cm_bf548.c 19 KB

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