ezkit.c 20 KB

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