diff options
author | Tony Lindgren <tony@atomide.com> | 2010-10-08 14:10:36 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-10-08 14:10:36 -0400 |
commit | a7c887510073b2f403e123f2befa40bf93554df9 (patch) | |
tree | afee0628d0688bb2460cfd4eb1ee4cc8281e925c | |
parent | 4415beb6fb519c4e98491666838494a8c46cc3ee (diff) | |
parent | 4367260c0bc1773c00b2309a31b31657cabfda3f (diff) |
Merge branch 'control_mcbsp_fix_2.6.37' of git://git.pwsan.com/linux-2.6 into omap-for-linus
44 files changed, 625 insertions, 444 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 2b79b84d0542..ab784bfde908 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -100,20 +100,20 @@ config MACH_OMAP2_TUSB6010 | |||
100 | 100 | ||
101 | config MACH_OMAP_H4 | 101 | config MACH_OMAP_H4 |
102 | bool "OMAP 2420 H4 board" | 102 | bool "OMAP 2420 H4 board" |
103 | depends on ARCH_OMAP2 | 103 | depends on ARCH_OMAP2420 |
104 | default y | 104 | default y |
105 | select OMAP_PACKAGE_ZAF | 105 | select OMAP_PACKAGE_ZAF |
106 | select OMAP_DEBUG_DEVICES | 106 | select OMAP_DEBUG_DEVICES |
107 | 107 | ||
108 | config MACH_OMAP_APOLLON | 108 | config MACH_OMAP_APOLLON |
109 | bool "OMAP 2420 Apollon board" | 109 | bool "OMAP 2420 Apollon board" |
110 | depends on ARCH_OMAP2 | 110 | depends on ARCH_OMAP2420 |
111 | default y | 111 | default y |
112 | select OMAP_PACKAGE_ZAC | 112 | select OMAP_PACKAGE_ZAC |
113 | 113 | ||
114 | config MACH_OMAP_2430SDP | 114 | config MACH_OMAP_2430SDP |
115 | bool "OMAP 2430 SDP board" | 115 | bool "OMAP 2430 SDP board" |
116 | depends on ARCH_OMAP2 | 116 | depends on ARCH_OMAP2430 |
117 | default y | 117 | default y |
118 | select OMAP_PACKAGE_ZAC | 118 | select OMAP_PACKAGE_ZAC |
119 | 119 | ||
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index d8b1de6f3f62..7352412e4917 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -3,7 +3,8 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o | 6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \ |
7 | common.o | ||
7 | 8 | ||
8 | omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o | 9 | omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o |
9 | hwmod-common = omap_hwmod.o \ | 10 | hwmod-common = omap_hwmod.o \ |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 9ba2ee246a75..88b5734d0bb2 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <plat/gpmc.h> | 39 | #include <plat/gpmc.h> |
40 | #include <plat/display.h> | 40 | #include <plat/display.h> |
41 | 41 | ||
42 | #include <plat/control.h> | ||
43 | #include <plat/gpmc-smc91x.h> | 42 | #include <plat/gpmc-smc91x.h> |
44 | 43 | ||
45 | #include "board-flash.h" | 44 | #include "board-flash.h" |
@@ -47,6 +46,7 @@ | |||
47 | #include "sdram-qimonda-hyb18m512160af-6.h" | 46 | #include "sdram-qimonda-hyb18m512160af-6.h" |
48 | #include "hsmmc.h" | 47 | #include "hsmmc.h" |
49 | #include "pm.h" | 48 | #include "pm.h" |
49 | #include "control.h" | ||
50 | 50 | ||
51 | #define CONFIG_DISABLE_HFCLK 1 | 51 | #define CONFIG_DISABLE_HFCLK 1 |
52 | 52 | ||
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 1d7d70ae7cb8..aafd30680fc8 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -32,12 +32,12 @@ | |||
32 | 32 | ||
33 | #include <plat/board.h> | 33 | #include <plat/board.h> |
34 | #include <plat/common.h> | 34 | #include <plat/common.h> |
35 | #include <plat/control.h> | ||
36 | #include <plat/usb.h> | 35 | #include <plat/usb.h> |
37 | #include <plat/mmc.h> | 36 | #include <plat/mmc.h> |
38 | 37 | ||
39 | #include "hsmmc.h" | 38 | #include "hsmmc.h" |
40 | #include "timer-gp.h" | 39 | #include "timer-gp.h" |
40 | #include "control.h" | ||
41 | 41 | ||
42 | #define ETH_KS8851_IRQ 34 | 42 | #define ETH_KS8851_IRQ 34 |
43 | #define ETH_KS8851_POWER_ON 48 | 43 | #define ETH_KS8851_POWER_ON 48 |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index b091741500de..fada04ea1d5c 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -32,11 +32,11 @@ | |||
32 | 32 | ||
33 | #include <plat/board.h> | 33 | #include <plat/board.h> |
34 | #include <plat/common.h> | 34 | #include <plat/common.h> |
35 | #include <plat/control.h> | ||
36 | #include <plat/usb.h> | 35 | #include <plat/usb.h> |
37 | #include <plat/display.h> | 36 | #include <plat/display.h> |
38 | 37 | ||
39 | #include "mux.h" | 38 | #include "mux.h" |
39 | #include "control.h" | ||
40 | 40 | ||
41 | #define AM35XX_EVM_PHY_MASK (0xF) | 41 | #define AM35XX_EVM_PHY_MASK (0xF) |
42 | #define AM35XX_EVM_MDIO_FREQUENCY (1000000) | 42 | #define AM35XX_EVM_MDIO_FREQUENCY (1000000) |
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index c6421a72514a..102719cb052b 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
@@ -39,9 +39,9 @@ | |||
39 | #include <plat/board.h> | 39 | #include <plat/board.h> |
40 | #include <plat/common.h> | 40 | #include <plat/common.h> |
41 | #include <plat/gpmc.h> | 41 | #include <plat/gpmc.h> |
42 | #include <plat/control.h> | ||
43 | 42 | ||
44 | #include "mux.h" | 43 | #include "mux.h" |
44 | #include "control.h" | ||
45 | 45 | ||
46 | /* LED & Switch macros */ | 46 | /* LED & Switch macros */ |
47 | #define LED0_GPIO13 13 | 47 | #define LED0_GPIO13 13 |
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c index 1115b8ab5e1d..c49319ff5c36 100644 --- a/arch/arm/mach-omap2/board-cm-t3517.c +++ b/arch/arm/mach-omap2/board-cm-t3517.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include <plat/board.h> | 41 | #include <plat/board.h> |
42 | #include <plat/common.h> | 42 | #include <plat/common.h> |
43 | #include <plat/control.h> | ||
44 | #include <plat/usb.h> | 43 | #include <plat/usb.h> |
45 | #include <plat/nand.h> | 44 | #include <plat/nand.h> |
46 | #include <plat/gpmc.h> | 45 | #include <plat/gpmc.h> |
@@ -48,6 +47,7 @@ | |||
48 | #include <mach/am35xx.h> | 47 | #include <mach/am35xx.h> |
49 | 48 | ||
50 | #include "mux.h" | 49 | #include "mux.h" |
50 | #include "control.h" | ||
51 | 51 | ||
52 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | 52 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
53 | static struct gpio_led cm_t3517_leds[] = { | 53 | static struct gpio_led cm_t3517_leds[] = { |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 3482b99e8c86..8aee862b625a 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -48,10 +48,22 @@ static void __init omap_generic_init(void) | |||
48 | 48 | ||
49 | static void __init omap_generic_map_io(void) | 49 | static void __init omap_generic_map_io(void) |
50 | { | 50 | { |
51 | omap2_set_globals_242x(); /* should be 242x, 243x, or 343x */ | 51 | if (cpu_is_omap242x()) { |
52 | omap242x_map_common_io(); | 52 | omap2_set_globals_242x(); |
53 | omap242x_map_common_io(); | ||
54 | } else if (cpu_is_omap243x()) { | ||
55 | omap2_set_globals_243x(); | ||
56 | omap243x_map_common_io(); | ||
57 | } else if (cpu_is_omap34xx()) { | ||
58 | omap2_set_globals_3xxx(); | ||
59 | omap34xx_map_common_io(); | ||
60 | } else if (cpu_is_omap44xx()) { | ||
61 | omap2_set_globals_443x(); | ||
62 | omap44xx_map_common_io(); | ||
63 | } | ||
53 | } | 64 | } |
54 | 65 | ||
66 | /* XXX This machine entry name should be updated */ | ||
55 | MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") | 67 | MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") |
56 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ | 68 | /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ |
57 | .phys_io = 0x48000000, | 69 | .phys_io = 0x48000000, |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index e09bd686389f..08492a34d310 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
32 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
33 | 33 | ||
34 | #include <plat/control.h> | ||
35 | #include <mach/gpio.h> | 34 | #include <mach/gpio.h> |
36 | #include <plat/usb.h> | 35 | #include <plat/usb.h> |
37 | #include <plat/board.h> | 36 | #include <plat/board.h> |
@@ -42,6 +41,7 @@ | |||
42 | #include <plat/gpmc.h> | 41 | #include <plat/gpmc.h> |
43 | 42 | ||
44 | #include "mux.h" | 43 | #include "mux.h" |
44 | #include "control.h" | ||
45 | 45 | ||
46 | #define H4_FLASH_CS 0 | 46 | #define H4_FLASH_CS 0 |
47 | #define H4_SMC91X_CS 1 | 47 | #define H4_SMC91X_CS 1 |
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 7c1e6ad3972e..8495f37d2756 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -42,12 +42,12 @@ | |||
42 | #include <mach/board-zoom.h> | 42 | #include <mach/board-zoom.h> |
43 | 43 | ||
44 | #include <asm/delay.h> | 44 | #include <asm/delay.h> |
45 | #include <plat/control.h> | ||
46 | #include <plat/usb.h> | 45 | #include <plat/usb.h> |
47 | 46 | ||
48 | #include "board-flash.h" | 47 | #include "board-flash.h" |
49 | #include "mux.h" | 48 | #include "mux.h" |
50 | #include "hsmmc.h" | 49 | #include "hsmmc.h" |
50 | #include "control.h" | ||
51 | 51 | ||
52 | #define LDP_SMSC911X_CS 1 | 52 | #define LDP_SMSC911X_CS 1 |
53 | #define LDP_SMSC911X_GPIO 152 | 53 | #define LDP_SMSC911X_GPIO 152 |
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c index 3151cf269a59..44ff6744ef59 100644 --- a/arch/arm/mach-omap2/board-omap3logic.c +++ b/arch/arm/mach-omap2/board-omap3logic.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "mux.h" | 36 | #include "mux.h" |
37 | #include "hsmmc.h" | 37 | #include "hsmmc.h" |
38 | #include "timer-gp.h" | 38 | #include "timer-gp.h" |
39 | #include "control.h" | ||
39 | 40 | ||
40 | #include <plat/mux.h> | 41 | #include <plat/mux.h> |
41 | #include <plat/board.h> | 42 | #include <plat/board.h> |
@@ -43,7 +44,6 @@ | |||
43 | #include <plat/gpmc-smsc911x.h> | 44 | #include <plat/gpmc-smsc911x.h> |
44 | #include <plat/gpmc.h> | 45 | #include <plat/gpmc.h> |
45 | #include <plat/sdrc.h> | 46 | #include <plat/sdrc.h> |
46 | #include <plat/control.h> | ||
47 | 47 | ||
48 | #define OMAP3LOGIC_SMSC911X_CS 1 | 48 | #define OMAP3LOGIC_SMSC911X_CS 1 |
49 | 49 | ||
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 5eb1a77bf0e5..a9d8a19ada7e 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -34,12 +34,12 @@ | |||
34 | 34 | ||
35 | #include <plat/board.h> | 35 | #include <plat/board.h> |
36 | #include <plat/common.h> | 36 | #include <plat/common.h> |
37 | #include <plat/control.h> | ||
38 | #include <plat/usb.h> | 37 | #include <plat/usb.h> |
39 | #include <plat/mmc.h> | 38 | #include <plat/mmc.h> |
40 | #include "hsmmc.h" | ||
41 | #include "timer-gp.h" | 39 | #include "timer-gp.h" |
42 | 40 | ||
41 | #include "hsmmc.h" | ||
42 | #include "control.h" | ||
43 | 43 | ||
44 | #define GPIO_HUB_POWER 1 | 44 | #define GPIO_HUB_POWER 1 |
45 | #define GPIO_HUB_NRESET 62 | 45 | #define GPIO_HUB_NRESET 62 |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 605f531783a8..b5babf5440e4 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -395,7 +395,7 @@ void omap2_clk_disable_unused(struct clk *clk) | |||
395 | if ((regval32 & (1 << clk->enable_bit)) == v) | 395 | if ((regval32 & (1 << clk->enable_bit)) == v) |
396 | return; | 396 | return; |
397 | 397 | ||
398 | printk(KERN_DEBUG "Disabling unused clock \"%s\"\n", clk->name); | 398 | pr_debug("Disabling unused clock \"%s\"\n", clk->name); |
399 | if (cpu_is_omap34xx()) { | 399 | if (cpu_is_omap34xx()) { |
400 | omap2_clk_enable(clk); | 400 | omap2_clk_enable(clk); |
401 | omap2_clk_disable(clk); | 401 | omap2_clk_disable(clk); |
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c index 5f2066a6ba74..21f856252ad8 100644 --- a/arch/arm/mach-omap2/clock2420_data.c +++ b/arch/arm/mach-omap2/clock2420_data.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "prm-regbits-24xx.h" | 27 | #include "prm-regbits-24xx.h" |
28 | #include "cm-regbits-24xx.h" | 28 | #include "cm-regbits-24xx.h" |
29 | #include "sdrc.h" | 29 | #include "sdrc.h" |
30 | #include "control.h" | ||
30 | 31 | ||
31 | #define OMAP_CM_REGADDR OMAP2420_CM_REGADDR | 32 | #define OMAP_CM_REGADDR OMAP2420_CM_REGADDR |
32 | 33 | ||
@@ -89,6 +90,12 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ | |||
89 | .clkdm_name = "wkup_clkdm", | 90 | .clkdm_name = "wkup_clkdm", |
90 | }; | 91 | }; |
91 | 92 | ||
93 | /* Optional external clock input for McBSP CLKS */ | ||
94 | static struct clk mcbsp_clks = { | ||
95 | .name = "mcbsp_clks", | ||
96 | .ops = &clkops_null, | ||
97 | }; | ||
98 | |||
92 | /* | 99 | /* |
93 | * Analog domain root source clocks | 100 | * Analog domain root source clocks |
94 | */ | 101 | */ |
@@ -1135,14 +1142,34 @@ static struct clk mcbsp1_ick = { | |||
1135 | .recalc = &followparent_recalc, | 1142 | .recalc = &followparent_recalc, |
1136 | }; | 1143 | }; |
1137 | 1144 | ||
1145 | static const struct clksel_rate common_mcbsp_96m_rates[] = { | ||
1146 | { .div = 1, .val = 0, .flags = RATE_IN_24XX }, | ||
1147 | { .div = 0 } | ||
1148 | }; | ||
1149 | |||
1150 | static const struct clksel_rate common_mcbsp_mcbsp_rates[] = { | ||
1151 | { .div = 1, .val = 1, .flags = RATE_IN_24XX }, | ||
1152 | { .div = 0 } | ||
1153 | }; | ||
1154 | |||
1155 | static const struct clksel mcbsp_fck_clksel[] = { | ||
1156 | { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates }, | ||
1157 | { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, | ||
1158 | { .parent = NULL } | ||
1159 | }; | ||
1160 | |||
1138 | static struct clk mcbsp1_fck = { | 1161 | static struct clk mcbsp1_fck = { |
1139 | .name = "mcbsp1_fck", | 1162 | .name = "mcbsp1_fck", |
1140 | .ops = &clkops_omap2_dflt_wait, | 1163 | .ops = &clkops_omap2_dflt_wait, |
1141 | .parent = &func_96m_ck, | 1164 | .parent = &func_96m_ck, |
1165 | .init = &omap2_init_clksel_parent, | ||
1142 | .clkdm_name = "core_l4_clkdm", | 1166 | .clkdm_name = "core_l4_clkdm", |
1143 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1167 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1144 | .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, | 1168 | .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, |
1145 | .recalc = &followparent_recalc, | 1169 | .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), |
1170 | .clksel_mask = OMAP2_MCBSP1_CLKS_MASK, | ||
1171 | .clksel = mcbsp_fck_clksel, | ||
1172 | .recalc = &omap2_clksel_recalc, | ||
1146 | }; | 1173 | }; |
1147 | 1174 | ||
1148 | static struct clk mcbsp2_ick = { | 1175 | static struct clk mcbsp2_ick = { |
@@ -1159,10 +1186,14 @@ static struct clk mcbsp2_fck = { | |||
1159 | .name = "mcbsp2_fck", | 1186 | .name = "mcbsp2_fck", |
1160 | .ops = &clkops_omap2_dflt_wait, | 1187 | .ops = &clkops_omap2_dflt_wait, |
1161 | .parent = &func_96m_ck, | 1188 | .parent = &func_96m_ck, |
1189 | .init = &omap2_init_clksel_parent, | ||
1162 | .clkdm_name = "core_l4_clkdm", | 1190 | .clkdm_name = "core_l4_clkdm", |
1163 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1191 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1164 | .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, | 1192 | .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, |
1165 | .recalc = &followparent_recalc, | 1193 | .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), |
1194 | .clksel_mask = OMAP2_MCBSP2_CLKS_MASK, | ||
1195 | .clksel = mcbsp_fck_clksel, | ||
1196 | .recalc = &omap2_clksel_recalc, | ||
1166 | }; | 1197 | }; |
1167 | 1198 | ||
1168 | static struct clk mcspi1_ick = { | 1199 | static struct clk mcspi1_ick = { |
@@ -1721,6 +1752,9 @@ static struct omap_clk omap2420_clks[] = { | |||
1721 | CLK(NULL, "osc_ck", &osc_ck, CK_242X), | 1752 | CLK(NULL, "osc_ck", &osc_ck, CK_242X), |
1722 | CLK(NULL, "sys_ck", &sys_ck, CK_242X), | 1753 | CLK(NULL, "sys_ck", &sys_ck, CK_242X), |
1723 | CLK(NULL, "alt_ck", &alt_ck, CK_242X), | 1754 | CLK(NULL, "alt_ck", &alt_ck, CK_242X), |
1755 | CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_242X), | ||
1756 | CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_242X), | ||
1757 | CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X), | ||
1724 | /* internal analog sources */ | 1758 | /* internal analog sources */ |
1725 | CLK(NULL, "dpll_ck", &dpll_ck, CK_242X), | 1759 | CLK(NULL, "dpll_ck", &dpll_ck, CK_242X), |
1726 | CLK(NULL, "apll96_ck", &apll96_ck, CK_242X), | 1760 | CLK(NULL, "apll96_ck", &apll96_ck, CK_242X), |
@@ -1728,6 +1762,8 @@ static struct omap_clk omap2420_clks[] = { | |||
1728 | /* internal prcm root sources */ | 1762 | /* internal prcm root sources */ |
1729 | CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X), | 1763 | CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X), |
1730 | CLK(NULL, "core_ck", &core_ck, CK_242X), | 1764 | CLK(NULL, "core_ck", &core_ck, CK_242X), |
1765 | CLK("omap-mcbsp.1", "prcm_fck", &func_96m_ck, CK_242X), | ||
1766 | CLK("omap-mcbsp.2", "prcm_fck", &func_96m_ck, CK_242X), | ||
1731 | CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X), | 1767 | CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X), |
1732 | CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X), | 1768 | CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X), |
1733 | CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X), | 1769 | CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X), |
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c index 701a1716019e..e32afcbdfb88 100644 --- a/arch/arm/mach-omap2/clock2430_data.c +++ b/arch/arm/mach-omap2/clock2430_data.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "prm-regbits-24xx.h" | 27 | #include "prm-regbits-24xx.h" |
28 | #include "cm-regbits-24xx.h" | 28 | #include "cm-regbits-24xx.h" |
29 | #include "sdrc.h" | 29 | #include "sdrc.h" |
30 | #include "control.h" | ||
30 | 31 | ||
31 | #define OMAP_CM_REGADDR OMAP2430_CM_REGADDR | 32 | #define OMAP_CM_REGADDR OMAP2430_CM_REGADDR |
32 | 33 | ||
@@ -89,6 +90,12 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ | |||
89 | .clkdm_name = "wkup_clkdm", | 90 | .clkdm_name = "wkup_clkdm", |
90 | }; | 91 | }; |
91 | 92 | ||
93 | /* Optional external clock input for McBSP CLKS */ | ||
94 | static struct clk mcbsp_clks = { | ||
95 | .name = "mcbsp_clks", | ||
96 | .ops = &clkops_null, | ||
97 | }; | ||
98 | |||
92 | /* | 99 | /* |
93 | * Analog domain root source clocks | 100 | * Analog domain root source clocks |
94 | */ | 101 | */ |
@@ -1123,14 +1130,34 @@ static struct clk mcbsp1_ick = { | |||
1123 | .recalc = &followparent_recalc, | 1130 | .recalc = &followparent_recalc, |
1124 | }; | 1131 | }; |
1125 | 1132 | ||
1133 | static const struct clksel_rate common_mcbsp_96m_rates[] = { | ||
1134 | { .div = 1, .val = 0, .flags = RATE_IN_24XX }, | ||
1135 | { .div = 0 } | ||
1136 | }; | ||
1137 | |||
1138 | static const struct clksel_rate common_mcbsp_mcbsp_rates[] = { | ||
1139 | { .div = 1, .val = 1, .flags = RATE_IN_24XX }, | ||
1140 | { .div = 0 } | ||
1141 | }; | ||
1142 | |||
1143 | static const struct clksel mcbsp_fck_clksel[] = { | ||
1144 | { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates }, | ||
1145 | { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, | ||
1146 | { .parent = NULL } | ||
1147 | }; | ||
1148 | |||
1126 | static struct clk mcbsp1_fck = { | 1149 | static struct clk mcbsp1_fck = { |
1127 | .name = "mcbsp1_fck", | 1150 | .name = "mcbsp1_fck", |
1128 | .ops = &clkops_omap2_dflt_wait, | 1151 | .ops = &clkops_omap2_dflt_wait, |
1129 | .parent = &func_96m_ck, | 1152 | .parent = &func_96m_ck, |
1153 | .init = &omap2_init_clksel_parent, | ||
1130 | .clkdm_name = "core_l4_clkdm", | 1154 | .clkdm_name = "core_l4_clkdm", |
1131 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1155 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1132 | .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, | 1156 | .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, |
1133 | .recalc = &followparent_recalc, | 1157 | .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), |
1158 | .clksel_mask = OMAP2_MCBSP1_CLKS_MASK, | ||
1159 | .clksel = mcbsp_fck_clksel, | ||
1160 | .recalc = &omap2_clksel_recalc, | ||
1134 | }; | 1161 | }; |
1135 | 1162 | ||
1136 | static struct clk mcbsp2_ick = { | 1163 | static struct clk mcbsp2_ick = { |
@@ -1147,10 +1174,14 @@ static struct clk mcbsp2_fck = { | |||
1147 | .name = "mcbsp2_fck", | 1174 | .name = "mcbsp2_fck", |
1148 | .ops = &clkops_omap2_dflt_wait, | 1175 | .ops = &clkops_omap2_dflt_wait, |
1149 | .parent = &func_96m_ck, | 1176 | .parent = &func_96m_ck, |
1177 | .init = &omap2_init_clksel_parent, | ||
1150 | .clkdm_name = "core_l4_clkdm", | 1178 | .clkdm_name = "core_l4_clkdm", |
1151 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1179 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1152 | .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, | 1180 | .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, |
1153 | .recalc = &followparent_recalc, | 1181 | .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), |
1182 | .clksel_mask = OMAP2_MCBSP2_CLKS_MASK, | ||
1183 | .clksel = mcbsp_fck_clksel, | ||
1184 | .recalc = &omap2_clksel_recalc, | ||
1154 | }; | 1185 | }; |
1155 | 1186 | ||
1156 | static struct clk mcbsp3_ick = { | 1187 | static struct clk mcbsp3_ick = { |
@@ -1167,10 +1198,14 @@ static struct clk mcbsp3_fck = { | |||
1167 | .name = "mcbsp3_fck", | 1198 | .name = "mcbsp3_fck", |
1168 | .ops = &clkops_omap2_dflt_wait, | 1199 | .ops = &clkops_omap2_dflt_wait, |
1169 | .parent = &func_96m_ck, | 1200 | .parent = &func_96m_ck, |
1201 | .init = &omap2_init_clksel_parent, | ||
1170 | .clkdm_name = "core_l4_clkdm", | 1202 | .clkdm_name = "core_l4_clkdm", |
1171 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | 1203 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), |
1172 | .enable_bit = OMAP2430_EN_MCBSP3_SHIFT, | 1204 | .enable_bit = OMAP2430_EN_MCBSP3_SHIFT, |
1173 | .recalc = &followparent_recalc, | 1205 | .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1), |
1206 | .clksel_mask = OMAP2_MCBSP3_CLKS_MASK, | ||
1207 | .clksel = mcbsp_fck_clksel, | ||
1208 | .recalc = &omap2_clksel_recalc, | ||
1174 | }; | 1209 | }; |
1175 | 1210 | ||
1176 | static struct clk mcbsp4_ick = { | 1211 | static struct clk mcbsp4_ick = { |
@@ -1187,10 +1222,14 @@ static struct clk mcbsp4_fck = { | |||
1187 | .name = "mcbsp4_fck", | 1222 | .name = "mcbsp4_fck", |
1188 | .ops = &clkops_omap2_dflt_wait, | 1223 | .ops = &clkops_omap2_dflt_wait, |
1189 | .parent = &func_96m_ck, | 1224 | .parent = &func_96m_ck, |
1225 | .init = &omap2_init_clksel_parent, | ||
1190 | .clkdm_name = "core_l4_clkdm", | 1226 | .clkdm_name = "core_l4_clkdm", |
1191 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | 1227 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), |
1192 | .enable_bit = OMAP2430_EN_MCBSP4_SHIFT, | 1228 | .enable_bit = OMAP2430_EN_MCBSP4_SHIFT, |
1193 | .recalc = &followparent_recalc, | 1229 | .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1), |
1230 | .clksel_mask = OMAP2_MCBSP4_CLKS_MASK, | ||
1231 | .clksel = mcbsp_fck_clksel, | ||
1232 | .recalc = &omap2_clksel_recalc, | ||
1194 | }; | 1233 | }; |
1195 | 1234 | ||
1196 | static struct clk mcbsp5_ick = { | 1235 | static struct clk mcbsp5_ick = { |
@@ -1207,10 +1246,14 @@ static struct clk mcbsp5_fck = { | |||
1207 | .name = "mcbsp5_fck", | 1246 | .name = "mcbsp5_fck", |
1208 | .ops = &clkops_omap2_dflt_wait, | 1247 | .ops = &clkops_omap2_dflt_wait, |
1209 | .parent = &func_96m_ck, | 1248 | .parent = &func_96m_ck, |
1249 | .init = &omap2_init_clksel_parent, | ||
1210 | .clkdm_name = "core_l4_clkdm", | 1250 | .clkdm_name = "core_l4_clkdm", |
1211 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), | 1251 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), |
1212 | .enable_bit = OMAP2430_EN_MCBSP5_SHIFT, | 1252 | .enable_bit = OMAP2430_EN_MCBSP5_SHIFT, |
1213 | .recalc = &followparent_recalc, | 1253 | .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1), |
1254 | .clksel_mask = OMAP2_MCBSP5_CLKS_MASK, | ||
1255 | .clksel = mcbsp_fck_clksel, | ||
1256 | .recalc = &omap2_clksel_recalc, | ||
1214 | }; | 1257 | }; |
1215 | 1258 | ||
1216 | static struct clk mcspi1_ick = { | 1259 | static struct clk mcspi1_ick = { |
@@ -1808,6 +1851,12 @@ static struct omap_clk omap2430_clks[] = { | |||
1808 | CLK(NULL, "osc_ck", &osc_ck, CK_243X), | 1851 | CLK(NULL, "osc_ck", &osc_ck, CK_243X), |
1809 | CLK(NULL, "sys_ck", &sys_ck, CK_243X), | 1852 | CLK(NULL, "sys_ck", &sys_ck, CK_243X), |
1810 | CLK(NULL, "alt_ck", &alt_ck, CK_243X), | 1853 | CLK(NULL, "alt_ck", &alt_ck, CK_243X), |
1854 | CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_243X), | ||
1855 | CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_243X), | ||
1856 | CLK("omap-mcbsp.3", "pad_fck", &mcbsp_clks, CK_243X), | ||
1857 | CLK("omap-mcbsp.4", "pad_fck", &mcbsp_clks, CK_243X), | ||
1858 | CLK("omap-mcbsp.5", "pad_fck", &mcbsp_clks, CK_243X), | ||
1859 | CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X), | ||
1811 | /* internal analog sources */ | 1860 | /* internal analog sources */ |
1812 | CLK(NULL, "dpll_ck", &dpll_ck, CK_243X), | 1861 | CLK(NULL, "dpll_ck", &dpll_ck, CK_243X), |
1813 | CLK(NULL, "apll96_ck", &apll96_ck, CK_243X), | 1862 | CLK(NULL, "apll96_ck", &apll96_ck, CK_243X), |
@@ -1815,6 +1864,11 @@ static struct omap_clk omap2430_clks[] = { | |||
1815 | /* internal prcm root sources */ | 1864 | /* internal prcm root sources */ |
1816 | CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X), | 1865 | CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X), |
1817 | CLK(NULL, "core_ck", &core_ck, CK_243X), | 1866 | CLK(NULL, "core_ck", &core_ck, CK_243X), |
1867 | CLK("omap-mcbsp.1", "prcm_fck", &func_96m_ck, CK_243X), | ||
1868 | CLK("omap-mcbsp.2", "prcm_fck", &func_96m_ck, CK_243X), | ||
1869 | CLK("omap-mcbsp.3", "prcm_fck", &func_96m_ck, CK_243X), | ||
1870 | CLK("omap-mcbsp.4", "prcm_fck", &func_96m_ck, CK_243X), | ||
1871 | CLK("omap-mcbsp.5", "prcm_fck", &func_96m_ck, CK_243X), | ||
1818 | CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X), | 1872 | CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X), |
1819 | CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X), | 1873 | CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X), |
1820 | CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X), | 1874 | CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X), |
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index ba01ec0cae45..d85ecd5aebfd 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | 22 | ||
23 | #include <plat/control.h> | ||
24 | #include <plat/clkdev_omap.h> | 23 | #include <plat/clkdev_omap.h> |
25 | 24 | ||
26 | #include "clock.h" | 25 | #include "clock.h" |
@@ -33,6 +32,7 @@ | |||
33 | #include "cm-regbits-34xx.h" | 32 | #include "cm-regbits-34xx.h" |
34 | #include "prm.h" | 33 | #include "prm.h" |
35 | #include "prm-regbits-34xx.h" | 34 | #include "prm-regbits-34xx.h" |
35 | #include "control.h" | ||
36 | 36 | ||
37 | /* | 37 | /* |
38 | * clocks | 38 | * clocks |
@@ -3208,6 +3208,11 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3208 | CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX), | 3208 | CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX), |
3209 | CLK(NULL, "sys_ck", &sys_ck, CK_3XXX), | 3209 | CLK(NULL, "sys_ck", &sys_ck, CK_3XXX), |
3210 | CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX), | 3210 | CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX), |
3211 | CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_3XXX), | ||
3212 | CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_3XXX), | ||
3213 | CLK("omap-mcbsp.3", "pad_fck", &mcbsp_clks, CK_3XXX), | ||
3214 | CLK("omap-mcbsp.4", "pad_fck", &mcbsp_clks, CK_3XXX), | ||
3215 | CLK("omap-mcbsp.5", "pad_fck", &mcbsp_clks, CK_3XXX), | ||
3211 | CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX), | 3216 | CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX), |
3212 | CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX), | 3217 | CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX), |
3213 | CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX), | 3218 | CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX), |
@@ -3273,6 +3278,8 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3273 | CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2 | CK_AM35XX), | 3278 | CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2 | CK_AM35XX), |
3274 | CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2 | CK_AM35XX), | 3279 | CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2 | CK_AM35XX), |
3275 | CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2 | CK_AM35XX), | 3280 | CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2 | CK_AM35XX), |
3281 | CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX), | ||
3282 | CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX), | ||
3276 | CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), | 3283 | CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), |
3277 | CLK("mmci-omap-hs.2", "fck", &mmchs3_fck, CK_3430ES2 | CK_AM35XX), | 3284 | CLK("mmci-omap-hs.2", "fck", &mmchs3_fck, CK_3430ES2 | CK_AM35XX), |
3278 | CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_3XXX), | 3285 | CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_3XXX), |
@@ -3366,6 +3373,9 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3366 | CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX), | 3373 | CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX), |
3367 | CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX), | 3374 | CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX), |
3368 | CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX), | 3375 | CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX), |
3376 | CLK("omap-mcbsp.2", "prcm_fck", &per_96m_fck, CK_3XXX), | ||
3377 | CLK("omap-mcbsp.3", "prcm_fck", &per_96m_fck, CK_3XXX), | ||
3378 | CLK("omap-mcbsp.4", "prcm_fck", &per_96m_fck, CK_3XXX), | ||
3369 | CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX), | 3379 | CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX), |
3370 | CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX), | 3380 | CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX), |
3371 | CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX), | 3381 | CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX), |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 67fac44cb6e6..1599836ba3d9 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/list.h> | 27 | #include <linux/list.h> |
28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
29 | #include <plat/control.h> | ||
30 | #include <plat/clkdev_omap.h> | 29 | #include <plat/clkdev_omap.h> |
31 | 30 | ||
32 | #include "clock.h" | 31 | #include "clock.h" |
@@ -35,6 +34,7 @@ | |||
35 | #include "cm-regbits-44xx.h" | 34 | #include "cm-regbits-44xx.h" |
36 | #include "prm.h" | 35 | #include "prm.h" |
37 | #include "prm-regbits-44xx.h" | 36 | #include "prm-regbits-44xx.h" |
37 | #include "control.h" | ||
38 | 38 | ||
39 | /* Root clocks */ | 39 | /* Root clocks */ |
40 | 40 | ||
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c new file mode 100644 index 000000000000..778929f7e92d --- /dev/null +++ b/arch/arm/mach-omap2/common.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap2/common.c | ||
3 | * | ||
4 | * Code common to all OMAP2+ machines. | ||
5 | * | ||
6 | * Copyright (C) 2009 Texas Instruments | ||
7 | * Copyright (C) 2010 Nokia Corporation | ||
8 | * Tony Lindgren <tony@atomide.com> | ||
9 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | #include <plat/common.h> | ||
21 | #include <plat/board.h> | ||
22 | #include <plat/mux.h> | ||
23 | |||
24 | #include <plat/clock.h> | ||
25 | |||
26 | #include "sdrc.h" | ||
27 | #include "control.h" | ||
28 | |||
29 | /* Global address base setup code */ | ||
30 | |||
31 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | ||
32 | |||
33 | static void __init __omap2_set_globals(struct omap_globals *omap2_globals) | ||
34 | { | ||
35 | omap2_set_globals_tap(omap2_globals); | ||
36 | omap2_set_globals_sdrc(omap2_globals); | ||
37 | omap2_set_globals_control(omap2_globals); | ||
38 | omap2_set_globals_prcm(omap2_globals); | ||
39 | } | ||
40 | |||
41 | #endif | ||
42 | |||
43 | #if defined(CONFIG_ARCH_OMAP2420) | ||
44 | |||
45 | static struct omap_globals omap242x_globals = { | ||
46 | .class = OMAP242X_CLASS, | ||
47 | .tap = OMAP2_L4_IO_ADDRESS(0x48014000), | ||
48 | .sdrc = OMAP2420_SDRC_BASE, | ||
49 | .sms = OMAP2420_SMS_BASE, | ||
50 | .ctrl = OMAP242X_CTRL_BASE, | ||
51 | .prm = OMAP2420_PRM_BASE, | ||
52 | .cm = OMAP2420_CM_BASE, | ||
53 | .uart1_phys = OMAP2_UART1_BASE, | ||
54 | .uart2_phys = OMAP2_UART2_BASE, | ||
55 | .uart3_phys = OMAP2_UART3_BASE, | ||
56 | }; | ||
57 | |||
58 | void __init omap2_set_globals_242x(void) | ||
59 | { | ||
60 | __omap2_set_globals(&omap242x_globals); | ||
61 | } | ||
62 | #endif | ||
63 | |||
64 | #if defined(CONFIG_ARCH_OMAP2430) | ||
65 | |||
66 | static struct omap_globals omap243x_globals = { | ||
67 | .class = OMAP243X_CLASS, | ||
68 | .tap = OMAP2_L4_IO_ADDRESS(0x4900a000), | ||
69 | .sdrc = OMAP243X_SDRC_BASE, | ||
70 | .sms = OMAP243X_SMS_BASE, | ||
71 | .ctrl = OMAP243X_CTRL_BASE, | ||
72 | .prm = OMAP2430_PRM_BASE, | ||
73 | .cm = OMAP2430_CM_BASE, | ||
74 | .uart1_phys = OMAP2_UART1_BASE, | ||
75 | .uart2_phys = OMAP2_UART2_BASE, | ||
76 | .uart3_phys = OMAP2_UART3_BASE, | ||
77 | }; | ||
78 | |||
79 | void __init omap2_set_globals_243x(void) | ||
80 | { | ||
81 | __omap2_set_globals(&omap243x_globals); | ||
82 | } | ||
83 | #endif | ||
84 | |||
85 | #if defined(CONFIG_ARCH_OMAP3) | ||
86 | |||
87 | static struct omap_globals omap3_globals = { | ||
88 | .class = OMAP343X_CLASS, | ||
89 | .tap = OMAP2_L4_IO_ADDRESS(0x4830A000), | ||
90 | .sdrc = OMAP343X_SDRC_BASE, | ||
91 | .sms = OMAP343X_SMS_BASE, | ||
92 | .ctrl = OMAP343X_CTRL_BASE, | ||
93 | .prm = OMAP3430_PRM_BASE, | ||
94 | .cm = OMAP3430_CM_BASE, | ||
95 | .uart1_phys = OMAP3_UART1_BASE, | ||
96 | .uart2_phys = OMAP3_UART2_BASE, | ||
97 | .uart3_phys = OMAP3_UART3_BASE, | ||
98 | .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */ | ||
99 | }; | ||
100 | |||
101 | void __init omap2_set_globals_3xxx(void) | ||
102 | { | ||
103 | __omap2_set_globals(&omap3_globals); | ||
104 | } | ||
105 | |||
106 | void __init omap3_map_io(void) | ||
107 | { | ||
108 | omap2_set_globals_3xxx(); | ||
109 | omap34xx_map_common_io(); | ||
110 | } | ||
111 | #endif | ||
112 | |||
113 | #if defined(CONFIG_ARCH_OMAP4) | ||
114 | static struct omap_globals omap4_globals = { | ||
115 | .class = OMAP443X_CLASS, | ||
116 | .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), | ||
117 | .ctrl = OMAP443X_SCM_BASE, | ||
118 | .ctrl_pad = OMAP443X_CTRL_BASE, | ||
119 | .prm = OMAP4430_PRM_BASE, | ||
120 | .cm = OMAP4430_CM_BASE, | ||
121 | .cm2 = OMAP4430_CM2_BASE, | ||
122 | .uart1_phys = OMAP4_UART1_BASE, | ||
123 | .uart2_phys = OMAP4_UART2_BASE, | ||
124 | .uart3_phys = OMAP4_UART3_BASE, | ||
125 | .uart4_phys = OMAP4_UART4_BASE, | ||
126 | }; | ||
127 | |||
128 | void __init omap2_set_globals_443x(void) | ||
129 | { | ||
130 | omap2_set_globals_tap(&omap4_globals); | ||
131 | omap2_set_globals_control(&omap4_globals); | ||
132 | omap2_set_globals_prcm(&omap4_globals); | ||
133 | } | ||
134 | #endif | ||
135 | |||
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 5d9b30dd6e56..1fa3294b6048 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c | |||
@@ -16,14 +16,15 @@ | |||
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | 17 | ||
18 | #include <plat/common.h> | 18 | #include <plat/common.h> |
19 | #include <plat/control.h> | ||
20 | #include <plat/sdrc.h> | 19 | #include <plat/sdrc.h> |
20 | |||
21 | #include "cm-regbits-34xx.h" | 21 | #include "cm-regbits-34xx.h" |
22 | #include "prm-regbits-34xx.h" | 22 | #include "prm-regbits-34xx.h" |
23 | #include "cm.h" | 23 | #include "cm.h" |
24 | #include "prm.h" | 24 | #include "prm.h" |
25 | #include "sdrc.h" | 25 | #include "sdrc.h" |
26 | #include "pm.h" | 26 | #include "pm.h" |
27 | #include "control.h" | ||
27 | 28 | ||
28 | static void __iomem *omap2_ctrl_base; | 29 | static void __iomem *omap2_ctrl_base; |
29 | static void __iomem *omap4_ctrl_pad_base; | 30 | static void __iomem *omap4_ctrl_pad_base; |
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/mach-omap2/control.h index 19c9b2a82046..b6c6b7c450b3 100644 --- a/arch/arm/plat-omap/include/plat/control.h +++ b/arch/arm/mach-omap2/control.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/plat-omap/include/mach/control.h | 2 | * arch/arm/mach-omap2/control.h |
3 | * | 3 | * |
4 | * OMAP2/3/4 System Control Module definitions | 4 | * OMAP2/3/4 System Control Module definitions |
5 | * | 5 | * |
6 | * Copyright (C) 2007-2009 Texas Instruments, Inc. | 6 | * Copyright (C) 2007-2010 Texas Instruments, Inc. |
7 | * Copyright (C) 2007-2008 Nokia Corporation | 7 | * Copyright (C) 2007-2008, 2010 Nokia Corporation |
8 | * | 8 | * |
9 | * Written by Paul Walmsley | 9 | * Written by Paul Walmsley |
10 | * | 10 | * |
@@ -13,8 +13,8 @@ | |||
13 | * the Free Software Foundation. | 13 | * the Free Software Foundation. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __ASM_ARCH_CONTROL_H | 16 | #ifndef __ARCH_ARM_MACH_OMAP2_CONTROL_H |
17 | #define __ASM_ARCH_CONTROL_H | 17 | #define __ARCH_ARM_MACH_OMAP2_CONTROL_H |
18 | 18 | ||
19 | #include <mach/io.h> | 19 | #include <mach/io.h> |
20 | #include <mach/ctrl_module_core_44xx.h> | 20 | #include <mach/ctrl_module_core_44xx.h> |
@@ -223,6 +223,8 @@ | |||
223 | #define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */ | 223 | #define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */ |
224 | #define OMAP24XX_USBSTANDBYCTRL (1 << 15) | 224 | #define OMAP24XX_USBSTANDBYCTRL (1 << 15) |
225 | #define OMAP2_MCBSP2_CLKS_MASK (1 << 6) | 225 | #define OMAP2_MCBSP2_CLKS_MASK (1 << 6) |
226 | #define OMAP2_MCBSP1_FSR_MASK (1 << 4) | ||
227 | #define OMAP2_MCBSP1_CLKR_MASK (1 << 3) | ||
226 | #define OMAP2_MCBSP1_CLKS_MASK (1 << 2) | 228 | #define OMAP2_MCBSP1_CLKS_MASK (1 << 2) |
227 | 229 | ||
228 | /* CONTROL_DEVCONF1 bits */ | 230 | /* CONTROL_DEVCONF1 bits */ |
@@ -319,12 +321,12 @@ | |||
319 | #define FEAT_L2CACHE_256KB 3 | 321 | #define FEAT_L2CACHE_256KB 3 |
320 | 322 | ||
321 | #define OMAP3_ISP_SHIFT 5 | 323 | #define OMAP3_ISP_SHIFT 5 |
322 | #define OMAP3_ISP_MASK (1<< OMAP3_ISP_SHIFT) | 324 | #define OMAP3_ISP_MASK (1 << OMAP3_ISP_SHIFT) |
323 | #define FEAT_ISP 0 | 325 | #define FEAT_ISP 0 |
324 | #define FEAT_ISP_NONE 1 | 326 | #define FEAT_ISP_NONE 1 |
325 | 327 | ||
326 | #define OMAP3_NEON_SHIFT 4 | 328 | #define OMAP3_NEON_SHIFT 4 |
327 | #define OMAP3_NEON_MASK (1<< OMAP3_NEON_SHIFT) | 329 | #define OMAP3_NEON_MASK (1 << OMAP3_NEON_SHIFT) |
328 | #define FEAT_NEON 0 | 330 | #define FEAT_NEON 0 |
329 | #define FEAT_NEON_NONE 1 | 331 | #define FEAT_NEON_NONE 1 |
330 | 332 | ||
@@ -362,5 +364,5 @@ extern void omap3_control_restore_context(void); | |||
362 | #endif | 364 | #endif |
363 | #endif /* __ASSEMBLY__ */ | 365 | #endif /* __ASSEMBLY__ */ |
364 | 366 | ||
365 | #endif /* __ASM_ARCH_CONTROL_H */ | 367 | #endif /* __ARCH_ARM_MACH_OMAP2_CONTROL_H */ |
366 | 368 | ||
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 703b5ec88e98..0d50b45d041c 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
@@ -29,10 +29,10 @@ | |||
29 | #include <plat/irqs.h> | 29 | #include <plat/irqs.h> |
30 | #include <plat/powerdomain.h> | 30 | #include <plat/powerdomain.h> |
31 | #include <plat/clockdomain.h> | 31 | #include <plat/clockdomain.h> |
32 | #include <plat/control.h> | ||
33 | #include <plat/serial.h> | 32 | #include <plat/serial.h> |
34 | 33 | ||
35 | #include "pm.h" | 34 | #include "pm.h" |
35 | #include "control.h" | ||
36 | 36 | ||
37 | #ifdef CONFIG_CPU_IDLE | 37 | #ifdef CONFIG_CPU_IDLE |
38 | 38 | ||
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 818452ac905d..eaf37994403b 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
@@ -23,7 +22,6 @@ | |||
23 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
24 | #include <asm/pmu.h> | 23 | #include <asm/pmu.h> |
25 | 24 | ||
26 | #include <plat/control.h> | ||
27 | #include <plat/tc.h> | 25 | #include <plat/tc.h> |
28 | #include <plat/board.h> | 26 | #include <plat/board.h> |
29 | #include <mach/gpio.h> | 27 | #include <mach/gpio.h> |
@@ -33,6 +31,7 @@ | |||
33 | #include <plat/omap_device.h> | 31 | #include <plat/omap_device.h> |
34 | 32 | ||
35 | #include "mux.h" | 33 | #include "mux.h" |
34 | #include "control.h" | ||
36 | 35 | ||
37 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) | 36 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) |
38 | 37 | ||
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index ab78a5a8d9b0..34272e4863fd 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c | |||
@@ -14,11 +14,11 @@ | |||
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <mach/hardware.h> | 16 | #include <mach/hardware.h> |
17 | #include <plat/control.h> | ||
18 | #include <plat/mmc.h> | 17 | #include <plat/mmc.h> |
19 | #include <plat/omap-pm.h> | 18 | #include <plat/omap-pm.h> |
20 | 19 | ||
21 | #include "hsmmc.h" | 20 | #include "hsmmc.h" |
21 | #include "control.h" | ||
22 | 22 | ||
23 | #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | 23 | #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) |
24 | 24 | ||
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 04a2fa240bc3..5f9086c65e48 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
@@ -22,11 +22,12 @@ | |||
22 | #include <asm/cputype.h> | 22 | #include <asm/cputype.h> |
23 | 23 | ||
24 | #include <plat/common.h> | 24 | #include <plat/common.h> |
25 | #include <plat/control.h> | ||
26 | #include <plat/cpu.h> | 25 | #include <plat/cpu.h> |
27 | 26 | ||
28 | #include <mach/id.h> | 27 | #include <mach/id.h> |
29 | 28 | ||
29 | #include "control.h" | ||
30 | |||
30 | static struct omap_chip_id omap_chip; | 31 | static struct omap_chip_id omap_chip; |
31 | static unsigned int omap_revision; | 32 | static unsigned int omap_revision; |
32 | 33 | ||
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 88b8790e4fec..f9c9df5b5ff1 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -23,6 +23,86 @@ | |||
23 | #include <plat/cpu.h> | 23 | #include <plat/cpu.h> |
24 | #include <plat/mcbsp.h> | 24 | #include <plat/mcbsp.h> |
25 | 25 | ||
26 | #include "control.h" | ||
27 | |||
28 | |||
29 | /* McBSP internal signal muxing functions */ | ||
30 | |||
31 | void omap2_mcbsp1_mux_clkr_src(u8 mux) | ||
32 | { | ||
33 | u32 v; | ||
34 | |||
35 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
36 | if (mux == CLKR_SRC_CLKR) | ||
37 | v &= ~OMAP2_MCBSP1_CLKR_MASK; | ||
38 | else if (mux == CLKR_SRC_CLKX) | ||
39 | v |= OMAP2_MCBSP1_CLKR_MASK; | ||
40 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
41 | } | ||
42 | EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src); | ||
43 | |||
44 | void omap2_mcbsp1_mux_fsr_src(u8 mux) | ||
45 | { | ||
46 | u32 v; | ||
47 | |||
48 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
49 | if (mux == FSR_SRC_FSR) | ||
50 | v &= ~OMAP2_MCBSP1_FSR_MASK; | ||
51 | else if (mux == FSR_SRC_FSX) | ||
52 | v |= OMAP2_MCBSP1_FSR_MASK; | ||
53 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
54 | } | ||
55 | EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src); | ||
56 | |||
57 | /* McBSP CLKS source switching function */ | ||
58 | |||
59 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) | ||
60 | { | ||
61 | struct omap_mcbsp *mcbsp; | ||
62 | struct clk *fck_src; | ||
63 | char *fck_src_name; | ||
64 | int r; | ||
65 | |||
66 | if (!omap_mcbsp_check_valid_id(id)) { | ||
67 | pr_err("%s: Invalid id (%d)\n", __func__, id + 1); | ||
68 | return -EINVAL; | ||
69 | } | ||
70 | mcbsp = id_to_mcbsp_ptr(id); | ||
71 | |||
72 | if (fck_src_id == MCBSP_CLKS_PAD_SRC) | ||
73 | fck_src_name = "pad_fck"; | ||
74 | else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) | ||
75 | fck_src_name = "prcm_fck"; | ||
76 | else | ||
77 | return -EINVAL; | ||
78 | |||
79 | fck_src = clk_get(mcbsp->dev, fck_src_name); | ||
80 | if (IS_ERR_OR_NULL(fck_src)) { | ||
81 | pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks", | ||
82 | fck_src_name); | ||
83 | return -EINVAL; | ||
84 | } | ||
85 | |||
86 | clk_disable(mcbsp->fclk); | ||
87 | |||
88 | r = clk_set_parent(mcbsp->fclk, fck_src); | ||
89 | if (IS_ERR_VALUE(r)) { | ||
90 | pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n", | ||
91 | "clks", fck_src_name); | ||
92 | clk_put(fck_src); | ||
93 | return -EINVAL; | ||
94 | } | ||
95 | |||
96 | clk_enable(mcbsp->fclk); | ||
97 | |||
98 | clk_put(fck_src); | ||
99 | |||
100 | return 0; | ||
101 | } | ||
102 | EXPORT_SYMBOL(omap2_mcbsp_set_clks_src); | ||
103 | |||
104 | |||
105 | /* Platform data */ | ||
26 | 106 | ||
27 | #ifdef CONFIG_ARCH_OMAP2420 | 107 | #ifdef CONFIG_ARCH_OMAP2420 |
28 | static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | 108 | static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index e33740c091be..074536ae401f 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -23,12 +23,11 @@ | |||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | #include <linux/module.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/slab.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/slab.h> | ||
32 | #include <linux/ctype.h> | 31 | #include <linux/ctype.h> |
33 | #include <linux/debugfs.h> | 32 | #include <linux/debugfs.h> |
34 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
@@ -36,8 +35,7 @@ | |||
36 | 35 | ||
37 | #include <asm/system.h> | 36 | #include <asm/system.h> |
38 | 37 | ||
39 | #include <plat/control.h> | 38 | #include "control.h" |
40 | |||
41 | #include "mux.h" | 39 | #include "mux.h" |
42 | 40 | ||
43 | #define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */ | 41 | #define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */ |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index f5c7ef955942..a40457d81927 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <mach/irqs.h> | 38 | #include <mach/irqs.h> |
39 | #include <plat/clock.h> | 39 | #include <plat/clock.h> |
40 | #include <plat/sram.h> | 40 | #include <plat/sram.h> |
41 | #include <plat/control.h> | ||
42 | #include <plat/dma.h> | 41 | #include <plat/dma.h> |
43 | #include <plat/board.h> | 42 | #include <plat/board.h> |
44 | 43 | ||
@@ -48,6 +47,7 @@ | |||
48 | #include "cm-regbits-24xx.h" | 47 | #include "cm-regbits-24xx.h" |
49 | #include "sdrc.h" | 48 | #include "sdrc.h" |
50 | #include "pm.h" | 49 | #include "pm.h" |
50 | #include "control.h" | ||
51 | 51 | ||
52 | #include <plat/powerdomain.h> | 52 | #include <plat/powerdomain.h> |
53 | #include <plat/clockdomain.h> | 53 | #include <plat/clockdomain.h> |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index e57c9aeeefe0..8c8f1acd3526 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <plat/sram.h> | 32 | #include <plat/sram.h> |
33 | #include <plat/clockdomain.h> | 33 | #include <plat/clockdomain.h> |
34 | #include <plat/powerdomain.h> | 34 | #include <plat/powerdomain.h> |
35 | #include <plat/control.h> | ||
36 | #include <plat/serial.h> | 35 | #include <plat/serial.h> |
37 | #include <plat/sdrc.h> | 36 | #include <plat/sdrc.h> |
38 | #include <plat/prcm.h> | 37 | #include <plat/prcm.h> |
@@ -48,6 +47,7 @@ | |||
48 | #include "prm.h" | 47 | #include "prm.h" |
49 | #include "pm.h" | 48 | #include "pm.h" |
50 | #include "sdrc.h" | 49 | #include "sdrc.h" |
50 | #include "control.h" | ||
51 | 51 | ||
52 | /* Scratchpad offsets */ | 52 | /* Scratchpad offsets */ |
53 | #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31 | 53 | #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31 |
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index a48a1e24f42b..a51846e3a6fa 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <plat/common.h> | 26 | #include <plat/common.h> |
27 | #include <plat/prcm.h> | 27 | #include <plat/prcm.h> |
28 | #include <plat/irqs.h> | 28 | #include <plat/irqs.h> |
29 | #include <plat/control.h> | ||
30 | 29 | ||
31 | #include "clock.h" | 30 | #include "clock.h" |
32 | #include "clock2xxx.h" | 31 | #include "clock2xxx.h" |
@@ -34,6 +33,7 @@ | |||
34 | #include "prm.h" | 33 | #include "prm.h" |
35 | #include "prm-regbits-24xx.h" | 34 | #include "prm-regbits-24xx.h" |
36 | #include "prm-regbits-44xx.h" | 35 | #include "prm-regbits-44xx.h" |
36 | #include "control.h" | ||
37 | 37 | ||
38 | static void __iomem *prm_base; | 38 | static void __iomem *prm_base; |
39 | static void __iomem *cm_base; | 39 | static void __iomem *cm_base; |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 0bcc9df0c034..338e46a844a4 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <plat/common.h> | 35 | #include <plat/common.h> |
36 | #include <plat/board.h> | 36 | #include <plat/board.h> |
37 | #include <plat/clock.h> | 37 | #include <plat/clock.h> |
38 | #include <plat/control.h> | ||
39 | #include <plat/dma.h> | 38 | #include <plat/dma.h> |
40 | #include <plat/omap_hwmod.h> | 39 | #include <plat/omap_hwmod.h> |
41 | #include <plat/omap_device.h> | 40 | #include <plat/omap_device.h> |
@@ -44,6 +43,7 @@ | |||
44 | #include "pm.h" | 43 | #include "pm.h" |
45 | #include "cm.h" | 44 | #include "cm.h" |
46 | #include "prm-regbits-34xx.h" | 45 | #include "prm-regbits-34xx.h" |
46 | #include "control.h" | ||
47 | 47 | ||
48 | #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52 | 48 | #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52 |
49 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ | 49 | #define UART_OMAP_WER 0x17 /* Wake-up enable register */ |
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index ba53191ae4c5..2fb205a7f285 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S | |||
@@ -27,11 +27,11 @@ | |||
27 | #include <linux/linkage.h> | 27 | #include <linux/linkage.h> |
28 | #include <asm/assembler.h> | 28 | #include <asm/assembler.h> |
29 | #include <mach/io.h> | 29 | #include <mach/io.h> |
30 | #include <plat/control.h> | ||
31 | 30 | ||
32 | #include "cm.h" | 31 | #include "cm.h" |
33 | #include "prm.h" | 32 | #include "prm.h" |
34 | #include "sdrc.h" | 33 | #include "sdrc.h" |
34 | #include "control.h" | ||
35 | 35 | ||
36 | #define SDRC_SCRATCHPAD_SEM_V 0xfa00291c | 36 | #define SDRC_SCRATCHPAD_SEM_V 0xfa00291c |
37 | 37 | ||
diff --git a/arch/arm/mach-omap2/usb-fs.c b/arch/arm/mach-omap2/usb-fs.c index a216d88b04b5..1481078763b8 100644 --- a/arch/arm/mach-omap2/usb-fs.c +++ b/arch/arm/mach-omap2/usb-fs.c | |||
@@ -29,18 +29,18 @@ | |||
29 | 29 | ||
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | 31 | ||
32 | #include <plat/control.h> | ||
33 | #include <plat/usb.h> | 32 | #include <plat/usb.h> |
34 | #include <plat/board.h> | 33 | #include <plat/board.h> |
35 | 34 | ||
35 | #include "control.h" | ||
36 | #include "mux.h" | ||
37 | |||
36 | #define INT_USB_IRQ_GEN INT_24XX_USB_IRQ_GEN | 38 | #define INT_USB_IRQ_GEN INT_24XX_USB_IRQ_GEN |
37 | #define INT_USB_IRQ_NISO INT_24XX_USB_IRQ_NISO | 39 | #define INT_USB_IRQ_NISO INT_24XX_USB_IRQ_NISO |
38 | #define INT_USB_IRQ_ISO INT_24XX_USB_IRQ_ISO | 40 | #define INT_USB_IRQ_ISO INT_24XX_USB_IRQ_ISO |
39 | #define INT_USB_IRQ_HGEN INT_24XX_USB_IRQ_HGEN | 41 | #define INT_USB_IRQ_HGEN INT_24XX_USB_IRQ_HGEN |
40 | #define INT_USB_IRQ_OTG INT_24XX_USB_IRQ_OTG | 42 | #define INT_USB_IRQ_OTG INT_24XX_USB_IRQ_OTG |
41 | 43 | ||
42 | #include "mux.h" | ||
43 | |||
44 | #if defined(CONFIG_ARCH_OMAP2) | 44 | #if defined(CONFIG_ARCH_OMAP2) |
45 | 45 | ||
46 | #ifdef CONFIG_USB_GADGET_OMAP | 46 | #ifdef CONFIG_USB_GADGET_OMAP |
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index 2a151917ef52..a4a12859fdd5 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \ | 6 | obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \ |
7 | usb.o fb.o io.o | 7 | usb.o fb.o io.o counter_32k.o |
8 | obj-m := | 8 | obj-m := |
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 7190cbd92620..fc62fb5fc20b 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -60,7 +60,7 @@ void clk_disable(struct clk *clk) | |||
60 | 60 | ||
61 | spin_lock_irqsave(&clockfw_lock, flags); | 61 | spin_lock_irqsave(&clockfw_lock, flags); |
62 | if (clk->usecount == 0) { | 62 | if (clk->usecount == 0) { |
63 | printk(KERN_ERR "Trying disable clock %s with 0 usecount\n", | 63 | pr_err("Trying disable clock %s with 0 usecount\n", |
64 | clk->name); | 64 | clk->name); |
65 | WARN_ON(1); | 65 | WARN_ON(1); |
66 | goto out; | 66 | goto out; |
@@ -397,6 +397,7 @@ static int __init clk_disable_unused(void) | |||
397 | struct clk *ck; | 397 | struct clk *ck; |
398 | unsigned long flags; | 398 | unsigned long flags; |
399 | 399 | ||
400 | pr_info("clock: disabling unused clocks to save power\n"); | ||
400 | list_for_each_entry(ck, &clocks, node) { | 401 | list_for_each_entry(ck, &clocks, node) { |
401 | if (ck->ops == &clkops_null) | 402 | if (ck->ops == &clkops_null) |
402 | continue; | 403 | continue; |
@@ -418,7 +419,7 @@ late_initcall(clk_disable_unused); | |||
418 | int __init clk_init(struct clk_functions * custom_clocks) | 419 | int __init clk_init(struct clk_functions * custom_clocks) |
419 | { | 420 | { |
420 | if (!custom_clocks) { | 421 | if (!custom_clocks) { |
421 | printk(KERN_ERR "No custom clock functions registered\n"); | 422 | pr_err("No custom clock functions registered\n"); |
422 | BUG(); | 423 | BUG(); |
423 | } | 424 | } |
424 | 425 | ||
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 947de3fb93f3..221a675ebbae 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
@@ -11,38 +11,15 @@ | |||
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/delay.h> | ||
18 | #include <linux/console.h> | ||
19 | #include <linux/serial.h> | ||
20 | #include <linux/tty.h> | ||
21 | #include <linux/serial_8250.h> | ||
22 | #include <linux/serial_reg.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/io.h> | 16 | #include <linux/io.h> |
25 | #include <linux/omapfb.h> | 17 | #include <linux/omapfb.h> |
26 | 18 | ||
27 | #include <mach/hardware.h> | ||
28 | #include <asm/system.h> | ||
29 | #include <asm/pgtable.h> | ||
30 | #include <asm/mach/map.h> | ||
31 | #include <asm/setup.h> | ||
32 | |||
33 | #include <plat/common.h> | 19 | #include <plat/common.h> |
34 | #include <plat/board.h> | 20 | #include <plat/board.h> |
35 | #include <plat/control.h> | ||
36 | #include <plat/mux.h> | ||
37 | #include <plat/fpga.h> | ||
38 | #include <plat/serial.h> | ||
39 | #include <plat/vram.h> | 21 | #include <plat/vram.h> |
40 | 22 | ||
41 | #include <plat/clock.h> | ||
42 | |||
43 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | ||
44 | # include "../mach-omap2/sdrc.h" | ||
45 | #endif | ||
46 | 23 | ||
47 | #define NO_LENGTH_CHECK 0xffffffff | 24 | #define NO_LENGTH_CHECK 0xffffffff |
48 | 25 | ||
@@ -88,255 +65,3 @@ void __init omap_reserve(void) | |||
88 | omapfb_reserve_sdram_memblock(); | 65 | omapfb_reserve_sdram_memblock(); |
89 | omap_vram_reserve_sdram_memblock(); | 66 | omap_vram_reserve_sdram_memblock(); |
90 | } | 67 | } |
91 | |||
92 | /* | ||
93 | * 32KHz clocksource ... always available, on pretty most chips except | ||
94 | * OMAP 730 and 1510. Other timers could be used as clocksources, with | ||
95 | * higher resolution in free-running counter modes (e.g. 12 MHz xtal), | ||
96 | * but systems won't necessarily want to spend resources that way. | ||
97 | */ | ||
98 | |||
99 | #define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410 | ||
100 | |||
101 | #if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) | ||
102 | |||
103 | #include <linux/clocksource.h> | ||
104 | |||
105 | /* | ||
106 | * offset_32k holds the init time counter value. It is then subtracted | ||
107 | * from every counter read to achieve a counter that counts time from the | ||
108 | * kernel boot (needed for sched_clock()). | ||
109 | */ | ||
110 | static u32 offset_32k __read_mostly; | ||
111 | |||
112 | #ifdef CONFIG_ARCH_OMAP16XX | ||
113 | static cycle_t omap16xx_32k_read(struct clocksource *cs) | ||
114 | { | ||
115 | return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k; | ||
116 | } | ||
117 | #else | ||
118 | #define omap16xx_32k_read NULL | ||
119 | #endif | ||
120 | |||
121 | #ifdef CONFIG_ARCH_OMAP2420 | ||
122 | static cycle_t omap2420_32k_read(struct clocksource *cs) | ||
123 | { | ||
124 | return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k; | ||
125 | } | ||
126 | #else | ||
127 | #define omap2420_32k_read NULL | ||
128 | #endif | ||
129 | |||
130 | #ifdef CONFIG_ARCH_OMAP2430 | ||
131 | static cycle_t omap2430_32k_read(struct clocksource *cs) | ||
132 | { | ||
133 | return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k; | ||
134 | } | ||
135 | #else | ||
136 | #define omap2430_32k_read NULL | ||
137 | #endif | ||
138 | |||
139 | #ifdef CONFIG_ARCH_OMAP3 | ||
140 | static cycle_t omap34xx_32k_read(struct clocksource *cs) | ||
141 | { | ||
142 | return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k; | ||
143 | } | ||
144 | #else | ||
145 | #define omap34xx_32k_read NULL | ||
146 | #endif | ||
147 | |||
148 | #ifdef CONFIG_ARCH_OMAP4 | ||
149 | static cycle_t omap44xx_32k_read(struct clocksource *cs) | ||
150 | { | ||
151 | return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k; | ||
152 | } | ||
153 | #else | ||
154 | #define omap44xx_32k_read NULL | ||
155 | #endif | ||
156 | |||
157 | /* | ||
158 | * Kernel assumes that sched_clock can be called early but may not have | ||
159 | * things ready yet. | ||
160 | */ | ||
161 | static cycle_t omap_32k_read_dummy(struct clocksource *cs) | ||
162 | { | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static struct clocksource clocksource_32k = { | ||
167 | .name = "32k_counter", | ||
168 | .rating = 250, | ||
169 | .read = omap_32k_read_dummy, | ||
170 | .mask = CLOCKSOURCE_MASK(32), | ||
171 | .shift = 10, | ||
172 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
173 | }; | ||
174 | |||
175 | /* | ||
176 | * Returns current time from boot in nsecs. It's OK for this to wrap | ||
177 | * around for now, as it's just a relative time stamp. | ||
178 | */ | ||
179 | unsigned long long sched_clock(void) | ||
180 | { | ||
181 | return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k), | ||
182 | clocksource_32k.mult, clocksource_32k.shift); | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * read_persistent_clock - Return time from a persistent clock. | ||
187 | * | ||
188 | * Reads the time from a source which isn't disabled during PM, the | ||
189 | * 32k sync timer. Convert the cycles elapsed since last read into | ||
190 | * nsecs and adds to a monotonically increasing timespec. | ||
191 | */ | ||
192 | static struct timespec persistent_ts; | ||
193 | static cycles_t cycles, last_cycles; | ||
194 | void read_persistent_clock(struct timespec *ts) | ||
195 | { | ||
196 | unsigned long long nsecs; | ||
197 | cycles_t delta; | ||
198 | struct timespec *tsp = &persistent_ts; | ||
199 | |||
200 | last_cycles = cycles; | ||
201 | cycles = clocksource_32k.read(&clocksource_32k); | ||
202 | delta = cycles - last_cycles; | ||
203 | |||
204 | nsecs = clocksource_cyc2ns(delta, | ||
205 | clocksource_32k.mult, clocksource_32k.shift); | ||
206 | |||
207 | timespec_add_ns(tsp, nsecs); | ||
208 | *ts = *tsp; | ||
209 | } | ||
210 | |||
211 | static int __init omap_init_clocksource_32k(void) | ||
212 | { | ||
213 | static char err[] __initdata = KERN_ERR | ||
214 | "%s: can't register clocksource!\n"; | ||
215 | |||
216 | if (cpu_is_omap16xx() || cpu_class_is_omap2()) { | ||
217 | struct clk *sync_32k_ick; | ||
218 | |||
219 | if (cpu_is_omap16xx()) | ||
220 | clocksource_32k.read = omap16xx_32k_read; | ||
221 | else if (cpu_is_omap2420()) | ||
222 | clocksource_32k.read = omap2420_32k_read; | ||
223 | else if (cpu_is_omap2430()) | ||
224 | clocksource_32k.read = omap2430_32k_read; | ||
225 | else if (cpu_is_omap34xx()) | ||
226 | clocksource_32k.read = omap34xx_32k_read; | ||
227 | else if (cpu_is_omap44xx()) | ||
228 | clocksource_32k.read = omap44xx_32k_read; | ||
229 | else | ||
230 | return -ENODEV; | ||
231 | |||
232 | sync_32k_ick = clk_get(NULL, "omap_32ksync_ick"); | ||
233 | if (sync_32k_ick) | ||
234 | clk_enable(sync_32k_ick); | ||
235 | |||
236 | clocksource_32k.mult = clocksource_hz2mult(32768, | ||
237 | clocksource_32k.shift); | ||
238 | |||
239 | offset_32k = clocksource_32k.read(&clocksource_32k); | ||
240 | |||
241 | if (clocksource_register(&clocksource_32k)) | ||
242 | printk(err, clocksource_32k.name); | ||
243 | } | ||
244 | return 0; | ||
245 | } | ||
246 | arch_initcall(omap_init_clocksource_32k); | ||
247 | |||
248 | #endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */ | ||
249 | |||
250 | /* Global address base setup code */ | ||
251 | |||
252 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | ||
253 | |||
254 | static void __init __omap2_set_globals(struct omap_globals *omap2_globals) | ||
255 | { | ||
256 | omap2_set_globals_tap(omap2_globals); | ||
257 | omap2_set_globals_sdrc(omap2_globals); | ||
258 | omap2_set_globals_control(omap2_globals); | ||
259 | omap2_set_globals_prcm(omap2_globals); | ||
260 | } | ||
261 | |||
262 | #endif | ||
263 | |||
264 | #if defined(CONFIG_ARCH_OMAP2420) | ||
265 | |||
266 | static struct omap_globals omap242x_globals = { | ||
267 | .class = OMAP242X_CLASS, | ||
268 | .tap = OMAP2_L4_IO_ADDRESS(0x48014000), | ||
269 | .sdrc = OMAP2420_SDRC_BASE, | ||
270 | .sms = OMAP2420_SMS_BASE, | ||
271 | .ctrl = OMAP2420_CTRL_BASE, | ||
272 | .prm = OMAP2420_PRM_BASE, | ||
273 | .cm = OMAP2420_CM_BASE, | ||
274 | }; | ||
275 | |||
276 | void __init omap2_set_globals_242x(void) | ||
277 | { | ||
278 | __omap2_set_globals(&omap242x_globals); | ||
279 | } | ||
280 | #endif | ||
281 | |||
282 | #if defined(CONFIG_ARCH_OMAP2430) | ||
283 | |||
284 | static struct omap_globals omap243x_globals = { | ||
285 | .class = OMAP243X_CLASS, | ||
286 | .tap = OMAP2_L4_IO_ADDRESS(0x4900a000), | ||
287 | .sdrc = OMAP243X_SDRC_BASE, | ||
288 | .sms = OMAP243X_SMS_BASE, | ||
289 | .ctrl = OMAP243X_CTRL_BASE, | ||
290 | .prm = OMAP2430_PRM_BASE, | ||
291 | .cm = OMAP2430_CM_BASE, | ||
292 | }; | ||
293 | |||
294 | void __init omap2_set_globals_243x(void) | ||
295 | { | ||
296 | __omap2_set_globals(&omap243x_globals); | ||
297 | } | ||
298 | #endif | ||
299 | |||
300 | #if defined(CONFIG_ARCH_OMAP3) | ||
301 | |||
302 | static struct omap_globals omap3_globals = { | ||
303 | .class = OMAP343X_CLASS, | ||
304 | .tap = OMAP2_L4_IO_ADDRESS(0x4830A000), | ||
305 | .sdrc = OMAP343X_SDRC_BASE, | ||
306 | .sms = OMAP343X_SMS_BASE, | ||
307 | .ctrl = OMAP343X_CTRL_BASE, | ||
308 | .prm = OMAP3430_PRM_BASE, | ||
309 | .cm = OMAP3430_CM_BASE, | ||
310 | }; | ||
311 | |||
312 | void __init omap2_set_globals_3xxx(void) | ||
313 | { | ||
314 | __omap2_set_globals(&omap3_globals); | ||
315 | } | ||
316 | |||
317 | void __init omap3_map_io(void) | ||
318 | { | ||
319 | omap2_set_globals_3xxx(); | ||
320 | omap34xx_map_common_io(); | ||
321 | } | ||
322 | #endif | ||
323 | |||
324 | #if defined(CONFIG_ARCH_OMAP4) | ||
325 | static struct omap_globals omap4_globals = { | ||
326 | .class = OMAP443X_CLASS, | ||
327 | .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), | ||
328 | .ctrl = OMAP443X_SCM_BASE, | ||
329 | .ctrl_pad = OMAP443X_CTRL_BASE, | ||
330 | .prm = OMAP4430_PRM_BASE, | ||
331 | .cm = OMAP4430_CM_BASE, | ||
332 | .cm2 = OMAP4430_CM2_BASE, | ||
333 | }; | ||
334 | |||
335 | void __init omap2_set_globals_443x(void) | ||
336 | { | ||
337 | omap2_set_globals_tap(&omap4_globals); | ||
338 | omap2_set_globals_control(&omap4_globals); | ||
339 | omap2_set_globals_prcm(&omap4_globals); | ||
340 | } | ||
341 | #endif | ||
342 | |||
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c new file mode 100644 index 000000000000..155fe43a672b --- /dev/null +++ b/arch/arm/plat-omap/counter_32k.c | |||
@@ -0,0 +1,183 @@ | |||
1 | /* | ||
2 | * OMAP 32ksynctimer/counter_32k-related code | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments | ||
5 | * Copyright (C) 2010 Nokia Corporation | ||
6 | * Tony Lindgren <tony@atomide.com> | ||
7 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * NOTE: This timer is not the same timer as the old OMAP1 MPU timer. | ||
14 | */ | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | #include <plat/common.h> | ||
21 | #include <plat/board.h> | ||
22 | |||
23 | #include <plat/clock.h> | ||
24 | |||
25 | |||
26 | /* | ||
27 | * 32KHz clocksource ... always available, on pretty most chips except | ||
28 | * OMAP 730 and 1510. Other timers could be used as clocksources, with | ||
29 | * higher resolution in free-running counter modes (e.g. 12 MHz xtal), | ||
30 | * but systems won't necessarily want to spend resources that way. | ||
31 | */ | ||
32 | |||
33 | #define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410 | ||
34 | |||
35 | #if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) | ||
36 | |||
37 | #include <linux/clocksource.h> | ||
38 | |||
39 | /* | ||
40 | * offset_32k holds the init time counter value. It is then subtracted | ||
41 | * from every counter read to achieve a counter that counts time from the | ||
42 | * kernel boot (needed for sched_clock()). | ||
43 | */ | ||
44 | static u32 offset_32k __read_mostly; | ||
45 | |||
46 | #ifdef CONFIG_ARCH_OMAP16XX | ||
47 | static cycle_t omap16xx_32k_read(struct clocksource *cs) | ||
48 | { | ||
49 | return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k; | ||
50 | } | ||
51 | #else | ||
52 | #define omap16xx_32k_read NULL | ||
53 | #endif | ||
54 | |||
55 | #ifdef CONFIG_ARCH_OMAP2420 | ||
56 | static cycle_t omap2420_32k_read(struct clocksource *cs) | ||
57 | { | ||
58 | return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k; | ||
59 | } | ||
60 | #else | ||
61 | #define omap2420_32k_read NULL | ||
62 | #endif | ||
63 | |||
64 | #ifdef CONFIG_ARCH_OMAP2430 | ||
65 | static cycle_t omap2430_32k_read(struct clocksource *cs) | ||
66 | { | ||
67 | return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k; | ||
68 | } | ||
69 | #else | ||
70 | #define omap2430_32k_read NULL | ||
71 | #endif | ||
72 | |||
73 | #ifdef CONFIG_ARCH_OMAP3 | ||
74 | static cycle_t omap34xx_32k_read(struct clocksource *cs) | ||
75 | { | ||
76 | return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k; | ||
77 | } | ||
78 | #else | ||
79 | #define omap34xx_32k_read NULL | ||
80 | #endif | ||
81 | |||
82 | #ifdef CONFIG_ARCH_OMAP4 | ||
83 | static cycle_t omap44xx_32k_read(struct clocksource *cs) | ||
84 | { | ||
85 | return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k; | ||
86 | } | ||
87 | #else | ||
88 | #define omap44xx_32k_read NULL | ||
89 | #endif | ||
90 | |||
91 | /* | ||
92 | * Kernel assumes that sched_clock can be called early but may not have | ||
93 | * things ready yet. | ||
94 | */ | ||
95 | static cycle_t omap_32k_read_dummy(struct clocksource *cs) | ||
96 | { | ||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static struct clocksource clocksource_32k = { | ||
101 | .name = "32k_counter", | ||
102 | .rating = 250, | ||
103 | .read = omap_32k_read_dummy, | ||
104 | .mask = CLOCKSOURCE_MASK(32), | ||
105 | .shift = 10, | ||
106 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
107 | }; | ||
108 | |||
109 | /* | ||
110 | * Returns current time from boot in nsecs. It's OK for this to wrap | ||
111 | * around for now, as it's just a relative time stamp. | ||
112 | */ | ||
113 | unsigned long long sched_clock(void) | ||
114 | { | ||
115 | return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k), | ||
116 | clocksource_32k.mult, clocksource_32k.shift); | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * read_persistent_clock - Return time from a persistent clock. | ||
121 | * | ||
122 | * Reads the time from a source which isn't disabled during PM, the | ||
123 | * 32k sync timer. Convert the cycles elapsed since last read into | ||
124 | * nsecs and adds to a monotonically increasing timespec. | ||
125 | */ | ||
126 | static struct timespec persistent_ts; | ||
127 | static cycles_t cycles, last_cycles; | ||
128 | void read_persistent_clock(struct timespec *ts) | ||
129 | { | ||
130 | unsigned long long nsecs; | ||
131 | cycles_t delta; | ||
132 | struct timespec *tsp = &persistent_ts; | ||
133 | |||
134 | last_cycles = cycles; | ||
135 | cycles = clocksource_32k.read(&clocksource_32k); | ||
136 | delta = cycles - last_cycles; | ||
137 | |||
138 | nsecs = clocksource_cyc2ns(delta, | ||
139 | clocksource_32k.mult, clocksource_32k.shift); | ||
140 | |||
141 | timespec_add_ns(tsp, nsecs); | ||
142 | *ts = *tsp; | ||
143 | } | ||
144 | |||
145 | static int __init omap_init_clocksource_32k(void) | ||
146 | { | ||
147 | static char err[] __initdata = KERN_ERR | ||
148 | "%s: can't register clocksource!\n"; | ||
149 | |||
150 | if (cpu_is_omap16xx() || cpu_class_is_omap2()) { | ||
151 | struct clk *sync_32k_ick; | ||
152 | |||
153 | if (cpu_is_omap16xx()) | ||
154 | clocksource_32k.read = omap16xx_32k_read; | ||
155 | else if (cpu_is_omap2420()) | ||
156 | clocksource_32k.read = omap2420_32k_read; | ||
157 | else if (cpu_is_omap2430()) | ||
158 | clocksource_32k.read = omap2430_32k_read; | ||
159 | else if (cpu_is_omap34xx()) | ||
160 | clocksource_32k.read = omap34xx_32k_read; | ||
161 | else if (cpu_is_omap44xx()) | ||
162 | clocksource_32k.read = omap44xx_32k_read; | ||
163 | else | ||
164 | return -ENODEV; | ||
165 | |||
166 | sync_32k_ick = clk_get(NULL, "omap_32ksync_ick"); | ||
167 | if (sync_32k_ick) | ||
168 | clk_enable(sync_32k_ick); | ||
169 | |||
170 | clocksource_32k.mult = clocksource_hz2mult(32768, | ||
171 | clocksource_32k.shift); | ||
172 | |||
173 | offset_32k = clocksource_32k.read(&clocksource_32k); | ||
174 | |||
175 | if (clocksource_register(&clocksource_32k)) | ||
176 | printk(err, clocksource_32k.name); | ||
177 | } | ||
178 | return 0; | ||
179 | } | ||
180 | arch_initcall(omap_init_clocksource_32k); | ||
181 | |||
182 | #endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */ | ||
183 | |||
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index 8e88e0e5d524..1e2383eae638 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <asm/mach/map.h> | 21 | #include <asm/mach/map.h> |
22 | 22 | ||
23 | #include <plat/tc.h> | 23 | #include <plat/tc.h> |
24 | #include <plat/control.h> | ||
25 | #include <plat/board.h> | 24 | #include <plat/board.h> |
26 | #include <plat/mmc.h> | 25 | #include <plat/mmc.h> |
27 | #include <mach/gpio.h> | 26 | #include <mach/gpio.h> |
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h index b4ff6a11a8f2..e19abf2c8fe7 100644 --- a/arch/arm/plat-omap/include/plat/mcbsp.h +++ b/arch/arm/plat-omap/include/plat/mcbsp.h | |||
@@ -312,6 +312,18 @@ | |||
312 | #define RFSREN 0x0002 | 312 | #define RFSREN 0x0002 |
313 | #define RSYNCERREN 0x0001 | 313 | #define RSYNCERREN 0x0001 |
314 | 314 | ||
315 | /* CLKR signal muxing options */ | ||
316 | #define CLKR_SRC_CLKR 0 | ||
317 | #define CLKR_SRC_CLKX 1 | ||
318 | |||
319 | /* FSR signal muxing options */ | ||
320 | #define FSR_SRC_FSR 0 | ||
321 | #define FSR_SRC_FSX 1 | ||
322 | |||
323 | /* McBSP functional clock sources */ | ||
324 | #define MCBSP_CLKS_PRCM_SRC 0 | ||
325 | #define MCBSP_CLKS_PAD_SRC 1 | ||
326 | |||
315 | /* we don't do multichannel for now */ | 327 | /* we don't do multichannel for now */ |
316 | struct omap_mcbsp_reg_cfg { | 328 | struct omap_mcbsp_reg_cfg { |
317 | u16 spcr2; | 329 | u16 spcr2; |
@@ -398,6 +410,7 @@ struct omap_mcbsp_spi_cfg { | |||
398 | struct omap_mcbsp_ops { | 410 | struct omap_mcbsp_ops { |
399 | void (*request)(unsigned int); | 411 | void (*request)(unsigned int); |
400 | void (*free)(unsigned int); | 412 | void (*free)(unsigned int); |
413 | int (*set_clks_src)(u8, u8); | ||
401 | }; | 414 | }; |
402 | 415 | ||
403 | struct omap_mcbsp_platform_data { | 416 | struct omap_mcbsp_platform_data { |
@@ -464,6 +477,9 @@ struct omap_mcbsp { | |||
464 | extern struct omap_mcbsp **mcbsp_ptr; | 477 | extern struct omap_mcbsp **mcbsp_ptr; |
465 | extern int omap_mcbsp_count, omap_mcbsp_cache_size; | 478 | extern int omap_mcbsp_count, omap_mcbsp_cache_size; |
466 | 479 | ||
480 | #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) | ||
481 | #define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; | ||
482 | |||
467 | int omap_mcbsp_init(void); | 483 | int omap_mcbsp_init(void); |
468 | void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, | 484 | void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, |
469 | int size); | 485 | int size); |
@@ -502,6 +518,8 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word); | |||
502 | int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word); | 518 | int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word); |
503 | 519 | ||
504 | 520 | ||
521 | /* McBSP functional clock source changing function */ | ||
522 | extern int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id); | ||
505 | /* SPI specific API */ | 523 | /* SPI specific API */ |
506 | void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg); | 524 | void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg); |
507 | 525 | ||
@@ -510,6 +528,10 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf); | |||
510 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf); | 528 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf); |
511 | int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); | 529 | int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); |
512 | 530 | ||
531 | /* McBSP signal muxing API */ | ||
532 | void omap2_mcbsp1_mux_clkr_src(u8 mux); | ||
533 | void omap2_mcbsp1_mux_fsr_src(u8 mux); | ||
534 | |||
513 | #ifdef CONFIG_ARCH_OMAP3 | 535 | #ifdef CONFIG_ARCH_OMAP3 |
514 | /* Sidetone specific API */ | 536 | /* Sidetone specific API */ |
515 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); | 537 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); |
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h index 0d6f076cf748..c8dae02f0704 100644 --- a/arch/arm/plat-omap/include/plat/omap-serial.h +++ b/arch/arm/plat-omap/include/plat/omap-serial.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/serial_core.h> | 20 | #include <linux/serial_core.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | 22 | ||
23 | #include <plat/control.h> | ||
24 | #include <plat/mux.h> | 23 | #include <plat/mux.h> |
25 | 24 | ||
26 | #define DRIVER_NAME "omap-hsuart" | 25 | #define DRIVER_NAME "omap-hsuart" |
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h index 7055672a8c68..92df9e27cc5c 100644 --- a/arch/arm/plat-omap/include/plat/omap24xx.h +++ b/arch/arm/plat-omap/include/plat/omap24xx.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000) | 40 | #define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000) |
41 | #define OMAP24XX_IVA_INTC_BASE 0x40000000 | 41 | #define OMAP24XX_IVA_INTC_BASE 0x40000000 |
42 | 42 | ||
43 | #define OMAP2420_CTRL_BASE L4_24XX_BASE | 43 | #define OMAP242X_CTRL_BASE L4_24XX_BASE |
44 | #define OMAP2420_32KSYNCT_BASE (L4_24XX_BASE + 0x4000) | 44 | #define OMAP2420_32KSYNCT_BASE (L4_24XX_BASE + 0x4000) |
45 | #define OMAP2420_PRCM_BASE (L4_24XX_BASE + 0x8000) | 45 | #define OMAP2420_PRCM_BASE (L4_24XX_BASE + 0x8000) |
46 | #define OMAP2420_CM_BASE (L4_24XX_BASE + 0x8000) | 46 | #define OMAP2420_CM_BASE (L4_24XX_BASE + 0x8000) |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index b2e046990d38..45d99e955f7f 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -80,9 +80,6 @@ static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg) | |||
80 | #define MCBSP_READ_CACHE(mcbsp, reg) \ | 80 | #define MCBSP_READ_CACHE(mcbsp, reg) \ |
81 | omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1) | 81 | omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1) |
82 | 82 | ||
83 | #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) | ||
84 | #define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; | ||
85 | |||
86 | #define MCBSP_ST_READ(mcbsp, reg) \ | 83 | #define MCBSP_ST_READ(mcbsp, reg) \ |
87 | omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg) | 84 | omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg) |
88 | #define MCBSP_ST_WRITE(mcbsp, reg, val) \ | 85 | #define MCBSP_ST_WRITE(mcbsp, reg, val) \ |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index dba5704b77db..c209163563b8 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -31,10 +31,8 @@ | |||
31 | #include <plat/cpu.h> | 31 | #include <plat/cpu.h> |
32 | #include <plat/vram.h> | 32 | #include <plat/vram.h> |
33 | 33 | ||
34 | #include <plat/control.h> | ||
35 | #include "sram.h" | 34 | #include "sram.h" |
36 | #include "fb.h" | 35 | #include "fb.h" |
37 | |||
38 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 36 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
39 | # include "../mach-omap2/prm.h" | 37 | # include "../mach-omap2/prm.h" |
40 | # include "../mach-omap2/cm.h" | 38 | # include "../mach-omap2/cm.h" |
@@ -71,7 +69,6 @@ | |||
71 | #define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858) | 69 | #define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858) |
72 | #define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880) | 70 | #define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880) |
73 | #define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048) | 71 | #define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048) |
74 | #define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0) | ||
75 | 72 | ||
76 | #define GP_DEVICE 0x300 | 73 | #define GP_DEVICE 0x300 |
77 | 74 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index f81e4f025f23..7f472a57490e 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -54,7 +54,6 @@ | |||
54 | 54 | ||
55 | #include <plat/dma.h> | 55 | #include <plat/dma.h> |
56 | #include <plat/usb.h> | 56 | #include <plat/usb.h> |
57 | #include <plat/control.h> | ||
58 | 57 | ||
59 | #include "omap_udc.h" | 58 | #include "omap_udc.h" |
60 | 59 | ||
@@ -2309,21 +2308,12 @@ static char *trx_mode(unsigned m, int enabled) | |||
2309 | static int proc_otg_show(struct seq_file *s) | 2308 | static int proc_otg_show(struct seq_file *s) |
2310 | { | 2309 | { |
2311 | u32 tmp; | 2310 | u32 tmp; |
2312 | u32 trans; | 2311 | u32 trans = 0; |
2313 | char *ctrl_name; | 2312 | char *ctrl_name = "(UNKNOWN)"; |
2314 | 2313 | ||
2314 | /* XXX This needs major revision for OMAP2+ */ | ||
2315 | tmp = omap_readl(OTG_REV); | 2315 | tmp = omap_readl(OTG_REV); |
2316 | if (cpu_is_omap24xx()) { | 2316 | if (cpu_class_is_omap1()) { |
2317 | /* | ||
2318 | * REVISIT: Not clear how this works on OMAP2. trans | ||
2319 | * is ANDed to produce bits 7 and 8, which might make | ||
2320 | * sense for USB_TRANSCEIVER_CTRL on OMAP1, | ||
2321 | * but with CONTROL_DEVCONF, these bits have something to | ||
2322 | * do with the frame adjustment counter and McBSP2. | ||
2323 | */ | ||
2324 | ctrl_name = "control_devconf"; | ||
2325 | trans = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
2326 | } else { | ||
2327 | ctrl_name = "tranceiver_ctrl"; | 2317 | ctrl_name = "tranceiver_ctrl"; |
2328 | trans = omap_readw(USB_TRANSCEIVER_CTRL); | 2318 | trans = omap_readw(USB_TRANSCEIVER_CTRL); |
2329 | } | 2319 | } |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 86f213905e2c..b59ad11466a9 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <sound/initval.h> | 31 | #include <sound/initval.h> |
32 | #include <sound/soc.h> | 32 | #include <sound/soc.h> |
33 | 33 | ||
34 | #include <plat/control.h> | ||
35 | #include <plat/dma.h> | 34 | #include <plat/dma.h> |
36 | #include <plat/mcbsp.h> | 35 | #include <plat/mcbsp.h> |
37 | #include "omap-mcbsp.h" | 36 | #include "omap-mcbsp.h" |
@@ -608,93 +607,6 @@ static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai, | |||
608 | return 0; | 607 | return 0; |
609 | } | 608 | } |
610 | 609 | ||
611 | static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data, | ||
612 | int clk_id) | ||
613 | { | ||
614 | int sel_bit; | ||
615 | u16 reg, reg_devconf1 = OMAP243X_CONTROL_DEVCONF1; | ||
616 | |||
617 | if (cpu_class_is_omap1()) { | ||
618 | /* OMAP1's can use only external source clock */ | ||
619 | if (unlikely(clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK)) | ||
620 | return -EINVAL; | ||
621 | else | ||
622 | return 0; | ||
623 | } | ||
624 | |||
625 | if (cpu_is_omap2420() && mcbsp_data->bus_id > 1) | ||
626 | return -EINVAL; | ||
627 | |||
628 | if (cpu_is_omap343x()) | ||
629 | reg_devconf1 = OMAP343X_CONTROL_DEVCONF1; | ||
630 | |||
631 | switch (mcbsp_data->bus_id) { | ||
632 | case 0: | ||
633 | reg = OMAP2_CONTROL_DEVCONF0; | ||
634 | sel_bit = 2; | ||
635 | break; | ||
636 | case 1: | ||
637 | reg = OMAP2_CONTROL_DEVCONF0; | ||
638 | sel_bit = 6; | ||
639 | break; | ||
640 | case 2: | ||
641 | reg = reg_devconf1; | ||
642 | sel_bit = 0; | ||
643 | break; | ||
644 | case 3: | ||
645 | reg = reg_devconf1; | ||
646 | sel_bit = 2; | ||
647 | break; | ||
648 | case 4: | ||
649 | reg = reg_devconf1; | ||
650 | sel_bit = 4; | ||
651 | break; | ||
652 | default: | ||
653 | return -EINVAL; | ||
654 | } | ||
655 | |||
656 | if (clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK) | ||
657 | omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg); | ||
658 | else | ||
659 | omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg); | ||
660 | |||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data *mcbsp_data, | ||
665 | int clk_id) | ||
666 | { | ||
667 | int sel_bit, set = 0; | ||
668 | u16 reg = OMAP2_CONTROL_DEVCONF0; | ||
669 | |||
670 | if (cpu_class_is_omap1()) | ||
671 | return -EINVAL; /* TODO: Can this be implemented for OMAP1? */ | ||
672 | if (mcbsp_data->bus_id != 0) | ||
673 | return -EINVAL; | ||
674 | |||
675 | switch (clk_id) { | ||
676 | case OMAP_MCBSP_CLKR_SRC_CLKX: | ||
677 | set = 1; | ||
678 | case OMAP_MCBSP_CLKR_SRC_CLKR: | ||
679 | sel_bit = 3; | ||
680 | break; | ||
681 | case OMAP_MCBSP_FSR_SRC_FSX: | ||
682 | set = 1; | ||
683 | case OMAP_MCBSP_FSR_SRC_FSR: | ||
684 | sel_bit = 4; | ||
685 | break; | ||
686 | default: | ||
687 | return -EINVAL; | ||
688 | } | ||
689 | |||
690 | if (set) | ||
691 | omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg); | ||
692 | else | ||
693 | omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg); | ||
694 | |||
695 | return 0; | ||
696 | } | ||
697 | |||
698 | static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | 610 | static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, |
699 | int clk_id, unsigned int freq, | 611 | int clk_id, unsigned int freq, |
700 | int dir) | 612 | int dir) |
@@ -703,6 +615,14 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
703 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 615 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
704 | int err = 0; | 616 | int err = 0; |
705 | 617 | ||
618 | /* The McBSP signal muxing functions are only available on McBSP1 */ | ||
619 | if (clk_id == OMAP_MCBSP_CLKR_SRC_CLKR || | ||
620 | clk_id == OMAP_MCBSP_CLKR_SRC_CLKX || | ||
621 | clk_id == OMAP_MCBSP_FSR_SRC_FSR || | ||
622 | clk_id == OMAP_MCBSP_FSR_SRC_FSX) | ||
623 | if (cpu_class_is_omap1() || mcbsp_data->bus_id != 0) | ||
624 | return -EINVAL; | ||
625 | |||
706 | mcbsp_data->in_freq = freq; | 626 | mcbsp_data->in_freq = freq; |
707 | 627 | ||
708 | switch (clk_id) { | 628 | switch (clk_id) { |
@@ -710,8 +630,20 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
710 | regs->srgr2 |= CLKSM; | 630 | regs->srgr2 |= CLKSM; |
711 | break; | 631 | break; |
712 | case OMAP_MCBSP_SYSCLK_CLKS_FCLK: | 632 | case OMAP_MCBSP_SYSCLK_CLKS_FCLK: |
633 | if (cpu_class_is_omap1()) { | ||
634 | err = -EINVAL; | ||
635 | break; | ||
636 | } | ||
637 | err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id, | ||
638 | MCBSP_CLKS_PRCM_SRC); | ||
639 | break; | ||
713 | case OMAP_MCBSP_SYSCLK_CLKS_EXT: | 640 | case OMAP_MCBSP_SYSCLK_CLKS_EXT: |
714 | err = omap_mcbsp_dai_set_clks_src(mcbsp_data, clk_id); | 641 | if (cpu_class_is_omap1()) { |
642 | err = 0; | ||
643 | break; | ||
644 | } | ||
645 | err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id, | ||
646 | MCBSP_CLKS_PAD_SRC); | ||
715 | break; | 647 | break; |
716 | 648 | ||
717 | case OMAP_MCBSP_SYSCLK_CLKX_EXT: | 649 | case OMAP_MCBSP_SYSCLK_CLKX_EXT: |
@@ -720,11 +652,18 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
720 | regs->pcr0 |= SCLKME; | 652 | regs->pcr0 |= SCLKME; |
721 | break; | 653 | break; |
722 | 654 | ||
655 | |||
723 | case OMAP_MCBSP_CLKR_SRC_CLKR: | 656 | case OMAP_MCBSP_CLKR_SRC_CLKR: |
657 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); | ||
658 | break; | ||
724 | case OMAP_MCBSP_CLKR_SRC_CLKX: | 659 | case OMAP_MCBSP_CLKR_SRC_CLKX: |
660 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); | ||
661 | break; | ||
725 | case OMAP_MCBSP_FSR_SRC_FSR: | 662 | case OMAP_MCBSP_FSR_SRC_FSR: |
663 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); | ||
664 | break; | ||
726 | case OMAP_MCBSP_FSR_SRC_FSX: | 665 | case OMAP_MCBSP_FSR_SRC_FSX: |
727 | err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id); | 666 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); |
728 | break; | 667 | break; |
729 | default: | 668 | default: |
730 | err = -ENODEV; | 669 | err = -ENODEV; |