ezkit.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2
  7. */
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/physmap.h>
  12. #include <linux/mtd/partitions.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #include <linux/irq.h>
  16. #include <linux/interrupt.h>
  17. #include <asm/bfin5xx_spi.h>
  18. #include <asm/dma.h>
  19. #include <asm/gpio.h>
  20. #include <asm/nand.h>
  21. #include <asm/portmux.h>
  22. #include <asm/dpmc.h>
  23. #include <linux/input.h>
  24. /*
  25. * Name the Board for the /proc/cpuinfo
  26. */
  27. const char bfin_board_name[] = "ADI BF538-EZKIT";
  28. /*
  29. * Driver needs to know address, irq and flag pin.
  30. */
  31. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  32. static struct platform_device rtc_device = {
  33. .name = "rtc-bfin",
  34. .id = -1,
  35. };
  36. #endif /* CONFIG_RTC_DRV_BFIN */
  37. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  38. #ifdef CONFIG_SERIAL_BFIN_UART0
  39. static struct resource bfin_uart0_resources[] = {
  40. {
  41. .start = UART0_THR,
  42. .end = UART0_GCTL+2,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. {
  46. .start = IRQ_UART0_TX,
  47. .end = IRQ_UART0_TX,
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. {
  51. .start = IRQ_UART0_RX,
  52. .end = IRQ_UART0_RX,
  53. .flags = IORESOURCE_IRQ,
  54. },
  55. {
  56. .start = IRQ_UART0_ERROR,
  57. .end = IRQ_UART0_ERROR,
  58. .flags = IORESOURCE_IRQ,
  59. },
  60. {
  61. .start = CH_UART0_TX,
  62. .end = CH_UART0_TX,
  63. .flags = IORESOURCE_DMA,
  64. },
  65. {
  66. .start = CH_UART0_RX,
  67. .end = CH_UART0_RX,
  68. .flags = IORESOURCE_DMA,
  69. },
  70. #ifdef CONFIG_BFIN_UART0_CTSRTS
  71. { /* CTS pin */
  72. .start = GPIO_PG7,
  73. .end = GPIO_PG7,
  74. .flags = IORESOURCE_IO,
  75. },
  76. { /* RTS pin */
  77. .start = GPIO_PG6,
  78. .end = GPIO_PG6,
  79. .flags = IORESOURCE_IO,
  80. },
  81. #endif
  82. };
  83. static unsigned short bfin_uart0_peripherals[] = {
  84. P_UART0_TX, P_UART0_RX, 0
  85. };
  86. static struct platform_device bfin_uart0_device = {
  87. .name = "bfin-uart",
  88. .id = 0,
  89. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  90. .resource = bfin_uart0_resources,
  91. .dev = {
  92. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  93. },
  94. };
  95. #endif /* CONFIG_SERIAL_BFIN_UART0 */
  96. #ifdef CONFIG_SERIAL_BFIN_UART1
  97. static struct resource bfin_uart1_resources[] = {
  98. {
  99. .start = UART1_THR,
  100. .end = UART1_GCTL+2,
  101. .flags = IORESOURCE_MEM,
  102. },
  103. {
  104. .start = IRQ_UART1_TX,
  105. .end = IRQ_UART1_TX,
  106. .flags = IORESOURCE_IRQ,
  107. },
  108. {
  109. .start = IRQ_UART1_RX,
  110. .end = IRQ_UART1_RX,
  111. .flags = IORESOURCE_IRQ,
  112. },
  113. {
  114. .start = IRQ_UART1_ERROR,
  115. .end = IRQ_UART1_ERROR,
  116. .flags = IORESOURCE_IRQ,
  117. },
  118. {
  119. .start = CH_UART1_TX,
  120. .end = CH_UART1_TX,
  121. .flags = IORESOURCE_DMA,
  122. },
  123. {
  124. .start = CH_UART1_RX,
  125. .end = CH_UART1_RX,
  126. .flags = IORESOURCE_DMA,
  127. },
  128. };
  129. static unsigned short bfin_uart1_peripherals[] = {
  130. P_UART1_TX, P_UART1_RX, 0
  131. };
  132. static struct platform_device bfin_uart1_device = {
  133. .name = "bfin-uart",
  134. .id = 1,
  135. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  136. .resource = bfin_uart1_resources,
  137. .dev = {
  138. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  139. },
  140. };
  141. #endif /* CONFIG_SERIAL_BFIN_UART1 */
  142. #ifdef CONFIG_SERIAL_BFIN_UART2
  143. static struct resource bfin_uart2_resources[] = {
  144. {
  145. .start = UART2_THR,
  146. .end = UART2_GCTL+2,
  147. .flags = IORESOURCE_MEM,
  148. },
  149. {
  150. .start = IRQ_UART2_TX,
  151. .end = IRQ_UART2_TX,
  152. .flags = IORESOURCE_IRQ,
  153. },
  154. {
  155. .start = IRQ_UART2_RX,
  156. .end = IRQ_UART2_RX,
  157. .flags = IORESOURCE_IRQ,
  158. },
  159. {
  160. .start = IRQ_UART2_ERROR,
  161. .end = IRQ_UART2_ERROR,
  162. .flags = IORESOURCE_IRQ,
  163. },
  164. {
  165. .start = CH_UART2_TX,
  166. .end = CH_UART2_TX,
  167. .flags = IORESOURCE_DMA,
  168. },
  169. {
  170. .start = CH_UART2_RX,
  171. .end = CH_UART2_RX,
  172. .flags = IORESOURCE_DMA,
  173. },
  174. };
  175. static unsigned short bfin_uart2_peripherals[] = {
  176. P_UART2_TX, P_UART2_RX, 0
  177. };
  178. static struct platform_device bfin_uart2_device = {
  179. .name = "bfin-uart",
  180. .id = 2,
  181. .num_resources = ARRAY_SIZE(bfin_uart2_resources),
  182. .resource = bfin_uart2_resources,
  183. .dev = {
  184. .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
  185. },
  186. };
  187. #endif /* CONFIG_SERIAL_BFIN_UART2 */
  188. #endif /* CONFIG_SERIAL_BFIN */
  189. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  190. #ifdef CONFIG_BFIN_SIR0
  191. static struct resource bfin_sir0_resources[] = {
  192. {
  193. .start = 0xFFC00400,
  194. .end = 0xFFC004FF,
  195. .flags = IORESOURCE_MEM,
  196. },
  197. {
  198. .start = IRQ_UART0_RX,
  199. .end = IRQ_UART0_RX+1,
  200. .flags = IORESOURCE_IRQ,
  201. },
  202. {
  203. .start = CH_UART0_RX,
  204. .end = CH_UART0_RX+1,
  205. .flags = IORESOURCE_DMA,
  206. },
  207. };
  208. static struct platform_device bfin_sir0_device = {
  209. .name = "bfin_sir",
  210. .id = 0,
  211. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  212. .resource = bfin_sir0_resources,
  213. };
  214. #endif /* CONFIG_BFIN_SIR0 */
  215. #ifdef CONFIG_BFIN_SIR1
  216. static struct resource bfin_sir1_resources[] = {
  217. {
  218. .start = 0xFFC02000,
  219. .end = 0xFFC020FF,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. {
  223. .start = IRQ_UART1_RX,
  224. .end = IRQ_UART1_RX+1,
  225. .flags = IORESOURCE_IRQ,
  226. },
  227. {
  228. .start = CH_UART1_RX,
  229. .end = CH_UART1_RX+1,
  230. .flags = IORESOURCE_DMA,
  231. },
  232. };
  233. static struct platform_device bfin_sir1_device = {
  234. .name = "bfin_sir",
  235. .id = 1,
  236. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  237. .resource = bfin_sir1_resources,
  238. };
  239. #endif /* CONFIG_BFIN_SIR1 */
  240. #ifdef CONFIG_BFIN_SIR2
  241. static struct resource bfin_sir2_resources[] = {
  242. {
  243. .start = 0xFFC02100,
  244. .end = 0xFFC021FF,
  245. .flags = IORESOURCE_MEM,
  246. },
  247. {
  248. .start = IRQ_UART2_RX,
  249. .end = IRQ_UART2_RX+1,
  250. .flags = IORESOURCE_IRQ,
  251. },
  252. {
  253. .start = CH_UART2_RX,
  254. .end = CH_UART2_RX+1,
  255. .flags = IORESOURCE_DMA,
  256. },
  257. };
  258. static struct platform_device bfin_sir2_device = {
  259. .name = "bfin_sir",
  260. .id = 2,
  261. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  262. .resource = bfin_sir2_resources,
  263. };
  264. #endif /* CONFIG_BFIN_SIR2 */
  265. #endif /* CONFIG_BFIN_SIR */
  266. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  267. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  268. static struct resource bfin_sport0_uart_resources[] = {
  269. {
  270. .start = SPORT0_TCR1,
  271. .end = SPORT0_MRCS3+4,
  272. .flags = IORESOURCE_MEM,
  273. },
  274. {
  275. .start = IRQ_SPORT0_RX,
  276. .end = IRQ_SPORT0_RX+1,
  277. .flags = IORESOURCE_IRQ,
  278. },
  279. {
  280. .start = IRQ_SPORT0_ERROR,
  281. .end = IRQ_SPORT0_ERROR,
  282. .flags = IORESOURCE_IRQ,
  283. },
  284. };
  285. static unsigned short bfin_sport0_peripherals[] = {
  286. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  287. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  288. };
  289. static struct platform_device bfin_sport0_uart_device = {
  290. .name = "bfin-sport-uart",
  291. .id = 0,
  292. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  293. .resource = bfin_sport0_uart_resources,
  294. .dev = {
  295. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  296. },
  297. };
  298. #endif /* CONFIG_SERIAL_BFIN_SPORT0_UART */
  299. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  300. static struct resource bfin_sport1_uart_resources[] = {
  301. {
  302. .start = SPORT1_TCR1,
  303. .end = SPORT1_MRCS3+4,
  304. .flags = IORESOURCE_MEM,
  305. },
  306. {
  307. .start = IRQ_SPORT1_RX,
  308. .end = IRQ_SPORT1_RX+1,
  309. .flags = IORESOURCE_IRQ,
  310. },
  311. {
  312. .start = IRQ_SPORT1_ERROR,
  313. .end = IRQ_SPORT1_ERROR,
  314. .flags = IORESOURCE_IRQ,
  315. },
  316. };
  317. static unsigned short bfin_sport1_peripherals[] = {
  318. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  319. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  320. };
  321. static struct platform_device bfin_sport1_uart_device = {
  322. .name = "bfin-sport-uart",
  323. .id = 1,
  324. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  325. .resource = bfin_sport1_uart_resources,
  326. .dev = {
  327. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  328. },
  329. };
  330. #endif /* CONFIG_SERIAL_BFIN_SPORT1_UART */
  331. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  332. static struct resource bfin_sport2_uart_resources[] = {
  333. {
  334. .start = SPORT2_TCR1,
  335. .end = SPORT2_MRCS3+4,
  336. .flags = IORESOURCE_MEM,
  337. },
  338. {
  339. .start = IRQ_SPORT2_RX,
  340. .end = IRQ_SPORT2_RX+1,
  341. .flags = IORESOURCE_IRQ,
  342. },
  343. {
  344. .start = IRQ_SPORT2_ERROR,
  345. .end = IRQ_SPORT2_ERROR,
  346. .flags = IORESOURCE_IRQ,
  347. },
  348. };
  349. static unsigned short bfin_sport2_peripherals[] = {
  350. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  351. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  352. };
  353. static struct platform_device bfin_sport2_uart_device = {
  354. .name = "bfin-sport-uart",
  355. .id = 2,
  356. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  357. .resource = bfin_sport2_uart_resources,
  358. .dev = {
  359. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  360. },
  361. };
  362. #endif /* CONFIG_SERIAL_BFIN_SPORT2_UART */
  363. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  364. static struct resource bfin_sport3_uart_resources[] = {
  365. {
  366. .start = SPORT3_TCR1,
  367. .end = SPORT3_MRCS3+4,
  368. .flags = IORESOURCE_MEM,
  369. },
  370. {
  371. .start = IRQ_SPORT3_RX,
  372. .end = IRQ_SPORT3_RX+1,
  373. .flags = IORESOURCE_IRQ,
  374. },
  375. {
  376. .start = IRQ_SPORT3_ERROR,
  377. .end = IRQ_SPORT3_ERROR,
  378. .flags = IORESOURCE_IRQ,
  379. },
  380. };
  381. static unsigned short bfin_sport3_peripherals[] = {
  382. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  383. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  384. };
  385. static struct platform_device bfin_sport3_uart_device = {
  386. .name = "bfin-sport-uart",
  387. .id = 3,
  388. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  389. .resource = bfin_sport3_uart_resources,
  390. .dev = {
  391. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  392. },
  393. };
  394. #endif /* CONFIG_SERIAL_BFIN_SPORT3_UART */
  395. #endif /* CONFIG_SERIAL_BFIN_SPORT */
  396. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  397. static unsigned short bfin_can_peripherals[] = {
  398. P_CAN0_RX, P_CAN0_TX, 0
  399. };
  400. static struct resource bfin_can_resources[] = {
  401. {
  402. .start = 0xFFC02A00,
  403. .end = 0xFFC02FFF,
  404. .flags = IORESOURCE_MEM,
  405. },
  406. {
  407. .start = IRQ_CAN_RX,
  408. .end = IRQ_CAN_RX,
  409. .flags = IORESOURCE_IRQ,
  410. },
  411. {
  412. .start = IRQ_CAN_TX,
  413. .end = IRQ_CAN_TX,
  414. .flags = IORESOURCE_IRQ,
  415. },
  416. {
  417. .start = IRQ_CAN_ERROR,
  418. .end = IRQ_CAN_ERROR,
  419. .flags = IORESOURCE_IRQ,
  420. },
  421. };
  422. static struct platform_device bfin_can_device = {
  423. .name = "bfin_can",
  424. .num_resources = ARRAY_SIZE(bfin_can_resources),
  425. .resource = bfin_can_resources,
  426. .dev = {
  427. .platform_data = &bfin_can_peripherals, /* Passed to driver */
  428. },
  429. };
  430. #endif /* CONFIG_CAN_BFIN */
  431. /*
  432. * USB-LAN EzExtender board
  433. * Driver needs to know address, irq and flag pin.
  434. */
  435. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  436. #include <linux/smc91x.h>
  437. static struct smc91x_platdata smc91x_info = {
  438. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  439. .leda = RPC_LED_100_10,
  440. .ledb = RPC_LED_TX_RX,
  441. };
  442. static struct resource smc91x_resources[] = {
  443. {
  444. .name = "smc91x-regs",
  445. .start = 0x20310300,
  446. .end = 0x20310300 + 16,
  447. .flags = IORESOURCE_MEM,
  448. }, {
  449. .start = IRQ_PF0,
  450. .end = IRQ_PF0,
  451. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  452. },
  453. };
  454. static struct platform_device smc91x_device = {
  455. .name = "smc91x",
  456. .id = 0,
  457. .num_resources = ARRAY_SIZE(smc91x_resources),
  458. .resource = smc91x_resources,
  459. .dev = {
  460. .platform_data = &smc91x_info,
  461. },
  462. };
  463. #endif /* CONFIG_SMC91X */
  464. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  465. /* all SPI peripherals info goes here */
  466. #if defined(CONFIG_MTD_M25P80) \
  467. || defined(CONFIG_MTD_M25P80_MODULE)
  468. /* SPI flash chip (m25p16) */
  469. static struct mtd_partition bfin_spi_flash_partitions[] = {
  470. {
  471. .name = "bootloader(spi)",
  472. .size = 0x00040000,
  473. .offset = 0,
  474. .mask_flags = MTD_CAP_ROM
  475. }, {
  476. .name = "linux kernel(spi)",
  477. .size = 0x1c0000,
  478. .offset = 0x40000
  479. }
  480. };
  481. static struct flash_platform_data bfin_spi_flash_data = {
  482. .name = "m25p80",
  483. .parts = bfin_spi_flash_partitions,
  484. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  485. .type = "m25p16",
  486. };
  487. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  488. .enable_dma = 0, /* use dma transfer with this chip*/
  489. };
  490. #endif /* CONFIG_MTD_M25P80 */
  491. #endif /* CONFIG_SPI_BFIN5XX */
  492. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  493. #include <linux/spi/ad7879.h>
  494. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  495. .model = 7879, /* Model = AD7879 */
  496. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  497. .pressure_max = 10000,
  498. .pressure_min = 0,
  499. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  500. .acquisition_time = 1, /* 4us acquisition time per sample */
  501. .median = 2, /* do 8 measurements */
  502. .averaging = 1, /* take the average of 4 middle samples */
  503. .pen_down_acc_interval = 255, /* 9.4 ms */
  504. .gpio_export = 1, /* Export GPIO to gpiolib */
  505. .gpio_base = -1, /* Dynamic allocation */
  506. };
  507. #endif /* CONFIG_TOUCHSCREEN_AD7879 */
  508. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  509. #include <asm/bfin-lq035q1.h>
  510. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  511. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  512. .ppi_mode = USE_RGB565_16_BIT_PPI,
  513. .use_bl = 0, /* let something else control the LCD Blacklight */
  514. .gpio_bl = GPIO_PF7,
  515. };
  516. static struct resource bfin_lq035q1_resources[] = {
  517. {
  518. .start = IRQ_PPI_ERROR,
  519. .end = IRQ_PPI_ERROR,
  520. .flags = IORESOURCE_IRQ,
  521. },
  522. };
  523. static struct platform_device bfin_lq035q1_device = {
  524. .name = "bfin-lq035q1",
  525. .id = -1,
  526. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  527. .resource = bfin_lq035q1_resources,
  528. .dev = {
  529. .platform_data = &bfin_lq035q1_data,
  530. },
  531. };
  532. #endif /* CONFIG_FB_BFIN_LQ035Q1 */
  533. static struct spi_board_info bf538_spi_board_info[] __initdata = {
  534. #if defined(CONFIG_MTD_M25P80) \
  535. || defined(CONFIG_MTD_M25P80_MODULE)
  536. {
  537. /* the modalias must be the same as spi device driver name */
  538. .modalias = "m25p80", /* Name of spi_driver for this device */
  539. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  540. .bus_num = 0, /* Framework bus number */
  541. .chip_select = 1, /* SPI_SSEL1*/
  542. .platform_data = &bfin_spi_flash_data,
  543. .controller_data = &spi_flash_chip_info,
  544. .mode = SPI_MODE_3,
  545. },
  546. #endif /* CONFIG_MTD_M25P80 */
  547. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  548. {
  549. .modalias = "ad7879",
  550. .platform_data = &bfin_ad7879_ts_info,
  551. .irq = IRQ_PF3,
  552. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  553. .bus_num = 0,
  554. .chip_select = 1,
  555. .mode = SPI_CPHA | SPI_CPOL,
  556. },
  557. #endif /* CONFIG_TOUCHSCREEN_AD7879_SPI */
  558. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  559. {
  560. .modalias = "bfin-lq035q1-spi",
  561. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  562. .bus_num = 0,
  563. .chip_select = 2,
  564. .mode = SPI_CPHA | SPI_CPOL,
  565. },
  566. #endif /* CONFIG_FB_BFIN_LQ035Q1 */
  567. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  568. {
  569. .modalias = "spidev",
  570. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  571. .bus_num = 0,
  572. .chip_select = 1,
  573. },
  574. #endif /* CONFIG_SPI_SPIDEV */
  575. };
  576. /* SPI (0) */
  577. static struct resource bfin_spi0_resource[] = {
  578. [0] = {
  579. .start = SPI0_REGBASE,
  580. .end = SPI0_REGBASE + 0xFF,
  581. .flags = IORESOURCE_MEM,
  582. },
  583. [1] = {
  584. .start = CH_SPI0,
  585. .end = CH_SPI0,
  586. .flags = IORESOURCE_DMA,
  587. },
  588. [2] = {
  589. .start = IRQ_SPI0,
  590. .end = IRQ_SPI0,
  591. .flags = IORESOURCE_IRQ,
  592. }
  593. };
  594. /* SPI (1) */
  595. static struct resource bfin_spi1_resource[] = {
  596. [0] = {
  597. .start = SPI1_REGBASE,
  598. .end = SPI1_REGBASE + 0xFF,
  599. .flags = IORESOURCE_MEM,
  600. },
  601. [1] = {
  602. .start = CH_SPI1,
  603. .end = CH_SPI1,
  604. .flags = IORESOURCE_DMA,
  605. },
  606. [2] = {
  607. .start = IRQ_SPI1,
  608. .end = IRQ_SPI1,
  609. .flags = IORESOURCE_IRQ,
  610. }
  611. };
  612. /* SPI (2) */
  613. static struct resource bfin_spi2_resource[] = {
  614. [0] = {
  615. .start = SPI2_REGBASE,
  616. .end = SPI2_REGBASE + 0xFF,
  617. .flags = IORESOURCE_MEM,
  618. },
  619. [1] = {
  620. .start = CH_SPI2,
  621. .end = CH_SPI2,
  622. .flags = IORESOURCE_DMA,
  623. },
  624. [2] = {
  625. .start = IRQ_SPI2,
  626. .end = IRQ_SPI2,
  627. .flags = IORESOURCE_IRQ,
  628. }
  629. };
  630. /* SPI controller data */
  631. static struct bfin5xx_spi_master bf538_spi_master_info0 = {
  632. .num_chipselect = 8,
  633. .enable_dma = 1, /* master has the ability to do dma transfer */
  634. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  635. };
  636. static struct platform_device bf538_spi_master0 = {
  637. .name = "bfin-spi",
  638. .id = 0, /* Bus number */
  639. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  640. .resource = bfin_spi0_resource,
  641. .dev = {
  642. .platform_data = &bf538_spi_master_info0, /* Passed to driver */
  643. },
  644. };
  645. static struct bfin5xx_spi_master bf538_spi_master_info1 = {
  646. .num_chipselect = 2,
  647. .enable_dma = 1, /* master has the ability to do dma transfer */
  648. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  649. };
  650. static struct platform_device bf538_spi_master1 = {
  651. .name = "bfin-spi",
  652. .id = 1, /* Bus number */
  653. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  654. .resource = bfin_spi1_resource,
  655. .dev = {
  656. .platform_data = &bf538_spi_master_info1, /* Passed to driver */
  657. },
  658. };
  659. static struct bfin5xx_spi_master bf538_spi_master_info2 = {
  660. .num_chipselect = 2,
  661. .enable_dma = 1, /* master has the ability to do dma transfer */
  662. .pin_req = {P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0},
  663. };
  664. static struct platform_device bf538_spi_master2 = {
  665. .name = "bfin-spi",
  666. .id = 2, /* Bus number */
  667. .num_resources = ARRAY_SIZE(bfin_spi2_resource),
  668. .resource = bfin_spi2_resource,
  669. .dev = {
  670. .platform_data = &bf538_spi_master_info2, /* Passed to driver */
  671. },
  672. };
  673. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  674. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  675. static struct resource bfin_twi0_resource[] = {
  676. [0] = {
  677. .start = TWI0_REGBASE,
  678. .end = TWI0_REGBASE + 0xFF,
  679. .flags = IORESOURCE_MEM,
  680. },
  681. [1] = {
  682. .start = IRQ_TWI0,
  683. .end = IRQ_TWI0,
  684. .flags = IORESOURCE_IRQ,
  685. },
  686. };
  687. static struct platform_device i2c_bfin_twi0_device = {
  688. .name = "i2c-bfin-twi",
  689. .id = 0,
  690. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  691. .resource = bfin_twi0_resource,
  692. .dev = {
  693. .platform_data = &bfin_twi0_pins,
  694. },
  695. };
  696. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  697. static struct resource bfin_twi1_resource[] = {
  698. [0] = {
  699. .start = TWI1_REGBASE,
  700. .end = TWI1_REGBASE + 0xFF,
  701. .flags = IORESOURCE_MEM,
  702. },
  703. [1] = {
  704. .start = IRQ_TWI1,
  705. .end = IRQ_TWI1,
  706. .flags = IORESOURCE_IRQ,
  707. },
  708. };
  709. static struct platform_device i2c_bfin_twi1_device = {
  710. .name = "i2c-bfin-twi",
  711. .id = 1,
  712. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  713. .resource = bfin_twi1_resource,
  714. };
  715. #endif /* CONFIG_BF542 */
  716. #endif /* CONFIG_I2C_BLACKFIN_TWI */
  717. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  718. #include <linux/gpio_keys.h>
  719. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  720. {BTN_0, GPIO_PC7, 1, "gpio-keys: BTN0"},
  721. };
  722. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  723. .buttons = bfin_gpio_keys_table,
  724. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  725. };
  726. static struct platform_device bfin_device_gpiokeys = {
  727. .name = "gpio-keys",
  728. .dev = {
  729. .platform_data = &bfin_gpio_keys_data,
  730. },
  731. };
  732. #endif
  733. static const unsigned int cclk_vlev_datasheet[] =
  734. {
  735. /*
  736. * Internal VLEV BF538SBBC1533
  737. ****temporarily using these values until data sheet is updated
  738. */
  739. VRPAIR(VLEV_100, 150000000),
  740. VRPAIR(VLEV_100, 250000000),
  741. VRPAIR(VLEV_110, 276000000),
  742. VRPAIR(VLEV_115, 301000000),
  743. VRPAIR(VLEV_120, 525000000),
  744. VRPAIR(VLEV_125, 550000000),
  745. VRPAIR(VLEV_130, 600000000),
  746. };
  747. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  748. .tuple_tab = cclk_vlev_datasheet,
  749. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  750. .vr_settling_time = 25 /* us */,
  751. };
  752. static struct platform_device bfin_dpmc = {
  753. .name = "bfin dpmc",
  754. .dev = {
  755. .platform_data = &bfin_dmpc_vreg_data,
  756. },
  757. };
  758. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  759. static struct mtd_partition ezkit_partitions[] = {
  760. {
  761. .name = "bootloader(nor)",
  762. .size = 0x40000,
  763. .offset = 0,
  764. }, {
  765. .name = "linux kernel(nor)",
  766. .size = 0x180000,
  767. .offset = MTDPART_OFS_APPEND,
  768. }, {
  769. .name = "file system(nor)",
  770. .size = MTDPART_SIZ_FULL,
  771. .offset = MTDPART_OFS_APPEND,
  772. }
  773. };
  774. static struct physmap_flash_data ezkit_flash_data = {
  775. .width = 2,
  776. .parts = ezkit_partitions,
  777. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  778. };
  779. static struct resource ezkit_flash_resource = {
  780. .start = 0x20000000,
  781. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  782. .end = 0x202fffff,
  783. #else
  784. .end = 0x203fffff,
  785. #endif
  786. .flags = IORESOURCE_MEM,
  787. };
  788. static struct platform_device ezkit_flash_device = {
  789. .name = "physmap-flash",
  790. .id = 0,
  791. .dev = {
  792. .platform_data = &ezkit_flash_data,
  793. },
  794. .num_resources = 1,
  795. .resource = &ezkit_flash_resource,
  796. };
  797. #endif
  798. static struct platform_device *cm_bf538_devices[] __initdata = {
  799. &bfin_dpmc,
  800. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  801. &rtc_device,
  802. #endif
  803. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  804. #ifdef CONFIG_SERIAL_BFIN_UART0
  805. &bfin_uart0_device,
  806. #endif
  807. #ifdef CONFIG_SERIAL_BFIN_UART1
  808. &bfin_uart1_device,
  809. #endif
  810. #ifdef CONFIG_SERIAL_BFIN_UART2
  811. &bfin_uart2_device,
  812. #endif
  813. #endif
  814. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  815. &bf538_spi_master0,
  816. &bf538_spi_master1,
  817. &bf538_spi_master2,
  818. #endif
  819. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  820. &i2c_bfin_twi0_device,
  821. &i2c_bfin_twi1_device,
  822. #endif
  823. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  824. #ifdef CONFIG_BFIN_SIR0
  825. &bfin_sir0_device,
  826. #endif
  827. #ifdef CONFIG_BFIN_SIR1
  828. &bfin_sir1_device,
  829. #endif
  830. #ifdef CONFIG_BFIN_SIR2
  831. &bfin_sir2_device,
  832. #endif
  833. #endif
  834. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  835. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  836. &bfin_sport0_uart_device,
  837. #endif
  838. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  839. &bfin_sport1_uart_device,
  840. #endif
  841. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  842. &bfin_sport2_uart_device,
  843. #endif
  844. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  845. &bfin_sport3_uart_device,
  846. #endif
  847. #endif
  848. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  849. &bfin_can_device,
  850. #endif
  851. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  852. &smc91x_device,
  853. #endif
  854. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  855. &bfin_lq035q1_device,
  856. #endif
  857. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  858. &bfin_device_gpiokeys,
  859. #endif
  860. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  861. &ezkit_flash_device,
  862. #endif
  863. };
  864. static int __init ezkit_init(void)
  865. {
  866. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  867. platform_add_devices(cm_bf538_devices, ARRAY_SIZE(cm_bf538_devices));
  868. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  869. spi_register_board_info(bf538_spi_board_info,
  870. ARRAY_SIZE(bf538_spi_board_info));
  871. #endif
  872. return 0;
  873. }
  874. arch_initcall(ezkit_init);
  875. static struct platform_device *ezkit_early_devices[] __initdata = {
  876. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  877. #ifdef CONFIG_SERIAL_BFIN_UART0
  878. &bfin_uart0_device,
  879. #endif
  880. #ifdef CONFIG_SERIAL_BFIN_UART1
  881. &bfin_uart1_device,
  882. #endif
  883. #ifdef CONFIG_SERIAL_BFIN_UART2
  884. &bfin_uart2_device,
  885. #endif
  886. #endif
  887. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  888. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  889. &bfin_sport0_uart_device,
  890. #endif
  891. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  892. &bfin_sport1_uart_device,
  893. #endif
  894. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  895. &bfin_sport2_uart_device,
  896. #endif
  897. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  898. &bfin_sport3_uart_device,
  899. #endif
  900. #endif
  901. };
  902. void __init native_machine_early_platform_add_devices(void)
  903. {
  904. printk(KERN_INFO "register early platform devices\n");
  905. early_platform_add_devices(ezkit_early_devices,
  906. ARRAY_SIZE(ezkit_early_devices));
  907. }