aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-09-20 14:24:58 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-20 14:25:03 -0400
commitbfefb7a0c6e08736f2d5917c468467f134bf28bb (patch)
tree7aa7084114dc083fe5b4d7b532901bdeb67188e7 /arch/sh/boards
parent8d0cc631f6dd0a9283ceb7d61d8b85ecbcd355ea (diff)
parent78f28b7c555359c67c2a0d23f7436e915329421e (diff)
Merge branch 'linus' into x86/urgent
Merge reason: Bring in changes that the next patch will depend on. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/Kconfig22
-rw-r--r--arch/sh/boards/board-ap325rxa.c10
-rw-r--r--arch/sh/boards/board-sh7785lcr.c18
-rw-r--r--arch/sh/boards/mach-ecovec24/Makefile9
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c670
-rw-r--r--arch/sh/boards/mach-highlander/setup.c7
-rw-r--r--arch/sh/boards/mach-kfr2r09/Makefile2
-rw-r--r--arch/sh/boards/mach-kfr2r09/lcd_wqvga.c332
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c386
-rw-r--r--arch/sh/boards/mach-migor/setup.c11
-rw-r--r--arch/sh/boards/mach-se/7722/setup.c4
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c110
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c7
13 files changed, 1572 insertions, 16 deletions
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 2b1af0eefa6a..aedd9deb5de2 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -160,7 +160,6 @@ config SH_SH7785LCR
160 bool "SH7785LCR" 160 bool "SH7785LCR"
161 depends on CPU_SUBTYPE_SH7785 161 depends on CPU_SUBTYPE_SH7785
162 select SYS_SUPPORTS_PCI 162 select SYS_SUPPORTS_PCI
163 select IO_TRAPPED if MMU
164 163
165config SH_SH7785LCR_29BIT_PHYSMAPS 164config SH_SH7785LCR_29BIT_PHYSMAPS
166 bool "SH7785LCR 29bit physmaps" 165 bool "SH7785LCR 29bit physmaps"
@@ -171,6 +170,13 @@ config SH_SH7785LCR_29BIT_PHYSMAPS
171 DIP switch(S2-5). If you set the DIP switch for S2-5 = ON, 170 DIP switch(S2-5). If you set the DIP switch for S2-5 = ON,
172 you can access all on-board device in 29bit address mode. 171 you can access all on-board device in 29bit address mode.
173 172
173config SH_SH7785LCR_PT
174 bool "SH7785LCR prototype board on 32-bit MMU mode"
175 depends on SH_SH7785LCR && 32BIT
176 default n
177 help
178 If you use prototype board, this option is enabled.
179
174config SH_URQUELL 180config SH_URQUELL
175 bool "Urquell" 181 bool "Urquell"
176 depends on CPU_SUBTYPE_SH7786 182 depends on CPU_SUBTYPE_SH7786
@@ -193,6 +199,20 @@ config SH_AP325RXA
193 Renesas "AP-325RXA" support. 199 Renesas "AP-325RXA" support.
194 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A" 200 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
195 201
202config SH_KFR2R09
203 bool "KFR2R09"
204 depends on CPU_SUBTYPE_SH7724
205 select ARCH_REQUIRE_GPIOLIB
206 help
207 "Kit For R2R for 2009" support.
208
209config SH_ECOVEC
210 bool "EcoVec"
211 depends on CPU_SUBTYPE_SH7724
212 select ARCH_REQUIRE_GPIOLIB
213 help
214 Renesas "R0P7724LC0011/21RL (EcoVec)" support.
215
196config SH_SH7763RDP 216config SH_SH7763RDP
197 bool "SH7763RDP" 217 bool "SH7763RDP"
198 depends on CPU_SUBTYPE_SH7763 218 depends on CPU_SUBTYPE_SH7763
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index b9c88cc519e2..327d47c25a57 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -188,7 +188,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
188 .name = "LB070WV1", 188 .name = "LB070WV1",
189 .xres = 800, 189 .xres = 800,
190 .yres = 480, 190 .yres = 480,
191 .left_margin = 40, 191 .left_margin = 32,
192 .right_margin = 160, 192 .right_margin = 160,
193 .hsync_len = 8, 193 .hsync_len = 8,
194 .upper_margin = 63, 194 .upper_margin = 63,
@@ -211,7 +211,7 @@ static struct resource lcdc_resources[] = {
211 [0] = { 211 [0] = {
212 .name = "LCDC", 212 .name = "LCDC",
213 .start = 0xfe940000, /* P4-only space */ 213 .start = 0xfe940000, /* P4-only space */
214 .end = 0xfe941fff, 214 .end = 0xfe942fff,
215 .flags = IORESOURCE_MEM, 215 .flags = IORESOURCE_MEM,
216 }, 216 },
217 [1] = { 217 [1] = {
@@ -227,6 +227,9 @@ static struct platform_device lcdc_device = {
227 .dev = { 227 .dev = {
228 .platform_data = &lcdc_info, 228 .platform_data = &lcdc_info,
229 }, 229 },
230 .archdata = {
231 .hwblk_id = HWBLK_LCDC,
232 },
230}; 233};
231 234
232static void camera_power(int val) 235static void camera_power(int val)
@@ -377,6 +380,9 @@ static struct platform_device ceu_device = {
377 .dev = { 380 .dev = {
378 .platform_data = &sh_mobile_ceu_info, 381 .platform_data = &sh_mobile_ceu_info,
379 }, 382 },
383 .archdata = {
384 .hwblk_id = HWBLK_CEU,
385 },
380}; 386};
381 387
382struct spi_gpio_platform_data sdcard_cn3_platform_data = { 388struct spi_gpio_platform_data sdcard_cn3_platform_data = {
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index 42410a15d255..e5a8a2fde39c 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -223,6 +223,19 @@ static struct platform_device sm501_device = {
223 .resource = sm501_resources, 223 .resource = sm501_resources,
224}; 224};
225 225
226static struct resource i2c_proto_resources[] = {
227 [0] = {
228 .start = PCA9564_PROTO_32BIT_ADDR,
229 .end = PCA9564_PROTO_32BIT_ADDR + PCA9564_SIZE - 1,
230 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
231 },
232 [1] = {
233 .start = 12,
234 .end = 12,
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
226static struct resource i2c_resources[] = { 239static struct resource i2c_resources[] = {
227 [0] = { 240 [0] = {
228 .start = PCA9564_ADDR, 241 .start = PCA9564_ADDR,
@@ -271,6 +284,11 @@ static int __init sh7785lcr_devices_setup(void)
271 i2c_register_board_info(0, sh7785lcr_i2c_devices, 284 i2c_register_board_info(0, sh7785lcr_i2c_devices,
272 ARRAY_SIZE(sh7785lcr_i2c_devices)); 285 ARRAY_SIZE(sh7785lcr_i2c_devices));
273 286
287 if (mach_is_sh7785lcr_pt()) {
288 i2c_device.resource = i2c_proto_resources;
289 i2c_device.num_resources = ARRAY_SIZE(i2c_proto_resources);
290 }
291
274 return platform_add_devices(sh7785lcr_devices, 292 return platform_add_devices(sh7785lcr_devices,
275 ARRAY_SIZE(sh7785lcr_devices)); 293 ARRAY_SIZE(sh7785lcr_devices));
276} 294}
diff --git a/arch/sh/boards/mach-ecovec24/Makefile b/arch/sh/boards/mach-ecovec24/Makefile
new file mode 100644
index 000000000000..51f852151655
--- /dev/null
+++ b/arch/sh/boards/mach-ecovec24/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for the R0P7724LC0011/21RL (EcoVec)
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8
9obj-y := setup.o \ No newline at end of file
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
new file mode 100644
index 000000000000..96bc1698310f
--- /dev/null
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -0,0 +1,670 @@
1/*
2 * Copyright (C) 2009 Renesas Solutions Corp.
3 *
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
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/device.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/gpio.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18#include <linux/delay.h>
19#include <linux/usb/r8a66597.h>
20#include <linux/i2c.h>
21#include <linux/input.h>
22#include <video/sh_mobile_lcdc.h>
23#include <media/sh_mobile_ceu.h>
24#include <asm/heartbeat.h>
25#include <asm/sh_eth.h>
26#include <asm/sh_keysc.h>
27#include <asm/clock.h>
28#include <cpu/sh7724.h>
29
30/*
31 * Address Interface BusWidth
32 *-----------------------------------------
33 * 0x0000_0000 uboot 16bit
34 * 0x0004_0000 Linux romImage 16bit
35 * 0x0014_0000 MTD for Linux 16bit
36 * 0x0400_0000 Internal I/O 16/32bit
37 * 0x0800_0000 DRAM 32bit
38 * 0x1800_0000 MFI 16bit
39 */
40
41/* Heartbeat */
42static unsigned char led_pos[] = { 0, 1, 2, 3 };
43static struct heartbeat_data heartbeat_data = {
44 .regsize = 8,
45 .nr_bits = 4,
46 .bit_pos = led_pos,
47};
48
49static struct resource heartbeat_resources[] = {
50 [0] = {
51 .start = 0xA405012C, /* PTG */
52 .end = 0xA405012E - 1,
53 .flags = IORESOURCE_MEM,
54 },
55};
56
57static struct platform_device heartbeat_device = {
58 .name = "heartbeat",
59 .id = -1,
60 .dev = {
61 .platform_data = &heartbeat_data,
62 },
63 .num_resources = ARRAY_SIZE(heartbeat_resources),
64 .resource = heartbeat_resources,
65};
66
67/* MTD */
68static struct mtd_partition nor_flash_partitions[] = {
69 {
70 .name = "boot loader",
71 .offset = 0,
72 .size = (5 * 1024 * 1024),
73 .mask_flags = MTD_CAP_ROM,
74 }, {
75 .name = "free-area",
76 .offset = MTDPART_OFS_APPEND,
77 .size = MTDPART_SIZ_FULL,
78 },
79};
80
81static struct physmap_flash_data nor_flash_data = {
82 .width = 2,
83 .parts = nor_flash_partitions,
84 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
85};
86
87static struct resource nor_flash_resources[] = {
88 [0] = {
89 .name = "NOR Flash",
90 .start = 0x00000000,
91 .end = 0x03ffffff,
92 .flags = IORESOURCE_MEM,
93 }
94};
95
96static struct platform_device nor_flash_device = {
97 .name = "physmap-flash",
98 .resource = nor_flash_resources,
99 .num_resources = ARRAY_SIZE(nor_flash_resources),
100 .dev = {
101 .platform_data = &nor_flash_data,
102 },
103};
104
105/* SH Eth */
106#define SH_ETH_ADDR (0xA4600000)
107#define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
108#define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
109static struct resource sh_eth_resources[] = {
110 [0] = {
111 .start = SH_ETH_ADDR,
112 .end = SH_ETH_ADDR + 0x1FC,
113 .flags = IORESOURCE_MEM,
114 },
115 [1] = {
116 .start = 91,
117 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
118 },
119};
120
121struct sh_eth_plat_data sh_eth_plat = {
122 .phy = 0x1f, /* SMSC LAN8700 */
123 .edmac_endian = EDMAC_LITTLE_ENDIAN,
124};
125
126static struct platform_device sh_eth_device = {
127 .name = "sh-eth",
128 .id = 0,
129 .dev = {
130 .platform_data = &sh_eth_plat,
131 },
132 .num_resources = ARRAY_SIZE(sh_eth_resources),
133 .resource = sh_eth_resources,
134};
135
136/* USB0 host */
137void usb0_port_power(int port, int power)
138{
139 gpio_set_value(GPIO_PTB4, power);
140}
141
142static struct r8a66597_platdata usb0_host_data = {
143 .on_chip = 1,
144 .port_power = usb0_port_power,
145};
146
147static struct resource usb0_host_resources[] = {
148 [0] = {
149 .start = 0xa4d80000,
150 .end = 0xa4d80124 - 1,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = 65,
155 .end = 65,
156 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
157 },
158};
159
160static struct platform_device usb0_host_device = {
161 .name = "r8a66597_hcd",
162 .id = 0,
163 .dev = {
164 .dma_mask = NULL, /* not use dma */
165 .coherent_dma_mask = 0xffffffff,
166 .platform_data = &usb0_host_data,
167 },
168 .num_resources = ARRAY_SIZE(usb0_host_resources),
169 .resource = usb0_host_resources,
170};
171
172/*
173 * USB1
174 *
175 * CN5 can use both host/function,
176 * and we can determine it by checking PTB[3]
177 *
178 * This time only USB1 host is supported.
179 */
180void usb1_port_power(int port, int power)
181{
182 if (!gpio_get_value(GPIO_PTB3)) {
183 printk(KERN_ERR "USB1 function is not supported\n");
184 return;
185 }
186
187 gpio_set_value(GPIO_PTB5, power);
188}
189
190static struct r8a66597_platdata usb1_host_data = {
191 .on_chip = 1,
192 .port_power = usb1_port_power,
193};
194
195static struct resource usb1_host_resources[] = {
196 [0] = {
197 .start = 0xa4d90000,
198 .end = 0xa4d90124 - 1,
199 .flags = IORESOURCE_MEM,
200 },
201 [1] = {
202 .start = 66,
203 .end = 66,
204 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
205 },
206};
207
208static struct platform_device usb1_host_device = {
209 .name = "r8a66597_hcd",
210 .id = 1,
211 .dev = {
212 .dma_mask = NULL, /* not use dma */
213 .coherent_dma_mask = 0xffffffff,
214 .platform_data = &usb1_host_data,
215 },
216 .num_resources = ARRAY_SIZE(usb1_host_resources),
217 .resource = usb1_host_resources,
218};
219
220/* LCDC */
221static struct sh_mobile_lcdc_info lcdc_info = {
222 .ch[0] = {
223 .interface_type = RGB18,
224 .chan = LCDC_CHAN_MAINLCD,
225 .bpp = 16,
226 .lcd_cfg = {
227 .sync = 0, /* hsync and vsync are active low */
228 },
229 .lcd_size_cfg = { /* 7.0 inch */
230 .width = 152,
231 .height = 91,
232 },
233 .board_cfg = {
234 },
235 }
236};
237
238static struct resource lcdc_resources[] = {
239 [0] = {
240 .name = "LCDC",
241 .start = 0xfe940000,
242 .end = 0xfe942fff,
243 .flags = IORESOURCE_MEM,
244 },
245 [1] = {
246 .start = 106,
247 .flags = IORESOURCE_IRQ,
248 },
249};
250
251static struct platform_device lcdc_device = {
252 .name = "sh_mobile_lcdc_fb",
253 .num_resources = ARRAY_SIZE(lcdc_resources),
254 .resource = lcdc_resources,
255 .dev = {
256 .platform_data = &lcdc_info,
257 },
258 .archdata = {
259 .hwblk_id = HWBLK_LCDC,
260 },
261};
262
263/* CEU0 */
264static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
265 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
266};
267
268static struct resource ceu0_resources[] = {
269 [0] = {
270 .name = "CEU0",
271 .start = 0xfe910000,
272 .end = 0xfe91009f,
273 .flags = IORESOURCE_MEM,
274 },
275 [1] = {
276 .start = 52,
277 .flags = IORESOURCE_IRQ,
278 },
279 [2] = {
280 /* place holder for contiguous memory */
281 },
282};
283
284static struct platform_device ceu0_device = {
285 .name = "sh_mobile_ceu",
286 .id = 0, /* "ceu0" clock */
287 .num_resources = ARRAY_SIZE(ceu0_resources),
288 .resource = ceu0_resources,
289 .dev = {
290 .platform_data = &sh_mobile_ceu0_info,
291 },
292 .archdata = {
293 .hwblk_id = HWBLK_CEU0,
294 },
295};
296
297/* CEU1 */
298static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
299 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
300};
301
302static struct resource ceu1_resources[] = {
303 [0] = {
304 .name = "CEU1",
305 .start = 0xfe914000,
306 .end = 0xfe91409f,
307 .flags = IORESOURCE_MEM,
308 },
309 [1] = {
310 .start = 63,
311 .flags = IORESOURCE_IRQ,
312 },
313 [2] = {
314 /* place holder for contiguous memory */
315 },
316};
317
318static struct platform_device ceu1_device = {
319 .name = "sh_mobile_ceu",
320 .id = 1, /* "ceu1" clock */
321 .num_resources = ARRAY_SIZE(ceu1_resources),
322 .resource = ceu1_resources,
323 .dev = {
324 .platform_data = &sh_mobile_ceu1_info,
325 },
326 .archdata = {
327 .hwblk_id = HWBLK_CEU1,
328 },
329};
330
331/* I2C device */
332static struct i2c_board_info i2c1_devices[] = {
333 {
334 I2C_BOARD_INFO("r2025sd", 0x32),
335 },
336};
337
338/* KEYSC */
339static struct sh_keysc_info keysc_info = {
340 .mode = SH_KEYSC_MODE_1,
341 .scan_timing = 3,
342 .delay = 50,
343 .kycr2_delay = 100,
344 .keycodes = { KEY_1, 0, 0, 0, 0,
345 KEY_2, 0, 0, 0, 0,
346 KEY_3, 0, 0, 0, 0,
347 KEY_4, 0, 0, 0, 0,
348 KEY_5, 0, 0, 0, 0,
349 KEY_6, 0, 0, 0, 0, },
350};
351
352static struct resource keysc_resources[] = {
353 [0] = {
354 .name = "KEYSC",
355 .start = 0x044b0000,
356 .end = 0x044b000f,
357 .flags = IORESOURCE_MEM,
358 },
359 [1] = {
360 .start = 79,
361 .flags = IORESOURCE_IRQ,
362 },
363};
364
365static struct platform_device keysc_device = {
366 .name = "sh_keysc",
367 .id = 0, /* keysc0 clock */
368 .num_resources = ARRAY_SIZE(keysc_resources),
369 .resource = keysc_resources,
370 .dev = {
371 .platform_data = &keysc_info,
372 },
373 .archdata = {
374 .hwblk_id = HWBLK_KEYSC,
375 },
376};
377
378static struct platform_device *ecovec_devices[] __initdata = {
379 &heartbeat_device,
380 &nor_flash_device,
381 &sh_eth_device,
382 &usb0_host_device,
383 &usb1_host_device, /* USB1 host support */
384 &lcdc_device,
385 &ceu0_device,
386 &ceu1_device,
387 &keysc_device,
388};
389
390#define EEPROM_ADDR 0x50
391static u8 mac_read(struct i2c_adapter *a, u8 command)
392{
393 struct i2c_msg msg[2];
394 u8 buf;
395 int ret;
396
397 msg[0].addr = EEPROM_ADDR;
398 msg[0].flags = 0;
399 msg[0].len = 1;
400 msg[0].buf = &command;
401
402 msg[1].addr = EEPROM_ADDR;
403 msg[1].flags = I2C_M_RD;
404 msg[1].len = 1;
405 msg[1].buf = &buf;
406
407 ret = i2c_transfer(a, msg, 2);
408 if (ret < 0) {
409 printk(KERN_ERR "error %d\n", ret);
410 buf = 0xff;
411 }
412
413 return buf;
414}
415
416#define MAC_LEN 6
417static void __init sh_eth_init(void)
418{
419 struct i2c_adapter *a = i2c_get_adapter(1);
420 struct clk *eth_clk;
421 u8 mac[MAC_LEN];
422 int i;
423
424 if (!a) {
425 pr_err("can not get I2C 1\n");
426 return;
427 }
428
429 eth_clk = clk_get(NULL, "eth0");
430 if (!eth_clk) {
431 pr_err("can not get eth0 clk\n");
432 return;
433 }
434
435 /* read MAC address frome EEPROM */
436 for (i = 0; i < MAC_LEN; i++) {
437 mac[i] = mac_read(a, 0x10 + i);
438 msleep(10);
439 }
440
441 /* clock enable */
442 clk_enable(eth_clk);
443
444 /* reset sh-eth */
445 ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
446
447 /* set MAC addr */
448 ctrl_outl((mac[0] << 24) |
449 (mac[1] << 16) |
450 (mac[2] << 8) |
451 (mac[3] << 0), SH_ETH_MAHR);
452 ctrl_outl((mac[4] << 8) |
453 (mac[5] << 0), SH_ETH_MALR);
454
455 clk_put(eth_clk);
456}
457
458#define PORT_HIZA 0xA4050158
459#define IODRIVEA 0xA405018A
460static int __init arch_setup(void)
461{
462 /* enable SCIFA0 */
463 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
464 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
465
466 /* enable debug LED */
467 gpio_request(GPIO_PTG0, NULL);
468 gpio_request(GPIO_PTG1, NULL);
469 gpio_request(GPIO_PTG2, NULL);
470 gpio_request(GPIO_PTG3, NULL);
471 gpio_direction_output(GPIO_PTG0, 0);
472 gpio_direction_output(GPIO_PTG1, 0);
473 gpio_direction_output(GPIO_PTG2, 0);
474 gpio_direction_output(GPIO_PTG3, 0);
475 ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
476
477 /* enable SH-Eth */
478 gpio_request(GPIO_PTA1, NULL);
479 gpio_direction_output(GPIO_PTA1, 1);
480 mdelay(20);
481
482 gpio_request(GPIO_FN_RMII_RXD0, NULL);
483 gpio_request(GPIO_FN_RMII_RXD1, NULL);
484 gpio_request(GPIO_FN_RMII_TXD0, NULL);
485 gpio_request(GPIO_FN_RMII_TXD1, NULL);
486 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
487 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
488 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
489 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
490 gpio_request(GPIO_FN_MDIO, NULL);
491 gpio_request(GPIO_FN_MDC, NULL);
492 gpio_request(GPIO_FN_LNKSTA, NULL);
493
494 /* enable USB */
495 ctrl_outw(0x0000, 0xA4D80000);
496 ctrl_outw(0x0000, 0xA4D90000);
497 gpio_request(GPIO_PTB3, NULL);
498 gpio_request(GPIO_PTB4, NULL);
499 gpio_request(GPIO_PTB5, NULL);
500 gpio_direction_input(GPIO_PTB3);
501 gpio_direction_output(GPIO_PTB4, 0);
502 gpio_direction_output(GPIO_PTB5, 0);
503 ctrl_outw(0x0600, 0xa40501d4);
504 ctrl_outw(0x0600, 0xa4050192);
505
506 /* enable LCDC */
507 gpio_request(GPIO_FN_LCDD23, NULL);
508 gpio_request(GPIO_FN_LCDD22, NULL);
509 gpio_request(GPIO_FN_LCDD21, NULL);
510 gpio_request(GPIO_FN_LCDD20, NULL);
511 gpio_request(GPIO_FN_LCDD19, NULL);
512 gpio_request(GPIO_FN_LCDD18, NULL);
513 gpio_request(GPIO_FN_LCDD17, NULL);
514 gpio_request(GPIO_FN_LCDD16, NULL);
515 gpio_request(GPIO_FN_LCDD15, NULL);
516 gpio_request(GPIO_FN_LCDD14, NULL);
517 gpio_request(GPIO_FN_LCDD13, NULL);
518 gpio_request(GPIO_FN_LCDD12, NULL);
519 gpio_request(GPIO_FN_LCDD11, NULL);
520 gpio_request(GPIO_FN_LCDD10, NULL);
521 gpio_request(GPIO_FN_LCDD9, NULL);
522 gpio_request(GPIO_FN_LCDD8, NULL);
523 gpio_request(GPIO_FN_LCDD7, NULL);
524 gpio_request(GPIO_FN_LCDD6, NULL);
525 gpio_request(GPIO_FN_LCDD5, NULL);
526 gpio_request(GPIO_FN_LCDD4, NULL);
527 gpio_request(GPIO_FN_LCDD3, NULL);
528 gpio_request(GPIO_FN_LCDD2, NULL);
529 gpio_request(GPIO_FN_LCDD1, NULL);
530 gpio_request(GPIO_FN_LCDD0, NULL);
531 gpio_request(GPIO_FN_LCDDISP, NULL);
532 gpio_request(GPIO_FN_LCDHSYN, NULL);
533 gpio_request(GPIO_FN_LCDDCK, NULL);
534 gpio_request(GPIO_FN_LCDVSYN, NULL);
535 gpio_request(GPIO_FN_LCDDON, NULL);
536 gpio_request(GPIO_FN_LCDLCLK, NULL);
537 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
538
539 gpio_request(GPIO_PTE6, NULL);
540 gpio_request(GPIO_PTU1, NULL);
541 gpio_request(GPIO_PTR1, NULL);
542 gpio_request(GPIO_PTA2, NULL);
543 gpio_direction_input(GPIO_PTE6);
544 gpio_direction_output(GPIO_PTU1, 0);
545 gpio_direction_output(GPIO_PTR1, 0);
546 gpio_direction_output(GPIO_PTA2, 0);
547
548 /* I/O buffer drive ability is low */
549 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0040 , IODRIVEA);
550
551 if (gpio_get_value(GPIO_PTE6)) {
552 /* DVI */
553 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
554 lcdc_info.ch[0].clock_divider = 1,
555 lcdc_info.ch[0].lcd_cfg.name = "DVI";
556 lcdc_info.ch[0].lcd_cfg.xres = 1280;
557 lcdc_info.ch[0].lcd_cfg.yres = 720;
558 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
559 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
560 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
561 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
562 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
563 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
564
565 gpio_set_value(GPIO_PTA2, 1);
566 gpio_set_value(GPIO_PTU1, 1);
567 } else {
568 /* Panel */
569
570 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
571 lcdc_info.ch[0].clock_divider = 2,
572 lcdc_info.ch[0].lcd_cfg.name = "Panel";
573 lcdc_info.ch[0].lcd_cfg.xres = 800;
574 lcdc_info.ch[0].lcd_cfg.yres = 480;
575 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
576 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
577 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
578 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
579 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
580 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
581
582 gpio_set_value(GPIO_PTR1, 1);
583
584 /* FIXME
585 *
586 * LCDDON control is needed for Panel,
587 * but current sh_mobile_lcdc driver doesn't control it.
588 * It is temporary correspondence
589 */
590 gpio_request(GPIO_PTF4, NULL);
591 gpio_direction_output(GPIO_PTF4, 1);
592 }
593
594 /* enable CEU0 */
595 gpio_request(GPIO_FN_VIO0_D15, NULL);
596 gpio_request(GPIO_FN_VIO0_D14, NULL);
597 gpio_request(GPIO_FN_VIO0_D13, NULL);
598 gpio_request(GPIO_FN_VIO0_D12, NULL);
599 gpio_request(GPIO_FN_VIO0_D11, NULL);
600 gpio_request(GPIO_FN_VIO0_D10, NULL);
601 gpio_request(GPIO_FN_VIO0_D9, NULL);
602 gpio_request(GPIO_FN_VIO0_D8, NULL);
603 gpio_request(GPIO_FN_VIO0_D7, NULL);
604 gpio_request(GPIO_FN_VIO0_D6, NULL);
605 gpio_request(GPIO_FN_VIO0_D5, NULL);
606 gpio_request(GPIO_FN_VIO0_D4, NULL);
607 gpio_request(GPIO_FN_VIO0_D3, NULL);
608 gpio_request(GPIO_FN_VIO0_D2, NULL);
609 gpio_request(GPIO_FN_VIO0_D1, NULL);
610 gpio_request(GPIO_FN_VIO0_D0, NULL);
611 gpio_request(GPIO_FN_VIO0_VD, NULL);
612 gpio_request(GPIO_FN_VIO0_CLK, NULL);
613 gpio_request(GPIO_FN_VIO0_FLD, NULL);
614 gpio_request(GPIO_FN_VIO0_HD, NULL);
615 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
616
617 /* enable CEU1 */
618 gpio_request(GPIO_FN_VIO1_D7, NULL);
619 gpio_request(GPIO_FN_VIO1_D6, NULL);
620 gpio_request(GPIO_FN_VIO1_D5, NULL);
621 gpio_request(GPIO_FN_VIO1_D4, NULL);
622 gpio_request(GPIO_FN_VIO1_D3, NULL);
623 gpio_request(GPIO_FN_VIO1_D2, NULL);
624 gpio_request(GPIO_FN_VIO1_D1, NULL);
625 gpio_request(GPIO_FN_VIO1_D0, NULL);
626 gpio_request(GPIO_FN_VIO1_FLD, NULL);
627 gpio_request(GPIO_FN_VIO1_HD, NULL);
628 gpio_request(GPIO_FN_VIO1_VD, NULL);
629 gpio_request(GPIO_FN_VIO1_CLK, NULL);
630 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
631
632 /* enable KEYSC */
633 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
634 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
635 gpio_request(GPIO_FN_KEYOUT3, NULL);
636 gpio_request(GPIO_FN_KEYOUT2, NULL);
637 gpio_request(GPIO_FN_KEYOUT1, NULL);
638 gpio_request(GPIO_FN_KEYOUT0, NULL);
639 gpio_request(GPIO_FN_KEYIN0, NULL);
640
641 /* enable user debug switch */
642 gpio_request(GPIO_PTR0, NULL);
643 gpio_request(GPIO_PTR4, NULL);
644 gpio_request(GPIO_PTR5, NULL);
645 gpio_request(GPIO_PTR6, NULL);
646 gpio_direction_input(GPIO_PTR0);
647 gpio_direction_input(GPIO_PTR4);
648 gpio_direction_input(GPIO_PTR5);
649 gpio_direction_input(GPIO_PTR6);
650
651 /* enable I2C device */
652 i2c_register_board_info(1, i2c1_devices,
653 ARRAY_SIZE(i2c1_devices));
654
655 return platform_add_devices(ecovec_devices,
656 ARRAY_SIZE(ecovec_devices));
657}
658arch_initcall(arch_setup);
659
660static int __init devices_setup(void)
661{
662 sh_eth_init();
663 return 0;
664}
665device_initcall(devices_setup);
666
667
668static struct sh_machine_vector mv_ecovec __initmv = {
669 .mv_name = "R0P7724 (EcoVec)",
670};
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index 1639f8915000..566e69d8d729 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -22,6 +22,7 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/usb/r8a66597.h> 24#include <linux/usb/r8a66597.h>
25#include <linux/usb/m66592.h>
25#include <net/ax88796.h> 26#include <net/ax88796.h>
26#include <asm/machvec.h> 27#include <asm/machvec.h>
27#include <mach/highlander.h> 28#include <mach/highlander.h>
@@ -60,6 +61,11 @@ static struct platform_device r8a66597_usb_host_device = {
60 .resource = r8a66597_usb_host_resources, 61 .resource = r8a66597_usb_host_resources,
61}; 62};
62 63
64static struct m66592_platdata usbf_platdata = {
65 .xtal = M66592_PLATDATA_XTAL_24MHZ,
66 .vif = 1,
67};
68
63static struct resource m66592_usb_peripheral_resources[] = { 69static struct resource m66592_usb_peripheral_resources[] = {
64 [0] = { 70 [0] = {
65 .name = "m66592_udc", 71 .name = "m66592_udc",
@@ -81,6 +87,7 @@ static struct platform_device m66592_usb_peripheral_device = {
81 .dev = { 87 .dev = {
82 .dma_mask = NULL, /* don't use dma */ 88 .dma_mask = NULL, /* don't use dma */
83 .coherent_dma_mask = 0xffffffff, 89 .coherent_dma_mask = 0xffffffff,
90 .platform_data = &usbf_platdata,
84 }, 91 },
85 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), 92 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
86 .resource = m66592_usb_peripheral_resources, 93 .resource = m66592_usb_peripheral_resources,
diff --git a/arch/sh/boards/mach-kfr2r09/Makefile b/arch/sh/boards/mach-kfr2r09/Makefile
new file mode 100644
index 000000000000..5d5867826e3b
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/Makefile
@@ -0,0 +1,2 @@
1obj-y := setup.o
2obj-$(CONFIG_FB_SH_MOBILE_LCDC) += lcd_wqvga.o
diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
new file mode 100644
index 000000000000..8ccb1cc8b589
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
@@ -0,0 +1,332 @@
1/*
2 * KFR2R09 LCD panel support
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * Register settings based on the out-of-tree t33fb.c driver
7 * Copyright (C) 2008 Lineo Solutions, Inc.
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file COPYING in the main directory of this archive for
11 * more details.
12 */
13
14#include <linux/delay.h>
15#include <linux/err.h>
16#include <linux/fb.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/gpio.h>
21#include <video/sh_mobile_lcdc.h>
22#include <mach/kfr2r09.h>
23#include <cpu/sh7724.h>
24
25/* The on-board LCD module is a Hitachi TX07D34VM0AAA. This module is made
26 * up of a 240x400 LCD hooked up to a R61517 driver IC. The driver IC is
27 * communicating with the main port of the LCDC using an 18-bit SYS interface.
28 *
29 * The device code for this LCD module is 0x01221517.
30 */
31
32static const unsigned char data_frame_if[] = {
33 0x02, /* WEMODE: 1=cont, 0=one-shot */
34 0x00, 0x00,
35 0x00, /* EPF, DFM */
36 0x02, /* RIM[1] : 1 (18bpp) */
37};
38
39static const unsigned char data_panel[] = {
40 0x0b,
41 0x63, /* 400 lines */
42 0x04, 0x00, 0x00, 0x04, 0x11, 0x00, 0x00,
43};
44
45static const unsigned char data_timing[] = {
46 0x00, 0x00, 0x13, 0x08, 0x08,
47};
48
49static const unsigned char data_timing_src[] = {
50 0x11, 0x01, 0x00, 0x01,
51};
52
53static const unsigned char data_gamma[] = {
54 0x01, 0x02, 0x08, 0x23, 0x03, 0x0c, 0x00, 0x06, 0x00, 0x00,
55 0x01, 0x00, 0x0c, 0x23, 0x03, 0x08, 0x02, 0x06, 0x00, 0x00,
56};
57
58static const unsigned char data_power[] = {
59 0x07, 0xc5, 0xdc, 0x02, 0x33, 0x0a,
60};
61
62static unsigned long read_reg(void *sohandle,
63 struct sh_mobile_lcdc_sys_bus_ops *so)
64{
65 return so->read_data(sohandle);
66}
67
68static void write_reg(void *sohandle,
69 struct sh_mobile_lcdc_sys_bus_ops *so,
70 int i, unsigned long v)
71{
72 if (i)
73 so->write_data(sohandle, v); /* PTH4/LCDRS High [param, 17:0] */
74 else
75 so->write_index(sohandle, v); /* PTH4/LCDRS Low [cmd, 7:0] */
76}
77
78static void write_data(void *sohandle,
79 struct sh_mobile_lcdc_sys_bus_ops *so,
80 unsigned char const *data, int no_data)
81{
82 int i;
83
84 for (i = 0; i < no_data; i++)
85 write_reg(sohandle, so, 1, data[i]);
86}
87
88static unsigned long read_device_code(void *sohandle,
89 struct sh_mobile_lcdc_sys_bus_ops *so)
90{
91 unsigned long device_code;
92
93 /* access protect OFF */
94 write_reg(sohandle, so, 0, 0xb0);
95 write_reg(sohandle, so, 1, 0x00);
96
97 /* deep standby OFF */
98 write_reg(sohandle, so, 0, 0xb1);
99 write_reg(sohandle, so, 1, 0x00);
100
101 /* device code command */
102 write_reg(sohandle, so, 0, 0xbf);
103 mdelay(50);
104
105 /* dummy read */
106 read_reg(sohandle, so);
107
108 /* read device code */
109 device_code = ((read_reg(sohandle, so) & 0xff) << 24);
110 device_code |= ((read_reg(sohandle, so) & 0xff) << 16);
111 device_code |= ((read_reg(sohandle, so) & 0xff) << 8);
112 device_code |= (read_reg(sohandle, so) & 0xff);
113
114 return device_code;
115}
116
117static void write_memory_start(void *sohandle,
118 struct sh_mobile_lcdc_sys_bus_ops *so)
119{
120 write_reg(sohandle, so, 0, 0x2c);
121}
122
123static void clear_memory(void *sohandle,
124 struct sh_mobile_lcdc_sys_bus_ops *so)
125{
126 int i;
127
128 /* write start */
129 write_memory_start(sohandle, so);
130
131 /* paint it black */
132 for (i = 0; i < (240 * 400); i++)
133 write_reg(sohandle, so, 1, 0x00);
134}
135
136static void display_on(void *sohandle,
137 struct sh_mobile_lcdc_sys_bus_ops *so)
138{
139 /* access protect off */
140 write_reg(sohandle, so, 0, 0xb0);
141 write_reg(sohandle, so, 1, 0x00);
142
143 /* exit deep standby mode */
144 write_reg(sohandle, so, 0, 0xb1);
145 write_reg(sohandle, so, 1, 0x00);
146
147 /* frame memory I/F */
148 write_reg(sohandle, so, 0, 0xb3);
149 write_data(sohandle, so, data_frame_if, ARRAY_SIZE(data_frame_if));
150
151 /* display mode and frame memory write mode */
152 write_reg(sohandle, so, 0, 0xb4);
153 write_reg(sohandle, so, 1, 0x00); /* DBI, internal clock */
154
155 /* panel */
156 write_reg(sohandle, so, 0, 0xc0);
157 write_data(sohandle, so, data_panel, ARRAY_SIZE(data_panel));
158
159 /* timing (normal) */
160 write_reg(sohandle, so, 0, 0xc1);
161 write_data(sohandle, so, data_timing, ARRAY_SIZE(data_timing));
162
163 /* timing (partial) */
164 write_reg(sohandle, so, 0, 0xc2);
165 write_data(sohandle, so, data_timing, ARRAY_SIZE(data_timing));
166
167 /* timing (idle) */
168 write_reg(sohandle, so, 0, 0xc3);
169 write_data(sohandle, so, data_timing, ARRAY_SIZE(data_timing));
170
171 /* timing (source/VCOM/gate driving) */
172 write_reg(sohandle, so, 0, 0xc4);
173 write_data(sohandle, so, data_timing_src, ARRAY_SIZE(data_timing_src));
174
175 /* gamma (red) */
176 write_reg(sohandle, so, 0, 0xc8);
177 write_data(sohandle, so, data_gamma, ARRAY_SIZE(data_gamma));
178
179 /* gamma (green) */
180 write_reg(sohandle, so, 0, 0xc9);
181 write_data(sohandle, so, data_gamma, ARRAY_SIZE(data_gamma));
182
183 /* gamma (blue) */
184 write_reg(sohandle, so, 0, 0xca);
185 write_data(sohandle, so, data_gamma, ARRAY_SIZE(data_gamma));
186
187 /* power (common) */
188 write_reg(sohandle, so, 0, 0xd0);
189 write_data(sohandle, so, data_power, ARRAY_SIZE(data_power));
190
191 /* VCOM */
192 write_reg(sohandle, so, 0, 0xd1);
193 write_reg(sohandle, so, 1, 0x00);
194 write_reg(sohandle, so, 1, 0x0f);
195 write_reg(sohandle, so, 1, 0x02);
196
197 /* power (normal) */
198 write_reg(sohandle, so, 0, 0xd2);
199 write_reg(sohandle, so, 1, 0x63);
200 write_reg(sohandle, so, 1, 0x24);
201
202 /* power (partial) */
203 write_reg(sohandle, so, 0, 0xd3);
204 write_reg(sohandle, so, 1, 0x63);
205 write_reg(sohandle, so, 1, 0x24);
206
207 /* power (idle) */
208 write_reg(sohandle, so, 0, 0xd4);
209 write_reg(sohandle, so, 1, 0x63);
210 write_reg(sohandle, so, 1, 0x24);
211
212 write_reg(sohandle, so, 0, 0xd8);
213 write_reg(sohandle, so, 1, 0x77);
214 write_reg(sohandle, so, 1, 0x77);
215
216 /* TE signal */
217 write_reg(sohandle, so, 0, 0x35);
218 write_reg(sohandle, so, 1, 0x00);
219
220 /* TE signal line */
221 write_reg(sohandle, so, 0, 0x44);
222 write_reg(sohandle, so, 1, 0x00);
223 write_reg(sohandle, so, 1, 0x00);
224
225 /* column address */
226 write_reg(sohandle, so, 0, 0x2a);
227 write_reg(sohandle, so, 1, 0x00);
228 write_reg(sohandle, so, 1, 0x00);
229 write_reg(sohandle, so, 1, 0x00);
230 write_reg(sohandle, so, 1, 0xef);
231
232 /* page address */
233 write_reg(sohandle, so, 0, 0x2b);
234 write_reg(sohandle, so, 1, 0x00);
235 write_reg(sohandle, so, 1, 0x00);
236 write_reg(sohandle, so, 1, 0x01);
237 write_reg(sohandle, so, 1, 0x8f);
238
239 /* exit sleep mode */
240 write_reg(sohandle, so, 0, 0x11);
241
242 mdelay(120);
243
244 /* clear vram */
245 clear_memory(sohandle, so);
246
247 /* display ON */
248 write_reg(sohandle, so, 0, 0x29);
249 mdelay(1);
250
251 write_memory_start(sohandle, so);
252}
253
254int kfr2r09_lcd_setup(void *board_data, void *sohandle,
255 struct sh_mobile_lcdc_sys_bus_ops *so)
256{
257 /* power on */
258 gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
259 gpio_set_value(GPIO_PTE4, 0); /* LCD_RST/ -> L */
260 gpio_set_value(GPIO_PTF4, 1); /* PROTECT/ -> H */
261 udelay(1100);
262 gpio_set_value(GPIO_PTE4, 1); /* LCD_RST/ -> H */
263 udelay(10);
264 gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
265 mdelay(20);
266
267 if (read_device_code(sohandle, so) != 0x01221517)
268 return -ENODEV;
269
270 pr_info("KFR2R09 WQVGA LCD Module detected.\n");
271
272 display_on(sohandle, so);
273 return 0;
274}
275
276#define CTRL_CKSW 0x10
277#define CTRL_C10 0x20
278#define CTRL_CPSW 0x80
279#define MAIN_MLED4 0x40
280#define MAIN_MSW 0x80
281
282static int kfr2r09_lcd_backlight(int on)
283{
284 struct i2c_adapter *a;
285 struct i2c_msg msg;
286 unsigned char buf[2];
287 int ret;
288
289 a = i2c_get_adapter(0);
290 if (!a)
291 return -ENODEV;
292
293 buf[0] = 0x00;
294 if (on)
295 buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
296 else
297 buf[1] = 0;
298
299 msg.addr = 0x75;
300 msg.buf = buf;
301 msg.len = 2;
302 msg.flags = 0;
303 ret = i2c_transfer(a, &msg, 1);
304 if (ret != 1)
305 return -ENODEV;
306
307 buf[0] = 0x01;
308 if (on)
309 buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
310 else
311 buf[1] = 0;
312
313 msg.addr = 0x75;
314 msg.buf = buf;
315 msg.len = 2;
316 msg.flags = 0;
317 ret = i2c_transfer(a, &msg, 1);
318 if (ret != 1)
319 return -ENODEV;
320
321 return 0;
322}
323
324void kfr2r09_lcd_on(void *board_data)
325{
326 kfr2r09_lcd_backlight(1);
327}
328
329void kfr2r09_lcd_off(void *board_data)
330{
331 kfr2r09_lcd_backlight(0);
332}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
new file mode 100644
index 000000000000..c08d33fe2104
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -0,0 +1,386 @@
1/*
2 * KFR2R09 board support code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
13#include <linux/mtd/physmap.h>
14#include <linux/mtd/onenand.h>
15#include <linux/delay.h>
16#include <linux/clk.h>
17#include <linux/gpio.h>
18#include <linux/input.h>
19#include <linux/i2c.h>
20#include <linux/usb/r8a66597.h>
21#include <video/sh_mobile_lcdc.h>
22#include <asm/clock.h>
23#include <asm/machvec.h>
24#include <asm/io.h>
25#include <asm/sh_keysc.h>
26#include <cpu/sh7724.h>
27#include <mach/kfr2r09.h>
28
29static struct mtd_partition kfr2r09_nor_flash_partitions[] =
30{
31 {
32 .name = "boot",
33 .offset = 0,
34 .size = (4 * 1024 * 1024),
35 .mask_flags = MTD_WRITEABLE, /* Read-only */
36 },
37 {
38 .name = "other",
39 .offset = MTDPART_OFS_APPEND,
40 .size = MTDPART_SIZ_FULL,
41 },
42};
43
44static struct physmap_flash_data kfr2r09_nor_flash_data = {
45 .width = 2,
46 .parts = kfr2r09_nor_flash_partitions,
47 .nr_parts = ARRAY_SIZE(kfr2r09_nor_flash_partitions),
48};
49
50static struct resource kfr2r09_nor_flash_resources[] = {
51 [0] = {
52 .name = "NOR Flash",
53 .start = 0x00000000,
54 .end = 0x03ffffff,
55 .flags = IORESOURCE_MEM,
56 }
57};
58
59static struct platform_device kfr2r09_nor_flash_device = {
60 .name = "physmap-flash",
61 .resource = kfr2r09_nor_flash_resources,
62 .num_resources = ARRAY_SIZE(kfr2r09_nor_flash_resources),
63 .dev = {
64 .platform_data = &kfr2r09_nor_flash_data,
65 },
66};
67
68static struct resource kfr2r09_nand_flash_resources[] = {
69 [0] = {
70 .name = "NAND Flash",
71 .start = 0x10000000,
72 .end = 0x1001ffff,
73 .flags = IORESOURCE_MEM,
74 }
75};
76
77static struct platform_device kfr2r09_nand_flash_device = {
78 .name = "onenand-flash",
79 .resource = kfr2r09_nand_flash_resources,
80 .num_resources = ARRAY_SIZE(kfr2r09_nand_flash_resources),
81};
82
83static struct sh_keysc_info kfr2r09_sh_keysc_info = {
84 .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */
85 .scan_timing = 3,
86 .delay = 10,
87 .keycodes = {
88 KEY_PHONE, KEY_CLEAR, KEY_MAIL, KEY_WWW, KEY_ENTER,
89 KEY_1, KEY_2, KEY_3, 0, KEY_UP,
90 KEY_4, KEY_5, KEY_6, 0, KEY_LEFT,
91 KEY_7, KEY_8, KEY_9, KEY_PROG1, KEY_RIGHT,
92 KEY_S, KEY_0, KEY_P, KEY_PROG2, KEY_DOWN,
93 0, 0, 0, 0, 0
94 },
95};
96
97static struct resource kfr2r09_sh_keysc_resources[] = {
98 [0] = {
99 .name = "KEYSC",
100 .start = 0x044b0000,
101 .end = 0x044b000f,
102 .flags = IORESOURCE_MEM,
103 },
104 [1] = {
105 .start = 79,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110static struct platform_device kfr2r09_sh_keysc_device = {
111 .name = "sh_keysc",
112 .id = 0, /* "keysc0" clock */
113 .num_resources = ARRAY_SIZE(kfr2r09_sh_keysc_resources),
114 .resource = kfr2r09_sh_keysc_resources,
115 .dev = {
116 .platform_data = &kfr2r09_sh_keysc_info,
117 },
118 .archdata = {
119 .hwblk_id = HWBLK_KEYSC,
120 },
121};
122
123static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
124 .clock_source = LCDC_CLK_BUS,
125 .ch[0] = {
126 .chan = LCDC_CHAN_MAINLCD,
127 .bpp = 16,
128 .interface_type = SYS18,
129 .clock_divider = 6,
130 .flags = LCDC_FLAGS_DWPOL,
131 .lcd_cfg = {
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 .lcd_size_cfg = {
144 .width = 35,
145 .height = 58,
146 },
147 .board_cfg = {
148 .setup_sys = kfr2r09_lcd_setup,
149 .display_on = kfr2r09_lcd_on,
150 .display_off = kfr2r09_lcd_off,
151 },
152 .sys_bus_cfg = {
153 .ldmt2r = 0x07010904,
154 .ldmt3r = 0x14012914,
155 /* set 1s delay to encourage fsync() */
156 .deferred_io_msec = 1000,
157 },
158 }
159};
160
161static struct resource kfr2r09_sh_lcdc_resources[] = {
162 [0] = {
163 .name = "LCDC",
164 .start = 0xfe940000, /* P4-only space */
165 .end = 0xfe942fff,
166 .flags = IORESOURCE_MEM,
167 },
168 [1] = {
169 .start = 106,
170 .flags = IORESOURCE_IRQ,
171 },
172};
173
174static struct platform_device kfr2r09_sh_lcdc_device = {
175 .name = "sh_mobile_lcdc_fb",
176 .num_resources = ARRAY_SIZE(kfr2r09_sh_lcdc_resources),
177 .resource = kfr2r09_sh_lcdc_resources,
178 .dev = {
179 .platform_data = &kfr2r09_sh_lcdc_info,
180 },
181 .archdata = {
182 .hwblk_id = HWBLK_LCDC,
183 },
184};
185
186static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
187 .on_chip = 1,
188};
189
190static struct resource kfr2r09_usb0_gadget_resources[] = {
191 [0] = {
192 .start = 0x04d80000,
193 .end = 0x04d80123,
194 .flags = IORESOURCE_MEM,
195 },
196 [1] = {
197 .start = 65,
198 .end = 65,
199 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
200 },
201};
202
203static struct platform_device kfr2r09_usb0_gadget_device = {
204 .name = "r8a66597_udc",
205 .id = 0,
206 .dev = {
207 .dma_mask = NULL, /* not use dma */
208 .coherent_dma_mask = 0xffffffff,
209 .platform_data = &kfr2r09_usb0_gadget_data,
210 },
211 .num_resources = ARRAY_SIZE(kfr2r09_usb0_gadget_resources),
212 .resource = kfr2r09_usb0_gadget_resources,
213};
214
215static struct platform_device *kfr2r09_devices[] __initdata = {
216 &kfr2r09_nor_flash_device,
217 &kfr2r09_nand_flash_device,
218 &kfr2r09_sh_keysc_device,
219 &kfr2r09_sh_lcdc_device,
220};
221
222#define BSC_CS0BCR 0xfec10004
223#define BSC_CS0WCR 0xfec10024
224#define BSC_CS4BCR 0xfec10010
225#define BSC_CS4WCR 0xfec10030
226#define PORT_MSELCRB 0xa4050182
227
228#ifdef CONFIG_I2C
229static int kfr2r09_usb0_gadget_i2c_setup(void)
230{
231 struct i2c_adapter *a;
232 struct i2c_msg msg;
233 unsigned char buf[2];
234 int ret;
235
236 a = i2c_get_adapter(0);
237 if (!a)
238 return -ENODEV;
239
240 /* set bit 1 (the second bit) of chip at 0x09, register 0x13 */
241 buf[0] = 0x13;
242 msg.addr = 0x09;
243 msg.buf = buf;
244 msg.len = 1;
245 msg.flags = 0;
246 ret = i2c_transfer(a, &msg, 1);
247 if (ret != 1)
248 return -ENODEV;
249
250 buf[0] = 0;
251 msg.addr = 0x09;
252 msg.buf = buf;
253 msg.len = 1;
254 msg.flags = I2C_M_RD;
255 ret = i2c_transfer(a, &msg, 1);
256 if (ret != 1)
257 return -ENODEV;
258
259 buf[1] = buf[0] | (1 << 1);
260 buf[0] = 0x13;
261 msg.addr = 0x09;
262 msg.buf = buf;
263 msg.len = 2;
264 msg.flags = 0;
265 ret = i2c_transfer(a, &msg, 1);
266 if (ret != 1)
267 return -ENODEV;
268
269 return 0;
270}
271#else
272static int kfr2r09_usb0_gadget_i2c_setup(void)
273{
274 return -ENODEV;
275}
276#endif
277
278static int kfr2r09_usb0_gadget_setup(void)
279{
280 int plugged_in;
281
282 gpio_request(GPIO_PTN4, NULL); /* USB_DET */
283 gpio_direction_input(GPIO_PTN4);
284 plugged_in = gpio_get_value(GPIO_PTN4);
285 if (!plugged_in)
286 return -ENODEV; /* no cable plugged in */
287
288 if (kfr2r09_usb0_gadget_i2c_setup() != 0)
289 return -ENODEV; /* unable to configure using i2c */
290
291 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
292 gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
293 gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
294 gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
295 msleep(20); /* wait 20ms to let the clock settle */
296 clk_enable(clk_get(NULL, "usb0"));
297 ctrl_outw(0x0600, 0xa40501d4);
298
299 return 0;
300}
301
302static int __init kfr2r09_devices_setup(void)
303{
304 /* enable SCIF1 serial port for YC401 console support */
305 gpio_request(GPIO_FN_SCIF1_RXD, NULL);
306 gpio_request(GPIO_FN_SCIF1_TXD, NULL);
307
308 /* setup NOR flash at CS0 */
309 ctrl_outl(0x36db0400, BSC_CS0BCR);
310 ctrl_outl(0x00000500, BSC_CS0WCR);
311
312 /* setup NAND flash at CS4 */
313 ctrl_outl(0x36db0400, BSC_CS4BCR);
314 ctrl_outl(0x00000500, BSC_CS4WCR);
315
316 /* setup KEYSC pins */
317 gpio_request(GPIO_FN_KEYOUT0, NULL);
318 gpio_request(GPIO_FN_KEYOUT1, NULL);
319 gpio_request(GPIO_FN_KEYOUT2, NULL);
320 gpio_request(GPIO_FN_KEYOUT3, NULL);
321 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
322 gpio_request(GPIO_FN_KEYIN0, NULL);
323 gpio_request(GPIO_FN_KEYIN1, NULL);
324 gpio_request(GPIO_FN_KEYIN2, NULL);
325 gpio_request(GPIO_FN_KEYIN3, NULL);
326 gpio_request(GPIO_FN_KEYIN4, NULL);
327 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
328
329 /* setup LCDC pins for SYS panel */
330 gpio_request(GPIO_FN_LCDD17, NULL);
331 gpio_request(GPIO_FN_LCDD16, NULL);
332 gpio_request(GPIO_FN_LCDD15, NULL);
333 gpio_request(GPIO_FN_LCDD14, NULL);
334 gpio_request(GPIO_FN_LCDD13, NULL);
335 gpio_request(GPIO_FN_LCDD12, NULL);
336 gpio_request(GPIO_FN_LCDD11, NULL);
337 gpio_request(GPIO_FN_LCDD10, NULL);
338 gpio_request(GPIO_FN_LCDD9, NULL);
339 gpio_request(GPIO_FN_LCDD8, NULL);
340 gpio_request(GPIO_FN_LCDD7, NULL);
341 gpio_request(GPIO_FN_LCDD6, NULL);
342 gpio_request(GPIO_FN_LCDD5, NULL);
343 gpio_request(GPIO_FN_LCDD4, NULL);
344 gpio_request(GPIO_FN_LCDD3, NULL);
345 gpio_request(GPIO_FN_LCDD2, NULL);
346 gpio_request(GPIO_FN_LCDD1, NULL);
347 gpio_request(GPIO_FN_LCDD0, NULL);
348 gpio_request(GPIO_FN_LCDRS, NULL); /* LCD_RS */
349 gpio_request(GPIO_FN_LCDCS, NULL); /* LCD_CS/ */
350 gpio_request(GPIO_FN_LCDRD, NULL); /* LCD_RD/ */
351 gpio_request(GPIO_FN_LCDWR, NULL); /* LCD_WR/ */
352 gpio_request(GPIO_FN_LCDVSYN, NULL); /* LCD_VSYNC */
353 gpio_request(GPIO_PTE4, NULL); /* LCD_RST/ */
354 gpio_direction_output(GPIO_PTE4, 1);
355 gpio_request(GPIO_PTF4, NULL); /* PROTECT/ */
356 gpio_direction_output(GPIO_PTF4, 1);
357 gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */
358 gpio_direction_output(GPIO_PTU0, 1);
359
360 /* setup USB function */
361 if (kfr2r09_usb0_gadget_setup() == 0)
362 platform_device_register(&kfr2r09_usb0_gadget_device);
363
364 return platform_add_devices(kfr2r09_devices,
365 ARRAY_SIZE(kfr2r09_devices));
366}
367device_initcall(kfr2r09_devices_setup);
368
369/* Return the board specific boot mode pin configuration */
370static int kfr2r09_mode_pins(void)
371{
372 /* MD0=1, MD1=1, MD2=0: Clock Mode 3
373 * MD3=0: 16-bit Area0 Bus Width
374 * MD5=1: Little Endian
375 * MD8=1: Test Mode Disabled
376 */
377 return MODE_PIN0 | MODE_PIN1 | MODE_PIN5 | MODE_PIN8;
378}
379
380/*
381 * The Machine Vector
382 */
383static struct sh_machine_vector mv_kfr2r09 __initmv = {
384 .mv_name = "kfr2r09",
385 .mv_mode_pins = kfr2r09_mode_pins,
386};
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index f9b2e4df35b9..6ed1fd32369e 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -98,6 +98,9 @@ static struct platform_device sh_keysc_device = {
98 .dev = { 98 .dev = {
99 .platform_data = &sh_keysc_info, 99 .platform_data = &sh_keysc_info,
100 }, 100 },
101 .archdata = {
102 .hwblk_id = HWBLK_KEYSC,
103 },
101}; 104};
102 105
103static struct mtd_partition migor_nor_flash_partitions[] = 106static struct mtd_partition migor_nor_flash_partitions[] =
@@ -276,7 +279,7 @@ static struct resource migor_lcdc_resources[] = {
276 [0] = { 279 [0] = {
277 .name = "LCDC", 280 .name = "LCDC",
278 .start = 0xfe940000, /* P4-only space */ 281 .start = 0xfe940000, /* P4-only space */
279 .end = 0xfe941fff, 282 .end = 0xfe942fff,
280 .flags = IORESOURCE_MEM, 283 .flags = IORESOURCE_MEM,
281 }, 284 },
282 [1] = { 285 [1] = {
@@ -292,6 +295,9 @@ static struct platform_device migor_lcdc_device = {
292 .dev = { 295 .dev = {
293 .platform_data = &sh_mobile_lcdc_info, 296 .platform_data = &sh_mobile_lcdc_info,
294 }, 297 },
298 .archdata = {
299 .hwblk_id = HWBLK_LCDC,
300 },
295}; 301};
296 302
297static struct clk *camera_clk; 303static struct clk *camera_clk;
@@ -379,6 +385,9 @@ static struct platform_device migor_ceu_device = {
379 .dev = { 385 .dev = {
380 .platform_data = &sh_mobile_ceu_info, 386 .platform_data = &sh_mobile_ceu_info,
381 }, 387 },
388 .archdata = {
389 .hwblk_id = HWBLK_CEU,
390 },
382}; 391};
383 392
384struct spi_gpio_platform_data sdcard_cn9_platform_data = { 393struct spi_gpio_platform_data sdcard_cn9_platform_data = {
diff --git a/arch/sh/boards/mach-se/7722/setup.c b/arch/sh/boards/mach-se/7722/setup.c
index af84904ed86f..36374078e521 100644
--- a/arch/sh/boards/mach-se/7722/setup.c
+++ b/arch/sh/boards/mach-se/7722/setup.c
@@ -22,6 +22,7 @@
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/heartbeat.h> 23#include <asm/heartbeat.h>
24#include <asm/sh_keysc.h> 24#include <asm/sh_keysc.h>
25#include <cpu/sh7722.h>
25 26
26/* Heartbeat */ 27/* Heartbeat */
27static struct heartbeat_data heartbeat_data = { 28static struct heartbeat_data heartbeat_data = {
@@ -137,6 +138,9 @@ static struct platform_device sh_keysc_device = {
137 .dev = { 138 .dev = {
138 .platform_data = &sh_keysc_info, 139 .platform_data = &sh_keysc_info,
139 }, 140 },
141 .archdata = {
142 .hwblk_id = HWBLK_KEYSC,
143 },
140}; 144};
141 145
142static struct platform_device *se7722_devices[] __initdata = { 146static struct platform_device *se7722_devices[] __initdata = {
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 15456a0773bf..00973e0f8c63 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -39,7 +39,15 @@
39 * SW41 : abxx xxxx -> a = 0 : Analog monitor 39 * SW41 : abxx xxxx -> a = 0 : Analog monitor
40 * 1 : Digital monitor 40 * 1 : Digital monitor
41 * b = 0 : VGA 41 * b = 0 : VGA
42 * 1 : SVGA 42 * 1 : 720p
43 */
44
45/*
46 * about 720p
47 *
48 * When you use 1280 x 720 lcdc output,
49 * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz,
50 * and change SW41 to use 720p
43 */ 51 */
44 52
45/* Heartbeat */ 53/* Heartbeat */
@@ -158,7 +166,7 @@ static struct resource lcdc_resources[] = {
158 [0] = { 166 [0] = {
159 .name = "LCDC", 167 .name = "LCDC",
160 .start = 0xfe940000, 168 .start = 0xfe940000,
161 .end = 0xfe941fff, 169 .end = 0xfe942fff,
162 .flags = IORESOURCE_MEM, 170 .flags = IORESOURCE_MEM,
163 }, 171 },
164 [1] = { 172 [1] = {
@@ -174,6 +182,9 @@ static struct platform_device lcdc_device = {
174 .dev = { 182 .dev = {
175 .platform_data = &lcdc_info, 183 .platform_data = &lcdc_info,
176 }, 184 },
185 .archdata = {
186 .hwblk_id = HWBLK_LCDC,
187 },
177}; 188};
178 189
179/* CEU0 */ 190/* CEU0 */
@@ -205,6 +216,9 @@ static struct platform_device ceu0_device = {
205 .dev = { 216 .dev = {
206 .platform_data = &sh_mobile_ceu0_info, 217 .platform_data = &sh_mobile_ceu0_info,
207 }, 218 },
219 .archdata = {
220 .hwblk_id = HWBLK_CEU0,
221 },
208}; 222};
209 223
210/* CEU1 */ 224/* CEU1 */
@@ -236,6 +250,9 @@ static struct platform_device ceu1_device = {
236 .dev = { 250 .dev = {
237 .platform_data = &sh_mobile_ceu1_info, 251 .platform_data = &sh_mobile_ceu1_info,
238 }, 252 },
253 .archdata = {
254 .hwblk_id = HWBLK_CEU1,
255 },
239}; 256};
240 257
241/* KEYSC in SoC (Needs SW33-2 set to ON) */ 258/* KEYSC in SoC (Needs SW33-2 set to ON) */
@@ -274,6 +291,9 @@ static struct platform_device keysc_device = {
274 .dev = { 291 .dev = {
275 .platform_data = &keysc_info, 292 .platform_data = &keysc_info,
276 }, 293 },
294 .archdata = {
295 .hwblk_id = HWBLK_KEYSC,
296 },
277}; 297};
278 298
279/* SH Eth */ 299/* SH Eth */
@@ -302,15 +322,19 @@ static struct platform_device sh_eth_device = {
302 }, 322 },
303 .num_resources = ARRAY_SIZE(sh_eth_resources), 323 .num_resources = ARRAY_SIZE(sh_eth_resources),
304 .resource = sh_eth_resources, 324 .resource = sh_eth_resources,
325 .archdata = {
326 .hwblk_id = HWBLK_ETHER,
327 },
305}; 328};
306 329
307static struct r8a66597_platdata sh7724_usb0_host_data = { 330static struct r8a66597_platdata sh7724_usb0_host_data = {
331 .on_chip = 1,
308}; 332};
309 333
310static struct resource sh7724_usb0_host_resources[] = { 334static struct resource sh7724_usb0_host_resources[] = {
311 [0] = { 335 [0] = {
312 .start = 0xa4d80000, 336 .start = 0xa4d80000,
313 .end = 0xa4d800ff, 337 .end = 0xa4d80124 - 1,
314 .flags = IORESOURCE_MEM, 338 .flags = IORESOURCE_MEM,
315 }, 339 },
316 [1] = { 340 [1] = {
@@ -330,6 +354,38 @@ static struct platform_device sh7724_usb0_host_device = {
330 }, 354 },
331 .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources), 355 .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources),
332 .resource = sh7724_usb0_host_resources, 356 .resource = sh7724_usb0_host_resources,
357 .archdata = {
358 .hwblk_id = HWBLK_USB0,
359 },
360};
361
362static struct r8a66597_platdata sh7724_usb1_gadget_data = {
363 .on_chip = 1,
364};
365
366static struct resource sh7724_usb1_gadget_resources[] = {
367 [0] = {
368 .start = 0xa4d90000,
369 .end = 0xa4d90123,
370 .flags = IORESOURCE_MEM,
371 },
372 [1] = {
373 .start = 66,
374 .end = 66,
375 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
376 },
377};
378
379static struct platform_device sh7724_usb1_gadget_device = {
380 .name = "r8a66597_udc",
381 .id = 1, /* USB1 */
382 .dev = {
383 .dma_mask = NULL, /* not use dma */
384 .coherent_dma_mask = 0xffffffff,
385 .platform_data = &sh7724_usb1_gadget_data,
386 },
387 .num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources),
388 .resource = sh7724_usb1_gadget_resources,
333}; 389};
334 390
335static struct platform_device *ms7724se_devices[] __initdata = { 391static struct platform_device *ms7724se_devices[] __initdata = {
@@ -342,6 +398,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
342 &keysc_device, 398 &keysc_device,
343 &sh_eth_device, 399 &sh_eth_device,
344 &sh7724_usb0_host_device, 400 &sh7724_usb0_host_device,
401 &sh7724_usb1_gadget_device,
345}; 402};
346 403
347#define EEPROM_OP 0xBA206000 404#define EEPROM_OP 0xBA206000
@@ -421,9 +478,38 @@ static int __init devices_setup(void)
421 /* turn on USB clocks, use external clock */ 478 /* turn on USB clocks, use external clock */
422 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB); 479 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
423 480
481#ifdef CONFIG_PM
482 /* Let LED9 show STATUS2 */
483 gpio_request(GPIO_FN_STATUS2, NULL);
484
485 /* Lit LED10 show STATUS0 */
486 gpio_request(GPIO_FN_STATUS0, NULL);
487
488 /* Lit LED11 show PDSTATUS */
489 gpio_request(GPIO_FN_PDSTATUS, NULL);
490#else
491 /* Lit LED9 */
492 gpio_request(GPIO_PTJ6, NULL);
493 gpio_direction_output(GPIO_PTJ6, 1);
494 gpio_export(GPIO_PTJ6, 0);
495
496 /* Lit LED10 */
497 gpio_request(GPIO_PTJ5, NULL);
498 gpio_direction_output(GPIO_PTJ5, 1);
499 gpio_export(GPIO_PTJ5, 0);
500
501 /* Lit LED11 */
502 gpio_request(GPIO_PTJ7, NULL);
503 gpio_direction_output(GPIO_PTJ7, 1);
504 gpio_export(GPIO_PTJ7, 0);
505#endif
506
424 /* enable USB0 port */ 507 /* enable USB0 port */
425 ctrl_outw(0x0600, 0xa40501d4); 508 ctrl_outw(0x0600, 0xa40501d4);
426 509
510 /* enable USB1 port */
511 ctrl_outw(0x0600, 0xa4050192);
512
427 /* enable IRQ 0,1,2 */ 513 /* enable IRQ 0,1,2 */
428 gpio_request(GPIO_FN_INTC_IRQ0, NULL); 514 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
429 gpio_request(GPIO_FN_INTC_IRQ1, NULL); 515 gpio_request(GPIO_FN_INTC_IRQ1, NULL);
@@ -546,15 +632,15 @@ static int __init devices_setup(void)
546 sh_eth_init(); 632 sh_eth_init();
547 633
548 if (sw & SW41_B) { 634 if (sw & SW41_B) {
549 /* SVGA */ 635 /* 720p */
550 lcdc_info.ch[0].lcd_cfg.xres = 800; 636 lcdc_info.ch[0].lcd_cfg.xres = 1280;
551 lcdc_info.ch[0].lcd_cfg.yres = 600; 637 lcdc_info.ch[0].lcd_cfg.yres = 720;
552 lcdc_info.ch[0].lcd_cfg.left_margin = 142; 638 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
553 lcdc_info.ch[0].lcd_cfg.right_margin = 52; 639 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
554 lcdc_info.ch[0].lcd_cfg.hsync_len = 96; 640 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
555 lcdc_info.ch[0].lcd_cfg.upper_margin = 24; 641 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
556 lcdc_info.ch[0].lcd_cfg.lower_margin = 2; 642 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
557 lcdc_info.ch[0].lcd_cfg.vsync_len = 2; 643 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
558 } else { 644 } else {
559 /* VGA */ 645 /* VGA */
560 lcdc_info.ch[0].lcd_cfg.xres = 640; 646 lcdc_info.ch[0].lcd_cfg.xres = 640;
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index 8913ae39a802..efe4cb9f8a77 100644
--- a/arch/sh/boards/mach-x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
@@ -17,6 +17,7 @@
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/usb/r8a66597.h> 19#include <linux/usb/r8a66597.h>
20#include <linux/usb/m66592.h>
20#include <asm/ilsel.h> 21#include <asm/ilsel.h>
21 22
22static struct resource heartbeat_resources[] = { 23static struct resource heartbeat_resources[] = {
@@ -89,6 +90,11 @@ static struct platform_device r8a66597_usb_host_device = {
89 .resource = r8a66597_usb_host_resources, 90 .resource = r8a66597_usb_host_resources,
90}; 91};
91 92
93static struct m66592_platdata usbf_platdata = {
94 .xtal = M66592_PLATDATA_XTAL_24MHZ,
95 .vif = 1,
96};
97
92static struct resource m66592_usb_peripheral_resources[] = { 98static struct resource m66592_usb_peripheral_resources[] = {
93 [0] = { 99 [0] = {
94 .name = "m66592_udc", 100 .name = "m66592_udc",
@@ -109,6 +115,7 @@ static struct platform_device m66592_usb_peripheral_device = {
109 .dev = { 115 .dev = {
110 .dma_mask = NULL, /* don't use dma */ 116 .dma_mask = NULL, /* don't use dma */
111 .coherent_dma_mask = 0xffffffff, 117 .coherent_dma_mask = 0xffffffff,
118 .platform_data = &usbf_platdata,
112 }, 119 },
113 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), 120 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
114 .resource = m66592_usb_peripheral_resources, 121 .resource = m66592_usb_peripheral_resources,