ezkit.c 21 KB

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