board-mackerel.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  1. /*
  2. * mackerel board support
  3. *
  4. * Copyright (C) 2010 Renesas Solutions Corp.
  5. * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  6. *
  7. * based on ap4evb
  8. * Copyright (C) 2010 Magnus Damm
  9. * Copyright (C) 2008 Yoshihiro Shimoda
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; version 2 of the License.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #include <linux/delay.h>
  25. #include <linux/kernel.h>
  26. #include <linux/init.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/irq.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/gpio.h>
  31. #include <linux/input.h>
  32. #include <linux/io.h>
  33. #include <linux/i2c.h>
  34. #include <linux/leds.h>
  35. #include <linux/mfd/tmio.h>
  36. #include <linux/mmc/host.h>
  37. #include <linux/mmc/sh_mmcif.h>
  38. #include <linux/mmc/sh_mobile_sdhi.h>
  39. #include <linux/mtd/mtd.h>
  40. #include <linux/mtd/partitions.h>
  41. #include <linux/mtd/physmap.h>
  42. #include <linux/smsc911x.h>
  43. #include <linux/sh_intc.h>
  44. #include <linux/tca6416_keypad.h>
  45. #include <linux/usb/r8a66597.h>
  46. #include <video/sh_mobile_hdmi.h>
  47. #include <video/sh_mobile_lcdc.h>
  48. #include <media/sh_mobile_ceu.h>
  49. #include <media/soc_camera.h>
  50. #include <media/soc_camera_platform.h>
  51. #include <sound/sh_fsi.h>
  52. #include <mach/common.h>
  53. #include <mach/sh7372.h>
  54. #include <asm/mach/arch.h>
  55. #include <asm/mach/time.h>
  56. #include <asm/mach/map.h>
  57. #include <asm/mach-types.h>
  58. /*
  59. * Address Interface BusWidth note
  60. * ------------------------------------------------------------------
  61. * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
  62. * 0x0800_0000 user area -
  63. * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
  64. * 0x1400_0000 Ether (LAN9220) 16bit
  65. * 0x1600_0000 user area - cannot use with NAND
  66. * 0x1800_0000 user area -
  67. * 0x1A00_0000 -
  68. * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
  69. */
  70. /*
  71. * CPU mode
  72. *
  73. * SW4 | Boot Area| Master | Remarks
  74. * 1 | 2 | 3 | 4 | 5 | 6 | 8 | | Processor|
  75. * ----+-----+-----+-----+-----+-----+-----+----------+----------+--------------
  76. * ON | ON | OFF | ON | ON | OFF | OFF | External | System | External ROM
  77. * ON | ON | ON | ON | ON | OFF | OFF | External | System | ROM Debug
  78. * ON | ON | X | ON | OFF | OFF | OFF | Built-in | System | ROM Debug
  79. * X | OFF | X | X | X | X | OFF | Built-in | System | MaskROM
  80. * OFF | X | X | X | X | X | OFF | Built-in | System | MaskROM
  81. * X | X | X | OFF | X | X | OFF | Built-in | System | MaskROM
  82. * OFF | ON | OFF | X | X | OFF | ON | External | System | Standalone
  83. * ON | OFF | OFF | X | X | OFF | ON | External | Realtime | Standalone
  84. */
  85. /*
  86. * NOR Flash ROM
  87. *
  88. * SW1 | SW2 | SW7 | NOR Flash ROM
  89. * bit1 | bit1 bit2 | bit1 | Memory allocation
  90. * ------+------------+------+------------------
  91. * OFF | ON OFF | ON | Area 0
  92. * OFF | ON OFF | OFF | Area 4
  93. */
  94. /*
  95. * SMSC 9220
  96. *
  97. * SW1 SMSC 9220
  98. * -----------------------
  99. * ON access disable
  100. * OFF access enable
  101. */
  102. /*
  103. * NAND Flash ROM
  104. *
  105. * SW1 | SW2 | SW7 | NAND Flash ROM
  106. * bit1 | bit1 bit2 | bit2 | Memory allocation
  107. * ------+------------+------+------------------
  108. * OFF | ON OFF | ON | FCE 0
  109. * OFF | ON OFF | OFF | FCE 1
  110. */
  111. /*
  112. * External interrupt pin settings
  113. *
  114. * IRQX | pin setting | device | level
  115. * ------+--------------------+--------------------+-------
  116. * IRQ0 | ICR1A.IRQ0SA=0010 | SDHI2 card detect | Low
  117. * IRQ6 | ICR1A.IRQ6SA=0011 | Ether(LAN9220) | High
  118. * IRQ7 | ICR1A.IRQ7SA=0010 | LCD Tuch Panel | Low
  119. * IRQ8 | ICR2A.IRQ8SA=0010 | MMC/SD card detect | Low
  120. * IRQ9 | ICR2A.IRQ9SA=0010 | KEY(TCA6408) | Low
  121. * IRQ21 | ICR4A.IRQ21SA=0011 | Sensor(ADXL345) | High
  122. * IRQ22 | ICR4A.IRQ22SA=0011 | Sensor(AK8975) | High
  123. */
  124. /*
  125. * USB
  126. *
  127. * USB0 : CN22 : Function
  128. * USB1 : CN31 : Function/Host *1
  129. *
  130. * J30 (for CN31) *1
  131. * ----------+---------------+-------------
  132. * 1-2 short | VBUS 5V | Host
  133. * open | external VBUS | Function
  134. *
  135. * *1
  136. * CN31 is used as Host in Linux.
  137. */
  138. /*
  139. * SDHI0 (CN12)
  140. *
  141. * SW56 : OFF
  142. *
  143. */
  144. /* MMC /SDHI1 (CN7)
  145. *
  146. * I/O voltage : 1.8v
  147. *
  148. * Power voltage : 1.8v or 3.3v
  149. * J22 : select power voltage *1
  150. * 1-2 pin : 1.8v
  151. * 2-3 pin : 3.3v
  152. *
  153. * *1
  154. * Please change J22 depends the card to be used.
  155. * MMC's OCR field set to support either voltage for the card inserted.
  156. *
  157. * SW1 | SW33
  158. * | bit1 | bit2 | bit3 | bit4
  159. * -------------+------+------+------+-------
  160. * MMC0 OFF | OFF | X | ON | X (Use MMCIF)
  161. * SDHI1 OFF | ON | X | OFF | X (Use MFD_SH_MOBILE_SDHI)
  162. *
  163. */
  164. /*
  165. * SDHI2 (CN23)
  166. *
  167. * microSD card sloct
  168. *
  169. */
  170. /*
  171. * FIXME !!
  172. *
  173. * gpio_no_direction
  174. * are quick_hack.
  175. *
  176. * current gpio frame work doesn't have
  177. * the method to control only pull up/down/free.
  178. * this function should be replaced by correct gpio function
  179. */
  180. static void __init gpio_no_direction(u32 addr)
  181. {
  182. __raw_writeb(0x00, addr);
  183. }
  184. /* MTD */
  185. static struct mtd_partition nor_flash_partitions[] = {
  186. {
  187. .name = "loader",
  188. .offset = 0x00000000,
  189. .size = 512 * 1024,
  190. .mask_flags = MTD_WRITEABLE,
  191. },
  192. {
  193. .name = "bootenv",
  194. .offset = MTDPART_OFS_APPEND,
  195. .size = 512 * 1024,
  196. .mask_flags = MTD_WRITEABLE,
  197. },
  198. {
  199. .name = "kernel_ro",
  200. .offset = MTDPART_OFS_APPEND,
  201. .size = 8 * 1024 * 1024,
  202. .mask_flags = MTD_WRITEABLE,
  203. },
  204. {
  205. .name = "kernel",
  206. .offset = MTDPART_OFS_APPEND,
  207. .size = 8 * 1024 * 1024,
  208. },
  209. {
  210. .name = "data",
  211. .offset = MTDPART_OFS_APPEND,
  212. .size = MTDPART_SIZ_FULL,
  213. },
  214. };
  215. static struct physmap_flash_data nor_flash_data = {
  216. .width = 2,
  217. .parts = nor_flash_partitions,
  218. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  219. };
  220. static struct resource nor_flash_resources[] = {
  221. [0] = {
  222. .start = 0x00000000,
  223. .end = 0x08000000 - 1,
  224. .flags = IORESOURCE_MEM,
  225. }
  226. };
  227. static struct platform_device nor_flash_device = {
  228. .name = "physmap-flash",
  229. .dev = {
  230. .platform_data = &nor_flash_data,
  231. },
  232. .num_resources = ARRAY_SIZE(nor_flash_resources),
  233. .resource = nor_flash_resources,
  234. };
  235. /* SMSC */
  236. static struct resource smc911x_resources[] = {
  237. {
  238. .start = 0x14000000,
  239. .end = 0x16000000 - 1,
  240. .flags = IORESOURCE_MEM,
  241. }, {
  242. .start = evt2irq(0x02c0) /* IRQ6A */,
  243. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  244. },
  245. };
  246. static struct smsc911x_platform_config smsc911x_info = {
  247. .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
  248. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  249. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  250. };
  251. static struct platform_device smc911x_device = {
  252. .name = "smsc911x",
  253. .id = -1,
  254. .num_resources = ARRAY_SIZE(smc911x_resources),
  255. .resource = smc911x_resources,
  256. .dev = {
  257. .platform_data = &smsc911x_info,
  258. },
  259. };
  260. /* LCDC */
  261. static struct fb_videomode mackerel_lcdc_modes[] = {
  262. {
  263. .name = "WVGA Panel",
  264. .xres = 800,
  265. .yres = 480,
  266. .left_margin = 220,
  267. .right_margin = 110,
  268. .hsync_len = 70,
  269. .upper_margin = 20,
  270. .lower_margin = 5,
  271. .vsync_len = 5,
  272. .sync = 0,
  273. },
  274. };
  275. static int mackerel_set_brightness(void *board_data, int brightness)
  276. {
  277. gpio_set_value(GPIO_PORT31, brightness);
  278. return 0;
  279. }
  280. static int mackerel_get_brightness(void *board_data)
  281. {
  282. return gpio_get_value(GPIO_PORT31);
  283. }
  284. static struct sh_mobile_lcdc_info lcdc_info = {
  285. .clock_source = LCDC_CLK_BUS,
  286. .ch[0] = {
  287. .chan = LCDC_CHAN_MAINLCD,
  288. .bpp = 16,
  289. .lcd_cfg = mackerel_lcdc_modes,
  290. .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
  291. .interface_type = RGB24,
  292. .clock_divider = 3,
  293. .flags = 0,
  294. .lcd_size_cfg.width = 152,
  295. .lcd_size_cfg.height = 91,
  296. .board_cfg = {
  297. .set_brightness = mackerel_set_brightness,
  298. .get_brightness = mackerel_get_brightness,
  299. },
  300. .bl_info = {
  301. .name = "sh_mobile_lcdc_bl",
  302. .max_brightness = 1,
  303. },
  304. }
  305. };
  306. static struct resource lcdc_resources[] = {
  307. [0] = {
  308. .name = "LCDC",
  309. .start = 0xfe940000,
  310. .end = 0xfe943fff,
  311. .flags = IORESOURCE_MEM,
  312. },
  313. [1] = {
  314. .start = intcs_evt2irq(0x580),
  315. .flags = IORESOURCE_IRQ,
  316. },
  317. };
  318. static struct platform_device lcdc_device = {
  319. .name = "sh_mobile_lcdc_fb",
  320. .num_resources = ARRAY_SIZE(lcdc_resources),
  321. .resource = lcdc_resources,
  322. .dev = {
  323. .platform_data = &lcdc_info,
  324. .coherent_dma_mask = ~0,
  325. },
  326. };
  327. /* HDMI */
  328. static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
  329. .clock_source = LCDC_CLK_EXTERNAL,
  330. .ch[0] = {
  331. .chan = LCDC_CHAN_MAINLCD,
  332. .bpp = 16,
  333. .interface_type = RGB24,
  334. .clock_divider = 1,
  335. .flags = LCDC_FLAGS_DWPOL,
  336. }
  337. };
  338. static struct resource hdmi_lcdc_resources[] = {
  339. [0] = {
  340. .name = "LCDC1",
  341. .start = 0xfe944000,
  342. .end = 0xfe947fff,
  343. .flags = IORESOURCE_MEM,
  344. },
  345. [1] = {
  346. .start = intcs_evt2irq(0x1780),
  347. .flags = IORESOURCE_IRQ,
  348. },
  349. };
  350. static struct platform_device hdmi_lcdc_device = {
  351. .name = "sh_mobile_lcdc_fb",
  352. .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
  353. .resource = hdmi_lcdc_resources,
  354. .id = 1,
  355. .dev = {
  356. .platform_data = &hdmi_lcdc_info,
  357. .coherent_dma_mask = ~0,
  358. },
  359. };
  360. static struct sh_mobile_hdmi_info hdmi_info = {
  361. .lcd_chan = &hdmi_lcdc_info.ch[0],
  362. .lcd_dev = &hdmi_lcdc_device.dev,
  363. .flags = HDMI_SND_SRC_SPDIF,
  364. };
  365. static struct resource hdmi_resources[] = {
  366. [0] = {
  367. .name = "HDMI",
  368. .start = 0xe6be0000,
  369. .end = 0xe6be00ff,
  370. .flags = IORESOURCE_MEM,
  371. },
  372. [1] = {
  373. /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
  374. .start = evt2irq(0x17e0),
  375. .flags = IORESOURCE_IRQ,
  376. },
  377. };
  378. static struct platform_device hdmi_device = {
  379. .name = "sh-mobile-hdmi",
  380. .num_resources = ARRAY_SIZE(hdmi_resources),
  381. .resource = hdmi_resources,
  382. .id = -1,
  383. .dev = {
  384. .platform_data = &hdmi_info,
  385. },
  386. };
  387. static struct platform_device fsi_hdmi_device = {
  388. .name = "sh_fsi2_b_hdmi",
  389. };
  390. static int __init hdmi_init_pm_clock(void)
  391. {
  392. struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
  393. int ret;
  394. long rate;
  395. if (IS_ERR(hdmi_ick)) {
  396. ret = PTR_ERR(hdmi_ick);
  397. pr_err("Cannot get HDMI ICK: %d\n", ret);
  398. goto out;
  399. }
  400. ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk);
  401. if (ret < 0) {
  402. pr_err("Cannot set PLLC2 parent: %d, %d users\n",
  403. ret, sh7372_pllc2_clk.usecount);
  404. goto out;
  405. }
  406. pr_debug("PLLC2 initial frequency %lu\n",
  407. clk_get_rate(&sh7372_pllc2_clk));
  408. rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
  409. if (rate < 0) {
  410. pr_err("Cannot get suitable rate: %ld\n", rate);
  411. ret = rate;
  412. goto out;
  413. }
  414. ret = clk_set_rate(&sh7372_pllc2_clk, rate);
  415. if (ret < 0) {
  416. pr_err("Cannot set rate %ld: %d\n", rate, ret);
  417. goto out;
  418. }
  419. ret = clk_enable(&sh7372_pllc2_clk);
  420. if (ret < 0) {
  421. pr_err("Cannot enable pllc2 clock\n");
  422. goto out;
  423. }
  424. pr_debug("PLLC2 set frequency %lu\n", rate);
  425. ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
  426. if (ret < 0) {
  427. pr_err("Cannot set HDMI parent: %d\n", ret);
  428. goto out;
  429. }
  430. out:
  431. if (!IS_ERR(hdmi_ick))
  432. clk_put(hdmi_ick);
  433. return ret;
  434. }
  435. device_initcall(hdmi_init_pm_clock);
  436. /* USB1 (Host) */
  437. static void usb1_host_port_power(int port, int power)
  438. {
  439. if (!power) /* only power-on is supported for now */
  440. return;
  441. /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
  442. __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
  443. }
  444. static struct r8a66597_platdata usb1_host_data = {
  445. .on_chip = 1,
  446. .port_power = usb1_host_port_power,
  447. };
  448. static struct resource usb1_host_resources[] = {
  449. [0] = {
  450. .name = "USBHS",
  451. .start = 0xE68B0000,
  452. .end = 0xE68B00E6 - 1,
  453. .flags = IORESOURCE_MEM,
  454. },
  455. [1] = {
  456. .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
  457. .flags = IORESOURCE_IRQ,
  458. },
  459. };
  460. static struct platform_device usb1_host_device = {
  461. .name = "r8a66597_hcd",
  462. .id = 1,
  463. .dev = {
  464. .dma_mask = NULL, /* not use dma */
  465. .coherent_dma_mask = 0xffffffff,
  466. .platform_data = &usb1_host_data,
  467. },
  468. .num_resources = ARRAY_SIZE(usb1_host_resources),
  469. .resource = usb1_host_resources,
  470. };
  471. /* LED */
  472. static struct gpio_led mackerel_leds[] = {
  473. {
  474. .name = "led0",
  475. .gpio = GPIO_PORT0,
  476. .default_state = LEDS_GPIO_DEFSTATE_ON,
  477. },
  478. {
  479. .name = "led1",
  480. .gpio = GPIO_PORT1,
  481. .default_state = LEDS_GPIO_DEFSTATE_ON,
  482. },
  483. {
  484. .name = "led2",
  485. .gpio = GPIO_PORT2,
  486. .default_state = LEDS_GPIO_DEFSTATE_ON,
  487. },
  488. {
  489. .name = "led3",
  490. .gpio = GPIO_PORT159,
  491. .default_state = LEDS_GPIO_DEFSTATE_ON,
  492. }
  493. };
  494. static struct gpio_led_platform_data mackerel_leds_pdata = {
  495. .leds = mackerel_leds,
  496. .num_leds = ARRAY_SIZE(mackerel_leds),
  497. };
  498. static struct platform_device leds_device = {
  499. .name = "leds-gpio",
  500. .id = 0,
  501. .dev = {
  502. .platform_data = &mackerel_leds_pdata,
  503. },
  504. };
  505. /* FSI */
  506. #define IRQ_FSI evt2irq(0x1840)
  507. static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
  508. {
  509. int ret;
  510. if (rate <= 0)
  511. return 0;
  512. if (!enable) {
  513. clk_disable(clk);
  514. return 0;
  515. }
  516. ret = clk_set_rate(clk, clk_round_rate(clk, rate));
  517. if (ret < 0)
  518. return ret;
  519. return clk_enable(clk);
  520. }
  521. static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
  522. {
  523. struct clk *fsib_clk;
  524. struct clk *fdiv_clk = &sh7372_fsidivb_clk;
  525. long fsib_rate = 0;
  526. long fdiv_rate = 0;
  527. int ackmd_bpfmd;
  528. int ret;
  529. /* FSIA is slave mode. nothing to do here */
  530. if (is_porta)
  531. return 0;
  532. /* clock start */
  533. switch (rate) {
  534. case 44100:
  535. fsib_rate = rate * 256;
  536. ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
  537. break;
  538. case 48000:
  539. fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
  540. fdiv_rate = rate * 256;
  541. ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
  542. break;
  543. default:
  544. pr_err("unsupported rate in FSI2 port B\n");
  545. return -EINVAL;
  546. }
  547. /* FSI B setting */
  548. fsib_clk = clk_get(dev, "ickb");
  549. if (IS_ERR(fsib_clk))
  550. return -EIO;
  551. /* fsib */
  552. ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
  553. if (ret < 0)
  554. goto fsi_set_rate_end;
  555. /* FSI DIV */
  556. ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
  557. if (ret < 0) {
  558. /* disable FSI B */
  559. if (enable)
  560. __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
  561. goto fsi_set_rate_end;
  562. }
  563. ret = ackmd_bpfmd;
  564. fsi_set_rate_end:
  565. clk_put(fsib_clk);
  566. return ret;
  567. }
  568. static struct sh_fsi_platform_info fsi_info = {
  569. .porta_flags = SH_FSI_BRS_INV,
  570. .portb_flags = SH_FSI_BRS_INV |
  571. SH_FSI_BRM_INV |
  572. SH_FSI_LRS_INV |
  573. SH_FSI_FMT_SPDIF,
  574. .set_rate = fsi_set_rate,
  575. };
  576. static struct resource fsi_resources[] = {
  577. [0] = {
  578. .name = "FSI",
  579. .start = 0xFE3C0000,
  580. .end = 0xFE3C0400 - 1,
  581. .flags = IORESOURCE_MEM,
  582. },
  583. [1] = {
  584. .start = IRQ_FSI,
  585. .flags = IORESOURCE_IRQ,
  586. },
  587. };
  588. static struct platform_device fsi_device = {
  589. .name = "sh_fsi2",
  590. .id = -1,
  591. .num_resources = ARRAY_SIZE(fsi_resources),
  592. .resource = fsi_resources,
  593. .dev = {
  594. .platform_data = &fsi_info,
  595. },
  596. };
  597. static struct platform_device fsi_ak4643_device = {
  598. .name = "sh_fsi2_a_ak4643",
  599. };
  600. /*
  601. * The card detect pin of the top SD/MMC slot (CN7) is active low and is
  602. * connected to GPIO A22 of SH7372 (GPIO_PORT41).
  603. */
  604. static int slot_cn7_get_cd(struct platform_device *pdev)
  605. {
  606. return !gpio_get_value(GPIO_PORT41);
  607. }
  608. /* SDHI0 */
  609. static struct sh_mobile_sdhi_info sdhi0_info = {
  610. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  611. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  612. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
  613. };
  614. static struct resource sdhi0_resources[] = {
  615. [0] = {
  616. .name = "SDHI0",
  617. .start = 0xe6850000,
  618. .end = 0xe68500ff,
  619. .flags = IORESOURCE_MEM,
  620. },
  621. [1] = {
  622. .start = evt2irq(0x0e00) /* SDHI0 */,
  623. .flags = IORESOURCE_IRQ,
  624. },
  625. };
  626. static struct platform_device sdhi0_device = {
  627. .name = "sh_mobile_sdhi",
  628. .num_resources = ARRAY_SIZE(sdhi0_resources),
  629. .resource = sdhi0_resources,
  630. .id = 0,
  631. .dev = {
  632. .platform_data = &sdhi0_info,
  633. },
  634. };
  635. #if !defined(CONFIG_MMC_SH_MMCIF)
  636. /* SDHI1 */
  637. static struct sh_mobile_sdhi_info sdhi1_info = {
  638. .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
  639. .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
  640. .tmio_ocr_mask = MMC_VDD_165_195,
  641. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
  642. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
  643. MMC_CAP_NEEDS_POLL,
  644. .get_cd = slot_cn7_get_cd,
  645. };
  646. static struct resource sdhi1_resources[] = {
  647. [0] = {
  648. .name = "SDHI1",
  649. .start = 0xe6860000,
  650. .end = 0xe68600ff,
  651. .flags = IORESOURCE_MEM,
  652. },
  653. [1] = {
  654. .start = evt2irq(0x0e80),
  655. .flags = IORESOURCE_IRQ,
  656. },
  657. };
  658. static struct platform_device sdhi1_device = {
  659. .name = "sh_mobile_sdhi",
  660. .num_resources = ARRAY_SIZE(sdhi1_resources),
  661. .resource = sdhi1_resources,
  662. .id = 1,
  663. .dev = {
  664. .platform_data = &sdhi1_info,
  665. },
  666. };
  667. #endif
  668. /*
  669. * The card detect pin of the top SD/MMC slot (CN23) is active low and is
  670. * connected to GPIO SCIFB_SCK of SH7372 (GPIO_PORT162).
  671. */
  672. static int slot_cn23_get_cd(struct platform_device *pdev)
  673. {
  674. return !gpio_get_value(GPIO_PORT162);
  675. }
  676. /* SDHI2 */
  677. static struct sh_mobile_sdhi_info sdhi2_info = {
  678. .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
  679. .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
  680. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
  681. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
  682. MMC_CAP_NEEDS_POLL,
  683. .get_cd = slot_cn23_get_cd,
  684. };
  685. static struct resource sdhi2_resources[] = {
  686. [0] = {
  687. .name = "SDHI2",
  688. .start = 0xe6870000,
  689. .end = 0xe68700ff,
  690. .flags = IORESOURCE_MEM,
  691. },
  692. [1] = {
  693. .start = evt2irq(0x1200),
  694. .flags = IORESOURCE_IRQ,
  695. },
  696. };
  697. static struct platform_device sdhi2_device = {
  698. .name = "sh_mobile_sdhi",
  699. .num_resources = ARRAY_SIZE(sdhi2_resources),
  700. .resource = sdhi2_resources,
  701. .id = 2,
  702. .dev = {
  703. .platform_data = &sdhi2_info,
  704. },
  705. };
  706. /* SH_MMCIF */
  707. static struct resource sh_mmcif_resources[] = {
  708. [0] = {
  709. .name = "MMCIF",
  710. .start = 0xE6BD0000,
  711. .end = 0xE6BD00FF,
  712. .flags = IORESOURCE_MEM,
  713. },
  714. [1] = {
  715. /* MMC ERR */
  716. .start = evt2irq(0x1ac0),
  717. .flags = IORESOURCE_IRQ,
  718. },
  719. [2] = {
  720. /* MMC NOR */
  721. .start = evt2irq(0x1ae0),
  722. .flags = IORESOURCE_IRQ,
  723. },
  724. };
  725. static struct sh_mmcif_plat_data sh_mmcif_plat = {
  726. .sup_pclk = 0,
  727. .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  728. .caps = MMC_CAP_4_BIT_DATA |
  729. MMC_CAP_8_BIT_DATA |
  730. MMC_CAP_NEEDS_POLL,
  731. .get_cd = slot_cn7_get_cd,
  732. };
  733. static struct platform_device sh_mmcif_device = {
  734. .name = "sh_mmcif",
  735. .id = 0,
  736. .dev = {
  737. .dma_mask = NULL,
  738. .coherent_dma_mask = 0xffffffff,
  739. .platform_data = &sh_mmcif_plat,
  740. },
  741. .num_resources = ARRAY_SIZE(sh_mmcif_resources),
  742. .resource = sh_mmcif_resources,
  743. };
  744. static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev);
  745. static void mackerel_camera_del(struct soc_camera_link *icl);
  746. static int camera_set_capture(struct soc_camera_platform_info *info,
  747. int enable)
  748. {
  749. return 0; /* camera sensor always enabled */
  750. }
  751. static struct soc_camera_platform_info camera_info = {
  752. .format_name = "UYVY",
  753. .format_depth = 16,
  754. .format = {
  755. .code = V4L2_MBUS_FMT_UYVY8_2X8,
  756. .colorspace = V4L2_COLORSPACE_SMPTE170M,
  757. .field = V4L2_FIELD_NONE,
  758. .width = 640,
  759. .height = 480,
  760. },
  761. .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
  762. SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8 |
  763. SOCAM_DATA_ACTIVE_HIGH,
  764. .set_capture = camera_set_capture,
  765. };
  766. static struct soc_camera_link camera_link = {
  767. .bus_id = 0,
  768. .add_device = mackerel_camera_add,
  769. .del_device = mackerel_camera_del,
  770. .module_name = "soc_camera_platform",
  771. .priv = &camera_info,
  772. };
  773. static void dummy_release(struct device *dev)
  774. {
  775. }
  776. static struct platform_device camera_device = {
  777. .name = "soc_camera_platform",
  778. .dev = {
  779. .platform_data = &camera_info,
  780. .release = dummy_release,
  781. },
  782. };
  783. static int mackerel_camera_add(struct soc_camera_link *icl,
  784. struct device *dev)
  785. {
  786. if (icl != &camera_link)
  787. return -ENODEV;
  788. camera_info.dev = dev;
  789. return platform_device_register(&camera_device);
  790. }
  791. static void mackerel_camera_del(struct soc_camera_link *icl)
  792. {
  793. if (icl != &camera_link)
  794. return;
  795. platform_device_unregister(&camera_device);
  796. memset(&camera_device.dev.kobj, 0,
  797. sizeof(camera_device.dev.kobj));
  798. }
  799. static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
  800. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  801. };
  802. static struct resource ceu_resources[] = {
  803. [0] = {
  804. .name = "CEU",
  805. .start = 0xfe910000,
  806. .end = 0xfe91009f,
  807. .flags = IORESOURCE_MEM,
  808. },
  809. [1] = {
  810. .start = intcs_evt2irq(0x880),
  811. .flags = IORESOURCE_IRQ,
  812. },
  813. [2] = {
  814. /* place holder for contiguous memory */
  815. },
  816. };
  817. static struct platform_device ceu_device = {
  818. .name = "sh_mobile_ceu",
  819. .id = 0, /* "ceu0" clock */
  820. .num_resources = ARRAY_SIZE(ceu_resources),
  821. .resource = ceu_resources,
  822. .dev = {
  823. .platform_data = &sh_mobile_ceu_info,
  824. .coherent_dma_mask = 0xffffffff,
  825. },
  826. };
  827. static struct platform_device mackerel_camera = {
  828. .name = "soc-camera-pdrv",
  829. .id = 0,
  830. .dev = {
  831. .platform_data = &camera_link,
  832. },
  833. };
  834. static struct platform_device *mackerel_devices[] __initdata = {
  835. &nor_flash_device,
  836. &smc911x_device,
  837. &lcdc_device,
  838. &usb1_host_device,
  839. &leds_device,
  840. &fsi_device,
  841. &fsi_ak4643_device,
  842. &fsi_hdmi_device,
  843. &sdhi0_device,
  844. #if !defined(CONFIG_MMC_SH_MMCIF)
  845. &sdhi1_device,
  846. #endif
  847. &sdhi2_device,
  848. &sh_mmcif_device,
  849. &ceu_device,
  850. &mackerel_camera,
  851. &hdmi_lcdc_device,
  852. &hdmi_device,
  853. };
  854. /* Keypad Initialization */
  855. #define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
  856. { \
  857. .type = ev_type, \
  858. .code = ev_code, \
  859. .active_low = act_low, \
  860. }
  861. #define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)
  862. static struct tca6416_button mackerel_gpio_keys[] = {
  863. KEYPAD_BUTTON_LOW(KEY_HOME),
  864. KEYPAD_BUTTON_LOW(KEY_MENU),
  865. KEYPAD_BUTTON_LOW(KEY_BACK),
  866. KEYPAD_BUTTON_LOW(KEY_POWER),
  867. };
  868. static struct tca6416_keys_platform_data mackerel_tca6416_keys_info = {
  869. .buttons = mackerel_gpio_keys,
  870. .nbuttons = ARRAY_SIZE(mackerel_gpio_keys),
  871. .rep = 1,
  872. .use_polling = 0,
  873. .pinmask = 0x000F,
  874. };
  875. /* I2C */
  876. #define IRQ7 evt2irq(0x02e0)
  877. #define IRQ9 evt2irq(0x0320)
  878. static struct i2c_board_info i2c0_devices[] = {
  879. {
  880. I2C_BOARD_INFO("ak4643", 0x13),
  881. },
  882. /* Keypad */
  883. {
  884. I2C_BOARD_INFO("tca6408-keys", 0x20),
  885. .platform_data = &mackerel_tca6416_keys_info,
  886. .irq = IRQ9,
  887. },
  888. /* Touchscreen */
  889. {
  890. I2C_BOARD_INFO("st1232-ts", 0x55),
  891. .irq = IRQ7,
  892. },
  893. };
  894. #define IRQ21 evt2irq(0x32a0)
  895. static struct i2c_board_info i2c1_devices[] = {
  896. /* Accelerometer */
  897. {
  898. I2C_BOARD_INFO("adxl34x", 0x53),
  899. .irq = IRQ21,
  900. },
  901. };
  902. static struct map_desc mackerel_io_desc[] __initdata = {
  903. /* create a 1:1 entity map for 0xe6xxxxxx
  904. * used by CPGA, INTC and PFC.
  905. */
  906. {
  907. .virtual = 0xe6000000,
  908. .pfn = __phys_to_pfn(0xe6000000),
  909. .length = 256 << 20,
  910. .type = MT_DEVICE_NONSHARED
  911. },
  912. };
  913. static void __init mackerel_map_io(void)
  914. {
  915. iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
  916. /* setup early devices and console here as well */
  917. sh7372_add_early_devices();
  918. shmobile_setup_console();
  919. }
  920. #define GPIO_PORT9CR 0xE6051009
  921. #define GPIO_PORT10CR 0xE605100A
  922. #define SRCR4 0xe61580bc
  923. #define USCCR1 0xE6058144
  924. static void __init mackerel_init(void)
  925. {
  926. u32 srcr4;
  927. struct clk *clk;
  928. sh7372_pinmux_init();
  929. /* enable SCIFA0 */
  930. gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
  931. gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
  932. /* enable SMSC911X */
  933. gpio_request(GPIO_FN_CS5A, NULL);
  934. gpio_request(GPIO_FN_IRQ6_39, NULL);
  935. /* LCDC */
  936. gpio_request(GPIO_FN_LCDD23, NULL);
  937. gpio_request(GPIO_FN_LCDD22, NULL);
  938. gpio_request(GPIO_FN_LCDD21, NULL);
  939. gpio_request(GPIO_FN_LCDD20, NULL);
  940. gpio_request(GPIO_FN_LCDD19, NULL);
  941. gpio_request(GPIO_FN_LCDD18, NULL);
  942. gpio_request(GPIO_FN_LCDD17, NULL);
  943. gpio_request(GPIO_FN_LCDD16, NULL);
  944. gpio_request(GPIO_FN_LCDD15, NULL);
  945. gpio_request(GPIO_FN_LCDD14, NULL);
  946. gpio_request(GPIO_FN_LCDD13, NULL);
  947. gpio_request(GPIO_FN_LCDD12, NULL);
  948. gpio_request(GPIO_FN_LCDD11, NULL);
  949. gpio_request(GPIO_FN_LCDD10, NULL);
  950. gpio_request(GPIO_FN_LCDD9, NULL);
  951. gpio_request(GPIO_FN_LCDD8, NULL);
  952. gpio_request(GPIO_FN_LCDD7, NULL);
  953. gpio_request(GPIO_FN_LCDD6, NULL);
  954. gpio_request(GPIO_FN_LCDD5, NULL);
  955. gpio_request(GPIO_FN_LCDD4, NULL);
  956. gpio_request(GPIO_FN_LCDD3, NULL);
  957. gpio_request(GPIO_FN_LCDD2, NULL);
  958. gpio_request(GPIO_FN_LCDD1, NULL);
  959. gpio_request(GPIO_FN_LCDD0, NULL);
  960. gpio_request(GPIO_FN_LCDDISP, NULL);
  961. gpio_request(GPIO_FN_LCDDCK, NULL);
  962. gpio_request(GPIO_PORT31, NULL); /* backlight */
  963. gpio_direction_output(GPIO_PORT31, 0); /* off by default */
  964. gpio_request(GPIO_PORT151, NULL); /* LCDDON */
  965. gpio_direction_output(GPIO_PORT151, 1);
  966. /* USB enable */
  967. gpio_request(GPIO_FN_VBUS0_1, NULL);
  968. gpio_request(GPIO_FN_IDIN_1_18, NULL);
  969. gpio_request(GPIO_FN_PWEN_1_115, NULL);
  970. gpio_request(GPIO_FN_OVCN_1_114, NULL);
  971. gpio_request(GPIO_FN_EXTLP_1, NULL);
  972. gpio_request(GPIO_FN_OVCN2_1, NULL);
  973. /* setup USB phy */
  974. __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */
  975. /* enable FSI2 port A (ak4643) */
  976. gpio_request(GPIO_FN_FSIAIBT, NULL);
  977. gpio_request(GPIO_FN_FSIAILR, NULL);
  978. gpio_request(GPIO_FN_FSIAISLD, NULL);
  979. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  980. gpio_request(GPIO_PORT161, NULL);
  981. gpio_direction_output(GPIO_PORT161, 0); /* slave */
  982. gpio_request(GPIO_PORT9, NULL);
  983. gpio_request(GPIO_PORT10, NULL);
  984. gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */
  985. gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
  986. intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
  987. /* setup FSI2 port B (HDMI) */
  988. gpio_request(GPIO_FN_FSIBCK, NULL);
  989. __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
  990. /* set SPU2 clock to 119.6 MHz */
  991. clk = clk_get(NULL, "spu_clk");
  992. if (!IS_ERR(clk)) {
  993. clk_set_rate(clk, clk_round_rate(clk, 119600000));
  994. clk_put(clk);
  995. }
  996. /* enable Keypad */
  997. gpio_request(GPIO_FN_IRQ9_42, NULL);
  998. irq_set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
  999. /* enable Touchscreen */
  1000. gpio_request(GPIO_FN_IRQ7_40, NULL);
  1001. irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
  1002. /* enable Accelerometer */
  1003. gpio_request(GPIO_FN_IRQ21, NULL);
  1004. irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
  1005. /* enable SDHI0 */
  1006. gpio_request(GPIO_FN_SDHICD0, NULL);
  1007. gpio_request(GPIO_FN_SDHIWP0, NULL);
  1008. gpio_request(GPIO_FN_SDHICMD0, NULL);
  1009. gpio_request(GPIO_FN_SDHICLK0, NULL);
  1010. gpio_request(GPIO_FN_SDHID0_3, NULL);
  1011. gpio_request(GPIO_FN_SDHID0_2, NULL);
  1012. gpio_request(GPIO_FN_SDHID0_1, NULL);
  1013. gpio_request(GPIO_FN_SDHID0_0, NULL);
  1014. #if !defined(CONFIG_MMC_SH_MMCIF)
  1015. /* enable SDHI1 */
  1016. gpio_request(GPIO_FN_SDHICMD1, NULL);
  1017. gpio_request(GPIO_FN_SDHICLK1, NULL);
  1018. gpio_request(GPIO_FN_SDHID1_3, NULL);
  1019. gpio_request(GPIO_FN_SDHID1_2, NULL);
  1020. gpio_request(GPIO_FN_SDHID1_1, NULL);
  1021. gpio_request(GPIO_FN_SDHID1_0, NULL);
  1022. #endif
  1023. /* card detect pin for MMC slot (CN7) */
  1024. gpio_request(GPIO_PORT41, NULL);
  1025. gpio_direction_input(GPIO_PORT41);
  1026. /* enable SDHI2 */
  1027. gpio_request(GPIO_FN_SDHICMD2, NULL);
  1028. gpio_request(GPIO_FN_SDHICLK2, NULL);
  1029. gpio_request(GPIO_FN_SDHID2_3, NULL);
  1030. gpio_request(GPIO_FN_SDHID2_2, NULL);
  1031. gpio_request(GPIO_FN_SDHID2_1, NULL);
  1032. gpio_request(GPIO_FN_SDHID2_0, NULL);
  1033. /* card detect pin for microSD slot (CN23) */
  1034. gpio_request(GPIO_PORT162, NULL);
  1035. gpio_direction_input(GPIO_PORT162);
  1036. /* MMCIF */
  1037. gpio_request(GPIO_FN_MMCD0_0, NULL);
  1038. gpio_request(GPIO_FN_MMCD0_1, NULL);
  1039. gpio_request(GPIO_FN_MMCD0_2, NULL);
  1040. gpio_request(GPIO_FN_MMCD0_3, NULL);
  1041. gpio_request(GPIO_FN_MMCD0_4, NULL);
  1042. gpio_request(GPIO_FN_MMCD0_5, NULL);
  1043. gpio_request(GPIO_FN_MMCD0_6, NULL);
  1044. gpio_request(GPIO_FN_MMCD0_7, NULL);
  1045. gpio_request(GPIO_FN_MMCCMD0, NULL);
  1046. gpio_request(GPIO_FN_MMCCLK0, NULL);
  1047. /* enable GPS module (GT-720F) */
  1048. gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  1049. gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  1050. /* CEU */
  1051. gpio_request(GPIO_FN_VIO_CLK, NULL);
  1052. gpio_request(GPIO_FN_VIO_VD, NULL);
  1053. gpio_request(GPIO_FN_VIO_HD, NULL);
  1054. gpio_request(GPIO_FN_VIO_FIELD, NULL);
  1055. gpio_request(GPIO_FN_VIO_CKO, NULL);
  1056. gpio_request(GPIO_FN_VIO_D7, NULL);
  1057. gpio_request(GPIO_FN_VIO_D6, NULL);
  1058. gpio_request(GPIO_FN_VIO_D5, NULL);
  1059. gpio_request(GPIO_FN_VIO_D4, NULL);
  1060. gpio_request(GPIO_FN_VIO_D3, NULL);
  1061. gpio_request(GPIO_FN_VIO_D2, NULL);
  1062. gpio_request(GPIO_FN_VIO_D1, NULL);
  1063. gpio_request(GPIO_FN_VIO_D0, NULL);
  1064. /* HDMI */
  1065. gpio_request(GPIO_FN_HDMI_HPD, NULL);
  1066. gpio_request(GPIO_FN_HDMI_CEC, NULL);
  1067. /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */
  1068. srcr4 = __raw_readl(SRCR4);
  1069. __raw_writel(srcr4 | (1 << 13), SRCR4);
  1070. udelay(50);
  1071. __raw_writel(srcr4 & ~(1 << 13), SRCR4);
  1072. i2c_register_board_info(0, i2c0_devices,
  1073. ARRAY_SIZE(i2c0_devices));
  1074. i2c_register_board_info(1, i2c1_devices,
  1075. ARRAY_SIZE(i2c1_devices));
  1076. sh7372_add_standard_devices();
  1077. platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
  1078. }
  1079. static void __init mackerel_timer_init(void)
  1080. {
  1081. sh7372_clock_init();
  1082. shmobile_timer.init();
  1083. /* External clock source */
  1084. clk_set_rate(&sh7372_dv_clki_clk, 27000000);
  1085. }
  1086. static struct sys_timer mackerel_timer = {
  1087. .init = mackerel_timer_init,
  1088. };
  1089. MACHINE_START(MACKEREL, "mackerel")
  1090. .map_io = mackerel_map_io,
  1091. .init_irq = sh7372_init_irq,
  1092. .handle_irq = shmobile_handle_irq_intc,
  1093. .init_machine = mackerel_init,
  1094. .timer = &mackerel_timer,
  1095. MACHINE_END