ezkit.c 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <linux/mtd/physmap.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #include <linux/irq.h>
  16. #include <linux/i2c.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/usb/musb.h>
  19. #include <linux/pinctrl/machine.h>
  20. #include <linux/pinctrl/pinconf-generic.h>
  21. #include <linux/platform_data/pinctrl-adi2.h>
  22. #include <asm/bfin5xx_spi.h>
  23. #include <asm/dma.h>
  24. #include <asm/gpio.h>
  25. #include <asm/nand.h>
  26. #include <asm/dpmc.h>
  27. #include <asm/bfin_sport.h>
  28. #include <asm/portmux.h>
  29. #include <asm/bfin_sdh.h>
  30. #include <mach/bf54x_keys.h>
  31. #include <linux/input.h>
  32. #include <linux/spi/ad7877.h>
  33. /*
  34. * Name the Board for the /proc/cpuinfo
  35. */
  36. const char bfin_board_name[] = "ADI BF548-EZKIT";
  37. /*
  38. * Driver needs to know address, irq and flag pin.
  39. */
  40. #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
  41. #include <linux/usb/isp1760.h>
  42. static struct resource bfin_isp1760_resources[] = {
  43. [0] = {
  44. .start = 0x2C0C0000,
  45. .end = 0x2C0C0000 + 0xfffff,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. [1] = {
  49. .start = IRQ_PG7,
  50. .end = IRQ_PG7,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. static struct isp1760_platform_data isp1760_priv = {
  55. .is_isp1761 = 0,
  56. .bus_width_16 = 1,
  57. .port1_otg = 0,
  58. .analog_oc = 0,
  59. .dack_polarity_high = 0,
  60. .dreq_polarity_high = 0,
  61. };
  62. static struct platform_device bfin_isp1760_device = {
  63. .name = "isp1760",
  64. .id = 0,
  65. .dev = {
  66. .platform_data = &isp1760_priv,
  67. },
  68. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  69. .resource = bfin_isp1760_resources,
  70. };
  71. #endif
  72. #if IS_ENABLED(CONFIG_FB_BF54X_LQ043)
  73. #include <mach/bf54x-lq043.h>
  74. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  75. .width = 95,
  76. .height = 54,
  77. .xres = {480, 480, 480},
  78. .yres = {272, 272, 272},
  79. .bpp = {24, 24, 24},
  80. .disp = GPIO_PE3,
  81. };
  82. static struct resource bf54x_lq043_resources[] = {
  83. {
  84. .start = IRQ_EPPI0_ERR,
  85. .end = IRQ_EPPI0_ERR,
  86. .flags = IORESOURCE_IRQ,
  87. },
  88. };
  89. static struct platform_device bf54x_lq043_device = {
  90. .name = "bf54x-lq043",
  91. .id = -1,
  92. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  93. .resource = bf54x_lq043_resources,
  94. .dev = {
  95. .platform_data = &bf54x_lq043_data,
  96. },
  97. };
  98. #endif
  99. #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
  100. static const unsigned int bf548_keymap[] = {
  101. KEYVAL(0, 0, KEY_ENTER),
  102. KEYVAL(0, 1, KEY_HELP),
  103. KEYVAL(0, 2, KEY_0),
  104. KEYVAL(0, 3, KEY_BACKSPACE),
  105. KEYVAL(1, 0, KEY_TAB),
  106. KEYVAL(1, 1, KEY_9),
  107. KEYVAL(1, 2, KEY_8),
  108. KEYVAL(1, 3, KEY_7),
  109. KEYVAL(2, 0, KEY_DOWN),
  110. KEYVAL(2, 1, KEY_6),
  111. KEYVAL(2, 2, KEY_5),
  112. KEYVAL(2, 3, KEY_4),
  113. KEYVAL(3, 0, KEY_UP),
  114. KEYVAL(3, 1, KEY_3),
  115. KEYVAL(3, 2, KEY_2),
  116. KEYVAL(3, 3, KEY_1),
  117. };
  118. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  119. .rows = 4,
  120. .cols = 4,
  121. .keymap = bf548_keymap,
  122. .keymapsize = ARRAY_SIZE(bf548_keymap),
  123. .repeat = 0,
  124. .debounce_time = 5000, /* ns (5ms) */
  125. .coldrive_time = 1000, /* ns (1ms) */
  126. .keyup_test_interval = 50, /* ms (50ms) */
  127. };
  128. static struct resource bf54x_kpad_resources[] = {
  129. {
  130. .start = IRQ_KEY,
  131. .end = IRQ_KEY,
  132. .flags = IORESOURCE_IRQ,
  133. },
  134. };
  135. static struct platform_device bf54x_kpad_device = {
  136. .name = "bf54x-keys",
  137. .id = -1,
  138. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  139. .resource = bf54x_kpad_resources,
  140. .dev = {
  141. .platform_data = &bf54x_kpad_data,
  142. },
  143. };
  144. #endif
  145. #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
  146. #include <asm/bfin_rotary.h>
  147. static struct bfin_rotary_platform_data bfin_rotary_data = {
  148. /*.rotary_up_key = KEY_UP,*/
  149. /*.rotary_down_key = KEY_DOWN,*/
  150. .rotary_rel_code = REL_WHEEL,
  151. .rotary_button_key = KEY_ENTER,
  152. .debounce = 10, /* 0..17 */
  153. .mode = ROT_QUAD_ENC | ROT_DEBE,
  154. .pm_wakeup = 1,
  155. };
  156. static struct resource bfin_rotary_resources[] = {
  157. {
  158. .start = IRQ_CNT,
  159. .end = IRQ_CNT,
  160. .flags = IORESOURCE_IRQ,
  161. },
  162. };
  163. static struct platform_device bfin_rotary_device = {
  164. .name = "bfin-rotary",
  165. .id = -1,
  166. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  167. .resource = bfin_rotary_resources,
  168. .dev = {
  169. .platform_data = &bfin_rotary_data,
  170. },
  171. };
  172. #endif
  173. #if IS_ENABLED(CONFIG_INPUT_ADXL34X)
  174. #include <linux/input/adxl34x.h>
  175. static const struct adxl34x_platform_data adxl34x_info = {
  176. .x_axis_offset = 0,
  177. .y_axis_offset = 0,
  178. .z_axis_offset = 0,
  179. .tap_threshold = 0x31,
  180. .tap_duration = 0x10,
  181. .tap_latency = 0x60,
  182. .tap_window = 0xF0,
  183. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  184. .act_axis_control = 0xFF,
  185. .activity_threshold = 5,
  186. .inactivity_threshold = 3,
  187. .inactivity_time = 4,
  188. .free_fall_threshold = 0x7,
  189. .free_fall_time = 0x20,
  190. .data_rate = 0x8,
  191. .data_range = ADXL_FULL_RES,
  192. .ev_type = EV_ABS,
  193. .ev_code_x = ABS_X, /* EV_REL */
  194. .ev_code_y = ABS_Y, /* EV_REL */
  195. .ev_code_z = ABS_Z, /* EV_REL */
  196. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  197. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  198. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  199. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  200. .fifo_mode = ADXL_FIFO_STREAM,
  201. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  202. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  203. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  204. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  205. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  206. };
  207. #endif
  208. #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
  209. static struct platform_device rtc_device = {
  210. .name = "rtc-bfin",
  211. .id = -1,
  212. };
  213. #endif
  214. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  215. #ifdef CONFIG_SERIAL_BFIN_UART0
  216. static struct resource bfin_uart0_resources[] = {
  217. {
  218. .start = UART0_DLL,
  219. .end = UART0_RBR+2,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. #ifdef CONFIG_EARLY_PRINTK
  223. {
  224. .start = PORTE_FER,
  225. .end = PORTE_FER+2,
  226. .flags = IORESOURCE_REG,
  227. },
  228. #endif
  229. {
  230. .start = IRQ_UART0_TX,
  231. .end = IRQ_UART0_TX,
  232. .flags = IORESOURCE_IRQ,
  233. },
  234. {
  235. .start = IRQ_UART0_RX,
  236. .end = IRQ_UART0_RX,
  237. .flags = IORESOURCE_IRQ,
  238. },
  239. {
  240. .start = IRQ_UART0_ERROR,
  241. .end = IRQ_UART0_ERROR,
  242. .flags = IORESOURCE_IRQ,
  243. },
  244. {
  245. .start = CH_UART0_TX,
  246. .end = CH_UART0_TX,
  247. .flags = IORESOURCE_DMA,
  248. },
  249. {
  250. .start = CH_UART0_RX,
  251. .end = CH_UART0_RX,
  252. .flags = IORESOURCE_DMA,
  253. },
  254. };
  255. static unsigned short bfin_uart0_peripherals[] = {
  256. P_UART0_TX, P_UART0_RX, 0
  257. };
  258. static struct platform_device bfin_uart0_device = {
  259. .name = "bfin-uart",
  260. .id = 0,
  261. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  262. .resource = bfin_uart0_resources,
  263. .dev = {
  264. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  265. },
  266. };
  267. #endif
  268. #ifdef CONFIG_SERIAL_BFIN_UART1
  269. static struct resource bfin_uart1_resources[] = {
  270. {
  271. .start = UART1_DLL,
  272. .end = UART1_RBR+2,
  273. .flags = IORESOURCE_MEM,
  274. },
  275. #ifdef CONFIG_EARLY_PRINTK
  276. {
  277. .start = PORTH_FER,
  278. .end = PORTH_FER+2,
  279. .flags = IORESOURCE_REG,
  280. },
  281. #endif
  282. {
  283. .start = IRQ_UART1_TX,
  284. .end = IRQ_UART1_TX,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. {
  288. .start = IRQ_UART1_RX,
  289. .end = IRQ_UART1_RX,
  290. .flags = IORESOURCE_IRQ,
  291. },
  292. {
  293. .start = IRQ_UART1_ERROR,
  294. .end = IRQ_UART1_ERROR,
  295. .flags = IORESOURCE_IRQ,
  296. },
  297. {
  298. .start = CH_UART1_TX,
  299. .end = CH_UART1_TX,
  300. .flags = IORESOURCE_DMA,
  301. },
  302. {
  303. .start = CH_UART1_RX,
  304. .end = CH_UART1_RX,
  305. .flags = IORESOURCE_DMA,
  306. },
  307. #ifdef CONFIG_BFIN_UART1_CTSRTS
  308. { /* CTS pin -- 0 means not supported */
  309. .start = GPIO_PE10,
  310. .end = GPIO_PE10,
  311. .flags = IORESOURCE_IO,
  312. },
  313. { /* RTS pin -- 0 means not supported */
  314. .start = GPIO_PE9,
  315. .end = GPIO_PE9,
  316. .flags = IORESOURCE_IO,
  317. },
  318. #endif
  319. };
  320. static unsigned short bfin_uart1_peripherals[] = {
  321. P_UART1_TX, P_UART1_RX,
  322. #ifdef CONFIG_BFIN_UART1_CTSRTS
  323. P_UART1_RTS, P_UART1_CTS,
  324. #endif
  325. 0
  326. };
  327. static struct platform_device bfin_uart1_device = {
  328. .name = "bfin-uart",
  329. .id = 1,
  330. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  331. .resource = bfin_uart1_resources,
  332. .dev = {
  333. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  334. },
  335. };
  336. #endif
  337. #ifdef CONFIG_SERIAL_BFIN_UART2
  338. static struct resource bfin_uart2_resources[] = {
  339. {
  340. .start = UART2_DLL,
  341. .end = UART2_RBR+2,
  342. .flags = IORESOURCE_MEM,
  343. },
  344. #ifdef CONFIG_EARLY_PRINTK
  345. {
  346. .start = PORTB_FER,
  347. .end = PORTB_FER+2,
  348. .flags = IORESOURCE_REG,
  349. },
  350. #endif
  351. {
  352. .start = IRQ_UART2_TX,
  353. .end = IRQ_UART2_TX,
  354. .flags = IORESOURCE_IRQ,
  355. },
  356. {
  357. .start = IRQ_UART2_RX,
  358. .end = IRQ_UART2_RX,
  359. .flags = IORESOURCE_IRQ,
  360. },
  361. {
  362. .start = IRQ_UART2_ERROR,
  363. .end = IRQ_UART2_ERROR,
  364. .flags = IORESOURCE_IRQ,
  365. },
  366. {
  367. .start = CH_UART2_TX,
  368. .end = CH_UART2_TX,
  369. .flags = IORESOURCE_DMA,
  370. },
  371. {
  372. .start = CH_UART2_RX,
  373. .end = CH_UART2_RX,
  374. .flags = IORESOURCE_DMA,
  375. },
  376. };
  377. static unsigned short bfin_uart2_peripherals[] = {
  378. P_UART2_TX, P_UART2_RX, 0
  379. };
  380. static struct platform_device bfin_uart2_device = {
  381. .name = "bfin-uart",
  382. .id = 2,
  383. .num_resources = ARRAY_SIZE(bfin_uart2_resources),
  384. .resource = bfin_uart2_resources,
  385. .dev = {
  386. .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
  387. },
  388. };
  389. #endif
  390. #ifdef CONFIG_SERIAL_BFIN_UART3
  391. static struct resource bfin_uart3_resources[] = {
  392. {
  393. .start = UART3_DLL,
  394. .end = UART3_RBR+2,
  395. .flags = IORESOURCE_MEM,
  396. },
  397. #ifdef CONFIG_EARLY_PRINTK
  398. {
  399. .start = PORTB_FER,
  400. .end = PORTB_FER+2,
  401. .flags = IORESOURCE_REG,
  402. },
  403. #endif
  404. {
  405. .start = IRQ_UART3_TX,
  406. .end = IRQ_UART3_TX,
  407. .flags = IORESOURCE_IRQ,
  408. },
  409. {
  410. .start = IRQ_UART3_RX,
  411. .end = IRQ_UART3_RX,
  412. .flags = IORESOURCE_IRQ,
  413. },
  414. {
  415. .start = IRQ_UART3_ERROR,
  416. .end = IRQ_UART3_ERROR,
  417. .flags = IORESOURCE_IRQ,
  418. },
  419. {
  420. .start = CH_UART3_TX,
  421. .end = CH_UART3_TX,
  422. .flags = IORESOURCE_DMA,
  423. },
  424. {
  425. .start = CH_UART3_RX,
  426. .end = CH_UART3_RX,
  427. .flags = IORESOURCE_DMA,
  428. },
  429. #ifdef CONFIG_BFIN_UART3_CTSRTS
  430. { /* CTS pin -- 0 means not supported */
  431. .start = GPIO_PB3,
  432. .end = GPIO_PB3,
  433. .flags = IORESOURCE_IO,
  434. },
  435. { /* RTS pin -- 0 means not supported */
  436. .start = GPIO_PB2,
  437. .end = GPIO_PB2,
  438. .flags = IORESOURCE_IO,
  439. },
  440. #endif
  441. };
  442. static unsigned short bfin_uart3_peripherals[] = {
  443. P_UART3_TX, P_UART3_RX,
  444. #ifdef CONFIG_BFIN_UART3_CTSRTS
  445. P_UART3_RTS, P_UART3_CTS,
  446. #endif
  447. 0
  448. };
  449. static struct platform_device bfin_uart3_device = {
  450. .name = "bfin-uart",
  451. .id = 3,
  452. .num_resources = ARRAY_SIZE(bfin_uart3_resources),
  453. .resource = bfin_uart3_resources,
  454. .dev = {
  455. .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
  456. },
  457. };
  458. #endif
  459. #endif
  460. #if IS_ENABLED(CONFIG_BFIN_SIR)
  461. #ifdef CONFIG_BFIN_SIR0
  462. static struct resource bfin_sir0_resources[] = {
  463. {
  464. .start = 0xFFC00400,
  465. .end = 0xFFC004FF,
  466. .flags = IORESOURCE_MEM,
  467. },
  468. {
  469. .start = IRQ_UART0_RX,
  470. .end = IRQ_UART0_RX+1,
  471. .flags = IORESOURCE_IRQ,
  472. },
  473. {
  474. .start = CH_UART0_RX,
  475. .end = CH_UART0_RX+1,
  476. .flags = IORESOURCE_DMA,
  477. },
  478. };
  479. static struct platform_device bfin_sir0_device = {
  480. .name = "bfin_sir",
  481. .id = 0,
  482. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  483. .resource = bfin_sir0_resources,
  484. };
  485. #endif
  486. #ifdef CONFIG_BFIN_SIR1
  487. static struct resource bfin_sir1_resources[] = {
  488. {
  489. .start = 0xFFC02000,
  490. .end = 0xFFC020FF,
  491. .flags = IORESOURCE_MEM,
  492. },
  493. {
  494. .start = IRQ_UART1_RX,
  495. .end = IRQ_UART1_RX+1,
  496. .flags = IORESOURCE_IRQ,
  497. },
  498. {
  499. .start = CH_UART1_RX,
  500. .end = CH_UART1_RX+1,
  501. .flags = IORESOURCE_DMA,
  502. },
  503. };
  504. static struct platform_device bfin_sir1_device = {
  505. .name = "bfin_sir",
  506. .id = 1,
  507. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  508. .resource = bfin_sir1_resources,
  509. };
  510. #endif
  511. #ifdef CONFIG_BFIN_SIR2
  512. static struct resource bfin_sir2_resources[] = {
  513. {
  514. .start = 0xFFC02100,
  515. .end = 0xFFC021FF,
  516. .flags = IORESOURCE_MEM,
  517. },
  518. {
  519. .start = IRQ_UART2_RX,
  520. .end = IRQ_UART2_RX+1,
  521. .flags = IORESOURCE_IRQ,
  522. },
  523. {
  524. .start = CH_UART2_RX,
  525. .end = CH_UART2_RX+1,
  526. .flags = IORESOURCE_DMA,
  527. },
  528. };
  529. static struct platform_device bfin_sir2_device = {
  530. .name = "bfin_sir",
  531. .id = 2,
  532. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  533. .resource = bfin_sir2_resources,
  534. };
  535. #endif
  536. #ifdef CONFIG_BFIN_SIR3
  537. static struct resource bfin_sir3_resources[] = {
  538. {
  539. .start = 0xFFC03100,
  540. .end = 0xFFC031FF,
  541. .flags = IORESOURCE_MEM,
  542. },
  543. {
  544. .start = IRQ_UART3_RX,
  545. .end = IRQ_UART3_RX+1,
  546. .flags = IORESOURCE_IRQ,
  547. },
  548. {
  549. .start = CH_UART3_RX,
  550. .end = CH_UART3_RX+1,
  551. .flags = IORESOURCE_DMA,
  552. },
  553. };
  554. static struct platform_device bfin_sir3_device = {
  555. .name = "bfin_sir",
  556. .id = 3,
  557. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  558. .resource = bfin_sir3_resources,
  559. };
  560. #endif
  561. #endif
  562. #if IS_ENABLED(CONFIG_SMSC911X)
  563. #include <linux/smsc911x.h>
  564. static struct resource smsc911x_resources[] = {
  565. {
  566. .name = "smsc911x-memory",
  567. .start = 0x24000000,
  568. .end = 0x24000000 + 0xFF,
  569. .flags = IORESOURCE_MEM,
  570. },
  571. {
  572. .start = IRQ_PE8,
  573. .end = IRQ_PE8,
  574. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  575. },
  576. };
  577. static struct smsc911x_platform_config smsc911x_config = {
  578. .flags = SMSC911X_USE_32BIT,
  579. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  580. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  581. .phy_interface = PHY_INTERFACE_MODE_MII,
  582. };
  583. static struct platform_device smsc911x_device = {
  584. .name = "smsc911x",
  585. .id = 0,
  586. .num_resources = ARRAY_SIZE(smsc911x_resources),
  587. .resource = smsc911x_resources,
  588. .dev = {
  589. .platform_data = &smsc911x_config,
  590. },
  591. };
  592. #endif
  593. #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
  594. static struct resource musb_resources[] = {
  595. [0] = {
  596. .start = 0xFFC03C00,
  597. .end = 0xFFC040FF,
  598. .flags = IORESOURCE_MEM,
  599. },
  600. [1] = { /* general IRQ */
  601. .start = IRQ_USB_INT0,
  602. .end = IRQ_USB_INT0,
  603. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  604. .name = "mc"
  605. },
  606. [2] = { /* DMA IRQ */
  607. .start = IRQ_USB_DMA,
  608. .end = IRQ_USB_DMA,
  609. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  610. .name = "dma"
  611. },
  612. };
  613. static struct musb_hdrc_config musb_config = {
  614. .multipoint = 0,
  615. .dyn_fifo = 0,
  616. .soft_con = 1,
  617. .dma = 1,
  618. .num_eps = 8,
  619. .dma_channels = 8,
  620. .gpio_vrsel = GPIO_PE7,
  621. /* Some custom boards need to be active low, just set it to "0"
  622. * if it is the case.
  623. */
  624. .gpio_vrsel_active = 1,
  625. .clkin = 24, /* musb CLKIN in MHZ */
  626. };
  627. static struct musb_hdrc_platform_data musb_plat = {
  628. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  629. .mode = MUSB_OTG,
  630. #elif defined(CONFIG_USB_MUSB_HDRC)
  631. .mode = MUSB_HOST,
  632. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  633. .mode = MUSB_PERIPHERAL,
  634. #endif
  635. .config = &musb_config,
  636. };
  637. static u64 musb_dmamask = ~(u32)0;
  638. static struct platform_device musb_device = {
  639. .name = "musb-blackfin",
  640. .id = 0,
  641. .dev = {
  642. .dma_mask = &musb_dmamask,
  643. .coherent_dma_mask = 0xffffffff,
  644. .platform_data = &musb_plat,
  645. },
  646. .num_resources = ARRAY_SIZE(musb_resources),
  647. .resource = musb_resources,
  648. };
  649. #endif
  650. #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
  651. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  652. static struct resource bfin_sport0_uart_resources[] = {
  653. {
  654. .start = SPORT0_TCR1,
  655. .end = SPORT0_MRCS3+4,
  656. .flags = IORESOURCE_MEM,
  657. },
  658. {
  659. .start = IRQ_SPORT0_RX,
  660. .end = IRQ_SPORT0_RX+1,
  661. .flags = IORESOURCE_IRQ,
  662. },
  663. {
  664. .start = IRQ_SPORT0_ERROR,
  665. .end = IRQ_SPORT0_ERROR,
  666. .flags = IORESOURCE_IRQ,
  667. },
  668. };
  669. static unsigned short bfin_sport0_peripherals[] = {
  670. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  671. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  672. };
  673. static struct platform_device bfin_sport0_uart_device = {
  674. .name = "bfin-sport-uart",
  675. .id = 0,
  676. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  677. .resource = bfin_sport0_uart_resources,
  678. .dev = {
  679. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  680. },
  681. };
  682. #endif
  683. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  684. static struct resource bfin_sport1_uart_resources[] = {
  685. {
  686. .start = SPORT1_TCR1,
  687. .end = SPORT1_MRCS3+4,
  688. .flags = IORESOURCE_MEM,
  689. },
  690. {
  691. .start = IRQ_SPORT1_RX,
  692. .end = IRQ_SPORT1_RX+1,
  693. .flags = IORESOURCE_IRQ,
  694. },
  695. {
  696. .start = IRQ_SPORT1_ERROR,
  697. .end = IRQ_SPORT1_ERROR,
  698. .flags = IORESOURCE_IRQ,
  699. },
  700. };
  701. static unsigned short bfin_sport1_peripherals[] = {
  702. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  703. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  704. };
  705. static struct platform_device bfin_sport1_uart_device = {
  706. .name = "bfin-sport-uart",
  707. .id = 1,
  708. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  709. .resource = bfin_sport1_uart_resources,
  710. .dev = {
  711. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  712. },
  713. };
  714. #endif
  715. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  716. static struct resource bfin_sport2_uart_resources[] = {
  717. {
  718. .start = SPORT2_TCR1,
  719. .end = SPORT2_MRCS3+4,
  720. .flags = IORESOURCE_MEM,
  721. },
  722. {
  723. .start = IRQ_SPORT2_RX,
  724. .end = IRQ_SPORT2_RX+1,
  725. .flags = IORESOURCE_IRQ,
  726. },
  727. {
  728. .start = IRQ_SPORT2_ERROR,
  729. .end = IRQ_SPORT2_ERROR,
  730. .flags = IORESOURCE_IRQ,
  731. },
  732. };
  733. static unsigned short bfin_sport2_peripherals[] = {
  734. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  735. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  736. };
  737. static struct platform_device bfin_sport2_uart_device = {
  738. .name = "bfin-sport-uart",
  739. .id = 2,
  740. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  741. .resource = bfin_sport2_uart_resources,
  742. .dev = {
  743. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  744. },
  745. };
  746. #endif
  747. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  748. static struct resource bfin_sport3_uart_resources[] = {
  749. {
  750. .start = SPORT3_TCR1,
  751. .end = SPORT3_MRCS3+4,
  752. .flags = IORESOURCE_MEM,
  753. },
  754. {
  755. .start = IRQ_SPORT3_RX,
  756. .end = IRQ_SPORT3_RX+1,
  757. .flags = IORESOURCE_IRQ,
  758. },
  759. {
  760. .start = IRQ_SPORT3_ERROR,
  761. .end = IRQ_SPORT3_ERROR,
  762. .flags = IORESOURCE_IRQ,
  763. },
  764. };
  765. static unsigned short bfin_sport3_peripherals[] = {
  766. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  767. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  768. };
  769. static struct platform_device bfin_sport3_uart_device = {
  770. .name = "bfin-sport-uart",
  771. .id = 3,
  772. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  773. .resource = bfin_sport3_uart_resources,
  774. .dev = {
  775. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  776. },
  777. };
  778. #endif
  779. #endif
  780. #if IS_ENABLED(CONFIG_CAN_BFIN)
  781. static unsigned short bfin_can0_peripherals[] = {
  782. P_CAN0_RX, P_CAN0_TX, 0
  783. };
  784. static struct resource bfin_can0_resources[] = {
  785. {
  786. .start = 0xFFC02A00,
  787. .end = 0xFFC02FFF,
  788. .flags = IORESOURCE_MEM,
  789. },
  790. {
  791. .start = IRQ_CAN0_RX,
  792. .end = IRQ_CAN0_RX,
  793. .flags = IORESOURCE_IRQ,
  794. },
  795. {
  796. .start = IRQ_CAN0_TX,
  797. .end = IRQ_CAN0_TX,
  798. .flags = IORESOURCE_IRQ,
  799. },
  800. {
  801. .start = IRQ_CAN0_ERROR,
  802. .end = IRQ_CAN0_ERROR,
  803. .flags = IORESOURCE_IRQ,
  804. },
  805. };
  806. static struct platform_device bfin_can0_device = {
  807. .name = "bfin_can",
  808. .id = 0,
  809. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  810. .resource = bfin_can0_resources,
  811. .dev = {
  812. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  813. },
  814. };
  815. static unsigned short bfin_can1_peripherals[] = {
  816. P_CAN1_RX, P_CAN1_TX, 0
  817. };
  818. static struct resource bfin_can1_resources[] = {
  819. {
  820. .start = 0xFFC03200,
  821. .end = 0xFFC037FF,
  822. .flags = IORESOURCE_MEM,
  823. },
  824. {
  825. .start = IRQ_CAN1_RX,
  826. .end = IRQ_CAN1_RX,
  827. .flags = IORESOURCE_IRQ,
  828. },
  829. {
  830. .start = IRQ_CAN1_TX,
  831. .end = IRQ_CAN1_TX,
  832. .flags = IORESOURCE_IRQ,
  833. },
  834. {
  835. .start = IRQ_CAN1_ERROR,
  836. .end = IRQ_CAN1_ERROR,
  837. .flags = IORESOURCE_IRQ,
  838. },
  839. };
  840. static struct platform_device bfin_can1_device = {
  841. .name = "bfin_can",
  842. .id = 1,
  843. .num_resources = ARRAY_SIZE(bfin_can1_resources),
  844. .resource = bfin_can1_resources,
  845. .dev = {
  846. .platform_data = &bfin_can1_peripherals, /* Passed to driver */
  847. },
  848. };
  849. #endif
  850. #if IS_ENABLED(CONFIG_PATA_BF54X)
  851. static struct resource bfin_atapi_resources[] = {
  852. {
  853. .start = 0xFFC03800,
  854. .end = 0xFFC0386F,
  855. .flags = IORESOURCE_MEM,
  856. },
  857. {
  858. .start = IRQ_ATAPI_ERR,
  859. .end = IRQ_ATAPI_ERR,
  860. .flags = IORESOURCE_IRQ,
  861. },
  862. };
  863. static struct platform_device bfin_atapi_device = {
  864. .name = "pata-bf54x",
  865. .id = -1,
  866. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  867. .resource = bfin_atapi_resources,
  868. };
  869. #endif
  870. #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
  871. static struct mtd_partition partition_info[] = {
  872. {
  873. .name = "bootloader(nand)",
  874. .offset = 0,
  875. .size = 0x80000,
  876. }, {
  877. .name = "linux kernel(nand)",
  878. .offset = MTDPART_OFS_APPEND,
  879. .size = 4 * 1024 * 1024,
  880. },
  881. {
  882. .name = "file system(nand)",
  883. .offset = MTDPART_OFS_APPEND,
  884. .size = MTDPART_SIZ_FULL,
  885. },
  886. };
  887. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  888. .data_width = NFC_NWIDTH_8,
  889. .partitions = partition_info,
  890. .nr_partitions = ARRAY_SIZE(partition_info),
  891. .rd_dly = 3,
  892. .wr_dly = 3,
  893. };
  894. static struct resource bf5xx_nand_resources[] = {
  895. {
  896. .start = 0xFFC03B00,
  897. .end = 0xFFC03B4F,
  898. .flags = IORESOURCE_MEM,
  899. },
  900. {
  901. .start = CH_NFC,
  902. .end = CH_NFC,
  903. .flags = IORESOURCE_IRQ,
  904. },
  905. };
  906. static struct platform_device bf5xx_nand_device = {
  907. .name = "bf5xx-nand",
  908. .id = 0,
  909. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  910. .resource = bf5xx_nand_resources,
  911. .dev = {
  912. .platform_data = &bf5xx_nand_platform,
  913. },
  914. };
  915. #endif
  916. #if IS_ENABLED(CONFIG_SDH_BFIN)
  917. static struct bfin_sd_host bfin_sdh_data = {
  918. .dma_chan = CH_SDH,
  919. .irq_int0 = IRQ_SDH_MASK0,
  920. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  921. };
  922. static struct platform_device bf54x_sdh_device = {
  923. .name = "bfin-sdh",
  924. .id = 0,
  925. .dev = {
  926. .platform_data = &bfin_sdh_data,
  927. },
  928. };
  929. #endif
  930. #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
  931. static struct mtd_partition ezkit_partitions[] = {
  932. {
  933. .name = "bootloader(nor)",
  934. .size = 0x80000,
  935. .offset = 0,
  936. }, {
  937. .name = "linux kernel(nor)",
  938. .size = 0x400000,
  939. .offset = MTDPART_OFS_APPEND,
  940. }, {
  941. .name = "file system(nor)",
  942. .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
  943. .offset = MTDPART_OFS_APPEND,
  944. }, {
  945. .name = "config(nor)",
  946. .size = 0x8000 * 3,
  947. .offset = MTDPART_OFS_APPEND,
  948. }, {
  949. .name = "u-boot env(nor)",
  950. .size = 0x8000,
  951. .offset = MTDPART_OFS_APPEND,
  952. }
  953. };
  954. static struct physmap_flash_data ezkit_flash_data = {
  955. .width = 2,
  956. .parts = ezkit_partitions,
  957. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  958. };
  959. static struct resource ezkit_flash_resource = {
  960. .start = 0x20000000,
  961. .end = 0x21ffffff,
  962. .flags = IORESOURCE_MEM,
  963. };
  964. static struct platform_device ezkit_flash_device = {
  965. .name = "physmap-flash",
  966. .id = 0,
  967. .dev = {
  968. .platform_data = &ezkit_flash_data,
  969. },
  970. .num_resources = 1,
  971. .resource = &ezkit_flash_resource,
  972. };
  973. #endif
  974. #if IS_ENABLED(CONFIG_MTD_M25P80)
  975. /* SPI flash chip (m25p16) */
  976. static struct mtd_partition bfin_spi_flash_partitions[] = {
  977. {
  978. .name = "bootloader(spi)",
  979. .size = 0x00080000,
  980. .offset = 0,
  981. .mask_flags = MTD_CAP_ROM
  982. }, {
  983. .name = "linux kernel(spi)",
  984. .size = MTDPART_SIZ_FULL,
  985. .offset = MTDPART_OFS_APPEND,
  986. }
  987. };
  988. static struct flash_platform_data bfin_spi_flash_data = {
  989. .name = "m25p80",
  990. .parts = bfin_spi_flash_partitions,
  991. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  992. .type = "m25p16",
  993. };
  994. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  995. .enable_dma = 0, /* use dma transfer with this chip*/
  996. };
  997. #endif
  998. #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
  999. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1000. .model = 7877,
  1001. .vref_delay_usecs = 50, /* internal, no capacitor */
  1002. .x_plate_ohms = 419,
  1003. .y_plate_ohms = 486,
  1004. .pressure_max = 1000,
  1005. .pressure_min = 0,
  1006. .stopacq_polarity = 1,
  1007. .first_conversion_delay = 3,
  1008. .acquisition_time = 1,
  1009. .averaging = 1,
  1010. .pen_down_acc_interval = 1,
  1011. };
  1012. #endif
  1013. #ifdef CONFIG_PINCTRL_ADI2
  1014. # define ADI_PINT_DEVNAME "adi-gpio-pint"
  1015. # define ADI_GPIO_DEVNAME "adi-gpio"
  1016. # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
  1017. static struct platform_device bfin_pinctrl_device = {
  1018. .name = ADI_PINCTRL_DEVNAME,
  1019. .id = 0,
  1020. };
  1021. static struct resource bfin_pint0_resources[] = {
  1022. {
  1023. .start = PINT0_MASK_SET,
  1024. .end = PINT0_LATCH + 3,
  1025. .flags = IORESOURCE_MEM,
  1026. },
  1027. {
  1028. .start = IRQ_PINT0,
  1029. .end = IRQ_PINT0,
  1030. .flags = IORESOURCE_IRQ,
  1031. },
  1032. };
  1033. static struct platform_device bfin_pint0_device = {
  1034. .name = ADI_PINT_DEVNAME,
  1035. .id = 0,
  1036. .num_resources = ARRAY_SIZE(bfin_pint0_resources),
  1037. .resource = bfin_pint0_resources,
  1038. };
  1039. static struct resource bfin_pint1_resources[] = {
  1040. {
  1041. .start = PINT1_MASK_SET,
  1042. .end = PINT1_LATCH + 3,
  1043. .flags = IORESOURCE_MEM,
  1044. },
  1045. {
  1046. .start = IRQ_PINT1,
  1047. .end = IRQ_PINT1,
  1048. .flags = IORESOURCE_IRQ,
  1049. },
  1050. };
  1051. static struct platform_device bfin_pint1_device = {
  1052. .name = ADI_PINT_DEVNAME,
  1053. .id = 1,
  1054. .num_resources = ARRAY_SIZE(bfin_pint1_resources),
  1055. .resource = bfin_pint1_resources,
  1056. };
  1057. static struct resource bfin_pint2_resources[] = {
  1058. {
  1059. .start = PINT2_MASK_SET,
  1060. .end = PINT2_LATCH + 3,
  1061. .flags = IORESOURCE_MEM,
  1062. },
  1063. {
  1064. .start = IRQ_PINT2,
  1065. .end = IRQ_PINT2,
  1066. .flags = IORESOURCE_IRQ,
  1067. },
  1068. };
  1069. static struct platform_device bfin_pint2_device = {
  1070. .name = ADI_PINT_DEVNAME,
  1071. .id = 2,
  1072. .num_resources = ARRAY_SIZE(bfin_pint2_resources),
  1073. .resource = bfin_pint2_resources,
  1074. };
  1075. static struct resource bfin_pint3_resources[] = {
  1076. {
  1077. .start = PINT3_MASK_SET,
  1078. .end = PINT3_LATCH + 3,
  1079. .flags = IORESOURCE_MEM,
  1080. },
  1081. {
  1082. .start = IRQ_PINT3,
  1083. .end = IRQ_PINT3,
  1084. .flags = IORESOURCE_IRQ,
  1085. },
  1086. };
  1087. static struct platform_device bfin_pint3_device = {
  1088. .name = ADI_PINT_DEVNAME,
  1089. .id = 3,
  1090. .num_resources = ARRAY_SIZE(bfin_pint3_resources),
  1091. .resource = bfin_pint3_resources,
  1092. };
  1093. static struct resource bfin_gpa_resources[] = {
  1094. {
  1095. .start = PORTA_FER,
  1096. .end = PORTA_MUX + 3,
  1097. .flags = IORESOURCE_MEM,
  1098. },
  1099. { /* optional */
  1100. .start = IRQ_PA0,
  1101. .end = IRQ_PA0,
  1102. .flags = IORESOURCE_IRQ,
  1103. },
  1104. };
  1105. static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
  1106. .port_gpio_base = GPIO_PA0, /* Optional */
  1107. .port_pin_base = GPIO_PA0,
  1108. .port_width = GPIO_BANKSIZE,
  1109. .pint_id = 0, /* PINT0 */
  1110. .pint_assign = true, /* PINT upper 16 bit */
  1111. .pint_map = 0, /* mapping mask in PINT */
  1112. };
  1113. static struct platform_device bfin_gpa_device = {
  1114. .name = ADI_GPIO_DEVNAME,
  1115. .id = 0,
  1116. .num_resources = ARRAY_SIZE(bfin_gpa_resources),
  1117. .resource = bfin_gpa_resources,
  1118. .dev = {
  1119. .platform_data = &bfin_gpa_pdata, /* Passed to driver */
  1120. },
  1121. };
  1122. static struct resource bfin_gpb_resources[] = {
  1123. {
  1124. .start = PORTB_FER,
  1125. .end = PORTB_MUX + 3,
  1126. .flags = IORESOURCE_MEM,
  1127. },
  1128. {
  1129. .start = IRQ_PB0,
  1130. .end = IRQ_PB0,
  1131. .flags = IORESOURCE_IRQ,
  1132. },
  1133. };
  1134. static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
  1135. .port_gpio_base = GPIO_PB0,
  1136. .port_pin_base = GPIO_PB0,
  1137. .port_width = 15,
  1138. .pint_id = 0,
  1139. .pint_assign = true,
  1140. .pint_map = 1,
  1141. };
  1142. static struct platform_device bfin_gpb_device = {
  1143. .name = ADI_GPIO_DEVNAME,
  1144. .id = 1,
  1145. .num_resources = ARRAY_SIZE(bfin_gpb_resources),
  1146. .resource = bfin_gpb_resources,
  1147. .dev = {
  1148. .platform_data = &bfin_gpb_pdata, /* Passed to driver */
  1149. },
  1150. };
  1151. static struct resource bfin_gpc_resources[] = {
  1152. {
  1153. .start = PORTC_FER,
  1154. .end = PORTC_MUX + 3,
  1155. .flags = IORESOURCE_MEM,
  1156. },
  1157. {
  1158. .start = IRQ_PC0,
  1159. .end = IRQ_PC0,
  1160. .flags = IORESOURCE_IRQ,
  1161. },
  1162. };
  1163. static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
  1164. .port_gpio_base = GPIO_PC0,
  1165. .port_pin_base = GPIO_PC0,
  1166. .port_width = 14,
  1167. .pint_id = 2,
  1168. .pint_assign = true,
  1169. .pint_map = 0,
  1170. };
  1171. static struct platform_device bfin_gpc_device = {
  1172. .name = ADI_GPIO_DEVNAME,
  1173. .id = 2,
  1174. .num_resources = ARRAY_SIZE(bfin_gpc_resources),
  1175. .resource = bfin_gpc_resources,
  1176. .dev = {
  1177. .platform_data = &bfin_gpc_pdata, /* Passed to driver */
  1178. },
  1179. };
  1180. static struct resource bfin_gpd_resources[] = {
  1181. {
  1182. .start = PORTD_FER,
  1183. .end = PORTD_MUX + 3,
  1184. .flags = IORESOURCE_MEM,
  1185. },
  1186. {
  1187. .start = IRQ_PD0,
  1188. .end = IRQ_PD0,
  1189. .flags = IORESOURCE_IRQ,
  1190. },
  1191. };
  1192. static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
  1193. .port_gpio_base = GPIO_PD0,
  1194. .port_pin_base = GPIO_PD0,
  1195. .port_width = GPIO_BANKSIZE,
  1196. .pint_id = 2,
  1197. .pint_assign = false,
  1198. .pint_map = 1,
  1199. };
  1200. static struct platform_device bfin_gpd_device = {
  1201. .name = ADI_GPIO_DEVNAME,
  1202. .id = 3,
  1203. .num_resources = ARRAY_SIZE(bfin_gpd_resources),
  1204. .resource = bfin_gpd_resources,
  1205. .dev = {
  1206. .platform_data = &bfin_gpd_pdata, /* Passed to driver */
  1207. },
  1208. };
  1209. static struct resource bfin_gpe_resources[] = {
  1210. {
  1211. .start = PORTE_FER,
  1212. .end = PORTE_MUX + 3,
  1213. .flags = IORESOURCE_MEM,
  1214. },
  1215. {
  1216. .start = IRQ_PE0,
  1217. .end = IRQ_PE0,
  1218. .flags = IORESOURCE_IRQ,
  1219. },
  1220. };
  1221. static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
  1222. .port_gpio_base = GPIO_PE0,
  1223. .port_pin_base = GPIO_PE0,
  1224. .port_width = GPIO_BANKSIZE,
  1225. .pint_id = 3,
  1226. .pint_assign = true,
  1227. .pint_map = 2,
  1228. };
  1229. static struct platform_device bfin_gpe_device = {
  1230. .name = ADI_GPIO_DEVNAME,
  1231. .id = 4,
  1232. .num_resources = ARRAY_SIZE(bfin_gpe_resources),
  1233. .resource = bfin_gpe_resources,
  1234. .dev = {
  1235. .platform_data = &bfin_gpe_pdata, /* Passed to driver */
  1236. },
  1237. };
  1238. static struct resource bfin_gpf_resources[] = {
  1239. {
  1240. .start = PORTF_FER,
  1241. .end = PORTF_MUX + 3,
  1242. .flags = IORESOURCE_MEM,
  1243. },
  1244. {
  1245. .start = IRQ_PF0,
  1246. .end = IRQ_PF0,
  1247. .flags = IORESOURCE_IRQ,
  1248. },
  1249. };
  1250. static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
  1251. .port_gpio_base = GPIO_PF0,
  1252. .port_pin_base = GPIO_PF0,
  1253. .port_width = GPIO_BANKSIZE,
  1254. .pint_id = 3,
  1255. .pint_assign = false,
  1256. .pint_map = 3,
  1257. };
  1258. static struct platform_device bfin_gpf_device = {
  1259. .name = ADI_GPIO_DEVNAME,
  1260. .id = 5,
  1261. .num_resources = ARRAY_SIZE(bfin_gpf_resources),
  1262. .resource = bfin_gpf_resources,
  1263. .dev = {
  1264. .platform_data = &bfin_gpf_pdata, /* Passed to driver */
  1265. },
  1266. };
  1267. static struct resource bfin_gpg_resources[] = {
  1268. {
  1269. .start = PORTG_FER,
  1270. .end = PORTG_MUX + 3,
  1271. .flags = IORESOURCE_MEM,
  1272. },
  1273. {
  1274. .start = IRQ_PG0,
  1275. .end = IRQ_PG0,
  1276. .flags = IORESOURCE_IRQ,
  1277. },
  1278. };
  1279. static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
  1280. .port_gpio_base = GPIO_PG0,
  1281. .port_pin_base = GPIO_PG0,
  1282. .port_width = GPIO_BANKSIZE,
  1283. .pint_id = -1,
  1284. };
  1285. static struct platform_device bfin_gpg_device = {
  1286. .name = ADI_GPIO_DEVNAME,
  1287. .id = 6,
  1288. .num_resources = ARRAY_SIZE(bfin_gpg_resources),
  1289. .resource = bfin_gpg_resources,
  1290. .dev = {
  1291. .platform_data = &bfin_gpg_pdata, /* Passed to driver */
  1292. },
  1293. };
  1294. static struct resource bfin_gph_resources[] = {
  1295. {
  1296. .start = PORTH_FER,
  1297. .end = PORTH_MUX + 3,
  1298. .flags = IORESOURCE_MEM,
  1299. },
  1300. {
  1301. .start = IRQ_PH0,
  1302. .end = IRQ_PH0,
  1303. .flags = IORESOURCE_IRQ,
  1304. },
  1305. };
  1306. static struct adi_pinctrl_gpio_platform_data bfin_gph_pdata = {
  1307. .port_gpio_base = GPIO_PH0,
  1308. .port_pin_base = GPIO_PH0,
  1309. .port_width = 14,
  1310. .pint_id = -1,
  1311. };
  1312. static struct platform_device bfin_gph_device = {
  1313. .name = ADI_GPIO_DEVNAME,
  1314. .id = 7,
  1315. .num_resources = ARRAY_SIZE(bfin_gph_resources),
  1316. .resource = bfin_gph_resources,
  1317. .dev = {
  1318. .platform_data = &bfin_gph_pdata, /* Passed to driver */
  1319. },
  1320. };
  1321. static struct resource bfin_gpi_resources[] = {
  1322. {
  1323. .start = PORTI_FER,
  1324. .end = PORTI_MUX + 3,
  1325. .flags = IORESOURCE_MEM,
  1326. },
  1327. {
  1328. .start = IRQ_PI0,
  1329. .end = IRQ_PI0,
  1330. .flags = IORESOURCE_IRQ,
  1331. },
  1332. };
  1333. static struct adi_pinctrl_gpio_platform_data bfin_gpi_pdata = {
  1334. .port_gpio_base = GPIO_PI0,
  1335. .port_pin_base = GPIO_PI0,
  1336. .port_width = GPIO_BANKSIZE,
  1337. .pint_id = -1,
  1338. };
  1339. static struct platform_device bfin_gpi_device = {
  1340. .name = ADI_GPIO_DEVNAME,
  1341. .id = 8,
  1342. .num_resources = ARRAY_SIZE(bfin_gpi_resources),
  1343. .resource = bfin_gpi_resources,
  1344. .dev = {
  1345. .platform_data = &bfin_gpi_pdata, /* Passed to driver */
  1346. },
  1347. };
  1348. static struct resource bfin_gpj_resources[] = {
  1349. {
  1350. .start = PORTJ_FER,
  1351. .end = PORTJ_MUX + 3,
  1352. .flags = IORESOURCE_MEM,
  1353. },
  1354. {
  1355. .start = IRQ_PJ0,
  1356. .end = IRQ_PJ0,
  1357. .flags = IORESOURCE_IRQ,
  1358. },
  1359. };
  1360. static struct adi_pinctrl_gpio_platform_data bfin_gpj_pdata = {
  1361. .port_gpio_base = GPIO_PJ0,
  1362. .port_pin_base = GPIO_PJ0,
  1363. .port_width = 14,
  1364. .pint_id = -1,
  1365. };
  1366. static struct platform_device bfin_gpj_device = {
  1367. .name = ADI_GPIO_DEVNAME,
  1368. .id = 9,
  1369. .num_resources = ARRAY_SIZE(bfin_gpj_resources),
  1370. .resource = bfin_gpj_resources,
  1371. .dev = {
  1372. .platform_data = &bfin_gpj_pdata, /* Passed to driver */
  1373. },
  1374. };
  1375. #endif
  1376. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1377. #if IS_ENABLED(CONFIG_MTD_M25P80)
  1378. {
  1379. /* the modalias must be the same as spi device driver name */
  1380. .modalias = "m25p80", /* Name of spi_driver for this device */
  1381. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1382. .bus_num = 0, /* Framework bus number */
  1383. .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1*/
  1384. .platform_data = &bfin_spi_flash_data,
  1385. .controller_data = &spi_flash_chip_info,
  1386. .mode = SPI_MODE_3,
  1387. },
  1388. #endif
  1389. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X)
  1390. {
  1391. .modalias = "ad183x",
  1392. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1393. .bus_num = 1,
  1394. .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
  1395. },
  1396. #endif
  1397. #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
  1398. {
  1399. .modalias = "ad7877",
  1400. .platform_data = &bfin_ad7877_ts_info,
  1401. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  1402. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1403. .bus_num = 0,
  1404. .chip_select = MAX_CTRL_CS + GPIO_PE5, /* SPI_SSEL2 */
  1405. },
  1406. #endif
  1407. #if IS_ENABLED(CONFIG_SPI_SPIDEV)
  1408. {
  1409. .modalias = "spidev",
  1410. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1411. .bus_num = 0,
  1412. .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1 */
  1413. },
  1414. #endif
  1415. #if IS_ENABLED(CONFIG_INPUT_ADXL34X_SPI)
  1416. {
  1417. .modalias = "adxl34x",
  1418. .platform_data = &adxl34x_info,
  1419. .irq = IRQ_PC5,
  1420. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1421. .bus_num = 1,
  1422. .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
  1423. .mode = SPI_MODE_3,
  1424. },
  1425. #endif
  1426. };
  1427. #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
  1428. /* SPI (0) */
  1429. static struct resource bfin_spi0_resource[] = {
  1430. [0] = {
  1431. .start = SPI0_REGBASE,
  1432. .end = SPI0_REGBASE + 0xFF,
  1433. .flags = IORESOURCE_MEM,
  1434. },
  1435. [1] = {
  1436. .start = CH_SPI0,
  1437. .end = CH_SPI0,
  1438. .flags = IORESOURCE_DMA,
  1439. },
  1440. [2] = {
  1441. .start = IRQ_SPI0,
  1442. .end = IRQ_SPI0,
  1443. .flags = IORESOURCE_IRQ,
  1444. }
  1445. };
  1446. /* SPI (1) */
  1447. static struct resource bfin_spi1_resource[] = {
  1448. [0] = {
  1449. .start = SPI1_REGBASE,
  1450. .end = SPI1_REGBASE + 0xFF,
  1451. .flags = IORESOURCE_MEM,
  1452. },
  1453. [1] = {
  1454. .start = CH_SPI1,
  1455. .end = CH_SPI1,
  1456. .flags = IORESOURCE_DMA,
  1457. },
  1458. [2] = {
  1459. .start = IRQ_SPI1,
  1460. .end = IRQ_SPI1,
  1461. .flags = IORESOURCE_IRQ,
  1462. }
  1463. };
  1464. /* SPI controller data */
  1465. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  1466. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1467. .enable_dma = 1, /* master has the ability to do dma transfer */
  1468. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1469. };
  1470. static struct platform_device bf54x_spi_master0 = {
  1471. .name = "bfin-spi",
  1472. .id = 0, /* Bus number */
  1473. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1474. .resource = bfin_spi0_resource,
  1475. .dev = {
  1476. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  1477. },
  1478. };
  1479. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  1480. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1481. .enable_dma = 1, /* master has the ability to do dma transfer */
  1482. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1483. };
  1484. static struct platform_device bf54x_spi_master1 = {
  1485. .name = "bfin-spi",
  1486. .id = 1, /* Bus number */
  1487. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1488. .resource = bfin_spi1_resource,
  1489. .dev = {
  1490. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  1491. },
  1492. };
  1493. #endif /* spi master and devices */
  1494. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
  1495. #include <linux/videodev2.h>
  1496. #include <media/blackfin/bfin_capture.h>
  1497. #include <media/blackfin/ppi.h>
  1498. static const unsigned short ppi_req[] = {
  1499. P_PPI1_D0, P_PPI1_D1, P_PPI1_D2, P_PPI1_D3,
  1500. P_PPI1_D4, P_PPI1_D5, P_PPI1_D6, P_PPI1_D7,
  1501. P_PPI1_CLK, P_PPI1_FS1, P_PPI1_FS2,
  1502. 0,
  1503. };
  1504. static const struct ppi_info ppi_info = {
  1505. .type = PPI_TYPE_EPPI,
  1506. .dma_ch = CH_EPPI1,
  1507. .irq_err = IRQ_EPPI1_ERROR,
  1508. .base = (void __iomem *)EPPI1_STATUS,
  1509. .pin_req = ppi_req,
  1510. };
  1511. #if IS_ENABLED(CONFIG_VIDEO_VS6624)
  1512. static struct v4l2_input vs6624_inputs[] = {
  1513. {
  1514. .index = 0,
  1515. .name = "Camera",
  1516. .type = V4L2_INPUT_TYPE_CAMERA,
  1517. .std = V4L2_STD_UNKNOWN,
  1518. },
  1519. };
  1520. static struct bcap_route vs6624_routes[] = {
  1521. {
  1522. .input = 0,
  1523. .output = 0,
  1524. },
  1525. };
  1526. static const unsigned vs6624_ce_pin = GPIO_PG6;
  1527. static struct bfin_capture_config bfin_capture_data = {
  1528. .card_name = "BF548",
  1529. .inputs = vs6624_inputs,
  1530. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  1531. .routes = vs6624_routes,
  1532. .i2c_adapter_id = 0,
  1533. .board_info = {
  1534. .type = "vs6624",
  1535. .addr = 0x10,
  1536. .platform_data = (void *)&vs6624_ce_pin,
  1537. },
  1538. .ppi_info = &ppi_info,
  1539. .ppi_control = (POLC | PACKEN | DLEN_8 | XFR_TYPE | 0x20),
  1540. .int_mask = 0xFFFFFFFF, /* disable error interrupt on eppi */
  1541. .blank_clocks = 8, /* 8 clocks as SAV and EAV */
  1542. };
  1543. #endif
  1544. static struct platform_device bfin_capture_device = {
  1545. .name = "bfin_capture",
  1546. .dev = {
  1547. .platform_data = &bfin_capture_data,
  1548. },
  1549. };
  1550. #endif
  1551. #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
  1552. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1553. static struct resource bfin_twi0_resource[] = {
  1554. [0] = {
  1555. .start = TWI0_REGBASE,
  1556. .end = TWI0_REGBASE + 0xFF,
  1557. .flags = IORESOURCE_MEM,
  1558. },
  1559. [1] = {
  1560. .start = IRQ_TWI0,
  1561. .end = IRQ_TWI0,
  1562. .flags = IORESOURCE_IRQ,
  1563. },
  1564. };
  1565. static struct platform_device i2c_bfin_twi0_device = {
  1566. .name = "i2c-bfin-twi",
  1567. .id = 0,
  1568. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1569. .resource = bfin_twi0_resource,
  1570. .dev = {
  1571. .platform_data = &bfin_twi0_pins,
  1572. },
  1573. };
  1574. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1575. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1576. static struct resource bfin_twi1_resource[] = {
  1577. [0] = {
  1578. .start = TWI1_REGBASE,
  1579. .end = TWI1_REGBASE + 0xFF,
  1580. .flags = IORESOURCE_MEM,
  1581. },
  1582. [1] = {
  1583. .start = IRQ_TWI1,
  1584. .end = IRQ_TWI1,
  1585. .flags = IORESOURCE_IRQ,
  1586. },
  1587. };
  1588. static struct platform_device i2c_bfin_twi1_device = {
  1589. .name = "i2c-bfin-twi",
  1590. .id = 1,
  1591. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1592. .resource = bfin_twi1_resource,
  1593. .dev = {
  1594. .platform_data = &bfin_twi1_pins,
  1595. },
  1596. };
  1597. #endif
  1598. #endif
  1599. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1600. #if IS_ENABLED(CONFIG_SND_SOC_SSM2602)
  1601. {
  1602. I2C_BOARD_INFO("ssm2602", 0x1b),
  1603. },
  1604. #endif
  1605. };
  1606. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1607. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1608. #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
  1609. {
  1610. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1611. },
  1612. #endif
  1613. #if IS_ENABLED(CONFIG_INPUT_PCF8574)
  1614. {
  1615. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1616. .irq = 212,
  1617. },
  1618. #endif
  1619. #if IS_ENABLED(CONFIG_INPUT_ADXL34X_I2C)
  1620. {
  1621. I2C_BOARD_INFO("adxl34x", 0x53),
  1622. .irq = IRQ_PC5,
  1623. .platform_data = (void *)&adxl34x_info,
  1624. },
  1625. #endif
  1626. #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
  1627. {
  1628. I2C_BOARD_INFO("ad5252", 0x2f),
  1629. },
  1630. #endif
  1631. };
  1632. #endif
  1633. #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
  1634. #include <linux/gpio_keys.h>
  1635. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1636. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  1637. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  1638. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  1639. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  1640. };
  1641. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1642. .buttons = bfin_gpio_keys_table,
  1643. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1644. };
  1645. static struct platform_device bfin_device_gpiokeys = {
  1646. .name = "gpio-keys",
  1647. .dev = {
  1648. .platform_data = &bfin_gpio_keys_data,
  1649. },
  1650. };
  1651. #endif
  1652. static const unsigned int cclk_vlev_datasheet[] =
  1653. {
  1654. /*
  1655. * Internal VLEV BF54XSBBC1533
  1656. ****temporarily using these values until data sheet is updated
  1657. */
  1658. VRPAIR(VLEV_085, 150000000),
  1659. VRPAIR(VLEV_090, 250000000),
  1660. VRPAIR(VLEV_110, 276000000),
  1661. VRPAIR(VLEV_115, 301000000),
  1662. VRPAIR(VLEV_120, 525000000),
  1663. VRPAIR(VLEV_125, 550000000),
  1664. VRPAIR(VLEV_130, 600000000),
  1665. };
  1666. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1667. .tuple_tab = cclk_vlev_datasheet,
  1668. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1669. .vr_settling_time = 25 /* us */,
  1670. };
  1671. static struct platform_device bfin_dpmc = {
  1672. .name = "bfin dpmc",
  1673. .dev = {
  1674. .platform_data = &bfin_dmpc_vreg_data,
  1675. },
  1676. };
  1677. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S) || \
  1678. IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1679. #define SPORT_REQ(x) \
  1680. [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
  1681. P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
  1682. static const u16 bfin_snd_pin[][7] = {
  1683. SPORT_REQ(0),
  1684. SPORT_REQ(1),
  1685. SPORT_REQ(2),
  1686. SPORT_REQ(3),
  1687. };
  1688. static struct bfin_snd_platform_data bfin_snd_data[] = {
  1689. {
  1690. .pin_req = &bfin_snd_pin[0][0],
  1691. },
  1692. {
  1693. .pin_req = &bfin_snd_pin[1][0],
  1694. },
  1695. {
  1696. .pin_req = &bfin_snd_pin[2][0],
  1697. },
  1698. {
  1699. .pin_req = &bfin_snd_pin[3][0],
  1700. },
  1701. };
  1702. #define BFIN_SND_RES(x) \
  1703. [x] = { \
  1704. { \
  1705. .start = SPORT##x##_TCR1, \
  1706. .end = SPORT##x##_TCR1, \
  1707. .flags = IORESOURCE_MEM \
  1708. }, \
  1709. { \
  1710. .start = CH_SPORT##x##_RX, \
  1711. .end = CH_SPORT##x##_RX, \
  1712. .flags = IORESOURCE_DMA, \
  1713. }, \
  1714. { \
  1715. .start = CH_SPORT##x##_TX, \
  1716. .end = CH_SPORT##x##_TX, \
  1717. .flags = IORESOURCE_DMA, \
  1718. }, \
  1719. { \
  1720. .start = IRQ_SPORT##x##_ERROR, \
  1721. .end = IRQ_SPORT##x##_ERROR, \
  1722. .flags = IORESOURCE_IRQ, \
  1723. } \
  1724. }
  1725. static struct resource bfin_snd_resources[][4] = {
  1726. BFIN_SND_RES(0),
  1727. BFIN_SND_RES(1),
  1728. BFIN_SND_RES(2),
  1729. BFIN_SND_RES(3),
  1730. };
  1731. #endif
  1732. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1733. static struct platform_device bfin_i2s_pcm = {
  1734. .name = "bfin-i2s-pcm-audio",
  1735. .id = -1,
  1736. };
  1737. #endif
  1738. #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1739. static struct platform_device bfin_ac97_pcm = {
  1740. .name = "bfin-ac97-pcm-audio",
  1741. .id = -1,
  1742. };
  1743. #endif
  1744. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD73311)
  1745. static struct platform_device bfin_ad73311_codec_device = {
  1746. .name = "ad73311",
  1747. .id = -1,
  1748. };
  1749. #endif
  1750. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1980)
  1751. static struct platform_device bfin_ad1980_codec_device = {
  1752. .name = "ad1980",
  1753. .id = -1,
  1754. };
  1755. #endif
  1756. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_I2S)
  1757. static struct platform_device bfin_i2s = {
  1758. .name = "bfin-i2s",
  1759. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1760. .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
  1761. .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
  1762. .dev = {
  1763. .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
  1764. },
  1765. };
  1766. #endif
  1767. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AC97)
  1768. static struct platform_device bfin_ac97 = {
  1769. .name = "bfin-ac97",
  1770. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1771. .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
  1772. .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
  1773. .dev = {
  1774. .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
  1775. },
  1776. };
  1777. #endif
  1778. static struct platform_device *ezkit_devices[] __initdata = {
  1779. &bfin_dpmc,
  1780. #if defined(CONFIG_PINCTRL_ADI2)
  1781. &bfin_pinctrl_device,
  1782. &bfin_pint0_device,
  1783. &bfin_pint1_device,
  1784. &bfin_pint2_device,
  1785. &bfin_pint3_device,
  1786. &bfin_gpa_device,
  1787. &bfin_gpb_device,
  1788. &bfin_gpc_device,
  1789. &bfin_gpd_device,
  1790. &bfin_gpe_device,
  1791. &bfin_gpf_device,
  1792. &bfin_gpg_device,
  1793. &bfin_gph_device,
  1794. &bfin_gpi_device,
  1795. &bfin_gpj_device,
  1796. #endif
  1797. #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
  1798. &rtc_device,
  1799. #endif
  1800. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  1801. #ifdef CONFIG_SERIAL_BFIN_UART0
  1802. &bfin_uart0_device,
  1803. #endif
  1804. #ifdef CONFIG_SERIAL_BFIN_UART1
  1805. &bfin_uart1_device,
  1806. #endif
  1807. #ifdef CONFIG_SERIAL_BFIN_UART2
  1808. &bfin_uart2_device,
  1809. #endif
  1810. #ifdef CONFIG_SERIAL_BFIN_UART3
  1811. &bfin_uart3_device,
  1812. #endif
  1813. #endif
  1814. #if IS_ENABLED(CONFIG_BFIN_SIR)
  1815. #ifdef CONFIG_BFIN_SIR0
  1816. &bfin_sir0_device,
  1817. #endif
  1818. #ifdef CONFIG_BFIN_SIR1
  1819. &bfin_sir1_device,
  1820. #endif
  1821. #ifdef CONFIG_BFIN_SIR2
  1822. &bfin_sir2_device,
  1823. #endif
  1824. #ifdef CONFIG_BFIN_SIR3
  1825. &bfin_sir3_device,
  1826. #endif
  1827. #endif
  1828. #if IS_ENABLED(CONFIG_FB_BF54X_LQ043)
  1829. &bf54x_lq043_device,
  1830. #endif
  1831. #if IS_ENABLED(CONFIG_SMSC911X)
  1832. &smsc911x_device,
  1833. #endif
  1834. #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
  1835. &musb_device,
  1836. #endif
  1837. #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
  1838. &bfin_isp1760_device,
  1839. #endif
  1840. #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
  1841. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1842. &bfin_sport0_uart_device,
  1843. #endif
  1844. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1845. &bfin_sport1_uart_device,
  1846. #endif
  1847. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1848. &bfin_sport2_uart_device,
  1849. #endif
  1850. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1851. &bfin_sport3_uart_device,
  1852. #endif
  1853. #endif
  1854. #if IS_ENABLED(CONFIG_CAN_BFIN)
  1855. &bfin_can0_device,
  1856. &bfin_can1_device,
  1857. #endif
  1858. #if IS_ENABLED(CONFIG_PATA_BF54X)
  1859. &bfin_atapi_device,
  1860. #endif
  1861. #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
  1862. &bf5xx_nand_device,
  1863. #endif
  1864. #if IS_ENABLED(CONFIG_SDH_BFIN)
  1865. &bf54x_sdh_device,
  1866. #endif
  1867. #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
  1868. &bf54x_spi_master0,
  1869. &bf54x_spi_master1,
  1870. #endif
  1871. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
  1872. &bfin_capture_device,
  1873. #endif
  1874. #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
  1875. &bf54x_kpad_device,
  1876. #endif
  1877. #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
  1878. &bfin_rotary_device,
  1879. #endif
  1880. #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
  1881. &i2c_bfin_twi0_device,
  1882. #if !defined(CONFIG_BF542)
  1883. &i2c_bfin_twi1_device,
  1884. #endif
  1885. #endif
  1886. #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
  1887. &bfin_device_gpiokeys,
  1888. #endif
  1889. #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
  1890. &ezkit_flash_device,
  1891. #endif
  1892. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1893. &bfin_i2s_pcm,
  1894. #endif
  1895. #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1896. &bfin_ac97_pcm,
  1897. #endif
  1898. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1980)
  1899. &bfin_ad1980_codec_device,
  1900. #endif
  1901. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1902. &bfin_i2s,
  1903. #endif
  1904. #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1905. &bfin_ac97,
  1906. #endif
  1907. };
  1908. /* Pin control settings */
  1909. static struct pinctrl_map __initdata bfin_pinmux_map[] = {
  1910. /* per-device maps */
  1911. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
  1912. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
  1913. #ifdef CONFIG_BFIN_UART1_CTSRTS
  1914. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1_ctsrts"),
  1915. #endif
  1916. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.2", "pinctrl-adi2.0", NULL, "uart2"),
  1917. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3"),
  1918. #ifdef CONFIG_BFIN_UART3_CTSRTS
  1919. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3_ctsrts"),
  1920. #endif
  1921. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
  1922. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
  1923. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.2", "pinctrl-adi2.0", NULL, "uart2"),
  1924. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.3", "pinctrl-adi2.0", NULL, "uart3"),
  1925. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
  1926. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.0", "pinctrl-adi2.0", NULL, "spi0"),
  1927. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.1", "pinctrl-adi2.0", NULL, "spi1"),
  1928. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
  1929. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1930. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
  1931. #endif
  1932. PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
  1933. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
  1934. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.1", "pinctrl-adi2.0", NULL, "can1"),
  1935. PIN_MAP_MUX_GROUP_DEFAULT("bf54x-lq043", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"),
  1936. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
  1937. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
  1938. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.0", "pinctrl-adi2.0", NULL, "sport0"),
  1939. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
  1940. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
  1941. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.1", "pinctrl-adi2.0", NULL, "sport1"),
  1942. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
  1943. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
  1944. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.2", "pinctrl-adi2.0", NULL, "sport2"),
  1945. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.3", "pinctrl-adi2.0", NULL, "sport3"),
  1946. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.3", "pinctrl-adi2.0", NULL, "sport3"),
  1947. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.3", "pinctrl-adi2.0", NULL, "sport3"),
  1948. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.0", "pinctrl-adi2.0", NULL, "sport0"),
  1949. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.1", "pinctrl-adi2.0", NULL, "sport1"),
  1950. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.2", "pinctrl-adi2.0", NULL, "sport2"),
  1951. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.3", "pinctrl-adi2.0", NULL, "sport3"),
  1952. PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi"),
  1953. #ifdef CONFIG_BF548_ATAPI_ALTERNATIVE_PORT
  1954. PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi_alter"),
  1955. #endif
  1956. PIN_MAP_MUX_GROUP_DEFAULT("bf5xx-nand.0", "pinctrl-adi2.0", NULL, "nfc0"),
  1957. PIN_MAP_MUX_GROUP_DEFAULT("bf54x-keys", "pinctrl-adi2.0", "keys_4x4grp", "keys"),
  1958. PIN_MAP_MUX_GROUP("bf54x-keys", "4bit", "pinctrl-adi2.0", "keys_4x4grp", "keys"),
  1959. PIN_MAP_MUX_GROUP("bf54x-keys", "8bit", "pinctrl-adi2.0", "keys_8x8grp", "keys"),
  1960. };
  1961. static int __init ezkit_init(void)
  1962. {
  1963. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1964. /* Initialize pinmuxing */
  1965. pinctrl_register_mappings(bfin_pinmux_map,
  1966. ARRAY_SIZE(bfin_pinmux_map));
  1967. i2c_register_board_info(0, bfin_i2c_board_info0,
  1968. ARRAY_SIZE(bfin_i2c_board_info0));
  1969. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1970. i2c_register_board_info(1, bfin_i2c_board_info1,
  1971. ARRAY_SIZE(bfin_i2c_board_info1));
  1972. #endif
  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. #ifdef CONFIG_SERIAL_BFIN_UART2
  1987. &bfin_uart2_device,
  1988. #endif
  1989. #ifdef CONFIG_SERIAL_BFIN_UART3
  1990. &bfin_uart3_device,
  1991. #endif
  1992. #endif
  1993. };
  1994. void __init native_machine_early_platform_add_devices(void)
  1995. {
  1996. printk(KERN_INFO "register early platform devices\n");
  1997. early_platform_add_devices(ezkit_early_devices,
  1998. ARRAY_SIZE(ezkit_early_devices));
  1999. }