cm_bf548.c 17 KB

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