diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-10-03 06:52:33 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-03 06:52:33 -0400 |
commit | 56f68556d7bbb51dd158c74deb09c783345bfbbd (patch) | |
tree | 536e6e3c7063b1eee927194dda257602bd3dc66f /arch/arm/plat-omap/mcbsp.c | |
parent | fd9470ce3ac6fb54d6026e4b1cdab0936e34805e (diff) | |
parent | 7c8ad9828e793573877fd60868bb5d2f1e3b64da (diff) |
Merge unstable branch 'omap-rmk'
Merge branch 'omap-rmk' into omap-all
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index d0844050f2d2..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; |
@@ -651,7 +652,7 @@ int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, | |||
651 | omap_set_dma_dest_params(mcbsp[id].dma_tx_lch, | 652 | omap_set_dma_dest_params(mcbsp[id].dma_tx_lch, |
652 | src_port, | 653 | src_port, |
653 | OMAP_DMA_AMODE_CONSTANT, | 654 | OMAP_DMA_AMODE_CONSTANT, |
654 | mcbsp[id].io_base + OMAP_MCBSP_REG_DXR1, | 655 | mcbsp[id].phys_base + OMAP_MCBSP_REG_DXR1, |
655 | 0, 0); | 656 | 0, 0); |
656 | 657 | ||
657 | omap_set_dma_src_params(mcbsp[id].dma_tx_lch, | 658 | omap_set_dma_src_params(mcbsp[id].dma_tx_lch, |
@@ -712,7 +713,7 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, | |||
712 | omap_set_dma_src_params(mcbsp[id].dma_rx_lch, | 713 | omap_set_dma_src_params(mcbsp[id].dma_rx_lch, |
713 | src_port, | 714 | src_port, |
714 | OMAP_DMA_AMODE_CONSTANT, | 715 | OMAP_DMA_AMODE_CONSTANT, |
715 | mcbsp[id].io_base + OMAP_MCBSP_REG_DRR1, | 716 | mcbsp[id].phys_base + OMAP_MCBSP_REG_DRR1, |
716 | 0, 0); | 717 | 0, 0); |
717 | 718 | ||
718 | omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, | 719 | omap_set_dma_dest_params(mcbsp[id].dma_rx_lch, |
@@ -830,7 +831,13 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev) | |||
830 | mcbsp[id].dma_tx_lch = -1; | 831 | mcbsp[id].dma_tx_lch = -1; |
831 | mcbsp[id].dma_rx_lch = -1; | 832 | mcbsp[id].dma_rx_lch = -1; |
832 | 833 | ||
833 | mcbsp[id].io_base = pdata->virt_base; | 834 | mcbsp[id].phys_base = pdata->phys_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 | |||
834 | /* Default I/O is IRQ based */ | 841 | /* Default I/O is IRQ based */ |
835 | mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO; | 842 | mcbsp[id].io_type = OMAP_MCBSP_IRQ_IO; |
836 | mcbsp[id].tx_irq = pdata->tx_irq; | 843 | mcbsp[id].tx_irq = pdata->tx_irq; |
@@ -841,18 +848,22 @@ static int __init omap_mcbsp_probe(struct platform_device *pdev) | |||
841 | if (pdata->clk_name) | 848 | if (pdata->clk_name) |
842 | mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name); | 849 | mcbsp[id].clk = clk_get(&pdev->dev, pdata->clk_name); |
843 | if (IS_ERR(mcbsp[id].clk)) { | 850 | if (IS_ERR(mcbsp[id].clk)) { |
844 | mcbsp[id].free = 0; | ||
845 | dev_err(&pdev->dev, | 851 | dev_err(&pdev->dev, |
846 | "Invalid clock configuration for McBSP%d.\n", | 852 | "Invalid clock configuration for McBSP%d.\n", |
847 | mcbsp[id].id); | 853 | mcbsp[id].id); |
848 | ret = -EINVAL; | 854 | ret = PTR_ERR(mcbsp[id].clk); |
849 | goto exit; | 855 | goto err_clk; |
850 | } | 856 | } |
851 | 857 | ||
852 | mcbsp[id].pdata = pdata; | 858 | mcbsp[id].pdata = pdata; |
853 | mcbsp[id].dev = &pdev->dev; | 859 | mcbsp[id].dev = &pdev->dev; |
854 | platform_set_drvdata(pdev, &mcbsp[id]); | 860 | platform_set_drvdata(pdev, &mcbsp[id]); |
861 | return 0; | ||
855 | 862 | ||
863 | err_clk: | ||
864 | iounmap(mcbsp[id].io_base); | ||
865 | err_ioremap: | ||
866 | mcbsp[id].free = 0; | ||
856 | exit: | 867 | exit: |
857 | return ret; | 868 | return ret; |
858 | } | 869 | } |
@@ -871,6 +882,8 @@ static int omap_mcbsp_remove(struct platform_device *pdev) | |||
871 | clk_disable(mcbsp->clk); | 882 | clk_disable(mcbsp->clk); |
872 | clk_put(mcbsp->clk); | 883 | clk_put(mcbsp->clk); |
873 | 884 | ||
885 | iounmap(mcbsp->io_base); | ||
886 | |||
874 | mcbsp->clk = NULL; | 887 | mcbsp->clk = NULL; |
875 | mcbsp->free = 0; | 888 | mcbsp->free = 0; |
876 | mcbsp->dev = NULL; | 889 | mcbsp->dev = NULL; |