ezkit.c 48 KB

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