ezkit.c 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <linux/mtd/physmap.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #include <linux/irq.h>
  16. #include <linux/i2c.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/usb/musb.h>
  19. #include <linux/pinctrl/machine.h>
  20. #include <linux/pinctrl/pinconf-generic.h>
  21. #include <linux/platform_data/pinctrl-adi2.h>
  22. #include <asm/bfin_spi3.h>
  23. #include <asm/dma.h>
  24. #include <asm/gpio.h>
  25. #include <asm/nand.h>
  26. #include <asm/dpmc.h>
  27. #include <asm/portmux.h>
  28. #include <asm/bfin_sdh.h>
  29. #include <linux/input.h>
  30. #include <linux/spi/ad7877.h>
  31. /*
  32. * Name the Board for the /proc/cpuinfo
  33. */
  34. const char bfin_board_name[] = "ADI BF609-EZKIT";
  35. /*
  36. * Driver needs to know address, irq and flag pin.
  37. */
  38. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  39. #include <linux/usb/isp1760.h>
  40. static struct resource bfin_isp1760_resources[] = {
  41. [0] = {
  42. .start = 0x2C0C0000,
  43. .end = 0x2C0C0000 + 0xfffff,
  44. .flags = IORESOURCE_MEM,
  45. },
  46. [1] = {
  47. .start = IRQ_PG7,
  48. .end = IRQ_PG7,
  49. .flags = IORESOURCE_IRQ,
  50. },
  51. };
  52. static struct isp1760_platform_data isp1760_priv = {
  53. .is_isp1761 = 0,
  54. .bus_width_16 = 1,
  55. .port1_otg = 0,
  56. .analog_oc = 0,
  57. .dack_polarity_high = 0,
  58. .dreq_polarity_high = 0,
  59. };
  60. static struct platform_device bfin_isp1760_device = {
  61. .name = "isp1760",
  62. .id = 0,
  63. .dev = {
  64. .platform_data = &isp1760_priv,
  65. },
  66. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  67. .resource = bfin_isp1760_resources,
  68. };
  69. #endif
  70. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  71. #include <asm/bfin_rotary.h>
  72. static struct bfin_rotary_platform_data bfin_rotary_data = {
  73. /*.rotary_up_key = KEY_UP,*/
  74. /*.rotary_down_key = KEY_DOWN,*/
  75. .rotary_rel_code = REL_WHEEL,
  76. .rotary_button_key = KEY_ENTER,
  77. .debounce = 10, /* 0..17 */
  78. .mode = ROT_QUAD_ENC | ROT_DEBE,
  79. };
  80. static struct resource bfin_rotary_resources[] = {
  81. {
  82. .start = IRQ_CNT,
  83. .end = IRQ_CNT,
  84. .flags = IORESOURCE_IRQ,
  85. },
  86. };
  87. static struct platform_device bfin_rotary_device = {
  88. .name = "bfin-rotary",
  89. .id = -1,
  90. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  91. .resource = bfin_rotary_resources,
  92. .dev = {
  93. .platform_data = &bfin_rotary_data,
  94. },
  95. };
  96. #endif
  97. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  98. #include <linux/stmmac.h>
  99. #include <linux/phy.h>
  100. static struct stmmac_mdio_bus_data phy_private_data = {
  101. .phy_mask = 1,
  102. };
  103. static struct stmmac_dma_cfg eth_dma_cfg = {
  104. .pbl = 2,
  105. };
  106. int stmmac_ptp_clk_init(struct platform_device *pdev)
  107. {
  108. bfin_write32(PADS0_EMAC_PTP_CLKSEL, 0);
  109. return 0;
  110. }
  111. static struct plat_stmmacenet_data eth_private_data = {
  112. .has_gmac = 1,
  113. .bus_id = 0,
  114. .enh_desc = 1,
  115. .phy_addr = 1,
  116. .mdio_bus_data = &phy_private_data,
  117. .dma_cfg = &eth_dma_cfg,
  118. .force_thresh_dma_mode = 1,
  119. .interface = PHY_INTERFACE_MODE_RMII,
  120. .init = stmmac_ptp_clk_init,
  121. };
  122. static struct platform_device bfin_eth_device = {
  123. .name = "stmmaceth",
  124. .id = 0,
  125. .num_resources = 2,
  126. .resource = (struct resource[]) {
  127. {
  128. .start = EMAC0_MACCFG,
  129. .end = EMAC0_MACCFG + 0x1274,
  130. .flags = IORESOURCE_MEM,
  131. },
  132. {
  133. .name = "macirq",
  134. .start = IRQ_EMAC0_STAT,
  135. .end = IRQ_EMAC0_STAT,
  136. .flags = IORESOURCE_IRQ,
  137. },
  138. },
  139. .dev = {
  140. .power.can_wakeup = 1,
  141. .platform_data = &eth_private_data,
  142. }
  143. };
  144. #endif
  145. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  146. #include <linux/input/adxl34x.h>
  147. static const struct adxl34x_platform_data adxl34x_info = {
  148. .x_axis_offset = 0,
  149. .y_axis_offset = 0,
  150. .z_axis_offset = 0,
  151. .tap_threshold = 0x31,
  152. .tap_duration = 0x10,
  153. .tap_latency = 0x60,
  154. .tap_window = 0xF0,
  155. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  156. .act_axis_control = 0xFF,
  157. .activity_threshold = 5,
  158. .inactivity_threshold = 3,
  159. .inactivity_time = 4,
  160. .free_fall_threshold = 0x7,
  161. .free_fall_time = 0x20,
  162. .data_rate = 0x8,
  163. .data_range = ADXL_FULL_RES,
  164. .ev_type = EV_ABS,
  165. .ev_code_x = ABS_X, /* EV_REL */
  166. .ev_code_y = ABS_Y, /* EV_REL */
  167. .ev_code_z = ABS_Z, /* EV_REL */
  168. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  169. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  170. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  171. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  172. .fifo_mode = ADXL_FIFO_STREAM,
  173. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  174. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  175. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  176. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  177. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  178. };
  179. #endif
  180. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  181. static struct platform_device rtc_device = {
  182. .name = "rtc-bfin",
  183. .id = -1,
  184. };
  185. #endif
  186. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  187. #ifdef CONFIG_SERIAL_BFIN_UART0
  188. static struct resource bfin_uart0_resources[] = {
  189. {
  190. .start = UART0_REVID,
  191. .end = UART0_RXDIV+4,
  192. .flags = IORESOURCE_MEM,
  193. },
  194. #ifdef CONFIG_EARLY_PRINTK
  195. {
  196. .start = PORTD_FER,
  197. .end = PORTD_FER+2,
  198. .flags = IORESOURCE_REG,
  199. },
  200. {
  201. .start = PORTD_MUX,
  202. .end = PORTD_MUX+3,
  203. .flags = IORESOURCE_REG,
  204. },
  205. #endif
  206. {
  207. .start = IRQ_UART0_TX,
  208. .end = IRQ_UART0_TX,
  209. .flags = IORESOURCE_IRQ,
  210. },
  211. {
  212. .start = IRQ_UART0_RX,
  213. .end = IRQ_UART0_RX,
  214. .flags = IORESOURCE_IRQ,
  215. },
  216. {
  217. .start = IRQ_UART0_STAT,
  218. .end = IRQ_UART0_STAT,
  219. .flags = IORESOURCE_IRQ,
  220. },
  221. {
  222. .start = CH_UART0_TX,
  223. .end = CH_UART0_TX,
  224. .flags = IORESOURCE_DMA,
  225. },
  226. {
  227. .start = CH_UART0_RX,
  228. .end = CH_UART0_RX,
  229. .flags = IORESOURCE_DMA,
  230. },
  231. #ifdef CONFIG_BFIN_UART0_CTSRTS
  232. { /* CTS pin -- 0 means not supported */
  233. .start = GPIO_PD10,
  234. .end = GPIO_PD10,
  235. .flags = IORESOURCE_IO,
  236. },
  237. { /* RTS pin -- 0 means not supported */
  238. .start = GPIO_PD9,
  239. .end = GPIO_PD9,
  240. .flags = IORESOURCE_IO,
  241. },
  242. #endif
  243. };
  244. static unsigned short bfin_uart0_peripherals[] = {
  245. P_UART0_TX, P_UART0_RX,
  246. #ifdef CONFIG_BFIN_UART0_CTSRTS
  247. P_UART0_RTS, P_UART0_CTS,
  248. #endif
  249. 0
  250. };
  251. static struct platform_device bfin_uart0_device = {
  252. .name = "bfin-uart",
  253. .id = 0,
  254. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  255. .resource = bfin_uart0_resources,
  256. .dev = {
  257. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  258. },
  259. };
  260. #endif
  261. #ifdef CONFIG_SERIAL_BFIN_UART1
  262. static struct resource bfin_uart1_resources[] = {
  263. {
  264. .start = UART1_REVID,
  265. .end = UART1_RXDIV+4,
  266. .flags = IORESOURCE_MEM,
  267. },
  268. #ifdef CONFIG_EARLY_PRINTK
  269. {
  270. .start = PORTG_FER_SET,
  271. .end = PORTG_FER_SET+2,
  272. .flags = IORESOURCE_REG,
  273. },
  274. #endif
  275. {
  276. .start = IRQ_UART1_TX,
  277. .end = IRQ_UART1_TX,
  278. .flags = IORESOURCE_IRQ,
  279. },
  280. {
  281. .start = IRQ_UART1_RX,
  282. .end = IRQ_UART1_RX,
  283. .flags = IORESOURCE_IRQ,
  284. },
  285. {
  286. .start = IRQ_UART1_STAT,
  287. .end = IRQ_UART1_STAT,
  288. .flags = IORESOURCE_IRQ,
  289. },
  290. {
  291. .start = CH_UART1_TX,
  292. .end = CH_UART1_TX,
  293. .flags = IORESOURCE_DMA,
  294. },
  295. {
  296. .start = CH_UART1_RX,
  297. .end = CH_UART1_RX,
  298. .flags = IORESOURCE_DMA,
  299. },
  300. #ifdef CONFIG_BFIN_UART1_CTSRTS
  301. { /* CTS pin -- 0 means not supported */
  302. .start = GPIO_PG13,
  303. .end = GPIO_PG13,
  304. .flags = IORESOURCE_IO,
  305. },
  306. { /* RTS pin -- 0 means not supported */
  307. .start = GPIO_PG10,
  308. .end = GPIO_PG10,
  309. .flags = IORESOURCE_IO,
  310. },
  311. #endif
  312. };
  313. static unsigned short bfin_uart1_peripherals[] = {
  314. P_UART1_TX, P_UART1_RX,
  315. #ifdef CONFIG_BFIN_UART1_CTSRTS
  316. P_UART1_RTS, P_UART1_CTS,
  317. #endif
  318. 0
  319. };
  320. static struct platform_device bfin_uart1_device = {
  321. .name = "bfin-uart",
  322. .id = 1,
  323. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  324. .resource = bfin_uart1_resources,
  325. .dev = {
  326. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  327. },
  328. };
  329. #endif
  330. #endif
  331. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  332. #ifdef CONFIG_BFIN_SIR0
  333. static struct resource bfin_sir0_resources[] = {
  334. {
  335. .start = 0xFFC00400,
  336. .end = 0xFFC004FF,
  337. .flags = IORESOURCE_MEM,
  338. },
  339. {
  340. .start = IRQ_UART0_TX,
  341. .end = IRQ_UART0_TX+1,
  342. .flags = IORESOURCE_IRQ,
  343. },
  344. {
  345. .start = CH_UART0_TX,
  346. .end = CH_UART0_TX+1,
  347. .flags = IORESOURCE_DMA,
  348. },
  349. };
  350. static struct platform_device bfin_sir0_device = {
  351. .name = "bfin_sir",
  352. .id = 0,
  353. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  354. .resource = bfin_sir0_resources,
  355. };
  356. #endif
  357. #ifdef CONFIG_BFIN_SIR1
  358. static struct resource bfin_sir1_resources[] = {
  359. {
  360. .start = 0xFFC02000,
  361. .end = 0xFFC020FF,
  362. .flags = IORESOURCE_MEM,
  363. },
  364. {
  365. .start = IRQ_UART1_TX,
  366. .end = IRQ_UART1_TX+1,
  367. .flags = IORESOURCE_IRQ,
  368. },
  369. {
  370. .start = CH_UART1_TX,
  371. .end = CH_UART1_TX+1,
  372. .flags = IORESOURCE_DMA,
  373. },
  374. };
  375. static struct platform_device bfin_sir1_device = {
  376. .name = "bfin_sir",
  377. .id = 1,
  378. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  379. .resource = bfin_sir1_resources,
  380. };
  381. #endif
  382. #endif
  383. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  384. static struct resource musb_resources[] = {
  385. [0] = {
  386. .start = 0xFFCC1000,
  387. .end = 0xFFCC1398,
  388. .flags = IORESOURCE_MEM,
  389. },
  390. [1] = { /* general IRQ */
  391. .start = IRQ_USB_STAT,
  392. .end = IRQ_USB_STAT,
  393. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  394. .name = "mc"
  395. },
  396. [2] = { /* DMA IRQ */
  397. .start = IRQ_USB_DMA,
  398. .end = IRQ_USB_DMA,
  399. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  400. .name = "dma"
  401. },
  402. };
  403. static struct musb_hdrc_config musb_config = {
  404. .multipoint = 1,
  405. .dyn_fifo = 0,
  406. .dma = 1,
  407. .num_eps = 16,
  408. .dma_channels = 8,
  409. .clkin = 48, /* musb CLKIN in MHZ */
  410. };
  411. static struct musb_hdrc_platform_data musb_plat = {
  412. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  413. .mode = MUSB_OTG,
  414. #elif defined(CONFIG_USB_MUSB_HDRC)
  415. .mode = MUSB_HOST,
  416. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  417. .mode = MUSB_PERIPHERAL,
  418. #endif
  419. .config = &musb_config,
  420. };
  421. static u64 musb_dmamask = ~(u32)0;
  422. static struct platform_device musb_device = {
  423. .name = "musb-blackfin",
  424. .id = 0,
  425. .dev = {
  426. .dma_mask = &musb_dmamask,
  427. .coherent_dma_mask = 0xffffffff,
  428. .platform_data = &musb_plat,
  429. },
  430. .num_resources = ARRAY_SIZE(musb_resources),
  431. .resource = musb_resources,
  432. };
  433. #endif
  434. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  435. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  436. static struct resource bfin_sport0_uart_resources[] = {
  437. {
  438. .start = SPORT0_TCR1,
  439. .end = SPORT0_MRCS3+4,
  440. .flags = IORESOURCE_MEM,
  441. },
  442. {
  443. .start = IRQ_SPORT0_RX,
  444. .end = IRQ_SPORT0_RX+1,
  445. .flags = IORESOURCE_IRQ,
  446. },
  447. {
  448. .start = IRQ_SPORT0_ERROR,
  449. .end = IRQ_SPORT0_ERROR,
  450. .flags = IORESOURCE_IRQ,
  451. },
  452. };
  453. static unsigned short bfin_sport0_peripherals[] = {
  454. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  455. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  456. };
  457. static struct platform_device bfin_sport0_uart_device = {
  458. .name = "bfin-sport-uart",
  459. .id = 0,
  460. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  461. .resource = bfin_sport0_uart_resources,
  462. .dev = {
  463. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  464. },
  465. };
  466. #endif
  467. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  468. static struct resource bfin_sport1_uart_resources[] = {
  469. {
  470. .start = SPORT1_TCR1,
  471. .end = SPORT1_MRCS3+4,
  472. .flags = IORESOURCE_MEM,
  473. },
  474. {
  475. .start = IRQ_SPORT1_RX,
  476. .end = IRQ_SPORT1_RX+1,
  477. .flags = IORESOURCE_IRQ,
  478. },
  479. {
  480. .start = IRQ_SPORT1_ERROR,
  481. .end = IRQ_SPORT1_ERROR,
  482. .flags = IORESOURCE_IRQ,
  483. },
  484. };
  485. static unsigned short bfin_sport1_peripherals[] = {
  486. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  487. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  488. };
  489. static struct platform_device bfin_sport1_uart_device = {
  490. .name = "bfin-sport-uart",
  491. .id = 1,
  492. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  493. .resource = bfin_sport1_uart_resources,
  494. .dev = {
  495. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  496. },
  497. };
  498. #endif
  499. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  500. static struct resource bfin_sport2_uart_resources[] = {
  501. {
  502. .start = SPORT2_TCR1,
  503. .end = SPORT2_MRCS3+4,
  504. .flags = IORESOURCE_MEM,
  505. },
  506. {
  507. .start = IRQ_SPORT2_RX,
  508. .end = IRQ_SPORT2_RX+1,
  509. .flags = IORESOURCE_IRQ,
  510. },
  511. {
  512. .start = IRQ_SPORT2_ERROR,
  513. .end = IRQ_SPORT2_ERROR,
  514. .flags = IORESOURCE_IRQ,
  515. },
  516. };
  517. static unsigned short bfin_sport2_peripherals[] = {
  518. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  519. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  520. };
  521. static struct platform_device bfin_sport2_uart_device = {
  522. .name = "bfin-sport-uart",
  523. .id = 2,
  524. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  525. .resource = bfin_sport2_uart_resources,
  526. .dev = {
  527. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  528. },
  529. };
  530. #endif
  531. #endif
  532. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  533. static unsigned short bfin_can0_peripherals[] = {
  534. P_CAN0_RX, P_CAN0_TX, 0
  535. };
  536. static struct resource bfin_can0_resources[] = {
  537. {
  538. .start = 0xFFC00A00,
  539. .end = 0xFFC00FFF,
  540. .flags = IORESOURCE_MEM,
  541. },
  542. {
  543. .start = IRQ_CAN0_RX,
  544. .end = IRQ_CAN0_RX,
  545. .flags = IORESOURCE_IRQ,
  546. },
  547. {
  548. .start = IRQ_CAN0_TX,
  549. .end = IRQ_CAN0_TX,
  550. .flags = IORESOURCE_IRQ,
  551. },
  552. {
  553. .start = IRQ_CAN0_STAT,
  554. .end = IRQ_CAN0_STAT,
  555. .flags = IORESOURCE_IRQ,
  556. },
  557. };
  558. static struct platform_device bfin_can0_device = {
  559. .name = "bfin_can",
  560. .id = 0,
  561. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  562. .resource = bfin_can0_resources,
  563. .dev = {
  564. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  565. },
  566. };
  567. #endif
  568. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  569. static struct mtd_partition partition_info[] = {
  570. {
  571. .name = "bootloader(nand)",
  572. .offset = 0,
  573. .size = 0x80000,
  574. }, {
  575. .name = "linux kernel(nand)",
  576. .offset = MTDPART_OFS_APPEND,
  577. .size = 4 * 1024 * 1024,
  578. },
  579. {
  580. .name = "file system(nand)",
  581. .offset = MTDPART_OFS_APPEND,
  582. .size = MTDPART_SIZ_FULL,
  583. },
  584. };
  585. static struct bf5xx_nand_platform bfin_nand_platform = {
  586. .data_width = NFC_NWIDTH_8,
  587. .partitions = partition_info,
  588. .nr_partitions = ARRAY_SIZE(partition_info),
  589. .rd_dly = 3,
  590. .wr_dly = 3,
  591. };
  592. static struct resource bfin_nand_resources[] = {
  593. {
  594. .start = 0xFFC03B00,
  595. .end = 0xFFC03B4F,
  596. .flags = IORESOURCE_MEM,
  597. },
  598. {
  599. .start = CH_NFC,
  600. .end = CH_NFC,
  601. .flags = IORESOURCE_IRQ,
  602. },
  603. };
  604. static struct platform_device bfin_nand_device = {
  605. .name = "bfin-nand",
  606. .id = 0,
  607. .num_resources = ARRAY_SIZE(bfin_nand_resources),
  608. .resource = bfin_nand_resources,
  609. .dev = {
  610. .platform_data = &bfin_nand_platform,
  611. },
  612. };
  613. #endif
  614. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  615. static struct bfin_sd_host bfin_sdh_data = {
  616. .dma_chan = CH_RSI,
  617. .irq_int0 = IRQ_RSI_INT0,
  618. .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
  619. };
  620. static struct platform_device bfin_sdh_device = {
  621. .name = "bfin-sdh",
  622. .id = 0,
  623. .dev = {
  624. .platform_data = &bfin_sdh_data,
  625. },
  626. };
  627. #endif
  628. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  629. static struct mtd_partition ezkit_partitions[] = {
  630. {
  631. .name = "bootloader(nor)",
  632. .size = 0x80000,
  633. .offset = 0,
  634. }, {
  635. .name = "linux kernel(nor)",
  636. .size = 0x400000,
  637. .offset = MTDPART_OFS_APPEND,
  638. }, {
  639. .name = "file system(nor)",
  640. .size = 0x1000000 - 0x80000 - 0x400000,
  641. .offset = MTDPART_OFS_APPEND,
  642. },
  643. };
  644. int bf609_nor_flash_init(struct platform_device *pdev)
  645. {
  646. #define CONFIG_SMC_GCTL_VAL 0x00000010
  647. if (!devm_pinctrl_get_select_default(&pdev->dev))
  648. return -EBUSY;
  649. bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
  650. bfin_write32(SMC_B0CTL, 0x01002011);
  651. bfin_write32(SMC_B0TIM, 0x08170977);
  652. bfin_write32(SMC_B0ETIM, 0x00092231);
  653. return 0;
  654. }
  655. void bf609_nor_flash_exit(struct platform_device *pdev)
  656. {
  657. devm_pinctrl_put(pdev->dev.pins->p);
  658. bfin_write32(SMC_GCTL, 0);
  659. }
  660. static struct physmap_flash_data ezkit_flash_data = {
  661. .width = 2,
  662. .parts = ezkit_partitions,
  663. .init = bf609_nor_flash_init,
  664. .exit = bf609_nor_flash_exit,
  665. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  666. #ifdef CONFIG_ROMKERNEL
  667. .probe_type = "map_rom",
  668. #endif
  669. };
  670. static struct resource ezkit_flash_resource = {
  671. .start = 0xb0000000,
  672. .end = 0xb0ffffff,
  673. .flags = IORESOURCE_MEM,
  674. };
  675. static struct platform_device ezkit_flash_device = {
  676. .name = "physmap-flash",
  677. .id = 0,
  678. .dev = {
  679. .platform_data = &ezkit_flash_data,
  680. },
  681. .num_resources = 1,
  682. .resource = &ezkit_flash_resource,
  683. };
  684. #endif
  685. #if defined(CONFIG_MTD_M25P80) \
  686. || defined(CONFIG_MTD_M25P80_MODULE)
  687. /* SPI flash chip (w25q32) */
  688. static struct mtd_partition bfin_spi_flash_partitions[] = {
  689. {
  690. .name = "bootloader(spi)",
  691. .size = 0x00080000,
  692. .offset = 0,
  693. .mask_flags = MTD_CAP_ROM
  694. }, {
  695. .name = "linux kernel(spi)",
  696. .size = 0x00180000,
  697. .offset = MTDPART_OFS_APPEND,
  698. }, {
  699. .name = "file system(spi)",
  700. .size = MTDPART_SIZ_FULL,
  701. .offset = MTDPART_OFS_APPEND,
  702. }
  703. };
  704. static struct flash_platform_data bfin_spi_flash_data = {
  705. .name = "m25p80",
  706. .parts = bfin_spi_flash_partitions,
  707. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  708. .type = "w25q32",
  709. };
  710. static struct bfin_spi3_chip spi_flash_chip_info = {
  711. .enable_dma = true, /* use dma transfer with this chip*/
  712. };
  713. #endif
  714. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  715. static struct bfin_spi3_chip spidev_chip_info = {
  716. .enable_dma = true,
  717. };
  718. #endif
  719. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  720. static struct platform_device bfin_i2s_pcm = {
  721. .name = "bfin-i2s-pcm-audio",
  722. .id = -1,
  723. };
  724. #endif
  725. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  726. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  727. #include <asm/bfin_sport3.h>
  728. static struct resource bfin_snd_resources[] = {
  729. {
  730. .start = SPORT0_CTL_A,
  731. .end = SPORT0_CTL_A,
  732. .flags = IORESOURCE_MEM,
  733. },
  734. {
  735. .start = SPORT0_CTL_B,
  736. .end = SPORT0_CTL_B,
  737. .flags = IORESOURCE_MEM,
  738. },
  739. {
  740. .start = CH_SPORT0_TX,
  741. .end = CH_SPORT0_TX,
  742. .flags = IORESOURCE_DMA,
  743. },
  744. {
  745. .start = CH_SPORT0_RX,
  746. .end = CH_SPORT0_RX,
  747. .flags = IORESOURCE_DMA,
  748. },
  749. {
  750. .start = IRQ_SPORT0_TX_STAT,
  751. .end = IRQ_SPORT0_TX_STAT,
  752. .flags = IORESOURCE_IRQ,
  753. },
  754. {
  755. .start = IRQ_SPORT0_RX_STAT,
  756. .end = IRQ_SPORT0_RX_STAT,
  757. .flags = IORESOURCE_IRQ,
  758. },
  759. };
  760. static const unsigned short bfin_snd_pin[] = {
  761. P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
  762. P_SPORT0_BFS, P_SPORT0_BD0, 0,
  763. };
  764. static struct bfin_snd_platform_data bfin_snd_data = {
  765. .pin_req = bfin_snd_pin,
  766. };
  767. static struct platform_device bfin_i2s = {
  768. .name = "bfin-i2s",
  769. .num_resources = ARRAY_SIZE(bfin_snd_resources),
  770. .resource = bfin_snd_resources,
  771. .dev = {
  772. .platform_data = &bfin_snd_data,
  773. },
  774. };
  775. #endif
  776. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
  777. || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  778. static const char * const ad1836_link[] = {
  779. "bfin-i2s.0",
  780. "spi0.76",
  781. };
  782. static struct platform_device bfin_ad1836_machine = {
  783. .name = "bfin-snd-ad1836",
  784. .id = -1,
  785. .dev = {
  786. .platform_data = (void *)ad1836_link,
  787. },
  788. };
  789. #endif
  790. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  791. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  792. static struct platform_device adau1761_device = {
  793. .name = "bfin-eval-adau1x61",
  794. };
  795. #endif
  796. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  797. #include <sound/adau17x1.h>
  798. static struct adau1761_platform_data adau1761_info = {
  799. .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
  800. .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
  801. };
  802. #endif
  803. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  804. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  805. #include <linux/videodev2.h>
  806. #include <media/blackfin/bfin_capture.h>
  807. #include <media/blackfin/ppi.h>
  808. static const unsigned short ppi_req[] = {
  809. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  810. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  811. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  812. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  813. #if !defined(CONFIG_VIDEO_VS6624) && !defined(CONFIG_VIDEO_VS6624_MODULE)
  814. P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
  815. P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
  816. #endif
  817. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  818. 0,
  819. };
  820. static const struct ppi_info ppi_info = {
  821. .type = PPI_TYPE_EPPI3,
  822. .dma_ch = CH_EPPI0_CH0,
  823. .irq_err = IRQ_EPPI0_STAT,
  824. .base = (void __iomem *)EPPI0_STAT,
  825. .pin_req = ppi_req,
  826. };
  827. #if defined(CONFIG_VIDEO_VS6624) \
  828. || defined(CONFIG_VIDEO_VS6624_MODULE)
  829. static struct v4l2_input vs6624_inputs[] = {
  830. {
  831. .index = 0,
  832. .name = "Camera",
  833. .type = V4L2_INPUT_TYPE_CAMERA,
  834. .std = V4L2_STD_UNKNOWN,
  835. },
  836. };
  837. static struct bcap_route vs6624_routes[] = {
  838. {
  839. .input = 0,
  840. .output = 0,
  841. },
  842. };
  843. static const unsigned vs6624_ce_pin = GPIO_PE4;
  844. static struct bfin_capture_config bfin_capture_data = {
  845. .card_name = "BF609",
  846. .inputs = vs6624_inputs,
  847. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  848. .routes = vs6624_routes,
  849. .i2c_adapter_id = 0,
  850. .board_info = {
  851. .type = "vs6624",
  852. .addr = 0x10,
  853. .platform_data = (void *)&vs6624_ce_pin,
  854. },
  855. .ppi_info = &ppi_info,
  856. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
  857. | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  858. .blank_pixels = 4,
  859. };
  860. #endif
  861. #if defined(CONFIG_VIDEO_ADV7842) \
  862. || defined(CONFIG_VIDEO_ADV7842_MODULE)
  863. #include <media/adv7842.h>
  864. static struct v4l2_input adv7842_inputs[] = {
  865. {
  866. .index = 0,
  867. .name = "Composite",
  868. .type = V4L2_INPUT_TYPE_CAMERA,
  869. .std = V4L2_STD_ALL,
  870. .capabilities = V4L2_IN_CAP_STD,
  871. },
  872. {
  873. .index = 1,
  874. .name = "S-Video",
  875. .type = V4L2_INPUT_TYPE_CAMERA,
  876. .std = V4L2_STD_ALL,
  877. .capabilities = V4L2_IN_CAP_STD,
  878. },
  879. {
  880. .index = 2,
  881. .name = "Component",
  882. .type = V4L2_INPUT_TYPE_CAMERA,
  883. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  884. },
  885. {
  886. .index = 3,
  887. .name = "VGA",
  888. .type = V4L2_INPUT_TYPE_CAMERA,
  889. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  890. },
  891. {
  892. .index = 4,
  893. .name = "HDMI",
  894. .type = V4L2_INPUT_TYPE_CAMERA,
  895. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  896. },
  897. };
  898. static struct bcap_route adv7842_routes[] = {
  899. {
  900. .input = 3,
  901. .output = 0,
  902. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  903. | EPPI_CTL_ACTIVE656),
  904. },
  905. {
  906. .input = 4,
  907. .output = 0,
  908. },
  909. {
  910. .input = 2,
  911. .output = 0,
  912. },
  913. {
  914. .input = 1,
  915. .output = 0,
  916. },
  917. {
  918. .input = 0,
  919. .output = 1,
  920. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  921. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC2
  922. | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  923. },
  924. };
  925. static struct adv7842_output_format adv7842_opf[] = {
  926. {
  927. .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
  928. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
  929. .op_656_range = 1,
  930. .blank_data = 1,
  931. .insert_av_codes = 1,
  932. },
  933. {
  934. .op_ch_sel = ADV7842_OP_CH_SEL_RGB,
  935. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_16,
  936. .op_656_range = 1,
  937. .blank_data = 1,
  938. },
  939. };
  940. static struct adv7842_platform_data adv7842_data = {
  941. .opf = adv7842_opf,
  942. .num_opf = ARRAY_SIZE(adv7842_opf),
  943. .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
  944. .prim_mode = ADV7842_PRIM_MODE_SDP,
  945. .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
  946. .inp_color_space = ADV7842_INP_COLOR_SPACE_AUTO,
  947. .i2c_sdp_io = 0x40,
  948. .i2c_sdp = 0x41,
  949. .i2c_cp = 0x42,
  950. .i2c_vdp = 0x43,
  951. .i2c_afe = 0x44,
  952. .i2c_hdmi = 0x45,
  953. .i2c_repeater = 0x46,
  954. .i2c_edid = 0x47,
  955. .i2c_infoframe = 0x48,
  956. .i2c_cec = 0x49,
  957. .i2c_avlink = 0x4a,
  958. .i2c_ex = 0x26,
  959. };
  960. static struct bfin_capture_config bfin_capture_data = {
  961. .card_name = "BF609",
  962. .inputs = adv7842_inputs,
  963. .num_inputs = ARRAY_SIZE(adv7842_inputs),
  964. .routes = adv7842_routes,
  965. .i2c_adapter_id = 0,
  966. .board_info = {
  967. .type = "adv7842",
  968. .addr = 0x20,
  969. .platform_data = (void *)&adv7842_data,
  970. },
  971. .ppi_info = &ppi_info,
  972. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  973. | EPPI_CTL_ACTIVE656),
  974. };
  975. #endif
  976. static struct platform_device bfin_capture_device = {
  977. .name = "bfin_capture",
  978. .dev = {
  979. .platform_data = &bfin_capture_data,
  980. },
  981. };
  982. #endif
  983. #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
  984. || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
  985. #include <linux/videodev2.h>
  986. #include <media/blackfin/bfin_display.h>
  987. #include <media/blackfin/ppi.h>
  988. static const unsigned short ppi_req_disp[] = {
  989. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  990. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  991. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  992. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  993. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  994. 0,
  995. };
  996. static const struct ppi_info ppi_info = {
  997. .type = PPI_TYPE_EPPI3,
  998. .dma_ch = CH_EPPI0_CH0,
  999. .irq_err = IRQ_EPPI0_STAT,
  1000. .base = (void __iomem *)EPPI0_STAT,
  1001. .pin_req = ppi_req_disp,
  1002. };
  1003. #if defined(CONFIG_VIDEO_ADV7511) \
  1004. || defined(CONFIG_VIDEO_ADV7511_MODULE)
  1005. #include <media/adv7511.h>
  1006. static struct v4l2_output adv7511_outputs[] = {
  1007. {
  1008. .index = 0,
  1009. .name = "HDMI",
  1010. .type = V4L2_INPUT_TYPE_CAMERA,
  1011. .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
  1012. },
  1013. };
  1014. static struct disp_route adv7511_routes[] = {
  1015. {
  1016. .output = 0,
  1017. },
  1018. };
  1019. static struct adv7511_platform_data adv7511_data = {
  1020. .edid_addr = 0x7e,
  1021. .i2c_ex = 0x25,
  1022. };
  1023. static struct bfin_display_config bfin_display_data = {
  1024. .card_name = "BF609",
  1025. .outputs = adv7511_outputs,
  1026. .num_outputs = ARRAY_SIZE(adv7511_outputs),
  1027. .routes = adv7511_routes,
  1028. .i2c_adapter_id = 0,
  1029. .board_info = {
  1030. .type = "adv7511",
  1031. .addr = 0x39,
  1032. .platform_data = (void *)&adv7511_data,
  1033. },
  1034. .ppi_info = &ppi_info,
  1035. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  1036. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC3
  1037. | EPPI_CTL_IFSGEN | EPPI_CTL_SYNC2
  1038. | EPPI_CTL_NON656 | EPPI_CTL_DIR),
  1039. };
  1040. #endif
  1041. #if IS_ENABLED(CONFIG_VIDEO_ADV7343)
  1042. #include <media/adv7343.h>
  1043. static struct v4l2_output adv7343_outputs[] = {
  1044. {
  1045. .index = 0,
  1046. .name = "Composite",
  1047. .type = V4L2_OUTPUT_TYPE_ANALOG,
  1048. .std = V4L2_STD_ALL,
  1049. .capabilities = V4L2_OUT_CAP_STD,
  1050. },
  1051. {
  1052. .index = 1,
  1053. .name = "S-Video",
  1054. .type = V4L2_OUTPUT_TYPE_ANALOG,
  1055. .std = V4L2_STD_ALL,
  1056. .capabilities = V4L2_OUT_CAP_STD,
  1057. },
  1058. {
  1059. .index = 2,
  1060. .name = "Component",
  1061. .type = V4L2_OUTPUT_TYPE_ANALOG,
  1062. .std = V4L2_STD_ALL,
  1063. .capabilities = V4L2_OUT_CAP_STD,
  1064. },
  1065. };
  1066. static struct disp_route adv7343_routes[] = {
  1067. {
  1068. .output = ADV7343_COMPOSITE_ID,
  1069. },
  1070. {
  1071. .output = ADV7343_SVIDEO_ID,
  1072. },
  1073. {
  1074. .output = ADV7343_COMPONENT_ID,
  1075. },
  1076. };
  1077. static struct adv7343_platform_data adv7343_data = {
  1078. .mode_config = {
  1079. .sleep_mode = false,
  1080. .pll_control = false,
  1081. .dac_1 = true,
  1082. .dac_2 = true,
  1083. .dac_3 = true,
  1084. .dac_4 = true,
  1085. .dac_5 = true,
  1086. .dac_6 = true,
  1087. },
  1088. .sd_config = {
  1089. .sd_dac_out1 = false,
  1090. .sd_dac_out2 = false,
  1091. },
  1092. };
  1093. static struct bfin_display_config bfin_display_data = {
  1094. .card_name = "BF609",
  1095. .outputs = adv7343_outputs,
  1096. .num_outputs = ARRAY_SIZE(adv7343_outputs),
  1097. .routes = adv7343_routes,
  1098. .i2c_adapter_id = 0,
  1099. .board_info = {
  1100. .type = "adv7343",
  1101. .addr = 0x2b,
  1102. .platform_data = (void *)&adv7343_data,
  1103. },
  1104. .ppi_info = &ppi_info_disp,
  1105. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1LO_FS2LO
  1106. | EPPI_CTL_POLC3 | EPPI_CTL_BLANKGEN | EPPI_CTL_SYNC2
  1107. | EPPI_CTL_NON656 | EPPI_CTL_DIR),
  1108. };
  1109. #endif
  1110. static struct platform_device bfin_display_device = {
  1111. .name = "bfin_display",
  1112. .dev = {
  1113. .platform_data = &bfin_display_data,
  1114. },
  1115. };
  1116. #endif
  1117. #if defined(CONFIG_BFIN_CRC)
  1118. #define BFIN_CRC_NAME "bfin-crc"
  1119. static struct resource bfin_crc0_resources[] = {
  1120. {
  1121. .start = REG_CRC0_CTL,
  1122. .end = REG_CRC0_REVID+4,
  1123. .flags = IORESOURCE_MEM,
  1124. },
  1125. {
  1126. .start = IRQ_CRC0_DCNTEXP,
  1127. .end = IRQ_CRC0_DCNTEXP,
  1128. .flags = IORESOURCE_IRQ,
  1129. },
  1130. {
  1131. .start = CH_MEM_STREAM0_SRC_CRC0,
  1132. .end = CH_MEM_STREAM0_SRC_CRC0,
  1133. .flags = IORESOURCE_DMA,
  1134. },
  1135. {
  1136. .start = CH_MEM_STREAM0_DEST_CRC0,
  1137. .end = CH_MEM_STREAM0_DEST_CRC0,
  1138. .flags = IORESOURCE_DMA,
  1139. },
  1140. };
  1141. static struct platform_device bfin_crc0_device = {
  1142. .name = BFIN_CRC_NAME,
  1143. .id = 0,
  1144. .num_resources = ARRAY_SIZE(bfin_crc0_resources),
  1145. .resource = bfin_crc0_resources,
  1146. };
  1147. static struct resource bfin_crc1_resources[] = {
  1148. {
  1149. .start = REG_CRC1_CTL,
  1150. .end = REG_CRC1_REVID+4,
  1151. .flags = IORESOURCE_MEM,
  1152. },
  1153. {
  1154. .start = IRQ_CRC1_DCNTEXP,
  1155. .end = IRQ_CRC1_DCNTEXP,
  1156. .flags = IORESOURCE_IRQ,
  1157. },
  1158. {
  1159. .start = CH_MEM_STREAM1_SRC_CRC1,
  1160. .end = CH_MEM_STREAM1_SRC_CRC1,
  1161. .flags = IORESOURCE_DMA,
  1162. },
  1163. {
  1164. .start = CH_MEM_STREAM1_DEST_CRC1,
  1165. .end = CH_MEM_STREAM1_DEST_CRC1,
  1166. .flags = IORESOURCE_DMA,
  1167. },
  1168. };
  1169. static struct platform_device bfin_crc1_device = {
  1170. .name = BFIN_CRC_NAME,
  1171. .id = 1,
  1172. .num_resources = ARRAY_SIZE(bfin_crc1_resources),
  1173. .resource = bfin_crc1_resources,
  1174. };
  1175. #endif
  1176. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1177. #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
  1178. #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
  1179. static struct resource bfin_crypto_crc_resources[] = {
  1180. {
  1181. .start = REG_CRC0_CTL,
  1182. .end = REG_CRC0_REVID+4,
  1183. .flags = IORESOURCE_MEM,
  1184. },
  1185. {
  1186. .start = IRQ_CRC0_DCNTEXP,
  1187. .end = IRQ_CRC0_DCNTEXP,
  1188. .flags = IORESOURCE_IRQ,
  1189. },
  1190. {
  1191. .start = CH_MEM_STREAM0_SRC_CRC0,
  1192. .end = CH_MEM_STREAM0_SRC_CRC0,
  1193. .flags = IORESOURCE_DMA,
  1194. },
  1195. };
  1196. static struct platform_device bfin_crypto_crc_device = {
  1197. .name = BFIN_CRYPTO_CRC_NAME,
  1198. .id = 0,
  1199. .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
  1200. .resource = bfin_crypto_crc_resources,
  1201. .dev = {
  1202. .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
  1203. },
  1204. };
  1205. #endif
  1206. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1207. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1208. .model = 7877,
  1209. .vref_delay_usecs = 50, /* internal, no capacitor */
  1210. .x_plate_ohms = 419,
  1211. .y_plate_ohms = 486,
  1212. .pressure_max = 1000,
  1213. .pressure_min = 0,
  1214. .stopacq_polarity = 1,
  1215. .first_conversion_delay = 3,
  1216. .acquisition_time = 1,
  1217. .averaging = 1,
  1218. .pen_down_acc_interval = 1,
  1219. };
  1220. #endif
  1221. #ifdef CONFIG_PINCTRL_ADI2
  1222. # define ADI_PINT_DEVNAME "adi-gpio-pint"
  1223. # define ADI_GPIO_DEVNAME "adi-gpio"
  1224. # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
  1225. static struct platform_device bfin_pinctrl_device = {
  1226. .name = ADI_PINCTRL_DEVNAME,
  1227. .id = 0,
  1228. };
  1229. static struct resource bfin_pint0_resources[] = {
  1230. {
  1231. .start = PINT0_MASK_SET,
  1232. .end = PINT0_LATCH + 3,
  1233. .flags = IORESOURCE_MEM,
  1234. },
  1235. {
  1236. .start = IRQ_PINT0,
  1237. .end = IRQ_PINT0,
  1238. .flags = IORESOURCE_IRQ,
  1239. },
  1240. };
  1241. static struct platform_device bfin_pint0_device = {
  1242. .name = ADI_PINT_DEVNAME,
  1243. .id = 0,
  1244. .num_resources = ARRAY_SIZE(bfin_pint0_resources),
  1245. .resource = bfin_pint0_resources,
  1246. };
  1247. static struct resource bfin_pint1_resources[] = {
  1248. {
  1249. .start = PINT1_MASK_SET,
  1250. .end = PINT1_LATCH + 3,
  1251. .flags = IORESOURCE_MEM,
  1252. },
  1253. {
  1254. .start = IRQ_PINT1,
  1255. .end = IRQ_PINT1,
  1256. .flags = IORESOURCE_IRQ,
  1257. },
  1258. };
  1259. static struct platform_device bfin_pint1_device = {
  1260. .name = ADI_PINT_DEVNAME,
  1261. .id = 1,
  1262. .num_resources = ARRAY_SIZE(bfin_pint1_resources),
  1263. .resource = bfin_pint1_resources,
  1264. };
  1265. static struct resource bfin_pint2_resources[] = {
  1266. {
  1267. .start = PINT2_MASK_SET,
  1268. .end = PINT2_LATCH + 3,
  1269. .flags = IORESOURCE_MEM,
  1270. },
  1271. {
  1272. .start = IRQ_PINT2,
  1273. .end = IRQ_PINT2,
  1274. .flags = IORESOURCE_IRQ,
  1275. },
  1276. };
  1277. static struct platform_device bfin_pint2_device = {
  1278. .name = ADI_PINT_DEVNAME,
  1279. .id = 2,
  1280. .num_resources = ARRAY_SIZE(bfin_pint2_resources),
  1281. .resource = bfin_pint2_resources,
  1282. };
  1283. static struct resource bfin_pint3_resources[] = {
  1284. {
  1285. .start = PINT3_MASK_SET,
  1286. .end = PINT3_LATCH + 3,
  1287. .flags = IORESOURCE_MEM,
  1288. },
  1289. {
  1290. .start = IRQ_PINT3,
  1291. .end = IRQ_PINT3,
  1292. .flags = IORESOURCE_IRQ,
  1293. },
  1294. };
  1295. static struct platform_device bfin_pint3_device = {
  1296. .name = ADI_PINT_DEVNAME,
  1297. .id = 3,
  1298. .num_resources = ARRAY_SIZE(bfin_pint3_resources),
  1299. .resource = bfin_pint3_resources,
  1300. };
  1301. static struct resource bfin_pint4_resources[] = {
  1302. {
  1303. .start = PINT4_MASK_SET,
  1304. .end = PINT4_LATCH + 3,
  1305. .flags = IORESOURCE_MEM,
  1306. },
  1307. {
  1308. .start = IRQ_PINT4,
  1309. .end = IRQ_PINT4,
  1310. .flags = IORESOURCE_IRQ,
  1311. },
  1312. };
  1313. static struct platform_device bfin_pint4_device = {
  1314. .name = ADI_PINT_DEVNAME,
  1315. .id = 4,
  1316. .num_resources = ARRAY_SIZE(bfin_pint4_resources),
  1317. .resource = bfin_pint4_resources,
  1318. };
  1319. static struct resource bfin_pint5_resources[] = {
  1320. {
  1321. .start = PINT5_MASK_SET,
  1322. .end = PINT5_LATCH + 3,
  1323. .flags = IORESOURCE_MEM,
  1324. },
  1325. {
  1326. .start = IRQ_PINT5,
  1327. .end = IRQ_PINT5,
  1328. .flags = IORESOURCE_IRQ,
  1329. },
  1330. };
  1331. static struct platform_device bfin_pint5_device = {
  1332. .name = ADI_PINT_DEVNAME,
  1333. .id = 5,
  1334. .num_resources = ARRAY_SIZE(bfin_pint5_resources),
  1335. .resource = bfin_pint5_resources,
  1336. };
  1337. static struct resource bfin_gpa_resources[] = {
  1338. {
  1339. .start = PORTA_FER,
  1340. .end = PORTA_MUX + 3,
  1341. .flags = IORESOURCE_MEM,
  1342. },
  1343. { /* optional */
  1344. .start = IRQ_PA0,
  1345. .end = IRQ_PA0,
  1346. .flags = IORESOURCE_IRQ,
  1347. },
  1348. };
  1349. static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
  1350. .port_pin_base = GPIO_PA0,
  1351. .port_width = GPIO_BANKSIZE,
  1352. .pint_id = 0, /* PINT0 */
  1353. .pint_assign = true, /* PINT upper 16 bit */
  1354. .pint_map = 0, /* mapping mask in PINT */
  1355. };
  1356. static struct platform_device bfin_gpa_device = {
  1357. .name = ADI_GPIO_DEVNAME,
  1358. .id = 0,
  1359. .num_resources = ARRAY_SIZE(bfin_gpa_resources),
  1360. .resource = bfin_gpa_resources,
  1361. .dev = {
  1362. .platform_data = &bfin_gpa_pdata, /* Passed to driver */
  1363. },
  1364. };
  1365. static struct resource bfin_gpb_resources[] = {
  1366. {
  1367. .start = PORTB_FER,
  1368. .end = PORTB_MUX + 3,
  1369. .flags = IORESOURCE_MEM,
  1370. },
  1371. {
  1372. .start = IRQ_PB0,
  1373. .end = IRQ_PB0,
  1374. .flags = IORESOURCE_IRQ,
  1375. },
  1376. };
  1377. static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
  1378. .port_pin_base = GPIO_PB0,
  1379. .port_width = GPIO_BANKSIZE,
  1380. .pint_id = 0,
  1381. .pint_assign = false,
  1382. .pint_map = 1,
  1383. };
  1384. static struct platform_device bfin_gpb_device = {
  1385. .name = ADI_GPIO_DEVNAME,
  1386. .id = 1,
  1387. .num_resources = ARRAY_SIZE(bfin_gpb_resources),
  1388. .resource = bfin_gpb_resources,
  1389. .dev = {
  1390. .platform_data = &bfin_gpb_pdata, /* Passed to driver */
  1391. },
  1392. };
  1393. static struct resource bfin_gpc_resources[] = {
  1394. {
  1395. .start = PORTC_FER,
  1396. .end = PORTC_MUX + 3,
  1397. .flags = IORESOURCE_MEM,
  1398. },
  1399. {
  1400. .start = IRQ_PC0,
  1401. .end = IRQ_PC0,
  1402. .flags = IORESOURCE_IRQ,
  1403. },
  1404. };
  1405. static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
  1406. .port_pin_base = GPIO_PC0,
  1407. .port_width = GPIO_BANKSIZE,
  1408. .pint_id = 1,
  1409. .pint_assign = false,
  1410. .pint_map = 1,
  1411. };
  1412. static struct platform_device bfin_gpc_device = {
  1413. .name = ADI_GPIO_DEVNAME,
  1414. .id = 2,
  1415. .num_resources = ARRAY_SIZE(bfin_gpc_resources),
  1416. .resource = bfin_gpc_resources,
  1417. .dev = {
  1418. .platform_data = &bfin_gpc_pdata, /* Passed to driver */
  1419. },
  1420. };
  1421. static struct resource bfin_gpd_resources[] = {
  1422. {
  1423. .start = PORTD_FER,
  1424. .end = PORTD_MUX + 3,
  1425. .flags = IORESOURCE_MEM,
  1426. },
  1427. {
  1428. .start = IRQ_PD0,
  1429. .end = IRQ_PD0,
  1430. .flags = IORESOURCE_IRQ,
  1431. },
  1432. };
  1433. static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
  1434. .port_pin_base = GPIO_PD0,
  1435. .port_width = GPIO_BANKSIZE,
  1436. .pint_id = 2,
  1437. .pint_assign = false,
  1438. .pint_map = 1,
  1439. };
  1440. static struct platform_device bfin_gpd_device = {
  1441. .name = ADI_GPIO_DEVNAME,
  1442. .id = 3,
  1443. .num_resources = ARRAY_SIZE(bfin_gpd_resources),
  1444. .resource = bfin_gpd_resources,
  1445. .dev = {
  1446. .platform_data = &bfin_gpd_pdata, /* Passed to driver */
  1447. },
  1448. };
  1449. static struct resource bfin_gpe_resources[] = {
  1450. {
  1451. .start = PORTE_FER,
  1452. .end = PORTE_MUX + 3,
  1453. .flags = IORESOURCE_MEM,
  1454. },
  1455. {
  1456. .start = IRQ_PE0,
  1457. .end = IRQ_PE0,
  1458. .flags = IORESOURCE_IRQ,
  1459. },
  1460. };
  1461. static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
  1462. .port_pin_base = GPIO_PE0,
  1463. .port_width = GPIO_BANKSIZE,
  1464. .pint_id = 3,
  1465. .pint_assign = false,
  1466. .pint_map = 1,
  1467. };
  1468. static struct platform_device bfin_gpe_device = {
  1469. .name = ADI_GPIO_DEVNAME,
  1470. .id = 4,
  1471. .num_resources = ARRAY_SIZE(bfin_gpe_resources),
  1472. .resource = bfin_gpe_resources,
  1473. .dev = {
  1474. .platform_data = &bfin_gpe_pdata, /* Passed to driver */
  1475. },
  1476. };
  1477. static struct resource bfin_gpf_resources[] = {
  1478. {
  1479. .start = PORTF_FER,
  1480. .end = PORTF_MUX + 3,
  1481. .flags = IORESOURCE_MEM,
  1482. },
  1483. {
  1484. .start = IRQ_PF0,
  1485. .end = IRQ_PF0,
  1486. .flags = IORESOURCE_IRQ,
  1487. },
  1488. };
  1489. static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
  1490. .port_pin_base = GPIO_PF0,
  1491. .port_width = GPIO_BANKSIZE,
  1492. .pint_id = 4,
  1493. .pint_assign = false,
  1494. .pint_map = 1,
  1495. };
  1496. static struct platform_device bfin_gpf_device = {
  1497. .name = ADI_GPIO_DEVNAME,
  1498. .id = 5,
  1499. .num_resources = ARRAY_SIZE(bfin_gpf_resources),
  1500. .resource = bfin_gpf_resources,
  1501. .dev = {
  1502. .platform_data = &bfin_gpf_pdata, /* Passed to driver */
  1503. },
  1504. };
  1505. static struct resource bfin_gpg_resources[] = {
  1506. {
  1507. .start = PORTG_FER,
  1508. .end = PORTG_MUX + 3,
  1509. .flags = IORESOURCE_MEM,
  1510. },
  1511. {
  1512. .start = IRQ_PG0,
  1513. .end = IRQ_PG0,
  1514. .flags = IORESOURCE_IRQ,
  1515. },
  1516. };
  1517. static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
  1518. .port_pin_base = GPIO_PG0,
  1519. .port_width = GPIO_BANKSIZE,
  1520. .pint_id = 5,
  1521. .pint_assign = false,
  1522. .pint_map = 1,
  1523. };
  1524. static struct platform_device bfin_gpg_device = {
  1525. .name = ADI_GPIO_DEVNAME,
  1526. .id = 6,
  1527. .num_resources = ARRAY_SIZE(bfin_gpg_resources),
  1528. .resource = bfin_gpg_resources,
  1529. .dev = {
  1530. .platform_data = &bfin_gpg_pdata, /* Passed to driver */
  1531. },
  1532. };
  1533. #endif
  1534. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1535. #include <linux/input.h>
  1536. #include <linux/gpio_keys.h>
  1537. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1538. {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
  1539. {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
  1540. };
  1541. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1542. .buttons = bfin_gpio_keys_table,
  1543. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1544. };
  1545. static struct platform_device bfin_device_gpiokeys = {
  1546. .name = "gpio-keys",
  1547. .dev = {
  1548. .platform_data = &bfin_gpio_keys_data,
  1549. },
  1550. };
  1551. #endif
  1552. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1553. #if defined(CONFIG_MTD_M25P80) \
  1554. || defined(CONFIG_MTD_M25P80_MODULE)
  1555. {
  1556. /* the modalias must be the same as spi device driver name */
  1557. .modalias = "m25p80", /* Name of spi_driver for this device */
  1558. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1559. .bus_num = 0, /* Framework bus number */
  1560. .chip_select = MAX_CTRL_CS + GPIO_PD11, /* SPI_SSEL1*/
  1561. .platform_data = &bfin_spi_flash_data,
  1562. .controller_data = &spi_flash_chip_info,
  1563. .mode = SPI_MODE_3,
  1564. },
  1565. #endif
  1566. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1567. {
  1568. .modalias = "ad7877",
  1569. .platform_data = &bfin_ad7877_ts_info,
  1570. .irq = IRQ_PD9,
  1571. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1572. .bus_num = 0,
  1573. .chip_select = MAX_CTRL_CS + GPIO_PC15, /* SPI_SSEL4 */
  1574. },
  1575. #endif
  1576. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  1577. {
  1578. .modalias = "spidev",
  1579. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1580. .bus_num = 0,
  1581. .chip_select = MAX_CTRL_CS + GPIO_PD11, /* SPI_SSEL1*/
  1582. .controller_data = &spidev_chip_info,
  1583. },
  1584. #endif
  1585. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  1586. {
  1587. .modalias = "adxl34x",
  1588. .platform_data = &adxl34x_info,
  1589. .irq = IRQ_PC5,
  1590. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1591. .bus_num = 1,
  1592. .chip_select = 2,
  1593. .mode = SPI_MODE_3,
  1594. },
  1595. #endif
  1596. };
  1597. #if IS_ENABLED(CONFIG_SPI_BFIN_V3)
  1598. /* SPI (0) */
  1599. static struct resource bfin_spi0_resource[] = {
  1600. {
  1601. .start = SPI0_REGBASE,
  1602. .end = SPI0_REGBASE + 0xFF,
  1603. .flags = IORESOURCE_MEM,
  1604. },
  1605. {
  1606. .start = CH_SPI0_TX,
  1607. .end = CH_SPI0_TX,
  1608. .flags = IORESOURCE_DMA,
  1609. },
  1610. {
  1611. .start = CH_SPI0_RX,
  1612. .end = CH_SPI0_RX,
  1613. .flags = IORESOURCE_DMA,
  1614. },
  1615. };
  1616. /* SPI (1) */
  1617. static struct resource bfin_spi1_resource[] = {
  1618. {
  1619. .start = SPI1_REGBASE,
  1620. .end = SPI1_REGBASE + 0xFF,
  1621. .flags = IORESOURCE_MEM,
  1622. },
  1623. {
  1624. .start = CH_SPI1_TX,
  1625. .end = CH_SPI1_TX,
  1626. .flags = IORESOURCE_DMA,
  1627. },
  1628. {
  1629. .start = CH_SPI1_RX,
  1630. .end = CH_SPI1_RX,
  1631. .flags = IORESOURCE_DMA,
  1632. },
  1633. };
  1634. /* SPI controller data */
  1635. static struct bfin_spi3_master bf60x_spi_master_info0 = {
  1636. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1637. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1638. };
  1639. static struct platform_device bf60x_spi_master0 = {
  1640. .name = "bfin-spi3",
  1641. .id = 0, /* Bus number */
  1642. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1643. .resource = bfin_spi0_resource,
  1644. .dev = {
  1645. .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
  1646. },
  1647. };
  1648. static struct bfin_spi3_master bf60x_spi_master_info1 = {
  1649. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1650. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1651. };
  1652. static struct platform_device bf60x_spi_master1 = {
  1653. .name = "bfin-spi3",
  1654. .id = 1, /* Bus number */
  1655. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1656. .resource = bfin_spi1_resource,
  1657. .dev = {
  1658. .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
  1659. },
  1660. };
  1661. #endif /* spi master and devices */
  1662. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1663. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1664. static struct resource bfin_twi0_resource[] = {
  1665. [0] = {
  1666. .start = TWI0_CLKDIV,
  1667. .end = TWI0_CLKDIV + 0xFF,
  1668. .flags = IORESOURCE_MEM,
  1669. },
  1670. [1] = {
  1671. .start = IRQ_TWI0,
  1672. .end = IRQ_TWI0,
  1673. .flags = IORESOURCE_IRQ,
  1674. },
  1675. };
  1676. static struct platform_device i2c_bfin_twi0_device = {
  1677. .name = "i2c-bfin-twi",
  1678. .id = 0,
  1679. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1680. .resource = bfin_twi0_resource,
  1681. .dev = {
  1682. .platform_data = &bfin_twi0_pins,
  1683. },
  1684. };
  1685. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1686. static struct resource bfin_twi1_resource[] = {
  1687. [0] = {
  1688. .start = TWI1_CLKDIV,
  1689. .end = TWI1_CLKDIV + 0xFF,
  1690. .flags = IORESOURCE_MEM,
  1691. },
  1692. [1] = {
  1693. .start = IRQ_TWI1,
  1694. .end = IRQ_TWI1,
  1695. .flags = IORESOURCE_IRQ,
  1696. },
  1697. };
  1698. static struct platform_device i2c_bfin_twi1_device = {
  1699. .name = "i2c-bfin-twi",
  1700. .id = 1,
  1701. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1702. .resource = bfin_twi1_resource,
  1703. .dev = {
  1704. .platform_data = &bfin_twi1_pins,
  1705. },
  1706. };
  1707. #endif
  1708. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1709. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1710. {
  1711. I2C_BOARD_INFO("adxl34x", 0x53),
  1712. .irq = IRQ_PC5,
  1713. .platform_data = (void *)&adxl34x_info,
  1714. },
  1715. #endif
  1716. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  1717. {
  1718. I2C_BOARD_INFO("adau1761", 0x38),
  1719. .platform_data = (void *)&adau1761_info
  1720. },
  1721. #endif
  1722. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  1723. {
  1724. I2C_BOARD_INFO("ssm2602", 0x1b),
  1725. },
  1726. #endif
  1727. };
  1728. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1729. };
  1730. static const unsigned int cclk_vlev_datasheet[] =
  1731. {
  1732. /*
  1733. * Internal VLEV BF54XSBBC1533
  1734. ****temporarily using these values until data sheet is updated
  1735. */
  1736. VRPAIR(VLEV_085, 150000000),
  1737. VRPAIR(VLEV_090, 250000000),
  1738. VRPAIR(VLEV_110, 276000000),
  1739. VRPAIR(VLEV_115, 301000000),
  1740. VRPAIR(VLEV_120, 525000000),
  1741. VRPAIR(VLEV_125, 550000000),
  1742. VRPAIR(VLEV_130, 600000000),
  1743. };
  1744. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1745. .tuple_tab = cclk_vlev_datasheet,
  1746. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1747. .vr_settling_time = 25 /* us */,
  1748. };
  1749. static struct platform_device bfin_dpmc = {
  1750. .name = "bfin dpmc",
  1751. .dev = {
  1752. .platform_data = &bfin_dmpc_vreg_data,
  1753. },
  1754. };
  1755. static struct platform_device *ezkit_devices[] __initdata = {
  1756. &bfin_dpmc,
  1757. #if defined(CONFIG_PINCTRL_ADI2)
  1758. &bfin_pinctrl_device,
  1759. &bfin_pint0_device,
  1760. &bfin_pint1_device,
  1761. &bfin_pint2_device,
  1762. &bfin_pint3_device,
  1763. &bfin_pint4_device,
  1764. &bfin_pint5_device,
  1765. &bfin_gpa_device,
  1766. &bfin_gpb_device,
  1767. &bfin_gpc_device,
  1768. &bfin_gpd_device,
  1769. &bfin_gpe_device,
  1770. &bfin_gpf_device,
  1771. &bfin_gpg_device,
  1772. #endif
  1773. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1774. &rtc_device,
  1775. #endif
  1776. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1777. #ifdef CONFIG_SERIAL_BFIN_UART0
  1778. &bfin_uart0_device,
  1779. #endif
  1780. #ifdef CONFIG_SERIAL_BFIN_UART1
  1781. &bfin_uart1_device,
  1782. #endif
  1783. #endif
  1784. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1785. #ifdef CONFIG_BFIN_SIR0
  1786. &bfin_sir0_device,
  1787. #endif
  1788. #ifdef CONFIG_BFIN_SIR1
  1789. &bfin_sir1_device,
  1790. #endif
  1791. #endif
  1792. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1793. &bfin_eth_device,
  1794. #endif
  1795. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1796. &musb_device,
  1797. #endif
  1798. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1799. &bfin_isp1760_device,
  1800. #endif
  1801. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1802. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1803. &bfin_sport0_uart_device,
  1804. #endif
  1805. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1806. &bfin_sport1_uart_device,
  1807. #endif
  1808. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1809. &bfin_sport2_uart_device,
  1810. #endif
  1811. #endif
  1812. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1813. &bfin_can0_device,
  1814. #endif
  1815. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1816. &bfin_nand_device,
  1817. #endif
  1818. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1819. &bfin_sdh_device,
  1820. #endif
  1821. #if IS_ENABLED(CONFIG_SPI_BFIN_V3)
  1822. &bf60x_spi_master0,
  1823. &bf60x_spi_master1,
  1824. #endif
  1825. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1826. &bfin_rotary_device,
  1827. #endif
  1828. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1829. &i2c_bfin_twi0_device,
  1830. #if !defined(CONFIG_BF542)
  1831. &i2c_bfin_twi1_device,
  1832. #endif
  1833. #endif
  1834. #if defined(CONFIG_BFIN_CRC)
  1835. &bfin_crc0_device,
  1836. &bfin_crc1_device,
  1837. #endif
  1838. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1839. &bfin_crypto_crc_device,
  1840. #endif
  1841. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1842. &bfin_device_gpiokeys,
  1843. #endif
  1844. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1845. &ezkit_flash_device,
  1846. #endif
  1847. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1848. &bfin_i2s_pcm,
  1849. #endif
  1850. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  1851. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  1852. &bfin_i2s,
  1853. #endif
  1854. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \
  1855. defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  1856. &bfin_ad1836_machine,
  1857. #endif
  1858. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  1859. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  1860. &adau1761_device,
  1861. #endif
  1862. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  1863. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  1864. &bfin_capture_device,
  1865. #endif
  1866. #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
  1867. || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
  1868. &bfin_display_device,
  1869. #endif
  1870. };
  1871. /* Pin control settings */
  1872. static struct pinctrl_map __initdata bfin_pinmux_map[] = {
  1873. /* per-device maps */
  1874. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
  1875. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
  1876. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
  1877. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
  1878. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
  1879. PIN_MAP_MUX_GROUP_DEFAULT("stmmaceth.0", "pinctrl-adi2.0", NULL, "eth0"),
  1880. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi3.0", "pinctrl-adi2.0", NULL, "spi0"),
  1881. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi3.1", "pinctrl-adi2.0", NULL, "spi1"),
  1882. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
  1883. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
  1884. PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
  1885. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
  1886. PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL, "smc0"),
  1887. PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", NULL, "ppi2_16b"),
  1888. PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", NULL, "ppi0_16b"),
  1889. #if defined(CONFIG_VIDEO_MT9M114) || defined(CONFIG_VIDEO_MT9M114_MODULE)
  1890. PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL, "ppi0_8b"),
  1891. #elif defined(CONFIG_VIDEO_VS6624) || defined(CONFIG_VIDEO_VS6624_MODULE)
  1892. PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL, "ppi0_16b"),
  1893. #else
  1894. PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL, "ppi0_24b"),
  1895. #endif
  1896. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
  1897. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
  1898. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
  1899. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
  1900. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
  1901. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
  1902. };
  1903. static int __init ezkit_init(void)
  1904. {
  1905. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1906. /* Initialize pinmuxing */
  1907. pinctrl_register_mappings(bfin_pinmux_map,
  1908. ARRAY_SIZE(bfin_pinmux_map));
  1909. i2c_register_board_info(0, bfin_i2c_board_info0,
  1910. ARRAY_SIZE(bfin_i2c_board_info0));
  1911. i2c_register_board_info(1, bfin_i2c_board_info1,
  1912. ARRAY_SIZE(bfin_i2c_board_info1));
  1913. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1914. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1915. return 0;
  1916. }
  1917. arch_initcall(ezkit_init);
  1918. static struct platform_device *ezkit_early_devices[] __initdata = {
  1919. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1920. #ifdef CONFIG_SERIAL_BFIN_UART0
  1921. &bfin_uart0_device,
  1922. #endif
  1923. #ifdef CONFIG_SERIAL_BFIN_UART1
  1924. &bfin_uart1_device,
  1925. #endif
  1926. #endif
  1927. };
  1928. void __init native_machine_early_platform_add_devices(void)
  1929. {
  1930. printk(KERN_INFO "register early platform devices\n");
  1931. early_platform_add_devices(ezkit_early_devices,
  1932. ARRAY_SIZE(ezkit_early_devices));
  1933. }