ezkit.c 24 KB

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