From db58e90fdbe9d12b431ae8d8e856961ce75d74f0 Mon Sep 17 00:00:00 2001 From: wanzongshun Date: Tue, 14 Jul 2009 15:10:43 +0100 Subject: [PATCH] [ARM] 5602/1: Add sub clock api for w90p910 platform Add sub clock api for w90p910 platform. Signed-off-by: Wan ZongShun Signed-off-by: Russell King --- arch/arm/mach-w90x900/clock.c | 18 ++++++++++++++++++ arch/arm/mach-w90x900/clock.h | 8 ++++++++ arch/arm/mach-w90x900/w90p910.c | 6 ++++++ 3 files changed, 32 insertions(+) diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c index f420613..49cf1fb 100644 --- a/arch/arm/mach-w90x900/clock.c +++ b/arch/arm/mach-w90x900/clock.c @@ -25,6 +25,8 @@ #include "clock.h" +#define SUBCLK 0x24 + static DEFINE_SPINLOCK(clocks_lock); int clk_enable(struct clk *clk) @@ -68,6 +70,22 @@ void w90x900_clk_enable(struct clk *clk, int enable) __raw_writel(clken, W90X900_VA_CLKPWR); } +void w90x900_subclk_enable(struct clk *clk, int enable) +{ + unsigned int clocks = clk->cken; + unsigned long clken; + + clken = __raw_readl(W90X900_VA_CLKPWR + SUBCLK); + + if (enable) + clken |= clocks; + else + clken &= ~clocks; + + __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK); +} + + void clks_register(struct clk_lookup *clks, size_t num) { int i; diff --git a/arch/arm/mach-w90x900/clock.h b/arch/arm/mach-w90x900/clock.h index 4f27bda..d2f0e50 100644 --- a/arch/arm/mach-w90x900/clock.h +++ b/arch/arm/mach-w90x900/clock.h @@ -13,6 +13,7 @@ #include void w90x900_clk_enable(struct clk *clk, int enable); +void w90x900_subclk_enable(struct clk *clk, int enable); void clks_register(struct clk_lookup *clks, size_t num); struct clk { @@ -27,6 +28,13 @@ struct clk clk_##_name = { \ .cken = (1 << _ctrlbit), \ } +#define DEFINE_SUBCLK(_name, _ctrlbit) \ +struct clk clk_##_name = { \ + .enable = w90x900_subclk_enable, \ + .cken = (1 << _ctrlbit), \ + } + + #define DEF_CLKLOOK(_clk, _devname, _conname) \ { \ .clk = _clk, \ diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c index 1c97e49..1bde69e 100644 --- a/arch/arm/mach-w90x900/w90p910.c +++ b/arch/arm/mach-w90x900/w90p910.c @@ -57,9 +57,12 @@ static struct map_desc w90p910_iodesc[] __initdata = { static DEFINE_CLK(lcd, 0); static DEFINE_CLK(audio, 1); static DEFINE_CLK(fmi, 4); +static DEFINE_SUBCLK(ms, 0); +static DEFINE_SUBCLK(sd, 1); static DEFINE_CLK(dmac, 5); static DEFINE_CLK(atapi, 6); static DEFINE_CLK(emc, 7); +static DEFINE_SUBCLK(rmii, 2); static DEFINE_CLK(usbd, 8); static DEFINE_CLK(usbh, 9); static DEFINE_CLK(g2d, 10);; @@ -75,9 +78,12 @@ static struct clk_lookup w90p910_clkregs[] = { DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), + DEF_CLKLOOK(&clk_ms, "w90p910-fmi", "MS"), + DEF_CLKLOOK(&clk_sd, "w90p910-fmi", "SD"), DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), + DEF_CLKLOOK(&clk_rmii, "w90p910-emc", "RMII"), DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), -- 2.7.4