ezkit.c 22 KB

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