ezkit.c 23 KB

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