提交 14b6848b 编写于 作者: R Russell King 提交者: Russell King

Merge branch 'omap-clks3' into devel

Conflicts:

	arch/arm/mach-omap2/clock.c
...@@ -20,41 +20,161 @@ ...@@ -20,41 +20,161 @@
#include <linux/io.h> #include <linux/io.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/clkdev.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include <mach/usb.h> #include <mach/usb.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/sram.h> #include <mach/sram.h>
static const struct clkops clkops_generic;
static const struct clkops clkops_uart;
static const struct clkops clkops_dspck;
#include "clock.h" #include "clock.h"
static int clk_omap1_dummy_enable(struct clk *clk)
{
return 0;
}
static void clk_omap1_dummy_disable(struct clk *clk)
{
}
static const struct clkops clkops_dummy = {
.enable = clk_omap1_dummy_enable,
.disable = clk_omap1_dummy_disable,
};
static struct clk dummy_ck = {
.name = "dummy",
.ops = &clkops_dummy,
.flags = RATE_FIXED,
};
struct omap_clk {
u32 cpu;
struct clk_lookup lk;
};
#define CLK(dev, con, ck, cp) \
{ \
.cpu = cp, \
.lk = { \
.dev_id = dev, \
.con_id = con, \
.clk = ck, \
}, \
}
#define CK_310 (1 << 0)
#define CK_730 (1 << 1)
#define CK_1510 (1 << 2)
#define CK_16XX (1 << 3)
static struct omap_clk omap_clks[] = {
/* non-ULPD clocks */
CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310),
/* CK_GEN1 clocks */
CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX),
CLK("omap_wdt", "ick", &dummy_ck, CK_1510 | CK_310),
CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310),
CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),
/* CK_GEN2 clocks */
CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310),
/* CK_GEN3 clocks */
CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_730),
CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX),
CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_730),
CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310),
/* ULPD clocks */
CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310),
CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX),
CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310),
CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX),
CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX),
CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
CLK(NULL, "bclk", &bclk_16xx, CK_16XX),
CLK("mmci-omap.0", "fck", &mmc1_ck, CK_16XX | CK_1510 | CK_310),
CLK("mmci-omap.0", "ick", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK("mmci-omap.1", "fck", &mmc2_ck, CK_16XX),
CLK("mmci-omap.1", "ick", &armper_ck.clk, CK_16XX),
/* Virtual clocks */
CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310),
CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310),
CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX),
CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310),
CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
};
static int omap1_clk_enable_generic(struct clk * clk);
static int omap1_clk_enable(struct clk *clk);
static void omap1_clk_disable_generic(struct clk * clk);
static void omap1_clk_disable(struct clk *clk);
__u32 arm_idlect1_mask; __u32 arm_idlect1_mask;
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Omap1 specific clock functions * Omap1 specific clock functions
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
static void omap1_watchdog_recalc(struct clk * clk) static unsigned long omap1_watchdog_recalc(struct clk *clk)
{ {
clk->rate = clk->parent->rate / 14; return clk->parent->rate / 14;
} }
static void omap1_uart_recalc(struct clk * clk) static unsigned long omap1_uart_recalc(struct clk *clk)
{ {
unsigned int val = omap_readl(clk->enable_reg); unsigned int val = __raw_readl(clk->enable_reg);
if (val & clk->enable_bit) return val & clk->enable_bit ? 48000000 : 12000000;
clk->rate = 48000000;
else
clk->rate = 12000000;
} }
static void omap1_sossi_recalc(struct clk *clk) static unsigned long omap1_sossi_recalc(struct clk *clk)
{ {
u32 div = omap_readl(MOD_CONF_CTRL_1); u32 div = omap_readl(MOD_CONF_CTRL_1);
div = (div >> 17) & 0x7; div = (div >> 17) & 0x7;
div++; div++;
clk->rate = clk->parent->rate / div;
return clk->parent->rate / div;
} }
static int omap1_clk_enable_dsp_domain(struct clk *clk) static int omap1_clk_enable_dsp_domain(struct clk *clk)
...@@ -78,6 +198,11 @@ static void omap1_clk_disable_dsp_domain(struct clk *clk) ...@@ -78,6 +198,11 @@ static void omap1_clk_disable_dsp_domain(struct clk *clk)
} }
} }
static const struct clkops clkops_dspck = {
.enable = &omap1_clk_enable_dsp_domain,
.disable = &omap1_clk_disable_dsp_domain,
};
static int omap1_clk_enable_uart_functional(struct clk *clk) static int omap1_clk_enable_uart_functional(struct clk *clk)
{ {
int ret; int ret;
...@@ -105,6 +230,11 @@ static void omap1_clk_disable_uart_functional(struct clk *clk) ...@@ -105,6 +230,11 @@ static void omap1_clk_disable_uart_functional(struct clk *clk)
omap1_clk_disable_generic(clk); omap1_clk_disable_generic(clk);
} }
static const struct clkops clkops_uart = {
.enable = &omap1_clk_enable_uart_functional,
.disable = &omap1_clk_disable_uart_functional,
};
static void omap1_clk_allow_idle(struct clk *clk) static void omap1_clk_allow_idle(struct clk *clk)
{ {
struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk;
...@@ -197,9 +327,6 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate) ...@@ -197,9 +327,6 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)
struct clk * parent; struct clk * parent;
unsigned dsor_exp; unsigned dsor_exp;
if (unlikely(!(clk->flags & RATE_CKCTL)))
return -EINVAL;
parent = clk->parent; parent = clk->parent;
if (unlikely(parent == NULL)) if (unlikely(parent == NULL))
return -EIO; return -EIO;
...@@ -215,22 +342,15 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate) ...@@ -215,22 +342,15 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)
return dsor_exp; return dsor_exp;
} }
static void omap1_ckctl_recalc(struct clk * clk) static unsigned long omap1_ckctl_recalc(struct clk *clk)
{ {
int dsor;
/* Calculate divisor encoded as 2-bit exponent */ /* Calculate divisor encoded as 2-bit exponent */
dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset)); int dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset));
if (unlikely(clk->rate == clk->parent->rate / dsor)) return clk->parent->rate / dsor;
return; /* No change, quick exit */
clk->rate = clk->parent->rate / dsor;
if (unlikely(clk->flags & RATE_PROPAGATES))
propagate_rate(clk);
} }
static void omap1_ckctl_recalc_dsp_domain(struct clk * clk) static unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk)
{ {
int dsor; int dsor;
...@@ -245,12 +365,7 @@ static void omap1_ckctl_recalc_dsp_domain(struct clk * clk) ...@@ -245,12 +365,7 @@ static void omap1_ckctl_recalc_dsp_domain(struct clk * clk)
dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset)); dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset));
omap1_clk_disable(&api_ck.clk); omap1_clk_disable(&api_ck.clk);
if (unlikely(clk->rate == clk->parent->rate / dsor)) return clk->parent->rate / dsor;
return; /* No change, quick exit */
clk->rate = clk->parent->rate / dsor;
if (unlikely(clk->flags & RATE_PROPAGATES))
propagate_rate(clk);
} }
/* MPU virtual clock functions */ /* MPU virtual clock functions */
...@@ -289,35 +404,57 @@ static int omap1_select_table_rate(struct clk * clk, unsigned long rate) ...@@ -289,35 +404,57 @@ static int omap1_select_table_rate(struct clk * clk, unsigned long rate)
omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val); omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val);
ck_dpll1.rate = ptr->pll_rate; ck_dpll1.rate = ptr->pll_rate;
propagate_rate(&ck_dpll1);
return 0; return 0;
} }
static int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate) static int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate)
{ {
int ret = -EINVAL; int dsor_exp;
int dsor_exp; u16 regval;
__u16 regval;
if (clk->flags & RATE_CKCTL) {
dsor_exp = calc_dsor_exp(clk, rate);
if (dsor_exp > 3)
dsor_exp = -EINVAL;
if (dsor_exp < 0)
return dsor_exp;
regval = __raw_readw(DSP_CKCTL);
regval &= ~(3 << clk->rate_offset);
regval |= dsor_exp << clk->rate_offset;
__raw_writew(regval, DSP_CKCTL);
clk->rate = clk->parent->rate / (1 << dsor_exp);
ret = 0;
}
if (unlikely(ret == 0 && (clk->flags & RATE_PROPAGATES))) dsor_exp = calc_dsor_exp(clk, rate);
propagate_rate(clk); if (dsor_exp > 3)
dsor_exp = -EINVAL;
if (dsor_exp < 0)
return dsor_exp;
return ret; regval = __raw_readw(DSP_CKCTL);
regval &= ~(3 << clk->rate_offset);
regval |= dsor_exp << clk->rate_offset;
__raw_writew(regval, DSP_CKCTL);
clk->rate = clk->parent->rate / (1 << dsor_exp);
return 0;
}
static long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate)
{
int dsor_exp = calc_dsor_exp(clk, rate);
if (dsor_exp < 0)
return dsor_exp;
if (dsor_exp > 3)
dsor_exp = 3;
return clk->parent->rate / (1 << dsor_exp);
}
static int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate)
{
int dsor_exp;
u16 regval;
dsor_exp = calc_dsor_exp(clk, rate);
if (dsor_exp > 3)
dsor_exp = -EINVAL;
if (dsor_exp < 0)
return dsor_exp;
regval = omap_readw(ARM_CKCTL);
regval &= ~(3 << clk->rate_offset);
regval |= dsor_exp << clk->rate_offset;
regval = verify_ckctl_value(regval);
omap_writew(regval, ARM_CKCTL);
clk->rate = clk->parent->rate / (1 << dsor_exp);
return 0;
} }
static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate) static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate)
...@@ -372,14 +509,14 @@ static int omap1_set_uart_rate(struct clk * clk, unsigned long rate) ...@@ -372,14 +509,14 @@ static int omap1_set_uart_rate(struct clk * clk, unsigned long rate)
{ {
unsigned int val; unsigned int val;
val = omap_readl(clk->enable_reg); val = __raw_readl(clk->enable_reg);
if (rate == 12000000) if (rate == 12000000)
val &= ~(1 << clk->enable_bit); val &= ~(1 << clk->enable_bit);
else if (rate == 48000000) else if (rate == 48000000)
val |= (1 << clk->enable_bit); val |= (1 << clk->enable_bit);
else else
return -EINVAL; return -EINVAL;
omap_writel(val, clk->enable_reg); __raw_writel(val, clk->enable_reg);
clk->rate = rate; clk->rate = rate;
return 0; return 0;
...@@ -398,8 +535,8 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate) ...@@ -398,8 +535,8 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate)
else else
ratio_bits = (dsor - 2) << 2; ratio_bits = (dsor - 2) << 2;
ratio_bits |= omap_readw(clk->enable_reg) & ~0xfd; ratio_bits |= __raw_readw(clk->enable_reg) & ~0xfd;
omap_writew(ratio_bits, clk->enable_reg); __raw_writew(ratio_bits, clk->enable_reg);
return 0; return 0;
} }
...@@ -423,8 +560,6 @@ static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate) ...@@ -423,8 +560,6 @@ static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate)
omap_writel(l, MOD_CONF_CTRL_1); omap_writel(l, MOD_CONF_CTRL_1);
clk->rate = p_rate / (div + 1); clk->rate = p_rate / (div + 1);
if (unlikely(clk->flags & RATE_PROPAGATES))
propagate_rate(clk);
return 0; return 0;
} }
...@@ -440,8 +575,8 @@ static void omap1_init_ext_clk(struct clk * clk) ...@@ -440,8 +575,8 @@ static void omap1_init_ext_clk(struct clk * clk)
__u16 ratio_bits; __u16 ratio_bits;
/* Determine current rate and ensure clock is based on 96MHz APLL */ /* Determine current rate and ensure clock is based on 96MHz APLL */
ratio_bits = omap_readw(clk->enable_reg) & ~1; ratio_bits = __raw_readw(clk->enable_reg) & ~1;
omap_writew(ratio_bits, clk->enable_reg); __raw_writew(ratio_bits, clk->enable_reg);
ratio_bits = (ratio_bits & 0xfc) >> 2; ratio_bits = (ratio_bits & 0xfc) >> 2;
if (ratio_bits > 6) if (ratio_bits > 6)
...@@ -468,7 +603,7 @@ static int omap1_clk_enable(struct clk *clk) ...@@ -468,7 +603,7 @@ static int omap1_clk_enable(struct clk *clk)
omap1_clk_deny_idle(clk->parent); omap1_clk_deny_idle(clk->parent);
} }
ret = clk->enable(clk); ret = clk->ops->enable(clk);
if (unlikely(ret != 0) && clk->parent) { if (unlikely(ret != 0) && clk->parent) {
omap1_clk_disable(clk->parent); omap1_clk_disable(clk->parent);
...@@ -482,7 +617,7 @@ static int omap1_clk_enable(struct clk *clk) ...@@ -482,7 +617,7 @@ static int omap1_clk_enable(struct clk *clk)
static void omap1_clk_disable(struct clk *clk) static void omap1_clk_disable(struct clk *clk)
{ {
if (clk->usecount > 0 && !(--clk->usecount)) { if (clk->usecount > 0 && !(--clk->usecount)) {
clk->disable(clk); clk->ops->disable(clk);
if (likely(clk->parent)) { if (likely(clk->parent)) {
omap1_clk_disable(clk->parent); omap1_clk_disable(clk->parent);
if (clk->flags & CLOCK_NO_IDLE_PARENT) if (clk->flags & CLOCK_NO_IDLE_PARENT)
...@@ -496,9 +631,6 @@ static int omap1_clk_enable_generic(struct clk *clk) ...@@ -496,9 +631,6 @@ static int omap1_clk_enable_generic(struct clk *clk)
__u16 regval16; __u16 regval16;
__u32 regval32; __u32 regval32;
if (clk->flags & ALWAYS_ENABLED)
return 0;
if (unlikely(clk->enable_reg == NULL)) { if (unlikely(clk->enable_reg == NULL)) {
printk(KERN_ERR "clock.c: Enable for %s without enable code\n", printk(KERN_ERR "clock.c: Enable for %s without enable code\n",
clk->name); clk->name);
...@@ -506,25 +638,13 @@ static int omap1_clk_enable_generic(struct clk *clk) ...@@ -506,25 +638,13 @@ static int omap1_clk_enable_generic(struct clk *clk)
} }
if (clk->flags & ENABLE_REG_32BIT) { if (clk->flags & ENABLE_REG_32BIT) {
if (clk->flags & VIRTUAL_IO_ADDRESS) { regval32 = __raw_readl(clk->enable_reg);
regval32 = __raw_readl(clk->enable_reg); regval32 |= (1 << clk->enable_bit);
regval32 |= (1 << clk->enable_bit); __raw_writel(regval32, clk->enable_reg);
__raw_writel(regval32, clk->enable_reg);
} else {
regval32 = omap_readl(clk->enable_reg);
regval32 |= (1 << clk->enable_bit);
omap_writel(regval32, clk->enable_reg);
}
} else { } else {
if (clk->flags & VIRTUAL_IO_ADDRESS) { regval16 = __raw_readw(clk->enable_reg);
regval16 = __raw_readw(clk->enable_reg); regval16 |= (1 << clk->enable_bit);
regval16 |= (1 << clk->enable_bit); __raw_writew(regval16, clk->enable_reg);
__raw_writew(regval16, clk->enable_reg);
} else {
regval16 = omap_readw(clk->enable_reg);
regval16 |= (1 << clk->enable_bit);
omap_writew(regval16, clk->enable_reg);
}
} }
return 0; return 0;
...@@ -539,44 +659,26 @@ static void omap1_clk_disable_generic(struct clk *clk) ...@@ -539,44 +659,26 @@ static void omap1_clk_disable_generic(struct clk *clk)
return; return;
if (clk->flags & ENABLE_REG_32BIT) { if (clk->flags & ENABLE_REG_32BIT) {
if (clk->flags & VIRTUAL_IO_ADDRESS) { regval32 = __raw_readl(clk->enable_reg);
regval32 = __raw_readl(clk->enable_reg); regval32 &= ~(1 << clk->enable_bit);
regval32 &= ~(1 << clk->enable_bit); __raw_writel(regval32, clk->enable_reg);
__raw_writel(regval32, clk->enable_reg);
} else {
regval32 = omap_readl(clk->enable_reg);
regval32 &= ~(1 << clk->enable_bit);
omap_writel(regval32, clk->enable_reg);
}
} else { } else {
if (clk->flags & VIRTUAL_IO_ADDRESS) { regval16 = __raw_readw(clk->enable_reg);
regval16 = __raw_readw(clk->enable_reg); regval16 &= ~(1 << clk->enable_bit);
regval16 &= ~(1 << clk->enable_bit); __raw_writew(regval16, clk->enable_reg);
__raw_writew(regval16, clk->enable_reg);
} else {
regval16 = omap_readw(clk->enable_reg);
regval16 &= ~(1 << clk->enable_bit);
omap_writew(regval16, clk->enable_reg);
}
} }
} }
static const struct clkops clkops_generic = {
.enable = &omap1_clk_enable_generic,
.disable = &omap1_clk_disable_generic,
};
static long omap1_clk_round_rate(struct clk *clk, unsigned long rate) static long omap1_clk_round_rate(struct clk *clk, unsigned long rate)
{ {
int dsor_exp;
if (clk->flags & RATE_FIXED) if (clk->flags & RATE_FIXED)
return clk->rate; return clk->rate;
if (clk->flags & RATE_CKCTL) {
dsor_exp = calc_dsor_exp(clk, rate);
if (dsor_exp < 0)
return dsor_exp;
if (dsor_exp > 3)
dsor_exp = 3;
return clk->parent->rate / (1 << dsor_exp);
}
if (clk->round_rate != NULL) if (clk->round_rate != NULL)
return clk->round_rate(clk, rate); return clk->round_rate(clk, rate);
...@@ -586,30 +688,9 @@ static long omap1_clk_round_rate(struct clk *clk, unsigned long rate) ...@@ -586,30 +688,9 @@ static long omap1_clk_round_rate(struct clk *clk, unsigned long rate)
static int omap1_clk_set_rate(struct clk *clk, unsigned long rate) static int omap1_clk_set_rate(struct clk *clk, unsigned long rate)
{ {
int ret = -EINVAL; int ret = -EINVAL;
int dsor_exp;
__u16 regval;
if (clk->set_rate) if (clk->set_rate)
ret = clk->set_rate(clk, rate); ret = clk->set_rate(clk, rate);
else if (clk->flags & RATE_CKCTL) {
dsor_exp = calc_dsor_exp(clk, rate);
if (dsor_exp > 3)
dsor_exp = -EINVAL;
if (dsor_exp < 0)
return dsor_exp;
regval = omap_readw(ARM_CKCTL);
regval &= ~(3 << clk->rate_offset);
regval |= dsor_exp << clk->rate_offset;
regval = verify_ckctl_value(regval);
omap_writew(regval, ARM_CKCTL);
clk->rate = clk->parent->rate / (1 << dsor_exp);
ret = 0;
}
if (unlikely(ret == 0 && (clk->flags & RATE_PROPAGATES)))
propagate_rate(clk);
return ret; return ret;
} }
...@@ -632,17 +713,10 @@ static void __init omap1_clk_disable_unused(struct clk *clk) ...@@ -632,17 +713,10 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
} }
/* Is the clock already disabled? */ /* Is the clock already disabled? */
if (clk->flags & ENABLE_REG_32BIT) { if (clk->flags & ENABLE_REG_32BIT)
if (clk->flags & VIRTUAL_IO_ADDRESS) regval32 = __raw_readl(clk->enable_reg);
regval32 = __raw_readl(clk->enable_reg); else
else regval32 = __raw_readw(clk->enable_reg);
regval32 = omap_readl(clk->enable_reg);
} else {
if (clk->flags & VIRTUAL_IO_ADDRESS)
regval32 = __raw_readw(clk->enable_reg);
else
regval32 = omap_readw(clk->enable_reg);
}
if ((regval32 & (1 << clk->enable_bit)) == 0) if ((regval32 & (1 << clk->enable_bit)) == 0)
return; return;
...@@ -659,7 +733,7 @@ static void __init omap1_clk_disable_unused(struct clk *clk) ...@@ -659,7 +733,7 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
} }
printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name); printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name);
clk->disable(clk); clk->ops->disable(clk);
printk(" done\n"); printk(" done\n");
} }
...@@ -677,10 +751,10 @@ static struct clk_functions omap1_clk_functions = { ...@@ -677,10 +751,10 @@ static struct clk_functions omap1_clk_functions = {
int __init omap1_clk_init(void) int __init omap1_clk_init(void)
{ {
struct clk ** clkp; struct omap_clk *c;
const struct omap_clock_config *info; const struct omap_clock_config *info;
int crystal_type = 0; /* Default 12 MHz */ int crystal_type = 0; /* Default 12 MHz */
u32 reg; u32 reg, cpu_mask;
#ifdef CONFIG_DEBUG_LL #ifdef CONFIG_DEBUG_LL
/* Resets some clocks that may be left on from bootloader, /* Resets some clocks that may be left on from bootloader,
...@@ -700,27 +774,24 @@ int __init omap1_clk_init(void) ...@@ -700,27 +774,24 @@ int __init omap1_clk_init(void)
/* By default all idlect1 clocks are allowed to idle */ /* By default all idlect1 clocks are allowed to idle */
arm_idlect1_mask = ~0; arm_idlect1_mask = ~0;
for (clkp = onchip_clks; clkp < onchip_clks+ARRAY_SIZE(onchip_clks); clkp++) { for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
if (((*clkp)->flags &CLOCK_IN_OMAP1510) && cpu_is_omap1510()) { clk_init_one(c->lk.clk);
clk_register(*clkp);
continue;
}
if (((*clkp)->flags &CLOCK_IN_OMAP16XX) && cpu_is_omap16xx()) {
clk_register(*clkp);
continue;
}
if (((*clkp)->flags &CLOCK_IN_OMAP730) && cpu_is_omap730()) {
clk_register(*clkp);
continue;
}
if (((*clkp)->flags &CLOCK_IN_OMAP310) && cpu_is_omap310()) { cpu_mask = 0;
clk_register(*clkp); if (cpu_is_omap16xx())
continue; cpu_mask |= CK_16XX;
if (cpu_is_omap1510())
cpu_mask |= CK_1510;
if (cpu_is_omap730())
cpu_mask |= CK_730;
if (cpu_is_omap310())
cpu_mask |= CK_310;
for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
if (c->cpu & cpu_mask) {
clkdev_add(&c->lk);
clk_register(c->lk.clk);
} }
}
info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config); info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
if (info != NULL) { if (info != NULL) {
...@@ -769,7 +840,6 @@ int __init omap1_clk_init(void) ...@@ -769,7 +840,6 @@ int __init omap1_clk_init(void)
} }
} }
} }
propagate_rate(&ck_dpll1);
#else #else
/* Find the highest supported frequency and enable it */ /* Find the highest supported frequency and enable it */
if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
...@@ -778,9 +848,9 @@ int __init omap1_clk_init(void) ...@@ -778,9 +848,9 @@ int __init omap1_clk_init(void)
omap_writew(0x2290, DPLL_CTL); omap_writew(0x2290, DPLL_CTL);
omap_writew(cpu_is_omap730() ? 0x3005 : 0x1005, ARM_CKCTL); omap_writew(cpu_is_omap730() ? 0x3005 : 0x1005, ARM_CKCTL);
ck_dpll1.rate = 60000000; ck_dpll1.rate = 60000000;
propagate_rate(&ck_dpll1);
} }
#endif #endif
propagate_rate(&ck_dpll1);
/* Cache rates for clocks connected to ck_ref (not dpll1) */ /* Cache rates for clocks connected to ck_ref (not dpll1) */
propagate_rate(&ck_ref); propagate_rate(&ck_ref);
printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): " printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
...@@ -832,4 +902,3 @@ int __init omap1_clk_init(void) ...@@ -832,4 +902,3 @@ int __init omap1_clk_init(void)
return 0; return 0;
} }
此差异已折叠。
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#define DPS_RSTCT2_PER_EN (1 << 0) #define DPS_RSTCT2_PER_EN (1 << 0)
#define DSP_RSTCT2_WD_PER_EN (1 << 1) #define DSP_RSTCT2_WD_PER_EN (1 << 1)
#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) static int dsp_use;
const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" }; static struct clk *api_clk;
#endif static struct clk *dsp_clk;
static void omap1_mcbsp_request(unsigned int id) static void omap1_mcbsp_request(unsigned int id)
{ {
...@@ -39,20 +39,40 @@ static void omap1_mcbsp_request(unsigned int id) ...@@ -39,20 +39,40 @@ static void omap1_mcbsp_request(unsigned int id)
* are DSP public peripherals. * are DSP public peripherals.
*/ */
if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) { if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
omap_dsp_request_mem(); if (dsp_use++ == 0) {
/* api_clk = clk_get(NULL, "api_clk");
* DSP external peripheral reset dsp_clk = clk_get(NULL, "dsp_clk");
* FIXME: This should be moved to dsp code if (!IS_ERR(api_clk) && !IS_ERR(dsp_clk)) {
*/ clk_enable(api_clk);
__raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN | clk_enable(dsp_clk);
DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2);
omap_dsp_request_mem();
/*
* DSP external peripheral reset
* FIXME: This should be moved to dsp code
*/
__raw_writew(__raw_readw(DSP_RSTCT2) | DPS_RSTCT2_PER_EN |
DSP_RSTCT2_WD_PER_EN, DSP_RSTCT2);
}
}
} }
} }
static void omap1_mcbsp_free(unsigned int id) static void omap1_mcbsp_free(unsigned int id)
{ {
if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
omap_dsp_release_mem(); if (--dsp_use == 0) {
omap_dsp_release_mem();
if (!IS_ERR(api_clk)) {
clk_disable(api_clk);
clk_put(api_clk);
}
if (!IS_ERR(dsp_clk)) {
clk_disable(dsp_clk);
clk_put(dsp_clk);
}
}
}
} }
static struct omap_mcbsp_ops omap1_mcbsp_ops = { static struct omap_mcbsp_ops omap1_mcbsp_ops = {
...@@ -94,8 +114,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { ...@@ -94,8 +114,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
.rx_irq = INT_McBSP1RX, .rx_irq = INT_McBSP1RX,
.tx_irq = INT_McBSP1TX, .tx_irq = INT_McBSP1TX,
.ops = &omap1_mcbsp_ops, .ops = &omap1_mcbsp_ops,
.clk_names = clk_names,
.num_clks = 3,
}, },
{ {
.phys_base = OMAP1510_MCBSP2_BASE, .phys_base = OMAP1510_MCBSP2_BASE,
...@@ -112,8 +130,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { ...@@ -112,8 +130,6 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
.rx_irq = INT_McBSP3RX, .rx_irq = INT_McBSP3RX,
.tx_irq = INT_McBSP3TX, .tx_irq = INT_McBSP3TX,
.ops = &omap1_mcbsp_ops, .ops = &omap1_mcbsp_ops,
.clk_names = clk_names,
.num_clks = 3,
}, },
}; };
#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) #define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
...@@ -131,8 +147,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { ...@@ -131,8 +147,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
.rx_irq = INT_McBSP1RX, .rx_irq = INT_McBSP1RX,
.tx_irq = INT_McBSP1TX, .tx_irq = INT_McBSP1TX,
.ops = &omap1_mcbsp_ops, .ops = &omap1_mcbsp_ops,
.clk_names = clk_names,
.num_clks = 3,
}, },
{ {
.phys_base = OMAP1610_MCBSP2_BASE, .phys_base = OMAP1610_MCBSP2_BASE,
...@@ -149,8 +163,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { ...@@ -149,8 +163,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
.rx_irq = INT_McBSP3RX, .rx_irq = INT_McBSP3RX,
.tx_irq = INT_McBSP3TX, .tx_irq = INT_McBSP3TX,
.ops = &omap1_mcbsp_ops, .ops = &omap1_mcbsp_ops,
.clk_names = clk_names,
.num_clks = 3,
}, },
}; };
#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) #define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Common support # Common support
obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \ obj-y := irq.o id.o io.o sdrc.o control.o prcm.o clock.o mux.o \
devices.o serial.o gpmc.o timer-gp.o powerdomain.o \ devices.o serial.o gpmc.o timer-gp.o powerdomain.o \
clockdomain.o clockdomain.o
...@@ -14,6 +14,10 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o ...@@ -14,6 +14,10 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o
obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o
obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o
# SMS/SDRC
obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
# Power Management # Power Management
ifeq ($(CONFIG_PM),y) ifeq ($(CONFIG_PM),y)
obj-y += pm.o obj-y += pm.o
......
...@@ -185,7 +185,7 @@ static inline void __init sdp2430_init_smc91x(void) ...@@ -185,7 +185,7 @@ static inline void __init sdp2430_init_smc91x(void)
static void __init omap_2430sdp_init_irq(void) static void __init omap_2430sdp_init_irq(void)
{ {
omap2_init_common_hw(); omap2_init_common_hw(NULL);
omap_init_irq(); omap_init_irq();
omap_gpio_init(); omap_gpio_init();
sdp2430_init_smc91x(); sdp2430_init_smc91x();
......
...@@ -249,7 +249,7 @@ static inline void __init apollon_init_smc91x(void) ...@@ -249,7 +249,7 @@ static inline void __init apollon_init_smc91x(void)
static void __init omap_apollon_init_irq(void) static void __init omap_apollon_init_irq(void)
{ {
omap2_init_common_hw(); omap2_init_common_hw(NULL);
omap_init_irq(); omap_init_irq();
omap_gpio_init(); omap_gpio_init();
apollon_init_smc91x(); apollon_init_smc91x();
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
static void __init omap_generic_init_irq(void) static void __init omap_generic_init_irq(void)
{ {
omap2_init_common_hw(); omap2_init_common_hw(NULL);
omap_init_irq(); omap_init_irq();
} }
......
...@@ -363,7 +363,7 @@ static void __init h4_init_flash(void) ...@@ -363,7 +363,7 @@ static void __init h4_init_flash(void)
static void __init omap_h4_init_irq(void) static void __init omap_h4_init_irq(void)
{ {
omap2_init_common_hw(); omap2_init_common_hw(NULL);
omap_init_irq(); omap_init_irq();
omap_gpio_init(); omap_gpio_init();
h4_init_flash(); h4_init_flash();
......
...@@ -98,7 +98,7 @@ static inline void __init ldp_init_smc911x(void) ...@@ -98,7 +98,7 @@ static inline void __init ldp_init_smc911x(void)
static void __init omap_ldp_init_irq(void) static void __init omap_ldp_init_irq(void)
{ {
omap2_init_common_hw(); omap2_init_common_hw(NULL);
omap_init_irq(); omap_init_irq();
omap_gpio_init(); omap_gpio_init();
ldp_init_smc911x(); ldp_init_smc911x();
......
...@@ -184,7 +184,7 @@ static int __init omap3_beagle_i2c_init(void) ...@@ -184,7 +184,7 @@ static int __init omap3_beagle_i2c_init(void)
static void __init omap3_beagle_init_irq(void) static void __init omap3_beagle_init_irq(void)
{ {
omap2_init_common_hw(); omap2_init_common_hw(NULL);
omap_init_irq(); omap_init_irq();
omap_gpio_init(); omap_gpio_init();
} }
......
此差异已折叠。
...@@ -21,13 +21,28 @@ ...@@ -21,13 +21,28 @@
/* The maximum error between a target DPLL rate and the rounded rate in Hz */ /* The maximum error between a target DPLL rate and the rounded rate in Hz */
#define DEFAULT_DPLL_RATE_TOLERANCE 50000 #define DEFAULT_DPLL_RATE_TOLERANCE 50000
/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
#define CORE_CLK_SRC_32K 0x0
#define CORE_CLK_SRC_DPLL 0x1
#define CORE_CLK_SRC_DPLL_X2 0x2
/* OMAP2xxx CM_CLKEN_PLL.EN_DPLL bits - for omap2_get_dpll_rate() */
#define OMAP2XXX_EN_DPLL_LPBYPASS 0x1
#define OMAP2XXX_EN_DPLL_FRBYPASS 0x2
#define OMAP2XXX_EN_DPLL_LOCKED 0x3
/* OMAP3xxx CM_CLKEN_PLL*.EN_*_DPLL bits - for omap2_get_dpll_rate() */
#define OMAP3XXX_EN_DPLL_LPBYPASS 0x5
#define OMAP3XXX_EN_DPLL_FRBYPASS 0x6
#define OMAP3XXX_EN_DPLL_LOCKED 0x7
int omap2_clk_init(void); int omap2_clk_init(void);
int omap2_clk_enable(struct clk *clk); int omap2_clk_enable(struct clk *clk);
void omap2_clk_disable(struct clk *clk); void omap2_clk_disable(struct clk *clk);
long omap2_clk_round_rate(struct clk *clk, unsigned long rate); long omap2_clk_round_rate(struct clk *clk, unsigned long rate);
int omap2_clk_set_rate(struct clk *clk, unsigned long rate); int omap2_clk_set_rate(struct clk *clk, unsigned long rate);
int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent);
int omap2_dpll_rate_tolerance_set(struct clk *clk, unsigned int tolerance); int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance);
long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate);
#ifdef CONFIG_OMAP_RESET_CLOCKS #ifdef CONFIG_OMAP_RESET_CLOCKS
...@@ -36,7 +51,7 @@ void omap2_clk_disable_unused(struct clk *clk); ...@@ -36,7 +51,7 @@ void omap2_clk_disable_unused(struct clk *clk);
#define omap2_clk_disable_unused NULL #define omap2_clk_disable_unused NULL
#endif #endif
void omap2_clksel_recalc(struct clk *clk); unsigned long omap2_clksel_recalc(struct clk *clk);
void omap2_init_clk_clkdm(struct clk *clk); void omap2_init_clk_clkdm(struct clk *clk);
void omap2_init_clksel_parent(struct clk *clk); void omap2_init_clksel_parent(struct clk *clk);
u32 omap2_clksel_get_divisor(struct clk *clk); u32 omap2_clksel_get_divisor(struct clk *clk);
...@@ -44,13 +59,16 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, ...@@ -44,13 +59,16 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
u32 *new_div); u32 *new_div);
u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val); u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val);
u32 omap2_divisor_to_clksel(struct clk *clk, u32 div); u32 omap2_divisor_to_clksel(struct clk *clk, u32 div);
void omap2_fixed_divisor_recalc(struct clk *clk); unsigned long omap2_fixed_divisor_recalc(struct clk *clk);
long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
u32 omap2_get_dpll_rate(struct clk *clk); u32 omap2_get_dpll_rate(struct clk *clk);
int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
void omap2_clk_prepare_for_reboot(void); void omap2_clk_prepare_for_reboot(void);
extern const struct clkops clkops_omap2_dflt_wait;
extern const struct clkops clkops_omap2_dflt;
extern u8 cpu_mask; extern u8 cpu_mask;
/* clksel_rate data common to 24xx/343x */ /* clksel_rate data common to 24xx/343x */
......
...@@ -31,15 +31,192 @@ ...@@ -31,15 +31,192 @@
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/sram.h> #include <mach/sram.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/clkdev.h>
#include "memory.h" #include <mach/sdrc.h>
#include "clock.h" #include "clock.h"
#include "clock24xx.h"
#include "prm.h" #include "prm.h"
#include "prm-regbits-24xx.h" #include "prm-regbits-24xx.h"
#include "cm.h" #include "cm.h"
#include "cm-regbits-24xx.h" #include "cm-regbits-24xx.h"
static const struct clkops clkops_oscck;
static const struct clkops clkops_fixed;
#include "clock24xx.h"
struct omap_clk {
u32 cpu;
struct clk_lookup lk;
};
#define CLK(dev, con, ck, cp) \
{ \
.cpu = cp, \
.lk = { \
.dev_id = dev, \
.con_id = con, \
.clk = ck, \
}, \
}
#define CK_243X (1 << 0)
#define CK_242X (1 << 1)
static struct omap_clk omap24xx_clks[] = {
/* external root sources */
CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X),
CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X),
CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X),
CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X),
/* internal analog sources */
CLK(NULL, "dpll_ck", &dpll_ck, CK_243X | CK_242X),
CLK(NULL, "apll96_ck", &apll96_ck, CK_243X | CK_242X),
CLK(NULL, "apll54_ck", &apll54_ck, CK_243X | CK_242X),
/* internal prcm root sources */
CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X | CK_242X),
CLK(NULL, "core_ck", &core_ck, CK_243X | CK_242X),
CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X | CK_242X),
CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X | CK_242X),
CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X | CK_242X),
CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X | CK_242X),
CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X | CK_242X),
CLK(NULL, "sys_clkout", &sys_clkout, CK_243X | CK_242X),
CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
CLK(NULL, "emul_ck", &emul_ck, CK_242X),
/* mpu domain clocks */
CLK(NULL, "mpu_ck", &mpu_ck, CK_243X | CK_242X),
/* dsp domain clocks */
CLK(NULL, "dsp_fck", &dsp_fck, CK_243X | CK_242X),
CLK(NULL, "dsp_irate_ick", &dsp_irate_ick, CK_243X | CK_242X),
CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
/* GFX domain clocks */
CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X | CK_242X),
CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X | CK_242X),
CLK(NULL, "gfx_ick", &gfx_ick, CK_243X | CK_242X),
/* Modem domain clocks */
CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
/* DSS domain clocks */
CLK(NULL, "dss_ick", &dss_ick, CK_243X | CK_242X),
CLK(NULL, "dss1_fck", &dss1_fck, CK_243X | CK_242X),
CLK(NULL, "dss2_fck", &dss2_fck, CK_243X | CK_242X),
CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X | CK_242X),
/* L3 domain clocks */
CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X | CK_242X),
CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X | CK_242X),
CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X | CK_242X),
/* L4 domain clocks */
CLK(NULL, "l4_ck", &l4_ck, CK_243X | CK_242X),
CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X | CK_242X),
/* virtual meta-group clock */
CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X | CK_242X),
/* general l4 interface ck, multi-parent functional clk */
CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X | CK_242X),
CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X | CK_242X),
CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X | CK_242X),
CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X | CK_242X),
CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X | CK_242X),
CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X | CK_242X),
CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X | CK_242X),
CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X | CK_242X),
CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X | CK_242X),
CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X | CK_242X),
CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X | CK_242X),
CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X | CK_242X),
CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X | CK_242X),
CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X | CK_242X),
CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X | CK_242X),
CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X | CK_242X),
CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X | CK_242X),
CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X | CK_242X),
CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X | CK_242X),
CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X | CK_242X),
CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X | CK_242X),
CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X | CK_242X),
CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X | CK_242X),
CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X | CK_242X),
CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X | CK_242X),
CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_243X | CK_242X),
CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X | CK_242X),
CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_243X | CK_242X),
CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_243X),
CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_243X),
CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_243X),
CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X | CK_242X),
CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_243X | CK_242X),
CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X | CK_242X),
CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_243X | CK_242X),
CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_243X),
CLK(NULL, "uart1_ick", &uart1_ick, CK_243X | CK_242X),
CLK(NULL, "uart1_fck", &uart1_fck, CK_243X | CK_242X),
CLK(NULL, "uart2_ick", &uart2_ick, CK_243X | CK_242X),
CLK(NULL, "uart2_fck", &uart2_fck, CK_243X | CK_242X),
CLK(NULL, "uart3_ick", &uart3_ick, CK_243X | CK_242X),
CLK(NULL, "uart3_fck", &uart3_fck, CK_243X | CK_242X),
CLK(NULL, "gpios_ick", &gpios_ick, CK_243X | CK_242X),
CLK(NULL, "gpios_fck", &gpios_fck, CK_243X | CK_242X),
CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X | CK_242X),
CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_243X | CK_242X),
CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X | CK_242X),
CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X | CK_242X),
CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X | CK_242X),
CLK(NULL, "icr_ick", &icr_ick, CK_243X),
CLK("omap24xxcam", "fck", &cam_fck, CK_243X | CK_242X),
CLK("omap24xxcam", "ick", &cam_ick, CK_243X | CK_242X),
CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X | CK_242X),
CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X | CK_242X),
CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X | CK_242X),
CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
CLK(NULL, "mspro_ick", &mspro_ick, CK_243X | CK_242X),
CLK(NULL, "mspro_fck", &mspro_fck, CK_243X | CK_242X),
CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
CLK(NULL, "fac_ick", &fac_ick, CK_243X | CK_242X),
CLK(NULL, "fac_fck", &fac_fck, CK_243X | CK_242X),
CLK(NULL, "eac_ick", &eac_ick, CK_242X),
CLK(NULL, "eac_fck", &eac_fck, CK_242X),
CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X | CK_242X),
CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X | CK_242X),
CLK("i2c_omap.1", "ick", &i2c1_ick, CK_243X | CK_242X),
CLK("i2c_omap.1", "fck", &i2c1_fck, CK_242X),
CLK("i2c_omap.1", "fck", &i2chs1_fck, CK_243X),
CLK("i2c_omap.2", "ick", &i2c2_ick, CK_243X | CK_242X),
CLK("i2c_omap.2", "fck", &i2c2_fck, CK_242X),
CLK("i2c_omap.2", "fck", &i2chs2_fck, CK_243X),
CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X | CK_242X),
CLK(NULL, "sdma_fck", &sdma_fck, CK_243X | CK_242X),
CLK(NULL, "sdma_ick", &sdma_ick, CK_243X | CK_242X),
CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
CLK(NULL, "des_ick", &des_ick, CK_243X | CK_242X),
CLK(NULL, "sha_ick", &sha_ick, CK_243X | CK_242X),
CLK("omap_rng", "ick", &rng_ick, CK_243X | CK_242X),
CLK(NULL, "aes_ick", &aes_ick, CK_243X | CK_242X),
CLK(NULL, "pka_ick", &pka_ick, CK_243X | CK_242X),
CLK(NULL, "usb_fck", &usb_fck, CK_243X | CK_242X),
CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_243X),
CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_243X),
CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_243X),
CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_243X),
CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
CLK("mmci-omap-hs.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
CLK("mmci-omap-hs.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
};
/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ /* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
#define EN_APLL_STOPPED 0 #define EN_APLL_STOPPED 0
#define EN_APLL_LOCKED 3 #define EN_APLL_LOCKED 3
...@@ -59,19 +236,32 @@ static struct clk *sclk; ...@@ -59,19 +236,32 @@ static struct clk *sclk;
* Omap24xx specific clock functions * Omap24xx specific clock functions
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
/* This actually returns the rate of core_ck, not dpll_ck. */ /**
static u32 omap2_get_dpll_rate_24xx(struct clk *tclk) * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
* @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
*
* Returns the CORE_CLK rate. CORE_CLK can have one of three rate
* sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
* (the latter is unusual). This currently should be called with
* struct clk *dpll_ck, which is a composite clock of dpll_ck and
* core_ck.
*/
static unsigned long omap2xxx_clk_get_core_rate(struct clk *clk)
{ {
long long dpll_clk; long long core_clk;
u8 amult; u32 v;
core_clk = omap2_get_dpll_rate(clk);
dpll_clk = omap2_get_dpll_rate(tclk); v = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
v &= OMAP24XX_CORE_CLK_SRC_MASK;
amult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); if (v == CORE_CLK_SRC_32K)
amult &= OMAP24XX_CORE_CLK_SRC_MASK; core_clk = 32768;
dpll_clk *= amult; else
core_clk *= v;
return dpll_clk; return core_clk;
} }
static int omap2_enable_osc_ck(struct clk *clk) static int omap2_enable_osc_ck(struct clk *clk)
...@@ -96,6 +286,11 @@ static void omap2_disable_osc_ck(struct clk *clk) ...@@ -96,6 +286,11 @@ static void omap2_disable_osc_ck(struct clk *clk)
OMAP24XX_PRCM_CLKSRC_CTRL); OMAP24XX_PRCM_CLKSRC_CTRL);
} }
static const struct clkops clkops_oscck = {
.enable = &omap2_enable_osc_ck,
.disable = &omap2_disable_osc_ck,
};
#ifdef OLD_CK #ifdef OLD_CK
/* Recalculate SYST_CLK */ /* Recalculate SYST_CLK */
static void omap2_sys_clk_recalc(struct clk * clk) static void omap2_sys_clk_recalc(struct clk * clk)
...@@ -149,11 +344,16 @@ static void omap2_clk_fixed_disable(struct clk *clk) ...@@ -149,11 +344,16 @@ static void omap2_clk_fixed_disable(struct clk *clk)
cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
} }
static const struct clkops clkops_fixed = {
.enable = &omap2_clk_fixed_enable,
.disable = &omap2_clk_fixed_disable,
};
/* /*
* Uses the current prcm set to tell if a rate is valid. * Uses the current prcm set to tell if a rate is valid.
* You can go slower, but not faster within a given rate set. * You can go slower, but not faster within a given rate set.
*/ */
long omap2_dpllcore_round_rate(unsigned long target_rate) static long omap2_dpllcore_round_rate(unsigned long target_rate)
{ {
u32 high, low, core_clk_src; u32 high, low, core_clk_src;
...@@ -182,11 +382,9 @@ long omap2_dpllcore_round_rate(unsigned long target_rate) ...@@ -182,11 +382,9 @@ long omap2_dpllcore_round_rate(unsigned long target_rate)
} }
static void omap2_dpllcore_recalc(struct clk *clk) static unsigned long omap2_dpllcore_recalc(struct clk *clk)
{ {
clk->rate = omap2_get_dpll_rate_24xx(clk); return omap2xxx_clk_get_core_rate(clk);
propagate_rate(clk);
} }
static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
...@@ -195,22 +393,19 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) ...@@ -195,22 +393,19 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
u32 bypass = 0; u32 bypass = 0;
struct prcm_config tmpset; struct prcm_config tmpset;
const struct dpll_data *dd; const struct dpll_data *dd;
unsigned long flags;
int ret = -EINVAL;
local_irq_save(flags); cur_rate = omap2xxx_clk_get_core_rate(&dpll_ck);
cur_rate = omap2_get_dpll_rate_24xx(&dpll_ck);
mult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); mult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
mult &= OMAP24XX_CORE_CLK_SRC_MASK; mult &= OMAP24XX_CORE_CLK_SRC_MASK;
if ((rate == (cur_rate / 2)) && (mult == 2)) { if ((rate == (cur_rate / 2)) && (mult == 2)) {
omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL, 1); omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
} else if ((rate == (cur_rate * 2)) && (mult == 1)) { } else if ((rate == (cur_rate * 2)) && (mult == 1)) {
omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
} else if (rate != cur_rate) { } else if (rate != cur_rate) {
valid_rate = omap2_dpllcore_round_rate(rate); valid_rate = omap2_dpllcore_round_rate(rate);
if (valid_rate != rate) if (valid_rate != rate)
goto dpll_exit; return -EINVAL;
if (mult == 1) if (mult == 1)
low = curr_prcm_set->dpll_speed; low = curr_prcm_set->dpll_speed;
...@@ -219,7 +414,7 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) ...@@ -219,7 +414,7 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
dd = clk->dpll_data; dd = clk->dpll_data;
if (!dd) if (!dd)
goto dpll_exit; return -EINVAL;
tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg); tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg);
tmpset.cm_clksel1_pll &= ~(dd->mult_mask | tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
...@@ -245,22 +440,19 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) ...@@ -245,22 +440,19 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
if (rate == curr_prcm_set->xtal_speed) /* If asking for 1-1 */ if (rate == curr_prcm_set->xtal_speed) /* If asking for 1-1 */
bypass = 1; bypass = 1;
omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); /* For init_mem */ /* For omap2xxx_sdrc_init_params() */
omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
/* Force dll lock mode */ /* Force dll lock mode */
omap2_set_prcm(tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr, omap2_set_prcm(tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr,
bypass); bypass);
/* Errata: ret dll entry state */ /* Errata: ret dll entry state */
omap2_init_memory_params(omap2_dll_force_needed()); omap2xxx_sdrc_init_params(omap2xxx_sdrc_dll_is_unlocked());
omap2_reprogram_sdrc(done_rate, 0); omap2xxx_sdrc_reprogram(done_rate, 0);
} }
omap2_dpllcore_recalc(&dpll_ck);
ret = 0;
dpll_exit: return 0;
local_irq_restore(flags);
return(ret);
} }
/** /**
...@@ -269,9 +461,9 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) ...@@ -269,9 +461,9 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
* *
* Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
*/ */
static void omap2_table_mpu_recalc(struct clk *clk) static unsigned long omap2_table_mpu_recalc(struct clk *clk)
{ {
clk->rate = curr_prcm_set->mpu_speed; return curr_prcm_set->mpu_speed;
} }
/* /*
...@@ -337,12 +529,12 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate) ...@@ -337,12 +529,12 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
} }
curr_prcm_set = prcm; curr_prcm_set = prcm;
cur_rate = omap2_get_dpll_rate_24xx(&dpll_ck); cur_rate = omap2xxx_clk_get_core_rate(&dpll_ck);
if (prcm->dpll_speed == cur_rate / 2) { if (prcm->dpll_speed == cur_rate / 2) {
omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL, 1); omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
} else if (prcm->dpll_speed == cur_rate * 2) { } else if (prcm->dpll_speed == cur_rate * 2) {
omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
} else if (prcm->dpll_speed != cur_rate) { } else if (prcm->dpll_speed != cur_rate) {
local_irq_save(flags); local_irq_save(flags);
...@@ -366,27 +558,67 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate) ...@@ -366,27 +558,67 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
/* Major subsystem dividers */ /* Major subsystem dividers */
tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK; tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD, CM_CLKSEL1); cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
CM_CLKSEL1);
if (cpu_is_omap2430()) if (cpu_is_omap2430())
cm_write_mod_reg(prcm->cm_clksel_mdm, cm_write_mod_reg(prcm->cm_clksel_mdm,
OMAP2430_MDM_MOD, CM_CLKSEL); OMAP2430_MDM_MOD, CM_CLKSEL);
/* x2 to enter init_mem */ /* x2 to enter omap2xxx_sdrc_init_params() */
omap2_reprogram_sdrc(CORE_CLK_SRC_DPLL_X2, 1); omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
omap2_set_prcm(prcm->cm_clksel1_pll, prcm->base_sdrc_rfr, omap2_set_prcm(prcm->cm_clksel1_pll, prcm->base_sdrc_rfr,
bypass); bypass);
omap2_init_memory_params(omap2_dll_force_needed()); omap2xxx_sdrc_init_params(omap2xxx_sdrc_dll_is_unlocked());
omap2_reprogram_sdrc(done_rate, 0); omap2xxx_sdrc_reprogram(done_rate, 0);
local_irq_restore(flags); local_irq_restore(flags);
} }
omap2_dpllcore_recalc(&dpll_ck);
return 0; return 0;
} }
#ifdef CONFIG_CPU_FREQ
/*
* Walk PRCM rate table and fillout cpufreq freq_table
*/
static struct cpufreq_frequency_table freq_table[ARRAY_SIZE(rate_table)];
void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
{
struct prcm_config *prcm;
int i = 0;
for (prcm = rate_table; prcm->mpu_speed; prcm++) {
if (!(prcm->flags & cpu_mask))
continue;
if (prcm->xtal_speed != sys_ck.rate)
continue;
/* don't put bypass rates in table */
if (prcm->dpll_speed == prcm->xtal_speed)
continue;
freq_table[i].index = i;
freq_table[i].frequency = prcm->mpu_speed / 1000;
i++;
}
if (i == 0) {
printk(KERN_WARNING "%s: failed to initialize frequency "
"table\n", __func__);
return;
}
freq_table[i].index = i;
freq_table[i].frequency = CPUFREQ_TABLE_END;
*table = &freq_table[0];
}
#endif
static struct clk_functions omap2_clk_functions = { static struct clk_functions omap2_clk_functions = {
.clk_enable = omap2_clk_enable, .clk_enable = omap2_clk_enable,
.clk_disable = omap2_clk_disable, .clk_disable = omap2_clk_disable,
...@@ -394,24 +626,27 @@ static struct clk_functions omap2_clk_functions = { ...@@ -394,24 +626,27 @@ static struct clk_functions omap2_clk_functions = {
.clk_set_rate = omap2_clk_set_rate, .clk_set_rate = omap2_clk_set_rate,
.clk_set_parent = omap2_clk_set_parent, .clk_set_parent = omap2_clk_set_parent,
.clk_disable_unused = omap2_clk_disable_unused, .clk_disable_unused = omap2_clk_disable_unused,
#ifdef CONFIG_CPU_FREQ
.clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
#endif
}; };
static u32 omap2_get_apll_clkin(void) static u32 omap2_get_apll_clkin(void)
{ {
u32 aplls, sclk = 0; u32 aplls, srate = 0;
aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1); aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1);
aplls &= OMAP24XX_APLLS_CLKIN_MASK; aplls &= OMAP24XX_APLLS_CLKIN_MASK;
aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT; aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT;
if (aplls == APLLS_CLKIN_19_2MHZ) if (aplls == APLLS_CLKIN_19_2MHZ)
sclk = 19200000; srate = 19200000;
else if (aplls == APLLS_CLKIN_13MHZ) else if (aplls == APLLS_CLKIN_13MHZ)
sclk = 13000000; srate = 13000000;
else if (aplls == APLLS_CLKIN_12MHZ) else if (aplls == APLLS_CLKIN_12MHZ)
sclk = 12000000; srate = 12000000;
return sclk; return srate;
} }
static u32 omap2_get_sysclkdiv(void) static u32 omap2_get_sysclkdiv(void)
...@@ -425,16 +660,14 @@ static u32 omap2_get_sysclkdiv(void) ...@@ -425,16 +660,14 @@ static u32 omap2_get_sysclkdiv(void)
return div; return div;
} }
static void omap2_osc_clk_recalc(struct clk *clk) static unsigned long omap2_osc_clk_recalc(struct clk *clk)
{ {
clk->rate = omap2_get_apll_clkin() * omap2_get_sysclkdiv(); return omap2_get_apll_clkin() * omap2_get_sysclkdiv();
propagate_rate(clk);
} }
static void omap2_sys_clk_recalc(struct clk *clk) static unsigned long omap2_sys_clk_recalc(struct clk *clk)
{ {
clk->rate = clk->parent->rate / omap2_get_sysclkdiv(); return clk->parent->rate / omap2_get_sysclkdiv();
propagate_rate(clk);
} }
/* /*
...@@ -460,7 +693,7 @@ static int __init omap2_clk_arch_init(void) ...@@ -460,7 +693,7 @@ static int __init omap2_clk_arch_init(void)
if (!mpurate) if (!mpurate)
return -EINVAL; return -EINVAL;
if (omap2_select_table_rate(&virt_prcm_set, mpurate)) if (clk_set_rate(&virt_prcm_set, mpurate))
printk(KERN_ERR "Could not find matching MPU rate\n"); printk(KERN_ERR "Could not find matching MPU rate\n");
recalculate_root_clocks(); recalculate_root_clocks();
...@@ -477,8 +710,8 @@ arch_initcall(omap2_clk_arch_init); ...@@ -477,8 +710,8 @@ arch_initcall(omap2_clk_arch_init);
int __init omap2_clk_init(void) int __init omap2_clk_init(void)
{ {
struct prcm_config *prcm; struct prcm_config *prcm;
struct clk **clkp; struct omap_clk *c;
u32 clkrate; u32 clkrate, cpu_mask;
if (cpu_is_omap242x()) if (cpu_is_omap242x())
cpu_mask = RATE_IN_242X; cpu_mask = RATE_IN_242X;
...@@ -487,26 +720,28 @@ int __init omap2_clk_init(void) ...@@ -487,26 +720,28 @@ int __init omap2_clk_init(void)
clk_init(&omap2_clk_functions); clk_init(&omap2_clk_functions);
omap2_osc_clk_recalc(&osc_ck); osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
omap2_sys_clk_recalc(&sys_ck); propagate_rate(&osc_ck);
sys_ck.rate = omap2_sys_clk_recalc(&sys_ck);
propagate_rate(&sys_ck);
for (clkp = onchip_24xx_clks; for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
clkp < onchip_24xx_clks + ARRAY_SIZE(onchip_24xx_clks); clk_init_one(c->lk.clk);
clkp++) {
if ((*clkp)->flags & CLOCK_IN_OMAP242X && cpu_is_omap2420()) { cpu_mask = 0;
clk_register(*clkp); if (cpu_is_omap2420())
continue; cpu_mask |= CK_242X;
} if (cpu_is_omap2430())
cpu_mask |= CK_243X;
if ((*clkp)->flags & CLOCK_IN_OMAP243X && cpu_is_omap2430()) { for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
clk_register(*clkp); if (c->cpu & cpu_mask) {
continue; clkdev_add(&c->lk);
clk_register(c->lk.clk);
} }
}
/* Check the MPU rate set by bootloader */ /* Check the MPU rate set by bootloader */
clkrate = omap2_get_dpll_rate_24xx(&dpll_ck); clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
for (prcm = rate_table; prcm->mpu_speed; prcm++) { for (prcm = rate_table; prcm->mpu_speed; prcm++) {
if (!(prcm->flags & cpu_mask)) if (!(prcm->flags & cpu_mask))
continue; continue;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/limits.h> #include <linux/limits.h>
#include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -71,16 +72,13 @@ static void _autodep_lookup(struct clkdm_pwrdm_autodep *autodep) ...@@ -71,16 +72,13 @@ static void _autodep_lookup(struct clkdm_pwrdm_autodep *autodep)
if (!omap_chip_is(autodep->omap_chip)) if (!omap_chip_is(autodep->omap_chip))
return; return;
pwrdm = pwrdm_lookup(autodep->pwrdm_name); pwrdm = pwrdm_lookup(autodep->pwrdm.name);
if (!pwrdm) { if (!pwrdm) {
pr_debug("clockdomain: _autodep_lookup: powerdomain %s " pr_err("clockdomain: autodeps: powerdomain %s does not exist\n",
"does not exist\n", autodep->pwrdm_name); autodep->pwrdm.name);
WARN_ON(1); pwrdm = ERR_PTR(-ENOENT);
return;
} }
autodep->pwrdm = pwrdm; autodep->pwrdm.ptr = pwrdm;
return;
} }
/* /*
...@@ -95,16 +93,19 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm) ...@@ -95,16 +93,19 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
{ {
struct clkdm_pwrdm_autodep *autodep; struct clkdm_pwrdm_autodep *autodep;
for (autodep = autodeps; autodep->pwrdm_name; autodep++) { for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) {
if (!autodep->pwrdm) if (IS_ERR(autodep->pwrdm.ptr))
continue;
if (!omap_chip_is(autodep->omap_chip))
continue; continue;
pr_debug("clockdomain: adding %s sleepdep/wkdep for " pr_debug("clockdomain: adding %s sleepdep/wkdep for "
"pwrdm %s\n", autodep->pwrdm_name, "pwrdm %s\n", autodep->pwrdm.ptr->name,
clkdm->pwrdm->name); clkdm->pwrdm.ptr->name);
pwrdm_add_sleepdep(clkdm->pwrdm, autodep->pwrdm); pwrdm_add_sleepdep(clkdm->pwrdm.ptr, autodep->pwrdm.ptr);
pwrdm_add_wkdep(clkdm->pwrdm, autodep->pwrdm); pwrdm_add_wkdep(clkdm->pwrdm.ptr, autodep->pwrdm.ptr);
} }
} }
...@@ -120,16 +121,19 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm) ...@@ -120,16 +121,19 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
{ {
struct clkdm_pwrdm_autodep *autodep; struct clkdm_pwrdm_autodep *autodep;
for (autodep = autodeps; autodep->pwrdm_name; autodep++) { for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) {
if (!autodep->pwrdm) if (IS_ERR(autodep->pwrdm.ptr))
continue;
if (!omap_chip_is(autodep->omap_chip))
continue; continue;
pr_debug("clockdomain: removing %s sleepdep/wkdep for " pr_debug("clockdomain: removing %s sleepdep/wkdep for "
"pwrdm %s\n", autodep->pwrdm_name, "pwrdm %s\n", autodep->pwrdm.ptr->name,
clkdm->pwrdm->name); clkdm->pwrdm.ptr->name);
pwrdm_del_sleepdep(clkdm->pwrdm, autodep->pwrdm); pwrdm_del_sleepdep(clkdm->pwrdm.ptr, autodep->pwrdm.ptr);
pwrdm_del_wkdep(clkdm->pwrdm, autodep->pwrdm); pwrdm_del_wkdep(clkdm->pwrdm.ptr, autodep->pwrdm.ptr);
} }
} }
...@@ -179,7 +183,7 @@ void clkdm_init(struct clockdomain **clkdms, ...@@ -179,7 +183,7 @@ void clkdm_init(struct clockdomain **clkdms,
autodeps = init_autodeps; autodeps = init_autodeps;
if (autodeps) if (autodeps)
for (autodep = autodeps; autodep->pwrdm_name; autodep++) for (autodep = autodeps; autodep->pwrdm.ptr; autodep++)
_autodep_lookup(autodep); _autodep_lookup(autodep);
} }
...@@ -202,20 +206,20 @@ int clkdm_register(struct clockdomain *clkdm) ...@@ -202,20 +206,20 @@ int clkdm_register(struct clockdomain *clkdm)
if (!omap_chip_is(clkdm->omap_chip)) if (!omap_chip_is(clkdm->omap_chip))
return -EINVAL; return -EINVAL;
pwrdm = pwrdm_lookup(clkdm->pwrdm_name); pwrdm = pwrdm_lookup(clkdm->pwrdm.name);
if (!pwrdm) { if (!pwrdm) {
pr_debug("clockdomain: clkdm_register %s: powerdomain %s " pr_err("clockdomain: %s: powerdomain %s does not exist\n",
"does not exist\n", clkdm->name, clkdm->pwrdm_name); clkdm->name, clkdm->pwrdm.name);
return -EINVAL; return -EINVAL;
} }
clkdm->pwrdm = pwrdm; clkdm->pwrdm.ptr = pwrdm;
mutex_lock(&clkdm_mutex); mutex_lock(&clkdm_mutex);
/* Verify that the clockdomain is not already registered */ /* Verify that the clockdomain is not already registered */
if (_clkdm_lookup(clkdm->name)) { if (_clkdm_lookup(clkdm->name)) {
ret = -EEXIST; ret = -EEXIST;
goto cr_unlock; goto cr_unlock;
}; }
list_add(&clkdm->node, &clkdm_list); list_add(&clkdm->node, &clkdm_list);
...@@ -242,7 +246,7 @@ int clkdm_unregister(struct clockdomain *clkdm) ...@@ -242,7 +246,7 @@ int clkdm_unregister(struct clockdomain *clkdm)
if (!clkdm) if (!clkdm)
return -EINVAL; return -EINVAL;
pwrdm_del_clkdm(clkdm->pwrdm, clkdm); pwrdm_del_clkdm(clkdm->pwrdm.ptr, clkdm);
mutex_lock(&clkdm_mutex); mutex_lock(&clkdm_mutex);
list_del(&clkdm->node); list_del(&clkdm->node);
...@@ -327,7 +331,7 @@ struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm) ...@@ -327,7 +331,7 @@ struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)
if (!clkdm) if (!clkdm)
return NULL; return NULL;
return clkdm->pwrdm; return clkdm->pwrdm.ptr;
} }
...@@ -348,7 +352,7 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm) ...@@ -348,7 +352,7 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
if (!clkdm) if (!clkdm)
return -EINVAL; return -EINVAL;
v = cm_read_mod_reg(clkdm->pwrdm->prcm_offs, CM_CLKSTCTRL); v = cm_read_mod_reg(clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
v &= clkdm->clktrctrl_mask; v &= clkdm->clktrctrl_mask;
v >>= __ffs(clkdm->clktrctrl_mask); v >>= __ffs(clkdm->clktrctrl_mask);
...@@ -380,7 +384,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm) ...@@ -380,7 +384,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
cm_set_mod_reg_bits(OMAP24XX_FORCESTATE, cm_set_mod_reg_bits(OMAP24XX_FORCESTATE,
clkdm->pwrdm->prcm_offs, PM_PWSTCTRL); clkdm->pwrdm.ptr->prcm_offs, PM_PWSTCTRL);
} else if (cpu_is_omap34xx()) { } else if (cpu_is_omap34xx()) {
...@@ -388,7 +392,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm) ...@@ -388,7 +392,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
__ffs(clkdm->clktrctrl_mask)); __ffs(clkdm->clktrctrl_mask));
cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, v, cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, v,
clkdm->pwrdm->prcm_offs, CM_CLKSTCTRL); clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
} else { } else {
BUG(); BUG();
...@@ -422,7 +426,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) ...@@ -422,7 +426,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE, cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE,
clkdm->pwrdm->prcm_offs, PM_PWSTCTRL); clkdm->pwrdm.ptr->prcm_offs, PM_PWSTCTRL);
} else if (cpu_is_omap34xx()) { } else if (cpu_is_omap34xx()) {
...@@ -430,7 +434,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) ...@@ -430,7 +434,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
__ffs(clkdm->clktrctrl_mask)); __ffs(clkdm->clktrctrl_mask));
cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, v, cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, v,
clkdm->pwrdm->prcm_offs, CM_CLKSTCTRL); clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
} else { } else {
BUG(); BUG();
...@@ -478,7 +482,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) ...@@ -478,7 +482,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
v << __ffs(clkdm->clktrctrl_mask), v << __ffs(clkdm->clktrctrl_mask),
clkdm->pwrdm->prcm_offs, clkdm->pwrdm.ptr->prcm_offs,
CM_CLKSTCTRL); CM_CLKSTCTRL);
} }
...@@ -516,7 +520,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm) ...@@ -516,7 +520,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
v << __ffs(clkdm->clktrctrl_mask), v << __ffs(clkdm->clktrctrl_mask),
clkdm->pwrdm->prcm_offs, CM_CLKSTCTRL); clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
if (atomic_read(&clkdm->usecount) > 0) if (atomic_read(&clkdm->usecount) > 0)
_clkdm_del_autodeps(clkdm); _clkdm_del_autodeps(clkdm);
...@@ -567,6 +571,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) ...@@ -567,6 +571,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
else else
omap2_clkdm_wakeup(clkdm); omap2_clkdm_wakeup(clkdm);
pwrdm_wait_transition(clkdm->pwrdm.ptr);
return 0; return 0;
} }
......
此差异已折叠。
...@@ -110,35 +110,56 @@ ...@@ -110,35 +110,56 @@
#define OMAP24XX_EN_DES (1 << 0) #define OMAP24XX_EN_DES (1 << 0)
/* CM_IDLEST1_CORE specific bits */ /* CM_IDLEST1_CORE specific bits */
#define OMAP24XX_ST_MAILBOXES (1 << 30) #define OMAP24XX_ST_MAILBOXES_SHIFT 30
#define OMAP24XX_ST_WDT4 (1 << 29) #define OMAP24XX_ST_MAILBOXES_MASK (1 << 30)
#define OMAP2420_ST_WDT3 (1 << 28) #define OMAP24XX_ST_WDT4_SHIFT 29
#define OMAP24XX_ST_MSPRO (1 << 27) #define OMAP24XX_ST_WDT4_MASK (1 << 29)
#define OMAP24XX_ST_FAC (1 << 25) #define OMAP2420_ST_WDT3_SHIFT 28
#define OMAP2420_ST_EAC (1 << 24) #define OMAP2420_ST_WDT3_MASK (1 << 28)
#define OMAP24XX_ST_HDQ (1 << 23) #define OMAP24XX_ST_MSPRO_SHIFT 27
#define OMAP24XX_ST_I2C2 (1 << 20) #define OMAP24XX_ST_MSPRO_MASK (1 << 27)
#define OMAP24XX_ST_I2C1 (1 << 19) #define OMAP24XX_ST_FAC_SHIFT 25
#define OMAP24XX_ST_MCBSP2 (1 << 16) #define OMAP24XX_ST_FAC_MASK (1 << 25)
#define OMAP24XX_ST_MCBSP1 (1 << 15) #define OMAP2420_ST_EAC_SHIFT 24
#define OMAP24XX_ST_DSS (1 << 0) #define OMAP2420_ST_EAC_MASK (1 << 24)
#define OMAP24XX_ST_HDQ_SHIFT 23
#define OMAP24XX_ST_HDQ_MASK (1 << 23)
#define OMAP2420_ST_I2C2_SHIFT 20
#define OMAP2420_ST_I2C2_MASK (1 << 20)
#define OMAP2420_ST_I2C1_SHIFT 19
#define OMAP2420_ST_I2C1_MASK (1 << 19)
#define OMAP24XX_ST_MCBSP2_SHIFT 16
#define OMAP24XX_ST_MCBSP2_MASK (1 << 16)
#define OMAP24XX_ST_MCBSP1_SHIFT 15
#define OMAP24XX_ST_MCBSP1_MASK (1 << 15)
#define OMAP24XX_ST_DSS_SHIFT 0
#define OMAP24XX_ST_DSS_MASK (1 << 0)
/* CM_IDLEST2_CORE */ /* CM_IDLEST2_CORE */
#define OMAP2430_ST_MCBSP5 (1 << 5) #define OMAP2430_ST_MCBSP5_SHIFT 5
#define OMAP2430_ST_MCBSP4 (1 << 4) #define OMAP2430_ST_MCBSP5_MASK (1 << 5)
#define OMAP2430_ST_MCBSP3 (1 << 3) #define OMAP2430_ST_MCBSP4_SHIFT 4
#define OMAP24XX_ST_SSI (1 << 1) #define OMAP2430_ST_MCBSP4_MASK (1 << 4)
#define OMAP2430_ST_MCBSP3_SHIFT 3
#define OMAP2430_ST_MCBSP3_MASK (1 << 3)
#define OMAP24XX_ST_SSI_SHIFT 1
#define OMAP24XX_ST_SSI_MASK (1 << 1)
/* CM_IDLEST3_CORE */ /* CM_IDLEST3_CORE */
/* 2430 only */ /* 2430 only */
#define OMAP2430_ST_SDRC (1 << 2) #define OMAP2430_ST_SDRC_MASK (1 << 2)
/* CM_IDLEST4_CORE */ /* CM_IDLEST4_CORE */
#define OMAP24XX_ST_PKA (1 << 4) #define OMAP24XX_ST_PKA_SHIFT 4
#define OMAP24XX_ST_AES (1 << 3) #define OMAP24XX_ST_PKA_MASK (1 << 4)
#define OMAP24XX_ST_RNG (1 << 2) #define OMAP24XX_ST_AES_SHIFT 3
#define OMAP24XX_ST_SHA (1 << 1) #define OMAP24XX_ST_AES_MASK (1 << 3)
#define OMAP24XX_ST_DES (1 << 0) #define OMAP24XX_ST_RNG_SHIFT 2
#define OMAP24XX_ST_RNG_MASK (1 << 2)
#define OMAP24XX_ST_SHA_SHIFT 1
#define OMAP24XX_ST_SHA_MASK (1 << 1)
#define OMAP24XX_ST_DES_SHIFT 0
#define OMAP24XX_ST_DES_MASK (1 << 0)
/* CM_AUTOIDLE1_CORE */ /* CM_AUTOIDLE1_CORE */
#define OMAP24XX_AUTO_CAM (1 << 31) #define OMAP24XX_AUTO_CAM (1 << 31)
...@@ -275,11 +296,16 @@ ...@@ -275,11 +296,16 @@
#define OMAP24XX_EN_32KSYNC (1 << 1) #define OMAP24XX_EN_32KSYNC (1 << 1)
/* CM_IDLEST_WKUP specific bits */ /* CM_IDLEST_WKUP specific bits */
#define OMAP2430_ST_ICR (1 << 6) #define OMAP2430_ST_ICR_SHIFT 6
#define OMAP24XX_ST_OMAPCTRL (1 << 5) #define OMAP2430_ST_ICR_MASK (1 << 6)
#define OMAP24XX_ST_WDT1 (1 << 4) #define OMAP24XX_ST_OMAPCTRL_SHIFT 5
#define OMAP24XX_ST_MPU_WDT (1 << 3) #define OMAP24XX_ST_OMAPCTRL_MASK (1 << 5)
#define OMAP24XX_ST_32KSYNC (1 << 1) #define OMAP24XX_ST_WDT1_SHIFT 4
#define OMAP24XX_ST_WDT1_MASK (1 << 4)
#define OMAP24XX_ST_MPU_WDT_SHIFT 3
#define OMAP24XX_ST_MPU_WDT_MASK (1 << 3)
#define OMAP24XX_ST_32KSYNC_SHIFT 1
#define OMAP24XX_ST_32KSYNC_MASK (1 << 1)
/* CM_AUTOIDLE_WKUP */ /* CM_AUTOIDLE_WKUP */
#define OMAP24XX_AUTO_OMAPCTRL (1 << 5) #define OMAP24XX_AUTO_OMAPCTRL (1 << 5)
......
...@@ -348,11 +348,12 @@ static void __init omap_hsmmc_reset(void) ...@@ -348,11 +348,12 @@ static void __init omap_hsmmc_reset(void)
} }
dummy_pdev.id = i; dummy_pdev.id = i;
iclk = clk_get(dev, "mmchs_ick"); dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
iclk = clk_get(dev, "ick");
if (iclk && clk_enable(iclk)) if (iclk && clk_enable(iclk))
iclk = NULL; iclk = NULL;
fclk = clk_get(dev, "mmchs_fck"); fclk = clk_get(dev, "fck");
if (fclk && clk_enable(fclk)) if (fclk && clk_enable(fclk))
fclk = NULL; fclk = NULL;
......
...@@ -217,8 +217,13 @@ void __init omap2_check_revision(void) ...@@ -217,8 +217,13 @@ void __init omap2_check_revision(void)
omap_chip.oc = CHIP_IS_OMAP3430; omap_chip.oc = CHIP_IS_OMAP3430;
if (omap_rev() == OMAP3430_REV_ES1_0) if (omap_rev() == OMAP3430_REV_ES1_0)
omap_chip.oc |= CHIP_IS_OMAP3430ES1; omap_chip.oc |= CHIP_IS_OMAP3430ES1;
else if (omap_rev() > OMAP3430_REV_ES1_0) else if (omap_rev() >= OMAP3430_REV_ES2_0 &&
omap_rev() <= OMAP3430_REV_ES2_1)
omap_chip.oc |= CHIP_IS_OMAP3430ES2; omap_chip.oc |= CHIP_IS_OMAP3430ES2;
else if (omap_rev() == OMAP3430_REV_ES3_0)
omap_chip.oc |= CHIP_IS_OMAP3430ES3_0;
else if (omap_rev() == OMAP3430_REV_ES3_1)
omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
} else { } else {
pr_err("Uninitialized omap_chip, please fix!\n"); pr_err("Uninitialized omap_chip, please fix!\n");
} }
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include <mach/mux.h> #include <mach/mux.h>
#include <mach/omapfb.h> #include <mach/omapfb.h>
#include <mach/sram.h> #include <mach/sram.h>
#include <mach/sdrc.h>
#include "memory.h" #include <mach/gpmc.h>
#include "clock.h" #include "clock.h"
...@@ -195,12 +195,12 @@ void __init omap2_map_common_io(void) ...@@ -195,12 +195,12 @@ void __init omap2_map_common_io(void)
omapfb_reserve_sdram(); omapfb_reserve_sdram();
} }
void __init omap2_init_common_hw(void) void __init omap2_init_common_hw(struct omap_sdrc_params *sp)
{ {
omap2_mux_init(); omap2_mux_init();
pwrdm_init(powerdomains_omap); pwrdm_init(powerdomains_omap);
clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
omap2_clk_init(); omap2_clk_init();
omap2_init_memory(); omap2_sdrc_init(sp);
gpmc_init(); gpmc_init();
} }
此差异已折叠。
/*
* linux/arch/arm/mach-omap2/memory.h
*
* Interface for memory timing related functions for OMAP24XX
*
* Copyright (C) 2005 Texas Instruments Inc.
* Richard Woodruff <r-woodruff2@ti.com>
*
* Copyright (C) 2005 Nokia Corporation
* Tony Lindgren <tony@atomide.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef ARCH_ARM_MACH_OMAP2_MEMORY_H
#define ARCH_ARM_MACH_OMAP2_MEMORY_H
/* Memory timings */
#define M_DDR 1
#define M_LOCK_CTRL (1 << 2)
#define M_UNLOCK 0
#define M_LOCK 1
struct memory_timings {
u32 m_type; /* ddr = 1, sdr = 0 */
u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
u32 base_cs; /* base chip select to use for calculations */
};
extern void omap2_init_memory_params(u32 force_lock_to_unlock_mode);
extern u32 omap2_memory_get_slow_dll_ctrl(void);
extern u32 omap2_memory_get_fast_dll_ctrl(void);
extern u32 omap2_memory_get_type(void);
u32 omap2_dll_force_needed(void);
u32 omap2_reprogram_sdrc(u32 level, u32 force);
void __init omap2_init_memory(void);
void __init gpmc_init(void);
#endif
...@@ -103,7 +103,7 @@ static struct platform_suspend_ops omap_pm_ops = { ...@@ -103,7 +103,7 @@ static struct platform_suspend_ops omap_pm_ops = {
.valid = suspend_valid_only_mem, .valid = suspend_valid_only_mem,
}; };
int __init omap2_pm_init(void) static int __init omap2_pm_init(void)
{ {
return 0; return 0;
} }
......
...@@ -171,13 +171,19 @@ static struct powerdomain *powerdomains_omap[] __initdata = { ...@@ -171,13 +171,19 @@ static struct powerdomain *powerdomains_omap[] __initdata = {
&iva2_pwrdm, &iva2_pwrdm,
&mpu_34xx_pwrdm, &mpu_34xx_pwrdm,
&neon_pwrdm, &neon_pwrdm,
&core_34xx_pwrdm, &core_34xx_pre_es3_1_pwrdm,
&core_34xx_es3_1_pwrdm,
&cam_pwrdm, &cam_pwrdm,
&dss_pwrdm, &dss_pwrdm,
&per_pwrdm, &per_pwrdm,
&emu_pwrdm, &emu_pwrdm,
&sgx_pwrdm, &sgx_pwrdm,
&usbhost_pwrdm, &usbhost_pwrdm,
&dpll1_pwrdm,
&dpll2_pwrdm,
&dpll3_pwrdm,
&dpll4_pwrdm,
&dpll5_pwrdm,
#endif #endif
NULL NULL
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -249,7 +249,7 @@ static struct omap_globals *omap2_globals; ...@@ -249,7 +249,7 @@ static struct omap_globals *omap2_globals;
static void __init __omap2_set_globals(void) static void __init __omap2_set_globals(void)
{ {
omap2_set_globals_tap(omap2_globals); omap2_set_globals_tap(omap2_globals);
omap2_set_globals_memory(omap2_globals); omap2_set_globals_sdrc(omap2_globals);
omap2_set_globals_control(omap2_globals); omap2_set_globals_control(omap2_globals);
omap2_set_globals_prcm(omap2_globals); omap2_set_globals_prcm(omap2_globals);
} }
......
此差异已折叠。
此差异已折叠。
...@@ -103,6 +103,6 @@ extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); ...@@ -103,6 +103,6 @@ extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
extern void gpmc_cs_free(int cs); extern void gpmc_cs_free(int cs);
extern int gpmc_cs_set_reserved(int cs, int reserved); extern int gpmc_cs_set_reserved(int cs, int reserved);
extern int gpmc_cs_reserved(int cs); extern int gpmc_cs_reserved(int cs);
extern void gpmc_init(void); extern void __init gpmc_init(void);
#endif #endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册