diff options
Diffstat (limited to 'arch/sh/boards/mach-se')
-rw-r--r-- | arch/sh/boards/mach-se/7206/io.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-se/7724/setup.c | 148 |
2 files changed, 145 insertions, 5 deletions
diff --git a/arch/sh/boards/mach-se/7206/io.c b/arch/sh/boards/mach-se/7206/io.c index 9c3a33210d61..180455642a43 100644 --- a/arch/sh/boards/mach-se/7206/io.c +++ b/arch/sh/boards/mach-se/7206/io.c | |||
@@ -50,7 +50,7 @@ unsigned char se7206_inb_p(unsigned long port) | |||
50 | 50 | ||
51 | unsigned short se7206_inw(unsigned long port) | 51 | unsigned short se7206_inw(unsigned long port) |
52 | { | 52 | { |
53 | return *port2adr(port);; | 53 | return *port2adr(port); |
54 | } | 54 | } |
55 | 55 | ||
56 | void se7206_outb(unsigned char value, unsigned long port) | 56 | void se7206_outb(unsigned char value, unsigned long port) |
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 9cd04bd558b8..8fed45a2fb85 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
@@ -19,10 +19,13 @@ | |||
19 | #include <linux/smc91x.h> | 19 | #include <linux/smc91x.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/usb/r8a66597.h> | ||
22 | #include <video/sh_mobile_lcdc.h> | 23 | #include <video/sh_mobile_lcdc.h> |
23 | #include <media/sh_mobile_ceu.h> | 24 | #include <media/sh_mobile_ceu.h> |
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/heartbeat.h> | 26 | #include <asm/heartbeat.h> |
27 | #include <asm/sh_eth.h> | ||
28 | #include <asm/clock.h> | ||
26 | #include <asm/sh_keysc.h> | 29 | #include <asm/sh_keysc.h> |
27 | #include <cpu/sh7724.h> | 30 | #include <cpu/sh7724.h> |
28 | #include <mach-se/mach/se7724.h> | 31 | #include <mach-se/mach/se7724.h> |
@@ -272,6 +275,62 @@ static struct platform_device keysc_device = { | |||
272 | }, | 275 | }, |
273 | }; | 276 | }; |
274 | 277 | ||
278 | /* SH Eth */ | ||
279 | static struct resource sh_eth_resources[] = { | ||
280 | [0] = { | ||
281 | .start = SH_ETH_ADDR, | ||
282 | .end = SH_ETH_ADDR + 0x1FC, | ||
283 | .flags = IORESOURCE_MEM, | ||
284 | }, | ||
285 | [1] = { | ||
286 | .start = 91, | ||
287 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | ||
288 | }, | ||
289 | }; | ||
290 | |||
291 | struct sh_eth_plat_data sh_eth_plat = { | ||
292 | .phy = 0x1f, /* SMSC LAN8187 */ | ||
293 | .edmac_endian = EDMAC_LITTLE_ENDIAN, | ||
294 | }; | ||
295 | |||
296 | static struct platform_device sh_eth_device = { | ||
297 | .name = "sh-eth", | ||
298 | .id = 0, | ||
299 | .dev = { | ||
300 | .platform_data = &sh_eth_plat, | ||
301 | }, | ||
302 | .num_resources = ARRAY_SIZE(sh_eth_resources), | ||
303 | .resource = sh_eth_resources, | ||
304 | }; | ||
305 | |||
306 | static struct r8a66597_platdata sh7724_usb0_host_data = { | ||
307 | }; | ||
308 | |||
309 | static struct resource sh7724_usb0_host_resources[] = { | ||
310 | [0] = { | ||
311 | .start = 0xa4d80000, | ||
312 | .end = 0xa4d800ff, | ||
313 | .flags = IORESOURCE_MEM, | ||
314 | }, | ||
315 | [1] = { | ||
316 | .start = 65, | ||
317 | .end = 65, | ||
318 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
319 | }, | ||
320 | }; | ||
321 | |||
322 | static struct platform_device sh7724_usb0_host_device = { | ||
323 | .name = "r8a66597_hcd", | ||
324 | .id = 0, | ||
325 | .dev = { | ||
326 | .dma_mask = NULL, /* not use dma */ | ||
327 | .coherent_dma_mask = 0xffffffff, | ||
328 | .platform_data = &sh7724_usb0_host_data, | ||
329 | }, | ||
330 | .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources), | ||
331 | .resource = sh7724_usb0_host_resources, | ||
332 | }; | ||
333 | |||
275 | static struct platform_device *ms7724se_devices[] __initdata = { | 334 | static struct platform_device *ms7724se_devices[] __initdata = { |
276 | &heartbeat_device, | 335 | &heartbeat_device, |
277 | &smc91x_eth_device, | 336 | &smc91x_eth_device, |
@@ -280,11 +339,62 @@ static struct platform_device *ms7724se_devices[] __initdata = { | |||
280 | &ceu0_device, | 339 | &ceu0_device, |
281 | &ceu1_device, | 340 | &ceu1_device, |
282 | &keysc_device, | 341 | &keysc_device, |
342 | &sh_eth_device, | ||
343 | &sh7724_usb0_host_device, | ||
283 | }; | 344 | }; |
284 | 345 | ||
346 | #define EEPROM_OP 0xBA206000 | ||
347 | #define EEPROM_ADR 0xBA206004 | ||
348 | #define EEPROM_DATA 0xBA20600C | ||
349 | #define EEPROM_STAT 0xBA206010 | ||
350 | #define EEPROM_STRT 0xBA206014 | ||
351 | static int __init sh_eth_is_eeprom_ready(void) | ||
352 | { | ||
353 | int t = 10000; | ||
354 | |||
355 | while (t--) { | ||
356 | if (!ctrl_inw(EEPROM_STAT)) | ||
357 | return 1; | ||
358 | cpu_relax(); | ||
359 | } | ||
360 | |||
361 | printk(KERN_ERR "ms7724se can not access to eeprom\n"); | ||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | static void __init sh_eth_init(void) | ||
366 | { | ||
367 | int i; | ||
368 | u16 mac[3]; | ||
369 | |||
370 | /* check EEPROM status */ | ||
371 | if (!sh_eth_is_eeprom_ready()) | ||
372 | return; | ||
373 | |||
374 | /* read MAC addr from EEPROM */ | ||
375 | for (i = 0 ; i < 3 ; i++) { | ||
376 | ctrl_outw(0x0, EEPROM_OP); /* read */ | ||
377 | ctrl_outw(i*2, EEPROM_ADR); | ||
378 | ctrl_outw(0x1, EEPROM_STRT); | ||
379 | if (!sh_eth_is_eeprom_ready()) | ||
380 | return; | ||
381 | |||
382 | mac[i] = ctrl_inw(EEPROM_DATA); | ||
383 | mac[i] = ((mac[i] & 0xFF) << 8) | (mac[i] >> 8); /* swap */ | ||
384 | } | ||
385 | |||
386 | /* reset sh-eth */ | ||
387 | ctrl_outl(0x1, SH_ETH_ADDR + 0x0); | ||
388 | |||
389 | /* set MAC addr */ | ||
390 | ctrl_outl(((mac[0] << 16) | (mac[1])), SH_ETH_MAHR); | ||
391 | ctrl_outl((mac[2]), SH_ETH_MALR); | ||
392 | } | ||
393 | |||
285 | #define SW4140 0xBA201000 | 394 | #define SW4140 0xBA201000 |
286 | #define FPGA_OUT 0xBA200400 | 395 | #define FPGA_OUT 0xBA200400 |
287 | #define PORT_HIZA 0xA4050158 | 396 | #define PORT_HIZA 0xA4050158 |
397 | #define PORT_MSELCRB 0xA4050182 | ||
288 | 398 | ||
289 | #define SW41_A 0x0100 | 399 | #define SW41_A 0x0100 |
290 | #define SW41_B 0x0200 | 400 | #define SW41_B 0x0200 |
@@ -294,6 +404,7 @@ static struct platform_device *ms7724se_devices[] __initdata = { | |||
294 | #define SW41_F 0x2000 | 404 | #define SW41_F 0x2000 |
295 | #define SW41_G 0x4000 | 405 | #define SW41_G 0x4000 |
296 | #define SW41_H 0x8000 | 406 | #define SW41_H 0x8000 |
407 | |||
297 | static int __init devices_setup(void) | 408 | static int __init devices_setup(void) |
298 | { | 409 | { |
299 | u16 sw = ctrl_inw(SW4140); /* select camera, monitor */ | 410 | u16 sw = ctrl_inw(SW4140); /* select camera, monitor */ |
@@ -302,9 +413,16 @@ static int __init devices_setup(void) | |||
302 | ctrl_outw(ctrl_inw(FPGA_OUT) & | 413 | ctrl_outw(ctrl_inw(FPGA_OUT) & |
303 | ~((1 << 1) | /* LAN */ | 414 | ~((1 << 1) | /* LAN */ |
304 | (1 << 6) | /* VIDEO DAC */ | 415 | (1 << 6) | /* VIDEO DAC */ |
305 | (1 << 12)), /* USB0 */ | 416 | (1 << 12) | /* USB0 */ |
417 | (1 << 14)), /* RMII */ | ||
306 | FPGA_OUT); | 418 | FPGA_OUT); |
307 | 419 | ||
420 | /* turn on USB clocks, use external clock */ | ||
421 | ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB); | ||
422 | |||
423 | /* enable USB0 port */ | ||
424 | ctrl_outw(0x0600, 0xa40501d4); | ||
425 | |||
308 | /* enable IRQ 0,1,2 */ | 426 | /* enable IRQ 0,1,2 */ |
309 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); | 427 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); |
310 | gpio_request(GPIO_FN_INTC_IRQ1, NULL); | 428 | gpio_request(GPIO_FN_INTC_IRQ1, NULL); |
@@ -374,7 +492,7 @@ static int __init devices_setup(void) | |||
374 | gpio_request(GPIO_FN_VIO0_CLK, NULL); | 492 | gpio_request(GPIO_FN_VIO0_CLK, NULL); |
375 | gpio_request(GPIO_FN_VIO0_FLD, NULL); | 493 | gpio_request(GPIO_FN_VIO0_FLD, NULL); |
376 | gpio_request(GPIO_FN_VIO0_HD, NULL); | 494 | gpio_request(GPIO_FN_VIO0_HD, NULL); |
377 | platform_resource_setup_memory(&ceu0_device, "ceu", 4 << 20); | 495 | platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20); |
378 | 496 | ||
379 | /* enable CEU1 */ | 497 | /* enable CEU1 */ |
380 | gpio_request(GPIO_FN_VIO1_D7, NULL); | 498 | gpio_request(GPIO_FN_VIO1_D7, NULL); |
@@ -389,7 +507,7 @@ static int __init devices_setup(void) | |||
389 | gpio_request(GPIO_FN_VIO1_HD, NULL); | 507 | gpio_request(GPIO_FN_VIO1_HD, NULL); |
390 | gpio_request(GPIO_FN_VIO1_VD, NULL); | 508 | gpio_request(GPIO_FN_VIO1_VD, NULL); |
391 | gpio_request(GPIO_FN_VIO1_CLK, NULL); | 509 | gpio_request(GPIO_FN_VIO1_CLK, NULL); |
392 | platform_resource_setup_memory(&ceu1_device, "ceu", 4 << 20); | 510 | platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20); |
393 | 511 | ||
394 | /* KEYSC */ | 512 | /* KEYSC */ |
395 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); | 513 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); |
@@ -404,6 +522,28 @@ static int __init devices_setup(void) | |||
404 | gpio_request(GPIO_FN_KEYOUT1, NULL); | 522 | gpio_request(GPIO_FN_KEYOUT1, NULL); |
405 | gpio_request(GPIO_FN_KEYOUT0, NULL); | 523 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
406 | 524 | ||
525 | /* | ||
526 | * enable SH-Eth | ||
527 | * | ||
528 | * please remove J33 pin from your board !! | ||
529 | * | ||
530 | * ms7724 board should not use GPIO_FN_LNKSTA pin | ||
531 | * So, This time PTX5 is set to input pin | ||
532 | */ | ||
533 | gpio_request(GPIO_FN_RMII_RXD0, NULL); | ||
534 | gpio_request(GPIO_FN_RMII_RXD1, NULL); | ||
535 | gpio_request(GPIO_FN_RMII_TXD0, NULL); | ||
536 | gpio_request(GPIO_FN_RMII_TXD1, NULL); | ||
537 | gpio_request(GPIO_FN_RMII_REF_CLK, NULL); | ||
538 | gpio_request(GPIO_FN_RMII_TX_EN, NULL); | ||
539 | gpio_request(GPIO_FN_RMII_RX_ER, NULL); | ||
540 | gpio_request(GPIO_FN_RMII_CRS_DV, NULL); | ||
541 | gpio_request(GPIO_FN_MDIO, NULL); | ||
542 | gpio_request(GPIO_FN_MDC, NULL); | ||
543 | gpio_request(GPIO_PTX5, NULL); | ||
544 | gpio_direction_input(GPIO_PTX5); | ||
545 | sh_eth_init(); | ||
546 | |||
407 | if (sw & SW41_B) { | 547 | if (sw & SW41_B) { |
408 | /* SVGA */ | 548 | /* SVGA */ |
409 | lcdc_info.ch[0].lcd_cfg.xres = 800; | 549 | lcdc_info.ch[0].lcd_cfg.xres = 800; |
@@ -437,7 +577,7 @@ static int __init devices_setup(void) | |||
437 | } | 577 | } |
438 | 578 | ||
439 | return platform_add_devices(ms7724se_devices, | 579 | return platform_add_devices(ms7724se_devices, |
440 | ARRAY_SIZE(ms7724se_devices)); | 580 | ARRAY_SIZE(ms7724se_devices)); |
441 | } | 581 | } |
442 | device_initcall(devices_setup); | 582 | device_initcall(devices_setup); |
443 | 583 | ||