diff options
Diffstat (limited to 'arch/arm/mach-shmobile/board-g4evm.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-g4evm.c | 153 |
1 files changed, 143 insertions, 10 deletions
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c index 10673a90be52..2c3ff6f7f34c 100644 --- a/arch/arm/mach-shmobile/board-g4evm.c +++ b/arch/arm/mach-shmobile/board-g4evm.c | |||
@@ -30,12 +30,39 @@ | |||
30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
31 | #include <linux/input.h> | 31 | #include <linux/input.h> |
32 | #include <linux/input/sh_keysc.h> | 32 | #include <linux/input/sh_keysc.h> |
33 | #include <linux/mfd/sh_mobile_sdhi.h> | ||
33 | #include <linux/gpio.h> | 34 | #include <linux/gpio.h> |
34 | #include <mach/sh7377.h> | 35 | #include <mach/sh7377.h> |
35 | #include <mach/common.h> | 36 | #include <mach/common.h> |
36 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
37 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
38 | #include <asm/mach/map.h> | 39 | #include <asm/mach/map.h> |
40 | #include <asm/mach/time.h> | ||
41 | |||
42 | /* | ||
43 | * SDHI | ||
44 | * | ||
45 | * SDHI0 : card detection is possible | ||
46 | * SDHI1 : card detection is impossible | ||
47 | * | ||
48 | * [G4-MAIN-BOARD] | ||
49 | * JP74 : short # DBG_2V8A for SDHI0 | ||
50 | * JP75 : NC # DBG_3V3A for SDHI0 | ||
51 | * JP76 : NC # DBG_3V3A_SD for SDHI0 | ||
52 | * JP77 : NC # 3V3A_SDIO for SDHI1 | ||
53 | * JP78 : short # DBG_2V8A for SDHI1 | ||
54 | * JP79 : NC # DBG_3V3A for SDHI1 | ||
55 | * JP80 : NC # DBG_3V3A_SD for SDHI1 | ||
56 | * | ||
57 | * [G4-CORE-BOARD] | ||
58 | * S32 : all off # to dissever from G3-CORE_DBG board | ||
59 | * S33 : all off # to dissever from G3-CORE_DBG board | ||
60 | * | ||
61 | * [G3-CORE_DBG-BOARD] | ||
62 | * S1 : all off # to dissever from G3-CORE_DBG board | ||
63 | * S3 : all off # to dissever from G3-CORE_DBG board | ||
64 | * S4 : all off # to dissever from G3-CORE_DBG board | ||
65 | */ | ||
39 | 66 | ||
40 | static struct mtd_partition nor_flash_partitions[] = { | 67 | static struct mtd_partition nor_flash_partitions[] = { |
41 | { | 68 | { |
@@ -90,7 +117,7 @@ static struct platform_device nor_flash_device = { | |||
90 | }; | 117 | }; |
91 | 118 | ||
92 | /* USBHS */ | 119 | /* USBHS */ |
93 | void usb_host_port_power(int port, int power) | 120 | static void usb_host_port_power(int port, int power) |
94 | { | 121 | { |
95 | if (!power) /* only power-on supported for now */ | 122 | if (!power) /* only power-on supported for now */ |
96 | return; | 123 | return; |
@@ -112,8 +139,7 @@ static struct resource usb_host_resources[] = { | |||
112 | .flags = IORESOURCE_MEM, | 139 | .flags = IORESOURCE_MEM, |
113 | }, | 140 | }, |
114 | [1] = { | 141 | [1] = { |
115 | .start = 65, | 142 | .start = evt2irq(0x0a20), /* USBHS_USHI0 */ |
116 | .end = 65, | ||
117 | .flags = IORESOURCE_IRQ, | 143 | .flags = IORESOURCE_IRQ, |
118 | }, | 144 | }, |
119 | }; | 145 | }; |
@@ -154,7 +180,7 @@ static struct resource keysc_resources[] = { | |||
154 | .flags = IORESOURCE_MEM, | 180 | .flags = IORESOURCE_MEM, |
155 | }, | 181 | }, |
156 | [1] = { | 182 | [1] = { |
157 | .start = 79, | 183 | .start = evt2irq(0x0be0), /* KEYSC_KEY */ |
158 | .flags = IORESOURCE_IRQ, | 184 | .flags = IORESOURCE_IRQ, |
159 | }, | 185 | }, |
160 | }; | 186 | }; |
@@ -169,10 +195,53 @@ static struct platform_device keysc_device = { | |||
169 | }, | 195 | }, |
170 | }; | 196 | }; |
171 | 197 | ||
198 | /* SDHI */ | ||
199 | static struct resource sdhi0_resources[] = { | ||
200 | [0] = { | ||
201 | .name = "SDHI0", | ||
202 | .start = 0xe6d50000, | ||
203 | .end = 0xe6d501ff, | ||
204 | .flags = IORESOURCE_MEM, | ||
205 | }, | ||
206 | [1] = { | ||
207 | .start = evt2irq(0x0e00), /* SDHI0 */ | ||
208 | .flags = IORESOURCE_IRQ, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | static struct platform_device sdhi0_device = { | ||
213 | .name = "sh_mobile_sdhi", | ||
214 | .num_resources = ARRAY_SIZE(sdhi0_resources), | ||
215 | .resource = sdhi0_resources, | ||
216 | .id = 0, | ||
217 | }; | ||
218 | |||
219 | static struct resource sdhi1_resources[] = { | ||
220 | [0] = { | ||
221 | .name = "SDHI1", | ||
222 | .start = 0xe6d60000, | ||
223 | .end = 0xe6d601ff, | ||
224 | .flags = IORESOURCE_MEM, | ||
225 | }, | ||
226 | [1] = { | ||
227 | .start = evt2irq(0x0e80), /* SDHI1 */ | ||
228 | .flags = IORESOURCE_IRQ, | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | static struct platform_device sdhi1_device = { | ||
233 | .name = "sh_mobile_sdhi", | ||
234 | .num_resources = ARRAY_SIZE(sdhi1_resources), | ||
235 | .resource = sdhi1_resources, | ||
236 | .id = 1, | ||
237 | }; | ||
238 | |||
172 | static struct platform_device *g4evm_devices[] __initdata = { | 239 | static struct platform_device *g4evm_devices[] __initdata = { |
173 | &nor_flash_device, | 240 | &nor_flash_device, |
174 | &usb_host_device, | 241 | &usb_host_device, |
175 | &keysc_device, | 242 | &keysc_device, |
243 | &sdhi0_device, | ||
244 | &sdhi1_device, | ||
176 | }; | 245 | }; |
177 | 246 | ||
178 | static struct map_desc g4evm_io_desc[] __initdata = { | 247 | static struct map_desc g4evm_io_desc[] __initdata = { |
@@ -191,12 +260,41 @@ static void __init g4evm_map_io(void) | |||
191 | { | 260 | { |
192 | iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc)); | 261 | iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc)); |
193 | 262 | ||
194 | /* setup early devices, clocks and console here as well */ | 263 | /* setup early devices and console here as well */ |
195 | sh7377_add_early_devices(); | 264 | sh7377_add_early_devices(); |
196 | sh7367_clock_init(); /* use g3 clocks for now */ | ||
197 | shmobile_setup_console(); | 265 | shmobile_setup_console(); |
198 | } | 266 | } |
199 | 267 | ||
268 | #define GPIO_SDHID0_D0 0xe60520fc | ||
269 | #define GPIO_SDHID0_D1 0xe60520fd | ||
270 | #define GPIO_SDHID0_D2 0xe60520fe | ||
271 | #define GPIO_SDHID0_D3 0xe60520ff | ||
272 | #define GPIO_SDHICMD0 0xe6052100 | ||
273 | |||
274 | #define GPIO_SDHID1_D0 0xe6052103 | ||
275 | #define GPIO_SDHID1_D1 0xe6052104 | ||
276 | #define GPIO_SDHID1_D2 0xe6052105 | ||
277 | #define GPIO_SDHID1_D3 0xe6052106 | ||
278 | #define GPIO_SDHICMD1 0xe6052107 | ||
279 | |||
280 | /* | ||
281 | * FIXME !! | ||
282 | * | ||
283 | * gpio_pull_up is quick_hack. | ||
284 | * | ||
285 | * current gpio frame work doesn't have | ||
286 | * the method to control only pull up/down/free. | ||
287 | * this function should be replaced by correct gpio function | ||
288 | */ | ||
289 | static void __init gpio_pull_up(u32 addr) | ||
290 | { | ||
291 | u8 data = __raw_readb(addr); | ||
292 | |||
293 | data &= 0x0F; | ||
294 | data |= 0xC0; | ||
295 | __raw_writeb(data, addr); | ||
296 | } | ||
297 | |||
200 | static void __init g4evm_init(void) | 298 | static void __init g4evm_init(void) |
201 | { | 299 | { |
202 | sh7377_pinmux_init(); | 300 | sh7377_pinmux_init(); |
@@ -229,9 +327,6 @@ static void __init g4evm_init(void) | |||
229 | gpio_request(GPIO_FN_EXTLP, NULL); | 327 | gpio_request(GPIO_FN_EXTLP, NULL); |
230 | gpio_request(GPIO_FN_IDIN, NULL); | 328 | gpio_request(GPIO_FN_IDIN, NULL); |
231 | 329 | ||
232 | /* enable clock in SMSTPCR3 */ | ||
233 | __raw_writel(__raw_readl(0xe615013c) & ~(1 << 22), 0xe615013c); | ||
234 | |||
235 | /* setup USB phy */ | 330 | /* setup USB phy */ |
236 | __raw_writew(0x0200, 0xe605810a); /* USBCR1 */ | 331 | __raw_writew(0x0200, 0xe605810a); /* USBCR1 */ |
237 | __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */ | 332 | __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */ |
@@ -253,16 +348,54 @@ static void __init g4evm_init(void) | |||
253 | gpio_request(GPIO_FN_PORT71_KEYIN5_PU, NULL); | 348 | gpio_request(GPIO_FN_PORT71_KEYIN5_PU, NULL); |
254 | gpio_request(GPIO_FN_PORT72_KEYIN6_PU, NULL); | 349 | gpio_request(GPIO_FN_PORT72_KEYIN6_PU, NULL); |
255 | 350 | ||
351 | /* SDHI0 */ | ||
352 | gpio_request(GPIO_FN_SDHICLK0, NULL); | ||
353 | gpio_request(GPIO_FN_SDHICD0, NULL); | ||
354 | gpio_request(GPIO_FN_SDHID0_0, NULL); | ||
355 | gpio_request(GPIO_FN_SDHID0_1, NULL); | ||
356 | gpio_request(GPIO_FN_SDHID0_2, NULL); | ||
357 | gpio_request(GPIO_FN_SDHID0_3, NULL); | ||
358 | gpio_request(GPIO_FN_SDHICMD0, NULL); | ||
359 | gpio_request(GPIO_FN_SDHIWP0, NULL); | ||
360 | gpio_pull_up(GPIO_SDHID0_D0); | ||
361 | gpio_pull_up(GPIO_SDHID0_D1); | ||
362 | gpio_pull_up(GPIO_SDHID0_D2); | ||
363 | gpio_pull_up(GPIO_SDHID0_D3); | ||
364 | gpio_pull_up(GPIO_SDHICMD0); | ||
365 | |||
366 | /* SDHI1 */ | ||
367 | gpio_request(GPIO_FN_SDHICLK1, NULL); | ||
368 | gpio_request(GPIO_FN_SDHID1_0, NULL); | ||
369 | gpio_request(GPIO_FN_SDHID1_1, NULL); | ||
370 | gpio_request(GPIO_FN_SDHID1_2, NULL); | ||
371 | gpio_request(GPIO_FN_SDHID1_3, NULL); | ||
372 | gpio_request(GPIO_FN_SDHICMD1, NULL); | ||
373 | gpio_pull_up(GPIO_SDHID1_D0); | ||
374 | gpio_pull_up(GPIO_SDHID1_D1); | ||
375 | gpio_pull_up(GPIO_SDHID1_D2); | ||
376 | gpio_pull_up(GPIO_SDHID1_D3); | ||
377 | gpio_pull_up(GPIO_SDHICMD1); | ||
378 | |||
256 | sh7377_add_standard_devices(); | 379 | sh7377_add_standard_devices(); |
257 | 380 | ||
258 | platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); | 381 | platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); |
259 | } | 382 | } |
260 | 383 | ||
384 | static void __init g4evm_timer_init(void) | ||
385 | { | ||
386 | sh7377_clock_init(); | ||
387 | shmobile_timer.init(); | ||
388 | } | ||
389 | |||
390 | static struct sys_timer g4evm_timer = { | ||
391 | .init = g4evm_timer_init, | ||
392 | }; | ||
393 | |||
261 | MACHINE_START(G4EVM, "g4evm") | 394 | MACHINE_START(G4EVM, "g4evm") |
262 | .phys_io = 0xe6000000, | 395 | .phys_io = 0xe6000000, |
263 | .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc, | 396 | .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc, |
264 | .map_io = g4evm_map_io, | 397 | .map_io = g4evm_map_io, |
265 | .init_irq = sh7377_init_irq, | 398 | .init_irq = sh7377_init_irq, |
266 | .init_machine = g4evm_init, | 399 | .init_machine = g4evm_init, |
267 | .timer = &shmobile_timer, | 400 | .timer = &g4evm_timer, |
268 | MACHINE_END | 401 | MACHINE_END |