ezkit.c 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  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/ata_platform.h>
  41. #include <linux/i2c.h>
  42. #include <linux/irq.h>
  43. #include <linux/interrupt.h>
  44. #include <linux/usb/sl811.h>
  45. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  46. #include <linux/usb/musb.h>
  47. #endif
  48. #include <asm/cplb.h>
  49. #include <asm/dma.h>
  50. #include <asm/bfin5xx_spi.h>
  51. #include <asm/reboot.h>
  52. #include <asm/nand.h>
  53. #include <asm/portmux.h>
  54. #include <asm/dpmc.h>
  55. #include <linux/spi/ad7877.h>
  56. /*
  57. * Name the Board for the /proc/cpuinfo
  58. */
  59. const char bfin_board_name[] = "ADDS-BF527-EZKIT";
  60. /*
  61. * Driver needs to know address, irq and flag pin.
  62. */
  63. #define ISP1761_BASE 0x203C0000
  64. #define ISP1761_IRQ IRQ_PF7
  65. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  66. static struct resource bfin_isp1761_resources[] = {
  67. [0] = {
  68. .name = "isp1761-regs",
  69. .start = ISP1761_BASE + 0x00000000,
  70. .end = ISP1761_BASE + 0x000fffff,
  71. .flags = IORESOURCE_MEM,
  72. },
  73. [1] = {
  74. .start = ISP1761_IRQ,
  75. .end = ISP1761_IRQ,
  76. .flags = IORESOURCE_IRQ,
  77. },
  78. };
  79. static struct platform_device bfin_isp1761_device = {
  80. .name = "isp1761",
  81. .id = 0,
  82. .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
  83. .resource = bfin_isp1761_resources,
  84. };
  85. static struct platform_device *bfin_isp1761_devices[] = {
  86. &bfin_isp1761_device,
  87. };
  88. int __init bfin_isp1761_init(void)
  89. {
  90. unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
  91. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  92. set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
  93. return platform_add_devices(bfin_isp1761_devices, num_devices);
  94. }
  95. void __exit bfin_isp1761_exit(void)
  96. {
  97. platform_device_unregister(&bfin_isp1761_device);
  98. }
  99. arch_initcall(bfin_isp1761_init);
  100. #endif
  101. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  102. static struct resource musb_resources[] = {
  103. [0] = {
  104. .start = 0xffc03800,
  105. .end = 0xffc03cff,
  106. .flags = IORESOURCE_MEM,
  107. },
  108. [1] = { /* general IRQ */
  109. .start = IRQ_USB_INT0,
  110. .end = IRQ_USB_INT0,
  111. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  112. },
  113. [2] = { /* DMA IRQ */
  114. .start = IRQ_USB_DMA,
  115. .end = IRQ_USB_DMA,
  116. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  117. },
  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. .multipoint = 0,
  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",
  161. .size = 0x40000,
  162. .offset = 0,
  163. }, {
  164. .name = "Kernel",
  165. .size = 0x1C0000,
  166. .offset = MTDPART_OFS_APPEND,
  167. }, {
  168. .name = "RootFS",
  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",
  197. .offset = 0,
  198. .size = 4 * SIZE_1M,
  199. },
  200. {
  201. .name = "File System",
  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 + 8,
  294. .flags = IORESOURCE_MEM,
  295. },
  296. [1] = {
  297. .start = IRQ_PF9,
  298. .end = IRQ_PF9,
  299. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  300. },
  301. };
  302. static struct platform_device dm9000_device = {
  303. .name = "dm9000",
  304. .id = -1,
  305. .num_resources = ARRAY_SIZE(dm9000_resources),
  306. .resource = dm9000_resources,
  307. };
  308. #endif
  309. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  310. static struct resource sl811_hcd_resources[] = {
  311. {
  312. .start = 0x20340000,
  313. .end = 0x20340000,
  314. .flags = IORESOURCE_MEM,
  315. }, {
  316. .start = 0x20340004,
  317. .end = 0x20340004,
  318. .flags = IORESOURCE_MEM,
  319. }, {
  320. .start = CONFIG_USB_SL811_BFIN_IRQ,
  321. .end = CONFIG_USB_SL811_BFIN_IRQ,
  322. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  323. },
  324. };
  325. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  326. void sl811_port_power(struct device *dev, int is_on)
  327. {
  328. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  329. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  330. }
  331. #endif
  332. static struct sl811_platform_data sl811_priv = {
  333. .potpg = 10,
  334. .power = 250, /* == 500mA */
  335. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  336. .port_power = &sl811_port_power,
  337. #endif
  338. };
  339. static struct platform_device sl811_hcd_device = {
  340. .name = "sl811-hcd",
  341. .id = 0,
  342. .dev = {
  343. .platform_data = &sl811_priv,
  344. },
  345. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  346. .resource = sl811_hcd_resources,
  347. };
  348. #endif
  349. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  350. static struct resource isp1362_hcd_resources[] = {
  351. {
  352. .start = 0x20360000,
  353. .end = 0x20360000,
  354. .flags = IORESOURCE_MEM,
  355. }, {
  356. .start = 0x20360004,
  357. .end = 0x20360004,
  358. .flags = IORESOURCE_MEM,
  359. }, {
  360. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  361. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  362. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  363. },
  364. };
  365. static struct isp1362_platform_data isp1362_priv = {
  366. .sel15Kres = 1,
  367. .clknotstop = 0,
  368. .oc_enable = 0,
  369. .int_act_high = 0,
  370. .int_edge_triggered = 0,
  371. .remote_wakeup_connected = 0,
  372. .no_power_switching = 1,
  373. .power_switching_mode = 0,
  374. };
  375. static struct platform_device isp1362_hcd_device = {
  376. .name = "isp1362-hcd",
  377. .id = 0,
  378. .dev = {
  379. .platform_data = &isp1362_priv,
  380. },
  381. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  382. .resource = isp1362_hcd_resources,
  383. };
  384. #endif
  385. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  386. static struct platform_device bfin_mac_device = {
  387. .name = "bfin_mac",
  388. };
  389. #endif
  390. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  391. static struct resource net2272_bfin_resources[] = {
  392. {
  393. .start = 0x20300000,
  394. .end = 0x20300000 + 0x100,
  395. .flags = IORESOURCE_MEM,
  396. }, {
  397. .start = IRQ_PF7,
  398. .end = IRQ_PF7,
  399. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  400. },
  401. };
  402. static struct platform_device net2272_bfin_device = {
  403. .name = "net2272",
  404. .id = -1,
  405. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  406. .resource = net2272_bfin_resources,
  407. };
  408. #endif
  409. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  410. /* all SPI peripherals info goes here */
  411. #if defined(CONFIG_MTD_M25P80) \
  412. || defined(CONFIG_MTD_M25P80_MODULE)
  413. static struct mtd_partition bfin_spi_flash_partitions[] = {
  414. {
  415. .name = "bootloader",
  416. .size = 0x00040000,
  417. .offset = 0,
  418. .mask_flags = MTD_CAP_ROM
  419. }, {
  420. .name = "linux kernel",
  421. .size = MTDPART_SIZ_FULL,
  422. .offset = MTDPART_OFS_APPEND,
  423. }
  424. };
  425. static struct flash_platform_data bfin_spi_flash_data = {
  426. .name = "m25p80",
  427. .parts = bfin_spi_flash_partitions,
  428. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  429. .type = "m25p16",
  430. };
  431. /* SPI flash chip (m25p64) */
  432. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  433. .enable_dma = 0, /* use dma transfer with this chip*/
  434. .bits_per_word = 8,
  435. };
  436. #endif
  437. #if defined(CONFIG_SPI_ADC_BF533) \
  438. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  439. /* SPI ADC chip */
  440. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  441. .enable_dma = 1, /* use dma transfer with this chip*/
  442. .bits_per_word = 16,
  443. };
  444. #endif
  445. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  446. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  447. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  448. .enable_dma = 0,
  449. .bits_per_word = 16,
  450. };
  451. #endif
  452. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  453. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  454. .enable_dma = 0,
  455. .bits_per_word = 16,
  456. };
  457. #endif
  458. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  459. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  460. .enable_dma = 1,
  461. .bits_per_word = 8,
  462. };
  463. #endif
  464. #if defined(CONFIG_PBX)
  465. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  466. .ctl_reg = 0x4, /* send zero */
  467. .enable_dma = 0,
  468. .bits_per_word = 8,
  469. .cs_change_per_word = 1,
  470. };
  471. #endif
  472. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  473. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  474. .enable_dma = 0,
  475. .bits_per_word = 16,
  476. };
  477. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  478. .model = 7877,
  479. .vref_delay_usecs = 50, /* internal, no capacitor */
  480. .x_plate_ohms = 419,
  481. .y_plate_ohms = 486,
  482. .pressure_max = 1000,
  483. .pressure_min = 0,
  484. .stopacq_polarity = 1,
  485. .first_conversion_delay = 3,
  486. .acquisition_time = 1,
  487. .averaging = 1,
  488. .pen_down_acc_interval = 1,
  489. };
  490. #endif
  491. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  492. && defined(CONFIG_SND_SOC_WM8731_SPI)
  493. static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
  494. .enable_dma = 0,
  495. .bits_per_word = 16,
  496. };
  497. #endif
  498. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  499. static struct bfin5xx_spi_chip spidev_chip_info = {
  500. .enable_dma = 0,
  501. .bits_per_word = 8,
  502. };
  503. #endif
  504. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  505. #if defined(CONFIG_MTD_M25P80) \
  506. || defined(CONFIG_MTD_M25P80_MODULE)
  507. {
  508. /* the modalias must be the same as spi device driver name */
  509. .modalias = "m25p80", /* Name of spi_driver for this device */
  510. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  511. .bus_num = 0, /* Framework bus number */
  512. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  513. .platform_data = &bfin_spi_flash_data,
  514. .controller_data = &spi_flash_chip_info,
  515. .mode = SPI_MODE_3,
  516. },
  517. #endif
  518. #if defined(CONFIG_SPI_ADC_BF533) \
  519. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  520. {
  521. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  522. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  523. .bus_num = 0, /* Framework bus number */
  524. .chip_select = 1, /* Framework chip select. */
  525. .platform_data = NULL, /* No spi_driver specific config */
  526. .controller_data = &spi_adc_chip_info,
  527. },
  528. #endif
  529. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  530. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  531. {
  532. .modalias = "ad1836-spi",
  533. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  534. .bus_num = 0,
  535. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  536. .controller_data = &ad1836_spi_chip_info,
  537. },
  538. #endif
  539. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  540. {
  541. .modalias = "ad9960-spi",
  542. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  543. .bus_num = 0,
  544. .chip_select = 1,
  545. .controller_data = &ad9960_spi_chip_info,
  546. },
  547. #endif
  548. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  549. {
  550. .modalias = "spi_mmc_dummy",
  551. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  552. .bus_num = 0,
  553. .chip_select = 0,
  554. .platform_data = NULL,
  555. .controller_data = &spi_mmc_chip_info,
  556. .mode = SPI_MODE_3,
  557. },
  558. {
  559. .modalias = "spi_mmc",
  560. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  561. .bus_num = 0,
  562. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  563. .platform_data = NULL,
  564. .controller_data = &spi_mmc_chip_info,
  565. .mode = SPI_MODE_3,
  566. },
  567. #endif
  568. #if defined(CONFIG_PBX)
  569. {
  570. .modalias = "fxs-spi",
  571. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  572. .bus_num = 0,
  573. .chip_select = 8 - CONFIG_J11_JUMPER,
  574. .controller_data = &spi_si3xxx_chip_info,
  575. .mode = SPI_MODE_3,
  576. },
  577. {
  578. .modalias = "fxo-spi",
  579. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  580. .bus_num = 0,
  581. .chip_select = 8 - CONFIG_J19_JUMPER,
  582. .controller_data = &spi_si3xxx_chip_info,
  583. .mode = SPI_MODE_3,
  584. },
  585. #endif
  586. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  587. {
  588. .modalias = "ad7877",
  589. .platform_data = &bfin_ad7877_ts_info,
  590. .irq = IRQ_PF6,
  591. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  592. .bus_num = 0,
  593. .chip_select = 1,
  594. .controller_data = &spi_ad7877_chip_info,
  595. },
  596. #endif
  597. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  598. && defined(CONFIG_SND_SOC_WM8731_SPI)
  599. {
  600. .modalias = "wm8731",
  601. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  602. .bus_num = 0,
  603. .chip_select = 5,
  604. .controller_data = &spi_wm8731_chip_info,
  605. .mode = SPI_MODE_0,
  606. },
  607. #endif
  608. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  609. {
  610. .modalias = "spidev",
  611. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  612. .bus_num = 0,
  613. .chip_select = 1,
  614. .controller_data = &spidev_chip_info,
  615. },
  616. #endif
  617. };
  618. /* SPI controller data */
  619. static struct bfin5xx_spi_master bfin_spi0_info = {
  620. .num_chipselect = 8,
  621. .enable_dma = 1, /* master has the ability to do dma transfer */
  622. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  623. };
  624. /* SPI (0) */
  625. static struct resource bfin_spi0_resource[] = {
  626. [0] = {
  627. .start = SPI0_REGBASE,
  628. .end = SPI0_REGBASE + 0xFF,
  629. .flags = IORESOURCE_MEM,
  630. },
  631. [1] = {
  632. .start = CH_SPI,
  633. .end = CH_SPI,
  634. .flags = IORESOURCE_IRQ,
  635. },
  636. };
  637. static struct platform_device bfin_spi0_device = {
  638. .name = "bfin-spi",
  639. .id = 0, /* Bus number */
  640. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  641. .resource = bfin_spi0_resource,
  642. .dev = {
  643. .platform_data = &bfin_spi0_info, /* Passed to driver */
  644. },
  645. };
  646. #endif /* spi master and devices */
  647. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  648. static struct platform_device bfin_fb_device = {
  649. .name = "bf537-lq035",
  650. };
  651. #endif
  652. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  653. static struct platform_device bfin_fb_adv7393_device = {
  654. .name = "bfin-adv7393",
  655. };
  656. #endif
  657. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  658. static struct resource bfin_uart_resources[] = {
  659. #ifdef CONFIG_SERIAL_BFIN_UART0
  660. {
  661. .start = 0xFFC00400,
  662. .end = 0xFFC004FF,
  663. .flags = IORESOURCE_MEM,
  664. },
  665. #endif
  666. #ifdef CONFIG_SERIAL_BFIN_UART1
  667. {
  668. .start = 0xFFC02000,
  669. .end = 0xFFC020FF,
  670. .flags = IORESOURCE_MEM,
  671. },
  672. #endif
  673. };
  674. static struct platform_device bfin_uart_device = {
  675. .name = "bfin-uart",
  676. .id = 1,
  677. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  678. .resource = bfin_uart_resources,
  679. };
  680. #endif
  681. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  682. static struct resource bfin_sir_resources[] = {
  683. #ifdef CONFIG_BFIN_SIR0
  684. {
  685. .start = 0xFFC00400,
  686. .end = 0xFFC004FF,
  687. .flags = IORESOURCE_MEM,
  688. },
  689. #endif
  690. #ifdef CONFIG_BFIN_SIR1
  691. {
  692. .start = 0xFFC02000,
  693. .end = 0xFFC020FF,
  694. .flags = IORESOURCE_MEM,
  695. },
  696. #endif
  697. };
  698. static struct platform_device bfin_sir_device = {
  699. .name = "bfin_sir",
  700. .id = 0,
  701. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  702. .resource = bfin_sir_resources,
  703. };
  704. #endif
  705. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  706. static struct resource bfin_twi0_resource[] = {
  707. [0] = {
  708. .start = TWI0_REGBASE,
  709. .end = TWI0_REGBASE,
  710. .flags = IORESOURCE_MEM,
  711. },
  712. [1] = {
  713. .start = IRQ_TWI,
  714. .end = IRQ_TWI,
  715. .flags = IORESOURCE_IRQ,
  716. },
  717. };
  718. static struct platform_device i2c_bfin_twi_device = {
  719. .name = "i2c-bfin-twi",
  720. .id = 0,
  721. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  722. .resource = bfin_twi0_resource,
  723. };
  724. #endif
  725. #ifdef CONFIG_I2C_BOARDINFO
  726. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  727. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  728. {
  729. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  730. .type = "pcf8574_lcd",
  731. },
  732. #endif
  733. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  734. {
  735. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  736. .type = "pcf8574_keypad",
  737. .irq = IRQ_PF8,
  738. },
  739. #endif
  740. };
  741. #endif
  742. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  743. static struct platform_device bfin_sport0_uart_device = {
  744. .name = "bfin-sport-uart",
  745. .id = 0,
  746. };
  747. static struct platform_device bfin_sport1_uart_device = {
  748. .name = "bfin-sport-uart",
  749. .id = 1,
  750. };
  751. #endif
  752. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  753. #define PATA_INT 55
  754. static struct pata_platform_info bfin_pata_platform_data = {
  755. .ioport_shift = 1,
  756. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  757. };
  758. static struct resource bfin_pata_resources[] = {
  759. {
  760. .start = 0x20314020,
  761. .end = 0x2031403F,
  762. .flags = IORESOURCE_MEM,
  763. },
  764. {
  765. .start = 0x2031401C,
  766. .end = 0x2031401F,
  767. .flags = IORESOURCE_MEM,
  768. },
  769. {
  770. .start = PATA_INT,
  771. .end = PATA_INT,
  772. .flags = IORESOURCE_IRQ,
  773. },
  774. };
  775. static struct platform_device bfin_pata_device = {
  776. .name = "pata_platform",
  777. .id = -1,
  778. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  779. .resource = bfin_pata_resources,
  780. .dev = {
  781. .platform_data = &bfin_pata_platform_data,
  782. }
  783. };
  784. #endif
  785. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  786. #include <linux/input.h>
  787. #include <linux/gpio_keys.h>
  788. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  789. {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
  790. {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
  791. };
  792. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  793. .buttons = bfin_gpio_keys_table,
  794. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  795. };
  796. static struct platform_device bfin_device_gpiokeys = {
  797. .name = "gpio-keys",
  798. .dev = {
  799. .platform_data = &bfin_gpio_keys_data,
  800. },
  801. };
  802. #endif
  803. static struct resource bfin_gpios_resources = {
  804. .start = 0,
  805. .end = MAX_BLACKFIN_GPIOS - 1,
  806. .flags = IORESOURCE_IRQ,
  807. };
  808. static struct platform_device bfin_gpios_device = {
  809. .name = "simple-gpio",
  810. .id = -1,
  811. .num_resources = 1,
  812. .resource = &bfin_gpios_resources,
  813. };
  814. static const unsigned int cclk_vlev_datasheet[] =
  815. {
  816. VRPAIR(VLEV_100, 400000000),
  817. VRPAIR(VLEV_105, 426000000),
  818. VRPAIR(VLEV_110, 500000000),
  819. VRPAIR(VLEV_115, 533000000),
  820. VRPAIR(VLEV_120, 600000000),
  821. };
  822. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  823. .tuple_tab = cclk_vlev_datasheet,
  824. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  825. .vr_settling_time = 25 /* us */,
  826. };
  827. static struct platform_device bfin_dpmc = {
  828. .name = "bfin dpmc",
  829. .dev = {
  830. .platform_data = &bfin_dmpc_vreg_data,
  831. },
  832. };
  833. static struct platform_device *stamp_devices[] __initdata = {
  834. &bfin_dpmc,
  835. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  836. &bf5xx_nand_device,
  837. #endif
  838. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  839. &bfin_pcmcia_cf_device,
  840. #endif
  841. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  842. &rtc_device,
  843. #endif
  844. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  845. &sl811_hcd_device,
  846. #endif
  847. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  848. &isp1362_hcd_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_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  891. &bfin_pata_device,
  892. #endif
  893. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  894. &bfin_device_gpiokeys,
  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. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  910. spi_register_board_info(bfin_spi_board_info,
  911. ARRAY_SIZE(bfin_spi_board_info));
  912. #endif
  913. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  914. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  915. #endif
  916. return 0;
  917. }
  918. arch_initcall(stamp_init);
  919. void native_machine_restart(char *cmd)
  920. {
  921. /* workaround reboot hang when booting from SPI */
  922. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  923. bfin_gpio_reset_spi0_ssel1();
  924. }
  925. void bfin_get_ether_addr(char *addr)
  926. {
  927. /* the MAC is stored in OTP memory page 0xDF */
  928. u32 ret;
  929. u64 otp_mac;
  930. u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
  931. ret = otp_read(0xDF, 0x00, &otp_mac);
  932. if (!(ret & 0x1)) {
  933. char *otp_mac_p = (char *)&otp_mac;
  934. for (ret = 0; ret < 6; ++ret)
  935. addr[ret] = otp_mac_p[5 - ret];
  936. }
  937. }
  938. EXPORT_SYMBOL(bfin_get_ether_addr);