提交 35c9221a 编写于 作者: W wanzongshun 提交者: Russell King

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: NWan ZongShun <mcuos.com@gmail.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 a8bc4ead
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
# Object file lists. # Object file lists.
obj-y := irq.o time.o mfp-w90p910.o gpio.o clock.o obj-y := irq.o time.o mfp.o gpio.o clock.o
obj-y += clksel.o obj-y += clksel.o dev.o cpu.o
# W90X900 CPU support files # W90X900 CPU support files
obj-$(CONFIG_CPU_W90P910) += w90p910.o obj-$(CONFIG_CPU_W90P910) += nuc910.o
# machine support # machine support
obj-$(CONFIG_MACH_W90P910EVB) += mach-w90p910evb.o obj-$(CONFIG_MACH_W90P910EVB) += mach-nuc910evb.o
...@@ -42,13 +42,13 @@ static void clock_source_select(const char *dev_id, unsigned int clkval) ...@@ -42,13 +42,13 @@ static void clock_source_select(const char *dev_id, unsigned int clkval)
clksel = __raw_readl(REG_CLKSEL); clksel = __raw_readl(REG_CLKSEL);
if (strcmp(dev_id, "w90p910-ms") == 0) if (strcmp(dev_id, "nuc900-ms") == 0)
offset = MSOFFSET; offset = MSOFFSET;
else if (strcmp(dev_id, "w90p910-atapi") == 0) else if (strcmp(dev_id, "nuc900-atapi") == 0)
offset = ATAOFFSET; offset = ATAOFFSET;
else if (strcmp(dev_id, "w90p910-lcd") == 0) else if (strcmp(dev_id, "nuc900-lcd") == 0)
offset = LCDOFFSET; offset = LCDOFFSET;
else if (strcmp(dev_id, "w90p910-audio") == 0) else if (strcmp(dev_id, "nuc900-audio") == 0)
offset = AUDOFFSET; offset = AUDOFFSET;
else else
offset = CPUOFFSET; offset = CPUOFFSET;
...@@ -59,7 +59,7 @@ static void clock_source_select(const char *dev_id, unsigned int clkval) ...@@ -59,7 +59,7 @@ static void clock_source_select(const char *dev_id, unsigned int clkval)
__raw_writel(clksel, REG_CLKSEL); __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; unsigned int clkval;
const char *dev_id; const char *dev_id;
...@@ -87,5 +87,5 @@ void w90p910_clock_source(struct device *dev, unsigned char *src) ...@@ -87,5 +87,5 @@ void w90p910_clock_source(struct device *dev, unsigned char *src)
mutex_unlock(&clksel_sem); mutex_unlock(&clksel_sem);
} }
EXPORT_SYMBOL(w90p910_clock_source); EXPORT_SYMBOL(nuc900_clock_source);
...@@ -61,7 +61,7 @@ unsigned long clk_get_rate(struct clk *clk) ...@@ -61,7 +61,7 @@ unsigned long clk_get_rate(struct clk *clk)
} }
EXPORT_SYMBOL(clk_get_rate); 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 int clocks = clk->cken;
unsigned long clken; unsigned long clken;
...@@ -76,7 +76,7 @@ void w90x900_clk_enable(struct clk *clk, int enable) ...@@ -76,7 +76,7 @@ void w90x900_clk_enable(struct clk *clk, int enable)
__raw_writel(clken, W90X900_VA_CLKPWR); __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 int clocks = clk->cken;
unsigned long clken; unsigned long clken;
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include <asm/clkdev.h> #include <asm/clkdev.h>
void w90x900_clk_enable(struct clk *clk, int enable); void nuc900_clk_enable(struct clk *clk, int enable);
void w90x900_subclk_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); void clks_register(struct clk_lookup *clks, size_t num);
struct clk { struct clk {
...@@ -24,13 +24,13 @@ struct clk { ...@@ -24,13 +24,13 @@ struct clk {
#define DEFINE_CLK(_name, _ctrlbit) \ #define DEFINE_CLK(_name, _ctrlbit) \
struct clk clk_##_name = { \ struct clk clk_##_name = { \
.enable = w90x900_clk_enable, \ .enable = nuc900_clk_enable, \
.cken = (1 << _ctrlbit), \ .cken = (1 << _ctrlbit), \
} }
#define DEFINE_SUBCLK(_name, _ctrlbit) \ #define DEFINE_SUBCLK(_name, _ctrlbit) \
struct clk clk_##_name = { \ struct clk clk_##_name = { \
.enable = w90x900_subclk_enable, \ .enable = nuc900_subclk_enable, \
.cken = (1 << _ctrlbit), \ .cken = (1 << _ctrlbit), \
} }
......
/* /*
* 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) 2009 Nuvoton corporation.
*
* Copyright (c) 2008 Nuvoton technology corporation.
* *
* Wan ZongShun <mcuos.com@gmail.com> * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -41,19 +39,12 @@ ...@@ -41,19 +39,12 @@
/* Initial IO mappings */ /* Initial IO mappings */
static struct map_desc w90p910_iodesc[] __initdata = { static struct map_desc nuc900_iodesc[] __initdata = {
IODESC_ENT(IRQ), IODESC_ENT(IRQ),
IODESC_ENT(GCR), IODESC_ENT(GCR),
IODESC_ENT(UART), IODESC_ENT(UART),
IODESC_ENT(TIMER), IODESC_ENT(TIMER),
IODESC_ENT(EBI), 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. */ /* Initial clock declarations. */
...@@ -78,58 +69,45 @@ static DEFINE_CLK(adc, 28); ...@@ -78,58 +69,45 @@ static DEFINE_CLK(adc, 28);
static DEFINE_CLK(usi, 29); static DEFINE_CLK(usi, 29);
static DEFINE_CLK(ext, 0); static DEFINE_CLK(ext, 0);
static struct clk_lookup w90p910_clkregs[] = { static struct clk_lookup nuc900_clkregs[] = {
DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), DEF_CLKLOOK(&clk_lcd, "nuc900-lcd", NULL),
DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), DEF_CLKLOOK(&clk_audio, "nuc900-audio", NULL),
DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), DEF_CLKLOOK(&clk_fmi, "nuc900-fmi", NULL),
DEF_CLKLOOK(&clk_ms, "w90p910-fmi", "MS"), DEF_CLKLOOK(&clk_ms, "nuc900-fmi", "MS"),
DEF_CLKLOOK(&clk_sd, "w90p910-fmi", "SD"), DEF_CLKLOOK(&clk_sd, "nuc900-fmi", "SD"),
DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), DEF_CLKLOOK(&clk_dmac, "nuc900-dmac", NULL),
DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), DEF_CLKLOOK(&clk_atapi, "nuc900-atapi", NULL),
DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), DEF_CLKLOOK(&clk_emc, "nuc900-emc", NULL),
DEF_CLKLOOK(&clk_rmii, "w90p910-emc", "RMII"), DEF_CLKLOOK(&clk_rmii, "nuc900-emc", "RMII"),
DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), DEF_CLKLOOK(&clk_usbd, "nuc900-usbd", NULL),
DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), DEF_CLKLOOK(&clk_usbh, "nuc900-usbh", NULL),
DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), DEF_CLKLOOK(&clk_g2d, "nuc900-g2d", NULL),
DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL), DEF_CLKLOOK(&clk_pwm, "nuc900-pwm", NULL),
DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL), DEF_CLKLOOK(&clk_ps2, "nuc900-ps2", NULL),
DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL), DEF_CLKLOOK(&clk_kpi, "nuc900-kpi", NULL),
DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL), DEF_CLKLOOK(&clk_wdt, "nuc900-wdt", NULL),
DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL), DEF_CLKLOOK(&clk_gdma, "nuc900-gdma", NULL),
DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL), DEF_CLKLOOK(&clk_adc, "nuc900-adc", NULL),
DEF_CLKLOOK(&clk_usi, "w90p910-spi", NULL), DEF_CLKLOOK(&clk_usi, "nuc900-spi", NULL),
DEF_CLKLOOK(&clk_ext, NULL, "ext"), DEF_CLKLOOK(&clk_ext, NULL, "ext"),
}; };
/* Initial serial platform data */ /* Initial serial platform data */
struct plat_serial8250_port w90p910_uart_data[] = { struct plat_serial8250_port nuc900_uart_data[] = {
W90X900_8250PORT(UART0), NUC900_8250PORT(UART0),
}; };
struct platform_device w90p910_serial_device = { struct platform_device nuc900_serial_device = {
.name = "serial8250", .name = "serial8250",
.id = PLAT8250_DEV_PLATFORM, .id = PLAT8250_DEV_PLATFORM,
.dev = { .dev = {
.platform_data = w90p910_uart_data, .platform_data = nuc900_uart_data,
}, },
}; };
/*Init W90P910 evb io*/ /*Set NUC900 series cpu frequence*/
static int __init nuc900_set_clkval(unsigned int cpufreq)
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)
{ {
unsigned int pllclk, ahbclk, apbclk, val; unsigned int pllclk, ahbclk, apbclk, val;
...@@ -178,7 +156,7 @@ static int __init w90p910_set_clkval(unsigned int cpufreq) ...@@ -178,7 +156,7 @@ static int __init w90p910_set_clkval(unsigned int cpufreq)
return 0; return 0;
} }
static int __init w90p910_set_cpufreq(char *str) static int __init nuc900_set_cpufreq(char *str)
{ {
unsigned long cpufreq, val; unsigned long cpufreq, val;
...@@ -187,9 +165,9 @@ static int __init w90p910_set_cpufreq(char *str) ...@@ -187,9 +165,9 @@ static int __init w90p910_set_cpufreq(char *str)
strict_strtoul(str, 0, &cpufreq); 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); mdelay(1);
...@@ -198,27 +176,37 @@ static int __init w90p910_set_cpufreq(char *str) ...@@ -198,27 +176,37 @@ static int __init w90p910_set_cpufreq(char *str)
val |= DEFAULTSKEW; val |= DEFAULTSKEW;
__raw_writel(val, REG_CKSKEW); __raw_writel(val, REG_CKSKEW);
w90p910_clock_source(NULL, "pll0"); nuc900_clock_source(NULL, "pll0");
return 1; 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) iotable_init(mach_desc, mach_size);
{ iotable_init(nuc900_iodesc, ARRAY_SIZE(nuc900_iodesc));
return 0;
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);
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (c) 2008 Nuvoton technology corporation * Copyright (c) 2008 Nuvoton technology corporation
* All rights reserved. * All rights reserved.
* *
* Header file for W90X900 CPU support * Header file for NUC900 CPU support
* *
* Wan ZongShun <mcuos.com@gmail.com> * Wan ZongShun <mcuos.com@gmail.com>
* *
...@@ -24,30 +24,7 @@ ...@@ -24,30 +24,7 @@
.type = MT_DEVICE, \ .type = MT_DEVICE, \
} }
/*Cpu identifier register*/ #define NUC900_8250PORT(name) \
#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) \
{ \ { \
.membase = name##_BA, \ .membase = name##_BA, \
.mapbase = name##_PA, \ .mapbase = name##_PA, \
...@@ -57,3 +34,26 @@ extern void w90p910_clock_source(struct device *dev, unsigned char *src); ...@@ -57,3 +34,26 @@ extern void w90p910_clock_source(struct device *dev, unsigned char *src);
.iotype = UPIO_MEM, \ .iotype = UPIO_MEM, \
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \ .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;
/* /*
* linux/arch/arm/mach-w90x900/mach-w90p910evb.c * linux/arch/arm/mach-w90x900/dev.c
* *
* Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche * Copyright (C) 2009 Nuvoton corporation.
*
* Copyright (C) 2008 Nuvoton technology corporation.
* *
* Wan ZongShun <mcuos.com@gmail.com> * Wan ZongShun <mcuos.com@gmail.com>
* *
...@@ -37,14 +35,15 @@ ...@@ -37,14 +35,15 @@
#include <mach/map.h> #include <mach/map.h>
#include "cpu.h" #include "cpu.h"
/*w90p910 evb norflash driver data */
#define W90P910_FLASH_BASE 0xA0000000 /*NUC900 evb norflash driver data */
#define W90P910_FLASH_SIZE 0x400000
#define NUC900_FLASH_BASE 0xA0000000
#define NUC900_FLASH_SIZE 0x400000
#define SPIOFFSET 0x200 #define SPIOFFSET 0x200
#define SPIOREG_SIZE 0x100 #define SPIOREG_SIZE 0x100
static struct mtd_partition w90p910_flash_partitions[] = { static struct mtd_partition nuc900_flash_partitions[] = {
{ {
.name = "NOR Partition 1 for kernel (960K)", .name = "NOR Partition 1 for kernel (960K)",
.size = 0xF0000, .size = 0xF0000,
...@@ -62,33 +61,33 @@ static struct mtd_partition w90p910_flash_partitions[] = { ...@@ -62,33 +61,33 @@ static struct mtd_partition w90p910_flash_partitions[] = {
} }
}; };
static struct physmap_flash_data w90p910_flash_data = { static struct physmap_flash_data nuc900_flash_data = {
.width = 2, .width = 2,
.parts = w90p910_flash_partitions, .parts = nuc900_flash_partitions,
.nr_parts = ARRAY_SIZE(w90p910_flash_partitions), .nr_parts = ARRAY_SIZE(nuc900_flash_partitions),
}; };
static struct resource w90p910_flash_resources[] = { static struct resource nuc900_flash_resources[] = {
{ {
.start = W90P910_FLASH_BASE, .start = NUC900_FLASH_BASE,
.end = W90P910_FLASH_BASE + W90P910_FLASH_SIZE - 1, .end = NUC900_FLASH_BASE + NUC900_FLASH_SIZE - 1,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
} }
}; };
static struct platform_device w90p910_flash_device = { static struct platform_device nuc900_flash_device = {
.name = "physmap-flash", .name = "physmap-flash",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &w90p910_flash_data, .platform_data = &nuc900_flash_data,
}, },
.resource = w90p910_flash_resources, .resource = nuc900_flash_resources,
.num_resources = ARRAY_SIZE(w90p910_flash_resources), .num_resources = ARRAY_SIZE(nuc900_flash_resources),
}; };
/* USB EHCI Host Controller */ /* USB EHCI Host Controller */
static struct resource w90x900_usb_ehci_resource[] = { static struct resource nuc900_usb_ehci_resource[] = {
[0] = { [0] = {
.start = W90X900_PA_USBEHCIHOST, .start = W90X900_PA_USBEHCIHOST,
.end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1, .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1,
...@@ -101,23 +100,22 @@ static struct resource w90x900_usb_ehci_resource[] = { ...@@ -101,23 +100,22 @@ static struct resource w90x900_usb_ehci_resource[] = {
} }
}; };
static u64 w90x900_device_usb_ehci_dmamask = 0xffffffffUL; static u64 nuc900_device_usb_ehci_dmamask = 0xffffffffUL;
struct platform_device w90x900_device_usb_ehci = { static struct platform_device nuc900_device_usb_ehci = {
.name = "w90x900-ehci", .name = "nuc900-ehci",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(w90x900_usb_ehci_resource), .num_resources = ARRAY_SIZE(nuc900_usb_ehci_resource),
.resource = w90x900_usb_ehci_resource, .resource = nuc900_usb_ehci_resource,
.dev = { .dev = {
.dma_mask = &w90x900_device_usb_ehci_dmamask, .dma_mask = &nuc900_device_usb_ehci_dmamask,
.coherent_dma_mask = 0xffffffffUL .coherent_dma_mask = 0xffffffffUL
} }
}; };
EXPORT_SYMBOL(w90x900_device_usb_ehci);
/* USB OHCI Host Controller */ /* USB OHCI Host Controller */
static struct resource w90x900_usb_ohci_resource[] = { static struct resource nuc900_usb_ohci_resource[] = {
[0] = { [0] = {
.start = W90X900_PA_USBOHCIHOST, .start = W90X900_PA_USBOHCIHOST,
.end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1, .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1,
...@@ -130,92 +128,21 @@ static struct resource w90x900_usb_ohci_resource[] = { ...@@ -130,92 +128,21 @@ static struct resource w90x900_usb_ohci_resource[] = {
} }
}; };
static u64 w90x900_device_usb_ohci_dmamask = 0xffffffffUL; static u64 nuc900_device_usb_ohci_dmamask = 0xffffffffUL;
struct platform_device w90x900_device_usb_ohci = { static struct platform_device nuc900_device_usb_ohci = {
.name = "w90x900-ohci", .name = "nuc900-ohci",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(w90x900_usb_ohci_resource), .num_resources = ARRAY_SIZE(nuc900_usb_ohci_resource),
.resource = w90x900_usb_ohci_resource, .resource = nuc900_usb_ohci_resource,
.dev = { .dev = {
.dma_mask = &w90x900_device_usb_ohci_dmamask, .dma_mask = &nuc900_device_usb_ohci_dmamask,
.coherent_dma_mask = 0xffffffffUL .coherent_dma_mask = 0xffffffffUL
} }
}; };
EXPORT_SYMBOL(w90x900_device_usb_ohci);
/*TouchScreen controller*/
static struct resource w90x900_ts_resource[] = {
[0] = {
.start = W90X900_PA_ADC,
.end = W90X900_PA_ADC + W90X900_SZ_ADC-1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_ADC,
.end = IRQ_ADC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device w90x900_device_ts = {
.name = "w90x900-ts",
.id = -1,
.resource = w90x900_ts_resource,
.num_resources = ARRAY_SIZE(w90x900_ts_resource),
};
EXPORT_SYMBOL(w90x900_device_ts);
/* RTC controller*/
static struct resource w90x900_rtc_resource[] = {
[0] = {
.start = W90X900_PA_RTC,
.end = W90X900_PA_RTC + 0xff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_RTC,
.end = IRQ_RTC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device w90x900_device_rtc = {
.name = "w90x900-rtc",
.id = -1,
.num_resources = ARRAY_SIZE(w90x900_rtc_resource),
.resource = w90x900_rtc_resource,
};
EXPORT_SYMBOL(w90x900_device_rtc);
/* KPI controller*/
static struct resource w90x900_kpi_resource[] = {
[0] = {
.start = W90X900_PA_KPI,
.end = W90X900_PA_KPI + W90X900_SZ_KPI - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_KPI,
.end = IRQ_KPI,
.flags = IORESOURCE_IRQ,
}
};
struct platform_device w90x900_device_kpi = {
.name = "w90x900-kpi",
.id = -1,
.num_resources = ARRAY_SIZE(w90x900_kpi_resource),
.resource = w90x900_kpi_resource,
};
EXPORT_SYMBOL(w90x900_device_kpi);
/* USB Device (Gadget)*/ /* USB Device (Gadget)*/
static struct resource w90x900_usbgadget_resource[] = { static struct resource nuc900_usbgadget_resource[] = {
[0] = { [0] = {
.start = W90X900_PA_USBDEV, .start = W90X900_PA_USBDEV,
.end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1, .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1,
...@@ -228,39 +155,16 @@ static struct resource w90x900_usbgadget_resource[] = { ...@@ -228,39 +155,16 @@ static struct resource w90x900_usbgadget_resource[] = {
} }
}; };
struct platform_device w90x900_device_usbgadget = { static struct platform_device nuc900_device_usbgadget = {
.name = "w90x900-usbgadget", .name = "nuc900-usbgadget",
.id = -1,
.num_resources = ARRAY_SIZE(w90x900_usbgadget_resource),
.resource = w90x900_usbgadget_resource,
};
EXPORT_SYMBOL(w90x900_device_usbgadget);
/* FMI Device */
static struct resource w90p910_fmi_resource[] = {
[0] = {
.start = W90X900_PA_FMI,
.end = W90X900_PA_FMI + W90X900_SZ_FMI - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_FMI,
.end = IRQ_FMI,
.flags = IORESOURCE_IRQ,
}
};
static struct platform_device w90p910_device_fmi = {
.name = "w90p910-fmi",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(w90p910_fmi_resource), .num_resources = ARRAY_SIZE(nuc900_usbgadget_resource),
.resource = w90p910_fmi_resource, .resource = nuc900_usbgadget_resource,
}; };
/* MAC device */ /* MAC device */
static struct resource w90x900_emc_resource[] = { static struct resource nuc900_emc_resource[] = {
[0] = { [0] = {
.start = W90X900_PA_EMC, .start = W90X900_PA_EMC,
.end = W90X900_PA_EMC + W90X900_SZ_EMC - 1, .end = W90X900_PA_EMC + W90X900_SZ_EMC - 1,
...@@ -278,21 +182,21 @@ static struct resource w90x900_emc_resource[] = { ...@@ -278,21 +182,21 @@ static struct resource w90x900_emc_resource[] = {
} }
}; };
static u64 w90x900_device_emc_dmamask = 0xffffffffUL; static u64 nuc900_device_emc_dmamask = 0xffffffffUL;
static struct platform_device w90p910_device_emc = { static struct platform_device nuc900_device_emc = {
.name = "w90p910-emc", .name = "nuc900-emc",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(w90x900_emc_resource), .num_resources = ARRAY_SIZE(nuc900_emc_resource),
.resource = w90x900_emc_resource, .resource = nuc900_emc_resource,
.dev = { .dev = {
.dma_mask = &w90x900_device_emc_dmamask, .dma_mask = &nuc900_device_emc_dmamask,
.coherent_dma_mask = 0xffffffffUL .coherent_dma_mask = 0xffffffffUL
} }
}; };
/* SPI device */ /* SPI device */
static struct resource w90p910_spi_resource[] = { static struct resource nuc900_spi_resource[] = {
[0] = { [0] = {
.start = W90X900_PA_I2C + SPIOFFSET, .start = W90X900_PA_I2C + SPIOFFSET,
.end = W90X900_PA_I2C + SPIOFFSET + SPIOREG_SIZE - 1, .end = W90X900_PA_I2C + SPIOFFSET + SPIOREG_SIZE - 1,
...@@ -305,16 +209,16 @@ static struct resource w90p910_spi_resource[] = { ...@@ -305,16 +209,16 @@ static struct resource w90p910_spi_resource[] = {
} }
}; };
static struct platform_device w90p910_device_spi = { static struct platform_device nuc900_device_spi = {
.name = "w90p910-spi", .name = "nuc900-spi",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(w90p910_spi_resource), .num_resources = ARRAY_SIZE(nuc900_spi_resource),
.resource = w90p910_spi_resource, .resource = nuc900_spi_resource,
}; };
/* spi device, spi flash info */ /* spi device, spi flash info */
static struct mtd_partition w90p910_spi_flash_partitions[] = { static struct mtd_partition nuc900_spi_flash_partitions[] = {
{ {
.name = "bootloader(spi)", .name = "bootloader(spi)",
.size = 0x0100000, .size = 0x0100000,
...@@ -322,27 +226,27 @@ static struct mtd_partition w90p910_spi_flash_partitions[] = { ...@@ -322,27 +226,27 @@ static struct mtd_partition w90p910_spi_flash_partitions[] = {
}, },
}; };
static struct flash_platform_data w90p910_spi_flash_data = { static struct flash_platform_data nuc900_spi_flash_data = {
.name = "m25p80", .name = "m25p80",
.parts = w90p910_spi_flash_partitions, .parts = nuc900_spi_flash_partitions,
.nr_parts = ARRAY_SIZE(w90p910_spi_flash_partitions), .nr_parts = ARRAY_SIZE(nuc900_spi_flash_partitions),
.type = "w25x16", .type = "w25x16",
}; };
static struct spi_board_info w90p910_spi_board_info[] __initdata = { static struct spi_board_info nuc900_spi_board_info[] __initdata = {
{ {
.modalias = "m25p80", .modalias = "m25p80",
.max_speed_hz = 20000000, .max_speed_hz = 20000000,
.bus_num = 0, .bus_num = 0,
.chip_select = 1, .chip_select = 1,
.platform_data = &w90p910_spi_flash_data, .platform_data = &nuc900_spi_flash_data,
.mode = SPI_MODE_0, .mode = SPI_MODE_0,
}, },
}; };
/* WDT Device */ /* WDT Device */
static struct resource w90p910_wdt_resource[] = { static struct resource nuc900_wdt_resource[] = {
[0] = { [0] = {
.start = W90X900_PA_TIMER, .start = W90X900_PA_TIMER,
.end = W90X900_PA_TIMER + W90X900_SZ_TIMER - 1, .end = W90X900_PA_TIMER + W90X900_SZ_TIMER - 1,
...@@ -355,53 +259,131 @@ static struct resource w90p910_wdt_resource[] = { ...@@ -355,53 +259,131 @@ static struct resource w90p910_wdt_resource[] = {
} }
}; };
static struct platform_device w90p910_device_wdt = { static struct platform_device nuc900_device_wdt = {
.name = "w90p910-wdt", .name = "nuc900-wdt",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(w90p910_wdt_resource), .num_resources = ARRAY_SIZE(nuc900_wdt_resource),
.resource = w90p910_wdt_resource, .resource = nuc900_wdt_resource,
}; };
static struct map_desc w90p910_iodesc[] __initdata = { /*
* public device definition between 910 and 920, or 910
* and 950 or 950 and 960...,their dev platform register
* should be in specific file such as nuc950, nuc960 c
* files rather than the public dev.c file here. so the
* corresponding platform_device definition should not be
* static.
*/
/* RTC controller*/
static struct resource nuc900_rtc_resource[] = {
[0] = {
.start = W90X900_PA_RTC,
.end = W90X900_PA_RTC + 0xff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_RTC,
.end = IRQ_RTC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device nuc900_device_rtc = {
.name = "nuc900-rtc",
.id = -1,
.num_resources = ARRAY_SIZE(nuc900_rtc_resource),
.resource = nuc900_rtc_resource,
};
/*TouchScreen controller*/
static struct resource nuc900_ts_resource[] = {
[0] = {
.start = W90X900_PA_ADC,
.end = W90X900_PA_ADC + W90X900_SZ_ADC-1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_ADC,
.end = IRQ_ADC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device nuc900_device_ts = {
.name = "nuc900-ts",
.id = -1,
.resource = nuc900_ts_resource,
.num_resources = ARRAY_SIZE(nuc900_ts_resource),
};
/* FMI Device */
static struct resource nuc900_fmi_resource[] = {
[0] = {
.start = W90X900_PA_FMI,
.end = W90X900_PA_FMI + W90X900_SZ_FMI - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_FMI,
.end = IRQ_FMI,
.flags = IORESOURCE_IRQ,
}
};
struct platform_device nuc900_device_fmi = {
.name = "nuc900-fmi",
.id = -1,
.num_resources = ARRAY_SIZE(nuc900_fmi_resource),
.resource = nuc900_fmi_resource,
};
/* KPI controller*/
static struct resource nuc900_kpi_resource[] = {
[0] = {
.start = W90X900_PA_KPI,
.end = W90X900_PA_KPI + W90X900_SZ_KPI - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_KPI,
.end = IRQ_KPI,
.flags = IORESOURCE_IRQ,
}
};
struct platform_device nuc900_device_kpi = {
.name = "nuc900-kpi",
.id = -1,
.num_resources = ARRAY_SIZE(nuc900_kpi_resource),
.resource = nuc900_kpi_resource,
}; };
/*Here should be your evb resourse,such as LCD*/ /*Here should be your evb resourse,such as LCD*/
static struct platform_device *w90p910evb_dev[] __initdata = { static struct platform_device *nuc900_public_dev[] __initdata = {
&w90p910_serial_device, &nuc900_serial_device,
&w90p910_flash_device, &nuc900_flash_device,
&w90x900_device_usb_ehci, &nuc900_device_usb_ehci,
&w90x900_device_usb_ohci, &nuc900_device_usb_ohci,
&w90x900_device_ts, &nuc900_device_usbgadget,
&w90x900_device_rtc, &nuc900_device_emc,
&w90x900_device_kpi, &nuc900_device_spi,
&w90x900_device_usbgadget, &nuc900_device_wdt,
&w90p910_device_fmi,
&w90p910_device_emc,
&w90p910_device_spi,
&w90p910_device_wdt,
}; };
static void __init w90p910evb_map_io(void) /* Provide adding specific CPU platform devices API */
{
w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
w90p910_init_clocks();
}
static void __init w90p910evb_init(void) void __init nuc900_board_init(struct platform_device **device, int size)
{ {
platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev)); platform_add_devices(device, size);
spi_register_board_info(w90p910_spi_board_info, platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev));
ARRAY_SIZE(w90p910_spi_board_info)); spi_register_board_info(nuc900_spi_board_info,
ARRAY_SIZE(nuc900_spi_board_info));
} }
MACHINE_START(W90P910EVB, "W90P910EVB")
/* Maintainer: Wan ZongShun */
.phys_io = W90X900_PA_UART,
.io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
.boot_params = 0,
.map_io = w90p910evb_map_io,
.init_irq = w90x900_init_irq,
.init_machine = w90p910evb_init,
.timer = &w90x900_timer,
MACHINE_END
/* /*
* linux/arch/arm/mach-w90p910/gpio.c * linux/arch/arm/mach-w90x900/gpio.c
* *
* Generic w90p910 GPIO handling * Generic nuc900 GPIO handling
* *
* Wan ZongShun <mcuos.com@gmail.com> * Wan ZongShun <mcuos.com@gmail.com>
* *
...@@ -30,31 +30,31 @@ ...@@ -30,31 +30,31 @@
#define GPIO_IN (0x0C) #define GPIO_IN (0x0C)
#define GROUPINERV (0x10) #define GROUPINERV (0x10)
#define GPIO_GPIO(Nb) (0x00000001 << (Nb)) #define GPIO_GPIO(Nb) (0x00000001 << (Nb))
#define to_w90p910_gpio_chip(c) container_of(c, struct w90p910_gpio_chip, chip) #define to_nuc900_gpio_chip(c) container_of(c, struct nuc900_gpio_chip, chip)
#define W90P910_GPIO_CHIP(name, base_gpio, nr_gpio) \ #define NUC900_GPIO_CHIP(name, base_gpio, nr_gpio) \
{ \ { \
.chip = { \ .chip = { \
.label = name, \ .label = name, \
.direction_input = w90p910_dir_input, \ .direction_input = nuc900_dir_input, \
.direction_output = w90p910_dir_output, \ .direction_output = nuc900_dir_output, \
.get = w90p910_gpio_get, \ .get = nuc900_gpio_get, \
.set = w90p910_gpio_set, \ .set = nuc900_gpio_set, \
.base = base_gpio, \ .base = base_gpio, \
.ngpio = nr_gpio, \ .ngpio = nr_gpio, \
} \ } \
} }
struct w90p910_gpio_chip { struct nuc900_gpio_chip {
struct gpio_chip chip; struct gpio_chip chip;
void __iomem *regbase; /* Base of group register*/ void __iomem *regbase; /* Base of group register*/
spinlock_t gpio_lock; spinlock_t gpio_lock;
}; };
static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset) static int nuc900_gpio_get(struct gpio_chip *chip, unsigned offset)
{ {
struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
void __iomem *pio = w90p910_gpio->regbase + GPIO_IN; void __iomem *pio = nuc900_gpio->regbase + GPIO_IN;
unsigned int regval; unsigned int regval;
regval = __raw_readl(pio); regval = __raw_readl(pio);
...@@ -63,14 +63,14 @@ static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -63,14 +63,14 @@ static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset)
return (regval != 0); return (regval != 0);
} }
static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static void nuc900_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
{ {
struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
void __iomem *pio = w90p910_gpio->regbase + GPIO_OUT; void __iomem *pio = nuc900_gpio->regbase + GPIO_OUT;
unsigned int regval; unsigned int regval;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
regval = __raw_readl(pio); regval = __raw_readl(pio);
...@@ -81,36 +81,36 @@ static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val) ...@@ -81,36 +81,36 @@ static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
__raw_writel(regval, pio); __raw_writel(regval, pio);
spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
} }
static int w90p910_dir_input(struct gpio_chip *chip, unsigned offset) static int nuc900_dir_input(struct gpio_chip *chip, unsigned offset)
{ {
struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR;
unsigned int regval; unsigned int regval;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
regval = __raw_readl(pio); regval = __raw_readl(pio);
regval &= ~GPIO_GPIO(offset); regval &= ~GPIO_GPIO(offset);
__raw_writel(regval, pio); __raw_writel(regval, pio);
spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
return 0; return 0;
} }
static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val) static int nuc900_dir_output(struct gpio_chip *chip, unsigned offset, int val)
{ {
struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
void __iomem *outreg = w90p910_gpio->regbase + GPIO_OUT; void __iomem *outreg = nuc900_gpio->regbase + GPIO_OUT;
void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR;
unsigned int regval; unsigned int regval;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
regval = __raw_readl(pio); regval = __raw_readl(pio);
regval |= GPIO_GPIO(offset); regval |= GPIO_GPIO(offset);
...@@ -125,28 +125,28 @@ static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val) ...@@ -125,28 +125,28 @@ static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val)
__raw_writel(regval, outreg); __raw_writel(regval, outreg);
spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
return 0; return 0;
} }
static struct w90p910_gpio_chip w90p910_gpio[] = { static struct nuc900_gpio_chip nuc900_gpio[] = {
W90P910_GPIO_CHIP("GROUPC", 0, 16), NUC900_GPIO_CHIP("GROUPC", 0, 16),
W90P910_GPIO_CHIP("GROUPD", 16, 10), NUC900_GPIO_CHIP("GROUPD", 16, 10),
W90P910_GPIO_CHIP("GROUPE", 26, 14), NUC900_GPIO_CHIP("GROUPE", 26, 14),
W90P910_GPIO_CHIP("GROUPF", 40, 10), NUC900_GPIO_CHIP("GROUPF", 40, 10),
W90P910_GPIO_CHIP("GROUPG", 50, 17), NUC900_GPIO_CHIP("GROUPG", 50, 17),
W90P910_GPIO_CHIP("GROUPH", 67, 8), NUC900_GPIO_CHIP("GROUPH", 67, 8),
W90P910_GPIO_CHIP("GROUPI", 75, 17), NUC900_GPIO_CHIP("GROUPI", 75, 17),
}; };
void __init w90p910_init_gpio(int nr_group) void __init nuc900_init_gpio(int nr_group)
{ {
unsigned i; unsigned i;
struct w90p910_gpio_chip *gpio_chip; struct nuc900_gpio_chip *gpio_chip;
for (i = 0; i < nr_group; i++) { for (i = 0; i < nr_group; i++) {
gpio_chip = &w90p910_gpio[i]; gpio_chip = &nuc900_gpio[i];
spin_lock_init(&gpio_chip->gpio_lock); spin_lock_init(&gpio_chip->gpio_lock);
gpio_chip->regbase = GPIO_BASE + i * GROUPINERV; gpio_chip->regbase = GPIO_BASE + i * GROUPINERV;
gpiochip_add(&gpio_chip->chip); gpiochip_add(&gpio_chip->chip);
......
...@@ -38,11 +38,11 @@ static DEFINE_SPINLOCK(groupirq_lock); ...@@ -38,11 +38,11 @@ static DEFINE_SPINLOCK(groupirq_lock);
#define DEFINE_GROUP(_name, _ctrlbit, _num) \ #define DEFINE_GROUP(_name, _ctrlbit, _num) \
struct group_irq group_##_name = { \ struct group_irq group_##_name = { \
.enable = w90x900_group_enable, \ .enable = nuc900_group_enable, \
.gpen = ((2 ^ _num) - 1) << _ctrlbit, \ .gpen = ((1 << _num) - 1) << _ctrlbit, \
} }
static void w90x900_group_enable(struct group_irq *gpirq, int enable); static void nuc900_group_enable(struct group_irq *gpirq, int enable);
static DEFINE_GROUP(nirq0, 0, 4); static DEFINE_GROUP(nirq0, 0, 4);
static DEFINE_GROUP(nirq1, 4, 4); static DEFINE_GROUP(nirq1, 4, 4);
...@@ -77,7 +77,7 @@ static void group_irq_disable(struct group_irq *group_irq) ...@@ -77,7 +77,7 @@ static void group_irq_disable(struct group_irq *group_irq)
spin_unlock_irqrestore(&groupirq_lock, flags); spin_unlock_irqrestore(&groupirq_lock, flags);
} }
static void w90x900_group_enable(struct group_irq *gpirq, int enable) static void nuc900_group_enable(struct group_irq *gpirq, int enable)
{ {
unsigned int groupen = gpirq->gpen; unsigned int groupen = gpirq->gpen;
unsigned long regval; unsigned long regval;
...@@ -92,7 +92,7 @@ static void w90x900_group_enable(struct group_irq *gpirq, int enable) ...@@ -92,7 +92,7 @@ static void w90x900_group_enable(struct group_irq *gpirq, int enable)
__raw_writel(regval, REG_AIC_GEN); __raw_writel(regval, REG_AIC_GEN);
} }
static void w90x900_irq_mask(unsigned int irq) static void nuc900_irq_mask(unsigned int irq)
{ {
struct group_irq *group_irq; struct group_irq *group_irq;
...@@ -143,12 +143,12 @@ static void w90x900_irq_mask(unsigned int irq) ...@@ -143,12 +143,12 @@ static void w90x900_irq_mask(unsigned int irq)
* to REG_AIC_EOSCR for ACK * to REG_AIC_EOSCR for ACK
*/ */
static void w90x900_irq_ack(unsigned int irq) static void nuc900_irq_ack(unsigned int irq)
{ {
__raw_writel(0x01, REG_AIC_EOSCR); __raw_writel(0x01, REG_AIC_EOSCR);
} }
static void w90x900_irq_unmask(unsigned int irq) static void nuc900_irq_unmask(unsigned int irq)
{ {
struct group_irq *group_irq; struct group_irq *group_irq;
...@@ -194,20 +194,20 @@ static void w90x900_irq_unmask(unsigned int irq) ...@@ -194,20 +194,20 @@ static void w90x900_irq_unmask(unsigned int irq)
group_irq_enable(group_irq); group_irq_enable(group_irq);
} }
static struct irq_chip w90x900_irq_chip = { static struct irq_chip nuc900_irq_chip = {
.ack = w90x900_irq_ack, .ack = nuc900_irq_ack,
.mask = w90x900_irq_mask, .mask = nuc900_irq_mask,
.unmask = w90x900_irq_unmask, .unmask = nuc900_irq_unmask,
}; };
void __init w90x900_init_irq(void) void __init nuc900_init_irq(void)
{ {
int irqno; int irqno;
__raw_writel(0xFFFFFFFE, REG_AIC_MDCR); __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) { for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
set_irq_chip(irqno, &w90x900_irq_chip); set_irq_chip(irqno, &nuc900_irq_chip);
set_irq_handler(irqno, handle_level_irq); set_irq_handler(irqno, handle_level_irq);
set_irq_flags(irqno, IRQF_VALID); set_irq_flags(irqno, IRQF_VALID);
} }
......
/*
* linux/arch/arm/mach-w90x900/mach-nuc910evb.c
*
* Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
*
* Copyright (C) 2008 Nuvoton technology corporation.
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* 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 <linux/platform_device.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach-types.h>
#include <mach/map.h>
#include "nuc910.h"
static void __init nuc910evb_map_io(void)
{
nuc910_map_io();
nuc910_init_clocks();
}
static void __init nuc910evb_init(void)
{
nuc910_board_init();
}
MACHINE_START(W90P910EVB, "W90P910EVB")
/* Maintainer: Wan ZongShun */
.phys_io = W90X900_PA_UART,
.io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
.boot_params = 0,
.map_io = nuc910evb_map_io,
.init_irq = nuc900_init_irq,
.init_machine = nuc910evb_init,
.timer = &nuc900_timer,
MACHINE_END
/* /*
* linux/arch/arm/mach-w90x900/mfp-w90p910.c * linux/arch/arm/mach-w90x900/mfp.c
* *
* Copyright (c) 2008 Nuvoton technology corporation * Copyright (c) 2008 Nuvoton technology corporation
* *
...@@ -55,7 +55,7 @@ void mfp_set_groupf(struct device *dev) ...@@ -55,7 +55,7 @@ void mfp_set_groupf(struct device *dev)
mfpen = __raw_readl(REG_MFSEL); mfpen = __raw_readl(REG_MFSEL);
if (strcmp(dev_id, "w90p910-emc") == 0) if (strcmp(dev_id, "nuc900-emc") == 0)
mfpen |= GPSELF;/*enable mac*/ mfpen |= GPSELF;/*enable mac*/
else else
mfpen &= ~GPSELF;/*GPIOF[9:0]*/ mfpen &= ~GPSELF;/*GPIOF[9:0]*/
...@@ -79,12 +79,12 @@ void mfp_set_groupc(struct device *dev) ...@@ -79,12 +79,12 @@ void mfp_set_groupc(struct device *dev)
mfpen = __raw_readl(REG_MFSEL); mfpen = __raw_readl(REG_MFSEL);
if (strcmp(dev_id, "w90p910-lcd") == 0) if (strcmp(dev_id, "nuc900-lcd") == 0)
mfpen |= GPSELC;/*enable lcd*/ mfpen |= GPSELC;/*enable lcd*/
else if (strcmp(dev_id, "w90p910-kpi") == 0) { else if (strcmp(dev_id, "nuc900-kpi") == 0) {
mfpen &= (~GPSELC);/*enable kpi*/ mfpen &= (~GPSELC);/*enable kpi*/
mfpen |= ENKPI; mfpen |= ENKPI;
} else if (strcmp(dev_id, "w90p910-nand") == 0) { } else if (strcmp(dev_id, "nuc900-nand") == 0) {
mfpen &= (~GPSELC);/*enable nand*/ mfpen &= (~GPSELC);/*enable nand*/
mfpen |= ENNAND; mfpen |= ENNAND;
} else } else
...@@ -111,11 +111,11 @@ void mfp_set_groupi(struct device *dev) ...@@ -111,11 +111,11 @@ void mfp_set_groupi(struct device *dev)
mfpen &= ~GPSELEI1;/*default gpio16*/ mfpen &= ~GPSELEI1;/*default gpio16*/
if (strcmp(dev_id, "w90p910-wdog") == 0) if (strcmp(dev_id, "nuc900-wdog") == 0)
mfpen |= GPSELEI1;/*enable wdog*/ mfpen |= GPSELEI1;/*enable wdog*/
else if (strcmp(dev_id, "w90p910-atapi") == 0) else if (strcmp(dev_id, "nuc900-atapi") == 0)
mfpen |= GPSELEI0;/*enable atapi*/ mfpen |= GPSELEI0;/*enable atapi*/
else if (strcmp(dev_id, "w90p910-keypad") == 0) else if (strcmp(dev_id, "nuc900-keypad") == 0)
mfpen &= ~GPSELEI0;/*enable keypad*/ mfpen &= ~GPSELEI0;/*enable keypad*/
__raw_writel(mfpen, REG_MFSEL); __raw_writel(mfpen, REG_MFSEL);
...@@ -137,13 +137,13 @@ void mfp_set_groupg(struct device *dev) ...@@ -137,13 +137,13 @@ void mfp_set_groupg(struct device *dev)
mfpen = __raw_readl(REG_MFSEL); mfpen = __raw_readl(REG_MFSEL);
if (strcmp(dev_id, "w90p910-spi") == 0) { if (strcmp(dev_id, "nuc900-spi") == 0) {
mfpen &= ~(GPIOG0TO1 | GPIOG2TO3); mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);
mfpen |= ENSPI;/*enable spi*/ mfpen |= ENSPI;/*enable spi*/
} else if (strcmp(dev_id, "w90p910-i2c0") == 0) { } else if (strcmp(dev_id, "nuc900-i2c0") == 0) {
mfpen &= ~(GPIOG0TO1); mfpen &= ~(GPIOG0TO1);
mfpen |= ENI2C0;/*enable i2c0*/ mfpen |= ENI2C0;/*enable i2c0*/
} else if (strcmp(dev_id, "w90p910-i2c1") == 0) { } else if (strcmp(dev_id, "nuc900-i2c1") == 0) {
mfpen &= ~(GPIOG2TO3); mfpen &= ~(GPIOG2TO3);
mfpen |= ENI2C1;/*enable i2c1*/ mfpen |= ENI2C1;/*enable i2c1*/
} else { } else {
......
/*
* linux/arch/arm/mach-w90x900/nuc910.c
*
* Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks
*
* Copyright (c) 2009 Nuvoton corporation.
*
* Wan ZongShun <mcuos.com@gmail.com>
*
* NUC910 cpu 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
* the Free Software Foundation;version 2 of the License.
*
*/
#include <linux/platform_device.h>
#include <asm/mach/map.h>
#include <mach/hardware.h>
#include "cpu.h"
#include "clock.h"
/* define specific CPU platform device */
static struct platform_device *nuc910_dev[] __initdata = {
&nuc900_device_ts,
&nuc900_device_rtc,
};
/* define specific CPU platform io map */
static struct map_desc nuc910evb_iodesc[] __initdata = {
IODESC_ENT(USBEHCIHOST),
IODESC_ENT(USBOHCIHOST),
IODESC_ENT(KPI),
IODESC_ENT(USBDEV),
IODESC_ENT(ADC),
};
/*Init NUC910 evb io*/
void __init nuc910_map_io(void)
{
nuc900_map_io(nuc910evb_iodesc, ARRAY_SIZE(nuc910evb_iodesc));
}
/*Init NUC910 clock*/
void __init nuc910_init_clocks(void)
{
nuc900_init_clocks();
}
/*Init NUC910 board info*/
void __init nuc910_board_init(void)
{
nuc900_board_init(nuc910_dev, ARRAY_SIZE(nuc910_dev));
}
/*
* arch/arm/mach-w90x900/nuc910.h
*
* Copyright (c) 2008 Nuvoton corporation
*
* Header file for NUC900 CPU support
*
* Wan ZongShun <mcuos.com@gmail.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.
*
*/
struct map_desc;
struct sys_timer;
/* core initialisation functions */
extern void nuc900_init_irq(void);
extern struct sys_timer nuc900_timer;
/* extern file from nuc910.c */
extern void nuc910_board_init(void);
extern void nuc910_init_clocks(void);
extern void nuc910_map_io(void);
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
unsigned int timer0_load; unsigned int timer0_load;
static void w90p910_clockevent_setmode(enum clock_event_mode mode, static void nuc900_clockevent_setmode(enum clock_event_mode mode,
struct clock_event_device *clk) struct clock_event_device *clk)
{ {
unsigned int val; unsigned int val;
...@@ -71,7 +71,7 @@ static void w90p910_clockevent_setmode(enum clock_event_mode mode, ...@@ -71,7 +71,7 @@ static void w90p910_clockevent_setmode(enum clock_event_mode mode,
__raw_writel(val, REG_TCSR0); __raw_writel(val, REG_TCSR0);
} }
static int w90p910_clockevent_setnextevent(unsigned long evt, static int nuc900_clockevent_setnextevent(unsigned long evt,
struct clock_event_device *clk) struct clock_event_device *clk)
{ {
unsigned int val; unsigned int val;
...@@ -85,20 +85,20 @@ static int w90p910_clockevent_setnextevent(unsigned long evt, ...@@ -85,20 +85,20 @@ static int w90p910_clockevent_setnextevent(unsigned long evt,
return 0; return 0;
} }
static struct clock_event_device w90p910_clockevent_device = { static struct clock_event_device nuc900_clockevent_device = {
.name = "w90p910-timer0", .name = "nuc900-timer0",
.shift = 32, .shift = 32,
.features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.set_mode = w90p910_clockevent_setmode, .set_mode = nuc900_clockevent_setmode,
.set_next_event = w90p910_clockevent_setnextevent, .set_next_event = nuc900_clockevent_setnextevent,
.rating = 300, .rating = 300,
}; };
/*IRQ handler for the timer*/ /*IRQ handler for the timer*/
static irqreturn_t w90p910_timer0_interrupt(int irq, void *dev_id) static irqreturn_t nuc900_timer0_interrupt(int irq, void *dev_id)
{ {
struct clock_event_device *evt = &w90p910_clockevent_device; struct clock_event_device *evt = &nuc900_clockevent_device;
__raw_writel(0x01, REG_TISR); /* clear TIF0 */ __raw_writel(0x01, REG_TISR); /* clear TIF0 */
...@@ -106,40 +106,40 @@ static irqreturn_t w90p910_timer0_interrupt(int irq, void *dev_id) ...@@ -106,40 +106,40 @@ static irqreturn_t w90p910_timer0_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static struct irqaction w90p910_timer0_irq = { static struct irqaction nuc900_timer0_irq = {
.name = "w90p910-timer0", .name = "nuc900-timer0",
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = w90p910_timer0_interrupt, .handler = nuc900_timer0_interrupt,
}; };
static void __init w90p910_clockevents_init(unsigned int rate) static void __init nuc900_clockevents_init(unsigned int rate)
{ {
w90p910_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC, nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC,
w90p910_clockevent_device.shift); nuc900_clockevent_device.shift);
w90p910_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff, nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff,
&w90p910_clockevent_device); &nuc900_clockevent_device);
w90p910_clockevent_device.min_delta_ns = clockevent_delta2ns(0xf, nuc900_clockevent_device.min_delta_ns = clockevent_delta2ns(0xf,
&w90p910_clockevent_device); &nuc900_clockevent_device);
w90p910_clockevent_device.cpumask = cpumask_of(0); nuc900_clockevent_device.cpumask = cpumask_of(0);
clockevents_register_device(&w90p910_clockevent_device); clockevents_register_device(&nuc900_clockevent_device);
} }
static cycle_t w90p910_get_cycles(struct clocksource *cs) static cycle_t nuc900_get_cycles(struct clocksource *cs)
{ {
return ~__raw_readl(REG_TDR1); return ~__raw_readl(REG_TDR1);
} }
static struct clocksource clocksource_w90p910 = { static struct clocksource clocksource_nuc900 = {
.name = "w90p910-timer1", .name = "nuc900-timer1",
.rating = 200, .rating = 200,
.read = w90p910_get_cycles, .read = nuc900_get_cycles,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.shift = 20, .shift = 20,
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
static void __init w90p910_clocksource_init(unsigned int rate) static void __init nuc900_clocksource_init(unsigned int rate)
{ {
unsigned int val; unsigned int val;
...@@ -149,12 +149,12 @@ static void __init w90p910_clocksource_init(unsigned int rate) ...@@ -149,12 +149,12 @@ static void __init w90p910_clocksource_init(unsigned int rate)
val |= (COUNTEN | PERIOD); val |= (COUNTEN | PERIOD);
__raw_writel(val, REG_TCSR1); __raw_writel(val, REG_TCSR1);
clocksource_w90p910.mult = clocksource_nuc900.mult =
clocksource_khz2mult((rate / 1000), clocksource_w90p910.shift); clocksource_khz2mult((rate / 1000), clocksource_nuc900.shift);
clocksource_register(&clocksource_w90p910); clocksource_register(&clocksource_nuc900);
} }
static void __init w90p910_timer_init(void) static void __init nuc900_timer_init(void)
{ {
struct clk *ck_ext = clk_get(NULL, "ext"); struct clk *ck_ext = clk_get(NULL, "ext");
unsigned int rate; unsigned int rate;
...@@ -171,12 +171,12 @@ static void __init w90p910_timer_init(void) ...@@ -171,12 +171,12 @@ static void __init w90p910_timer_init(void)
__raw_writel(RESETINT, REG_TISR); __raw_writel(RESETINT, REG_TISR);
timer0_load = (rate / TICKS_PER_SEC); timer0_load = (rate / TICKS_PER_SEC);
setup_irq(IRQ_TIMER0, &w90p910_timer0_irq); setup_irq(IRQ_TIMER0, &nuc900_timer0_irq);
w90p910_clocksource_init(rate); nuc900_clocksource_init(rate);
w90p910_clockevents_init(rate); nuc900_clockevents_init(rate);
} }
struct sys_timer w90x900_timer = { struct sys_timer nuc900_timer = {
.init = w90p910_timer_init, .init = nuc900_timer_init,
}; };
...@@ -326,7 +326,7 @@ static struct platform_driver w90x900ts_driver = { ...@@ -326,7 +326,7 @@ static struct platform_driver w90x900ts_driver = {
.probe = w90x900ts_probe, .probe = w90x900ts_probe,
.remove = __devexit_p(w90x900ts_remove), .remove = __devexit_p(w90x900ts_remove),
.driver = { .driver = {
.name = "w90x900-ts", .name = "nuc900-ts",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
}; };
...@@ -347,4 +347,4 @@ module_exit(w90x900ts_exit); ...@@ -347,4 +347,4 @@ module_exit(w90x900ts_exit);
MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
MODULE_DESCRIPTION("w90p910 touch screen driver!"); MODULE_DESCRIPTION("w90p910 touch screen driver!");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:w90p910-ts"); MODULE_ALIAS("platform:nuc900-ts");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册