ezkit.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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 = 0x1C0000,
  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_SND_BLACKFIN_AD1836) \
  372. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  373. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  374. .enable_dma = 0,
  375. .bits_per_word = 16,
  376. };
  377. #endif
  378. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  379. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  380. .cs_change_per_word = 0,
  381. .enable_dma = 0,
  382. .bits_per_word = 16,
  383. };
  384. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  385. .model = 7877,
  386. .vref_delay_usecs = 50, /* internal, no capacitor */
  387. .x_plate_ohms = 419,
  388. .y_plate_ohms = 486,
  389. .pressure_max = 1000,
  390. .pressure_min = 0,
  391. .stopacq_polarity = 1,
  392. .first_conversion_delay = 3,
  393. .acquisition_time = 1,
  394. .averaging = 1,
  395. .pen_down_acc_interval = 1,
  396. };
  397. #endif
  398. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  399. static struct bfin5xx_spi_chip spidev_chip_info = {
  400. .enable_dma = 0,
  401. .bits_per_word = 8,
  402. };
  403. #endif
  404. static struct spi_board_info bf54x_spi_board_info[] __initdata = {
  405. #if defined(CONFIG_MTD_M25P80) \
  406. || defined(CONFIG_MTD_M25P80_MODULE)
  407. {
  408. /* the modalias must be the same as spi device driver name */
  409. .modalias = "m25p80", /* Name of spi_driver for this device */
  410. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  411. .bus_num = 0, /* Framework bus number */
  412. .chip_select = 1, /* SPI_SSEL1*/
  413. .platform_data = &bfin_spi_flash_data,
  414. .controller_data = &spi_flash_chip_info,
  415. .mode = SPI_MODE_3,
  416. },
  417. #endif
  418. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  419. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  420. {
  421. .modalias = "ad1836-spi",
  422. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  423. .bus_num = 1,
  424. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  425. .controller_data = &ad1836_spi_chip_info,
  426. },
  427. #endif
  428. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  429. {
  430. .modalias = "ad7877",
  431. .platform_data = &bfin_ad7877_ts_info,
  432. .irq = IRQ_PJ11,
  433. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  434. .bus_num = 0,
  435. .chip_select = 2,
  436. .controller_data = &spi_ad7877_chip_info,
  437. },
  438. #endif
  439. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  440. {
  441. .modalias = "spidev",
  442. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  443. .bus_num = 0,
  444. .chip_select = 1,
  445. .controller_data = &spidev_chip_info,
  446. },
  447. #endif
  448. };
  449. /* SPI (0) */
  450. static struct resource bfin_spi0_resource[] = {
  451. [0] = {
  452. .start = SPI0_REGBASE,
  453. .end = SPI0_REGBASE + 0xFF,
  454. .flags = IORESOURCE_MEM,
  455. },
  456. [1] = {
  457. .start = CH_SPI0,
  458. .end = CH_SPI0,
  459. .flags = IORESOURCE_IRQ,
  460. }
  461. };
  462. /* SPI (1) */
  463. static struct resource bfin_spi1_resource[] = {
  464. [0] = {
  465. .start = SPI1_REGBASE,
  466. .end = SPI1_REGBASE + 0xFF,
  467. .flags = IORESOURCE_MEM,
  468. },
  469. [1] = {
  470. .start = CH_SPI1,
  471. .end = CH_SPI1,
  472. .flags = IORESOURCE_IRQ,
  473. }
  474. };
  475. /* SPI controller data */
  476. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  477. .num_chipselect = 8,
  478. .enable_dma = 1, /* master has the ability to do dma transfer */
  479. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  480. };
  481. static struct platform_device bf54x_spi_master0 = {
  482. .name = "bfin-spi",
  483. .id = 0, /* Bus number */
  484. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  485. .resource = bfin_spi0_resource,
  486. .dev = {
  487. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  488. },
  489. };
  490. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  491. .num_chipselect = 8,
  492. .enable_dma = 1, /* master has the ability to do dma transfer */
  493. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  494. };
  495. static struct platform_device bf54x_spi_master1 = {
  496. .name = "bfin-spi",
  497. .id = 1, /* Bus number */
  498. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  499. .resource = bfin_spi1_resource,
  500. .dev = {
  501. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  502. },
  503. };
  504. #endif /* spi master and devices */
  505. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  506. static struct resource bfin_twi0_resource[] = {
  507. [0] = {
  508. .start = TWI0_REGBASE,
  509. .end = TWI0_REGBASE + 0xFF,
  510. .flags = IORESOURCE_MEM,
  511. },
  512. [1] = {
  513. .start = IRQ_TWI0,
  514. .end = IRQ_TWI0,
  515. .flags = IORESOURCE_IRQ,
  516. },
  517. };
  518. static struct platform_device i2c_bfin_twi0_device = {
  519. .name = "i2c-bfin-twi",
  520. .id = 0,
  521. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  522. .resource = bfin_twi0_resource,
  523. };
  524. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  525. static struct resource bfin_twi1_resource[] = {
  526. [0] = {
  527. .start = TWI1_REGBASE,
  528. .end = TWI1_REGBASE + 0xFF,
  529. .flags = IORESOURCE_MEM,
  530. },
  531. [1] = {
  532. .start = IRQ_TWI1,
  533. .end = IRQ_TWI1,
  534. .flags = IORESOURCE_IRQ,
  535. },
  536. };
  537. static struct platform_device i2c_bfin_twi1_device = {
  538. .name = "i2c-bfin-twi",
  539. .id = 1,
  540. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  541. .resource = bfin_twi1_resource,
  542. };
  543. #endif
  544. #endif
  545. #ifdef CONFIG_I2C_BOARDINFO
  546. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  547. };
  548. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  549. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  550. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  551. {
  552. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  553. .type = "pcf8574_lcd",
  554. },
  555. #endif
  556. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  557. {
  558. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  559. .type = "pcf8574_keypad",
  560. .irq = 212,
  561. },
  562. #endif
  563. };
  564. #endif
  565. #endif
  566. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  567. #include <linux/gpio_keys.h>
  568. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  569. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  570. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  571. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  572. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  573. };
  574. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  575. .buttons = bfin_gpio_keys_table,
  576. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  577. };
  578. static struct platform_device bfin_device_gpiokeys = {
  579. .name = "gpio-keys",
  580. .dev = {
  581. .platform_data = &bfin_gpio_keys_data,
  582. },
  583. };
  584. #endif
  585. static struct resource bfin_gpios_resources = {
  586. .start = 0,
  587. .end = MAX_BLACKFIN_GPIOS - 1,
  588. .flags = IORESOURCE_IRQ,
  589. };
  590. static struct platform_device bfin_gpios_device = {
  591. .name = "simple-gpio",
  592. .id = -1,
  593. .num_resources = 1,
  594. .resource = &bfin_gpios_resources,
  595. };
  596. static struct platform_device *ezkit_devices[] __initdata = {
  597. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  598. &rtc_device,
  599. #endif
  600. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  601. &bfin_uart_device,
  602. #endif
  603. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  604. &bf54x_lq043_device,
  605. #endif
  606. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  607. &smsc911x_device,
  608. #endif
  609. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  610. &musb_device,
  611. #endif
  612. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  613. &bfin_atapi_device,
  614. #endif
  615. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  616. &bf5xx_nand_device,
  617. #endif
  618. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  619. &bf54x_sdh_device,
  620. #endif
  621. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  622. &bf54x_spi_master0,
  623. &bf54x_spi_master1,
  624. #endif
  625. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  626. &bf54x_kpad_device,
  627. #endif
  628. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  629. &i2c_bfin_twi0_device,
  630. #if !defined(CONFIG_BF542)
  631. &i2c_bfin_twi1_device,
  632. #endif
  633. #endif
  634. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  635. &bfin_device_gpiokeys,
  636. #endif
  637. &bfin_gpios_device,
  638. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  639. &ezkit_flash_device,
  640. #endif
  641. };
  642. static int __init ezkit_init(void)
  643. {
  644. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  645. #ifdef CONFIG_I2C_BOARDINFO
  646. i2c_register_board_info(0, bfin_i2c_board_info0,
  647. ARRAY_SIZE(bfin_i2c_board_info0));
  648. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  649. i2c_register_board_info(1, bfin_i2c_board_info1,
  650. ARRAY_SIZE(bfin_i2c_board_info1));
  651. #endif
  652. #endif
  653. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  654. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  655. spi_register_board_info(bf54x_spi_board_info,
  656. ARRAY_SIZE(bf54x_spi_board_info));
  657. #endif
  658. return 0;
  659. }
  660. arch_initcall(ezkit_init);