ezkit.c 22 KB

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