]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/gpmc.c
Fix compiler warnings in gpmc.c
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / gpmc.c
index 0eb29e13960a31cafa41201fb5c7f5ed29c84ce4..4365c5905fe0968c8b7b2e3ea2c573d42964df54 100644 (file)
@@ -59,7 +59,7 @@ static struct resource        gpmc_cs_mem[GPMC_CS_NUM];
 static DEFINE_SPINLOCK(gpmc_mem_lock);
 static unsigned                gpmc_cs_map;
 
-static u32 gpmc_base;
+static void __iomem *gpmc_base;
 
 static struct clk *gpmc_l3_clk;
 
@@ -95,7 +95,7 @@ unsigned long gpmc_get_fclk_period(void)
        unsigned long rate = clk_get_rate(gpmc_l3_clk);
 
        if (rate == 0) {
-               printk(KERN_WARNING "gpmc_l3_clk no enabled\n");
+               printk(KERN_WARNING "gpmc_l3_clk not enabled\n");
                return 0;
        }
 
@@ -413,19 +413,31 @@ static void __init gpmc_mem_init(void)
 void __init gpmc_init(void)
 {
        u32 l;
+       char *ck;
 
        if (cpu_is_omap24xx()) {
-               gpmc_l3_clk = clk_get(NULL, "core_l3_ck");
+               ck = "core_l3_ck";
                if (cpu_is_omap2420())
-                       gpmc_base = OMAP2_IO_ADDRESS(OMAP2420_GPMC_BASE);
-               else if (cpu_is_omap2430())
-                       gpmc_base = OMAP2_IO_ADDRESS(OMAP243X_GPMC_BASE);
+                       l = OMAP2420_GPMC_BASE;
+               else
+                       l = OMAP34XX_GPMC_BASE;
        } else if (cpu_is_omap34xx()) {
-               gpmc_l3_clk = clk_get(NULL, "gpmc_fck");
-               gpmc_base = OMAP2_IO_ADDRESS(OMAP34XX_GPMC_BASE);
+               ck = "gpmc_fck";
+               l = OMAP34XX_GPMC_BASE;
        }
 
-       BUG_ON(IS_ERR(gpmc_l3_clk));
+       gpmc_l3_clk = clk_get(NULL, ck);
+       if (IS_ERR(gpmc_l3_clk)) {
+               printk(KERN_ERR "Could not get GPMC clock %s\n", ck);
+               BUG();
+       }
+
+       gpmc_base = ioremap(l, SZ_4K);
+       if (!gpmc_base) {
+               clk_put(gpmc_l3_clk);
+               printk(KERN_ERR "Could not get GPMC register memory\n");
+               BUG();
+       }
 
        l = gpmc_read_reg(GPMC_REVISION);
        printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f);