From ae45b1c618d9e645a5e1decff31b710f739745fa Mon Sep 17 00:00:00 2001 From: wanzongshun Date: Fri, 31 Jul 2009 02:30:32 +0100 Subject: ARM: 5634/1: Add static setting cpu frequence for w90p910 platform Add static setting cpu frequence for w90p910 platform. Signed-off-by: Wan ZongShun Signed-off-by: Russell King --- arch/arm/mach-w90x900/clksel.c | 91 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 arch/arm/mach-w90x900/clksel.c (limited to 'arch/arm/mach-w90x900/clksel.c') diff --git a/arch/arm/mach-w90x900/clksel.c b/arch/arm/mach-w90x900/clksel.c new file mode 100644 index 00000000000..5a77eb91cb1 --- /dev/null +++ b/arch/arm/mach-w90x900/clksel.c @@ -0,0 +1,91 @@ +/* + * linux/arch/arm/mach-w90x900/clksel.c + * + * Copyright (c) 2008 Nuvoton technology corporation + * + * Wan ZongShun + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation;version 2 of the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define PLL0 0x00 +#define PLL1 0x01 +#define OTHER 0x02 +#define EXT 0x03 +#define MSOFFSET 0x0C +#define ATAOFFSET 0x0a +#define LCDOFFSET 0x06 +#define AUDOFFSET 0x04 +#define CPUOFFSET 0x00 + +static DEFINE_MUTEX(clksel_sem); + +static void clock_source_select(const char *dev_id, unsigned int clkval) +{ + unsigned int clksel, offset; + + clksel = __raw_readl(REG_CLKSEL); + + if (strcmp(dev_id, "w90p910-ms") == 0) + offset = MSOFFSET; + else if (strcmp(dev_id, "w90p910-atapi") == 0) + offset = ATAOFFSET; + else if (strcmp(dev_id, "w90p910-lcd") == 0) + offset = LCDOFFSET; + else if (strcmp(dev_id, "w90p910-audio") == 0) + offset = AUDOFFSET; + else + offset = CPUOFFSET; + + clksel &= ~(0x03 << offset); + clksel |= (clkval << offset); + + __raw_writel(clksel, REG_CLKSEL); +} + +void w90p910_clock_source(struct device *dev, unsigned char *src) +{ + unsigned int clkval; + const char *dev_id; + + BUG_ON(!src); + clkval = 0; + + mutex_lock(&clksel_sem); + + if (dev) + dev_id = dev_name(dev); + else + dev_id = "cpufreq"; + + if (strcmp(src, "pll0") == 0) + clkval = PLL0; + else if (strcmp(src, "pll1") == 0) + clkval = PLL1; + else if (strcmp(src, "ext") == 0) + clkval = EXT; + else if (strcmp(src, "oth") == 0) + clkval = OTHER; + + clock_source_select(dev_id, clkval); + + mutex_unlock(&clksel_sem); +} +EXPORT_SYMBOL(w90p910_clock_source); + -- cgit v1.2.3 From 35c9221acb133ecc9abd701a1fb6fa909d177a77 Mon Sep 17 00:00:00 2001 From: wanzongshun Date: Fri, 21 Aug 2009 07:07:46 +0100 Subject: ARM: 5682/1: Add cpu.c and dev.c and modify some files of w90p910 platform Add the cpu.c and dev.c and modify w90p910 platform to apply to use the common API(provided by cpu.c and dev.c) at the same time, I renamed all w90x900 to nuc900 in every c file of w90x900 platform and touchscreen's driver name. Signed-off-by: Wan ZongShun Signed-off-by: Russell King --- arch/arm/mach-w90x900/clksel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'arch/arm/mach-w90x900/clksel.c') diff --git a/arch/arm/mach-w90x900/clksel.c b/arch/arm/mach-w90x900/clksel.c index 5a77eb91cb1..3de4a5211c3 100644 --- a/arch/arm/mach-w90x900/clksel.c +++ b/arch/arm/mach-w90x900/clksel.c @@ -42,13 +42,13 @@ static void clock_source_select(const char *dev_id, unsigned int clkval) clksel = __raw_readl(REG_CLKSEL); - if (strcmp(dev_id, "w90p910-ms") == 0) + if (strcmp(dev_id, "nuc900-ms") == 0) offset = MSOFFSET; - else if (strcmp(dev_id, "w90p910-atapi") == 0) + else if (strcmp(dev_id, "nuc900-atapi") == 0) offset = ATAOFFSET; - else if (strcmp(dev_id, "w90p910-lcd") == 0) + else if (strcmp(dev_id, "nuc900-lcd") == 0) offset = LCDOFFSET; - else if (strcmp(dev_id, "w90p910-audio") == 0) + else if (strcmp(dev_id, "nuc900-audio") == 0) offset = AUDOFFSET; else offset = CPUOFFSET; @@ -59,7 +59,7 @@ static void clock_source_select(const char *dev_id, unsigned int clkval) __raw_writel(clksel, REG_CLKSEL); } -void w90p910_clock_source(struct device *dev, unsigned char *src) +void nuc900_clock_source(struct device *dev, unsigned char *src) { unsigned int clkval; const char *dev_id; @@ -87,5 +87,5 @@ void w90p910_clock_source(struct device *dev, unsigned char *src) mutex_unlock(&clksel_sem); } -EXPORT_SYMBOL(w90p910_clock_source); +EXPORT_SYMBOL(nuc900_clock_source); -- cgit v1.2.3