cm_bf548.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  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. static struct resource bfin_gpios_resources = {
  337. .start = 0,
  338. .end = MAX_BLACKFIN_GPIOS - 1,
  339. .flags = IORESOURCE_IRQ,
  340. };
  341. static struct platform_device bfin_gpios_device = {
  342. .name = "simple-gpio",
  343. .id = -1,
  344. .num_resources = 1,
  345. .resource = &bfin_gpios_resources,
  346. };
  347. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  348. static struct resource bfin_atapi_resources[] = {
  349. {
  350. .start = 0xFFC03800,
  351. .end = 0xFFC0386F,
  352. .flags = IORESOURCE_MEM,
  353. },
  354. {
  355. .start = IRQ_ATAPI_ERR,
  356. .end = IRQ_ATAPI_ERR,
  357. .flags = IORESOURCE_IRQ,
  358. },
  359. };
  360. static struct platform_device bfin_atapi_device = {
  361. .name = "pata-bf54x",
  362. .id = -1,
  363. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  364. .resource = bfin_atapi_resources,
  365. };
  366. #endif
  367. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  368. static struct mtd_partition partition_info[] = {
  369. {
  370. .name = "linux kernel(nand)",
  371. .offset = 0,
  372. .size = 4 * 1024 * 1024,
  373. },
  374. {
  375. .name = "file system(nand)",
  376. .offset = 4 * 1024 * 1024,
  377. .size = (256 - 4) * 1024 * 1024,
  378. },
  379. };
  380. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  381. .page_size = NFC_PG_SIZE_256,
  382. .data_width = NFC_NWIDTH_8,
  383. .partitions = partition_info,
  384. .nr_partitions = ARRAY_SIZE(partition_info),
  385. .rd_dly = 3,
  386. .wr_dly = 3,
  387. };
  388. static struct resource bf5xx_nand_resources[] = {
  389. {
  390. .start = 0xFFC03B00,
  391. .end = 0xFFC03B4F,
  392. .flags = IORESOURCE_MEM,
  393. },
  394. {
  395. .start = CH_NFC,
  396. .end = CH_NFC,
  397. .flags = IORESOURCE_IRQ,
  398. },
  399. };
  400. static struct platform_device bf5xx_nand_device = {
  401. .name = "bf5xx-nand",
  402. .id = 0,
  403. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  404. .resource = bf5xx_nand_resources,
  405. .dev = {
  406. .platform_data = &bf5xx_nand_platform,
  407. },
  408. };
  409. #endif
  410. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  411. static struct bfin_sd_host bfin_sdh_data = {
  412. .dma_chan = CH_SDH,
  413. .irq_int0 = IRQ_SDH_MASK0,
  414. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  415. };
  416. static struct platform_device bf54x_sdh_device = {
  417. .name = "bfin-sdh",
  418. .id = 0,
  419. .dev = {
  420. .platform_data = &bfin_sdh_data,
  421. },
  422. };
  423. #endif
  424. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  425. static struct mtd_partition para_partitions[] = {
  426. {
  427. .name = "bootloader(nor)",
  428. .size = 0x40000,
  429. .offset = 0,
  430. }, {
  431. .name = "linux kernel(nor)",
  432. .size = 0x100000,
  433. .offset = MTDPART_OFS_APPEND,
  434. }, {
  435. .name = "file system(nor)",
  436. .size = MTDPART_SIZ_FULL,
  437. .offset = MTDPART_OFS_APPEND,
  438. }
  439. };
  440. static struct physmap_flash_data para_flash_data = {
  441. .width = 2,
  442. .parts = para_partitions,
  443. .nr_parts = ARRAY_SIZE(para_partitions),
  444. };
  445. static struct resource para_flash_resource = {
  446. .start = 0x20000000,
  447. .end = 0x207fffff,
  448. .flags = IORESOURCE_MEM,
  449. };
  450. static struct platform_device para_flash_device = {
  451. .name = "physmap-flash",
  452. .id = 0,
  453. .dev = {
  454. .platform_data = &para_flash_data,
  455. },
  456. .num_resources = 1,
  457. .resource = &para_flash_resource,
  458. };
  459. #endif
  460. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  461. /* all SPI peripherals info goes here */
  462. #if defined(CONFIG_MTD_M25P80) \
  463. || defined(CONFIG_MTD_M25P80_MODULE)
  464. /* SPI flash chip (m25p16) */
  465. static struct mtd_partition bfin_spi_flash_partitions[] = {
  466. {
  467. .name = "bootloader(spi)",
  468. .size = 0x00040000,
  469. .offset = 0,
  470. .mask_flags = MTD_CAP_ROM
  471. }, {
  472. .name = "linux kernel(spi)",
  473. .size = 0x1c0000,
  474. .offset = 0x40000
  475. }
  476. };
  477. static struct flash_platform_data bfin_spi_flash_data = {
  478. .name = "m25p80",
  479. .parts = bfin_spi_flash_partitions,
  480. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  481. .type = "m25p16",
  482. };
  483. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  484. .enable_dma = 0, /* use dma transfer with this chip*/
  485. .bits_per_word = 8,
  486. };
  487. #endif
  488. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  489. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  490. .enable_dma = 0,
  491. .bits_per_word = 16,
  492. };
  493. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  494. .model = 7877,
  495. .vref_delay_usecs = 50, /* internal, no capacitor */
  496. .x_plate_ohms = 419,
  497. .y_plate_ohms = 486,
  498. .pressure_max = 1000,
  499. .pressure_min = 0,
  500. .stopacq_polarity = 1,
  501. .first_conversion_delay = 3,
  502. .acquisition_time = 1,
  503. .averaging = 1,
  504. .pen_down_acc_interval = 1,
  505. };
  506. #endif
  507. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  508. static struct bfin5xx_spi_chip spidev_chip_info = {
  509. .enable_dma = 0,
  510. .bits_per_word = 8,
  511. };
  512. #endif
  513. static struct spi_board_info bf54x_spi_board_info[] __initdata = {
  514. #if defined(CONFIG_MTD_M25P80) \
  515. || defined(CONFIG_MTD_M25P80_MODULE)
  516. {
  517. /* the modalias must be the same as spi device driver name */
  518. .modalias = "m25p80", /* Name of spi_driver for this device */
  519. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  520. .bus_num = 0, /* Framework bus number */
  521. .chip_select = 1, /* SPI_SSEL1*/
  522. .platform_data = &bfin_spi_flash_data,
  523. .controller_data = &spi_flash_chip_info,
  524. .mode = SPI_MODE_3,
  525. },
  526. #endif
  527. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  528. {
  529. .modalias = "ad7877",
  530. .platform_data = &bfin_ad7877_ts_info,
  531. .irq = IRQ_PJ11,
  532. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  533. .bus_num = 0,
  534. .chip_select = 2,
  535. .controller_data = &spi_ad7877_chip_info,
  536. },
  537. #endif
  538. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  539. {
  540. .modalias = "spidev",
  541. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  542. .bus_num = 0,
  543. .chip_select = 1,
  544. .controller_data = &spidev_chip_info,
  545. },
  546. #endif
  547. };
  548. /* SPI (0) */
  549. static struct resource bfin_spi0_resource[] = {
  550. [0] = {
  551. .start = SPI0_REGBASE,
  552. .end = SPI0_REGBASE + 0xFF,
  553. .flags = IORESOURCE_MEM,
  554. },
  555. [1] = {
  556. .start = CH_SPI0,
  557. .end = CH_SPI0,
  558. .flags = IORESOURCE_DMA,
  559. },
  560. [2] = {
  561. .start = IRQ_SPI0,
  562. .end = IRQ_SPI0,
  563. .flags = IORESOURCE_IRQ,
  564. }
  565. };
  566. /* SPI (1) */
  567. static struct resource bfin_spi1_resource[] = {
  568. [0] = {
  569. .start = SPI1_REGBASE,
  570. .end = SPI1_REGBASE + 0xFF,
  571. .flags = IORESOURCE_MEM,
  572. },
  573. [1] = {
  574. .start = CH_SPI1,
  575. .end = CH_SPI1,
  576. .flags = IORESOURCE_DMA,
  577. },
  578. [2] = {
  579. .start = IRQ_SPI1,
  580. .end = IRQ_SPI1,
  581. .flags = IORESOURCE_IRQ,
  582. }
  583. };
  584. /* SPI controller data */
  585. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  586. .num_chipselect = 3,
  587. .enable_dma = 1, /* master has the ability to do dma transfer */
  588. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  589. };
  590. static struct platform_device bf54x_spi_master0 = {
  591. .name = "bfin-spi",
  592. .id = 0, /* Bus number */
  593. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  594. .resource = bfin_spi0_resource,
  595. .dev = {
  596. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  597. },
  598. };
  599. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  600. .num_chipselect = 3,
  601. .enable_dma = 1, /* master has the ability to do dma transfer */
  602. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  603. };
  604. static struct platform_device bf54x_spi_master1 = {
  605. .name = "bfin-spi",
  606. .id = 1, /* Bus number */
  607. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  608. .resource = bfin_spi1_resource,
  609. .dev = {
  610. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  611. },
  612. };
  613. #endif /* spi master and devices */
  614. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  615. static struct resource bfin_twi0_resource[] = {
  616. [0] = {
  617. .start = TWI0_REGBASE,
  618. .end = TWI0_REGBASE + 0xFF,
  619. .flags = IORESOURCE_MEM,
  620. },
  621. [1] = {
  622. .start = IRQ_TWI0,
  623. .end = IRQ_TWI0,
  624. .flags = IORESOURCE_IRQ,
  625. },
  626. };
  627. static struct platform_device i2c_bfin_twi0_device = {
  628. .name = "i2c-bfin-twi",
  629. .id = 0,
  630. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  631. .resource = bfin_twi0_resource,
  632. };
  633. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  634. static struct resource bfin_twi1_resource[] = {
  635. [0] = {
  636. .start = TWI1_REGBASE,
  637. .end = TWI1_REGBASE + 0xFF,
  638. .flags = IORESOURCE_MEM,
  639. },
  640. [1] = {
  641. .start = IRQ_TWI1,
  642. .end = IRQ_TWI1,
  643. .flags = IORESOURCE_IRQ,
  644. },
  645. };
  646. static struct platform_device i2c_bfin_twi1_device = {
  647. .name = "i2c-bfin-twi",
  648. .id = 1,
  649. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  650. .resource = bfin_twi1_resource,
  651. };
  652. #endif
  653. #endif
  654. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  655. #include <linux/gpio_keys.h>
  656. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  657. {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
  658. };
  659. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  660. .buttons = bfin_gpio_keys_table,
  661. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  662. };
  663. static struct platform_device bfin_device_gpiokeys = {
  664. .name = "gpio-keys",
  665. .dev = {
  666. .platform_data = &bfin_gpio_keys_data,
  667. },
  668. };
  669. #endif
  670. static const unsigned int cclk_vlev_datasheet[] =
  671. {
  672. /*
  673. * Internal VLEV BF54XSBBC1533
  674. ****temporarily using these values until data sheet is updated
  675. */
  676. VRPAIR(VLEV_085, 150000000),
  677. VRPAIR(VLEV_090, 250000000),
  678. VRPAIR(VLEV_110, 276000000),
  679. VRPAIR(VLEV_115, 301000000),
  680. VRPAIR(VLEV_120, 525000000),
  681. VRPAIR(VLEV_125, 550000000),
  682. VRPAIR(VLEV_130, 600000000),
  683. };
  684. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  685. .tuple_tab = cclk_vlev_datasheet,
  686. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  687. .vr_settling_time = 25 /* us */,
  688. };
  689. static struct platform_device bfin_dpmc = {
  690. .name = "bfin dpmc",
  691. .dev = {
  692. .platform_data = &bfin_dmpc_vreg_data,
  693. },
  694. };
  695. static struct platform_device *cm_bf548_devices[] __initdata = {
  696. &bfin_dpmc,
  697. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  698. &rtc_device,
  699. #endif
  700. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  701. &bfin_uart_device,
  702. #endif
  703. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  704. #ifdef CONFIG_BFIN_SIR0
  705. &bfin_sir0_device,
  706. #endif
  707. #ifdef CONFIG_BFIN_SIR1
  708. &bfin_sir1_device,
  709. #endif
  710. #ifdef CONFIG_BFIN_SIR2
  711. &bfin_sir2_device,
  712. #endif
  713. #ifdef CONFIG_BFIN_SIR3
  714. &bfin_sir3_device,
  715. #endif
  716. #endif
  717. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  718. &bf54x_lq043_device,
  719. #endif
  720. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  721. &smsc911x_device,
  722. #endif
  723. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  724. &musb_device,
  725. #endif
  726. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  727. &bfin_atapi_device,
  728. #endif
  729. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  730. &bf5xx_nand_device,
  731. #endif
  732. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  733. &bf54x_sdh_device,
  734. #endif
  735. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  736. &bf54x_spi_master0,
  737. &bf54x_spi_master1,
  738. #endif
  739. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  740. &bf54x_kpad_device,
  741. #endif
  742. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  743. &i2c_bfin_twi0_device,
  744. #if !defined(CONFIG_BF542)
  745. &i2c_bfin_twi1_device,
  746. #endif
  747. #endif
  748. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  749. &bfin_device_gpiokeys,
  750. #endif
  751. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  752. &para_flash_device,
  753. #endif
  754. &bfin_gpios_device,
  755. };
  756. static int __init cm_bf548_init(void)
  757. {
  758. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  759. platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
  760. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  761. spi_register_board_info(bf54x_spi_board_info,
  762. ARRAY_SIZE(bf54x_spi_board_info));
  763. #endif
  764. return 0;
  765. }
  766. arch_initcall(cm_bf548_init);