diff options
author | Chandra Shekhar <x0044955@ti.com> | 2008-10-08 03:01:39 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-10-08 03:01:39 -0400 |
commit | b4b58f5834a023dab67201db9a626bef07bb200c (patch) | |
tree | 721917a3f675ba7f55ce6d8df0fef9f0a6ed88a5 /arch/arm/mach-omap2/mcbsp.c | |
parent | 25cef2251415cef5438e20965fec87096fe2efb0 (diff) |
ARM: OMAP: Allocate McBSP devices dynamically
Based on Chandra's earlier patches in linux-omap tree.
Note that omap1_mcbsp_check and omap2_mcbsp_check are no longer
needed as there's now omap_mcbsp_check_valid_id() defined.
Also some functions can now be marked __init.
Signed-off-by: Chandra Shekhar <x0044955@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/mcbsp.c')
-rw-r--r-- | arch/arm/mach-omap2/mcbsp.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 709db03b9999..73f2279ef2ea 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -28,7 +28,7 @@ struct mcbsp_internal_clk { | |||
28 | int n_childs; | 28 | int n_childs; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) | 31 | #if defined(CONFIG_ARCH_OMAP24XX) |
32 | static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) | 32 | static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) |
33 | { | 33 | { |
34 | const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" }; | 34 | const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" }; |
@@ -117,18 +117,8 @@ static void omap2_mcbsp_request(unsigned int id) | |||
117 | omap2_mcbsp2_mux_setup(); | 117 | omap2_mcbsp2_mux_setup(); |
118 | } | 118 | } |
119 | 119 | ||
120 | static int omap2_mcbsp_check(unsigned int id) | ||
121 | { | ||
122 | if (id > OMAP_MAX_MCBSP_COUNT - 1) { | ||
123 | printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1); | ||
124 | return -ENODEV; | ||
125 | } | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static struct omap_mcbsp_ops omap2_mcbsp_ops = { | 120 | static struct omap_mcbsp_ops omap2_mcbsp_ops = { |
130 | .request = omap2_mcbsp_request, | 121 | .request = omap2_mcbsp_request, |
131 | .check = omap2_mcbsp_check, | ||
132 | }; | 122 | }; |
133 | 123 | ||
134 | #ifdef CONFIG_ARCH_OMAP24XX | 124 | #ifdef CONFIG_ARCH_OMAP24XX |
@@ -185,7 +175,7 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
185 | #define OMAP34XX_MCBSP_PDATA_SZ 0 | 175 | #define OMAP34XX_MCBSP_PDATA_SZ 0 |
186 | #endif | 176 | #endif |
187 | 177 | ||
188 | int __init omap2_mcbsp_init(void) | 178 | static int __init omap2_mcbsp_init(void) |
189 | { | 179 | { |
190 | int i; | 180 | int i; |
191 | 181 | ||
@@ -196,13 +186,19 @@ int __init omap2_mcbsp_init(void) | |||
196 | } | 186 | } |
197 | 187 | ||
198 | if (cpu_is_omap24xx()) | 188 | if (cpu_is_omap24xx()) |
189 | omap_mcbsp_count = OMAP24XX_MCBSP_PDATA_SZ; | ||
190 | if (cpu_is_omap34xx()) | ||
191 | omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ; | ||
192 | |||
193 | mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), | ||
194 | GFP_KERNEL); | ||
195 | if (!mcbsp_ptr) | ||
196 | return -ENOMEM; | ||
197 | |||
198 | if (cpu_is_omap24xx()) | ||
199 | omap_mcbsp_register_board_cfg(omap24xx_mcbsp_pdata, | 199 | omap_mcbsp_register_board_cfg(omap24xx_mcbsp_pdata, |
200 | OMAP24XX_MCBSP_PDATA_SZ); | 200 | OMAP24XX_MCBSP_PDATA_SZ); |
201 | 201 | ||
202 | if (cpu_is_omap34xx()) | ||
203 | omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata, | ||
204 | OMAP34XX_MCBSP_PDATA_SZ); | ||
205 | |||
206 | return omap_mcbsp_init(); | 202 | return omap_mcbsp_init(); |
207 | } | 203 | } |
208 | arch_initcall(omap2_mcbsp_init); | 204 | arch_initcall(omap2_mcbsp_init); |