board-mackerel.c 28 KB

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