Commit d8e09b5b authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP2: Fix clock usage for gpmc_clk

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: default avatarTony Lindgren <tony@atomide.com>
parent cc1398ba
...@@ -285,15 +285,18 @@ static inline void __init sdp2430_init_smc91x(void) ...@@ -285,15 +285,18 @@ static inline void __init sdp2430_init_smc91x(void)
int eth_cs; int eth_cs;
unsigned long cs_mem_base; unsigned long cs_mem_base;
unsigned int rate; unsigned int rate;
struct clk *l3ck; struct clk *gpmc_fck;
eth_cs = SDP2430_SMC91X_CS; eth_cs = SDP2430_SMC91X_CS;
l3ck = clk_get(NULL, "core_l3_ck"); gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */
if (IS_ERR(l3ck)) if (IS_ERR(gpmc_fck)) {
rate = 100000000; WARN_ON(1);
else return;
rate = clk_get_rate(l3ck); }
clk_enable(gpmc_fck);
rate = clk_get_rate(gpmc_fck);
/* Make sure CS1 timings are correct, for 2430 always muxed */ /* Make sure CS1 timings are correct, for 2430 always muxed */
gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200);
...@@ -320,7 +323,7 @@ static inline void __init sdp2430_init_smc91x(void) ...@@ -320,7 +323,7 @@ static inline void __init sdp2430_init_smc91x(void)
if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
return; goto out;
} }
sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300; sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300;
...@@ -331,10 +334,13 @@ static inline void __init sdp2430_init_smc91x(void) ...@@ -331,10 +334,13 @@ static inline void __init sdp2430_init_smc91x(void)
printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
OMAP24XX_ETHR_GPIO_IRQ); OMAP24XX_ETHR_GPIO_IRQ);
gpmc_cs_free(eth_cs); gpmc_cs_free(eth_cs);
return; goto out;
} }
omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1); 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) static void __init omap_2430sdp_init_irq(void)
......
...@@ -262,14 +262,17 @@ static inline void __init apollon_init_smc91x(void) ...@@ -262,14 +262,17 @@ static inline void __init apollon_init_smc91x(void)
{ {
unsigned long base; unsigned long base;
unsigned int rate; unsigned int rate;
struct clk *l3ck; struct clk *gpmc_fck;
int eth_cs; int eth_cs;
l3ck = clk_get(NULL, "core_l3_ck"); gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */
if (IS_ERR(l3ck)) if (IS_ERR(gpmc_fck)) {
rate = 100000000; WARN_ON(1);
else return;
rate = clk_get_rate(l3ck); }
clk_enable(gpmc_fck);
rate = clk_get_rate(gpmc_fck);
eth_cs = APOLLON_ETH_CS; eth_cs = APOLLON_ETH_CS;
...@@ -298,7 +301,7 @@ static inline void __init apollon_init_smc91x(void) ...@@ -298,7 +301,7 @@ static inline void __init apollon_init_smc91x(void)
if (gpmc_cs_request(eth_cs, SZ_16M, &base) < 0) { if (gpmc_cs_request(eth_cs, SZ_16M, &base) < 0) {
printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); 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].start = base + 0x300;
apollon_smc91x_resources[0].end = base + 0x30f; apollon_smc91x_resources[0].end = base + 0x30f;
...@@ -309,9 +312,13 @@ static inline void __init apollon_init_smc91x(void) ...@@ -309,9 +312,13 @@ static inline void __init apollon_init_smc91x(void)
printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
APOLLON_ETHR_GPIO_IRQ); APOLLON_ETHR_GPIO_IRQ);
gpmc_cs_free(eth_cs); gpmc_cs_free(eth_cs);
return; goto out;
} }
omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); 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) static void __init omap_apollon_init_irq(void)
......
...@@ -302,15 +302,20 @@ static inline void __init h4_init_debug(void) ...@@ -302,15 +302,20 @@ static inline void __init h4_init_debug(void)
int eth_cs; int eth_cs;
unsigned long cs_mem_base; unsigned long cs_mem_base;
unsigned int muxed, rate; unsigned int muxed, rate;
struct clk *l3ck; struct clk *gpmc_fck;
eth_cs = H4_SMC91X_CS; eth_cs = H4_SMC91X_CS;
l3ck = clk_get(NULL, "core_l3_ck"); gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */
if (IS_ERR(l3ck)) if (IS_ERR(gpmc_fck)) {
rate = 100000000; WARN_ON(1);
else return;
rate = clk_get_rate(l3ck); }
clk_enable(gpmc_fck);
rate = clk_get_rate(gpmc_fck);
clk_disable(gpmc_fck);
clk_put(gpmc_fck);
if (is_gpmc_muxed()) if (is_gpmc_muxed())
muxed = 0x200; muxed = 0x200;
...@@ -343,7 +348,7 @@ static inline void __init h4_init_debug(void) ...@@ -343,7 +348,7 @@ static inline void __init h4_init_debug(void)
if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
return; goto out;
} }
udelay(100); udelay(100);
...@@ -351,6 +356,10 @@ static inline void __init h4_init_debug(void) ...@@ -351,6 +356,10 @@ static inline void __init h4_init_debug(void)
omap_cfg_reg(M15_24XX_GPIO92); omap_cfg_reg(M15_24XX_GPIO92);
if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0) if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0)
gpmc_cs_free(eth_cs); gpmc_cs_free(eth_cs);
out:
clk_disable(gpmc_fck);
clk_put(gpmc_fck);
} }
static void __init h4_init_flash(void) static void __init h4_init_flash(void)
......
...@@ -2235,7 +2235,7 @@ static struct clk i2chs1_fck = { ...@@ -2235,7 +2235,7 @@ static struct clk i2chs1_fck = {
static struct clk gpmc_fck = { static struct clk gpmc_fck = {
.name = "gpmc_fck", .name = "gpmc_fck",
.parent = &core_l3_ck, .parent = &core_l3_ck,
.flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | ENABLE_ON_INIT,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
}; };
......
...@@ -1598,7 +1598,8 @@ static struct clk sdrc_ick = { ...@@ -1598,7 +1598,8 @@ static struct clk sdrc_ick = {
static struct clk gpmc_fck = { static struct clk gpmc_fck = {
.name = "gpmc_fck", .name = "gpmc_fck",
.parent = &core_l3_ick, .parent = &core_l3_ick,
.flags = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK, .flags = CLOCK_IN_OMAP343X | PARENT_CONTROLS_CLOCK |
ENABLE_ON_INIT,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment