ezkit.c 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  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. static struct resource bfin_uart_resources[] = {
  211. #ifdef CONFIG_SERIAL_BFIN_UART0
  212. {
  213. .start = 0xFFC00400,
  214. .end = 0xFFC004FF,
  215. .flags = IORESOURCE_MEM,
  216. },
  217. #endif
  218. #ifdef CONFIG_SERIAL_BFIN_UART1
  219. {
  220. .start = 0xFFC02000,
  221. .end = 0xFFC020FF,
  222. .flags = IORESOURCE_MEM,
  223. },
  224. #endif
  225. #ifdef CONFIG_SERIAL_BFIN_UART2
  226. {
  227. .start = 0xFFC02100,
  228. .end = 0xFFC021FF,
  229. .flags = IORESOURCE_MEM,
  230. },
  231. #endif
  232. #ifdef CONFIG_SERIAL_BFIN_UART3
  233. {
  234. .start = 0xFFC03100,
  235. .end = 0xFFC031FF,
  236. .flags = IORESOURCE_MEM,
  237. },
  238. #endif
  239. };
  240. static struct platform_device bfin_uart_device = {
  241. .name = "bfin-uart",
  242. .id = 1,
  243. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  244. .resource = bfin_uart_resources,
  245. };
  246. #endif
  247. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  248. #ifdef CONFIG_BFIN_SIR0
  249. static struct resource bfin_sir0_resources[] = {
  250. {
  251. .start = 0xFFC00400,
  252. .end = 0xFFC004FF,
  253. .flags = IORESOURCE_MEM,
  254. },
  255. {
  256. .start = IRQ_UART0_RX,
  257. .end = IRQ_UART0_RX+1,
  258. .flags = IORESOURCE_IRQ,
  259. },
  260. {
  261. .start = CH_UART0_RX,
  262. .end = CH_UART0_RX+1,
  263. .flags = IORESOURCE_DMA,
  264. },
  265. };
  266. static struct platform_device bfin_sir0_device = {
  267. .name = "bfin_sir",
  268. .id = 0,
  269. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  270. .resource = bfin_sir0_resources,
  271. };
  272. #endif
  273. #ifdef CONFIG_BFIN_SIR1
  274. static struct resource bfin_sir1_resources[] = {
  275. {
  276. .start = 0xFFC02000,
  277. .end = 0xFFC020FF,
  278. .flags = IORESOURCE_MEM,
  279. },
  280. {
  281. .start = IRQ_UART1_RX,
  282. .end = IRQ_UART1_RX+1,
  283. .flags = IORESOURCE_IRQ,
  284. },
  285. {
  286. .start = CH_UART1_RX,
  287. .end = CH_UART1_RX+1,
  288. .flags = IORESOURCE_DMA,
  289. },
  290. };
  291. static struct platform_device bfin_sir1_device = {
  292. .name = "bfin_sir",
  293. .id = 1,
  294. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  295. .resource = bfin_sir1_resources,
  296. };
  297. #endif
  298. #ifdef CONFIG_BFIN_SIR2
  299. static struct resource bfin_sir2_resources[] = {
  300. {
  301. .start = 0xFFC02100,
  302. .end = 0xFFC021FF,
  303. .flags = IORESOURCE_MEM,
  304. },
  305. {
  306. .start = IRQ_UART2_RX,
  307. .end = IRQ_UART2_RX+1,
  308. .flags = IORESOURCE_IRQ,
  309. },
  310. {
  311. .start = CH_UART2_RX,
  312. .end = CH_UART2_RX+1,
  313. .flags = IORESOURCE_DMA,
  314. },
  315. };
  316. static struct platform_device bfin_sir2_device = {
  317. .name = "bfin_sir",
  318. .id = 2,
  319. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  320. .resource = bfin_sir2_resources,
  321. };
  322. #endif
  323. #ifdef CONFIG_BFIN_SIR3
  324. static struct resource bfin_sir3_resources[] = {
  325. {
  326. .start = 0xFFC03100,
  327. .end = 0xFFC031FF,
  328. .flags = IORESOURCE_MEM,
  329. },
  330. {
  331. .start = IRQ_UART3_RX,
  332. .end = IRQ_UART3_RX+1,
  333. .flags = IORESOURCE_IRQ,
  334. },
  335. {
  336. .start = CH_UART3_RX,
  337. .end = CH_UART3_RX+1,
  338. .flags = IORESOURCE_DMA,
  339. },
  340. };
  341. static struct platform_device bfin_sir3_device = {
  342. .name = "bfin_sir",
  343. .id = 3,
  344. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  345. .resource = bfin_sir3_resources,
  346. };
  347. #endif
  348. #endif
  349. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  350. #include <linux/smsc911x.h>
  351. static struct resource smsc911x_resources[] = {
  352. {
  353. .name = "smsc911x-memory",
  354. .start = 0x24000000,
  355. .end = 0x24000000 + 0xFF,
  356. .flags = IORESOURCE_MEM,
  357. },
  358. {
  359. .start = IRQ_PE8,
  360. .end = IRQ_PE8,
  361. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  362. },
  363. };
  364. static struct smsc911x_platform_config smsc911x_config = {
  365. .flags = SMSC911X_USE_32BIT,
  366. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  367. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  368. .phy_interface = PHY_INTERFACE_MODE_MII,
  369. };
  370. static struct platform_device smsc911x_device = {
  371. .name = "smsc911x",
  372. .id = 0,
  373. .num_resources = ARRAY_SIZE(smsc911x_resources),
  374. .resource = smsc911x_resources,
  375. .dev = {
  376. .platform_data = &smsc911x_config,
  377. },
  378. };
  379. #endif
  380. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  381. static struct resource musb_resources[] = {
  382. [0] = {
  383. .start = 0xFFC03C00,
  384. .end = 0xFFC040FF,
  385. .flags = IORESOURCE_MEM,
  386. },
  387. [1] = { /* general IRQ */
  388. .start = IRQ_USB_INT0,
  389. .end = IRQ_USB_INT0,
  390. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  391. },
  392. [2] = { /* DMA IRQ */
  393. .start = IRQ_USB_DMA,
  394. .end = IRQ_USB_DMA,
  395. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  396. },
  397. };
  398. static struct musb_hdrc_config musb_config = {
  399. .multipoint = 0,
  400. .dyn_fifo = 0,
  401. .soft_con = 1,
  402. .dma = 1,
  403. .num_eps = 8,
  404. .dma_channels = 8,
  405. .gpio_vrsel = GPIO_PE7,
  406. };
  407. static struct musb_hdrc_platform_data musb_plat = {
  408. #if defined(CONFIG_USB_MUSB_OTG)
  409. .mode = MUSB_OTG,
  410. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  411. .mode = MUSB_HOST,
  412. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  413. .mode = MUSB_PERIPHERAL,
  414. #endif
  415. .config = &musb_config,
  416. };
  417. static u64 musb_dmamask = ~(u32)0;
  418. static struct platform_device musb_device = {
  419. .name = "musb_hdrc",
  420. .id = 0,
  421. .dev = {
  422. .dma_mask = &musb_dmamask,
  423. .coherent_dma_mask = 0xffffffff,
  424. .platform_data = &musb_plat,
  425. },
  426. .num_resources = ARRAY_SIZE(musb_resources),
  427. .resource = musb_resources,
  428. };
  429. #endif
  430. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  431. unsigned short bfin_can_peripherals[] = {
  432. P_CAN0_RX, P_CAN0_TX, 0
  433. };
  434. static struct resource bfin_can_resources[] = {
  435. {
  436. .start = 0xFFC02A00,
  437. .end = 0xFFC02FFF,
  438. .flags = IORESOURCE_MEM,
  439. },
  440. {
  441. .start = IRQ_CAN0_RX,
  442. .end = IRQ_CAN0_RX,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. {
  446. .start = IRQ_CAN0_TX,
  447. .end = IRQ_CAN0_TX,
  448. .flags = IORESOURCE_IRQ,
  449. },
  450. {
  451. .start = IRQ_CAN0_ERROR,
  452. .end = IRQ_CAN0_ERROR,
  453. .flags = IORESOURCE_IRQ,
  454. },
  455. };
  456. static struct platform_device bfin_can_device = {
  457. .name = "bfin_can",
  458. .num_resources = ARRAY_SIZE(bfin_can_resources),
  459. .resource = bfin_can_resources,
  460. .dev = {
  461. .platform_data = &bfin_can_peripherals, /* Passed to driver */
  462. },
  463. };
  464. #endif
  465. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  466. static struct resource bfin_atapi_resources[] = {
  467. {
  468. .start = 0xFFC03800,
  469. .end = 0xFFC0386F,
  470. .flags = IORESOURCE_MEM,
  471. },
  472. {
  473. .start = IRQ_ATAPI_ERR,
  474. .end = IRQ_ATAPI_ERR,
  475. .flags = IORESOURCE_IRQ,
  476. },
  477. };
  478. static struct platform_device bfin_atapi_device = {
  479. .name = "pata-bf54x",
  480. .id = -1,
  481. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  482. .resource = bfin_atapi_resources,
  483. };
  484. #endif
  485. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  486. static struct mtd_partition partition_info[] = {
  487. {
  488. .name = "linux kernel(nand)",
  489. .offset = 0,
  490. .size = 4 * 1024 * 1024,
  491. },
  492. {
  493. .name = "file system(nand)",
  494. .offset = MTDPART_OFS_APPEND,
  495. .size = MTDPART_SIZ_FULL,
  496. },
  497. };
  498. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  499. .page_size = NFC_PG_SIZE_256,
  500. .data_width = NFC_NWIDTH_8,
  501. .partitions = partition_info,
  502. .nr_partitions = ARRAY_SIZE(partition_info),
  503. .rd_dly = 3,
  504. .wr_dly = 3,
  505. };
  506. static struct resource bf5xx_nand_resources[] = {
  507. {
  508. .start = 0xFFC03B00,
  509. .end = 0xFFC03B4F,
  510. .flags = IORESOURCE_MEM,
  511. },
  512. {
  513. .start = CH_NFC,
  514. .end = CH_NFC,
  515. .flags = IORESOURCE_IRQ,
  516. },
  517. };
  518. static struct platform_device bf5xx_nand_device = {
  519. .name = "bf5xx-nand",
  520. .id = 0,
  521. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  522. .resource = bf5xx_nand_resources,
  523. .dev = {
  524. .platform_data = &bf5xx_nand_platform,
  525. },
  526. };
  527. #endif
  528. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  529. static struct bfin_sd_host bfin_sdh_data = {
  530. .dma_chan = CH_SDH,
  531. .irq_int0 = IRQ_SDH_MASK0,
  532. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  533. };
  534. static struct platform_device bf54x_sdh_device = {
  535. .name = "bfin-sdh",
  536. .id = 0,
  537. .dev = {
  538. .platform_data = &bfin_sdh_data,
  539. },
  540. };
  541. #endif
  542. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  543. static struct mtd_partition ezkit_partitions[] = {
  544. {
  545. .name = "bootloader(nor)",
  546. .size = 0x40000,
  547. .offset = 0,
  548. }, {
  549. .name = "linux kernel(nor)",
  550. .size = 0x400000,
  551. .offset = MTDPART_OFS_APPEND,
  552. }, {
  553. .name = "file system(nor)",
  554. .size = MTDPART_SIZ_FULL,
  555. .offset = MTDPART_OFS_APPEND,
  556. }
  557. };
  558. static struct physmap_flash_data ezkit_flash_data = {
  559. .width = 2,
  560. .parts = ezkit_partitions,
  561. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  562. };
  563. static struct resource ezkit_flash_resource = {
  564. .start = 0x20000000,
  565. .end = 0x21ffffff,
  566. .flags = IORESOURCE_MEM,
  567. };
  568. static struct platform_device ezkit_flash_device = {
  569. .name = "physmap-flash",
  570. .id = 0,
  571. .dev = {
  572. .platform_data = &ezkit_flash_data,
  573. },
  574. .num_resources = 1,
  575. .resource = &ezkit_flash_resource,
  576. };
  577. #endif
  578. #if defined(CONFIG_MTD_M25P80) \
  579. || defined(CONFIG_MTD_M25P80_MODULE)
  580. /* SPI flash chip (m25p16) */
  581. static struct mtd_partition bfin_spi_flash_partitions[] = {
  582. {
  583. .name = "bootloader(spi)",
  584. .size = 0x00040000,
  585. .offset = 0,
  586. .mask_flags = MTD_CAP_ROM
  587. }, {
  588. .name = "linux kernel(spi)",
  589. .size = MTDPART_SIZ_FULL,
  590. .offset = MTDPART_OFS_APPEND,
  591. }
  592. };
  593. static struct flash_platform_data bfin_spi_flash_data = {
  594. .name = "m25p80",
  595. .parts = bfin_spi_flash_partitions,
  596. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  597. .type = "m25p16",
  598. };
  599. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  600. .enable_dma = 0, /* use dma transfer with this chip*/
  601. .bits_per_word = 8,
  602. };
  603. #endif
  604. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  605. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  606. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  607. .enable_dma = 0,
  608. .bits_per_word = 16,
  609. };
  610. #endif
  611. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  612. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  613. .enable_dma = 0,
  614. .bits_per_word = 16,
  615. };
  616. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  617. .model = 7877,
  618. .vref_delay_usecs = 50, /* internal, no capacitor */
  619. .x_plate_ohms = 419,
  620. .y_plate_ohms = 486,
  621. .pressure_max = 1000,
  622. .pressure_min = 0,
  623. .stopacq_polarity = 1,
  624. .first_conversion_delay = 3,
  625. .acquisition_time = 1,
  626. .averaging = 1,
  627. .pen_down_acc_interval = 1,
  628. };
  629. #endif
  630. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  631. static struct bfin5xx_spi_chip spidev_chip_info = {
  632. .enable_dma = 0,
  633. .bits_per_word = 8,
  634. };
  635. #endif
  636. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  637. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  638. .enable_dma = 0, /* use dma transfer with this chip*/
  639. .bits_per_word = 8,
  640. };
  641. #endif
  642. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  643. #if defined(CONFIG_MTD_M25P80) \
  644. || defined(CONFIG_MTD_M25P80_MODULE)
  645. {
  646. /* the modalias must be the same as spi device driver name */
  647. .modalias = "m25p80", /* Name of spi_driver for this device */
  648. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  649. .bus_num = 0, /* Framework bus number */
  650. .chip_select = 1, /* SPI_SSEL1*/
  651. .platform_data = &bfin_spi_flash_data,
  652. .controller_data = &spi_flash_chip_info,
  653. .mode = SPI_MODE_3,
  654. },
  655. #endif
  656. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  657. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  658. {
  659. .modalias = "ad1836",
  660. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  661. .bus_num = 1,
  662. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  663. .controller_data = &ad1836_spi_chip_info,
  664. },
  665. #endif
  666. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  667. {
  668. .modalias = "ad7877",
  669. .platform_data = &bfin_ad7877_ts_info,
  670. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  671. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  672. .bus_num = 0,
  673. .chip_select = 2,
  674. .controller_data = &spi_ad7877_chip_info,
  675. },
  676. #endif
  677. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  678. {
  679. .modalias = "spidev",
  680. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  681. .bus_num = 0,
  682. .chip_select = 1,
  683. .controller_data = &spidev_chip_info,
  684. },
  685. #endif
  686. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  687. {
  688. .modalias = "adxl34x",
  689. .platform_data = &adxl34x_info,
  690. .irq = IRQ_PC5,
  691. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  692. .bus_num = 1,
  693. .chip_select = 2,
  694. .controller_data = &spi_adxl34x_chip_info,
  695. .mode = SPI_MODE_3,
  696. },
  697. #endif
  698. };
  699. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  700. /* SPI (0) */
  701. static struct resource bfin_spi0_resource[] = {
  702. [0] = {
  703. .start = SPI0_REGBASE,
  704. .end = SPI0_REGBASE + 0xFF,
  705. .flags = IORESOURCE_MEM,
  706. },
  707. [1] = {
  708. .start = CH_SPI0,
  709. .end = CH_SPI0,
  710. .flags = IORESOURCE_DMA,
  711. },
  712. [2] = {
  713. .start = IRQ_SPI0,
  714. .end = IRQ_SPI0,
  715. .flags = IORESOURCE_IRQ,
  716. }
  717. };
  718. /* SPI (1) */
  719. static struct resource bfin_spi1_resource[] = {
  720. [0] = {
  721. .start = SPI1_REGBASE,
  722. .end = SPI1_REGBASE + 0xFF,
  723. .flags = IORESOURCE_MEM,
  724. },
  725. [1] = {
  726. .start = CH_SPI1,
  727. .end = CH_SPI1,
  728. .flags = IORESOURCE_DMA,
  729. },
  730. [2] = {
  731. .start = IRQ_SPI1,
  732. .end = IRQ_SPI1,
  733. .flags = IORESOURCE_IRQ,
  734. }
  735. };
  736. /* SPI controller data */
  737. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  738. .num_chipselect = 3,
  739. .enable_dma = 1, /* master has the ability to do dma transfer */
  740. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  741. };
  742. static struct platform_device bf54x_spi_master0 = {
  743. .name = "bfin-spi",
  744. .id = 0, /* Bus number */
  745. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  746. .resource = bfin_spi0_resource,
  747. .dev = {
  748. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  749. },
  750. };
  751. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  752. .num_chipselect = 3,
  753. .enable_dma = 1, /* master has the ability to do dma transfer */
  754. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  755. };
  756. static struct platform_device bf54x_spi_master1 = {
  757. .name = "bfin-spi",
  758. .id = 1, /* Bus number */
  759. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  760. .resource = bfin_spi1_resource,
  761. .dev = {
  762. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  763. },
  764. };
  765. #endif /* spi master and devices */
  766. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  767. static struct resource bfin_twi0_resource[] = {
  768. [0] = {
  769. .start = TWI0_REGBASE,
  770. .end = TWI0_REGBASE + 0xFF,
  771. .flags = IORESOURCE_MEM,
  772. },
  773. [1] = {
  774. .start = IRQ_TWI0,
  775. .end = IRQ_TWI0,
  776. .flags = IORESOURCE_IRQ,
  777. },
  778. };
  779. static struct platform_device i2c_bfin_twi0_device = {
  780. .name = "i2c-bfin-twi",
  781. .id = 0,
  782. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  783. .resource = bfin_twi0_resource,
  784. };
  785. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  786. static struct resource bfin_twi1_resource[] = {
  787. [0] = {
  788. .start = TWI1_REGBASE,
  789. .end = TWI1_REGBASE + 0xFF,
  790. .flags = IORESOURCE_MEM,
  791. },
  792. [1] = {
  793. .start = IRQ_TWI1,
  794. .end = IRQ_TWI1,
  795. .flags = IORESOURCE_IRQ,
  796. },
  797. };
  798. static struct platform_device i2c_bfin_twi1_device = {
  799. .name = "i2c-bfin-twi",
  800. .id = 1,
  801. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  802. .resource = bfin_twi1_resource,
  803. };
  804. #endif
  805. #endif
  806. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  807. };
  808. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  809. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  810. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  811. {
  812. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  813. },
  814. #endif
  815. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  816. {
  817. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  818. .irq = 212,
  819. },
  820. #endif
  821. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  822. {
  823. I2C_BOARD_INFO("adxl34x", 0x53),
  824. .irq = IRQ_PC5,
  825. .platform_data = (void *)&adxl34x_info,
  826. },
  827. #endif
  828. };
  829. #endif
  830. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  831. #include <linux/gpio_keys.h>
  832. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  833. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  834. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  835. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  836. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  837. };
  838. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  839. .buttons = bfin_gpio_keys_table,
  840. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  841. };
  842. static struct platform_device bfin_device_gpiokeys = {
  843. .name = "gpio-keys",
  844. .dev = {
  845. .platform_data = &bfin_gpio_keys_data,
  846. },
  847. };
  848. #endif
  849. static const unsigned int cclk_vlev_datasheet[] =
  850. {
  851. /*
  852. * Internal VLEV BF54XSBBC1533
  853. ****temporarily using these values until data sheet is updated
  854. */
  855. VRPAIR(VLEV_085, 150000000),
  856. VRPAIR(VLEV_090, 250000000),
  857. VRPAIR(VLEV_110, 276000000),
  858. VRPAIR(VLEV_115, 301000000),
  859. VRPAIR(VLEV_120, 525000000),
  860. VRPAIR(VLEV_125, 550000000),
  861. VRPAIR(VLEV_130, 600000000),
  862. };
  863. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  864. .tuple_tab = cclk_vlev_datasheet,
  865. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  866. .vr_settling_time = 25 /* us */,
  867. };
  868. static struct platform_device bfin_dpmc = {
  869. .name = "bfin dpmc",
  870. .dev = {
  871. .platform_data = &bfin_dmpc_vreg_data,
  872. },
  873. };
  874. static struct platform_device *ezkit_devices[] __initdata = {
  875. &bfin_dpmc,
  876. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  877. &rtc_device,
  878. #endif
  879. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  880. &bfin_uart_device,
  881. #endif
  882. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  883. #ifdef CONFIG_BFIN_SIR0
  884. &bfin_sir0_device,
  885. #endif
  886. #ifdef CONFIG_BFIN_SIR1
  887. &bfin_sir1_device,
  888. #endif
  889. #ifdef CONFIG_BFIN_SIR2
  890. &bfin_sir2_device,
  891. #endif
  892. #ifdef CONFIG_BFIN_SIR3
  893. &bfin_sir3_device,
  894. #endif
  895. #endif
  896. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  897. &bf54x_lq043_device,
  898. #endif
  899. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  900. &smsc911x_device,
  901. #endif
  902. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  903. &musb_device,
  904. #endif
  905. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  906. &bfin_isp1760_device,
  907. #endif
  908. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  909. &bfin_can_device,
  910. #endif
  911. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  912. &bfin_atapi_device,
  913. #endif
  914. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  915. &bf5xx_nand_device,
  916. #endif
  917. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  918. &bf54x_sdh_device,
  919. #endif
  920. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  921. &bf54x_spi_master0,
  922. &bf54x_spi_master1,
  923. #endif
  924. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  925. &bf54x_kpad_device,
  926. #endif
  927. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  928. &bfin_rotary_device,
  929. #endif
  930. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  931. &i2c_bfin_twi0_device,
  932. #if !defined(CONFIG_BF542)
  933. &i2c_bfin_twi1_device,
  934. #endif
  935. #endif
  936. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  937. &bfin_device_gpiokeys,
  938. #endif
  939. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  940. &ezkit_flash_device,
  941. #endif
  942. };
  943. static int __init ezkit_init(void)
  944. {
  945. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  946. i2c_register_board_info(0, bfin_i2c_board_info0,
  947. ARRAY_SIZE(bfin_i2c_board_info0));
  948. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  949. i2c_register_board_info(1, bfin_i2c_board_info1,
  950. ARRAY_SIZE(bfin_i2c_board_info1));
  951. #endif
  952. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  953. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  954. return 0;
  955. }
  956. arch_initcall(ezkit_init);