cm_bf548.c 19 KB

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