From f228a725b975832ac5771ab2fc86d06bd694cdb3 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Thu, 4 Sep 2008 16:19:14 -0700 Subject: [PATCH] ARM: OMAP: Remove io_p2v, use ioremap and XXX_IO_ADDRESS In general, drivers should now use ioremap. Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/board-n800-audio.c | 14 ++++------ arch/arm/plat-omap/include/mach/sti.h | 2 +- drivers/bluetooth/brf6150.c | 15 ++++++++-- drivers/bluetooth/hci_h4p/core.c | 15 ++++++++-- drivers/cbus/cbus.c | 2 +- drivers/media/video/omap/omap16xxcam.c | 2 +- drivers/misc/sti/sti.c | 38 ++++++++++++-------------- drivers/mtd/nand/omap-hw.c | 2 +- 8 files changed, 52 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-omap2/board-n800-audio.c b/arch/arm/mach-omap2/board-n800-audio.c index ebaf21f689f..e28390e0c19 100644 --- a/arch/arm/mach-omap2/board-n800-audio.c +++ b/arch/arm/mach-omap2/board-n800-audio.c @@ -54,13 +54,11 @@ static int eac_mux_disabled = 0; static int clkout2_mux_disabled = 0; static u32 saved_mux[2]; -#define MUX_EAC_IOP2V(x) (__force void __iomem *)io_p2v(x) - static void n800_enable_eac_mux(void) { if (!eac_mux_disabled) return; - __raw_writel(saved_mux[1], MUX_EAC_IOP2V(0x48000124)); + __raw_writel(saved_mux[1], OMAP2_IO_ADDRESS(0x48000124)); eac_mux_disabled = 0; } @@ -70,8 +68,8 @@ static void n800_disable_eac_mux(void) WARN_ON(eac_mux_disabled); return; } - saved_mux[1] = __raw_readl(MUX_EAC_IOP2V(0x48000124)); - __raw_writel(0x1f1f1f1f, MUX_EAC_IOP2V(0x48000124)); + saved_mux[1] = __raw_readl(OMAP2_IO_ADDRESS(0x48000124)); + __raw_writel(0x1f1f1f1f, OMAP2_IO_ADDRESS(0x48000124)); eac_mux_disabled = 1; } @@ -79,7 +77,7 @@ static void n800_enable_clkout2_mux(void) { if (!clkout2_mux_disabled) return; - __raw_writel(saved_mux[0], MUX_EAC_IOP2V(0x480000e8)); + __raw_writel(saved_mux[0], OMAP2_IO_ADDRESS(0x480000e8)); clkout2_mux_disabled = 0; } @@ -91,10 +89,10 @@ static void n800_disable_clkout2_mux(void) WARN_ON(clkout2_mux_disabled); return; } - saved_mux[0] = __raw_readl(MUX_EAC_IOP2V(0x480000e8)); + saved_mux[0] = __raw_readl(OMAP2_IO_ADDRESS(0x480000e8)); l = saved_mux[0] & ~0xff; l |= 0x1f; - __raw_writel(l, MUX_EAC_IOP2V(0x480000e8)); + __raw_writel(l, OMAP2_IO_ADDRESS(0x480000e8)); clkout2_mux_disabled = 1; } diff --git a/arch/arm/plat-omap/include/mach/sti.h b/arch/arm/plat-omap/include/mach/sti.h index d818dc6552d..af439170eba 100644 --- a/arch/arm/plat-omap/include/mach/sti.h +++ b/arch/arm/plat-omap/include/mach/sti.h @@ -127,7 +127,7 @@ enum { #endif /* arch/arm/plat-omap/sti/sti.c */ -extern unsigned long sti_base, sti_channel_base; +extern void __iomem *sti_base, *sti_channel_base; int sti_request_irq(unsigned int irq, void *handler, unsigned long arg); void sti_free_irq(unsigned int irq); diff --git a/drivers/bluetooth/brf6150.c b/drivers/bluetooth/brf6150.c index f47b22fd7d0..476cc6554b9 100644 --- a/drivers/bluetooth/brf6150.c +++ b/drivers/bluetooth/brf6150.c @@ -952,17 +952,26 @@ static int __init brf6150_init(void) case 1: irq = INT_UART1; info->uart_ck = clk_get(NULL, "uart1_ck"); - info->uart_base = io_p2v((unsigned long)OMAP_UART1_BASE); + /* FIXME: Use platform_get_resource for the port */ + info->uart_base = ioremap(OMAP_UART1_BASE, 0x16); + if (!info->uart_base) + goto cleanup; break; case 2: irq = INT_UART2; info->uart_ck = clk_get(NULL, "uart2_ck"); - info->uart_base = io_p2v((unsigned long)OMAP_UART2_BASE); + /* FIXME: Use platform_get_resource for the port */ + info->uart_base = ioremap(OMAP_UART2_BASE, 0x16); + if (!info->uart_base) + goto cleanup; break; case 3: irq = INT_UART3; info->uart_ck = clk_get(NULL, "uart3_ck"); - info->uart_base = io_p2v((unsigned long)OMAP_UART3_BASE); + /* FIXME: Use platform_get_resource for the port */ + info->uart_base = ioremap(OMAP_UART3_BASE, 0x16); + if (!info->uart_base) + goto cleanup; break; default: printk(KERN_ERR "No uart defined\n"); diff --git a/drivers/bluetooth/hci_h4p/core.c b/drivers/bluetooth/hci_h4p/core.c index f3337030fc5..005e6528a14 100644 --- a/drivers/bluetooth/hci_h4p/core.c +++ b/drivers/bluetooth/hci_h4p/core.c @@ -866,7 +866,10 @@ static int hci_h4p_probe(struct platform_device *pdev) info->uart_iclk = clk_get(NULL, "uart1_ick"); info->uart_fclk = clk_get(NULL, "uart1_fck"); } - info->uart_base = (void *)io_p2v(OMAP_UART1_BASE); + /* FIXME: Use platform_get_resource for the port */ + info->uart_base = ioremap(OMAP_UART1_BASE, 0x16); + if (!info->uart_base) + goto cleanup; break; case 2: if (cpu_is_omap16xx()) { @@ -877,7 +880,10 @@ static int hci_h4p_probe(struct platform_device *pdev) info->uart_iclk = clk_get(NULL, "uart2_ick"); info->uart_fclk = clk_get(NULL, "uart2_fck"); } - info->uart_base = (void *)io_p2v(OMAP_UART2_BASE); + /* FIXME: Use platform_get_resource for the port */ + info->uart_base = ioremap(OMAP_UART2_BASE, 0x16); + if (!info->uart_base) + goto cleanup; break; case 3: if (cpu_is_omap16xx()) { @@ -888,7 +894,10 @@ static int hci_h4p_probe(struct platform_device *pdev) info->uart_iclk = clk_get(NULL, "uart3_ick"); info->uart_fclk = clk_get(NULL, "uart3_fck"); } - info->uart_base = (void *)io_p2v(OMAP_UART3_BASE); + /* FIXME: Use platform_get_resource for the port */ + info->uart_base = ioremap(OMAP_UART3_BASE, 0x16); + if (!info->uart_base) + goto cleanup; break; default: dev_err(info->dev, "No uart defined\n"); diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c index 289557c4a24..d72c49a9654 100644 --- a/drivers/cbus/cbus.c +++ b/drivers/cbus/cbus.c @@ -141,7 +141,7 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data) u32 base; #ifdef CONFIG_ARCH_OMAP1 - base = (u32) io_p2v(OMAP_MPUIO_BASE); + base = OMAP1_IO_ADDRESS(OMAP_MPUIO_BASE); #else base = 0; #endif diff --git a/drivers/media/video/omap/omap16xxcam.c b/drivers/media/video/omap/omap16xxcam.c index 1615fb7eceb..0b5a30236ee 100644 --- a/drivers/media/video/omap/omap16xxcam.c +++ b/drivers/media/video/omap/omap16xxcam.c @@ -538,7 +538,7 @@ static void *omap16xxcam_init(void) return NULL; } } else - cam_iobase = io_p2v(CAMERA_BASE); + cam_iobase = OMAP1_IO_ADDRESS(CAMERA_BASE); /* Set the base address of the camera registers */ hardware_data.camera_regs = (camera_regs_t *) cam_iobase; diff --git a/drivers/misc/sti/sti.c b/drivers/misc/sti/sti.c index 28fac623313..518298bb3b5 100644 --- a/drivers/misc/sti/sti.c +++ b/drivers/misc/sti/sti.c @@ -26,7 +26,7 @@ #include static struct clk *sti_ck; -unsigned long sti_base, sti_channel_base; +void __iomem *sti_base, *sti_channel_base; static unsigned long sti_kern_mask = STIEn; static unsigned long sti_irq_mask = STI_IRQSTATUS_MASK; static DEFINE_SPINLOCK(sti_lock); @@ -326,6 +326,7 @@ static DEVICE_ATTR(imask, S_IRUGO | S_IWUSR, sti_imask_show, sti_imask_store); static int __devinit sti_probe(struct platform_device *pdev) { struct resource *res, *cres; + unsigned int size; int ret; if (pdev->num_resources != 3) { @@ -356,23 +357,19 @@ static int __devinit sti_probe(struct platform_device *pdev) if (unlikely(ret != 0)) goto err; - sti_base = io_p2v(res->start); + size = res->end - res->start + 1; + sti_base = ioremap(res->start, size); + if (!sti_base) { + ret = -ENOMEM; + goto err_badremap; + } - /* - * OMAP 16xx keeps channels in a relatively sane location, - * whereas 24xx maps them much further out, and so they must be - * remapped. - */ - if (cpu_is_omap16xx()) - sti_channel_base = io_p2v(cres->start); - else if (cpu_is_omap24xx()) { - unsigned int size = cres->end - cres->start; - - sti_channel_base = (unsigned long)ioremap(cres->start, size); - if (unlikely(!sti_channel_base)) { - ret = -ENODEV; - goto err_badremap; - } + size = cres->end - cres->start + 1; + sti_channel_base = ioremap(cres->start, size); + if (!sti_channel_base) { + iounmap(sti_base); + ret = -ENOMEM; + goto err_badremap; } ret = request_irq(platform_get_irq(pdev, 0), sti_interrupt, @@ -383,7 +380,8 @@ static int __devinit sti_probe(struct platform_device *pdev) return sti_init(); err_badirq: - iounmap((void *)sti_channel_base); + iounmap(sti_channel_base); + iounmap(sti_base); err_badremap: device_remove_file(&pdev->dev, &dev_attr_imask); err: @@ -396,8 +394,8 @@ static int __devexit sti_remove(struct platform_device *pdev) { unsigned int irq = platform_get_irq(pdev, 0); - if (cpu_is_omap24xx()) - iounmap((void *)sti_channel_base); + iounmap(sti_channel_base); + iounmap(sti_base); device_remove_file(&pdev->dev, &dev_attr_trace); device_remove_file(&pdev->dev, &dev_attr_imask); diff --git a/drivers/mtd/nand/omap-hw.c b/drivers/mtd/nand/omap-hw.c index c598d9d58b7..1eb19ce0a0b 100644 --- a/drivers/mtd/nand/omap-hw.c +++ b/drivers/mtd/nand/omap-hw.c @@ -165,7 +165,7 @@ static struct mtd_info *omap_mtd; static struct clk *omap_nand_clk; static int omap_nand_dma_ch; static struct completion omap_nand_dma_comp; -static unsigned long omap_nand_base = io_p2v(NAND_BASE); +static unsigned long omap_nand_base = OMAP1_IO_ADDRESS(NAND_BASE); static inline u32 nand_read_reg(int idx) { -- 2.41.0