diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-11-03 15:14:39 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-11-03 15:14:39 -0500 |
commit | 2058297d2d045cb57138c33b87cfabcc80e65186 (patch) | |
tree | 7ccffd0e162cbd7471f643561e79f23abb989a62 /arch/arm/mach-ep93xx | |
parent | 150e6c67f4bf6ab51e62defc41bd19a2eefe5709 (diff) | |
parent | 4b27e1bb442e964903f8a3fa6bdf33a602dc0941 (diff) |
Merge branch 'for-linus' into for-2.6.33
Conflicts:
block/cfq-iosched.c
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'arch/arm/mach-ep93xx')
-rw-r--r-- | arch/arm/mach-ep93xx/Kconfig | 44 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/Makefile.boot | 9 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/clock.c | 166 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/core.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/edb93xx.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 42 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/gpio.h | 16 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/memory.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/platform.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/micro9.c | 132 |
10 files changed, 322 insertions, 161 deletions
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig index d7291c682a64..9167c3d2a5ed 100644 --- a/arch/arm/mach-ep93xx/Kconfig +++ b/arch/arm/mach-ep93xx/Kconfig | |||
@@ -17,13 +17,31 @@ config EP93XX_SDCE3_SYNC_PHYS_OFFSET | |||
17 | bool "0x00000000 - SDCE3/SyncBoot" | 17 | bool "0x00000000 - SDCE3/SyncBoot" |
18 | help | 18 | help |
19 | Select this option if you want support for EP93xx boards with the | 19 | Select this option if you want support for EP93xx boards with the |
20 | first SDRAM bank at 0x00000000 | 20 | first SDRAM bank at 0x00000000. |
21 | 21 | ||
22 | config EP93XX_SDCE0_PHYS_OFFSET | 22 | config EP93XX_SDCE0_PHYS_OFFSET |
23 | bool "0xc0000000 - SDCEO" | 23 | bool "0xc0000000 - SDCEO" |
24 | help | 24 | help |
25 | Select this option if you want support for EP93xx boards with the | 25 | Select this option if you want support for EP93xx boards with the |
26 | first SDRAM bank at 0xc0000000 | 26 | first SDRAM bank at 0xc0000000. |
27 | |||
28 | config EP93XX_SDCE1_PHYS_OFFSET | ||
29 | bool "0xd0000000 - SDCE1" | ||
30 | help | ||
31 | Select this option if you want support for EP93xx boards with the | ||
32 | first SDRAM bank at 0xd0000000. | ||
33 | |||
34 | config EP93XX_SDCE2_PHYS_OFFSET | ||
35 | bool "0xe0000000 - SDCE2" | ||
36 | help | ||
37 | Select this option if you want support for EP93xx boards with the | ||
38 | first SDRAM bank at 0xe0000000. | ||
39 | |||
40 | config EP93XX_SDCE3_ASYNC_PHYS_OFFSET | ||
41 | bool "0xf0000000 - SDCE3/AsyncBoot" | ||
42 | help | ||
43 | Select this option if you want support for EP93xx boards with the | ||
44 | first SDRAM bank at 0xf0000000. | ||
27 | 45 | ||
28 | endchoice | 46 | endchoice |
29 | 47 | ||
@@ -112,28 +130,36 @@ config MACH_MICRO9 | |||
112 | bool | 130 | bool |
113 | 131 | ||
114 | config MACH_MICRO9H | 132 | config MACH_MICRO9H |
115 | bool "Support Contec Hypercontrol Micro9-H" | 133 | bool "Support Contec Micro9-High" |
116 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET | 134 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET |
117 | select MACH_MICRO9 | 135 | select MACH_MICRO9 |
118 | help | 136 | help |
119 | Say 'Y' here if you want your kernel to support the | 137 | Say 'Y' here if you want your kernel to support the |
120 | Contec Hypercontrol Micro9-H board. | 138 | Contec Micro9-High board. |
121 | 139 | ||
122 | config MACH_MICRO9M | 140 | config MACH_MICRO9M |
123 | bool "Support Contec Hypercontrol Micro9-M" | 141 | bool "Support Contec Micro9-Mid" |
124 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET | 142 | depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET |
125 | select MACH_MICRO9 | 143 | select MACH_MICRO9 |
126 | help | 144 | help |
127 | Say 'Y' here if you want your kernel to support the | 145 | Say 'Y' here if you want your kernel to support the |
128 | Contec Hypercontrol Micro9-M board. | 146 | Contec Micro9-Mid board. |
129 | 147 | ||
130 | config MACH_MICRO9L | 148 | config MACH_MICRO9L |
131 | bool "Support Contec Hypercontrol Micro9-L" | 149 | bool "Support Contec Micro9-Lite" |
132 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET | 150 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET |
133 | select MACH_MICRO9 | 151 | select MACH_MICRO9 |
134 | help | 152 | help |
135 | Say 'Y' here if you want your kernel to support the | 153 | Say 'Y' here if you want your kernel to support the |
136 | Contec Hypercontrol Micro9-L board. | 154 | Contec Micro9-Lite board. |
155 | |||
156 | config MACH_MICRO9S | ||
157 | bool "Support Contec Micro9-Slim" | ||
158 | depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET | ||
159 | select MACH_MICRO9 | ||
160 | help | ||
161 | Say 'Y' here if you want your kernel to support the | ||
162 | Contec Micro9-Slim board. | ||
137 | 163 | ||
138 | config MACH_TS72XX | 164 | config MACH_TS72XX |
139 | bool "Support Technologic Systems TS-72xx SBC" | 165 | bool "Support Technologic Systems TS-72xx SBC" |
diff --git a/arch/arm/mach-ep93xx/Makefile.boot b/arch/arm/mach-ep93xx/Makefile.boot index 27a085a8f12a..0ad33f15c622 100644 --- a/arch/arm/mach-ep93xx/Makefile.boot +++ b/arch/arm/mach-ep93xx/Makefile.boot | |||
@@ -3,3 +3,12 @@ params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100 | |||
3 | 3 | ||
4 | zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 | 4 | zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 |
5 | params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 | 5 | params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 |
6 | |||
7 | zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0008000 | ||
8 | params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100 | ||
9 | |||
10 | zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0008000 | ||
11 | params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100 | ||
12 | |||
13 | zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0008000 | ||
14 | params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100 | ||
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index dda19cd76194..1d0f9d8aff2e 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c | |||
@@ -16,13 +16,16 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/spinlock.h> | ||
20 | |||
21 | #include <mach/hardware.h> | ||
19 | 22 | ||
20 | #include <asm/clkdev.h> | 23 | #include <asm/clkdev.h> |
21 | #include <asm/div64.h> | 24 | #include <asm/div64.h> |
22 | #include <mach/hardware.h> | ||
23 | 25 | ||
24 | 26 | ||
25 | struct clk { | 27 | struct clk { |
28 | struct clk *parent; | ||
26 | unsigned long rate; | 29 | unsigned long rate; |
27 | int users; | 30 | int users; |
28 | int sw_locked; | 31 | int sw_locked; |
@@ -39,40 +42,60 @@ static unsigned long get_uart_rate(struct clk *clk); | |||
39 | static int set_keytchclk_rate(struct clk *clk, unsigned long rate); | 42 | static int set_keytchclk_rate(struct clk *clk, unsigned long rate); |
40 | static int set_div_rate(struct clk *clk, unsigned long rate); | 43 | static int set_div_rate(struct clk *clk, unsigned long rate); |
41 | 44 | ||
45 | |||
46 | static struct clk clk_xtali = { | ||
47 | .rate = EP93XX_EXT_CLK_RATE, | ||
48 | }; | ||
42 | static struct clk clk_uart1 = { | 49 | static struct clk clk_uart1 = { |
50 | .parent = &clk_xtali, | ||
43 | .sw_locked = 1, | 51 | .sw_locked = 1, |
44 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 52 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
45 | .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, | 53 | .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, |
46 | .get_rate = get_uart_rate, | 54 | .get_rate = get_uart_rate, |
47 | }; | 55 | }; |
48 | static struct clk clk_uart2 = { | 56 | static struct clk clk_uart2 = { |
57 | .parent = &clk_xtali, | ||
49 | .sw_locked = 1, | 58 | .sw_locked = 1, |
50 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 59 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
51 | .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, | 60 | .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, |
52 | .get_rate = get_uart_rate, | 61 | .get_rate = get_uart_rate, |
53 | }; | 62 | }; |
54 | static struct clk clk_uart3 = { | 63 | static struct clk clk_uart3 = { |
64 | .parent = &clk_xtali, | ||
55 | .sw_locked = 1, | 65 | .sw_locked = 1, |
56 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 66 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
57 | .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, | 67 | .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, |
58 | .get_rate = get_uart_rate, | 68 | .get_rate = get_uart_rate, |
59 | }; | 69 | }; |
60 | static struct clk clk_pll1; | 70 | static struct clk clk_pll1 = { |
61 | static struct clk clk_f; | 71 | .parent = &clk_xtali, |
62 | static struct clk clk_h; | 72 | }; |
63 | static struct clk clk_p; | 73 | static struct clk clk_f = { |
64 | static struct clk clk_pll2; | 74 | .parent = &clk_pll1, |
75 | }; | ||
76 | static struct clk clk_h = { | ||
77 | .parent = &clk_pll1, | ||
78 | }; | ||
79 | static struct clk clk_p = { | ||
80 | .parent = &clk_pll1, | ||
81 | }; | ||
82 | static struct clk clk_pll2 = { | ||
83 | .parent = &clk_xtali, | ||
84 | }; | ||
65 | static struct clk clk_usb_host = { | 85 | static struct clk clk_usb_host = { |
86 | .parent = &clk_pll2, | ||
66 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 87 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
67 | .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, | 88 | .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, |
68 | }; | 89 | }; |
69 | static struct clk clk_keypad = { | 90 | static struct clk clk_keypad = { |
91 | .parent = &clk_xtali, | ||
70 | .sw_locked = 1, | 92 | .sw_locked = 1, |
71 | .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, | 93 | .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, |
72 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, | 94 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, |
73 | .set_rate = set_keytchclk_rate, | 95 | .set_rate = set_keytchclk_rate, |
74 | }; | 96 | }; |
75 | static struct clk clk_pwm = { | 97 | static struct clk clk_pwm = { |
98 | .parent = &clk_xtali, | ||
76 | .rate = EP93XX_EXT_CLK_RATE, | 99 | .rate = EP93XX_EXT_CLK_RATE, |
77 | }; | 100 | }; |
78 | 101 | ||
@@ -85,50 +108,62 @@ static struct clk clk_video = { | |||
85 | 108 | ||
86 | /* DMA Clocks */ | 109 | /* DMA Clocks */ |
87 | static struct clk clk_m2p0 = { | 110 | static struct clk clk_m2p0 = { |
111 | .parent = &clk_h, | ||
88 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 112 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
89 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, | 113 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, |
90 | }; | 114 | }; |
91 | static struct clk clk_m2p1 = { | 115 | static struct clk clk_m2p1 = { |
116 | .parent = &clk_h, | ||
92 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 117 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
93 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, | 118 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, |
94 | }; | 119 | }; |
95 | static struct clk clk_m2p2 = { | 120 | static struct clk clk_m2p2 = { |
121 | .parent = &clk_h, | ||
96 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 122 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
97 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, | 123 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, |
98 | }; | 124 | }; |
99 | static struct clk clk_m2p3 = { | 125 | static struct clk clk_m2p3 = { |
126 | .parent = &clk_h, | ||
100 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 127 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
101 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, | 128 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, |
102 | }; | 129 | }; |
103 | static struct clk clk_m2p4 = { | 130 | static struct clk clk_m2p4 = { |
131 | .parent = &clk_h, | ||
104 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 132 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
105 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, | 133 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, |
106 | }; | 134 | }; |
107 | static struct clk clk_m2p5 = { | 135 | static struct clk clk_m2p5 = { |
136 | .parent = &clk_h, | ||
108 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 137 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
109 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, | 138 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, |
110 | }; | 139 | }; |
111 | static struct clk clk_m2p6 = { | 140 | static struct clk clk_m2p6 = { |
141 | .parent = &clk_h, | ||
112 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 142 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
113 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, | 143 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, |
114 | }; | 144 | }; |
115 | static struct clk clk_m2p7 = { | 145 | static struct clk clk_m2p7 = { |
146 | .parent = &clk_h, | ||
116 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 147 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
117 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, | 148 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, |
118 | }; | 149 | }; |
119 | static struct clk clk_m2p8 = { | 150 | static struct clk clk_m2p8 = { |
151 | .parent = &clk_h, | ||
120 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 152 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
121 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, | 153 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, |
122 | }; | 154 | }; |
123 | static struct clk clk_m2p9 = { | 155 | static struct clk clk_m2p9 = { |
156 | .parent = &clk_h, | ||
124 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 157 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
125 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, | 158 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, |
126 | }; | 159 | }; |
127 | static struct clk clk_m2m0 = { | 160 | static struct clk clk_m2m0 = { |
161 | .parent = &clk_h, | ||
128 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 162 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
129 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, | 163 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, |
130 | }; | 164 | }; |
131 | static struct clk clk_m2m1 = { | 165 | static struct clk clk_m2m1 = { |
166 | .parent = &clk_h, | ||
132 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 167 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
133 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, | 168 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, |
134 | }; | 169 | }; |
@@ -137,6 +172,7 @@ static struct clk clk_m2m1 = { | |||
137 | { .dev_id = dev, .con_id = con, .clk = ck } | 172 | { .dev_id = dev, .con_id = con, .clk = ck } |
138 | 173 | ||
139 | static struct clk_lookup clocks[] = { | 174 | static struct clk_lookup clocks[] = { |
175 | INIT_CK(NULL, "xtali", &clk_xtali), | ||
140 | INIT_CK("apb:uart1", NULL, &clk_uart1), | 176 | INIT_CK("apb:uart1", NULL, &clk_uart1), |
141 | INIT_CK("apb:uart2", NULL, &clk_uart2), | 177 | INIT_CK("apb:uart2", NULL, &clk_uart2), |
142 | INIT_CK("apb:uart3", NULL, &clk_uart3), | 178 | INIT_CK("apb:uart3", NULL, &clk_uart3), |
@@ -163,48 +199,84 @@ static struct clk_lookup clocks[] = { | |||
163 | INIT_CK(NULL, "m2m1", &clk_m2m1), | 199 | INIT_CK(NULL, "m2m1", &clk_m2m1), |
164 | }; | 200 | }; |
165 | 201 | ||
202 | static DEFINE_SPINLOCK(clk_lock); | ||
203 | |||
204 | static void __clk_enable(struct clk *clk) | ||
205 | { | ||
206 | if (!clk->users++) { | ||
207 | if (clk->parent) | ||
208 | __clk_enable(clk->parent); | ||
209 | |||
210 | if (clk->enable_reg) { | ||
211 | u32 v; | ||
212 | |||
213 | v = __raw_readl(clk->enable_reg); | ||
214 | v |= clk->enable_mask; | ||
215 | if (clk->sw_locked) | ||
216 | ep93xx_syscon_swlocked_write(v, clk->enable_reg); | ||
217 | else | ||
218 | __raw_writel(v, clk->enable_reg); | ||
219 | } | ||
220 | } | ||
221 | } | ||
166 | 222 | ||
167 | int clk_enable(struct clk *clk) | 223 | int clk_enable(struct clk *clk) |
168 | { | 224 | { |
169 | if (!clk->users++ && clk->enable_reg) { | 225 | unsigned long flags; |
170 | u32 value; | ||
171 | 226 | ||
172 | value = __raw_readl(clk->enable_reg); | 227 | if (!clk) |
173 | value |= clk->enable_mask; | 228 | return -EINVAL; |
174 | if (clk->sw_locked) | 229 | |
175 | ep93xx_syscon_swlocked_write(value, clk->enable_reg); | 230 | spin_lock_irqsave(&clk_lock, flags); |
176 | else | 231 | __clk_enable(clk); |
177 | __raw_writel(value, clk->enable_reg); | 232 | spin_unlock_irqrestore(&clk_lock, flags); |
178 | } | ||
179 | 233 | ||
180 | return 0; | 234 | return 0; |
181 | } | 235 | } |
182 | EXPORT_SYMBOL(clk_enable); | 236 | EXPORT_SYMBOL(clk_enable); |
183 | 237 | ||
184 | void clk_disable(struct clk *clk) | 238 | static void __clk_disable(struct clk *clk) |
185 | { | 239 | { |
186 | if (!--clk->users && clk->enable_reg) { | 240 | if (!--clk->users) { |
187 | u32 value; | 241 | if (clk->enable_reg) { |
242 | u32 v; | ||
243 | |||
244 | v = __raw_readl(clk->enable_reg); | ||
245 | v &= ~clk->enable_mask; | ||
246 | if (clk->sw_locked) | ||
247 | ep93xx_syscon_swlocked_write(v, clk->enable_reg); | ||
248 | else | ||
249 | __raw_writel(v, clk->enable_reg); | ||
250 | } | ||
188 | 251 | ||
189 | value = __raw_readl(clk->enable_reg); | 252 | if (clk->parent) |
190 | value &= ~clk->enable_mask; | 253 | __clk_disable(clk->parent); |
191 | if (clk->sw_locked) | ||
192 | ep93xx_syscon_swlocked_write(value, clk->enable_reg); | ||
193 | else | ||
194 | __raw_writel(value, clk->enable_reg); | ||
195 | } | 254 | } |
196 | } | 255 | } |
256 | |||
257 | void clk_disable(struct clk *clk) | ||
258 | { | ||
259 | unsigned long flags; | ||
260 | |||
261 | if (!clk) | ||
262 | return; | ||
263 | |||
264 | spin_lock_irqsave(&clk_lock, flags); | ||
265 | __clk_disable(clk); | ||
266 | spin_unlock_irqrestore(&clk_lock, flags); | ||
267 | } | ||
197 | EXPORT_SYMBOL(clk_disable); | 268 | EXPORT_SYMBOL(clk_disable); |
198 | 269 | ||
199 | static unsigned long get_uart_rate(struct clk *clk) | 270 | static unsigned long get_uart_rate(struct clk *clk) |
200 | { | 271 | { |
272 | unsigned long rate = clk_get_rate(clk->parent); | ||
201 | u32 value; | 273 | u32 value; |
202 | 274 | ||
203 | value = __raw_readl(EP93XX_SYSCON_PWRCNT); | 275 | value = __raw_readl(EP93XX_SYSCON_PWRCNT); |
204 | if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) | 276 | if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) |
205 | return EP93XX_EXT_CLK_RATE; | 277 | return rate; |
206 | else | 278 | else |
207 | return EP93XX_EXT_CLK_RATE / 2; | 279 | return rate / 2; |
208 | } | 280 | } |
209 | 281 | ||
210 | unsigned long clk_get_rate(struct clk *clk) | 282 | unsigned long clk_get_rate(struct clk *clk) |
@@ -244,16 +316,16 @@ static int set_keytchclk_rate(struct clk *clk, unsigned long rate) | |||
244 | return 0; | 316 | return 0; |
245 | } | 317 | } |
246 | 318 | ||
247 | static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | 319 | static int calc_clk_div(struct clk *clk, unsigned long rate, |
248 | int *pdiv, int *div) | 320 | int *psel, int *esel, int *pdiv, int *div) |
249 | { | 321 | { |
250 | unsigned long max_rate, best_rate = 0, | 322 | struct clk *mclk; |
251 | actual_rate = 0, mclk_rate = 0, rate_err = -1; | 323 | unsigned long max_rate, actual_rate, mclk_rate, rate_err = -1; |
252 | int i, found = 0, __div = 0, __pdiv = 0; | 324 | int i, found = 0, __div = 0, __pdiv = 0; |
253 | 325 | ||
254 | /* Don't exceed the maximum rate */ | 326 | /* Don't exceed the maximum rate */ |
255 | max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), | 327 | max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), |
256 | (unsigned long)EP93XX_EXT_CLK_RATE / 4); | 328 | clk_xtali.rate / 4); |
257 | rate = min(rate, max_rate); | 329 | rate = min(rate, max_rate); |
258 | 330 | ||
259 | /* | 331 | /* |
@@ -267,11 +339,12 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
267 | */ | 339 | */ |
268 | for (i = 0; i < 3; i++) { | 340 | for (i = 0; i < 3; i++) { |
269 | if (i == 0) | 341 | if (i == 0) |
270 | mclk_rate = EP93XX_EXT_CLK_RATE * 2; | 342 | mclk = &clk_xtali; |
271 | else if (i == 1) | 343 | else if (i == 1) |
272 | mclk_rate = clk_pll1.rate * 2; | 344 | mclk = &clk_pll1; |
273 | else if (i == 2) | 345 | else |
274 | mclk_rate = clk_pll2.rate * 2; | 346 | mclk = &clk_pll2; |
347 | mclk_rate = mclk->rate * 2; | ||
275 | 348 | ||
276 | /* Try each predivider value */ | 349 | /* Try each predivider value */ |
277 | for (__pdiv = 4; __pdiv <= 6; __pdiv++) { | 350 | for (__pdiv = 4; __pdiv <= 6; __pdiv++) { |
@@ -286,7 +359,8 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
286 | *div = __div; | 359 | *div = __div; |
287 | *psel = (i == 2); | 360 | *psel = (i == 2); |
288 | *esel = (i != 0); | 361 | *esel = (i != 0); |
289 | best_rate = actual_rate; | 362 | clk->parent = mclk; |
363 | clk->rate = actual_rate; | ||
290 | rate_err = abs(actual_rate - rate); | 364 | rate_err = abs(actual_rate - rate); |
291 | found = 1; | 365 | found = 1; |
292 | } | 366 | } |
@@ -294,21 +368,19 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
294 | } | 368 | } |
295 | 369 | ||
296 | if (!found) | 370 | if (!found) |
297 | return 0; | 371 | return -EINVAL; |
298 | 372 | ||
299 | return best_rate; | 373 | return 0; |
300 | } | 374 | } |
301 | 375 | ||
302 | static int set_div_rate(struct clk *clk, unsigned long rate) | 376 | static int set_div_rate(struct clk *clk, unsigned long rate) |
303 | { | 377 | { |
304 | unsigned long actual_rate; | 378 | int err, psel = 0, esel = 0, pdiv = 0, div = 0; |
305 | int psel = 0, esel = 0, pdiv = 0, div = 0; | ||
306 | u32 val; | 379 | u32 val; |
307 | 380 | ||
308 | actual_rate = calc_clk_div(rate, &psel, &esel, &pdiv, &div); | 381 | err = calc_clk_div(clk, rate, &psel, &esel, &pdiv, &div); |
309 | if (actual_rate == 0) | 382 | if (err) |
310 | return -EINVAL; | 383 | return err; |
311 | clk->rate = actual_rate; | ||
312 | 384 | ||
313 | /* Clear the esel, psel, pdiv and div bits */ | 385 | /* Clear the esel, psel, pdiv and div bits */ |
314 | val = __raw_readl(clk->enable_reg); | 386 | val = __raw_readl(clk->enable_reg); |
@@ -344,7 +416,7 @@ static unsigned long calc_pll_rate(u32 config_word) | |||
344 | unsigned long long rate; | 416 | unsigned long long rate; |
345 | int i; | 417 | int i; |
346 | 418 | ||
347 | rate = EP93XX_EXT_CLK_RATE; | 419 | rate = clk_xtali.rate; |
348 | rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ | 420 | rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ |
349 | rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ | 421 | rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ |
350 | do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ | 422 | do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ |
@@ -377,7 +449,7 @@ static int __init ep93xx_clock_init(void) | |||
377 | 449 | ||
378 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); | 450 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); |
379 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ | 451 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ |
380 | clk_pll1.rate = EP93XX_EXT_CLK_RATE; | 452 | clk_pll1.rate = clk_xtali.rate; |
381 | } else { | 453 | } else { |
382 | clk_pll1.rate = calc_pll_rate(value); | 454 | clk_pll1.rate = calc_pll_rate(value); |
383 | } | 455 | } |
@@ -388,7 +460,7 @@ static int __init ep93xx_clock_init(void) | |||
388 | 460 | ||
389 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); | 461 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); |
390 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ | 462 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ |
391 | clk_pll2.rate = EP93XX_EXT_CLK_RATE; | 463 | clk_pll2.rate = clk_xtali.rate; |
392 | } else if (value & 0x00040000) { /* PLL2 enabled? */ | 464 | } else if (value & 0x00040000) { /* PLL2 enabled? */ |
393 | clk_pll2.rate = calc_pll_rate(value); | 465 | clk_pll2.rate = calc_pll_rate(value); |
394 | } else { | 466 | } else { |
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index f7ebed942f66..b4357c388d2e 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
@@ -206,7 +206,6 @@ static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
206 | for (i = 0; i < 8; i++) { | 206 | for (i = 0; i < 8; i++) { |
207 | if (status & (1 << i)) { | 207 | if (status & (1 << i)) { |
208 | int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_B(0)) + i; | 208 | int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_B(0)) + i; |
209 | desc = irq_desc + gpio_irq; | ||
210 | generic_handle_irq(gpio_irq); | 209 | generic_handle_irq(gpio_irq); |
211 | } | 210 | } |
212 | } | 211 | } |
@@ -550,13 +549,11 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) | |||
550 | platform_device_register(&ep93xx_eth_device); | 549 | platform_device_register(&ep93xx_eth_device); |
551 | } | 550 | } |
552 | 551 | ||
553 | static struct i2c_gpio_platform_data ep93xx_i2c_data = { | 552 | |
554 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | 553 | /************************************************************************* |
555 | .sda_is_open_drain = 0, | 554 | * EP93xx i2c peripheral handling |
556 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | 555 | *************************************************************************/ |
557 | .scl_is_open_drain = 0, | 556 | static struct i2c_gpio_platform_data ep93xx_i2c_data; |
558 | .udelay = 2, | ||
559 | }; | ||
560 | 557 | ||
561 | static struct platform_device ep93xx_i2c_device = { | 558 | static struct platform_device ep93xx_i2c_device = { |
562 | .name = "i2c-gpio", | 559 | .name = "i2c-gpio", |
@@ -564,8 +561,25 @@ static struct platform_device ep93xx_i2c_device = { | |||
564 | .dev.platform_data = &ep93xx_i2c_data, | 561 | .dev.platform_data = &ep93xx_i2c_data, |
565 | }; | 562 | }; |
566 | 563 | ||
567 | void __init ep93xx_register_i2c(struct i2c_board_info *devices, int num) | 564 | void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, |
565 | struct i2c_board_info *devices, int num) | ||
568 | { | 566 | { |
567 | /* | ||
568 | * Set the EEPROM interface pin drive type control. | ||
569 | * Defines the driver type for the EECLK and EEDAT pins as either | ||
570 | * open drain, which will require an external pull-up, or a normal | ||
571 | * CMOS driver. | ||
572 | */ | ||
573 | if (data->sda_is_open_drain && data->sda_pin != EP93XX_GPIO_LINE_EEDAT) | ||
574 | pr_warning("ep93xx: sda != EEDAT, open drain has no effect\n"); | ||
575 | if (data->scl_is_open_drain && data->scl_pin != EP93XX_GPIO_LINE_EECLK) | ||
576 | pr_warning("ep93xx: scl != EECLK, open drain has no effect\n"); | ||
577 | |||
578 | __raw_writel((data->sda_is_open_drain << 1) | | ||
579 | (data->scl_is_open_drain << 0), | ||
580 | EP93XX_GPIO_EEDRIVE); | ||
581 | |||
582 | ep93xx_i2c_data = *data; | ||
569 | i2c_register_board_info(0, devices, num); | 583 | i2c_register_board_info(0, devices, num); |
570 | platform_device_register(&ep93xx_i2c_device); | 584 | platform_device_register(&ep93xx_i2c_device); |
571 | } | 585 | } |
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c index 73145ae5d3fa..a4a7be308000 100644 --- a/arch/arm/mach-ep93xx/edb93xx.c +++ b/arch/arm/mach-ep93xx/edb93xx.c | |||
@@ -27,8 +27,10 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/i2c.h> | ||
31 | #include <linux/mtd/physmap.h> | 30 | #include <linux/mtd/physmap.h> |
31 | #include <linux/gpio.h> | ||
32 | #include <linux/i2c.h> | ||
33 | #include <linux/i2c-gpio.h> | ||
32 | 34 | ||
33 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
34 | 36 | ||
@@ -76,13 +78,26 @@ static struct ep93xx_eth_data edb93xx_eth_data = { | |||
76 | .phy_id = 1, | 78 | .phy_id = 1, |
77 | }; | 79 | }; |
78 | 80 | ||
79 | static struct i2c_board_info __initdata edb93xxa_i2c_data[] = { | 81 | |
82 | /************************************************************************* | ||
83 | * EDB93xx i2c peripheral handling | ||
84 | *************************************************************************/ | ||
85 | static struct i2c_gpio_platform_data edb93xx_i2c_gpio_data = { | ||
86 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | ||
87 | .sda_is_open_drain = 0, | ||
88 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | ||
89 | .scl_is_open_drain = 0, | ||
90 | .udelay = 0, /* default to 100 kHz */ | ||
91 | .timeout = 0, /* default to 100 ms */ | ||
92 | }; | ||
93 | |||
94 | static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { | ||
80 | { | 95 | { |
81 | I2C_BOARD_INFO("isl1208", 0x6f), | 96 | I2C_BOARD_INFO("isl1208", 0x6f), |
82 | }, | 97 | }, |
83 | }; | 98 | }; |
84 | 99 | ||
85 | static struct i2c_board_info __initdata edb93xx_i2c_data[] = { | 100 | static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = { |
86 | { | 101 | { |
87 | I2C_BOARD_INFO("ds1337", 0x68), | 102 | I2C_BOARD_INFO("ds1337", 0x68), |
88 | }, | 103 | }, |
@@ -92,12 +107,14 @@ static void __init edb93xx_register_i2c(void) | |||
92 | { | 107 | { |
93 | if (machine_is_edb9302a() || machine_is_edb9307a() || | 108 | if (machine_is_edb9302a() || machine_is_edb9307a() || |
94 | machine_is_edb9315a()) { | 109 | machine_is_edb9315a()) { |
95 | ep93xx_register_i2c(edb93xxa_i2c_data, | 110 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
96 | ARRAY_SIZE(edb93xxa_i2c_data)); | 111 | edb93xxa_i2c_board_info, |
112 | ARRAY_SIZE(edb93xxa_i2c_board_info)); | ||
97 | } else if (machine_is_edb9307() || machine_is_edb9312() || | 113 | } else if (machine_is_edb9307() || machine_is_edb9312() || |
98 | machine_is_edb9315()) { | 114 | machine_is_edb9315()) { |
99 | ep93xx_register_i2c(edb93xx_i2c_data, | 115 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
100 | ARRAY_SIZE(edb93xx_i2c_data)); | 116 | edb93xx_i2c_board_info, |
117 | ARRAY_SIZE(edb93xx_i2c_board_info)); | ||
101 | } | 118 | } |
102 | } | 119 | } |
103 | 120 | ||
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h index 0fbf87b16338..b1f937eda29c 100644 --- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | |||
@@ -52,25 +52,27 @@ | |||
52 | #define EP93XX_AHB_VIRT_BASE 0xfef00000 | 52 | #define EP93XX_AHB_VIRT_BASE 0xfef00000 |
53 | #define EP93XX_AHB_SIZE 0x00100000 | 53 | #define EP93XX_AHB_SIZE 0x00100000 |
54 | 54 | ||
55 | #define EP93XX_AHB_PHYS(x) (EP93XX_AHB_PHYS_BASE + (x)) | ||
55 | #define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x)) | 56 | #define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x)) |
56 | 57 | ||
57 | #define EP93XX_APB_PHYS_BASE 0x80800000 | 58 | #define EP93XX_APB_PHYS_BASE 0x80800000 |
58 | #define EP93XX_APB_VIRT_BASE 0xfed00000 | 59 | #define EP93XX_APB_VIRT_BASE 0xfed00000 |
59 | #define EP93XX_APB_SIZE 0x00200000 | 60 | #define EP93XX_APB_SIZE 0x00200000 |
60 | 61 | ||
62 | #define EP93XX_APB_PHYS(x) (EP93XX_APB_PHYS_BASE + (x)) | ||
61 | #define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) | 63 | #define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) |
62 | 64 | ||
63 | 65 | ||
64 | /* AHB peripherals */ | 66 | /* AHB peripherals */ |
65 | #define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) | 67 | #define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) |
66 | 68 | ||
67 | #define EP93XX_ETHERNET_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00010000) | 69 | #define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000) |
68 | #define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) | 70 | #define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) |
69 | 71 | ||
70 | #define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) | 72 | #define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000) |
71 | #define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) | 73 | #define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) |
72 | 74 | ||
73 | #define EP93XX_RASTER_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00030000) | 75 | #define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000) |
74 | #define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) | 76 | #define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) |
75 | 77 | ||
76 | #define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) | 78 | #define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) |
@@ -112,21 +114,10 @@ | |||
112 | 114 | ||
113 | #define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000) | 115 | #define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000) |
114 | #define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) | 116 | #define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) |
115 | #define EP93XX_GPIO_F_INT_TYPE1 EP93XX_GPIO_REG(0x4c) | ||
116 | #define EP93XX_GPIO_F_INT_TYPE2 EP93XX_GPIO_REG(0x50) | ||
117 | #define EP93XX_GPIO_F_INT_ACK EP93XX_GPIO_REG(0x54) | ||
118 | #define EP93XX_GPIO_F_INT_ENABLE EP93XX_GPIO_REG(0x58) | ||
119 | #define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) | 117 | #define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) |
120 | #define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90) | ||
121 | #define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94) | ||
122 | #define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98) | ||
123 | #define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c) | ||
124 | #define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) | 118 | #define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) |
125 | #define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac) | ||
126 | #define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0) | ||
127 | #define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4) | ||
128 | #define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8) | ||
129 | #define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) | 119 | #define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) |
120 | #define EP93XX_GPIO_EEDRIVE EP93XX_GPIO_REG(0xc8) | ||
130 | 121 | ||
131 | #define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) | 122 | #define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) |
132 | 123 | ||
@@ -134,13 +125,13 @@ | |||
134 | 125 | ||
135 | #define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) | 126 | #define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) |
136 | 127 | ||
137 | #define EP93XX_UART1_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000c0000) | 128 | #define EP93XX_UART1_PHYS_BASE EP93XX_APB_PHYS(0x000c0000) |
138 | #define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) | 129 | #define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) |
139 | 130 | ||
140 | #define EP93XX_UART2_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000d0000) | 131 | #define EP93XX_UART2_PHYS_BASE EP93XX_APB_PHYS(0x000d0000) |
141 | #define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000) | 132 | #define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000) |
142 | 133 | ||
143 | #define EP93XX_UART3_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000e0000) | 134 | #define EP93XX_UART3_PHYS_BASE EP93XX_APB_PHYS(0x000e0000) |
144 | #define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) | 135 | #define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) |
145 | 136 | ||
146 | #define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) | 137 | #define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) |
@@ -148,10 +139,10 @@ | |||
148 | #define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) | 139 | #define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) |
149 | #define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) | 140 | #define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) |
150 | 141 | ||
151 | #define EP93XX_PWM_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x00110000) | 142 | #define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000) |
152 | #define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) | 143 | #define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) |
153 | 144 | ||
154 | #define EP93XX_RTC_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x00120000) | 145 | #define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000) |
155 | #define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) | 146 | #define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) |
156 | 147 | ||
157 | #define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) | 148 | #define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) |
@@ -218,6 +209,17 @@ | |||
218 | #define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) | 209 | #define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) |
219 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15) | 210 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15) |
220 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) | 211 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) |
212 | #define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c) | ||
213 | #define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000) | ||
214 | #define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28) | ||
215 | #define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8) | ||
216 | #define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7) | ||
217 | #define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6) | ||
218 | #define EP93XX_SYSCON_SYSCFG_LASDO (1<<5) | ||
219 | #define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4) | ||
220 | #define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3) | ||
221 | #define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1) | ||
222 | #define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0) | ||
221 | #define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) | 223 | #define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) |
222 | 224 | ||
223 | #define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) | 225 | #define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) |
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h index 0a1498ae899a..c991b149bdf2 100644 --- a/arch/arm/mach-ep93xx/include/mach/gpio.h +++ b/arch/arm/mach-ep93xx/include/mach/gpio.h | |||
@@ -114,17 +114,9 @@ extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable); | |||
114 | * B0..B7 (7..15) to irq 72..79, and | 114 | * B0..B7 (7..15) to irq 72..79, and |
115 | * F0..F7 (16..24) to irq 80..87. | 115 | * F0..F7 (16..24) to irq 80..87. |
116 | */ | 116 | */ |
117 | static inline int gpio_to_irq(unsigned gpio) | 117 | #define gpio_to_irq(gpio) \ |
118 | { | 118 | (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL) |
119 | if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ) | 119 | |
120 | return 64 + gpio; | 120 | #define irq_to_gpio(irq) ((irq) - gpio_to_irq(0)) |
121 | |||
122 | return -EINVAL; | ||
123 | } | ||
124 | |||
125 | static inline int irq_to_gpio(unsigned irq) | ||
126 | { | ||
127 | return irq - gpio_to_irq(0); | ||
128 | } | ||
129 | 121 | ||
130 | #endif | 122 | #endif |
diff --git a/arch/arm/mach-ep93xx/include/mach/memory.h b/arch/arm/mach-ep93xx/include/mach/memory.h index 925b12ea0990..554064e90307 100644 --- a/arch/arm/mach-ep93xx/include/mach/memory.h +++ b/arch/arm/mach-ep93xx/include/mach/memory.h | |||
@@ -9,6 +9,12 @@ | |||
9 | #define PHYS_OFFSET UL(0x00000000) | 9 | #define PHYS_OFFSET UL(0x00000000) |
10 | #elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) | 10 | #elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) |
11 | #define PHYS_OFFSET UL(0xc0000000) | 11 | #define PHYS_OFFSET UL(0xc0000000) |
12 | #elif defined(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) | ||
13 | #define PHYS_OFFSET UL(0xd0000000) | ||
14 | #elif defined(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) | ||
15 | #define PHYS_OFFSET UL(0xe0000000) | ||
16 | #elif defined(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) | ||
17 | #define PHYS_OFFSET UL(0xf0000000) | ||
12 | #else | 18 | #else |
13 | #error "Kconfig bug: No EP93xx PHYS_OFFSET set" | 19 | #error "Kconfig bug: No EP93xx PHYS_OFFSET set" |
14 | #endif | 20 | #endif |
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h index 01a0f0838e5b..469fd968d517 100644 --- a/arch/arm/mach-ep93xx/include/mach/platform.h +++ b/arch/arm/mach-ep93xx/include/mach/platform.h | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #ifndef __ASSEMBLY__ | 5 | #ifndef __ASSEMBLY__ |
6 | 6 | ||
7 | struct i2c_gpio_platform_data; | ||
7 | struct i2c_board_info; | 8 | struct i2c_board_info; |
8 | struct platform_device; | 9 | struct platform_device; |
9 | struct ep93xxfb_mach_info; | 10 | struct ep93xxfb_mach_info; |
@@ -16,7 +17,6 @@ struct ep93xx_eth_data | |||
16 | 17 | ||
17 | void ep93xx_map_io(void); | 18 | void ep93xx_map_io(void); |
18 | void ep93xx_init_irq(void); | 19 | void ep93xx_init_irq(void); |
19 | void ep93xx_init_time(unsigned long); | ||
20 | 20 | ||
21 | /* EP93xx System Controller software locked register write */ | 21 | /* EP93xx System Controller software locked register write */ |
22 | void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg); | 22 | void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg); |
@@ -33,7 +33,8 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); | 35 | void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); |
36 | void ep93xx_register_i2c(struct i2c_board_info *devices, int num); | 36 | void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, |
37 | struct i2c_board_info *devices, int num); | ||
37 | void ep93xx_register_fb(struct ep93xxfb_mach_info *data); | 38 | void ep93xx_register_fb(struct ep93xxfb_mach_info *data); |
38 | void ep93xx_register_pwm(int pwm0, int pwm1); | 39 | void ep93xx_register_pwm(int pwm0, int pwm1); |
39 | int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); | 40 | int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); |
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c index 0a313e82fb74..d83b80478b09 100644 --- a/arch/arm/mach-ep93xx/micro9.c +++ b/arch/arm/mach-ep93xx/micro9.c | |||
@@ -2,7 +2,9 @@ | |||
2 | * linux/arch/arm/mach-ep93xx/micro9.c | 2 | * linux/arch/arm/mach-ep93xx/micro9.c |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH | 4 | * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH |
5 | * Manfred Gruber <manfred.gruber@contec.at> | 5 | * Manfred Gruber <m.gruber@tirol.com> |
6 | * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH | ||
7 | * Hubert Feurstein <hubert.feurstein@contec.at> | ||
6 | * | 8 | * |
7 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -20,104 +22,124 @@ | |||
20 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
21 | 23 | ||
22 | 24 | ||
23 | static struct ep93xx_eth_data micro9_eth_data = { | 25 | /************************************************************************* |
24 | .phy_id = 0x1f, | 26 | * Micro9 NOR Flash |
25 | }; | 27 | * |
26 | 28 | * Micro9-High has up to 64MB of 32-bit flash on CS1 | |
27 | static void __init micro9_init(void) | 29 | * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1 |
28 | { | 30 | * Micro9-Lite uses a seperate MTD map driver for flash support |
29 | ep93xx_register_eth(µ9_eth_data, 1); | 31 | * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 |
30 | } | 32 | *************************************************************************/ |
31 | 33 | static struct physmap_flash_data micro9_flash_data; | |
32 | /* | 34 | |
33 | * Micro9-H | 35 | static struct resource micro9_flash_resource = { |
34 | */ | ||
35 | #ifdef CONFIG_MACH_MICRO9H | ||
36 | static struct physmap_flash_data micro9h_flash_data = { | ||
37 | .width = 4, | ||
38 | }; | ||
39 | |||
40 | static struct resource micro9h_flash_resource = { | ||
41 | .start = EP93XX_CS1_PHYS_BASE, | 36 | .start = EP93XX_CS1_PHYS_BASE, |
42 | .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, | 37 | .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, |
43 | .flags = IORESOURCE_MEM, | 38 | .flags = IORESOURCE_MEM, |
44 | }; | 39 | }; |
45 | 40 | ||
46 | static struct platform_device micro9h_flash = { | 41 | static struct platform_device micro9_flash = { |
47 | .name = "physmap-flash", | 42 | .name = "physmap-flash", |
48 | .id = 0, | 43 | .id = 0, |
49 | .dev = { | 44 | .dev = { |
50 | .platform_data = µ9h_flash_data, | 45 | .platform_data = µ9_flash_data, |
51 | }, | 46 | }, |
52 | .num_resources = 1, | 47 | .num_resources = 1, |
53 | .resource = µ9h_flash_resource, | 48 | .resource = µ9_flash_resource, |
54 | }; | 49 | }; |
55 | 50 | ||
56 | static void __init micro9h_init(void) | 51 | static void __init __micro9_register_flash(unsigned int width) |
52 | { | ||
53 | micro9_flash_data.width = width; | ||
54 | |||
55 | platform_device_register(µ9_flash); | ||
56 | } | ||
57 | |||
58 | static unsigned int __init micro9_detect_bootwidth(void) | ||
59 | { | ||
60 | u32 v; | ||
61 | |||
62 | /* Detect the bus width of the external flash memory */ | ||
63 | v = __raw_readl(EP93XX_SYSCON_SYSCFG); | ||
64 | if (v & EP93XX_SYSCON_SYSCFG_LCSN7) | ||
65 | return 4; /* 32-bit */ | ||
66 | else | ||
67 | return 2; /* 16-bit */ | ||
68 | } | ||
69 | |||
70 | static void __init micro9_register_flash(void) | ||
57 | { | 71 | { |
58 | platform_device_register(µ9h_flash); | 72 | if (machine_is_micro9()) |
73 | __micro9_register_flash(4); | ||
74 | else if (machine_is_micro9m() || machine_is_micro9s()) | ||
75 | __micro9_register_flash(micro9_detect_bootwidth()); | ||
59 | } | 76 | } |
60 | 77 | ||
61 | static void __init micro9h_init_machine(void) | 78 | |
79 | /************************************************************************* | ||
80 | * Micro9 Ethernet | ||
81 | *************************************************************************/ | ||
82 | static struct ep93xx_eth_data micro9_eth_data = { | ||
83 | .phy_id = 0x1f, | ||
84 | }; | ||
85 | |||
86 | |||
87 | static void __init micro9_init_machine(void) | ||
62 | { | 88 | { |
63 | ep93xx_init_devices(); | 89 | ep93xx_init_devices(); |
64 | micro9_init(); | 90 | ep93xx_register_eth(µ9_eth_data, 1); |
65 | micro9h_init(); | 91 | micro9_register_flash(); |
66 | } | 92 | } |
67 | 93 | ||
68 | MACHINE_START(MICRO9, "Contec Hypercontrol Micro9-H") | 94 | |
69 | /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ | 95 | #ifdef CONFIG_MACH_MICRO9H |
96 | MACHINE_START(MICRO9, "Contec Micro9-High") | ||
97 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ | ||
70 | .phys_io = EP93XX_APB_PHYS_BASE, | 98 | .phys_io = EP93XX_APB_PHYS_BASE, |
71 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | 99 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
72 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, | 100 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
73 | .map_io = ep93xx_map_io, | 101 | .map_io = ep93xx_map_io, |
74 | .init_irq = ep93xx_init_irq, | 102 | .init_irq = ep93xx_init_irq, |
75 | .timer = &ep93xx_timer, | 103 | .timer = &ep93xx_timer, |
76 | .init_machine = micro9h_init_machine, | 104 | .init_machine = micro9_init_machine, |
77 | MACHINE_END | 105 | MACHINE_END |
78 | #endif | 106 | #endif |
79 | 107 | ||
80 | /* | ||
81 | * Micro9-M | ||
82 | */ | ||
83 | #ifdef CONFIG_MACH_MICRO9M | 108 | #ifdef CONFIG_MACH_MICRO9M |
84 | static void __init micro9m_init_machine(void) | 109 | MACHINE_START(MICRO9M, "Contec Micro9-Mid") |
85 | { | 110 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
86 | ep93xx_init_devices(); | ||
87 | micro9_init(); | ||
88 | } | ||
89 | |||
90 | MACHINE_START(MICRO9M, "Contec Hypercontrol Micro9-M") | ||
91 | /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ | ||
92 | .phys_io = EP93XX_APB_PHYS_BASE, | 111 | .phys_io = EP93XX_APB_PHYS_BASE, |
93 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | 112 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
94 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, | 113 | .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100, |
95 | .map_io = ep93xx_map_io, | 114 | .map_io = ep93xx_map_io, |
96 | .init_irq = ep93xx_init_irq, | 115 | .init_irq = ep93xx_init_irq, |
97 | .timer = &ep93xx_timer, | 116 | .timer = &ep93xx_timer, |
98 | .init_machine = micro9m_init_machine, | 117 | .init_machine = micro9_init_machine, |
99 | MACHINE_END | 118 | MACHINE_END |
100 | #endif | 119 | #endif |
101 | 120 | ||
102 | /* | ||
103 | * Micro9-L | ||
104 | */ | ||
105 | #ifdef CONFIG_MACH_MICRO9L | 121 | #ifdef CONFIG_MACH_MICRO9L |
106 | static void __init micro9l_init_machine(void) | 122 | MACHINE_START(MICRO9L, "Contec Micro9-Lite") |
107 | { | 123 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
108 | ep93xx_init_devices(); | ||
109 | micro9_init(); | ||
110 | } | ||
111 | |||
112 | MACHINE_START(MICRO9L, "Contec Hypercontrol Micro9-L") | ||
113 | /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ | ||
114 | .phys_io = EP93XX_APB_PHYS_BASE, | 124 | .phys_io = EP93XX_APB_PHYS_BASE, |
115 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | 125 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
116 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, | 126 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
117 | .map_io = ep93xx_map_io, | 127 | .map_io = ep93xx_map_io, |
118 | .init_irq = ep93xx_init_irq, | 128 | .init_irq = ep93xx_init_irq, |
119 | .timer = &ep93xx_timer, | 129 | .timer = &ep93xx_timer, |
120 | .init_machine = micro9l_init_machine, | 130 | .init_machine = micro9_init_machine, |
121 | MACHINE_END | 131 | MACHINE_END |
122 | #endif | 132 | #endif |
123 | 133 | ||
134 | #ifdef CONFIG_MACH_MICRO9S | ||
135 | MACHINE_START(MICRO9S, "Contec Micro9-Slim") | ||
136 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ | ||
137 | .phys_io = EP93XX_APB_PHYS_BASE, | ||
138 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | ||
139 | .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100, | ||
140 | .map_io = ep93xx_map_io, | ||
141 | .init_irq = ep93xx_init_irq, | ||
142 | .timer = &ep93xx_timer, | ||
143 | .init_machine = micro9_init_machine, | ||
144 | MACHINE_END | ||
145 | #endif | ||