diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-01-23 05:26:46 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-08 12:50:19 -0500 |
commit | b820ce4e6736ddad7ccda528e10aaf37ad3f13f9 (patch) | |
tree | 173ca76cff521df77256564ee3905ccd0928f10f /arch/arm/mach-omap1/mcbsp.c | |
parent | 1b5715ec471d1def9722e22b6cb1d24841b5e290 (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/mcbsp.c')
-rw-r--r-- | arch/arm/mach-omap1/mcbsp.c | 52 |
1 files changed, 32 insertions, 20 deletions
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) |