aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-09-04 09:25:42 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-05 12:02:30 -0400
commitd592dd1adc4f57171fa2570a94279d887b78d5b5 (patch)
tree61abfb1d8c05aece32bbd62870c0ae6b7a38f4af
parent55c381e4896be2611da87088acfad74b361239ab (diff)
[ARM] omap: convert mcbsp to use ioremap()
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-omap1/mcbsp.c8
-rw-r--r--arch/arm/mach-omap2/mcbsp.c4
-rw-r--r--arch/arm/plat-omap/include/mach/mcbsp.h3
-rw-r--r--arch/arm/plat-omap/mcbsp.c42
4 files changed, 28 insertions, 29 deletions
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index 2baeaeb0c900..afb5789f94f9 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -160,7 +160,6 @@ static struct omap_mcbsp_ops omap1_mcbsp_ops = {
160static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = { 160static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
161 { 161 {
162 .phys_base = OMAP730_MCBSP1_BASE, 162 .phys_base = OMAP730_MCBSP1_BASE,
163 .virt_base = io_p2v(OMAP730_MCBSP1_BASE),
164 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 163 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
165 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 164 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
166 .rx_irq = INT_730_McBSP1RX, 165 .rx_irq = INT_730_McBSP1RX,
@@ -169,7 +168,6 @@ static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
169 }, 168 },
170 { 169 {
171 .phys_base = OMAP730_MCBSP2_BASE, 170 .phys_base = OMAP730_MCBSP2_BASE,
172 .virt_base = io_p2v(OMAP730_MCBSP2_BASE),
173 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 171 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
174 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 172 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
175 .rx_irq = INT_730_McBSP2RX, 173 .rx_irq = INT_730_McBSP2RX,
@@ -187,7 +185,6 @@ static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
187static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { 185static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
188 { 186 {
189 .phys_base = OMAP1510_MCBSP1_BASE, 187 .phys_base = OMAP1510_MCBSP1_BASE,
190 .virt_base = OMAP1510_MCBSP1_BASE,
191 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 188 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
192 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 189 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
193 .rx_irq = INT_McBSP1RX, 190 .rx_irq = INT_McBSP1RX,
@@ -197,7 +194,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
197 }, 194 },
198 { 195 {
199 .phys_base = OMAP1510_MCBSP2_BASE, 196 .phys_base = OMAP1510_MCBSP2_BASE,
200 .virt_base = io_p2v(OMAP1510_MCBSP2_BASE),
201 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 197 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
202 .dma_tx_sync = OMAP_DMA_MCBSP2_TX, 198 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
203 .rx_irq = INT_1510_SPI_RX, 199 .rx_irq = INT_1510_SPI_RX,
@@ -206,7 +202,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
206 }, 202 },
207 { 203 {
208 .phys_base = OMAP1510_MCBSP3_BASE, 204 .phys_base = OMAP1510_MCBSP3_BASE,
209 .virt_base = OMAP1510_MCBSP3_BASE,
210 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 205 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
211 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 206 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
212 .rx_irq = INT_McBSP3RX, 207 .rx_irq = INT_McBSP3RX,
@@ -225,7 +220,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
225static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { 220static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
226 { 221 {
227 .phys_base = OMAP1610_MCBSP1_BASE, 222 .phys_base = OMAP1610_MCBSP1_BASE,
228 .virt_base = OMAP1610_MCBSP1_BASE,
229 .dma_rx_sync = OMAP_DMA_MCBSP1_RX, 223 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
230 .dma_tx_sync = OMAP_DMA_MCBSP1_TX, 224 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
231 .rx_irq = INT_McBSP1RX, 225 .rx_irq = INT_McBSP1RX,
@@ -235,7 +229,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
235 }, 229 },
236 { 230 {
237 .phys_base = OMAP1610_MCBSP2_BASE, 231 .phys_base = OMAP1610_MCBSP2_BASE,
238 .virt_base = io_p2v(OMAP1610_MCBSP2_BASE),
239 .dma_rx_sync = OMAP_DMA_MCBSP2_RX, 232 .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
240 .dma_tx_sync = OMAP_DMA_MCBSP2_TX, 233 .dma_tx_sync = OMAP_DMA_MCBSP2_TX,
241 .rx_irq = INT_1610_McBSP2_RX, 234 .rx_irq = INT_1610_McBSP2_RX,
@@ -244,7 +237,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
244 }, 237 },
245 { 238 {
246 .phys_base = OMAP1610_MCBSP3_BASE, 239 .phys_base = OMAP1610_MCBSP3_BASE,
247 .virt_base = OMAP1610_MCBSP3_BASE,
248 .dma_rx_sync = OMAP_DMA_MCBSP3_RX, 240 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
249 .dma_tx_sync = OMAP_DMA_MCBSP3_TX, 241 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
250 .rx_irq = INT_McBSP3RX, 242 .rx_irq = INT_McBSP3RX,
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index b261f1f80b5e..709db03b9999 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -135,7 +135,6 @@ static struct omap_mcbsp_ops omap2_mcbsp_ops = {
135static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = { 135static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
136 { 136 {
137 .phys_base = OMAP24XX_MCBSP1_BASE, 137 .phys_base = OMAP24XX_MCBSP1_BASE,
138 .virt_base = IO_ADDRESS(OMAP24XX_MCBSP1_BASE),
139 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, 138 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
140 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, 139 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
141 .rx_irq = INT_24XX_MCBSP1_IRQ_RX, 140 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
@@ -145,7 +144,6 @@ static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
145 }, 144 },
146 { 145 {
147 .phys_base = OMAP24XX_MCBSP2_BASE, 146 .phys_base = OMAP24XX_MCBSP2_BASE,
148 .virt_base = IO_ADDRESS(OMAP24XX_MCBSP2_BASE),
149 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, 147 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
150 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, 148 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
151 .rx_irq = INT_24XX_MCBSP2_IRQ_RX, 149 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
@@ -164,7 +162,6 @@ static struct omap_mcbsp_platform_data omap24xx_mcbsp_pdata[] = {
164static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { 162static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
165 { 163 {
166 .phys_base = OMAP34XX_MCBSP1_BASE, 164 .phys_base = OMAP34XX_MCBSP1_BASE,
167 .virt_base = IO_ADDRESS(OMAP34XX_MCBSP1_BASE),
168 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX, 165 .dma_rx_sync = OMAP24XX_DMA_MCBSP1_RX,
169 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX, 166 .dma_tx_sync = OMAP24XX_DMA_MCBSP1_TX,
170 .rx_irq = INT_24XX_MCBSP1_IRQ_RX, 167 .rx_irq = INT_24XX_MCBSP1_IRQ_RX,
@@ -174,7 +171,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
174 }, 171 },
175 { 172 {
176 .phys_base = OMAP34XX_MCBSP2_BASE, 173 .phys_base = OMAP34XX_MCBSP2_BASE,
177 .virt_base = IO_ADDRESS(OMAP34XX_MCBSP2_BASE),
178 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX, 174 .dma_rx_sync = OMAP24XX_DMA_MCBSP2_RX,
179 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX, 175 .dma_tx_sync = OMAP24XX_DMA_MCBSP2_TX,
180 .rx_irq = INT_24XX_MCBSP2_IRQ_RX, 176 .rx_irq = INT_24XX_MCBSP2_IRQ_RX,
diff --git a/arch/arm/plat-omap/include/mach/mcbsp.h b/arch/arm/plat-omap/include/mach/mcbsp.h
index 8fdb95e26fcd..a3074f2fb7ce 100644
--- a/arch/arm/plat-omap/include/mach/mcbsp.h
+++ b/arch/arm/plat-omap/include/mach/mcbsp.h
@@ -316,7 +316,6 @@ struct omap_mcbsp_ops {
316 316
317struct omap_mcbsp_platform_data { 317struct omap_mcbsp_platform_data {
318 unsigned long phys_base; 318 unsigned long phys_base;
319 u32 virt_base;
320 u8 dma_rx_sync, dma_tx_sync; 319 u8 dma_rx_sync, dma_tx_sync;
321 u16 rx_irq, tx_irq; 320 u16 rx_irq, tx_irq;
322 struct omap_mcbsp_ops *ops; 321 struct omap_mcbsp_ops *ops;
@@ -326,7 +325,7 @@ struct omap_mcbsp_platform_data {
326struct omap_mcbsp { 325struct omap_mcbsp {
327 struct device *dev; 326 struct device *dev;
328 unsigned long phys_base; 327 unsigned long phys_base;
329 u32 io_base; 328 void __iomem *io_base;
330 u8 id; 329 u8 id;
331 u8 free; 330 u8 free;
332 omap_mcbsp_word_length rx_word_length; 331 omap_mcbsp_word_length rx_word_length;
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 014d26574bb6..e63990fd923f 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -126,7 +126,7 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
126 */ 126 */
127void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) 127void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
128{ 128{
129 u32 io_base; 129 void __iomem *io_base;
130 130
131 if (!omap_mcbsp_check_valid_id(id)) { 131 if (!omap_mcbsp_check_valid_id(id)) {
132 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 132 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -134,8 +134,8 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
134 } 134 }
135 135
136 io_base = mcbsp[id].io_base; 136 io_base = mcbsp[id].io_base;
137 dev_dbg(mcbsp[id].dev, "Configuring McBSP%d io_base: 0x%8x\n", 137 dev_dbg(mcbsp[id].dev, "Configuring McBSP%d phys_base: 0x%08lx\n",
138 mcbsp[id].id, io_base); 138 mcbsp[id].id, mcbsp[id].phys_base);
139 139
140 /* We write the given config */ 140 /* We write the given config */
141 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2); 141 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2);
@@ -273,7 +273,7 @@ EXPORT_SYMBOL(omap_mcbsp_free);
273 */ 273 */
274void omap_mcbsp_start(unsigned int id) 274void omap_mcbsp_start(unsigned int id)
275{ 275{
276 u32 io_base; 276 void __iomem *io_base;
277 u16 w; 277 u16 w;
278 278
279 if (!omap_mcbsp_check_valid_id(id)) { 279 if (!omap_mcbsp_check_valid_id(id)) {
@@ -310,7 +310,7 @@ EXPORT_SYMBOL(omap_mcbsp_start);
310 310
311void omap_mcbsp_stop(unsigned int id) 311void omap_mcbsp_stop(unsigned int id)
312{ 312{
313 u32 io_base; 313 void __iomem *io_base;
314 u16 w; 314 u16 w;
315 315
316 if (!omap_mcbsp_check_valid_id(id)) { 316 if (!omap_mcbsp_check_valid_id(id)) {
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(omap_mcbsp_stop);
337/* polled mcbsp i/o operations */ 337/* polled mcbsp i/o operations */
338int omap_mcbsp_pollwrite(unsigned int id, u16 buf) 338int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
339{ 339{
340 u32 base; 340 void __iomem *base;
341 341
342 if (!omap_mcbsp_check_valid_id(id)) { 342 if (!omap_mcbsp_check_valid_id(id)) {
343 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 343 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -379,7 +379,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollwrite);
379 379
380int omap_mcbsp_pollread(unsigned int id, u16 *buf) 380int omap_mcbsp_pollread(unsigned int id, u16 *buf)
381{ 381{
382 u32 base; 382 void __iomem *base;
383 383
384 if (!omap_mcbsp_check_valid_id(id)) { 384 if (!omap_mcbsp_check_valid_id(id)) {
385 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 385 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -424,7 +424,7 @@ EXPORT_SYMBOL(omap_mcbsp_pollread);
424 */ 424 */
425void omap_mcbsp_xmit_word(unsigned int id, u32 word) 425void omap_mcbsp_xmit_word(unsigned int id, u32 word)
426{ 426{
427 u32 io_base; 427 void __iomem *io_base;
428 omap_mcbsp_word_length word_length; 428 omap_mcbsp_word_length word_length;
429 429
430 if (!omap_mcbsp_check_valid_id(id)) { 430 if (!omap_mcbsp_check_valid_id(id)) {
@@ -445,7 +445,7 @@ EXPORT_SYMBOL(omap_mcbsp_xmit_word);
445 445
446u32 omap_mcbsp_recv_word(unsigned int id) 446u32 omap_mcbsp_recv_word(unsigned int id)
447{ 447{
448 u32 io_base; 448 void __iomem *io_base;
449 u16 word_lsb, word_msb = 0; 449 u16 word_lsb, word_msb = 0;
450 omap_mcbsp_word_length word_length; 450 omap_mcbsp_word_length word_length;
451 451
@@ -469,7 +469,7 @@ EXPORT_SYMBOL(omap_mcbsp_recv_word);
469 469
470int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) 470int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
471{ 471{
472 u32 io_base; 472 void __iomem *io_base;
473 omap_mcbsp_word_length tx_word_length; 473 omap_mcbsp_word_length tx_word_length;
474 omap_mcbsp_word_length rx_word_length; 474 omap_mcbsp_word_length rx_word_length;
475 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 475 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
@@ -534,7 +534,8 @@ EXPORT_SYMBOL(omap_mcbsp_spi_master_xmit_word_poll);
534 534
535int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word) 535int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
536{ 536{
537 u32 io_base, clock_word = 0; 537 u32 clock_word = 0;
538 void __iomem *io_base;
538 omap_mcbsp_word_length tx_word_length; 539 omap_mcbsp_word_length tx_word_length;
539 omap_mcbsp_word_length rx_word_length; 540 omap_mcbsp_word_length rx_word_length;
540 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 541 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
@@ -831,7 +832,12 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev)
831 mcbsp[id].dma_rx_lch = -1; 832 mcbsp[id].dma_rx_lch = -1;
832 833
833 mcbsp[id].phys_base = pdata->phys_base; 834 mcbsp[id].phys_base = pdata->phys_base;
834 mcbsp[id].io_base = pdata->virt_base; 835 mcbsp[id].io_base = ioremap(pdata->phys_base, SZ_4K);
836 if (!mcbsp[id].io_base) {
837 ret = -ENOMEM;
838 goto err_ioremap;
839 }
840
835 /* Default I/O is IRQ based */ 841 /* Default I/O is IRQ based */
836 mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO; 842 mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO;
837 mcbsp[id].tx_irq = pdata->tx_irq; 843 mcbsp[id].tx_irq = pdata->tx_irq;
@@ -842,18 +848,22 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev)
842 if (pdata->clk_name) 848 if (pdata->clk_name)
843 mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name); 849 mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name);
844 if (IS_ERR(mcbsp[id].clk)) { 850 if (IS_ERR(mcbsp[id].clk)) {
845 mcbsp[id].free = 0;
846 dev_err(&pdev->dev, 851 dev_err(&pdev->dev,
847 "Invalid clock configuration for McBSP%d.\n", 852 "Invalid clock configuration for McBSP%d.\n",
848 mcbsp[id].id); 853 mcbsp[id].id);
849 ret = -EINVAL; 854 ret = PTR_ERR(mcbsp[id].clk);
850 goto exit; 855 goto err_clk;
851 } 856 }
852 857
853 mcbsp[id].pdata = pdata; 858 mcbsp[id].pdata = pdata;
854 mcbsp[id].dev = &pdev->dev; 859 mcbsp[id].dev = &pdev->dev;
855 platform_set_drvdata(pdev, &mcbsp[id]); 860 platform_set_drvdata(pdev, &mcbsp[id]);
861 return 0;
856 862
863err_clk:
864 iounmap(mcbsp[id].io_base);
865err_ioremap:
866 mcbsp[id].free = 0;
857exit: 867exit:
858 return ret; 868 return ret;
859} 869}
@@ -872,6 +882,8 @@ static int omap_mcbsp_remove(struct platform_device *pdev)
872 clk_disable(mcbsp->clk); 882 clk_disable(mcbsp->clk);
873 clk_put(mcbsp->clk); 883 clk_put(mcbsp->clk);
874 884
885 iounmap(mcbsp->io_base);
886
875 mcbsp->clk = NULL; 887 mcbsp->clk = NULL;
876 mcbsp->free = 0; 888 mcbsp->free = 0;
877 mcbsp->dev = NULL; 889 mcbsp->dev = NULL;