ezkit.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  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_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  176. static struct resource bfin_sir_resources[] = {
  177. #ifdef CONFIG_BFIN_SIR0
  178. {
  179. .start = 0xFFC00400,
  180. .end = 0xFFC004FF,
  181. .flags = IORESOURCE_MEM,
  182. },
  183. #endif
  184. #ifdef CONFIG_BFIN_SIR1
  185. {
  186. .start = 0xFFC02000,
  187. .end = 0xFFC020FF,
  188. .flags = IORESOURCE_MEM,
  189. },
  190. #endif
  191. #ifdef CONFIG_BFIN_SIR2
  192. {
  193. .start = 0xFFC02100,
  194. .end = 0xFFC021FF,
  195. .flags = IORESOURCE_MEM,
  196. },
  197. #endif
  198. #ifdef CONFIG_BFIN_SIR3
  199. {
  200. .start = 0xFFC03100,
  201. .end = 0xFFC031FF,
  202. .flags = IORESOURCE_MEM,
  203. },
  204. #endif
  205. };
  206. static struct platform_device bfin_sir_device = {
  207. .name = "bfin_sir",
  208. .id = 0,
  209. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  210. .resource = bfin_sir_resources,
  211. };
  212. #endif
  213. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  214. static struct resource smsc911x_resources[] = {
  215. {
  216. .name = "smsc911x-memory",
  217. .start = 0x24000000,
  218. .end = 0x24000000 + 0xFF,
  219. .flags = IORESOURCE_MEM,
  220. },
  221. {
  222. .start = IRQ_PE8,
  223. .end = IRQ_PE8,
  224. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  225. },
  226. };
  227. static struct platform_device smsc911x_device = {
  228. .name = "smsc911x",
  229. .id = 0,
  230. .num_resources = ARRAY_SIZE(smsc911x_resources),
  231. .resource = smsc911x_resources,
  232. };
  233. #endif
  234. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  235. static struct resource musb_resources[] = {
  236. [0] = {
  237. .start = 0xFFC03C00,
  238. .end = 0xFFC040FF,
  239. .flags = IORESOURCE_MEM,
  240. },
  241. [1] = { /* general IRQ */
  242. .start = IRQ_USB_INT0,
  243. .end = IRQ_USB_INT0,
  244. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  245. },
  246. [2] = { /* DMA IRQ */
  247. .start = IRQ_USB_DMA,
  248. .end = IRQ_USB_DMA,
  249. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  250. },
  251. };
  252. static struct musb_hdrc_platform_data musb_plat = {
  253. #if defined(CONFIG_USB_MUSB_OTG)
  254. .mode = MUSB_OTG,
  255. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  256. .mode = MUSB_HOST,
  257. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  258. .mode = MUSB_PERIPHERAL,
  259. #endif
  260. .multipoint = 0,
  261. };
  262. static u64 musb_dmamask = ~(u32)0;
  263. static struct platform_device musb_device = {
  264. .name = "musb_hdrc",
  265. .id = 0,
  266. .dev = {
  267. .dma_mask = &musb_dmamask,
  268. .coherent_dma_mask = 0xffffffff,
  269. .platform_data = &musb_plat,
  270. },
  271. .num_resources = ARRAY_SIZE(musb_resources),
  272. .resource = musb_resources,
  273. };
  274. #endif
  275. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  276. static struct resource bfin_atapi_resources[] = {
  277. {
  278. .start = 0xFFC03800,
  279. .end = 0xFFC0386F,
  280. .flags = IORESOURCE_MEM,
  281. },
  282. {
  283. .start = IRQ_ATAPI_ERR,
  284. .end = IRQ_ATAPI_ERR,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. };
  288. static struct platform_device bfin_atapi_device = {
  289. .name = "pata-bf54x",
  290. .id = -1,
  291. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  292. .resource = bfin_atapi_resources,
  293. };
  294. #endif
  295. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  296. static struct mtd_partition partition_info[] = {
  297. {
  298. .name = "Linux Kernel",
  299. .offset = 0,
  300. .size = 4 * SIZE_1M,
  301. },
  302. {
  303. .name = "File System",
  304. .offset = MTDPART_OFS_APPEND,
  305. .size = MTDPART_SIZ_FULL,
  306. },
  307. };
  308. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  309. .page_size = NFC_PG_SIZE_256,
  310. .data_width = NFC_NWIDTH_8,
  311. .partitions = partition_info,
  312. .nr_partitions = ARRAY_SIZE(partition_info),
  313. .rd_dly = 3,
  314. .wr_dly = 3,
  315. };
  316. static struct resource bf5xx_nand_resources[] = {
  317. {
  318. .start = 0xFFC03B00,
  319. .end = 0xFFC03B4F,
  320. .flags = IORESOURCE_MEM,
  321. },
  322. {
  323. .start = CH_NFC,
  324. .end = CH_NFC,
  325. .flags = IORESOURCE_IRQ,
  326. },
  327. };
  328. static struct platform_device bf5xx_nand_device = {
  329. .name = "bf5xx-nand",
  330. .id = 0,
  331. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  332. .resource = bf5xx_nand_resources,
  333. .dev = {
  334. .platform_data = &bf5xx_nand_platform,
  335. },
  336. };
  337. #endif
  338. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  339. static struct platform_device bf54x_sdh_device = {
  340. .name = "bfin-sdh",
  341. .id = 0,
  342. };
  343. #endif
  344. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  345. static struct mtd_partition ezkit_partitions[] = {
  346. {
  347. .name = "Bootloader",
  348. .size = 0x40000,
  349. .offset = 0,
  350. }, {
  351. .name = "Kernel",
  352. .size = 0x1C0000,
  353. .offset = MTDPART_OFS_APPEND,
  354. }, {
  355. .name = "RootFS",
  356. .size = MTDPART_SIZ_FULL,
  357. .offset = MTDPART_OFS_APPEND,
  358. }
  359. };
  360. static struct physmap_flash_data ezkit_flash_data = {
  361. .width = 2,
  362. .parts = ezkit_partitions,
  363. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  364. };
  365. static struct resource ezkit_flash_resource = {
  366. .start = 0x20000000,
  367. .end = 0x20ffffff,
  368. .flags = IORESOURCE_MEM,
  369. };
  370. static struct platform_device ezkit_flash_device = {
  371. .name = "physmap-flash",
  372. .id = 0,
  373. .dev = {
  374. .platform_data = &ezkit_flash_data,
  375. },
  376. .num_resources = 1,
  377. .resource = &ezkit_flash_resource,
  378. };
  379. #endif
  380. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  381. /* all SPI peripherals info goes here */
  382. #if defined(CONFIG_MTD_M25P80) \
  383. || defined(CONFIG_MTD_M25P80_MODULE)
  384. /* SPI flash chip (m25p16) */
  385. static struct mtd_partition bfin_spi_flash_partitions[] = {
  386. {
  387. .name = "bootloader",
  388. .size = 0x00040000,
  389. .offset = 0,
  390. .mask_flags = MTD_CAP_ROM
  391. }, {
  392. .name = "linux kernel",
  393. .size = MTDPART_SIZ_FULL,
  394. .offset = MTDPART_OFS_APPEND,
  395. }
  396. };
  397. static struct flash_platform_data bfin_spi_flash_data = {
  398. .name = "m25p80",
  399. .parts = bfin_spi_flash_partitions,
  400. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  401. .type = "m25p16",
  402. };
  403. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  404. .enable_dma = 0, /* use dma transfer with this chip*/
  405. .bits_per_word = 8,
  406. .cs_change_per_word = 0,
  407. };
  408. #endif
  409. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  410. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  411. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  412. .enable_dma = 0,
  413. .bits_per_word = 16,
  414. };
  415. #endif
  416. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  417. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  418. .cs_change_per_word = 0,
  419. .enable_dma = 0,
  420. .bits_per_word = 16,
  421. };
  422. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  423. .model = 7877,
  424. .vref_delay_usecs = 50, /* internal, no capacitor */
  425. .x_plate_ohms = 419,
  426. .y_plate_ohms = 486,
  427. .pressure_max = 1000,
  428. .pressure_min = 0,
  429. .stopacq_polarity = 1,
  430. .first_conversion_delay = 3,
  431. .acquisition_time = 1,
  432. .averaging = 1,
  433. .pen_down_acc_interval = 1,
  434. };
  435. #endif
  436. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  437. static struct bfin5xx_spi_chip spidev_chip_info = {
  438. .enable_dma = 0,
  439. .bits_per_word = 8,
  440. };
  441. #endif
  442. static struct spi_board_info bf54x_spi_board_info[] __initdata = {
  443. #if defined(CONFIG_MTD_M25P80) \
  444. || defined(CONFIG_MTD_M25P80_MODULE)
  445. {
  446. /* the modalias must be the same as spi device driver name */
  447. .modalias = "m25p80", /* Name of spi_driver for this device */
  448. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  449. .bus_num = 0, /* Framework bus number */
  450. .chip_select = 1, /* SPI_SSEL1*/
  451. .platform_data = &bfin_spi_flash_data,
  452. .controller_data = &spi_flash_chip_info,
  453. .mode = SPI_MODE_3,
  454. },
  455. #endif
  456. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  457. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  458. {
  459. .modalias = "ad1836-spi",
  460. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  461. .bus_num = 1,
  462. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  463. .controller_data = &ad1836_spi_chip_info,
  464. },
  465. #endif
  466. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  467. {
  468. .modalias = "ad7877",
  469. .platform_data = &bfin_ad7877_ts_info,
  470. .irq = IRQ_PJ11,
  471. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  472. .bus_num = 0,
  473. .chip_select = 2,
  474. .controller_data = &spi_ad7877_chip_info,
  475. },
  476. #endif
  477. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  478. {
  479. .modalias = "spidev",
  480. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  481. .bus_num = 0,
  482. .chip_select = 1,
  483. .controller_data = &spidev_chip_info,
  484. },
  485. #endif
  486. };
  487. /* SPI (0) */
  488. static struct resource bfin_spi0_resource[] = {
  489. [0] = {
  490. .start = SPI0_REGBASE,
  491. .end = SPI0_REGBASE + 0xFF,
  492. .flags = IORESOURCE_MEM,
  493. },
  494. [1] = {
  495. .start = CH_SPI0,
  496. .end = CH_SPI0,
  497. .flags = IORESOURCE_IRQ,
  498. }
  499. };
  500. /* SPI (1) */
  501. static struct resource bfin_spi1_resource[] = {
  502. [0] = {
  503. .start = SPI1_REGBASE,
  504. .end = SPI1_REGBASE + 0xFF,
  505. .flags = IORESOURCE_MEM,
  506. },
  507. [1] = {
  508. .start = CH_SPI1,
  509. .end = CH_SPI1,
  510. .flags = IORESOURCE_IRQ,
  511. }
  512. };
  513. /* SPI controller data */
  514. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  515. .num_chipselect = 8,
  516. .enable_dma = 1, /* master has the ability to do dma transfer */
  517. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  518. };
  519. static struct platform_device bf54x_spi_master0 = {
  520. .name = "bfin-spi",
  521. .id = 0, /* Bus number */
  522. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  523. .resource = bfin_spi0_resource,
  524. .dev = {
  525. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  526. },
  527. };
  528. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  529. .num_chipselect = 8,
  530. .enable_dma = 1, /* master has the ability to do dma transfer */
  531. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  532. };
  533. static struct platform_device bf54x_spi_master1 = {
  534. .name = "bfin-spi",
  535. .id = 1, /* Bus number */
  536. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  537. .resource = bfin_spi1_resource,
  538. .dev = {
  539. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  540. },
  541. };
  542. #endif /* spi master and devices */
  543. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  544. static struct resource bfin_twi0_resource[] = {
  545. [0] = {
  546. .start = TWI0_REGBASE,
  547. .end = TWI0_REGBASE + 0xFF,
  548. .flags = IORESOURCE_MEM,
  549. },
  550. [1] = {
  551. .start = IRQ_TWI0,
  552. .end = IRQ_TWI0,
  553. .flags = IORESOURCE_IRQ,
  554. },
  555. };
  556. static struct platform_device i2c_bfin_twi0_device = {
  557. .name = "i2c-bfin-twi",
  558. .id = 0,
  559. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  560. .resource = bfin_twi0_resource,
  561. };
  562. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  563. static struct resource bfin_twi1_resource[] = {
  564. [0] = {
  565. .start = TWI1_REGBASE,
  566. .end = TWI1_REGBASE + 0xFF,
  567. .flags = IORESOURCE_MEM,
  568. },
  569. [1] = {
  570. .start = IRQ_TWI1,
  571. .end = IRQ_TWI1,
  572. .flags = IORESOURCE_IRQ,
  573. },
  574. };
  575. static struct platform_device i2c_bfin_twi1_device = {
  576. .name = "i2c-bfin-twi",
  577. .id = 1,
  578. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  579. .resource = bfin_twi1_resource,
  580. };
  581. #endif
  582. #endif
  583. #ifdef CONFIG_I2C_BOARDINFO
  584. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  585. };
  586. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  587. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  588. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  589. {
  590. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  591. },
  592. #endif
  593. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  594. {
  595. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  596. .irq = 212,
  597. },
  598. #endif
  599. };
  600. #endif
  601. #endif
  602. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  603. #include <linux/gpio_keys.h>
  604. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  605. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  606. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  607. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  608. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  609. };
  610. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  611. .buttons = bfin_gpio_keys_table,
  612. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  613. };
  614. static struct platform_device bfin_device_gpiokeys = {
  615. .name = "gpio-keys",
  616. .dev = {
  617. .platform_data = &bfin_gpio_keys_data,
  618. },
  619. };
  620. #endif
  621. static struct resource bfin_gpios_resources = {
  622. .start = 0,
  623. .end = MAX_BLACKFIN_GPIOS - 1,
  624. .flags = IORESOURCE_IRQ,
  625. };
  626. static struct platform_device bfin_gpios_device = {
  627. .name = "simple-gpio",
  628. .id = -1,
  629. .num_resources = 1,
  630. .resource = &bfin_gpios_resources,
  631. };
  632. static struct platform_device *ezkit_devices[] __initdata = {
  633. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  634. &rtc_device,
  635. #endif
  636. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  637. &bfin_uart_device,
  638. #endif
  639. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  640. &bfin_sir_device,
  641. #endif
  642. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  643. &bf54x_lq043_device,
  644. #endif
  645. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  646. &smsc911x_device,
  647. #endif
  648. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  649. &musb_device,
  650. #endif
  651. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  652. &bfin_atapi_device,
  653. #endif
  654. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  655. &bf5xx_nand_device,
  656. #endif
  657. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  658. &bf54x_sdh_device,
  659. #endif
  660. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  661. &bf54x_spi_master0,
  662. &bf54x_spi_master1,
  663. #endif
  664. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  665. &bf54x_kpad_device,
  666. #endif
  667. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  668. &i2c_bfin_twi0_device,
  669. #if !defined(CONFIG_BF542)
  670. &i2c_bfin_twi1_device,
  671. #endif
  672. #endif
  673. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  674. &bfin_device_gpiokeys,
  675. #endif
  676. &bfin_gpios_device,
  677. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  678. &ezkit_flash_device,
  679. #endif
  680. };
  681. static int __init ezkit_init(void)
  682. {
  683. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  684. #ifdef CONFIG_I2C_BOARDINFO
  685. i2c_register_board_info(0, bfin_i2c_board_info0,
  686. ARRAY_SIZE(bfin_i2c_board_info0));
  687. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  688. i2c_register_board_info(1, bfin_i2c_board_info1,
  689. ARRAY_SIZE(bfin_i2c_board_info1));
  690. #endif
  691. #endif
  692. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  693. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  694. spi_register_board_info(bf54x_spi_board_info,
  695. ARRAY_SIZE(bf54x_spi_board_info));
  696. #endif
  697. return 0;
  698. }
  699. arch_initcall(ezkit_init);