ezkit.c 23 KB

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