aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-12-11 20:12:17 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-11 20:12:17 -0500
commit501706565b2d4d2d40d0d301d5411ede099b8a6f (patch)
tree142a18bf1f1e74a09dbfa27540b893ade0fd797d /arch/sh/boards
parente93737b0f0159a61772894943199fd3b6f315641 (diff)
parent2fe77b81c77eed92c4c0439f74c8148a295b4a86 (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts: include/net/tcp.h
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/Makefile1
-rw-r--r--arch/sh/boards/mach-ap325rxa/Makefile2
-rw-r--r--arch/sh/boards/mach-ap325rxa/sdram.S69
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c (renamed from arch/sh/boards/board-ap325rxa.c)97
-rw-r--r--arch/sh/boards/mach-ecovec24/Makefile2
-rw-r--r--arch/sh/boards/mach-ecovec24/sdram.S52
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c197
-rw-r--r--arch/sh/boards/mach-highlander/setup.c2
-rw-r--r--arch/sh/boards/mach-kfr2r09/Makefile2
-rw-r--r--arch/sh/boards/mach-kfr2r09/sdram.S80
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c238
-rw-r--r--arch/sh/boards/mach-migor/Makefile2
-rw-r--r--arch/sh/boards/mach-migor/sdram.S69
-rw-r--r--arch/sh/boards/mach-migor/setup.c65
-rw-r--r--arch/sh/boards/mach-r2d/irq.c2
-rw-r--r--arch/sh/boards/mach-se/7722/irq.c32
-rw-r--r--arch/sh/boards/mach-se/7722/setup.c17
-rw-r--r--arch/sh/boards/mach-se/7724/Makefile2
-rw-r--r--arch/sh/boards/mach-se/7724/sdram.S52
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c96
20 files changed, 939 insertions, 140 deletions
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
index 7baa21090231..ce0f26381784 100644
--- a/arch/sh/boards/Makefile
+++ b/arch/sh/boards/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Specific board support, not covered by a mach group. 2# Specific board support, not covered by a mach group.
3# 3#
4obj-$(CONFIG_SH_AP325RXA) += board-ap325rxa.o
5obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o 4obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
6obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o 5obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
7obj-$(CONFIG_SH_URQUELL) += board-urquell.o 6obj-$(CONFIG_SH_URQUELL) += board-urquell.o
diff --git a/arch/sh/boards/mach-ap325rxa/Makefile b/arch/sh/boards/mach-ap325rxa/Makefile
new file mode 100644
index 000000000000..4cf1774d2613
--- /dev/null
+++ b/arch/sh/boards/mach-ap325rxa/Makefile
@@ -0,0 +1,2 @@
1obj-y := setup.o sdram.o
2
diff --git a/arch/sh/boards/mach-ap325rxa/sdram.S b/arch/sh/boards/mach-ap325rxa/sdram.S
new file mode 100644
index 000000000000..db24fbed4fca
--- /dev/null
+++ b/arch/sh/boards/mach-ap325rxa/sdram.S
@@ -0,0 +1,69 @@
1/*
2 * AP325RXA sdram self/auto-refresh setup code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/sys.h>
12#include <linux/errno.h>
13#include <linux/linkage.h>
14#include <asm/asm-offsets.h>
15#include <asm/suspend.h>
16#include <asm/romimage-macros.h>
17
18/* code to enter and leave self-refresh. must be self-contained.
19 * this code will be copied to on-chip memory and executed from there.
20 */
21 .balign 4
22ENTRY(ap325rxa_sdram_enter_start)
23
24 /* SBSC: disable power down and put in self-refresh mode */
25 mov.l 1f, r4
26 mov.l 2f, r1
27 mov.l @r4, r2
28 or r1, r2
29 mov.l 3f, r3
30 and r3, r2
31 mov.l r2, @r4
32
33 rts
34 nop
35
36 .balign 4
371: .long 0xfe400008 /* SDCR0 */
382: .long 0x00000400
393: .long 0xffff7fff
40ENTRY(ap325rxa_sdram_enter_end)
41
42 .balign 4
43ENTRY(ap325rxa_sdram_leave_start)
44
45 /* SBSC: set auto-refresh mode */
46 mov.l 1f, r4
47 mov.l @r4, r0
48 mov.l 4f, r1
49 and r1, r0
50 mov.l r0, @r4
51 mov.l 6f, r4
52 mov.l 8f, r0
53 mov.l @r4, r1
54 mov #-1, r4
55 add r4, r1
56 or r1, r0
57 mov.l 7f, r1
58 mov.l r0, @r1
59
60 rts
61 nop
62
63 .balign 4
641: .long 0xfe400008 /* SDCR0 */
654: .long 0xfffffbff
666: .long 0xfe40001c /* RTCOR */
677: .long 0xfe400018 /* RTCNT */
688: .long 0xa55a0000
69ENTRY(ap325rxa_sdram_leave_end)
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 2d080732a964..cf9dc12dfeb1 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -20,8 +20,6 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/spi/spi.h>
24#include <linux/spi/spi_gpio.h>
25#include <media/ov772x.h> 23#include <media/ov772x.h>
26#include <media/soc_camera.h> 24#include <media/soc_camera.h>
27#include <media/soc_camera_platform.h> 25#include <media/soc_camera_platform.h>
@@ -29,6 +27,7 @@
29#include <video/sh_mobile_lcdc.h> 27#include <video/sh_mobile_lcdc.h>
30#include <asm/io.h> 28#include <asm/io.h>
31#include <asm/clock.h> 29#include <asm/clock.h>
30#include <asm/suspend.h>
32#include <cpu/sh7723.h> 31#include <cpu/sh7723.h>
33 32
34static struct smsc911x_platform_config smsc911x_config = { 33static struct smsc911x_platform_config smsc911x_config = {
@@ -409,17 +408,49 @@ static struct platform_device ceu_device = {
409 }, 408 },
410}; 409};
411 410
412struct spi_gpio_platform_data sdcard_cn3_platform_data = { 411static struct resource sdhi0_cn3_resources[] = {
413 .sck = GPIO_PTD0, 412 [0] = {
414 .mosi = GPIO_PTD1, 413 .name = "SDHI0",
415 .miso = GPIO_PTD2, 414 .start = 0x04ce0000,
416 .num_chipselect = 1, 415 .end = 0x04ce01ff,
416 .flags = IORESOURCE_MEM,
417 },
418 [1] = {
419 .start = 101,
420 .flags = IORESOURCE_IRQ,
421 },
417}; 422};
418 423
419static struct platform_device sdcard_cn3_device = { 424static struct platform_device sdhi0_cn3_device = {
420 .name = "spi_gpio", 425 .name = "sh_mobile_sdhi",
421 .dev = { 426 .id = 0, /* "sdhi0" clock */
422 .platform_data = &sdcard_cn3_platform_data, 427 .num_resources = ARRAY_SIZE(sdhi0_cn3_resources),
428 .resource = sdhi0_cn3_resources,
429 .archdata = {
430 .hwblk_id = HWBLK_SDHI0,
431 },
432};
433
434static struct resource sdhi1_cn7_resources[] = {
435 [0] = {
436 .name = "SDHI1",
437 .start = 0x04cf0000,
438 .end = 0x04cf01ff,
439 .flags = IORESOURCE_MEM,
440 },
441 [1] = {
442 .start = 24,
443 .flags = IORESOURCE_IRQ,
444 },
445};
446
447static struct platform_device sdhi1_cn7_device = {
448 .name = "sh_mobile_sdhi",
449 .id = 1, /* "sdhi1" clock */
450 .num_resources = ARRAY_SIZE(sdhi1_cn7_resources),
451 .resource = sdhi1_cn7_resources,
452 .archdata = {
453 .hwblk_id = HWBLK_SDHI1,
423 }, 454 },
424}; 455};
425 456
@@ -470,22 +501,26 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
470 &lcdc_device, 501 &lcdc_device,
471 &ceu_device, 502 &ceu_device,
472 &nand_flash_device, 503 &nand_flash_device,
473 &sdcard_cn3_device, 504 &sdhi0_cn3_device,
505 &sdhi1_cn7_device,
474 &ap325rxa_camera[0], 506 &ap325rxa_camera[0],
475 &ap325rxa_camera[1], 507 &ap325rxa_camera[1],
476}; 508};
477 509
478static struct spi_board_info ap325rxa_spi_devices[] = { 510extern char ap325rxa_sdram_enter_start;
479 { 511extern char ap325rxa_sdram_enter_end;
480 .modalias = "mmc_spi", 512extern char ap325rxa_sdram_leave_start;
481 .max_speed_hz = 5000000, 513extern char ap325rxa_sdram_leave_end;
482 .chip_select = 0,
483 .controller_data = (void *) GPIO_PTD5,
484 },
485};
486 514
487static int __init ap325rxa_devices_setup(void) 515static int __init ap325rxa_devices_setup(void)
488{ 516{
517 /* register board specific self-refresh code */
518 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
519 &ap325rxa_sdram_enter_start,
520 &ap325rxa_sdram_enter_end,
521 &ap325rxa_sdram_leave_start,
522 &ap325rxa_sdram_leave_end);
523
489 /* LD3 and LD4 LEDs */ 524 /* LD3 and LD4 LEDs */
490 gpio_request(GPIO_PTX5, NULL); /* RUN */ 525 gpio_request(GPIO_PTX5, NULL); /* RUN */
491 gpio_direction_output(GPIO_PTX5, 1); 526 gpio_direction_output(GPIO_PTX5, 1);
@@ -578,12 +613,28 @@ static int __init ap325rxa_devices_setup(void)
578 613
579 platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20); 614 platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);
580 615
616 /* SDHI0 - CN3 - SD CARD */
617 gpio_request(GPIO_FN_SDHI0CD_PTD, NULL);
618 gpio_request(GPIO_FN_SDHI0WP_PTD, NULL);
619 gpio_request(GPIO_FN_SDHI0D3_PTD, NULL);
620 gpio_request(GPIO_FN_SDHI0D2_PTD, NULL);
621 gpio_request(GPIO_FN_SDHI0D1_PTD, NULL);
622 gpio_request(GPIO_FN_SDHI0D0_PTD, NULL);
623 gpio_request(GPIO_FN_SDHI0CMD_PTD, NULL);
624 gpio_request(GPIO_FN_SDHI0CLK_PTD, NULL);
625
626 /* SDHI1 - CN7 - MICRO SD CARD */
627 gpio_request(GPIO_FN_SDHI1CD, NULL);
628 gpio_request(GPIO_FN_SDHI1D3, NULL);
629 gpio_request(GPIO_FN_SDHI1D2, NULL);
630 gpio_request(GPIO_FN_SDHI1D1, NULL);
631 gpio_request(GPIO_FN_SDHI1D0, NULL);
632 gpio_request(GPIO_FN_SDHI1CMD, NULL);
633 gpio_request(GPIO_FN_SDHI1CLK, NULL);
634
581 i2c_register_board_info(0, ap325rxa_i2c_devices, 635 i2c_register_board_info(0, ap325rxa_i2c_devices,
582 ARRAY_SIZE(ap325rxa_i2c_devices)); 636 ARRAY_SIZE(ap325rxa_i2c_devices));
583 637
584 spi_register_board_info(ap325rxa_spi_devices,
585 ARRAY_SIZE(ap325rxa_spi_devices));
586
587 return platform_add_devices(ap325rxa_devices, 638 return platform_add_devices(ap325rxa_devices,
588 ARRAY_SIZE(ap325rxa_devices)); 639 ARRAY_SIZE(ap325rxa_devices));
589} 640}
diff --git a/arch/sh/boards/mach-ecovec24/Makefile b/arch/sh/boards/mach-ecovec24/Makefile
index 51f852151655..e69bc82208fc 100644
--- a/arch/sh/boards/mach-ecovec24/Makefile
+++ b/arch/sh/boards/mach-ecovec24/Makefile
@@ -6,4 +6,4 @@
6# for more details. 6# for more details.
7# 7#
8 8
9obj-y := setup.o \ No newline at end of file 9obj-y := setup.o sdram.o \ No newline at end of file
diff --git a/arch/sh/boards/mach-ecovec24/sdram.S b/arch/sh/boards/mach-ecovec24/sdram.S
new file mode 100644
index 000000000000..833440044407
--- /dev/null
+++ b/arch/sh/boards/mach-ecovec24/sdram.S
@@ -0,0 +1,52 @@
1/*
2 * Ecovec24 sdram self/auto-refresh setup code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/sys.h>
12#include <linux/errno.h>
13#include <linux/linkage.h>
14#include <asm/asm-offsets.h>
15#include <asm/suspend.h>
16#include <asm/romimage-macros.h>
17
18/* code to enter and leave self-refresh. must be self-contained.
19 * this code will be copied to on-chip memory and executed from there.
20 */
21 .balign 4
22ENTRY(ecovec24_sdram_enter_start)
23
24 /* DBSC: put memory in self-refresh mode */
25
26 ED 0xFD000010, 0x00000000 /* DBEN */
27 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
28 ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
29 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
30 ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
31
32 rts
33 nop
34
35ENTRY(ecovec24_sdram_enter_end)
36
37 .balign 4
38ENTRY(ecovec24_sdram_leave_start)
39
40 /* DBSC: put memory in auto-refresh mode */
41
42 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
43 WAIT 1
44 ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
45 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
46 ED 0xFD000010, 0x00000001 /* DBEN */
47 ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
48
49 rts
50 nop
51
52ENTRY(ecovec24_sdram_leave_end)
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 3b1ceb46fa54..826e62326d51 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -20,12 +20,14 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/i2c/tsc2007.h> 21#include <linux/i2c/tsc2007.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/input/sh_keysc.h>
24#include <linux/mfd/sh_mobile_sdhi.h>
23#include <video/sh_mobile_lcdc.h> 25#include <video/sh_mobile_lcdc.h>
24#include <media/sh_mobile_ceu.h> 26#include <media/sh_mobile_ceu.h>
25#include <asm/heartbeat.h> 27#include <asm/heartbeat.h>
26#include <asm/sh_eth.h> 28#include <asm/sh_eth.h>
27#include <asm/sh_keysc.h>
28#include <asm/clock.h> 29#include <asm/clock.h>
30#include <asm/suspend.h>
29#include <cpu/sh7724.h> 31#include <cpu/sh7724.h>
30 32
31/* 33/*
@@ -147,6 +149,9 @@ static struct platform_device sh_eth_device = {
147 }, 149 },
148 .num_resources = ARRAY_SIZE(sh_eth_resources), 150 .num_resources = ARRAY_SIZE(sh_eth_resources),
149 .resource = sh_eth_resources, 151 .resource = sh_eth_resources,
152 .archdata = {
153 .hwblk_id = HWBLK_ETHER,
154 },
150}; 155};
151 156
152/* USB0 host */ 157/* USB0 host */
@@ -185,30 +190,18 @@ static struct platform_device usb0_host_device = {
185 .resource = usb0_host_resources, 190 .resource = usb0_host_resources,
186}; 191};
187 192
188/* 193/* USB1 host/function */
189 * USB1
190 *
191 * CN5 can use both host/function,
192 * and we can determine it by checking PTB[3]
193 *
194 * This time only USB1 host is supported.
195 */
196void usb1_port_power(int port, int power) 194void usb1_port_power(int port, int power)
197{ 195{
198 if (!gpio_get_value(GPIO_PTB3)) {
199 printk(KERN_ERR "USB1 function is not supported\n");
200 return;
201 }
202
203 gpio_set_value(GPIO_PTB5, power); 196 gpio_set_value(GPIO_PTB5, power);
204} 197}
205 198
206static struct r8a66597_platdata usb1_host_data = { 199static struct r8a66597_platdata usb1_common_data = {
207 .on_chip = 1, 200 .on_chip = 1,
208 .port_power = usb1_port_power, 201 .port_power = usb1_port_power,
209}; 202};
210 203
211static struct resource usb1_host_resources[] = { 204static struct resource usb1_common_resources[] = {
212 [0] = { 205 [0] = {
213 .start = 0xa4d90000, 206 .start = 0xa4d90000,
214 .end = 0xa4d90124 - 1, 207 .end = 0xa4d90124 - 1,
@@ -221,16 +214,16 @@ static struct resource usb1_host_resources[] = {
221 }, 214 },
222}; 215};
223 216
224static struct platform_device usb1_host_device = { 217static struct platform_device usb1_common_device = {
225 .name = "r8a66597_hcd", 218 /* .name will be added in arch_setup */
226 .id = 1, 219 .id = 1,
227 .dev = { 220 .dev = {
228 .dma_mask = NULL, /* not use dma */ 221 .dma_mask = NULL, /* not use dma */
229 .coherent_dma_mask = 0xffffffff, 222 .coherent_dma_mask = 0xffffffff,
230 .platform_data = &usb1_host_data, 223 .platform_data = &usb1_common_data,
231 }, 224 },
232 .num_resources = ARRAY_SIZE(usb1_host_resources), 225 .num_resources = ARRAY_SIZE(usb1_common_resources),
233 .resource = usb1_host_resources, 226 .resource = usb1_common_resources,
234}; 227};
235 228
236/* LCDC */ 229/* LCDC */
@@ -428,16 +421,90 @@ static struct i2c_board_info ts_i2c_clients = {
428 .irq = IRQ0, 421 .irq = IRQ0,
429}; 422};
430 423
424/* SHDI0 */
425static void sdhi0_set_pwr(struct platform_device *pdev, int state)
426{
427 gpio_set_value(GPIO_PTB6, state);
428}
429
430static struct sh_mobile_sdhi_info sdhi0_info = {
431 .set_pwr = sdhi0_set_pwr,
432};
433
434static struct resource sdhi0_resources[] = {
435 [0] = {
436 .name = "SDHI0",
437 .start = 0x04ce0000,
438 .end = 0x04ce01ff,
439 .flags = IORESOURCE_MEM,
440 },
441 [1] = {
442 .start = 101,
443 .flags = IORESOURCE_IRQ,
444 },
445};
446
447static struct platform_device sdhi0_device = {
448 .name = "sh_mobile_sdhi",
449 .num_resources = ARRAY_SIZE(sdhi0_resources),
450 .resource = sdhi0_resources,
451 .id = 0,
452 .dev = {
453 .platform_data = &sdhi0_info,
454 },
455 .archdata = {
456 .hwblk_id = HWBLK_SDHI0,
457 },
458};
459
460/* SHDI1 */
461static void sdhi1_set_pwr(struct platform_device *pdev, int state)
462{
463 gpio_set_value(GPIO_PTB7, state);
464}
465
466static struct sh_mobile_sdhi_info sdhi1_info = {
467 .set_pwr = sdhi1_set_pwr,
468};
469
470static struct resource sdhi1_resources[] = {
471 [0] = {
472 .name = "SDHI1",
473 .start = 0x04cf0000,
474 .end = 0x04cf01ff,
475 .flags = IORESOURCE_MEM,
476 },
477 [1] = {
478 .start = 24,
479 .flags = IORESOURCE_IRQ,
480 },
481};
482
483static struct platform_device sdhi1_device = {
484 .name = "sh_mobile_sdhi",
485 .num_resources = ARRAY_SIZE(sdhi1_resources),
486 .resource = sdhi1_resources,
487 .id = 1,
488 .dev = {
489 .platform_data = &sdhi1_info,
490 },
491 .archdata = {
492 .hwblk_id = HWBLK_SDHI1,
493 },
494};
495
431static struct platform_device *ecovec_devices[] __initdata = { 496static struct platform_device *ecovec_devices[] __initdata = {
432 &heartbeat_device, 497 &heartbeat_device,
433 &nor_flash_device, 498 &nor_flash_device,
434 &sh_eth_device, 499 &sh_eth_device,
435 &usb0_host_device, 500 &usb0_host_device,
436 &usb1_host_device, /* USB1 host support */ 501 &usb1_common_device,
437 &lcdc_device, 502 &lcdc_device,
438 &ceu0_device, 503 &ceu0_device,
439 &ceu1_device, 504 &ceu1_device,
440 &keysc_device, 505 &keysc_device,
506 &sdhi0_device,
507 &sdhi1_device,
441}; 508};
442 509
443#define EEPROM_ADDR 0x50 510#define EEPROM_ADDR 0x50
@@ -466,12 +533,9 @@ static u8 mac_read(struct i2c_adapter *a, u8 command)
466 return buf; 533 return buf;
467} 534}
468 535
469#define MAC_LEN 6 536static void __init sh_eth_init(struct sh_eth_plat_data *pd)
470static void __init sh_eth_init(void)
471{ 537{
472 struct i2c_adapter *a = i2c_get_adapter(1); 538 struct i2c_adapter *a = i2c_get_adapter(1);
473 struct clk *eth_clk;
474 u8 mac[MAC_LEN];
475 int i; 539 int i;
476 540
477 if (!a) { 541 if (!a) {
@@ -479,39 +543,30 @@ static void __init sh_eth_init(void)
479 return; 543 return;
480 } 544 }
481 545
482 eth_clk = clk_get(NULL, "eth0");
483 if (!eth_clk) {
484 pr_err("can not get eth0 clk\n");
485 return;
486 }
487
488 /* read MAC address frome EEPROM */ 546 /* read MAC address frome EEPROM */
489 for (i = 0; i < MAC_LEN; i++) { 547 for (i = 0; i < sizeof(pd->mac_addr); i++) {
490 mac[i] = mac_read(a, 0x10 + i); 548 pd->mac_addr[i] = mac_read(a, 0x10 + i);
491 msleep(10); 549 msleep(10);
492 } 550 }
493
494 /* clock enable */
495 clk_enable(eth_clk);
496
497 /* reset sh-eth */
498 ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
499
500 /* set MAC addr */
501 ctrl_outl((mac[0] << 24) |
502 (mac[1] << 16) |
503 (mac[2] << 8) |
504 (mac[3] << 0), SH_ETH_MAHR);
505 ctrl_outl((mac[4] << 8) |
506 (mac[5] << 0), SH_ETH_MALR);
507
508 clk_put(eth_clk);
509} 551}
510 552
511#define PORT_HIZA 0xA4050158 553#define PORT_HIZA 0xA4050158
512#define IODRIVEA 0xA405018A 554#define IODRIVEA 0xA405018A
555
556extern char ecovec24_sdram_enter_start;
557extern char ecovec24_sdram_enter_end;
558extern char ecovec24_sdram_leave_start;
559extern char ecovec24_sdram_leave_end;
560
513static int __init arch_setup(void) 561static int __init arch_setup(void)
514{ 562{
563 /* register board specific self-refresh code */
564 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
565 &ecovec24_sdram_enter_start,
566 &ecovec24_sdram_enter_end,
567 &ecovec24_sdram_leave_start,
568 &ecovec24_sdram_leave_end);
569
515 /* enable STATUS0, STATUS2 and PDSTATUS */ 570 /* enable STATUS0, STATUS2 and PDSTATUS */
516 gpio_request(GPIO_FN_STATUS0, NULL); 571 gpio_request(GPIO_FN_STATUS0, NULL);
517 gpio_request(GPIO_FN_STATUS2, NULL); 572 gpio_request(GPIO_FN_STATUS2, NULL);
@@ -561,6 +616,14 @@ static int __init arch_setup(void)
561 ctrl_outw(0x0600, 0xa40501d4); 616 ctrl_outw(0x0600, 0xa40501d4);
562 ctrl_outw(0x0600, 0xa4050192); 617 ctrl_outw(0x0600, 0xa4050192);
563 618
619 if (gpio_get_value(GPIO_PTB3)) {
620 printk(KERN_INFO "USB1 function is selected\n");
621 usb1_common_device.name = "r8a66597_udc";
622 } else {
623 printk(KERN_INFO "USB1 host is selected\n");
624 usb1_common_device.name = "r8a66597_hcd";
625 }
626
564 /* enable LCDC */ 627 /* enable LCDC */
565 gpio_request(GPIO_FN_LCDD23, NULL); 628 gpio_request(GPIO_FN_LCDD23, NULL);
566 gpio_request(GPIO_FN_LCDD22, NULL); 629 gpio_request(GPIO_FN_LCDD22, NULL);
@@ -603,8 +666,8 @@ static int __init arch_setup(void)
603 gpio_direction_output(GPIO_PTR1, 0); 666 gpio_direction_output(GPIO_PTR1, 0);
604 gpio_direction_output(GPIO_PTA2, 0); 667 gpio_direction_output(GPIO_PTA2, 0);
605 668
606 /* I/O buffer drive ability is low */ 669 /* I/O buffer drive ability is high */
607 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0040 , IODRIVEA); 670 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
608 671
609 if (gpio_get_value(GPIO_PTE6)) { 672 if (gpio_get_value(GPIO_PTE6)) {
610 /* DVI */ 673 /* DVI */
@@ -710,6 +773,33 @@ static int __init arch_setup(void)
710 gpio_direction_input(GPIO_PTR5); 773 gpio_direction_input(GPIO_PTR5);
711 gpio_direction_input(GPIO_PTR6); 774 gpio_direction_input(GPIO_PTR6);
712 775
776 /* enable SDHI0 (needs DS2.4 set to ON) */
777 gpio_request(GPIO_FN_SDHI0CD, NULL);
778 gpio_request(GPIO_FN_SDHI0WP, NULL);
779 gpio_request(GPIO_FN_SDHI0CMD, NULL);
780 gpio_request(GPIO_FN_SDHI0CLK, NULL);
781 gpio_request(GPIO_FN_SDHI0D3, NULL);
782 gpio_request(GPIO_FN_SDHI0D2, NULL);
783 gpio_request(GPIO_FN_SDHI0D1, NULL);
784 gpio_request(GPIO_FN_SDHI0D0, NULL);
785 gpio_request(GPIO_PTB6, NULL);
786 gpio_direction_output(GPIO_PTB6, 0);
787
788 /* enable SDHI1 (needs DS2.6,7 set to ON,OFF) */
789 gpio_request(GPIO_FN_SDHI1CD, NULL);
790 gpio_request(GPIO_FN_SDHI1WP, NULL);
791 gpio_request(GPIO_FN_SDHI1CMD, NULL);
792 gpio_request(GPIO_FN_SDHI1CLK, NULL);
793 gpio_request(GPIO_FN_SDHI1D3, NULL);
794 gpio_request(GPIO_FN_SDHI1D2, NULL);
795 gpio_request(GPIO_FN_SDHI1D1, NULL);
796 gpio_request(GPIO_FN_SDHI1D0, NULL);
797 gpio_request(GPIO_PTB7, NULL);
798 gpio_direction_output(GPIO_PTB7, 0);
799
800 /* I/O buffer drive ability is high for SDHI1 */
801 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
802
713 /* enable I2C device */ 803 /* enable I2C device */
714 i2c_register_board_info(1, i2c1_devices, 804 i2c_register_board_info(1, i2c1_devices,
715 ARRAY_SIZE(i2c1_devices)); 805 ARRAY_SIZE(i2c1_devices));
@@ -721,12 +811,11 @@ arch_initcall(arch_setup);
721 811
722static int __init devices_setup(void) 812static int __init devices_setup(void)
723{ 813{
724 sh_eth_init(); 814 sh_eth_init(&sh_eth_plat);
725 return 0; 815 return 0;
726} 816}
727device_initcall(devices_setup); 817device_initcall(devices_setup);
728 818
729
730static struct sh_machine_vector mv_ecovec __initmv = { 819static struct sh_machine_vector mv_ecovec __initmv = {
731 .mv_name = "R0P7724 (EcoVec)", 820 .mv_name = "R0P7724 (EcoVec)",
732}; 821};
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index 566e69d8d729..f663c14d8885 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -384,7 +384,7 @@ static unsigned char irl2irq[HL_NR_IRL];
384 384
385static int highlander_irq_demux(int irq) 385static int highlander_irq_demux(int irq)
386{ 386{
387 if (irq >= HL_NR_IRL || !irl2irq[irq]) 387 if (irq >= HL_NR_IRL || irq < 0 || !irl2irq[irq])
388 return irq; 388 return irq;
389 389
390 return irl2irq[irq]; 390 return irl2irq[irq];
diff --git a/arch/sh/boards/mach-kfr2r09/Makefile b/arch/sh/boards/mach-kfr2r09/Makefile
index 5d5867826e3b..4e577a3bf658 100644
--- a/arch/sh/boards/mach-kfr2r09/Makefile
+++ b/arch/sh/boards/mach-kfr2r09/Makefile
@@ -1,2 +1,2 @@
1obj-y := setup.o 1obj-y := setup.o sdram.o
2obj-$(CONFIG_FB_SH_MOBILE_LCDC) += lcd_wqvga.o 2obj-$(CONFIG_FB_SH_MOBILE_LCDC) += lcd_wqvga.o
diff --git a/arch/sh/boards/mach-kfr2r09/sdram.S b/arch/sh/boards/mach-kfr2r09/sdram.S
new file mode 100644
index 000000000000..0c9f55bec2fe
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/sdram.S
@@ -0,0 +1,80 @@
1/*
2 * KFR2R09 sdram self/auto-refresh setup code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/sys.h>
12#include <linux/errno.h>
13#include <linux/linkage.h>
14#include <asm/asm-offsets.h>
15#include <asm/suspend.h>
16#include <asm/romimage-macros.h>
17
18/* code to enter and leave self-refresh. must be self-contained.
19 * this code will be copied to on-chip memory and executed from there.
20 */
21 .balign 4
22ENTRY(kfr2r09_sdram_enter_start)
23
24 /* DBSC: put memory in self-refresh mode */
25
26 ED 0xFD000010, 0x00000000 /* DBEN */
27 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
28 ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
29 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
30 ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
31
32 rts
33 nop
34
35ENTRY(kfr2r09_sdram_enter_end)
36
37 .balign 4
38ENTRY(kfr2r09_sdram_leave_start)
39
40 /* DBSC: put memory in auto-refresh mode */
41
42 mov.l @(SH_SLEEP_MODE, r5), r0
43 tst #SUSP_SH_RSTANDBY, r0
44 bf resume_rstandby
45
46 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
47 WAIT 1
48 ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
49 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
50 ED 0xFD000010, 0x00000001 /* DBEN */
51 ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
52
53 rts
54 nop
55
56resume_rstandby:
57
58 /* DBSC: re-initialize and put in auto-refresh */
59
60 ED 0xFD000108, 0x40000301 /* DBPDCNT0 */
61 ED 0xFD000020, 0x011B0002 /* DBCONF */
62 ED 0xFD000030, 0x03060E02 /* DBTR0 */
63 ED 0xFD000034, 0x01020102 /* DBTR1 */
64 ED 0xFD000038, 0x01090406 /* DBTR2 */
65 ED 0xFD000008, 0x00000004 /* DBKIND */
66 ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
67 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
68 ED 0xFD000018, 0x00000001 /* DBCKECNT */
69 WAIT 1
70 ED 0xFD000010, 0x00000001 /* DBEN */
71 ED 0xFD000044, 0x000004AF /* DBRFPDN1 */
72 ED 0xFD000048, 0x20CF0037 /* DBRFPDN2 */
73 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
74 ED 0xFD000108, 0x40000300 /* DBPDCNT0 */
75 ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
76
77 rts
78 nop
79
80ENTRY(kfr2r09_sdram_leave_end)
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index c08d33fe2104..87438d6603d6 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -16,13 +16,16 @@
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/input/sh_keysc.h>
19#include <linux/i2c.h> 20#include <linux/i2c.h>
20#include <linux/usb/r8a66597.h> 21#include <linux/usb/r8a66597.h>
22#include <media/soc_camera.h>
23#include <media/sh_mobile_ceu.h>
21#include <video/sh_mobile_lcdc.h> 24#include <video/sh_mobile_lcdc.h>
25#include <asm/suspend.h>
22#include <asm/clock.h> 26#include <asm/clock.h>
23#include <asm/machvec.h> 27#include <asm/machvec.h>
24#include <asm/io.h> 28#include <asm/io.h>
25#include <asm/sh_keysc.h>
26#include <cpu/sh7724.h> 29#include <cpu/sh7724.h>
27#include <mach/kfr2r09.h> 30#include <mach/kfr2r09.h>
28 31
@@ -212,11 +215,154 @@ static struct platform_device kfr2r09_usb0_gadget_device = {
212 .resource = kfr2r09_usb0_gadget_resources, 215 .resource = kfr2r09_usb0_gadget_resources,
213}; 216};
214 217
218static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
219 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
220};
221
222static struct resource kfr2r09_ceu_resources[] = {
223 [0] = {
224 .name = "CEU",
225 .start = 0xfe910000,
226 .end = 0xfe91009f,
227 .flags = IORESOURCE_MEM,
228 },
229 [1] = {
230 .start = 52,
231 .end = 52,
232 .flags = IORESOURCE_IRQ,
233 },
234 [2] = {
235 /* place holder for contiguous memory */
236 },
237};
238
239static struct platform_device kfr2r09_ceu_device = {
240 .name = "sh_mobile_ceu",
241 .id = 0, /* "ceu0" clock */
242 .num_resources = ARRAY_SIZE(kfr2r09_ceu_resources),
243 .resource = kfr2r09_ceu_resources,
244 .dev = {
245 .platform_data = &sh_mobile_ceu_info,
246 },
247 .archdata = {
248 .hwblk_id = HWBLK_CEU0,
249 },
250};
251
252static struct i2c_board_info kfr2r09_i2c_camera = {
253 I2C_BOARD_INFO("rj54n1cb0c", 0x50),
254};
255
256static struct clk *camera_clk;
257
258#define DRVCRB 0xA405018C
259static int camera_power(struct device *dev, int mode)
260{
261 int ret;
262
263 if (mode) {
264 long rate;
265
266 camera_clk = clk_get(NULL, "video_clk");
267 if (IS_ERR(camera_clk))
268 return PTR_ERR(camera_clk);
269
270 /* set VIO_CKO clock to 25MHz */
271 rate = clk_round_rate(camera_clk, 25000000);
272 ret = clk_set_rate(camera_clk, rate);
273 if (ret < 0)
274 goto eclkrate;
275
276 /* set DRVCRB
277 *
278 * use 1.8 V for VccQ_VIO
279 * use 2.85V for VccQ_SR
280 */
281 ctrl_outw((ctrl_inw(DRVCRB) & ~0x0003) | 0x0001, DRVCRB);
282
283 /* reset clear */
284 ret = gpio_request(GPIO_PTB4, NULL);
285 if (ret < 0)
286 goto eptb4;
287 ret = gpio_request(GPIO_PTB7, NULL);
288 if (ret < 0)
289 goto eptb7;
290
291 ret = gpio_direction_output(GPIO_PTB4, 1);
292 if (!ret)
293 ret = gpio_direction_output(GPIO_PTB7, 1);
294 if (ret < 0)
295 goto egpioout;
296 msleep(1);
297
298 ret = clk_enable(camera_clk); /* start VIO_CKO */
299 if (ret < 0)
300 goto eclkon;
301
302 return 0;
303 }
304
305 ret = 0;
306
307 clk_disable(camera_clk);
308eclkon:
309 gpio_set_value(GPIO_PTB7, 0);
310egpioout:
311 gpio_set_value(GPIO_PTB4, 0);
312 gpio_free(GPIO_PTB7);
313eptb7:
314 gpio_free(GPIO_PTB4);
315eptb4:
316eclkrate:
317 clk_put(camera_clk);
318 return ret;
319}
320
321static struct soc_camera_link rj54n1_link = {
322 .power = camera_power,
323 .board_info = &kfr2r09_i2c_camera,
324 .i2c_adapter_id = 1,
325 .module_name = "rj54n1cb0c",
326};
327
328static struct platform_device kfr2r09_camera = {
329 .name = "soc-camera-pdrv",
330 .id = 0,
331 .dev = {
332 .platform_data = &rj54n1_link,
333 },
334};
335
336static struct resource kfr2r09_sh_sdhi0_resources[] = {
337 [0] = {
338 .name = "SDHI0",
339 .start = 0x04ce0000,
340 .end = 0x04ce01ff,
341 .flags = IORESOURCE_MEM,
342 },
343 [1] = {
344 .start = 101,
345 .flags = IORESOURCE_IRQ,
346 },
347};
348
349static struct platform_device kfr2r09_sh_sdhi0_device = {
350 .name = "sh_mobile_sdhi",
351 .num_resources = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources),
352 .resource = kfr2r09_sh_sdhi0_resources,
353 .archdata = {
354 .hwblk_id = HWBLK_SDHI0,
355 },
356};
357
215static struct platform_device *kfr2r09_devices[] __initdata = { 358static struct platform_device *kfr2r09_devices[] __initdata = {
216 &kfr2r09_nor_flash_device, 359 &kfr2r09_nor_flash_device,
217 &kfr2r09_nand_flash_device, 360 &kfr2r09_nand_flash_device,
218 &kfr2r09_sh_keysc_device, 361 &kfr2r09_sh_keysc_device,
219 &kfr2r09_sh_lcdc_device, 362 &kfr2r09_sh_lcdc_device,
363 &kfr2r09_ceu_device,
364 &kfr2r09_camera,
365 &kfr2r09_sh_sdhi0_device,
220}; 366};
221 367
222#define BSC_CS0BCR 0xfec10004 368#define BSC_CS0BCR 0xfec10004
@@ -268,11 +414,59 @@ static int kfr2r09_usb0_gadget_i2c_setup(void)
268 414
269 return 0; 415 return 0;
270} 416}
417
418static int kfr2r09_serial_i2c_setup(void)
419{
420 struct i2c_adapter *a;
421 struct i2c_msg msg;
422 unsigned char buf[2];
423 int ret;
424
425 a = i2c_get_adapter(0);
426 if (!a)
427 return -ENODEV;
428
429 /* set bit 6 (the 7th bit) of chip at 0x09, register 0x13 */
430 buf[0] = 0x13;
431 msg.addr = 0x09;
432 msg.buf = buf;
433 msg.len = 1;
434 msg.flags = 0;
435 ret = i2c_transfer(a, &msg, 1);
436 if (ret != 1)
437 return -ENODEV;
438
439 buf[0] = 0;
440 msg.addr = 0x09;
441 msg.buf = buf;
442 msg.len = 1;
443 msg.flags = I2C_M_RD;
444 ret = i2c_transfer(a, &msg, 1);
445 if (ret != 1)
446 return -ENODEV;
447
448 buf[1] = buf[0] | (1 << 6);
449 buf[0] = 0x13;
450 msg.addr = 0x09;
451 msg.buf = buf;
452 msg.len = 2;
453 msg.flags = 0;
454 ret = i2c_transfer(a, &msg, 1);
455 if (ret != 1)
456 return -ENODEV;
457
458 return 0;
459}
271#else 460#else
272static int kfr2r09_usb0_gadget_i2c_setup(void) 461static int kfr2r09_usb0_gadget_i2c_setup(void)
273{ 462{
274 return -ENODEV; 463 return -ENODEV;
275} 464}
465
466static int kfr2r09_serial_i2c_setup(void)
467{
468 return -ENODEV;
469}
276#endif 470#endif
277 471
278static int kfr2r09_usb0_gadget_setup(void) 472static int kfr2r09_usb0_gadget_setup(void)
@@ -299,11 +493,27 @@ static int kfr2r09_usb0_gadget_setup(void)
299 return 0; 493 return 0;
300} 494}
301 495
496extern char kfr2r09_sdram_enter_start;
497extern char kfr2r09_sdram_enter_end;
498extern char kfr2r09_sdram_leave_start;
499extern char kfr2r09_sdram_leave_end;
500
302static int __init kfr2r09_devices_setup(void) 501static int __init kfr2r09_devices_setup(void)
303{ 502{
503 /* register board specific self-refresh code */
504 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
505 SUSP_SH_RSTANDBY,
506 &kfr2r09_sdram_enter_start,
507 &kfr2r09_sdram_enter_end,
508 &kfr2r09_sdram_leave_start,
509 &kfr2r09_sdram_leave_end);
510
304 /* enable SCIF1 serial port for YC401 console support */ 511 /* enable SCIF1 serial port for YC401 console support */
305 gpio_request(GPIO_FN_SCIF1_RXD, NULL); 512 gpio_request(GPIO_FN_SCIF1_RXD, NULL);
306 gpio_request(GPIO_FN_SCIF1_TXD, NULL); 513 gpio_request(GPIO_FN_SCIF1_TXD, NULL);
514 kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */
515 gpio_request(GPIO_PTG3, NULL); /* HPON_ON */
516 gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
307 517
308 /* setup NOR flash at CS0 */ 518 /* setup NOR flash at CS0 */
309 ctrl_outl(0x36db0400, BSC_CS0BCR); 519 ctrl_outl(0x36db0400, BSC_CS0BCR);
@@ -361,6 +571,32 @@ static int __init kfr2r09_devices_setup(void)
361 if (kfr2r09_usb0_gadget_setup() == 0) 571 if (kfr2r09_usb0_gadget_setup() == 0)
362 platform_device_register(&kfr2r09_usb0_gadget_device); 572 platform_device_register(&kfr2r09_usb0_gadget_device);
363 573
574 /* CEU */
575 gpio_request(GPIO_FN_VIO_CKO, NULL);
576 gpio_request(GPIO_FN_VIO0_CLK, NULL);
577 gpio_request(GPIO_FN_VIO0_VD, NULL);
578 gpio_request(GPIO_FN_VIO0_HD, NULL);
579 gpio_request(GPIO_FN_VIO0_FLD, NULL);
580 gpio_request(GPIO_FN_VIO0_D7, NULL);
581 gpio_request(GPIO_FN_VIO0_D6, NULL);
582 gpio_request(GPIO_FN_VIO0_D5, NULL);
583 gpio_request(GPIO_FN_VIO0_D4, NULL);
584 gpio_request(GPIO_FN_VIO0_D3, NULL);
585 gpio_request(GPIO_FN_VIO0_D2, NULL);
586 gpio_request(GPIO_FN_VIO0_D1, NULL);
587 gpio_request(GPIO_FN_VIO0_D0, NULL);
588
589 platform_resource_setup_memory(&kfr2r09_ceu_device, "ceu", 4 << 20);
590
591 /* SDHI0 connected to yc304 */
592 gpio_request(GPIO_FN_SDHI0CD, NULL);
593 gpio_request(GPIO_FN_SDHI0D3, NULL);
594 gpio_request(GPIO_FN_SDHI0D2, NULL);
595 gpio_request(GPIO_FN_SDHI0D1, NULL);
596 gpio_request(GPIO_FN_SDHI0D0, NULL);
597 gpio_request(GPIO_FN_SDHI0CMD, NULL);
598 gpio_request(GPIO_FN_SDHI0CLK, NULL);
599
364 return platform_add_devices(kfr2r09_devices, 600 return platform_add_devices(kfr2r09_devices,
365 ARRAY_SIZE(kfr2r09_devices)); 601 ARRAY_SIZE(kfr2r09_devices));
366} 602}
diff --git a/arch/sh/boards/mach-migor/Makefile b/arch/sh/boards/mach-migor/Makefile
index 5f231dd25c0e..4601a89e5ac7 100644
--- a/arch/sh/boards/mach-migor/Makefile
+++ b/arch/sh/boards/mach-migor/Makefile
@@ -1,2 +1,2 @@
1obj-y := setup.o 1obj-y := setup.o sdram.o
2obj-$(CONFIG_SH_MIGOR_QVGA) += lcd_qvga.o 2obj-$(CONFIG_SH_MIGOR_QVGA) += lcd_qvga.o
diff --git a/arch/sh/boards/mach-migor/sdram.S b/arch/sh/boards/mach-migor/sdram.S
new file mode 100644
index 000000000000..614aa3a1398c
--- /dev/null
+++ b/arch/sh/boards/mach-migor/sdram.S
@@ -0,0 +1,69 @@
1/*
2 * Migo-R sdram self/auto-refresh setup code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/sys.h>
12#include <linux/errno.h>
13#include <linux/linkage.h>
14#include <asm/asm-offsets.h>
15#include <asm/suspend.h>
16#include <asm/romimage-macros.h>
17
18/* code to enter and leave self-refresh. must be self-contained.
19 * this code will be copied to on-chip memory and executed from there.
20 */
21 .balign 4
22ENTRY(migor_sdram_enter_start)
23
24 /* SBSC: disable power down and put in self-refresh mode */
25 mov.l 1f, r4
26 mov.l 2f, r1
27 mov.l @r4, r2
28 or r1, r2
29 mov.l 3f, r3
30 and r3, r2
31 mov.l r2, @r4
32
33 rts
34 nop
35
36 .balign 4
371: .long 0xfe400008 /* SDCR0 */
382: .long 0x00000400
393: .long 0xffff7fff
40ENTRY(migor_sdram_enter_end)
41
42 .balign 4
43ENTRY(migor_sdram_leave_start)
44
45 /* SBSC: set auto-refresh mode */
46 mov.l 1f, r4
47 mov.l @r4, r0
48 mov.l 4f, r1
49 and r1, r0
50 mov.l r0, @r4
51 mov.l 6f, r4
52 mov.l 8f, r0
53 mov.l @r4, r1
54 mov #-1, r4
55 add r4, r1
56 or r1, r0
57 mov.l 7f, r1
58 mov.l r0, @r1
59
60 rts
61 nop
62
63 .balign 4
641: .long 0xfe400008 /* SDCR0 */
654: .long 0xfffffbff
666: .long 0xfe40001c /* RTCOR */
677: .long 0xfe400018 /* RTCNT */
688: .long 0xa55a0000
69ENTRY(migor_sdram_leave_end)
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 6ed1fd32369e..9099b6da9957 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -11,6 +11,7 @@
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/input/sh_keysc.h>
14#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
15#include <linux/mtd/nand.h> 16#include <linux/mtd/nand.h>
16#include <linux/i2c.h> 17#include <linux/i2c.h>
@@ -18,8 +19,6 @@
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/clk.h> 20#include <linux/clk.h>
20#include <linux/gpio.h> 21#include <linux/gpio.h>
21#include <linux/spi/spi.h>
22#include <linux/spi/spi_gpio.h>
23#include <video/sh_mobile_lcdc.h> 22#include <video/sh_mobile_lcdc.h>
24#include <media/sh_mobile_ceu.h> 23#include <media/sh_mobile_ceu.h>
25#include <media/ov772x.h> 24#include <media/ov772x.h>
@@ -27,7 +26,7 @@
27#include <asm/clock.h> 26#include <asm/clock.h>
28#include <asm/machvec.h> 27#include <asm/machvec.h>
29#include <asm/io.h> 28#include <asm/io.h>
30#include <asm/sh_keysc.h> 29#include <asm/suspend.h>
31#include <mach/migor.h> 30#include <mach/migor.h>
32#include <cpu/sh7722.h> 31#include <cpu/sh7722.h>
33 32
@@ -390,17 +389,25 @@ static struct platform_device migor_ceu_device = {
390 }, 389 },
391}; 390};
392 391
393struct spi_gpio_platform_data sdcard_cn9_platform_data = { 392static struct resource sdhi_cn9_resources[] = {
394 .sck = GPIO_PTD0, 393 [0] = {
395 .mosi = GPIO_PTD1, 394 .name = "SDHI",
396 .miso = GPIO_PTD2, 395 .start = 0x04ce0000,
397 .num_chipselect = 1, 396 .end = 0x04ce01ff,
397 .flags = IORESOURCE_MEM,
398 },
399 [1] = {
400 .start = 101,
401 .flags = IORESOURCE_IRQ,
402 },
398}; 403};
399 404
400static struct platform_device sdcard_cn9_device = { 405static struct platform_device sdhi_cn9_device = {
401 .name = "spi_gpio", 406 .name = "sh_mobile_sdhi",
402 .dev = { 407 .num_resources = ARRAY_SIZE(sdhi_cn9_resources),
403 .platform_data = &sdcard_cn9_platform_data, 408 .resource = sdhi_cn9_resources,
409 .archdata = {
410 .hwblk_id = HWBLK_SDHI,
404 }, 411 },
405}; 412};
406 413
@@ -467,23 +474,24 @@ static struct platform_device *migor_devices[] __initdata = {
467 &migor_ceu_device, 474 &migor_ceu_device,
468 &migor_nor_flash_device, 475 &migor_nor_flash_device,
469 &migor_nand_flash_device, 476 &migor_nand_flash_device,
470 &sdcard_cn9_device, 477 &sdhi_cn9_device,
471 &migor_camera[0], 478 &migor_camera[0],
472 &migor_camera[1], 479 &migor_camera[1],
473}; 480};
474 481
475static struct spi_board_info migor_spi_devices[] = { 482extern char migor_sdram_enter_start;
476 { 483extern char migor_sdram_enter_end;
477 .modalias = "mmc_spi", 484extern char migor_sdram_leave_start;
478 .max_speed_hz = 5000000, 485extern char migor_sdram_leave_end;
479 .chip_select = 0,
480 .controller_data = (void *) GPIO_PTD5,
481 },
482};
483 486
484static int __init migor_devices_setup(void) 487static int __init migor_devices_setup(void)
485{ 488{
486 489 /* register board specific self-refresh code */
490 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
491 &migor_sdram_enter_start,
492 &migor_sdram_enter_end,
493 &migor_sdram_leave_start,
494 &migor_sdram_leave_end);
487#ifdef CONFIG_PM 495#ifdef CONFIG_PM
488 /* Let D11 LED show STATUS0 */ 496 /* Let D11 LED show STATUS0 */
489 gpio_request(GPIO_FN_STATUS0, NULL); 497 gpio_request(GPIO_FN_STATUS0, NULL);
@@ -525,6 +533,16 @@ static int __init migor_devices_setup(void)
525 gpio_request(GPIO_PTA1, NULL); 533 gpio_request(GPIO_PTA1, NULL);
526 gpio_direction_input(GPIO_PTA1); 534 gpio_direction_input(GPIO_PTA1);
527 535
536 /* SDHI */
537 gpio_request(GPIO_FN_SDHICD, NULL);
538 gpio_request(GPIO_FN_SDHIWP, NULL);
539 gpio_request(GPIO_FN_SDHID3, NULL);
540 gpio_request(GPIO_FN_SDHID2, NULL);
541 gpio_request(GPIO_FN_SDHID1, NULL);
542 gpio_request(GPIO_FN_SDHID0, NULL);
543 gpio_request(GPIO_FN_SDHICMD, NULL);
544 gpio_request(GPIO_FN_SDHICLK, NULL);
545
528 /* Touch Panel */ 546 /* Touch Panel */
529 gpio_request(GPIO_FN_IRQ6, NULL); 547 gpio_request(GPIO_FN_IRQ6, NULL);
530 548
@@ -612,9 +630,6 @@ static int __init migor_devices_setup(void)
612 i2c_register_board_info(0, migor_i2c_devices, 630 i2c_register_board_info(0, migor_i2c_devices,
613 ARRAY_SIZE(migor_i2c_devices)); 631 ARRAY_SIZE(migor_i2c_devices));
614 632
615 spi_register_board_info(migor_spi_devices,
616 ARRAY_SIZE(migor_spi_devices));
617
618 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); 633 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
619} 634}
620arch_initcall(migor_devices_setup); 635arch_initcall(migor_devices_setup);
diff --git a/arch/sh/boards/mach-r2d/irq.c b/arch/sh/boards/mach-r2d/irq.c
index c70fecedcac4..78d7b27c80da 100644
--- a/arch/sh/boards/mach-r2d/irq.c
+++ b/arch/sh/boards/mach-r2d/irq.c
@@ -116,7 +116,7 @@ static unsigned char irl2irq[R2D_NR_IRL];
116 116
117int rts7751r2d_irq_demux(int irq) 117int rts7751r2d_irq_demux(int irq)
118{ 118{
119 if (irq >= R2D_NR_IRL || !irl2irq[irq]) 119 if (irq >= R2D_NR_IRL || irq < 0 || !irl2irq[irq])
120 return irq; 120 return irq;
121 121
122 return irl2irq[irq]; 122 return irl2irq[irq];
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
index 02d21a3e2a8f..4eb31acfafef 100644
--- a/arch/sh/boards/mach-se/7722/irq.c
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -16,15 +16,17 @@
16#include <asm/io.h> 16#include <asm/io.h>
17#include <mach-se/mach/se7722.h> 17#include <mach-se/mach/se7722.h>
18 18
19unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, };
20
19static void disable_se7722_irq(unsigned int irq) 21static void disable_se7722_irq(unsigned int irq)
20{ 22{
21 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE; 23 unsigned int bit = (unsigned int)get_irq_chip_data(irq);
22 ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK); 24 ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
23} 25}
24 26
25static void enable_se7722_irq(unsigned int irq) 27static void enable_se7722_irq(unsigned int irq)
26{ 28{
27 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE; 29 unsigned int bit = (unsigned int)get_irq_chip_data(irq);
28 ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK); 30 ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
29} 31}
30 32
@@ -38,18 +40,15 @@ static struct irq_chip se7722_irq_chip __read_mostly = {
38static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc) 40static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
39{ 41{
40 unsigned short intv = ctrl_inw(IRQ01_STS); 42 unsigned short intv = ctrl_inw(IRQ01_STS);
41 struct irq_desc *ext_desc; 43 unsigned int ext_irq = 0;
42 unsigned int ext_irq = SE7722_FPGA_IRQ_BASE;
43 44
44 intv &= (1 << SE7722_FPGA_IRQ_NR) - 1; 45 intv &= (1 << SE7722_FPGA_IRQ_NR) - 1;
45 46
46 while (intv) { 47 for (; intv; intv >>= 1, ext_irq++) {
47 if (intv & 1) { 48 if (!(intv & 1))
48 ext_desc = irq_desc + ext_irq; 49 continue;
49 handle_level_irq(ext_irq, ext_desc); 50
50 } 51 generic_handle_irq(se7722_fpga_irq[ext_irq]);
51 intv >>= 1;
52 ext_irq++;
53 } 52 }
54} 53}
55 54
@@ -63,11 +62,18 @@ void __init init_se7722_IRQ(void)
63 ctrl_outw(0, IRQ01_MASK); /* disable all irqs */ 62 ctrl_outw(0, IRQ01_MASK); /* disable all irqs */
64 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */ 63 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
65 64
66 for (i = 0; i < SE7722_FPGA_IRQ_NR; i++) 65 for (i = 0; i < SE7722_FPGA_IRQ_NR; i++) {
67 set_irq_chip_and_handler_name(SE7722_FPGA_IRQ_BASE + i, 66 se7722_fpga_irq[i] = create_irq();
67 if (se7722_fpga_irq[i] < 0)
68 return;
69
70 set_irq_chip_and_handler_name(se7722_fpga_irq[i],
68 &se7722_irq_chip, 71 &se7722_irq_chip,
69 handle_level_irq, "level"); 72 handle_level_irq, "level");
70 73
74 set_irq_chip_data(se7722_fpga_irq[i], (void *)i);
75 }
76
71 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux); 77 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux);
72 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW); 78 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
73 79
diff --git a/arch/sh/boards/mach-se/7722/setup.c b/arch/sh/boards/mach-se/7722/setup.c
index 36374078e521..b1cb9425b600 100644
--- a/arch/sh/boards/mach-se/7722/setup.c
+++ b/arch/sh/boards/mach-se/7722/setup.c
@@ -14,6 +14,7 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/ata_platform.h> 15#include <linux/ata_platform.h>
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/input/sh_keysc.h>
17#include <linux/smc91x.h> 18#include <linux/smc91x.h>
18#include <mach-se/mach/se7722.h> 19#include <mach-se/mach/se7722.h>
19#include <mach-se/mach/mrshpc.h> 20#include <mach-se/mach/mrshpc.h>
@@ -21,7 +22,6 @@
21#include <asm/clock.h> 22#include <asm/clock.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/heartbeat.h> 24#include <asm/heartbeat.h>
24#include <asm/sh_keysc.h>
25#include <cpu/sh7722.h> 25#include <cpu/sh7722.h>
26 26
27/* Heartbeat */ 27/* Heartbeat */
@@ -60,8 +60,7 @@ static struct resource smc91x_eth_resources[] = {
60 .flags = IORESOURCE_MEM, 60 .flags = IORESOURCE_MEM,
61 }, 61 },
62 [1] = { 62 [1] = {
63 .start = SMC_IRQ, 63 /* Filled in later */
64 .end = SMC_IRQ,
65 .flags = IORESOURCE_IRQ, 64 .flags = IORESOURCE_IRQ,
66 }, 65 },
67}; 66};
@@ -90,8 +89,7 @@ static struct resource cf_ide_resources[] = {
90 .flags = IORESOURCE_IO, 89 .flags = IORESOURCE_IO,
91 }, 90 },
92 [2] = { 91 [2] = {
93 .start = MRSHPC_IRQ0, 92 /* Filled in later */
94 .end = MRSHPC_IRQ0,
95 .flags = IORESOURCE_IRQ, 93 .flags = IORESOURCE_IRQ,
96 }, 94 },
97}; 95};
@@ -153,6 +151,14 @@ static struct platform_device *se7722_devices[] __initdata = {
153static int __init se7722_devices_setup(void) 151static int __init se7722_devices_setup(void)
154{ 152{
155 mrshpc_setup_windows(); 153 mrshpc_setup_windows();
154
155 /* Wire-up dynamic vectors */
156 cf_ide_resources[2].start = cf_ide_resources[2].end =
157 se7722_fpga_irq[SE7722_FPGA_IRQ_MRSHPC0];
158
159 smc91x_eth_resources[1].start = smc91x_eth_resources[1].end =
160 se7722_fpga_irq[SE7722_FPGA_IRQ_SMC];
161
156 return platform_add_devices(se7722_devices, ARRAY_SIZE(se7722_devices)); 162 return platform_add_devices(se7722_devices, ARRAY_SIZE(se7722_devices));
157} 163}
158device_initcall(se7722_devices_setup); 164device_initcall(se7722_devices_setup);
@@ -193,6 +199,5 @@ static void __init se7722_setup(char **cmdline_p)
193static struct sh_machine_vector mv_se7722 __initmv = { 199static struct sh_machine_vector mv_se7722 __initmv = {
194 .mv_name = "Solution Engine 7722" , 200 .mv_name = "Solution Engine 7722" ,
195 .mv_setup = se7722_setup , 201 .mv_setup = se7722_setup ,
196 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
197 .mv_init_irq = init_se7722_IRQ, 202 .mv_init_irq = init_se7722_IRQ,
198}; 203};
diff --git a/arch/sh/boards/mach-se/7724/Makefile b/arch/sh/boards/mach-se/7724/Makefile
index 349cbd6ce82d..a08b36830f0e 100644
--- a/arch/sh/boards/mach-se/7724/Makefile
+++ b/arch/sh/boards/mach-se/7724/Makefile
@@ -7,4 +7,4 @@
7# 7#
8# 8#
9 9
10obj-y := setup.o irq.o \ No newline at end of file 10obj-y := setup.o irq.o sdram.o
diff --git a/arch/sh/boards/mach-se/7724/sdram.S b/arch/sh/boards/mach-se/7724/sdram.S
new file mode 100644
index 000000000000..9040167d5022
--- /dev/null
+++ b/arch/sh/boards/mach-se/7724/sdram.S
@@ -0,0 +1,52 @@
1/*
2 * MS7724SE sdram self/auto-refresh setup code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/sys.h>
12#include <linux/errno.h>
13#include <linux/linkage.h>
14#include <asm/asm-offsets.h>
15#include <asm/suspend.h>
16#include <asm/romimage-macros.h>
17
18/* code to enter and leave self-refresh. must be self-contained.
19 * this code will be copied to on-chip memory and executed from there.
20 */
21 .balign 4
22ENTRY(ms7724se_sdram_enter_start)
23
24 /* DBSC: put memory in self-refresh mode */
25
26 ED 0xFD000010, 0x00000000 /* DBEN */
27 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
28 ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
29 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
30 ED 0xFD000040, 0x00000001 /* DBRFPDN0 */
31
32 rts
33 nop
34
35ENTRY(ms7724se_sdram_enter_end)
36
37 .balign 4
38ENTRY(ms7724se_sdram_leave_start)
39
40 /* DBSC: put memory in auto-refresh mode */
41
42 ED 0xFD000040, 0x00000000 /* DBRFPDN0 */
43 WAIT 1
44 ED 0xFD000014, 0x00000002 /* DBCMDCNT (PALL) */
45 ED 0xFD000014, 0x00000004 /* DBCMDCNT (REF) */
46 ED 0xFD000010, 0x00000001 /* DBEN */
47 ED 0xFD000040, 0x00010000 /* DBRFPDN0 */
48
49 rts
50 nop
51
52ENTRY(ms7724se_sdram_leave_end)
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 0894bba9fade..4b0f0c0dc2b8 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -19,6 +19,7 @@
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/input/sh_keysc.h>
22#include <linux/usb/r8a66597.h> 23#include <linux/usb/r8a66597.h>
23#include <video/sh_mobile_lcdc.h> 24#include <video/sh_mobile_lcdc.h>
24#include <media/sh_mobile_ceu.h> 25#include <media/sh_mobile_ceu.h>
@@ -27,7 +28,7 @@
27#include <asm/heartbeat.h> 28#include <asm/heartbeat.h>
28#include <asm/sh_eth.h> 29#include <asm/sh_eth.h>
29#include <asm/clock.h> 30#include <asm/clock.h>
30#include <asm/sh_keysc.h> 31#include <asm/suspend.h>
31#include <cpu/sh7724.h> 32#include <cpu/sh7724.h>
32#include <mach-se/mach/se7724.h> 33#include <mach-se/mach/se7724.h>
33 34
@@ -451,6 +452,52 @@ static struct platform_device sh7724_usb1_gadget_device = {
451 .resource = sh7724_usb1_gadget_resources, 452 .resource = sh7724_usb1_gadget_resources,
452}; 453};
453 454
455static struct resource sdhi0_cn7_resources[] = {
456 [0] = {
457 .name = "SDHI0",
458 .start = 0x04ce0000,
459 .end = 0x04ce01ff,
460 .flags = IORESOURCE_MEM,
461 },
462 [1] = {
463 .start = 101,
464 .flags = IORESOURCE_IRQ,
465 },
466};
467
468static struct platform_device sdhi0_cn7_device = {
469 .name = "sh_mobile_sdhi",
470 .id = 0,
471 .num_resources = ARRAY_SIZE(sdhi0_cn7_resources),
472 .resource = sdhi0_cn7_resources,
473 .archdata = {
474 .hwblk_id = HWBLK_SDHI0,
475 },
476};
477
478static struct resource sdhi1_cn8_resources[] = {
479 [0] = {
480 .name = "SDHI1",
481 .start = 0x04cf0000,
482 .end = 0x04cf01ff,
483 .flags = IORESOURCE_MEM,
484 },
485 [1] = {
486 .start = 24,
487 .flags = IORESOURCE_IRQ,
488 },
489};
490
491static struct platform_device sdhi1_cn8_device = {
492 .name = "sh_mobile_sdhi",
493 .id = 1,
494 .num_resources = ARRAY_SIZE(sdhi1_cn8_resources),
495 .resource = sdhi1_cn8_resources,
496 .archdata = {
497 .hwblk_id = HWBLK_SDHI1,
498 },
499};
500
454static struct platform_device *ms7724se_devices[] __initdata = { 501static struct platform_device *ms7724se_devices[] __initdata = {
455 &heartbeat_device, 502 &heartbeat_device,
456 &smc91x_eth_device, 503 &smc91x_eth_device,
@@ -463,6 +510,8 @@ static struct platform_device *ms7724se_devices[] __initdata = {
463 &sh7724_usb0_host_device, 510 &sh7724_usb0_host_device,
464 &sh7724_usb1_gadget_device, 511 &sh7724_usb1_gadget_device,
465 &fsi_device, 512 &fsi_device,
513 &sdhi0_cn7_device,
514 &sdhi1_cn8_device,
466}; 515};
467 516
468#define EEPROM_OP 0xBA206000 517#define EEPROM_OP 0xBA206000
@@ -487,7 +536,7 @@ static int __init sh_eth_is_eeprom_ready(void)
487static void __init sh_eth_init(void) 536static void __init sh_eth_init(void)
488{ 537{
489 int i; 538 int i;
490 u16 mac[3]; 539 u16 mac;
491 540
492 /* check EEPROM status */ 541 /* check EEPROM status */
493 if (!sh_eth_is_eeprom_ready()) 542 if (!sh_eth_is_eeprom_ready())
@@ -501,16 +550,10 @@ static void __init sh_eth_init(void)
501 if (!sh_eth_is_eeprom_ready()) 550 if (!sh_eth_is_eeprom_ready())
502 return; 551 return;
503 552
504 mac[i] = ctrl_inw(EEPROM_DATA); 553 mac = ctrl_inw(EEPROM_DATA);
505 mac[i] = ((mac[i] & 0xFF) << 8) | (mac[i] >> 8); /* swap */ 554 sh_eth_plat.mac_addr[i << 1] = mac & 0xff;
555 sh_eth_plat.mac_addr[(i << 1) + 1] = mac >> 8;
506 } 556 }
507
508 /* reset sh-eth */
509 ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
510
511 /* set MAC addr */
512 ctrl_outl(((mac[0] << 16) | (mac[1])), SH_ETH_MAHR);
513 ctrl_outl((mac[2]), SH_ETH_MALR);
514} 557}
515 558
516#define SW4140 0xBA201000 559#define SW4140 0xBA201000
@@ -527,11 +570,22 @@ static void __init sh_eth_init(void)
527#define SW41_G 0x4000 570#define SW41_G 0x4000
528#define SW41_H 0x8000 571#define SW41_H 0x8000
529 572
573extern char ms7724se_sdram_enter_start;
574extern char ms7724se_sdram_enter_end;
575extern char ms7724se_sdram_leave_start;
576extern char ms7724se_sdram_leave_end;
577
530static int __init devices_setup(void) 578static int __init devices_setup(void)
531{ 579{
532 u16 sw = ctrl_inw(SW4140); /* select camera, monitor */ 580 u16 sw = ctrl_inw(SW4140); /* select camera, monitor */
533 struct clk *fsia_clk; 581 struct clk *fsia_clk;
534 582
583 /* register board specific self-refresh code */
584 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
585 &ms7724se_sdram_enter_start,
586 &ms7724se_sdram_enter_end,
587 &ms7724se_sdram_leave_start,
588 &ms7724se_sdram_leave_end);
535 /* Reset Release */ 589 /* Reset Release */
536 ctrl_outw(ctrl_inw(FPGA_OUT) & 590 ctrl_outw(ctrl_inw(FPGA_OUT) &
537 ~((1 << 1) | /* LAN */ 591 ~((1 << 1) | /* LAN */
@@ -701,6 +755,26 @@ static int __init devices_setup(void)
701 clk_set_rate(&fsimcka_clk, 11000); 755 clk_set_rate(&fsimcka_clk, 11000);
702 clk_put(fsia_clk); 756 clk_put(fsia_clk);
703 757
758 /* SDHI0 connected to cn7 */
759 gpio_request(GPIO_FN_SDHI0CD, NULL);
760 gpio_request(GPIO_FN_SDHI0WP, NULL);
761 gpio_request(GPIO_FN_SDHI0D3, NULL);
762 gpio_request(GPIO_FN_SDHI0D2, NULL);
763 gpio_request(GPIO_FN_SDHI0D1, NULL);
764 gpio_request(GPIO_FN_SDHI0D0, NULL);
765 gpio_request(GPIO_FN_SDHI0CMD, NULL);
766 gpio_request(GPIO_FN_SDHI0CLK, NULL);
767
768 /* SDHI1 connected to cn8 */
769 gpio_request(GPIO_FN_SDHI1CD, NULL);
770 gpio_request(GPIO_FN_SDHI1WP, NULL);
771 gpio_request(GPIO_FN_SDHI1D3, NULL);
772 gpio_request(GPIO_FN_SDHI1D2, NULL);
773 gpio_request(GPIO_FN_SDHI1D1, NULL);
774 gpio_request(GPIO_FN_SDHI1D0, NULL);
775 gpio_request(GPIO_FN_SDHI1CMD, NULL);
776 gpio_request(GPIO_FN_SDHI1CLK, NULL);
777
704 /* 778 /*
705 * enable SH-Eth 779 * enable SH-Eth
706 * 780 *