board-mackerel.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  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 void __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. out:
  429. if (!IS_ERR(hdmi_ick))
  430. clk_put(hdmi_ick);
  431. }
  432. /* USB1 (Host) */
  433. static void usb1_host_port_power(int port, int power)
  434. {
  435. if (!power) /* only power-on is supported for now */
  436. return;
  437. /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
  438. __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
  439. }
  440. static struct r8a66597_platdata usb1_host_data = {
  441. .on_chip = 1,
  442. .port_power = usb1_host_port_power,
  443. };
  444. static struct resource usb1_host_resources[] = {
  445. [0] = {
  446. .name = "USBHS",
  447. .start = 0xE68B0000,
  448. .end = 0xE68B00E6 - 1,
  449. .flags = IORESOURCE_MEM,
  450. },
  451. [1] = {
  452. .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
  453. .flags = IORESOURCE_IRQ,
  454. },
  455. };
  456. static struct platform_device usb1_host_device = {
  457. .name = "r8a66597_hcd",
  458. .id = 1,
  459. .dev = {
  460. .dma_mask = NULL, /* not use dma */
  461. .coherent_dma_mask = 0xffffffff,
  462. .platform_data = &usb1_host_data,
  463. },
  464. .num_resources = ARRAY_SIZE(usb1_host_resources),
  465. .resource = usb1_host_resources,
  466. };
  467. /* LED */
  468. static struct gpio_led mackerel_leds[] = {
  469. {
  470. .name = "led0",
  471. .gpio = GPIO_PORT0,
  472. .default_state = LEDS_GPIO_DEFSTATE_ON,
  473. },
  474. {
  475. .name = "led1",
  476. .gpio = GPIO_PORT1,
  477. .default_state = LEDS_GPIO_DEFSTATE_ON,
  478. },
  479. {
  480. .name = "led2",
  481. .gpio = GPIO_PORT2,
  482. .default_state = LEDS_GPIO_DEFSTATE_ON,
  483. },
  484. {
  485. .name = "led3",
  486. .gpio = GPIO_PORT159,
  487. .default_state = LEDS_GPIO_DEFSTATE_ON,
  488. }
  489. };
  490. static struct gpio_led_platform_data mackerel_leds_pdata = {
  491. .leds = mackerel_leds,
  492. .num_leds = ARRAY_SIZE(mackerel_leds),
  493. };
  494. static struct platform_device leds_device = {
  495. .name = "leds-gpio",
  496. .id = 0,
  497. .dev = {
  498. .platform_data = &mackerel_leds_pdata,
  499. },
  500. };
  501. /* FSI */
  502. #define IRQ_FSI evt2irq(0x1840)
  503. static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
  504. {
  505. int ret;
  506. if (rate <= 0)
  507. return 0;
  508. if (!enable) {
  509. clk_disable(clk);
  510. return 0;
  511. }
  512. ret = clk_set_rate(clk, clk_round_rate(clk, rate));
  513. if (ret < 0)
  514. return ret;
  515. return clk_enable(clk);
  516. }
  517. static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
  518. {
  519. struct clk *fsib_clk;
  520. struct clk *fdiv_clk = &sh7372_fsidivb_clk;
  521. long fsib_rate = 0;
  522. long fdiv_rate = 0;
  523. int ackmd_bpfmd;
  524. int ret;
  525. /* FSIA is slave mode. nothing to do here */
  526. if (is_porta)
  527. return 0;
  528. /* clock start */
  529. switch (rate) {
  530. case 44100:
  531. fsib_rate = rate * 256;
  532. ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
  533. break;
  534. case 48000:
  535. fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
  536. fdiv_rate = rate * 256;
  537. ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
  538. break;
  539. default:
  540. pr_err("unsupported rate in FSI2 port B\n");
  541. return -EINVAL;
  542. }
  543. /* FSI B setting */
  544. fsib_clk = clk_get(dev, "ickb");
  545. if (IS_ERR(fsib_clk))
  546. return -EIO;
  547. /* fsib */
  548. ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
  549. if (ret < 0)
  550. goto fsi_set_rate_end;
  551. /* FSI DIV */
  552. ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
  553. if (ret < 0) {
  554. /* disable FSI B */
  555. if (enable)
  556. __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
  557. goto fsi_set_rate_end;
  558. }
  559. ret = ackmd_bpfmd;
  560. fsi_set_rate_end:
  561. clk_put(fsib_clk);
  562. return ret;
  563. }
  564. static struct sh_fsi_platform_info fsi_info = {
  565. .porta_flags = SH_FSI_BRS_INV,
  566. .portb_flags = SH_FSI_BRS_INV |
  567. SH_FSI_BRM_INV |
  568. SH_FSI_LRS_INV |
  569. SH_FSI_FMT_SPDIF,
  570. .set_rate = fsi_set_rate,
  571. };
  572. static struct resource fsi_resources[] = {
  573. [0] = {
  574. .name = "FSI",
  575. .start = 0xFE3C0000,
  576. .end = 0xFE3C0400 - 1,
  577. .flags = IORESOURCE_MEM,
  578. },
  579. [1] = {
  580. .start = IRQ_FSI,
  581. .flags = IORESOURCE_IRQ,
  582. },
  583. };
  584. static struct platform_device fsi_device = {
  585. .name = "sh_fsi2",
  586. .id = -1,
  587. .num_resources = ARRAY_SIZE(fsi_resources),
  588. .resource = fsi_resources,
  589. .dev = {
  590. .platform_data = &fsi_info,
  591. },
  592. };
  593. static struct platform_device fsi_ak4643_device = {
  594. .name = "sh_fsi2_a_ak4643",
  595. };
  596. /*
  597. * The card detect pin of the top SD/MMC slot (CN7) is active low and is
  598. * connected to GPIO A22 of SH7372 (GPIO_PORT41).
  599. */
  600. static int slot_cn7_get_cd(struct platform_device *pdev)
  601. {
  602. return !gpio_get_value(GPIO_PORT41);
  603. }
  604. /* SDHI0 */
  605. static struct sh_mobile_sdhi_info sdhi0_info = {
  606. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  607. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  608. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
  609. };
  610. static struct resource sdhi0_resources[] = {
  611. [0] = {
  612. .name = "SDHI0",
  613. .start = 0xe6850000,
  614. .end = 0xe68500ff,
  615. .flags = IORESOURCE_MEM,
  616. },
  617. [1] = {
  618. .start = evt2irq(0x0e00) /* SDHI0 */,
  619. .flags = IORESOURCE_IRQ,
  620. },
  621. };
  622. static struct platform_device sdhi0_device = {
  623. .name = "sh_mobile_sdhi",
  624. .num_resources = ARRAY_SIZE(sdhi0_resources),
  625. .resource = sdhi0_resources,
  626. .id = 0,
  627. .dev = {
  628. .platform_data = &sdhi0_info,
  629. },
  630. };
  631. #if !defined(CONFIG_MMC_SH_MMCIF)
  632. /* SDHI1 */
  633. static struct sh_mobile_sdhi_info sdhi1_info = {
  634. .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
  635. .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
  636. .tmio_ocr_mask = MMC_VDD_165_195,
  637. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
  638. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
  639. MMC_CAP_NEEDS_POLL,
  640. .get_cd = slot_cn7_get_cd,
  641. };
  642. static struct resource sdhi1_resources[] = {
  643. [0] = {
  644. .name = "SDHI1",
  645. .start = 0xe6860000,
  646. .end = 0xe68600ff,
  647. .flags = IORESOURCE_MEM,
  648. },
  649. [1] = {
  650. .start = evt2irq(0x0e80),
  651. .flags = IORESOURCE_IRQ,
  652. },
  653. };
  654. static struct platform_device sdhi1_device = {
  655. .name = "sh_mobile_sdhi",
  656. .num_resources = ARRAY_SIZE(sdhi1_resources),
  657. .resource = sdhi1_resources,
  658. .id = 1,
  659. .dev = {
  660. .platform_data = &sdhi1_info,
  661. },
  662. };
  663. #endif
  664. /*
  665. * The card detect pin of the top SD/MMC slot (CN23) is active low and is
  666. * connected to GPIO SCIFB_SCK of SH7372 (GPIO_PORT162).
  667. */
  668. static int slot_cn23_get_cd(struct platform_device *pdev)
  669. {
  670. return !gpio_get_value(GPIO_PORT162);
  671. }
  672. /* SDHI2 */
  673. static struct sh_mobile_sdhi_info sdhi2_info = {
  674. .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
  675. .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
  676. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
  677. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
  678. MMC_CAP_NEEDS_POLL,
  679. .get_cd = slot_cn23_get_cd,
  680. };
  681. static struct resource sdhi2_resources[] = {
  682. [0] = {
  683. .name = "SDHI2",
  684. .start = 0xe6870000,
  685. .end = 0xe68700ff,
  686. .flags = IORESOURCE_MEM,
  687. },
  688. [1] = {
  689. .start = evt2irq(0x1200),
  690. .flags = IORESOURCE_IRQ,
  691. },
  692. };
  693. static struct platform_device sdhi2_device = {
  694. .name = "sh_mobile_sdhi",
  695. .num_resources = ARRAY_SIZE(sdhi2_resources),
  696. .resource = sdhi2_resources,
  697. .id = 2,
  698. .dev = {
  699. .platform_data = &sdhi2_info,
  700. },
  701. };
  702. /* SH_MMCIF */
  703. static struct resource sh_mmcif_resources[] = {
  704. [0] = {
  705. .name = "MMCIF",
  706. .start = 0xE6BD0000,
  707. .end = 0xE6BD00FF,
  708. .flags = IORESOURCE_MEM,
  709. },
  710. [1] = {
  711. /* MMC ERR */
  712. .start = evt2irq(0x1ac0),
  713. .flags = IORESOURCE_IRQ,
  714. },
  715. [2] = {
  716. /* MMC NOR */
  717. .start = evt2irq(0x1ae0),
  718. .flags = IORESOURCE_IRQ,
  719. },
  720. };
  721. static struct sh_mmcif_plat_data sh_mmcif_plat = {
  722. .sup_pclk = 0,
  723. .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  724. .caps = MMC_CAP_4_BIT_DATA |
  725. MMC_CAP_8_BIT_DATA |
  726. MMC_CAP_NEEDS_POLL,
  727. .get_cd = slot_cn7_get_cd,
  728. };
  729. static struct platform_device sh_mmcif_device = {
  730. .name = "sh_mmcif",
  731. .id = 0,
  732. .dev = {
  733. .dma_mask = NULL,
  734. .coherent_dma_mask = 0xffffffff,
  735. .platform_data = &sh_mmcif_plat,
  736. },
  737. .num_resources = ARRAY_SIZE(sh_mmcif_resources),
  738. .resource = sh_mmcif_resources,
  739. };
  740. static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev);
  741. static void mackerel_camera_del(struct soc_camera_link *icl);
  742. static int camera_set_capture(struct soc_camera_platform_info *info,
  743. int enable)
  744. {
  745. return 0; /* camera sensor always enabled */
  746. }
  747. static struct soc_camera_platform_info camera_info = {
  748. .format_name = "UYVY",
  749. .format_depth = 16,
  750. .format = {
  751. .code = V4L2_MBUS_FMT_UYVY8_2X8,
  752. .colorspace = V4L2_COLORSPACE_SMPTE170M,
  753. .field = V4L2_FIELD_NONE,
  754. .width = 640,
  755. .height = 480,
  756. },
  757. .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
  758. SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8 |
  759. SOCAM_DATA_ACTIVE_HIGH,
  760. .set_capture = camera_set_capture,
  761. };
  762. static struct soc_camera_link camera_link = {
  763. .bus_id = 0,
  764. .add_device = mackerel_camera_add,
  765. .del_device = mackerel_camera_del,
  766. .module_name = "soc_camera_platform",
  767. .priv = &camera_info,
  768. };
  769. static void dummy_release(struct device *dev)
  770. {
  771. }
  772. static struct platform_device camera_device = {
  773. .name = "soc_camera_platform",
  774. .dev = {
  775. .platform_data = &camera_info,
  776. .release = dummy_release,
  777. },
  778. };
  779. static int mackerel_camera_add(struct soc_camera_link *icl,
  780. struct device *dev)
  781. {
  782. if (icl != &camera_link)
  783. return -ENODEV;
  784. camera_info.dev = dev;
  785. return platform_device_register(&camera_device);
  786. }
  787. static void mackerel_camera_del(struct soc_camera_link *icl)
  788. {
  789. if (icl != &camera_link)
  790. return;
  791. platform_device_unregister(&camera_device);
  792. memset(&camera_device.dev.kobj, 0,
  793. sizeof(camera_device.dev.kobj));
  794. }
  795. static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
  796. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  797. };
  798. static struct resource ceu_resources[] = {
  799. [0] = {
  800. .name = "CEU",
  801. .start = 0xfe910000,
  802. .end = 0xfe91009f,
  803. .flags = IORESOURCE_MEM,
  804. },
  805. [1] = {
  806. .start = intcs_evt2irq(0x880),
  807. .flags = IORESOURCE_IRQ,
  808. },
  809. [2] = {
  810. /* place holder for contiguous memory */
  811. },
  812. };
  813. static struct platform_device ceu_device = {
  814. .name = "sh_mobile_ceu",
  815. .id = 0, /* "ceu0" clock */
  816. .num_resources = ARRAY_SIZE(ceu_resources),
  817. .resource = ceu_resources,
  818. .dev = {
  819. .platform_data = &sh_mobile_ceu_info,
  820. .coherent_dma_mask = 0xffffffff,
  821. },
  822. };
  823. static struct platform_device mackerel_camera = {
  824. .name = "soc-camera-pdrv",
  825. .id = 0,
  826. .dev = {
  827. .platform_data = &camera_link,
  828. },
  829. };
  830. static struct platform_device *mackerel_devices[] __initdata = {
  831. &nor_flash_device,
  832. &smc911x_device,
  833. &lcdc_device,
  834. &usb1_host_device,
  835. &leds_device,
  836. &fsi_device,
  837. &fsi_ak4643_device,
  838. &fsi_hdmi_device,
  839. &sdhi0_device,
  840. #if !defined(CONFIG_MMC_SH_MMCIF)
  841. &sdhi1_device,
  842. #endif
  843. &sdhi2_device,
  844. &sh_mmcif_device,
  845. &ceu_device,
  846. &mackerel_camera,
  847. &hdmi_lcdc_device,
  848. &hdmi_device,
  849. };
  850. /* Keypad Initialization */
  851. #define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
  852. { \
  853. .type = ev_type, \
  854. .code = ev_code, \
  855. .active_low = act_low, \
  856. }
  857. #define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)
  858. static struct tca6416_button mackerel_gpio_keys[] = {
  859. KEYPAD_BUTTON_LOW(KEY_HOME),
  860. KEYPAD_BUTTON_LOW(KEY_MENU),
  861. KEYPAD_BUTTON_LOW(KEY_BACK),
  862. KEYPAD_BUTTON_LOW(KEY_POWER),
  863. };
  864. static struct tca6416_keys_platform_data mackerel_tca6416_keys_info = {
  865. .buttons = mackerel_gpio_keys,
  866. .nbuttons = ARRAY_SIZE(mackerel_gpio_keys),
  867. .rep = 1,
  868. .use_polling = 0,
  869. .pinmask = 0x000F,
  870. };
  871. /* I2C */
  872. #define IRQ7 evt2irq(0x02e0)
  873. #define IRQ9 evt2irq(0x0320)
  874. static struct i2c_board_info i2c0_devices[] = {
  875. {
  876. I2C_BOARD_INFO("ak4643", 0x13),
  877. },
  878. /* Keypad */
  879. {
  880. I2C_BOARD_INFO("tca6408-keys", 0x20),
  881. .platform_data = &mackerel_tca6416_keys_info,
  882. .irq = IRQ9,
  883. },
  884. /* Touchscreen */
  885. {
  886. I2C_BOARD_INFO("st1232-ts", 0x55),
  887. .irq = IRQ7,
  888. },
  889. };
  890. #define IRQ21 evt2irq(0x32a0)
  891. static struct i2c_board_info i2c1_devices[] = {
  892. /* Accelerometer */
  893. {
  894. I2C_BOARD_INFO("adxl34x", 0x53),
  895. .irq = IRQ21,
  896. },
  897. };
  898. static struct map_desc mackerel_io_desc[] __initdata = {
  899. /* create a 1:1 entity map for 0xe6xxxxxx
  900. * used by CPGA, INTC and PFC.
  901. */
  902. {
  903. .virtual = 0xe6000000,
  904. .pfn = __phys_to_pfn(0xe6000000),
  905. .length = 256 << 20,
  906. .type = MT_DEVICE_NONSHARED
  907. },
  908. };
  909. static void __init mackerel_map_io(void)
  910. {
  911. iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
  912. /* setup early devices and console here as well */
  913. sh7372_add_early_devices();
  914. shmobile_setup_console();
  915. }
  916. #define GPIO_PORT9CR 0xE6051009
  917. #define GPIO_PORT10CR 0xE605100A
  918. #define SRCR4 0xe61580bc
  919. #define USCCR1 0xE6058144
  920. static void __init mackerel_init(void)
  921. {
  922. u32 srcr4;
  923. struct clk *clk;
  924. sh7372_pinmux_init();
  925. /* enable SCIFA0 */
  926. gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
  927. gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
  928. /* enable SMSC911X */
  929. gpio_request(GPIO_FN_CS5A, NULL);
  930. gpio_request(GPIO_FN_IRQ6_39, NULL);
  931. /* LCDC */
  932. gpio_request(GPIO_FN_LCDD23, NULL);
  933. gpio_request(GPIO_FN_LCDD22, NULL);
  934. gpio_request(GPIO_FN_LCDD21, NULL);
  935. gpio_request(GPIO_FN_LCDD20, NULL);
  936. gpio_request(GPIO_FN_LCDD19, NULL);
  937. gpio_request(GPIO_FN_LCDD18, NULL);
  938. gpio_request(GPIO_FN_LCDD17, NULL);
  939. gpio_request(GPIO_FN_LCDD16, NULL);
  940. gpio_request(GPIO_FN_LCDD15, NULL);
  941. gpio_request(GPIO_FN_LCDD14, NULL);
  942. gpio_request(GPIO_FN_LCDD13, NULL);
  943. gpio_request(GPIO_FN_LCDD12, NULL);
  944. gpio_request(GPIO_FN_LCDD11, NULL);
  945. gpio_request(GPIO_FN_LCDD10, NULL);
  946. gpio_request(GPIO_FN_LCDD9, NULL);
  947. gpio_request(GPIO_FN_LCDD8, NULL);
  948. gpio_request(GPIO_FN_LCDD7, NULL);
  949. gpio_request(GPIO_FN_LCDD6, NULL);
  950. gpio_request(GPIO_FN_LCDD5, NULL);
  951. gpio_request(GPIO_FN_LCDD4, NULL);
  952. gpio_request(GPIO_FN_LCDD3, NULL);
  953. gpio_request(GPIO_FN_LCDD2, NULL);
  954. gpio_request(GPIO_FN_LCDD1, NULL);
  955. gpio_request(GPIO_FN_LCDD0, NULL);
  956. gpio_request(GPIO_FN_LCDDISP, NULL);
  957. gpio_request(GPIO_FN_LCDDCK, NULL);
  958. gpio_request(GPIO_PORT31, NULL); /* backlight */
  959. gpio_direction_output(GPIO_PORT31, 0); /* off by default */
  960. gpio_request(GPIO_PORT151, NULL); /* LCDDON */
  961. gpio_direction_output(GPIO_PORT151, 1);
  962. /* USB enable */
  963. gpio_request(GPIO_FN_VBUS0_1, NULL);
  964. gpio_request(GPIO_FN_IDIN_1_18, NULL);
  965. gpio_request(GPIO_FN_PWEN_1_115, NULL);
  966. gpio_request(GPIO_FN_OVCN_1_114, NULL);
  967. gpio_request(GPIO_FN_EXTLP_1, NULL);
  968. gpio_request(GPIO_FN_OVCN2_1, NULL);
  969. /* setup USB phy */
  970. __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */
  971. /* enable FSI2 port A (ak4643) */
  972. gpio_request(GPIO_FN_FSIAIBT, NULL);
  973. gpio_request(GPIO_FN_FSIAILR, NULL);
  974. gpio_request(GPIO_FN_FSIAISLD, NULL);
  975. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  976. gpio_request(GPIO_PORT161, NULL);
  977. gpio_direction_output(GPIO_PORT161, 0); /* slave */
  978. gpio_request(GPIO_PORT9, NULL);
  979. gpio_request(GPIO_PORT10, NULL);
  980. gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */
  981. gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
  982. intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
  983. /* setup FSI2 port B (HDMI) */
  984. gpio_request(GPIO_FN_FSIBCK, NULL);
  985. __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
  986. /* set SPU2 clock to 119.6 MHz */
  987. clk = clk_get(NULL, "spu_clk");
  988. if (!IS_ERR(clk)) {
  989. clk_set_rate(clk, clk_round_rate(clk, 119600000));
  990. clk_put(clk);
  991. }
  992. /* enable Keypad */
  993. gpio_request(GPIO_FN_IRQ9_42, NULL);
  994. irq_set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
  995. /* enable Touchscreen */
  996. gpio_request(GPIO_FN_IRQ7_40, NULL);
  997. irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
  998. /* enable Accelerometer */
  999. gpio_request(GPIO_FN_IRQ21, NULL);
  1000. irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
  1001. /* enable SDHI0 */
  1002. gpio_request(GPIO_FN_SDHICD0, NULL);
  1003. gpio_request(GPIO_FN_SDHIWP0, NULL);
  1004. gpio_request(GPIO_FN_SDHICMD0, NULL);
  1005. gpio_request(GPIO_FN_SDHICLK0, NULL);
  1006. gpio_request(GPIO_FN_SDHID0_3, NULL);
  1007. gpio_request(GPIO_FN_SDHID0_2, NULL);
  1008. gpio_request(GPIO_FN_SDHID0_1, NULL);
  1009. gpio_request(GPIO_FN_SDHID0_0, NULL);
  1010. #if !defined(CONFIG_MMC_SH_MMCIF)
  1011. /* enable SDHI1 */
  1012. gpio_request(GPIO_FN_SDHICMD1, NULL);
  1013. gpio_request(GPIO_FN_SDHICLK1, NULL);
  1014. gpio_request(GPIO_FN_SDHID1_3, NULL);
  1015. gpio_request(GPIO_FN_SDHID1_2, NULL);
  1016. gpio_request(GPIO_FN_SDHID1_1, NULL);
  1017. gpio_request(GPIO_FN_SDHID1_0, NULL);
  1018. #endif
  1019. /* card detect pin for MMC slot (CN7) */
  1020. gpio_request(GPIO_PORT41, NULL);
  1021. gpio_direction_input(GPIO_PORT41);
  1022. /* enable SDHI2 */
  1023. gpio_request(GPIO_FN_SDHICMD2, NULL);
  1024. gpio_request(GPIO_FN_SDHICLK2, NULL);
  1025. gpio_request(GPIO_FN_SDHID2_3, NULL);
  1026. gpio_request(GPIO_FN_SDHID2_2, NULL);
  1027. gpio_request(GPIO_FN_SDHID2_1, NULL);
  1028. gpio_request(GPIO_FN_SDHID2_0, NULL);
  1029. /* card detect pin for microSD slot (CN23) */
  1030. gpio_request(GPIO_PORT162, NULL);
  1031. gpio_direction_input(GPIO_PORT162);
  1032. /* MMCIF */
  1033. gpio_request(GPIO_FN_MMCD0_0, NULL);
  1034. gpio_request(GPIO_FN_MMCD0_1, NULL);
  1035. gpio_request(GPIO_FN_MMCD0_2, NULL);
  1036. gpio_request(GPIO_FN_MMCD0_3, NULL);
  1037. gpio_request(GPIO_FN_MMCD0_4, NULL);
  1038. gpio_request(GPIO_FN_MMCD0_5, NULL);
  1039. gpio_request(GPIO_FN_MMCD0_6, NULL);
  1040. gpio_request(GPIO_FN_MMCD0_7, NULL);
  1041. gpio_request(GPIO_FN_MMCCMD0, NULL);
  1042. gpio_request(GPIO_FN_MMCCLK0, NULL);
  1043. /* enable GPS module (GT-720F) */
  1044. gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  1045. gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  1046. /* CEU */
  1047. gpio_request(GPIO_FN_VIO_CLK, NULL);
  1048. gpio_request(GPIO_FN_VIO_VD, NULL);
  1049. gpio_request(GPIO_FN_VIO_HD, NULL);
  1050. gpio_request(GPIO_FN_VIO_FIELD, NULL);
  1051. gpio_request(GPIO_FN_VIO_CKO, NULL);
  1052. gpio_request(GPIO_FN_VIO_D7, NULL);
  1053. gpio_request(GPIO_FN_VIO_D6, NULL);
  1054. gpio_request(GPIO_FN_VIO_D5, NULL);
  1055. gpio_request(GPIO_FN_VIO_D4, NULL);
  1056. gpio_request(GPIO_FN_VIO_D3, NULL);
  1057. gpio_request(GPIO_FN_VIO_D2, NULL);
  1058. gpio_request(GPIO_FN_VIO_D1, NULL);
  1059. gpio_request(GPIO_FN_VIO_D0, NULL);
  1060. /* HDMI */
  1061. gpio_request(GPIO_FN_HDMI_HPD, NULL);
  1062. gpio_request(GPIO_FN_HDMI_CEC, NULL);
  1063. /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */
  1064. srcr4 = __raw_readl(SRCR4);
  1065. __raw_writel(srcr4 | (1 << 13), SRCR4);
  1066. udelay(50);
  1067. __raw_writel(srcr4 & ~(1 << 13), SRCR4);
  1068. i2c_register_board_info(0, i2c0_devices,
  1069. ARRAY_SIZE(i2c0_devices));
  1070. i2c_register_board_info(1, i2c1_devices,
  1071. ARRAY_SIZE(i2c1_devices));
  1072. sh7372_add_standard_devices();
  1073. platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
  1074. hdmi_init_pm_clock();
  1075. }
  1076. static void __init mackerel_timer_init(void)
  1077. {
  1078. sh7372_clock_init();
  1079. shmobile_timer.init();
  1080. /* External clock source */
  1081. clk_set_rate(&sh7372_dv_clki_clk, 27000000);
  1082. }
  1083. static struct sys_timer mackerel_timer = {
  1084. .init = mackerel_timer_init,
  1085. };
  1086. MACHINE_START(MACKEREL, "mackerel")
  1087. .map_io = mackerel_map_io,
  1088. .init_irq = sh7372_init_irq,
  1089. .handle_irq = shmobile_handle_irq_intc,
  1090. .init_machine = mackerel_init,
  1091. .timer = &mackerel_timer,
  1092. MACHINE_END