ezkit.c 23 KB

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