diff options
Diffstat (limited to 'arch/arm/mach-w90x900')
-rw-r--r-- | arch/arm/mach-w90x900/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/clock.c | 77 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/clock.h | 36 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/cpu.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/gpio.c | 154 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/clkdev.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/gpio.h | 34 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/irqs.h | 49 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/map.h | 101 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/regs-clock.h | 31 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/regs-usb.h | 35 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/mach-w90p910evb.c | 164 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/mfp-w90p910.c | 116 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/w90p910.c | 53 |
14 files changed, 835 insertions, 26 deletions
diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile index 0c0c1d63f1c7..d50c94f4dbdf 100644 --- a/arch/arm/mach-w90x900/Makefile +++ b/arch/arm/mach-w90x900/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-y := irq.o time.o | 7 | obj-y := irq.o time.o mfp-w90p910.o gpio.o clock.o |
8 | 8 | ||
9 | # W90X900 CPU support files | 9 | # W90X900 CPU support files |
10 | 10 | ||
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c new file mode 100644 index 000000000000..f420613cd395 --- /dev/null +++ b/arch/arm/mach-w90x900/clock.c | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/clock.c | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/spinlock.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | |||
26 | #include "clock.h" | ||
27 | |||
28 | static DEFINE_SPINLOCK(clocks_lock); | ||
29 | |||
30 | int clk_enable(struct clk *clk) | ||
31 | { | ||
32 | unsigned long flags; | ||
33 | |||
34 | spin_lock_irqsave(&clocks_lock, flags); | ||
35 | if (clk->enabled++ == 0) | ||
36 | (clk->enable)(clk, 1); | ||
37 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
38 | |||
39 | return 0; | ||
40 | } | ||
41 | EXPORT_SYMBOL(clk_enable); | ||
42 | |||
43 | void clk_disable(struct clk *clk) | ||
44 | { | ||
45 | unsigned long flags; | ||
46 | |||
47 | WARN_ON(clk->enabled == 0); | ||
48 | |||
49 | spin_lock_irqsave(&clocks_lock, flags); | ||
50 | if (--clk->enabled == 0) | ||
51 | (clk->enable)(clk, 0); | ||
52 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
53 | } | ||
54 | EXPORT_SYMBOL(clk_disable); | ||
55 | |||
56 | void w90x900_clk_enable(struct clk *clk, int enable) | ||
57 | { | ||
58 | unsigned int clocks = clk->cken; | ||
59 | unsigned long clken; | ||
60 | |||
61 | clken = __raw_readl(W90X900_VA_CLKPWR); | ||
62 | |||
63 | if (enable) | ||
64 | clken |= clocks; | ||
65 | else | ||
66 | clken &= ~clocks; | ||
67 | |||
68 | __raw_writel(clken, W90X900_VA_CLKPWR); | ||
69 | } | ||
70 | |||
71 | void clks_register(struct clk_lookup *clks, size_t num) | ||
72 | { | ||
73 | int i; | ||
74 | |||
75 | for (i = 0; i < num; i++) | ||
76 | clkdev_add(&clks[i]); | ||
77 | } | ||
diff --git a/arch/arm/mach-w90x900/clock.h b/arch/arm/mach-w90x900/clock.h new file mode 100644 index 000000000000..4f27bda76d56 --- /dev/null +++ b/arch/arm/mach-w90x900/clock.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/clock.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <asm/clkdev.h> | ||
14 | |||
15 | void w90x900_clk_enable(struct clk *clk, int enable); | ||
16 | void clks_register(struct clk_lookup *clks, size_t num); | ||
17 | |||
18 | struct clk { | ||
19 | unsigned long cken; | ||
20 | unsigned int enabled; | ||
21 | void (*enable)(struct clk *, int enable); | ||
22 | }; | ||
23 | |||
24 | #define DEFINE_CLK(_name, _ctrlbit) \ | ||
25 | struct clk clk_##_name = { \ | ||
26 | .enable = w90x900_clk_enable, \ | ||
27 | .cken = (1 << _ctrlbit), \ | ||
28 | } | ||
29 | |||
30 | #define DEF_CLKLOOK(_clk, _devname, _conname) \ | ||
31 | { \ | ||
32 | .clk = _clk, \ | ||
33 | .dev_id = _devname, \ | ||
34 | .con_id = _conname, \ | ||
35 | } | ||
36 | |||
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h index de29ddcb9459..57b5dbabeb41 100644 --- a/arch/arm/mach-w90x900/cpu.h +++ b/arch/arm/mach-w90x900/cpu.h | |||
@@ -41,7 +41,7 @@ struct sys_timer; | |||
41 | extern void w90x900_init_irq(void); | 41 | extern void w90x900_init_irq(void); |
42 | extern void w90p910_init_io(struct map_desc *mach_desc, int size); | 42 | extern void w90p910_init_io(struct map_desc *mach_desc, int size); |
43 | extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no); | 43 | extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no); |
44 | extern void w90p910_init_clocks(int xtal); | 44 | extern void w90p910_init_clocks(void); |
45 | extern void w90p910_map_io(struct map_desc *mach_desc, int size); | 45 | extern void w90p910_map_io(struct map_desc *mach_desc, int size); |
46 | extern struct platform_device w90p910_serial_device; | 46 | extern struct platform_device w90p910_serial_device; |
47 | extern struct sys_timer w90x900_timer; | 47 | extern struct sys_timer w90x900_timer; |
diff --git a/arch/arm/mach-w90x900/gpio.c b/arch/arm/mach-w90x900/gpio.c new file mode 100644 index 000000000000..c72e0dfa1825 --- /dev/null +++ b/arch/arm/mach-w90x900/gpio.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90p910/gpio.c | ||
3 | * | ||
4 | * Generic w90p910 GPIO handling | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/clk.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/debugfs.h> | ||
18 | #include <linux/seq_file.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/list.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/gpio.h> | ||
24 | |||
25 | #include <mach/hardware.h> | ||
26 | |||
27 | #define GPIO_BASE (W90X900_VA_GPIO) | ||
28 | #define GPIO_DIR (0x04) | ||
29 | #define GPIO_OUT (0x08) | ||
30 | #define GPIO_IN (0x0C) | ||
31 | #define GROUPINERV (0x10) | ||
32 | #define GPIO_GPIO(Nb) (0x00000001 << (Nb)) | ||
33 | #define to_w90p910_gpio_chip(c) container_of(c, struct w90p910_gpio_chip, chip) | ||
34 | |||
35 | #define W90P910_GPIO_CHIP(name, base_gpio, nr_gpio) \ | ||
36 | { \ | ||
37 | .chip = { \ | ||
38 | .label = name, \ | ||
39 | .direction_input = w90p910_dir_input, \ | ||
40 | .direction_output = w90p910_dir_output, \ | ||
41 | .get = w90p910_gpio_get, \ | ||
42 | .set = w90p910_gpio_set, \ | ||
43 | .base = base_gpio, \ | ||
44 | .ngpio = nr_gpio, \ | ||
45 | } \ | ||
46 | } | ||
47 | |||
48 | struct w90p910_gpio_chip { | ||
49 | struct gpio_chip chip; | ||
50 | void __iomem *regbase; /* Base of group register*/ | ||
51 | spinlock_t gpio_lock; | ||
52 | }; | ||
53 | |||
54 | static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
55 | { | ||
56 | struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); | ||
57 | void __iomem *pio = w90p910_gpio->regbase + GPIO_IN; | ||
58 | unsigned int regval; | ||
59 | |||
60 | regval = __raw_readl(pio); | ||
61 | regval &= GPIO_GPIO(offset); | ||
62 | |||
63 | return (regval != 0); | ||
64 | } | ||
65 | |||
66 | static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | ||
67 | { | ||
68 | struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); | ||
69 | void __iomem *pio = w90p910_gpio->regbase + GPIO_OUT; | ||
70 | unsigned int regval; | ||
71 | unsigned long flags; | ||
72 | |||
73 | spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); | ||
74 | |||
75 | regval = __raw_readl(pio); | ||
76 | |||
77 | if (val) | ||
78 | regval |= GPIO_GPIO(offset); | ||
79 | else | ||
80 | regval &= ~GPIO_GPIO(offset); | ||
81 | |||
82 | __raw_writel(regval, pio); | ||
83 | |||
84 | spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); | ||
85 | } | ||
86 | |||
87 | static int w90p910_dir_input(struct gpio_chip *chip, unsigned offset) | ||
88 | { | ||
89 | struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); | ||
90 | void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; | ||
91 | unsigned int regval; | ||
92 | unsigned long flags; | ||
93 | |||
94 | spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); | ||
95 | |||
96 | regval = __raw_readl(pio); | ||
97 | regval &= ~GPIO_GPIO(offset); | ||
98 | __raw_writel(regval, pio); | ||
99 | |||
100 | spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val) | ||
106 | { | ||
107 | struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); | ||
108 | void __iomem *outreg = w90p910_gpio->regbase + GPIO_OUT; | ||
109 | void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; | ||
110 | unsigned int regval; | ||
111 | unsigned long flags; | ||
112 | |||
113 | spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); | ||
114 | |||
115 | regval = __raw_readl(pio); | ||
116 | regval |= GPIO_GPIO(offset); | ||
117 | __raw_writel(regval, pio); | ||
118 | |||
119 | regval = __raw_readl(outreg); | ||
120 | |||
121 | if (val) | ||
122 | regval |= GPIO_GPIO(offset); | ||
123 | else | ||
124 | regval &= ~GPIO_GPIO(offset); | ||
125 | |||
126 | __raw_writel(regval, outreg); | ||
127 | |||
128 | spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); | ||
129 | |||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static struct w90p910_gpio_chip w90p910_gpio[] = { | ||
134 | W90P910_GPIO_CHIP("GROUPC", 0, 16), | ||
135 | W90P910_GPIO_CHIP("GROUPD", 16, 10), | ||
136 | W90P910_GPIO_CHIP("GROUPE", 26, 14), | ||
137 | W90P910_GPIO_CHIP("GROUPF", 40, 10), | ||
138 | W90P910_GPIO_CHIP("GROUPG", 50, 17), | ||
139 | W90P910_GPIO_CHIP("GROUPH", 67, 8), | ||
140 | W90P910_GPIO_CHIP("GROUPI", 75, 17), | ||
141 | }; | ||
142 | |||
143 | void __init w90p910_init_gpio(int nr_group) | ||
144 | { | ||
145 | unsigned i; | ||
146 | struct w90p910_gpio_chip *gpio_chip; | ||
147 | |||
148 | for (i = 0; i < nr_group; i++) { | ||
149 | gpio_chip = &w90p910_gpio[i]; | ||
150 | spin_lock_init(&gpio_chip->gpio_lock); | ||
151 | gpio_chip->regbase = GPIO_BASE + i * GROUPINERV; | ||
152 | gpiochip_add(&gpio_chip->chip); | ||
153 | } | ||
154 | } | ||
diff --git a/arch/arm/mach-w90x900/include/mach/clkdev.h b/arch/arm/mach-w90x900/include/mach/clkdev.h new file mode 100644 index 000000000000..04b37a89801c --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/clkdev.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_MACH_CLKDEV_H | ||
2 | #define __ASM_MACH_CLKDEV_H | ||
3 | |||
4 | #define __clk_get(clk) ({ 1; }) | ||
5 | #define __clk_put(clk) do { } while (0) | ||
6 | |||
7 | #endif | ||
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h new file mode 100644 index 000000000000..034da3e390c9 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/gpio.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90p910/include/mach/gpio.h | ||
3 | * | ||
4 | * Generic w90p910 GPIO handling | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_W90P910_GPIO_H | ||
14 | #define __ASM_ARCH_W90P910_GPIO_H | ||
15 | |||
16 | #include <mach/hardware.h> | ||
17 | #include <asm/irq.h> | ||
18 | #include <asm-generic/gpio.h> | ||
19 | |||
20 | #define gpio_get_value __gpio_get_value | ||
21 | #define gpio_set_value __gpio_set_value | ||
22 | #define gpio_cansleep __gpio_cansleep | ||
23 | |||
24 | static inline int gpio_to_irq(unsigned gpio) | ||
25 | { | ||
26 | return gpio; | ||
27 | } | ||
28 | |||
29 | static inline int irq_to_gpio(unsigned irq) | ||
30 | { | ||
31 | return irq; | ||
32 | } | ||
33 | |||
34 | #endif | ||
diff --git a/arch/arm/mach-w90x900/include/mach/irqs.h b/arch/arm/mach-w90x900/include/mach/irqs.h index 1c583f9cbcde..9d5cba3a509f 100644 --- a/arch/arm/mach-w90x900/include/mach/irqs.h +++ b/arch/arm/mach-w90x900/include/mach/irqs.h | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-w90x900/include/mach/irqs.h | 2 | * arch/arm/mach-w90x900/include/mach/irqs.h |
3 | * | 3 | * |
4 | * Copyright (c) 2008 Nuvoton technology corporation | 4 | * Copyright (c) 2008 Nuvoton technology corporation. |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Wan ZongShun <mcuos.com@gmail.com> | 6 | * Wan ZongShun <mcuos.com@gmail.com> |
8 | * | 7 | * |
@@ -10,8 +9,7 @@ | |||
10 | * | 9 | * |
11 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation;version 2 of the License. |
14 | * (at your option) any later version. | ||
15 | * | 13 | * |
16 | */ | 14 | */ |
17 | 15 | ||
@@ -31,6 +29,11 @@ | |||
31 | /* Main cpu interrupts */ | 29 | /* Main cpu interrupts */ |
32 | 30 | ||
33 | #define IRQ_WDT W90X900_IRQ(1) | 31 | #define IRQ_WDT W90X900_IRQ(1) |
32 | #define IRQ_GROUP0 W90X900_IRQ(2) | ||
33 | #define IRQ_GROUP1 W90X900_IRQ(3) | ||
34 | #define IRQ_ACTL W90X900_IRQ(4) | ||
35 | #define IRQ_LCD W90X900_IRQ(5) | ||
36 | #define IRQ_RTC W90X900_IRQ(6) | ||
34 | #define IRQ_UART0 W90X900_IRQ(7) | 37 | #define IRQ_UART0 W90X900_IRQ(7) |
35 | #define IRQ_UART1 W90X900_IRQ(8) | 38 | #define IRQ_UART1 W90X900_IRQ(8) |
36 | #define IRQ_UART2 W90X900_IRQ(9) | 39 | #define IRQ_UART2 W90X900_IRQ(9) |
@@ -39,7 +42,45 @@ | |||
39 | #define IRQ_TIMER0 W90X900_IRQ(12) | 42 | #define IRQ_TIMER0 W90X900_IRQ(12) |
40 | #define IRQ_TIMER1 W90X900_IRQ(13) | 43 | #define IRQ_TIMER1 W90X900_IRQ(13) |
41 | #define IRQ_T_INT_GROUP W90X900_IRQ(14) | 44 | #define IRQ_T_INT_GROUP W90X900_IRQ(14) |
45 | #define IRQ_USBH W90X900_IRQ(15) | ||
46 | #define IRQ_EMCTX W90X900_IRQ(16) | ||
47 | #define IRQ_EMCRX W90X900_IRQ(17) | ||
48 | #define IRQ_GDMAGROUP W90X900_IRQ(18) | ||
49 | #define IRQ_DMAC W90X900_IRQ(19) | ||
50 | #define IRQ_FMI W90X900_IRQ(20) | ||
51 | #define IRQ_USBD W90X900_IRQ(21) | ||
52 | #define IRQ_ATAPI W90X900_IRQ(22) | ||
53 | #define IRQ_G2D W90X900_IRQ(23) | ||
54 | #define IRQ_PCI W90X900_IRQ(24) | ||
55 | #define IRQ_SCGROUP W90X900_IRQ(25) | ||
56 | #define IRQ_I2CGROUP W90X900_IRQ(26) | ||
57 | #define IRQ_SSP W90X900_IRQ(27) | ||
58 | #define IRQ_PWM W90X900_IRQ(28) | ||
59 | #define IRQ_KPI W90X900_IRQ(29) | ||
60 | #define IRQ_P2SGROUP W90X900_IRQ(30) | ||
42 | #define IRQ_ADC W90X900_IRQ(31) | 61 | #define IRQ_ADC W90X900_IRQ(31) |
43 | #define NR_IRQS (IRQ_ADC+1) | 62 | #define NR_IRQS (IRQ_ADC+1) |
44 | 63 | ||
64 | /*for irq group*/ | ||
65 | |||
66 | #define IRQ_PS2_PORT0 0x10000000 | ||
67 | #define IRQ_PS2_PORT1 0x20000000 | ||
68 | #define IRQ_I2C_LINE0 0x04000000 | ||
69 | #define IRQ_I2C_LINE1 0x08000000 | ||
70 | #define IRQ_SC_CARD0 0x01000000 | ||
71 | #define IRQ_SC_CARD1 0x02000000 | ||
72 | #define IRQ_GDMA_CH0 0x00100000 | ||
73 | #define IRQ_GDMA_CH1 0x00200000 | ||
74 | #define IRQ_TIMER2 0x00010000 | ||
75 | #define IRQ_TIMER3 0x00020000 | ||
76 | #define IRQ_TIMER4 0x00040000 | ||
77 | #define IRQ_GROUP0_IRQ0 0x00000001 | ||
78 | #define IRQ_GROUP0_IRQ1 0x00000002 | ||
79 | #define IRQ_GROUP0_IRQ2 0x00000004 | ||
80 | #define IRQ_GROUP0_IRQ3 0x00000008 | ||
81 | #define IRQ_GROUP1_IRQ4 0x00000010 | ||
82 | #define IRQ_GROUP1_IRQ5 0x00000020 | ||
83 | #define IRQ_GROUP1_IRQ6 0x00000040 | ||
84 | #define IRQ_GROUP1_IRQ7 0x00000080 | ||
85 | |||
45 | #endif /* __ASM_ARCH_IRQ_H */ | 86 | #endif /* __ASM_ARCH_IRQ_H */ |
diff --git a/arch/arm/mach-w90x900/include/mach/map.h b/arch/arm/mach-w90x900/include/mach/map.h index 79320ebe614b..1a2095304117 100644 --- a/arch/arm/mach-w90x900/include/mach/map.h +++ b/arch/arm/mach-w90x900/include/mach/map.h | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-w90x900/include/mach/map.h | 2 | * arch/arm/mach-w90x900/include/mach/map.h |
3 | * | 3 | * |
4 | * Copyright (c) 2008 Nuvoton technology corporation | 4 | * Copyright (c) 2008 Nuvoton technology corporation. |
5 | * All rights reserved. | ||
6 | * | 5 | * |
7 | * Wan ZongShun <mcuos.com@gmail.com> | 6 | * Wan ZongShun <mcuos.com@gmail.com> |
8 | * | 7 | * |
@@ -10,8 +9,7 @@ | |||
10 | * | 9 | * |
11 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation;version 2 of the License. |
14 | * (at your option) any later version. | ||
15 | * | 13 | * |
16 | */ | 14 | */ |
17 | 15 | ||
@@ -34,7 +32,6 @@ | |||
34 | * interrupt controller is the first thing we put in, to make | 32 | * interrupt controller is the first thing we put in, to make |
35 | * the assembly code for the irq detection easier | 33 | * the assembly code for the irq detection easier |
36 | */ | 34 | */ |
37 | |||
38 | #define W90X900_VA_IRQ W90X900_ADDR(0x00000000) | 35 | #define W90X900_VA_IRQ W90X900_ADDR(0x00000000) |
39 | #define W90X900_PA_IRQ (0xB8002000) | 36 | #define W90X900_PA_IRQ (0xB8002000) |
40 | #define W90X900_SZ_IRQ SZ_4K | 37 | #define W90X900_SZ_IRQ SZ_4K |
@@ -44,33 +41,117 @@ | |||
44 | #define W90X900_SZ_GCR SZ_4K | 41 | #define W90X900_SZ_GCR SZ_4K |
45 | 42 | ||
46 | /* Clock and Power management */ | 43 | /* Clock and Power management */ |
47 | |||
48 | #define W90X900_VA_CLKPWR (W90X900_VA_GCR+0x200) | 44 | #define W90X900_VA_CLKPWR (W90X900_VA_GCR+0x200) |
49 | #define W90X900_PA_CLKPWR (0xB0000200) | 45 | #define W90X900_PA_CLKPWR (0xB0000200) |
50 | #define W90X900_SZ_CLKPWR SZ_4K | 46 | #define W90X900_SZ_CLKPWR SZ_4K |
51 | 47 | ||
52 | /* EBI management */ | 48 | /* EBI management */ |
53 | |||
54 | #define W90X900_VA_EBI W90X900_ADDR(0x00001000) | 49 | #define W90X900_VA_EBI W90X900_ADDR(0x00001000) |
55 | #define W90X900_PA_EBI (0xB0001000) | 50 | #define W90X900_PA_EBI (0xB0001000) |
56 | #define W90X900_SZ_EBI SZ_4K | 51 | #define W90X900_SZ_EBI SZ_4K |
57 | 52 | ||
58 | /* UARTs */ | 53 | /* UARTs */ |
59 | |||
60 | #define W90X900_VA_UART W90X900_ADDR(0x08000000) | 54 | #define W90X900_VA_UART W90X900_ADDR(0x08000000) |
61 | #define W90X900_PA_UART (0xB8000000) | 55 | #define W90X900_PA_UART (0xB8000000) |
62 | #define W90X900_SZ_UART SZ_4K | 56 | #define W90X900_SZ_UART SZ_4K |
63 | 57 | ||
64 | /* Timers */ | 58 | /* Timers */ |
65 | |||
66 | #define W90X900_VA_TIMER W90X900_ADDR(0x08001000) | 59 | #define W90X900_VA_TIMER W90X900_ADDR(0x08001000) |
67 | #define W90X900_PA_TIMER (0xB8001000) | 60 | #define W90X900_PA_TIMER (0xB8001000) |
68 | #define W90X900_SZ_TIMER SZ_4K | 61 | #define W90X900_SZ_TIMER SZ_4K |
69 | 62 | ||
70 | /* GPIO ports */ | 63 | /* GPIO ports */ |
71 | |||
72 | #define W90X900_VA_GPIO W90X900_ADDR(0x08003000) | 64 | #define W90X900_VA_GPIO W90X900_ADDR(0x08003000) |
73 | #define W90X900_PA_GPIO (0xB8003000) | 65 | #define W90X900_PA_GPIO (0xB8003000) |
74 | #define W90X900_SZ_GPIO SZ_4K | 66 | #define W90X900_SZ_GPIO SZ_4K |
75 | 67 | ||
68 | /* GDMA control */ | ||
69 | #define W90X900_VA_GDMA W90X900_ADDR(0x00004000) | ||
70 | #define W90X900_PA_GDMA (0xB0004000) | ||
71 | #define W90X900_SZ_GDMA SZ_4K | ||
72 | |||
73 | /* USB host controller*/ | ||
74 | #define W90X900_VA_USBEHCIHOST W90X900_ADDR(0x00005000) | ||
75 | #define W90X900_PA_USBEHCIHOST (0xB0005000) | ||
76 | #define W90X900_SZ_USBEHCIHOST SZ_4K | ||
77 | |||
78 | #define W90X900_VA_USBOHCIHOST W90X900_ADDR(0x00007000) | ||
79 | #define W90X900_PA_USBOHCIHOST (0xB0007000) | ||
80 | #define W90X900_SZ_USBOHCIHOST SZ_4K | ||
81 | |||
82 | /* I2C hardware controller */ | ||
83 | #define W90X900_VA_I2C W90X900_ADDR(0x08006000) | ||
84 | #define W90X900_PA_I2C (0xB8006000) | ||
85 | #define W90X900_SZ_I2C SZ_4K | ||
86 | |||
87 | /* Keypad Interface*/ | ||
88 | #define W90X900_VA_KPI W90X900_ADDR(0x08008000) | ||
89 | #define W90X900_PA_KPI (0xB8008000) | ||
90 | #define W90X900_SZ_KPI SZ_4K | ||
91 | |||
92 | /* Smart card host*/ | ||
93 | #define W90X900_VA_SC W90X900_ADDR(0x08005000) | ||
94 | #define W90X900_PA_SC (0xB8005000) | ||
95 | #define W90X900_SZ_SC SZ_4K | ||
96 | |||
97 | /* LCD controller*/ | ||
98 | #define W90X900_VA_LCD W90X900_ADDR(0x00008000) | ||
99 | #define W90X900_PA_LCD (0xB0008000) | ||
100 | #define W90X900_SZ_LCD SZ_4K | ||
101 | |||
102 | /* 2D controller*/ | ||
103 | #define W90X900_VA_GE W90X900_ADDR(0x0000B000) | ||
104 | #define W90X900_PA_GE (0xB000B000) | ||
105 | #define W90X900_SZ_GE SZ_4K | ||
106 | |||
107 | /* ATAPI */ | ||
108 | #define W90X900_VA_ATAPI W90X900_ADDR(0x0000A000) | ||
109 | #define W90X900_PA_ATAPI (0xB000A000) | ||
110 | #define W90X900_SZ_ATAPI SZ_4K | ||
111 | |||
112 | /* ADC */ | ||
113 | #define W90X900_VA_ADC W90X900_ADDR(0x0800A000) | ||
114 | #define W90X900_PA_ADC (0xB800A000) | ||
115 | #define W90X900_SZ_ADC SZ_4K | ||
116 | |||
117 | /* PS2 Interface*/ | ||
118 | #define W90X900_VA_PS2 W90X900_ADDR(0x08009000) | ||
119 | #define W90X900_PA_PS2 (0xB8009000) | ||
120 | #define W90X900_SZ_PS2 SZ_4K | ||
121 | |||
122 | /* RTC */ | ||
123 | #define W90X900_VA_RTC W90X900_ADDR(0x08004000) | ||
124 | #define W90X900_PA_RTC (0xB8004000) | ||
125 | #define W90X900_SZ_RTC SZ_4K | ||
126 | |||
127 | /* Pulse Width Modulation(PWM) Registers */ | ||
128 | #define W90X900_VA_PWM W90X900_ADDR(0x08007000) | ||
129 | #define W90X900_PA_PWM (0xB8007000) | ||
130 | #define W90X900_SZ_PWM SZ_4K | ||
131 | |||
132 | /* Audio Controller controller */ | ||
133 | #define W90X900_VA_ACTL W90X900_ADDR(0x00009000) | ||
134 | #define W90X900_PA_ACTL (0xB0009000) | ||
135 | #define W90X900_SZ_ACTL SZ_4K | ||
136 | |||
137 | /* DMA controller */ | ||
138 | #define W90X900_VA_DMA W90X900_ADDR(0x0000c000) | ||
139 | #define W90X900_PA_DMA (0xB000c000) | ||
140 | #define W90X900_SZ_DMA SZ_4K | ||
141 | |||
142 | /* FMI controller */ | ||
143 | #define W90X900_VA_FMI W90X900_ADDR(0x0000d000) | ||
144 | #define W90X900_PA_FMI (0xB000d000) | ||
145 | #define W90X900_SZ_FMI SZ_4K | ||
146 | |||
147 | /* USB Device port */ | ||
148 | #define W90X900_VA_USBDEV W90X900_ADDR(0x00006000) | ||
149 | #define W90X900_PA_USBDEV (0xB0006000) | ||
150 | #define W90X900_SZ_USBDEV SZ_4K | ||
151 | |||
152 | /* External MAC control*/ | ||
153 | #define W90X900_VA_EMC W90X900_ADDR(0x00003000) | ||
154 | #define W90X900_PA_EMC (0xB0003000) | ||
155 | #define W90X900_SZ_EMC SZ_4K | ||
156 | |||
76 | #endif /* __ASM_ARCH_MAP_H */ | 157 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-w90x900/include/mach/regs-clock.h b/arch/arm/mach-w90x900/include/mach/regs-clock.h new file mode 100644 index 000000000000..f10b6a8dc069 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-clock.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-clock.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation. | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_CLOCK_H | ||
15 | #define __ASM_ARCH_REGS_CLOCK_H | ||
16 | |||
17 | /* Clock Control Registers */ | ||
18 | #define CLK_BA W90X900_VA_CLKPWR | ||
19 | #define REG_CLKEN (CLK_BA + 0x00) | ||
20 | #define REG_CLKSEL (CLK_BA + 0x04) | ||
21 | #define REG_CLKDIV (CLK_BA + 0x08) | ||
22 | #define REG_PLLCON0 (CLK_BA + 0x0C) | ||
23 | #define REG_PLLCON1 (CLK_BA + 0x10) | ||
24 | #define REG_PMCON (CLK_BA + 0x14) | ||
25 | #define REG_IRQWAKECON (CLK_BA + 0x18) | ||
26 | #define REG_IRQWAKEFLAG (CLK_BA + 0x1C) | ||
27 | #define REG_IPSRST (CLK_BA + 0x20) | ||
28 | #define REG_CLKEN1 (CLK_BA + 0x24) | ||
29 | #define REG_CLKDIV1 (CLK_BA + 0x28) | ||
30 | |||
31 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/regs-usb.h b/arch/arm/mach-w90x900/include/mach/regs-usb.h new file mode 100644 index 000000000000..ab74b0c2480b --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-usb.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-usb.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation. | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_USB_H | ||
15 | #define __ASM_ARCH_REGS_USB_H | ||
16 | |||
17 | /* usb Control Registers */ | ||
18 | #define USBH_BA W90X900_VA_USBEHCIHOST | ||
19 | #define USBD_BA W90X900_VA_USBDEV | ||
20 | #define USBO_BA W90X900_VA_USBOHCIHOST | ||
21 | |||
22 | /* USB Host Control Registers */ | ||
23 | #define REG_UPSCR0 (USBH_BA+0x064) | ||
24 | #define REG_UPSCR1 (USBH_BA+0x068) | ||
25 | #define REG_USBPCR0 (USBH_BA+0x0C4) | ||
26 | #define REG_USBPCR1 (USBH_BA+0x0C8) | ||
27 | |||
28 | /* USBH OHCI Control Registers */ | ||
29 | #define REG_OpModEn (USBO_BA+0x204) | ||
30 | /*This bit controls the polarity of over | ||
31 | *current flag from external power IC. | ||
32 | */ | ||
33 | #define OCALow 0x08 | ||
34 | |||
35 | #endif /* __ASM_ARCH_REGS_USB_H */ | ||
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c index 726ff6798a56..7a62bd348e80 100644 --- a/arch/arm/mach-w90x900/mach-w90p910evb.c +++ b/arch/arm/mach-w90x900/mach-w90p910evb.c | |||
@@ -3,15 +3,13 @@ | |||
3 | * | 3 | * |
4 | * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche | 4 | * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche |
5 | * | 5 | * |
6 | * Copyright (C) 2008 Nuvoton technology corporation | 6 | * Copyright (C) 2008 Nuvoton technology corporation. |
7 | * All rights reserved. | ||
8 | * | 7 | * |
9 | * Wan ZongShun <mcuos.com@gmail.com> | 8 | * Wan ZongShun <mcuos.com@gmail.com> |
10 | * | 9 | * |
11 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU General Public License as | 11 | * modify it under the terms of the GNU General Public License as |
13 | * published by the Free Software Foundation; either version 2 of | 12 | * published by the Free Software Foundation;version 2 of the License. |
14 | * the License, or (at your option) any later version. | ||
15 | * | 13 | * |
16 | */ | 14 | */ |
17 | 15 | ||
@@ -80,6 +78,156 @@ static struct platform_device w90p910_flash_device = { | |||
80 | .num_resources = ARRAY_SIZE(w90p910_flash_resources), | 78 | .num_resources = ARRAY_SIZE(w90p910_flash_resources), |
81 | }; | 79 | }; |
82 | 80 | ||
81 | /* USB EHCI Host Controller */ | ||
82 | |||
83 | static struct resource w90x900_usb_ehci_resource[] = { | ||
84 | [0] = { | ||
85 | .start = W90X900_PA_USBEHCIHOST, | ||
86 | .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1, | ||
87 | .flags = IORESOURCE_MEM, | ||
88 | }, | ||
89 | [1] = { | ||
90 | .start = IRQ_USBH, | ||
91 | .end = IRQ_USBH, | ||
92 | .flags = IORESOURCE_IRQ, | ||
93 | } | ||
94 | }; | ||
95 | |||
96 | static u64 w90x900_device_usb_ehci_dmamask = 0xffffffffUL; | ||
97 | |||
98 | struct platform_device w90x900_device_usb_ehci = { | ||
99 | .name = "w90x900-ehci", | ||
100 | .id = -1, | ||
101 | .num_resources = ARRAY_SIZE(w90x900_usb_ehci_resource), | ||
102 | .resource = w90x900_usb_ehci_resource, | ||
103 | .dev = { | ||
104 | .dma_mask = &w90x900_device_usb_ehci_dmamask, | ||
105 | .coherent_dma_mask = 0xffffffffUL | ||
106 | } | ||
107 | }; | ||
108 | EXPORT_SYMBOL(w90x900_device_usb_ehci); | ||
109 | |||
110 | /* USB OHCI Host Controller */ | ||
111 | |||
112 | static struct resource w90x900_usb_ohci_resource[] = { | ||
113 | [0] = { | ||
114 | .start = W90X900_PA_USBOHCIHOST, | ||
115 | .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1, | ||
116 | .flags = IORESOURCE_MEM, | ||
117 | }, | ||
118 | [1] = { | ||
119 | .start = IRQ_USBH, | ||
120 | .end = IRQ_USBH, | ||
121 | .flags = IORESOURCE_IRQ, | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | static u64 w90x900_device_usb_ohci_dmamask = 0xffffffffUL; | ||
126 | struct platform_device w90x900_device_usb_ohci = { | ||
127 | .name = "w90x900-ohci", | ||
128 | .id = -1, | ||
129 | .num_resources = ARRAY_SIZE(w90x900_usb_ohci_resource), | ||
130 | .resource = w90x900_usb_ohci_resource, | ||
131 | .dev = { | ||
132 | .dma_mask = &w90x900_device_usb_ohci_dmamask, | ||
133 | .coherent_dma_mask = 0xffffffffUL | ||
134 | } | ||
135 | }; | ||
136 | EXPORT_SYMBOL(w90x900_device_usb_ohci); | ||
137 | |||
138 | /*TouchScreen controller*/ | ||
139 | |||
140 | static struct resource w90x900_ts_resource[] = { | ||
141 | [0] = { | ||
142 | .start = W90X900_PA_ADC, | ||
143 | .end = W90X900_PA_ADC + W90X900_SZ_ADC-1, | ||
144 | .flags = IORESOURCE_MEM, | ||
145 | }, | ||
146 | [1] = { | ||
147 | .start = IRQ_ADC, | ||
148 | .end = IRQ_ADC, | ||
149 | .flags = IORESOURCE_IRQ, | ||
150 | }, | ||
151 | }; | ||
152 | |||
153 | struct platform_device w90x900_device_ts = { | ||
154 | .name = "w90x900-ts", | ||
155 | .id = -1, | ||
156 | .resource = w90x900_ts_resource, | ||
157 | .num_resources = ARRAY_SIZE(w90x900_ts_resource), | ||
158 | }; | ||
159 | EXPORT_SYMBOL(w90x900_device_ts); | ||
160 | |||
161 | /* RTC controller*/ | ||
162 | |||
163 | static struct resource w90x900_rtc_resource[] = { | ||
164 | [0] = { | ||
165 | .start = W90X900_PA_RTC, | ||
166 | .end = W90X900_PA_RTC + 0xff, | ||
167 | .flags = IORESOURCE_MEM, | ||
168 | }, | ||
169 | [1] = { | ||
170 | .start = IRQ_RTC, | ||
171 | .end = IRQ_RTC, | ||
172 | .flags = IORESOURCE_IRQ, | ||
173 | }, | ||
174 | }; | ||
175 | |||
176 | struct platform_device w90x900_device_rtc = { | ||
177 | .name = "w90x900-rtc", | ||
178 | .id = -1, | ||
179 | .num_resources = ARRAY_SIZE(w90x900_rtc_resource), | ||
180 | .resource = w90x900_rtc_resource, | ||
181 | }; | ||
182 | EXPORT_SYMBOL(w90x900_device_rtc); | ||
183 | |||
184 | /* KPI controller*/ | ||
185 | |||
186 | static struct resource w90x900_kpi_resource[] = { | ||
187 | [0] = { | ||
188 | .start = W90X900_PA_KPI, | ||
189 | .end = W90X900_PA_KPI + W90X900_SZ_KPI - 1, | ||
190 | .flags = IORESOURCE_MEM, | ||
191 | }, | ||
192 | [1] = { | ||
193 | .start = IRQ_KPI, | ||
194 | .end = IRQ_KPI, | ||
195 | .flags = IORESOURCE_IRQ, | ||
196 | } | ||
197 | |||
198 | }; | ||
199 | |||
200 | struct platform_device w90x900_device_kpi = { | ||
201 | .name = "w90x900-kpi", | ||
202 | .id = -1, | ||
203 | .num_resources = ARRAY_SIZE(w90x900_kpi_resource), | ||
204 | .resource = w90x900_kpi_resource, | ||
205 | }; | ||
206 | EXPORT_SYMBOL(w90x900_device_kpi); | ||
207 | |||
208 | /* USB Device (Gadget)*/ | ||
209 | |||
210 | static struct resource w90x900_usbgadget_resource[] = { | ||
211 | [0] = { | ||
212 | .start = W90X900_PA_USBDEV, | ||
213 | .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1, | ||
214 | .flags = IORESOURCE_MEM, | ||
215 | }, | ||
216 | [1] = { | ||
217 | .start = IRQ_USBD, | ||
218 | .end = IRQ_USBD, | ||
219 | .flags = IORESOURCE_IRQ, | ||
220 | } | ||
221 | }; | ||
222 | |||
223 | struct platform_device w90x900_device_usbgadget = { | ||
224 | .name = "w90x900-usbgadget", | ||
225 | .id = -1, | ||
226 | .num_resources = ARRAY_SIZE(w90x900_usbgadget_resource), | ||
227 | .resource = w90x900_usbgadget_resource, | ||
228 | }; | ||
229 | EXPORT_SYMBOL(w90x900_device_usbgadget); | ||
230 | |||
83 | static struct map_desc w90p910_iodesc[] __initdata = { | 231 | static struct map_desc w90p910_iodesc[] __initdata = { |
84 | }; | 232 | }; |
85 | 233 | ||
@@ -88,12 +236,18 @@ static struct map_desc w90p910_iodesc[] __initdata = { | |||
88 | static struct platform_device *w90p910evb_dev[] __initdata = { | 236 | static struct platform_device *w90p910evb_dev[] __initdata = { |
89 | &w90p910_serial_device, | 237 | &w90p910_serial_device, |
90 | &w90p910_flash_device, | 238 | &w90p910_flash_device, |
239 | &w90x900_device_usb_ehci, | ||
240 | &w90x900_device_usb_ohci, | ||
241 | &w90x900_device_ts, | ||
242 | &w90x900_device_rtc, | ||
243 | &w90x900_device_kpi, | ||
244 | &w90x900_device_usbgadget, | ||
91 | }; | 245 | }; |
92 | 246 | ||
93 | static void __init w90p910evb_map_io(void) | 247 | static void __init w90p910evb_map_io(void) |
94 | { | 248 | { |
95 | w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); | 249 | w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); |
96 | w90p910_init_clocks(0); | 250 | w90p910_init_clocks(); |
97 | } | 251 | } |
98 | 252 | ||
99 | static void __init w90p910evb_init(void) | 253 | static void __init w90p910evb_init(void) |
diff --git a/arch/arm/mach-w90x900/mfp-w90p910.c b/arch/arm/mach-w90x900/mfp-w90p910.c new file mode 100644 index 000000000000..a3520fefb5e7 --- /dev/null +++ b/arch/arm/mach-w90x900/mfp-w90p910.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-w90x900/mfp-w90p910.c | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * | ||
6 | * Wan ZongShun <mcuos.com@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation;version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | |||
26 | #define REG_MFSEL (W90X900_VA_GCR + 0xC) | ||
27 | |||
28 | #define GPSELF (0x01 << 1) | ||
29 | |||
30 | #define GPSELC (0x03 << 2) | ||
31 | #define ENKPI (0x02 << 2) | ||
32 | #define ENNAND (0x01 << 2) | ||
33 | |||
34 | #define GPSELEI0 (0x01 << 26) | ||
35 | #define GPSELEI1 (0x01 << 27) | ||
36 | |||
37 | static DECLARE_MUTEX(mfp_sem); | ||
38 | |||
39 | void mfp_set_groupf(struct device *dev) | ||
40 | { | ||
41 | unsigned long mfpen; | ||
42 | const char *dev_id; | ||
43 | |||
44 | BUG_ON(!dev); | ||
45 | |||
46 | down(&mfp_sem); | ||
47 | |||
48 | dev_id = dev_name(dev); | ||
49 | |||
50 | mfpen = __raw_readl(REG_MFSEL); | ||
51 | |||
52 | if (strcmp(dev_id, "w90p910-emc") == 0) | ||
53 | mfpen |= GPSELF;/*enable mac*/ | ||
54 | else | ||
55 | mfpen &= ~GPSELF;/*GPIOF[9:0]*/ | ||
56 | |||
57 | __raw_writel(mfpen, REG_MFSEL); | ||
58 | |||
59 | up(&mfp_sem); | ||
60 | } | ||
61 | EXPORT_SYMBOL(mfp_set_groupf); | ||
62 | |||
63 | void mfp_set_groupc(struct device *dev) | ||
64 | { | ||
65 | unsigned long mfpen; | ||
66 | const char *dev_id; | ||
67 | |||
68 | BUG_ON(!dev); | ||
69 | |||
70 | down(&mfp_sem); | ||
71 | |||
72 | dev_id = dev_name(dev); | ||
73 | |||
74 | mfpen = __raw_readl(REG_MFSEL); | ||
75 | |||
76 | if (strcmp(dev_id, "w90p910-lcd") == 0) | ||
77 | mfpen |= GPSELC;/*enable lcd*/ | ||
78 | else if (strcmp(dev_id, "w90p910-kpi") == 0) { | ||
79 | mfpen &= (~GPSELC);/*enable kpi*/ | ||
80 | mfpen |= ENKPI; | ||
81 | } else if (strcmp(dev_id, "w90p910-nand") == 0) { | ||
82 | mfpen &= (~GPSELC);/*enable nand*/ | ||
83 | mfpen |= ENNAND; | ||
84 | } else | ||
85 | mfpen &= (~GPSELC);/*GPIOC[14:0]*/ | ||
86 | |||
87 | __raw_writel(mfpen, REG_MFSEL); | ||
88 | |||
89 | up(&mfp_sem); | ||
90 | } | ||
91 | EXPORT_SYMBOL(mfp_set_groupc); | ||
92 | |||
93 | void mfp_set_groupi(struct device *dev, int gpio) | ||
94 | { | ||
95 | unsigned long mfpen; | ||
96 | const char *dev_id; | ||
97 | |||
98 | BUG_ON(!dev); | ||
99 | |||
100 | down(&mfp_sem); | ||
101 | |||
102 | dev_id = dev_name(dev); | ||
103 | |||
104 | mfpen = __raw_readl(REG_MFSEL); | ||
105 | |||
106 | if (strcmp(dev_id, "w90p910-wdog") == 0) | ||
107 | mfpen |= GPSELEI1;/*enable wdog*/ | ||
108 | else if (strcmp(dev_id, "w90p910-atapi") == 0) | ||
109 | mfpen |= GPSELEI0;/*enable atapi*/ | ||
110 | |||
111 | __raw_writel(mfpen, REG_MFSEL); | ||
112 | |||
113 | up(&mfp_sem); | ||
114 | } | ||
115 | EXPORT_SYMBOL(mfp_set_groupi); | ||
116 | |||
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c index 2bcbaa681b99..1c97e4930b7a 100644 --- a/arch/arm/mach-w90x900/w90p910.c +++ b/arch/arm/mach-w90x900/w90p910.c | |||
@@ -3,8 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks | 4 | * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks |
5 | * | 5 | * |
6 | * Copyright (c) 2008 Nuvoton technology corporation | 6 | * Copyright (c) 2008 Nuvoton technology corporation. |
7 | * All rights reserved. | ||
8 | * | 7 | * |
9 | * Wan ZongShun <mcuos.com@gmail.com> | 8 | * Wan ZongShun <mcuos.com@gmail.com> |
10 | * | 9 | * |
@@ -12,8 +11,7 @@ | |||
12 | * | 11 | * |
13 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 13 | * it under the terms of the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2 of the License, or | 14 | * the Free Software Foundation;version 2 of the License. |
16 | * (at your option) any later version. | ||
17 | * | 15 | * |
18 | */ | 16 | */ |
19 | 17 | ||
@@ -36,6 +34,7 @@ | |||
36 | #include <mach/regs-serial.h> | 34 | #include <mach/regs-serial.h> |
37 | 35 | ||
38 | #include "cpu.h" | 36 | #include "cpu.h" |
37 | #include "clock.h" | ||
39 | 38 | ||
40 | /* Initial IO mappings */ | 39 | /* Initial IO mappings */ |
41 | 40 | ||
@@ -45,9 +44,52 @@ static struct map_desc w90p910_iodesc[] __initdata = { | |||
45 | IODESC_ENT(UART), | 44 | IODESC_ENT(UART), |
46 | IODESC_ENT(TIMER), | 45 | IODESC_ENT(TIMER), |
47 | IODESC_ENT(EBI), | 46 | IODESC_ENT(EBI), |
47 | IODESC_ENT(USBEHCIHOST), | ||
48 | IODESC_ENT(USBOHCIHOST), | ||
49 | IODESC_ENT(ADC), | ||
50 | IODESC_ENT(RTC), | ||
51 | IODESC_ENT(KPI), | ||
52 | IODESC_ENT(USBDEV), | ||
48 | /*IODESC_ENT(LCD),*/ | 53 | /*IODESC_ENT(LCD),*/ |
49 | }; | 54 | }; |
50 | 55 | ||
56 | /* Initial clock declarations. */ | ||
57 | static DEFINE_CLK(lcd, 0); | ||
58 | static DEFINE_CLK(audio, 1); | ||
59 | static DEFINE_CLK(fmi, 4); | ||
60 | static DEFINE_CLK(dmac, 5); | ||
61 | static DEFINE_CLK(atapi, 6); | ||
62 | static DEFINE_CLK(emc, 7); | ||
63 | static DEFINE_CLK(usbd, 8); | ||
64 | static DEFINE_CLK(usbh, 9); | ||
65 | static DEFINE_CLK(g2d, 10);; | ||
66 | static DEFINE_CLK(pwm, 18); | ||
67 | static DEFINE_CLK(ps2, 24); | ||
68 | static DEFINE_CLK(kpi, 25); | ||
69 | static DEFINE_CLK(wdt, 26); | ||
70 | static DEFINE_CLK(gdma, 27); | ||
71 | static DEFINE_CLK(adc, 28); | ||
72 | static DEFINE_CLK(usi, 29); | ||
73 | |||
74 | static struct clk_lookup w90p910_clkregs[] = { | ||
75 | DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), | ||
76 | DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), | ||
77 | DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), | ||
78 | DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), | ||
79 | DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), | ||
80 | DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), | ||
81 | DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), | ||
82 | DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), | ||
83 | DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), | ||
84 | DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL), | ||
85 | DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL), | ||
86 | DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL), | ||
87 | DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL), | ||
88 | DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL), | ||
89 | DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL), | ||
90 | DEF_CLKLOOK(&clk_usi, "w90p910-usi", NULL), | ||
91 | }; | ||
92 | |||
51 | /* Initial serial platform data */ | 93 | /* Initial serial platform data */ |
52 | 94 | ||
53 | struct plat_serial8250_port w90p910_uart_data[] = { | 95 | struct plat_serial8250_port w90p910_uart_data[] = { |
@@ -77,8 +119,9 @@ void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size) | |||
77 | 119 | ||
78 | /*Init W90P910 clock*/ | 120 | /*Init W90P910 clock*/ |
79 | 121 | ||
80 | void __init w90p910_init_clocks(int xtal) | 122 | void __init w90p910_init_clocks(void) |
81 | { | 123 | { |
124 | clks_register(w90p910_clkregs, ARRAY_SIZE(w90p910_clkregs)); | ||
82 | } | 125 | } |
83 | 126 | ||
84 | static int __init w90p910_init_cpu(void) | 127 | static int __init w90p910_init_cpu(void) |