ezkit.c 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645
  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 <asm/bfin6xx_spi.h>
  20. #include <asm/dma.h>
  21. #include <asm/gpio.h>
  22. #include <asm/nand.h>
  23. #include <asm/dpmc.h>
  24. #include <asm/portmux.h>
  25. #include <asm/bfin_sdh.h>
  26. #include <linux/input.h>
  27. #include <linux/spi/ad7877.h>
  28. /*
  29. * Name the Board for the /proc/cpuinfo
  30. */
  31. const char bfin_board_name[] = "ADI BF609-EZKIT";
  32. /*
  33. * Driver needs to know address, irq and flag pin.
  34. */
  35. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  36. #include <linux/usb/isp1760.h>
  37. static struct resource bfin_isp1760_resources[] = {
  38. [0] = {
  39. .start = 0x2C0C0000,
  40. .end = 0x2C0C0000 + 0xfffff,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .start = IRQ_PG7,
  45. .end = IRQ_PG7,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. static struct isp1760_platform_data isp1760_priv = {
  50. .is_isp1761 = 0,
  51. .bus_width_16 = 1,
  52. .port1_otg = 0,
  53. .analog_oc = 0,
  54. .dack_polarity_high = 0,
  55. .dreq_polarity_high = 0,
  56. };
  57. static struct platform_device bfin_isp1760_device = {
  58. .name = "isp1760",
  59. .id = 0,
  60. .dev = {
  61. .platform_data = &isp1760_priv,
  62. },
  63. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  64. .resource = bfin_isp1760_resources,
  65. };
  66. #endif
  67. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  68. #include <asm/bfin_rotary.h>
  69. static struct bfin_rotary_platform_data bfin_rotary_data = {
  70. /*.rotary_up_key = KEY_UP,*/
  71. /*.rotary_down_key = KEY_DOWN,*/
  72. .rotary_rel_code = REL_WHEEL,
  73. .rotary_button_key = KEY_ENTER,
  74. .debounce = 10, /* 0..17 */
  75. .mode = ROT_QUAD_ENC | ROT_DEBE,
  76. };
  77. static struct resource bfin_rotary_resources[] = {
  78. {
  79. .start = IRQ_CNT,
  80. .end = IRQ_CNT,
  81. .flags = IORESOURCE_IRQ,
  82. },
  83. };
  84. static struct platform_device bfin_rotary_device = {
  85. .name = "bfin-rotary",
  86. .id = -1,
  87. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  88. .resource = bfin_rotary_resources,
  89. .dev = {
  90. .platform_data = &bfin_rotary_data,
  91. },
  92. };
  93. #endif
  94. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  95. #include <linux/stmmac.h>
  96. static unsigned short pins[] = P_RMII0;
  97. static struct stmmac_mdio_bus_data phy_private_data = {
  98. .bus_id = 0,
  99. .phy_mask = 1,
  100. };
  101. static struct plat_stmmacenet_data eth_private_data = {
  102. .bus_id = 0,
  103. .enh_desc = 1,
  104. .phy_addr = 1,
  105. .mdio_bus_data = &phy_private_data,
  106. };
  107. static struct platform_device bfin_eth_device = {
  108. .name = "stmmaceth",
  109. .id = 0,
  110. .num_resources = 2,
  111. .resource = (struct resource[]) {
  112. {
  113. .start = EMAC0_MACCFG,
  114. .end = EMAC0_MACCFG + 0x1274,
  115. .flags = IORESOURCE_MEM,
  116. },
  117. {
  118. .name = "macirq",
  119. .start = IRQ_EMAC0_STAT,
  120. .end = IRQ_EMAC0_STAT,
  121. .flags = IORESOURCE_IRQ,
  122. },
  123. },
  124. .dev = {
  125. .power.can_wakeup = 1,
  126. .platform_data = &eth_private_data,
  127. }
  128. };
  129. #endif
  130. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  131. #include <linux/input/adxl34x.h>
  132. static const struct adxl34x_platform_data adxl34x_info = {
  133. .x_axis_offset = 0,
  134. .y_axis_offset = 0,
  135. .z_axis_offset = 0,
  136. .tap_threshold = 0x31,
  137. .tap_duration = 0x10,
  138. .tap_latency = 0x60,
  139. .tap_window = 0xF0,
  140. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  141. .act_axis_control = 0xFF,
  142. .activity_threshold = 5,
  143. .inactivity_threshold = 3,
  144. .inactivity_time = 4,
  145. .free_fall_threshold = 0x7,
  146. .free_fall_time = 0x20,
  147. .data_rate = 0x8,
  148. .data_range = ADXL_FULL_RES,
  149. .ev_type = EV_ABS,
  150. .ev_code_x = ABS_X, /* EV_REL */
  151. .ev_code_y = ABS_Y, /* EV_REL */
  152. .ev_code_z = ABS_Z, /* EV_REL */
  153. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  154. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  155. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  156. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  157. .fifo_mode = ADXL_FIFO_STREAM,
  158. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  159. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  160. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  161. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  162. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  163. };
  164. #endif
  165. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  166. static struct platform_device rtc_device = {
  167. .name = "rtc-bfin",
  168. .id = -1,
  169. };
  170. #endif
  171. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  172. #ifdef CONFIG_SERIAL_BFIN_UART0
  173. static struct resource bfin_uart0_resources[] = {
  174. {
  175. .start = UART0_REVID,
  176. .end = UART0_RXDIV+4,
  177. .flags = IORESOURCE_MEM,
  178. },
  179. {
  180. .start = IRQ_UART0_TX,
  181. .end = IRQ_UART0_TX,
  182. .flags = IORESOURCE_IRQ,
  183. },
  184. {
  185. .start = IRQ_UART0_RX,
  186. .end = IRQ_UART0_RX,
  187. .flags = IORESOURCE_IRQ,
  188. },
  189. {
  190. .start = IRQ_UART0_STAT,
  191. .end = IRQ_UART0_STAT,
  192. .flags = IORESOURCE_IRQ,
  193. },
  194. {
  195. .start = CH_UART0_TX,
  196. .end = CH_UART0_TX,
  197. .flags = IORESOURCE_DMA,
  198. },
  199. {
  200. .start = CH_UART0_RX,
  201. .end = CH_UART0_RX,
  202. .flags = IORESOURCE_DMA,
  203. },
  204. #ifdef CONFIG_BFIN_UART0_CTSRTS
  205. { /* CTS pin -- 0 means not supported */
  206. .start = GPIO_PD10,
  207. .end = GPIO_PD10,
  208. .flags = IORESOURCE_IO,
  209. },
  210. { /* RTS pin -- 0 means not supported */
  211. .start = GPIO_PD9,
  212. .end = GPIO_PD9,
  213. .flags = IORESOURCE_IO,
  214. },
  215. #endif
  216. };
  217. static unsigned short bfin_uart0_peripherals[] = {
  218. P_UART0_TX, P_UART0_RX,
  219. #ifdef CONFIG_BFIN_UART0_CTSRTS
  220. P_UART0_RTS, P_UART0_CTS,
  221. #endif
  222. 0
  223. };
  224. static struct platform_device bfin_uart0_device = {
  225. .name = "bfin-uart",
  226. .id = 0,
  227. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  228. .resource = bfin_uart0_resources,
  229. .dev = {
  230. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  231. },
  232. };
  233. #endif
  234. #ifdef CONFIG_SERIAL_BFIN_UART1
  235. static struct resource bfin_uart1_resources[] = {
  236. {
  237. .start = UART1_REVID,
  238. .end = UART1_RXDIV+4,
  239. .flags = IORESOURCE_MEM,
  240. },
  241. {
  242. .start = IRQ_UART1_TX,
  243. .end = IRQ_UART1_TX,
  244. .flags = IORESOURCE_IRQ,
  245. },
  246. {
  247. .start = IRQ_UART1_RX,
  248. .end = IRQ_UART1_RX,
  249. .flags = IORESOURCE_IRQ,
  250. },
  251. {
  252. .start = IRQ_UART1_STAT,
  253. .end = IRQ_UART1_STAT,
  254. .flags = IORESOURCE_IRQ,
  255. },
  256. {
  257. .start = CH_UART1_TX,
  258. .end = CH_UART1_TX,
  259. .flags = IORESOURCE_DMA,
  260. },
  261. {
  262. .start = CH_UART1_RX,
  263. .end = CH_UART1_RX,
  264. .flags = IORESOURCE_DMA,
  265. },
  266. #ifdef CONFIG_BFIN_UART1_CTSRTS
  267. { /* CTS pin -- 0 means not supported */
  268. .start = GPIO_PG13,
  269. .end = GPIO_PG13,
  270. .flags = IORESOURCE_IO,
  271. },
  272. { /* RTS pin -- 0 means not supported */
  273. .start = GPIO_PG10,
  274. .end = GPIO_PG10,
  275. .flags = IORESOURCE_IO,
  276. },
  277. #endif
  278. };
  279. static unsigned short bfin_uart1_peripherals[] = {
  280. P_UART1_TX, P_UART1_RX,
  281. #ifdef CONFIG_BFIN_UART1_CTSRTS
  282. P_UART1_RTS, P_UART1_CTS,
  283. #endif
  284. 0
  285. };
  286. static struct platform_device bfin_uart1_device = {
  287. .name = "bfin-uart",
  288. .id = 1,
  289. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  290. .resource = bfin_uart1_resources,
  291. .dev = {
  292. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  293. },
  294. };
  295. #endif
  296. #endif
  297. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  298. #ifdef CONFIG_BFIN_SIR0
  299. static struct resource bfin_sir0_resources[] = {
  300. {
  301. .start = 0xFFC00400,
  302. .end = 0xFFC004FF,
  303. .flags = IORESOURCE_MEM,
  304. },
  305. {
  306. .start = IRQ_UART0_TX,
  307. .end = IRQ_UART0_TX+1,
  308. .flags = IORESOURCE_IRQ,
  309. },
  310. {
  311. .start = CH_UART0_TX,
  312. .end = CH_UART0_TX+1,
  313. .flags = IORESOURCE_DMA,
  314. },
  315. };
  316. static struct platform_device bfin_sir0_device = {
  317. .name = "bfin_sir",
  318. .id = 0,
  319. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  320. .resource = bfin_sir0_resources,
  321. };
  322. #endif
  323. #ifdef CONFIG_BFIN_SIR1
  324. static struct resource bfin_sir1_resources[] = {
  325. {
  326. .start = 0xFFC02000,
  327. .end = 0xFFC020FF,
  328. .flags = IORESOURCE_MEM,
  329. },
  330. {
  331. .start = IRQ_UART1_TX,
  332. .end = IRQ_UART1_TX+1,
  333. .flags = IORESOURCE_IRQ,
  334. },
  335. {
  336. .start = CH_UART1_TX,
  337. .end = CH_UART1_TX+1,
  338. .flags = IORESOURCE_DMA,
  339. },
  340. };
  341. static struct platform_device bfin_sir1_device = {
  342. .name = "bfin_sir",
  343. .id = 1,
  344. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  345. .resource = bfin_sir1_resources,
  346. };
  347. #endif
  348. #endif
  349. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  350. static struct resource musb_resources[] = {
  351. [0] = {
  352. .start = 0xFFCC1000,
  353. .end = 0xFFCC1398,
  354. .flags = IORESOURCE_MEM,
  355. },
  356. [1] = { /* general IRQ */
  357. .start = IRQ_USB_STAT,
  358. .end = IRQ_USB_STAT,
  359. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  360. .name = "mc"
  361. },
  362. [2] = { /* DMA IRQ */
  363. .start = IRQ_USB_DMA,
  364. .end = IRQ_USB_DMA,
  365. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  366. .name = "dma"
  367. },
  368. };
  369. static struct musb_hdrc_config musb_config = {
  370. .multipoint = 1,
  371. .dyn_fifo = 0,
  372. .dma = 1,
  373. .num_eps = 16,
  374. .dma_channels = 8,
  375. .clkin = 48, /* musb CLKIN in MHZ */
  376. };
  377. static struct musb_hdrc_platform_data musb_plat = {
  378. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  379. .mode = MUSB_OTG,
  380. #elif defined(CONFIG_USB_MUSB_HDRC)
  381. .mode = MUSB_HOST,
  382. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  383. .mode = MUSB_PERIPHERAL,
  384. #endif
  385. .config = &musb_config,
  386. };
  387. static u64 musb_dmamask = ~(u32)0;
  388. static struct platform_device musb_device = {
  389. .name = "musb-blackfin",
  390. .id = 0,
  391. .dev = {
  392. .dma_mask = &musb_dmamask,
  393. .coherent_dma_mask = 0xffffffff,
  394. .platform_data = &musb_plat,
  395. },
  396. .num_resources = ARRAY_SIZE(musb_resources),
  397. .resource = musb_resources,
  398. };
  399. #endif
  400. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  401. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  402. static struct resource bfin_sport0_uart_resources[] = {
  403. {
  404. .start = SPORT0_TCR1,
  405. .end = SPORT0_MRCS3+4,
  406. .flags = IORESOURCE_MEM,
  407. },
  408. {
  409. .start = IRQ_SPORT0_RX,
  410. .end = IRQ_SPORT0_RX+1,
  411. .flags = IORESOURCE_IRQ,
  412. },
  413. {
  414. .start = IRQ_SPORT0_ERROR,
  415. .end = IRQ_SPORT0_ERROR,
  416. .flags = IORESOURCE_IRQ,
  417. },
  418. };
  419. static unsigned short bfin_sport0_peripherals[] = {
  420. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  421. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  422. };
  423. static struct platform_device bfin_sport0_uart_device = {
  424. .name = "bfin-sport-uart",
  425. .id = 0,
  426. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  427. .resource = bfin_sport0_uart_resources,
  428. .dev = {
  429. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  430. },
  431. };
  432. #endif
  433. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  434. static struct resource bfin_sport1_uart_resources[] = {
  435. {
  436. .start = SPORT1_TCR1,
  437. .end = SPORT1_MRCS3+4,
  438. .flags = IORESOURCE_MEM,
  439. },
  440. {
  441. .start = IRQ_SPORT1_RX,
  442. .end = IRQ_SPORT1_RX+1,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. {
  446. .start = IRQ_SPORT1_ERROR,
  447. .end = IRQ_SPORT1_ERROR,
  448. .flags = IORESOURCE_IRQ,
  449. },
  450. };
  451. static unsigned short bfin_sport1_peripherals[] = {
  452. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  453. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  454. };
  455. static struct platform_device bfin_sport1_uart_device = {
  456. .name = "bfin-sport-uart",
  457. .id = 1,
  458. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  459. .resource = bfin_sport1_uart_resources,
  460. .dev = {
  461. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  462. },
  463. };
  464. #endif
  465. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  466. static struct resource bfin_sport2_uart_resources[] = {
  467. {
  468. .start = SPORT2_TCR1,
  469. .end = SPORT2_MRCS3+4,
  470. .flags = IORESOURCE_MEM,
  471. },
  472. {
  473. .start = IRQ_SPORT2_RX,
  474. .end = IRQ_SPORT2_RX+1,
  475. .flags = IORESOURCE_IRQ,
  476. },
  477. {
  478. .start = IRQ_SPORT2_ERROR,
  479. .end = IRQ_SPORT2_ERROR,
  480. .flags = IORESOURCE_IRQ,
  481. },
  482. };
  483. static unsigned short bfin_sport2_peripherals[] = {
  484. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  485. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  486. };
  487. static struct platform_device bfin_sport2_uart_device = {
  488. .name = "bfin-sport-uart",
  489. .id = 2,
  490. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  491. .resource = bfin_sport2_uart_resources,
  492. .dev = {
  493. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  494. },
  495. };
  496. #endif
  497. #endif
  498. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  499. static unsigned short bfin_can0_peripherals[] = {
  500. P_CAN0_RX, P_CAN0_TX, 0
  501. };
  502. static struct resource bfin_can0_resources[] = {
  503. {
  504. .start = 0xFFC00A00,
  505. .end = 0xFFC00FFF,
  506. .flags = IORESOURCE_MEM,
  507. },
  508. {
  509. .start = IRQ_CAN0_RX,
  510. .end = IRQ_CAN0_RX,
  511. .flags = IORESOURCE_IRQ,
  512. },
  513. {
  514. .start = IRQ_CAN0_TX,
  515. .end = IRQ_CAN0_TX,
  516. .flags = IORESOURCE_IRQ,
  517. },
  518. {
  519. .start = IRQ_CAN0_STAT,
  520. .end = IRQ_CAN0_STAT,
  521. .flags = IORESOURCE_IRQ,
  522. },
  523. };
  524. static struct platform_device bfin_can0_device = {
  525. .name = "bfin_can",
  526. .id = 0,
  527. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  528. .resource = bfin_can0_resources,
  529. .dev = {
  530. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  531. },
  532. };
  533. #endif
  534. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  535. static struct mtd_partition partition_info[] = {
  536. {
  537. .name = "bootloader(nand)",
  538. .offset = 0,
  539. .size = 0x80000,
  540. }, {
  541. .name = "linux kernel(nand)",
  542. .offset = MTDPART_OFS_APPEND,
  543. .size = 4 * 1024 * 1024,
  544. },
  545. {
  546. .name = "file system(nand)",
  547. .offset = MTDPART_OFS_APPEND,
  548. .size = MTDPART_SIZ_FULL,
  549. },
  550. };
  551. static struct bf5xx_nand_platform bfin_nand_platform = {
  552. .data_width = NFC_NWIDTH_8,
  553. .partitions = partition_info,
  554. .nr_partitions = ARRAY_SIZE(partition_info),
  555. .rd_dly = 3,
  556. .wr_dly = 3,
  557. };
  558. static struct resource bfin_nand_resources[] = {
  559. {
  560. .start = 0xFFC03B00,
  561. .end = 0xFFC03B4F,
  562. .flags = IORESOURCE_MEM,
  563. },
  564. {
  565. .start = CH_NFC,
  566. .end = CH_NFC,
  567. .flags = IORESOURCE_IRQ,
  568. },
  569. };
  570. static struct platform_device bfin_nand_device = {
  571. .name = "bfin-nand",
  572. .id = 0,
  573. .num_resources = ARRAY_SIZE(bfin_nand_resources),
  574. .resource = bfin_nand_resources,
  575. .dev = {
  576. .platform_data = &bfin_nand_platform,
  577. },
  578. };
  579. #endif
  580. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  581. static struct bfin_sd_host bfin_sdh_data = {
  582. .dma_chan = CH_RSI,
  583. .irq_int0 = IRQ_RSI_INT0,
  584. .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
  585. };
  586. static struct platform_device bfin_sdh_device = {
  587. .name = "bfin-sdh",
  588. .id = 0,
  589. .dev = {
  590. .platform_data = &bfin_sdh_data,
  591. },
  592. };
  593. #endif
  594. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  595. static struct mtd_partition ezkit_partitions[] = {
  596. {
  597. .name = "bootloader(nor)",
  598. .size = 0x80000,
  599. .offset = 0,
  600. }, {
  601. .name = "linux kernel(nor)",
  602. .size = 0x400000,
  603. .offset = MTDPART_OFS_APPEND,
  604. }, {
  605. .name = "file system(nor)",
  606. .size = 0x1000000 - 0x80000 - 0x400000,
  607. .offset = MTDPART_OFS_APPEND,
  608. },
  609. };
  610. int bf609_nor_flash_init(struct platform_device *dev)
  611. {
  612. #define CONFIG_SMC_GCTL_VAL 0x00000010
  613. const unsigned short pins[] = {
  614. P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
  615. P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
  616. P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
  617. };
  618. peripheral_request_list(pins, "smc0");
  619. bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
  620. bfin_write32(SMC_B0CTL, 0x01002011);
  621. bfin_write32(SMC_B0TIM, 0x08170977);
  622. bfin_write32(SMC_B0ETIM, 0x00092231);
  623. return 0;
  624. }
  625. void bf609_nor_flash_exit(struct platform_device *dev)
  626. {
  627. const unsigned short pins[] = {
  628. P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
  629. P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
  630. P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
  631. };
  632. peripheral_free_list(pins);
  633. bfin_write32(SMC_GCTL, 0);
  634. }
  635. static struct physmap_flash_data ezkit_flash_data = {
  636. .width = 2,
  637. .parts = ezkit_partitions,
  638. .init = bf609_nor_flash_init,
  639. .exit = bf609_nor_flash_exit,
  640. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  641. #ifdef CONFIG_ROMKERNEL
  642. .probe_type = "map_rom",
  643. #endif
  644. };
  645. static struct resource ezkit_flash_resource = {
  646. .start = 0xb0000000,
  647. .end = 0xb0ffffff,
  648. .flags = IORESOURCE_MEM,
  649. };
  650. static struct platform_device ezkit_flash_device = {
  651. .name = "physmap-flash",
  652. .id = 0,
  653. .dev = {
  654. .platform_data = &ezkit_flash_data,
  655. },
  656. .num_resources = 1,
  657. .resource = &ezkit_flash_resource,
  658. };
  659. #endif
  660. #if defined(CONFIG_MTD_M25P80) \
  661. || defined(CONFIG_MTD_M25P80_MODULE)
  662. /* SPI flash chip (w25q32) */
  663. static struct mtd_partition bfin_spi_flash_partitions[] = {
  664. {
  665. .name = "bootloader(spi)",
  666. .size = 0x00080000,
  667. .offset = 0,
  668. .mask_flags = MTD_CAP_ROM
  669. }, {
  670. .name = "linux kernel(spi)",
  671. .size = 0x00180000,
  672. .offset = MTDPART_OFS_APPEND,
  673. }, {
  674. .name = "file system(spi)",
  675. .size = MTDPART_SIZ_FULL,
  676. .offset = MTDPART_OFS_APPEND,
  677. }
  678. };
  679. static struct flash_platform_data bfin_spi_flash_data = {
  680. .name = "m25p80",
  681. .parts = bfin_spi_flash_partitions,
  682. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  683. .type = "w25q32",
  684. };
  685. static struct bfin6xx_spi_chip spi_flash_chip_info = {
  686. .enable_dma = true, /* use dma transfer with this chip*/
  687. };
  688. #endif
  689. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  690. static struct bfin6xx_spi_chip spidev_chip_info = {
  691. .enable_dma = true,
  692. };
  693. #endif
  694. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  695. static struct platform_device bfin_i2s_pcm = {
  696. .name = "bfin-i2s-pcm-audio",
  697. .id = -1,
  698. };
  699. #endif
  700. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  701. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  702. #include <asm/bfin_sport3.h>
  703. static struct resource bfin_snd_resources[] = {
  704. {
  705. .start = SPORT0_CTL_A,
  706. .end = SPORT0_CTL_A,
  707. .flags = IORESOURCE_MEM,
  708. },
  709. {
  710. .start = SPORT0_CTL_B,
  711. .end = SPORT0_CTL_B,
  712. .flags = IORESOURCE_MEM,
  713. },
  714. {
  715. .start = CH_SPORT0_TX,
  716. .end = CH_SPORT0_TX,
  717. .flags = IORESOURCE_DMA,
  718. },
  719. {
  720. .start = CH_SPORT0_RX,
  721. .end = CH_SPORT0_RX,
  722. .flags = IORESOURCE_DMA,
  723. },
  724. {
  725. .start = IRQ_SPORT0_TX_STAT,
  726. .end = IRQ_SPORT0_TX_STAT,
  727. .flags = IORESOURCE_IRQ,
  728. },
  729. {
  730. .start = IRQ_SPORT0_RX_STAT,
  731. .end = IRQ_SPORT0_RX_STAT,
  732. .flags = IORESOURCE_IRQ,
  733. },
  734. };
  735. static const unsigned short bfin_snd_pin[] = {
  736. P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
  737. P_SPORT0_BFS, P_SPORT0_BD0, 0,
  738. };
  739. static struct bfin_snd_platform_data bfin_snd_data = {
  740. .pin_req = bfin_snd_pin,
  741. };
  742. static struct platform_device bfin_i2s = {
  743. .name = "bfin-i2s",
  744. .num_resources = ARRAY_SIZE(bfin_snd_resources),
  745. .resource = bfin_snd_resources,
  746. .dev = {
  747. .platform_data = &bfin_snd_data,
  748. },
  749. };
  750. #endif
  751. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
  752. || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  753. static const char * const ad1836_link[] = {
  754. "bfin-tdm.0",
  755. "spi0.76",
  756. };
  757. static struct platform_device bfin_ad1836_machine = {
  758. .name = "bfin-snd-ad1836",
  759. .id = -1,
  760. .dev = {
  761. .platform_data = (void *)ad1836_link,
  762. },
  763. };
  764. #endif
  765. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  766. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  767. static struct platform_device adau1761_device = {
  768. .name = "bfin-eval-adau1x61",
  769. };
  770. #endif
  771. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  772. #include <sound/adau17x1.h>
  773. static struct adau1761_platform_data adau1761_info = {
  774. .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
  775. .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
  776. };
  777. #endif
  778. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  779. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  780. #include <linux/videodev2.h>
  781. #include <media/blackfin/bfin_capture.h>
  782. #include <media/blackfin/ppi.h>
  783. static const unsigned short ppi_req[] = {
  784. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  785. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  786. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  787. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  788. #if !defined(CONFIG_VIDEO_VS6624) && !defined(CONFIG_VIDEO_VS6624_MODULE)
  789. P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
  790. P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
  791. #endif
  792. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  793. 0,
  794. };
  795. static const struct ppi_info ppi_info = {
  796. .type = PPI_TYPE_EPPI3,
  797. .dma_ch = CH_EPPI0_CH0,
  798. .irq_err = IRQ_EPPI0_STAT,
  799. .base = (void __iomem *)EPPI0_STAT,
  800. .pin_req = ppi_req,
  801. };
  802. #if defined(CONFIG_VIDEO_VS6624) \
  803. || defined(CONFIG_VIDEO_VS6624_MODULE)
  804. static struct v4l2_input vs6624_inputs[] = {
  805. {
  806. .index = 0,
  807. .name = "Camera",
  808. .type = V4L2_INPUT_TYPE_CAMERA,
  809. .std = V4L2_STD_UNKNOWN,
  810. },
  811. };
  812. static struct bcap_route vs6624_routes[] = {
  813. {
  814. .input = 0,
  815. .output = 0,
  816. },
  817. };
  818. static const unsigned vs6624_ce_pin = GPIO_PE4;
  819. static struct bfin_capture_config bfin_capture_data = {
  820. .card_name = "BF609",
  821. .inputs = vs6624_inputs,
  822. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  823. .routes = vs6624_routes,
  824. .i2c_adapter_id = 0,
  825. .board_info = {
  826. .type = "vs6624",
  827. .addr = 0x10,
  828. .platform_data = (void *)&vs6624_ce_pin,
  829. },
  830. .ppi_info = &ppi_info,
  831. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
  832. | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  833. .blank_pixels = 4,
  834. };
  835. #endif
  836. #if defined(CONFIG_VIDEO_ADV7842) \
  837. || defined(CONFIG_VIDEO_ADV7842_MODULE)
  838. #include <media/adv7842.h>
  839. static struct v4l2_input adv7842_inputs[] = {
  840. {
  841. .index = 0,
  842. .name = "Composite",
  843. .type = V4L2_INPUT_TYPE_CAMERA,
  844. .std = V4L2_STD_ALL,
  845. .capabilities = V4L2_IN_CAP_STD,
  846. },
  847. {
  848. .index = 1,
  849. .name = "S-Video",
  850. .type = V4L2_INPUT_TYPE_CAMERA,
  851. .std = V4L2_STD_ALL,
  852. .capabilities = V4L2_IN_CAP_STD,
  853. },
  854. {
  855. .index = 2,
  856. .name = "Component",
  857. .type = V4L2_INPUT_TYPE_CAMERA,
  858. .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
  859. },
  860. {
  861. .index = 3,
  862. .name = "VGA",
  863. .type = V4L2_INPUT_TYPE_CAMERA,
  864. .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
  865. },
  866. {
  867. .index = 4,
  868. .name = "HDMI",
  869. .type = V4L2_INPUT_TYPE_CAMERA,
  870. .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS,
  871. },
  872. };
  873. static struct bcap_route adv7842_routes[] = {
  874. {
  875. .input = 3,
  876. .output = 0,
  877. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  878. | EPPI_CTL_ACTIVE656),
  879. },
  880. {
  881. .input = 4,
  882. .output = 0,
  883. },
  884. {
  885. .input = 2,
  886. .output = 0,
  887. },
  888. {
  889. .input = 1,
  890. .output = 0,
  891. },
  892. {
  893. .input = 0,
  894. .output = 1,
  895. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  896. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC2
  897. | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  898. },
  899. };
  900. static struct adv7842_output_format adv7842_opf[] = {
  901. {
  902. .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
  903. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
  904. .op_656_range = 1,
  905. .blank_data = 1,
  906. .insert_av_codes = 1,
  907. },
  908. {
  909. .op_ch_sel = ADV7842_OP_CH_SEL_RGB,
  910. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_16,
  911. .op_656_range = 1,
  912. .blank_data = 1,
  913. },
  914. };
  915. static struct adv7842_platform_data adv7842_data = {
  916. .opf = adv7842_opf,
  917. .num_opf = ARRAY_SIZE(adv7842_opf),
  918. .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
  919. .prim_mode = ADV7842_PRIM_MODE_SDP,
  920. .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
  921. .inp_color_space = ADV7842_INP_COLOR_SPACE_AUTO,
  922. .i2c_sdp_io = 0x40,
  923. .i2c_sdp = 0x41,
  924. .i2c_cp = 0x42,
  925. .i2c_vdp = 0x43,
  926. .i2c_afe = 0x44,
  927. .i2c_hdmi = 0x45,
  928. .i2c_repeater = 0x46,
  929. .i2c_edid = 0x47,
  930. .i2c_infoframe = 0x48,
  931. .i2c_cec = 0x49,
  932. .i2c_avlink = 0x4a,
  933. .i2c_ex = 0x26,
  934. };
  935. static struct bfin_capture_config bfin_capture_data = {
  936. .card_name = "BF609",
  937. .inputs = adv7842_inputs,
  938. .num_inputs = ARRAY_SIZE(adv7842_inputs),
  939. .routes = adv7842_routes,
  940. .i2c_adapter_id = 0,
  941. .board_info = {
  942. .type = "adv7842",
  943. .addr = 0x20,
  944. .platform_data = (void *)&adv7842_data,
  945. },
  946. .ppi_info = &ppi_info,
  947. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  948. | EPPI_CTL_ACTIVE656),
  949. };
  950. #endif
  951. static struct platform_device bfin_capture_device = {
  952. .name = "bfin_capture",
  953. .dev = {
  954. .platform_data = &bfin_capture_data,
  955. },
  956. };
  957. #endif
  958. #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
  959. || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
  960. #include <linux/videodev2.h>
  961. #include <media/blackfin/bfin_display.h>
  962. #include <media/blackfin/ppi.h>
  963. static const unsigned short ppi_req_disp[] = {
  964. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  965. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  966. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  967. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  968. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  969. 0,
  970. };
  971. static const struct ppi_info ppi_info = {
  972. .type = PPI_TYPE_EPPI3,
  973. .dma_ch = CH_EPPI0_CH0,
  974. .irq_err = IRQ_EPPI0_STAT,
  975. .base = (void __iomem *)EPPI0_STAT,
  976. .pin_req = ppi_req_disp,
  977. };
  978. #if defined(CONFIG_VIDEO_ADV7511) \
  979. || defined(CONFIG_VIDEO_ADV7511_MODULE)
  980. #include <media/adv7511.h>
  981. static struct v4l2_output adv7511_outputs[] = {
  982. {
  983. .index = 0,
  984. .name = "HDMI",
  985. .type = V4L2_INPUT_TYPE_CAMERA,
  986. .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS,
  987. },
  988. };
  989. static struct disp_route adv7511_routes[] = {
  990. {
  991. .output = 0,
  992. },
  993. };
  994. static struct adv7511_platform_data adv7511_data = {
  995. .edid_addr = 0x7e,
  996. .i2c_ex = 0x25,
  997. };
  998. static struct bfin_display_config bfin_display_data = {
  999. .card_name = "BF609",
  1000. .outputs = adv7511_outputs,
  1001. .num_outputs = ARRAY_SIZE(adv7511_outputs),
  1002. .routes = adv7511_routes,
  1003. .i2c_adapter_id = 0,
  1004. .board_info = {
  1005. .type = "adv7511",
  1006. .addr = 0x39,
  1007. .platform_data = (void *)&adv7511_data,
  1008. },
  1009. .ppi_info = &ppi_info,
  1010. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  1011. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC3
  1012. | EPPI_CTL_IFSGEN | EPPI_CTL_SYNC2
  1013. | EPPI_CTL_NON656 | EPPI_CTL_DIR),
  1014. };
  1015. #endif
  1016. static struct platform_device bfin_display_device = {
  1017. .name = "bfin_display",
  1018. .dev = {
  1019. .platform_data = &bfin_display_data,
  1020. },
  1021. };
  1022. #endif
  1023. #if defined(CONFIG_BFIN_CRC)
  1024. #define BFIN_CRC_NAME "bfin-crc"
  1025. static struct resource bfin_crc0_resources[] = {
  1026. {
  1027. .start = REG_CRC0_CTL,
  1028. .end = REG_CRC0_REVID+4,
  1029. .flags = IORESOURCE_MEM,
  1030. },
  1031. {
  1032. .start = IRQ_CRC0_DCNTEXP,
  1033. .end = IRQ_CRC0_DCNTEXP,
  1034. .flags = IORESOURCE_IRQ,
  1035. },
  1036. {
  1037. .start = CH_MEM_STREAM0_SRC_CRC0,
  1038. .end = CH_MEM_STREAM0_SRC_CRC0,
  1039. .flags = IORESOURCE_DMA,
  1040. },
  1041. {
  1042. .start = CH_MEM_STREAM0_DEST_CRC0,
  1043. .end = CH_MEM_STREAM0_DEST_CRC0,
  1044. .flags = IORESOURCE_DMA,
  1045. },
  1046. };
  1047. static struct platform_device bfin_crc0_device = {
  1048. .name = BFIN_CRC_NAME,
  1049. .id = 0,
  1050. .num_resources = ARRAY_SIZE(bfin_crc0_resources),
  1051. .resource = bfin_crc0_resources,
  1052. };
  1053. static struct resource bfin_crc1_resources[] = {
  1054. {
  1055. .start = REG_CRC1_CTL,
  1056. .end = REG_CRC1_REVID+4,
  1057. .flags = IORESOURCE_MEM,
  1058. },
  1059. {
  1060. .start = IRQ_CRC1_DCNTEXP,
  1061. .end = IRQ_CRC1_DCNTEXP,
  1062. .flags = IORESOURCE_IRQ,
  1063. },
  1064. {
  1065. .start = CH_MEM_STREAM1_SRC_CRC1,
  1066. .end = CH_MEM_STREAM1_SRC_CRC1,
  1067. .flags = IORESOURCE_DMA,
  1068. },
  1069. {
  1070. .start = CH_MEM_STREAM1_DEST_CRC1,
  1071. .end = CH_MEM_STREAM1_DEST_CRC1,
  1072. .flags = IORESOURCE_DMA,
  1073. },
  1074. };
  1075. static struct platform_device bfin_crc1_device = {
  1076. .name = BFIN_CRC_NAME,
  1077. .id = 1,
  1078. .num_resources = ARRAY_SIZE(bfin_crc1_resources),
  1079. .resource = bfin_crc1_resources,
  1080. };
  1081. #endif
  1082. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1083. #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
  1084. #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
  1085. static struct resource bfin_crypto_crc_resources[] = {
  1086. {
  1087. .start = REG_CRC0_CTL,
  1088. .end = REG_CRC0_REVID+4,
  1089. .flags = IORESOURCE_MEM,
  1090. },
  1091. {
  1092. .start = IRQ_CRC0_DCNTEXP,
  1093. .end = IRQ_CRC0_DCNTEXP,
  1094. .flags = IORESOURCE_IRQ,
  1095. },
  1096. {
  1097. .start = CH_MEM_STREAM0_SRC_CRC0,
  1098. .end = CH_MEM_STREAM0_SRC_CRC0,
  1099. .flags = IORESOURCE_DMA,
  1100. },
  1101. };
  1102. static struct platform_device bfin_crypto_crc_device = {
  1103. .name = BFIN_CRYPTO_CRC_NAME,
  1104. .id = 0,
  1105. .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
  1106. .resource = bfin_crypto_crc_resources,
  1107. .dev = {
  1108. .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
  1109. },
  1110. };
  1111. #endif
  1112. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1113. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1114. .model = 7877,
  1115. .vref_delay_usecs = 50, /* internal, no capacitor */
  1116. .x_plate_ohms = 419,
  1117. .y_plate_ohms = 486,
  1118. .pressure_max = 1000,
  1119. .pressure_min = 0,
  1120. .stopacq_polarity = 1,
  1121. .first_conversion_delay = 3,
  1122. .acquisition_time = 1,
  1123. .averaging = 1,
  1124. .pen_down_acc_interval = 1,
  1125. };
  1126. #endif
  1127. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1128. #include <linux/input.h>
  1129. #include <linux/gpio_keys.h>
  1130. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1131. {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
  1132. {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
  1133. };
  1134. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1135. .buttons = bfin_gpio_keys_table,
  1136. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1137. };
  1138. static struct platform_device bfin_device_gpiokeys = {
  1139. .name = "gpio-keys",
  1140. .dev = {
  1141. .platform_data = &bfin_gpio_keys_data,
  1142. },
  1143. };
  1144. #endif
  1145. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1146. #if defined(CONFIG_MTD_M25P80) \
  1147. || defined(CONFIG_MTD_M25P80_MODULE)
  1148. {
  1149. /* the modalias must be the same as spi device driver name */
  1150. .modalias = "m25p80", /* Name of spi_driver for this device */
  1151. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1152. .bus_num = 0, /* Framework bus number */
  1153. .chip_select = 1, /* SPI_SSEL1*/
  1154. .platform_data = &bfin_spi_flash_data,
  1155. .controller_data = &spi_flash_chip_info,
  1156. .mode = SPI_MODE_3,
  1157. },
  1158. #endif
  1159. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1160. {
  1161. .modalias = "ad7877",
  1162. .platform_data = &bfin_ad7877_ts_info,
  1163. .irq = IRQ_PD9,
  1164. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1165. .bus_num = 0,
  1166. .chip_select = 4,
  1167. },
  1168. #endif
  1169. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  1170. {
  1171. .modalias = "spidev",
  1172. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1173. .bus_num = 0,
  1174. .chip_select = 1,
  1175. .controller_data = &spidev_chip_info,
  1176. },
  1177. #endif
  1178. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  1179. {
  1180. .modalias = "adxl34x",
  1181. .platform_data = &adxl34x_info,
  1182. .irq = IRQ_PC5,
  1183. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1184. .bus_num = 1,
  1185. .chip_select = 2,
  1186. .mode = SPI_MODE_3,
  1187. },
  1188. #endif
  1189. };
  1190. #if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
  1191. /* SPI (0) */
  1192. static struct resource bfin_spi0_resource[] = {
  1193. {
  1194. .start = SPI0_REGBASE,
  1195. .end = SPI0_REGBASE + 0xFF,
  1196. .flags = IORESOURCE_MEM,
  1197. },
  1198. {
  1199. .start = CH_SPI0_TX,
  1200. .end = CH_SPI0_TX,
  1201. .flags = IORESOURCE_DMA,
  1202. },
  1203. {
  1204. .start = CH_SPI0_RX,
  1205. .end = CH_SPI0_RX,
  1206. .flags = IORESOURCE_DMA,
  1207. },
  1208. };
  1209. /* SPI (1) */
  1210. static struct resource bfin_spi1_resource[] = {
  1211. {
  1212. .start = SPI1_REGBASE,
  1213. .end = SPI1_REGBASE + 0xFF,
  1214. .flags = IORESOURCE_MEM,
  1215. },
  1216. {
  1217. .start = CH_SPI1_TX,
  1218. .end = CH_SPI1_TX,
  1219. .flags = IORESOURCE_DMA,
  1220. },
  1221. {
  1222. .start = CH_SPI1_RX,
  1223. .end = CH_SPI1_RX,
  1224. .flags = IORESOURCE_DMA,
  1225. },
  1226. };
  1227. /* SPI controller data */
  1228. static struct bfin6xx_spi_master bf60x_spi_master_info0 = {
  1229. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1230. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1231. };
  1232. static struct platform_device bf60x_spi_master0 = {
  1233. .name = "bfin-spi",
  1234. .id = 0, /* Bus number */
  1235. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1236. .resource = bfin_spi0_resource,
  1237. .dev = {
  1238. .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
  1239. },
  1240. };
  1241. static struct bfin6xx_spi_master bf60x_spi_master_info1 = {
  1242. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1243. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1244. };
  1245. static struct platform_device bf60x_spi_master1 = {
  1246. .name = "bfin-spi",
  1247. .id = 1, /* Bus number */
  1248. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1249. .resource = bfin_spi1_resource,
  1250. .dev = {
  1251. .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
  1252. },
  1253. };
  1254. #endif /* spi master and devices */
  1255. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1256. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1257. static struct resource bfin_twi0_resource[] = {
  1258. [0] = {
  1259. .start = TWI0_CLKDIV,
  1260. .end = TWI0_CLKDIV + 0xFF,
  1261. .flags = IORESOURCE_MEM,
  1262. },
  1263. [1] = {
  1264. .start = IRQ_TWI0,
  1265. .end = IRQ_TWI0,
  1266. .flags = IORESOURCE_IRQ,
  1267. },
  1268. };
  1269. static struct platform_device i2c_bfin_twi0_device = {
  1270. .name = "i2c-bfin-twi",
  1271. .id = 0,
  1272. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1273. .resource = bfin_twi0_resource,
  1274. .dev = {
  1275. .platform_data = &bfin_twi0_pins,
  1276. },
  1277. };
  1278. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1279. static struct resource bfin_twi1_resource[] = {
  1280. [0] = {
  1281. .start = TWI1_CLKDIV,
  1282. .end = TWI1_CLKDIV + 0xFF,
  1283. .flags = IORESOURCE_MEM,
  1284. },
  1285. [1] = {
  1286. .start = IRQ_TWI1,
  1287. .end = IRQ_TWI1,
  1288. .flags = IORESOURCE_IRQ,
  1289. },
  1290. };
  1291. static struct platform_device i2c_bfin_twi1_device = {
  1292. .name = "i2c-bfin-twi",
  1293. .id = 1,
  1294. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1295. .resource = bfin_twi1_resource,
  1296. .dev = {
  1297. .platform_data = &bfin_twi1_pins,
  1298. },
  1299. };
  1300. #endif
  1301. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1302. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1303. {
  1304. I2C_BOARD_INFO("adxl34x", 0x53),
  1305. .irq = IRQ_PC5,
  1306. .platform_data = (void *)&adxl34x_info,
  1307. },
  1308. #endif
  1309. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  1310. {
  1311. I2C_BOARD_INFO("adau1761", 0x38),
  1312. .platform_data = (void *)&adau1761_info
  1313. },
  1314. #endif
  1315. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  1316. {
  1317. I2C_BOARD_INFO("ssm2602", 0x1b),
  1318. },
  1319. #endif
  1320. };
  1321. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1322. };
  1323. static const unsigned int cclk_vlev_datasheet[] =
  1324. {
  1325. /*
  1326. * Internal VLEV BF54XSBBC1533
  1327. ****temporarily using these values until data sheet is updated
  1328. */
  1329. VRPAIR(VLEV_085, 150000000),
  1330. VRPAIR(VLEV_090, 250000000),
  1331. VRPAIR(VLEV_110, 276000000),
  1332. VRPAIR(VLEV_115, 301000000),
  1333. VRPAIR(VLEV_120, 525000000),
  1334. VRPAIR(VLEV_125, 550000000),
  1335. VRPAIR(VLEV_130, 600000000),
  1336. };
  1337. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1338. .tuple_tab = cclk_vlev_datasheet,
  1339. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1340. .vr_settling_time = 25 /* us */,
  1341. };
  1342. static struct platform_device bfin_dpmc = {
  1343. .name = "bfin dpmc",
  1344. .dev = {
  1345. .platform_data = &bfin_dmpc_vreg_data,
  1346. },
  1347. };
  1348. static struct platform_device *ezkit_devices[] __initdata = {
  1349. &bfin_dpmc,
  1350. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1351. &rtc_device,
  1352. #endif
  1353. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1354. #ifdef CONFIG_SERIAL_BFIN_UART0
  1355. &bfin_uart0_device,
  1356. #endif
  1357. #ifdef CONFIG_SERIAL_BFIN_UART1
  1358. &bfin_uart1_device,
  1359. #endif
  1360. #endif
  1361. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1362. #ifdef CONFIG_BFIN_SIR0
  1363. &bfin_sir0_device,
  1364. #endif
  1365. #ifdef CONFIG_BFIN_SIR1
  1366. &bfin_sir1_device,
  1367. #endif
  1368. #endif
  1369. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1370. &bfin_eth_device,
  1371. #endif
  1372. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1373. &musb_device,
  1374. #endif
  1375. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1376. &bfin_isp1760_device,
  1377. #endif
  1378. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1379. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1380. &bfin_sport0_uart_device,
  1381. #endif
  1382. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1383. &bfin_sport1_uart_device,
  1384. #endif
  1385. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1386. &bfin_sport2_uart_device,
  1387. #endif
  1388. #endif
  1389. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1390. &bfin_can0_device,
  1391. #endif
  1392. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1393. &bfin_nand_device,
  1394. #endif
  1395. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1396. &bfin_sdh_device,
  1397. #endif
  1398. #if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
  1399. &bf60x_spi_master0,
  1400. &bf60x_spi_master1,
  1401. #endif
  1402. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1403. &bfin_rotary_device,
  1404. #endif
  1405. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1406. &i2c_bfin_twi0_device,
  1407. #if !defined(CONFIG_BF542)
  1408. &i2c_bfin_twi1_device,
  1409. #endif
  1410. #endif
  1411. #if defined(CONFIG_BFIN_CRC)
  1412. &bfin_crc0_device,
  1413. &bfin_crc1_device,
  1414. #endif
  1415. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1416. &bfin_crypto_crc_device,
  1417. #endif
  1418. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1419. &bfin_device_gpiokeys,
  1420. #endif
  1421. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1422. &ezkit_flash_device,
  1423. #endif
  1424. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1425. &bfin_i2s_pcm,
  1426. #endif
  1427. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  1428. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  1429. &bfin_i2s,
  1430. #endif
  1431. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \
  1432. defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  1433. &bfin_ad1836_machine,
  1434. #endif
  1435. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  1436. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  1437. &adau1761_device,
  1438. #endif
  1439. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  1440. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  1441. &bfin_capture_device,
  1442. #endif
  1443. #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
  1444. || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
  1445. &bfin_display_device,
  1446. #endif
  1447. };
  1448. static int __init ezkit_init(void)
  1449. {
  1450. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1451. i2c_register_board_info(0, bfin_i2c_board_info0,
  1452. ARRAY_SIZE(bfin_i2c_board_info0));
  1453. i2c_register_board_info(1, bfin_i2c_board_info1,
  1454. ARRAY_SIZE(bfin_i2c_board_info1));
  1455. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1456. if (!peripheral_request_list(pins, "emac0"))
  1457. printk(KERN_ERR "%s(): request emac pins failed\n", __func__);
  1458. #endif
  1459. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1460. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1461. return 0;
  1462. }
  1463. arch_initcall(ezkit_init);
  1464. static struct platform_device *ezkit_early_devices[] __initdata = {
  1465. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1466. #ifdef CONFIG_SERIAL_BFIN_UART0
  1467. &bfin_uart0_device,
  1468. #endif
  1469. #ifdef CONFIG_SERIAL_BFIN_UART1
  1470. &bfin_uart1_device,
  1471. #endif
  1472. #endif
  1473. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1474. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1475. &bfin_sport0_uart_device,
  1476. #endif
  1477. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1478. &bfin_sport1_uart_device,
  1479. #endif
  1480. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1481. &bfin_sport2_uart_device,
  1482. #endif
  1483. #endif
  1484. };
  1485. void __init native_machine_early_platform_add_devices(void)
  1486. {
  1487. printk(KERN_INFO "register early platform devices\n");
  1488. early_platform_add_devices(ezkit_early_devices,
  1489. ARRAY_SIZE(ezkit_early_devices));
  1490. }