ezkit.c 51 KB

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