Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 160799
b: refs/heads/master
c: 35c9221
h: refs/heads/master
i:
  160797: 17c9573
  160795: 99a1be4
  160791: e341fc6
  160783: e33ecae
  160767: 9b0fc5d
v: v3
  • Loading branch information
wanzongshun authored and Russell King committed Sep 2, 2009
1 parent f8b0672 commit 5c5892b
Show file tree
Hide file tree
Showing 17 changed files with 728 additions and 626 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a8bc4eadd936bbad9e99b89fe692679451ad75c9
refs/heads/master: 35c9221acb133ecc9abd701a1fb6fa909d177a77
8 changes: 4 additions & 4 deletions trunk/arch/arm/mach-w90x900/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

# Object file lists.

obj-y := irq.o time.o mfp-w90p910.o gpio.o clock.o
obj-y += clksel.o
obj-y := irq.o time.o mfp.o gpio.o clock.o
obj-y += clksel.o dev.o cpu.o
# W90X900 CPU support files

obj-$(CONFIG_CPU_W90P910) += w90p910.o
obj-$(CONFIG_CPU_W90P910) += nuc910.o

# machine support

obj-$(CONFIG_MACH_W90P910EVB) += mach-w90p910evb.o
obj-$(CONFIG_MACH_W90P910EVB) += mach-nuc910evb.o
12 changes: 6 additions & 6 deletions trunk/arch/arm/mach-w90x900/clksel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);

4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-w90x900/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ unsigned long clk_get_rate(struct clk *clk)
}
EXPORT_SYMBOL(clk_get_rate);

void w90x900_clk_enable(struct clk *clk, int enable)
void nuc900_clk_enable(struct clk *clk, int enable)
{
unsigned int clocks = clk->cken;
unsigned long clken;
Expand All @@ -76,7 +76,7 @@ void w90x900_clk_enable(struct clk *clk, int enable)
__raw_writel(clken, W90X900_VA_CLKPWR);
}

void w90x900_subclk_enable(struct clk *clk, int enable)
void nuc900_subclk_enable(struct clk *clk, int enable)
{
unsigned int clocks = clk->cken;
unsigned long clken;
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/arm/mach-w90x900/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#include <asm/clkdev.h>

void w90x900_clk_enable(struct clk *clk, int enable);
void w90x900_subclk_enable(struct clk *clk, int enable);
void nuc900_clk_enable(struct clk *clk, int enable);
void nuc900_subclk_enable(struct clk *clk, int enable);
void clks_register(struct clk_lookup *clks, size_t num);

struct clk {
Expand All @@ -24,13 +24,13 @@ struct clk {

#define DEFINE_CLK(_name, _ctrlbit) \
struct clk clk_##_name = { \
.enable = w90x900_clk_enable, \
.enable = nuc900_clk_enable, \
.cken = (1 << _ctrlbit), \
}

#define DEFINE_SUBCLK(_name, _ctrlbit) \
struct clk clk_##_name = { \
.enable = w90x900_subclk_enable, \
.enable = nuc900_subclk_enable, \
.cken = (1 << _ctrlbit), \
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/*
* linux/arch/arm/mach-w90x900/w90p910.c
* linux/arch/arm/mach-w90x900/cpu.c
*
* Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
*
* Copyright (c) 2008 Nuvoton technology corporation.
* Copyright (c) 2009 Nuvoton corporation.
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* W90P910 cpu support
* NUC900 series cpu common support
*
* 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
Expand Down Expand Up @@ -41,19 +39,12 @@

/* Initial IO mappings */

static struct map_desc w90p910_iodesc[] __initdata = {
static struct map_desc nuc900_iodesc[] __initdata = {
IODESC_ENT(IRQ),
IODESC_ENT(GCR),
IODESC_ENT(UART),
IODESC_ENT(TIMER),
IODESC_ENT(EBI),
IODESC_ENT(USBEHCIHOST),
IODESC_ENT(USBOHCIHOST),
IODESC_ENT(ADC),
IODESC_ENT(RTC),
IODESC_ENT(KPI),
IODESC_ENT(USBDEV),
/*IODESC_ENT(LCD),*/
};

/* Initial clock declarations. */
Expand All @@ -78,58 +69,45 @@ static DEFINE_CLK(adc, 28);
static DEFINE_CLK(usi, 29);
static DEFINE_CLK(ext, 0);

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),
DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL),
DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL),
DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL),
DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL),
DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL),
DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL),
DEF_CLKLOOK(&clk_usi, "w90p910-spi", NULL),
static struct clk_lookup nuc900_clkregs[] = {
DEF_CLKLOOK(&clk_lcd, "nuc900-lcd", NULL),
DEF_CLKLOOK(&clk_audio, "nuc900-audio", NULL),
DEF_CLKLOOK(&clk_fmi, "nuc900-fmi", NULL),
DEF_CLKLOOK(&clk_ms, "nuc900-fmi", "MS"),
DEF_CLKLOOK(&clk_sd, "nuc900-fmi", "SD"),
DEF_CLKLOOK(&clk_dmac, "nuc900-dmac", NULL),
DEF_CLKLOOK(&clk_atapi, "nuc900-atapi", NULL),
DEF_CLKLOOK(&clk_emc, "nuc900-emc", NULL),
DEF_CLKLOOK(&clk_rmii, "nuc900-emc", "RMII"),
DEF_CLKLOOK(&clk_usbd, "nuc900-usbd", NULL),
DEF_CLKLOOK(&clk_usbh, "nuc900-usbh", NULL),
DEF_CLKLOOK(&clk_g2d, "nuc900-g2d", NULL),
DEF_CLKLOOK(&clk_pwm, "nuc900-pwm", NULL),
DEF_CLKLOOK(&clk_ps2, "nuc900-ps2", NULL),
DEF_CLKLOOK(&clk_kpi, "nuc900-kpi", NULL),
DEF_CLKLOOK(&clk_wdt, "nuc900-wdt", NULL),
DEF_CLKLOOK(&clk_gdma, "nuc900-gdma", NULL),
DEF_CLKLOOK(&clk_adc, "nuc900-adc", NULL),
DEF_CLKLOOK(&clk_usi, "nuc900-spi", NULL),
DEF_CLKLOOK(&clk_ext, NULL, "ext"),
};

/* Initial serial platform data */

struct plat_serial8250_port w90p910_uart_data[] = {
W90X900_8250PORT(UART0),
struct plat_serial8250_port nuc900_uart_data[] = {
NUC900_8250PORT(UART0),
};

struct platform_device w90p910_serial_device = {
struct platform_device nuc900_serial_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = w90p910_uart_data,
.platform_data = nuc900_uart_data,
},
};

/*Init W90P910 evb io*/

void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size)
{
unsigned long idcode = 0x0;

iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));

idcode = __raw_readl(W90X900PDID);
if (idcode != W90P910_CPUID)
printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode);
}

/*Set W90P910 cpu frequence*/
static int __init w90p910_set_clkval(unsigned int cpufreq)
/*Set NUC900 series cpu frequence*/
static int __init nuc900_set_clkval(unsigned int cpufreq)
{
unsigned int pllclk, ahbclk, apbclk, val;

Expand Down Expand Up @@ -178,7 +156,7 @@ static int __init w90p910_set_clkval(unsigned int cpufreq)

return 0;
}
static int __init w90p910_set_cpufreq(char *str)
static int __init nuc900_set_cpufreq(char *str)
{
unsigned long cpufreq, val;

Expand All @@ -187,9 +165,9 @@ static int __init w90p910_set_cpufreq(char *str)

strict_strtoul(str, 0, &cpufreq);

w90p910_clock_source(NULL, "ext");
nuc900_clock_source(NULL, "ext");

w90p910_set_clkval(cpufreq);
nuc900_set_clkval(cpufreq);

mdelay(1);

Expand All @@ -198,27 +176,37 @@ static int __init w90p910_set_cpufreq(char *str)
val |= DEFAULTSKEW;
__raw_writel(val, REG_CKSKEW);

w90p910_clock_source(NULL, "pll0");
nuc900_clock_source(NULL, "pll0");

return 1;
}

__setup("cpufreq=", w90p910_set_cpufreq);
__setup("cpufreq=", nuc900_set_cpufreq);

/*Init W90P910 clock*/
/*Init NUC900 evb io*/

void __init w90p910_init_clocks(void)
void __init nuc900_map_io(struct map_desc *mach_desc, int mach_size)
{
clks_register(w90p910_clkregs, ARRAY_SIZE(w90p910_clkregs));
}
unsigned long idcode = 0x0;

static int __init w90p910_init_cpu(void)
{
return 0;
iotable_init(mach_desc, mach_size);
iotable_init(nuc900_iodesc, ARRAY_SIZE(nuc900_iodesc));

idcode = __raw_readl(NUC900PDID);
if (idcode == NUC910_CPUID)
printk(KERN_INFO "CPU type 0x%08lx is NUC910\n", idcode);
else if (idcode == NUC920_CPUID)
printk(KERN_INFO "CPU type 0x%08lx is NUC920\n", idcode);
else if (idcode == NUC950_CPUID)
printk(KERN_INFO "CPU type 0x%08lx is NUC950\n", idcode);
else if (idcode == NUC960_CPUID)
printk(KERN_INFO "CPU type 0x%08lx is NUC960\n", idcode);
}

static int __init w90x900_arch_init(void)
/*Init NUC900 clock*/

void __init nuc900_init_clocks(void)
{
return w90p910_init_cpu();
clks_register(nuc900_clkregs, ARRAY_SIZE(nuc900_clkregs));
}
arch_initcall(w90x900_arch_init);

50 changes: 25 additions & 25 deletions trunk/arch/arm/mach-w90x900/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (c) 2008 Nuvoton technology corporation
* All rights reserved.
*
* Header file for W90X900 CPU support
* Header file for NUC900 CPU support
*
* Wan ZongShun <mcuos.com@gmail.com>
*
Expand All @@ -24,30 +24,7 @@
.type = MT_DEVICE, \
}

/*Cpu identifier register*/

#define W90X900PDID W90X900_VA_GCR
#define W90P910_CPUID 0x02900910
#define W90P920_CPUID 0x02900920
#define W90P950_CPUID 0x02900950
#define W90N960_CPUID 0x02900960

struct w90x900_uartcfg;
struct map_desc;
struct sys_timer;

/* core initialisation functions */

extern void w90x900_init_irq(void);
extern void w90p910_init_io(struct map_desc *mach_desc, int size);
extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no);
extern void w90p910_init_clocks(void);
extern void w90p910_map_io(struct map_desc *mach_desc, int size);
extern struct platform_device w90p910_serial_device;
extern struct sys_timer w90x900_timer;
extern void w90p910_clock_source(struct device *dev, unsigned char *src);

#define W90X900_8250PORT(name) \
#define NUC900_8250PORT(name) \
{ \
.membase = name##_BA, \
.mapbase = name##_PA, \
Expand All @@ -57,3 +34,26 @@ extern void w90p910_clock_source(struct device *dev, unsigned char *src);
.iotype = UPIO_MEM, \
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
}

/*Cpu identifier register*/

#define NUC900PDID W90X900_VA_GCR
#define NUC910_CPUID 0x02900910
#define NUC920_CPUID 0x02900920
#define NUC950_CPUID 0x02900950
#define NUC960_CPUID 0x02900960

/* extern file from cpu.c */

extern void nuc900_clock_source(struct device *dev, unsigned char *src);
extern void nuc900_init_clocks(void);
extern void nuc900_map_io(struct map_desc *mach_desc, int mach_size);
extern void nuc900_board_init(struct platform_device **device, int size);

/* for either public between 910 and 920, or between 920 and 950 */

extern struct platform_device nuc900_serial_device;
extern struct platform_device nuc900_device_fmi;
extern struct platform_device nuc900_device_kpi;
extern struct platform_device nuc900_device_rtc;
extern struct platform_device nuc900_device_ts;
Loading

0 comments on commit 5c5892b

Please sign in to comment.