board-ap4evb.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. /*
  2. * AP4EVB board support
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. * Copyright (C) 2008 Yoshihiro Shimoda
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/clk.h>
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/irq.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/delay.h>
  27. #include <linux/mfd/sh_mobile_sdhi.h>
  28. #include <linux/mtd/mtd.h>
  29. #include <linux/mtd/partitions.h>
  30. #include <linux/mtd/physmap.h>
  31. #include <linux/i2c.h>
  32. #include <linux/i2c/tsc2007.h>
  33. #include <linux/io.h>
  34. #include <linux/smsc911x.h>
  35. #include <linux/sh_intc.h>
  36. #include <linux/sh_clk.h>
  37. #include <linux/gpio.h>
  38. #include <linux/input.h>
  39. #include <linux/input/sh_keysc.h>
  40. #include <linux/usb/r8a66597.h>
  41. #include <sound/sh_fsi.h>
  42. #include <video/sh_mobile_lcdc.h>
  43. #include <video/sh_mipi_dsi.h>
  44. #include <mach/common.h>
  45. #include <mach/irqs.h>
  46. #include <mach/sh7372.h>
  47. #include <asm/mach-types.h>
  48. #include <asm/mach/arch.h>
  49. #include <asm/mach/map.h>
  50. #include <asm/mach/time.h>
  51. /*
  52. * Address Interface BusWidth note
  53. * ------------------------------------------------------------------
  54. * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
  55. * 0x0800_0000 user area -
  56. * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
  57. * 0x1400_0000 Ether (LAN9220) 16bit
  58. * 0x1600_0000 user area - cannot use with NAND
  59. * 0x1800_0000 user area -
  60. * 0x1A00_0000 -
  61. * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
  62. */
  63. /*
  64. * NOR Flash ROM
  65. *
  66. * SW1 | SW2 | SW7 | NOR Flash ROM
  67. * bit1 | bit1 bit2 | bit1 | Memory allocation
  68. * ------+------------+------+------------------
  69. * OFF | ON OFF | ON | Area 0
  70. * OFF | ON OFF | OFF | Area 4
  71. */
  72. /*
  73. * NAND Flash ROM
  74. *
  75. * SW1 | SW2 | SW7 | NAND Flash ROM
  76. * bit1 | bit1 bit2 | bit2 | Memory allocation
  77. * ------+------------+------+------------------
  78. * OFF | ON OFF | ON | FCE 0
  79. * OFF | ON OFF | OFF | FCE 1
  80. */
  81. /*
  82. * SMSC 9220
  83. *
  84. * SW1 SMSC 9220
  85. * -----------------------
  86. * ON access disable
  87. * OFF access enable
  88. */
  89. /*
  90. * LCD / IRQ / KEYSC / IrDA
  91. *
  92. * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (TouchScreen)
  93. * LCD = 2nd LCDC
  94. *
  95. * | SW43 |
  96. * SW3 | ON | OFF |
  97. * -------------+-----------------------+---------------+
  98. * ON | KEY / IrDA | LCD |
  99. * OFF | KEY / IrDA / IRQ | IRQ |
  100. */
  101. /*
  102. * USB
  103. *
  104. * J7 : 1-2 MAX3355E VBUS
  105. * 2-3 DC 5.0V
  106. *
  107. * S39: bit2: off
  108. */
  109. /*
  110. * FSI/FSMI
  111. *
  112. * SW41 : ON : SH-Mobile AP4 Audio Mode
  113. * : OFF : Bluetooth Audio Mode
  114. */
  115. /* MTD */
  116. static struct mtd_partition nor_flash_partitions[] = {
  117. {
  118. .name = "loader",
  119. .offset = 0x00000000,
  120. .size = 512 * 1024,
  121. },
  122. {
  123. .name = "bootenv",
  124. .offset = MTDPART_OFS_APPEND,
  125. .size = 512 * 1024,
  126. },
  127. {
  128. .name = "kernel_ro",
  129. .offset = MTDPART_OFS_APPEND,
  130. .size = 8 * 1024 * 1024,
  131. .mask_flags = MTD_WRITEABLE,
  132. },
  133. {
  134. .name = "kernel",
  135. .offset = MTDPART_OFS_APPEND,
  136. .size = 8 * 1024 * 1024,
  137. },
  138. {
  139. .name = "data",
  140. .offset = MTDPART_OFS_APPEND,
  141. .size = MTDPART_SIZ_FULL,
  142. },
  143. };
  144. static struct physmap_flash_data nor_flash_data = {
  145. .width = 2,
  146. .parts = nor_flash_partitions,
  147. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  148. };
  149. static struct resource nor_flash_resources[] = {
  150. [0] = {
  151. .start = 0x00000000,
  152. .end = 0x08000000 - 1,
  153. .flags = IORESOURCE_MEM,
  154. }
  155. };
  156. static struct platform_device nor_flash_device = {
  157. .name = "physmap-flash",
  158. .dev = {
  159. .platform_data = &nor_flash_data,
  160. },
  161. .num_resources = ARRAY_SIZE(nor_flash_resources),
  162. .resource = nor_flash_resources,
  163. };
  164. /* SMSC 9220 */
  165. static struct resource smc911x_resources[] = {
  166. {
  167. .start = 0x14000000,
  168. .end = 0x16000000 - 1,
  169. .flags = IORESOURCE_MEM,
  170. }, {
  171. .start = evt2irq(0x02c0) /* IRQ6A */,
  172. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  173. },
  174. };
  175. static struct smsc911x_platform_config smsc911x_info = {
  176. .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
  177. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  178. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  179. };
  180. static struct platform_device smc911x_device = {
  181. .name = "smsc911x",
  182. .id = -1,
  183. .num_resources = ARRAY_SIZE(smc911x_resources),
  184. .resource = smc911x_resources,
  185. .dev = {
  186. .platform_data = &smsc911x_info,
  187. },
  188. };
  189. /* KEYSC (Needs SW43 set to ON) */
  190. static struct sh_keysc_info keysc_info = {
  191. .mode = SH_KEYSC_MODE_1,
  192. .scan_timing = 3,
  193. .delay = 2500,
  194. .keycodes = {
  195. KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
  196. KEY_5, KEY_6, KEY_7, KEY_8, KEY_9,
  197. KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
  198. KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
  199. KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
  200. },
  201. };
  202. static struct resource keysc_resources[] = {
  203. [0] = {
  204. .name = "KEYSC",
  205. .start = 0xe61b0000,
  206. .end = 0xe61b0063,
  207. .flags = IORESOURCE_MEM,
  208. },
  209. [1] = {
  210. .start = evt2irq(0x0be0), /* KEYSC_KEY */
  211. .flags = IORESOURCE_IRQ,
  212. },
  213. };
  214. static struct platform_device keysc_device = {
  215. .name = "sh_keysc",
  216. .id = 0, /* "keysc0" clock */
  217. .num_resources = ARRAY_SIZE(keysc_resources),
  218. .resource = keysc_resources,
  219. .dev = {
  220. .platform_data = &keysc_info,
  221. },
  222. };
  223. /* SDHI0 */
  224. static struct sh_mobile_sdhi_info sdhi0_info = {
  225. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  226. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  227. };
  228. static struct resource sdhi0_resources[] = {
  229. [0] = {
  230. .name = "SDHI0",
  231. .start = 0xe6850000,
  232. .end = 0xe68501ff,
  233. .flags = IORESOURCE_MEM,
  234. },
  235. [1] = {
  236. .start = evt2irq(0x0e00) /* SDHI0 */,
  237. .flags = IORESOURCE_IRQ,
  238. },
  239. };
  240. static struct platform_device sdhi0_device = {
  241. .name = "sh_mobile_sdhi",
  242. .num_resources = ARRAY_SIZE(sdhi0_resources),
  243. .resource = sdhi0_resources,
  244. .id = 0,
  245. .dev = {
  246. .platform_data = &sdhi0_info,
  247. },
  248. };
  249. /* USB1 */
  250. void usb1_host_port_power(int port, int power)
  251. {
  252. if (!power) /* only power-on supported for now */
  253. return;
  254. /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
  255. __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
  256. }
  257. static struct r8a66597_platdata usb1_host_data = {
  258. .on_chip = 1,
  259. .port_power = usb1_host_port_power,
  260. };
  261. static struct resource usb1_host_resources[] = {
  262. [0] = {
  263. .name = "USBHS",
  264. .start = 0xE68B0000,
  265. .end = 0xE68B00E6 - 1,
  266. .flags = IORESOURCE_MEM,
  267. },
  268. [1] = {
  269. .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
  270. .flags = IORESOURCE_IRQ,
  271. },
  272. };
  273. static struct platform_device usb1_host_device = {
  274. .name = "r8a66597_hcd",
  275. .id = 1,
  276. .dev = {
  277. .dma_mask = NULL, /* not use dma */
  278. .coherent_dma_mask = 0xffffffff,
  279. .platform_data = &usb1_host_data,
  280. },
  281. .num_resources = ARRAY_SIZE(usb1_host_resources),
  282. .resource = usb1_host_resources,
  283. };
  284. static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
  285. .clock_source = LCDC_CLK_PERIPHERAL, /* One of interface clocks */
  286. .ch[0] = {
  287. .chan = LCDC_CHAN_MAINLCD,
  288. .bpp = 16,
  289. .interface_type = RGB24,
  290. .clock_divider = 1,
  291. .flags = LCDC_FLAGS_DWPOL,
  292. .lcd_cfg = {
  293. .name = "R63302(QHD)",
  294. .xres = 544,
  295. .yres = 961,
  296. .left_margin = 72,
  297. .right_margin = 600,
  298. .hsync_len = 16,
  299. .upper_margin = 8,
  300. .lower_margin = 8,
  301. .vsync_len = 2,
  302. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  303. },
  304. .lcd_size_cfg = {
  305. .width = 44,
  306. .height = 79,
  307. },
  308. }
  309. };
  310. static struct resource lcdc_resources[] = {
  311. [0] = {
  312. .name = "LCDC",
  313. .start = 0xfe940000, /* P4-only space */
  314. .end = 0xfe943fff,
  315. .flags = IORESOURCE_MEM,
  316. },
  317. [1] = {
  318. .start = intcs_evt2irq(0x580),
  319. .flags = IORESOURCE_IRQ,
  320. },
  321. };
  322. static struct platform_device lcdc_device = {
  323. .name = "sh_mobile_lcdc_fb",
  324. .num_resources = ARRAY_SIZE(lcdc_resources),
  325. .resource = lcdc_resources,
  326. .dev = {
  327. .platform_data = &sh_mobile_lcdc_info,
  328. .coherent_dma_mask = ~0,
  329. },
  330. };
  331. static struct resource mipidsi0_resources[] = {
  332. [0] = {
  333. .start = 0xffc60000,
  334. .end = 0xffc68fff,
  335. .flags = IORESOURCE_MEM,
  336. },
  337. };
  338. static struct sh_mipi_dsi_info mipidsi0_info = {
  339. .data_format = MIPI_RGB888,
  340. .lcd_chan = &sh_mobile_lcdc_info.ch[0],
  341. };
  342. static struct platform_device mipidsi0_device = {
  343. .name = "sh-mipi-dsi",
  344. .num_resources = ARRAY_SIZE(mipidsi0_resources),
  345. .resource = mipidsi0_resources,
  346. .id = 0,
  347. .dev = {
  348. .platform_data = &mipidsi0_info,
  349. },
  350. };
  351. /* FSI */
  352. #define IRQ_FSI evt2irq(0x1840)
  353. #define FSIACKCR 0xE6150018
  354. static void fsiackcr_init(struct clk *clk)
  355. {
  356. u32 status = __raw_readl(clk->enable_reg);
  357. /* use external clock */
  358. status &= ~0x000000ff;
  359. status |= 0x00000080;
  360. __raw_writel(status, clk->enable_reg);
  361. }
  362. static struct clk_ops fsiackcr_clk_ops = {
  363. .init = fsiackcr_init,
  364. };
  365. static struct clk fsiackcr_clk = {
  366. .ops = &fsiackcr_clk_ops,
  367. .enable_reg = (void __iomem *)FSIACKCR,
  368. .rate = 0, /* unknown */
  369. };
  370. struct sh_fsi_platform_info fsi_info = {
  371. .porta_flags = SH_FSI_BRS_INV |
  372. SH_FSI_OUT_SLAVE_MODE |
  373. SH_FSI_IN_SLAVE_MODE |
  374. SH_FSI_OFMT(PCM) |
  375. SH_FSI_IFMT(PCM),
  376. };
  377. static struct resource fsi_resources[] = {
  378. [0] = {
  379. .name = "FSI",
  380. .start = 0xFE3C0000,
  381. .end = 0xFE3C0400 - 1,
  382. .flags = IORESOURCE_MEM,
  383. },
  384. [1] = {
  385. .start = IRQ_FSI,
  386. .flags = IORESOURCE_IRQ,
  387. },
  388. };
  389. static struct platform_device fsi_device = {
  390. .name = "sh_fsi2",
  391. .id = 0,
  392. .num_resources = ARRAY_SIZE(fsi_resources),
  393. .resource = fsi_resources,
  394. .dev = {
  395. .platform_data = &fsi_info,
  396. },
  397. };
  398. static struct platform_device *ap4evb_devices[] __initdata = {
  399. &nor_flash_device,
  400. &smc911x_device,
  401. &keysc_device,
  402. &sdhi0_device,
  403. &usb1_host_device,
  404. &lcdc_device,
  405. &mipidsi0_device,
  406. &fsi_device,
  407. };
  408. /* TouchScreen (Needs SW3 set to OFF) */
  409. #define IRQ28 evt2irq(0x3380) /* IRQ28A */
  410. struct tsc2007_platform_data tsc2007_info = {
  411. .model = 2007,
  412. .x_plate_ohms = 180,
  413. };
  414. /* I2C */
  415. static struct i2c_board_info i2c0_devices[] = {
  416. {
  417. I2C_BOARD_INFO("ak4643", 0x13),
  418. },
  419. };
  420. static struct i2c_board_info i2c1_devices[] = {
  421. {
  422. I2C_BOARD_INFO("r2025sd", 0x32),
  423. },
  424. {
  425. I2C_BOARD_INFO("tsc2007", 0x48),
  426. .type = "tsc2007",
  427. .platform_data = &tsc2007_info,
  428. .irq = IRQ28,
  429. },
  430. };
  431. static struct map_desc ap4evb_io_desc[] __initdata = {
  432. /* create a 1:1 entity map for 0xe6xxxxxx
  433. * used by CPGA, INTC and PFC.
  434. */
  435. {
  436. .virtual = 0xe6000000,
  437. .pfn = __phys_to_pfn(0xe6000000),
  438. .length = 256 << 20,
  439. .type = MT_DEVICE_NONSHARED
  440. },
  441. };
  442. static void __init ap4evb_map_io(void)
  443. {
  444. iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
  445. /* setup early devices and console here as well */
  446. sh7372_add_early_devices();
  447. shmobile_setup_console();
  448. }
  449. /* This function will disappear when we switch to (runtime) PM */
  450. static int __init ap4evb_init_display_clk(void)
  451. {
  452. struct clk *lcdc_clk;
  453. struct clk *dsitx_clk;
  454. int ret;
  455. lcdc_clk = clk_get(&lcdc_device.dev, "sh_mobile_lcdc_fb.0");
  456. if (IS_ERR(lcdc_clk))
  457. return PTR_ERR(lcdc_clk);
  458. dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0");
  459. if (IS_ERR(dsitx_clk)) {
  460. ret = PTR_ERR(dsitx_clk);
  461. goto eclkdsitxget;
  462. }
  463. ret = clk_enable(lcdc_clk);
  464. if (ret < 0)
  465. goto eclklcdcon;
  466. ret = clk_enable(dsitx_clk);
  467. if (ret < 0)
  468. goto eclkdsitxon;
  469. return 0;
  470. eclkdsitxon:
  471. clk_disable(lcdc_clk);
  472. eclklcdcon:
  473. clk_put(dsitx_clk);
  474. eclkdsitxget:
  475. clk_put(lcdc_clk);
  476. return ret;
  477. }
  478. device_initcall(ap4evb_init_display_clk);
  479. /*
  480. * FIXME !!
  481. *
  482. * gpio_no_direction is quick_hack.
  483. *
  484. * current gpio frame work doesn't have
  485. * the method to control only pull up/down/free.
  486. * this function should be replaced by correct gpio function
  487. */
  488. static void __init gpio_no_direction(u32 addr)
  489. {
  490. __raw_writeb(0x00, addr);
  491. }
  492. #define GPIO_PORT9CR 0xE6051009
  493. #define GPIO_PORT10CR 0xE605100A
  494. static void __init ap4evb_init(void)
  495. {
  496. struct clk *clk;
  497. sh7372_pinmux_init();
  498. /* enable SCIFA0 */
  499. gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
  500. gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
  501. /* enable SMSC911X */
  502. gpio_request(GPIO_FN_CS5A, NULL);
  503. gpio_request(GPIO_FN_IRQ6_39, NULL);
  504. /* enable LED 1 - 4 */
  505. gpio_request(GPIO_PORT185, NULL);
  506. gpio_request(GPIO_PORT186, NULL);
  507. gpio_request(GPIO_PORT187, NULL);
  508. gpio_request(GPIO_PORT188, NULL);
  509. gpio_direction_output(GPIO_PORT185, 1);
  510. gpio_direction_output(GPIO_PORT186, 1);
  511. gpio_direction_output(GPIO_PORT187, 1);
  512. gpio_direction_output(GPIO_PORT188, 1);
  513. gpio_export(GPIO_PORT185, 0);
  514. gpio_export(GPIO_PORT186, 0);
  515. gpio_export(GPIO_PORT187, 0);
  516. gpio_export(GPIO_PORT188, 0);
  517. /* enable Debug switch (S6) */
  518. gpio_request(GPIO_PORT32, NULL);
  519. gpio_request(GPIO_PORT33, NULL);
  520. gpio_request(GPIO_PORT34, NULL);
  521. gpio_request(GPIO_PORT35, NULL);
  522. gpio_direction_input(GPIO_PORT32);
  523. gpio_direction_input(GPIO_PORT33);
  524. gpio_direction_input(GPIO_PORT34);
  525. gpio_direction_input(GPIO_PORT35);
  526. gpio_export(GPIO_PORT32, 0);
  527. gpio_export(GPIO_PORT33, 0);
  528. gpio_export(GPIO_PORT34, 0);
  529. gpio_export(GPIO_PORT35, 0);
  530. /* enable KEYSC */
  531. gpio_request(GPIO_FN_KEYOUT0, NULL);
  532. gpio_request(GPIO_FN_KEYOUT1, NULL);
  533. gpio_request(GPIO_FN_KEYOUT2, NULL);
  534. gpio_request(GPIO_FN_KEYOUT3, NULL);
  535. gpio_request(GPIO_FN_KEYOUT4, NULL);
  536. gpio_request(GPIO_FN_KEYIN0_136, NULL);
  537. gpio_request(GPIO_FN_KEYIN1_135, NULL);
  538. gpio_request(GPIO_FN_KEYIN2_134, NULL);
  539. gpio_request(GPIO_FN_KEYIN3_133, NULL);
  540. gpio_request(GPIO_FN_KEYIN4, NULL);
  541. /* SDHI0 */
  542. gpio_request(GPIO_FN_SDHICD0, NULL);
  543. gpio_request(GPIO_FN_SDHIWP0, NULL);
  544. gpio_request(GPIO_FN_SDHICMD0, NULL);
  545. gpio_request(GPIO_FN_SDHICLK0, NULL);
  546. gpio_request(GPIO_FN_SDHID0_3, NULL);
  547. gpio_request(GPIO_FN_SDHID0_2, NULL);
  548. gpio_request(GPIO_FN_SDHID0_1, NULL);
  549. gpio_request(GPIO_FN_SDHID0_0, NULL);
  550. /* enable TouchScreen */
  551. gpio_request(GPIO_FN_IRQ28_123, NULL);
  552. set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW);
  553. /* USB enable */
  554. gpio_request(GPIO_FN_VBUS0_1, NULL);
  555. gpio_request(GPIO_FN_IDIN_1_18, NULL);
  556. gpio_request(GPIO_FN_PWEN_1_115, NULL);
  557. gpio_request(GPIO_FN_OVCN_1_114, NULL);
  558. gpio_request(GPIO_FN_EXTLP_1, NULL);
  559. gpio_request(GPIO_FN_OVCN2_1, NULL);
  560. /* setup USB phy */
  561. __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */
  562. /* enable FSI2 */
  563. gpio_request(GPIO_FN_FSIAIBT, NULL);
  564. gpio_request(GPIO_FN_FSIAILR, NULL);
  565. gpio_request(GPIO_FN_FSIAISLD, NULL);
  566. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  567. gpio_request(GPIO_PORT161, NULL);
  568. gpio_direction_output(GPIO_PORT161, 0); /* slave */
  569. gpio_request(GPIO_PORT9, NULL);
  570. gpio_request(GPIO_PORT10, NULL);
  571. gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */
  572. gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
  573. /* set SPU2 clock to 119.6 MHz */
  574. clk = clk_get(NULL, "spu_clk");
  575. if (!IS_ERR_VALUE(clk)) {
  576. clk_set_rate(clk, clk_round_rate(clk, 119600000));
  577. clk_put(clk);
  578. }
  579. /* change parent of FSI A */
  580. clk = clk_get(NULL, "fsia_clk");
  581. if (!IS_ERR_VALUE(clk)) {
  582. clk_register(&fsiackcr_clk);
  583. clk_set_parent(clk, &fsiackcr_clk);
  584. clk_put(clk);
  585. }
  586. /*
  587. * set irq priority, to avoid sound chopping
  588. * when NFS rootfs is used
  589. * FSI(3) > SMSC911X(2)
  590. */
  591. intc_set_priority(IRQ_FSI, 3);
  592. i2c_register_board_info(0, i2c0_devices,
  593. ARRAY_SIZE(i2c0_devices));
  594. i2c_register_board_info(1, i2c1_devices,
  595. ARRAY_SIZE(i2c1_devices));
  596. sh7372_add_standard_devices();
  597. platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
  598. }
  599. static void __init ap4evb_timer_init(void)
  600. {
  601. sh7372_clock_init();
  602. shmobile_timer.init();
  603. }
  604. static struct sys_timer ap4evb_timer = {
  605. .init = ap4evb_timer_init,
  606. };
  607. MACHINE_START(AP4EVB, "ap4evb")
  608. .phys_io = 0xe6000000,
  609. .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
  610. .map_io = ap4evb_map_io,
  611. .init_irq = sh7372_init_irq,
  612. .init_machine = ap4evb_init,
  613. .timer = &ap4evb_timer,
  614. MACHINE_END