diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-09-04 09:25:42 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-05 12:02:30 -0400 |
commit | d592dd1adc4f57171fa2570a94279d887b78d5b5 (patch) | |
tree | 61abfb1d8c05aece32bbd62870c0ae6b7a38f4af /arch/arm/plat-omap/mcbsp.c | |
parent | 55c381e4896be2611da87088acfad74b361239ab (diff) |
[ARM] omap: convert mcbsp to use ioremap()
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 42 |
1 files changed, 27 insertions, 15 deletions
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 | */ |
127 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) | 127 | void 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 | */ |
274 | void omap_mcbsp_start(unsigned int id) | 274 | void 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 | ||
311 | void omap_mcbsp_stop(unsigned int id) | 311 | void 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 */ |
338 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf) | 338 | int 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 | ||
380 | int omap_mcbsp_pollread(unsigned int id, u16 *buf) | 380 | int 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 | */ |
425 | void omap_mcbsp_xmit_word(unsigned int id, u32 word) | 425 | void 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 | ||
446 | u32 omap_mcbsp_recv_word(unsigned int id) | 446 | u32 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 | ||
470 | int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) | 470 | int 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 | ||
535 | int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word) | 535 | int 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 | ||
863 | err_clk: | ||
864 | iounmap(mcbsp[id].io_base); | ||
865 | err_ioremap: | ||
866 | mcbsp[id].free = 0; | ||
857 | exit: | 867 | exit: |
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; |