ezkit.c 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. /*
  2. * File: arch/blackfin/mach-bf527/boards/ezkit.c
  3. * Based on: arch/blackfin/mach-bf537/boards/stamp.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. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  38. #include <linux/usb/isp1362.h>
  39. #endif
  40. #include <linux/i2c.h>
  41. #include <linux/irq.h>
  42. #include <linux/interrupt.h>
  43. #include <linux/usb/sl811.h>
  44. #include <linux/usb/musb.h>
  45. #include <asm/dma.h>
  46. #include <asm/bfin5xx_spi.h>
  47. #include <asm/reboot.h>
  48. #include <asm/nand.h>
  49. #include <asm/portmux.h>
  50. #include <asm/dpmc.h>
  51. #include <linux/spi/ad7877.h>
  52. /*
  53. * Name the Board for the /proc/cpuinfo
  54. */
  55. const char bfin_board_name[] = "ADI BF527-EZKIT";
  56. /*
  57. * Driver needs to know address, irq and flag pin.
  58. */
  59. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  60. #include <linux/usb/isp1760.h>
  61. static struct resource bfin_isp1760_resources[] = {
  62. [0] = {
  63. .start = 0x203C0000,
  64. .end = 0x203C0000 + 0x000fffff,
  65. .flags = IORESOURCE_MEM,
  66. },
  67. [1] = {
  68. .start = IRQ_PF7,
  69. .end = IRQ_PF7,
  70. .flags = IORESOURCE_IRQ,
  71. },
  72. };
  73. static struct isp1760_platform_data isp1760_priv = {
  74. .is_isp1761 = 0,
  75. .port1_disable = 0,
  76. .bus_width_16 = 1,
  77. .port1_otg = 0,
  78. .analog_oc = 0,
  79. .dack_polarity_high = 0,
  80. .dreq_polarity_high = 0,
  81. };
  82. static struct platform_device bfin_isp1760_device = {
  83. .name = "isp1760-hcd",
  84. .id = 0,
  85. .dev = {
  86. .platform_data = &isp1760_priv,
  87. },
  88. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  89. .resource = bfin_isp1760_resources,
  90. };
  91. #endif
  92. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  93. static struct resource musb_resources[] = {
  94. [0] = {
  95. .start = 0xffc03800,
  96. .end = 0xffc03cff,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. [1] = { /* general IRQ */
  100. .start = IRQ_USB_INT0,
  101. .end = IRQ_USB_INT0,
  102. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  103. },
  104. [2] = { /* DMA IRQ */
  105. .start = IRQ_USB_DMA,
  106. .end = IRQ_USB_DMA,
  107. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  108. },
  109. };
  110. static struct musb_hdrc_config musb_config = {
  111. .multipoint = 0,
  112. .dyn_fifo = 0,
  113. .soft_con = 1,
  114. .dma = 1,
  115. .num_eps = 7,
  116. .dma_channels = 7,
  117. .gpio_vrsel = GPIO_PG13,
  118. };
  119. static struct musb_hdrc_platform_data musb_plat = {
  120. #if defined(CONFIG_USB_MUSB_OTG)
  121. .mode = MUSB_OTG,
  122. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  123. .mode = MUSB_HOST,
  124. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  125. .mode = MUSB_PERIPHERAL,
  126. #endif
  127. .config = &musb_config,
  128. };
  129. static u64 musb_dmamask = ~(u32)0;
  130. static struct platform_device musb_device = {
  131. .name = "musb_hdrc",
  132. .id = 0,
  133. .dev = {
  134. .dma_mask = &musb_dmamask,
  135. .coherent_dma_mask = 0xffffffff,
  136. .platform_data = &musb_plat,
  137. },
  138. .num_resources = ARRAY_SIZE(musb_resources),
  139. .resource = musb_resources,
  140. };
  141. #endif
  142. #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
  143. static struct resource bf52x_t350mcqb_resources[] = {
  144. {
  145. .start = IRQ_PPI_ERROR,
  146. .end = IRQ_PPI_ERROR,
  147. .flags = IORESOURCE_IRQ,
  148. },
  149. };
  150. static struct platform_device bf52x_t350mcqb_device = {
  151. .name = "bfin-t350mcqb",
  152. .id = -1,
  153. .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
  154. .resource = bf52x_t350mcqb_resources,
  155. };
  156. #endif
  157. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  158. static struct mtd_partition ezkit_partitions[] = {
  159. {
  160. .name = "bootloader(nor)",
  161. .size = 0x40000,
  162. .offset = 0,
  163. }, {
  164. .name = "linux kernel(nor)",
  165. .size = 0x1C0000,
  166. .offset = MTDPART_OFS_APPEND,
  167. }, {
  168. .name = "file system(nor)",
  169. .size = MTDPART_SIZ_FULL,
  170. .offset = MTDPART_OFS_APPEND,
  171. }
  172. };
  173. static struct physmap_flash_data ezkit_flash_data = {
  174. .width = 2,
  175. .parts = ezkit_partitions,
  176. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  177. };
  178. static struct resource ezkit_flash_resource = {
  179. .start = 0x20000000,
  180. .end = 0x203fffff,
  181. .flags = IORESOURCE_MEM,
  182. };
  183. static struct platform_device ezkit_flash_device = {
  184. .name = "physmap-flash",
  185. .id = 0,
  186. .dev = {
  187. .platform_data = &ezkit_flash_data,
  188. },
  189. .num_resources = 1,
  190. .resource = &ezkit_flash_resource,
  191. };
  192. #endif
  193. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  194. static struct mtd_partition partition_info[] = {
  195. {
  196. .name = "linux kernel(nand)",
  197. .offset = 0,
  198. .size = 4 * 1024 * 1024,
  199. },
  200. {
  201. .name = "file system(nand)",
  202. .offset = MTDPART_OFS_APPEND,
  203. .size = MTDPART_SIZ_FULL,
  204. },
  205. };
  206. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  207. .page_size = NFC_PG_SIZE_256,
  208. .data_width = NFC_NWIDTH_8,
  209. .partitions = partition_info,
  210. .nr_partitions = ARRAY_SIZE(partition_info),
  211. .rd_dly = 3,
  212. .wr_dly = 3,
  213. };
  214. static struct resource bf5xx_nand_resources[] = {
  215. {
  216. .start = NFC_CTL,
  217. .end = NFC_DATA_RD + 2,
  218. .flags = IORESOURCE_MEM,
  219. },
  220. {
  221. .start = CH_NFC,
  222. .end = CH_NFC,
  223. .flags = IORESOURCE_IRQ,
  224. },
  225. };
  226. static struct platform_device bf5xx_nand_device = {
  227. .name = "bf5xx-nand",
  228. .id = 0,
  229. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  230. .resource = bf5xx_nand_resources,
  231. .dev = {
  232. .platform_data = &bf5xx_nand_platform,
  233. },
  234. };
  235. #endif
  236. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  237. static struct resource bfin_pcmcia_cf_resources[] = {
  238. {
  239. .start = 0x20310000, /* IO PORT */
  240. .end = 0x20312000,
  241. .flags = IORESOURCE_MEM,
  242. }, {
  243. .start = 0x20311000, /* Attribute Memory */
  244. .end = 0x20311FFF,
  245. .flags = IORESOURCE_MEM,
  246. }, {
  247. .start = IRQ_PF4,
  248. .end = IRQ_PF4,
  249. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  250. }, {
  251. .start = 6, /* Card Detect PF6 */
  252. .end = 6,
  253. .flags = IORESOURCE_IRQ,
  254. },
  255. };
  256. static struct platform_device bfin_pcmcia_cf_device = {
  257. .name = "bfin_cf_pcmcia",
  258. .id = -1,
  259. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  260. .resource = bfin_pcmcia_cf_resources,
  261. };
  262. #endif
  263. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  264. static struct platform_device rtc_device = {
  265. .name = "rtc-bfin",
  266. .id = -1,
  267. };
  268. #endif
  269. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  270. static struct resource smc91x_resources[] = {
  271. {
  272. .name = "smc91x-regs",
  273. .start = 0x20300300,
  274. .end = 0x20300300 + 16,
  275. .flags = IORESOURCE_MEM,
  276. }, {
  277. .start = IRQ_PF7,
  278. .end = IRQ_PF7,
  279. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  280. },
  281. };
  282. static struct platform_device smc91x_device = {
  283. .name = "smc91x",
  284. .id = 0,
  285. .num_resources = ARRAY_SIZE(smc91x_resources),
  286. .resource = smc91x_resources,
  287. };
  288. #endif
  289. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  290. static struct resource dm9000_resources[] = {
  291. [0] = {
  292. .start = 0x203FB800,
  293. .end = 0x203FB800 + 1,
  294. .flags = IORESOURCE_MEM,
  295. },
  296. [1] = {
  297. .start = 0x203FB800 + 4,
  298. .end = 0x203FB800 + 5,
  299. .flags = IORESOURCE_MEM,
  300. },
  301. [2] = {
  302. .start = IRQ_PF9,
  303. .end = IRQ_PF9,
  304. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  305. },
  306. };
  307. static struct platform_device dm9000_device = {
  308. .name = "dm9000",
  309. .id = -1,
  310. .num_resources = ARRAY_SIZE(dm9000_resources),
  311. .resource = dm9000_resources,
  312. };
  313. #endif
  314. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  315. static struct resource sl811_hcd_resources[] = {
  316. {
  317. .start = 0x20340000,
  318. .end = 0x20340000,
  319. .flags = IORESOURCE_MEM,
  320. }, {
  321. .start = 0x20340004,
  322. .end = 0x20340004,
  323. .flags = IORESOURCE_MEM,
  324. }, {
  325. .start = CONFIG_USB_SL811_BFIN_IRQ,
  326. .end = CONFIG_USB_SL811_BFIN_IRQ,
  327. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  328. },
  329. };
  330. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  331. void sl811_port_power(struct device *dev, int is_on)
  332. {
  333. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  334. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  335. }
  336. #endif
  337. static struct sl811_platform_data sl811_priv = {
  338. .potpg = 10,
  339. .power = 250, /* == 500mA */
  340. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  341. .port_power = &sl811_port_power,
  342. #endif
  343. };
  344. static struct platform_device sl811_hcd_device = {
  345. .name = "sl811-hcd",
  346. .id = 0,
  347. .dev = {
  348. .platform_data = &sl811_priv,
  349. },
  350. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  351. .resource = sl811_hcd_resources,
  352. };
  353. #endif
  354. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  355. static struct resource isp1362_hcd_resources[] = {
  356. {
  357. .start = 0x20360000,
  358. .end = 0x20360000,
  359. .flags = IORESOURCE_MEM,
  360. }, {
  361. .start = 0x20360004,
  362. .end = 0x20360004,
  363. .flags = IORESOURCE_MEM,
  364. }, {
  365. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  366. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  367. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  368. },
  369. };
  370. static struct isp1362_platform_data isp1362_priv = {
  371. .sel15Kres = 1,
  372. .clknotstop = 0,
  373. .oc_enable = 0,
  374. .int_act_high = 0,
  375. .int_edge_triggered = 0,
  376. .remote_wakeup_connected = 0,
  377. .no_power_switching = 1,
  378. .power_switching_mode = 0,
  379. };
  380. static struct platform_device isp1362_hcd_device = {
  381. .name = "isp1362-hcd",
  382. .id = 0,
  383. .dev = {
  384. .platform_data = &isp1362_priv,
  385. },
  386. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  387. .resource = isp1362_hcd_resources,
  388. };
  389. #endif
  390. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  391. static struct platform_device bfin_mac_device = {
  392. .name = "bfin_mac",
  393. };
  394. #endif
  395. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  396. static struct resource net2272_bfin_resources[] = {
  397. {
  398. .start = 0x20300000,
  399. .end = 0x20300000 + 0x100,
  400. .flags = IORESOURCE_MEM,
  401. }, {
  402. .start = IRQ_PF7,
  403. .end = IRQ_PF7,
  404. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  405. },
  406. };
  407. static struct platform_device net2272_bfin_device = {
  408. .name = "net2272",
  409. .id = -1,
  410. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  411. .resource = net2272_bfin_resources,
  412. };
  413. #endif
  414. #if defined(CONFIG_MTD_M25P80) \
  415. || defined(CONFIG_MTD_M25P80_MODULE)
  416. static struct mtd_partition bfin_spi_flash_partitions[] = {
  417. {
  418. .name = "bootloader(spi)",
  419. .size = 0x00040000,
  420. .offset = 0,
  421. .mask_flags = MTD_CAP_ROM
  422. }, {
  423. .name = "linux kernel(spi)",
  424. .size = MTDPART_SIZ_FULL,
  425. .offset = MTDPART_OFS_APPEND,
  426. }
  427. };
  428. static struct flash_platform_data bfin_spi_flash_data = {
  429. .name = "m25p80",
  430. .parts = bfin_spi_flash_partitions,
  431. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  432. .type = "m25p16",
  433. };
  434. /* SPI flash chip (m25p64) */
  435. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  436. .enable_dma = 0, /* use dma transfer with this chip*/
  437. .bits_per_word = 8,
  438. };
  439. #endif
  440. #if defined(CONFIG_SPI_ADC_BF533) \
  441. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  442. /* SPI ADC chip */
  443. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  444. .enable_dma = 1, /* use dma transfer with this chip*/
  445. .bits_per_word = 16,
  446. };
  447. #endif
  448. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  449. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  450. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  451. .enable_dma = 0,
  452. .bits_per_word = 16,
  453. };
  454. #endif
  455. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  456. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  457. .enable_dma = 0,
  458. .bits_per_word = 16,
  459. };
  460. #endif
  461. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  462. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  463. .enable_dma = 1,
  464. .bits_per_word = 8,
  465. };
  466. #endif
  467. #if defined(CONFIG_PBX)
  468. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  469. .ctl_reg = 0x4, /* send zero */
  470. .enable_dma = 0,
  471. .bits_per_word = 8,
  472. .cs_change_per_word = 1,
  473. };
  474. #endif
  475. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  476. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  477. .enable_dma = 0,
  478. .bits_per_word = 16,
  479. };
  480. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  481. .model = 7877,
  482. .vref_delay_usecs = 50, /* internal, no capacitor */
  483. .x_plate_ohms = 419,
  484. .y_plate_ohms = 486,
  485. .pressure_max = 1000,
  486. .pressure_min = 0,
  487. .stopacq_polarity = 1,
  488. .first_conversion_delay = 3,
  489. .acquisition_time = 1,
  490. .averaging = 1,
  491. .pen_down_acc_interval = 1,
  492. };
  493. #endif
  494. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  495. && defined(CONFIG_SND_SOC_WM8731_SPI)
  496. static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
  497. .enable_dma = 0,
  498. .bits_per_word = 16,
  499. };
  500. #endif
  501. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  502. static struct bfin5xx_spi_chip spidev_chip_info = {
  503. .enable_dma = 0,
  504. .bits_per_word = 8,
  505. };
  506. #endif
  507. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  508. #if defined(CONFIG_MTD_M25P80) \
  509. || defined(CONFIG_MTD_M25P80_MODULE)
  510. {
  511. /* the modalias must be the same as spi device driver name */
  512. .modalias = "m25p80", /* Name of spi_driver for this device */
  513. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  514. .bus_num = 0, /* Framework bus number */
  515. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  516. .platform_data = &bfin_spi_flash_data,
  517. .controller_data = &spi_flash_chip_info,
  518. .mode = SPI_MODE_3,
  519. },
  520. #endif
  521. #if defined(CONFIG_SPI_ADC_BF533) \
  522. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  523. {
  524. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  525. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  526. .bus_num = 0, /* Framework bus number */
  527. .chip_select = 1, /* Framework chip select. */
  528. .platform_data = NULL, /* No spi_driver specific config */
  529. .controller_data = &spi_adc_chip_info,
  530. },
  531. #endif
  532. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  533. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  534. {
  535. .modalias = "ad1836-spi",
  536. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  537. .bus_num = 0,
  538. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  539. .controller_data = &ad1836_spi_chip_info,
  540. },
  541. #endif
  542. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  543. {
  544. .modalias = "ad9960-spi",
  545. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  546. .bus_num = 0,
  547. .chip_select = 1,
  548. .controller_data = &ad9960_spi_chip_info,
  549. },
  550. #endif
  551. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  552. {
  553. .modalias = "spi_mmc_dummy",
  554. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  555. .bus_num = 0,
  556. .chip_select = 0,
  557. .platform_data = NULL,
  558. .controller_data = &spi_mmc_chip_info,
  559. .mode = SPI_MODE_3,
  560. },
  561. {
  562. .modalias = "spi_mmc",
  563. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  564. .bus_num = 0,
  565. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  566. .platform_data = NULL,
  567. .controller_data = &spi_mmc_chip_info,
  568. .mode = SPI_MODE_3,
  569. },
  570. #endif
  571. #if defined(CONFIG_PBX)
  572. {
  573. .modalias = "fxs-spi",
  574. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  575. .bus_num = 0,
  576. .chip_select = 8 - CONFIG_J11_JUMPER,
  577. .controller_data = &spi_si3xxx_chip_info,
  578. .mode = SPI_MODE_3,
  579. },
  580. {
  581. .modalias = "fxo-spi",
  582. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  583. .bus_num = 0,
  584. .chip_select = 8 - CONFIG_J19_JUMPER,
  585. .controller_data = &spi_si3xxx_chip_info,
  586. .mode = SPI_MODE_3,
  587. },
  588. #endif
  589. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  590. {
  591. .modalias = "ad7877",
  592. .platform_data = &bfin_ad7877_ts_info,
  593. .irq = IRQ_PF8,
  594. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  595. .bus_num = 0,
  596. .chip_select = 2,
  597. .controller_data = &spi_ad7877_chip_info,
  598. },
  599. #endif
  600. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  601. && defined(CONFIG_SND_SOC_WM8731_SPI)
  602. {
  603. .modalias = "wm8731",
  604. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  605. .bus_num = 0,
  606. .chip_select = 5,
  607. .controller_data = &spi_wm8731_chip_info,
  608. .mode = SPI_MODE_0,
  609. },
  610. #endif
  611. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  612. {
  613. .modalias = "spidev",
  614. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  615. .bus_num = 0,
  616. .chip_select = 1,
  617. .controller_data = &spidev_chip_info,
  618. },
  619. #endif
  620. };
  621. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  622. /* SPI controller data */
  623. static struct bfin5xx_spi_master bfin_spi0_info = {
  624. .num_chipselect = 8,
  625. .enable_dma = 1, /* master has the ability to do dma transfer */
  626. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  627. };
  628. /* SPI (0) */
  629. static struct resource bfin_spi0_resource[] = {
  630. [0] = {
  631. .start = SPI0_REGBASE,
  632. .end = SPI0_REGBASE + 0xFF,
  633. .flags = IORESOURCE_MEM,
  634. },
  635. [1] = {
  636. .start = CH_SPI,
  637. .end = CH_SPI,
  638. .flags = IORESOURCE_IRQ,
  639. },
  640. };
  641. static struct platform_device bfin_spi0_device = {
  642. .name = "bfin-spi",
  643. .id = 0, /* Bus number */
  644. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  645. .resource = bfin_spi0_resource,
  646. .dev = {
  647. .platform_data = &bfin_spi0_info, /* Passed to driver */
  648. },
  649. };
  650. #endif /* spi master and devices */
  651. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  652. static struct platform_device bfin_fb_device = {
  653. .name = "bf537-lq035",
  654. };
  655. #endif
  656. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  657. static struct platform_device bfin_fb_adv7393_device = {
  658. .name = "bfin-adv7393",
  659. };
  660. #endif
  661. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  662. static struct resource bfin_uart_resources[] = {
  663. #ifdef CONFIG_SERIAL_BFIN_UART0
  664. {
  665. .start = 0xFFC00400,
  666. .end = 0xFFC004FF,
  667. .flags = IORESOURCE_MEM,
  668. },
  669. #endif
  670. #ifdef CONFIG_SERIAL_BFIN_UART1
  671. {
  672. .start = 0xFFC02000,
  673. .end = 0xFFC020FF,
  674. .flags = IORESOURCE_MEM,
  675. },
  676. #endif
  677. };
  678. static struct platform_device bfin_uart_device = {
  679. .name = "bfin-uart",
  680. .id = 1,
  681. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  682. .resource = bfin_uart_resources,
  683. };
  684. #endif
  685. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  686. static struct resource bfin_sir_resources[] = {
  687. #ifdef CONFIG_BFIN_SIR0
  688. {
  689. .start = 0xFFC00400,
  690. .end = 0xFFC004FF,
  691. .flags = IORESOURCE_MEM,
  692. },
  693. #endif
  694. #ifdef CONFIG_BFIN_SIR1
  695. {
  696. .start = 0xFFC02000,
  697. .end = 0xFFC020FF,
  698. .flags = IORESOURCE_MEM,
  699. },
  700. #endif
  701. };
  702. static struct platform_device bfin_sir_device = {
  703. .name = "bfin_sir",
  704. .id = 0,
  705. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  706. .resource = bfin_sir_resources,
  707. };
  708. #endif
  709. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  710. static struct resource bfin_twi0_resource[] = {
  711. [0] = {
  712. .start = TWI0_REGBASE,
  713. .end = TWI0_REGBASE,
  714. .flags = IORESOURCE_MEM,
  715. },
  716. [1] = {
  717. .start = IRQ_TWI,
  718. .end = IRQ_TWI,
  719. .flags = IORESOURCE_IRQ,
  720. },
  721. };
  722. static struct platform_device i2c_bfin_twi_device = {
  723. .name = "i2c-bfin-twi",
  724. .id = 0,
  725. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  726. .resource = bfin_twi0_resource,
  727. };
  728. #endif
  729. #ifdef CONFIG_I2C_BOARDINFO
  730. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  731. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  732. {
  733. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  734. },
  735. #endif
  736. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  737. {
  738. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  739. .irq = IRQ_PF8,
  740. },
  741. #endif
  742. };
  743. #endif
  744. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  745. static struct platform_device bfin_sport0_uart_device = {
  746. .name = "bfin-sport-uart",
  747. .id = 0,
  748. };
  749. static struct platform_device bfin_sport1_uart_device = {
  750. .name = "bfin-sport-uart",
  751. .id = 1,
  752. };
  753. #endif
  754. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  755. #include <linux/input.h>
  756. #include <linux/gpio_keys.h>
  757. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  758. {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
  759. {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
  760. };
  761. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  762. .buttons = bfin_gpio_keys_table,
  763. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  764. };
  765. static struct platform_device bfin_device_gpiokeys = {
  766. .name = "gpio-keys",
  767. .dev = {
  768. .platform_data = &bfin_gpio_keys_data,
  769. },
  770. };
  771. #endif
  772. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  773. #include <linux/input.h>
  774. #include <asm/bfin_rotary.h>
  775. static struct bfin_rotary_platform_data bfin_rotary_data = {
  776. /*.rotary_up_key = KEY_UP,*/
  777. /*.rotary_down_key = KEY_DOWN,*/
  778. .rotary_rel_code = REL_WHEEL,
  779. .rotary_button_key = KEY_ENTER,
  780. .debounce = 10, /* 0..17 */
  781. .mode = ROT_QUAD_ENC | ROT_DEBE,
  782. };
  783. static struct resource bfin_rotary_resources[] = {
  784. {
  785. .start = IRQ_CNT,
  786. .end = IRQ_CNT,
  787. .flags = IORESOURCE_IRQ,
  788. },
  789. };
  790. static struct platform_device bfin_rotary_device = {
  791. .name = "bfin-rotary",
  792. .id = -1,
  793. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  794. .resource = bfin_rotary_resources,
  795. .dev = {
  796. .platform_data = &bfin_rotary_data,
  797. },
  798. };
  799. #endif
  800. static struct resource bfin_gpios_resources = {
  801. .start = 0,
  802. .end = MAX_BLACKFIN_GPIOS - 1,
  803. .flags = IORESOURCE_IRQ,
  804. };
  805. static struct platform_device bfin_gpios_device = {
  806. .name = "simple-gpio",
  807. .id = -1,
  808. .num_resources = 1,
  809. .resource = &bfin_gpios_resources,
  810. };
  811. static const unsigned int cclk_vlev_datasheet[] =
  812. {
  813. VRPAIR(VLEV_100, 400000000),
  814. VRPAIR(VLEV_105, 426000000),
  815. VRPAIR(VLEV_110, 500000000),
  816. VRPAIR(VLEV_115, 533000000),
  817. VRPAIR(VLEV_120, 600000000),
  818. };
  819. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  820. .tuple_tab = cclk_vlev_datasheet,
  821. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  822. .vr_settling_time = 25 /* us */,
  823. };
  824. static struct platform_device bfin_dpmc = {
  825. .name = "bfin dpmc",
  826. .dev = {
  827. .platform_data = &bfin_dmpc_vreg_data,
  828. },
  829. };
  830. static struct platform_device *stamp_devices[] __initdata = {
  831. &bfin_dpmc,
  832. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  833. &bf5xx_nand_device,
  834. #endif
  835. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  836. &bfin_pcmcia_cf_device,
  837. #endif
  838. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  839. &rtc_device,
  840. #endif
  841. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  842. &sl811_hcd_device,
  843. #endif
  844. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  845. &isp1362_hcd_device,
  846. #endif
  847. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  848. &bfin_isp1760_device,
  849. #endif
  850. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  851. &musb_device,
  852. #endif
  853. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  854. &smc91x_device,
  855. #endif
  856. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  857. &dm9000_device,
  858. #endif
  859. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  860. &bfin_mac_device,
  861. #endif
  862. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  863. &net2272_bfin_device,
  864. #endif
  865. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  866. &bfin_spi0_device,
  867. #endif
  868. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  869. &bfin_fb_device,
  870. #endif
  871. #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
  872. &bf52x_t350mcqb_device,
  873. #endif
  874. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  875. &bfin_fb_adv7393_device,
  876. #endif
  877. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  878. &bfin_uart_device,
  879. #endif
  880. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  881. &bfin_sir_device,
  882. #endif
  883. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  884. &i2c_bfin_twi_device,
  885. #endif
  886. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  887. &bfin_sport0_uart_device,
  888. &bfin_sport1_uart_device,
  889. #endif
  890. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  891. &bfin_device_gpiokeys,
  892. #endif
  893. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  894. &bfin_rotary_device,
  895. #endif
  896. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  897. &ezkit_flash_device,
  898. #endif
  899. &bfin_gpios_device,
  900. };
  901. static int __init stamp_init(void)
  902. {
  903. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  904. #ifdef CONFIG_I2C_BOARDINFO
  905. i2c_register_board_info(0, bfin_i2c_board_info,
  906. ARRAY_SIZE(bfin_i2c_board_info));
  907. #endif
  908. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  909. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  910. return 0;
  911. }
  912. arch_initcall(stamp_init);
  913. void native_machine_restart(char *cmd)
  914. {
  915. /* workaround reboot hang when booting from SPI */
  916. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  917. bfin_gpio_reset_spi0_ssel1();
  918. }
  919. void bfin_get_ether_addr(char *addr)
  920. {
  921. /* the MAC is stored in OTP memory page 0xDF */
  922. u32 ret;
  923. u64 otp_mac;
  924. u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
  925. ret = otp_read(0xDF, 0x00, &otp_mac);
  926. if (!(ret & 0x1)) {
  927. char *otp_mac_p = (char *)&otp_mac;
  928. for (ret = 0; ret < 6; ++ret)
  929. addr[ret] = otp_mac_p[5 - ret];
  930. }
  931. }
  932. EXPORT_SYMBOL(bfin_get_ether_addr);