ezkit.c 21 KB

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