ezkit.c 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. /*
  2. * File: arch/blackfin/mach-bf548/boards/ezkit.c
  3. * Based on: arch/blackfin/mach-bf537/boards/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2007 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #include <linux/device.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/partitions.h>
  34. #include <linux/mtd/physmap.h>
  35. #include <linux/spi/spi.h>
  36. #include <linux/spi/flash.h>
  37. #include <linux/irq.h>
  38. #include <linux/i2c.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/usb/musb.h>
  41. #include <asm/bfin5xx_spi.h>
  42. #include <asm/dma.h>
  43. #include <asm/gpio.h>
  44. #include <asm/nand.h>
  45. #include <asm/dpmc.h>
  46. #include <asm/portmux.h>
  47. #include <asm/bfin_sdh.h>
  48. #include <mach/bf54x_keys.h>
  49. #include <linux/input.h>
  50. #include <linux/spi/ad7877.h>
  51. /*
  52. * Name the Board for the /proc/cpuinfo
  53. */
  54. const char bfin_board_name[] = "ADI BF548-EZKIT";
  55. /*
  56. * Driver needs to know address, irq and flag pin.
  57. */
  58. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  59. #include <linux/usb/isp1760.h>
  60. static struct resource bfin_isp1760_resources[] = {
  61. [0] = {
  62. .start = 0x2C0C0000,
  63. .end = 0x2C0C0000 + 0xfffff,
  64. .flags = IORESOURCE_MEM,
  65. },
  66. [1] = {
  67. .start = IRQ_PG7,
  68. .end = IRQ_PG7,
  69. .flags = IORESOURCE_IRQ,
  70. },
  71. };
  72. static struct isp1760_platform_data isp1760_priv = {
  73. .is_isp1761 = 0,
  74. .port1_disable = 0,
  75. .bus_width_16 = 1,
  76. .port1_otg = 0,
  77. .analog_oc = 0,
  78. .dack_polarity_high = 0,
  79. .dreq_polarity_high = 0,
  80. };
  81. static struct platform_device bfin_isp1760_device = {
  82. .name = "isp1760-hcd",
  83. .id = 0,
  84. .dev = {
  85. .platform_data = &isp1760_priv,
  86. },
  87. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  88. .resource = bfin_isp1760_resources,
  89. };
  90. #endif
  91. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  92. #include <mach/bf54x-lq043.h>
  93. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  94. .width = 480,
  95. .height = 272,
  96. .xres = {480, 480, 480},
  97. .yres = {272, 272, 272},
  98. .bpp = {24, 24, 24},
  99. .disp = GPIO_PE3,
  100. };
  101. static struct resource bf54x_lq043_resources[] = {
  102. {
  103. .start = IRQ_EPPI0_ERR,
  104. .end = IRQ_EPPI0_ERR,
  105. .flags = IORESOURCE_IRQ,
  106. },
  107. };
  108. static struct platform_device bf54x_lq043_device = {
  109. .name = "bf54x-lq043",
  110. .id = -1,
  111. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  112. .resource = bf54x_lq043_resources,
  113. .dev = {
  114. .platform_data = &bf54x_lq043_data,
  115. },
  116. };
  117. #endif
  118. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  119. static const unsigned int bf548_keymap[] = {
  120. KEYVAL(0, 0, KEY_ENTER),
  121. KEYVAL(0, 1, KEY_HELP),
  122. KEYVAL(0, 2, KEY_0),
  123. KEYVAL(0, 3, KEY_BACKSPACE),
  124. KEYVAL(1, 0, KEY_TAB),
  125. KEYVAL(1, 1, KEY_9),
  126. KEYVAL(1, 2, KEY_8),
  127. KEYVAL(1, 3, KEY_7),
  128. KEYVAL(2, 0, KEY_DOWN),
  129. KEYVAL(2, 1, KEY_6),
  130. KEYVAL(2, 2, KEY_5),
  131. KEYVAL(2, 3, KEY_4),
  132. KEYVAL(3, 0, KEY_UP),
  133. KEYVAL(3, 1, KEY_3),
  134. KEYVAL(3, 2, KEY_2),
  135. KEYVAL(3, 3, KEY_1),
  136. };
  137. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  138. .rows = 4,
  139. .cols = 4,
  140. .keymap = bf548_keymap,
  141. .keymapsize = ARRAY_SIZE(bf548_keymap),
  142. .repeat = 0,
  143. .debounce_time = 5000, /* ns (5ms) */
  144. .coldrive_time = 1000, /* ns (1ms) */
  145. .keyup_test_interval = 50, /* ms (50ms) */
  146. };
  147. static struct resource bf54x_kpad_resources[] = {
  148. {
  149. .start = IRQ_KEY,
  150. .end = IRQ_KEY,
  151. .flags = IORESOURCE_IRQ,
  152. },
  153. };
  154. static struct platform_device bf54x_kpad_device = {
  155. .name = "bf54x-keys",
  156. .id = -1,
  157. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  158. .resource = bf54x_kpad_resources,
  159. .dev = {
  160. .platform_data = &bf54x_kpad_data,
  161. },
  162. };
  163. #endif
  164. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  165. #include <asm/bfin_rotary.h>
  166. static struct bfin_rotary_platform_data bfin_rotary_data = {
  167. /*.rotary_up_key = KEY_UP,*/
  168. /*.rotary_down_key = KEY_DOWN,*/
  169. .rotary_rel_code = REL_WHEEL,
  170. .rotary_button_key = KEY_ENTER,
  171. .debounce = 10, /* 0..17 */
  172. .mode = ROT_QUAD_ENC | ROT_DEBE,
  173. };
  174. static struct resource bfin_rotary_resources[] = {
  175. {
  176. .start = IRQ_CNT,
  177. .end = IRQ_CNT,
  178. .flags = IORESOURCE_IRQ,
  179. },
  180. };
  181. static struct platform_device bfin_rotary_device = {
  182. .name = "bfin-rotary",
  183. .id = -1,
  184. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  185. .resource = bfin_rotary_resources,
  186. .dev = {
  187. .platform_data = &bfin_rotary_data,
  188. },
  189. };
  190. #endif
  191. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  192. #include <linux/input.h>
  193. #include <linux/spi/adxl34x.h>
  194. static const struct adxl34x_platform_data adxl34x_info = {
  195. .x_axis_offset = 0,
  196. .y_axis_offset = 0,
  197. .z_axis_offset = 0,
  198. .tap_threshold = 0x31,
  199. .tap_duration = 0x10,
  200. .tap_latency = 0x60,
  201. .tap_window = 0xF0,
  202. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  203. .act_axis_control = 0xFF,
  204. .activity_threshold = 5,
  205. .inactivity_threshold = 3,
  206. .inactivity_time = 4,
  207. .free_fall_threshold = 0x7,
  208. .free_fall_time = 0x20,
  209. .data_rate = 0x8,
  210. .data_range = ADXL_FULL_RES,
  211. .ev_type = EV_ABS,
  212. .ev_code_x = ABS_X, /* EV_REL */
  213. .ev_code_y = ABS_Y, /* EV_REL */
  214. .ev_code_z = ABS_Z, /* EV_REL */
  215. .ev_code_tap_x = BTN_TOUCH, /* EV_KEY */
  216. .ev_code_tap_y = BTN_TOUCH, /* EV_KEY */
  217. .ev_code_tap_z = BTN_TOUCH, /* EV_KEY */
  218. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  219. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  220. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  221. .fifo_mode = ADXL_FIFO_STREAM,
  222. };
  223. #endif
  224. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  225. static struct platform_device rtc_device = {
  226. .name = "rtc-bfin",
  227. .id = -1,
  228. };
  229. #endif
  230. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  231. static struct resource bfin_uart_resources[] = {
  232. #ifdef CONFIG_SERIAL_BFIN_UART0
  233. {
  234. .start = 0xFFC00400,
  235. .end = 0xFFC004FF,
  236. .flags = IORESOURCE_MEM,
  237. },
  238. #endif
  239. #ifdef CONFIG_SERIAL_BFIN_UART1
  240. {
  241. .start = 0xFFC02000,
  242. .end = 0xFFC020FF,
  243. .flags = IORESOURCE_MEM,
  244. },
  245. #endif
  246. #ifdef CONFIG_SERIAL_BFIN_UART2
  247. {
  248. .start = 0xFFC02100,
  249. .end = 0xFFC021FF,
  250. .flags = IORESOURCE_MEM,
  251. },
  252. #endif
  253. #ifdef CONFIG_SERIAL_BFIN_UART3
  254. {
  255. .start = 0xFFC03100,
  256. .end = 0xFFC031FF,
  257. .flags = IORESOURCE_MEM,
  258. },
  259. #endif
  260. };
  261. static struct platform_device bfin_uart_device = {
  262. .name = "bfin-uart",
  263. .id = 1,
  264. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  265. .resource = bfin_uart_resources,
  266. };
  267. #endif
  268. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  269. #ifdef CONFIG_BFIN_SIR0
  270. static struct resource bfin_sir0_resources[] = {
  271. {
  272. .start = 0xFFC00400,
  273. .end = 0xFFC004FF,
  274. .flags = IORESOURCE_MEM,
  275. },
  276. {
  277. .start = IRQ_UART0_RX,
  278. .end = IRQ_UART0_RX+1,
  279. .flags = IORESOURCE_IRQ,
  280. },
  281. {
  282. .start = CH_UART0_RX,
  283. .end = CH_UART0_RX+1,
  284. .flags = IORESOURCE_DMA,
  285. },
  286. };
  287. static struct platform_device bfin_sir0_device = {
  288. .name = "bfin_sir",
  289. .id = 0,
  290. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  291. .resource = bfin_sir0_resources,
  292. };
  293. #endif
  294. #ifdef CONFIG_BFIN_SIR1
  295. static struct resource bfin_sir1_resources[] = {
  296. {
  297. .start = 0xFFC02000,
  298. .end = 0xFFC020FF,
  299. .flags = IORESOURCE_MEM,
  300. },
  301. {
  302. .start = IRQ_UART1_RX,
  303. .end = IRQ_UART1_RX+1,
  304. .flags = IORESOURCE_IRQ,
  305. },
  306. {
  307. .start = CH_UART1_RX,
  308. .end = CH_UART1_RX+1,
  309. .flags = IORESOURCE_DMA,
  310. },
  311. };
  312. static struct platform_device bfin_sir1_device = {
  313. .name = "bfin_sir",
  314. .id = 1,
  315. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  316. .resource = bfin_sir1_resources,
  317. };
  318. #endif
  319. #ifdef CONFIG_BFIN_SIR2
  320. static struct resource bfin_sir2_resources[] = {
  321. {
  322. .start = 0xFFC02100,
  323. .end = 0xFFC021FF,
  324. .flags = IORESOURCE_MEM,
  325. },
  326. {
  327. .start = IRQ_UART2_RX,
  328. .end = IRQ_UART2_RX+1,
  329. .flags = IORESOURCE_IRQ,
  330. },
  331. {
  332. .start = CH_UART2_RX,
  333. .end = CH_UART2_RX+1,
  334. .flags = IORESOURCE_DMA,
  335. },
  336. };
  337. static struct platform_device bfin_sir2_device = {
  338. .name = "bfin_sir",
  339. .id = 2,
  340. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  341. .resource = bfin_sir2_resources,
  342. };
  343. #endif
  344. #ifdef CONFIG_BFIN_SIR3
  345. static struct resource bfin_sir3_resources[] = {
  346. {
  347. .start = 0xFFC03100,
  348. .end = 0xFFC031FF,
  349. .flags = IORESOURCE_MEM,
  350. },
  351. {
  352. .start = IRQ_UART3_RX,
  353. .end = IRQ_UART3_RX+1,
  354. .flags = IORESOURCE_IRQ,
  355. },
  356. {
  357. .start = CH_UART3_RX,
  358. .end = CH_UART3_RX+1,
  359. .flags = IORESOURCE_DMA,
  360. },
  361. };
  362. static struct platform_device bfin_sir3_device = {
  363. .name = "bfin_sir",
  364. .id = 3,
  365. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  366. .resource = bfin_sir3_resources,
  367. };
  368. #endif
  369. #endif
  370. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  371. static struct resource smsc911x_resources[] = {
  372. {
  373. .name = "smsc911x-memory",
  374. .start = 0x24000000,
  375. .end = 0x24000000 + 0xFF,
  376. .flags = IORESOURCE_MEM,
  377. },
  378. {
  379. .start = IRQ_PE8,
  380. .end = IRQ_PE8,
  381. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  382. },
  383. };
  384. static struct platform_device smsc911x_device = {
  385. .name = "smsc911x",
  386. .id = 0,
  387. .num_resources = ARRAY_SIZE(smsc911x_resources),
  388. .resource = smsc911x_resources,
  389. };
  390. #endif
  391. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  392. static struct resource musb_resources[] = {
  393. [0] = {
  394. .start = 0xFFC03C00,
  395. .end = 0xFFC040FF,
  396. .flags = IORESOURCE_MEM,
  397. },
  398. [1] = { /* general IRQ */
  399. .start = IRQ_USB_INT0,
  400. .end = IRQ_USB_INT0,
  401. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  402. },
  403. [2] = { /* DMA IRQ */
  404. .start = IRQ_USB_DMA,
  405. .end = IRQ_USB_DMA,
  406. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  407. },
  408. };
  409. static struct musb_hdrc_config musb_config = {
  410. .multipoint = 0,
  411. .dyn_fifo = 0,
  412. .soft_con = 1,
  413. .dma = 1,
  414. .num_eps = 8,
  415. .dma_channels = 8,
  416. .gpio_vrsel = GPIO_PE7,
  417. };
  418. static struct musb_hdrc_platform_data musb_plat = {
  419. #if defined(CONFIG_USB_MUSB_OTG)
  420. .mode = MUSB_OTG,
  421. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  422. .mode = MUSB_HOST,
  423. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  424. .mode = MUSB_PERIPHERAL,
  425. #endif
  426. .config = &musb_config,
  427. };
  428. static u64 musb_dmamask = ~(u32)0;
  429. static struct platform_device musb_device = {
  430. .name = "musb_hdrc",
  431. .id = 0,
  432. .dev = {
  433. .dma_mask = &musb_dmamask,
  434. .coherent_dma_mask = 0xffffffff,
  435. .platform_data = &musb_plat,
  436. },
  437. .num_resources = ARRAY_SIZE(musb_resources),
  438. .resource = musb_resources,
  439. };
  440. #endif
  441. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  442. static struct resource bfin_atapi_resources[] = {
  443. {
  444. .start = 0xFFC03800,
  445. .end = 0xFFC0386F,
  446. .flags = IORESOURCE_MEM,
  447. },
  448. {
  449. .start = IRQ_ATAPI_ERR,
  450. .end = IRQ_ATAPI_ERR,
  451. .flags = IORESOURCE_IRQ,
  452. },
  453. };
  454. static struct platform_device bfin_atapi_device = {
  455. .name = "pata-bf54x",
  456. .id = -1,
  457. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  458. .resource = bfin_atapi_resources,
  459. };
  460. #endif
  461. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  462. static struct mtd_partition partition_info[] = {
  463. {
  464. .name = "linux kernel(nand)",
  465. .offset = 0,
  466. .size = 4 * 1024 * 1024,
  467. },
  468. {
  469. .name = "file system(nand)",
  470. .offset = MTDPART_OFS_APPEND,
  471. .size = MTDPART_SIZ_FULL,
  472. },
  473. };
  474. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  475. .page_size = NFC_PG_SIZE_256,
  476. .data_width = NFC_NWIDTH_8,
  477. .partitions = partition_info,
  478. .nr_partitions = ARRAY_SIZE(partition_info),
  479. .rd_dly = 3,
  480. .wr_dly = 3,
  481. };
  482. static struct resource bf5xx_nand_resources[] = {
  483. {
  484. .start = 0xFFC03B00,
  485. .end = 0xFFC03B4F,
  486. .flags = IORESOURCE_MEM,
  487. },
  488. {
  489. .start = CH_NFC,
  490. .end = CH_NFC,
  491. .flags = IORESOURCE_IRQ,
  492. },
  493. };
  494. static struct platform_device bf5xx_nand_device = {
  495. .name = "bf5xx-nand",
  496. .id = 0,
  497. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  498. .resource = bf5xx_nand_resources,
  499. .dev = {
  500. .platform_data = &bf5xx_nand_platform,
  501. },
  502. };
  503. #endif
  504. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  505. static struct bfin_sd_host bfin_sdh_data = {
  506. .dma_chan = CH_SDH,
  507. .irq_int0 = IRQ_SDH_MASK0,
  508. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  509. };
  510. static struct platform_device bf54x_sdh_device = {
  511. .name = "bfin-sdh",
  512. .id = 0,
  513. .dev = {
  514. .platform_data = &bfin_sdh_data,
  515. },
  516. };
  517. #endif
  518. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  519. static struct mtd_partition ezkit_partitions[] = {
  520. {
  521. .name = "bootloader(nor)",
  522. .size = 0x40000,
  523. .offset = 0,
  524. }, {
  525. .name = "linux kernel(nor)",
  526. .size = 0x400000,
  527. .offset = MTDPART_OFS_APPEND,
  528. }, {
  529. .name = "file system(nor)",
  530. .size = MTDPART_SIZ_FULL,
  531. .offset = MTDPART_OFS_APPEND,
  532. }
  533. };
  534. static struct physmap_flash_data ezkit_flash_data = {
  535. .width = 2,
  536. .parts = ezkit_partitions,
  537. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  538. };
  539. static struct resource ezkit_flash_resource = {
  540. .start = 0x20000000,
  541. .end = 0x21ffffff,
  542. .flags = IORESOURCE_MEM,
  543. };
  544. static struct platform_device ezkit_flash_device = {
  545. .name = "physmap-flash",
  546. .id = 0,
  547. .dev = {
  548. .platform_data = &ezkit_flash_data,
  549. },
  550. .num_resources = 1,
  551. .resource = &ezkit_flash_resource,
  552. };
  553. #endif
  554. #if defined(CONFIG_MTD_M25P80) \
  555. || defined(CONFIG_MTD_M25P80_MODULE)
  556. /* SPI flash chip (m25p16) */
  557. static struct mtd_partition bfin_spi_flash_partitions[] = {
  558. {
  559. .name = "bootloader(spi)",
  560. .size = 0x00040000,
  561. .offset = 0,
  562. .mask_flags = MTD_CAP_ROM
  563. }, {
  564. .name = "linux kernel(spi)",
  565. .size = MTDPART_SIZ_FULL,
  566. .offset = MTDPART_OFS_APPEND,
  567. }
  568. };
  569. static struct flash_platform_data bfin_spi_flash_data = {
  570. .name = "m25p80",
  571. .parts = bfin_spi_flash_partitions,
  572. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  573. .type = "m25p16",
  574. };
  575. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  576. .enable_dma = 0, /* use dma transfer with this chip*/
  577. .bits_per_word = 8,
  578. .cs_change_per_word = 0,
  579. };
  580. #endif
  581. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  582. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  583. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  584. .enable_dma = 0,
  585. .bits_per_word = 16,
  586. };
  587. #endif
  588. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  589. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  590. .cs_change_per_word = 0,
  591. .enable_dma = 0,
  592. .bits_per_word = 16,
  593. };
  594. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  595. .model = 7877,
  596. .vref_delay_usecs = 50, /* internal, no capacitor */
  597. .x_plate_ohms = 419,
  598. .y_plate_ohms = 486,
  599. .pressure_max = 1000,
  600. .pressure_min = 0,
  601. .stopacq_polarity = 1,
  602. .first_conversion_delay = 3,
  603. .acquisition_time = 1,
  604. .averaging = 1,
  605. .pen_down_acc_interval = 1,
  606. };
  607. #endif
  608. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  609. static struct bfin5xx_spi_chip spidev_chip_info = {
  610. .enable_dma = 0,
  611. .bits_per_word = 8,
  612. };
  613. #endif
  614. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  615. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  616. .enable_dma = 0, /* use dma transfer with this chip*/
  617. .bits_per_word = 8,
  618. .cs_change_per_word = 0,
  619. };
  620. #endif
  621. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  622. #if defined(CONFIG_MTD_M25P80) \
  623. || defined(CONFIG_MTD_M25P80_MODULE)
  624. {
  625. /* the modalias must be the same as spi device driver name */
  626. .modalias = "m25p80", /* Name of spi_driver for this device */
  627. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  628. .bus_num = 0, /* Framework bus number */
  629. .chip_select = 1, /* SPI_SSEL1*/
  630. .platform_data = &bfin_spi_flash_data,
  631. .controller_data = &spi_flash_chip_info,
  632. .mode = SPI_MODE_3,
  633. },
  634. #endif
  635. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  636. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  637. {
  638. .modalias = "ad1836-spi",
  639. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  640. .bus_num = 1,
  641. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  642. .controller_data = &ad1836_spi_chip_info,
  643. },
  644. #endif
  645. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  646. {
  647. .modalias = "ad7877",
  648. .platform_data = &bfin_ad7877_ts_info,
  649. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  650. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  651. .bus_num = 0,
  652. .chip_select = 2,
  653. .controller_data = &spi_ad7877_chip_info,
  654. },
  655. #endif
  656. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  657. {
  658. .modalias = "spidev",
  659. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  660. .bus_num = 0,
  661. .chip_select = 1,
  662. .controller_data = &spidev_chip_info,
  663. },
  664. #endif
  665. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  666. {
  667. .modalias = "adxl34x",
  668. .platform_data = &adxl34x_info,
  669. .irq = IRQ_PC5,
  670. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  671. .bus_num = 1,
  672. .chip_select = 2,
  673. .controller_data = &spi_adxl34x_chip_info,
  674. .mode = SPI_MODE_3,
  675. },
  676. #endif
  677. };
  678. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  679. /* SPI (0) */
  680. static struct resource bfin_spi0_resource[] = {
  681. [0] = {
  682. .start = SPI0_REGBASE,
  683. .end = SPI0_REGBASE + 0xFF,
  684. .flags = IORESOURCE_MEM,
  685. },
  686. [1] = {
  687. .start = CH_SPI0,
  688. .end = CH_SPI0,
  689. .flags = IORESOURCE_IRQ,
  690. }
  691. };
  692. /* SPI (1) */
  693. static struct resource bfin_spi1_resource[] = {
  694. [0] = {
  695. .start = SPI1_REGBASE,
  696. .end = SPI1_REGBASE + 0xFF,
  697. .flags = IORESOURCE_MEM,
  698. },
  699. [1] = {
  700. .start = CH_SPI1,
  701. .end = CH_SPI1,
  702. .flags = IORESOURCE_IRQ,
  703. }
  704. };
  705. /* SPI controller data */
  706. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  707. .num_chipselect = 8,
  708. .enable_dma = 1, /* master has the ability to do dma transfer */
  709. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  710. };
  711. static struct platform_device bf54x_spi_master0 = {
  712. .name = "bfin-spi",
  713. .id = 0, /* Bus number */
  714. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  715. .resource = bfin_spi0_resource,
  716. .dev = {
  717. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  718. },
  719. };
  720. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  721. .num_chipselect = 8,
  722. .enable_dma = 1, /* master has the ability to do dma transfer */
  723. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  724. };
  725. static struct platform_device bf54x_spi_master1 = {
  726. .name = "bfin-spi",
  727. .id = 1, /* Bus number */
  728. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  729. .resource = bfin_spi1_resource,
  730. .dev = {
  731. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  732. },
  733. };
  734. #endif /* spi master and devices */
  735. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  736. static struct resource bfin_twi0_resource[] = {
  737. [0] = {
  738. .start = TWI0_REGBASE,
  739. .end = TWI0_REGBASE + 0xFF,
  740. .flags = IORESOURCE_MEM,
  741. },
  742. [1] = {
  743. .start = IRQ_TWI0,
  744. .end = IRQ_TWI0,
  745. .flags = IORESOURCE_IRQ,
  746. },
  747. };
  748. static struct platform_device i2c_bfin_twi0_device = {
  749. .name = "i2c-bfin-twi",
  750. .id = 0,
  751. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  752. .resource = bfin_twi0_resource,
  753. };
  754. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  755. static struct resource bfin_twi1_resource[] = {
  756. [0] = {
  757. .start = TWI1_REGBASE,
  758. .end = TWI1_REGBASE + 0xFF,
  759. .flags = IORESOURCE_MEM,
  760. },
  761. [1] = {
  762. .start = IRQ_TWI1,
  763. .end = IRQ_TWI1,
  764. .flags = IORESOURCE_IRQ,
  765. },
  766. };
  767. static struct platform_device i2c_bfin_twi1_device = {
  768. .name = "i2c-bfin-twi",
  769. .id = 1,
  770. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  771. .resource = bfin_twi1_resource,
  772. };
  773. #endif
  774. #endif
  775. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  776. };
  777. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  778. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  779. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  780. {
  781. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  782. },
  783. #endif
  784. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  785. {
  786. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  787. .irq = 212,
  788. },
  789. #endif
  790. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  791. {
  792. I2C_BOARD_INFO("adxl34x", 0x53),
  793. .irq = IRQ_PC5,
  794. .platform_data = (void *)&adxl34x_info,
  795. },
  796. #endif
  797. };
  798. #endif
  799. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  800. #include <linux/gpio_keys.h>
  801. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  802. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  803. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  804. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  805. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  806. };
  807. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  808. .buttons = bfin_gpio_keys_table,
  809. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  810. };
  811. static struct platform_device bfin_device_gpiokeys = {
  812. .name = "gpio-keys",
  813. .dev = {
  814. .platform_data = &bfin_gpio_keys_data,
  815. },
  816. };
  817. #endif
  818. static struct resource bfin_gpios_resources = {
  819. .start = 0,
  820. .end = MAX_BLACKFIN_GPIOS - 1,
  821. .flags = IORESOURCE_IRQ,
  822. };
  823. static struct platform_device bfin_gpios_device = {
  824. .name = "simple-gpio",
  825. .id = -1,
  826. .num_resources = 1,
  827. .resource = &bfin_gpios_resources,
  828. };
  829. static const unsigned int cclk_vlev_datasheet[] =
  830. {
  831. /*
  832. * Internal VLEV BF54XSBBC1533
  833. ****temporarily using these values until data sheet is updated
  834. */
  835. VRPAIR(VLEV_085, 150000000),
  836. VRPAIR(VLEV_090, 250000000),
  837. VRPAIR(VLEV_110, 276000000),
  838. VRPAIR(VLEV_115, 301000000),
  839. VRPAIR(VLEV_120, 525000000),
  840. VRPAIR(VLEV_125, 550000000),
  841. VRPAIR(VLEV_130, 600000000),
  842. };
  843. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  844. .tuple_tab = cclk_vlev_datasheet,
  845. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  846. .vr_settling_time = 25 /* us */,
  847. };
  848. static struct platform_device bfin_dpmc = {
  849. .name = "bfin dpmc",
  850. .dev = {
  851. .platform_data = &bfin_dmpc_vreg_data,
  852. },
  853. };
  854. static struct platform_device *ezkit_devices[] __initdata = {
  855. &bfin_dpmc,
  856. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  857. &rtc_device,
  858. #endif
  859. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  860. &bfin_uart_device,
  861. #endif
  862. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  863. #ifdef CONFIG_BFIN_SIR0
  864. &bfin_sir0_device,
  865. #endif
  866. #ifdef CONFIG_BFIN_SIR1
  867. &bfin_sir1_device,
  868. #endif
  869. #ifdef CONFIG_BFIN_SIR2
  870. &bfin_sir2_device,
  871. #endif
  872. #ifdef CONFIG_BFIN_SIR3
  873. &bfin_sir3_device,
  874. #endif
  875. #endif
  876. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  877. &bf54x_lq043_device,
  878. #endif
  879. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  880. &smsc911x_device,
  881. #endif
  882. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  883. &musb_device,
  884. #endif
  885. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  886. &bfin_isp1760_device,
  887. #endif
  888. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  889. &bfin_atapi_device,
  890. #endif
  891. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  892. &bf5xx_nand_device,
  893. #endif
  894. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  895. &bf54x_sdh_device,
  896. #endif
  897. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  898. &bf54x_spi_master0,
  899. &bf54x_spi_master1,
  900. #endif
  901. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  902. &bf54x_kpad_device,
  903. #endif
  904. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  905. &bfin_rotary_device,
  906. #endif
  907. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  908. &i2c_bfin_twi0_device,
  909. #if !defined(CONFIG_BF542)
  910. &i2c_bfin_twi1_device,
  911. #endif
  912. #endif
  913. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  914. &bfin_device_gpiokeys,
  915. #endif
  916. &bfin_gpios_device,
  917. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  918. &ezkit_flash_device,
  919. #endif
  920. };
  921. static int __init ezkit_init(void)
  922. {
  923. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  924. i2c_register_board_info(0, bfin_i2c_board_info0,
  925. ARRAY_SIZE(bfin_i2c_board_info0));
  926. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  927. i2c_register_board_info(1, bfin_i2c_board_info1,
  928. ARRAY_SIZE(bfin_i2c_board_info1));
  929. #endif
  930. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  931. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  932. return 0;
  933. }
  934. arch_initcall(ezkit_init);