]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP2: Fix clock usage for gpmc_clk
authorTony Lindgren <tony@atomide.com>
Thu, 10 Apr 2008 00:34:17 +0000 (00:34 +0000)
committerTony Lindgren <tony@atomide.com>
Thu, 10 Apr 2008 00:34:17 +0000 (00:34 +0000)
Call clk_enable() before clk_get_rate(). Also free use
gpmc_clk instead of it's parent l3 clock.

Fixes based on comments from RMK, the real fix would be to
use the gpmc functions for timing calculations.

Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/clock24xx.h
arch/arm/mach-omap2/clock34xx.h

index 5228d2940321243598e95ddff7dedbfd6173f88a..76bbe06a26fcbf7a0cbb85e6034a25abf7ee8a52 100644 (file)
@@ -285,15 +285,18 @@ static inline void __init sdp2430_init_smc91x(void)
        int eth_cs;
        unsigned long cs_mem_base;
        unsigned int rate;
-       struct clk *l3ck;
+       struct clk *gpmc_fck;
 
        eth_cs = SDP2430_SMC91X_CS;
 
-       l3ck = clk_get(NULL, "core_l3_ck");
-       if (IS_ERR(l3ck))
-               rate = 100000000;
-       else
-               rate = clk_get_rate(l3ck);
+       gpmc_fck = clk_get(NULL, "gpmc_fck");   /* Always on ENABLE_ON_INIT */
+       if (IS_ERR(gpmc_fck)) {
+               WARN_ON(1);
+               return;
+       }
+
+       clk_enable(gpmc_fck);
+       rate = clk_get_rate(gpmc_fck);
 
        /* Make sure CS1 timings are correct, for 2430 always muxed */
        gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200);
@@ -320,7 +323,7 @@ static inline void __init sdp2430_init_smc91x(void)
 
        if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
                printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
-               return;
+               goto out;
        }
 
        sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300;
@@ -331,10 +334,13 @@ static inline void __init sdp2430_init_smc91x(void)
                printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
                        OMAP24XX_ETHR_GPIO_IRQ);
                gpmc_cs_free(eth_cs);
-               return;
+               goto out;
        }
        omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
 
+out:
+       clk_disable(gpmc_fck);
+       clk_put(gpmc_fck);
 }
 
 static void __init omap_2430sdp_init_irq(void)
index 24d3b9ab6e50cf1ab4219908329081ea084587bb..a06654a0b5d87940ce75d19f069b263e10ba9f05 100644 (file)
@@ -262,14 +262,17 @@ static inline void __init apollon_init_smc91x(void)
 {
        unsigned long base;
        unsigned int rate;
-       struct clk *l3ck;
+       struct clk *gpmc_fck;
        int eth_cs;
 
-       l3ck = clk_get(NULL, "core_l3_ck");
-       if (IS_ERR(l3ck))
-               rate = 100000000;
-       else
-               rate = clk_get_rate(l3ck);
+       gpmc_fck = clk_get(NULL, "gpmc_fck");   /* Always on ENABLE_ON_INIT */
+       if (IS_ERR(gpmc_fck)) {
+               WARN_ON(1);
+               return;
+       }
+
+       clk_enable(gpmc_fck);
+       rate = clk_get_rate(gpmc_fck);
 
        eth_cs = APOLLON_ETH_CS;
 
@@ -298,7 +301,7 @@ static inline void __init apollon_init_smc91x(void)
 
        if (gpmc_cs_request(eth_cs, SZ_16M, &base) < 0) {
                printk(KERN_ERR "Failed to request GPMC CS for smc91x\n");
-               return;
+               goto out;
        }
        apollon_smc91x_resources[0].start = base + 0x300;
        apollon_smc91x_resources[0].end   = base + 0x30f;
@@ -309,9 +312,13 @@ static inline void __init apollon_init_smc91x(void)
                printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
                        APOLLON_ETHR_GPIO_IRQ);
                gpmc_cs_free(eth_cs);
-               return;
+               goto out;
        }
        omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1);
+
+out:
+       clk_disable(gpmc_fck);
+       clk_put(gpmc_fck);
 }
 
 static void __init omap_apollon_init_irq(void)
index 9b494d00831a3981fa06581faf02b1c38215ef73..04c2cd8d80f6dd479b9b952c25916558ed6756d1 100644 (file)
@@ -302,15 +302,20 @@ static inline void __init h4_init_debug(void)
        int eth_cs;
        unsigned long cs_mem_base;
        unsigned int muxed, rate;
-       struct clk *l3ck;
+       struct clk *gpmc_fck;
 
        eth_cs  = H4_SMC91X_CS;
 
-       l3ck = clk_get(NULL, "core_l3_ck");
-       if (IS_ERR(l3ck))
-               rate = 100000000;
-       else
-               rate = clk_get_rate(l3ck);
+       gpmc_fck = clk_get(NULL, "gpmc_fck");   /* Always on ENABLE_ON_INIT */
+       if (IS_ERR(gpmc_fck)) {
+               WARN_ON(1);
+               return;
+       }
+
+       clk_enable(gpmc_fck);
+       rate = clk_get_rate(gpmc_fck);
+       clk_disable(gpmc_fck);
+       clk_put(gpmc_fck);
 
        if (is_gpmc_muxed())
                muxed = 0x200;
@@ -343,7 +348,7 @@ static inline void __init h4_init_debug(void)
 
        if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
                printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
-               return;
+               goto out;
        }
 
        udelay(100);
@@ -351,6 +356,10 @@ static inline void __init h4_init_debug(void)
        omap_cfg_reg(M15_24XX_GPIO92);
        if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0)
                gpmc_cs_free(eth_cs);
+
+out:
+       clk_disable(gpmc_fck);
+       clk_put(gpmc_fck);
 }
 
 static void __init h4_init_flash(void)
index 78bc755b6fa2b344762fa61ace751099ecb5af63..88081ed13f962d87beb41d9c69c727ade9fd6025 100644 (file)
@@ -2235,7 +2235,7 @@ static struct clk i2chs1_fck = {
 static struct clk gpmc_fck = {
        .name           = "gpmc_fck",
        .parent         = &core_l3_ck,
-       .flags          = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
+       .flags          = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ENABLE_ON_INIT,
        .recalc         = &followparent_recalc,
 };
 
index f60e2eae62d7bb7ca0af7a11470816b197569722..d06b2d0bda8fe946492ace0e951c8568f4ae8717 100644 (file)
@@ -1598,7 +1598,8 @@ static struct clk sdrc_ick = {
 static struct clk gpmc_fck = {
        .name           = "gpmc_fck",
        .parent         = &core_l3_ick,
-       .flags          = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK,
+       .flags          = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK |
+                               ENABLE_ON_INIT,
        .recalc         = &followparent_recalc,
 };