setup.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  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/input/sh_keysc.h>
  22. #include <linux/usb/r8a66597.h>
  23. #include <video/sh_mobile_lcdc.h>
  24. #include <media/sh_mobile_ceu.h>
  25. #include <sound/sh_fsi.h>
  26. #include <asm/io.h>
  27. #include <asm/heartbeat.h>
  28. #include <asm/sh_eth.h>
  29. #include <asm/clock.h>
  30. #include <asm/suspend.h>
  31. #include <cpu/sh7724.h>
  32. #include <mach-se/mach/se7724.h>
  33. /*
  34. * SWx 1234 5678
  35. * ------------------------------------
  36. * SW31 : 1001 1100 : default
  37. * SW32 : 0111 1111 : use on board flash
  38. *
  39. * SW41 : abxx xxxx -> a = 0 : Analog monitor
  40. * 1 : Digital monitor
  41. * b = 0 : VGA
  42. * 1 : 720p
  43. */
  44. /*
  45. * about 720p
  46. *
  47. * When you use 1280 x 720 lcdc output,
  48. * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz,
  49. * and change SW41 to use 720p
  50. */
  51. /* Heartbeat */
  52. static struct heartbeat_data heartbeat_data = {
  53. .regsize = 16,
  54. };
  55. static struct resource heartbeat_resources[] = {
  56. [0] = {
  57. .start = PA_LED,
  58. .end = PA_LED,
  59. .flags = IORESOURCE_MEM,
  60. },
  61. };
  62. static struct platform_device heartbeat_device = {
  63. .name = "heartbeat",
  64. .id = -1,
  65. .dev = {
  66. .platform_data = &heartbeat_data,
  67. },
  68. .num_resources = ARRAY_SIZE(heartbeat_resources),
  69. .resource = heartbeat_resources,
  70. };
  71. /* LAN91C111 */
  72. static struct smc91x_platdata smc91x_info = {
  73. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  74. };
  75. static struct resource smc91x_eth_resources[] = {
  76. [0] = {
  77. .name = "SMC91C111" ,
  78. .start = 0x1a300300,
  79. .end = 0x1a30030f,
  80. .flags = IORESOURCE_MEM,
  81. },
  82. [1] = {
  83. .start = IRQ0_SMC,
  84. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  85. },
  86. };
  87. static struct platform_device smc91x_eth_device = {
  88. .name = "smc91x",
  89. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  90. .resource = smc91x_eth_resources,
  91. .dev = {
  92. .platform_data = &smc91x_info,
  93. },
  94. };
  95. /* MTD */
  96. static struct mtd_partition nor_flash_partitions[] = {
  97. {
  98. .name = "uboot",
  99. .offset = 0,
  100. .size = (1 * 1024 * 1024),
  101. .mask_flags = MTD_WRITEABLE, /* Read-only */
  102. }, {
  103. .name = "kernel",
  104. .offset = MTDPART_OFS_APPEND,
  105. .size = (2 * 1024 * 1024),
  106. }, {
  107. .name = "free-area",
  108. .offset = MTDPART_OFS_APPEND,
  109. .size = MTDPART_SIZ_FULL,
  110. },
  111. };
  112. static struct physmap_flash_data nor_flash_data = {
  113. .width = 2,
  114. .parts = nor_flash_partitions,
  115. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  116. };
  117. static struct resource nor_flash_resources[] = {
  118. [0] = {
  119. .name = "NOR Flash",
  120. .start = 0x00000000,
  121. .end = 0x01ffffff,
  122. .flags = IORESOURCE_MEM,
  123. }
  124. };
  125. static struct platform_device nor_flash_device = {
  126. .name = "physmap-flash",
  127. .resource = nor_flash_resources,
  128. .num_resources = ARRAY_SIZE(nor_flash_resources),
  129. .dev = {
  130. .platform_data = &nor_flash_data,
  131. },
  132. };
  133. /* LCDC */
  134. static struct sh_mobile_lcdc_info lcdc_info = {
  135. .clock_source = LCDC_CLK_EXTERNAL,
  136. .ch[0] = {
  137. .chan = LCDC_CHAN_MAINLCD,
  138. .bpp = 16,
  139. .clock_divider = 1,
  140. .lcd_cfg = {
  141. .name = "LB070WV1",
  142. .sync = 0, /* hsync and vsync are active low */
  143. },
  144. .lcd_size_cfg = { /* 7.0 inch */
  145. .width = 152,
  146. .height = 91,
  147. },
  148. .board_cfg = {
  149. },
  150. }
  151. };
  152. static struct resource lcdc_resources[] = {
  153. [0] = {
  154. .name = "LCDC",
  155. .start = 0xfe940000,
  156. .end = 0xfe942fff,
  157. .flags = IORESOURCE_MEM,
  158. },
  159. [1] = {
  160. .start = 106,
  161. .flags = IORESOURCE_IRQ,
  162. },
  163. };
  164. static struct platform_device lcdc_device = {
  165. .name = "sh_mobile_lcdc_fb",
  166. .num_resources = ARRAY_SIZE(lcdc_resources),
  167. .resource = lcdc_resources,
  168. .dev = {
  169. .platform_data = &lcdc_info,
  170. },
  171. .archdata = {
  172. .hwblk_id = HWBLK_LCDC,
  173. },
  174. };
  175. /* CEU0 */
  176. static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
  177. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  178. };
  179. static struct resource ceu0_resources[] = {
  180. [0] = {
  181. .name = "CEU0",
  182. .start = 0xfe910000,
  183. .end = 0xfe91009f,
  184. .flags = IORESOURCE_MEM,
  185. },
  186. [1] = {
  187. .start = 52,
  188. .flags = IORESOURCE_IRQ,
  189. },
  190. [2] = {
  191. /* place holder for contiguous memory */
  192. },
  193. };
  194. static struct platform_device ceu0_device = {
  195. .name = "sh_mobile_ceu",
  196. .id = 0, /* "ceu0" clock */
  197. .num_resources = ARRAY_SIZE(ceu0_resources),
  198. .resource = ceu0_resources,
  199. .dev = {
  200. .platform_data = &sh_mobile_ceu0_info,
  201. },
  202. .archdata = {
  203. .hwblk_id = HWBLK_CEU0,
  204. },
  205. };
  206. /* CEU1 */
  207. static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
  208. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  209. };
  210. static struct resource ceu1_resources[] = {
  211. [0] = {
  212. .name = "CEU1",
  213. .start = 0xfe914000,
  214. .end = 0xfe91409f,
  215. .flags = IORESOURCE_MEM,
  216. },
  217. [1] = {
  218. .start = 63,
  219. .flags = IORESOURCE_IRQ,
  220. },
  221. [2] = {
  222. /* place holder for contiguous memory */
  223. },
  224. };
  225. static struct platform_device ceu1_device = {
  226. .name = "sh_mobile_ceu",
  227. .id = 1, /* "ceu1" clock */
  228. .num_resources = ARRAY_SIZE(ceu1_resources),
  229. .resource = ceu1_resources,
  230. .dev = {
  231. .platform_data = &sh_mobile_ceu1_info,
  232. },
  233. .archdata = {
  234. .hwblk_id = HWBLK_CEU1,
  235. },
  236. };
  237. /* FSI */
  238. /*
  239. * FSI-A use external clock which came from ak464x.
  240. * So, we should change parent of fsi
  241. */
  242. #define FCLKACR 0xa4150008
  243. static void fsimck_init(struct clk *clk)
  244. {
  245. u32 status = ctrl_inl(clk->enable_reg);
  246. /* use external clock */
  247. status &= ~0x000000ff;
  248. status |= 0x00000080;
  249. ctrl_outl(status, clk->enable_reg);
  250. }
  251. static struct clk_ops fsimck_clk_ops = {
  252. .init = fsimck_init,
  253. };
  254. static struct clk fsimcka_clk = {
  255. .name = "fsimcka_clk",
  256. .id = -1,
  257. .ops = &fsimck_clk_ops,
  258. .enable_reg = (void __iomem *)FCLKACR,
  259. .rate = 0, /* unknown */
  260. };
  261. struct sh_fsi_platform_info fsi_info = {
  262. .porta_flags = SH_FSI_BRS_INV |
  263. SH_FSI_OUT_SLAVE_MODE |
  264. SH_FSI_IN_SLAVE_MODE |
  265. SH_FSI_OFMT(PCM) |
  266. SH_FSI_IFMT(PCM),
  267. };
  268. static struct resource fsi_resources[] = {
  269. [0] = {
  270. .name = "FSI",
  271. .start = 0xFE3C0000,
  272. .end = 0xFE3C021d,
  273. .flags = IORESOURCE_MEM,
  274. },
  275. [1] = {
  276. .start = 108,
  277. .flags = IORESOURCE_IRQ,
  278. },
  279. };
  280. static struct platform_device fsi_device = {
  281. .name = "sh_fsi",
  282. .id = 0,
  283. .num_resources = ARRAY_SIZE(fsi_resources),
  284. .resource = fsi_resources,
  285. .dev = {
  286. .platform_data = &fsi_info,
  287. },
  288. .archdata = {
  289. .hwblk_id = HWBLK_SPU, /* FSI needs SPU hwblk */
  290. },
  291. };
  292. /* KEYSC in SoC (Needs SW33-2 set to ON) */
  293. static struct sh_keysc_info keysc_info = {
  294. .mode = SH_KEYSC_MODE_1,
  295. .scan_timing = 10,
  296. .delay = 50,
  297. .keycodes = {
  298. KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
  299. KEY_6, KEY_7, KEY_8, KEY_9, KEY_A,
  300. KEY_B, KEY_C, KEY_D, KEY_E, KEY_F,
  301. KEY_G, KEY_H, KEY_I, KEY_K, KEY_L,
  302. KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q,
  303. KEY_R, KEY_S, KEY_T, KEY_U, KEY_V,
  304. },
  305. };
  306. static struct resource keysc_resources[] = {
  307. [0] = {
  308. .name = "KEYSC",
  309. .start = 0x044b0000,
  310. .end = 0x044b000f,
  311. .flags = IORESOURCE_MEM,
  312. },
  313. [1] = {
  314. .start = 79,
  315. .flags = IORESOURCE_IRQ,
  316. },
  317. };
  318. static struct platform_device keysc_device = {
  319. .name = "sh_keysc",
  320. .id = 0, /* "keysc0" clock */
  321. .num_resources = ARRAY_SIZE(keysc_resources),
  322. .resource = keysc_resources,
  323. .dev = {
  324. .platform_data = &keysc_info,
  325. },
  326. .archdata = {
  327. .hwblk_id = HWBLK_KEYSC,
  328. },
  329. };
  330. /* SH Eth */
  331. static struct resource sh_eth_resources[] = {
  332. [0] = {
  333. .start = SH_ETH_ADDR,
  334. .end = SH_ETH_ADDR + 0x1FC,
  335. .flags = IORESOURCE_MEM,
  336. },
  337. [1] = {
  338. .start = 91,
  339. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  340. },
  341. };
  342. struct sh_eth_plat_data sh_eth_plat = {
  343. .phy = 0x1f, /* SMSC LAN8187 */
  344. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  345. };
  346. static struct platform_device sh_eth_device = {
  347. .name = "sh-eth",
  348. .id = 0,
  349. .dev = {
  350. .platform_data = &sh_eth_plat,
  351. },
  352. .num_resources = ARRAY_SIZE(sh_eth_resources),
  353. .resource = sh_eth_resources,
  354. .archdata = {
  355. .hwblk_id = HWBLK_ETHER,
  356. },
  357. };
  358. static struct r8a66597_platdata sh7724_usb0_host_data = {
  359. .on_chip = 1,
  360. };
  361. static struct resource sh7724_usb0_host_resources[] = {
  362. [0] = {
  363. .start = 0xa4d80000,
  364. .end = 0xa4d80124 - 1,
  365. .flags = IORESOURCE_MEM,
  366. },
  367. [1] = {
  368. .start = 65,
  369. .end = 65,
  370. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  371. },
  372. };
  373. static struct platform_device sh7724_usb0_host_device = {
  374. .name = "r8a66597_hcd",
  375. .id = 0,
  376. .dev = {
  377. .dma_mask = NULL, /* not use dma */
  378. .coherent_dma_mask = 0xffffffff,
  379. .platform_data = &sh7724_usb0_host_data,
  380. },
  381. .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources),
  382. .resource = sh7724_usb0_host_resources,
  383. .archdata = {
  384. .hwblk_id = HWBLK_USB0,
  385. },
  386. };
  387. static struct r8a66597_platdata sh7724_usb1_gadget_data = {
  388. .on_chip = 1,
  389. };
  390. static struct resource sh7724_usb1_gadget_resources[] = {
  391. [0] = {
  392. .start = 0xa4d90000,
  393. .end = 0xa4d90123,
  394. .flags = IORESOURCE_MEM,
  395. },
  396. [1] = {
  397. .start = 66,
  398. .end = 66,
  399. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  400. },
  401. };
  402. static struct platform_device sh7724_usb1_gadget_device = {
  403. .name = "r8a66597_udc",
  404. .id = 1, /* USB1 */
  405. .dev = {
  406. .dma_mask = NULL, /* not use dma */
  407. .coherent_dma_mask = 0xffffffff,
  408. .platform_data = &sh7724_usb1_gadget_data,
  409. },
  410. .num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources),
  411. .resource = sh7724_usb1_gadget_resources,
  412. };
  413. static struct resource sdhi0_cn7_resources[] = {
  414. [0] = {
  415. .name = "SDHI0",
  416. .start = 0x04ce0000,
  417. .end = 0x04ce01ff,
  418. .flags = IORESOURCE_MEM,
  419. },
  420. [1] = {
  421. .start = 101,
  422. .flags = IORESOURCE_IRQ,
  423. },
  424. };
  425. static struct platform_device sdhi0_cn7_device = {
  426. .name = "sh_mobile_sdhi",
  427. .id = 0,
  428. .num_resources = ARRAY_SIZE(sdhi0_cn7_resources),
  429. .resource = sdhi0_cn7_resources,
  430. .archdata = {
  431. .hwblk_id = HWBLK_SDHI0,
  432. },
  433. };
  434. static struct resource sdhi1_cn8_resources[] = {
  435. [0] = {
  436. .name = "SDHI1",
  437. .start = 0x04cf0000,
  438. .end = 0x04cf01ff,
  439. .flags = IORESOURCE_MEM,
  440. },
  441. [1] = {
  442. .start = 24,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. };
  446. static struct platform_device sdhi1_cn8_device = {
  447. .name = "sh_mobile_sdhi",
  448. .id = 1,
  449. .num_resources = ARRAY_SIZE(sdhi1_cn8_resources),
  450. .resource = sdhi1_cn8_resources,
  451. .archdata = {
  452. .hwblk_id = HWBLK_SDHI1,
  453. },
  454. };
  455. static struct platform_device *ms7724se_devices[] __initdata = {
  456. &heartbeat_device,
  457. &smc91x_eth_device,
  458. &lcdc_device,
  459. &nor_flash_device,
  460. &ceu0_device,
  461. &ceu1_device,
  462. &keysc_device,
  463. &sh_eth_device,
  464. &sh7724_usb0_host_device,
  465. &sh7724_usb1_gadget_device,
  466. &fsi_device,
  467. &sdhi0_cn7_device,
  468. &sdhi1_cn8_device,
  469. };
  470. /* I2C device */
  471. static struct i2c_board_info i2c0_devices[] = {
  472. {
  473. I2C_BOARD_INFO("ak4642", 0x12),
  474. },
  475. };
  476. #define EEPROM_OP 0xBA206000
  477. #define EEPROM_ADR 0xBA206004
  478. #define EEPROM_DATA 0xBA20600C
  479. #define EEPROM_STAT 0xBA206010
  480. #define EEPROM_STRT 0xBA206014
  481. static int __init sh_eth_is_eeprom_ready(void)
  482. {
  483. int t = 10000;
  484. while (t--) {
  485. if (!ctrl_inw(EEPROM_STAT))
  486. return 1;
  487. cpu_relax();
  488. }
  489. printk(KERN_ERR "ms7724se can not access to eeprom\n");
  490. return 0;
  491. }
  492. static void __init sh_eth_init(void)
  493. {
  494. int i;
  495. u16 mac;
  496. /* check EEPROM status */
  497. if (!sh_eth_is_eeprom_ready())
  498. return;
  499. /* read MAC addr from EEPROM */
  500. for (i = 0 ; i < 3 ; i++) {
  501. ctrl_outw(0x0, EEPROM_OP); /* read */
  502. ctrl_outw(i*2, EEPROM_ADR);
  503. ctrl_outw(0x1, EEPROM_STRT);
  504. if (!sh_eth_is_eeprom_ready())
  505. return;
  506. mac = ctrl_inw(EEPROM_DATA);
  507. sh_eth_plat.mac_addr[i << 1] = mac & 0xff;
  508. sh_eth_plat.mac_addr[(i << 1) + 1] = mac >> 8;
  509. }
  510. }
  511. #define SW4140 0xBA201000
  512. #define FPGA_OUT 0xBA200400
  513. #define PORT_HIZA 0xA4050158
  514. #define PORT_MSELCRB 0xA4050182
  515. #define SW41_A 0x0100
  516. #define SW41_B 0x0200
  517. #define SW41_C 0x0400
  518. #define SW41_D 0x0800
  519. #define SW41_E 0x1000
  520. #define SW41_F 0x2000
  521. #define SW41_G 0x4000
  522. #define SW41_H 0x8000
  523. extern char ms7724se_sdram_enter_start;
  524. extern char ms7724se_sdram_enter_end;
  525. extern char ms7724se_sdram_leave_start;
  526. extern char ms7724se_sdram_leave_end;
  527. static int __init arch_setup(void)
  528. {
  529. /* enable I2C device */
  530. i2c_register_board_info(0, i2c0_devices,
  531. ARRAY_SIZE(i2c0_devices));
  532. return 0;
  533. }
  534. arch_initcall(arch_setup);
  535. static int __init devices_setup(void)
  536. {
  537. u16 sw = ctrl_inw(SW4140); /* select camera, monitor */
  538. struct clk *fsia_clk;
  539. /* register board specific self-refresh code */
  540. sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
  541. &ms7724se_sdram_enter_start,
  542. &ms7724se_sdram_enter_end,
  543. &ms7724se_sdram_leave_start,
  544. &ms7724se_sdram_leave_end);
  545. /* Reset Release */
  546. ctrl_outw(ctrl_inw(FPGA_OUT) &
  547. ~((1 << 1) | /* LAN */
  548. (1 << 6) | /* VIDEO DAC */
  549. (1 << 7) | /* AK4643 */
  550. (1 << 12) | /* USB0 */
  551. (1 << 14)), /* RMII */
  552. FPGA_OUT);
  553. /* turn on USB clocks, use external clock */
  554. ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
  555. #ifdef CONFIG_PM
  556. /* Let LED9 show STATUS2 */
  557. gpio_request(GPIO_FN_STATUS2, NULL);
  558. /* Lit LED10 show STATUS0 */
  559. gpio_request(GPIO_FN_STATUS0, NULL);
  560. /* Lit LED11 show PDSTATUS */
  561. gpio_request(GPIO_FN_PDSTATUS, NULL);
  562. #else
  563. /* Lit LED9 */
  564. gpio_request(GPIO_PTJ6, NULL);
  565. gpio_direction_output(GPIO_PTJ6, 1);
  566. gpio_export(GPIO_PTJ6, 0);
  567. /* Lit LED10 */
  568. gpio_request(GPIO_PTJ5, NULL);
  569. gpio_direction_output(GPIO_PTJ5, 1);
  570. gpio_export(GPIO_PTJ5, 0);
  571. /* Lit LED11 */
  572. gpio_request(GPIO_PTJ7, NULL);
  573. gpio_direction_output(GPIO_PTJ7, 1);
  574. gpio_export(GPIO_PTJ7, 0);
  575. #endif
  576. /* enable USB0 port */
  577. ctrl_outw(0x0600, 0xa40501d4);
  578. /* enable USB1 port */
  579. ctrl_outw(0x0600, 0xa4050192);
  580. /* enable IRQ 0,1,2 */
  581. gpio_request(GPIO_FN_INTC_IRQ0, NULL);
  582. gpio_request(GPIO_FN_INTC_IRQ1, NULL);
  583. gpio_request(GPIO_FN_INTC_IRQ2, NULL);
  584. /* enable SCIFA3 */
  585. gpio_request(GPIO_FN_SCIF3_I_SCK, NULL);
  586. gpio_request(GPIO_FN_SCIF3_I_RXD, NULL);
  587. gpio_request(GPIO_FN_SCIF3_I_TXD, NULL);
  588. gpio_request(GPIO_FN_SCIF3_I_CTS, NULL);
  589. gpio_request(GPIO_FN_SCIF3_I_RTS, NULL);
  590. /* enable LCDC */
  591. gpio_request(GPIO_FN_LCDD23, NULL);
  592. gpio_request(GPIO_FN_LCDD22, NULL);
  593. gpio_request(GPIO_FN_LCDD21, NULL);
  594. gpio_request(GPIO_FN_LCDD20, NULL);
  595. gpio_request(GPIO_FN_LCDD19, NULL);
  596. gpio_request(GPIO_FN_LCDD18, NULL);
  597. gpio_request(GPIO_FN_LCDD17, NULL);
  598. gpio_request(GPIO_FN_LCDD16, NULL);
  599. gpio_request(GPIO_FN_LCDD15, NULL);
  600. gpio_request(GPIO_FN_LCDD14, NULL);
  601. gpio_request(GPIO_FN_LCDD13, NULL);
  602. gpio_request(GPIO_FN_LCDD12, NULL);
  603. gpio_request(GPIO_FN_LCDD11, NULL);
  604. gpio_request(GPIO_FN_LCDD10, NULL);
  605. gpio_request(GPIO_FN_LCDD9, NULL);
  606. gpio_request(GPIO_FN_LCDD8, NULL);
  607. gpio_request(GPIO_FN_LCDD7, NULL);
  608. gpio_request(GPIO_FN_LCDD6, NULL);
  609. gpio_request(GPIO_FN_LCDD5, NULL);
  610. gpio_request(GPIO_FN_LCDD4, NULL);
  611. gpio_request(GPIO_FN_LCDD3, NULL);
  612. gpio_request(GPIO_FN_LCDD2, NULL);
  613. gpio_request(GPIO_FN_LCDD1, NULL);
  614. gpio_request(GPIO_FN_LCDD0, NULL);
  615. gpio_request(GPIO_FN_LCDDISP, NULL);
  616. gpio_request(GPIO_FN_LCDHSYN, NULL);
  617. gpio_request(GPIO_FN_LCDDCK, NULL);
  618. gpio_request(GPIO_FN_LCDVSYN, NULL);
  619. gpio_request(GPIO_FN_LCDDON, NULL);
  620. gpio_request(GPIO_FN_LCDVEPWC, NULL);
  621. gpio_request(GPIO_FN_LCDVCPWC, NULL);
  622. gpio_request(GPIO_FN_LCDRD, NULL);
  623. gpio_request(GPIO_FN_LCDLCLK, NULL);
  624. ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
  625. /* enable CEU0 */
  626. gpio_request(GPIO_FN_VIO0_D15, NULL);
  627. gpio_request(GPIO_FN_VIO0_D14, NULL);
  628. gpio_request(GPIO_FN_VIO0_D13, NULL);
  629. gpio_request(GPIO_FN_VIO0_D12, NULL);
  630. gpio_request(GPIO_FN_VIO0_D11, NULL);
  631. gpio_request(GPIO_FN_VIO0_D10, NULL);
  632. gpio_request(GPIO_FN_VIO0_D9, NULL);
  633. gpio_request(GPIO_FN_VIO0_D8, NULL);
  634. gpio_request(GPIO_FN_VIO0_D7, NULL);
  635. gpio_request(GPIO_FN_VIO0_D6, NULL);
  636. gpio_request(GPIO_FN_VIO0_D5, NULL);
  637. gpio_request(GPIO_FN_VIO0_D4, NULL);
  638. gpio_request(GPIO_FN_VIO0_D3, NULL);
  639. gpio_request(GPIO_FN_VIO0_D2, NULL);
  640. gpio_request(GPIO_FN_VIO0_D1, NULL);
  641. gpio_request(GPIO_FN_VIO0_D0, NULL);
  642. gpio_request(GPIO_FN_VIO0_VD, NULL);
  643. gpio_request(GPIO_FN_VIO0_CLK, NULL);
  644. gpio_request(GPIO_FN_VIO0_FLD, NULL);
  645. gpio_request(GPIO_FN_VIO0_HD, NULL);
  646. platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
  647. /* enable CEU1 */
  648. gpio_request(GPIO_FN_VIO1_D7, NULL);
  649. gpio_request(GPIO_FN_VIO1_D6, NULL);
  650. gpio_request(GPIO_FN_VIO1_D5, NULL);
  651. gpio_request(GPIO_FN_VIO1_D4, NULL);
  652. gpio_request(GPIO_FN_VIO1_D3, NULL);
  653. gpio_request(GPIO_FN_VIO1_D2, NULL);
  654. gpio_request(GPIO_FN_VIO1_D1, NULL);
  655. gpio_request(GPIO_FN_VIO1_D0, NULL);
  656. gpio_request(GPIO_FN_VIO1_FLD, NULL);
  657. gpio_request(GPIO_FN_VIO1_HD, NULL);
  658. gpio_request(GPIO_FN_VIO1_VD, NULL);
  659. gpio_request(GPIO_FN_VIO1_CLK, NULL);
  660. platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
  661. /* KEYSC */
  662. gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
  663. gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
  664. gpio_request(GPIO_FN_KEYIN4, NULL);
  665. gpio_request(GPIO_FN_KEYIN3, NULL);
  666. gpio_request(GPIO_FN_KEYIN2, NULL);
  667. gpio_request(GPIO_FN_KEYIN1, NULL);
  668. gpio_request(GPIO_FN_KEYIN0, NULL);
  669. gpio_request(GPIO_FN_KEYOUT3, NULL);
  670. gpio_request(GPIO_FN_KEYOUT2, NULL);
  671. gpio_request(GPIO_FN_KEYOUT1, NULL);
  672. gpio_request(GPIO_FN_KEYOUT0, NULL);
  673. /* enable FSI */
  674. gpio_request(GPIO_FN_FSIMCKB, NULL);
  675. gpio_request(GPIO_FN_FSIMCKA, NULL);
  676. gpio_request(GPIO_FN_FSIOASD, NULL);
  677. gpio_request(GPIO_FN_FSIIABCK, NULL);
  678. gpio_request(GPIO_FN_FSIIALRCK, NULL);
  679. gpio_request(GPIO_FN_FSIOABCK, NULL);
  680. gpio_request(GPIO_FN_FSIOALRCK, NULL);
  681. gpio_request(GPIO_FN_CLKAUDIOAO, NULL);
  682. gpio_request(GPIO_FN_FSIIBSD, NULL);
  683. gpio_request(GPIO_FN_FSIOBSD, NULL);
  684. gpio_request(GPIO_FN_FSIIBBCK, NULL);
  685. gpio_request(GPIO_FN_FSIIBLRCK, NULL);
  686. gpio_request(GPIO_FN_FSIOBBCK, NULL);
  687. gpio_request(GPIO_FN_FSIOBLRCK, NULL);
  688. gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
  689. gpio_request(GPIO_FN_FSIIASD, NULL);
  690. /* change parent of FSI A */
  691. fsia_clk = clk_get(NULL, "fsia_clk");
  692. clk_register(&fsimcka_clk);
  693. clk_set_parent(fsia_clk, &fsimcka_clk);
  694. clk_set_rate(fsia_clk, 11000);
  695. clk_set_rate(&fsimcka_clk, 11000);
  696. clk_put(fsia_clk);
  697. /* SDHI0 connected to cn7 */
  698. gpio_request(GPIO_FN_SDHI0CD, NULL);
  699. gpio_request(GPIO_FN_SDHI0WP, NULL);
  700. gpio_request(GPIO_FN_SDHI0D3, NULL);
  701. gpio_request(GPIO_FN_SDHI0D2, NULL);
  702. gpio_request(GPIO_FN_SDHI0D1, NULL);
  703. gpio_request(GPIO_FN_SDHI0D0, NULL);
  704. gpio_request(GPIO_FN_SDHI0CMD, NULL);
  705. gpio_request(GPIO_FN_SDHI0CLK, NULL);
  706. /* SDHI1 connected to cn8 */
  707. gpio_request(GPIO_FN_SDHI1CD, NULL);
  708. gpio_request(GPIO_FN_SDHI1WP, NULL);
  709. gpio_request(GPIO_FN_SDHI1D3, NULL);
  710. gpio_request(GPIO_FN_SDHI1D2, NULL);
  711. gpio_request(GPIO_FN_SDHI1D1, NULL);
  712. gpio_request(GPIO_FN_SDHI1D0, NULL);
  713. gpio_request(GPIO_FN_SDHI1CMD, NULL);
  714. gpio_request(GPIO_FN_SDHI1CLK, NULL);
  715. /*
  716. * enable SH-Eth
  717. *
  718. * please remove J33 pin from your board !!
  719. *
  720. * ms7724 board should not use GPIO_FN_LNKSTA pin
  721. * So, This time PTX5 is set to input pin
  722. */
  723. gpio_request(GPIO_FN_RMII_RXD0, NULL);
  724. gpio_request(GPIO_FN_RMII_RXD1, NULL);
  725. gpio_request(GPIO_FN_RMII_TXD0, NULL);
  726. gpio_request(GPIO_FN_RMII_TXD1, NULL);
  727. gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
  728. gpio_request(GPIO_FN_RMII_TX_EN, NULL);
  729. gpio_request(GPIO_FN_RMII_RX_ER, NULL);
  730. gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
  731. gpio_request(GPIO_FN_MDIO, NULL);
  732. gpio_request(GPIO_FN_MDC, NULL);
  733. gpio_request(GPIO_PTX5, NULL);
  734. gpio_direction_input(GPIO_PTX5);
  735. sh_eth_init();
  736. if (sw & SW41_B) {
  737. /* 720p */
  738. lcdc_info.ch[0].lcd_cfg.xres = 1280;
  739. lcdc_info.ch[0].lcd_cfg.yres = 720;
  740. lcdc_info.ch[0].lcd_cfg.left_margin = 220;
  741. lcdc_info.ch[0].lcd_cfg.right_margin = 110;
  742. lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
  743. lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
  744. lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
  745. lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
  746. } else {
  747. /* VGA */
  748. lcdc_info.ch[0].lcd_cfg.xres = 640;
  749. lcdc_info.ch[0].lcd_cfg.yres = 480;
  750. lcdc_info.ch[0].lcd_cfg.left_margin = 105;
  751. lcdc_info.ch[0].lcd_cfg.right_margin = 50;
  752. lcdc_info.ch[0].lcd_cfg.hsync_len = 96;
  753. lcdc_info.ch[0].lcd_cfg.upper_margin = 33;
  754. lcdc_info.ch[0].lcd_cfg.lower_margin = 10;
  755. lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
  756. }
  757. if (sw & SW41_A) {
  758. /* Digital monitor */
  759. lcdc_info.ch[0].interface_type = RGB18;
  760. lcdc_info.ch[0].flags = 0;
  761. } else {
  762. /* Analog monitor */
  763. lcdc_info.ch[0].interface_type = RGB24;
  764. lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
  765. }
  766. return platform_add_devices(ms7724se_devices,
  767. ARRAY_SIZE(ms7724se_devices));
  768. }
  769. device_initcall(devices_setup);
  770. static struct sh_machine_vector mv_ms7724se __initmv = {
  771. .mv_name = "ms7724se",
  772. .mv_init_irq = init_se7724_IRQ,
  773. .mv_nr_irqs = SE7724_FPGA_IRQ_BASE + SE7724_FPGA_IRQ_NR,
  774. };