From 55c381e4896be2611da87088acfad74b361239ab Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 4 Sep 2008 14:07:22 +0100 Subject: [ARM] omap: convert OMAP drivers to use ioremap() Signed-off-by: Russell King --- drivers/video/omap/dispc.c | 15 +++++++++++---- drivers/video/omap/rfbi.c | 9 +++++++-- drivers/video/omap/sossi.c | 8 +++++++- 3 files changed, 25 insertions(+), 7 deletions(-) (limited to 'drivers/video/omap') diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c index 6efcf89e7fb..58f624bd22e 100644 --- a/drivers/video/omap/dispc.c +++ b/drivers/video/omap/dispc.c @@ -156,7 +156,7 @@ struct resmap { }; static struct { - u32 base; + void __iomem *base; struct omapfb_mem_desc mem_desc; struct resmap *res_map[DISPC_MEMTYPE_NUM]; @@ -1349,14 +1349,19 @@ static int omap_dispc_init(struct omapfb_device *fbdev, int ext_mode, memset(&dispc, 0, sizeof(dispc)); - dispc.base = io_p2v(DISPC_BASE); + dispc.base = ioremap(DISPC_BASE, SZ_1K); + if (!dispc.base) { + dev_err(fbdev->dev, "can't ioremap DISPC\n"); + return -ENOMEM; + } + dispc.fbdev = fbdev; dispc.ext_mode = ext_mode; init_completion(&dispc.frame_done); if ((r = get_dss_clocks()) < 0) - return r; + goto fail0; enable_interface_clocks(1); enable_lcd_clocks(1); @@ -1464,7 +1469,8 @@ fail1: enable_lcd_clocks(0); enable_interface_clocks(0); put_dss_clocks(); - +fail0: + iounmap(dispc.base); return r; } @@ -1481,6 +1487,7 @@ static void omap_dispc_cleanup(void) free_irq(INT_24XX_DSS_IRQ, dispc.fbdev); enable_interface_clocks(0); put_dss_clocks(); + iounmap(dispc.base); } const struct lcd_ctrl omap2_int_ctrl = { diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c index 4a6f13d3fac..a13c8dcad2a 100644 --- a/drivers/video/omap/rfbi.c +++ b/drivers/video/omap/rfbi.c @@ -59,7 +59,7 @@ #define DISPC_CONTROL 0x0040 static struct { - u32 base; + void __iomem *base; void (*lcdc_callback)(void *data); void *lcdc_callback_data; unsigned long l4_khz; @@ -518,7 +518,11 @@ static int rfbi_init(struct omapfb_device *fbdev) int r; rfbi.fbdev = fbdev; - rfbi.base = io_p2v(RFBI_BASE); + rfbi.base = ioremap(RFBI_BASE, SZ_1K); + if (!rfbi.base) { + dev_err(fbdev->dev, "can't ioremap RFBI\n"); + return -ENOMEM; + } if ((r = rfbi_get_clocks()) < 0) return r; @@ -566,6 +570,7 @@ static void rfbi_cleanup(void) { omap_dispc_free_irq(); rfbi_put_clocks(); + iounmap(rfbi.base); } const struct lcd_ctrl_extif omap2_ext_if = { diff --git a/drivers/video/omap/sossi.c b/drivers/video/omap/sossi.c index 6359353c2c6..a7694622024 100644 --- a/drivers/video/omap/sossi.c +++ b/drivers/video/omap/sossi.c @@ -574,7 +574,12 @@ static int sossi_init(struct omapfb_device *fbdev) struct clk *dpll1out_ck; int r; - sossi.base = (void __iomem *)IO_ADDRESS(OMAP_SOSSI_BASE); + sossi.base = ioremap(OMAP_SOSSI_BASE, SZ_1K); + if (!sossi.base) { + dev_err(fbdev->dev, "can't ioremap SoSSI\n"); + return -ENOMEM; + } + sossi.fbdev = fbdev; spin_lock_init(&sossi.lock); @@ -665,6 +670,7 @@ static void sossi_cleanup(void) { omap_lcdc_free_dma_callback(); clk_put(sossi.fck); + iounmap(sossi.base); } struct lcd_ctrl_extif omap1_ext_if = { -- cgit v1.2.3 From e8a91c953fca683ef9a9335fb00d6eb3e49ac1ee Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 1 Sep 2008 22:07:37 +0100 Subject: [ARM] omap: Fix IO_ADDRESS() macros OMAP1_IO_ADDRESS(), OMAP2_IO_ADDRESS() and IO_ADDRESS() returns cookies for use with __raw_{read|write}* for accessing registers. Therefore, these macros should return (void __iomem *) cookies, not integer values. Doing this improves typechecking, and means we can find those places where, eg, DMA controllers are incorrectly given virtual addresses to DMA to, or physical addresses are thrown through a virtual to physical address translation. Signed-off-by: Russell King --- drivers/video/omap/dispc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/video/omap') diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c index 58f624bd22e..dfb72f5e4c9 100644 --- a/drivers/video/omap/dispc.c +++ b/drivers/video/omap/dispc.c @@ -212,9 +212,9 @@ static void enable_rfbi_mode(int enable) dispc_write_reg(DISPC_CONTROL, l); /* Set bypass mode in RFBI module */ - l = __raw_readl(io_p2v(RFBI_CONTROL)); + l = __raw_readl(IO_ADDRESS(RFBI_CONTROL)); l |= enable ? 0 : (1 << 1); - __raw_writel(l, io_p2v(RFBI_CONTROL)); + __raw_writel(l, IO_ADDRESS(RFBI_CONTROL)); } static void set_lcd_data_lines(int data_lines) @@ -1419,7 +1419,7 @@ static int omap_dispc_init(struct omapfb_device *fbdev, int ext_mode, } /* L3 firewall setting: enable access to OCM RAM */ - __raw_writel(0x402000b0, io_p2v(0x680050a0)); + __raw_writel(0x402000b0, IO_ADDRESS(0x680050a0)); if ((r = alloc_palette_ram()) < 0) goto fail2; -- cgit v1.2.3 From c0fc18c5bf016a9d56aee64974c1ccdb87f3c783 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 5 Sep 2008 15:10:27 +0100 Subject: [ARM] omap: fix lots of 'Using plain integer as NULL pointer' Signed-off-by: Russell King --- drivers/video/omap/omapfb_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/video/omap') diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 51a138bd113..06a69e0345d 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c @@ -740,7 +740,7 @@ static int omapfb_update_win(struct fb_info *fbi, int ret; omapfb_rqueue_lock(plane->fbdev); - ret = omapfb_update_window_async(fbi, win, NULL, 0); + ret = omapfb_update_window_async(fbi, win, NULL, NULL); omapfb_rqueue_unlock(plane->fbdev); return ret; @@ -768,7 +768,7 @@ static int omapfb_update_full_screen(struct fb_info *fbi) win.format = 0; omapfb_rqueue_lock(fbdev); - r = fbdev->ctrl->update_window(fbi, &win, NULL, 0); + r = fbdev->ctrl->update_window(fbi, &win, NULL, NULL); omapfb_rqueue_unlock(fbdev); return r; @@ -1047,7 +1047,7 @@ void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval) win.height = 2; win.out_width = 2; win.out_height = 2; - fbdev->ctrl->update_window(fbdev->fb_info[0], &win, NULL, 0); + fbdev->ctrl->update_window(fbdev->fb_info[0], &win, NULL, NULL); } omapfb_rqueue_unlock(fbdev); } -- cgit v1.2.3 From 7c8ad9828e793573877fd60868bb5d2f1e3b64da Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 5 Sep 2008 15:13:24 +0100 Subject: [ARM] omap: fix a load of "warning: symbol 'xxx' was not declared. Should it be static?" Signed-off-by: Russell King --- drivers/video/omap/dispc.h | 2 ++ drivers/video/omap/lcd_h4.c | 4 ++-- drivers/video/omap/lcdc.c | 2 ++ drivers/video/omap/lcdc.h | 2 ++ drivers/video/omap/omapfb_main.c | 9 +++++---- 5 files changed, 13 insertions(+), 6 deletions(-) (limited to 'drivers/video/omap') diff --git a/drivers/video/omap/dispc.h b/drivers/video/omap/dispc.h index eb1512b56ce..ef720a78f6d 100644 --- a/drivers/video/omap/dispc.h +++ b/drivers/video/omap/dispc.h @@ -40,4 +40,6 @@ extern void omap_dispc_enable_digit_out(int enable); extern int omap_dispc_request_irq(void (*callback)(void *data), void *data); extern void omap_dispc_free_irq(void); +extern const struct lcd_ctrl omap2_int_ctrl; + #endif diff --git a/drivers/video/omap/lcd_h4.c b/drivers/video/omap/lcd_h4.c index 88c19d424ef..6ff56430341 100644 --- a/drivers/video/omap/lcd_h4.c +++ b/drivers/video/omap/lcd_h4.c @@ -47,7 +47,7 @@ static unsigned long h4_panel_get_caps(struct lcd_panel *panel) return 0; } -struct lcd_panel h4_panel = { +static struct lcd_panel h4_panel = { .name = "h4", .config = OMAP_LCDC_PANEL_TFT, @@ -91,7 +91,7 @@ static int h4_panel_resume(struct platform_device *pdev) return 0; } -struct platform_driver h4_panel_driver = { +static struct platform_driver h4_panel_driver = { .probe = h4_panel_probe, .remove = h4_panel_remove, .suspend = h4_panel_suspend, diff --git a/drivers/video/omap/lcdc.c b/drivers/video/omap/lcdc.c index 83514f06671..6e2ea751876 100644 --- a/drivers/video/omap/lcdc.c +++ b/drivers/video/omap/lcdc.c @@ -34,6 +34,8 @@ #include +#include "lcdc.h" + #define MODULE_NAME "lcdc" #define OMAP_LCDC_BASE 0xfffec000 diff --git a/drivers/video/omap/lcdc.h b/drivers/video/omap/lcdc.h index adb731e5314..845222270db 100644 --- a/drivers/video/omap/lcdc.h +++ b/drivers/video/omap/lcdc.h @@ -4,4 +4,6 @@ int omap_lcdc_set_dma_callback(void (*callback)(void *data), void *data); void omap_lcdc_free_dma_callback(void); +extern const struct lcd_ctrl omap1_int_ctrl; + #endif diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 06a69e0345d..5a5e407dc45 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c @@ -31,11 +31,14 @@ #include #include +#include "lcdc.h" +#include "dispc.h" + #define MODULE_NAME "omapfb" static unsigned int def_accel; static unsigned long def_vram[OMAPFB_PLANE_NUM]; -static int def_vram_cnt; +static unsigned int def_vram_cnt; static unsigned long def_vxres; static unsigned long def_vyres; static unsigned int def_rotate; @@ -84,12 +87,10 @@ static struct caps_table_struct color_caps[] = { * LCD panel * --------------------------------------------------------------------------- */ -extern struct lcd_ctrl omap1_int_ctrl; -extern struct lcd_ctrl omap2_int_ctrl; extern struct lcd_ctrl hwa742_ctrl; extern struct lcd_ctrl blizzard_ctrl; -static struct lcd_ctrl *ctrls[] = { +static const struct lcd_ctrl *ctrls[] = { #ifdef CONFIG_ARCH_OMAP1 &omap1_int_ctrl, #else -- cgit v1.2.3