Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/mcbsp.c |
| 3 | * |
| 4 | * Copyright (C) 2008 Instituto Nokia de Tecnologia |
| 5 | * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | * Multichannel mode not supported. |
| 12 | */ |
| 13 | #include <linux/module.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/clk.h> |
| 16 | #include <linux/err.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/platform_device.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 19 | #include <linux/slab.h> |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 20 | |
Tony Lindgren | dd7667a | 2009-01-15 13:09:51 +0200 | [diff] [blame] | 21 | #include <mach/irqs.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 22 | #include <plat/dma.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 23 | #include <plat/cpu.h> |
| 24 | #include <plat/mcbsp.h> |
Paul Walmsley | 4814ced | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 25 | |
| 26 | #include "control.h" |
| 27 | |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 28 | |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 29 | /* McBSP internal signal muxing functions */ |
| 30 | |
| 31 | void omap2_mcbsp1_mux_clkr_src(u8 mux) |
| 32 | { |
| 33 | u32 v; |
| 34 | |
| 35 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
| 36 | if (mux == CLKR_SRC_CLKR) |
Jarkko Nikula | 425925d | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 37 | v &= ~OMAP2_MCBSP1_CLKR_MASK; |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 38 | else if (mux == CLKR_SRC_CLKX) |
| 39 | v |= OMAP2_MCBSP1_CLKR_MASK; |
| 40 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); |
| 41 | } |
| 42 | EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src); |
| 43 | |
| 44 | void omap2_mcbsp1_mux_fsr_src(u8 mux) |
| 45 | { |
| 46 | u32 v; |
| 47 | |
| 48 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
| 49 | if (mux == FSR_SRC_FSR) |
Jarkko Nikula | 425925d | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 50 | v &= ~OMAP2_MCBSP1_FSR_MASK; |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 51 | else if (mux == FSR_SRC_FSX) |
| 52 | v |= OMAP2_MCBSP1_FSR_MASK; |
| 53 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); |
| 54 | } |
| 55 | EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src); |
| 56 | |
Paul Walmsley | d135865 | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 57 | /* McBSP CLKS source switching function */ |
| 58 | |
| 59 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) |
| 60 | { |
| 61 | struct omap_mcbsp *mcbsp; |
| 62 | struct clk *fck_src; |
| 63 | char *fck_src_name; |
| 64 | int r; |
| 65 | |
| 66 | if (!omap_mcbsp_check_valid_id(id)) { |
| 67 | pr_err("%s: Invalid id (%d)\n", __func__, id + 1); |
| 68 | return -EINVAL; |
| 69 | } |
| 70 | mcbsp = id_to_mcbsp_ptr(id); |
| 71 | |
| 72 | if (fck_src_id == MCBSP_CLKS_PAD_SRC) |
| 73 | fck_src_name = "pad_fck"; |
| 74 | else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) |
| 75 | fck_src_name = "prcm_fck"; |
| 76 | else |
| 77 | return -EINVAL; |
| 78 | |
| 79 | fck_src = clk_get(mcbsp->dev, fck_src_name); |
| 80 | if (IS_ERR_OR_NULL(fck_src)) { |
| 81 | pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks", |
| 82 | fck_src_name); |
| 83 | return -EINVAL; |
| 84 | } |
| 85 | |
| 86 | clk_disable(mcbsp->fclk); |
| 87 | |
| 88 | r = clk_set_parent(mcbsp->fclk, fck_src); |
| 89 | if (IS_ERR_VALUE(r)) { |
| 90 | pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n", |
| 91 | "clks", fck_src_name); |
| 92 | clk_put(fck_src); |
| 93 | return -EINVAL; |
| 94 | } |
| 95 | |
| 96 | clk_enable(mcbsp->fclk); |
| 97 | |
| 98 | clk_put(fck_src); |
| 99 | |
| 100 | return 0; |
| 101 | } |
| 102 | EXPORT_SYMBOL(omap2_mcbsp_set_clks_src); |
| 103 | |
| 104 | |
Paul Walmsley | cf4c87a | 2010-10-08 11:40:19 -0600 | [diff] [blame] | 105 | /* Platform data */ |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 106 | |
Tony Lindgren | 59b479e | 2011-01-27 16:39:40 -0800 | [diff] [blame] | 107 | #ifdef CONFIG_SOC_OMAP2420 |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 108 | static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 109 | { |
Russell King | 6584690 | 2008-09-03 23:46:18 +0100 | [diff] [blame] | 110 | .phys_base = OMAP24XX_MCBSP1_BASE, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 111 | .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, |
| 112 | .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, |
| 113 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
| 114 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 115 | }, |
| 116 | { |
Russell King | 6584690 | 2008-09-03 23:46:18 +0100 | [diff] [blame] | 117 | .phys_base = OMAP24XX_MCBSP2_BASE, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 118 | .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, |
| 119 | .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, |
| 120 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
| 121 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 122 | }, |
| 123 | }; |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 124 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 125 | #define OMAP2420_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 126 | #else |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 127 | #define omap2420_mcbsp_pdata NULL |
| 128 | #define OMAP2420_MCBSP_PDATA_SZ 0 |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 129 | #define OMAP2420_MCBSP_REG_NUM 0 |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 130 | #endif |
| 131 | |
Tony Lindgren | 59b479e | 2011-01-27 16:39:40 -0800 | [diff] [blame] | 132 | #ifdef CONFIG_SOC_OMAP2430 |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 133 | static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { |
| 134 | { |
| 135 | .phys_base = OMAP24XX_MCBSP1_BASE, |
| 136 | .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, |
| 137 | .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, |
| 138 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
| 139 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 140 | }, |
| 141 | { |
| 142 | .phys_base = OMAP24XX_MCBSP2_BASE, |
| 143 | .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, |
| 144 | .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, |
| 145 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
| 146 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 147 | }, |
| 148 | { |
| 149 | .phys_base = OMAP2430_MCBSP3_BASE, |
| 150 | .dma_rx_sync = OMAP24XX_DMA_MCBSP3_RX, |
| 151 | .dma_tx_sync = OMAP24XX_DMA_MCBSP3_TX, |
| 152 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, |
| 153 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 154 | }, |
| 155 | { |
| 156 | .phys_base = OMAP2430_MCBSP4_BASE, |
| 157 | .dma_rx_sync = OMAP24XX_DMA_MCBSP4_RX, |
| 158 | .dma_tx_sync = OMAP24XX_DMA_MCBSP4_TX, |
| 159 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, |
| 160 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 161 | }, |
| 162 | { |
| 163 | .phys_base = OMAP2430_MCBSP5_BASE, |
| 164 | .dma_rx_sync = OMAP24XX_DMA_MCBSP5_RX, |
| 165 | .dma_tx_sync = OMAP24XX_DMA_MCBSP5_TX, |
| 166 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, |
| 167 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 168 | }, |
| 169 | }; |
| 170 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 171 | #define OMAP2430_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 172 | #else |
| 173 | #define omap2430_mcbsp_pdata NULL |
| 174 | #define OMAP2430_MCBSP_PDATA_SZ 0 |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 175 | #define OMAP2430_MCBSP_REG_NUM 0 |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 176 | #endif |
| 177 | |
Tony Lindgren | a8eb7ca | 2010-02-12 12:26:48 -0800 | [diff] [blame] | 178 | #ifdef CONFIG_ARCH_OMAP3 |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 179 | static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { |
| 180 | { |
Russell King | 6584690 | 2008-09-03 23:46:18 +0100 | [diff] [blame] | 181 | .phys_base = OMAP34XX_MCBSP1_BASE, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 182 | .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, |
| 183 | .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, |
| 184 | .rx_irq = INT_24XX_MCBSP1_IRQ_RX, |
| 185 | .tx_irq = INT_24XX_MCBSP1_IRQ_TX, |
Peter Ujfalusi | 451fd82 | 2010-06-03 07:39:33 +0300 | [diff] [blame] | 186 | .buffer_size = 0x80, /* The FIFO has 128 locations */ |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 187 | }, |
| 188 | { |
Russell King | 6584690 | 2008-09-03 23:46:18 +0100 | [diff] [blame] | 189 | .phys_base = OMAP34XX_MCBSP2_BASE, |
Eero Nurkkala | d912fa9 | 2010-02-22 12:21:11 +0000 | [diff] [blame] | 190 | .phys_base_st = OMAP34XX_MCBSP2_ST_BASE, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 191 | .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, |
| 192 | .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, |
| 193 | .rx_irq = INT_24XX_MCBSP2_IRQ_RX, |
| 194 | .tx_irq = INT_24XX_MCBSP2_IRQ_TX, |
Peter Ujfalusi | 451fd82 | 2010-06-03 07:39:33 +0300 | [diff] [blame] | 195 | .buffer_size = 0x500, /* The FIFO has 1024 + 256 locations */ |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 196 | }, |
Chandra Shekhar | 9c8e3a0 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 197 | { |
| 198 | .phys_base = OMAP34XX_MCBSP3_BASE, |
Eero Nurkkala | d912fa9 | 2010-02-22 12:21:11 +0000 | [diff] [blame] | 199 | .phys_base_st = OMAP34XX_MCBSP3_ST_BASE, |
Chandra Shekhar | 9c8e3a0 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 200 | .dma_rx_sync = OMAP24XX_DMA_MCBSP3_RX, |
| 201 | .dma_tx_sync = OMAP24XX_DMA_MCBSP3_TX, |
| 202 | .rx_irq = INT_24XX_MCBSP3_IRQ_RX, |
| 203 | .tx_irq = INT_24XX_MCBSP3_IRQ_TX, |
Peter Ujfalusi | 451fd82 | 2010-06-03 07:39:33 +0300 | [diff] [blame] | 204 | .buffer_size = 0x80, /* The FIFO has 128 locations */ |
Chandra Shekhar | 9c8e3a0 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 205 | }, |
| 206 | { |
| 207 | .phys_base = OMAP34XX_MCBSP4_BASE, |
| 208 | .dma_rx_sync = OMAP24XX_DMA_MCBSP4_RX, |
| 209 | .dma_tx_sync = OMAP24XX_DMA_MCBSP4_TX, |
| 210 | .rx_irq = INT_24XX_MCBSP4_IRQ_RX, |
| 211 | .tx_irq = INT_24XX_MCBSP4_IRQ_TX, |
Peter Ujfalusi | 451fd82 | 2010-06-03 07:39:33 +0300 | [diff] [blame] | 212 | .buffer_size = 0x80, /* The FIFO has 128 locations */ |
Chandra Shekhar | 9c8e3a0 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 213 | }, |
| 214 | { |
| 215 | .phys_base = OMAP34XX_MCBSP5_BASE, |
| 216 | .dma_rx_sync = OMAP24XX_DMA_MCBSP5_RX, |
| 217 | .dma_tx_sync = OMAP24XX_DMA_MCBSP5_TX, |
| 218 | .rx_irq = INT_24XX_MCBSP5_IRQ_RX, |
| 219 | .tx_irq = INT_24XX_MCBSP5_IRQ_TX, |
Peter Ujfalusi | 451fd82 | 2010-06-03 07:39:33 +0300 | [diff] [blame] | 220 | .buffer_size = 0x80, /* The FIFO has 128 locations */ |
Chandra Shekhar | 9c8e3a0 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 221 | }, |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 222 | }; |
| 223 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 224 | #define OMAP34XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 225 | #else |
| 226 | #define omap34xx_mcbsp_pdata NULL |
| 227 | #define OMAP34XX_MCBSP_PDATA_SZ 0 |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 228 | #define OMAP34XX_MCBSP_REG_NUM 0 |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 229 | #endif |
| 230 | |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 231 | static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = { |
| 232 | { |
| 233 | .phys_base = OMAP44XX_MCBSP1_BASE, |
| 234 | .dma_rx_sync = OMAP44XX_DMA_MCBSP1_RX, |
| 235 | .dma_tx_sync = OMAP44XX_DMA_MCBSP1_TX, |
Jorge Eduardo Candelaria | 9319b9d | 2010-05-12 12:18:39 -0500 | [diff] [blame] | 236 | .tx_irq = OMAP44XX_IRQ_MCBSP1, |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 237 | }, |
| 238 | { |
| 239 | .phys_base = OMAP44XX_MCBSP2_BASE, |
| 240 | .dma_rx_sync = OMAP44XX_DMA_MCBSP2_RX, |
| 241 | .dma_tx_sync = OMAP44XX_DMA_MCBSP2_TX, |
Jorge Eduardo Candelaria | 9319b9d | 2010-05-12 12:18:39 -0500 | [diff] [blame] | 242 | .tx_irq = OMAP44XX_IRQ_MCBSP2, |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 243 | }, |
| 244 | { |
| 245 | .phys_base = OMAP44XX_MCBSP3_BASE, |
| 246 | .dma_rx_sync = OMAP44XX_DMA_MCBSP3_RX, |
| 247 | .dma_tx_sync = OMAP44XX_DMA_MCBSP3_TX, |
Jorge Eduardo Candelaria | 9319b9d | 2010-05-12 12:18:39 -0500 | [diff] [blame] | 248 | .tx_irq = OMAP44XX_IRQ_MCBSP3, |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 249 | }, |
| 250 | { |
| 251 | .phys_base = OMAP44XX_MCBSP4_BASE, |
| 252 | .dma_rx_sync = OMAP44XX_DMA_MCBSP4_RX, |
| 253 | .dma_tx_sync = OMAP44XX_DMA_MCBSP4_TX, |
Jorge Eduardo Candelaria | 9319b9d | 2010-05-12 12:18:39 -0500 | [diff] [blame] | 254 | .tx_irq = OMAP44XX_IRQ_MCBSP4, |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 255 | }, |
| 256 | }; |
| 257 | #define OMAP44XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap44xx_mcbsp_pdata) |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 258 | #define OMAP44XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 259 | |
Chandra Shekhar | b4b58f5 | 2008-10-08 10:01:39 +0300 | [diff] [blame] | 260 | static int __init omap2_mcbsp_init(void) |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 261 | { |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 262 | if (cpu_is_omap2420()) { |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 263 | omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ; |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 264 | omap_mcbsp_cache_size = OMAP2420_MCBSP_REG_NUM * sizeof(u16); |
| 265 | } else if (cpu_is_omap2430()) { |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 266 | omap_mcbsp_count = OMAP2430_MCBSP_PDATA_SZ; |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 267 | omap_mcbsp_cache_size = OMAP2430_MCBSP_REG_NUM * sizeof(u32); |
| 268 | } else if (cpu_is_omap34xx()) { |
Chandra Shekhar | b4b58f5 | 2008-10-08 10:01:39 +0300 | [diff] [blame] | 269 | omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ; |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 270 | omap_mcbsp_cache_size = OMAP34XX_MCBSP_REG_NUM * sizeof(u32); |
| 271 | } else if (cpu_is_omap44xx()) { |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 272 | omap_mcbsp_count = OMAP44XX_MCBSP_PDATA_SZ; |
Janusz Krzysztofik | c8c9969 | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 273 | omap_mcbsp_cache_size = OMAP44XX_MCBSP_REG_NUM * sizeof(u32); |
| 274 | } |
Chandra Shekhar | b4b58f5 | 2008-10-08 10:01:39 +0300 | [diff] [blame] | 275 | |
| 276 | mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), |
| 277 | GFP_KERNEL); |
| 278 | if (!mcbsp_ptr) |
| 279 | return -ENOMEM; |
| 280 | |
Jarkko Nikula | 05228c3 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 281 | if (cpu_is_omap2420()) |
| 282 | omap_mcbsp_register_board_cfg(omap2420_mcbsp_pdata, |
| 283 | OMAP2420_MCBSP_PDATA_SZ); |
| 284 | if (cpu_is_omap2430()) |
| 285 | omap_mcbsp_register_board_cfg(omap2430_mcbsp_pdata, |
| 286 | OMAP2430_MCBSP_PDATA_SZ); |
Chandra Shekhar | 9c8e3a0 | 2008-10-08 10:01:40 +0300 | [diff] [blame] | 287 | if (cpu_is_omap34xx()) |
| 288 | omap_mcbsp_register_board_cfg(omap34xx_mcbsp_pdata, |
| 289 | OMAP34XX_MCBSP_PDATA_SZ); |
Syed Rafiuddin | a5b92cc | 2009-07-28 18:57:10 +0530 | [diff] [blame] | 290 | if (cpu_is_omap44xx()) |
| 291 | omap_mcbsp_register_board_cfg(omap44xx_mcbsp_pdata, |
| 292 | OMAP44XX_MCBSP_PDATA_SZ); |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 293 | |
Eduardo Valentin | 78673bc | 2008-07-03 12:24:40 +0300 | [diff] [blame] | 294 | return omap_mcbsp_init(); |
| 295 | } |
| 296 | arch_initcall(omap2_mcbsp_init); |