ezkit.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  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/bfin5xx_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 <mach/bf54x_keys.h>
  27. #include <linux/input.h>
  28. #include <linux/spi/ad7877.h>
  29. /*
  30. * Name the Board for the /proc/cpuinfo
  31. */
  32. const char bfin_board_name[] = "ADI BF548-EZKIT";
  33. /*
  34. * Driver needs to know address, irq and flag pin.
  35. */
  36. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  37. #include <linux/usb/isp1760.h>
  38. static struct resource bfin_isp1760_resources[] = {
  39. [0] = {
  40. .start = 0x2C0C0000,
  41. .end = 0x2C0C0000 + 0xfffff,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. [1] = {
  45. .start = IRQ_PG7,
  46. .end = IRQ_PG7,
  47. .flags = IORESOURCE_IRQ,
  48. },
  49. };
  50. static struct isp1760_platform_data isp1760_priv = {
  51. .is_isp1761 = 0,
  52. .bus_width_16 = 1,
  53. .port1_otg = 0,
  54. .analog_oc = 0,
  55. .dack_polarity_high = 0,
  56. .dreq_polarity_high = 0,
  57. };
  58. static struct platform_device bfin_isp1760_device = {
  59. .name = "isp1760",
  60. .id = 0,
  61. .dev = {
  62. .platform_data = &isp1760_priv,
  63. },
  64. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  65. .resource = bfin_isp1760_resources,
  66. };
  67. #endif
  68. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  69. #include <mach/bf54x-lq043.h>
  70. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  71. .width = 95,
  72. .height = 54,
  73. .xres = {480, 480, 480},
  74. .yres = {272, 272, 272},
  75. .bpp = {24, 24, 24},
  76. .disp = GPIO_PE3,
  77. };
  78. static struct resource bf54x_lq043_resources[] = {
  79. {
  80. .start = IRQ_EPPI0_ERR,
  81. .end = IRQ_EPPI0_ERR,
  82. .flags = IORESOURCE_IRQ,
  83. },
  84. };
  85. static struct platform_device bf54x_lq043_device = {
  86. .name = "bf54x-lq043",
  87. .id = -1,
  88. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  89. .resource = bf54x_lq043_resources,
  90. .dev = {
  91. .platform_data = &bf54x_lq043_data,
  92. },
  93. };
  94. #endif
  95. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  96. static const unsigned int bf548_keymap[] = {
  97. KEYVAL(0, 0, KEY_ENTER),
  98. KEYVAL(0, 1, KEY_HELP),
  99. KEYVAL(0, 2, KEY_0),
  100. KEYVAL(0, 3, KEY_BACKSPACE),
  101. KEYVAL(1, 0, KEY_TAB),
  102. KEYVAL(1, 1, KEY_9),
  103. KEYVAL(1, 2, KEY_8),
  104. KEYVAL(1, 3, KEY_7),
  105. KEYVAL(2, 0, KEY_DOWN),
  106. KEYVAL(2, 1, KEY_6),
  107. KEYVAL(2, 2, KEY_5),
  108. KEYVAL(2, 3, KEY_4),
  109. KEYVAL(3, 0, KEY_UP),
  110. KEYVAL(3, 1, KEY_3),
  111. KEYVAL(3, 2, KEY_2),
  112. KEYVAL(3, 3, KEY_1),
  113. };
  114. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  115. .rows = 4,
  116. .cols = 4,
  117. .keymap = bf548_keymap,
  118. .keymapsize = ARRAY_SIZE(bf548_keymap),
  119. .repeat = 0,
  120. .debounce_time = 5000, /* ns (5ms) */
  121. .coldrive_time = 1000, /* ns (1ms) */
  122. .keyup_test_interval = 50, /* ms (50ms) */
  123. };
  124. static struct resource bf54x_kpad_resources[] = {
  125. {
  126. .start = IRQ_KEY,
  127. .end = IRQ_KEY,
  128. .flags = IORESOURCE_IRQ,
  129. },
  130. };
  131. static struct platform_device bf54x_kpad_device = {
  132. .name = "bf54x-keys",
  133. .id = -1,
  134. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  135. .resource = bf54x_kpad_resources,
  136. .dev = {
  137. .platform_data = &bf54x_kpad_data,
  138. },
  139. };
  140. #endif
  141. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  142. #include <asm/bfin_rotary.h>
  143. static struct bfin_rotary_platform_data bfin_rotary_data = {
  144. /*.rotary_up_key = KEY_UP,*/
  145. /*.rotary_down_key = KEY_DOWN,*/
  146. .rotary_rel_code = REL_WHEEL,
  147. .rotary_button_key = KEY_ENTER,
  148. .debounce = 10, /* 0..17 */
  149. .mode = ROT_QUAD_ENC | ROT_DEBE,
  150. };
  151. static struct resource bfin_rotary_resources[] = {
  152. {
  153. .start = IRQ_CNT,
  154. .end = IRQ_CNT,
  155. .flags = IORESOURCE_IRQ,
  156. },
  157. };
  158. static struct platform_device bfin_rotary_device = {
  159. .name = "bfin-rotary",
  160. .id = -1,
  161. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  162. .resource = bfin_rotary_resources,
  163. .dev = {
  164. .platform_data = &bfin_rotary_data,
  165. },
  166. };
  167. #endif
  168. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  169. #include <linux/input/adxl34x.h>
  170. static const struct adxl34x_platform_data adxl34x_info = {
  171. .x_axis_offset = 0,
  172. .y_axis_offset = 0,
  173. .z_axis_offset = 0,
  174. .tap_threshold = 0x31,
  175. .tap_duration = 0x10,
  176. .tap_latency = 0x60,
  177. .tap_window = 0xF0,
  178. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  179. .act_axis_control = 0xFF,
  180. .activity_threshold = 5,
  181. .inactivity_threshold = 3,
  182. .inactivity_time = 4,
  183. .free_fall_threshold = 0x7,
  184. .free_fall_time = 0x20,
  185. .data_rate = 0x8,
  186. .data_range = ADXL_FULL_RES,
  187. .ev_type = EV_ABS,
  188. .ev_code_x = ABS_X, /* EV_REL */
  189. .ev_code_y = ABS_Y, /* EV_REL */
  190. .ev_code_z = ABS_Z, /* EV_REL */
  191. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  192. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  193. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  194. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  195. .fifo_mode = ADXL_FIFO_STREAM,
  196. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  197. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  198. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  199. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  200. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  201. };
  202. #endif
  203. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  204. static struct platform_device rtc_device = {
  205. .name = "rtc-bfin",
  206. .id = -1,
  207. };
  208. #endif
  209. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  210. #ifdef CONFIG_SERIAL_BFIN_UART0
  211. static struct resource bfin_uart0_resources[] = {
  212. {
  213. .start = UART0_DLL,
  214. .end = UART0_RBR+2,
  215. .flags = IORESOURCE_MEM,
  216. },
  217. {
  218. .start = IRQ_UART0_RX,
  219. .end = IRQ_UART0_RX+1,
  220. .flags = IORESOURCE_IRQ,
  221. },
  222. {
  223. .start = IRQ_UART0_ERROR,
  224. .end = IRQ_UART0_ERROR,
  225. .flags = IORESOURCE_IRQ,
  226. },
  227. {
  228. .start = CH_UART0_TX,
  229. .end = CH_UART0_TX,
  230. .flags = IORESOURCE_DMA,
  231. },
  232. {
  233. .start = CH_UART0_RX,
  234. .end = CH_UART0_RX,
  235. .flags = IORESOURCE_DMA,
  236. },
  237. };
  238. unsigned short bfin_uart0_peripherals[] = {
  239. P_UART0_TX, P_UART0_RX, 0
  240. };
  241. static struct platform_device bfin_uart0_device = {
  242. .name = "bfin-uart",
  243. .id = 0,
  244. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  245. .resource = bfin_uart0_resources,
  246. .dev = {
  247. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  248. },
  249. };
  250. #endif
  251. #ifdef CONFIG_SERIAL_BFIN_UART1
  252. static struct resource bfin_uart1_resources[] = {
  253. {
  254. .start = UART1_DLL,
  255. .end = UART1_RBR+2,
  256. .flags = IORESOURCE_MEM,
  257. },
  258. {
  259. .start = IRQ_UART1_RX,
  260. .end = IRQ_UART1_RX+1,
  261. .flags = IORESOURCE_IRQ,
  262. },
  263. {
  264. .start = IRQ_UART1_ERROR,
  265. .end = IRQ_UART1_ERROR,
  266. .flags = IORESOURCE_IRQ,
  267. },
  268. {
  269. .start = CH_UART1_TX,
  270. .end = CH_UART1_TX,
  271. .flags = IORESOURCE_DMA,
  272. },
  273. {
  274. .start = CH_UART1_RX,
  275. .end = CH_UART1_RX,
  276. .flags = IORESOURCE_DMA,
  277. },
  278. #ifdef CONFIG_BFIN_UART1_CTSRTS
  279. { /* CTS pin -- 0 means not supported */
  280. .start = GPIO_PE10,
  281. .end = GPIO_PE10,
  282. .flags = IORESOURCE_IO,
  283. },
  284. { /* RTS pin -- 0 means not supported */
  285. .start = GPIO_PE9,
  286. .end = GPIO_PE9,
  287. .flags = IORESOURCE_IO,
  288. },
  289. #endif
  290. };
  291. unsigned short bfin_uart1_peripherals[] = {
  292. P_UART1_TX, P_UART1_RX,
  293. #ifdef CONFIG_BFIN_UART1_CTSRTS
  294. P_UART1_RTS, P_UART1_CTS,
  295. #endif
  296. 0
  297. };
  298. static struct platform_device bfin_uart1_device = {
  299. .name = "bfin-uart",
  300. .id = 1,
  301. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  302. .resource = bfin_uart1_resources,
  303. .dev = {
  304. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  305. },
  306. };
  307. #endif
  308. #ifdef CONFIG_SERIAL_BFIN_UART2
  309. static struct resource bfin_uart2_resources[] = {
  310. {
  311. .start = UART2_DLL,
  312. .end = UART2_RBR+2,
  313. .flags = IORESOURCE_MEM,
  314. },
  315. {
  316. .start = IRQ_UART2_RX,
  317. .end = IRQ_UART2_RX+1,
  318. .flags = IORESOURCE_IRQ,
  319. },
  320. {
  321. .start = IRQ_UART2_ERROR,
  322. .end = IRQ_UART2_ERROR,
  323. .flags = IORESOURCE_IRQ,
  324. },
  325. {
  326. .start = CH_UART2_TX,
  327. .end = CH_UART2_TX,
  328. .flags = IORESOURCE_DMA,
  329. },
  330. {
  331. .start = CH_UART2_RX,
  332. .end = CH_UART2_RX,
  333. .flags = IORESOURCE_DMA,
  334. },
  335. };
  336. unsigned short bfin_uart2_peripherals[] = {
  337. P_UART2_TX, P_UART2_RX, 0
  338. };
  339. static struct platform_device bfin_uart2_device = {
  340. .name = "bfin-uart",
  341. .id = 2,
  342. .num_resources = ARRAY_SIZE(bfin_uart2_resources),
  343. .resource = bfin_uart2_resources,
  344. .dev = {
  345. .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
  346. },
  347. };
  348. #endif
  349. #ifdef CONFIG_SERIAL_BFIN_UART3
  350. static struct resource bfin_uart3_resources[] = {
  351. {
  352. .start = UART3_DLL,
  353. .end = UART3_RBR+2,
  354. .flags = IORESOURCE_MEM,
  355. },
  356. {
  357. .start = IRQ_UART3_RX,
  358. .end = IRQ_UART3_RX+1,
  359. .flags = IORESOURCE_IRQ,
  360. },
  361. {
  362. .start = IRQ_UART3_ERROR,
  363. .end = IRQ_UART3_ERROR,
  364. .flags = IORESOURCE_IRQ,
  365. },
  366. {
  367. .start = CH_UART3_TX,
  368. .end = CH_UART3_TX,
  369. .flags = IORESOURCE_DMA,
  370. },
  371. {
  372. .start = CH_UART3_RX,
  373. .end = CH_UART3_RX,
  374. .flags = IORESOURCE_DMA,
  375. },
  376. #ifdef CONFIG_BFIN_UART3_CTSRTS
  377. { /* CTS pin -- 0 means not supported */
  378. .start = GPIO_PB3,
  379. .end = GPIO_PB3,
  380. .flags = IORESOURCE_IO,
  381. },
  382. { /* RTS pin -- 0 means not supported */
  383. .start = GPIO_PB2,
  384. .end = GPIO_PB2,
  385. .flags = IORESOURCE_IO,
  386. },
  387. #endif
  388. };
  389. unsigned short bfin_uart3_peripherals[] = {
  390. P_UART3_TX, P_UART3_RX,
  391. #ifdef CONFIG_BFIN_UART3_CTSRTS
  392. P_UART3_RTS, P_UART3_CTS,
  393. #endif
  394. 0
  395. };
  396. static struct platform_device bfin_uart3_device = {
  397. .name = "bfin-uart",
  398. .id = 3,
  399. .num_resources = ARRAY_SIZE(bfin_uart3_resources),
  400. .resource = bfin_uart3_resources,
  401. .dev = {
  402. .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
  403. },
  404. };
  405. #endif
  406. #endif
  407. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  408. #ifdef CONFIG_BFIN_SIR0
  409. static struct resource bfin_sir0_resources[] = {
  410. {
  411. .start = 0xFFC00400,
  412. .end = 0xFFC004FF,
  413. .flags = IORESOURCE_MEM,
  414. },
  415. {
  416. .start = IRQ_UART0_RX,
  417. .end = IRQ_UART0_RX+1,
  418. .flags = IORESOURCE_IRQ,
  419. },
  420. {
  421. .start = CH_UART0_RX,
  422. .end = CH_UART0_RX+1,
  423. .flags = IORESOURCE_DMA,
  424. },
  425. };
  426. static struct platform_device bfin_sir0_device = {
  427. .name = "bfin_sir",
  428. .id = 0,
  429. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  430. .resource = bfin_sir0_resources,
  431. };
  432. #endif
  433. #ifdef CONFIG_BFIN_SIR1
  434. static struct resource bfin_sir1_resources[] = {
  435. {
  436. .start = 0xFFC02000,
  437. .end = 0xFFC020FF,
  438. .flags = IORESOURCE_MEM,
  439. },
  440. {
  441. .start = IRQ_UART1_RX,
  442. .end = IRQ_UART1_RX+1,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. {
  446. .start = CH_UART1_RX,
  447. .end = CH_UART1_RX+1,
  448. .flags = IORESOURCE_DMA,
  449. },
  450. };
  451. static struct platform_device bfin_sir1_device = {
  452. .name = "bfin_sir",
  453. .id = 1,
  454. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  455. .resource = bfin_sir1_resources,
  456. };
  457. #endif
  458. #ifdef CONFIG_BFIN_SIR2
  459. static struct resource bfin_sir2_resources[] = {
  460. {
  461. .start = 0xFFC02100,
  462. .end = 0xFFC021FF,
  463. .flags = IORESOURCE_MEM,
  464. },
  465. {
  466. .start = IRQ_UART2_RX,
  467. .end = IRQ_UART2_RX+1,
  468. .flags = IORESOURCE_IRQ,
  469. },
  470. {
  471. .start = CH_UART2_RX,
  472. .end = CH_UART2_RX+1,
  473. .flags = IORESOURCE_DMA,
  474. },
  475. };
  476. static struct platform_device bfin_sir2_device = {
  477. .name = "bfin_sir",
  478. .id = 2,
  479. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  480. .resource = bfin_sir2_resources,
  481. };
  482. #endif
  483. #ifdef CONFIG_BFIN_SIR3
  484. static struct resource bfin_sir3_resources[] = {
  485. {
  486. .start = 0xFFC03100,
  487. .end = 0xFFC031FF,
  488. .flags = IORESOURCE_MEM,
  489. },
  490. {
  491. .start = IRQ_UART3_RX,
  492. .end = IRQ_UART3_RX+1,
  493. .flags = IORESOURCE_IRQ,
  494. },
  495. {
  496. .start = CH_UART3_RX,
  497. .end = CH_UART3_RX+1,
  498. .flags = IORESOURCE_DMA,
  499. },
  500. };
  501. static struct platform_device bfin_sir3_device = {
  502. .name = "bfin_sir",
  503. .id = 3,
  504. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  505. .resource = bfin_sir3_resources,
  506. };
  507. #endif
  508. #endif
  509. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  510. #include <linux/smsc911x.h>
  511. static struct resource smsc911x_resources[] = {
  512. {
  513. .name = "smsc911x-memory",
  514. .start = 0x24000000,
  515. .end = 0x24000000 + 0xFF,
  516. .flags = IORESOURCE_MEM,
  517. },
  518. {
  519. .start = IRQ_PE8,
  520. .end = IRQ_PE8,
  521. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  522. },
  523. };
  524. static struct smsc911x_platform_config smsc911x_config = {
  525. .flags = SMSC911X_USE_32BIT,
  526. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  527. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  528. .phy_interface = PHY_INTERFACE_MODE_MII,
  529. };
  530. static struct platform_device smsc911x_device = {
  531. .name = "smsc911x",
  532. .id = 0,
  533. .num_resources = ARRAY_SIZE(smsc911x_resources),
  534. .resource = smsc911x_resources,
  535. .dev = {
  536. .platform_data = &smsc911x_config,
  537. },
  538. };
  539. #endif
  540. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  541. static struct resource musb_resources[] = {
  542. [0] = {
  543. .start = 0xFFC03C00,
  544. .end = 0xFFC040FF,
  545. .flags = IORESOURCE_MEM,
  546. },
  547. [1] = { /* general IRQ */
  548. .start = IRQ_USB_INT0,
  549. .end = IRQ_USB_INT0,
  550. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  551. },
  552. [2] = { /* DMA IRQ */
  553. .start = IRQ_USB_DMA,
  554. .end = IRQ_USB_DMA,
  555. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  556. },
  557. };
  558. static struct musb_hdrc_config musb_config = {
  559. .multipoint = 0,
  560. .dyn_fifo = 0,
  561. .soft_con = 1,
  562. .dma = 1,
  563. .num_eps = 8,
  564. .dma_channels = 8,
  565. .gpio_vrsel = GPIO_PE7,
  566. /* Some custom boards need to be active low, just set it to "0"
  567. * if it is the case.
  568. */
  569. .gpio_vrsel_active = 1,
  570. };
  571. static struct musb_hdrc_platform_data musb_plat = {
  572. #if defined(CONFIG_USB_MUSB_OTG)
  573. .mode = MUSB_OTG,
  574. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  575. .mode = MUSB_HOST,
  576. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  577. .mode = MUSB_PERIPHERAL,
  578. #endif
  579. .config = &musb_config,
  580. };
  581. static u64 musb_dmamask = ~(u32)0;
  582. static struct platform_device musb_device = {
  583. .name = "musb_hdrc",
  584. .id = 0,
  585. .dev = {
  586. .dma_mask = &musb_dmamask,
  587. .coherent_dma_mask = 0xffffffff,
  588. .platform_data = &musb_plat,
  589. },
  590. .num_resources = ARRAY_SIZE(musb_resources),
  591. .resource = musb_resources,
  592. };
  593. #endif
  594. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  595. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  596. static struct resource bfin_sport0_uart_resources[] = {
  597. {
  598. .start = SPORT0_TCR1,
  599. .end = SPORT0_MRCS3+4,
  600. .flags = IORESOURCE_MEM,
  601. },
  602. {
  603. .start = IRQ_SPORT0_RX,
  604. .end = IRQ_SPORT0_RX+1,
  605. .flags = IORESOURCE_IRQ,
  606. },
  607. {
  608. .start = IRQ_SPORT0_ERROR,
  609. .end = IRQ_SPORT0_ERROR,
  610. .flags = IORESOURCE_IRQ,
  611. },
  612. };
  613. unsigned short bfin_sport0_peripherals[] = {
  614. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  615. P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
  616. };
  617. static struct platform_device bfin_sport0_uart_device = {
  618. .name = "bfin-sport-uart",
  619. .id = 0,
  620. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  621. .resource = bfin_sport0_uart_resources,
  622. .dev = {
  623. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  624. },
  625. };
  626. #endif
  627. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  628. static struct resource bfin_sport1_uart_resources[] = {
  629. {
  630. .start = SPORT1_TCR1,
  631. .end = SPORT1_MRCS3+4,
  632. .flags = IORESOURCE_MEM,
  633. },
  634. {
  635. .start = IRQ_SPORT1_RX,
  636. .end = IRQ_SPORT1_RX+1,
  637. .flags = IORESOURCE_IRQ,
  638. },
  639. {
  640. .start = IRQ_SPORT1_ERROR,
  641. .end = IRQ_SPORT1_ERROR,
  642. .flags = IORESOURCE_IRQ,
  643. },
  644. };
  645. unsigned short bfin_sport1_peripherals[] = {
  646. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  647. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
  648. };
  649. static struct platform_device bfin_sport1_uart_device = {
  650. .name = "bfin-sport-uart",
  651. .id = 1,
  652. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  653. .resource = bfin_sport1_uart_resources,
  654. .dev = {
  655. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  656. },
  657. };
  658. #endif
  659. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  660. static struct resource bfin_sport2_uart_resources[] = {
  661. {
  662. .start = SPORT2_TCR1,
  663. .end = SPORT2_MRCS3+4,
  664. .flags = IORESOURCE_MEM,
  665. },
  666. {
  667. .start = IRQ_SPORT2_RX,
  668. .end = IRQ_SPORT2_RX+1,
  669. .flags = IORESOURCE_IRQ,
  670. },
  671. {
  672. .start = IRQ_SPORT2_ERROR,
  673. .end = IRQ_SPORT2_ERROR,
  674. .flags = IORESOURCE_IRQ,
  675. },
  676. };
  677. unsigned short bfin_sport2_peripherals[] = {
  678. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  679. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  680. };
  681. static struct platform_device bfin_sport2_uart_device = {
  682. .name = "bfin-sport-uart",
  683. .id = 2,
  684. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  685. .resource = bfin_sport2_uart_resources,
  686. .dev = {
  687. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  688. },
  689. };
  690. #endif
  691. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  692. static struct resource bfin_sport3_uart_resources[] = {
  693. {
  694. .start = SPORT3_TCR1,
  695. .end = SPORT3_MRCS3+4,
  696. .flags = IORESOURCE_MEM,
  697. },
  698. {
  699. .start = IRQ_SPORT3_RX,
  700. .end = IRQ_SPORT3_RX+1,
  701. .flags = IORESOURCE_IRQ,
  702. },
  703. {
  704. .start = IRQ_SPORT3_ERROR,
  705. .end = IRQ_SPORT3_ERROR,
  706. .flags = IORESOURCE_IRQ,
  707. },
  708. };
  709. unsigned short bfin_sport3_peripherals[] = {
  710. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  711. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  712. };
  713. static struct platform_device bfin_sport3_uart_device = {
  714. .name = "bfin-sport-uart",
  715. .id = 3,
  716. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  717. .resource = bfin_sport3_uart_resources,
  718. .dev = {
  719. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  720. },
  721. };
  722. #endif
  723. #endif
  724. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  725. unsigned short bfin_can_peripherals[] = {
  726. P_CAN0_RX, P_CAN0_TX, 0
  727. };
  728. static struct resource bfin_can_resources[] = {
  729. {
  730. .start = 0xFFC02A00,
  731. .end = 0xFFC02FFF,
  732. .flags = IORESOURCE_MEM,
  733. },
  734. {
  735. .start = IRQ_CAN0_RX,
  736. .end = IRQ_CAN0_RX,
  737. .flags = IORESOURCE_IRQ,
  738. },
  739. {
  740. .start = IRQ_CAN0_TX,
  741. .end = IRQ_CAN0_TX,
  742. .flags = IORESOURCE_IRQ,
  743. },
  744. {
  745. .start = IRQ_CAN0_ERROR,
  746. .end = IRQ_CAN0_ERROR,
  747. .flags = IORESOURCE_IRQ,
  748. },
  749. };
  750. static struct platform_device bfin_can_device = {
  751. .name = "bfin_can",
  752. .num_resources = ARRAY_SIZE(bfin_can_resources),
  753. .resource = bfin_can_resources,
  754. .dev = {
  755. .platform_data = &bfin_can_peripherals, /* Passed to driver */
  756. },
  757. };
  758. #endif
  759. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  760. static struct resource bfin_atapi_resources[] = {
  761. {
  762. .start = 0xFFC03800,
  763. .end = 0xFFC0386F,
  764. .flags = IORESOURCE_MEM,
  765. },
  766. {
  767. .start = IRQ_ATAPI_ERR,
  768. .end = IRQ_ATAPI_ERR,
  769. .flags = IORESOURCE_IRQ,
  770. },
  771. };
  772. static struct platform_device bfin_atapi_device = {
  773. .name = "pata-bf54x",
  774. .id = -1,
  775. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  776. .resource = bfin_atapi_resources,
  777. };
  778. #endif
  779. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  780. static struct mtd_partition partition_info[] = {
  781. {
  782. .name = "linux kernel(nand)",
  783. .offset = 0,
  784. .size = 4 * 1024 * 1024,
  785. },
  786. {
  787. .name = "file system(nand)",
  788. .offset = MTDPART_OFS_APPEND,
  789. .size = MTDPART_SIZ_FULL,
  790. },
  791. };
  792. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  793. .page_size = NFC_PG_SIZE_256,
  794. .data_width = NFC_NWIDTH_8,
  795. .partitions = partition_info,
  796. .nr_partitions = ARRAY_SIZE(partition_info),
  797. .rd_dly = 3,
  798. .wr_dly = 3,
  799. };
  800. static struct resource bf5xx_nand_resources[] = {
  801. {
  802. .start = 0xFFC03B00,
  803. .end = 0xFFC03B4F,
  804. .flags = IORESOURCE_MEM,
  805. },
  806. {
  807. .start = CH_NFC,
  808. .end = CH_NFC,
  809. .flags = IORESOURCE_IRQ,
  810. },
  811. };
  812. static struct platform_device bf5xx_nand_device = {
  813. .name = "bf5xx-nand",
  814. .id = 0,
  815. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  816. .resource = bf5xx_nand_resources,
  817. .dev = {
  818. .platform_data = &bf5xx_nand_platform,
  819. },
  820. };
  821. #endif
  822. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  823. static struct bfin_sd_host bfin_sdh_data = {
  824. .dma_chan = CH_SDH,
  825. .irq_int0 = IRQ_SDH_MASK0,
  826. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  827. };
  828. static struct platform_device bf54x_sdh_device = {
  829. .name = "bfin-sdh",
  830. .id = 0,
  831. .dev = {
  832. .platform_data = &bfin_sdh_data,
  833. },
  834. };
  835. #endif
  836. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  837. static struct mtd_partition ezkit_partitions[] = {
  838. {
  839. .name = "bootloader(nor)",
  840. .size = 0x40000,
  841. .offset = 0,
  842. }, {
  843. .name = "linux kernel(nor)",
  844. .size = 0x400000,
  845. .offset = MTDPART_OFS_APPEND,
  846. }, {
  847. .name = "file system(nor)",
  848. .size = MTDPART_SIZ_FULL,
  849. .offset = MTDPART_OFS_APPEND,
  850. }
  851. };
  852. static struct physmap_flash_data ezkit_flash_data = {
  853. .width = 2,
  854. .parts = ezkit_partitions,
  855. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  856. };
  857. static struct resource ezkit_flash_resource = {
  858. .start = 0x20000000,
  859. .end = 0x21ffffff,
  860. .flags = IORESOURCE_MEM,
  861. };
  862. static struct platform_device ezkit_flash_device = {
  863. .name = "physmap-flash",
  864. .id = 0,
  865. .dev = {
  866. .platform_data = &ezkit_flash_data,
  867. },
  868. .num_resources = 1,
  869. .resource = &ezkit_flash_resource,
  870. };
  871. #endif
  872. #if defined(CONFIG_MTD_M25P80) \
  873. || defined(CONFIG_MTD_M25P80_MODULE)
  874. /* SPI flash chip (m25p16) */
  875. static struct mtd_partition bfin_spi_flash_partitions[] = {
  876. {
  877. .name = "bootloader(spi)",
  878. .size = 0x00040000,
  879. .offset = 0,
  880. .mask_flags = MTD_CAP_ROM
  881. }, {
  882. .name = "linux kernel(spi)",
  883. .size = MTDPART_SIZ_FULL,
  884. .offset = MTDPART_OFS_APPEND,
  885. }
  886. };
  887. static struct flash_platform_data bfin_spi_flash_data = {
  888. .name = "m25p80",
  889. .parts = bfin_spi_flash_partitions,
  890. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  891. .type = "m25p16",
  892. };
  893. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  894. .enable_dma = 0, /* use dma transfer with this chip*/
  895. .bits_per_word = 8,
  896. };
  897. #endif
  898. #if defined(CONFIG_SND_BLACKFIN_AD183X) \
  899. || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
  900. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  901. .enable_dma = 0,
  902. .bits_per_word = 16,
  903. };
  904. #endif
  905. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  906. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  907. .enable_dma = 0,
  908. .bits_per_word = 16,
  909. };
  910. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  911. .model = 7877,
  912. .vref_delay_usecs = 50, /* internal, no capacitor */
  913. .x_plate_ohms = 419,
  914. .y_plate_ohms = 486,
  915. .pressure_max = 1000,
  916. .pressure_min = 0,
  917. .stopacq_polarity = 1,
  918. .first_conversion_delay = 3,
  919. .acquisition_time = 1,
  920. .averaging = 1,
  921. .pen_down_acc_interval = 1,
  922. };
  923. #endif
  924. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  925. static struct bfin5xx_spi_chip spidev_chip_info = {
  926. .enable_dma = 0,
  927. .bits_per_word = 8,
  928. };
  929. #endif
  930. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  931. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  932. .enable_dma = 0, /* use dma transfer with this chip*/
  933. .bits_per_word = 8,
  934. };
  935. #endif
  936. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  937. #if defined(CONFIG_MTD_M25P80) \
  938. || defined(CONFIG_MTD_M25P80_MODULE)
  939. {
  940. /* the modalias must be the same as spi device driver name */
  941. .modalias = "m25p80", /* Name of spi_driver for this device */
  942. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  943. .bus_num = 0, /* Framework bus number */
  944. .chip_select = 1, /* SPI_SSEL1*/
  945. .platform_data = &bfin_spi_flash_data,
  946. .controller_data = &spi_flash_chip_info,
  947. .mode = SPI_MODE_3,
  948. },
  949. #endif
  950. #if defined(CONFIG_SND_BLACKFIN_AD183X) \
  951. || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
  952. {
  953. .modalias = "ad1836",
  954. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  955. .bus_num = 1,
  956. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  957. .controller_data = &ad1836_spi_chip_info,
  958. },
  959. #endif
  960. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  961. {
  962. .modalias = "ad7877",
  963. .platform_data = &bfin_ad7877_ts_info,
  964. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  965. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  966. .bus_num = 0,
  967. .chip_select = 2,
  968. .controller_data = &spi_ad7877_chip_info,
  969. },
  970. #endif
  971. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  972. {
  973. .modalias = "spidev",
  974. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  975. .bus_num = 0,
  976. .chip_select = 1,
  977. .controller_data = &spidev_chip_info,
  978. },
  979. #endif
  980. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  981. {
  982. .modalias = "adxl34x",
  983. .platform_data = &adxl34x_info,
  984. .irq = IRQ_PC5,
  985. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  986. .bus_num = 1,
  987. .chip_select = 2,
  988. .controller_data = &spi_adxl34x_chip_info,
  989. .mode = SPI_MODE_3,
  990. },
  991. #endif
  992. };
  993. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  994. /* SPI (0) */
  995. static struct resource bfin_spi0_resource[] = {
  996. [0] = {
  997. .start = SPI0_REGBASE,
  998. .end = SPI0_REGBASE + 0xFF,
  999. .flags = IORESOURCE_MEM,
  1000. },
  1001. [1] = {
  1002. .start = CH_SPI0,
  1003. .end = CH_SPI0,
  1004. .flags = IORESOURCE_DMA,
  1005. },
  1006. [2] = {
  1007. .start = IRQ_SPI0,
  1008. .end = IRQ_SPI0,
  1009. .flags = IORESOURCE_IRQ,
  1010. }
  1011. };
  1012. /* SPI (1) */
  1013. static struct resource bfin_spi1_resource[] = {
  1014. [0] = {
  1015. .start = SPI1_REGBASE,
  1016. .end = SPI1_REGBASE + 0xFF,
  1017. .flags = IORESOURCE_MEM,
  1018. },
  1019. [1] = {
  1020. .start = CH_SPI1,
  1021. .end = CH_SPI1,
  1022. .flags = IORESOURCE_DMA,
  1023. },
  1024. [2] = {
  1025. .start = IRQ_SPI1,
  1026. .end = IRQ_SPI1,
  1027. .flags = IORESOURCE_IRQ,
  1028. }
  1029. };
  1030. /* SPI controller data */
  1031. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  1032. .num_chipselect = 3,
  1033. .enable_dma = 1, /* master has the ability to do dma transfer */
  1034. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1035. };
  1036. static struct platform_device bf54x_spi_master0 = {
  1037. .name = "bfin-spi",
  1038. .id = 0, /* Bus number */
  1039. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1040. .resource = bfin_spi0_resource,
  1041. .dev = {
  1042. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  1043. },
  1044. };
  1045. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  1046. .num_chipselect = 3,
  1047. .enable_dma = 1, /* master has the ability to do dma transfer */
  1048. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1049. };
  1050. static struct platform_device bf54x_spi_master1 = {
  1051. .name = "bfin-spi",
  1052. .id = 1, /* Bus number */
  1053. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1054. .resource = bfin_spi1_resource,
  1055. .dev = {
  1056. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  1057. },
  1058. };
  1059. #endif /* spi master and devices */
  1060. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1061. static struct resource bfin_twi0_resource[] = {
  1062. [0] = {
  1063. .start = TWI0_REGBASE,
  1064. .end = TWI0_REGBASE + 0xFF,
  1065. .flags = IORESOURCE_MEM,
  1066. },
  1067. [1] = {
  1068. .start = IRQ_TWI0,
  1069. .end = IRQ_TWI0,
  1070. .flags = IORESOURCE_IRQ,
  1071. },
  1072. };
  1073. static struct platform_device i2c_bfin_twi0_device = {
  1074. .name = "i2c-bfin-twi",
  1075. .id = 0,
  1076. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1077. .resource = bfin_twi0_resource,
  1078. };
  1079. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1080. static struct resource bfin_twi1_resource[] = {
  1081. [0] = {
  1082. .start = TWI1_REGBASE,
  1083. .end = TWI1_REGBASE + 0xFF,
  1084. .flags = IORESOURCE_MEM,
  1085. },
  1086. [1] = {
  1087. .start = IRQ_TWI1,
  1088. .end = IRQ_TWI1,
  1089. .flags = IORESOURCE_IRQ,
  1090. },
  1091. };
  1092. static struct platform_device i2c_bfin_twi1_device = {
  1093. .name = "i2c-bfin-twi",
  1094. .id = 1,
  1095. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1096. .resource = bfin_twi1_resource,
  1097. };
  1098. #endif
  1099. #endif
  1100. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1101. };
  1102. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1103. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1104. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1105. {
  1106. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1107. },
  1108. #endif
  1109. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  1110. {
  1111. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1112. .irq = 212,
  1113. },
  1114. #endif
  1115. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1116. {
  1117. I2C_BOARD_INFO("adxl34x", 0x53),
  1118. .irq = IRQ_PC5,
  1119. .platform_data = (void *)&adxl34x_info,
  1120. },
  1121. #endif
  1122. };
  1123. #endif
  1124. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1125. #include <linux/gpio_keys.h>
  1126. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1127. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  1128. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  1129. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  1130. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  1131. };
  1132. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1133. .buttons = bfin_gpio_keys_table,
  1134. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1135. };
  1136. static struct platform_device bfin_device_gpiokeys = {
  1137. .name = "gpio-keys",
  1138. .dev = {
  1139. .platform_data = &bfin_gpio_keys_data,
  1140. },
  1141. };
  1142. #endif
  1143. static const unsigned int cclk_vlev_datasheet[] =
  1144. {
  1145. /*
  1146. * Internal VLEV BF54XSBBC1533
  1147. ****temporarily using these values until data sheet is updated
  1148. */
  1149. VRPAIR(VLEV_085, 150000000),
  1150. VRPAIR(VLEV_090, 250000000),
  1151. VRPAIR(VLEV_110, 276000000),
  1152. VRPAIR(VLEV_115, 301000000),
  1153. VRPAIR(VLEV_120, 525000000),
  1154. VRPAIR(VLEV_125, 550000000),
  1155. VRPAIR(VLEV_130, 600000000),
  1156. };
  1157. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1158. .tuple_tab = cclk_vlev_datasheet,
  1159. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1160. .vr_settling_time = 25 /* us */,
  1161. };
  1162. static struct platform_device bfin_dpmc = {
  1163. .name = "bfin dpmc",
  1164. .dev = {
  1165. .platform_data = &bfin_dmpc_vreg_data,
  1166. },
  1167. };
  1168. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1169. static struct platform_device bfin_i2s = {
  1170. .name = "bfin-i2s",
  1171. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1172. /* TODO: add platform data here */
  1173. };
  1174. #endif
  1175. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1176. static struct platform_device bfin_tdm = {
  1177. .name = "bfin-tdm",
  1178. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1179. /* TODO: add platform data here */
  1180. };
  1181. #endif
  1182. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1183. static struct platform_device bfin_ac97 = {
  1184. .name = "bfin-ac97",
  1185. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1186. /* TODO: add platform data here */
  1187. };
  1188. #endif
  1189. static struct platform_device *ezkit_devices[] __initdata = {
  1190. &bfin_dpmc,
  1191. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1192. &rtc_device,
  1193. #endif
  1194. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1195. #ifdef CONFIG_SERIAL_BFIN_UART0
  1196. &bfin_uart0_device,
  1197. #endif
  1198. #ifdef CONFIG_SERIAL_BFIN_UART1
  1199. &bfin_uart1_device,
  1200. #endif
  1201. #ifdef CONFIG_SERIAL_BFIN_UART2
  1202. &bfin_uart2_device,
  1203. #endif
  1204. #ifdef CONFIG_SERIAL_BFIN_UART3
  1205. &bfin_uart3_device,
  1206. #endif
  1207. #endif
  1208. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1209. #ifdef CONFIG_BFIN_SIR0
  1210. &bfin_sir0_device,
  1211. #endif
  1212. #ifdef CONFIG_BFIN_SIR1
  1213. &bfin_sir1_device,
  1214. #endif
  1215. #ifdef CONFIG_BFIN_SIR2
  1216. &bfin_sir2_device,
  1217. #endif
  1218. #ifdef CONFIG_BFIN_SIR3
  1219. &bfin_sir3_device,
  1220. #endif
  1221. #endif
  1222. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  1223. &bf54x_lq043_device,
  1224. #endif
  1225. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  1226. &smsc911x_device,
  1227. #endif
  1228. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1229. &musb_device,
  1230. #endif
  1231. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1232. &bfin_isp1760_device,
  1233. #endif
  1234. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1235. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1236. &bfin_sport0_uart_device,
  1237. #endif
  1238. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1239. &bfin_sport1_uart_device,
  1240. #endif
  1241. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1242. &bfin_sport2_uart_device,
  1243. #endif
  1244. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1245. &bfin_sport3_uart_device,
  1246. #endif
  1247. #endif
  1248. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1249. &bfin_can_device,
  1250. #endif
  1251. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  1252. &bfin_atapi_device,
  1253. #endif
  1254. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1255. &bf5xx_nand_device,
  1256. #endif
  1257. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1258. &bf54x_sdh_device,
  1259. #endif
  1260. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1261. &bf54x_spi_master0,
  1262. &bf54x_spi_master1,
  1263. #endif
  1264. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  1265. &bf54x_kpad_device,
  1266. #endif
  1267. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1268. &bfin_rotary_device,
  1269. #endif
  1270. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1271. &i2c_bfin_twi0_device,
  1272. #if !defined(CONFIG_BF542)
  1273. &i2c_bfin_twi1_device,
  1274. #endif
  1275. #endif
  1276. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1277. &bfin_device_gpiokeys,
  1278. #endif
  1279. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1280. &ezkit_flash_device,
  1281. #endif
  1282. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1283. &bfin_i2s,
  1284. #endif
  1285. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1286. &bfin_tdm,
  1287. #endif
  1288. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1289. &bfin_ac97,
  1290. #endif
  1291. };
  1292. static int __init ezkit_init(void)
  1293. {
  1294. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1295. i2c_register_board_info(0, bfin_i2c_board_info0,
  1296. ARRAY_SIZE(bfin_i2c_board_info0));
  1297. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1298. i2c_register_board_info(1, bfin_i2c_board_info1,
  1299. ARRAY_SIZE(bfin_i2c_board_info1));
  1300. #endif
  1301. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1302. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1303. return 0;
  1304. }
  1305. arch_initcall(ezkit_init);
  1306. static struct platform_device *ezkit_early_devices[] __initdata = {
  1307. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1308. #ifdef CONFIG_SERIAL_BFIN_UART0
  1309. &bfin_uart0_device,
  1310. #endif
  1311. #ifdef CONFIG_SERIAL_BFIN_UART1
  1312. &bfin_uart1_device,
  1313. #endif
  1314. #ifdef CONFIG_SERIAL_BFIN_UART2
  1315. &bfin_uart2_device,
  1316. #endif
  1317. #ifdef CONFIG_SERIAL_BFIN_UART3
  1318. &bfin_uart3_device,
  1319. #endif
  1320. #endif
  1321. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1322. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1323. &bfin_sport0_uart_device,
  1324. #endif
  1325. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1326. &bfin_sport1_uart_device,
  1327. #endif
  1328. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1329. &bfin_sport2_uart_device,
  1330. #endif
  1331. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1332. &bfin_sport3_uart_device,
  1333. #endif
  1334. #endif
  1335. };
  1336. void __init native_machine_early_platform_add_devices(void)
  1337. {
  1338. printk(KERN_INFO "register early platform devices\n");
  1339. early_platform_add_devices(ezkit_early_devices,
  1340. ARRAY_SIZE(ezkit_early_devices));
  1341. }