ezkit.c 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112
  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 <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 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 <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 IS_ENABLED(CONFIG_STMMAC_ETH)
  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, void *priv)
  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 IS_ENABLED(CONFIG_INPUT_ADXL34X)
  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 IS_ENABLED(CONFIG_RTC_DRV_BFIN)
  181. static struct platform_device rtc_device = {
  182. .name = "rtc-bfin",
  183. .id = -1,
  184. };
  185. #endif
  186. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  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 IS_ENABLED(CONFIG_BFIN_SIR)
  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 IS_ENABLED(CONFIG_USB_MUSB_HDRC)
  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 IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
  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 IS_ENABLED(CONFIG_CAN_BFIN)
  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 IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
  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 IS_ENABLED(CONFIG_SDH_BFIN)
  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 IS_ENABLED(CONFIG_MTD_PHYSMAP)
  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. bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
  648. bfin_write32(SMC_B0CTL, 0x01002011);
  649. bfin_write32(SMC_B0TIM, 0x08170977);
  650. bfin_write32(SMC_B0ETIM, 0x00092231);
  651. return 0;
  652. }
  653. void bf609_nor_flash_exit(struct platform_device *pdev)
  654. {
  655. bfin_write32(SMC_GCTL, 0);
  656. }
  657. static struct physmap_flash_data ezkit_flash_data = {
  658. .width = 2,
  659. .parts = ezkit_partitions,
  660. .init = bf609_nor_flash_init,
  661. .exit = bf609_nor_flash_exit,
  662. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  663. #ifdef CONFIG_ROMKERNEL
  664. .probe_type = "map_rom",
  665. #endif
  666. };
  667. static struct resource ezkit_flash_resource = {
  668. .start = 0xb0000000,
  669. .end = 0xb0ffffff,
  670. .flags = IORESOURCE_MEM,
  671. };
  672. static struct platform_device ezkit_flash_device = {
  673. .name = "physmap-flash",
  674. .id = 0,
  675. .dev = {
  676. .platform_data = &ezkit_flash_data,
  677. },
  678. .num_resources = 1,
  679. .resource = &ezkit_flash_resource,
  680. };
  681. #endif
  682. #if IS_ENABLED(CONFIG_MTD_M25P80)
  683. /* SPI flash chip (w25q32) */
  684. static struct mtd_partition bfin_spi_flash_partitions[] = {
  685. {
  686. .name = "bootloader(spi)",
  687. .size = 0x00080000,
  688. .offset = 0,
  689. .mask_flags = MTD_CAP_ROM
  690. }, {
  691. .name = "linux kernel(spi)",
  692. .size = 0x00180000,
  693. .offset = MTDPART_OFS_APPEND,
  694. }, {
  695. .name = "file system(spi)",
  696. .size = MTDPART_SIZ_FULL,
  697. .offset = MTDPART_OFS_APPEND,
  698. }
  699. };
  700. static struct flash_platform_data bfin_spi_flash_data = {
  701. .name = "m25p80",
  702. .parts = bfin_spi_flash_partitions,
  703. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  704. .type = "w25q32",
  705. };
  706. static struct adi_spi3_chip spi_flash_chip_info = {
  707. .enable_dma = true, /* use dma transfer with this chip*/
  708. };
  709. #endif
  710. #if IS_ENABLED(CONFIG_SPI_SPIDEV)
  711. static struct adi_spi3_chip spidev_chip_info = {
  712. .enable_dma = true,
  713. };
  714. #endif
  715. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  716. static struct platform_device bfin_i2s_pcm = {
  717. .name = "bfin-i2s-pcm-audio",
  718. .id = -1,
  719. };
  720. #endif
  721. #if IS_ENABLED(CONFIG_SND_BF6XX_SOC_I2S)
  722. #include <asm/bfin_sport3.h>
  723. static struct resource bfin_snd_resources[] = {
  724. {
  725. .start = SPORT0_CTL_A,
  726. .end = SPORT0_CTL_A,
  727. .flags = IORESOURCE_MEM,
  728. },
  729. {
  730. .start = SPORT0_CTL_B,
  731. .end = SPORT0_CTL_B,
  732. .flags = IORESOURCE_MEM,
  733. },
  734. {
  735. .start = CH_SPORT0_TX,
  736. .end = CH_SPORT0_TX,
  737. .flags = IORESOURCE_DMA,
  738. },
  739. {
  740. .start = CH_SPORT0_RX,
  741. .end = CH_SPORT0_RX,
  742. .flags = IORESOURCE_DMA,
  743. },
  744. {
  745. .start = IRQ_SPORT0_TX_STAT,
  746. .end = IRQ_SPORT0_TX_STAT,
  747. .flags = IORESOURCE_IRQ,
  748. },
  749. {
  750. .start = IRQ_SPORT0_RX_STAT,
  751. .end = IRQ_SPORT0_RX_STAT,
  752. .flags = IORESOURCE_IRQ,
  753. },
  754. };
  755. static const unsigned short bfin_snd_pin[] = {
  756. P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
  757. P_SPORT0_BFS, P_SPORT0_BD0, 0,
  758. };
  759. static struct bfin_snd_platform_data bfin_snd_data = {
  760. .pin_req = bfin_snd_pin,
  761. };
  762. static struct platform_device bfin_i2s = {
  763. .name = "bfin-i2s",
  764. .num_resources = ARRAY_SIZE(bfin_snd_resources),
  765. .resource = bfin_snd_resources,
  766. .dev = {
  767. .platform_data = &bfin_snd_data,
  768. },
  769. };
  770. #endif
  771. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
  772. static const char * const ad1836_link[] = {
  773. "bfin-i2s.0",
  774. "spi0.76",
  775. };
  776. static struct platform_device bfin_ad1836_machine = {
  777. .name = "bfin-snd-ad1836",
  778. .id = -1,
  779. .dev = {
  780. .platform_data = (void *)ad1836_link,
  781. },
  782. };
  783. #endif
  784. #if IS_ENABLED(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61)
  785. static struct platform_device adau1761_device = {
  786. .name = "bfin-eval-adau1x61",
  787. };
  788. #endif
  789. #if IS_ENABLED(CONFIG_SND_SOC_ADAU1761)
  790. #include <sound/adau17x1.h>
  791. static struct adau1761_platform_data adau1761_info = {
  792. .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
  793. .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
  794. };
  795. #endif
  796. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
  797. #include <linux/videodev2.h>
  798. #include <media/blackfin/bfin_capture.h>
  799. #include <media/blackfin/ppi.h>
  800. static const unsigned short ppi_req[] = {
  801. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  802. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  803. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  804. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  805. #if !IS_ENABLED(CONFIG_VIDEO_VS6624)
  806. P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
  807. P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
  808. #endif
  809. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  810. 0,
  811. };
  812. static const struct ppi_info ppi_info = {
  813. .type = PPI_TYPE_EPPI3,
  814. .dma_ch = CH_EPPI0_CH0,
  815. .irq_err = IRQ_EPPI0_STAT,
  816. .base = (void __iomem *)EPPI0_STAT,
  817. .pin_req = ppi_req,
  818. };
  819. #if IS_ENABLED(CONFIG_VIDEO_VS6624)
  820. static struct v4l2_input vs6624_inputs[] = {
  821. {
  822. .index = 0,
  823. .name = "Camera",
  824. .type = V4L2_INPUT_TYPE_CAMERA,
  825. .std = V4L2_STD_UNKNOWN,
  826. },
  827. };
  828. static struct bcap_route vs6624_routes[] = {
  829. {
  830. .input = 0,
  831. .output = 0,
  832. },
  833. };
  834. static const unsigned vs6624_ce_pin = GPIO_PE4;
  835. static struct bfin_capture_config bfin_capture_data = {
  836. .card_name = "BF609",
  837. .inputs = vs6624_inputs,
  838. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  839. .routes = vs6624_routes,
  840. .i2c_adapter_id = 0,
  841. .board_info = {
  842. .type = "vs6624",
  843. .addr = 0x10,
  844. .platform_data = (void *)&vs6624_ce_pin,
  845. },
  846. .ppi_info = &ppi_info,
  847. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
  848. | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  849. .blank_pixels = 4,
  850. };
  851. #endif
  852. #if IS_ENABLED(CONFIG_VIDEO_ADV7842)
  853. #include <media/adv7842.h>
  854. static struct v4l2_input adv7842_inputs[] = {
  855. {
  856. .index = 0,
  857. .name = "Composite",
  858. .type = V4L2_INPUT_TYPE_CAMERA,
  859. .std = V4L2_STD_ALL,
  860. .capabilities = V4L2_IN_CAP_STD,
  861. },
  862. {
  863. .index = 1,
  864. .name = "S-Video",
  865. .type = V4L2_INPUT_TYPE_CAMERA,
  866. .std = V4L2_STD_ALL,
  867. .capabilities = V4L2_IN_CAP_STD,
  868. },
  869. {
  870. .index = 2,
  871. .name = "Component",
  872. .type = V4L2_INPUT_TYPE_CAMERA,
  873. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  874. },
  875. {
  876. .index = 3,
  877. .name = "VGA",
  878. .type = V4L2_INPUT_TYPE_CAMERA,
  879. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  880. },
  881. {
  882. .index = 4,
  883. .name = "HDMI",
  884. .type = V4L2_INPUT_TYPE_CAMERA,
  885. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  886. },
  887. };
  888. static struct bcap_route adv7842_routes[] = {
  889. {
  890. .input = 3,
  891. .output = 0,
  892. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  893. | EPPI_CTL_ACTIVE656),
  894. },
  895. {
  896. .input = 4,
  897. .output = 0,
  898. },
  899. {
  900. .input = 2,
  901. .output = 0,
  902. },
  903. {
  904. .input = 1,
  905. .output = 0,
  906. },
  907. {
  908. .input = 0,
  909. .output = 1,
  910. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  911. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC2
  912. | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  913. },
  914. };
  915. static struct adv7842_output_format adv7842_opf[] = {
  916. {
  917. .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
  918. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
  919. .op_656_range = 1,
  920. .blank_data = 1,
  921. .insert_av_codes = 1,
  922. },
  923. {
  924. .op_ch_sel = ADV7842_OP_CH_SEL_RGB,
  925. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_16,
  926. .op_656_range = 1,
  927. .blank_data = 1,
  928. },
  929. };
  930. static struct adv7842_platform_data adv7842_data = {
  931. .opf = adv7842_opf,
  932. .num_opf = ARRAY_SIZE(adv7842_opf),
  933. .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
  934. .prim_mode = ADV7842_PRIM_MODE_SDP,
  935. .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
  936. .hdmi_free_run_enable = 1,
  937. .sdp_free_run_auto = 1,
  938. .llc_dll_phase = 0x10,
  939. .i2c_sdp_io = 0x40,
  940. .i2c_sdp = 0x41,
  941. .i2c_cp = 0x42,
  942. .i2c_vdp = 0x43,
  943. .i2c_afe = 0x44,
  944. .i2c_hdmi = 0x45,
  945. .i2c_repeater = 0x46,
  946. .i2c_edid = 0x47,
  947. .i2c_infoframe = 0x48,
  948. .i2c_cec = 0x49,
  949. .i2c_avlink = 0x4a,
  950. .i2c_ex = 0x26,
  951. };
  952. static struct bfin_capture_config bfin_capture_data = {
  953. .card_name = "BF609",
  954. .inputs = adv7842_inputs,
  955. .num_inputs = ARRAY_SIZE(adv7842_inputs),
  956. .routes = adv7842_routes,
  957. .i2c_adapter_id = 0,
  958. .board_info = {
  959. .type = "adv7842",
  960. .addr = 0x20,
  961. .platform_data = (void *)&adv7842_data,
  962. },
  963. .ppi_info = &ppi_info,
  964. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  965. | EPPI_CTL_ACTIVE656),
  966. };
  967. #endif
  968. static struct platform_device bfin_capture_device = {
  969. .name = "bfin_capture",
  970. .dev = {
  971. .platform_data = &bfin_capture_data,
  972. },
  973. };
  974. #endif
  975. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_DISPLAY)
  976. #include <linux/videodev2.h>
  977. #include <media/blackfin/bfin_display.h>
  978. #include <media/blackfin/ppi.h>
  979. static const unsigned short ppi_req_disp[] = {
  980. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  981. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  982. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  983. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  984. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  985. 0,
  986. };
  987. static const struct ppi_info ppi_info = {
  988. .type = PPI_TYPE_EPPI3,
  989. .dma_ch = CH_EPPI0_CH0,
  990. .irq_err = IRQ_EPPI0_STAT,
  991. .base = (void __iomem *)EPPI0_STAT,
  992. .pin_req = ppi_req_disp,
  993. };
  994. #if IS_ENABLED(CONFIG_VIDEO_ADV7511)
  995. #include <media/adv7511.h>
  996. static struct v4l2_output adv7511_outputs[] = {
  997. {
  998. .index = 0,
  999. .name = "HDMI",
  1000. .type = V4L2_INPUT_TYPE_CAMERA,
  1001. .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
  1002. },
  1003. };
  1004. static struct disp_route adv7511_routes[] = {
  1005. {
  1006. .output = 0,
  1007. },
  1008. };
  1009. static struct adv7511_platform_data adv7511_data = {
  1010. .edid_addr = 0x7e,
  1011. .i2c_ex = 0x25,
  1012. };
  1013. static struct bfin_display_config bfin_display_data = {
  1014. .card_name = "BF609",
  1015. .outputs = adv7511_outputs,
  1016. .num_outputs = ARRAY_SIZE(adv7511_outputs),
  1017. .routes = adv7511_routes,
  1018. .i2c_adapter_id = 0,
  1019. .board_info = {
  1020. .type = "adv7511",
  1021. .addr = 0x39,
  1022. .platform_data = (void *)&adv7511_data,
  1023. },
  1024. .ppi_info = &ppi_info,
  1025. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  1026. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC3
  1027. | EPPI_CTL_IFSGEN | EPPI_CTL_SYNC2
  1028. | EPPI_CTL_NON656 | EPPI_CTL_DIR),
  1029. };
  1030. #endif
  1031. #if IS_ENABLED(CONFIG_VIDEO_ADV7343)
  1032. #include <media/adv7343.h>
  1033. static struct v4l2_output adv7343_outputs[] = {
  1034. {
  1035. .index = 0,
  1036. .name = "Composite",
  1037. .type = V4L2_OUTPUT_TYPE_ANALOG,
  1038. .std = V4L2_STD_ALL,
  1039. .capabilities = V4L2_OUT_CAP_STD,
  1040. },
  1041. {
  1042. .index = 1,
  1043. .name = "S-Video",
  1044. .type = V4L2_OUTPUT_TYPE_ANALOG,
  1045. .std = V4L2_STD_ALL,
  1046. .capabilities = V4L2_OUT_CAP_STD,
  1047. },
  1048. {
  1049. .index = 2,
  1050. .name = "Component",
  1051. .type = V4L2_OUTPUT_TYPE_ANALOG,
  1052. .std = V4L2_STD_ALL,
  1053. .capabilities = V4L2_OUT_CAP_STD,
  1054. },
  1055. };
  1056. static struct disp_route adv7343_routes[] = {
  1057. {
  1058. .output = ADV7343_COMPOSITE_ID,
  1059. },
  1060. {
  1061. .output = ADV7343_SVIDEO_ID,
  1062. },
  1063. {
  1064. .output = ADV7343_COMPONENT_ID,
  1065. },
  1066. };
  1067. static struct adv7343_platform_data adv7343_data = {
  1068. .mode_config = {
  1069. .sleep_mode = false,
  1070. .pll_control = false,
  1071. .dac_1 = true,
  1072. .dac_2 = true,
  1073. .dac_3 = true,
  1074. .dac_4 = true,
  1075. .dac_5 = true,
  1076. .dac_6 = true,
  1077. },
  1078. .sd_config = {
  1079. .sd_dac_out1 = false,
  1080. .sd_dac_out2 = false,
  1081. },
  1082. };
  1083. static struct bfin_display_config bfin_display_data = {
  1084. .card_name = "BF609",
  1085. .outputs = adv7343_outputs,
  1086. .num_outputs = ARRAY_SIZE(adv7343_outputs),
  1087. .routes = adv7343_routes,
  1088. .i2c_adapter_id = 0,
  1089. .board_info = {
  1090. .type = "adv7343",
  1091. .addr = 0x2b,
  1092. .platform_data = (void *)&adv7343_data,
  1093. },
  1094. .ppi_info = &ppi_info_disp,
  1095. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1LO_FS2LO
  1096. | EPPI_CTL_POLC3 | EPPI_CTL_BLANKGEN | EPPI_CTL_SYNC2
  1097. | EPPI_CTL_NON656 | EPPI_CTL_DIR),
  1098. };
  1099. #endif
  1100. static struct platform_device bfin_display_device = {
  1101. .name = "bfin_display",
  1102. .dev = {
  1103. .platform_data = &bfin_display_data,
  1104. },
  1105. };
  1106. #endif
  1107. #if defined(CONFIG_BFIN_CRC)
  1108. #define BFIN_CRC_NAME "bfin-crc"
  1109. static struct resource bfin_crc0_resources[] = {
  1110. {
  1111. .start = REG_CRC0_CTL,
  1112. .end = REG_CRC0_REVID+4,
  1113. .flags = IORESOURCE_MEM,
  1114. },
  1115. {
  1116. .start = IRQ_CRC0_DCNTEXP,
  1117. .end = IRQ_CRC0_DCNTEXP,
  1118. .flags = IORESOURCE_IRQ,
  1119. },
  1120. {
  1121. .start = CH_MEM_STREAM0_SRC_CRC0,
  1122. .end = CH_MEM_STREAM0_SRC_CRC0,
  1123. .flags = IORESOURCE_DMA,
  1124. },
  1125. {
  1126. .start = CH_MEM_STREAM0_DEST_CRC0,
  1127. .end = CH_MEM_STREAM0_DEST_CRC0,
  1128. .flags = IORESOURCE_DMA,
  1129. },
  1130. };
  1131. static struct platform_device bfin_crc0_device = {
  1132. .name = BFIN_CRC_NAME,
  1133. .id = 0,
  1134. .num_resources = ARRAY_SIZE(bfin_crc0_resources),
  1135. .resource = bfin_crc0_resources,
  1136. };
  1137. static struct resource bfin_crc1_resources[] = {
  1138. {
  1139. .start = REG_CRC1_CTL,
  1140. .end = REG_CRC1_REVID+4,
  1141. .flags = IORESOURCE_MEM,
  1142. },
  1143. {
  1144. .start = IRQ_CRC1_DCNTEXP,
  1145. .end = IRQ_CRC1_DCNTEXP,
  1146. .flags = IORESOURCE_IRQ,
  1147. },
  1148. {
  1149. .start = CH_MEM_STREAM1_SRC_CRC1,
  1150. .end = CH_MEM_STREAM1_SRC_CRC1,
  1151. .flags = IORESOURCE_DMA,
  1152. },
  1153. {
  1154. .start = CH_MEM_STREAM1_DEST_CRC1,
  1155. .end = CH_MEM_STREAM1_DEST_CRC1,
  1156. .flags = IORESOURCE_DMA,
  1157. },
  1158. };
  1159. static struct platform_device bfin_crc1_device = {
  1160. .name = BFIN_CRC_NAME,
  1161. .id = 1,
  1162. .num_resources = ARRAY_SIZE(bfin_crc1_resources),
  1163. .resource = bfin_crc1_resources,
  1164. };
  1165. #endif
  1166. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1167. #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
  1168. #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
  1169. static struct resource bfin_crypto_crc_resources[] = {
  1170. {
  1171. .start = REG_CRC0_CTL,
  1172. .end = REG_CRC0_REVID+4,
  1173. .flags = IORESOURCE_MEM,
  1174. },
  1175. {
  1176. .start = IRQ_CRC0_DCNTEXP,
  1177. .end = IRQ_CRC0_DCNTEXP,
  1178. .flags = IORESOURCE_IRQ,
  1179. },
  1180. {
  1181. .start = CH_MEM_STREAM0_SRC_CRC0,
  1182. .end = CH_MEM_STREAM0_SRC_CRC0,
  1183. .flags = IORESOURCE_DMA,
  1184. },
  1185. };
  1186. static struct platform_device bfin_crypto_crc_device = {
  1187. .name = BFIN_CRYPTO_CRC_NAME,
  1188. .id = 0,
  1189. .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
  1190. .resource = bfin_crypto_crc_resources,
  1191. .dev = {
  1192. .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
  1193. },
  1194. };
  1195. #endif
  1196. #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
  1197. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1198. .model = 7877,
  1199. .vref_delay_usecs = 50, /* internal, no capacitor */
  1200. .x_plate_ohms = 419,
  1201. .y_plate_ohms = 486,
  1202. .pressure_max = 1000,
  1203. .pressure_min = 0,
  1204. .stopacq_polarity = 1,
  1205. .first_conversion_delay = 3,
  1206. .acquisition_time = 1,
  1207. .averaging = 1,
  1208. .pen_down_acc_interval = 1,
  1209. };
  1210. #endif
  1211. #ifdef CONFIG_PINCTRL_ADI2
  1212. # define ADI_PINT_DEVNAME "adi-gpio-pint"
  1213. # define ADI_GPIO_DEVNAME "adi-gpio"
  1214. # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
  1215. static struct platform_device bfin_pinctrl_device = {
  1216. .name = ADI_PINCTRL_DEVNAME,
  1217. .id = 0,
  1218. };
  1219. static struct resource bfin_pint0_resources[] = {
  1220. {
  1221. .start = PINT0_MASK_SET,
  1222. .end = PINT0_LATCH + 3,
  1223. .flags = IORESOURCE_MEM,
  1224. },
  1225. {
  1226. .start = IRQ_PINT0,
  1227. .end = IRQ_PINT0,
  1228. .flags = IORESOURCE_IRQ,
  1229. },
  1230. };
  1231. static struct platform_device bfin_pint0_device = {
  1232. .name = ADI_PINT_DEVNAME,
  1233. .id = 0,
  1234. .num_resources = ARRAY_SIZE(bfin_pint0_resources),
  1235. .resource = bfin_pint0_resources,
  1236. };
  1237. static struct resource bfin_pint1_resources[] = {
  1238. {
  1239. .start = PINT1_MASK_SET,
  1240. .end = PINT1_LATCH + 3,
  1241. .flags = IORESOURCE_MEM,
  1242. },
  1243. {
  1244. .start = IRQ_PINT1,
  1245. .end = IRQ_PINT1,
  1246. .flags = IORESOURCE_IRQ,
  1247. },
  1248. };
  1249. static struct platform_device bfin_pint1_device = {
  1250. .name = ADI_PINT_DEVNAME,
  1251. .id = 1,
  1252. .num_resources = ARRAY_SIZE(bfin_pint1_resources),
  1253. .resource = bfin_pint1_resources,
  1254. };
  1255. static struct resource bfin_pint2_resources[] = {
  1256. {
  1257. .start = PINT2_MASK_SET,
  1258. .end = PINT2_LATCH + 3,
  1259. .flags = IORESOURCE_MEM,
  1260. },
  1261. {
  1262. .start = IRQ_PINT2,
  1263. .end = IRQ_PINT2,
  1264. .flags = IORESOURCE_IRQ,
  1265. },
  1266. };
  1267. static struct platform_device bfin_pint2_device = {
  1268. .name = ADI_PINT_DEVNAME,
  1269. .id = 2,
  1270. .num_resources = ARRAY_SIZE(bfin_pint2_resources),
  1271. .resource = bfin_pint2_resources,
  1272. };
  1273. static struct resource bfin_pint3_resources[] = {
  1274. {
  1275. .start = PINT3_MASK_SET,
  1276. .end = PINT3_LATCH + 3,
  1277. .flags = IORESOURCE_MEM,
  1278. },
  1279. {
  1280. .start = IRQ_PINT3,
  1281. .end = IRQ_PINT3,
  1282. .flags = IORESOURCE_IRQ,
  1283. },
  1284. };
  1285. static struct platform_device bfin_pint3_device = {
  1286. .name = ADI_PINT_DEVNAME,
  1287. .id = 3,
  1288. .num_resources = ARRAY_SIZE(bfin_pint3_resources),
  1289. .resource = bfin_pint3_resources,
  1290. };
  1291. static struct resource bfin_pint4_resources[] = {
  1292. {
  1293. .start = PINT4_MASK_SET,
  1294. .end = PINT4_LATCH + 3,
  1295. .flags = IORESOURCE_MEM,
  1296. },
  1297. {
  1298. .start = IRQ_PINT4,
  1299. .end = IRQ_PINT4,
  1300. .flags = IORESOURCE_IRQ,
  1301. },
  1302. };
  1303. static struct platform_device bfin_pint4_device = {
  1304. .name = ADI_PINT_DEVNAME,
  1305. .id = 4,
  1306. .num_resources = ARRAY_SIZE(bfin_pint4_resources),
  1307. .resource = bfin_pint4_resources,
  1308. };
  1309. static struct resource bfin_pint5_resources[] = {
  1310. {
  1311. .start = PINT5_MASK_SET,
  1312. .end = PINT5_LATCH + 3,
  1313. .flags = IORESOURCE_MEM,
  1314. },
  1315. {
  1316. .start = IRQ_PINT5,
  1317. .end = IRQ_PINT5,
  1318. .flags = IORESOURCE_IRQ,
  1319. },
  1320. };
  1321. static struct platform_device bfin_pint5_device = {
  1322. .name = ADI_PINT_DEVNAME,
  1323. .id = 5,
  1324. .num_resources = ARRAY_SIZE(bfin_pint5_resources),
  1325. .resource = bfin_pint5_resources,
  1326. };
  1327. static struct resource bfin_gpa_resources[] = {
  1328. {
  1329. .start = PORTA_FER,
  1330. .end = PORTA_MUX + 3,
  1331. .flags = IORESOURCE_MEM,
  1332. },
  1333. { /* optional */
  1334. .start = IRQ_PA0,
  1335. .end = IRQ_PA0,
  1336. .flags = IORESOURCE_IRQ,
  1337. },
  1338. };
  1339. static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
  1340. .port_pin_base = GPIO_PA0,
  1341. .port_width = GPIO_BANKSIZE,
  1342. .pint_id = 0, /* PINT0 */
  1343. .pint_assign = true, /* PINT upper 16 bit */
  1344. .pint_map = 0, /* mapping mask in PINT */
  1345. };
  1346. static struct platform_device bfin_gpa_device = {
  1347. .name = ADI_GPIO_DEVNAME,
  1348. .id = 0,
  1349. .num_resources = ARRAY_SIZE(bfin_gpa_resources),
  1350. .resource = bfin_gpa_resources,
  1351. .dev = {
  1352. .platform_data = &bfin_gpa_pdata, /* Passed to driver */
  1353. },
  1354. };
  1355. static struct resource bfin_gpb_resources[] = {
  1356. {
  1357. .start = PORTB_FER,
  1358. .end = PORTB_MUX + 3,
  1359. .flags = IORESOURCE_MEM,
  1360. },
  1361. {
  1362. .start = IRQ_PB0,
  1363. .end = IRQ_PB0,
  1364. .flags = IORESOURCE_IRQ,
  1365. },
  1366. };
  1367. static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
  1368. .port_pin_base = GPIO_PB0,
  1369. .port_width = GPIO_BANKSIZE,
  1370. .pint_id = 0,
  1371. .pint_assign = false,
  1372. .pint_map = 1,
  1373. };
  1374. static struct platform_device bfin_gpb_device = {
  1375. .name = ADI_GPIO_DEVNAME,
  1376. .id = 1,
  1377. .num_resources = ARRAY_SIZE(bfin_gpb_resources),
  1378. .resource = bfin_gpb_resources,
  1379. .dev = {
  1380. .platform_data = &bfin_gpb_pdata, /* Passed to driver */
  1381. },
  1382. };
  1383. static struct resource bfin_gpc_resources[] = {
  1384. {
  1385. .start = PORTC_FER,
  1386. .end = PORTC_MUX + 3,
  1387. .flags = IORESOURCE_MEM,
  1388. },
  1389. {
  1390. .start = IRQ_PC0,
  1391. .end = IRQ_PC0,
  1392. .flags = IORESOURCE_IRQ,
  1393. },
  1394. };
  1395. static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
  1396. .port_pin_base = GPIO_PC0,
  1397. .port_width = GPIO_BANKSIZE,
  1398. .pint_id = 1,
  1399. .pint_assign = false,
  1400. .pint_map = 1,
  1401. };
  1402. static struct platform_device bfin_gpc_device = {
  1403. .name = ADI_GPIO_DEVNAME,
  1404. .id = 2,
  1405. .num_resources = ARRAY_SIZE(bfin_gpc_resources),
  1406. .resource = bfin_gpc_resources,
  1407. .dev = {
  1408. .platform_data = &bfin_gpc_pdata, /* Passed to driver */
  1409. },
  1410. };
  1411. static struct resource bfin_gpd_resources[] = {
  1412. {
  1413. .start = PORTD_FER,
  1414. .end = PORTD_MUX + 3,
  1415. .flags = IORESOURCE_MEM,
  1416. },
  1417. {
  1418. .start = IRQ_PD0,
  1419. .end = IRQ_PD0,
  1420. .flags = IORESOURCE_IRQ,
  1421. },
  1422. };
  1423. static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
  1424. .port_pin_base = GPIO_PD0,
  1425. .port_width = GPIO_BANKSIZE,
  1426. .pint_id = 2,
  1427. .pint_assign = false,
  1428. .pint_map = 1,
  1429. };
  1430. static struct platform_device bfin_gpd_device = {
  1431. .name = ADI_GPIO_DEVNAME,
  1432. .id = 3,
  1433. .num_resources = ARRAY_SIZE(bfin_gpd_resources),
  1434. .resource = bfin_gpd_resources,
  1435. .dev = {
  1436. .platform_data = &bfin_gpd_pdata, /* Passed to driver */
  1437. },
  1438. };
  1439. static struct resource bfin_gpe_resources[] = {
  1440. {
  1441. .start = PORTE_FER,
  1442. .end = PORTE_MUX + 3,
  1443. .flags = IORESOURCE_MEM,
  1444. },
  1445. {
  1446. .start = IRQ_PE0,
  1447. .end = IRQ_PE0,
  1448. .flags = IORESOURCE_IRQ,
  1449. },
  1450. };
  1451. static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
  1452. .port_pin_base = GPIO_PE0,
  1453. .port_width = GPIO_BANKSIZE,
  1454. .pint_id = 3,
  1455. .pint_assign = false,
  1456. .pint_map = 1,
  1457. };
  1458. static struct platform_device bfin_gpe_device = {
  1459. .name = ADI_GPIO_DEVNAME,
  1460. .id = 4,
  1461. .num_resources = ARRAY_SIZE(bfin_gpe_resources),
  1462. .resource = bfin_gpe_resources,
  1463. .dev = {
  1464. .platform_data = &bfin_gpe_pdata, /* Passed to driver */
  1465. },
  1466. };
  1467. static struct resource bfin_gpf_resources[] = {
  1468. {
  1469. .start = PORTF_FER,
  1470. .end = PORTF_MUX + 3,
  1471. .flags = IORESOURCE_MEM,
  1472. },
  1473. {
  1474. .start = IRQ_PF0,
  1475. .end = IRQ_PF0,
  1476. .flags = IORESOURCE_IRQ,
  1477. },
  1478. };
  1479. static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
  1480. .port_pin_base = GPIO_PF0,
  1481. .port_width = GPIO_BANKSIZE,
  1482. .pint_id = 4,
  1483. .pint_assign = false,
  1484. .pint_map = 1,
  1485. };
  1486. static struct platform_device bfin_gpf_device = {
  1487. .name = ADI_GPIO_DEVNAME,
  1488. .id = 5,
  1489. .num_resources = ARRAY_SIZE(bfin_gpf_resources),
  1490. .resource = bfin_gpf_resources,
  1491. .dev = {
  1492. .platform_data = &bfin_gpf_pdata, /* Passed to driver */
  1493. },
  1494. };
  1495. static struct resource bfin_gpg_resources[] = {
  1496. {
  1497. .start = PORTG_FER,
  1498. .end = PORTG_MUX + 3,
  1499. .flags = IORESOURCE_MEM,
  1500. },
  1501. {
  1502. .start = IRQ_PG0,
  1503. .end = IRQ_PG0,
  1504. .flags = IORESOURCE_IRQ,
  1505. },
  1506. };
  1507. static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
  1508. .port_pin_base = GPIO_PG0,
  1509. .port_width = GPIO_BANKSIZE,
  1510. .pint_id = 5,
  1511. .pint_assign = false,
  1512. .pint_map = 1,
  1513. };
  1514. static struct platform_device bfin_gpg_device = {
  1515. .name = ADI_GPIO_DEVNAME,
  1516. .id = 6,
  1517. .num_resources = ARRAY_SIZE(bfin_gpg_resources),
  1518. .resource = bfin_gpg_resources,
  1519. .dev = {
  1520. .platform_data = &bfin_gpg_pdata, /* Passed to driver */
  1521. },
  1522. };
  1523. #endif
  1524. #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
  1525. #include <linux/input.h>
  1526. #include <linux/gpio_keys.h>
  1527. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1528. {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
  1529. {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
  1530. };
  1531. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1532. .buttons = bfin_gpio_keys_table,
  1533. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1534. };
  1535. static struct platform_device bfin_device_gpiokeys = {
  1536. .name = "gpio-keys",
  1537. .dev = {
  1538. .platform_data = &bfin_gpio_keys_data,
  1539. },
  1540. };
  1541. #endif
  1542. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1543. #if IS_ENABLED(CONFIG_MTD_M25P80)
  1544. {
  1545. /* the modalias must be the same as spi device driver name */
  1546. .modalias = "m25p80", /* Name of spi_driver for this device */
  1547. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1548. .bus_num = 0, /* Framework bus number */
  1549. .chip_select = MAX_CTRL_CS + GPIO_PD11, /* SPI_SSEL1*/
  1550. .platform_data = &bfin_spi_flash_data,
  1551. .controller_data = &spi_flash_chip_info,
  1552. .mode = SPI_MODE_3,
  1553. },
  1554. #endif
  1555. #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
  1556. {
  1557. .modalias = "ad7877",
  1558. .platform_data = &bfin_ad7877_ts_info,
  1559. .irq = IRQ_PD9,
  1560. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1561. .bus_num = 0,
  1562. .chip_select = MAX_CTRL_CS + GPIO_PC15, /* SPI_SSEL4 */
  1563. },
  1564. #endif
  1565. #if IS_ENABLED(CONFIG_SPI_SPIDEV)
  1566. {
  1567. .modalias = "spidev",
  1568. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1569. .bus_num = 0,
  1570. .chip_select = MAX_CTRL_CS + GPIO_PD11, /* SPI_SSEL1*/
  1571. .controller_data = &spidev_chip_info,
  1572. },
  1573. #endif
  1574. #if IS_ENABLED(CONFIG_INPUT_ADXL34X_SPI)
  1575. {
  1576. .modalias = "adxl34x",
  1577. .platform_data = &adxl34x_info,
  1578. .irq = IRQ_PC5,
  1579. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1580. .bus_num = 1,
  1581. .chip_select = 2,
  1582. .mode = SPI_MODE_3,
  1583. },
  1584. #endif
  1585. };
  1586. #if IS_ENABLED(CONFIG_SPI_ADI_V3)
  1587. /* SPI (0) */
  1588. static struct resource bfin_spi0_resource[] = {
  1589. {
  1590. .start = SPI0_REGBASE,
  1591. .end = SPI0_REGBASE + 0xFF,
  1592. .flags = IORESOURCE_MEM,
  1593. },
  1594. {
  1595. .start = CH_SPI0_TX,
  1596. .end = CH_SPI0_TX,
  1597. .flags = IORESOURCE_DMA,
  1598. },
  1599. {
  1600. .start = CH_SPI0_RX,
  1601. .end = CH_SPI0_RX,
  1602. .flags = IORESOURCE_DMA,
  1603. },
  1604. };
  1605. /* SPI (1) */
  1606. static struct resource bfin_spi1_resource[] = {
  1607. {
  1608. .start = SPI1_REGBASE,
  1609. .end = SPI1_REGBASE + 0xFF,
  1610. .flags = IORESOURCE_MEM,
  1611. },
  1612. {
  1613. .start = CH_SPI1_TX,
  1614. .end = CH_SPI1_TX,
  1615. .flags = IORESOURCE_DMA,
  1616. },
  1617. {
  1618. .start = CH_SPI1_RX,
  1619. .end = CH_SPI1_RX,
  1620. .flags = IORESOURCE_DMA,
  1621. },
  1622. };
  1623. /* SPI controller data */
  1624. static struct adi_spi3_master bf60x_spi_master_info0 = {
  1625. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1626. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1627. };
  1628. static struct platform_device bf60x_spi_master0 = {
  1629. .name = "adi-spi3",
  1630. .id = 0, /* Bus number */
  1631. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1632. .resource = bfin_spi0_resource,
  1633. .dev = {
  1634. .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
  1635. },
  1636. };
  1637. static struct adi_spi3_master bf60x_spi_master_info1 = {
  1638. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1639. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1640. };
  1641. static struct platform_device bf60x_spi_master1 = {
  1642. .name = "adi-spi3",
  1643. .id = 1, /* Bus number */
  1644. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1645. .resource = bfin_spi1_resource,
  1646. .dev = {
  1647. .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
  1648. },
  1649. };
  1650. #endif /* spi master and devices */
  1651. #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
  1652. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1653. static struct resource bfin_twi0_resource[] = {
  1654. [0] = {
  1655. .start = TWI0_CLKDIV,
  1656. .end = TWI0_CLKDIV + 0xFF,
  1657. .flags = IORESOURCE_MEM,
  1658. },
  1659. [1] = {
  1660. .start = IRQ_TWI0,
  1661. .end = IRQ_TWI0,
  1662. .flags = IORESOURCE_IRQ,
  1663. },
  1664. };
  1665. static struct platform_device i2c_bfin_twi0_device = {
  1666. .name = "i2c-bfin-twi",
  1667. .id = 0,
  1668. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1669. .resource = bfin_twi0_resource,
  1670. .dev = {
  1671. .platform_data = &bfin_twi0_pins,
  1672. },
  1673. };
  1674. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1675. static struct resource bfin_twi1_resource[] = {
  1676. [0] = {
  1677. .start = TWI1_CLKDIV,
  1678. .end = TWI1_CLKDIV + 0xFF,
  1679. .flags = IORESOURCE_MEM,
  1680. },
  1681. [1] = {
  1682. .start = IRQ_TWI1,
  1683. .end = IRQ_TWI1,
  1684. .flags = IORESOURCE_IRQ,
  1685. },
  1686. };
  1687. static struct platform_device i2c_bfin_twi1_device = {
  1688. .name = "i2c-bfin-twi",
  1689. .id = 1,
  1690. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1691. .resource = bfin_twi1_resource,
  1692. .dev = {
  1693. .platform_data = &bfin_twi1_pins,
  1694. },
  1695. };
  1696. #endif
  1697. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1698. #if IS_ENABLED(CONFIG_INPUT_ADXL34X_I2C)
  1699. {
  1700. I2C_BOARD_INFO("adxl34x", 0x53),
  1701. .irq = IRQ_PC5,
  1702. .platform_data = (void *)&adxl34x_info,
  1703. },
  1704. #endif
  1705. #if IS_ENABLED(CONFIG_SND_SOC_ADAU1761)
  1706. {
  1707. I2C_BOARD_INFO("adau1761", 0x38),
  1708. .platform_data = (void *)&adau1761_info
  1709. },
  1710. #endif
  1711. #if IS_ENABLED(CONFIG_SND_SOC_SSM2602)
  1712. {
  1713. I2C_BOARD_INFO("ssm2602", 0x1b),
  1714. },
  1715. #endif
  1716. };
  1717. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1718. };
  1719. static const unsigned int cclk_vlev_datasheet[] =
  1720. {
  1721. /*
  1722. * Internal VLEV BF54XSBBC1533
  1723. ****temporarily using these values until data sheet is updated
  1724. */
  1725. VRPAIR(VLEV_085, 150000000),
  1726. VRPAIR(VLEV_090, 250000000),
  1727. VRPAIR(VLEV_110, 276000000),
  1728. VRPAIR(VLEV_115, 301000000),
  1729. VRPAIR(VLEV_120, 525000000),
  1730. VRPAIR(VLEV_125, 550000000),
  1731. VRPAIR(VLEV_130, 600000000),
  1732. };
  1733. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1734. .tuple_tab = cclk_vlev_datasheet,
  1735. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1736. .vr_settling_time = 25 /* us */,
  1737. };
  1738. static struct platform_device bfin_dpmc = {
  1739. .name = "bfin dpmc",
  1740. .dev = {
  1741. .platform_data = &bfin_dmpc_vreg_data,
  1742. },
  1743. };
  1744. static struct platform_device *ezkit_devices[] __initdata = {
  1745. &bfin_dpmc,
  1746. #if defined(CONFIG_PINCTRL_ADI2)
  1747. &bfin_pinctrl_device,
  1748. &bfin_pint0_device,
  1749. &bfin_pint1_device,
  1750. &bfin_pint2_device,
  1751. &bfin_pint3_device,
  1752. &bfin_pint4_device,
  1753. &bfin_pint5_device,
  1754. &bfin_gpa_device,
  1755. &bfin_gpb_device,
  1756. &bfin_gpc_device,
  1757. &bfin_gpd_device,
  1758. &bfin_gpe_device,
  1759. &bfin_gpf_device,
  1760. &bfin_gpg_device,
  1761. #endif
  1762. #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
  1763. &rtc_device,
  1764. #endif
  1765. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  1766. #ifdef CONFIG_SERIAL_BFIN_UART0
  1767. &bfin_uart0_device,
  1768. #endif
  1769. #ifdef CONFIG_SERIAL_BFIN_UART1
  1770. &bfin_uart1_device,
  1771. #endif
  1772. #endif
  1773. #if IS_ENABLED(CONFIG_BFIN_SIR)
  1774. #ifdef CONFIG_BFIN_SIR0
  1775. &bfin_sir0_device,
  1776. #endif
  1777. #ifdef CONFIG_BFIN_SIR1
  1778. &bfin_sir1_device,
  1779. #endif
  1780. #endif
  1781. #if IS_ENABLED(CONFIG_STMMAC_ETH)
  1782. &bfin_eth_device,
  1783. #endif
  1784. #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
  1785. &musb_device,
  1786. #endif
  1787. #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
  1788. &bfin_isp1760_device,
  1789. #endif
  1790. #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
  1791. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1792. &bfin_sport0_uart_device,
  1793. #endif
  1794. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1795. &bfin_sport1_uart_device,
  1796. #endif
  1797. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1798. &bfin_sport2_uart_device,
  1799. #endif
  1800. #endif
  1801. #if IS_ENABLED(CONFIG_CAN_BFIN)
  1802. &bfin_can0_device,
  1803. #endif
  1804. #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
  1805. &bfin_nand_device,
  1806. #endif
  1807. #if IS_ENABLED(CONFIG_SDH_BFIN)
  1808. &bfin_sdh_device,
  1809. #endif
  1810. #if IS_ENABLED(CONFIG_SPI_ADI_V3)
  1811. &bf60x_spi_master0,
  1812. &bf60x_spi_master1,
  1813. #endif
  1814. #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
  1815. &bfin_rotary_device,
  1816. #endif
  1817. #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
  1818. &i2c_bfin_twi0_device,
  1819. #if !defined(CONFIG_BF542)
  1820. &i2c_bfin_twi1_device,
  1821. #endif
  1822. #endif
  1823. #if defined(CONFIG_BFIN_CRC)
  1824. &bfin_crc0_device,
  1825. &bfin_crc1_device,
  1826. #endif
  1827. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1828. &bfin_crypto_crc_device,
  1829. #endif
  1830. #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
  1831. &bfin_device_gpiokeys,
  1832. #endif
  1833. #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
  1834. &ezkit_flash_device,
  1835. #endif
  1836. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1837. &bfin_i2s_pcm,
  1838. #endif
  1839. #if IS_ENABLED(CONFIG_SND_BF6XX_SOC_I2S)
  1840. &bfin_i2s,
  1841. #endif
  1842. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
  1843. &bfin_ad1836_machine,
  1844. #endif
  1845. #if IS_ENABLED(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61)
  1846. &adau1761_device,
  1847. #endif
  1848. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
  1849. &bfin_capture_device,
  1850. #endif
  1851. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_DISPLAY)
  1852. &bfin_display_device,
  1853. #endif
  1854. };
  1855. /* Pin control settings */
  1856. static struct pinctrl_map __initdata bfin_pinmux_map[] = {
  1857. /* per-device maps */
  1858. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
  1859. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
  1860. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
  1861. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
  1862. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
  1863. PIN_MAP_MUX_GROUP_DEFAULT("stmmaceth.0", "pinctrl-adi2.0", NULL, "eth0"),
  1864. PIN_MAP_MUX_GROUP_DEFAULT("adi-spi3.0", "pinctrl-adi2.0", NULL, "spi0"),
  1865. PIN_MAP_MUX_GROUP_DEFAULT("adi-spi3.1", "pinctrl-adi2.0", NULL, "spi1"),
  1866. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
  1867. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
  1868. PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
  1869. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
  1870. PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL, "smc0"),
  1871. PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"),
  1872. PIN_MAP_MUX_GROUP("bfin_display.0", "8bit", "pinctrl-adi2.0", "ppi2_8bgrp", "ppi2"),
  1873. PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"),
  1874. PIN_MAP_MUX_GROUP("bfin_display.0", "16bit", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"),
  1875. PIN_MAP_MUX_GROUP("bfin_capture.0", "8bit", "pinctrl-adi2.0", "ppi0_8bgrp", "ppi0"),
  1876. PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", "ppi0_16bgrp", "ppi0"),
  1877. PIN_MAP_MUX_GROUP("bfin_capture.0", "16bit", "pinctrl-adi2.0", "ppi0_16bgrp", "ppi0"),
  1878. PIN_MAP_MUX_GROUP("bfin_capture.0", "24bit", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"),
  1879. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
  1880. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
  1881. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
  1882. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
  1883. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
  1884. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
  1885. };
  1886. static int __init ezkit_init(void)
  1887. {
  1888. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1889. /* Initialize pinmuxing */
  1890. pinctrl_register_mappings(bfin_pinmux_map,
  1891. ARRAY_SIZE(bfin_pinmux_map));
  1892. i2c_register_board_info(0, bfin_i2c_board_info0,
  1893. ARRAY_SIZE(bfin_i2c_board_info0));
  1894. i2c_register_board_info(1, bfin_i2c_board_info1,
  1895. ARRAY_SIZE(bfin_i2c_board_info1));
  1896. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1897. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1898. return 0;
  1899. }
  1900. arch_initcall(ezkit_init);
  1901. static struct platform_device *ezkit_early_devices[] __initdata = {
  1902. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1903. #ifdef CONFIG_SERIAL_BFIN_UART0
  1904. &bfin_uart0_device,
  1905. #endif
  1906. #ifdef CONFIG_SERIAL_BFIN_UART1
  1907. &bfin_uart1_device,
  1908. #endif
  1909. #endif
  1910. };
  1911. void __init native_machine_early_platform_add_devices(void)
  1912. {
  1913. printk(KERN_INFO "register early platform devices\n");
  1914. early_platform_add_devices(ezkit_early_devices,
  1915. ARRAY_SIZE(ezkit_early_devices));
  1916. }