ezkit.c 20 KB

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