aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/mcbsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/mcbsp.c')
-rw-r--r--arch/arm/mach-omap1/mcbsp.c99
1 files changed, 11 insertions, 88 deletions
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index 4474da7bc88a..575ba31295cf 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <mach/irqs.h>
20#include <mach/dma.h> 21#include <mach/dma.h>
21#include <mach/irqs.h> 22#include <mach/irqs.h>
22#include <mach/mux.h> 23#include <mach/mux.h>
@@ -27,81 +28,8 @@
27#define DPS_RSTCT2_PER_EN (1 << 0) 28#define DPS_RSTCT2_PER_EN (1 << 0)
28#define DSP_RSTCT2_WD_PER_EN (1 << 1) 29#define DSP_RSTCT2_WD_PER_EN (1 << 1)
29 30
30struct mcbsp_internal_clk {
31 struct clk clk;
32 struct clk **childs;
33 int n_childs;
34};
35
36#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) 31#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
37static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) 32const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
38{
39 const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
40 int i;
41
42 mclk->n_childs = ARRAY_SIZE(clk_names);
43 mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
44 GFP_KERNEL);
45
46 for (i = 0; i < mclk->n_childs; i++) {
47 /* We fake a platform device to get correct device id */
48 struct platform_device pdev;
49
50 pdev.dev.bus = &platform_bus_type;
51 pdev.id = mclk->clk.id;
52 mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
53 if (IS_ERR(mclk->childs[i]))
54 printk(KERN_ERR "Could not get clock %s (%d).\n",
55 clk_names[i], mclk->clk.id);
56 }
57}
58
59static int omap_mcbsp_clk_enable(struct clk *clk)
60{
61 struct mcbsp_internal_clk *mclk = container_of(clk,
62 struct mcbsp_internal_clk, clk);
63 int i;
64
65 for (i = 0; i < mclk->n_childs; i++)
66 clk_enable(mclk->childs[i]);
67 return 0;
68}
69
70static void omap_mcbsp_clk_disable(struct clk *clk)
71{
72 struct mcbsp_internal_clk *mclk = container_of(clk,
73 struct mcbsp_internal_clk, clk);
74 int i;
75
76 for (i = 0; i < mclk->n_childs; i++)
77 clk_disable(mclk->childs[i]);
78}
79
80static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
81 {
82 .clk = {
83 .name = "mcbsp_clk",
84 .id = 1,
85 .enable = omap_mcbsp_clk_enable,
86 .disable = omap_mcbsp_clk_disable,
87 },
88 },
89 {
90 .clk = {
91 .name = "mcbsp_clk",
92 .id = 3,
93 .enable = omap_mcbsp_clk_enable,
94 .disable = omap_mcbsp_clk_disable,
95 },
96 },
97};
98
99#define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks)
100#else
101#define omap_mcbsp_clks_size 0
102static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
103static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
104{ }
105#endif 33#endif
106 34
107static void omap1_mcbsp_request(unsigned int id) 35static void omap1_mcbsp_request(unsigned int id)
@@ -166,8 +94,9 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
166 .rx_irq = INT_McBSP1RX, 94 .rx_irq = INT_McBSP1RX,
167 .tx_irq = INT_McBSP1TX, 95 .tx_irq = INT_McBSP1TX,
168 .ops = &omap1_mcbsp_ops, 96 .ops = &omap1_mcbsp_ops,
169 .clk_name = "mcbsp_clk", 97 .clk_names = clk_names,
170 }, 98 .num_clks = 3,
99 },
171 { 100 {
172 .phys_base = OMAP1510_MCBSP2_BASE, 101 .phys_base = OMAP1510_MCBSP2_BASE,
173 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 102 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
@@ -183,7 +112,8 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
183 .rx_irq = INT_McBSP3RX, 112 .rx_irq = INT_McBSP3RX,
184 .tx_irq = INT_McBSP3TX, 113 .tx_irq = INT_McBSP3TX,
185 .ops = &omap1_mcbsp_ops, 114 .ops = &omap1_mcbsp_ops,
186 .clk_name = "mcbsp_clk", 115 .clk_names = clk_names,
116 .num_clks = 3,
187 }, 117 },
188}; 118};
189#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) 119#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
@@ -201,7 +131,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
201 .rx_irq = INT_McBSP1RX, 131 .rx_irq = INT_McBSP1RX,
202 .tx_irq = INT_McBSP1TX, 132 .tx_irq = INT_McBSP1TX,
203 .ops = &omap1_mcbsp_ops, 133 .ops = &omap1_mcbsp_ops,
204 .clk_name = "mcbsp_clk", 134 .clk_names = clk_names,
135 .num_clks = 3,
205 }, 136 },
206 { 137 {
207 .phys_base = OMAP1610_MCBSP2_BASE, 138 .phys_base = OMAP1610_MCBSP2_BASE,
@@ -218,7 +149,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
218 .rx_irq = INT_McBSP3RX, 149 .rx_irq = INT_McBSP3RX,
219 .tx_irq = INT_McBSP3TX, 150 .tx_irq = INT_McBSP3TX,
220 .ops = &omap1_mcbsp_ops, 151 .ops = &omap1_mcbsp_ops,
221 .clk_name = "mcbsp_clk", 152 .clk_names = clk_names,
153 .num_clks = 3,
222 }, 154 },
223}; 155};
224#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) 156#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
@@ -229,15 +161,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
229 161
230int __init omap1_mcbsp_init(void) 162int __init omap1_mcbsp_init(void)
231{ 163{
232 int i;
233
234 for (i = 0; i < omap_mcbsp_clks_size; i++) {
235 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
236 omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
237 clk_register(&omap_mcbsp_clks[i].clk);
238 }
239 }
240
241 if (cpu_is_omap730()) 164 if (cpu_is_omap730())
242 omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ; 165 omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ;
243 if (cpu_is_omap15xx()) 166 if (cpu_is_omap15xx())