aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/Kconfig43
-rw-r--r--arch/sh/boards/Makefile6
-rw-r--r--arch/sh/boards/board-apsh4a3a.c175
-rw-r--r--arch/sh/boards/board-apsh4ad0a.c125
-rw-r--r--arch/sh/boards/board-edosk7705.c78
-rw-r--r--arch/sh/boards/board-edosk7760.c4
-rw-r--r--arch/sh/boards/board-espt.c7
-rw-r--r--arch/sh/boards/board-magicpanelr2.c12
-rw-r--r--arch/sh/boards/board-secureedge5410.c (renamed from arch/sh/boards/mach-snapgear/setup.c)38
-rw-r--r--arch/sh/boards/board-sh2007.c133
-rw-r--r--arch/sh/boards/board-sh7757lcr.c559
-rw-r--r--arch/sh/boards/board-sh7785lcr.c2
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c114
-rw-r--r--arch/sh/boards/mach-cayman/irq.c20
-rw-r--r--arch/sh/boards/mach-cayman/setup.c2
-rw-r--r--arch/sh/boards/mach-dreamcast/irq.c22
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c213
-rw-r--r--arch/sh/boards/mach-edosk7705/Makefile5
-rw-r--r--arch/sh/boards/mach-edosk7705/io.c71
-rw-r--r--arch/sh/boards/mach-edosk7705/setup.c36
-rw-r--r--arch/sh/boards/mach-highlander/setup.c2
-rw-r--r--arch/sh/boards/mach-hp6xx/pm.c2
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c36
-rw-r--r--arch/sh/boards/mach-landisk/gio.c1
-rw-r--r--arch/sh/boards/mach-landisk/irq.c60
-rw-r--r--arch/sh/boards/mach-landisk/setup.c9
-rw-r--r--arch/sh/boards/mach-microdev/io.c246
-rw-r--r--arch/sh/boards/mach-microdev/irq.c32
-rw-r--r--arch/sh/boards/mach-microdev/setup.c23
-rw-r--r--arch/sh/boards/mach-migor/setup.c66
-rw-r--r--arch/sh/boards/mach-r2d/setup.c2
-rw-r--r--arch/sh/boards/mach-rsk/devices-rsk7203.c37
-rw-r--r--arch/sh/boards/mach-sdk7786/Makefile5
-rw-r--r--arch/sh/boards/mach-sdk7786/gpio.c49
-rw-r--r--arch/sh/boards/mach-sdk7786/nmi.c83
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c57
-rw-r--r--arch/sh/boards/mach-sdk7786/sram.c72
-rw-r--r--arch/sh/boards/mach-se/7206/Makefile2
-rw-r--r--arch/sh/boards/mach-se/7206/io.c104
-rw-r--r--arch/sh/boards/mach-se/7206/irq.c29
-rw-r--r--arch/sh/boards/mach-se/7206/setup.c23
-rw-r--r--arch/sh/boards/mach-se/7343/irq.c38
-rw-r--r--arch/sh/boards/mach-se/770x/Makefile2
-rw-r--r--arch/sh/boards/mach-se/770x/io.c156
-rw-r--r--arch/sh/boards/mach-se/770x/setup.c22
-rw-r--r--arch/sh/boards/mach-se/7722/irq.c30
-rw-r--r--arch/sh/boards/mach-se/7724/irq.c28
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c122
-rw-r--r--arch/sh/boards/mach-se/7751/Makefile2
-rw-r--r--arch/sh/boards/mach-se/7751/io.c119
-rw-r--r--arch/sh/boards/mach-se/7751/setup.c20
-rw-r--r--arch/sh/boards/mach-se/board-se7619.c6
-rw-r--r--arch/sh/boards/mach-sh03/rtc.c2
-rw-r--r--arch/sh/boards/mach-sh03/setup.c2
-rw-r--r--arch/sh/boards/mach-sh7763rdp/setup.c6
-rw-r--r--arch/sh/boards/mach-snapgear/Makefile5
-rw-r--r--arch/sh/boards/mach-snapgear/io.c121
-rw-r--r--arch/sh/boards/mach-systemh/Makefile13
-rw-r--r--arch/sh/boards/mach-systemh/io.c158
-rw-r--r--arch/sh/boards/mach-systemh/irq.c76
-rw-r--r--arch/sh/boards/mach-systemh/setup.c57
-rw-r--r--arch/sh/boards/mach-x3proto/Makefile2
-rw-r--r--arch/sh/boards/mach-x3proto/gpio.c136
-rw-r--r--arch/sh/boards/mach-x3proto/ilsel.c18
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c132
65 files changed, 2189 insertions, 1689 deletions
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 07b35ca2f644..d893411022d5 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -3,6 +3,9 @@ menu "Board support"
3config SOLUTION_ENGINE 3config SOLUTION_ENGINE
4 bool 4 bool
5 5
6config SH_ALPHA_BOARD
7 bool
8
6config SH_SOLUTION_ENGINE 9config SH_SOLUTION_ENGINE
7 bool "SolutionEngine" 10 bool "SolutionEngine"
8 select SOLUTION_ENGINE 11 select SOLUTION_ENGINE
@@ -81,13 +84,6 @@ config SH_7343_SOLUTION_ENGINE
81 Select 7343 SolutionEngine if configuring for a Hitachi 84 Select 7343 SolutionEngine if configuring for a Hitachi
82 SH7343 (SH-Mobile 3AS) evaluation board. 85 SH7343 (SH-Mobile 3AS) evaluation board.
83 86
84config SH_7751_SYSTEMH
85 bool "SystemH7751R"
86 depends on CPU_SUBTYPE_SH7751R
87 help
88 Select SystemH if you are configuring for a Renesas SystemH
89 7751R evaluation board.
90
91config SH_HP6XX 87config SH_HP6XX
92 bool "HP6XX" 88 bool "HP6XX"
93 select SYS_SUPPORTS_APM_EMULATION 89 select SYS_SUPPORTS_APM_EMULATION
@@ -155,6 +151,8 @@ config SH_SDK7786
155 depends on CPU_SUBTYPE_SH7786 151 depends on CPU_SUBTYPE_SH7786
156 select SYS_SUPPORTS_PCI 152 select SYS_SUPPORTS_PCI
157 select NO_IOPORT if !PCI 153 select NO_IOPORT if !PCI
154 select ARCH_WANT_OPTIONAL_GPIOLIB
155 select HAVE_SRAM_POOL
158 help 156 help
159 Select SDK7786 if configuring for a Renesas Technology Europe 157 Select SDK7786 if configuring for a Renesas Technology Europe
160 SH7786-65nm board. 158 SH7786-65nm board.
@@ -165,6 +163,11 @@ config SH_HIGHLANDER
165 select SYS_SUPPORTS_PCI 163 select SYS_SUPPORTS_PCI
166 select IO_TRAPPED if MMU 164 select IO_TRAPPED if MMU
167 165
166config SH_SH7757LCR
167 bool "SH7757LCR"
168 depends on CPU_SUBTYPE_SH7757
169 select ARCH_REQUIRE_GPIOLIB
170
168config SH_SH7785LCR 171config SH_SH7785LCR
169 bool "SH7785LCR" 172 bool "SH7785LCR"
170 depends on CPU_SUBTYPE_SH7785 173 depends on CPU_SUBTYPE_SH7785
@@ -309,6 +312,32 @@ config SH_POLARIS
309 help 312 help
310 Select if configuring for an SMSC Polaris development board 313 Select if configuring for an SMSC Polaris development board
311 314
315config SH_SH2007
316 bool "SH-2007 board"
317 select NO_IOPORT
318 depends on CPU_SUBTYPE_SH7780
319 help
320 SH-2007 is a single-board computer based around SH7780 chip
321 intended for embedded applications.
322 It has an Ethernet interface (SMC9118), direct connected
323 Compact Flash socket, two serial ports and PC-104 bus.
324 More information at <http://sh2000.sh-linux.org>.
325
326config SH_APSH4A3A
327 bool "AP-SH4A-3A"
328 select SH_ALPHA_BOARD
329 depends on CPU_SUBTYPE_SH7785
330 help
331 Select AP-SH4A-3A if configuring for an ALPHAPROJECT AP-SH4A-3A.
332
333config SH_APSH4AD0A
334 bool "AP-SH4AD-0A"
335 select SH_ALPHA_BOARD
336 select SYS_SUPPORTS_PCI
337 depends on CPU_SUBTYPE_SH7786
338 help
339 Select AP-SH4AD-0A if configuring for an ALPHAPROJECT AP-SH4AD-0A.
340
312endmenu 341endmenu
313 342
314source "arch/sh/boards/mach-r2d/Kconfig" 343source "arch/sh/boards/mach-r2d/Kconfig"
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
index 4f90f9b7a922..975a0f64ff20 100644
--- a/arch/sh/boards/Makefile
+++ b/arch/sh/boards/Makefile
@@ -2,10 +2,16 @@
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_MAGIC_PANEL_R2) += board-magicpanelr2.o 4obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
5obj-$(CONFIG_SH_SECUREEDGE5410) += board-secureedge5410.o
6obj-$(CONFIG_SH_SH2007) += board-sh2007.o
5obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o 7obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
6obj-$(CONFIG_SH_URQUELL) += board-urquell.o 8obj-$(CONFIG_SH_URQUELL) += board-urquell.o
7obj-$(CONFIG_SH_SHMIN) += board-shmin.o 9obj-$(CONFIG_SH_SHMIN) += board-shmin.o
10obj-$(CONFIG_SH_EDOSK7705) += board-edosk7705.o
8obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o 11obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o
9obj-$(CONFIG_SH_ESPT) += board-espt.o 12obj-$(CONFIG_SH_ESPT) += board-espt.o
10obj-$(CONFIG_SH_POLARIS) += board-polaris.o 13obj-$(CONFIG_SH_POLARIS) += board-polaris.o
11obj-$(CONFIG_SH_TITAN) += board-titan.o 14obj-$(CONFIG_SH_TITAN) += board-titan.o
15obj-$(CONFIG_SH_SH7757LCR) += board-sh7757lcr.o
16obj-$(CONFIG_SH_APSH4A3A) += board-apsh4a3a.o
17obj-$(CONFIG_SH_APSH4AD0A) += board-apsh4ad0a.o
diff --git a/arch/sh/boards/board-apsh4a3a.c b/arch/sh/boards/board-apsh4a3a.c
new file mode 100644
index 000000000000..8e2a27057bc9
--- /dev/null
+++ b/arch/sh/boards/board-apsh4a3a.c
@@ -0,0 +1,175 @@
1/*
2 * ALPHAPROJECT AP-SH4A-3A Support.
3 *
4 * Copyright (C) 2010 ALPHAPROJECT Co.,Ltd.
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 * Copyright (C) 2009 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/io.h>
15#include <linux/mtd/physmap.h>
16#include <linux/smsc911x.h>
17#include <linux/irq.h>
18#include <linux/clk.h>
19#include <asm/machvec.h>
20#include <asm/sizes.h>
21#include <asm/clock.h>
22
23static struct mtd_partition nor_flash_partitions[] = {
24 {
25 .name = "loader",
26 .offset = 0x00000000,
27 .size = 512 * 1024,
28 },
29 {
30 .name = "bootenv",
31 .offset = MTDPART_OFS_APPEND,
32 .size = 512 * 1024,
33 },
34 {
35 .name = "kernel",
36 .offset = MTDPART_OFS_APPEND,
37 .size = 4 * 1024 * 1024,
38 },
39 {
40 .name = "data",
41 .offset = MTDPART_OFS_APPEND,
42 .size = MTDPART_SIZ_FULL,
43 },
44};
45
46static struct physmap_flash_data nor_flash_data = {
47 .width = 4,
48 .parts = nor_flash_partitions,
49 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
50};
51
52static struct resource nor_flash_resources[] = {
53 [0] = {
54 .start = 0x00000000,
55 .end = 0x01000000 - 1,
56 .flags = IORESOURCE_MEM,
57 }
58};
59
60static struct platform_device nor_flash_device = {
61 .name = "physmap-flash",
62 .dev = {
63 .platform_data = &nor_flash_data,
64 },
65 .num_resources = ARRAY_SIZE(nor_flash_resources),
66 .resource = nor_flash_resources,
67};
68
69static struct resource smsc911x_resources[] = {
70 [0] = {
71 .name = "smsc911x-memory",
72 .start = 0xA4000000,
73 .end = 0xA4000000 + SZ_256 - 1,
74 .flags = IORESOURCE_MEM,
75 },
76 [1] = {
77 .name = "smsc911x-irq",
78 .start = evt2irq(0x200),
79 .end = evt2irq(0x200),
80 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct smsc911x_platform_config smsc911x_config = {
85 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
86 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
87 .flags = SMSC911X_USE_16BIT,
88 .phy_interface = PHY_INTERFACE_MODE_MII,
89};
90
91static struct platform_device smsc911x_device = {
92 .name = "smsc911x",
93 .id = -1,
94 .num_resources = ARRAY_SIZE(smsc911x_resources),
95 .resource = smsc911x_resources,
96 .dev = {
97 .platform_data = &smsc911x_config,
98 },
99};
100
101static struct platform_device *apsh4a3a_devices[] __initdata = {
102 &nor_flash_device,
103 &smsc911x_device,
104};
105
106static int __init apsh4a3a_devices_setup(void)
107{
108 return platform_add_devices(apsh4a3a_devices,
109 ARRAY_SIZE(apsh4a3a_devices));
110}
111device_initcall(apsh4a3a_devices_setup);
112
113static int apsh4a3a_clk_init(void)
114{
115 struct clk *clk;
116 int ret;
117
118 clk = clk_get(NULL, "extal");
119 if (!clk || IS_ERR(clk))
120 return PTR_ERR(clk);
121 ret = clk_set_rate(clk, 33333000);
122 clk_put(clk);
123
124 return ret;
125}
126
127/* Initialize the board */
128static void __init apsh4a3a_setup(char **cmdline_p)
129{
130 printk(KERN_INFO "Alpha Project AP-SH4A-3A support:\n");
131}
132
133static void __init apsh4a3a_init_irq(void)
134{
135 plat_irq_setup_pins(IRQ_MODE_IRQ7654);
136}
137
138/* Return the board specific boot mode pin configuration */
139static int apsh4a3a_mode_pins(void)
140{
141 int value = 0;
142
143 /* These are the factory default settings of SW1 and SW2.
144 * If you change these dip switches then you will need to
145 * adjust the values below as well.
146 */
147 value &= ~MODE_PIN0; /* Clock Mode 16 */
148 value &= ~MODE_PIN1;
149 value &= ~MODE_PIN2;
150 value &= ~MODE_PIN3;
151 value |= MODE_PIN4;
152 value &= ~MODE_PIN5; /* 16-bit Area0 bus width */
153 value |= MODE_PIN6; /* Area 0 SRAM interface */
154 value |= MODE_PIN7;
155 value |= MODE_PIN8; /* Little Endian */
156 value |= MODE_PIN9; /* Master Mode */
157 value |= MODE_PIN10; /* Crystal resonator */
158 value |= MODE_PIN11; /* Display Unit */
159 value |= MODE_PIN12;
160 value &= ~MODE_PIN13; /* 29-bit address mode */
161 value |= MODE_PIN14; /* No PLL step-up */
162
163 return value;
164}
165
166/*
167 * The Machine Vector
168 */
169static struct sh_machine_vector mv_apsh4a3a __initmv = {
170 .mv_name = "AP-SH4A-3A",
171 .mv_setup = apsh4a3a_setup,
172 .mv_clk_init = apsh4a3a_clk_init,
173 .mv_init_irq = apsh4a3a_init_irq,
174 .mv_mode_pins = apsh4a3a_mode_pins,
175};
diff --git a/arch/sh/boards/board-apsh4ad0a.c b/arch/sh/boards/board-apsh4ad0a.c
new file mode 100644
index 000000000000..e2bd218a054e
--- /dev/null
+++ b/arch/sh/boards/board-apsh4ad0a.c
@@ -0,0 +1,125 @@
1/*
2 * ALPHAPROJECT AP-SH4AD-0A Support.
3 *
4 * Copyright (C) 2010 ALPHAPROJECT Co.,Ltd.
5 * Copyright (C) 2010 Matt Fleming
6 * Copyright (C) 2010 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/io.h>
15#include <linux/smsc911x.h>
16#include <linux/irq.h>
17#include <linux/clk.h>
18#include <asm/machvec.h>
19#include <asm/sizes.h>
20
21static struct resource smsc911x_resources[] = {
22 [0] = {
23 .name = "smsc911x-memory",
24 .start = 0xA4000000,
25 .end = 0xA4000000 + SZ_256 - 1,
26 .flags = IORESOURCE_MEM,
27 },
28 [1] = {
29 .name = "smsc911x-irq",
30 .start = evt2irq(0x200),
31 .end = evt2irq(0x200),
32 .flags = IORESOURCE_IRQ,
33 },
34};
35
36static struct smsc911x_platform_config smsc911x_config = {
37 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
38 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
39 .flags = SMSC911X_USE_16BIT,
40 .phy_interface = PHY_INTERFACE_MODE_MII,
41};
42
43static struct platform_device smsc911x_device = {
44 .name = "smsc911x",
45 .id = -1,
46 .num_resources = ARRAY_SIZE(smsc911x_resources),
47 .resource = smsc911x_resources,
48 .dev = {
49 .platform_data = &smsc911x_config,
50 },
51};
52
53static struct platform_device *apsh4ad0a_devices[] __initdata = {
54 &smsc911x_device,
55};
56
57static int __init apsh4ad0a_devices_setup(void)
58{
59 return platform_add_devices(apsh4ad0a_devices,
60 ARRAY_SIZE(apsh4ad0a_devices));
61}
62device_initcall(apsh4ad0a_devices_setup);
63
64static int apsh4ad0a_mode_pins(void)
65{
66 int value = 0;
67
68 /* These are the factory default settings of SW1 and SW2.
69 * If you change these dip switches then you will need to
70 * adjust the values below as well.
71 */
72 value |= MODE_PIN0; /* Clock Mode 3 */
73 value |= MODE_PIN1;
74 value &= ~MODE_PIN2;
75 value &= ~MODE_PIN3;
76 value &= ~MODE_PIN4; /* 16-bit Area0 bus width */
77 value |= MODE_PIN5;
78 value |= MODE_PIN6;
79 value |= MODE_PIN7; /* Normal mode */
80 value |= MODE_PIN8; /* Little Endian */
81 value |= MODE_PIN9; /* Crystal resonator */
82 value &= ~MODE_PIN10; /* 29-bit address mode */
83 value &= ~MODE_PIN11; /* PCI-E Root port */
84 value &= ~MODE_PIN12; /* 4 lane + 1 lane */
85 value |= MODE_PIN13; /* AUD Enable */
86 value &= ~MODE_PIN14; /* Normal Operation */
87
88 return value;
89}
90
91static int apsh4ad0a_clk_init(void)
92{
93 struct clk *clk;
94 int ret;
95
96 clk = clk_get(NULL, "extal");
97 if (!clk || IS_ERR(clk))
98 return PTR_ERR(clk);
99 ret = clk_set_rate(clk, 33333000);
100 clk_put(clk);
101
102 return ret;
103}
104
105/* Initialize the board */
106static void __init apsh4ad0a_setup(char **cmdline_p)
107{
108 pr_info("Alpha Project AP-SH4AD-0A support:\n");
109}
110
111static void __init apsh4ad0a_init_irq(void)
112{
113 plat_irq_setup_pins(IRQ_MODE_IRQ3210);
114}
115
116/*
117 * The Machine Vector
118 */
119static struct sh_machine_vector mv_apsh4ad0a __initmv = {
120 .mv_name = "AP-SH4AD-0A",
121 .mv_setup = apsh4ad0a_setup,
122 .mv_mode_pins = apsh4ad0a_mode_pins,
123 .mv_clk_init = apsh4ad0a_clk_init,
124 .mv_init_irq = apsh4ad0a_init_irq,
125};
diff --git a/arch/sh/boards/board-edosk7705.c b/arch/sh/boards/board-edosk7705.c
new file mode 100644
index 000000000000..541d8a281035
--- /dev/null
+++ b/arch/sh/boards/board-edosk7705.c
@@ -0,0 +1,78 @@
1/*
2 * arch/sh/boards/renesas/edosk7705/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for edosk7705 development
9 * board by S. Dunn, 2003.
10 */
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <linux/platform_device.h>
14#include <linux/interrupt.h>
15#include <linux/smc91x.h>
16#include <asm/machvec.h>
17#include <asm/sizes.h>
18
19#define SMC_IOBASE 0xA2000000
20#define SMC_IO_OFFSET 0x300
21#define SMC_IOADDR (SMC_IOBASE + SMC_IO_OFFSET)
22
23#define ETHERNET_IRQ 0x09
24
25static void __init sh_edosk7705_init_irq(void)
26{
27 make_imask_irq(ETHERNET_IRQ);
28}
29
30/* eth initialization functions */
31static struct smc91x_platdata smc91x_info = {
32 .flags = SMC91X_USE_16BIT | SMC91X_IO_SHIFT_1 | IORESOURCE_IRQ_LOWLEVEL,
33};
34
35static struct resource smc91x_res[] = {
36 [0] = {
37 .start = SMC_IOADDR,
38 .end = SMC_IOADDR + SZ_32 - 1,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = ETHERNET_IRQ,
43 .end = ETHERNET_IRQ,
44 .flags = IORESOURCE_IRQ ,
45 }
46};
47
48static struct platform_device smc91x_dev = {
49 .name = "smc91x",
50 .id = -1,
51 .num_resources = ARRAY_SIZE(smc91x_res),
52 .resource = smc91x_res,
53
54 .dev = {
55 .platform_data = &smc91x_info,
56 },
57};
58
59/* platform init code */
60static struct platform_device *edosk7705_devices[] __initdata = {
61 &smc91x_dev,
62};
63
64static int __init init_edosk7705_devices(void)
65{
66 return platform_add_devices(edosk7705_devices,
67 ARRAY_SIZE(edosk7705_devices));
68}
69device_initcall(init_edosk7705_devices);
70
71/*
72 * The Machine Vector
73 */
74static struct sh_machine_vector mv_edosk7705 __initmv = {
75 .mv_name = "EDOSK7705",
76 .mv_nr_irqs = 80,
77 .mv_init_irq = sh_edosk7705_init_irq,
78};
diff --git a/arch/sh/boards/board-edosk7760.c b/arch/sh/boards/board-edosk7760.c
index 35dc0994875d..e9656a2cc4cc 100644
--- a/arch/sh/boards/board-edosk7760.c
+++ b/arch/sh/boards/board-edosk7760.c
@@ -56,7 +56,7 @@ static struct mtd_partition edosk7760_nor_flash_partitions[] = {
56 }, { 56 }, {
57 .name = "fs", 57 .name = "fs",
58 .offset = MTDPART_OFS_APPEND, 58 .offset = MTDPART_OFS_APPEND,
59 .size = SZ_26M, 59 .size = (26 << 20),
60 }, { 60 }, {
61 .name = "other", 61 .name = "other",
62 .offset = MTDPART_OFS_APPEND, 62 .offset = MTDPART_OFS_APPEND,
@@ -182,7 +182,7 @@ static int __init init_edosk7760_devices(void)
182 return platform_add_devices(edosk7760_devices, 182 return platform_add_devices(edosk7760_devices,
183 ARRAY_SIZE(edosk7760_devices)); 183 ARRAY_SIZE(edosk7760_devices));
184} 184}
185__initcall(init_edosk7760_devices); 185device_initcall(init_edosk7760_devices);
186 186
187/* 187/*
188 * The Machine Vector 188 * The Machine Vector
diff --git a/arch/sh/boards/board-espt.c b/arch/sh/boards/board-espt.c
index d5ce5e18eb37..9da92ac36533 100644
--- a/arch/sh/boards/board-espt.c
+++ b/arch/sh/boards/board-espt.c
@@ -66,6 +66,11 @@ static struct resource sh_eth_resources[] = {
66 .end = 0xFEE00F7C - 1, 66 .end = 0xFEE00F7C - 1,
67 .flags = IORESOURCE_MEM, 67 .flags = IORESOURCE_MEM,
68 }, { 68 }, {
69 .start = 0xFEE01800, /* TSU */
70 .end = 0xFEE01FFF,
71 .flags = IORESOURCE_MEM,
72 }, {
73
69 .start = 57, /* irq number */ 74 .start = 57, /* irq number */
70 .flags = IORESOURCE_IRQ, 75 .flags = IORESOURCE_IRQ,
71 }, 76 },
@@ -74,6 +79,8 @@ static struct resource sh_eth_resources[] = {
74static struct sh_eth_plat_data sh7763_eth_pdata = { 79static struct sh_eth_plat_data sh7763_eth_pdata = {
75 .phy = 0, 80 .phy = 0,
76 .edmac_endian = EDMAC_LITTLE_ENDIAN, 81 .edmac_endian = EDMAC_LITTLE_ENDIAN,
82 .register_type = SH_ETH_REG_GIGABIT,
83 .phy_interface = PHY_INTERFACE_MODE_MII,
77}; 84};
78 85
79static struct platform_device espt_eth_device = { 86static struct platform_device espt_eth_device = {
diff --git a/arch/sh/boards/board-magicpanelr2.c b/arch/sh/boards/board-magicpanelr2.c
index efba450a0518..93f5039099b7 100644
--- a/arch/sh/boards/board-magicpanelr2.c
+++ b/arch/sh/boards/board-magicpanelr2.c
@@ -388,12 +388,12 @@ static void __init init_mpr2_IRQ(void)
388{ 388{
389 plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-5 */ 389 plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-5 */
390 390
391 set_irq_type(32, IRQ_TYPE_LEVEL_LOW); /* IRQ0 CAN1 */ 391 irq_set_irq_type(32, IRQ_TYPE_LEVEL_LOW); /* IRQ0 CAN1 */
392 set_irq_type(33, IRQ_TYPE_LEVEL_LOW); /* IRQ1 CAN2 */ 392 irq_set_irq_type(33, IRQ_TYPE_LEVEL_LOW); /* IRQ1 CAN2 */
393 set_irq_type(34, IRQ_TYPE_LEVEL_LOW); /* IRQ2 CAN3 */ 393 irq_set_irq_type(34, IRQ_TYPE_LEVEL_LOW); /* IRQ2 CAN3 */
394 set_irq_type(35, IRQ_TYPE_LEVEL_LOW); /* IRQ3 SMSC9115 */ 394 irq_set_irq_type(35, IRQ_TYPE_LEVEL_LOW); /* IRQ3 SMSC9115 */
395 set_irq_type(36, IRQ_TYPE_EDGE_RISING); /* IRQ4 touchscreen */ 395 irq_set_irq_type(36, IRQ_TYPE_EDGE_RISING); /* IRQ4 touchscreen */
396 set_irq_type(37, IRQ_TYPE_EDGE_FALLING); /* IRQ5 touchscreen */ 396 irq_set_irq_type(37, IRQ_TYPE_EDGE_FALLING); /* IRQ5 touchscreen */
397 397
398 intc_set_priority(32, 13); /* IRQ0 CAN1 */ 398 intc_set_priority(32, 13); /* IRQ0 CAN1 */
399 intc_set_priority(33, 13); /* IRQ0 CAN2 */ 399 intc_set_priority(33, 13); /* IRQ0 CAN2 */
diff --git a/arch/sh/boards/mach-snapgear/setup.c b/arch/sh/boards/board-secureedge5410.c
index 331745dee379..f968f17891a4 100644
--- a/arch/sh/boards/mach-snapgear/setup.c
+++ b/arch/sh/boards/board-secureedge5410.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/sh/boards/snapgear/setup.c
3 *
4 * Copyright (C) 2002 David McCullough <davidm@snapgear.com> 2 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
5 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> 3 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
6 * 4 *
@@ -19,19 +17,18 @@
19#include <linux/module.h> 17#include <linux/module.h>
20#include <linux/sched.h> 18#include <linux/sched.h>
21#include <asm/machvec.h> 19#include <asm/machvec.h>
22#include <mach/snapgear.h> 20#include <mach/secureedge5410.h>
23#include <asm/irq.h> 21#include <asm/irq.h>
24#include <asm/io.h> 22#include <asm/io.h>
25#include <cpu/timer.h> 23#include <cpu/timer.h>
26 24
25unsigned short secureedge5410_ioport;
26
27/* 27/*
28 * EraseConfig handling functions 28 * EraseConfig handling functions
29 */ 29 */
30
31static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) 30static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
32{ 31{
33 (void)__raw_readb(0xb8000000); /* dummy read */
34
35 printk("SnapGear: erase switch interrupt!\n"); 32 printk("SnapGear: erase switch interrupt!\n");
36 33
37 return IRQ_HANDLED; 34 return IRQ_HANDLED;
@@ -39,21 +36,22 @@ static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
39 36
40static int __init eraseconfig_init(void) 37static int __init eraseconfig_init(void)
41{ 38{
39 unsigned int irq = evt2irq(0x240);
40
42 printk("SnapGear: EraseConfig init\n"); 41 printk("SnapGear: EraseConfig init\n");
42
43 /* Setup "EraseConfig" switch on external IRQ 0 */ 43 /* Setup "EraseConfig" switch on external IRQ 0 */
44 if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED, 44 if (request_irq(irq, eraseconfig_interrupt, IRQF_DISABLED,
45 "Erase Config", NULL)) 45 "Erase Config", NULL))
46 printk("SnapGear: failed to register IRQ%d for Reset witch\n", 46 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
47 IRL0_IRQ); 47 irq);
48 else 48 else
49 printk("SnapGear: registered EraseConfig switch on IRQ%d\n", 49 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
50 IRL0_IRQ); 50 irq);
51 return(0); 51 return 0;
52} 52}
53
54module_init(eraseconfig_init); 53module_init(eraseconfig_init);
55 54
56/****************************************************************************/
57/* 55/*
58 * Initialize IRQ setting 56 * Initialize IRQ setting
59 * 57 *
@@ -62,7 +60,6 @@ module_init(eraseconfig_init);
62 * IRL2 = eth1 60 * IRL2 = eth1
63 * IRL3 = crypto 61 * IRL3 = crypto
64 */ 62 */
65
66static void __init init_snapgear_IRQ(void) 63static void __init init_snapgear_IRQ(void)
67{ 64{
68 printk("Setup SnapGear IRQ/IPR ...\n"); 65 printk("Setup SnapGear IRQ/IPR ...\n");
@@ -76,20 +73,5 @@ static void __init init_snapgear_IRQ(void)
76static struct sh_machine_vector mv_snapgear __initmv = { 73static struct sh_machine_vector mv_snapgear __initmv = {
77 .mv_name = "SnapGear SecureEdge5410", 74 .mv_name = "SnapGear SecureEdge5410",
78 .mv_nr_irqs = 72, 75 .mv_nr_irqs = 72,
79
80 .mv_inb = snapgear_inb,
81 .mv_inw = snapgear_inw,
82 .mv_inl = snapgear_inl,
83 .mv_outb = snapgear_outb,
84 .mv_outw = snapgear_outw,
85 .mv_outl = snapgear_outl,
86
87 .mv_inb_p = snapgear_inb_p,
88 .mv_inw_p = snapgear_inw,
89 .mv_inl_p = snapgear_inl,
90 .mv_outb_p = snapgear_outb_p,
91 .mv_outw_p = snapgear_outw,
92 .mv_outl_p = snapgear_outl,
93
94 .mv_init_irq = init_snapgear_IRQ, 76 .mv_init_irq = init_snapgear_IRQ,
95}; 77};
diff --git a/arch/sh/boards/board-sh2007.c b/arch/sh/boards/board-sh2007.c
new file mode 100644
index 000000000000..b90b78f6a829
--- /dev/null
+++ b/arch/sh/boards/board-sh2007.c
@@ -0,0 +1,133 @@
1/*
2 * SH-2007 board support.
3 *
4 * Copyright (C) 2003, 2004 SUGIOKA Toshinobu
5 * Copyright (C) 2010 Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
6 */
7#include <linux/init.h>
8#include <linux/irq.h>
9#include <linux/smsc911x.h>
10#include <linux/platform_device.h>
11#include <linux/ata_platform.h>
12#include <linux/io.h>
13#include <asm/machvec.h>
14#include <mach/sh2007.h>
15
16struct smsc911x_platform_config smc911x_info = {
17 .flags = SMSC911X_USE_32BIT,
18 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
19 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
20};
21
22static struct resource smsc9118_0_resources[] = {
23 [0] = {
24 .start = SMC0_BASE,
25 .end = SMC0_BASE + 0xff,
26 .flags = IORESOURCE_MEM,
27 },
28 [1] = {
29 .start = evt2irq(0x240),
30 .end = evt2irq(0x240),
31 .flags = IORESOURCE_IRQ,
32 }
33};
34
35static struct resource smsc9118_1_resources[] = {
36 [0] = {
37 .start = SMC1_BASE,
38 .end = SMC1_BASE + 0xff,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = evt2irq(0x280),
43 .end = evt2irq(0x280),
44 .flags = IORESOURCE_IRQ,
45 }
46};
47
48static struct platform_device smsc9118_0_device = {
49 .name = "smsc911x",
50 .id = 0,
51 .num_resources = ARRAY_SIZE(smsc9118_0_resources),
52 .resource = smsc9118_0_resources,
53 .dev = {
54 .platform_data = &smc911x_info,
55 },
56};
57
58static struct platform_device smsc9118_1_device = {
59 .name = "smsc911x",
60 .id = 1,
61 .num_resources = ARRAY_SIZE(smsc9118_1_resources),
62 .resource = smsc9118_1_resources,
63 .dev = {
64 .platform_data = &smc911x_info,
65 },
66};
67
68static struct resource cf_resources[] = {
69 [0] = {
70 .start = CF_BASE + CF_OFFSET,
71 .end = CF_BASE + CF_OFFSET + 0x0f,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
75 .start = CF_BASE + CF_OFFSET + 0x206,
76 .end = CF_BASE + CF_OFFSET + 0x20f,
77 .flags = IORESOURCE_MEM,
78 },
79 [2] = {
80 .start = evt2irq(0x2c0),
81 .end = evt2irq(0x2c0),
82 .flags = IORESOURCE_IRQ,
83 },
84};
85
86static struct platform_device cf_device = {
87 .name = "pata_platform",
88 .id = 0,
89 .num_resources = ARRAY_SIZE(cf_resources),
90 .resource = cf_resources,
91};
92
93static struct platform_device *sh2007_devices[] __initdata = {
94 &smsc9118_0_device,
95 &smsc9118_1_device,
96 &cf_device,
97};
98
99static int __init sh2007_io_init(void)
100{
101 platform_add_devices(sh2007_devices, ARRAY_SIZE(sh2007_devices));
102 return 0;
103}
104subsys_initcall(sh2007_io_init);
105
106static void __init sh2007_init_irq(void)
107{
108 plat_irq_setup_pins(IRQ_MODE_IRQ);
109}
110
111/*
112 * Initialize the board
113 */
114static void __init sh2007_setup(char **cmdline_p)
115{
116 printk(KERN_INFO "SH-2007 Setup...");
117
118 /* setup wait control registers for area 5 */
119 __raw_writel(CS5BCR_D, CS5BCR);
120 __raw_writel(CS5WCR_D, CS5WCR);
121 __raw_writel(CS5PCR_D, CS5PCR);
122
123 printk(KERN_INFO " done.\n");
124}
125
126/*
127 * The Machine Vector
128 */
129struct sh_machine_vector mv_sh2007 __initmv = {
130 .mv_setup = sh2007_setup,
131 .mv_name = "sh2007",
132 .mv_init_irq = sh2007_init_irq,
133};
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
new file mode 100644
index 000000000000..fa2a208ec6cb
--- /dev/null
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -0,0 +1,559 @@
1/*
2 * Renesas R0P7757LC0012RL Support.
3 *
4 * Copyright (C) 2009 - 2010 Renesas Solutions Corp.
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/init.h>
12#include <linux/platform_device.h>
13#include <linux/gpio.h>
14#include <linux/irq.h>
15#include <linux/spi/spi.h>
16#include <linux/spi/flash.h>
17#include <linux/io.h>
18#include <linux/mmc/host.h>
19#include <linux/mmc/sh_mmcif.h>
20#include <linux/mmc/sh_mobile_sdhi.h>
21#include <cpu/sh7757.h>
22#include <asm/sh_eth.h>
23#include <asm/heartbeat.h>
24
25static struct resource heartbeat_resource = {
26 .start = 0xffec005c, /* PUDR */
27 .end = 0xffec005c,
28 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
29};
30
31static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3 };
32
33static struct heartbeat_data heartbeat_data = {
34 .bit_pos = heartbeat_bit_pos,
35 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
36 .flags = HEARTBEAT_INVERTED,
37};
38
39static struct platform_device heartbeat_device = {
40 .name = "heartbeat",
41 .id = -1,
42 .dev = {
43 .platform_data = &heartbeat_data,
44 },
45 .num_resources = 1,
46 .resource = &heartbeat_resource,
47};
48
49/* Fast Ethernet */
50#define GBECONT 0xffc10100
51#define GBECONT_RMII1 BIT(17)
52#define GBECONT_RMII0 BIT(16)
53static void sh7757_eth_set_mdio_gate(unsigned long addr)
54{
55 if ((addr & 0x00000fff) < 0x0800)
56 writel(readl(GBECONT) | GBECONT_RMII0, GBECONT);
57 else
58 writel(readl(GBECONT) | GBECONT_RMII1, GBECONT);
59}
60
61static struct resource sh_eth0_resources[] = {
62 {
63 .start = 0xfef00000,
64 .end = 0xfef001ff,
65 .flags = IORESOURCE_MEM,
66 }, {
67 .start = 84,
68 .end = 84,
69 .flags = IORESOURCE_IRQ,
70 },
71};
72
73static struct sh_eth_plat_data sh7757_eth0_pdata = {
74 .phy = 1,
75 .edmac_endian = EDMAC_LITTLE_ENDIAN,
76 .register_type = SH_ETH_REG_FAST_SH4,
77 .set_mdio_gate = sh7757_eth_set_mdio_gate,
78};
79
80static struct platform_device sh7757_eth0_device = {
81 .name = "sh-eth",
82 .resource = sh_eth0_resources,
83 .id = 0,
84 .num_resources = ARRAY_SIZE(sh_eth0_resources),
85 .dev = {
86 .platform_data = &sh7757_eth0_pdata,
87 },
88};
89
90static struct resource sh_eth1_resources[] = {
91 {
92 .start = 0xfef00800,
93 .end = 0xfef009ff,
94 .flags = IORESOURCE_MEM,
95 }, {
96 .start = 84,
97 .end = 84,
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
102static struct sh_eth_plat_data sh7757_eth1_pdata = {
103 .phy = 1,
104 .edmac_endian = EDMAC_LITTLE_ENDIAN,
105 .register_type = SH_ETH_REG_FAST_SH4,
106 .set_mdio_gate = sh7757_eth_set_mdio_gate,
107};
108
109static struct platform_device sh7757_eth1_device = {
110 .name = "sh-eth",
111 .resource = sh_eth1_resources,
112 .id = 1,
113 .num_resources = ARRAY_SIZE(sh_eth1_resources),
114 .dev = {
115 .platform_data = &sh7757_eth1_pdata,
116 },
117};
118
119static void sh7757_eth_giga_set_mdio_gate(unsigned long addr)
120{
121 if ((addr & 0x00000fff) < 0x0800) {
122 gpio_set_value(GPIO_PTT4, 1);
123 writel(readl(GBECONT) & ~GBECONT_RMII0, GBECONT);
124 } else {
125 gpio_set_value(GPIO_PTT4, 0);
126 writel(readl(GBECONT) & ~GBECONT_RMII1, GBECONT);
127 }
128}
129
130static struct resource sh_eth_giga0_resources[] = {
131 {
132 .start = 0xfee00000,
133 .end = 0xfee007ff,
134 .flags = IORESOURCE_MEM,
135 }, {
136 /* TSU */
137 .start = 0xfee01800,
138 .end = 0xfee01fff,
139 .flags = IORESOURCE_MEM,
140 }, {
141 .start = 315,
142 .end = 315,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct sh_eth_plat_data sh7757_eth_giga0_pdata = {
148 .phy = 18,
149 .edmac_endian = EDMAC_LITTLE_ENDIAN,
150 .register_type = SH_ETH_REG_GIGABIT,
151 .set_mdio_gate = sh7757_eth_giga_set_mdio_gate,
152 .phy_interface = PHY_INTERFACE_MODE_RGMII_ID,
153};
154
155static struct platform_device sh7757_eth_giga0_device = {
156 .name = "sh-eth",
157 .resource = sh_eth_giga0_resources,
158 .id = 2,
159 .num_resources = ARRAY_SIZE(sh_eth_giga0_resources),
160 .dev = {
161 .platform_data = &sh7757_eth_giga0_pdata,
162 },
163};
164
165static struct resource sh_eth_giga1_resources[] = {
166 {
167 .start = 0xfee00800,
168 .end = 0xfee00fff,
169 .flags = IORESOURCE_MEM,
170 }, {
171 .start = 316,
172 .end = 316,
173 .flags = IORESOURCE_IRQ,
174 },
175};
176
177static struct sh_eth_plat_data sh7757_eth_giga1_pdata = {
178 .phy = 19,
179 .edmac_endian = EDMAC_LITTLE_ENDIAN,
180 .register_type = SH_ETH_REG_GIGABIT,
181 .set_mdio_gate = sh7757_eth_giga_set_mdio_gate,
182 .phy_interface = PHY_INTERFACE_MODE_RGMII_ID,
183};
184
185static struct platform_device sh7757_eth_giga1_device = {
186 .name = "sh-eth",
187 .resource = sh_eth_giga1_resources,
188 .id = 3,
189 .num_resources = ARRAY_SIZE(sh_eth_giga1_resources),
190 .dev = {
191 .platform_data = &sh7757_eth_giga1_pdata,
192 },
193};
194
195/* SH_MMCIF */
196static struct resource sh_mmcif_resources[] = {
197 [0] = {
198 .start = 0xffcb0000,
199 .end = 0xffcb00ff,
200 .flags = IORESOURCE_MEM,
201 },
202 [1] = {
203 .start = 211,
204 .flags = IORESOURCE_IRQ,
205 },
206 [2] = {
207 .start = 212,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211
212static struct sh_mmcif_dma sh7757lcr_mmcif_dma = {
213 .chan_priv_tx = SHDMA_SLAVE_MMCIF_TX,
214 .chan_priv_rx = SHDMA_SLAVE_MMCIF_RX,
215};
216
217static struct sh_mmcif_plat_data sh_mmcif_plat = {
218 .dma = &sh7757lcr_mmcif_dma,
219 .sup_pclk = 0x0f,
220 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
221 .ocr = MMC_VDD_32_33 | MMC_VDD_33_34,
222};
223
224static struct platform_device sh_mmcif_device = {
225 .name = "sh_mmcif",
226 .id = 0,
227 .dev = {
228 .platform_data = &sh_mmcif_plat,
229 },
230 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
231 .resource = sh_mmcif_resources,
232};
233
234/* SDHI0 */
235static struct sh_mobile_sdhi_info sdhi_info = {
236 .dma_slave_tx = SHDMA_SLAVE_SDHI_TX,
237 .dma_slave_rx = SHDMA_SLAVE_SDHI_RX,
238 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
239};
240
241static struct resource sdhi_resources[] = {
242 [0] = {
243 .start = 0xffe50000,
244 .end = 0xffe501ff,
245 .flags = IORESOURCE_MEM,
246 },
247 [1] = {
248 .start = 20,
249 .flags = IORESOURCE_IRQ,
250 },
251};
252
253static struct platform_device sdhi_device = {
254 .name = "sh_mobile_sdhi",
255 .num_resources = ARRAY_SIZE(sdhi_resources),
256 .resource = sdhi_resources,
257 .id = 0,
258 .dev = {
259 .platform_data = &sdhi_info,
260 },
261};
262
263static struct platform_device *sh7757lcr_devices[] __initdata = {
264 &heartbeat_device,
265 &sh7757_eth0_device,
266 &sh7757_eth1_device,
267 &sh7757_eth_giga0_device,
268 &sh7757_eth_giga1_device,
269 &sh_mmcif_device,
270 &sdhi_device,
271};
272
273static struct flash_platform_data spi_flash_data = {
274 .name = "m25p80",
275 .type = "m25px64",
276};
277
278static struct spi_board_info spi_board_info[] = {
279 {
280 .modalias = "m25p80",
281 .max_speed_hz = 25000000,
282 .bus_num = 0,
283 .chip_select = 1,
284 .platform_data = &spi_flash_data,
285 },
286};
287
288static int __init sh7757lcr_devices_setup(void)
289{
290 /* RGMII (PTA) */
291 gpio_request(GPIO_FN_ET0_MDC, NULL);
292 gpio_request(GPIO_FN_ET0_MDIO, NULL);
293 gpio_request(GPIO_FN_ET1_MDC, NULL);
294 gpio_request(GPIO_FN_ET1_MDIO, NULL);
295
296 /* ONFI (PTB, PTZ) */
297 gpio_request(GPIO_FN_ON_NRE, NULL);
298 gpio_request(GPIO_FN_ON_NWE, NULL);
299 gpio_request(GPIO_FN_ON_NWP, NULL);
300 gpio_request(GPIO_FN_ON_NCE0, NULL);
301 gpio_request(GPIO_FN_ON_R_B0, NULL);
302 gpio_request(GPIO_FN_ON_ALE, NULL);
303 gpio_request(GPIO_FN_ON_CLE, NULL);
304
305 gpio_request(GPIO_FN_ON_DQ7, NULL);
306 gpio_request(GPIO_FN_ON_DQ6, NULL);
307 gpio_request(GPIO_FN_ON_DQ5, NULL);
308 gpio_request(GPIO_FN_ON_DQ4, NULL);
309 gpio_request(GPIO_FN_ON_DQ3, NULL);
310 gpio_request(GPIO_FN_ON_DQ2, NULL);
311 gpio_request(GPIO_FN_ON_DQ1, NULL);
312 gpio_request(GPIO_FN_ON_DQ0, NULL);
313
314 /* IRQ8 to 0 (PTB, PTC) */
315 gpio_request(GPIO_FN_IRQ8, NULL);
316 gpio_request(GPIO_FN_IRQ7, NULL);
317 gpio_request(GPIO_FN_IRQ6, NULL);
318 gpio_request(GPIO_FN_IRQ5, NULL);
319 gpio_request(GPIO_FN_IRQ4, NULL);
320 gpio_request(GPIO_FN_IRQ3, NULL);
321 gpio_request(GPIO_FN_IRQ2, NULL);
322 gpio_request(GPIO_FN_IRQ1, NULL);
323 gpio_request(GPIO_FN_IRQ0, NULL);
324
325 /* SPI0 (PTD) */
326 gpio_request(GPIO_FN_SP0_MOSI, NULL);
327 gpio_request(GPIO_FN_SP0_MISO, NULL);
328 gpio_request(GPIO_FN_SP0_SCK, NULL);
329 gpio_request(GPIO_FN_SP0_SCK_FB, NULL);
330 gpio_request(GPIO_FN_SP0_SS0, NULL);
331 gpio_request(GPIO_FN_SP0_SS1, NULL);
332 gpio_request(GPIO_FN_SP0_SS2, NULL);
333 gpio_request(GPIO_FN_SP0_SS3, NULL);
334
335 /* RMII 0/1 (PTE, PTF) */
336 gpio_request(GPIO_FN_RMII0_CRS_DV, NULL);
337 gpio_request(GPIO_FN_RMII0_TXD1, NULL);
338 gpio_request(GPIO_FN_RMII0_TXD0, NULL);
339 gpio_request(GPIO_FN_RMII0_TXEN, NULL);
340 gpio_request(GPIO_FN_RMII0_REFCLK, NULL);
341 gpio_request(GPIO_FN_RMII0_RXD1, NULL);
342 gpio_request(GPIO_FN_RMII0_RXD0, NULL);
343 gpio_request(GPIO_FN_RMII0_RX_ER, NULL);
344 gpio_request(GPIO_FN_RMII1_CRS_DV, NULL);
345 gpio_request(GPIO_FN_RMII1_TXD1, NULL);
346 gpio_request(GPIO_FN_RMII1_TXD0, NULL);
347 gpio_request(GPIO_FN_RMII1_TXEN, NULL);
348 gpio_request(GPIO_FN_RMII1_REFCLK, NULL);
349 gpio_request(GPIO_FN_RMII1_RXD1, NULL);
350 gpio_request(GPIO_FN_RMII1_RXD0, NULL);
351 gpio_request(GPIO_FN_RMII1_RX_ER, NULL);
352
353 /* eMMC (PTG) */
354 gpio_request(GPIO_FN_MMCCLK, NULL);
355 gpio_request(GPIO_FN_MMCCMD, NULL);
356 gpio_request(GPIO_FN_MMCDAT7, NULL);
357 gpio_request(GPIO_FN_MMCDAT6, NULL);
358 gpio_request(GPIO_FN_MMCDAT5, NULL);
359 gpio_request(GPIO_FN_MMCDAT4, NULL);
360 gpio_request(GPIO_FN_MMCDAT3, NULL);
361 gpio_request(GPIO_FN_MMCDAT2, NULL);
362 gpio_request(GPIO_FN_MMCDAT1, NULL);
363 gpio_request(GPIO_FN_MMCDAT0, NULL);
364
365 /* LPC (PTG, PTH, PTQ, PTU) */
366 gpio_request(GPIO_FN_SERIRQ, NULL);
367 gpio_request(GPIO_FN_LPCPD, NULL);
368 gpio_request(GPIO_FN_LDRQ, NULL);
369 gpio_request(GPIO_FN_WP, NULL);
370 gpio_request(GPIO_FN_FMS0, NULL);
371 gpio_request(GPIO_FN_LAD3, NULL);
372 gpio_request(GPIO_FN_LAD2, NULL);
373 gpio_request(GPIO_FN_LAD1, NULL);
374 gpio_request(GPIO_FN_LAD0, NULL);
375 gpio_request(GPIO_FN_LFRAME, NULL);
376 gpio_request(GPIO_FN_LRESET, NULL);
377 gpio_request(GPIO_FN_LCLK, NULL);
378 gpio_request(GPIO_FN_LGPIO7, NULL);
379 gpio_request(GPIO_FN_LGPIO6, NULL);
380 gpio_request(GPIO_FN_LGPIO5, NULL);
381 gpio_request(GPIO_FN_LGPIO4, NULL);
382
383 /* SPI1 (PTH) */
384 gpio_request(GPIO_FN_SP1_MOSI, NULL);
385 gpio_request(GPIO_FN_SP1_MISO, NULL);
386 gpio_request(GPIO_FN_SP1_SCK, NULL);
387 gpio_request(GPIO_FN_SP1_SCK_FB, NULL);
388 gpio_request(GPIO_FN_SP1_SS0, NULL);
389 gpio_request(GPIO_FN_SP1_SS1, NULL);
390
391 /* SDHI (PTI) */
392 gpio_request(GPIO_FN_SD_WP, NULL);
393 gpio_request(GPIO_FN_SD_CD, NULL);
394 gpio_request(GPIO_FN_SD_CLK, NULL);
395 gpio_request(GPIO_FN_SD_CMD, NULL);
396 gpio_request(GPIO_FN_SD_D3, NULL);
397 gpio_request(GPIO_FN_SD_D2, NULL);
398 gpio_request(GPIO_FN_SD_D1, NULL);
399 gpio_request(GPIO_FN_SD_D0, NULL);
400
401 /* SCIF3/4 (PTJ, PTW) */
402 gpio_request(GPIO_FN_RTS3, NULL);
403 gpio_request(GPIO_FN_CTS3, NULL);
404 gpio_request(GPIO_FN_TXD3, NULL);
405 gpio_request(GPIO_FN_RXD3, NULL);
406 gpio_request(GPIO_FN_RTS4, NULL);
407 gpio_request(GPIO_FN_RXD4, NULL);
408 gpio_request(GPIO_FN_TXD4, NULL);
409 gpio_request(GPIO_FN_CTS4, NULL);
410
411 /* SERMUX (PTK, PTL, PTO, PTV) */
412 gpio_request(GPIO_FN_COM2_TXD, NULL);
413 gpio_request(GPIO_FN_COM2_RXD, NULL);
414 gpio_request(GPIO_FN_COM2_RTS, NULL);
415 gpio_request(GPIO_FN_COM2_CTS, NULL);
416 gpio_request(GPIO_FN_COM2_DTR, NULL);
417 gpio_request(GPIO_FN_COM2_DSR, NULL);
418 gpio_request(GPIO_FN_COM2_DCD, NULL);
419 gpio_request(GPIO_FN_COM2_RI, NULL);
420 gpio_request(GPIO_FN_RAC_RXD, NULL);
421 gpio_request(GPIO_FN_RAC_RTS, NULL);
422 gpio_request(GPIO_FN_RAC_CTS, NULL);
423 gpio_request(GPIO_FN_RAC_DTR, NULL);
424 gpio_request(GPIO_FN_RAC_DSR, NULL);
425 gpio_request(GPIO_FN_RAC_DCD, NULL);
426 gpio_request(GPIO_FN_RAC_TXD, NULL);
427 gpio_request(GPIO_FN_COM1_TXD, NULL);
428 gpio_request(GPIO_FN_COM1_RXD, NULL);
429 gpio_request(GPIO_FN_COM1_RTS, NULL);
430 gpio_request(GPIO_FN_COM1_CTS, NULL);
431
432 writeb(0x10, 0xfe470000); /* SMR0: SerMux mode 0 */
433
434 /* IIC (PTM, PTR, PTS) */
435 gpio_request(GPIO_FN_SDA7, NULL);
436 gpio_request(GPIO_FN_SCL7, NULL);
437 gpio_request(GPIO_FN_SDA6, NULL);
438 gpio_request(GPIO_FN_SCL6, NULL);
439 gpio_request(GPIO_FN_SDA5, NULL);
440 gpio_request(GPIO_FN_SCL5, NULL);
441 gpio_request(GPIO_FN_SDA4, NULL);
442 gpio_request(GPIO_FN_SCL4, NULL);
443 gpio_request(GPIO_FN_SDA3, NULL);
444 gpio_request(GPIO_FN_SCL3, NULL);
445 gpio_request(GPIO_FN_SDA2, NULL);
446 gpio_request(GPIO_FN_SCL2, NULL);
447 gpio_request(GPIO_FN_SDA1, NULL);
448 gpio_request(GPIO_FN_SCL1, NULL);
449 gpio_request(GPIO_FN_SDA0, NULL);
450 gpio_request(GPIO_FN_SCL0, NULL);
451
452 /* USB (PTN) */
453 gpio_request(GPIO_FN_VBUS_EN, NULL);
454 gpio_request(GPIO_FN_VBUS_OC, NULL);
455
456 /* SGPIO1/0 (PTN, PTO) */
457 gpio_request(GPIO_FN_SGPIO1_CLK, NULL);
458 gpio_request(GPIO_FN_SGPIO1_LOAD, NULL);
459 gpio_request(GPIO_FN_SGPIO1_DI, NULL);
460 gpio_request(GPIO_FN_SGPIO1_DO, NULL);
461 gpio_request(GPIO_FN_SGPIO0_CLK, NULL);
462 gpio_request(GPIO_FN_SGPIO0_LOAD, NULL);
463 gpio_request(GPIO_FN_SGPIO0_DI, NULL);
464 gpio_request(GPIO_FN_SGPIO0_DO, NULL);
465
466 /* WDT (PTN) */
467 gpio_request(GPIO_FN_SUB_CLKIN, NULL);
468
469 /* System (PTT) */
470 gpio_request(GPIO_FN_STATUS1, NULL);
471 gpio_request(GPIO_FN_STATUS0, NULL);
472
473 /* PWMX (PTT) */
474 gpio_request(GPIO_FN_PWMX1, NULL);
475 gpio_request(GPIO_FN_PWMX0, NULL);
476
477 /* R-SPI (PTV) */
478 gpio_request(GPIO_FN_R_SPI_MOSI, NULL);
479 gpio_request(GPIO_FN_R_SPI_MISO, NULL);
480 gpio_request(GPIO_FN_R_SPI_RSPCK, NULL);
481 gpio_request(GPIO_FN_R_SPI_SSL0, NULL);
482 gpio_request(GPIO_FN_R_SPI_SSL1, NULL);
483
484 /* EVC (PTV, PTW) */
485 gpio_request(GPIO_FN_EVENT7, NULL);
486 gpio_request(GPIO_FN_EVENT6, NULL);
487 gpio_request(GPIO_FN_EVENT5, NULL);
488 gpio_request(GPIO_FN_EVENT4, NULL);
489 gpio_request(GPIO_FN_EVENT3, NULL);
490 gpio_request(GPIO_FN_EVENT2, NULL);
491 gpio_request(GPIO_FN_EVENT1, NULL);
492 gpio_request(GPIO_FN_EVENT0, NULL);
493
494 /* LED for heartbeat */
495 gpio_request(GPIO_PTU3, NULL);
496 gpio_direction_output(GPIO_PTU3, 1);
497 gpio_request(GPIO_PTU2, NULL);
498 gpio_direction_output(GPIO_PTU2, 1);
499 gpio_request(GPIO_PTU1, NULL);
500 gpio_direction_output(GPIO_PTU1, 1);
501 gpio_request(GPIO_PTU0, NULL);
502 gpio_direction_output(GPIO_PTU0, 1);
503
504 /* control for MDIO of Gigabit Ethernet */
505 gpio_request(GPIO_PTT4, NULL);
506 gpio_direction_output(GPIO_PTT4, 1);
507
508 /* control for eMMC */
509 gpio_request(GPIO_PTT7, NULL); /* eMMC_RST# */
510 gpio_direction_output(GPIO_PTT7, 0);
511 gpio_request(GPIO_PTT6, NULL); /* eMMC_INDEX# */
512 gpio_direction_output(GPIO_PTT6, 0);
513 gpio_request(GPIO_PTT5, NULL); /* eMMC_PRST# */
514 gpio_direction_output(GPIO_PTT5, 1);
515
516 /* register SPI device information */
517 spi_register_board_info(spi_board_info,
518 ARRAY_SIZE(spi_board_info));
519
520 /* General platform */
521 return platform_add_devices(sh7757lcr_devices,
522 ARRAY_SIZE(sh7757lcr_devices));
523}
524arch_initcall(sh7757lcr_devices_setup);
525
526/* Initialize IRQ setting */
527void __init init_sh7757lcr_IRQ(void)
528{
529 plat_irq_setup_pins(IRQ_MODE_IRQ7654);
530 plat_irq_setup_pins(IRQ_MODE_IRQ3210);
531}
532
533/* Initialize the board */
534static void __init sh7757lcr_setup(char **cmdline_p)
535{
536 printk(KERN_INFO "Renesas R0P7757LC0012RL support.\n");
537}
538
539static int sh7757lcr_mode_pins(void)
540{
541 int value = 0;
542
543 /* These are the factory default settings of S3 (Low active).
544 * If you change these dip switches then you will need to
545 * adjust the values below as well.
546 */
547 value |= MODE_PIN0; /* Clock Mode: 1 */
548
549 return value;
550}
551
552/* The Machine Vector */
553static struct sh_machine_vector mv_sh7757lcr __initmv = {
554 .mv_name = "SH7757LCR",
555 .mv_setup = sh7757lcr_setup,
556 .mv_init_irq = init_sh7757lcr_IRQ,
557 .mv_mode_pins = sh7757lcr_mode_pins,
558};
559
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index fe7e686c94ac..ee65ff05c558 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -284,7 +284,7 @@ static int __init sh7785lcr_devices_setup(void)
284 return platform_add_devices(sh7785lcr_devices, 284 return platform_add_devices(sh7785lcr_devices,
285 ARRAY_SIZE(sh7785lcr_devices)); 285 ARRAY_SIZE(sh7785lcr_devices));
286} 286}
287__initcall(sh7785lcr_devices_setup); 287device_initcall(sh7785lcr_devices_setup);
288 288
289/* Initialize IRQ setting */ 289/* Initialize IRQ setting */
290void __init init_sh7785lcr_IRQ(void) 290void __init init_sh7785lcr_IRQ(void)
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 3da116f47f01..969421f64a15 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -14,6 +14,8 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mmc/host.h>
18#include <linux/mmc/sh_mobile_sdhi.h>
17#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
18#include <linux/mtd/sh_flctl.h> 20#include <linux/mtd/sh_flctl.h>
19#include <linux/delay.h> 21#include <linux/delay.h>
@@ -154,28 +156,53 @@ static struct platform_device nand_flash_device = {
154#define PORT_DRVCRA 0xA405018A 156#define PORT_DRVCRA 0xA405018A
155#define PORT_DRVCRB 0xA405018C 157#define PORT_DRVCRB 0xA405018C
156 158
159static int ap320_wvga_set_brightness(void *board_data, int brightness)
160{
161 if (brightness) {
162 gpio_set_value(GPIO_PTS3, 0);
163 __raw_writew(0x100, FPGA_BKLREG);
164 } else {
165 __raw_writew(0, FPGA_BKLREG);
166 gpio_set_value(GPIO_PTS3, 1);
167 }
168
169 return 0;
170}
171
172static int ap320_wvga_get_brightness(void *board_data)
173{
174 return gpio_get_value(GPIO_PTS3);
175}
176
157static void ap320_wvga_power_on(void *board_data, struct fb_info *info) 177static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
158{ 178{
159 msleep(100); 179 msleep(100);
160 180
161 /* ASD AP-320/325 LCD ON */ 181 /* ASD AP-320/325 LCD ON */
162 __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG); 182 __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
163
164 /* backlight */
165 gpio_set_value(GPIO_PTS3, 0);
166 __raw_writew(0x100, FPGA_BKLREG);
167} 183}
168 184
169static void ap320_wvga_power_off(void *board_data) 185static void ap320_wvga_power_off(void *board_data)
170{ 186{
171 /* backlight */
172 __raw_writew(0, FPGA_BKLREG);
173 gpio_set_value(GPIO_PTS3, 1);
174
175 /* ASD AP-320/325 LCD OFF */ 187 /* ASD AP-320/325 LCD OFF */
176 __raw_writew(0, FPGA_LCDREG); 188 __raw_writew(0, FPGA_LCDREG);
177} 189}
178 190
191const static struct fb_videomode ap325rxa_lcdc_modes[] = {
192 {
193 .name = "LB070WV1",
194 .xres = 800,
195 .yres = 480,
196 .left_margin = 32,
197 .right_margin = 160,
198 .hsync_len = 8,
199 .upper_margin = 63,
200 .lower_margin = 80,
201 .vsync_len = 1,
202 .sync = 0, /* hsync and vsync are active low */
203 },
204};
205
179static struct sh_mobile_lcdc_info lcdc_info = { 206static struct sh_mobile_lcdc_info lcdc_info = {
180 .clock_source = LCDC_CLK_EXTERNAL, 207 .clock_source = LCDC_CLK_EXTERNAL,
181 .ch[0] = { 208 .ch[0] = {
@@ -183,18 +210,8 @@ static struct sh_mobile_lcdc_info lcdc_info = {
183 .bpp = 16, 210 .bpp = 16,
184 .interface_type = RGB18, 211 .interface_type = RGB18,
185 .clock_divider = 1, 212 .clock_divider = 1,
186 .lcd_cfg = { 213 .lcd_cfg = ap325rxa_lcdc_modes,
187 .name = "LB070WV1", 214 .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
188 .xres = 800,
189 .yres = 480,
190 .left_margin = 32,
191 .right_margin = 160,
192 .hsync_len = 8,
193 .upper_margin = 63,
194 .lower_margin = 80,
195 .vsync_len = 1,
196 .sync = 0, /* hsync and vsync are active low */
197 },
198 .lcd_size_cfg = { /* 7.0 inch */ 215 .lcd_size_cfg = { /* 7.0 inch */
199 .width = 152, 216 .width = 152,
200 .height = 91, 217 .height = 91,
@@ -202,6 +219,12 @@ static struct sh_mobile_lcdc_info lcdc_info = {
202 .board_cfg = { 219 .board_cfg = {
203 .display_on = ap320_wvga_power_on, 220 .display_on = ap320_wvga_power_on,
204 .display_off = ap320_wvga_power_off, 221 .display_off = ap320_wvga_power_off,
222 .set_brightness = ap320_wvga_set_brightness,
223 .get_brightness = ap320_wvga_get_brightness,
224 },
225 .bl_info = {
226 .name = "sh_mobile_lcdc_bl",
227 .max_brightness = 1,
205 }, 228 },
206 } 229 }
207}; 230};
@@ -336,37 +359,31 @@ static struct soc_camera_link camera_link = {
336 .priv = &camera_info, 359 .priv = &camera_info,
337}; 360};
338 361
339static void dummy_release(struct device *dev) 362static struct platform_device *camera_device;
363
364static void ap325rxa_camera_release(struct device *dev)
340{ 365{
366 soc_camera_platform_release(&camera_device);
341} 367}
342 368
343static struct platform_device camera_device = {
344 .name = "soc_camera_platform",
345 .dev = {
346 .platform_data = &camera_info,
347 .release = dummy_release,
348 },
349};
350
351static int ap325rxa_camera_add(struct soc_camera_link *icl, 369static int ap325rxa_camera_add(struct soc_camera_link *icl,
352 struct device *dev) 370 struct device *dev)
353{ 371{
354 if (icl != &camera_link || camera_probe() <= 0) 372 int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link,
355 return -ENODEV; 373 ap325rxa_camera_release, 0);
374 if (ret < 0)
375 return ret;
356 376
357 camera_info.dev = dev; 377 ret = camera_probe();
378 if (ret < 0)
379 soc_camera_platform_del(icl, camera_device, &camera_link);
358 380
359 return platform_device_register(&camera_device); 381 return ret;
360} 382}
361 383
362static void ap325rxa_camera_del(struct soc_camera_link *icl) 384static void ap325rxa_camera_del(struct soc_camera_link *icl)
363{ 385{
364 if (icl != &camera_link) 386 soc_camera_platform_del(icl, camera_device, &camera_link);
365 return;
366
367 platform_device_unregister(&camera_device);
368 memset(&camera_device.dev.kobj, 0,
369 sizeof(camera_device.dev.kobj));
370} 387}
371#endif /* CONFIG_I2C */ 388#endif /* CONFIG_I2C */
372 389
@@ -416,7 +433,7 @@ static struct resource sdhi0_cn3_resources[] = {
416 [0] = { 433 [0] = {
417 .name = "SDHI0", 434 .name = "SDHI0",
418 .start = 0x04ce0000, 435 .start = 0x04ce0000,
419 .end = 0x04ce01ff, 436 .end = 0x04ce00ff,
420 .flags = IORESOURCE_MEM, 437 .flags = IORESOURCE_MEM,
421 }, 438 },
422 [1] = { 439 [1] = {
@@ -425,11 +442,18 @@ static struct resource sdhi0_cn3_resources[] = {
425 }, 442 },
426}; 443};
427 444
445static struct sh_mobile_sdhi_info sdhi0_cn3_data = {
446 .tmio_caps = MMC_CAP_SDIO_IRQ,
447};
448
428static struct platform_device sdhi0_cn3_device = { 449static struct platform_device sdhi0_cn3_device = {
429 .name = "sh_mobile_sdhi", 450 .name = "sh_mobile_sdhi",
430 .id = 0, /* "sdhi0" clock */ 451 .id = 0, /* "sdhi0" clock */
431 .num_resources = ARRAY_SIZE(sdhi0_cn3_resources), 452 .num_resources = ARRAY_SIZE(sdhi0_cn3_resources),
432 .resource = sdhi0_cn3_resources, 453 .resource = sdhi0_cn3_resources,
454 .dev = {
455 .platform_data = &sdhi0_cn3_data,
456 },
433 .archdata = { 457 .archdata = {
434 .hwblk_id = HWBLK_SDHI0, 458 .hwblk_id = HWBLK_SDHI0,
435 }, 459 },
@@ -439,7 +463,7 @@ static struct resource sdhi1_cn7_resources[] = {
439 [0] = { 463 [0] = {
440 .name = "SDHI1", 464 .name = "SDHI1",
441 .start = 0x04cf0000, 465 .start = 0x04cf0000,
442 .end = 0x04cf01ff, 466 .end = 0x04cf00ff,
443 .flags = IORESOURCE_MEM, 467 .flags = IORESOURCE_MEM,
444 }, 468 },
445 [1] = { 469 [1] = {
@@ -448,11 +472,18 @@ static struct resource sdhi1_cn7_resources[] = {
448 }, 472 },
449}; 473};
450 474
475static struct sh_mobile_sdhi_info sdhi1_cn7_data = {
476 .tmio_caps = MMC_CAP_SDIO_IRQ,
477};
478
451static struct platform_device sdhi1_cn7_device = { 479static struct platform_device sdhi1_cn7_device = {
452 .name = "sh_mobile_sdhi", 480 .name = "sh_mobile_sdhi",
453 .id = 1, /* "sdhi1" clock */ 481 .id = 1, /* "sdhi1" clock */
454 .num_resources = ARRAY_SIZE(sdhi1_cn7_resources), 482 .num_resources = ARRAY_SIZE(sdhi1_cn7_resources),
455 .resource = sdhi1_cn7_resources, 483 .resource = sdhi1_cn7_resources,
484 .dev = {
485 .platform_data = &sdhi1_cn7_data,
486 },
456 .archdata = { 487 .archdata = {
457 .hwblk_id = HWBLK_SDHI1, 488 .hwblk_id = HWBLK_SDHI1,
458 }, 489 },
@@ -481,7 +512,6 @@ static struct soc_camera_link ov7725_link = {
481 .power = ov7725_power, 512 .power = ov7725_power,
482 .board_info = &ap325rxa_i2c_camera[0], 513 .board_info = &ap325rxa_i2c_camera[0],
483 .i2c_adapter_id = 0, 514 .i2c_adapter_id = 0,
484 .module_name = "ov772x",
485 .priv = &ov7725_info, 515 .priv = &ov7725_info,
486}; 516};
487 517
diff --git a/arch/sh/boards/mach-cayman/irq.c b/arch/sh/boards/mach-cayman/irq.c
index 1394b078db36..311bcebdbd07 100644
--- a/arch/sh/boards/mach-cayman/irq.c
+++ b/arch/sh/boards/mach-cayman/irq.c
@@ -55,8 +55,9 @@ static struct irqaction cayman_action_pci2 = {
55 .flags = IRQF_DISABLED, 55 .flags = IRQF_DISABLED,
56}; 56};
57 57
58static void enable_cayman_irq(unsigned int irq) 58static void enable_cayman_irq(struct irq_data *data)
59{ 59{
60 unsigned int irq = data->irq;
60 unsigned long flags; 61 unsigned long flags;
61 unsigned long mask; 62 unsigned long mask;
62 unsigned int reg; 63 unsigned int reg;
@@ -72,8 +73,9 @@ static void enable_cayman_irq(unsigned int irq)
72 local_irq_restore(flags); 73 local_irq_restore(flags);
73} 74}
74 75
75void disable_cayman_irq(unsigned int irq) 76static void disable_cayman_irq(struct irq_data *data)
76{ 77{
78 unsigned int irq = data->irq;
77 unsigned long flags; 79 unsigned long flags;
78 unsigned long mask; 80 unsigned long mask;
79 unsigned int reg; 81 unsigned int reg;
@@ -89,16 +91,10 @@ void disable_cayman_irq(unsigned int irq)
89 local_irq_restore(flags); 91 local_irq_restore(flags);
90} 92}
91 93
92static void ack_cayman_irq(unsigned int irq)
93{
94 disable_cayman_irq(irq);
95}
96
97struct irq_chip cayman_irq_type = { 94struct irq_chip cayman_irq_type = {
98 .name = "Cayman-IRQ", 95 .name = "Cayman-IRQ",
99 .unmask = enable_cayman_irq, 96 .irq_unmask = enable_cayman_irq,
100 .mask = disable_cayman_irq, 97 .irq_mask = disable_cayman_irq,
101 .mask_ack = ack_cayman_irq,
102}; 98};
103 99
104int cayman_irq_demux(int evt) 100int cayman_irq_demux(int evt)
@@ -153,8 +149,8 @@ void init_cayman_irq(void)
153 } 149 }
154 150
155 for (i = 0; i < NR_EXT_IRQS; i++) { 151 for (i = 0; i < NR_EXT_IRQS; i++) {
156 set_irq_chip_and_handler(START_EXT_IRQS + i, &cayman_irq_type, 152 irq_set_chip_and_handler(START_EXT_IRQS + i,
157 handle_level_irq); 153 &cayman_irq_type, handle_level_irq);
158 } 154 }
159 155
160 /* Setup the SMSC interrupt */ 156 /* Setup the SMSC interrupt */
diff --git a/arch/sh/boards/mach-cayman/setup.c b/arch/sh/boards/mach-cayman/setup.c
index 7e8216ac31bd..e89e8e122a26 100644
--- a/arch/sh/boards/mach-cayman/setup.c
+++ b/arch/sh/boards/mach-cayman/setup.c
@@ -165,7 +165,7 @@ static int __init smsc_superio_setup(void)
165 165
166 return 0; 166 return 0;
167} 167}
168__initcall(smsc_superio_setup); 168device_initcall(smsc_superio_setup);
169 169
170static void __iomem *cayman_ioport_map(unsigned long port, unsigned int len) 170static void __iomem *cayman_ioport_map(unsigned long port, unsigned int len)
171{ 171{
diff --git a/arch/sh/boards/mach-dreamcast/irq.c b/arch/sh/boards/mach-dreamcast/irq.c
index d932667410ab..f63d323f411f 100644
--- a/arch/sh/boards/mach-dreamcast/irq.c
+++ b/arch/sh/boards/mach-dreamcast/irq.c
@@ -51,7 +51,7 @@
51 */ 51 */
52#define LEVEL(event) (((event) - HW_EVENT_IRQ_BASE) / 32) 52#define LEVEL(event) (((event) - HW_EVENT_IRQ_BASE) / 32)
53 53
54/* Return the hardware event's bit positon within the EMR/ESR */ 54/* Return the hardware event's bit position within the EMR/ESR */
55#define EVENT_BIT(event) (((event) - HW_EVENT_IRQ_BASE) & 31) 55#define EVENT_BIT(event) (((event) - HW_EVENT_IRQ_BASE) & 31)
56 56
57/* 57/*
@@ -60,8 +60,9 @@
60 */ 60 */
61 61
62/* Disable the hardware event by masking its bit in its EMR */ 62/* Disable the hardware event by masking its bit in its EMR */
63static inline void disable_systemasic_irq(unsigned int irq) 63static inline void disable_systemasic_irq(struct irq_data *data)
64{ 64{
65 unsigned int irq = data->irq;
65 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); 66 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
66 __u32 mask; 67 __u32 mask;
67 68
@@ -71,8 +72,9 @@ static inline void disable_systemasic_irq(unsigned int irq)
71} 72}
72 73
73/* Enable the hardware event by setting its bit in its EMR */ 74/* Enable the hardware event by setting its bit in its EMR */
74static inline void enable_systemasic_irq(unsigned int irq) 75static inline void enable_systemasic_irq(struct irq_data *data)
75{ 76{
77 unsigned int irq = data->irq;
76 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); 78 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
77 __u32 mask; 79 __u32 mask;
78 80
@@ -82,18 +84,19 @@ static inline void enable_systemasic_irq(unsigned int irq)
82} 84}
83 85
84/* Acknowledge a hardware event by writing its bit back to its ESR */ 86/* Acknowledge a hardware event by writing its bit back to its ESR */
85static void mask_ack_systemasic_irq(unsigned int irq) 87static void mask_ack_systemasic_irq(struct irq_data *data)
86{ 88{
89 unsigned int irq = data->irq;
87 __u32 esr = ESR_BASE + (LEVEL(irq) << 2); 90 __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
88 disable_systemasic_irq(irq); 91 disable_systemasic_irq(data);
89 outl((1 << EVENT_BIT(irq)), esr); 92 outl((1 << EVENT_BIT(irq)), esr);
90} 93}
91 94
92struct irq_chip systemasic_int = { 95struct irq_chip systemasic_int = {
93 .name = "System ASIC", 96 .name = "System ASIC",
94 .mask = disable_systemasic_irq, 97 .irq_mask = disable_systemasic_irq,
95 .mask_ack = mask_ack_systemasic_irq, 98 .irq_mask_ack = mask_ack_systemasic_irq,
96 .unmask = enable_systemasic_irq, 99 .irq_unmask = enable_systemasic_irq,
97}; 100};
98 101
99/* 102/*
@@ -158,7 +161,6 @@ void systemasic_irq_init(void)
158 return; 161 return;
159 } 162 }
160 163
161 set_irq_chip_and_handler(i, &systemasic_int, 164 irq_set_chip_and_handler(i, &systemasic_int, handle_level_irq);
162 handle_level_irq);
163 } 165 }
164} 166}
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 1d7b495a7db4..513cb1a2e6c8 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -11,15 +11,16 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/mfd/sh_mobile_sdhi.h>
15#include <linux/mmc/host.h> 14#include <linux/mmc/host.h>
16#include <linux/mmc/sh_mmcif.h> 15#include <linux/mmc/sh_mmcif.h>
16#include <linux/mmc/sh_mobile_sdhi.h>
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/usb/r8a66597.h> 22#include <linux/usb/r8a66597.h>
23#include <linux/usb/renesas_usbhs.h>
23#include <linux/i2c.h> 24#include <linux/i2c.h>
24#include <linux/i2c/tsc2007.h> 25#include <linux/i2c/tsc2007.h>
25#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
@@ -142,6 +143,8 @@ static struct resource sh_eth_resources[] = {
142static struct sh_eth_plat_data sh_eth_plat = { 143static struct sh_eth_plat_data sh_eth_plat = {
143 .phy = 0x1f, /* SMSC LAN8700 */ 144 .phy = 0x1f, /* SMSC LAN8700 */
144 .edmac_endian = EDMAC_LITTLE_ENDIAN, 145 .edmac_endian = EDMAC_LITTLE_ENDIAN,
146 .register_type = SH_ETH_REG_FAST_SH4,
147 .phy_interface = PHY_INTERFACE_MODE_MII,
145 .ether_link_active_low = 1 148 .ether_link_active_low = 1
146}; 149};
147 150
@@ -230,20 +233,111 @@ static struct platform_device usb1_common_device = {
230 .resource = usb1_common_resources, 233 .resource = usb1_common_resources,
231}; 234};
232 235
236/*
237 * USBHS
238 */
239static int usbhs_get_id(struct platform_device *pdev)
240{
241 return gpio_get_value(GPIO_PTB3);
242}
243
244static struct renesas_usbhs_platform_info usbhs_info = {
245 .platform_callback = {
246 .get_id = usbhs_get_id,
247 },
248 .driver_param = {
249 .buswait_bwait = 4,
250 .detection_delay = 5,
251 },
252};
253
254static struct resource usbhs_resources[] = {
255 [0] = {
256 .start = 0xa4d90000,
257 .end = 0xa4d90124 - 1,
258 .flags = IORESOURCE_MEM,
259 },
260 [1] = {
261 .start = 66,
262 .end = 66,
263 .flags = IORESOURCE_IRQ,
264 },
265};
266
267static struct platform_device usbhs_device = {
268 .name = "renesas_usbhs",
269 .id = 1,
270 .dev = {
271 .dma_mask = NULL, /* not use dma */
272 .coherent_dma_mask = 0xffffffff,
273 .platform_data = &usbhs_info,
274 },
275 .num_resources = ARRAY_SIZE(usbhs_resources),
276 .resource = usbhs_resources,
277 .archdata = {
278 .hwblk_id = HWBLK_USB1,
279 },
280};
281
233/* LCDC */ 282/* LCDC */
283const static struct fb_videomode ecovec_lcd_modes[] = {
284 {
285 .name = "Panel",
286 .xres = 800,
287 .yres = 480,
288 .left_margin = 220,
289 .right_margin = 110,
290 .hsync_len = 70,
291 .upper_margin = 20,
292 .lower_margin = 5,
293 .vsync_len = 5,
294 .sync = 0, /* hsync and vsync are active low */
295 },
296};
297
298const static struct fb_videomode ecovec_dvi_modes[] = {
299 {
300 .name = "DVI",
301 .xres = 1280,
302 .yres = 720,
303 .left_margin = 220,
304 .right_margin = 110,
305 .hsync_len = 40,
306 .upper_margin = 20,
307 .lower_margin = 5,
308 .vsync_len = 5,
309 .sync = 0, /* hsync and vsync are active low */
310 },
311};
312
313static int ecovec24_set_brightness(void *board_data, int brightness)
314{
315 gpio_set_value(GPIO_PTR1, brightness);
316
317 return 0;
318}
319
320static int ecovec24_get_brightness(void *board_data)
321{
322 return gpio_get_value(GPIO_PTR1);
323}
324
234static struct sh_mobile_lcdc_info lcdc_info = { 325static struct sh_mobile_lcdc_info lcdc_info = {
235 .ch[0] = { 326 .ch[0] = {
236 .interface_type = RGB18, 327 .interface_type = RGB18,
237 .chan = LCDC_CHAN_MAINLCD, 328 .chan = LCDC_CHAN_MAINLCD,
238 .bpp = 16, 329 .bpp = 16,
239 .lcd_cfg = {
240 .sync = 0, /* hsync and vsync are active low */
241 },
242 .lcd_size_cfg = { /* 7.0 inch */ 330 .lcd_size_cfg = { /* 7.0 inch */
243 .width = 152, 331 .width = 152,
244 .height = 91, 332 .height = 91,
245 }, 333 },
246 .board_cfg = { 334 .board_cfg = {
335 .set_brightness = ecovec24_set_brightness,
336 .get_brightness = ecovec24_get_brightness,
337 },
338 .bl_info = {
339 .name = "sh_mobile_lcdc_bl",
340 .max_brightness = 1,
247 }, 341 },
248 } 342 }
249}; 343};
@@ -435,7 +529,7 @@ static struct i2c_board_info ts_i2c_clients = {
435 .irq = IRQ0, 529 .irq = IRQ0,
436}; 530};
437 531
438#ifdef CONFIG_MFD_SH_MOBILE_SDHI 532#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
439/* SDHI0 */ 533/* SDHI0 */
440static void sdhi0_set_pwr(struct platform_device *pdev, int state) 534static void sdhi0_set_pwr(struct platform_device *pdev, int state)
441{ 535{
@@ -446,13 +540,14 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
446 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 540 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
447 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 541 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
448 .set_pwr = sdhi0_set_pwr, 542 .set_pwr = sdhi0_set_pwr,
543 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD,
449}; 544};
450 545
451static struct resource sdhi0_resources[] = { 546static struct resource sdhi0_resources[] = {
452 [0] = { 547 [0] = {
453 .name = "SDHI0", 548 .name = "SDHI0",
454 .start = 0x04ce0000, 549 .start = 0x04ce0000,
455 .end = 0x04ce01ff, 550 .end = 0x04ce00ff,
456 .flags = IORESOURCE_MEM, 551 .flags = IORESOURCE_MEM,
457 }, 552 },
458 [1] = { 553 [1] = {
@@ -474,7 +569,7 @@ static struct platform_device sdhi0_device = {
474 }, 569 },
475}; 570};
476 571
477#if !defined(CONFIG_MMC_SH_MMCIF) 572#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
478/* SDHI1 */ 573/* SDHI1 */
479static void sdhi1_set_pwr(struct platform_device *pdev, int state) 574static void sdhi1_set_pwr(struct platform_device *pdev, int state)
480{ 575{
@@ -484,6 +579,7 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
484static struct sh_mobile_sdhi_info sdhi1_info = { 579static struct sh_mobile_sdhi_info sdhi1_info = {
485 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 580 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
486 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 581 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
582 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD,
487 .set_pwr = sdhi1_set_pwr, 583 .set_pwr = sdhi1_set_pwr,
488}; 584};
489 585
@@ -491,7 +587,7 @@ static struct resource sdhi1_resources[] = {
491 [0] = { 587 [0] = {
492 .name = "SDHI1", 588 .name = "SDHI1",
493 .start = 0x04cf0000, 589 .start = 0x04cf0000,
494 .end = 0x04cf01ff, 590 .end = 0x04cf00ff,
495 .flags = IORESOURCE_MEM, 591 .flags = IORESOURCE_MEM,
496 }, 592 },
497 [1] = { 593 [1] = {
@@ -620,7 +716,6 @@ static struct soc_camera_link tw9910_link = {
620 .bus_id = 1, 716 .bus_id = 1,
621 .power = tw9910_power, 717 .power = tw9910_power,
622 .board_info = &i2c_camera[0], 718 .board_info = &i2c_camera[0],
623 .module_name = "tw9910",
624 .priv = &tw9910_info, 719 .priv = &tw9910_info,
625}; 720};
626 721
@@ -644,7 +739,6 @@ static struct soc_camera_link mt9t112_link1 = {
644 .power = mt9t112_power1, 739 .power = mt9t112_power1,
645 .bus_id = 0, 740 .bus_id = 0,
646 .board_info = &i2c_camera[1], 741 .board_info = &i2c_camera[1],
647 .module_name = "mt9t112",
648 .priv = &mt9t112_info1, 742 .priv = &mt9t112_info1,
649}; 743};
650 744
@@ -667,7 +761,6 @@ static struct soc_camera_link mt9t112_link2 = {
667 .power = mt9t112_power2, 761 .power = mt9t112_power2,
668 .bus_id = 1, 762 .bus_id = 1,
669 .board_info = &i2c_camera[2], 763 .board_info = &i2c_camera[2],
670 .module_name = "mt9t112",
671 .priv = &mt9t112_info2, 764 .priv = &mt9t112_info2,
672}; 765};
673 766
@@ -696,38 +789,8 @@ static struct platform_device camera_devices[] = {
696}; 789};
697 790
698/* FSI */ 791/* FSI */
699/*
700 * FSI-B use external clock which came from da7210.
701 * So, we should change parent of fsi
702 */
703#define FCLKBCR 0xa415000c
704static void fsimck_init(struct clk *clk)
705{
706 u32 status = __raw_readl(clk->enable_reg);
707
708 /* use external clock */
709 status &= ~0x000000ff;
710 status |= 0x00000080;
711
712 __raw_writel(status, clk->enable_reg);
713}
714
715static struct clk_ops fsimck_clk_ops = {
716 .init = fsimck_init,
717};
718
719static struct clk fsimckb_clk = {
720 .ops = &fsimck_clk_ops,
721 .enable_reg = (void __iomem *)FCLKBCR,
722 .rate = 0, /* unknown */
723};
724
725static struct sh_fsi_platform_info fsi_info = { 792static struct sh_fsi_platform_info fsi_info = {
726 .portb_flags = SH_FSI_BRS_INV | 793 .portb_flags = SH_FSI_BRS_INV,
727 SH_FSI_OUT_SLAVE_MODE |
728 SH_FSI_IN_SLAVE_MODE |
729 SH_FSI_OFMT(I2S) |
730 SH_FSI_IFMT(I2S),
731}; 794};
732 795
733static struct resource fsi_resources[] = { 796static struct resource fsi_resources[] = {
@@ -793,7 +856,6 @@ static struct sh_vou_pdata sh_vou_pdata = {
793 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 856 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
794 .board_info = &ak8813, 857 .board_info = &ak8813,
795 .i2c_adap = 0, 858 .i2c_adap = 0,
796 .module_name = "ak881x",
797}; 859};
798 860
799static struct resource sh_vou_resources[] = { 861static struct resource sh_vou_resources[] = {
@@ -821,7 +883,7 @@ static struct platform_device vou_device = {
821 }, 883 },
822}; 884};
823 885
824#if defined(CONFIG_MMC_SH_MMCIF) 886#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
825/* SH_MMCIF */ 887/* SH_MMCIF */
826static void mmcif_set_pwr(struct platform_device *pdev, int state) 888static void mmcif_set_pwr(struct platform_device *pdev, int state)
827{ 889{
@@ -870,6 +932,9 @@ static struct platform_device sh_mmcif_device = {
870 }, 932 },
871 .num_resources = ARRAY_SIZE(sh_mmcif_resources), 933 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
872 .resource = sh_mmcif_resources, 934 .resource = sh_mmcif_resources,
935 .archdata = {
936 .hwblk_id = HWBLK_MMC,
937 },
873}; 938};
874#endif 939#endif
875 940
@@ -879,13 +944,14 @@ static struct platform_device *ecovec_devices[] __initdata = {
879 &sh_eth_device, 944 &sh_eth_device,
880 &usb0_host_device, 945 &usb0_host_device,
881 &usb1_common_device, 946 &usb1_common_device,
947 &usbhs_device,
882 &lcdc_device, 948 &lcdc_device,
883 &ceu0_device, 949 &ceu0_device,
884 &ceu1_device, 950 &ceu1_device,
885 &keysc_device, 951 &keysc_device,
886#ifdef CONFIG_MFD_SH_MOBILE_SDHI 952#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
887 &sdhi0_device, 953 &sdhi0_device,
888#if !defined(CONFIG_MMC_SH_MMCIF) 954#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
889 &sdhi1_device, 955 &sdhi1_device,
890#endif 956#endif
891#else 957#else
@@ -897,7 +963,7 @@ static struct platform_device *ecovec_devices[] __initdata = {
897 &fsi_device, 963 &fsi_device,
898 &irda_device, 964 &irda_device,
899 &vou_device, 965 &vou_device,
900#if defined(CONFIG_MMC_SH_MMCIF) 966#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
901 &sh_mmcif_device, 967 &sh_mmcif_device,
902#endif 968#endif
903}; 969};
@@ -939,7 +1005,7 @@ static void __init sh_eth_init(struct sh_eth_plat_data *pd)
939 return; 1005 return;
940 } 1006 }
941 1007
942 /* read MAC address frome EEPROM */ 1008 /* read MAC address from EEPROM */
943 for (i = 0; i < sizeof(pd->mac_addr); i++) { 1009 for (i = 0; i < sizeof(pd->mac_addr); i++) {
944 pd->mac_addr[i] = mac_read(a, 0x10 + i); 1010 pd->mac_addr[i] = mac_read(a, 0x10 + i);
945 msleep(10); 1011 msleep(10);
@@ -1079,33 +1145,18 @@ static int __init arch_setup(void)
1079 if (gpio_get_value(GPIO_PTE6)) { 1145 if (gpio_get_value(GPIO_PTE6)) {
1080 /* DVI */ 1146 /* DVI */
1081 lcdc_info.clock_source = LCDC_CLK_EXTERNAL; 1147 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
1082 lcdc_info.ch[0].clock_divider = 1, 1148 lcdc_info.ch[0].clock_divider = 1;
1083 lcdc_info.ch[0].lcd_cfg.name = "DVI"; 1149 lcdc_info.ch[0].lcd_cfg = ecovec_dvi_modes;
1084 lcdc_info.ch[0].lcd_cfg.xres = 1280; 1150 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_dvi_modes);
1085 lcdc_info.ch[0].lcd_cfg.yres = 720;
1086 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
1087 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
1088 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
1089 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
1090 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
1091 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
1092 1151
1093 gpio_set_value(GPIO_PTA2, 1); 1152 gpio_set_value(GPIO_PTA2, 1);
1094 gpio_set_value(GPIO_PTU1, 1); 1153 gpio_set_value(GPIO_PTU1, 1);
1095 } else { 1154 } else {
1096 /* Panel */ 1155 /* Panel */
1097
1098 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; 1156 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
1099 lcdc_info.ch[0].clock_divider = 2, 1157 lcdc_info.ch[0].clock_divider = 2;
1100 lcdc_info.ch[0].lcd_cfg.name = "Panel"; 1158 lcdc_info.ch[0].lcd_cfg = ecovec_lcd_modes;
1101 lcdc_info.ch[0].lcd_cfg.xres = 800; 1159 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_lcd_modes);
1102 lcdc_info.ch[0].lcd_cfg.yres = 480;
1103 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
1104 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
1105 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
1106 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
1107 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
1108 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
1109 1160
1110 gpio_set_value(GPIO_PTR1, 1); 1161 gpio_set_value(GPIO_PTR1, 1);
1111 1162
@@ -1120,7 +1171,7 @@ static int __init arch_setup(void)
1120 1171
1121 /* enable TouchScreen */ 1172 /* enable TouchScreen */
1122 i2c_register_board_info(0, &ts_i2c_clients, 1); 1173 i2c_register_board_info(0, &ts_i2c_clients, 1);
1123 set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW); 1174 irq_set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
1124 } 1175 }
1125 1176
1126 /* enable CEU0 */ 1177 /* enable CEU0 */
@@ -1180,7 +1231,7 @@ static int __init arch_setup(void)
1180 gpio_direction_input(GPIO_PTR5); 1231 gpio_direction_input(GPIO_PTR5);
1181 gpio_direction_input(GPIO_PTR6); 1232 gpio_direction_input(GPIO_PTR6);
1182 1233
1183#ifdef CONFIG_MFD_SH_MOBILE_SDHI 1234#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
1184 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ 1235 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
1185 gpio_request(GPIO_FN_SDHI0CD, NULL); 1236 gpio_request(GPIO_FN_SDHI0CD, NULL);
1186 gpio_request(GPIO_FN_SDHI0WP, NULL); 1237 gpio_request(GPIO_FN_SDHI0WP, NULL);
@@ -1193,7 +1244,7 @@ static int __init arch_setup(void)
1193 gpio_request(GPIO_PTB6, NULL); 1244 gpio_request(GPIO_PTB6, NULL);
1194 gpio_direction_output(GPIO_PTB6, 0); 1245 gpio_direction_output(GPIO_PTB6, 0);
1195 1246
1196#if !defined(CONFIG_MMC_SH_MMCIF) 1247#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1197 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */ 1248 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
1198 gpio_request(GPIO_FN_SDHI1CD, NULL); 1249 gpio_request(GPIO_FN_SDHI1CD, NULL);
1199 gpio_request(GPIO_FN_SDHI1WP, NULL); 1250 gpio_request(GPIO_FN_SDHI1WP, NULL);
@@ -1248,18 +1299,18 @@ static int __init arch_setup(void)
1248 1299
1249 /* set SPU2 clock to 83.4 MHz */ 1300 /* set SPU2 clock to 83.4 MHz */
1250 clk = clk_get(NULL, "spu_clk"); 1301 clk = clk_get(NULL, "spu_clk");
1251 if (clk) { 1302 if (!IS_ERR(clk)) {
1252 clk_set_rate(clk, clk_round_rate(clk, 83333333)); 1303 clk_set_rate(clk, clk_round_rate(clk, 83333333));
1253 clk_put(clk); 1304 clk_put(clk);
1254 } 1305 }
1255 1306
1256 /* change parent of FSI B */ 1307 /* change parent of FSI B */
1257 clk = clk_get(NULL, "fsib_clk"); 1308 clk = clk_get(NULL, "fsib_clk");
1258 if (clk) { 1309 if (!IS_ERR(clk)) {
1259 clk_register(&fsimckb_clk); 1310 /* 48kHz dummy clock was used to make sure 1/1 divide */
1260 clk_set_parent(clk, &fsimckb_clk); 1311 clk_set_rate(&sh7724_fsimckb_clk, 48000);
1261 clk_set_rate(clk, 11000); 1312 clk_set_parent(clk, &sh7724_fsimckb_clk);
1262 clk_set_rate(&fsimckb_clk, 11000); 1313 clk_set_rate(clk, 48000);
1263 clk_put(clk); 1314 clk_put(clk);
1264 } 1315 }
1265 1316
@@ -1273,7 +1324,7 @@ static int __init arch_setup(void)
1273 1324
1274 /* set VPU clock to 166 MHz */ 1325 /* set VPU clock to 166 MHz */
1275 clk = clk_get(NULL, "vpu_clk"); 1326 clk = clk_get(NULL, "vpu_clk");
1276 if (clk) { 1327 if (!IS_ERR(clk)) {
1277 clk_set_rate(clk, clk_round_rate(clk, 166000000)); 1328 clk_set_rate(clk, clk_round_rate(clk, 166000000));
1278 clk_put(clk); 1329 clk_put(clk);
1279 } 1330 }
@@ -1284,7 +1335,7 @@ static int __init arch_setup(void)
1284 gpio_request(GPIO_PTU5, NULL); 1335 gpio_request(GPIO_PTU5, NULL);
1285 gpio_direction_output(GPIO_PTU5, 0); 1336 gpio_direction_output(GPIO_PTU5, 0);
1286 1337
1287#if defined(CONFIG_MMC_SH_MMCIF) 1338#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
1288 /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */ 1339 /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
1289 gpio_request(GPIO_FN_MMC_D7, NULL); 1340 gpio_request(GPIO_FN_MMC_D7, NULL);
1290 gpio_request(GPIO_FN_MMC_D6, NULL); 1341 gpio_request(GPIO_FN_MMC_D6, NULL);
@@ -1310,6 +1361,7 @@ static int __init arch_setup(void)
1310 i2c_register_board_info(1, i2c1_devices, 1361 i2c_register_board_info(1, i2c1_devices,
1311 ARRAY_SIZE(i2c1_devices)); 1362 ARRAY_SIZE(i2c1_devices));
1312 1363
1364#if defined(CONFIG_VIDEO_SH_VOU) || defined(CONFIG_VIDEO_SH_VOU_MODULE)
1313 /* VOU */ 1365 /* VOU */
1314 gpio_request(GPIO_FN_DV_D15, NULL); 1366 gpio_request(GPIO_FN_DV_D15, NULL);
1315 gpio_request(GPIO_FN_DV_D14, NULL); 1367 gpio_request(GPIO_FN_DV_D14, NULL);
@@ -1341,6 +1393,7 @@ static int __init arch_setup(void)
1341 1393
1342 /* Remove reset */ 1394 /* Remove reset */
1343 gpio_set_value(GPIO_PTG4, 1); 1395 gpio_set_value(GPIO_PTG4, 1);
1396#endif
1344 1397
1345 return platform_add_devices(ecovec_devices, 1398 return platform_add_devices(ecovec_devices,
1346 ARRAY_SIZE(ecovec_devices)); 1399 ARRAY_SIZE(ecovec_devices));
diff --git a/arch/sh/boards/mach-edosk7705/Makefile b/arch/sh/boards/mach-edosk7705/Makefile
deleted file mode 100644
index cd54acb51499..000000000000
--- a/arch/sh/boards/mach-edosk7705/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the EDOSK7705 specific parts of the kernel
3#
4
5obj-y := setup.o io.o
diff --git a/arch/sh/boards/mach-edosk7705/io.c b/arch/sh/boards/mach-edosk7705/io.c
deleted file mode 100644
index 5b9c57c43241..000000000000
--- a/arch/sh/boards/mach-edosk7705/io.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * arch/sh/boards/renesas/edosk7705/io.c
3 *
4 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
5 * Based largely on io_se.c.
6 *
7 * I/O routines for Hitachi EDOSK7705 board.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/io.h>
14#include <mach/edosk7705.h>
15#include <asm/addrspace.h>
16
17#define SMC_IOADDR 0xA2000000
18
19/* Map the Ethernet addresses as if it is at 0x300 - 0x320 */
20static unsigned long sh_edosk7705_isa_port2addr(unsigned long port)
21{
22 /*
23 * SMC91C96 registers are 4 byte aligned rather than the
24 * usual 2 byte!
25 */
26 if (port >= 0x300 && port < 0x320)
27 return SMC_IOADDR + ((port - 0x300) * 2);
28
29 maybebadio(port);
30 return port;
31}
32
33/* Trying to read / write bytes on odd-byte boundaries to the Ethernet
34 * registers causes problems. So we bit-shift the value and read / write
35 * in 2 byte chunks. Setting the low byte to 0 does not cause problems
36 * now as odd byte writes are only made on the bit mask / interrupt
37 * register. This may not be the case in future Mar-2003 SJD
38 */
39unsigned char sh_edosk7705_inb(unsigned long port)
40{
41 if (port >= 0x300 && port < 0x320 && port & 0x01)
42 return __raw_readw(port - 1) >> 8;
43
44 return __raw_readb(sh_edosk7705_isa_port2addr(port));
45}
46
47void sh_edosk7705_outb(unsigned char value, unsigned long port)
48{
49 if (port >= 0x300 && port < 0x320 && port & 0x01) {
50 __raw_writew(((unsigned short)value << 8), port - 1);
51 return;
52 }
53
54 __raw_writeb(value, sh_edosk7705_isa_port2addr(port));
55}
56
57void sh_edosk7705_insb(unsigned long port, void *addr, unsigned long count)
58{
59 unsigned char *p = addr;
60
61 while (count--)
62 *p++ = sh_edosk7705_inb(port);
63}
64
65void sh_edosk7705_outsb(unsigned long port, const void *addr, unsigned long count)
66{
67 unsigned char *p = (unsigned char *)addr;
68
69 while (count--)
70 sh_edosk7705_outb(*p++, port);
71}
diff --git a/arch/sh/boards/mach-edosk7705/setup.c b/arch/sh/boards/mach-edosk7705/setup.c
deleted file mode 100644
index d59225e26fb9..000000000000
--- a/arch/sh/boards/mach-edosk7705/setup.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/sh/boards/renesas/edosk7705/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for edosk7705 development
9 * board by S. Dunn, 2003.
10 */
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <asm/machvec.h>
14#include <mach/edosk7705.h>
15
16static void __init sh_edosk7705_init_irq(void)
17{
18 /* This is the Ethernet interrupt */
19 make_imask_irq(0x09);
20}
21
22/*
23 * The Machine Vector
24 */
25static struct sh_machine_vector mv_edosk7705 __initmv = {
26 .mv_name = "EDOSK7705",
27 .mv_nr_irqs = 80,
28
29 .mv_inb = sh_edosk7705_inb,
30 .mv_outb = sh_edosk7705_outb,
31
32 .mv_insb = sh_edosk7705_insb,
33 .mv_outsb = sh_edosk7705_outsb,
34
35 .mv_init_irq = sh_edosk7705_init_irq,
36};
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index a5ecfbacaf36..87618c91d178 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -24,10 +24,10 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/usb/r8a66597.h> 25#include <linux/usb/r8a66597.h>
26#include <linux/usb/m66592.h> 26#include <linux/usb/m66592.h>
27#include <linux/clkdev.h>
27#include <net/ax88796.h> 28#include <net/ax88796.h>
28#include <asm/machvec.h> 29#include <asm/machvec.h>
29#include <mach/highlander.h> 30#include <mach/highlander.h>
30#include <asm/clkdev.h>
31#include <asm/clock.h> 31#include <asm/clock.h>
32#include <asm/heartbeat.h> 32#include <asm/heartbeat.h>
33#include <asm/io.h> 33#include <asm/io.h>
diff --git a/arch/sh/boards/mach-hp6xx/pm.c b/arch/sh/boards/mach-hp6xx/pm.c
index 4499a3749d40..adc9b4bba828 100644
--- a/arch/sh/boards/mach-hp6xx/pm.c
+++ b/arch/sh/boards/mach-hp6xx/pm.c
@@ -143,7 +143,7 @@ static int hp6x0_pm_enter(suspend_state_t state)
143 return 0; 143 return 0;
144} 144}
145 145
146static struct platform_suspend_ops hp6x0_pm_ops = { 146static const struct platform_suspend_ops hp6x0_pm_ops = {
147 .enter = hp6x0_pm_enter, 147 .enter = hp6x0_pm_enter,
148 .valid = suspend_valid_only_mem, 148 .valid = suspend_valid_only_mem,
149}; 149};
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 68994a163f6c..8b4abbbd1477 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -10,7 +10,8 @@
10#include <linux/init.h> 10#include <linux/init.h>
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/mfd/sh_mobile_sdhi.h> 13#include <linux/mmc/host.h>
14#include <linux/mmc/sh_mobile_sdhi.h>
14#include <linux/mfd/tmio.h> 15#include <linux/mfd/tmio.h>
15#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
16#include <linux/mtd/onenand.h> 17#include <linux/mtd/onenand.h>
@@ -126,6 +127,21 @@ static struct platform_device kfr2r09_sh_keysc_device = {
126 }, 127 },
127}; 128};
128 129
130const static struct fb_videomode kfr2r09_lcdc_modes[] = {
131 {
132 .name = "TX07D34VM0AAA",
133 .xres = 240,
134 .yres = 400,
135 .left_margin = 0,
136 .right_margin = 16,
137 .hsync_len = 8,
138 .upper_margin = 0,
139 .lower_margin = 1,
140 .vsync_len = 1,
141 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
142 },
143};
144
129static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { 145static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
130 .clock_source = LCDC_CLK_BUS, 146 .clock_source = LCDC_CLK_BUS,
131 .ch[0] = { 147 .ch[0] = {
@@ -134,18 +150,8 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
134 .interface_type = SYS18, 150 .interface_type = SYS18,
135 .clock_divider = 6, 151 .clock_divider = 6,
136 .flags = LCDC_FLAGS_DWPOL, 152 .flags = LCDC_FLAGS_DWPOL,
137 .lcd_cfg = { 153 .lcd_cfg = kfr2r09_lcdc_modes,
138 .name = "TX07D34VM0AAA", 154 .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes),
139 .xres = 240,
140 .yres = 400,
141 .left_margin = 0,
142 .right_margin = 16,
143 .hsync_len = 8,
144 .upper_margin = 0,
145 .lower_margin = 1,
146 .vsync_len = 1,
147 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
148 },
149 .lcd_size_cfg = { 155 .lcd_size_cfg = {
150 .width = 35, 156 .width = 35,
151 .height = 58, 157 .height = 58,
@@ -333,7 +339,6 @@ static struct soc_camera_link rj54n1_link = {
333 .power = camera_power, 339 .power = camera_power,
334 .board_info = &kfr2r09_i2c_camera, 340 .board_info = &kfr2r09_i2c_camera,
335 .i2c_adapter_id = 1, 341 .i2c_adapter_id = 1,
336 .module_name = "rj54n1cb0c",
337 .priv = &rj54n1_priv, 342 .priv = &rj54n1_priv,
338}; 343};
339 344
@@ -349,7 +354,7 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
349 [0] = { 354 [0] = {
350 .name = "SDHI0", 355 .name = "SDHI0",
351 .start = 0x04ce0000, 356 .start = 0x04ce0000,
352 .end = 0x04ce01ff, 357 .end = 0x04ce00ff,
353 .flags = IORESOURCE_MEM, 358 .flags = IORESOURCE_MEM,
354 }, 359 },
355 [1] = { 360 [1] = {
@@ -362,6 +367,7 @@ static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
362 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 367 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
363 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 368 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
364 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, 369 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
370 .tmio_caps = MMC_CAP_SDIO_IRQ,
365}; 371};
366 372
367static struct platform_device kfr2r09_sh_sdhi0_device = { 373static struct platform_device kfr2r09_sh_sdhi0_device = {
diff --git a/arch/sh/boards/mach-landisk/gio.c b/arch/sh/boards/mach-landisk/gio.c
index 01e6abb769b9..8132dff078fb 100644
--- a/arch/sh/boards/mach-landisk/gio.c
+++ b/arch/sh/boards/mach-landisk/gio.c
@@ -128,6 +128,7 @@ static const struct file_operations gio_fops = {
128 .open = gio_open, /* open */ 128 .open = gio_open, /* open */
129 .release = gio_close, /* release */ 129 .release = gio_close, /* release */
130 .unlocked_ioctl = gio_ioctl, 130 .unlocked_ioctl = gio_ioctl,
131 .llseek = noop_llseek,
131}; 132};
132 133
133static int __init gio_init(void) 134static int __init gio_init(void)
diff --git a/arch/sh/boards/mach-landisk/irq.c b/arch/sh/boards/mach-landisk/irq.c
index 96f38a4187d0..c00ace38db3f 100644
--- a/arch/sh/boards/mach-landisk/irq.c
+++ b/arch/sh/boards/mach-landisk/irq.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * arch/sh/boards/landisk/irq.c 2 * arch/sh/boards/mach-landisk/irq.c
3 * 3 *
4 * I-O DATA Device, Inc. LANDISK Support 4 * I-O DATA Device, Inc. LANDISK Support
5 * 5 *
6 * Copyright (C) 2005-2007 kogiidena 6 * Copyright (C) 2005-2007 kogiidena
7 * Copyright (C) 2011 Nobuhiro Iwamatsu
7 * 8 *
8 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel 9 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
9 * Based largely on io_se.c. 10 * Based largely on io_se.c.
@@ -12,45 +13,54 @@
12 * License. See the file "COPYING" in the main directory of this archive 13 * License. See the file "COPYING" in the main directory of this archive
13 * for more details. 14 * for more details.
14 */ 15 */
16
15#include <linux/init.h> 17#include <linux/init.h>
16#include <linux/irq.h> 18#include <linux/irq.h>
17#include <linux/interrupt.h> 19#include <linux/interrupt.h>
18#include <linux/io.h> 20#include <linux/io.h>
19#include <mach-landisk/mach/iodata_landisk.h> 21#include <mach-landisk/mach/iodata_landisk.h>
20 22
21static void disable_landisk_irq(unsigned int irq) 23enum {
22{ 24 UNUSED = 0,
23 unsigned char mask = 0xff ^ (0x01 << (irq - 5));
24 25
25 __raw_writeb(__raw_readb(PA_IMASK) & mask, PA_IMASK); 26 PCI_INTA, /* PCI int A */
26} 27 PCI_INTB, /* PCI int B */
27 28 PCI_INTC, /* PCI int C */
28static void enable_landisk_irq(unsigned int irq) 29 PCI_INTD, /* PCI int D */
29{ 30 ATA, /* ATA */
30 unsigned char value = (0x01 << (irq - 5)); 31 FATA, /* CF */
32 POWER, /* Power swtich */
33 BUTTON, /* Button swtich */
34};
31 35
32 __raw_writeb(__raw_readb(PA_IMASK) | value, PA_IMASK); 36/* Vectors for LANDISK */
33} 37static struct intc_vect vectors_landisk[] __initdata = {
38 INTC_IRQ(PCI_INTA, IRQ_PCIINTA),
39 INTC_IRQ(PCI_INTB, IRQ_PCIINTB),
40 INTC_IRQ(PCI_INTC, IRQ_PCIINTC),
41 INTC_IRQ(PCI_INTD, IRQ_PCIINTD),
42 INTC_IRQ(ATA, IRQ_ATA),
43 INTC_IRQ(FATA, IRQ_FATA),
44 INTC_IRQ(POWER, IRQ_POWER),
45 INTC_IRQ(BUTTON, IRQ_BUTTON),
46};
34 47
35static struct irq_chip landisk_irq_chip __read_mostly = { 48/* IRLMSK mask register layout for LANDISK */
36 .name = "LANDISK", 49static struct intc_mask_reg mask_registers_landisk[] __initdata = {
37 .mask = disable_landisk_irq, 50 { PA_IMASK, 0, 8, /* IRLMSK */
38 .unmask = enable_landisk_irq, 51 { BUTTON, POWER, FATA, ATA,
39 .mask_ack = disable_landisk_irq, 52 PCI_INTD, PCI_INTC, PCI_INTB, PCI_INTA,
53 }
54 },
40}; 55};
41 56
57static DECLARE_INTC_DESC(intc_desc_landisk, "landisk", vectors_landisk, NULL,
58 mask_registers_landisk, NULL, NULL);
42/* 59/*
43 * Initialize IRQ setting 60 * Initialize IRQ setting
44 */ 61 */
45void __init init_landisk_IRQ(void) 62void __init init_landisk_IRQ(void)
46{ 63{
47 int i; 64 register_intc_controller(&intc_desc_landisk);
48
49 for (i = 5; i < 14; i++) {
50 disable_irq_nosync(i);
51 set_irq_chip_and_handler_name(i, &landisk_irq_chip,
52 handle_level_irq, "level");
53 enable_landisk_irq(i);
54 }
55 __raw_writeb(0x00, PA_PWRINT_CLR); 65 __raw_writeb(0x00, PA_PWRINT_CLR);
56} 66}
diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c
index 50337acc18c5..f1147caebacf 100644
--- a/arch/sh/boards/mach-landisk/setup.c
+++ b/arch/sh/boards/mach-landisk/setup.c
@@ -21,11 +21,9 @@
21#include <mach-landisk/mach/iodata_landisk.h> 21#include <mach-landisk/mach/iodata_landisk.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24void init_landisk_IRQ(void);
25
26static void landisk_power_off(void) 24static void landisk_power_off(void)
27{ 25{
28 __raw_writeb(0x01, PA_SHUTDOWN); 26 __raw_writeb(0x01, PA_SHUTDOWN);
29} 27}
30 28
31static struct resource cf_ide_resources[3]; 29static struct resource cf_ide_resources[3];
@@ -83,11 +81,11 @@ static int __init landisk_devices_setup(void)
83 ARRAY_SIZE(landisk_devices)); 81 ARRAY_SIZE(landisk_devices));
84} 82}
85 83
86__initcall(landisk_devices_setup); 84device_initcall(landisk_devices_setup);
87 85
88static void __init landisk_setup(char **cmdline_p) 86static void __init landisk_setup(char **cmdline_p)
89{ 87{
90 /* LED ON */ 88 /* LED ON */
91 __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED); 89 __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
92 90
93 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n"); 91 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
@@ -99,7 +97,6 @@ static void __init landisk_setup(char **cmdline_p)
99 */ 97 */
100static struct sh_machine_vector mv_landisk __initmv = { 98static struct sh_machine_vector mv_landisk __initmv = {
101 .mv_name = "LANDISK", 99 .mv_name = "LANDISK",
102 .mv_nr_irqs = 72,
103 .mv_setup = landisk_setup, 100 .mv_setup = landisk_setup,
104 .mv_init_irq = init_landisk_IRQ, 101 .mv_init_irq = init_landisk_IRQ,
105}; 102};
diff --git a/arch/sh/boards/mach-microdev/io.c b/arch/sh/boards/mach-microdev/io.c
index 2960c659020e..acdafb0c6404 100644
--- a/arch/sh/boards/mach-microdev/io.c
+++ b/arch/sh/boards/mach-microdev/io.c
@@ -54,7 +54,7 @@
54/* 54/*
55 * map I/O ports to memory-mapped addresses 55 * map I/O ports to memory-mapped addresses
56 */ 56 */
57static unsigned long microdev_isa_port2addr(unsigned long offset) 57void __iomem *microdev_ioport_map(unsigned long offset, unsigned int len)
58{ 58{
59 unsigned long result; 59 unsigned long result;
60 60
@@ -72,16 +72,6 @@ static unsigned long microdev_isa_port2addr(unsigned long offset)
72 * Configuration Registers 72 * Configuration Registers
73 */ 73 */
74 result = IO_SUPERIO_PHYS + (offset << 1); 74 result = IO_SUPERIO_PHYS + (offset << 1);
75#if 0
76 } else if (offset == KBD_DATA_REG || offset == KBD_CNTL_REG ||
77 offset == KBD_STATUS_REG) {
78 /*
79 * SMSC FDC37C93xAPM SuperIO chip
80 *
81 * PS/2 Keyboard + Mouse (ports 0x60 and 0x64).
82 */
83 result = IO_SUPERIO_PHYS + (offset << 1);
84#endif
85 } else if (((offset >= IO_IDE1_BASE) && 75 } else if (((offset >= IO_IDE1_BASE) &&
86 (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) || 76 (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) ||
87 (offset == IO_IDE1_MISC)) { 77 (offset == IO_IDE1_MISC)) {
@@ -131,237 +121,5 @@ static unsigned long microdev_isa_port2addr(unsigned long offset)
131 result = PVR; 121 result = PVR;
132 } 122 }
133 123
134 return result; 124 return (void __iomem *)result;
135}
136
137#define PORT2ADDR(x) (microdev_isa_port2addr(x))
138
139static inline void delay(void)
140{
141#if defined(CONFIG_PCI)
142 /* System board present, just make a dummy SRAM access. (CS0 will be
143 mapped to PCI memory, probably good to avoid it.) */
144 __raw_readw(0xa6800000);
145#else
146 /* CS0 will be mapped to flash, ROM etc so safe to access it. */
147 __raw_readw(0xa0000000);
148#endif
149}
150
151unsigned char microdev_inb(unsigned long port)
152{
153#ifdef CONFIG_PCI
154 if (port >= PCIBIOS_MIN_IO)
155 return microdev_pci_inb(port);
156#endif
157 return *(volatile unsigned char*)PORT2ADDR(port);
158}
159
160unsigned short microdev_inw(unsigned long port)
161{
162#ifdef CONFIG_PCI
163 if (port >= PCIBIOS_MIN_IO)
164 return microdev_pci_inw(port);
165#endif
166 return *(volatile unsigned short*)PORT2ADDR(port);
167}
168
169unsigned int microdev_inl(unsigned long port)
170{
171#ifdef CONFIG_PCI
172 if (port >= PCIBIOS_MIN_IO)
173 return microdev_pci_inl(port);
174#endif
175 return *(volatile unsigned int*)PORT2ADDR(port);
176}
177
178void microdev_outw(unsigned short b, unsigned long port)
179{
180#ifdef CONFIG_PCI
181 if (port >= PCIBIOS_MIN_IO) {
182 microdev_pci_outw(b, port);
183 return;
184 }
185#endif
186 *(volatile unsigned short*)PORT2ADDR(port) = b;
187}
188
189void microdev_outb(unsigned char b, unsigned long port)
190{
191#ifdef CONFIG_PCI
192 if (port >= PCIBIOS_MIN_IO) {
193 microdev_pci_outb(b, port);
194 return;
195 }
196#endif
197
198 /*
199 * There is a board feature with the current SH4-202 MicroDev in
200 * that the 2 byte enables (nBE0 and nBE1) are tied together (and
201 * to the Chip Select Line (Ethernet_CS)). Due to this connectivity,
202 * it is not possible to safely perform 8-bit writes to the
203 * Ethernet registers, as 16-bits will be consumed from the Data
204 * lines (corrupting the other byte). Hence, this function is
205 * written to implement 16-bit read/modify/write for all byte-wide
206 * accesses.
207 *
208 * Note: there is no problem with byte READS (even or odd).
209 *
210 * Sean McGoogan - 16th June 2003.
211 */
212 if ((port >= IO_LAN91C111_BASE) &&
213 (port < IO_LAN91C111_BASE + IO_LAN91C111_EXTENT)) {
214 /*
215 * Then are trying to perform a byte-write to the
216 * LAN91C111. This needs special care.
217 */
218 if (port % 2 == 1) { /* is the port odd ? */
219 /* unset bit-0, i.e. make even */
220 const unsigned long evenPort = port-1;
221 unsigned short word;
222
223 /*
224 * do a 16-bit read/write to write to 'port',
225 * preserving even byte.
226 *
227 * Even addresses are bits 0-7
228 * Odd addresses are bits 8-15
229 */
230 word = microdev_inw(evenPort);
231 word = (word & 0xffu) | (b << 8);
232 microdev_outw(word, evenPort);
233 } else {
234 /* else, we are trying to do an even byte write */
235 unsigned short word;
236
237 /*
238 * do a 16-bit read/write to write to 'port',
239 * preserving odd byte.
240 *
241 * Even addresses are bits 0-7
242 * Odd addresses are bits 8-15
243 */
244 word = microdev_inw(port);
245 word = (word & 0xff00u) | (b);
246 microdev_outw(word, port);
247 }
248 } else {
249 *(volatile unsigned char*)PORT2ADDR(port) = b;
250 }
251}
252
253void microdev_outl(unsigned int b, unsigned long port)
254{
255#ifdef CONFIG_PCI
256 if (port >= PCIBIOS_MIN_IO) {
257 microdev_pci_outl(b, port);
258 return;
259 }
260#endif
261 *(volatile unsigned int*)PORT2ADDR(port) = b;
262}
263
264unsigned char microdev_inb_p(unsigned long port)
265{
266 unsigned char v = microdev_inb(port);
267 delay();
268 return v;
269}
270
271unsigned short microdev_inw_p(unsigned long port)
272{
273 unsigned short v = microdev_inw(port);
274 delay();
275 return v;
276}
277
278unsigned int microdev_inl_p(unsigned long port)
279{
280 unsigned int v = microdev_inl(port);
281 delay();
282 return v;
283}
284
285void microdev_outb_p(unsigned char b, unsigned long port)
286{
287 microdev_outb(b, port);
288 delay();
289}
290
291void microdev_outw_p(unsigned short b, unsigned long port)
292{
293 microdev_outw(b, port);
294 delay();
295}
296
297void microdev_outl_p(unsigned int b, unsigned long port)
298{
299 microdev_outl(b, port);
300 delay();
301}
302
303void microdev_insb(unsigned long port, void *buffer, unsigned long count)
304{
305 volatile unsigned char *port_addr;
306 unsigned char *buf = buffer;
307
308 port_addr = (volatile unsigned char *)PORT2ADDR(port);
309
310 while (count--)
311 *buf++ = *port_addr;
312}
313
314void microdev_insw(unsigned long port, void *buffer, unsigned long count)
315{
316 volatile unsigned short *port_addr;
317 unsigned short *buf = buffer;
318
319 port_addr = (volatile unsigned short *)PORT2ADDR(port);
320
321 while (count--)
322 *buf++ = *port_addr;
323}
324
325void microdev_insl(unsigned long port, void *buffer, unsigned long count)
326{
327 volatile unsigned long *port_addr;
328 unsigned int *buf = buffer;
329
330 port_addr = (volatile unsigned long *)PORT2ADDR(port);
331
332 while (count--)
333 *buf++ = *port_addr;
334}
335
336void microdev_outsb(unsigned long port, const void *buffer, unsigned long count)
337{
338 volatile unsigned char *port_addr;
339 const unsigned char *buf = buffer;
340
341 port_addr = (volatile unsigned char *)PORT2ADDR(port);
342
343 while (count--)
344 *port_addr = *buf++;
345}
346
347void microdev_outsw(unsigned long port, const void *buffer, unsigned long count)
348{
349 volatile unsigned short *port_addr;
350 const unsigned short *buf = buffer;
351
352 port_addr = (volatile unsigned short *)PORT2ADDR(port);
353
354 while (count--)
355 *port_addr = *buf++;
356}
357
358void microdev_outsl(unsigned long port, const void *buffer, unsigned long count)
359{
360 volatile unsigned long *port_addr;
361 const unsigned int *buf = buffer;
362
363 port_addr = (volatile unsigned long *)PORT2ADDR(port);
364
365 while (count--)
366 *port_addr = *buf++;
367} 125}
diff --git a/arch/sh/boards/mach-microdev/irq.c b/arch/sh/boards/mach-microdev/irq.c
index a26d16669aa2..4fb00369f0e2 100644
--- a/arch/sh/boards/mach-microdev/irq.c
+++ b/arch/sh/boards/mach-microdev/irq.c
@@ -65,19 +65,9 @@ static const struct {
65# error Inconsistancy in defining the IRQ# for primary IDE! 65# error Inconsistancy in defining the IRQ# for primary IDE!
66#endif 66#endif
67 67
68static void enable_microdev_irq(unsigned int irq); 68static void disable_microdev_irq(struct irq_data *data)
69static void disable_microdev_irq(unsigned int irq);
70static void mask_and_ack_microdev(unsigned int);
71
72static struct irq_chip microdev_irq_type = {
73 .name = "MicroDev-IRQ",
74 .unmask = enable_microdev_irq,
75 .mask = disable_microdev_irq,
76 .ack = mask_and_ack_microdev,
77};
78
79static void disable_microdev_irq(unsigned int irq)
80{ 69{
70 unsigned int irq = data->irq;
81 unsigned int fpgaIrq; 71 unsigned int fpgaIrq;
82 72
83 if (irq >= NUM_EXTERNAL_IRQS) 73 if (irq >= NUM_EXTERNAL_IRQS)
@@ -91,8 +81,9 @@ static void disable_microdev_irq(unsigned int irq)
91 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG); 81 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG);
92} 82}
93 83
94static void enable_microdev_irq(unsigned int irq) 84static void enable_microdev_irq(struct irq_data *data)
95{ 85{
86 unsigned int irq = data->irq;
96 unsigned long priorityReg, priorities, pri; 87 unsigned long priorityReg, priorities, pri;
97 unsigned int fpgaIrq; 88 unsigned int fpgaIrq;
98 89
@@ -116,17 +107,18 @@ static void enable_microdev_irq(unsigned int irq)
116 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG); 107 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG);
117} 108}
118 109
110static struct irq_chip microdev_irq_type = {
111 .name = "MicroDev-IRQ",
112 .irq_unmask = enable_microdev_irq,
113 .irq_mask = disable_microdev_irq,
114};
115
119/* This function sets the desired irq handler to be a MicroDev type */ 116/* This function sets the desired irq handler to be a MicroDev type */
120static void __init make_microdev_irq(unsigned int irq) 117static void __init make_microdev_irq(unsigned int irq)
121{ 118{
122 disable_irq_nosync(irq); 119 disable_irq_nosync(irq);
123 set_irq_chip_and_handler(irq, &microdev_irq_type, handle_level_irq); 120 irq_set_chip_and_handler(irq, &microdev_irq_type, handle_level_irq);
124 disable_microdev_irq(irq); 121 disable_microdev_irq(irq_get_irq_data(irq));
125}
126
127static void mask_and_ack_microdev(unsigned int irq)
128{
129 disable_microdev_irq(irq);
130} 122}
131 123
132extern void __init init_microdev_irq(void) 124extern void __init init_microdev_irq(void)
diff --git a/arch/sh/boards/mach-microdev/setup.c b/arch/sh/boards/mach-microdev/setup.c
index d1df2a4fb9b8..d8a747291e03 100644
--- a/arch/sh/boards/mach-microdev/setup.c
+++ b/arch/sh/boards/mach-microdev/setup.c
@@ -195,27 +195,6 @@ device_initcall(microdev_devices_setup);
195static struct sh_machine_vector mv_sh4202_microdev __initmv = { 195static struct sh_machine_vector mv_sh4202_microdev __initmv = {
196 .mv_name = "SH4-202 MicroDev", 196 .mv_name = "SH4-202 MicroDev",
197 .mv_nr_irqs = 72, 197 .mv_nr_irqs = 72,
198 198 .mv_ioport_map = microdev_ioport_map,
199 .mv_inb = microdev_inb,
200 .mv_inw = microdev_inw,
201 .mv_inl = microdev_inl,
202 .mv_outb = microdev_outb,
203 .mv_outw = microdev_outw,
204 .mv_outl = microdev_outl,
205
206 .mv_inb_p = microdev_inb_p,
207 .mv_inw_p = microdev_inw_p,
208 .mv_inl_p = microdev_inl_p,
209 .mv_outb_p = microdev_outb_p,
210 .mv_outw_p = microdev_outw_p,
211 .mv_outl_p = microdev_outl_p,
212
213 .mv_insb = microdev_insb,
214 .mv_insw = microdev_insw,
215 .mv_insl = microdev_insl,
216 .mv_outsb = microdev_outsb,
217 .mv_outsw = microdev_outsw,
218 .mv_outsl = microdev_outsl,
219
220 .mv_init_irq = init_microdev_irq, 199 .mv_init_irq = init_microdev_irq,
221}; 200};
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 662debe4ead2..184fde169132 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -12,7 +12,8 @@
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/input/sh_keysc.h>
15#include <linux/mfd/sh_mobile_sdhi.h> 15#include <linux/mmc/host.h>
16#include <linux/mmc/sh_mobile_sdhi.h>
16#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
18#include <linux/i2c.h> 19#include <linux/i2c.h>
@@ -213,51 +214,55 @@ static struct platform_device migor_nand_flash_device = {
213 } 214 }
214}; 215};
215 216
217const static struct fb_videomode migor_lcd_modes[] = {
218 {
219#if defined(CONFIG_SH_MIGOR_RTA_WVGA)
220 .name = "LB070WV1",
221 .xres = 800,
222 .yres = 480,
223 .left_margin = 64,
224 .right_margin = 16,
225 .hsync_len = 120,
226 .sync = 0,
227#elif defined(CONFIG_SH_MIGOR_QVGA)
228 .name = "PH240320T",
229 .xres = 320,
230 .yres = 240,
231 .left_margin = 0,
232 .right_margin = 16,
233 .hsync_len = 8,
234 .sync = FB_SYNC_HOR_HIGH_ACT,
235#endif
236 .upper_margin = 1,
237 .lower_margin = 17,
238 .vsync_len = 2,
239 },
240};
241
216static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { 242static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
217#ifdef CONFIG_SH_MIGOR_RTA_WVGA 243#if defined(CONFIG_SH_MIGOR_RTA_WVGA)
218 .clock_source = LCDC_CLK_BUS, 244 .clock_source = LCDC_CLK_BUS,
219 .ch[0] = { 245 .ch[0] = {
220 .chan = LCDC_CHAN_MAINLCD, 246 .chan = LCDC_CHAN_MAINLCD,
221 .bpp = 16, 247 .bpp = 16,
222 .interface_type = RGB16, 248 .interface_type = RGB16,
223 .clock_divider = 2, 249 .clock_divider = 2,
224 .lcd_cfg = { 250 .lcd_cfg = migor_lcd_modes,
225 .name = "LB070WV1", 251 .num_cfg = ARRAY_SIZE(migor_lcd_modes),
226 .xres = 800,
227 .yres = 480,
228 .left_margin = 64,
229 .right_margin = 16,
230 .hsync_len = 120,
231 .upper_margin = 1,
232 .lower_margin = 17,
233 .vsync_len = 2,
234 .sync = 0,
235 },
236 .lcd_size_cfg = { /* 7.0 inch */ 252 .lcd_size_cfg = { /* 7.0 inch */
237 .width = 152, 253 .width = 152,
238 .height = 91, 254 .height = 91,
239 }, 255 },
240 } 256 }
241#endif 257#elif defined(CONFIG_SH_MIGOR_QVGA)
242#ifdef CONFIG_SH_MIGOR_QVGA
243 .clock_source = LCDC_CLK_PERIPHERAL, 258 .clock_source = LCDC_CLK_PERIPHERAL,
244 .ch[0] = { 259 .ch[0] = {
245 .chan = LCDC_CHAN_MAINLCD, 260 .chan = LCDC_CHAN_MAINLCD,
246 .bpp = 16, 261 .bpp = 16,
247 .interface_type = SYS16A, 262 .interface_type = SYS16A,
248 .clock_divider = 10, 263 .clock_divider = 10,
249 .lcd_cfg = { 264 .lcd_cfg = migor_lcd_modes,
250 .name = "PH240320T", 265 .num_cfg = ARRAY_SIZE(migor_lcd_modes),
251 .xres = 320,
252 .yres = 240,
253 .left_margin = 0,
254 .right_margin = 16,
255 .hsync_len = 8,
256 .upper_margin = 1,
257 .lower_margin = 17,
258 .vsync_len = 2,
259 .sync = FB_SYNC_HOR_HIGH_ACT,
260 },
261 .lcd_size_cfg = { /* 2.4 inch */ 266 .lcd_size_cfg = { /* 2.4 inch */
262 .width = 49, 267 .width = 49,
263 .height = 37, 268 .height = 37,
@@ -394,7 +399,7 @@ static struct resource sdhi_cn9_resources[] = {
394 [0] = { 399 [0] = {
395 .name = "SDHI", 400 .name = "SDHI",
396 .start = 0x04ce0000, 401 .start = 0x04ce0000,
397 .end = 0x04ce01ff, 402 .end = 0x04ce00ff,
398 .flags = IORESOURCE_MEM, 403 .flags = IORESOURCE_MEM,
399 }, 404 },
400 [1] = { 405 [1] = {
@@ -406,6 +411,7 @@ static struct resource sdhi_cn9_resources[] = {
406static struct sh_mobile_sdhi_info sh7724_sdhi_data = { 411static struct sh_mobile_sdhi_info sh7724_sdhi_data = {
407 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 412 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
408 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 413 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
414 .tmio_caps = MMC_CAP_SDIO_IRQ,
409}; 415};
410 416
411static struct platform_device sdhi_cn9_device = { 417static struct platform_device sdhi_cn9_device = {
@@ -450,7 +456,6 @@ static struct soc_camera_link ov7725_link = {
450 .power = ov7725_power, 456 .power = ov7725_power,
451 .board_info = &migor_i2c_camera[0], 457 .board_info = &migor_i2c_camera[0],
452 .i2c_adapter_id = 0, 458 .i2c_adapter_id = 0,
453 .module_name = "ov772x",
454 .priv = &ov7725_info, 459 .priv = &ov7725_info,
455}; 460};
456 461
@@ -463,7 +468,6 @@ static struct soc_camera_link tw9910_link = {
463 .power = tw9910_power, 468 .power = tw9910_power,
464 .board_info = &migor_i2c_camera[1], 469 .board_info = &migor_i2c_camera[1],
465 .i2c_adapter_id = 0, 470 .i2c_adapter_id = 0,
466 .module_name = "tw9910",
467 .priv = &tw9910_info, 471 .priv = &tw9910_info,
468}; 472};
469 473
diff --git a/arch/sh/boards/mach-r2d/setup.c b/arch/sh/boards/mach-r2d/setup.c
index b84df6a3a93c..4b98a5251f83 100644
--- a/arch/sh/boards/mach-r2d/setup.c
+++ b/arch/sh/boards/mach-r2d/setup.c
@@ -258,7 +258,7 @@ static int __init rts7751r2d_devices_setup(void)
258 return platform_add_devices(rts7751r2d_devices, 258 return platform_add_devices(rts7751r2d_devices,
259 ARRAY_SIZE(rts7751r2d_devices)); 259 ARRAY_SIZE(rts7751r2d_devices));
260} 260}
261__initcall(rts7751r2d_devices_setup); 261device_initcall(rts7751r2d_devices_setup);
262 262
263static void rts7751r2d_power_off(void) 263static void rts7751r2d_power_off(void)
264{ 264{
diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index 4fa08ba10253..a8089f79d058 100644
--- a/arch/sh/boards/mach-rsk/devices-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Renesas Technology Europe RSK+ 7203 Support. 2 * Renesas Technology Europe RSK+ 7203 Support.
3 * 3 *
4 * Copyright (C) 2008 Paul Mundt 4 * Copyright (C) 2008 - 2010 Paul Mundt
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 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 7 * License. See the file "COPYING" in the main directory of this archive
@@ -12,7 +12,9 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/smsc911x.h> 14#include <linux/smsc911x.h>
15#include <linux/input.h>
15#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/gpio_keys.h>
16#include <linux/leds.h> 18#include <linux/leds.h>
17#include <asm/machvec.h> 19#include <asm/machvec.h>
18#include <asm/io.h> 20#include <asm/io.h>
@@ -84,9 +86,42 @@ static struct platform_device led_device = {
84 }, 86 },
85}; 87};
86 88
89static struct gpio_keys_button rsk7203_gpio_keys_table[] = {
90 {
91 .code = BTN_0,
92 .gpio = GPIO_PB0,
93 .active_low = 1,
94 .desc = "SW1",
95 }, {
96 .code = BTN_1,
97 .gpio = GPIO_PB1,
98 .active_low = 1,
99 .desc = "SW2",
100 }, {
101 .code = BTN_2,
102 .gpio = GPIO_PB2,
103 .active_low = 1,
104 .desc = "SW3",
105 },
106};
107
108static struct gpio_keys_platform_data rsk7203_gpio_keys_info = {
109 .buttons = rsk7203_gpio_keys_table,
110 .nbuttons = ARRAY_SIZE(rsk7203_gpio_keys_table),
111 .poll_interval = 50, /* default to 50ms */
112};
113
114static struct platform_device keys_device = {
115 .name = "gpio-keys-polled",
116 .dev = {
117 .platform_data = &rsk7203_gpio_keys_info,
118 },
119};
120
87static struct platform_device *rsk7203_devices[] __initdata = { 121static struct platform_device *rsk7203_devices[] __initdata = {
88 &smsc911x_device, 122 &smsc911x_device,
89 &led_device, 123 &led_device,
124 &keys_device,
90}; 125};
91 126
92static int __init rsk7203_devices_setup(void) 127static int __init rsk7203_devices_setup(void)
diff --git a/arch/sh/boards/mach-sdk7786/Makefile b/arch/sh/boards/mach-sdk7786/Makefile
index a29f19e85b63..8ae56e9560ac 100644
--- a/arch/sh/boards/mach-sdk7786/Makefile
+++ b/arch/sh/boards/mach-sdk7786/Makefile
@@ -1 +1,4 @@
1obj-y := setup.o fpga.o irq.o 1obj-y := fpga.o irq.o nmi.o setup.o
2
3obj-$(CONFIG_GENERIC_GPIO) += gpio.o
4obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o
diff --git a/arch/sh/boards/mach-sdk7786/gpio.c b/arch/sh/boards/mach-sdk7786/gpio.c
new file mode 100644
index 000000000000..f71ce09d4e15
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/gpio.c
@@ -0,0 +1,49 @@
1/*
2 * SDK7786 FPGA USRGPIR Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
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#include <linux/init.h>
11#include <linux/interrupt.h>
12#include <linux/gpio.h>
13#include <linux/irq.h>
14#include <linux/kernel.h>
15#include <linux/spinlock.h>
16#include <linux/io.h>
17#include <mach/fpga.h>
18
19#define NR_FPGA_GPIOS 8
20
21static const char *usrgpir_gpio_names[NR_FPGA_GPIOS] = {
22 "in0", "in1", "in2", "in3", "in4", "in5", "in6", "in7",
23};
24
25static int usrgpir_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
26{
27 /* always in */
28 return 0;
29}
30
31static int usrgpir_gpio_get(struct gpio_chip *chip, unsigned gpio)
32{
33 return !!(fpga_read_reg(USRGPIR) & (1 << gpio));
34}
35
36static struct gpio_chip usrgpir_gpio_chip = {
37 .label = "sdk7786-fpga",
38 .names = usrgpir_gpio_names,
39 .direction_input = usrgpir_gpio_direction_input,
40 .get = usrgpir_gpio_get,
41 .base = -1, /* don't care */
42 .ngpio = NR_FPGA_GPIOS,
43};
44
45static int __init usrgpir_gpio_setup(void)
46{
47 return gpiochip_add(&usrgpir_gpio_chip);
48}
49device_initcall(usrgpir_gpio_setup);
diff --git a/arch/sh/boards/mach-sdk7786/nmi.c b/arch/sh/boards/mach-sdk7786/nmi.c
new file mode 100644
index 000000000000..edcfa1f568ba
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/nmi.c
@@ -0,0 +1,83 @@
1/*
2 * SDK7786 FPGA NMI Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
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#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13#include <mach/fpga.h>
14
15enum {
16 NMI_MODE_MANUAL,
17 NMI_MODE_AUX,
18 NMI_MODE_MASKED,
19 NMI_MODE_ANY,
20 NMI_MODE_UNKNOWN,
21};
22
23/*
24 * Default to the manual NMI switch.
25 */
26static unsigned int __initdata nmi_mode = NMI_MODE_ANY;
27
28static int __init nmi_mode_setup(char *str)
29{
30 if (!str)
31 return 0;
32
33 if (strcmp(str, "manual") == 0)
34 nmi_mode = NMI_MODE_MANUAL;
35 else if (strcmp(str, "aux") == 0)
36 nmi_mode = NMI_MODE_AUX;
37 else if (strcmp(str, "masked") == 0)
38 nmi_mode = NMI_MODE_MASKED;
39 else if (strcmp(str, "any") == 0)
40 nmi_mode = NMI_MODE_ANY;
41 else {
42 nmi_mode = NMI_MODE_UNKNOWN;
43 pr_warning("Unknown NMI mode %s\n", str);
44 }
45
46 printk("Set NMI mode to %d\n", nmi_mode);
47 return 0;
48}
49early_param("nmi_mode", nmi_mode_setup);
50
51void __init sdk7786_nmi_init(void)
52{
53 unsigned int source, mask, tmp;
54
55 switch (nmi_mode) {
56 case NMI_MODE_MANUAL:
57 source = NMISR_MAN_NMI;
58 mask = NMIMR_MAN_NMIM;
59 break;
60 case NMI_MODE_AUX:
61 source = NMISR_AUX_NMI;
62 mask = NMIMR_AUX_NMIM;
63 break;
64 case NMI_MODE_ANY:
65 source = NMISR_MAN_NMI | NMISR_AUX_NMI;
66 mask = NMIMR_MAN_NMIM | NMIMR_AUX_NMIM;
67 break;
68 case NMI_MODE_MASKED:
69 case NMI_MODE_UNKNOWN:
70 default:
71 source = mask = 0;
72 break;
73 }
74
75 /* Set the NMI source */
76 tmp = fpga_read_reg(NMISR);
77 tmp &= ~NMISR_MASK;
78 tmp |= source;
79 fpga_write_reg(tmp, NMISR);
80
81 /* And the IRQ masking */
82 fpga_write_reg(NMIMR_MASK ^ mask, NMIMR);
83}
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index 2ec1ea5cf8ef..1521aa75ee3a 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -15,11 +15,13 @@
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/clkdev.h>
18#include <mach/fpga.h> 19#include <mach/fpga.h>
19#include <mach/irq.h> 20#include <mach/irq.h>
20#include <asm/machvec.h> 21#include <asm/machvec.h>
21#include <asm/heartbeat.h> 22#include <asm/heartbeat.h>
22#include <asm/sizes.h> 23#include <asm/sizes.h>
24#include <asm/clock.h>
23#include <asm/reboot.h> 25#include <asm/reboot.h>
24#include <asm/smp-ops.h> 26#include <asm/smp-ops.h>
25 27
@@ -133,13 +135,52 @@ static int __init sdk7786_devices_setup(void)
133 135
134 return sdk7786_i2c_setup(); 136 return sdk7786_i2c_setup();
135} 137}
136__initcall(sdk7786_devices_setup); 138device_initcall(sdk7786_devices_setup);
137 139
138static int sdk7786_mode_pins(void) 140static int sdk7786_mode_pins(void)
139{ 141{
140 return fpga_read_reg(MODSWR); 142 return fpga_read_reg(MODSWR);
141} 143}
142 144
145/*
146 * FPGA-driven PCIe clocks
147 *
148 * Historically these include the oscillator, clock B (slots 2/3/4) and
149 * clock A (slot 1 and the CPU clock). Newer revs of the PCB shove
150 * everything under a single PCIe clocks enable bit that happens to map
151 * to the same bit position as the oscillator bit for earlier FPGA
152 * versions.
153 *
154 * Given that the legacy clocks have the side-effect of shutting the CPU
155 * off through the FPGA along with the PCI slots, we simply leave them in
156 * their initial state and don't bother registering them with the clock
157 * framework.
158 */
159static int sdk7786_pcie_clk_enable(struct clk *clk)
160{
161 fpga_write_reg(fpga_read_reg(PCIECR) | PCIECR_CLKEN, PCIECR);
162 return 0;
163}
164
165static void sdk7786_pcie_clk_disable(struct clk *clk)
166{
167 fpga_write_reg(fpga_read_reg(PCIECR) & ~PCIECR_CLKEN, PCIECR);
168}
169
170static struct clk_ops sdk7786_pcie_clk_ops = {
171 .enable = sdk7786_pcie_clk_enable,
172 .disable = sdk7786_pcie_clk_disable,
173};
174
175static struct clk sdk7786_pcie_clk = {
176 .ops = &sdk7786_pcie_clk_ops,
177};
178
179static struct clk_lookup sdk7786_pcie_cl = {
180 .con_id = "pcie_plat_clk",
181 .clk = &sdk7786_pcie_clk,
182};
183
143static int sdk7786_clk_init(void) 184static int sdk7786_clk_init(void)
144{ 185{
145 struct clk *clk; 186 struct clk *clk;
@@ -158,7 +199,18 @@ static int sdk7786_clk_init(void)
158 ret = clk_set_rate(clk, 33333333); 199 ret = clk_set_rate(clk, 33333333);
159 clk_put(clk); 200 clk_put(clk);
160 201
161 return ret; 202 /*
203 * Setup the FPGA clocks.
204 */
205 ret = clk_register(&sdk7786_pcie_clk);
206 if (unlikely(ret)) {
207 pr_err("FPGA clock registration failed\n");
208 return ret;
209 }
210
211 clkdev_add(&sdk7786_pcie_cl);
212
213 return 0;
162} 214}
163 215
164static void sdk7786_restart(char *cmd) 216static void sdk7786_restart(char *cmd)
@@ -185,6 +237,7 @@ static void __init sdk7786_setup(char **cmdline_p)
185 pr_info("Renesas Technology Europe SDK7786 support:\n"); 237 pr_info("Renesas Technology Europe SDK7786 support:\n");
186 238
187 sdk7786_fpga_init(); 239 sdk7786_fpga_init();
240 sdk7786_nmi_init();
188 241
189 pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf); 242 pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
190 243
diff --git a/arch/sh/boards/mach-sdk7786/sram.c b/arch/sh/boards/mach-sdk7786/sram.c
new file mode 100644
index 000000000000..c81c3abbe01c
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/sram.c
@@ -0,0 +1,72 @@
1/*
2 * SDK7786 FPGA SRAM Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
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#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/io.h>
16#include <linux/string.h>
17#include <mach/fpga.h>
18#include <asm/sram.h>
19#include <asm/sizes.h>
20
21static int __init fpga_sram_init(void)
22{
23 unsigned long phys;
24 unsigned int area;
25 void __iomem *vaddr;
26 int ret;
27 u16 data;
28
29 /* Enable FPGA SRAM */
30 data = fpga_read_reg(LCLASR);
31 data |= LCLASR_FRAMEN;
32 fpga_write_reg(data, LCLASR);
33
34 /*
35 * FPGA_SEL determines the area mapping
36 */
37 area = (data & LCLASR_FPGA_SEL_MASK) >> LCLASR_FPGA_SEL_SHIFT;
38 if (unlikely(area == LCLASR_AREA_MASK)) {
39 pr_err("FPGA memory unmapped.\n");
40 return -ENXIO;
41 }
42
43 /*
44 * The memory itself occupies a 2KiB range at the top of the area
45 * immediately below the system registers.
46 */
47 phys = (area << 26) + SZ_64M - SZ_4K;
48
49 /*
50 * The FPGA SRAM resides in translatable physical space, so set
51 * up a mapping prior to inserting it in to the pool.
52 */
53 vaddr = ioremap(phys, SZ_2K);
54 if (unlikely(!vaddr)) {
55 pr_err("Failed remapping FPGA memory.\n");
56 return -ENXIO;
57 }
58
59 pr_info("Adding %dKiB of FPGA memory at 0x%08lx-0x%08lx "
60 "(area %d) to pool.\n",
61 SZ_2K >> 10, phys, phys + SZ_2K - 1, area);
62
63 ret = gen_pool_add(sram_pool, (unsigned long)vaddr, SZ_2K, -1);
64 if (unlikely(ret < 0)) {
65 pr_err("Failed adding memory\n");
66 iounmap(vaddr);
67 return ret;
68 }
69
70 return 0;
71}
72postcore_initcall(fpga_sram_init);
diff --git a/arch/sh/boards/mach-se/7206/Makefile b/arch/sh/boards/mach-se/7206/Makefile
index 63e7ed699f39..5c9eaa0535b9 100644
--- a/arch/sh/boards/mach-se/7206/Makefile
+++ b/arch/sh/boards/mach-se/7206/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 7206 SolutionEngine specific parts of the kernel 2# Makefile for the 7206 SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/7206/io.c b/arch/sh/boards/mach-se/7206/io.c
deleted file mode 100644
index adadc77532ee..000000000000
--- a/arch/sh/boards/mach-se/7206/io.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $
2 *
3 * linux/arch/sh/boards/se/7206/io.c
4 *
5 * Copyright (C) 2006 Yoshinori Sato
6 *
7 * I/O routine for Hitachi 7206 SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <asm/io.h>
14#include <mach-se/mach/se7206.h>
15
16
17static inline void delay(void)
18{
19 __raw_readw(0x20000000); /* P2 ROM Area */
20}
21
22/* MS7750 requires special versions of in*, out* routines, since
23 PC-like io ports are located at upper half byte of 16-bit word which
24 can be accessed only with 16-bit wide. */
25
26static inline volatile __u16 *
27port2adr(unsigned int port)
28{
29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33
34 return (volatile __u16 *)port;
35}
36
37unsigned char se7206_inb(unsigned long port)
38{
39 return (*port2adr(port)) & 0xff;
40}
41
42unsigned char se7206_inb_p(unsigned long port)
43{
44 unsigned long v;
45
46 v = (*port2adr(port)) & 0xff;
47 delay();
48 return v;
49}
50
51unsigned short se7206_inw(unsigned long port)
52{
53 return *port2adr(port);
54}
55
56void se7206_outb(unsigned char value, unsigned long port)
57{
58 *(port2adr(port)) = value;
59}
60
61void se7206_outb_p(unsigned char value, unsigned long port)
62{
63 *(port2adr(port)) = value;
64 delay();
65}
66
67void se7206_outw(unsigned short value, unsigned long port)
68{
69 *port2adr(port) = value;
70}
71
72void se7206_insb(unsigned long port, void *addr, unsigned long count)
73{
74 volatile __u16 *p = port2adr(port);
75 __u8 *ap = addr;
76
77 while (count--)
78 *ap++ = *p;
79}
80
81void se7206_insw(unsigned long port, void *addr, unsigned long count)
82{
83 volatile __u16 *p = port2adr(port);
84 __u16 *ap = addr;
85 while (count--)
86 *ap++ = *p;
87}
88
89void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
90{
91 volatile __u16 *p = port2adr(port);
92 const __u8 *ap = addr;
93
94 while (count--)
95 *p = *ap++;
96}
97
98void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
99{
100 volatile __u16 *p = port2adr(port);
101 const __u16 *ap = addr;
102 while (count--)
103 *p = *ap++;
104}
diff --git a/arch/sh/boards/mach-se/7206/irq.c b/arch/sh/boards/mach-se/7206/irq.c
index 8d82175d83ab..0db058e709e9 100644
--- a/arch/sh/boards/mach-se/7206/irq.c
+++ b/arch/sh/boards/mach-se/7206/irq.c
@@ -25,8 +25,9 @@
25#define INTC_IPR01 0xfffe0818 25#define INTC_IPR01 0xfffe0818
26#define INTC_ICR1 0xfffe0802 26#define INTC_ICR1 0xfffe0802
27 27
28static void disable_se7206_irq(unsigned int irq) 28static void disable_se7206_irq(struct irq_data *data)
29{ 29{
30 unsigned int irq = data->irq;
30 unsigned short val; 31 unsigned short val;
31 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq))); 32 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq)));
32 unsigned short msk0,msk1; 33 unsigned short msk0,msk1;
@@ -55,8 +56,9 @@ static void disable_se7206_irq(unsigned int irq)
55 __raw_writew(msk1, INTMSK1); 56 __raw_writew(msk1, INTMSK1);
56} 57}
57 58
58static void enable_se7206_irq(unsigned int irq) 59static void enable_se7206_irq(struct irq_data *data)
59{ 60{
61 unsigned int irq = data->irq;
60 unsigned short val; 62 unsigned short val;
61 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq))); 63 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq)));
62 unsigned short msk0,msk1; 64 unsigned short msk0,msk1;
@@ -86,13 +88,13 @@ static void enable_se7206_irq(unsigned int irq)
86 __raw_writew(msk1, INTMSK1); 88 __raw_writew(msk1, INTMSK1);
87} 89}
88 90
89static void eoi_se7206_irq(unsigned int irq) 91static void eoi_se7206_irq(struct irq_data *data)
90{ 92{
91 unsigned short sts0,sts1; 93 unsigned short sts0,sts1;
92 struct irq_desc *desc = irq_to_desc(irq); 94 unsigned int irq = data->irq;
93 95
94 if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 96 if (!irqd_irq_disabled(data) && !irqd_irq_inprogress(data))
95 enable_se7206_irq(irq); 97 enable_se7206_irq(data);
96 /* FPGA isr clear */ 98 /* FPGA isr clear */
97 sts0 = __raw_readw(INTSTS0); 99 sts0 = __raw_readw(INTSTS0);
98 sts1 = __raw_readw(INTSTS1); 100 sts1 = __raw_readw(INTSTS1);
@@ -115,18 +117,17 @@ static void eoi_se7206_irq(unsigned int irq)
115 117
116static struct irq_chip se7206_irq_chip __read_mostly = { 118static struct irq_chip se7206_irq_chip __read_mostly = {
117 .name = "SE7206-FPGA", 119 .name = "SE7206-FPGA",
118 .mask = disable_se7206_irq, 120 .irq_mask = disable_se7206_irq,
119 .unmask = enable_se7206_irq, 121 .irq_unmask = enable_se7206_irq,
120 .mask_ack = disable_se7206_irq, 122 .irq_eoi = eoi_se7206_irq,
121 .eoi = eoi_se7206_irq,
122}; 123};
123 124
124static void make_se7206_irq(unsigned int irq) 125static void make_se7206_irq(unsigned int irq)
125{ 126{
126 disable_irq_nosync(irq); 127 disable_irq_nosync(irq);
127 set_irq_chip_and_handler_name(irq, &se7206_irq_chip, 128 irq_set_chip_and_handler_name(irq, &se7206_irq_chip,
128 handle_level_irq, "level"); 129 handle_level_irq, "level");
129 disable_se7206_irq(irq); 130 disable_se7206_irq(irq_get_irq_data(irq));
130} 131}
131 132
132/* 133/*
@@ -137,11 +138,13 @@ void __init init_se7206_IRQ(void)
137 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */ 138 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
138 make_se7206_irq(IRQ1_IRQ); /* ATA */ 139 make_se7206_irq(IRQ1_IRQ); /* ATA */
139 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */ 140 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
140 __raw_writew(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */ 141
142 __raw_writew(__raw_readw(INTC_ICR1) | 0x000b, INTC_ICR1); /* ICR1 */
141 143
142 /* FPGA System register setup*/ 144 /* FPGA System register setup*/
143 __raw_writew(0x0000,INTSTS0); /* Clear INTSTS0 */ 145 __raw_writew(0x0000,INTSTS0); /* Clear INTSTS0 */
144 __raw_writew(0x0000,INTSTS1); /* Clear INTSTS1 */ 146 __raw_writew(0x0000,INTSTS1); /* Clear INTSTS1 */
147
145 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */ 148 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
146 __raw_writew(0x0001,INTSEL); 149 __raw_writew(0x0001,INTSEL);
147} 150}
diff --git a/arch/sh/boards/mach-se/7206/setup.c b/arch/sh/boards/mach-se/7206/setup.c
index 8f5c65d43d1d..8ab8330e3fd1 100644
--- a/arch/sh/boards/mach-se/7206/setup.c
+++ b/arch/sh/boards/mach-se/7206/setup.c
@@ -77,7 +77,12 @@ static int __init se7206_devices_setup(void)
77{ 77{
78 return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices)); 78 return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices));
79} 79}
80__initcall(se7206_devices_setup); 80device_initcall(se7206_devices_setup);
81
82static int se7206_mode_pins(void)
83{
84 return MODE_PIN1 | MODE_PIN2;
85}
81 86
82/* 87/*
83 * The Machine Vector 88 * The Machine Vector
@@ -86,20 +91,6 @@ __initcall(se7206_devices_setup);
86static struct sh_machine_vector mv_se __initmv = { 91static struct sh_machine_vector mv_se __initmv = {
87 .mv_name = "SolutionEngine", 92 .mv_name = "SolutionEngine",
88 .mv_nr_irqs = 256, 93 .mv_nr_irqs = 256,
89 .mv_inb = se7206_inb,
90 .mv_inw = se7206_inw,
91 .mv_outb = se7206_outb,
92 .mv_outw = se7206_outw,
93
94 .mv_inb_p = se7206_inb_p,
95 .mv_inw_p = se7206_inw,
96 .mv_outb_p = se7206_outb_p,
97 .mv_outw_p = se7206_outw,
98
99 .mv_insb = se7206_insb,
100 .mv_insw = se7206_insw,
101 .mv_outsb = se7206_outsb,
102 .mv_outsw = se7206_outsw,
103
104 .mv_init_irq = init_se7206_IRQ, 94 .mv_init_irq = init_se7206_IRQ,
95 .mv_mode_pins = se7206_mode_pins,
105}; 96};
diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
index d4305c26e9f7..fd45ffc48340 100644
--- a/arch/sh/boards/mach-se/7343/irq.c
+++ b/arch/sh/boards/mach-se/7343/irq.c
@@ -18,23 +18,22 @@
18 18
19unsigned int se7343_fpga_irq[SE7343_FPGA_IRQ_NR] = { 0, }; 19unsigned int se7343_fpga_irq[SE7343_FPGA_IRQ_NR] = { 0, };
20 20
21static void disable_se7343_irq(unsigned int irq) 21static void disable_se7343_irq(struct irq_data *data)
22{ 22{
23 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 23 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
24 __raw_writew(__raw_readw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK); 24 __raw_writew(__raw_readw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK);
25} 25}
26 26
27static void enable_se7343_irq(unsigned int irq) 27static void enable_se7343_irq(struct irq_data *data)
28{ 28{
29 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 29 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
30 __raw_writew(__raw_readw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK); 30 __raw_writew(__raw_readw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK);
31} 31}
32 32
33static struct irq_chip se7343_irq_chip __read_mostly = { 33static struct irq_chip se7343_irq_chip __read_mostly = {
34 .name = "SE7343-FPGA", 34 .name = "SE7343-FPGA",
35 .mask = disable_se7343_irq, 35 .irq_mask = disable_se7343_irq,
36 .unmask = enable_se7343_irq, 36 .irq_unmask = enable_se7343_irq,
37 .mask_ack = disable_se7343_irq,
38}; 37};
39 38
40static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc) 39static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
@@ -68,19 +67,20 @@ void __init init_7343se_IRQ(void)
68 return; 67 return;
69 se7343_fpga_irq[i] = irq; 68 se7343_fpga_irq[i] = irq;
70 69
71 set_irq_chip_and_handler_name(se7343_fpga_irq[i], 70 irq_set_chip_and_handler_name(se7343_fpga_irq[i],
72 &se7343_irq_chip, 71 &se7343_irq_chip,
73 handle_level_irq, "level"); 72 handle_level_irq,
73 "level");
74 74
75 set_irq_chip_data(se7343_fpga_irq[i], (void *)i); 75 irq_set_chip_data(se7343_fpga_irq[i], (void *)i);
76 } 76 }
77 77
78 set_irq_chained_handler(IRQ0_IRQ, se7343_irq_demux); 78 irq_set_chained_handler(IRQ0_IRQ, se7343_irq_demux);
79 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW); 79 irq_set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
80 set_irq_chained_handler(IRQ1_IRQ, se7343_irq_demux); 80 irq_set_chained_handler(IRQ1_IRQ, se7343_irq_demux);
81 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW); 81 irq_set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
82 set_irq_chained_handler(IRQ4_IRQ, se7343_irq_demux); 82 irq_set_chained_handler(IRQ4_IRQ, se7343_irq_demux);
83 set_irq_type(IRQ4_IRQ, IRQ_TYPE_LEVEL_LOW); 83 irq_set_irq_type(IRQ4_IRQ, IRQ_TYPE_LEVEL_LOW);
84 set_irq_chained_handler(IRQ5_IRQ, se7343_irq_demux); 84 irq_set_chained_handler(IRQ5_IRQ, se7343_irq_demux);
85 set_irq_type(IRQ5_IRQ, IRQ_TYPE_LEVEL_LOW); 85 irq_set_irq_type(IRQ5_IRQ, IRQ_TYPE_LEVEL_LOW);
86} 86}
diff --git a/arch/sh/boards/mach-se/770x/Makefile b/arch/sh/boards/mach-se/770x/Makefile
index 8e624b06d5ea..43ea14feef51 100644
--- a/arch/sh/boards/mach-se/770x/Makefile
+++ b/arch/sh/boards/mach-se/770x/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 770x SolutionEngine specific parts of the kernel 2# Makefile for the 770x SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/770x/io.c b/arch/sh/boards/mach-se/770x/io.c
deleted file mode 100644
index 28833c8786ea..000000000000
--- a/arch/sh/boards/mach-se/770x/io.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * Copyright (C) 2000 Kazumoto Kojima
3 *
4 * I/O routine for Hitachi SolutionEngine.
5 */
6#include <linux/kernel.h>
7#include <linux/types.h>
8#include <asm/io.h>
9#include <mach-se/mach/se.h>
10
11/* MS7750 requires special versions of in*, out* routines, since
12 PC-like io ports are located at upper half byte of 16-bit word which
13 can be accessed only with 16-bit wide. */
14
15static inline volatile __u16 *
16port2adr(unsigned int port)
17{
18 if (port & 0xff000000)
19 return ( volatile __u16 *) port;
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 else if (port >= 0x1000)
23 return (volatile __u16 *) (PA_83902 + (port << 1));
24 else
25 return (volatile __u16 *) (PA_SUPERIO + (port << 1));
26}
27
28static inline int
29shifted_port(unsigned long port)
30{
31 /* For IDE registers, value is not shifted */
32 if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6)
33 return 0;
34 else
35 return 1;
36}
37
38unsigned char se_inb(unsigned long port)
39{
40 if (shifted_port(port))
41 return (*port2adr(port) >> 8);
42 else
43 return (*port2adr(port))&0xff;
44}
45
46unsigned char se_inb_p(unsigned long port)
47{
48 unsigned long v;
49
50 if (shifted_port(port))
51 v = (*port2adr(port) >> 8);
52 else
53 v = (*port2adr(port))&0xff;
54 ctrl_delay();
55 return v;
56}
57
58unsigned short se_inw(unsigned long port)
59{
60 if (port >= 0x2000)
61 return *port2adr(port);
62 else
63 maybebadio(port);
64 return 0;
65}
66
67unsigned int se_inl(unsigned long port)
68{
69 maybebadio(port);
70 return 0;
71}
72
73void se_outb(unsigned char value, unsigned long port)
74{
75 if (shifted_port(port))
76 *(port2adr(port)) = value << 8;
77 else
78 *(port2adr(port)) = value;
79}
80
81void se_outb_p(unsigned char value, unsigned long port)
82{
83 if (shifted_port(port))
84 *(port2adr(port)) = value << 8;
85 else
86 *(port2adr(port)) = value;
87 ctrl_delay();
88}
89
90void se_outw(unsigned short value, unsigned long port)
91{
92 if (port >= 0x2000)
93 *port2adr(port) = value;
94 else
95 maybebadio(port);
96}
97
98void se_outl(unsigned int value, unsigned long port)
99{
100 maybebadio(port);
101}
102
103void se_insb(unsigned long port, void *addr, unsigned long count)
104{
105 volatile __u16 *p = port2adr(port);
106 __u8 *ap = addr;
107
108 if (shifted_port(port)) {
109 while (count--)
110 *ap++ = *p >> 8;
111 } else {
112 while (count--)
113 *ap++ = *p;
114 }
115}
116
117void se_insw(unsigned long port, void *addr, unsigned long count)
118{
119 volatile __u16 *p = port2adr(port);
120 __u16 *ap = addr;
121 while (count--)
122 *ap++ = *p;
123}
124
125void se_insl(unsigned long port, void *addr, unsigned long count)
126{
127 maybebadio(port);
128}
129
130void se_outsb(unsigned long port, const void *addr, unsigned long count)
131{
132 volatile __u16 *p = port2adr(port);
133 const __u8 *ap = addr;
134
135 if (shifted_port(port)) {
136 while (count--)
137 *p = *ap++ << 8;
138 } else {
139 while (count--)
140 *p = *ap++;
141 }
142}
143
144void se_outsw(unsigned long port, const void *addr, unsigned long count)
145{
146 volatile __u16 *p = port2adr(port);
147 const __u16 *ap = addr;
148
149 while (count--)
150 *p = *ap++;
151}
152
153void se_outsl(unsigned long port, const void *addr, unsigned long count)
154{
155 maybebadio(port);
156}
diff --git a/arch/sh/boards/mach-se/770x/setup.c b/arch/sh/boards/mach-se/770x/setup.c
index 66d39d1b0901..31330c65c0ce 100644
--- a/arch/sh/boards/mach-se/770x/setup.c
+++ b/arch/sh/boards/mach-se/770x/setup.c
@@ -195,27 +195,5 @@ static struct sh_machine_vector mv_se __initmv = {
195#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 195#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
196 .mv_nr_irqs = 104, 196 .mv_nr_irqs = 104,
197#endif 197#endif
198
199 .mv_inb = se_inb,
200 .mv_inw = se_inw,
201 .mv_inl = se_inl,
202 .mv_outb = se_outb,
203 .mv_outw = se_outw,
204 .mv_outl = se_outl,
205
206 .mv_inb_p = se_inb_p,
207 .mv_inw_p = se_inw,
208 .mv_inl_p = se_inl,
209 .mv_outb_p = se_outb_p,
210 .mv_outw_p = se_outw,
211 .mv_outl_p = se_outl,
212
213 .mv_insb = se_insb,
214 .mv_insw = se_insw,
215 .mv_insl = se_insl,
216 .mv_outsb = se_outsb,
217 .mv_outsw = se_outsw,
218 .mv_outsl = se_outsl,
219
220 .mv_init_irq = init_se_IRQ, 198 .mv_init_irq = init_se_IRQ,
221}; 199};
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
index 61605db04ee6..aac92f21ebd2 100644
--- a/arch/sh/boards/mach-se/7722/irq.c
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -18,23 +18,22 @@
18 18
19unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, }; 19unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, };
20 20
21static void disable_se7722_irq(unsigned int irq) 21static void disable_se7722_irq(struct irq_data *data)
22{ 22{
23 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 23 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
24 __raw_writew(__raw_readw(IRQ01_MASK) | 1 << bit, IRQ01_MASK); 24 __raw_writew(__raw_readw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
25} 25}
26 26
27static void enable_se7722_irq(unsigned int irq) 27static void enable_se7722_irq(struct irq_data *data)
28{ 28{
29 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 29 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
30 __raw_writew(__raw_readw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK); 30 __raw_writew(__raw_readw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
31} 31}
32 32
33static struct irq_chip se7722_irq_chip __read_mostly = { 33static struct irq_chip se7722_irq_chip __read_mostly = {
34 .name = "SE7722-FPGA", 34 .name = "SE7722-FPGA",
35 .mask = disable_se7722_irq, 35 .irq_mask = disable_se7722_irq,
36 .unmask = enable_se7722_irq, 36 .irq_unmask = enable_se7722_irq,
37 .mask_ack = disable_se7722_irq,
38}; 37};
39 38
40static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc) 39static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
@@ -68,16 +67,17 @@ void __init init_se7722_IRQ(void)
68 return; 67 return;
69 se7722_fpga_irq[i] = irq; 68 se7722_fpga_irq[i] = irq;
70 69
71 set_irq_chip_and_handler_name(se7722_fpga_irq[i], 70 irq_set_chip_and_handler_name(se7722_fpga_irq[i],
72 &se7722_irq_chip, 71 &se7722_irq_chip,
73 handle_level_irq, "level"); 72 handle_level_irq,
73 "level");
74 74
75 set_irq_chip_data(se7722_fpga_irq[i], (void *)i); 75 irq_set_chip_data(se7722_fpga_irq[i], (void *)i);
76 } 76 }
77 77
78 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux); 78 irq_set_chained_handler(IRQ0_IRQ, se7722_irq_demux);
79 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW); 79 irq_set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
80 80
81 set_irq_chained_handler(IRQ1_IRQ, se7722_irq_demux); 81 irq_set_chained_handler(IRQ1_IRQ, se7722_irq_demux);
82 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW); 82 irq_set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
83} 83}
diff --git a/arch/sh/boards/mach-se/7724/irq.c b/arch/sh/boards/mach-se/7724/irq.c
index 0942be2daef6..c6342ce7768d 100644
--- a/arch/sh/boards/mach-se/7724/irq.c
+++ b/arch/sh/boards/mach-se/7724/irq.c
@@ -68,25 +68,26 @@ static struct fpga_irq get_fpga_irq(unsigned int irq)
68 return set; 68 return set;
69} 69}
70 70
71static void disable_se7724_irq(unsigned int irq) 71static void disable_se7724_irq(struct irq_data *data)
72{ 72{
73 unsigned int irq = data->irq;
73 struct fpga_irq set = get_fpga_irq(fpga2irq(irq)); 74 struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
74 unsigned int bit = irq - set.base; 75 unsigned int bit = irq - set.base;
75 __raw_writew(__raw_readw(set.mraddr) | 0x0001 << bit, set.mraddr); 76 __raw_writew(__raw_readw(set.mraddr) | 0x0001 << bit, set.mraddr);
76} 77}
77 78
78static void enable_se7724_irq(unsigned int irq) 79static void enable_se7724_irq(struct irq_data *data)
79{ 80{
81 unsigned int irq = data->irq;
80 struct fpga_irq set = get_fpga_irq(fpga2irq(irq)); 82 struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
81 unsigned int bit = irq - set.base; 83 unsigned int bit = irq - set.base;
82 __raw_writew(__raw_readw(set.mraddr) & ~(0x0001 << bit), set.mraddr); 84 __raw_writew(__raw_readw(set.mraddr) & ~(0x0001 << bit), set.mraddr);
83} 85}
84 86
85static struct irq_chip se7724_irq_chip __read_mostly = { 87static struct irq_chip se7724_irq_chip __read_mostly = {
86 .name = "SE7724-FPGA", 88 .name = "SE7724-FPGA",
87 .mask = disable_se7724_irq, 89 .irq_mask = disable_se7724_irq,
88 .unmask = enable_se7724_irq, 90 .irq_unmask = enable_se7724_irq,
89 .mask_ack = disable_se7724_irq,
90}; 91};
91 92
92static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc) 93static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
@@ -139,17 +140,16 @@ void __init init_se7724_IRQ(void)
139 return; 140 return;
140 } 141 }
141 142
142 set_irq_chip_and_handler_name(irq, 143 irq_set_chip_and_handler_name(irq, &se7724_irq_chip,
143 &se7724_irq_chip,
144 handle_level_irq, "level"); 144 handle_level_irq, "level");
145 } 145 }
146 146
147 set_irq_chained_handler(IRQ0_IRQ, se7724_irq_demux); 147 irq_set_chained_handler(IRQ0_IRQ, se7724_irq_demux);
148 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW); 148 irq_set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
149 149
150 set_irq_chained_handler(IRQ1_IRQ, se7724_irq_demux); 150 irq_set_chained_handler(IRQ1_IRQ, se7724_irq_demux);
151 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW); 151 irq_set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
152 152
153 set_irq_chained_handler(IRQ2_IRQ, se7724_irq_demux); 153 irq_set_chained_handler(IRQ2_IRQ, se7724_irq_demux);
154 set_irq_type(IRQ2_IRQ, IRQ_TYPE_LEVEL_LOW); 154 irq_set_irq_type(IRQ2_IRQ, IRQ_TYPE_LEVEL_LOW);
155} 155}
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 552ebd9ba82b..12357671023e 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -14,7 +14,8 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mfd/sh_mobile_sdhi.h> 17#include <linux/mmc/host.h>
18#include <linux/mmc/sh_mobile_sdhi.h>
18#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
19#include <linux/delay.h> 20#include <linux/delay.h>
20#include <linux/smc91x.h> 21#include <linux/smc91x.h>
@@ -144,16 +145,42 @@ static struct platform_device nor_flash_device = {
144}; 145};
145 146
146/* LCDC */ 147/* LCDC */
148const static struct fb_videomode lcdc_720p_modes[] = {
149 {
150 .name = "LB070WV1",
151 .sync = 0, /* hsync and vsync are active low */
152 .xres = 1280,
153 .yres = 720,
154 .left_margin = 220,
155 .right_margin = 110,
156 .hsync_len = 40,
157 .upper_margin = 20,
158 .lower_margin = 5,
159 .vsync_len = 5,
160 },
161};
162
163const static struct fb_videomode lcdc_vga_modes[] = {
164 {
165 .name = "LB070WV1",
166 .sync = 0, /* hsync and vsync are active low */
167 .xres = 640,
168 .yres = 480,
169 .left_margin = 105,
170 .right_margin = 50,
171 .hsync_len = 96,
172 .upper_margin = 33,
173 .lower_margin = 10,
174 .vsync_len = 2,
175 },
176};
177
147static struct sh_mobile_lcdc_info lcdc_info = { 178static struct sh_mobile_lcdc_info lcdc_info = {
148 .clock_source = LCDC_CLK_EXTERNAL, 179 .clock_source = LCDC_CLK_EXTERNAL,
149 .ch[0] = { 180 .ch[0] = {
150 .chan = LCDC_CHAN_MAINLCD, 181 .chan = LCDC_CHAN_MAINLCD,
151 .bpp = 16, 182 .bpp = 16,
152 .clock_divider = 1, 183 .clock_divider = 1,
153 .lcd_cfg = {
154 .name = "LB070WV1",
155 .sync = 0, /* hsync and vsync are active low */
156 },
157 .lcd_size_cfg = { /* 7.0 inch */ 184 .lcd_size_cfg = { /* 7.0 inch */
158 .width = 152, 185 .width = 152,
159 .height = 91, 186 .height = 91,
@@ -257,38 +284,9 @@ static struct platform_device ceu1_device = {
257}; 284};
258 285
259/* FSI */ 286/* FSI */
260/*
261 * FSI-A use external clock which came from ak464x.
262 * So, we should change parent of fsi
263 */
264#define FCLKACR 0xa4150008
265static void fsimck_init(struct clk *clk)
266{
267 u32 status = __raw_readl(clk->enable_reg);
268
269 /* use external clock */
270 status &= ~0x000000ff;
271 status |= 0x00000080;
272 __raw_writel(status, clk->enable_reg);
273}
274
275static struct clk_ops fsimck_clk_ops = {
276 .init = fsimck_init,
277};
278
279static struct clk fsimcka_clk = {
280 .ops = &fsimck_clk_ops,
281 .enable_reg = (void __iomem *)FCLKACR,
282 .rate = 0, /* unknown */
283};
284
285/* change J20, J21, J22 pin to 1-2 connection to use slave mode */ 287/* change J20, J21, J22 pin to 1-2 connection to use slave mode */
286static struct sh_fsi_platform_info fsi_info = { 288static struct sh_fsi_platform_info fsi_info = {
287 .porta_flags = SH_FSI_BRS_INV | 289 .porta_flags = SH_FSI_BRS_INV,
288 SH_FSI_OUT_SLAVE_MODE |
289 SH_FSI_IN_SLAVE_MODE |
290 SH_FSI_OFMT(PCM) |
291 SH_FSI_IFMT(PCM),
292}; 290};
293 291
294static struct resource fsi_resources[] = { 292static struct resource fsi_resources[] = {
@@ -317,6 +315,10 @@ static struct platform_device fsi_device = {
317 }, 315 },
318}; 316};
319 317
318static struct platform_device fsi_ak4642_device = {
319 .name = "sh_fsi_a_ak4642",
320};
321
320/* KEYSC in SoC (Needs SW33-2 set to ON) */ 322/* KEYSC in SoC (Needs SW33-2 set to ON) */
321static struct sh_keysc_info keysc_info = { 323static struct sh_keysc_info keysc_info = {
322 .mode = SH_KEYSC_MODE_1, 324 .mode = SH_KEYSC_MODE_1,
@@ -454,7 +456,7 @@ static struct resource sdhi0_cn7_resources[] = {
454 [0] = { 456 [0] = {
455 .name = "SDHI0", 457 .name = "SDHI0",
456 .start = 0x04ce0000, 458 .start = 0x04ce0000,
457 .end = 0x04ce01ff, 459 .end = 0x04ce00ff,
458 .flags = IORESOURCE_MEM, 460 .flags = IORESOURCE_MEM,
459 }, 461 },
460 [1] = { 462 [1] = {
@@ -466,6 +468,7 @@ static struct resource sdhi0_cn7_resources[] = {
466static struct sh_mobile_sdhi_info sh7724_sdhi0_data = { 468static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
467 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 469 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
468 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 470 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
471 .tmio_caps = MMC_CAP_SDIO_IRQ,
469}; 472};
470 473
471static struct platform_device sdhi0_cn7_device = { 474static struct platform_device sdhi0_cn7_device = {
@@ -485,7 +488,7 @@ static struct resource sdhi1_cn8_resources[] = {
485 [0] = { 488 [0] = {
486 .name = "SDHI1", 489 .name = "SDHI1",
487 .start = 0x04cf0000, 490 .start = 0x04cf0000,
488 .end = 0x04cf01ff, 491 .end = 0x04cf00ff,
489 .flags = IORESOURCE_MEM, 492 .flags = IORESOURCE_MEM,
490 }, 493 },
491 [1] = { 494 [1] = {
@@ -497,6 +500,7 @@ static struct resource sdhi1_cn8_resources[] = {
497static struct sh_mobile_sdhi_info sh7724_sdhi1_data = { 500static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
498 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 501 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
499 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 502 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
503 .tmio_caps = MMC_CAP_SDIO_IRQ,
500}; 504};
501 505
502static struct platform_device sdhi1_cn8_device = { 506static struct platform_device sdhi1_cn8_device = {
@@ -550,7 +554,6 @@ static struct sh_vou_pdata sh_vou_pdata = {
550 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 554 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
551 .board_info = &ak8813, 555 .board_info = &ak8813,
552 .i2c_adap = 0, 556 .i2c_adap = 0,
553 .module_name = "ak881x",
554}; 557};
555 558
556static struct resource sh_vou_resources[] = { 559static struct resource sh_vou_resources[] = {
@@ -590,6 +593,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
590 &sh7724_usb0_host_device, 593 &sh7724_usb0_host_device,
591 &sh7724_usb1_gadget_device, 594 &sh7724_usb1_gadget_device,
592 &fsi_device, 595 &fsi_device,
596 &fsi_ak4642_device,
593 &sdhi0_cn7_device, 597 &sdhi0_cn7_device,
594 &sdhi1_cn8_device, 598 &sdhi1_cn8_device,
595 &irda_device, 599 &irda_device,
@@ -827,37 +831,29 @@ static int __init devices_setup(void)
827 gpio_request(GPIO_FN_KEYOUT0, NULL); 831 gpio_request(GPIO_FN_KEYOUT0, NULL);
828 832
829 /* enable FSI */ 833 /* enable FSI */
830 gpio_request(GPIO_FN_FSIMCKB, NULL);
831 gpio_request(GPIO_FN_FSIMCKA, NULL); 834 gpio_request(GPIO_FN_FSIMCKA, NULL);
835 gpio_request(GPIO_FN_FSIIASD, NULL);
832 gpio_request(GPIO_FN_FSIOASD, NULL); 836 gpio_request(GPIO_FN_FSIOASD, NULL);
833 gpio_request(GPIO_FN_FSIIABCK, NULL); 837 gpio_request(GPIO_FN_FSIIABCK, NULL);
834 gpio_request(GPIO_FN_FSIIALRCK, NULL); 838 gpio_request(GPIO_FN_FSIIALRCK, NULL);
835 gpio_request(GPIO_FN_FSIOABCK, NULL); 839 gpio_request(GPIO_FN_FSIOABCK, NULL);
836 gpio_request(GPIO_FN_FSIOALRCK, NULL); 840 gpio_request(GPIO_FN_FSIOALRCK, NULL);
837 gpio_request(GPIO_FN_CLKAUDIOAO, NULL); 841 gpio_request(GPIO_FN_CLKAUDIOAO, NULL);
838 gpio_request(GPIO_FN_FSIIBSD, NULL);
839 gpio_request(GPIO_FN_FSIOBSD, NULL);
840 gpio_request(GPIO_FN_FSIIBBCK, NULL);
841 gpio_request(GPIO_FN_FSIIBLRCK, NULL);
842 gpio_request(GPIO_FN_FSIOBBCK, NULL);
843 gpio_request(GPIO_FN_FSIOBLRCK, NULL);
844 gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
845 gpio_request(GPIO_FN_FSIIASD, NULL);
846 842
847 /* set SPU2 clock to 83.4 MHz */ 843 /* set SPU2 clock to 83.4 MHz */
848 clk = clk_get(NULL, "spu_clk"); 844 clk = clk_get(NULL, "spu_clk");
849 if (clk) { 845 if (!IS_ERR(clk)) {
850 clk_set_rate(clk, clk_round_rate(clk, 83333333)); 846 clk_set_rate(clk, clk_round_rate(clk, 83333333));
851 clk_put(clk); 847 clk_put(clk);
852 } 848 }
853 849
854 /* change parent of FSI A */ 850 /* change parent of FSI A */
855 clk = clk_get(NULL, "fsia_clk"); 851 clk = clk_get(NULL, "fsia_clk");
856 if (clk) { 852 if (!IS_ERR(clk)) {
857 clk_register(&fsimcka_clk); 853 /* 48kHz dummy clock was used to make sure 1/1 divide */
858 clk_set_parent(clk, &fsimcka_clk); 854 clk_set_rate(&sh7724_fsimcka_clk, 48000);
859 clk_set_rate(clk, 11000); 855 clk_set_parent(clk, &sh7724_fsimcka_clk);
860 clk_set_rate(&fsimcka_clk, 11000); 856 clk_set_rate(clk, 48000);
861 clk_put(clk); 857 clk_put(clk);
862 } 858 }
863 859
@@ -909,24 +905,12 @@ static int __init devices_setup(void)
909 905
910 if (sw & SW41_B) { 906 if (sw & SW41_B) {
911 /* 720p */ 907 /* 720p */
912 lcdc_info.ch[0].lcd_cfg.xres = 1280; 908 lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes;
913 lcdc_info.ch[0].lcd_cfg.yres = 720; 909 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes);
914 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
915 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
916 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
917 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
918 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
919 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
920 } else { 910 } else {
921 /* VGA */ 911 /* VGA */
922 lcdc_info.ch[0].lcd_cfg.xres = 640; 912 lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes;
923 lcdc_info.ch[0].lcd_cfg.yres = 480; 913 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes);
924 lcdc_info.ch[0].lcd_cfg.left_margin = 105;
925 lcdc_info.ch[0].lcd_cfg.right_margin = 50;
926 lcdc_info.ch[0].lcd_cfg.hsync_len = 96;
927 lcdc_info.ch[0].lcd_cfg.upper_margin = 33;
928 lcdc_info.ch[0].lcd_cfg.lower_margin = 10;
929 lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
930 } 914 }
931 915
932 if (sw & SW41_A) { 916 if (sw & SW41_A) {
diff --git a/arch/sh/boards/mach-se/7751/Makefile b/arch/sh/boards/mach-se/7751/Makefile
index e6f4341bfe6e..a338fd9d5039 100644
--- a/arch/sh/boards/mach-se/7751/Makefile
+++ b/arch/sh/boards/mach-se/7751/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 7751 SolutionEngine specific parts of the kernel 2# Makefile for the 7751 SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/7751/io.c b/arch/sh/boards/mach-se/7751/io.c
deleted file mode 100644
index 6e75bd4459e5..000000000000
--- a/arch/sh/boards/mach-se/7751/io.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
4 *
5 * I/O routine for Hitachi 7751 SolutionEngine.
6 *
7 * Initial version only to support LAN access; some
8 * placeholder code from io_se.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
10 */
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/pci.h>
14#include <asm/io.h>
15#include <mach-se/mach/se7751.h>
16#include <asm/addrspace.h>
17
18static inline volatile u16 *port2adr(unsigned int port)
19{
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 maybebadio((unsigned long)port);
23 return (volatile __u16*)port;
24}
25
26/*
27 * General outline: remap really low stuff [eventually] to SuperIO,
28 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
29 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
30 * should be way beyond the window, and is used w/o translation for
31 * compatibility.
32 */
33unsigned char sh7751se_inb(unsigned long port)
34{
35 if (PXSEG(port))
36 return *(volatile unsigned char *)port;
37 else
38 return (*port2adr(port)) & 0xff;
39}
40
41unsigned char sh7751se_inb_p(unsigned long port)
42{
43 unsigned char v;
44
45 if (PXSEG(port))
46 v = *(volatile unsigned char *)port;
47 else
48 v = (*port2adr(port)) & 0xff;
49 ctrl_delay();
50 return v;
51}
52
53unsigned short sh7751se_inw(unsigned long port)
54{
55 if (PXSEG(port))
56 return *(volatile unsigned short *)port;
57 else if (port >= 0x2000)
58 return *port2adr(port);
59 else
60 maybebadio(port);
61 return 0;
62}
63
64unsigned int sh7751se_inl(unsigned long port)
65{
66 if (PXSEG(port))
67 return *(volatile unsigned long *)port;
68 else if (port >= 0x2000)
69 return *port2adr(port);
70 else
71 maybebadio(port);
72 return 0;
73}
74
75void sh7751se_outb(unsigned char value, unsigned long port)
76{
77
78 if (PXSEG(port))
79 *(volatile unsigned char *)port = value;
80 else
81 *(port2adr(port)) = value;
82}
83
84void sh7751se_outb_p(unsigned char value, unsigned long port)
85{
86 if (PXSEG(port))
87 *(volatile unsigned char *)port = value;
88 else
89 *(port2adr(port)) = value;
90 ctrl_delay();
91}
92
93void sh7751se_outw(unsigned short value, unsigned long port)
94{
95 if (PXSEG(port))
96 *(volatile unsigned short *)port = value;
97 else if (port >= 0x2000)
98 *port2adr(port) = value;
99 else
100 maybebadio(port);
101}
102
103void sh7751se_outl(unsigned int value, unsigned long port)
104{
105 if (PXSEG(port))
106 *(volatile unsigned long *)port = value;
107 else
108 maybebadio(port);
109}
110
111void sh7751se_insl(unsigned long port, void *addr, unsigned long count)
112{
113 maybebadio(port);
114}
115
116void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count)
117{
118 maybebadio(port);
119}
diff --git a/arch/sh/boards/mach-se/7751/setup.c b/arch/sh/boards/mach-se/7751/setup.c
index 50572512e3e8..4ed60c5e221f 100644
--- a/arch/sh/boards/mach-se/7751/setup.c
+++ b/arch/sh/boards/mach-se/7751/setup.c
@@ -48,7 +48,7 @@ static int __init se7751_devices_setup(void)
48{ 48{
49 return platform_add_devices(se7751_devices, ARRAY_SIZE(se7751_devices)); 49 return platform_add_devices(se7751_devices, ARRAY_SIZE(se7751_devices));
50} 50}
51__initcall(se7751_devices_setup); 51device_initcall(se7751_devices_setup);
52 52
53/* 53/*
54 * The Machine Vector 54 * The Machine Vector
@@ -56,23 +56,5 @@ __initcall(se7751_devices_setup);
56static struct sh_machine_vector mv_7751se __initmv = { 56static struct sh_machine_vector mv_7751se __initmv = {
57 .mv_name = "7751 SolutionEngine", 57 .mv_name = "7751 SolutionEngine",
58 .mv_nr_irqs = 72, 58 .mv_nr_irqs = 72,
59
60 .mv_inb = sh7751se_inb,
61 .mv_inw = sh7751se_inw,
62 .mv_inl = sh7751se_inl,
63 .mv_outb = sh7751se_outb,
64 .mv_outw = sh7751se_outw,
65 .mv_outl = sh7751se_outl,
66
67 .mv_inb_p = sh7751se_inb_p,
68 .mv_inw_p = sh7751se_inw,
69 .mv_inl_p = sh7751se_inl,
70 .mv_outb_p = sh7751se_outb_p,
71 .mv_outw_p = sh7751se_outw,
72 .mv_outl_p = sh7751se_outl,
73
74 .mv_insl = sh7751se_insl,
75 .mv_outsl = sh7751se_outsl,
76
77 .mv_init_irq = init_7751se_IRQ, 59 .mv_init_irq = init_7751se_IRQ,
78}; 60};
diff --git a/arch/sh/boards/mach-se/board-se7619.c b/arch/sh/boards/mach-se/board-se7619.c
index 1d0ef7faa10d..82b6d4a5dc02 100644
--- a/arch/sh/boards/mach-se/board-se7619.c
+++ b/arch/sh/boards/mach-se/board-se7619.c
@@ -11,6 +11,11 @@
11#include <asm/io.h> 11#include <asm/io.h>
12#include <asm/machvec.h> 12#include <asm/machvec.h>
13 13
14static int se7619_mode_pins(void)
15{
16 return MODE_PIN2 | MODE_PIN0;
17}
18
14/* 19/*
15 * The Machine Vector 20 * The Machine Vector
16 */ 21 */
@@ -18,4 +23,5 @@
18static struct sh_machine_vector mv_se __initmv = { 23static struct sh_machine_vector mv_se __initmv = {
19 .mv_name = "SolutionEngine", 24 .mv_name = "SolutionEngine",
20 .mv_nr_irqs = 108, 25 .mv_nr_irqs = 108,
26 .mv_mode_pins = se7619_mode_pins,
21}; 27};
diff --git a/arch/sh/boards/mach-sh03/rtc.c b/arch/sh/boards/mach-sh03/rtc.c
index 1b200990500c..f83ac7995d0f 100644
--- a/arch/sh/boards/mach-sh03/rtc.c
+++ b/arch/sh/boards/mach-sh03/rtc.c
@@ -108,7 +108,7 @@ static int set_rtc_mmss(unsigned long nowtime)
108 __raw_writeb(real_minutes % 10, RTC_MIN1); 108 __raw_writeb(real_minutes % 10, RTC_MIN1);
109 __raw_writeb(real_minutes / 10, RTC_MIN10); 109 __raw_writeb(real_minutes / 10, RTC_MIN10);
110 } else { 110 } else {
111 printk(KERN_WARNING 111 printk_once(KERN_NOTICE
112 "set_rtc_mmss: can't update from %d to %d\n", 112 "set_rtc_mmss: can't update from %d to %d\n",
113 cmos_minutes, real_minutes); 113 cmos_minutes, real_minutes);
114 retval = -1; 114 retval = -1;
diff --git a/arch/sh/boards/mach-sh03/setup.c b/arch/sh/boards/mach-sh03/setup.c
index af4a0c012a96..d4f79b2a6514 100644
--- a/arch/sh/boards/mach-sh03/setup.c
+++ b/arch/sh/boards/mach-sh03/setup.c
@@ -96,7 +96,7 @@ static int __init sh03_devices_setup(void)
96 96
97 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices)); 97 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
98} 98}
99__initcall(sh03_devices_setup); 99device_initcall(sh03_devices_setup);
100 100
101static struct sh_machine_vector mv_sh03 __initmv = { 101static struct sh_machine_vector mv_sh03 __initmv = {
102 .mv_name = "Interface (CTP/PCI-SH03)", 102 .mv_name = "Interface (CTP/PCI-SH03)",
diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c
index f64a6918224c..f3d828f133e5 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -75,6 +75,10 @@ static struct resource sh_eth_resources[] = {
75 .end = 0xFEE00F7C - 1, 75 .end = 0xFEE00F7C - 1,
76 .flags = IORESOURCE_MEM, 76 .flags = IORESOURCE_MEM,
77 }, { 77 }, {
78 .start = 0xFEE01800, /* TSU */
79 .end = 0xFEE01FFF,
80 .flags = IORESOURCE_MEM,
81 }, {
78 .start = 57, /* irq number */ 82 .start = 57, /* irq number */
79 .flags = IORESOURCE_IRQ, 83 .flags = IORESOURCE_IRQ,
80 }, 84 },
@@ -83,6 +87,8 @@ static struct resource sh_eth_resources[] = {
83static struct sh_eth_plat_data sh7763_eth_pdata = { 87static struct sh_eth_plat_data sh7763_eth_pdata = {
84 .phy = 1, 88 .phy = 1,
85 .edmac_endian = EDMAC_LITTLE_ENDIAN, 89 .edmac_endian = EDMAC_LITTLE_ENDIAN,
90 .register_type = SH_ETH_REG_GIGABIT,
91 .phy_interface = PHY_INTERFACE_MODE_MII,
86}; 92};
87 93
88static struct platform_device sh7763rdp_eth_device = { 94static struct platform_device sh7763rdp_eth_device = {
diff --git a/arch/sh/boards/mach-snapgear/Makefile b/arch/sh/boards/mach-snapgear/Makefile
deleted file mode 100644
index d2d2f4b6a502..000000000000
--- a/arch/sh/boards/mach-snapgear/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the SnapGear specific parts of the kernel
3#
4
5obj-y := setup.o io.o
diff --git a/arch/sh/boards/mach-snapgear/io.c b/arch/sh/boards/mach-snapgear/io.c
deleted file mode 100644
index 476650e42dbc..000000000000
--- a/arch/sh/boards/mach-snapgear/io.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
3 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
4 * Based largely on io_se.c.
5 *
6 * I/O routine for Hitachi 7751 SolutionEngine.
7 *
8 * Initial version only to support LAN access; some
9 * placeholder code from io_se.c left in with the
10 * expectation of later SuperIO and PCMCIA access.
11 */
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/pci.h>
15#include <asm/io.h>
16#include <asm/addrspace.h>
17
18#ifdef CONFIG_SH_SECUREEDGE5410
19unsigned short secureedge5410_ioport;
20#endif
21
22static inline volatile __u16 *port2adr(unsigned int port)
23{
24 maybebadio((unsigned long)port);
25 return (volatile __u16*)port;
26}
27
28/*
29 * General outline: remap really low stuff [eventually] to SuperIO,
30 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
31 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
32 * should be way beyond the window, and is used w/o translation for
33 * compatibility.
34 */
35unsigned char snapgear_inb(unsigned long port)
36{
37 if (PXSEG(port))
38 return *(volatile unsigned char *)port;
39 else
40 return (*port2adr(port)) & 0xff;
41}
42
43unsigned char snapgear_inb_p(unsigned long port)
44{
45 unsigned char v;
46
47 if (PXSEG(port))
48 v = *(volatile unsigned char *)port;
49 else
50 v = (*port2adr(port))&0xff;
51 ctrl_delay();
52 return v;
53}
54
55unsigned short snapgear_inw(unsigned long port)
56{
57 if (PXSEG(port))
58 return *(volatile unsigned short *)port;
59 else if (port >= 0x2000)
60 return *port2adr(port);
61 else
62 maybebadio(port);
63 return 0;
64}
65
66unsigned int snapgear_inl(unsigned long port)
67{
68 if (PXSEG(port))
69 return *(volatile unsigned long *)port;
70 else if (port >= 0x2000)
71 return *port2adr(port);
72 else
73 maybebadio(port);
74 return 0;
75}
76
77void snapgear_outb(unsigned char value, unsigned long port)
78{
79
80 if (PXSEG(port))
81 *(volatile unsigned char *)port = value;
82 else
83 *(port2adr(port)) = value;
84}
85
86void snapgear_outb_p(unsigned char value, unsigned long port)
87{
88 if (PXSEG(port))
89 *(volatile unsigned char *)port = value;
90 else
91 *(port2adr(port)) = value;
92 ctrl_delay();
93}
94
95void snapgear_outw(unsigned short value, unsigned long port)
96{
97 if (PXSEG(port))
98 *(volatile unsigned short *)port = value;
99 else if (port >= 0x2000)
100 *port2adr(port) = value;
101 else
102 maybebadio(port);
103}
104
105void snapgear_outl(unsigned int value, unsigned long port)
106{
107 if (PXSEG(port))
108 *(volatile unsigned long *)port = value;
109 else
110 maybebadio(port);
111}
112
113void snapgear_insl(unsigned long port, void *addr, unsigned long count)
114{
115 maybebadio(port);
116}
117
118void snapgear_outsl(unsigned long port, const void *addr, unsigned long count)
119{
120 maybebadio(port);
121}
diff --git a/arch/sh/boards/mach-systemh/Makefile b/arch/sh/boards/mach-systemh/Makefile
deleted file mode 100644
index 2cc6a23d9d39..000000000000
--- a/arch/sh/boards/mach-systemh/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
1#
2# Makefile for the SystemH specific parts of the kernel
3#
4
5obj-y := setup.o irq.o io.o
6
7# XXX: This wants to be consolidated in arch/sh/drivers/pci, and more
8# importantly, with the generic sh7751_pcic_init() code. For now, we'll
9# just abuse the hell out of kbuild, because we can..
10
11obj-$(CONFIG_PCI) += pci.o
12pci-y := ../../se/7751/pci.o
13
diff --git a/arch/sh/boards/mach-systemh/io.c b/arch/sh/boards/mach-systemh/io.c
deleted file mode 100644
index 15577ff1f715..000000000000
--- a/arch/sh/boards/mach-systemh/io.c
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * linux/arch/sh/boards/renesas/systemh/io.c
3 *
4 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
5 * Based largely on io_se.c.
6 *
7 * I/O routine for Hitachi 7751 Systemh.
8 */
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/pci.h>
12#include <mach/systemh7751.h>
13#include <asm/addrspace.h>
14#include <asm/io.h>
15
16#define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area
17 of smc lan chip*/
18static inline volatile __u16 *
19port2adr(unsigned int port)
20{
21 if (port >= 0x2000)
22 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
23 maybebadio((unsigned long)port);
24 return (volatile __u16*)port;
25}
26
27/*
28 * General outline: remap really low stuff [eventually] to SuperIO,
29 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
30 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
31 * should be way beyond the window, and is used w/o translation for
32 * compatibility.
33 */
34unsigned char sh7751systemh_inb(unsigned long port)
35{
36 if (PXSEG(port))
37 return *(volatile unsigned char *)port;
38 else if (port <= 0x3F1)
39 return *(volatile unsigned char *)ETHER_IOMAP(port);
40 else
41 return (*port2adr(port))&0xff;
42}
43
44unsigned char sh7751systemh_inb_p(unsigned long port)
45{
46 unsigned char v;
47
48 if (PXSEG(port))
49 v = *(volatile unsigned char *)port;
50 else if (port <= 0x3F1)
51 v = *(volatile unsigned char *)ETHER_IOMAP(port);
52 else
53 v = (*port2adr(port))&0xff;
54 ctrl_delay();
55 return v;
56}
57
58unsigned short sh7751systemh_inw(unsigned long port)
59{
60 if (PXSEG(port))
61 return *(volatile unsigned short *)port;
62 else if (port >= 0x2000)
63 return *port2adr(port);
64 else if (port <= 0x3F1)
65 return *(volatile unsigned int *)ETHER_IOMAP(port);
66 else
67 maybebadio(port);
68 return 0;
69}
70
71unsigned int sh7751systemh_inl(unsigned long port)
72{
73 if (PXSEG(port))
74 return *(volatile unsigned long *)port;
75 else if (port >= 0x2000)
76 return *port2adr(port);
77 else if (port <= 0x3F1)
78 return *(volatile unsigned int *)ETHER_IOMAP(port);
79 else
80 maybebadio(port);
81 return 0;
82}
83
84void sh7751systemh_outb(unsigned char value, unsigned long port)
85{
86
87 if (PXSEG(port))
88 *(volatile unsigned char *)port = value;
89 else if (port <= 0x3F1)
90 *(volatile unsigned char *)ETHER_IOMAP(port) = value;
91 else
92 *(port2adr(port)) = value;
93}
94
95void sh7751systemh_outb_p(unsigned char value, unsigned long port)
96{
97 if (PXSEG(port))
98 *(volatile unsigned char *)port = value;
99 else if (port <= 0x3F1)
100 *(volatile unsigned char *)ETHER_IOMAP(port) = value;
101 else
102 *(port2adr(port)) = value;
103 ctrl_delay();
104}
105
106void sh7751systemh_outw(unsigned short value, unsigned long port)
107{
108 if (PXSEG(port))
109 *(volatile unsigned short *)port = value;
110 else if (port >= 0x2000)
111 *port2adr(port) = value;
112 else if (port <= 0x3F1)
113 *(volatile unsigned short *)ETHER_IOMAP(port) = value;
114 else
115 maybebadio(port);
116}
117
118void sh7751systemh_outl(unsigned int value, unsigned long port)
119{
120 if (PXSEG(port))
121 *(volatile unsigned long *)port = value;
122 else
123 maybebadio(port);
124}
125
126void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count)
127{
128 unsigned char *p = addr;
129 while (count--) *p++ = sh7751systemh_inb(port);
130}
131
132void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count)
133{
134 unsigned short *p = addr;
135 while (count--) *p++ = sh7751systemh_inw(port);
136}
137
138void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count)
139{
140 maybebadio(port);
141}
142
143void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count)
144{
145 unsigned char *p = (unsigned char*)addr;
146 while (count--) sh7751systemh_outb(*p++, port);
147}
148
149void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long count)
150{
151 unsigned short *p = (unsigned short*)addr;
152 while (count--) sh7751systemh_outw(*p++, port);
153}
154
155void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count)
156{
157 maybebadio(port);
158}
diff --git a/arch/sh/boards/mach-systemh/irq.c b/arch/sh/boards/mach-systemh/irq.c
deleted file mode 100644
index 523aea5dc94e..000000000000
--- a/arch/sh/boards/mach-systemh/irq.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * linux/arch/sh/boards/renesas/systemh/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SystemH Support.
7 *
8 * Modified for 7751 SystemH by
9 * Jonathan Short.
10 */
11
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <linux/io.h>
16
17#include <mach/systemh7751.h>
18#include <asm/smc37c93x.h>
19
20/* address of external interrupt mask register
21 * address must be set prior to use these (maybe in init_XXX_irq())
22 * XXX : is it better to use .config than specifying it in code? */
23static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004;
24static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000;
25
26/* forward declaration */
27static void enable_systemh_irq(unsigned int irq);
28static void disable_systemh_irq(unsigned int irq);
29static void mask_and_ack_systemh(unsigned int);
30
31static struct irq_chip systemh_irq_type = {
32 .name = " SystemH Register",
33 .unmask = enable_systemh_irq,
34 .mask = disable_systemh_irq,
35 .ack = mask_and_ack_systemh,
36};
37
38static void disable_systemh_irq(unsigned int irq)
39{
40 if (systemh_irq_mask_register) {
41 unsigned long val, mask = 0x01 << 1;
42
43 /* Clear the "irq"th bit in the mask and set it in the request */
44 val = __raw_readl((unsigned long)systemh_irq_mask_register);
45 val &= ~mask;
46 __raw_writel(val, (unsigned long)systemh_irq_mask_register);
47
48 val = __raw_readl((unsigned long)systemh_irq_request_register);
49 val |= mask;
50 __raw_writel(val, (unsigned long)systemh_irq_request_register);
51 }
52}
53
54static void enable_systemh_irq(unsigned int irq)
55{
56 if (systemh_irq_mask_register) {
57 unsigned long val, mask = 0x01 << 1;
58
59 /* Set "irq"th bit in the mask register */
60 val = __raw_readl((unsigned long)systemh_irq_mask_register);
61 val |= mask;
62 __raw_writel(val, (unsigned long)systemh_irq_mask_register);
63 }
64}
65
66static void mask_and_ack_systemh(unsigned int irq)
67{
68 disable_systemh_irq(irq);
69}
70
71void make_systemh_irq(unsigned int irq)
72{
73 disable_irq_nosync(irq);
74 set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq);
75 disable_systemh_irq(irq);
76}
diff --git a/arch/sh/boards/mach-systemh/setup.c b/arch/sh/boards/mach-systemh/setup.c
deleted file mode 100644
index 219fd800a43f..000000000000
--- a/arch/sh/boards/mach-systemh/setup.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/arch/sh/boards/renesas/systemh/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * Hitachi SystemH Support.
8 *
9 * Modified for 7751 SystemH by Jonathan Short.
10 *
11 * Rewritten for 2.6 by Paul Mundt.
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#include <linux/init.h>
18#include <asm/machvec.h>
19#include <mach/systemh7751.h>
20
21extern void make_systemh_irq(unsigned int irq);
22
23/*
24 * Initialize IRQ setting
25 */
26static void __init sh7751systemh_init_irq(void)
27{
28 make_systemh_irq(0xb); /* Ethernet interrupt */
29}
30
31static struct sh_machine_vector mv_7751systemh __initmv = {
32 .mv_name = "7751 SystemH",
33 .mv_nr_irqs = 72,
34
35 .mv_inb = sh7751systemh_inb,
36 .mv_inw = sh7751systemh_inw,
37 .mv_inl = sh7751systemh_inl,
38 .mv_outb = sh7751systemh_outb,
39 .mv_outw = sh7751systemh_outw,
40 .mv_outl = sh7751systemh_outl,
41
42 .mv_inb_p = sh7751systemh_inb_p,
43 .mv_inw_p = sh7751systemh_inw,
44 .mv_inl_p = sh7751systemh_inl,
45 .mv_outb_p = sh7751systemh_outb_p,
46 .mv_outw_p = sh7751systemh_outw,
47 .mv_outl_p = sh7751systemh_outl,
48
49 .mv_insb = sh7751systemh_insb,
50 .mv_insw = sh7751systemh_insw,
51 .mv_insl = sh7751systemh_insl,
52 .mv_outsb = sh7751systemh_outsb,
53 .mv_outsw = sh7751systemh_outsw,
54 .mv_outsl = sh7751systemh_outsl,
55
56 .mv_init_irq = sh7751systemh_init_irq,
57};
diff --git a/arch/sh/boards/mach-x3proto/Makefile b/arch/sh/boards/mach-x3proto/Makefile
index 983e4551fecf..708c21c919ff 100644
--- a/arch/sh/boards/mach-x3proto/Makefile
+++ b/arch/sh/boards/mach-x3proto/Makefile
@@ -1 +1,3 @@
1obj-y += setup.o ilsel.o 1obj-y += setup.o ilsel.o
2
3obj-$(CONFIG_GENERIC_GPIO) += gpio.o
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
new file mode 100644
index 000000000000..f33b2b57019c
--- /dev/null
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -0,0 +1,136 @@
1/*
2 * arch/sh/boards/mach-x3proto/gpio.c
3 *
4 * Renesas SH-X3 Prototype Baseboard GPIO Support.
5 *
6 * Copyright (C) 2010 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/gpio.h>
17#include <linux/irq.h>
18#include <linux/kernel.h>
19#include <linux/spinlock.h>
20#include <linux/io.h>
21#include <mach/ilsel.h>
22#include <mach/hardware.h>
23
24#define KEYCTLR 0xb81c0000
25#define KEYOUTR 0xb81c0002
26#define KEYDETR 0xb81c0004
27
28static DEFINE_SPINLOCK(x3proto_gpio_lock);
29static unsigned int x3proto_gpio_irq_map[NR_BASEBOARD_GPIOS] = { 0, };
30
31static int x3proto_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
32{
33 unsigned long flags;
34 unsigned int data;
35
36 spin_lock_irqsave(&x3proto_gpio_lock, flags);
37 data = __raw_readw(KEYCTLR);
38 data |= (1 << gpio);
39 __raw_writew(data, KEYCTLR);
40 spin_unlock_irqrestore(&x3proto_gpio_lock, flags);
41
42 return 0;
43}
44
45static int x3proto_gpio_get(struct gpio_chip *chip, unsigned gpio)
46{
47 return !!(__raw_readw(KEYDETR) & (1 << gpio));
48}
49
50static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
51{
52 return x3proto_gpio_irq_map[gpio];
53}
54
55static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
56{
57 struct irq_data *data = irq_get_irq_data(irq);
58 struct irq_chip *chip = irq_data_get_irq_chip(data);
59 unsigned long mask;
60 int pin;
61
62 chip->irq_mask_ack(data);
63
64 mask = __raw_readw(KEYDETR);
65
66 for_each_set_bit(pin, &mask, NR_BASEBOARD_GPIOS)
67 generic_handle_irq(x3proto_gpio_to_irq(NULL, pin));
68
69 chip->irq_unmask(data);
70}
71
72struct gpio_chip x3proto_gpio_chip = {
73 .label = "x3proto-gpio",
74 .direction_input = x3proto_gpio_direction_input,
75 .get = x3proto_gpio_get,
76 .to_irq = x3proto_gpio_to_irq,
77 .base = -1,
78 .ngpio = NR_BASEBOARD_GPIOS,
79};
80
81int __init x3proto_gpio_setup(void)
82{
83 int ilsel;
84 int ret, i;
85
86 ilsel = ilsel_enable(ILSEL_KEY);
87 if (unlikely(ilsel < 0))
88 return ilsel;
89
90 ret = gpiochip_add(&x3proto_gpio_chip);
91 if (unlikely(ret))
92 goto err_gpio;
93
94 for (i = 0; i < NR_BASEBOARD_GPIOS; i++) {
95 unsigned long flags;
96 int irq = create_irq();
97
98 if (unlikely(irq < 0)) {
99 ret = -EINVAL;
100 goto err_irq;
101 }
102
103 spin_lock_irqsave(&x3proto_gpio_lock, flags);
104 x3proto_gpio_irq_map[i] = irq;
105 irq_set_chip_and_handler_name(irq, &dummy_irq_chip,
106 handle_simple_irq, "gpio");
107 spin_unlock_irqrestore(&x3proto_gpio_lock, flags);
108 }
109
110 pr_info("registering '%s' support, handling GPIOs %u -> %u, "
111 "bound to IRQ %u\n",
112 x3proto_gpio_chip.label, x3proto_gpio_chip.base,
113 x3proto_gpio_chip.base + x3proto_gpio_chip.ngpio,
114 ilsel);
115
116 irq_set_chained_handler(ilsel, x3proto_gpio_irq_handler);
117 irq_set_irq_wake(ilsel, 1);
118
119 return 0;
120
121err_irq:
122 for (; i >= 0; --i)
123 if (x3proto_gpio_irq_map[i])
124 destroy_irq(x3proto_gpio_irq_map[i]);
125
126 ret = gpiochip_remove(&x3proto_gpio_chip);
127 if (unlikely(ret))
128 pr_err("Failed deregistering GPIO\n");
129
130err_gpio:
131 synchronize_irq(ilsel);
132
133 ilsel_disable(ILSEL_KEY);
134
135 return ret;
136}
diff --git a/arch/sh/boards/mach-x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
index 5c9842704c60..95e346139515 100644
--- a/arch/sh/boards/mach-x3proto/ilsel.c
+++ b/arch/sh/boards/mach-x3proto/ilsel.c
@@ -1,20 +1,22 @@
1/* 1/*
2 * arch/sh/boards/renesas/x3proto/ilsel.c 2 * arch/sh/boards/mach-x3proto/ilsel.c
3 * 3 *
4 * Helper routines for SH-X3 proto board ILSEL. 4 * Helper routines for SH-X3 proto board ILSEL.
5 * 5 *
6 * Copyright (C) 2007 Paul Mundt 6 * Copyright (C) 2007 - 2010 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 10 * for more details.
11 */ 11 */
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/bitmap.h> 17#include <linux/bitmap.h>
16#include <linux/io.h> 18#include <linux/io.h>
17#include <asm/ilsel.h> 19#include <mach/ilsel.h>
18 20
19/* 21/*
20 * ILSEL is split across: 22 * ILSEL is split across:
@@ -64,6 +66,8 @@ static void __ilsel_enable(ilsel_source_t set, unsigned int bit)
64 unsigned int tmp, shift; 66 unsigned int tmp, shift;
65 unsigned long addr; 67 unsigned long addr;
66 68
69 pr_notice("enabling ILSEL set %d\n", set);
70
67 addr = mk_ilsel_addr(bit); 71 addr = mk_ilsel_addr(bit);
68 shift = mk_ilsel_shift(bit); 72 shift = mk_ilsel_shift(bit);
69 73
@@ -92,8 +96,10 @@ int ilsel_enable(ilsel_source_t set)
92{ 96{
93 unsigned int bit; 97 unsigned int bit;
94 98
95 /* Aliased sources must use ilsel_enable_fixed() */ 99 if (unlikely(set > ILSEL_KEY)) {
96 BUG_ON(set > ILSEL_KEY); 100 pr_err("Aliased sources must use ilsel_enable_fixed()\n");
101 return -EINVAL;
102 }
97 103
98 do { 104 do {
99 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS); 105 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
@@ -140,6 +146,8 @@ void ilsel_disable(unsigned int irq)
140 unsigned long addr; 146 unsigned long addr;
141 unsigned int tmp; 147 unsigned int tmp;
142 148
149 pr_notice("disabling ILSEL set %d\n", irq);
150
143 addr = mk_ilsel_addr(irq); 151 addr = mk_ilsel_addr(irq);
144 152
145 tmp = __raw_readw(addr); 153 tmp = __raw_readw(addr);
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index 102bf56befb4..d682e2b6a856 100644
--- a/arch/sh/boards/mach-x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * arch/sh/boards/renesas/x3proto/setup.c 2 * arch/sh/boards/mach-x3proto/setup.c
3 * 3 *
4 * Renesas SH-X3 Prototype Board Support. 4 * Renesas SH-X3 Prototype Board Support.
5 * 5 *
6 * Copyright (C) 2007 - 2008 Paul Mundt 6 * Copyright (C) 2007 - 2010 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -16,9 +16,13 @@
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/input.h>
19#include <linux/usb/r8a66597.h> 20#include <linux/usb/r8a66597.h>
20#include <linux/usb/m66592.h> 21#include <linux/usb/m66592.h>
21#include <asm/ilsel.h> 22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
24#include <mach/ilsel.h>
25#include <mach/hardware.h>
22#include <asm/smp-ops.h> 26#include <asm/smp-ops.h>
23 27
24static struct resource heartbeat_resources[] = { 28static struct resource heartbeat_resources[] = {
@@ -122,15 +126,128 @@ static struct platform_device m66592_usb_peripheral_device = {
122 .resource = m66592_usb_peripheral_resources, 126 .resource = m66592_usb_peripheral_resources,
123}; 127};
124 128
129static struct gpio_keys_button baseboard_buttons[NR_BASEBOARD_GPIOS] = {
130 {
131 .desc = "key44",
132 .code = KEY_POWER,
133 .active_low = 1,
134 .wakeup = 1,
135 }, {
136 .desc = "key43",
137 .code = KEY_SUSPEND,
138 .active_low = 1,
139 .wakeup = 1,
140 }, {
141 .desc = "key42",
142 .code = KEY_KATAKANAHIRAGANA,
143 .active_low = 1,
144 }, {
145 .desc = "key41",
146 .code = KEY_SWITCHVIDEOMODE,
147 .active_low = 1,
148 }, {
149 .desc = "key34",
150 .code = KEY_F12,
151 .active_low = 1,
152 }, {
153 .desc = "key33",
154 .code = KEY_F11,
155 .active_low = 1,
156 }, {
157 .desc = "key32",
158 .code = KEY_F10,
159 .active_low = 1,
160 }, {
161 .desc = "key31",
162 .code = KEY_F9,
163 .active_low = 1,
164 }, {
165 .desc = "key24",
166 .code = KEY_F8,
167 .active_low = 1,
168 }, {
169 .desc = "key23",
170 .code = KEY_F7,
171 .active_low = 1,
172 }, {
173 .desc = "key22",
174 .code = KEY_F6,
175 .active_low = 1,
176 }, {
177 .desc = "key21",
178 .code = KEY_F5,
179 .active_low = 1,
180 }, {
181 .desc = "key14",
182 .code = KEY_F4,
183 .active_low = 1,
184 }, {
185 .desc = "key13",
186 .code = KEY_F3,
187 .active_low = 1,
188 }, {
189 .desc = "key12",
190 .code = KEY_F2,
191 .active_low = 1,
192 }, {
193 .desc = "key11",
194 .code = KEY_F1,
195 .active_low = 1,
196 },
197};
198
199static struct gpio_keys_platform_data baseboard_buttons_data = {
200 .buttons = baseboard_buttons,
201 .nbuttons = ARRAY_SIZE(baseboard_buttons),
202};
203
204static struct platform_device baseboard_buttons_device = {
205 .name = "gpio-keys",
206 .id = -1,
207 .dev = {
208 .platform_data = &baseboard_buttons_data,
209 },
210};
211
125static struct platform_device *x3proto_devices[] __initdata = { 212static struct platform_device *x3proto_devices[] __initdata = {
126 &heartbeat_device, 213 &heartbeat_device,
127 &smc91x_device, 214 &smc91x_device,
128 &r8a66597_usb_host_device, 215 &r8a66597_usb_host_device,
129 &m66592_usb_peripheral_device, 216 &m66592_usb_peripheral_device,
217 &baseboard_buttons_device,
130}; 218};
131 219
220static void __init x3proto_init_irq(void)
221{
222 plat_irq_setup_pins(IRQ_MODE_IRL3210);
223
224 /* Set ICR0.LVLMODE */
225 __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
226}
227
132static int __init x3proto_devices_setup(void) 228static int __init x3proto_devices_setup(void)
133{ 229{
230 int ret, i;
231
232 /*
233 * IRLs are only needed for ILSEL mappings, so flip over the INTC
234 * pins at a later point to enable the GPIOs to settle.
235 */
236 x3proto_init_irq();
237
238 /*
239 * Now that ILSELs are available, set up the baseboard GPIOs.
240 */
241 ret = x3proto_gpio_setup();
242 if (unlikely(ret))
243 return ret;
244
245 /*
246 * Propagate dynamic GPIOs for the baseboard button device.
247 */
248 for (i = 0; i < ARRAY_SIZE(baseboard_buttons); i++)
249 baseboard_buttons[i].gpio = x3proto_gpio_chip.base + i;
250
134 r8a66597_usb_host_resources[1].start = 251 r8a66597_usb_host_resources[1].start =
135 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); 252 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
136 253
@@ -145,14 +262,6 @@ static int __init x3proto_devices_setup(void)
145} 262}
146device_initcall(x3proto_devices_setup); 263device_initcall(x3proto_devices_setup);
147 264
148static void __init x3proto_init_irq(void)
149{
150 plat_irq_setup_pins(IRQ_MODE_IRL3210);
151
152 /* Set ICR0.LVLMODE */
153 __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
154}
155
156static void __init x3proto_setup(char **cmdline_p) 265static void __init x3proto_setup(char **cmdline_p)
157{ 266{
158 register_smp_ops(&shx3_smp_ops); 267 register_smp_ops(&shx3_smp_ops);
@@ -161,5 +270,4 @@ static void __init x3proto_setup(char **cmdline_p)
161static struct sh_machine_vector mv_x3proto __initmv = { 270static struct sh_machine_vector mv_x3proto __initmv = {
162 .mv_name = "x3proto", 271 .mv_name = "x3proto",
163 .mv_setup = x3proto_setup, 272 .mv_setup = x3proto_setup,
164 .mv_init_irq = x3proto_init_irq,
165}; 273};