ezkit.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  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/dpmc.h>
  49. #include <asm/portmux.h>
  50. #include <asm/mach/bf54x_keys.h>
  51. #include <linux/input.h>
  52. #include <linux/spi/ad7877.h>
  53. /*
  54. * Name the Board for the /proc/cpuinfo
  55. */
  56. const char bfin_board_name[] = "ADSP-BF548-EZKIT";
  57. /*
  58. * Driver needs to know address, irq and flag pin.
  59. */
  60. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  61. #include <asm/mach/bf54x-lq043.h>
  62. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  63. .width = 480,
  64. .height = 272,
  65. .xres = {480, 480, 480},
  66. .yres = {272, 272, 272},
  67. .bpp = {24, 24, 24},
  68. .disp = GPIO_PE3,
  69. };
  70. static struct resource bf54x_lq043_resources[] = {
  71. {
  72. .start = IRQ_EPPI0_ERR,
  73. .end = IRQ_EPPI0_ERR,
  74. .flags = IORESOURCE_IRQ,
  75. },
  76. };
  77. static struct platform_device bf54x_lq043_device = {
  78. .name = "bf54x-lq043",
  79. .id = -1,
  80. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  81. .resource = bf54x_lq043_resources,
  82. .dev = {
  83. .platform_data = &bf54x_lq043_data,
  84. },
  85. };
  86. #endif
  87. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  88. static const unsigned int bf548_keymap[] = {
  89. KEYVAL(0, 0, KEY_ENTER),
  90. KEYVAL(0, 1, KEY_HELP),
  91. KEYVAL(0, 2, KEY_0),
  92. KEYVAL(0, 3, KEY_BACKSPACE),
  93. KEYVAL(1, 0, KEY_TAB),
  94. KEYVAL(1, 1, KEY_9),
  95. KEYVAL(1, 2, KEY_8),
  96. KEYVAL(1, 3, KEY_7),
  97. KEYVAL(2, 0, KEY_DOWN),
  98. KEYVAL(2, 1, KEY_6),
  99. KEYVAL(2, 2, KEY_5),
  100. KEYVAL(2, 3, KEY_4),
  101. KEYVAL(3, 0, KEY_UP),
  102. KEYVAL(3, 1, KEY_3),
  103. KEYVAL(3, 2, KEY_2),
  104. KEYVAL(3, 3, KEY_1),
  105. };
  106. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  107. .rows = 4,
  108. .cols = 4,
  109. .keymap = bf548_keymap,
  110. .keymapsize = ARRAY_SIZE(bf548_keymap),
  111. .repeat = 0,
  112. .debounce_time = 5000, /* ns (5ms) */
  113. .coldrive_time = 1000, /* ns (1ms) */
  114. .keyup_test_interval = 50, /* ms (50ms) */
  115. };
  116. static struct resource bf54x_kpad_resources[] = {
  117. {
  118. .start = IRQ_KEY,
  119. .end = IRQ_KEY,
  120. .flags = IORESOURCE_IRQ,
  121. },
  122. };
  123. static struct platform_device bf54x_kpad_device = {
  124. .name = "bf54x-keys",
  125. .id = -1,
  126. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  127. .resource = bf54x_kpad_resources,
  128. .dev = {
  129. .platform_data = &bf54x_kpad_data,
  130. },
  131. };
  132. #endif
  133. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  134. static struct platform_device rtc_device = {
  135. .name = "rtc-bfin",
  136. .id = -1,
  137. };
  138. #endif
  139. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  140. static struct resource bfin_uart_resources[] = {
  141. #ifdef CONFIG_SERIAL_BFIN_UART0
  142. {
  143. .start = 0xFFC00400,
  144. .end = 0xFFC004FF,
  145. .flags = IORESOURCE_MEM,
  146. },
  147. #endif
  148. #ifdef CONFIG_SERIAL_BFIN_UART1
  149. {
  150. .start = 0xFFC02000,
  151. .end = 0xFFC020FF,
  152. .flags = IORESOURCE_MEM,
  153. },
  154. #endif
  155. #ifdef CONFIG_SERIAL_BFIN_UART2
  156. {
  157. .start = 0xFFC02100,
  158. .end = 0xFFC021FF,
  159. .flags = IORESOURCE_MEM,
  160. },
  161. #endif
  162. #ifdef CONFIG_SERIAL_BFIN_UART3
  163. {
  164. .start = 0xFFC03100,
  165. .end = 0xFFC031FF,
  166. },
  167. #endif
  168. };
  169. static struct platform_device bfin_uart_device = {
  170. .name = "bfin-uart",
  171. .id = 1,
  172. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  173. .resource = bfin_uart_resources,
  174. };
  175. #endif
  176. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  177. static struct resource bfin_sir_resources[] = {
  178. #ifdef CONFIG_BFIN_SIR0
  179. {
  180. .start = 0xFFC00400,
  181. .end = 0xFFC004FF,
  182. .flags = IORESOURCE_MEM,
  183. },
  184. #endif
  185. #ifdef CONFIG_BFIN_SIR1
  186. {
  187. .start = 0xFFC02000,
  188. .end = 0xFFC020FF,
  189. .flags = IORESOURCE_MEM,
  190. },
  191. #endif
  192. #ifdef CONFIG_BFIN_SIR2
  193. {
  194. .start = 0xFFC02100,
  195. .end = 0xFFC021FF,
  196. .flags = IORESOURCE_MEM,
  197. },
  198. #endif
  199. #ifdef CONFIG_BFIN_SIR3
  200. {
  201. .start = 0xFFC03100,
  202. .end = 0xFFC031FF,
  203. .flags = IORESOURCE_MEM,
  204. },
  205. #endif
  206. };
  207. static struct platform_device bfin_sir_device = {
  208. .name = "bfin_sir",
  209. .id = 0,
  210. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  211. .resource = bfin_sir_resources,
  212. };
  213. #endif
  214. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  215. static struct resource smsc911x_resources[] = {
  216. {
  217. .name = "smsc911x-memory",
  218. .start = 0x24000000,
  219. .end = 0x24000000 + 0xFF,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. {
  223. .start = IRQ_PE8,
  224. .end = IRQ_PE8,
  225. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  226. },
  227. };
  228. static struct platform_device smsc911x_device = {
  229. .name = "smsc911x",
  230. .id = 0,
  231. .num_resources = ARRAY_SIZE(smsc911x_resources),
  232. .resource = smsc911x_resources,
  233. };
  234. #endif
  235. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  236. static struct resource musb_resources[] = {
  237. [0] = {
  238. .start = 0xFFC03C00,
  239. .end = 0xFFC040FF,
  240. .flags = IORESOURCE_MEM,
  241. },
  242. [1] = { /* general IRQ */
  243. .start = IRQ_USB_INT0,
  244. .end = IRQ_USB_INT0,
  245. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  246. },
  247. [2] = { /* DMA IRQ */
  248. .start = IRQ_USB_DMA,
  249. .end = IRQ_USB_DMA,
  250. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  251. },
  252. };
  253. static struct musb_hdrc_platform_data musb_plat = {
  254. #if defined(CONFIG_USB_MUSB_OTG)
  255. .mode = MUSB_OTG,
  256. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  257. .mode = MUSB_HOST,
  258. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  259. .mode = MUSB_PERIPHERAL,
  260. #endif
  261. .multipoint = 0,
  262. };
  263. static u64 musb_dmamask = ~(u32)0;
  264. static struct platform_device musb_device = {
  265. .name = "musb_hdrc",
  266. .id = 0,
  267. .dev = {
  268. .dma_mask = &musb_dmamask,
  269. .coherent_dma_mask = 0xffffffff,
  270. .platform_data = &musb_plat,
  271. },
  272. .num_resources = ARRAY_SIZE(musb_resources),
  273. .resource = musb_resources,
  274. };
  275. #endif
  276. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  277. static struct resource bfin_atapi_resources[] = {
  278. {
  279. .start = 0xFFC03800,
  280. .end = 0xFFC0386F,
  281. .flags = IORESOURCE_MEM,
  282. },
  283. {
  284. .start = IRQ_ATAPI_ERR,
  285. .end = IRQ_ATAPI_ERR,
  286. .flags = IORESOURCE_IRQ,
  287. },
  288. };
  289. static struct platform_device bfin_atapi_device = {
  290. .name = "pata-bf54x",
  291. .id = -1,
  292. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  293. .resource = bfin_atapi_resources,
  294. };
  295. #endif
  296. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  297. static struct mtd_partition partition_info[] = {
  298. {
  299. .name = "Linux Kernel",
  300. .offset = 0,
  301. .size = 4 * SIZE_1M,
  302. },
  303. {
  304. .name = "File System",
  305. .offset = MTDPART_OFS_APPEND,
  306. .size = MTDPART_SIZ_FULL,
  307. },
  308. };
  309. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  310. .page_size = NFC_PG_SIZE_256,
  311. .data_width = NFC_NWIDTH_8,
  312. .partitions = partition_info,
  313. .nr_partitions = ARRAY_SIZE(partition_info),
  314. .rd_dly = 3,
  315. .wr_dly = 3,
  316. };
  317. static struct resource bf5xx_nand_resources[] = {
  318. {
  319. .start = 0xFFC03B00,
  320. .end = 0xFFC03B4F,
  321. .flags = IORESOURCE_MEM,
  322. },
  323. {
  324. .start = CH_NFC,
  325. .end = CH_NFC,
  326. .flags = IORESOURCE_IRQ,
  327. },
  328. };
  329. static struct platform_device bf5xx_nand_device = {
  330. .name = "bf5xx-nand",
  331. .id = 0,
  332. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  333. .resource = bf5xx_nand_resources,
  334. .dev = {
  335. .platform_data = &bf5xx_nand_platform,
  336. },
  337. };
  338. #endif
  339. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  340. static struct platform_device bf54x_sdh_device = {
  341. .name = "bfin-sdh",
  342. .id = 0,
  343. };
  344. #endif
  345. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  346. static struct mtd_partition ezkit_partitions[] = {
  347. {
  348. .name = "Bootloader",
  349. .size = 0x40000,
  350. .offset = 0,
  351. }, {
  352. .name = "Kernel",
  353. .size = 0x1C0000,
  354. .offset = MTDPART_OFS_APPEND,
  355. }, {
  356. .name = "RootFS",
  357. .size = MTDPART_SIZ_FULL,
  358. .offset = MTDPART_OFS_APPEND,
  359. }
  360. };
  361. static struct physmap_flash_data ezkit_flash_data = {
  362. .width = 2,
  363. .parts = ezkit_partitions,
  364. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  365. };
  366. static struct resource ezkit_flash_resource = {
  367. .start = 0x20000000,
  368. .end = 0x20ffffff,
  369. .flags = IORESOURCE_MEM,
  370. };
  371. static struct platform_device ezkit_flash_device = {
  372. .name = "physmap-flash",
  373. .id = 0,
  374. .dev = {
  375. .platform_data = &ezkit_flash_data,
  376. },
  377. .num_resources = 1,
  378. .resource = &ezkit_flash_resource,
  379. };
  380. #endif
  381. #if defined(CONFIG_MTD_M25P80) \
  382. || defined(CONFIG_MTD_M25P80_MODULE)
  383. /* SPI flash chip (m25p16) */
  384. static struct mtd_partition bfin_spi_flash_partitions[] = {
  385. {
  386. .name = "bootloader",
  387. .size = 0x00040000,
  388. .offset = 0,
  389. .mask_flags = MTD_CAP_ROM
  390. }, {
  391. .name = "linux kernel",
  392. .size = MTDPART_SIZ_FULL,
  393. .offset = MTDPART_OFS_APPEND,
  394. }
  395. };
  396. static struct flash_platform_data bfin_spi_flash_data = {
  397. .name = "m25p80",
  398. .parts = bfin_spi_flash_partitions,
  399. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  400. .type = "m25p16",
  401. };
  402. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  403. .enable_dma = 0, /* use dma transfer with this chip*/
  404. .bits_per_word = 8,
  405. .cs_change_per_word = 0,
  406. };
  407. #endif
  408. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  409. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  410. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  411. .enable_dma = 0,
  412. .bits_per_word = 16,
  413. };
  414. #endif
  415. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  416. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  417. .cs_change_per_word = 0,
  418. .enable_dma = 0,
  419. .bits_per_word = 16,
  420. };
  421. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  422. .model = 7877,
  423. .vref_delay_usecs = 50, /* internal, no capacitor */
  424. .x_plate_ohms = 419,
  425. .y_plate_ohms = 486,
  426. .pressure_max = 1000,
  427. .pressure_min = 0,
  428. .stopacq_polarity = 1,
  429. .first_conversion_delay = 3,
  430. .acquisition_time = 1,
  431. .averaging = 1,
  432. .pen_down_acc_interval = 1,
  433. };
  434. #endif
  435. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  436. static struct bfin5xx_spi_chip spidev_chip_info = {
  437. .enable_dma = 0,
  438. .bits_per_word = 8,
  439. };
  440. #endif
  441. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  442. #if defined(CONFIG_MTD_M25P80) \
  443. || defined(CONFIG_MTD_M25P80_MODULE)
  444. {
  445. /* the modalias must be the same as spi device driver name */
  446. .modalias = "m25p80", /* Name of spi_driver for this device */
  447. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  448. .bus_num = 0, /* Framework bus number */
  449. .chip_select = 1, /* SPI_SSEL1*/
  450. .platform_data = &bfin_spi_flash_data,
  451. .controller_data = &spi_flash_chip_info,
  452. .mode = SPI_MODE_3,
  453. },
  454. #endif
  455. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  456. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  457. {
  458. .modalias = "ad1836-spi",
  459. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  460. .bus_num = 1,
  461. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  462. .controller_data = &ad1836_spi_chip_info,
  463. },
  464. #endif
  465. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  466. {
  467. .modalias = "ad7877",
  468. .platform_data = &bfin_ad7877_ts_info,
  469. .irq = IRQ_PJ11,
  470. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  471. .bus_num = 0,
  472. .chip_select = 2,
  473. .controller_data = &spi_ad7877_chip_info,
  474. },
  475. #endif
  476. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  477. {
  478. .modalias = "spidev",
  479. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  480. .bus_num = 0,
  481. .chip_select = 1,
  482. .controller_data = &spidev_chip_info,
  483. },
  484. #endif
  485. };
  486. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  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 const unsigned int cclk_vlev_datasheet[] =
  633. {
  634. /*
  635. * Internal VLEV BF54XSBBC1533
  636. ****temporarily using these values until data sheet is updated
  637. */
  638. VRPAIR(VLEV_085, 150000000),
  639. VRPAIR(VLEV_090, 250000000),
  640. VRPAIR(VLEV_110, 276000000),
  641. VRPAIR(VLEV_115, 301000000),
  642. VRPAIR(VLEV_120, 525000000),
  643. VRPAIR(VLEV_125, 550000000),
  644. VRPAIR(VLEV_130, 600000000),
  645. };
  646. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  647. .tuple_tab = cclk_vlev_datasheet,
  648. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  649. .vr_settling_time = 25 /* us */,
  650. };
  651. static struct platform_device bfin_dpmc = {
  652. .name = "bfin dpmc",
  653. .dev = {
  654. .platform_data = &bfin_dmpc_vreg_data,
  655. },
  656. };
  657. static struct platform_device *ezkit_devices[] __initdata = {
  658. &bfin_dpmc,
  659. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  660. &rtc_device,
  661. #endif
  662. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  663. &bfin_uart_device,
  664. #endif
  665. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  666. &bfin_sir_device,
  667. #endif
  668. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  669. &bf54x_lq043_device,
  670. #endif
  671. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  672. &smsc911x_device,
  673. #endif
  674. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  675. &musb_device,
  676. #endif
  677. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  678. &bfin_atapi_device,
  679. #endif
  680. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  681. &bf5xx_nand_device,
  682. #endif
  683. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  684. &bf54x_sdh_device,
  685. #endif
  686. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  687. &bf54x_spi_master0,
  688. &bf54x_spi_master1,
  689. #endif
  690. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  691. &bf54x_kpad_device,
  692. #endif
  693. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  694. &i2c_bfin_twi0_device,
  695. #if !defined(CONFIG_BF542)
  696. &i2c_bfin_twi1_device,
  697. #endif
  698. #endif
  699. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  700. &bfin_device_gpiokeys,
  701. #endif
  702. &bfin_gpios_device,
  703. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  704. &ezkit_flash_device,
  705. #endif
  706. };
  707. static int __init ezkit_init(void)
  708. {
  709. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  710. #ifdef CONFIG_I2C_BOARDINFO
  711. i2c_register_board_info(0, bfin_i2c_board_info0,
  712. ARRAY_SIZE(bfin_i2c_board_info0));
  713. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  714. i2c_register_board_info(1, bfin_i2c_board_info1,
  715. ARRAY_SIZE(bfin_i2c_board_info1));
  716. #endif
  717. #endif
  718. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  719. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  720. return 0;
  721. }
  722. arch_initcall(ezkit_init);