ezkit.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  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. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  41. #include <linux/usb/musb.h>
  42. #endif
  43. #include <asm/bfin5xx_spi.h>
  44. #include <asm/cplb.h>
  45. #include <asm/dma.h>
  46. #include <asm/gpio.h>
  47. #include <asm/nand.h>
  48. #include <asm/portmux.h>
  49. #include <asm/mach/bf54x_keys.h>
  50. #include <linux/input.h>
  51. #include <linux/spi/ad7877.h>
  52. /*
  53. * Name the Board for the /proc/cpuinfo
  54. */
  55. const char bfin_board_name[] = "ADSP-BF548-EZKIT";
  56. /*
  57. * Driver needs to know address, irq and flag pin.
  58. */
  59. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  60. #include <asm/mach/bf54x-lq043.h>
  61. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  62. .width = 480,
  63. .height = 272,
  64. .xres = {480, 480, 480},
  65. .yres = {272, 272, 272},
  66. .bpp = {24, 24, 24},
  67. .disp = GPIO_PE3,
  68. };
  69. static struct resource bf54x_lq043_resources[] = {
  70. {
  71. .start = IRQ_EPPI0_ERR,
  72. .end = IRQ_EPPI0_ERR,
  73. .flags = IORESOURCE_IRQ,
  74. },
  75. };
  76. static struct platform_device bf54x_lq043_device = {
  77. .name = "bf54x-lq043",
  78. .id = -1,
  79. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  80. .resource = bf54x_lq043_resources,
  81. .dev = {
  82. .platform_data = &bf54x_lq043_data,
  83. },
  84. };
  85. #endif
  86. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  87. static const unsigned int bf548_keymap[] = {
  88. KEYVAL(0, 0, KEY_ENTER),
  89. KEYVAL(0, 1, KEY_HELP),
  90. KEYVAL(0, 2, KEY_0),
  91. KEYVAL(0, 3, KEY_BACKSPACE),
  92. KEYVAL(1, 0, KEY_TAB),
  93. KEYVAL(1, 1, KEY_9),
  94. KEYVAL(1, 2, KEY_8),
  95. KEYVAL(1, 3, KEY_7),
  96. KEYVAL(2, 0, KEY_DOWN),
  97. KEYVAL(2, 1, KEY_6),
  98. KEYVAL(2, 2, KEY_5),
  99. KEYVAL(2, 3, KEY_4),
  100. KEYVAL(3, 0, KEY_UP),
  101. KEYVAL(3, 1, KEY_3),
  102. KEYVAL(3, 2, KEY_2),
  103. KEYVAL(3, 3, KEY_1),
  104. };
  105. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  106. .rows = 4,
  107. .cols = 4,
  108. .keymap = bf548_keymap,
  109. .keymapsize = ARRAY_SIZE(bf548_keymap),
  110. .repeat = 0,
  111. .debounce_time = 5000, /* ns (5ms) */
  112. .coldrive_time = 1000, /* ns (1ms) */
  113. .keyup_test_interval = 50, /* ms (50ms) */
  114. };
  115. static struct resource bf54x_kpad_resources[] = {
  116. {
  117. .start = IRQ_KEY,
  118. .end = IRQ_KEY,
  119. .flags = IORESOURCE_IRQ,
  120. },
  121. };
  122. static struct platform_device bf54x_kpad_device = {
  123. .name = "bf54x-keys",
  124. .id = -1,
  125. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  126. .resource = bf54x_kpad_resources,
  127. .dev = {
  128. .platform_data = &bf54x_kpad_data,
  129. },
  130. };
  131. #endif
  132. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  133. static struct platform_device rtc_device = {
  134. .name = "rtc-bfin",
  135. .id = -1,
  136. };
  137. #endif
  138. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  139. static struct resource bfin_uart_resources[] = {
  140. #ifdef CONFIG_SERIAL_BFIN_UART0
  141. {
  142. .start = 0xFFC00400,
  143. .end = 0xFFC004FF,
  144. .flags = IORESOURCE_MEM,
  145. },
  146. #endif
  147. #ifdef CONFIG_SERIAL_BFIN_UART1
  148. {
  149. .start = 0xFFC02000,
  150. .end = 0xFFC020FF,
  151. .flags = IORESOURCE_MEM,
  152. },
  153. #endif
  154. #ifdef CONFIG_SERIAL_BFIN_UART2
  155. {
  156. .start = 0xFFC02100,
  157. .end = 0xFFC021FF,
  158. .flags = IORESOURCE_MEM,
  159. },
  160. #endif
  161. #ifdef CONFIG_SERIAL_BFIN_UART3
  162. {
  163. .start = 0xFFC03100,
  164. .end = 0xFFC031FF,
  165. },
  166. #endif
  167. };
  168. static struct platform_device bfin_uart_device = {
  169. .name = "bfin-uart",
  170. .id = 1,
  171. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  172. .resource = bfin_uart_resources,
  173. };
  174. #endif
  175. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  176. static struct resource smsc911x_resources[] = {
  177. {
  178. .name = "smsc911x-memory",
  179. .start = 0x24000000,
  180. .end = 0x24000000 + 0xFF,
  181. .flags = IORESOURCE_MEM,
  182. },
  183. {
  184. .start = IRQ_PE8,
  185. .end = IRQ_PE8,
  186. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  187. },
  188. };
  189. static struct platform_device smsc911x_device = {
  190. .name = "smsc911x",
  191. .id = 0,
  192. .num_resources = ARRAY_SIZE(smsc911x_resources),
  193. .resource = smsc911x_resources,
  194. };
  195. #endif
  196. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  197. static struct resource musb_resources[] = {
  198. [0] = {
  199. .start = 0xFFC03C00,
  200. .end = 0xFFC040FF,
  201. .flags = IORESOURCE_MEM,
  202. },
  203. [1] = { /* general IRQ */
  204. .start = IRQ_USB_INT0,
  205. .end = IRQ_USB_INT0,
  206. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  207. },
  208. [2] = { /* DMA IRQ */
  209. .start = IRQ_USB_DMA,
  210. .end = IRQ_USB_DMA,
  211. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  212. },
  213. };
  214. static struct musb_hdrc_platform_data musb_plat = {
  215. #if defined(CONFIG_USB_MUSB_OTG)
  216. .mode = MUSB_OTG,
  217. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  218. .mode = MUSB_HOST,
  219. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  220. .mode = MUSB_PERIPHERAL,
  221. #endif
  222. .multipoint = 0,
  223. };
  224. static u64 musb_dmamask = ~(u32)0;
  225. static struct platform_device musb_device = {
  226. .name = "musb_hdrc",
  227. .id = 0,
  228. .dev = {
  229. .dma_mask = &musb_dmamask,
  230. .coherent_dma_mask = 0xffffffff,
  231. .platform_data = &musb_plat,
  232. },
  233. .num_resources = ARRAY_SIZE(musb_resources),
  234. .resource = musb_resources,
  235. };
  236. #endif
  237. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  238. static struct resource bfin_atapi_resources[] = {
  239. {
  240. .start = 0xFFC03800,
  241. .end = 0xFFC0386F,
  242. .flags = IORESOURCE_MEM,
  243. },
  244. {
  245. .start = IRQ_ATAPI_ERR,
  246. .end = IRQ_ATAPI_ERR,
  247. .flags = IORESOURCE_IRQ,
  248. },
  249. };
  250. static struct platform_device bfin_atapi_device = {
  251. .name = "pata-bf54x",
  252. .id = -1,
  253. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  254. .resource = bfin_atapi_resources,
  255. };
  256. #endif
  257. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  258. static struct mtd_partition partition_info[] = {
  259. {
  260. .name = "Linux Kernel",
  261. .offset = 0,
  262. .size = 4 * SIZE_1M,
  263. },
  264. {
  265. .name = "File System",
  266. .offset = MTDPART_OFS_APPEND,
  267. .size = MTDPART_SIZ_FULL,
  268. },
  269. };
  270. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  271. .page_size = NFC_PG_SIZE_256,
  272. .data_width = NFC_NWIDTH_8,
  273. .partitions = partition_info,
  274. .nr_partitions = ARRAY_SIZE(partition_info),
  275. .rd_dly = 3,
  276. .wr_dly = 3,
  277. };
  278. static struct resource bf5xx_nand_resources[] = {
  279. {
  280. .start = 0xFFC03B00,
  281. .end = 0xFFC03B4F,
  282. .flags = IORESOURCE_MEM,
  283. },
  284. {
  285. .start = CH_NFC,
  286. .end = CH_NFC,
  287. .flags = IORESOURCE_IRQ,
  288. },
  289. };
  290. static struct platform_device bf5xx_nand_device = {
  291. .name = "bf5xx-nand",
  292. .id = 0,
  293. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  294. .resource = bf5xx_nand_resources,
  295. .dev = {
  296. .platform_data = &bf5xx_nand_platform,
  297. },
  298. };
  299. #endif
  300. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  301. static struct platform_device bf54x_sdh_device = {
  302. .name = "bfin-sdh",
  303. .id = 0,
  304. };
  305. #endif
  306. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  307. static struct mtd_partition ezkit_partitions[] = {
  308. {
  309. .name = "Bootloader",
  310. .size = 0x40000,
  311. .offset = 0,
  312. }, {
  313. .name = "Kernel",
  314. .size = 0xE0000,
  315. .offset = MTDPART_OFS_APPEND,
  316. }, {
  317. .name = "RootFS",
  318. .size = MTDPART_SIZ_FULL,
  319. .offset = MTDPART_OFS_APPEND,
  320. }
  321. };
  322. static struct physmap_flash_data ezkit_flash_data = {
  323. .width = 2,
  324. .parts = ezkit_partitions,
  325. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  326. };
  327. static struct resource ezkit_flash_resource = {
  328. .start = 0x20000000,
  329. .end = 0x20ffffff,
  330. .flags = IORESOURCE_MEM,
  331. };
  332. static struct platform_device ezkit_flash_device = {
  333. .name = "physmap-flash",
  334. .id = 0,
  335. .dev = {
  336. .platform_data = &ezkit_flash_data,
  337. },
  338. .num_resources = 1,
  339. .resource = &ezkit_flash_resource,
  340. };
  341. #endif
  342. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  343. /* all SPI peripherals info goes here */
  344. #if defined(CONFIG_MTD_M25P80) \
  345. || defined(CONFIG_MTD_M25P80_MODULE)
  346. /* SPI flash chip (m25p16) */
  347. static struct mtd_partition bfin_spi_flash_partitions[] = {
  348. {
  349. .name = "bootloader",
  350. .size = 0x00040000,
  351. .offset = 0,
  352. .mask_flags = MTD_CAP_ROM
  353. }, {
  354. .name = "linux kernel",
  355. .size = MTDPART_SIZ_FULL,
  356. .offset = MTDPART_OFS_APPEND,
  357. }
  358. };
  359. static struct flash_platform_data bfin_spi_flash_data = {
  360. .name = "m25p80",
  361. .parts = bfin_spi_flash_partitions,
  362. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  363. .type = "m25p16",
  364. };
  365. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  366. .enable_dma = 0, /* use dma transfer with this chip*/
  367. .bits_per_word = 8,
  368. .cs_change_per_word = 0,
  369. };
  370. #endif
  371. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  372. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  373. .cs_change_per_word = 0,
  374. .enable_dma = 0,
  375. .bits_per_word = 16,
  376. };
  377. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  378. .model = 7877,
  379. .vref_delay_usecs = 50, /* internal, no capacitor */
  380. .x_plate_ohms = 419,
  381. .y_plate_ohms = 486,
  382. .pressure_max = 1000,
  383. .pressure_min = 0,
  384. .stopacq_polarity = 1,
  385. .first_conversion_delay = 3,
  386. .acquisition_time = 1,
  387. .averaging = 1,
  388. .pen_down_acc_interval = 1,
  389. };
  390. #endif
  391. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  392. static struct bfin5xx_spi_chip spidev_chip_info = {
  393. .enable_dma = 0,
  394. .bits_per_word = 8,
  395. };
  396. #endif
  397. static struct spi_board_info bf54x_spi_board_info[] __initdata = {
  398. #if defined(CONFIG_MTD_M25P80) \
  399. || defined(CONFIG_MTD_M25P80_MODULE)
  400. {
  401. /* the modalias must be the same as spi device driver name */
  402. .modalias = "m25p80", /* Name of spi_driver for this device */
  403. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  404. .bus_num = 0, /* Framework bus number */
  405. .chip_select = 1, /* SPI_SSEL1*/
  406. .platform_data = &bfin_spi_flash_data,
  407. .controller_data = &spi_flash_chip_info,
  408. .mode = SPI_MODE_3,
  409. },
  410. #endif
  411. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  412. {
  413. .modalias = "ad7877",
  414. .platform_data = &bfin_ad7877_ts_info,
  415. .irq = IRQ_PJ11,
  416. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  417. .bus_num = 0,
  418. .chip_select = 2,
  419. .controller_data = &spi_ad7877_chip_info,
  420. },
  421. #endif
  422. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  423. {
  424. .modalias = "spidev",
  425. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  426. .bus_num = 0,
  427. .chip_select = 1,
  428. .controller_data = &spidev_chip_info,
  429. },
  430. #endif
  431. };
  432. /* SPI (0) */
  433. static struct resource bfin_spi0_resource[] = {
  434. [0] = {
  435. .start = SPI0_REGBASE,
  436. .end = SPI0_REGBASE + 0xFF,
  437. .flags = IORESOURCE_MEM,
  438. },
  439. [1] = {
  440. .start = CH_SPI0,
  441. .end = CH_SPI0,
  442. .flags = IORESOURCE_IRQ,
  443. }
  444. };
  445. /* SPI (1) */
  446. static struct resource bfin_spi1_resource[] = {
  447. [0] = {
  448. .start = SPI1_REGBASE,
  449. .end = SPI1_REGBASE + 0xFF,
  450. .flags = IORESOURCE_MEM,
  451. },
  452. [1] = {
  453. .start = CH_SPI1,
  454. .end = CH_SPI1,
  455. .flags = IORESOURCE_IRQ,
  456. }
  457. };
  458. /* SPI controller data */
  459. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  460. .num_chipselect = 8,
  461. .enable_dma = 1, /* master has the ability to do dma transfer */
  462. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  463. };
  464. static struct platform_device bf54x_spi_master0 = {
  465. .name = "bfin-spi",
  466. .id = 0, /* Bus number */
  467. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  468. .resource = bfin_spi0_resource,
  469. .dev = {
  470. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  471. },
  472. };
  473. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  474. .num_chipselect = 8,
  475. .enable_dma = 1, /* master has the ability to do dma transfer */
  476. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  477. };
  478. static struct platform_device bf54x_spi_master1 = {
  479. .name = "bfin-spi",
  480. .id = 1, /* Bus number */
  481. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  482. .resource = bfin_spi1_resource,
  483. .dev = {
  484. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  485. },
  486. };
  487. #endif /* spi master and devices */
  488. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  489. static struct resource bfin_twi0_resource[] = {
  490. [0] = {
  491. .start = TWI0_REGBASE,
  492. .end = TWI0_REGBASE + 0xFF,
  493. .flags = IORESOURCE_MEM,
  494. },
  495. [1] = {
  496. .start = IRQ_TWI0,
  497. .end = IRQ_TWI0,
  498. .flags = IORESOURCE_IRQ,
  499. },
  500. };
  501. static struct platform_device i2c_bfin_twi0_device = {
  502. .name = "i2c-bfin-twi",
  503. .id = 0,
  504. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  505. .resource = bfin_twi0_resource,
  506. };
  507. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  508. static struct resource bfin_twi1_resource[] = {
  509. [0] = {
  510. .start = TWI1_REGBASE,
  511. .end = TWI1_REGBASE + 0xFF,
  512. .flags = IORESOURCE_MEM,
  513. },
  514. [1] = {
  515. .start = IRQ_TWI1,
  516. .end = IRQ_TWI1,
  517. .flags = IORESOURCE_IRQ,
  518. },
  519. };
  520. static struct platform_device i2c_bfin_twi1_device = {
  521. .name = "i2c-bfin-twi",
  522. .id = 1,
  523. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  524. .resource = bfin_twi1_resource,
  525. };
  526. #endif
  527. #endif
  528. #ifdef CONFIG_I2C_BOARDINFO
  529. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  530. };
  531. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  532. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  533. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  534. {
  535. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  536. .type = "pcf8574_lcd",
  537. },
  538. #endif
  539. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  540. {
  541. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  542. .type = "pcf8574_keypad",
  543. .irq = 212,
  544. },
  545. #endif
  546. };
  547. #endif
  548. #endif
  549. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  550. #include <linux/gpio_keys.h>
  551. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  552. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  553. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  554. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  555. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  556. };
  557. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  558. .buttons = bfin_gpio_keys_table,
  559. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  560. };
  561. static struct platform_device bfin_device_gpiokeys = {
  562. .name = "gpio-keys",
  563. .dev = {
  564. .platform_data = &bfin_gpio_keys_data,
  565. },
  566. };
  567. #endif
  568. static struct resource bfin_gpios_resources = {
  569. .start = 0,
  570. .end = MAX_BLACKFIN_GPIOS - 1,
  571. .flags = IORESOURCE_IRQ,
  572. };
  573. static struct platform_device bfin_gpios_device = {
  574. .name = "simple-gpio",
  575. .id = -1,
  576. .num_resources = 1,
  577. .resource = &bfin_gpios_resources,
  578. };
  579. static struct platform_device *ezkit_devices[] __initdata = {
  580. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  581. &rtc_device,
  582. #endif
  583. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  584. &bfin_uart_device,
  585. #endif
  586. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  587. &bf54x_lq043_device,
  588. #endif
  589. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  590. &smsc911x_device,
  591. #endif
  592. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  593. &musb_device,
  594. #endif
  595. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  596. &bfin_atapi_device,
  597. #endif
  598. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  599. &bf5xx_nand_device,
  600. #endif
  601. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  602. &bf54x_sdh_device,
  603. #endif
  604. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  605. &bf54x_spi_master0,
  606. &bf54x_spi_master1,
  607. #endif
  608. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  609. &bf54x_kpad_device,
  610. #endif
  611. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  612. &i2c_bfin_twi0_device,
  613. #if !defined(CONFIG_BF542)
  614. &i2c_bfin_twi1_device,
  615. #endif
  616. #endif
  617. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  618. &bfin_device_gpiokeys,
  619. #endif
  620. &bfin_gpios_device,
  621. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  622. &ezkit_flash_device,
  623. #endif
  624. };
  625. static int __init ezkit_init(void)
  626. {
  627. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  628. #ifdef CONFIG_I2C_BOARDINFO
  629. i2c_register_board_info(0, bfin_i2c_board_info0,
  630. ARRAY_SIZE(bfin_i2c_board_info0));
  631. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  632. i2c_register_board_info(1, bfin_i2c_board_info1,
  633. ARRAY_SIZE(bfin_i2c_board_info1));
  634. #endif
  635. #endif
  636. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  637. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  638. spi_register_board_info(bf54x_spi_board_info,
  639. ARRAY_SIZE(bf54x_spi_board_info));
  640. #endif
  641. return 0;
  642. }
  643. arch_initcall(ezkit_init);