aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-01-23 05:26:46 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 12:50:19 -0500
commitb820ce4e6736ddad7ccda528e10aaf37ad3f13f9 (patch)
tree173ca76cff521df77256564ee3905ccd0928f10f /arch/arm/mach-omap1
parent1b5715ec471d1def9722e22b6cb1d24841b5e290 (diff)
[ARM] omap: mcbsp: convert to use fck/ick clocks directly
Rather than introducing a special 'mcbsp_clk' with code behind it in mach-omap*/mcbsp.c to handle the SoC specifics, arrange for the mcbsp driver to be like any other driver. mcbsp requests its fck and ick clocks directly, and the SoC specific code deals with selecting the correct clock. There is one oddity to deal with - OMAP1 fiddles with the DSP clocks and DSP reset, so we move this to the two callback functions. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/clock.c9
-rw-r--r--arch/arm/mach-omap1/mcbsp.c52
2 files changed, 41 insertions, 20 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
137static int omap1_clk_enable_generic(struct clk * clk); 146static 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) 31static int dsp_use;
32const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" }; 32static struct clk *api_clk;
33#endif 33static struct clk *dsp_clk;
34 34
35static void omap1_mcbsp_request(unsigned int id) 35static 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
52static void omap1_mcbsp_free(unsigned int id) 61static 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
58static struct omap_mcbsp_ops omap1_mcbsp_ops = { 78static 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)