setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. /*
  2. * linux/arch/sh/boards/se/7724/setup.c
  3. *
  4. * Copyright (C) 2009 Renesas Solutions Corp.
  5. *
  6. * Kuninori Morimoto <morimoto.kuninori@renesas.com>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/device.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <linux/delay.h>
  18. #include <linux/smc91x.h>
  19. #include <linux/gpio.h>
  20. #include <linux/input.h>
  21. #include <linux/usb/r8a66597.h>
  22. #include <video/sh_mobile_lcdc.h>
  23. #include <media/sh_mobile_ceu.h>
  24. #include <asm/io.h>
  25. #include <asm/heartbeat.h>
  26. #include <asm/sh_eth.h>
  27. #include <asm/clock.h>
  28. #include <asm/sh_keysc.h>
  29. #include <cpu/sh7724.h>
  30. #include <mach-se/mach/se7724.h>
  31. /*
  32. * SWx 1234 5678
  33. * ------------------------------------
  34. * SW31 : 1001 1100 : default
  35. * SW32 : 0111 1111 : use on board flash
  36. *
  37. * SW41 : abxx xxxx -> a = 0 : Analog monitor
  38. * 1 : Digital monitor
  39. * b = 0 : VGA
  40. * 1 : 720p
  41. */
  42. /*
  43. * about 720p
  44. *
  45. * When you use 1280 x 720 lcdc output,
  46. * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz,
  47. * and change SW41 to use 720p
  48. */
  49. /* Heartbeat */
  50. static struct heartbeat_data heartbeat_data = {
  51. .regsize = 16,
  52. };
  53. static struct resource heartbeat_resources[] = {
  54. [0] = {
  55. .start = PA_LED,
  56. .end = PA_LED,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. };
  60. static struct platform_device heartbeat_device = {
  61. .name = "heartbeat",
  62. .id = -1,
  63. .dev = {
  64. .platform_data = &heartbeat_data,
  65. },
  66. .num_resources = ARRAY_SIZE(heartbeat_resources),
  67. .resource = heartbeat_resources,
  68. };
  69. /* LAN91C111 */
  70. static struct smc91x_platdata smc91x_info = {
  71. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  72. };
  73. static struct resource smc91x_eth_resources[] = {
  74. [0] = {
  75. .name = "SMC91C111" ,
  76. .start = 0x1a300300,
  77. .end = 0x1a30030f,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .start = IRQ0_SMC,
  82. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  83. },
  84. };
  85. static struct platform_device smc91x_eth_device = {
  86. .name = "smc91x",
  87. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  88. .resource = smc91x_eth_resources,
  89. .dev = {
  90. .platform_data = &smc91x_info,
  91. },
  92. };
  93. /* MTD */
  94. static struct mtd_partition nor_flash_partitions[] = {
  95. {
  96. .name = "uboot",
  97. .offset = 0,
  98. .size = (1 * 1024 * 1024),
  99. .mask_flags = MTD_WRITEABLE, /* Read-only */
  100. }, {
  101. .name = "kernel",
  102. .offset = MTDPART_OFS_APPEND,
  103. .size = (2 * 1024 * 1024),
  104. }, {
  105. .name = "free-area",
  106. .offset = MTDPART_OFS_APPEND,
  107. .size = MTDPART_SIZ_FULL,
  108. },
  109. };
  110. static struct physmap_flash_data nor_flash_data = {
  111. .width = 2,
  112. .parts = nor_flash_partitions,
  113. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  114. };
  115. static struct resource nor_flash_resources[] = {
  116. [0] = {
  117. .name = "NOR Flash",
  118. .start = 0x00000000,
  119. .end = 0x01ffffff,
  120. .flags = IORESOURCE_MEM,
  121. }
  122. };
  123. static struct platform_device nor_flash_device = {
  124. .name = "physmap-flash",
  125. .resource = nor_flash_resources,
  126. .num_resources = ARRAY_SIZE(nor_flash_resources),
  127. .dev = {
  128. .platform_data = &nor_flash_data,
  129. },
  130. };
  131. /* LCDC */
  132. static struct sh_mobile_lcdc_info lcdc_info = {
  133. .clock_source = LCDC_CLK_EXTERNAL,
  134. .ch[0] = {
  135. .chan = LCDC_CHAN_MAINLCD,
  136. .bpp = 16,
  137. .clock_divider = 1,
  138. .lcd_cfg = {
  139. .name = "LB070WV1",
  140. .sync = 0, /* hsync and vsync are active low */
  141. },
  142. .lcd_size_cfg = { /* 7.0 inch */
  143. .width = 152,
  144. .height = 91,
  145. },
  146. .board_cfg = {
  147. },
  148. }
  149. };
  150. static struct resource lcdc_resources[] = {
  151. [0] = {
  152. .name = "LCDC",
  153. .start = 0xfe940000,
  154. .end = 0xfe941fff,
  155. .flags = IORESOURCE_MEM,
  156. },
  157. [1] = {
  158. .start = 106,
  159. .flags = IORESOURCE_IRQ,
  160. },
  161. };
  162. static struct platform_device lcdc_device = {
  163. .name = "sh_mobile_lcdc_fb",
  164. .num_resources = ARRAY_SIZE(lcdc_resources),
  165. .resource = lcdc_resources,
  166. .dev = {
  167. .platform_data = &lcdc_info,
  168. },
  169. };
  170. /* CEU0 */
  171. static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
  172. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  173. };
  174. static struct resource ceu0_resources[] = {
  175. [0] = {
  176. .name = "CEU0",
  177. .start = 0xfe910000,
  178. .end = 0xfe91009f,
  179. .flags = IORESOURCE_MEM,
  180. },
  181. [1] = {
  182. .start = 52,
  183. .flags = IORESOURCE_IRQ,
  184. },
  185. [2] = {
  186. /* place holder for contiguous memory */
  187. },
  188. };
  189. static struct platform_device ceu0_device = {
  190. .name = "sh_mobile_ceu",
  191. .id = 0, /* "ceu0" clock */
  192. .num_resources = ARRAY_SIZE(ceu0_resources),
  193. .resource = ceu0_resources,
  194. .dev = {
  195. .platform_data = &sh_mobile_ceu0_info,
  196. },
  197. };
  198. /* CEU1 */
  199. static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
  200. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  201. };
  202. static struct resource ceu1_resources[] = {
  203. [0] = {
  204. .name = "CEU1",
  205. .start = 0xfe914000,
  206. .end = 0xfe91409f,
  207. .flags = IORESOURCE_MEM,
  208. },
  209. [1] = {
  210. .start = 63,
  211. .flags = IORESOURCE_IRQ,
  212. },
  213. [2] = {
  214. /* place holder for contiguous memory */
  215. },
  216. };
  217. static struct platform_device ceu1_device = {
  218. .name = "sh_mobile_ceu",
  219. .id = 1, /* "ceu1" clock */
  220. .num_resources = ARRAY_SIZE(ceu1_resources),
  221. .resource = ceu1_resources,
  222. .dev = {
  223. .platform_data = &sh_mobile_ceu1_info,
  224. },
  225. };
  226. /* KEYSC in SoC (Needs SW33-2 set to ON) */
  227. static struct sh_keysc_info keysc_info = {
  228. .mode = SH_KEYSC_MODE_1,
  229. .scan_timing = 10,
  230. .delay = 50,
  231. .keycodes = {
  232. KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
  233. KEY_6, KEY_7, KEY_8, KEY_9, KEY_A,
  234. KEY_B, KEY_C, KEY_D, KEY_E, KEY_F,
  235. KEY_G, KEY_H, KEY_I, KEY_K, KEY_L,
  236. KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q,
  237. KEY_R, KEY_S, KEY_T, KEY_U, KEY_V,
  238. },
  239. };
  240. static struct resource keysc_resources[] = {
  241. [0] = {
  242. .name = "KEYSC",
  243. .start = 0x044b0000,
  244. .end = 0x044b000f,
  245. .flags = IORESOURCE_MEM,
  246. },
  247. [1] = {
  248. .start = 79,
  249. .flags = IORESOURCE_IRQ,
  250. },
  251. };
  252. static struct platform_device keysc_device = {
  253. .name = "sh_keysc",
  254. .id = 0, /* "keysc0" clock */
  255. .num_resources = ARRAY_SIZE(keysc_resources),
  256. .resource = keysc_resources,
  257. .dev = {
  258. .platform_data = &keysc_info,
  259. },
  260. };
  261. /* SH Eth */
  262. static struct resource sh_eth_resources[] = {
  263. [0] = {
  264. .start = SH_ETH_ADDR,
  265. .end = SH_ETH_ADDR + 0x1FC,
  266. .flags = IORESOURCE_MEM,
  267. },
  268. [1] = {
  269. .start = 91,
  270. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  271. },
  272. };
  273. struct sh_eth_plat_data sh_eth_plat = {
  274. .phy = 0x1f, /* SMSC LAN8187 */
  275. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  276. };
  277. static struct platform_device sh_eth_device = {
  278. .name = "sh-eth",
  279. .id = 0,
  280. .dev = {
  281. .platform_data = &sh_eth_plat,
  282. },
  283. .num_resources = ARRAY_SIZE(sh_eth_resources),
  284. .resource = sh_eth_resources,
  285. };
  286. static struct r8a66597_platdata sh7724_usb0_host_data = {
  287. .on_chip = 1,
  288. };
  289. static struct resource sh7724_usb0_host_resources[] = {
  290. [0] = {
  291. .start = 0xa4d80000,
  292. .end = 0xa4d80124 - 1,
  293. .flags = IORESOURCE_MEM,
  294. },
  295. [1] = {
  296. .start = 65,
  297. .end = 65,
  298. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  299. },
  300. };
  301. static struct platform_device sh7724_usb0_host_device = {
  302. .name = "r8a66597_hcd",
  303. .id = 0,
  304. .dev = {
  305. .dma_mask = NULL, /* not use dma */
  306. .coherent_dma_mask = 0xffffffff,
  307. .platform_data = &sh7724_usb0_host_data,
  308. },
  309. .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources),
  310. .resource = sh7724_usb0_host_resources,
  311. };
  312. static struct r8a66597_platdata sh7724_usb1_gadget_data = {
  313. .on_chip = 1,
  314. };
  315. static struct resource sh7724_usb1_gadget_resources[] = {
  316. [0] = {
  317. .start = 0xa4d90000,
  318. .end = 0xa4d90123,
  319. .flags = IORESOURCE_MEM,
  320. },
  321. [1] = {
  322. .start = 66,
  323. .end = 66,
  324. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  325. },
  326. };
  327. static struct platform_device sh7724_usb1_gadget_device = {
  328. .name = "r8a66597_udc",
  329. .id = 1, /* USB1 */
  330. .dev = {
  331. .dma_mask = NULL, /* not use dma */
  332. .coherent_dma_mask = 0xffffffff,
  333. .platform_data = &sh7724_usb1_gadget_data,
  334. },
  335. .num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources),
  336. .resource = sh7724_usb1_gadget_resources,
  337. };
  338. static struct platform_device *ms7724se_devices[] __initdata = {
  339. &heartbeat_device,
  340. &smc91x_eth_device,
  341. &lcdc_device,
  342. &nor_flash_device,
  343. &ceu0_device,
  344. &ceu1_device,
  345. &keysc_device,
  346. &sh_eth_device,
  347. &sh7724_usb0_host_device,
  348. &sh7724_usb1_gadget_device,
  349. };
  350. #define EEPROM_OP 0xBA206000
  351. #define EEPROM_ADR 0xBA206004
  352. #define EEPROM_DATA 0xBA20600C
  353. #define EEPROM_STAT 0xBA206010
  354. #define EEPROM_STRT 0xBA206014
  355. static int __init sh_eth_is_eeprom_ready(void)
  356. {
  357. int t = 10000;
  358. while (t--) {
  359. if (!ctrl_inw(EEPROM_STAT))
  360. return 1;
  361. cpu_relax();
  362. }
  363. printk(KERN_ERR "ms7724se can not access to eeprom\n");
  364. return 0;
  365. }
  366. static void __init sh_eth_init(void)
  367. {
  368. int i;
  369. u16 mac[3];
  370. /* check EEPROM status */
  371. if (!sh_eth_is_eeprom_ready())
  372. return;
  373. /* read MAC addr from EEPROM */
  374. for (i = 0 ; i < 3 ; i++) {
  375. ctrl_outw(0x0, EEPROM_OP); /* read */
  376. ctrl_outw(i*2, EEPROM_ADR);
  377. ctrl_outw(0x1, EEPROM_STRT);
  378. if (!sh_eth_is_eeprom_ready())
  379. return;
  380. mac[i] = ctrl_inw(EEPROM_DATA);
  381. mac[i] = ((mac[i] & 0xFF) << 8) | (mac[i] >> 8); /* swap */
  382. }
  383. /* reset sh-eth */
  384. ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
  385. /* set MAC addr */
  386. ctrl_outl(((mac[0] << 16) | (mac[1])), SH_ETH_MAHR);
  387. ctrl_outl((mac[2]), SH_ETH_MALR);
  388. }
  389. #define SW4140 0xBA201000
  390. #define FPGA_OUT 0xBA200400
  391. #define PORT_HIZA 0xA4050158
  392. #define PORT_MSELCRB 0xA4050182
  393. #define SW41_A 0x0100
  394. #define SW41_B 0x0200
  395. #define SW41_C 0x0400
  396. #define SW41_D 0x0800
  397. #define SW41_E 0x1000
  398. #define SW41_F 0x2000
  399. #define SW41_G 0x4000
  400. #define SW41_H 0x8000
  401. static int __init devices_setup(void)
  402. {
  403. u16 sw = ctrl_inw(SW4140); /* select camera, monitor */
  404. /* Reset Release */
  405. ctrl_outw(ctrl_inw(FPGA_OUT) &
  406. ~((1 << 1) | /* LAN */
  407. (1 << 6) | /* VIDEO DAC */
  408. (1 << 12) | /* USB0 */
  409. (1 << 14)), /* RMII */
  410. FPGA_OUT);
  411. /* turn on USB clocks, use external clock */
  412. ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
  413. #ifdef CONFIG_PM
  414. /* Let LED9 show STATUS2 */
  415. gpio_request(GPIO_FN_STATUS2, NULL);
  416. /* Lit LED10 show STATUS0 */
  417. gpio_request(GPIO_FN_STATUS0, NULL);
  418. /* Lit LED11 show PDSTATUS */
  419. gpio_request(GPIO_FN_PDSTATUS, NULL);
  420. #else
  421. /* Lit LED9 */
  422. gpio_request(GPIO_PTJ6, NULL);
  423. gpio_direction_output(GPIO_PTJ6, 1);
  424. gpio_export(GPIO_PTJ6, 0);
  425. /* Lit LED10 */
  426. gpio_request(GPIO_PTJ5, NULL);
  427. gpio_direction_output(GPIO_PTJ5, 1);
  428. gpio_export(GPIO_PTJ5, 0);
  429. /* Lit LED11 */
  430. gpio_request(GPIO_PTJ7, NULL);
  431. gpio_direction_output(GPIO_PTJ7, 1);
  432. gpio_export(GPIO_PTJ7, 0);
  433. #endif
  434. /* enable USB0 port */
  435. ctrl_outw(0x0600, 0xa40501d4);
  436. /* enable USB1 port */
  437. ctrl_outw(0x0600, 0xa4050192);
  438. /* enable IRQ 0,1,2 */
  439. gpio_request(GPIO_FN_INTC_IRQ0, NULL);
  440. gpio_request(GPIO_FN_INTC_IRQ1, NULL);
  441. gpio_request(GPIO_FN_INTC_IRQ2, NULL);
  442. /* enable SCIFA3 */
  443. gpio_request(GPIO_FN_SCIF3_I_SCK, NULL);
  444. gpio_request(GPIO_FN_SCIF3_I_RXD, NULL);
  445. gpio_request(GPIO_FN_SCIF3_I_TXD, NULL);
  446. gpio_request(GPIO_FN_SCIF3_I_CTS, NULL);
  447. gpio_request(GPIO_FN_SCIF3_I_RTS, NULL);
  448. /* enable LCDC */
  449. gpio_request(GPIO_FN_LCDD23, NULL);
  450. gpio_request(GPIO_FN_LCDD22, NULL);
  451. gpio_request(GPIO_FN_LCDD21, NULL);
  452. gpio_request(GPIO_FN_LCDD20, NULL);
  453. gpio_request(GPIO_FN_LCDD19, NULL);
  454. gpio_request(GPIO_FN_LCDD18, NULL);
  455. gpio_request(GPIO_FN_LCDD17, NULL);
  456. gpio_request(GPIO_FN_LCDD16, NULL);
  457. gpio_request(GPIO_FN_LCDD15, NULL);
  458. gpio_request(GPIO_FN_LCDD14, NULL);
  459. gpio_request(GPIO_FN_LCDD13, NULL);
  460. gpio_request(GPIO_FN_LCDD12, NULL);
  461. gpio_request(GPIO_FN_LCDD11, NULL);
  462. gpio_request(GPIO_FN_LCDD10, NULL);
  463. gpio_request(GPIO_FN_LCDD9, NULL);
  464. gpio_request(GPIO_FN_LCDD8, NULL);
  465. gpio_request(GPIO_FN_LCDD7, NULL);
  466. gpio_request(GPIO_FN_LCDD6, NULL);
  467. gpio_request(GPIO_FN_LCDD5, NULL);
  468. gpio_request(GPIO_FN_LCDD4, NULL);
  469. gpio_request(GPIO_FN_LCDD3, NULL);
  470. gpio_request(GPIO_FN_LCDD2, NULL);
  471. gpio_request(GPIO_FN_LCDD1, NULL);
  472. gpio_request(GPIO_FN_LCDD0, NULL);
  473. gpio_request(GPIO_FN_LCDDISP, NULL);
  474. gpio_request(GPIO_FN_LCDHSYN, NULL);
  475. gpio_request(GPIO_FN_LCDDCK, NULL);
  476. gpio_request(GPIO_FN_LCDVSYN, NULL);
  477. gpio_request(GPIO_FN_LCDDON, NULL);
  478. gpio_request(GPIO_FN_LCDVEPWC, NULL);
  479. gpio_request(GPIO_FN_LCDVCPWC, NULL);
  480. gpio_request(GPIO_FN_LCDRD, NULL);
  481. gpio_request(GPIO_FN_LCDLCLK, NULL);
  482. ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
  483. /* enable CEU0 */
  484. gpio_request(GPIO_FN_VIO0_D15, NULL);
  485. gpio_request(GPIO_FN_VIO0_D14, NULL);
  486. gpio_request(GPIO_FN_VIO0_D13, NULL);
  487. gpio_request(GPIO_FN_VIO0_D12, NULL);
  488. gpio_request(GPIO_FN_VIO0_D11, NULL);
  489. gpio_request(GPIO_FN_VIO0_D10, NULL);
  490. gpio_request(GPIO_FN_VIO0_D9, NULL);
  491. gpio_request(GPIO_FN_VIO0_D8, NULL);
  492. gpio_request(GPIO_FN_VIO0_D7, NULL);
  493. gpio_request(GPIO_FN_VIO0_D6, NULL);
  494. gpio_request(GPIO_FN_VIO0_D5, NULL);
  495. gpio_request(GPIO_FN_VIO0_D4, NULL);
  496. gpio_request(GPIO_FN_VIO0_D3, NULL);
  497. gpio_request(GPIO_FN_VIO0_D2, NULL);
  498. gpio_request(GPIO_FN_VIO0_D1, NULL);
  499. gpio_request(GPIO_FN_VIO0_D0, NULL);
  500. gpio_request(GPIO_FN_VIO0_VD, NULL);
  501. gpio_request(GPIO_FN_VIO0_CLK, NULL);
  502. gpio_request(GPIO_FN_VIO0_FLD, NULL);
  503. gpio_request(GPIO_FN_VIO0_HD, NULL);
  504. platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
  505. /* enable CEU1 */
  506. gpio_request(GPIO_FN_VIO1_D7, NULL);
  507. gpio_request(GPIO_FN_VIO1_D6, NULL);
  508. gpio_request(GPIO_FN_VIO1_D5, NULL);
  509. gpio_request(GPIO_FN_VIO1_D4, NULL);
  510. gpio_request(GPIO_FN_VIO1_D3, NULL);
  511. gpio_request(GPIO_FN_VIO1_D2, NULL);
  512. gpio_request(GPIO_FN_VIO1_D1, NULL);
  513. gpio_request(GPIO_FN_VIO1_D0, NULL);
  514. gpio_request(GPIO_FN_VIO1_FLD, NULL);
  515. gpio_request(GPIO_FN_VIO1_HD, NULL);
  516. gpio_request(GPIO_FN_VIO1_VD, NULL);
  517. gpio_request(GPIO_FN_VIO1_CLK, NULL);
  518. platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
  519. /* KEYSC */
  520. gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
  521. gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
  522. gpio_request(GPIO_FN_KEYIN4, NULL);
  523. gpio_request(GPIO_FN_KEYIN3, NULL);
  524. gpio_request(GPIO_FN_KEYIN2, NULL);
  525. gpio_request(GPIO_FN_KEYIN1, NULL);
  526. gpio_request(GPIO_FN_KEYIN0, NULL);
  527. gpio_request(GPIO_FN_KEYOUT3, NULL);
  528. gpio_request(GPIO_FN_KEYOUT2, NULL);
  529. gpio_request(GPIO_FN_KEYOUT1, NULL);
  530. gpio_request(GPIO_FN_KEYOUT0, NULL);
  531. /*
  532. * enable SH-Eth
  533. *
  534. * please remove J33 pin from your board !!
  535. *
  536. * ms7724 board should not use GPIO_FN_LNKSTA pin
  537. * So, This time PTX5 is set to input pin
  538. */
  539. gpio_request(GPIO_FN_RMII_RXD0, NULL);
  540. gpio_request(GPIO_FN_RMII_RXD1, NULL);
  541. gpio_request(GPIO_FN_RMII_TXD0, NULL);
  542. gpio_request(GPIO_FN_RMII_TXD1, NULL);
  543. gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
  544. gpio_request(GPIO_FN_RMII_TX_EN, NULL);
  545. gpio_request(GPIO_FN_RMII_RX_ER, NULL);
  546. gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
  547. gpio_request(GPIO_FN_MDIO, NULL);
  548. gpio_request(GPIO_FN_MDC, NULL);
  549. gpio_request(GPIO_PTX5, NULL);
  550. gpio_direction_input(GPIO_PTX5);
  551. sh_eth_init();
  552. if (sw & SW41_B) {
  553. /* 720p */
  554. lcdc_info.ch[0].lcd_cfg.xres = 1280;
  555. lcdc_info.ch[0].lcd_cfg.yres = 720;
  556. lcdc_info.ch[0].lcd_cfg.left_margin = 220;
  557. lcdc_info.ch[0].lcd_cfg.right_margin = 110;
  558. lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
  559. lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
  560. lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
  561. lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
  562. } else {
  563. /* VGA */
  564. lcdc_info.ch[0].lcd_cfg.xres = 640;
  565. lcdc_info.ch[0].lcd_cfg.yres = 480;
  566. lcdc_info.ch[0].lcd_cfg.left_margin = 105;
  567. lcdc_info.ch[0].lcd_cfg.right_margin = 50;
  568. lcdc_info.ch[0].lcd_cfg.hsync_len = 96;
  569. lcdc_info.ch[0].lcd_cfg.upper_margin = 33;
  570. lcdc_info.ch[0].lcd_cfg.lower_margin = 10;
  571. lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
  572. }
  573. if (sw & SW41_A) {
  574. /* Digital monitor */
  575. lcdc_info.ch[0].interface_type = RGB18;
  576. lcdc_info.ch[0].flags = 0;
  577. } else {
  578. /* Analog monitor */
  579. lcdc_info.ch[0].interface_type = RGB24;
  580. lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
  581. }
  582. return platform_add_devices(ms7724se_devices,
  583. ARRAY_SIZE(ms7724se_devices));
  584. }
  585. device_initcall(devices_setup);
  586. static struct sh_machine_vector mv_ms7724se __initmv = {
  587. .mv_name = "ms7724se",
  588. .mv_init_irq = init_se7724_IRQ,
  589. .mv_nr_irqs = SE7724_FPGA_IRQ_BASE + SE7724_FPGA_IRQ_NR,
  590. };