ezkit.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  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. .flags = IORESOURCE_MEM,
  167. },
  168. #endif
  169. };
  170. static struct platform_device bfin_uart_device = {
  171. .name = "bfin-uart",
  172. .id = 1,
  173. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  174. .resource = bfin_uart_resources,
  175. };
  176. #endif
  177. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  178. static struct resource bfin_sir_resources[] = {
  179. #ifdef CONFIG_BFIN_SIR0
  180. {
  181. .start = 0xFFC00400,
  182. .end = 0xFFC004FF,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. #endif
  186. #ifdef CONFIG_BFIN_SIR1
  187. {
  188. .start = 0xFFC02000,
  189. .end = 0xFFC020FF,
  190. .flags = IORESOURCE_MEM,
  191. },
  192. #endif
  193. #ifdef CONFIG_BFIN_SIR2
  194. {
  195. .start = 0xFFC02100,
  196. .end = 0xFFC021FF,
  197. .flags = IORESOURCE_MEM,
  198. },
  199. #endif
  200. #ifdef CONFIG_BFIN_SIR3
  201. {
  202. .start = 0xFFC03100,
  203. .end = 0xFFC031FF,
  204. .flags = IORESOURCE_MEM,
  205. },
  206. #endif
  207. };
  208. static struct platform_device bfin_sir_device = {
  209. .name = "bfin_sir",
  210. .id = 0,
  211. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  212. .resource = bfin_sir_resources,
  213. };
  214. #endif
  215. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  216. static struct resource smsc911x_resources[] = {
  217. {
  218. .name = "smsc911x-memory",
  219. .start = 0x24000000,
  220. .end = 0x24000000 + 0xFF,
  221. .flags = IORESOURCE_MEM,
  222. },
  223. {
  224. .start = IRQ_PE8,
  225. .end = IRQ_PE8,
  226. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  227. },
  228. };
  229. static struct platform_device smsc911x_device = {
  230. .name = "smsc911x",
  231. .id = 0,
  232. .num_resources = ARRAY_SIZE(smsc911x_resources),
  233. .resource = smsc911x_resources,
  234. };
  235. #endif
  236. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  237. static struct resource musb_resources[] = {
  238. [0] = {
  239. .start = 0xFFC03C00,
  240. .end = 0xFFC040FF,
  241. .flags = IORESOURCE_MEM,
  242. },
  243. [1] = { /* general IRQ */
  244. .start = IRQ_USB_INT0,
  245. .end = IRQ_USB_INT0,
  246. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  247. },
  248. [2] = { /* DMA IRQ */
  249. .start = IRQ_USB_DMA,
  250. .end = IRQ_USB_DMA,
  251. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  252. },
  253. };
  254. static struct musb_hdrc_platform_data musb_plat = {
  255. #if defined(CONFIG_USB_MUSB_OTG)
  256. .mode = MUSB_OTG,
  257. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  258. .mode = MUSB_HOST,
  259. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  260. .mode = MUSB_PERIPHERAL,
  261. #endif
  262. .multipoint = 0,
  263. };
  264. static u64 musb_dmamask = ~(u32)0;
  265. static struct platform_device musb_device = {
  266. .name = "musb_hdrc",
  267. .id = 0,
  268. .dev = {
  269. .dma_mask = &musb_dmamask,
  270. .coherent_dma_mask = 0xffffffff,
  271. .platform_data = &musb_plat,
  272. },
  273. .num_resources = ARRAY_SIZE(musb_resources),
  274. .resource = musb_resources,
  275. };
  276. #endif
  277. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  278. static struct resource bfin_atapi_resources[] = {
  279. {
  280. .start = 0xFFC03800,
  281. .end = 0xFFC0386F,
  282. .flags = IORESOURCE_MEM,
  283. },
  284. {
  285. .start = IRQ_ATAPI_ERR,
  286. .end = IRQ_ATAPI_ERR,
  287. .flags = IORESOURCE_IRQ,
  288. },
  289. };
  290. static struct platform_device bfin_atapi_device = {
  291. .name = "pata-bf54x",
  292. .id = -1,
  293. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  294. .resource = bfin_atapi_resources,
  295. };
  296. #endif
  297. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  298. static struct mtd_partition partition_info[] = {
  299. {
  300. .name = "Linux Kernel",
  301. .offset = 0,
  302. .size = 4 * SIZE_1M,
  303. },
  304. {
  305. .name = "File System",
  306. .offset = MTDPART_OFS_APPEND,
  307. .size = MTDPART_SIZ_FULL,
  308. },
  309. };
  310. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  311. .page_size = NFC_PG_SIZE_256,
  312. .data_width = NFC_NWIDTH_8,
  313. .partitions = partition_info,
  314. .nr_partitions = ARRAY_SIZE(partition_info),
  315. .rd_dly = 3,
  316. .wr_dly = 3,
  317. };
  318. static struct resource bf5xx_nand_resources[] = {
  319. {
  320. .start = 0xFFC03B00,
  321. .end = 0xFFC03B4F,
  322. .flags = IORESOURCE_MEM,
  323. },
  324. {
  325. .start = CH_NFC,
  326. .end = CH_NFC,
  327. .flags = IORESOURCE_IRQ,
  328. },
  329. };
  330. static struct platform_device bf5xx_nand_device = {
  331. .name = "bf5xx-nand",
  332. .id = 0,
  333. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  334. .resource = bf5xx_nand_resources,
  335. .dev = {
  336. .platform_data = &bf5xx_nand_platform,
  337. },
  338. };
  339. #endif
  340. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  341. static struct platform_device bf54x_sdh_device = {
  342. .name = "bfin-sdh",
  343. .id = 0,
  344. };
  345. #endif
  346. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  347. static struct mtd_partition ezkit_partitions[] = {
  348. {
  349. .name = "Bootloader",
  350. .size = 0x40000,
  351. .offset = 0,
  352. }, {
  353. .name = "Kernel",
  354. .size = 0x1C0000,
  355. .offset = MTDPART_OFS_APPEND,
  356. }, {
  357. .name = "RootFS",
  358. .size = MTDPART_SIZ_FULL,
  359. .offset = MTDPART_OFS_APPEND,
  360. }
  361. };
  362. static struct physmap_flash_data ezkit_flash_data = {
  363. .width = 2,
  364. .parts = ezkit_partitions,
  365. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  366. };
  367. static struct resource ezkit_flash_resource = {
  368. .start = 0x20000000,
  369. .end = 0x20ffffff,
  370. .flags = IORESOURCE_MEM,
  371. };
  372. static struct platform_device ezkit_flash_device = {
  373. .name = "physmap-flash",
  374. .id = 0,
  375. .dev = {
  376. .platform_data = &ezkit_flash_data,
  377. },
  378. .num_resources = 1,
  379. .resource = &ezkit_flash_resource,
  380. };
  381. #endif
  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 bfin_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. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  488. /* SPI (0) */
  489. static struct resource bfin_spi0_resource[] = {
  490. [0] = {
  491. .start = SPI0_REGBASE,
  492. .end = SPI0_REGBASE + 0xFF,
  493. .flags = IORESOURCE_MEM,
  494. },
  495. [1] = {
  496. .start = CH_SPI0,
  497. .end = CH_SPI0,
  498. .flags = IORESOURCE_IRQ,
  499. }
  500. };
  501. /* SPI (1) */
  502. static struct resource bfin_spi1_resource[] = {
  503. [0] = {
  504. .start = SPI1_REGBASE,
  505. .end = SPI1_REGBASE + 0xFF,
  506. .flags = IORESOURCE_MEM,
  507. },
  508. [1] = {
  509. .start = CH_SPI1,
  510. .end = CH_SPI1,
  511. .flags = IORESOURCE_IRQ,
  512. }
  513. };
  514. /* SPI controller data */
  515. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  516. .num_chipselect = 8,
  517. .enable_dma = 1, /* master has the ability to do dma transfer */
  518. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  519. };
  520. static struct platform_device bf54x_spi_master0 = {
  521. .name = "bfin-spi",
  522. .id = 0, /* Bus number */
  523. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  524. .resource = bfin_spi0_resource,
  525. .dev = {
  526. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  527. },
  528. };
  529. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  530. .num_chipselect = 8,
  531. .enable_dma = 1, /* master has the ability to do dma transfer */
  532. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  533. };
  534. static struct platform_device bf54x_spi_master1 = {
  535. .name = "bfin-spi",
  536. .id = 1, /* Bus number */
  537. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  538. .resource = bfin_spi1_resource,
  539. .dev = {
  540. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  541. },
  542. };
  543. #endif /* spi master and devices */
  544. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  545. static struct resource bfin_twi0_resource[] = {
  546. [0] = {
  547. .start = TWI0_REGBASE,
  548. .end = TWI0_REGBASE + 0xFF,
  549. .flags = IORESOURCE_MEM,
  550. },
  551. [1] = {
  552. .start = IRQ_TWI0,
  553. .end = IRQ_TWI0,
  554. .flags = IORESOURCE_IRQ,
  555. },
  556. };
  557. static struct platform_device i2c_bfin_twi0_device = {
  558. .name = "i2c-bfin-twi",
  559. .id = 0,
  560. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  561. .resource = bfin_twi0_resource,
  562. };
  563. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  564. static struct resource bfin_twi1_resource[] = {
  565. [0] = {
  566. .start = TWI1_REGBASE,
  567. .end = TWI1_REGBASE + 0xFF,
  568. .flags = IORESOURCE_MEM,
  569. },
  570. [1] = {
  571. .start = IRQ_TWI1,
  572. .end = IRQ_TWI1,
  573. .flags = IORESOURCE_IRQ,
  574. },
  575. };
  576. static struct platform_device i2c_bfin_twi1_device = {
  577. .name = "i2c-bfin-twi",
  578. .id = 1,
  579. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  580. .resource = bfin_twi1_resource,
  581. };
  582. #endif
  583. #endif
  584. #ifdef CONFIG_I2C_BOARDINFO
  585. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  586. };
  587. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  588. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  589. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  590. {
  591. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  592. },
  593. #endif
  594. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  595. {
  596. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  597. .irq = 212,
  598. },
  599. #endif
  600. };
  601. #endif
  602. #endif
  603. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  604. #include <linux/gpio_keys.h>
  605. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  606. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  607. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  608. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  609. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  610. };
  611. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  612. .buttons = bfin_gpio_keys_table,
  613. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  614. };
  615. static struct platform_device bfin_device_gpiokeys = {
  616. .name = "gpio-keys",
  617. .dev = {
  618. .platform_data = &bfin_gpio_keys_data,
  619. },
  620. };
  621. #endif
  622. static struct resource bfin_gpios_resources = {
  623. .start = 0,
  624. .end = MAX_BLACKFIN_GPIOS - 1,
  625. .flags = IORESOURCE_IRQ,
  626. };
  627. static struct platform_device bfin_gpios_device = {
  628. .name = "simple-gpio",
  629. .id = -1,
  630. .num_resources = 1,
  631. .resource = &bfin_gpios_resources,
  632. };
  633. static const unsigned int cclk_vlev_datasheet[] =
  634. {
  635. /*
  636. * Internal VLEV BF54XSBBC1533
  637. ****temporarily using these values until data sheet is updated
  638. */
  639. VRPAIR(VLEV_085, 150000000),
  640. VRPAIR(VLEV_090, 250000000),
  641. VRPAIR(VLEV_110, 276000000),
  642. VRPAIR(VLEV_115, 301000000),
  643. VRPAIR(VLEV_120, 525000000),
  644. VRPAIR(VLEV_125, 550000000),
  645. VRPAIR(VLEV_130, 600000000),
  646. };
  647. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  648. .tuple_tab = cclk_vlev_datasheet,
  649. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  650. .vr_settling_time = 25 /* us */,
  651. };
  652. static struct platform_device bfin_dpmc = {
  653. .name = "bfin dpmc",
  654. .dev = {
  655. .platform_data = &bfin_dmpc_vreg_data,
  656. },
  657. };
  658. static struct platform_device *ezkit_devices[] __initdata = {
  659. &bfin_dpmc,
  660. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  661. &rtc_device,
  662. #endif
  663. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  664. &bfin_uart_device,
  665. #endif
  666. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  667. &bfin_sir_device,
  668. #endif
  669. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  670. &bf54x_lq043_device,
  671. #endif
  672. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  673. &smsc911x_device,
  674. #endif
  675. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  676. &musb_device,
  677. #endif
  678. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  679. &bfin_atapi_device,
  680. #endif
  681. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  682. &bf5xx_nand_device,
  683. #endif
  684. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  685. &bf54x_sdh_device,
  686. #endif
  687. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  688. &bf54x_spi_master0,
  689. &bf54x_spi_master1,
  690. #endif
  691. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  692. &bf54x_kpad_device,
  693. #endif
  694. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  695. &i2c_bfin_twi0_device,
  696. #if !defined(CONFIG_BF542)
  697. &i2c_bfin_twi1_device,
  698. #endif
  699. #endif
  700. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  701. &bfin_device_gpiokeys,
  702. #endif
  703. &bfin_gpios_device,
  704. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  705. &ezkit_flash_device,
  706. #endif
  707. };
  708. static int __init ezkit_init(void)
  709. {
  710. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  711. #ifdef CONFIG_I2C_BOARDINFO
  712. i2c_register_board_info(0, bfin_i2c_board_info0,
  713. ARRAY_SIZE(bfin_i2c_board_info0));
  714. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  715. i2c_register_board_info(1, bfin_i2c_board_info1,
  716. ARRAY_SIZE(bfin_i2c_board_info1));
  717. #endif
  718. #endif
  719. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  720. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  721. return 0;
  722. }
  723. arch_initcall(ezkit_init);