X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=arch%2Farm%2Fmach-omap1%2Fclock.c;h=4ea2933f887d1e12485354b8b042663ae6238420;hb=a8cac817764a494705aebd99fd51bdf6cdc28ec9;hp=638490e62d5f5ebb7e07a21f586c521b9b2f2fe2;hpb=1b06e7926694178e146ff708b2c15a6da64c9765;p=linux-2.6 diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 638490e62d..4ea2933f88 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c @@ -1,4 +1,3 @@ -//kernel/linux-omap-fsample/arch/arm/mach-omap1/clock.c#2 - edit change 3808 (text) /* * linux/arch/arm/mach-omap1/clock.c * @@ -49,6 +48,15 @@ static void omap1_uart_recalc(struct clk * clk) clk->rate = 12000000; } +static void omap1_sossi_recalc(struct clk *clk) +{ + u32 div = omap_readl(MOD_CONF_CTRL_1); + + div = (div >> 17) & 0x7; + div++; + clk->rate = clk->parent->rate / div; +} + static int omap1_clk_enable_dsp_domain(struct clk *clk) { int retval; @@ -396,6 +404,31 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate) return 0; } +static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate) +{ + u32 l; + int div; + unsigned long p_rate; + + p_rate = clk->parent->rate; + /* Round towards slower frequency */ + div = (p_rate + rate - 1) / rate; + div--; + if (div < 0 || div > 7) + return -EINVAL; + + l = omap_readl(MOD_CONF_CTRL_1); + l &= ~(7 << 17); + l |= div << 17; + omap_writel(l, MOD_CONF_CTRL_1); + + clk->rate = p_rate / (div + 1); + if (unlikely(clk->flags & RATE_PROPAGATES)) + propagate_rate(clk); + + return 0; +} + static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate) { return 96000000 / calc_ext_dsor(rate); @@ -432,8 +465,7 @@ static int omap1_clk_enable(struct clk *clk) } if (clk->flags & CLOCK_NO_IDLE_PARENT) - if (!cpu_is_omap24xx()) - omap1_clk_deny_idle(clk->parent); + omap1_clk_deny_idle(clk->parent); } ret = clk->enable(clk); @@ -454,8 +486,7 @@ static void omap1_clk_disable(struct clk *clk) if (likely(clk->parent)) { omap1_clk_disable(clk->parent); if (clk->flags & CLOCK_NO_IDLE_PARENT) - if (!cpu_is_omap24xx()) - omap1_clk_allow_idle(clk->parent); + omap1_clk_allow_idle(clk->parent); } } } @@ -471,7 +502,7 @@ static int omap1_clk_enable_generic(struct clk *clk) if (unlikely(clk->enable_reg == 0)) { printk(KERN_ERR "clock.c: Enable for %s without enable code\n", clk->name); - return 0; + return -EINVAL; } if (clk->flags & ENABLE_REG_32BIT) { @@ -618,9 +649,9 @@ static void __init omap1_clk_disable_unused(struct clk *clk) /* FIXME: This clock seems to be necessary but no-one * has asked for its activation. */ - if (clk == &tc2_ck // FIX: pm.c (SRAM), CCP, Camera - || clk == &ck_dpll1out.clk // FIX: SoSSI, SSR - || clk == &arm_gpio_ck // FIX: GPIO code for 1510 + if (clk == &tc2_ck /* FIX: pm.c (SRAM), CCP, Camera */ + || clk == &ck_dpll1out.clk /* FIX: SoSSI, SSR */ + || clk == &arm_gpio_ck /* FIX: GPIO code for 1510 */ ) { printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n", clk->name); @@ -651,10 +682,18 @@ int __init omap1_clk_init(void) int crystal_type = 0; /* Default 12 MHz */ u32 reg; +#ifdef CONFIG_DEBUG_LL + /* Resets some clocks that may be left on from bootloader, + * but leaves serial clocks on. + */ + omap_writel(0x3 << 29, MOD_CONF_CTRL_0); +#endif + /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */ reg = omap_readw(SOFT_REQ_REG) & (1 << 4); omap_writew(reg, SOFT_REQ_REG); - omap_writew(0, SOFT_REQ_REG2); + if (!cpu_is_omap15xx()) + omap_writew(0, SOFT_REQ_REG2); clk_init(&omap1_clk_functions); @@ -685,7 +724,7 @@ int __init omap1_clk_init(void) info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config); if (info != NULL) { - if (!cpu_is_omap1510()) + if (!cpu_is_omap15xx()) crystal_type = info->system_clock_type; }