ezkit.c 20 KB

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