diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap1/clock.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-omap1/mcbsp.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock24xx.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-omap2/mcbsp.c | 26 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/mcbsp.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 90 |
7 files changed, 100 insertions, 123 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 61ace02e7ddc..b62da4c95630 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -132,6 +132,15 @@ static struct omap_clk omap_clks[] = { | |||
132 | CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310), | 132 | CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310), |
133 | CLK("i2c_omap.1", "i2c_fck", &i2c_fck, CK_16XX | CK_1510 | CK_310), | 133 | CLK("i2c_omap.1", "i2c_fck", &i2c_fck, CK_16XX | CK_1510 | CK_310), |
134 | CLK("i2c_omap.1", "i2c_ick", &i2c_ick, CK_16XX), | 134 | CLK("i2c_omap.1", "i2c_ick", &i2c_ick, CK_16XX), |
135 | CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), | ||
136 | CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), | ||
137 | CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX), | ||
138 | CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310), | ||
139 | CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX), | ||
140 | CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310), | ||
141 | CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | ||
142 | CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310), | ||
143 | CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310), | ||
135 | }; | 144 | }; |
136 | 145 | ||
137 | static int omap1_clk_enable_generic(struct clk * clk); | 146 | static int omap1_clk_enable_generic(struct clk * clk); |
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c index 575ba31295cf..d040c3f1027f 100644 --- a/arch/arm/mach-omap1/mcbsp.c +++ b/arch/arm/mach-omap1/mcbsp.c | |||
@@ -28,9 +28,9 @@ | |||
28 | #define DPS_RSTCT2_PER_EN (1 << 0) | 28 | #define DPS_RSTCT2_PER_EN (1 << 0) |
29 | #define DSP_RSTCT2_WD_PER_EN (1 << 1) | 29 | #define DSP_RSTCT2_WD_PER_EN (1 << 1) |
30 | 30 | ||
31 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) | 31 | static int dsp_use; |
32 | const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" }; | 32 | static struct clk *api_clk; |
33 | #endif | 33 | static struct clk *dsp_clk; |
34 | 34 | ||
35 | static void omap1_mcbsp_request(unsigned int id) | 35 | static void omap1_mcbsp_request(unsigned int id) |
36 | { | 36 | { |
@@ -39,20 +39,40 @@ static void omap1_mcbsp_request(unsigned int id) | |||
39 | * are DSP public peripherals. | 39 | * are DSP public peripherals. |
40 | */ | 40 | */ |
41 | if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) { | 41 | if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) { |
42 | omap_dsp_request_mem(); | 42 | if (dsp_use++ == 0) { |
43 | /* | 43 | api_clk = clk_get(NULL, "api_clk"); |
44 | * DSP external peripheral reset | 44 | dsp_clk = clk_get(NULL, "dsp_clk"); |
45 | * FIXME: This should be moved to dsp code | 45 | if (!IS_ERR(api_clk) && !IS_ERR(dsp_clk)) { |
46 | */ | 46 | clk_enable(api_clk); |
47 | __raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN | | 47 | clk_enable(dsp_clk); |
48 | DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2); | 48 | |
49 | omap_dsp_request_mem(); | ||
50 | /* | ||
51 | * DSP external peripheral reset | ||
52 | * FIXME: This should be moved to dsp code | ||
53 | */ | ||
54 | __raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN | | ||
55 | DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2); | ||
56 | } | ||
57 | } | ||
49 | } | 58 | } |
50 | } | 59 | } |
51 | 60 | ||
52 | static void omap1_mcbsp_free(unsigned int id) | 61 | static void omap1_mcbsp_free(unsigned int id) |
53 | { | 62 | { |
54 | if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) | 63 | if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) { |
55 | omap_dsp_release_mem(); | 64 | if (--dsp_use == 0) { |
65 | omap_dsp_release_mem(); | ||
66 | if (!IS_ERR(api_clk)) { | ||
67 | clk_disable(api_clk); | ||
68 | clk_put(api_clk); | ||
69 | } | ||
70 | if (!IS_ERR(dsp_clk)) { | ||
71 | clk_disable(dsp_clk); | ||
72 | clk_put(dsp_clk); | ||
73 | } | ||
74 | } | ||
75 | } | ||
56 | } | 76 | } |
57 | 77 | ||
58 | static struct omap_mcbsp_ops omap1_mcbsp_ops = { | 78 | static struct omap_mcbsp_ops omap1_mcbsp_ops = { |
@@ -94,8 +114,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { | |||
94 | .rx_irq = INT_McBSP1RX, | 114 | .rx_irq = INT_McBSP1RX, |
95 | .tx_irq = INT_McBSP1TX, | 115 | .tx_irq = INT_McBSP1TX, |
96 | .ops = &omap1_mcbsp_ops, | 116 | .ops = &omap1_mcbsp_ops, |
97 | .clk_names = clk_names, | ||
98 | .num_clks = 3, | ||
99 | }, | 117 | }, |
100 | { | 118 | { |
101 | .phys_base = OMAP1510_MCBSP2_BASE, | 119 | .phys_base = OMAP1510_MCBSP2_BASE, |
@@ -112,8 +130,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { | |||
112 | .rx_irq = INT_McBSP3RX, | 130 | .rx_irq = INT_McBSP3RX, |
113 | .tx_irq = INT_McBSP3TX, | 131 | .tx_irq = INT_McBSP3TX, |
114 | .ops = &omap1_mcbsp_ops, | 132 | .ops = &omap1_mcbsp_ops, |
115 | .clk_names = clk_names, | ||
116 | .num_clks = 3, | ||
117 | }, | 133 | }, |
118 | }; | 134 | }; |
119 | #define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) | 135 | #define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) |
@@ -131,8 +147,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { | |||
131 | .rx_irq = INT_McBSP1RX, | 147 | .rx_irq = INT_McBSP1RX, |
132 | .tx_irq = INT_McBSP1TX, | 148 | .tx_irq = INT_McBSP1TX, |
133 | .ops = &omap1_mcbsp_ops, | 149 | .ops = &omap1_mcbsp_ops, |
134 | .clk_names = clk_names, | ||
135 | .num_clks = 3, | ||
136 | }, | 150 | }, |
137 | { | 151 | { |
138 | .phys_base = OMAP1610_MCBSP2_BASE, | 152 | .phys_base = OMAP1610_MCBSP2_BASE, |
@@ -149,8 +163,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { | |||
149 | .rx_irq = INT_McBSP3RX, | 163 | .rx_irq = INT_McBSP3RX, |
150 | .tx_irq = INT_McBSP3TX, | 164 | .tx_irq = INT_McBSP3TX, |
151 | .ops = &omap1_mcbsp_ops, | 165 | .ops = &omap1_mcbsp_ops, |
152 | .clk_names = clk_names, | ||
153 | .num_clks = 3, | ||
154 | }, | 166 | }, |
155 | }; | 167 | }; |
156 | #define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) | 168 | #define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) |
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c index ac038035c1c9..ea21d55a2075 100644 --- a/arch/arm/mach-omap2/clock24xx.c +++ b/arch/arm/mach-omap2/clock24xx.c | |||
@@ -139,16 +139,16 @@ static struct omap_clk omap24xx_clks[] = { | |||
139 | CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X | CK_242X), | 139 | CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X | CK_242X), |
140 | CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X | CK_242X), | 140 | CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X | CK_242X), |
141 | CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X | CK_242X), | 141 | CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X | CK_242X), |
142 | CLK("omap-mcbsp.1", "mcbsp_ick", &mcbsp1_ick, CK_243X | CK_242X), | 142 | CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X | CK_242X), |
143 | CLK("omap-mcbsp.1", "mcbsp_fck", &mcbsp1_fck, CK_243X | CK_242X), | 143 | CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_243X | CK_242X), |
144 | CLK("omap-mcbsp.2", "mcbsp_ick", &mcbsp2_ick, CK_243X | CK_242X), | 144 | CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X | CK_242X), |
145 | CLK("omap-mcbsp.2", "mcbsp_fck", &mcbsp2_fck, CK_243X | CK_242X), | 145 | CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_243X | CK_242X), |
146 | CLK("omap-mcbsp.3", "mcbsp_ick", &mcbsp3_ick, CK_243X), | 146 | CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X), |
147 | CLK("omap-mcbsp.3", "mcbsp_fck", &mcbsp3_fck, CK_243X), | 147 | CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_243X), |
148 | CLK("omap-mcbsp.4", "mcbsp_ick", &mcbsp4_ick, CK_243X), | 148 | CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X), |
149 | CLK("omap-mcbsp.4", "mcbsp_fck", &mcbsp4_fck, CK_243X), | 149 | CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_243X), |
150 | CLK("omap-mcbsp.5", "mcbsp_ick", &mcbsp5_ick, CK_243X), | 150 | CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X), |
151 | CLK("omap-mcbsp.5", "mcbsp_fck", &mcbsp5_fck, CK_243X), | 151 | CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_243X), |
152 | CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X | CK_242X), | 152 | CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X | CK_242X), |
153 | CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_243X | CK_242X), | 153 | CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_243X | CK_242X), |
154 | CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X | CK_242X), | 154 | CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X | CK_242X), |
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index d0bfae5a2f41..a70aa2eaf053 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -144,8 +144,8 @@ static struct omap_clk omap34xx_clks[] = { | |||
144 | CLK("i2c_omap.3", "i2c_fck", &i2c3_fck, CK_343X), | 144 | CLK("i2c_omap.3", "i2c_fck", &i2c3_fck, CK_343X), |
145 | CLK("i2c_omap.2", "i2c_fck", &i2c2_fck, CK_343X), | 145 | CLK("i2c_omap.2", "i2c_fck", &i2c2_fck, CK_343X), |
146 | CLK("i2c_omap.1", "i2c_fck", &i2c1_fck, CK_343X), | 146 | CLK("i2c_omap.1", "i2c_fck", &i2c1_fck, CK_343X), |
147 | CLK("omap-mcbsp.5", "mcbsp_fck", &mcbsp5_fck, CK_343X), | 147 | CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_343X), |
148 | CLK("omap-mcbsp.1", "mcbsp_fck", &mcbsp1_fck, CK_343X), | 148 | CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_343X), |
149 | CLK(NULL, "core_48m_fck", &core_48m_fck, CK_343X), | 149 | CLK(NULL, "core_48m_fck", &core_48m_fck, CK_343X), |
150 | CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_343X), | 150 | CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_343X), |
151 | CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_343X), | 151 | CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_343X), |
@@ -186,8 +186,8 @@ static struct omap_clk omap34xx_clks[] = { | |||
186 | CLK(NULL, "uart1_ick", &uart1_ick, CK_343X), | 186 | CLK(NULL, "uart1_ick", &uart1_ick, CK_343X), |
187 | CLK(NULL, "gpt11_ick", &gpt11_ick, CK_343X), | 187 | CLK(NULL, "gpt11_ick", &gpt11_ick, CK_343X), |
188 | CLK(NULL, "gpt10_ick", &gpt10_ick, CK_343X), | 188 | CLK(NULL, "gpt10_ick", &gpt10_ick, CK_343X), |
189 | CLK("omap-mcbsp.5", "mcbsp_ick", &mcbsp5_ick, CK_343X), | 189 | CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_343X), |
190 | CLK("omap-mcbsp.1", "mcbsp_ick", &mcbsp1_ick, CK_343X), | 190 | CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_343X), |
191 | CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1), | 191 | CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1), |
192 | CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X), | 192 | CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X), |
193 | CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X), | 193 | CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X), |
@@ -257,12 +257,12 @@ static struct omap_clk omap34xx_clks[] = { | |||
257 | CLK(NULL, "gpt4_ick", &gpt4_ick, CK_343X), | 257 | CLK(NULL, "gpt4_ick", &gpt4_ick, CK_343X), |
258 | CLK(NULL, "gpt3_ick", &gpt3_ick, CK_343X), | 258 | CLK(NULL, "gpt3_ick", &gpt3_ick, CK_343X), |
259 | CLK(NULL, "gpt2_ick", &gpt2_ick, CK_343X), | 259 | CLK(NULL, "gpt2_ick", &gpt2_ick, CK_343X), |
260 | CLK("omap-mcbsp.2", "mcbsp_ick", &mcbsp2_ick, CK_343X), | 260 | CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_343X), |
261 | CLK("omap-mcbsp.3", "mcbsp_ick", &mcbsp3_ick, CK_343X), | 261 | CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_343X), |
262 | CLK("omap-mcbsp.4", "mcbsp_ick", &mcbsp4_ick, CK_343X), | 262 | CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_343X), |
263 | CLK("omap-mcbsp.2", "mcbsp_fck", &mcbsp2_fck, CK_343X), | 263 | CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_343X), |
264 | CLK("omap-mcbsp.3", "mcbsp_fck", &mcbsp3_fck, CK_343X), | 264 | CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_343X), |
265 | CLK("omap-mcbsp.4", "mcbsp_fck", &mcbsp4_fck, CK_343X), | 265 | CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_343X), |
266 | CLK(NULL, "emu_src_ck", &emu_src_ck, CK_343X), | 266 | CLK(NULL, "emu_src_ck", &emu_src_ck, CK_343X), |
267 | CLK(NULL, "pclk_fck", &pclk_fck, CK_343X), | 267 | CLK(NULL, "pclk_fck", &pclk_fck, CK_343X), |
268 | CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X), | 268 | CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X), |
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index a9e631fc1134..a5c0f0435cd6 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -24,8 +24,6 @@ | |||
24 | #include <mach/cpu.h> | 24 | #include <mach/cpu.h> |
25 | #include <mach/mcbsp.h> | 25 | #include <mach/mcbsp.h> |
26 | 26 | ||
27 | const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" }; | ||
28 | |||
29 | static void omap2_mcbsp2_mux_setup(void) | 27 | static void omap2_mcbsp2_mux_setup(void) |
30 | { | 28 | { |
31 | omap_cfg_reg(Y15_24XX_MCBSP2_CLKX); | 29 | omap_cfg_reg(Y15_24XX_MCBSP2_CLKX); |
@@ -57,8 +55,6 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | |||
57 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, | 55 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
58 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, | 56 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
59 | .ops = &omap2_mcbsp_ops, | 57 | .ops = &omap2_mcbsp_ops, |
60 | .clk_names = clk_names, | ||
61 | .num_clks = 2, | ||
62 | }, | 58 | }, |
63 | { | 59 | { |
64 | .phys_base = OMAP24XX_MCBSP2_BASE, | 60 | .phys_base = OMAP24XX_MCBSP2_BASE, |
@@ -67,8 +63,6 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | |||
67 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, | 63 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
68 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, | 64 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
69 | .ops = &omap2_mcbsp_ops, | 65 | .ops = &omap2_mcbsp_ops, |
70 | .clk_names = clk_names, | ||
71 | .num_clks = 2, | ||
72 | }, | 66 | }, |
73 | }; | 67 | }; |
74 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) | 68 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) |
@@ -86,8 +80,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
86 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, | 80 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
87 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, | 81 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
88 | .ops = &omap2_mcbsp_ops, | 82 | .ops = &omap2_mcbsp_ops, |
89 | .clk_names = clk_names, | ||
90 | .num_clks = 2, | ||
91 | }, | 83 | }, |
92 | { | 84 | { |
93 | .phys_base = OMAP24XX_MCBSP2_BASE, | 85 | .phys_base = OMAP24XX_MCBSP2_BASE, |
@@ -96,8 +88,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
96 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, | 88 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
97 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, | 89 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
98 | .ops = &omap2_mcbsp_ops, | 90 | .ops = &omap2_mcbsp_ops, |
99 | .clk_names = clk_names, | ||
100 | .num_clks = 2, | ||
101 | }, | 91 | }, |
102 | { | 92 | { |
103 | .phys_base = OMAP2430_MCBSP3_BASE, | 93 | .phys_base = OMAP2430_MCBSP3_BASE, |
@@ -106,8 +96,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
106 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, | 96 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, |
107 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, | 97 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, |
108 | .ops = &omap2_mcbsp_ops, | 98 | .ops = &omap2_mcbsp_ops, |
109 | .clk_names = clk_names, | ||
110 | .num_clks = 2, | ||
111 | }, | 99 | }, |
112 | { | 100 | { |
113 | .phys_base = OMAP2430_MCBSP4_BASE, | 101 | .phys_base = OMAP2430_MCBSP4_BASE, |
@@ -116,8 +104,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
116 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, | 104 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, |
117 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, | 105 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, |
118 | .ops = &omap2_mcbsp_ops, | 106 | .ops = &omap2_mcbsp_ops, |
119 | .clk_names = clk_names, | ||
120 | .num_clks = 2, | ||
121 | }, | 107 | }, |
122 | { | 108 | { |
123 | .phys_base = OMAP2430_MCBSP5_BASE, | 109 | .phys_base = OMAP2430_MCBSP5_BASE, |
@@ -126,8 +112,6 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
126 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, | 112 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, |
127 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, | 113 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, |
128 | .ops = &omap2_mcbsp_ops, | 114 | .ops = &omap2_mcbsp_ops, |
129 | .clk_names = clk_names, | ||
130 | .num_clks = 2, | ||
131 | }, | 115 | }, |
132 | }; | 116 | }; |
133 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) | 117 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) |
@@ -145,8 +129,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
145 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, | 129 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
146 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, | 130 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
147 | .ops = &omap2_mcbsp_ops, | 131 | .ops = &omap2_mcbsp_ops, |
148 | .clk_names = clk_names, | ||
149 | .num_clks = 2, | ||
150 | }, | 132 | }, |
151 | { | 133 | { |
152 | .phys_base = OMAP34XX_MCBSP2_BASE, | 134 | .phys_base = OMAP34XX_MCBSP2_BASE, |
@@ -155,8 +137,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
155 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, | 137 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
156 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, | 138 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
157 | .ops = &omap2_mcbsp_ops, | 139 | .ops = &omap2_mcbsp_ops, |
158 | .clk_names = clk_names, | ||
159 | .num_clks = 2, | ||
160 | }, | 140 | }, |
161 | { | 141 | { |
162 | .phys_base = OMAP34XX_MCBSP3_BASE, | 142 | .phys_base = OMAP34XX_MCBSP3_BASE, |
@@ -165,8 +145,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
165 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, | 145 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, |
166 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, | 146 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, |
167 | .ops = &omap2_mcbsp_ops, | 147 | .ops = &omap2_mcbsp_ops, |
168 | .clk_names = clk_names, | ||
169 | .num_clks = 2, | ||
170 | }, | 148 | }, |
171 | { | 149 | { |
172 | .phys_base = OMAP34XX_MCBSP4_BASE, | 150 | .phys_base = OMAP34XX_MCBSP4_BASE, |
@@ -175,8 +153,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
175 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, | 153 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, |
176 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, | 154 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, |
177 | .ops = &omap2_mcbsp_ops, | 155 | .ops = &omap2_mcbsp_ops, |
178 | .clk_names = clk_names, | ||
179 | .num_clks = 2, | ||
180 | }, | 156 | }, |
181 | { | 157 | { |
182 | .phys_base = OMAP34XX_MCBSP5_BASE, | 158 | .phys_base = OMAP34XX_MCBSP5_BASE, |
@@ -185,8 +161,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
185 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, | 161 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, |
186 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, | 162 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, |
187 | .ops = &omap2_mcbsp_ops, | 163 | .ops = &omap2_mcbsp_ops, |
188 | .clk_names = clk_names, | ||
189 | .num_clks = 2, | ||
190 | }, | 164 | }, |
191 | }; | 165 | }; |
192 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) | 166 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) |
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h index 113c2466c86a..bb154ea76769 100644 --- a/arch/arm/plat-omap/include/mach/mcbsp.h +++ b/arch/arm/plat-omap/include/mach/mcbsp.h | |||
@@ -344,8 +344,6 @@ struct omap_mcbsp_platform_data { | |||
344 | u8 dma_rx_sync, dma_tx_sync; | 344 | u8 dma_rx_sync, dma_tx_sync; |
345 | u16 rx_irq, tx_irq; | 345 | u16 rx_irq, tx_irq; |
346 | struct omap_mcbsp_ops *ops; | 346 | struct omap_mcbsp_ops *ops; |
347 | char const **clk_names; | ||
348 | int num_clks; | ||
349 | }; | 347 | }; |
350 | 348 | ||
351 | struct omap_mcbsp { | 349 | struct omap_mcbsp { |
@@ -377,8 +375,8 @@ struct omap_mcbsp { | |||
377 | /* Protect the field .free, while checking if the mcbsp is in use */ | 375 | /* Protect the field .free, while checking if the mcbsp is in use */ |
378 | spinlock_t lock; | 376 | spinlock_t lock; |
379 | struct omap_mcbsp_platform_data *pdata; | 377 | struct omap_mcbsp_platform_data *pdata; |
380 | struct clk **clks; | 378 | struct clk *iclk; |
381 | int num_clks; | 379 | struct clk *fclk; |
382 | }; | 380 | }; |
383 | extern struct omap_mcbsp **mcbsp_ptr; | 381 | extern struct omap_mcbsp **mcbsp_ptr; |
384 | extern int omap_mcbsp_count; | 382 | extern int omap_mcbsp_count; |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index e5842e30e534..28b0a824b8cf 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -214,7 +214,6 @@ EXPORT_SYMBOL(omap_mcbsp_set_io_type); | |||
214 | int omap_mcbsp_request(unsigned int id) | 214 | int omap_mcbsp_request(unsigned int id) |
215 | { | 215 | { |
216 | struct omap_mcbsp *mcbsp; | 216 | struct omap_mcbsp *mcbsp; |
217 | int i; | ||
218 | int err; | 217 | int err; |
219 | 218 | ||
220 | if (!omap_mcbsp_check_valid_id(id)) { | 219 | if (!omap_mcbsp_check_valid_id(id)) { |
@@ -223,23 +222,23 @@ int omap_mcbsp_request(unsigned int id) | |||
223 | } | 222 | } |
224 | mcbsp = id_to_mcbsp_ptr(id); | 223 | mcbsp = id_to_mcbsp_ptr(id); |
225 | 224 | ||
226 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) | ||
227 | mcbsp->pdata->ops->request(id); | ||
228 | |||
229 | for (i = 0; i < mcbsp->num_clks; i++) | ||
230 | clk_enable(mcbsp->clks[i]); | ||
231 | |||
232 | spin_lock(&mcbsp->lock); | 225 | spin_lock(&mcbsp->lock); |
233 | if (!mcbsp->free) { | 226 | if (!mcbsp->free) { |
234 | dev_err(mcbsp->dev, "McBSP%d is currently in use\n", | 227 | dev_err(mcbsp->dev, "McBSP%d is currently in use\n", |
235 | mcbsp->id); | 228 | mcbsp->id); |
236 | spin_unlock(&mcbsp->lock); | 229 | spin_unlock(&mcbsp->lock); |
237 | return -1; | 230 | return -EBUSY; |
238 | } | 231 | } |
239 | 232 | ||
240 | mcbsp->free = 0; | 233 | mcbsp->free = 0; |
241 | spin_unlock(&mcbsp->lock); | 234 | spin_unlock(&mcbsp->lock); |
242 | 235 | ||
236 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) | ||
237 | mcbsp->pdata->ops->request(id); | ||
238 | |||
239 | clk_enable(mcbsp->iclk); | ||
240 | clk_enable(mcbsp->fclk); | ||
241 | |||
243 | /* | 242 | /* |
244 | * Make sure that transmitter, receiver and sample-rate generator are | 243 | * Make sure that transmitter, receiver and sample-rate generator are |
245 | * not running before activating IRQs. | 244 | * not running before activating IRQs. |
@@ -278,7 +277,6 @@ EXPORT_SYMBOL(omap_mcbsp_request); | |||
278 | void omap_mcbsp_free(unsigned int id) | 277 | void omap_mcbsp_free(unsigned int id) |
279 | { | 278 | { |
280 | struct omap_mcbsp *mcbsp; | 279 | struct omap_mcbsp *mcbsp; |
281 | int i; | ||
282 | 280 | ||
283 | if (!omap_mcbsp_check_valid_id(id)) { | 281 | if (!omap_mcbsp_check_valid_id(id)) { |
284 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | 282 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); |
@@ -289,8 +287,14 @@ void omap_mcbsp_free(unsigned int id) | |||
289 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | 287 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) |
290 | mcbsp->pdata->ops->free(id); | 288 | mcbsp->pdata->ops->free(id); |
291 | 289 | ||
292 | for (i = mcbsp->num_clks - 1; i >= 0; i--) | 290 | clk_disable(mcbsp->fclk); |
293 | clk_disable(mcbsp->clks[i]); | 291 | clk_disable(mcbsp->iclk); |
292 | |||
293 | if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) { | ||
294 | /* Free IRQs */ | ||
295 | free_irq(mcbsp->rx_irq, (void *)mcbsp); | ||
296 | free_irq(mcbsp->tx_irq, (void *)mcbsp); | ||
297 | } | ||
294 | 298 | ||
295 | spin_lock(&mcbsp->lock); | 299 | spin_lock(&mcbsp->lock); |
296 | if (mcbsp->free) { | 300 | if (mcbsp->free) { |
@@ -302,12 +306,6 @@ void omap_mcbsp_free(unsigned int id) | |||
302 | 306 | ||
303 | mcbsp->free = 1; | 307 | mcbsp->free = 1; |
304 | spin_unlock(&mcbsp->lock); | 308 | spin_unlock(&mcbsp->lock); |
305 | |||
306 | if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) { | ||
307 | /* Free IRQs */ | ||
308 | free_irq(mcbsp->rx_irq, (void *)mcbsp); | ||
309 | free_irq(mcbsp->tx_irq, (void *)mcbsp); | ||
310 | } | ||
311 | } | 309 | } |
312 | EXPORT_SYMBOL(omap_mcbsp_free); | 310 | EXPORT_SYMBOL(omap_mcbsp_free); |
313 | 311 | ||
@@ -876,7 +874,6 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
876 | struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; | 874 | struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data; |
877 | struct omap_mcbsp *mcbsp; | 875 | struct omap_mcbsp *mcbsp; |
878 | int id = pdev->id - 1; | 876 | int id = pdev->id - 1; |
879 | int i; | ||
880 | int ret = 0; | 877 | int ret = 0; |
881 | 878 | ||
882 | if (!pdata) { | 879 | if (!pdata) { |
@@ -899,7 +896,6 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
899 | ret = -ENOMEM; | 896 | ret = -ENOMEM; |
900 | goto exit; | 897 | goto exit; |
901 | } | 898 | } |
902 | mcbsp_ptr[id] = mcbsp; | ||
903 | 899 | ||
904 | spin_lock_init(&mcbsp->lock); | 900 | spin_lock_init(&mcbsp->lock); |
905 | mcbsp->id = id + 1; | 901 | mcbsp->id = id + 1; |
@@ -921,39 +917,32 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
921 | mcbsp->dma_rx_sync = pdata->dma_rx_sync; | 917 | mcbsp->dma_rx_sync = pdata->dma_rx_sync; |
922 | mcbsp->dma_tx_sync = pdata->dma_tx_sync; | 918 | mcbsp->dma_tx_sync = pdata->dma_tx_sync; |
923 | 919 | ||
924 | if (pdata->num_clks) { | 920 | mcbsp->iclk = clk_get(&pdev->dev, "ick"); |
925 | mcbsp->num_clks = pdata->num_clks; | 921 | if (IS_ERR(mcbsp->iclk)) { |
926 | mcbsp->clks = kzalloc(mcbsp->num_clks * sizeof(struct clk *), | 922 | ret = PTR_ERR(mcbsp->iclk); |
927 | GFP_KERNEL); | 923 | dev_err(&pdev->dev, "unable to get ick: %d\n", ret); |
928 | if (!mcbsp->clks) { | 924 | goto err_iclk; |
929 | ret = -ENOMEM; | 925 | } |
930 | goto exit; | ||
931 | } | ||
932 | for (i = 0; i < mcbsp->num_clks; i++) { | ||
933 | mcbsp->clks[i] = clk_get(&pdev->dev, pdata->clk_names[i]); | ||
934 | if (IS_ERR(mcbsp->clks[i])) { | ||
935 | dev_err(&pdev->dev, | ||
936 | "Invalid %s configuration for McBSP%d.\n", | ||
937 | pdata->clk_names[i], mcbsp->id); | ||
938 | ret = PTR_ERR(mcbsp->clks[i]); | ||
939 | goto err_clk; | ||
940 | } | ||
941 | } | ||
942 | 926 | ||
927 | mcbsp->fclk = clk_get(&pdev->dev, "fck"); | ||
928 | if (IS_ERR(mcbsp->fclk)) { | ||
929 | ret = PTR_ERR(mcbsp->fclk); | ||
930 | dev_err(&pdev->dev, "unable to get fck: %d\n", ret); | ||
931 | goto err_fclk; | ||
943 | } | 932 | } |
944 | 933 | ||
945 | mcbsp->pdata = pdata; | 934 | mcbsp->pdata = pdata; |
946 | mcbsp->dev = &pdev->dev; | 935 | mcbsp->dev = &pdev->dev; |
936 | mcbsp_ptr[id] = mcbsp; | ||
947 | platform_set_drvdata(pdev, mcbsp); | 937 | platform_set_drvdata(pdev, mcbsp); |
948 | return 0; | 938 | return 0; |
949 | 939 | ||
950 | err_clk: | 940 | err_fclk: |
951 | while (i--) | 941 | clk_put(mcbsp->iclk); |
952 | clk_put(mcbsp->clks[i]); | 942 | err_iclk: |
953 | kfree(mcbsp->clks); | ||
954 | iounmap(mcbsp->io_base); | 943 | iounmap(mcbsp->io_base); |
955 | err_ioremap: | 944 | err_ioremap: |
956 | mcbsp->free = 0; | 945 | kfree(mcbsp); |
957 | exit: | 946 | exit: |
958 | return ret; | 947 | return ret; |
959 | } | 948 | } |
@@ -961,7 +950,6 @@ exit: | |||
961 | static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | 950 | static int __devexit omap_mcbsp_remove(struct platform_device *pdev) |
962 | { | 951 | { |
963 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); | 952 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); |
964 | int i; | ||
965 | 953 | ||
966 | platform_set_drvdata(pdev, NULL); | 954 | platform_set_drvdata(pdev, NULL); |
967 | if (mcbsp) { | 955 | if (mcbsp) { |
@@ -970,18 +958,15 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | |||
970 | mcbsp->pdata->ops->free) | 958 | mcbsp->pdata->ops->free) |
971 | mcbsp->pdata->ops->free(mcbsp->id); | 959 | mcbsp->pdata->ops->free(mcbsp->id); |
972 | 960 | ||
973 | for (i = mcbsp->num_clks - 1; i >= 0; i--) { | 961 | clk_disable(mcbsp->fclk); |
974 | clk_disable(mcbsp->clks[i]); | 962 | clk_disable(mcbsp->iclk); |
975 | clk_put(mcbsp->clks[i]); | 963 | clk_put(mcbsp->fclk); |
976 | } | 964 | clk_put(mcbsp->iclk); |
977 | 965 | ||
978 | iounmap(mcbsp->io_base); | 966 | iounmap(mcbsp->io_base); |
979 | 967 | ||
980 | if (mcbsp->num_clks) { | 968 | mcbsp->fclk = NULL; |
981 | kfree(mcbsp->clks); | 969 | mcbsp->iclk = NULL; |
982 | mcbsp->clks = NULL; | ||
983 | mcbsp->num_clks = 0; | ||
984 | } | ||
985 | mcbsp->free = 0; | 970 | mcbsp->free = 0; |
986 | mcbsp->dev = NULL; | 971 | mcbsp->dev = NULL; |
987 | } | 972 | } |
@@ -1002,4 +987,3 @@ int __init omap_mcbsp_init(void) | |||
1002 | /* Register the McBSP driver */ | 987 | /* Register the McBSP driver */ |
1003 | return platform_driver_register(&omap_mcbsp_driver); | 988 | return platform_driver_register(&omap_mcbsp_driver); |
1004 | } | 989 | } |
1005 | |||