aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 16:32:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 16:32:53 -0400
commitf6a26ae7699416d86bea8cb68ce413571e9cab3c (patch)
treee91b7a7c7513151fe583721f7435cc9f5cdc4f42 /arch/arm/mach-shmobile
parentcdd3a354a05b0c33fe33ab11a0fb0838396cad19 (diff)
parent48a5765e5104f1afd22c75c5030af3a6cf24b4c3 (diff)
Merge tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm-soc board specific changes from Olof Johansson: "While we generally attempt to get rid of board specific files and replace them with device tree based descriptions, a lot of platforms have not come that far: In shmobile, we add two new board files because their recently started effort to add DT support has not proceeded enough to use it for all of the important hardware. In Kirkwood, we are adding support for new boards with a combination of DT and board file contents in multiple cases. pxa/mmp and imx are extending support for existing board files but not adding new ones." Fix up trivial conflicts in arch/arm/mach-{mmp/ttc_dkb.c,shmobile/{Kconfig,Makefile}} * tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (94 commits) ARM: shmobile: fix smp build ARM: kirkwood: Add support for RaidSonic IB-NAS6210/6220 using devicetree kirkwood: Add iconnect support orion/kirkwood: create a generic function for gpio led blinking kirkwood/orion: fix orion_gpio_set_blink ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt kirkwood: Allow nand to be configured via. devicetree mtd: Add orion_nand devicetree bindings ARM: kirkwood: Basic support for DNS-320 and DNS-325 ARM: mach-shmobile: Use DT_MACHINE for armadillo 800 eva ARM: mach-shmobile: Use DT_MACHINE for KZM9G ARM: pxa: hx4700: Add Synaptics NavPoint touchpad ARM: pxa: Use REGULATOR_SUPPLY macro ARM: mach-shmobile: kzm9g: enable SMP boot ARM: mach-shmobile: kzm9g: defconfig update ARM: mach-shmobile: kzm9g: add PCF8757 gpio-key ARM: mach-shmobile: kzm9g: add SDHI support ARM: mach-shmobile: kzm9g: add MMCIF support ARM: mach-shmobile: kzm9g: correct screen direction ARM: mach-shmobile: sh73a0.h: add GPIO_NR ...
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/Kconfig18
-rw-r--r--arch/arm/mach-shmobile/Makefile2
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c2
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c784
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c2
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c460
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c10
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c3
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h3
-rw-r--r--arch/arm/mach-shmobile/pfc-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/platsmp.c3
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c7
12 files changed, 1290 insertions, 8 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 7dcf08ee979d..98327b7a503c 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -99,6 +99,12 @@ config MACH_BONITO
99 select ARCH_REQUIRE_GPIOLIB 99 select ARCH_REQUIRE_GPIOLIB
100 depends on ARCH_R8A7740 100 depends on ARCH_R8A7740
101 101
102config MACH_ARMADILLO800EVA
103 bool "Armadillo-800 EVA board"
104 depends on ARCH_R8A7740
105 select ARCH_REQUIRE_GPIOLIB
106 select USE_OF
107
102config MACH_MARZEN 108config MACH_MARZEN
103 bool "MARZEN board" 109 bool "MARZEN board"
104 depends on ARCH_R8A7779 110 depends on ARCH_R8A7779
@@ -109,6 +115,12 @@ config MACH_KZM9D
109 depends on ARCH_EMEV2 115 depends on ARCH_EMEV2
110 select USE_OF 116 select USE_OF
111 117
118config MACH_KZM9G
119 bool "KZM-A9-GT board"
120 depends on ARCH_SH73A0
121 select ARCH_REQUIRE_GPIOLIB
122 select USE_OF
123
112comment "SH-Mobile System Configuration" 124comment "SH-Mobile System Configuration"
113 125
114config CPU_HAS_INTEVT 126config CPU_HAS_INTEVT
@@ -121,7 +133,8 @@ config MEMORY_START
121 hex "Physical memory start address" 133 hex "Physical memory start address"
122 default "0x50000000" if MACH_G3EVM 134 default "0x50000000" if MACH_G3EVM
123 default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \ 135 default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \
124 MACH_MACKEREL || MACH_BONITO 136 MACH_MACKEREL || MACH_BONITO || \
137 MACH_ARMADILLO800EVA
125 default "0x41000000" if MACH_KOTA2 138 default "0x41000000" if MACH_KOTA2
126 default "0x00000000" 139 default "0x00000000"
127 ---help--- 140 ---help---
@@ -133,7 +146,8 @@ config MEMORY_SIZE
133 hex "Physical memory size" 146 hex "Physical memory size"
134 default "0x08000000" if MACH_G3EVM 147 default "0x08000000" if MACH_G3EVM
135 default "0x08000000" if MACH_G4EVM 148 default "0x08000000" if MACH_G4EVM
136 default "0x20000000" if MACH_AG5EVM || MACH_BONITO 149 default "0x20000000" if MACH_AG5EVM || MACH_BONITO || \
150 MACH_ARMADILLO800EVA
137 default "0x1e000000" if MACH_KOTA2 151 default "0x1e000000" if MACH_KOTA2
138 default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL 152 default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL
139 default "0x04000000" 153 default "0x04000000"
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index c795335931c9..e6b177bc9410 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -51,7 +51,9 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
51obj-$(CONFIG_MACH_KOTA2) += board-kota2.o 51obj-$(CONFIG_MACH_KOTA2) += board-kota2.o
52obj-$(CONFIG_MACH_BONITO) += board-bonito.o 52obj-$(CONFIG_MACH_BONITO) += board-bonito.o
53obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 53obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
54obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
54obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 55obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
56obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
55 57
56# Framework support 58# Framework support
57obj-$(CONFIG_SMP) += $(smp-y) 59obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index b56dde2732bb..0c3caeba2f3e 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -997,6 +997,8 @@ static struct sh_mobile_ceu_companion csi2 = {
997 997
998static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 998static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
999 .flags = SH_CEU_FLAG_USE_8BIT_BUS, 999 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
1000 .max_width = 8188,
1001 .max_height = 8188,
1000 .csi2 = &csi2, 1002 .csi2 = &csi2,
1001}; 1003};
1002 1004
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
new file mode 100644
index 000000000000..9e37026ef9dd
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -0,0 +1,784 @@
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/delay.h>
24#include <linux/err.h>
25#include <linux/kernel.h>
26#include <linux/input.h>
27#include <linux/irq.h>
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/sh_eth.h>
32#include <linux/videodev2.h>
33#include <linux/usb/renesas_usbhs.h>
34#include <linux/mfd/tmio.h>
35#include <linux/mmc/host.h>
36#include <linux/mmc/sh_mmcif.h>
37#include <linux/mmc/sh_mobile_sdhi.h>
38#include <mach/common.h>
39#include <mach/irqs.h>
40#include <asm/page.h>
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <asm/mach/map.h>
44#include <asm/mach/time.h>
45#include <asm/hardware/cache-l2x0.h>
46#include <mach/r8a7740.h>
47#include <video/sh_mobile_lcdc.h>
48
49/*
50 * CON1 Camera Module
51 * CON2 Extension Bus
52 * CON3 HDMI Output
53 * CON4 Composite Video Output
54 * CON5 H-UDI JTAG
55 * CON6 ARM JTAG
56 * CON7 SD1
57 * CON8 SD2
58 * CON9 RTC BackUp
59 * CON10 Monaural Mic Input
60 * CON11 Stereo Headphone Output
61 * CON12 Audio Line Output(L)
62 * CON13 Audio Line Output(R)
63 * CON14 AWL13 Module
64 * CON15 Extension
65 * CON16 LCD1
66 * CON17 LCD2
67 * CON19 Power Input
68 * CON20 USB1
69 * CON21 USB2
70 * CON22 Serial
71 * CON23 LAN
72 * CON24 USB3
73 * LED1 Camera LED(Yellow)
74 * LED2 Power LED (Green)
75 * ED3-LED6 User LED(Yellow)
76 * LED7 LAN link LED(Green)
77 * LED8 LAN activity LED(Yellow)
78 */
79
80/*
81 * DipSwitch
82 *
83 * SW1
84 *
85 * -12345678-+---------------+----------------------------
86 * 1 | boot | hermit
87 * 0 | boot | OS auto boot
88 * -12345678-+---------------+----------------------------
89 * 00 | boot device | eMMC
90 * 10 | boot device | SDHI0 (CON7)
91 * 01 | boot device | -
92 * 11 | boot device | Extension Buss (CS0)
93 * -12345678-+---------------+----------------------------
94 * 0 | Extension Bus | D8-D15 disable, eMMC enable
95 * 1 | Extension Bus | D8-D15 enable, eMMC disable
96 * -12345678-+---------------+----------------------------
97 * 0 | SDHI1 | COM8 disable, COM14 enable
98 * 1 | SDHI1 | COM8 enable, COM14 disable
99 * -12345678-+---------------+----------------------------
100 * 0 | USB0 | COM20 enable, COM24 disable
101 * 1 | USB0 | COM20 disable, COM24 enable
102 * -12345678-+---------------+----------------------------
103 * 00 | JTAG | SH-X2
104 * 10 | JTAG | ARM
105 * 01 | JTAG | -
106 * 11 | JTAG | Boundary Scan
107 *-----------+---------------+----------------------------
108 */
109
110/*
111 * USB function
112 *
113 * When you use USB Function,
114 * set SW1.6 ON, and connect cable to CN24.
115 *
116 * USBF needs workaround on R8A7740 chip.
117 * These are a little bit complex.
118 * see
119 * usbhsf_power_ctrl()
120 *
121 * CAUTION
122 *
123 * It uses autonomy mode for USB hotplug at this point
124 * (= usbhs_private.platform_callback.get_vbus is NULL),
125 * since we don't know what's happen on PM control
126 * on this workaround.
127 */
128#define USBCR1 0xe605810a
129#define USBH 0xC6700000
130#define USBH_USBCTR 0x10834
131
132struct usbhsf_private {
133 struct clk *phy;
134 struct clk *usb24;
135 struct clk *pci;
136 struct clk *func;
137 struct clk *host;
138 void __iomem *usbh_base;
139 struct renesas_usbhs_platform_info info;
140};
141
142#define usbhsf_get_priv(pdev) \
143 container_of(renesas_usbhs_get_info(pdev), \
144 struct usbhsf_private, info)
145
146static int usbhsf_get_id(struct platform_device *pdev)
147{
148 return USBHS_GADGET;
149}
150
151static void usbhsf_power_ctrl(struct platform_device *pdev,
152 void __iomem *base, int enable)
153{
154 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
155
156 /*
157 * Work around for USB Function.
158 * It needs USB host clock, and settings
159 */
160 if (enable) {
161 /*
162 * enable all the related usb clocks
163 * for usb workaround
164 */
165 clk_enable(priv->usb24);
166 clk_enable(priv->pci);
167 clk_enable(priv->host);
168 clk_enable(priv->func);
169 clk_enable(priv->phy);
170
171 /*
172 * set USBCR1
173 *
174 * Port1 is driven by USB function,
175 * Port2 is driven by USB HOST
176 * One HOST (Port1 or Port2 is HOST)
177 * USB PLL input clock = 24MHz
178 */
179 __raw_writew(0xd750, USBCR1);
180 mdelay(1);
181
182 /*
183 * start USB Host
184 */
185 __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
186 __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
187 mdelay(10);
188
189 /*
190 * USB PHY Power ON
191 */
192 __raw_writew(0xd770, USBCR1);
193 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
194
195 } else {
196 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
197 __raw_writew(0xd7c0, USBCR1); /* GPIO */
198
199 clk_disable(priv->phy);
200 clk_disable(priv->func); /* usb work around */
201 clk_disable(priv->host); /* usb work around */
202 clk_disable(priv->pci); /* usb work around */
203 clk_disable(priv->usb24); /* usb work around */
204 }
205}
206
207static void usbhsf_hardware_exit(struct platform_device *pdev)
208{
209 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
210
211 if (!IS_ERR(priv->phy))
212 clk_put(priv->phy);
213 if (!IS_ERR(priv->usb24))
214 clk_put(priv->usb24);
215 if (!IS_ERR(priv->pci))
216 clk_put(priv->pci);
217 if (!IS_ERR(priv->host))
218 clk_put(priv->host);
219 if (!IS_ERR(priv->func))
220 clk_put(priv->func);
221 if (priv->usbh_base)
222 iounmap(priv->usbh_base);
223
224 priv->phy = NULL;
225 priv->usb24 = NULL;
226 priv->pci = NULL;
227 priv->host = NULL;
228 priv->func = NULL;
229 priv->usbh_base = NULL;
230}
231
232static int usbhsf_hardware_init(struct platform_device *pdev)
233{
234 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
235
236 priv->phy = clk_get(&pdev->dev, "phy");
237 priv->usb24 = clk_get(&pdev->dev, "usb24");
238 priv->pci = clk_get(&pdev->dev, "pci");
239 priv->func = clk_get(&pdev->dev, "func");
240 priv->host = clk_get(&pdev->dev, "host");
241 priv->usbh_base = ioremap_nocache(USBH, 0x20000);
242
243 if (IS_ERR(priv->phy) ||
244 IS_ERR(priv->usb24) ||
245 IS_ERR(priv->pci) ||
246 IS_ERR(priv->host) ||
247 IS_ERR(priv->func) ||
248 !priv->usbh_base) {
249 dev_err(&pdev->dev, "USB clock setting failed\n");
250 usbhsf_hardware_exit(pdev);
251 return -EIO;
252 }
253
254 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
255 clk_set_rate(priv->usb24,
256 clk_get_rate(clk_get_parent(priv->usb24)));
257
258 return 0;
259}
260
261static struct usbhsf_private usbhsf_private = {
262 .info = {
263 .platform_callback = {
264 .get_id = usbhsf_get_id,
265 .hardware_init = usbhsf_hardware_init,
266 .hardware_exit = usbhsf_hardware_exit,
267 .power_ctrl = usbhsf_power_ctrl,
268 },
269 .driver_param = {
270 .buswait_bwait = 5,
271 .detection_delay = 5,
272 },
273 }
274};
275
276static struct resource usbhsf_resources[] = {
277 {
278 .name = "USBHS",
279 .start = 0xe6890000,
280 .end = 0xe6890104 - 1,
281 .flags = IORESOURCE_MEM,
282 },
283 {
284 .start = evt2irq(0x0A20),
285 .flags = IORESOURCE_IRQ,
286 },
287};
288
289static struct platform_device usbhsf_device = {
290 .name = "renesas_usbhs",
291 .dev = {
292 .platform_data = &usbhsf_private.info,
293 },
294 .id = -1,
295 .num_resources = ARRAY_SIZE(usbhsf_resources),
296 .resource = usbhsf_resources,
297};
298
299/* Ether */
300static struct sh_eth_plat_data sh_eth_platdata = {
301 .phy = 0x00, /* LAN8710A */
302 .edmac_endian = EDMAC_LITTLE_ENDIAN,
303 .register_type = SH_ETH_REG_GIGABIT,
304 .phy_interface = PHY_INTERFACE_MODE_MII,
305};
306
307static struct resource sh_eth_resources[] = {
308 {
309 .start = 0xe9a00000,
310 .end = 0xe9a00800 - 1,
311 .flags = IORESOURCE_MEM,
312 }, {
313 .start = 0xe9a01800,
314 .end = 0xe9a02000 - 1,
315 .flags = IORESOURCE_MEM,
316 }, {
317 .start = evt2irq(0x0500),
318 .flags = IORESOURCE_IRQ,
319 },
320};
321
322static struct platform_device sh_eth_device = {
323 .name = "sh-eth",
324 .id = -1,
325 .dev = {
326 .platform_data = &sh_eth_platdata,
327 },
328 .resource = sh_eth_resources,
329 .num_resources = ARRAY_SIZE(sh_eth_resources),
330};
331
332/* LCDC */
333static struct fb_videomode lcdc0_mode = {
334 .name = "AMPIER/AM-800480",
335 .xres = 800,
336 .yres = 480,
337 .left_margin = 88,
338 .right_margin = 40,
339 .hsync_len = 128,
340 .upper_margin = 20,
341 .lower_margin = 5,
342 .vsync_len = 5,
343 .sync = 0,
344};
345
346static struct sh_mobile_lcdc_info lcdc0_info = {
347 .clock_source = LCDC_CLK_BUS,
348 .ch[0] = {
349 .chan = LCDC_CHAN_MAINLCD,
350 .fourcc = V4L2_PIX_FMT_RGB565,
351 .interface_type = RGB24,
352 .clock_divider = 5,
353 .flags = 0,
354 .lcd_modes = &lcdc0_mode,
355 .num_modes = 1,
356 .panel_cfg = {
357 .width = 111,
358 .height = 68,
359 },
360 },
361};
362
363static struct resource lcdc0_resources[] = {
364 [0] = {
365 .name = "LCD0",
366 .start = 0xfe940000,
367 .end = 0xfe943fff,
368 .flags = IORESOURCE_MEM,
369 },
370 [1] = {
371 .start = intcs_evt2irq(0x580),
372 .flags = IORESOURCE_IRQ,
373 },
374};
375
376static struct platform_device lcdc0_device = {
377 .name = "sh_mobile_lcdc_fb",
378 .num_resources = ARRAY_SIZE(lcdc0_resources),
379 .resource = lcdc0_resources,
380 .id = 0,
381 .dev = {
382 .platform_data = &lcdc0_info,
383 .coherent_dma_mask = ~0,
384 },
385};
386
387/* GPIO KEY */
388#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
389
390static struct gpio_keys_button gpio_buttons[] = {
391 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
392 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
393 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
394 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
395};
396
397static struct gpio_keys_platform_data gpio_key_info = {
398 .buttons = gpio_buttons,
399 .nbuttons = ARRAY_SIZE(gpio_buttons),
400};
401
402static struct platform_device gpio_keys_device = {
403 .name = "gpio-keys",
404 .id = -1,
405 .dev = {
406 .platform_data = &gpio_key_info,
407 },
408};
409
410/* SDHI0 */
411/*
412 * FIXME
413 *
414 * It use polling mode here, since
415 * CD (= Card Detect) pin is not connected to SDHI0_CD.
416 * We can use IRQ31 as card detect irq,
417 * but it needs chattering removal operation
418 */
419#define IRQ31 evt2irq(0x33E0)
420static struct sh_mobile_sdhi_info sdhi0_info = {
421 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
422 MMC_CAP_NEEDS_POLL,
423 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
424 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
425};
426
427static struct resource sdhi0_resources[] = {
428 {
429 .name = "SDHI0",
430 .start = 0xe6850000,
431 .end = 0xe6850100 - 1,
432 .flags = IORESOURCE_MEM,
433 },
434 /*
435 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
436 */
437 {
438 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
439 .start = evt2irq(0x0E20),
440 .flags = IORESOURCE_IRQ,
441 },
442 {
443 .name = SH_MOBILE_SDHI_IRQ_SDIO,
444 .start = evt2irq(0x0E40),
445 .flags = IORESOURCE_IRQ,
446 },
447};
448
449static struct platform_device sdhi0_device = {
450 .name = "sh_mobile_sdhi",
451 .id = 0,
452 .dev = {
453 .platform_data = &sdhi0_info,
454 },
455 .num_resources = ARRAY_SIZE(sdhi0_resources),
456 .resource = sdhi0_resources,
457};
458
459/* SDHI1 */
460static struct sh_mobile_sdhi_info sdhi1_info = {
461 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
462 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
463 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
464};
465
466static struct resource sdhi1_resources[] = {
467 [0] = {
468 .name = "SDHI1",
469 .start = 0xe6860000,
470 .end = 0xe6860100 - 1,
471 .flags = IORESOURCE_MEM,
472 },
473 [1] = {
474 .start = evt2irq(0x0E80),
475 .flags = IORESOURCE_IRQ,
476 },
477 [2] = {
478 .start = evt2irq(0x0EA0),
479 .flags = IORESOURCE_IRQ,
480 },
481 [3] = {
482 .start = evt2irq(0x0EC0),
483 .flags = IORESOURCE_IRQ,
484 },
485};
486
487static struct platform_device sdhi1_device = {
488 .name = "sh_mobile_sdhi",
489 .id = 1,
490 .dev = {
491 .platform_data = &sdhi1_info,
492 },
493 .num_resources = ARRAY_SIZE(sdhi1_resources),
494 .resource = sdhi1_resources,
495};
496
497/* MMCIF */
498static struct sh_mmcif_plat_data sh_mmcif_plat = {
499 .sup_pclk = 0,
500 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
501 .caps = MMC_CAP_4_BIT_DATA |
502 MMC_CAP_8_BIT_DATA |
503 MMC_CAP_NONREMOVABLE,
504};
505
506static struct resource sh_mmcif_resources[] = {
507 [0] = {
508 .name = "MMCIF",
509 .start = 0xe6bd0000,
510 .end = 0xe6bd0100 - 1,
511 .flags = IORESOURCE_MEM,
512 },
513 [1] = {
514 /* MMC ERR */
515 .start = evt2irq(0x1AC0),
516 .flags = IORESOURCE_IRQ,
517 },
518 [2] = {
519 /* MMC NOR */
520 .start = evt2irq(0x1AE0),
521 .flags = IORESOURCE_IRQ,
522 },
523};
524
525static struct platform_device sh_mmcif_device = {
526 .name = "sh_mmcif",
527 .id = -1,
528 .dev = {
529 .platform_data = &sh_mmcif_plat,
530 },
531 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
532 .resource = sh_mmcif_resources,
533};
534
535/* I2C */
536static struct i2c_board_info i2c0_devices[] = {
537 {
538 I2C_BOARD_INFO("st1232-ts", 0x55),
539 .irq = evt2irq(0x0340),
540 },
541};
542
543/*
544 * board devices
545 */
546static struct platform_device *eva_devices[] __initdata = {
547 &lcdc0_device,
548 &gpio_keys_device,
549 &sh_eth_device,
550 &sdhi0_device,
551 &sh_mmcif_device,
552};
553
554static void __init eva_clock_init(void)
555{
556 struct clk *system = clk_get(NULL, "system_clk");
557 struct clk *xtal1 = clk_get(NULL, "extal1");
558 struct clk *usb24s = clk_get(NULL, "usb24s");
559
560 if (IS_ERR(system) ||
561 IS_ERR(xtal1) ||
562 IS_ERR(usb24s)) {
563 pr_err("armadillo800eva board clock init failed\n");
564 goto clock_error;
565 }
566
567 /* armadillo 800 eva extal1 is 24MHz */
568 clk_set_rate(xtal1, 24000000);
569
570 /* usb24s use extal1 (= system) clock (= 24MHz) */
571 clk_set_parent(usb24s, system);
572
573clock_error:
574 if (!IS_ERR(system))
575 clk_put(system);
576 if (!IS_ERR(xtal1))
577 clk_put(xtal1);
578 if (!IS_ERR(usb24s))
579 clk_put(usb24s);
580}
581
582/*
583 * board init
584 */
585static void __init eva_init(void)
586{
587 eva_clock_init();
588
589 r8a7740_pinmux_init();
590
591 /* SCIFA1 */
592 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
593 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
594
595 /* LCDC0 */
596 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
597 gpio_request(GPIO_FN_LCD0_D0, NULL);
598 gpio_request(GPIO_FN_LCD0_D1, NULL);
599 gpio_request(GPIO_FN_LCD0_D2, NULL);
600 gpio_request(GPIO_FN_LCD0_D3, NULL);
601 gpio_request(GPIO_FN_LCD0_D4, NULL);
602 gpio_request(GPIO_FN_LCD0_D5, NULL);
603 gpio_request(GPIO_FN_LCD0_D6, NULL);
604 gpio_request(GPIO_FN_LCD0_D7, NULL);
605 gpio_request(GPIO_FN_LCD0_D8, NULL);
606 gpio_request(GPIO_FN_LCD0_D9, NULL);
607 gpio_request(GPIO_FN_LCD0_D10, NULL);
608 gpio_request(GPIO_FN_LCD0_D11, NULL);
609 gpio_request(GPIO_FN_LCD0_D12, NULL);
610 gpio_request(GPIO_FN_LCD0_D13, NULL);
611 gpio_request(GPIO_FN_LCD0_D14, NULL);
612 gpio_request(GPIO_FN_LCD0_D15, NULL);
613 gpio_request(GPIO_FN_LCD0_D16, NULL);
614 gpio_request(GPIO_FN_LCD0_D17, NULL);
615 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
616 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
617 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
618 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
619 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
620 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
621 gpio_request(GPIO_FN_LCD0_DCK, NULL);
622 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
623 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
624 gpio_request(GPIO_FN_LCD0_DISP, NULL);
625 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
626
627 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
628 gpio_direction_output(GPIO_PORT61, 1);
629
630 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
631 gpio_direction_output(GPIO_PORT202, 0);
632
633 /* Touchscreen */
634 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
635 gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
636 gpio_direction_output(GPIO_PORT166, 1);
637
638 /* GETHER */
639 gpio_request(GPIO_FN_ET_CRS, NULL);
640 gpio_request(GPIO_FN_ET_MDC, NULL);
641 gpio_request(GPIO_FN_ET_MDIO, NULL);
642 gpio_request(GPIO_FN_ET_TX_ER, NULL);
643 gpio_request(GPIO_FN_ET_RX_ER, NULL);
644 gpio_request(GPIO_FN_ET_ERXD0, NULL);
645 gpio_request(GPIO_FN_ET_ERXD1, NULL);
646 gpio_request(GPIO_FN_ET_ERXD2, NULL);
647 gpio_request(GPIO_FN_ET_ERXD3, NULL);
648 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
649 gpio_request(GPIO_FN_ET_TX_EN, NULL);
650 gpio_request(GPIO_FN_ET_ETXD0, NULL);
651 gpio_request(GPIO_FN_ET_ETXD1, NULL);
652 gpio_request(GPIO_FN_ET_ETXD2, NULL);
653 gpio_request(GPIO_FN_ET_ETXD3, NULL);
654 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
655 gpio_request(GPIO_FN_ET_COL, NULL);
656 gpio_request(GPIO_FN_ET_RX_DV, NULL);
657 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
658
659 gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
660 gpio_direction_output(GPIO_PORT18, 1);
661
662 /* USB */
663 gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
664 gpio_direction_input(GPIO_PORT159);
665
666 if (gpio_get_value(GPIO_PORT159)) {
667 /* USB Host */
668 } else {
669 /* USB Func */
670 gpio_request(GPIO_FN_VBUS, NULL);
671 platform_device_register(&usbhsf_device);
672 }
673
674 /* SDHI0 */
675 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
676 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
677 gpio_request(GPIO_FN_SDHI0_D0, NULL);
678 gpio_request(GPIO_FN_SDHI0_D1, NULL);
679 gpio_request(GPIO_FN_SDHI0_D2, NULL);
680 gpio_request(GPIO_FN_SDHI0_D3, NULL);
681 gpio_request(GPIO_FN_SDHI0_WP, NULL);
682
683 gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
684 gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
685 gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
686 gpio_direction_output(GPIO_PORT17, 0);
687 gpio_direction_output(GPIO_PORT74, 1);
688 gpio_direction_output(GPIO_PORT75, 1);
689
690 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
691
692 /*
693 * MMCIF
694 *
695 * Here doesn't care SW1.4 status,
696 * since CON2 is not mounted.
697 */
698 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
699 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
700 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
701 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
702 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
703 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
704 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
705 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
706 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
707 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
708
709 /*
710 * CAUTION
711 *
712 * DBGMD/LCDC0/FSIA MUX
713 * DBGMD_SELECT_B should be set after setting PFC Function.
714 */
715 gpio_request(GPIO_PORT176, NULL);
716 gpio_direction_output(GPIO_PORT176, 1);
717
718 /*
719 * We can switch CON8/CON14 by SW1.5,
720 * but it needs after DBGMD_SELECT_B
721 */
722 gpio_request(GPIO_PORT6, NULL);
723 gpio_direction_input(GPIO_PORT6);
724 if (gpio_get_value(GPIO_PORT6)) {
725 /* CON14 enable */
726 } else {
727 /* CON8 (SDHI1) enable */
728 gpio_request(GPIO_FN_SDHI1_CLK, NULL);
729 gpio_request(GPIO_FN_SDHI1_CMD, NULL);
730 gpio_request(GPIO_FN_SDHI1_D0, NULL);
731 gpio_request(GPIO_FN_SDHI1_D1, NULL);
732 gpio_request(GPIO_FN_SDHI1_D2, NULL);
733 gpio_request(GPIO_FN_SDHI1_D3, NULL);
734 gpio_request(GPIO_FN_SDHI1_CD, NULL);
735 gpio_request(GPIO_FN_SDHI1_WP, NULL);
736
737 gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
738 gpio_direction_output(GPIO_PORT16, 1);
739
740 platform_device_register(&sdhi1_device);
741 }
742
743
744#ifdef CONFIG_CACHE_L2X0
745 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
746 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
747#endif
748
749 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
750
751 r8a7740_add_standard_devices();
752
753 platform_add_devices(eva_devices,
754 ARRAY_SIZE(eva_devices));
755}
756
757static void __init eva_earlytimer_init(void)
758{
759 r8a7740_clock_init(MD_CK0 | MD_CK2);
760 shmobile_earlytimer_init();
761}
762
763static void __init eva_add_early_devices(void)
764{
765 r8a7740_add_early_devices();
766
767 /* override timer setup with board-specific code */
768 shmobile_timer.init = eva_earlytimer_init;
769}
770
771static const char *eva_boards_compat_dt[] __initdata = {
772 "renesas,armadillo800eva",
773 NULL,
774};
775
776DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
777 .map_io = r8a7740_map_io,
778 .init_early = eva_add_early_devices,
779 .init_irq = r8a7740_init_irq,
780 .handle_irq = shmobile_handle_irq_intc,
781 .init_machine = eva_init,
782 .timer = &shmobile_timer,
783 .dt_compat = eva_boards_compat_dt,
784MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 81fd95f7f52a..63ab7062bee3 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -486,7 +486,7 @@ static void __init bonito_earlytimer_init(void)
486 shmobile_earlytimer_init(); 486 shmobile_earlytimer_init();
487} 487}
488 488
489void __init bonito_add_early_devices(void) 489static void __init bonito_add_early_devices(void)
490{ 490{
491 r8a7740_add_early_devices(); 491 r8a7740_add_early_devices();
492 492
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
new file mode 100644
index 000000000000..d8e33b682832
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -0,0 +1,460 @@
1/*
2 * KZM-A9-GT board support
3 *
4 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <linux/delay.h>
21#include <linux/gpio.h>
22#include <linux/gpio_keys.h>
23#include <linux/io.h>
24#include <linux/irq.h>
25#include <linux/i2c.h>
26#include <linux/i2c/pcf857x.h>
27#include <linux/input.h>
28#include <linux/mmc/host.h>
29#include <linux/mmc/sh_mmcif.h>
30#include <linux/mmc/sh_mobile_sdhi.h>
31#include <linux/mfd/tmio.h>
32#include <linux/platform_device.h>
33#include <linux/smsc911x.h>
34#include <linux/usb/r8a66597.h>
35#include <linux/videodev2.h>
36#include <mach/irqs.h>
37#include <mach/sh73a0.h>
38#include <mach/common.h>
39#include <asm/hardware/cache-l2x0.h>
40#include <asm/hardware/gic.h>
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <video/sh_mobile_lcdc.h>
44
45/*
46 * external GPIO
47 */
48#define GPIO_PCF8575_BASE (GPIO_NR)
49#define GPIO_PCF8575_PORT10 (GPIO_NR + 8)
50#define GPIO_PCF8575_PORT11 (GPIO_NR + 9)
51#define GPIO_PCF8575_PORT12 (GPIO_NR + 10)
52#define GPIO_PCF8575_PORT13 (GPIO_NR + 11)
53#define GPIO_PCF8575_PORT14 (GPIO_NR + 12)
54#define GPIO_PCF8575_PORT15 (GPIO_NR + 13)
55#define GPIO_PCF8575_PORT16 (GPIO_NR + 14)
56
57/* SMSC 9221 */
58static struct resource smsc9221_resources[] = {
59 [0] = {
60 .start = 0x10000000, /* CS4 */
61 .end = 0x100000ff,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = intcs_evt2irq(0x260), /* IRQ3 */
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70static struct smsc911x_platform_config smsc9221_platdata = {
71 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
72 .phy_interface = PHY_INTERFACE_MODE_MII,
73 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
74 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
75};
76
77static struct platform_device smsc_device = {
78 .name = "smsc911x",
79 .dev = {
80 .platform_data = &smsc9221_platdata,
81 },
82 .resource = smsc9221_resources,
83 .num_resources = ARRAY_SIZE(smsc9221_resources),
84};
85
86/* USB external chip */
87static struct r8a66597_platdata usb_host_data = {
88 .on_chip = 0,
89 .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
90};
91
92static struct resource usb_resources[] = {
93 [0] = {
94 .start = 0x10010000,
95 .end = 0x1001ffff - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = intcs_evt2irq(0x220), /* IRQ1 */
100 .flags = IORESOURCE_IRQ,
101 },
102};
103
104static struct platform_device usb_host_device = {
105 .name = "r8a66597_hcd",
106 .dev = {
107 .platform_data = &usb_host_data,
108 .dma_mask = NULL,
109 .coherent_dma_mask = 0xffffffff,
110 },
111 .num_resources = ARRAY_SIZE(usb_resources),
112 .resource = usb_resources,
113};
114
115/* LCDC */
116static struct fb_videomode kzm_lcdc_mode = {
117 .name = "WVGA Panel",
118 .xres = 800,
119 .yres = 480,
120 .left_margin = 220,
121 .right_margin = 110,
122 .hsync_len = 70,
123 .upper_margin = 20,
124 .lower_margin = 5,
125 .vsync_len = 5,
126 .sync = 0,
127};
128
129static struct sh_mobile_lcdc_info lcdc_info = {
130 .clock_source = LCDC_CLK_BUS,
131 .ch[0] = {
132 .chan = LCDC_CHAN_MAINLCD,
133 .fourcc = V4L2_PIX_FMT_RGB565,
134 .interface_type = RGB24,
135 .lcd_modes = &kzm_lcdc_mode,
136 .num_modes = 1,
137 .clock_divider = 5,
138 .flags = 0,
139 .panel_cfg = {
140 .width = 152,
141 .height = 91,
142 },
143 }
144};
145
146static struct resource lcdc_resources[] = {
147 [0] = {
148 .name = "LCDC",
149 .start = 0xfe940000,
150 .end = 0xfe943fff,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = intcs_evt2irq(0x580),
155 .flags = IORESOURCE_IRQ,
156 },
157};
158
159static struct platform_device lcdc_device = {
160 .name = "sh_mobile_lcdc_fb",
161 .num_resources = ARRAY_SIZE(lcdc_resources),
162 .resource = lcdc_resources,
163 .dev = {
164 .platform_data = &lcdc_info,
165 .coherent_dma_mask = ~0,
166 },
167};
168
169/* MMCIF */
170static struct resource sh_mmcif_resources[] = {
171 [0] = {
172 .name = "MMCIF",
173 .start = 0xe6bd0000,
174 .end = 0xe6bd00ff,
175 .flags = IORESOURCE_MEM,
176 },
177 [1] = {
178 .start = gic_spi(141),
179 .flags = IORESOURCE_IRQ,
180 },
181 [2] = {
182 .start = gic_spi(140),
183 .flags = IORESOURCE_IRQ,
184 },
185};
186
187static struct sh_mmcif_plat_data sh_mmcif_platdata = {
188 .ocr = MMC_VDD_165_195,
189 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
190};
191
192static struct platform_device mmc_device = {
193 .name = "sh_mmcif",
194 .dev = {
195 .dma_mask = NULL,
196 .coherent_dma_mask = 0xffffffff,
197 .platform_data = &sh_mmcif_platdata,
198 },
199 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
200 .resource = sh_mmcif_resources,
201};
202
203/* SDHI */
204static struct sh_mobile_sdhi_info sdhi0_info = {
205 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
206 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
207 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
208};
209
210static struct resource sdhi0_resources[] = {
211 [0] = {
212 .name = "SDHI0",
213 .start = 0xee100000,
214 .end = 0xee1000ff,
215 .flags = IORESOURCE_MEM,
216 },
217 [1] = {
218 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
219 .start = gic_spi(83),
220 .flags = IORESOURCE_IRQ,
221 },
222 [2] = {
223 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
224 .start = gic_spi(84),
225 .flags = IORESOURCE_IRQ,
226 },
227 [3] = {
228 .name = SH_MOBILE_SDHI_IRQ_SDIO,
229 .start = gic_spi(85),
230 .flags = IORESOURCE_IRQ,
231 },
232};
233
234static struct platform_device sdhi0_device = {
235 .name = "sh_mobile_sdhi",
236 .num_resources = ARRAY_SIZE(sdhi0_resources),
237 .resource = sdhi0_resources,
238 .dev = {
239 .platform_data = &sdhi0_info,
240 },
241};
242
243/* KEY */
244#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
245
246static struct gpio_keys_button gpio_buttons[] = {
247 GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
248 GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
249 GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
250 GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
251 GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
252 GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
253 GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
254};
255
256static struct gpio_keys_platform_data gpio_key_info = {
257 .buttons = gpio_buttons,
258 .nbuttons = ARRAY_SIZE(gpio_buttons),
259 .poll_interval = 250, /* poling at this point */
260};
261
262static struct platform_device gpio_keys_device = {
263 /* gpio-pcf857x.c driver doesn't support gpio_to_irq() */
264 .name = "gpio-keys-polled",
265 .dev = {
266 .platform_data = &gpio_key_info,
267 },
268};
269
270/* I2C */
271static struct pcf857x_platform_data pcf8575_pdata = {
272 .gpio_base = GPIO_PCF8575_BASE,
273};
274
275static struct i2c_board_info i2c1_devices[] = {
276 {
277 I2C_BOARD_INFO("st1232-ts", 0x55),
278 .irq = intcs_evt2irq(0x300), /* IRQ8 */
279 },
280};
281
282static struct i2c_board_info i2c3_devices[] = {
283 {
284 I2C_BOARD_INFO("pcf8575", 0x20),
285 .platform_data = &pcf8575_pdata,
286 },
287};
288
289static struct platform_device *kzm_devices[] __initdata = {
290 &smsc_device,
291 &usb_host_device,
292 &lcdc_device,
293 &mmc_device,
294 &sdhi0_device,
295 &gpio_keys_device,
296};
297
298/*
299 * FIXME
300 *
301 * This is quick hack for enabling LCDC backlight
302 */
303static int __init as3711_enable_lcdc_backlight(void)
304{
305 struct i2c_adapter *a = i2c_get_adapter(0);
306 struct i2c_msg msg;
307 int i, ret;
308 __u8 magic[] = {
309 0x40, 0x2a,
310 0x43, 0x3c,
311 0x44, 0x3c,
312 0x45, 0x3c,
313 0x54, 0x03,
314 0x51, 0x00,
315 0x51, 0x01,
316 0xff, 0x00, /* wait */
317 0x43, 0xf0,
318 0x44, 0xf0,
319 0x45, 0xf0,
320 };
321
322 if (!machine_is_kzm9g())
323 return 0;
324
325 if (!a)
326 return 0;
327
328 msg.addr = 0x40;
329 msg.len = 2;
330 msg.flags = 0;
331
332 for (i = 0; i < ARRAY_SIZE(magic); i += 2) {
333 msg.buf = magic + i;
334
335 if (0xff == msg.buf[0]) {
336 udelay(500);
337 continue;
338 }
339
340 ret = i2c_transfer(a, &msg, 1);
341 if (ret < 0) {
342 pr_err("i2c transfer fail\n");
343 break;
344 }
345 }
346
347 return 0;
348}
349device_initcall(as3711_enable_lcdc_backlight);
350
351static void __init kzm_init(void)
352{
353 sh73a0_pinmux_init();
354
355 /* enable SCIFA4 */
356 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
357 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
358 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
359 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
360
361 /* CS4 for SMSC/USB */
362 gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
363
364 /* SMSC */
365 gpio_request(GPIO_PORT224, NULL); /* IRQ3 */
366 gpio_direction_input(GPIO_PORT224);
367
368 /* LCDC */
369 gpio_request(GPIO_FN_LCDD23, NULL);
370 gpio_request(GPIO_FN_LCDD22, NULL);
371 gpio_request(GPIO_FN_LCDD21, NULL);
372 gpio_request(GPIO_FN_LCDD20, NULL);
373 gpio_request(GPIO_FN_LCDD19, NULL);
374 gpio_request(GPIO_FN_LCDD18, NULL);
375 gpio_request(GPIO_FN_LCDD17, NULL);
376 gpio_request(GPIO_FN_LCDD16, NULL);
377 gpio_request(GPIO_FN_LCDD15, NULL);
378 gpio_request(GPIO_FN_LCDD14, NULL);
379 gpio_request(GPIO_FN_LCDD13, NULL);
380 gpio_request(GPIO_FN_LCDD12, NULL);
381 gpio_request(GPIO_FN_LCDD11, NULL);
382 gpio_request(GPIO_FN_LCDD10, NULL);
383 gpio_request(GPIO_FN_LCDD9, NULL);
384 gpio_request(GPIO_FN_LCDD8, NULL);
385 gpio_request(GPIO_FN_LCDD7, NULL);
386 gpio_request(GPIO_FN_LCDD6, NULL);
387 gpio_request(GPIO_FN_LCDD5, NULL);
388 gpio_request(GPIO_FN_LCDD4, NULL);
389 gpio_request(GPIO_FN_LCDD3, NULL);
390 gpio_request(GPIO_FN_LCDD2, NULL);
391 gpio_request(GPIO_FN_LCDD1, NULL);
392 gpio_request(GPIO_FN_LCDD0, NULL);
393 gpio_request(GPIO_FN_LCDDISP, NULL);
394 gpio_request(GPIO_FN_LCDDCK, NULL);
395
396 gpio_request(GPIO_PORT222, NULL); /* LCDCDON */
397 gpio_request(GPIO_PORT226, NULL); /* SC */
398 gpio_direction_output(GPIO_PORT222, 1);
399 gpio_direction_output(GPIO_PORT226, 1);
400
401 /* Touchscreen */
402 gpio_request(GPIO_PORT223, NULL); /* IRQ8 */
403 gpio_direction_input(GPIO_PORT223);
404
405 /* enable MMCIF */
406 gpio_request(GPIO_FN_MMCCLK0, NULL);
407 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
408 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
409 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
410 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
411 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
412 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
413 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
414 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
415 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
416
417 /* enable SD */
418 gpio_request(GPIO_FN_SDHIWP0, NULL);
419 gpio_request(GPIO_FN_SDHICD0, NULL);
420 gpio_request(GPIO_FN_SDHICMD0, NULL);
421 gpio_request(GPIO_FN_SDHICLK0, NULL);
422 gpio_request(GPIO_FN_SDHID0_3, NULL);
423 gpio_request(GPIO_FN_SDHID0_2, NULL);
424 gpio_request(GPIO_FN_SDHID0_1, NULL);
425 gpio_request(GPIO_FN_SDHID0_0, NULL);
426 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
427 gpio_request(GPIO_PORT15, NULL);
428 gpio_direction_output(GPIO_PORT15, 1); /* power */
429
430 /* I2C 3 */
431 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
432 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
433
434#ifdef CONFIG_CACHE_L2X0
435 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
436 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
437#endif
438
439 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
440 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
441
442 sh73a0_add_standard_devices();
443 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
444}
445
446static const char *kzm9g_boards_compat_dt[] __initdata = {
447 "renesas,kzm9g",
448 NULL,
449};
450
451DT_MACHINE_START(KZM9G_DT, "kzm9g")
452 .map_io = sh73a0_map_io,
453 .init_early = sh73a0_add_early_devices,
454 .nr_irqs = NR_IRQS_LEGACY,
455 .init_irq = sh73a0_init_irq,
456 .handle_irq = gic_handle_irq,
457 .init_machine = kzm_init,
458 .timer = &shmobile_timer,
459 .dt_compat = kzm9g_boards_compat_dt,
460MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 8c6202bb6aeb..aae2e24fde46 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -908,6 +908,8 @@ fsi_set_rate_end:
908static struct sh_fsi_platform_info fsi_info = { 908static struct sh_fsi_platform_info fsi_info = {
909 .port_a = { 909 .port_a = {
910 .flags = SH_FSI_BRS_INV, 910 .flags = SH_FSI_BRS_INV,
911 .tx_id = SHDMA_SLAVE_FSIA_TX,
912 .rx_id = SHDMA_SLAVE_FSIA_RX,
911 }, 913 },
912 .port_b = { 914 .port_b = {
913 .flags = SH_FSI_BRS_INV | 915 .flags = SH_FSI_BRS_INV |
@@ -920,9 +922,11 @@ static struct sh_fsi_platform_info fsi_info = {
920 922
921static struct resource fsi_resources[] = { 923static struct resource fsi_resources[] = {
922 [0] = { 924 [0] = {
925 /* we need 0xFE1F0000 to access DMA
926 * instead of 0xFE3C0000 */
923 .name = "FSI", 927 .name = "FSI",
924 .start = 0xFE3C0000, 928 .start = 0xFE1F0000,
925 .end = 0xFE3C0400 - 1, 929 .end = 0xFE1F0400 - 1,
926 .flags = IORESOURCE_MEM, 930 .flags = IORESOURCE_MEM,
927 }, 931 },
928 [1] = { 932 [1] = {
@@ -1248,6 +1252,8 @@ static void mackerel_camera_del(struct soc_camera_device *icd)
1248 1252
1249static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 1253static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
1250 .flags = SH_CEU_FLAG_USE_8BIT_BUS, 1254 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
1255 .max_width = 8188,
1256 .max_height = 8188,
1251}; 1257};
1252 1258
1253static struct resource ceu_resources[] = { 1259static struct resource ceu_resources[] = {
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 81b54a6af20f..26eea5f21054 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -352,6 +352,7 @@ enum {
352 352
353 MSTP329, MSTP328, MSTP323, MSTP320, 353 MSTP329, MSTP328, MSTP323, MSTP320,
354 MSTP314, MSTP313, MSTP312, 354 MSTP314, MSTP313, MSTP312,
355 MSTP309,
355 356
356 MSTP416, MSTP415, MSTP407, MSTP406, 357 MSTP416, MSTP415, MSTP407, MSTP406,
357 358
@@ -382,6 +383,7 @@ static struct clk mstp_clks[MSTP_NR] = {
382 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */ 383 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
383 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */ 384 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
384 [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */ 385 [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
386 [MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 9, 0), /* GEther */
385 387
386 [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */ 388 [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */
387 [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */ 389 [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */
@@ -447,6 +449,7 @@ static struct clk_lookup lookups[] = {
447 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 449 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
448 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 450 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
449 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 451 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
452 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]),
450 453
451 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), 454 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
452 455
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index 9b3598e4f105..398e2c10913b 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -482,6 +482,9 @@ enum {
482 GPIO_FN_FSIAILR_PU, 482 GPIO_FN_FSIAILR_PU,
483 GPIO_FN_FSIAIBT_PU, 483 GPIO_FN_FSIAIBT_PU,
484 GPIO_FN_FSIAISLD_PU, 484 GPIO_FN_FSIAISLD_PU,
485
486 /* end of GPIO */
487 GPIO_NR,
485}; 488};
486 489
487/* DMA slave IDs */ 490/* DMA slave IDs */
diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c
index e05634ce2e0d..4a547b803268 100644
--- a/arch/arm/mach-shmobile/pfc-sh73a0.c
+++ b/arch/arm/mach-shmobile/pfc-sh73a0.c
@@ -829,14 +829,14 @@ static pinmux_enum_t pinmux_data[] = {
829 PINMUX_DATA(PORT27_I2C_SCL2_MARK, PORT27_FN2, MSEL2CR_MSEL17_0, 829 PINMUX_DATA(PORT27_I2C_SCL2_MARK, PORT27_FN2, MSEL2CR_MSEL17_0,
830 MSEL2CR_MSEL16_1), \ 830 MSEL2CR_MSEL16_1), \
831 PINMUX_DATA(PORT27_I2C_SCL3_MARK, PORT27_FN3, MSEL2CR_MSEL19_0, 831 PINMUX_DATA(PORT27_I2C_SCL3_MARK, PORT27_FN3, MSEL2CR_MSEL19_0,
832 MSEL2CR_MSEL18_0), \ 832 MSEL2CR_MSEL18_1), \
833 PINMUX_DATA(MFG0_OUT1_MARK, PORT27_FN4), \ 833 PINMUX_DATA(MFG0_OUT1_MARK, PORT27_FN4), \
834 PINMUX_DATA(PORT27_IROUT_MARK, PORT27_FN7), 834 PINMUX_DATA(PORT27_IROUT_MARK, PORT27_FN7),
835 PINMUX_DATA(XDVFS2_MARK, PORT28_FN1), \ 835 PINMUX_DATA(XDVFS2_MARK, PORT28_FN1), \
836 PINMUX_DATA(PORT28_I2C_SDA2_MARK, PORT28_FN2, MSEL2CR_MSEL17_0, 836 PINMUX_DATA(PORT28_I2C_SDA2_MARK, PORT28_FN2, MSEL2CR_MSEL17_0,
837 MSEL2CR_MSEL16_1), \ 837 MSEL2CR_MSEL16_1), \
838 PINMUX_DATA(PORT28_I2C_SDA3_MARK, PORT28_FN3, MSEL2CR_MSEL19_0, 838 PINMUX_DATA(PORT28_I2C_SDA3_MARK, PORT28_FN3, MSEL2CR_MSEL19_0,
839 MSEL2CR_MSEL18_0), \ 839 MSEL2CR_MSEL18_1), \
840 PINMUX_DATA(PORT28_TPU1TO1_MARK, PORT28_FN7), 840 PINMUX_DATA(PORT28_TPU1TO1_MARK, PORT28_FN7),
841 PINMUX_DATA(SIM_RST_MARK, PORT29_FN1), \ 841 PINMUX_DATA(SIM_RST_MARK, PORT29_FN1), \
842 PINMUX_DATA(PORT29_TPU1TO1_MARK, PORT29_FN4), 842 PINMUX_DATA(PORT29_TPU1TO1_MARK, PORT29_FN4),
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 7006cdc8b8ca..bacdd667e3b1 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -22,7 +22,8 @@
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/emev2.h> 23#include <mach/emev2.h>
24 24
25#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2()) 25#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \
26 of_machine_is_compatible("renesas,sh73a0"))
26#define is_r8a7779() machine_is_marzen() 27#define is_r8a7779() machine_is_marzen()
27#define is_emev2() of_machine_is_compatible("renesas,emev2") 28#define is_emev2() of_machine_is_compatible("renesas,emev2")
28 29
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 34a1548dbda6..ec4eb49c1693 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/dma-mapping.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/io.h> 24#include <linux/io.h>
@@ -60,6 +61,12 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
60void __init r8a7740_map_io(void) 61void __init r8a7740_map_io(void)
61{ 62{
62 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 63 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
64
65 /*
66 * DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
67 * enough to allocate the frame buffer memory.
68 */
69 init_consistent_dma_size(12 << 20);
63} 70}
64 71
65/* SCIFA0 */ 72/* SCIFA0 */