ezkit.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  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_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  438. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  439. .enable_dma = 0,
  440. .bits_per_word = 16,
  441. };
  442. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  443. .model = 7877,
  444. .vref_delay_usecs = 50, /* internal, no capacitor */
  445. .x_plate_ohms = 419,
  446. .y_plate_ohms = 486,
  447. .pressure_max = 1000,
  448. .pressure_min = 0,
  449. .stopacq_polarity = 1,
  450. .first_conversion_delay = 3,
  451. .acquisition_time = 1,
  452. .averaging = 1,
  453. .pen_down_acc_interval = 1,
  454. };
  455. #endif
  456. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  457. && defined(CONFIG_SND_SOC_WM8731_SPI)
  458. static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
  459. .enable_dma = 0,
  460. .bits_per_word = 16,
  461. };
  462. #endif
  463. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  464. static struct bfin5xx_spi_chip spidev_chip_info = {
  465. .enable_dma = 0,
  466. .bits_per_word = 8,
  467. };
  468. #endif
  469. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  470. #if defined(CONFIG_MTD_M25P80) \
  471. || defined(CONFIG_MTD_M25P80_MODULE)
  472. {
  473. /* the modalias must be the same as spi device driver name */
  474. .modalias = "m25p80", /* Name of spi_driver for this device */
  475. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  476. .bus_num = 0, /* Framework bus number */
  477. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  478. .platform_data = &bfin_spi_flash_data,
  479. .controller_data = &spi_flash_chip_info,
  480. .mode = SPI_MODE_3,
  481. },
  482. #endif
  483. #if defined(CONFIG_SPI_ADC_BF533) \
  484. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  485. {
  486. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  487. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  488. .bus_num = 0, /* Framework bus number */
  489. .chip_select = 1, /* Framework chip select. */
  490. .platform_data = NULL, /* No spi_driver specific config */
  491. .controller_data = &spi_adc_chip_info,
  492. },
  493. #endif
  494. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  495. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  496. {
  497. .modalias = "ad1836-spi",
  498. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  499. .bus_num = 0,
  500. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  501. .controller_data = &ad1836_spi_chip_info,
  502. },
  503. #endif
  504. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  505. {
  506. .modalias = "ad9960-spi",
  507. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  508. .bus_num = 0,
  509. .chip_select = 1,
  510. .controller_data = &ad9960_spi_chip_info,
  511. },
  512. #endif
  513. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  514. {
  515. .modalias = "spi_mmc_dummy",
  516. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  517. .bus_num = 0,
  518. .chip_select = 0,
  519. .platform_data = NULL,
  520. .controller_data = &spi_mmc_chip_info,
  521. .mode = SPI_MODE_3,
  522. },
  523. {
  524. .modalias = "spi_mmc",
  525. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  526. .bus_num = 0,
  527. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  528. .platform_data = NULL,
  529. .controller_data = &spi_mmc_chip_info,
  530. .mode = SPI_MODE_3,
  531. },
  532. #endif
  533. #if defined(CONFIG_PBX)
  534. {
  535. .modalias = "fxs-spi",
  536. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  537. .bus_num = 0,
  538. .chip_select = 8 - CONFIG_J11_JUMPER,
  539. .controller_data = &spi_si3xxx_chip_info,
  540. .mode = SPI_MODE_3,
  541. },
  542. {
  543. .modalias = "fxo-spi",
  544. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  545. .bus_num = 0,
  546. .chip_select = 8 - CONFIG_J19_JUMPER,
  547. .controller_data = &spi_si3xxx_chip_info,
  548. .mode = SPI_MODE_3,
  549. },
  550. #endif
  551. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  552. {
  553. .modalias = "ad7877",
  554. .platform_data = &bfin_ad7877_ts_info,
  555. .irq = IRQ_PF6,
  556. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  557. .bus_num = 0,
  558. .chip_select = 1,
  559. .controller_data = &spi_ad7877_chip_info,
  560. },
  561. #endif
  562. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  563. && defined(CONFIG_SND_SOC_WM8731_SPI)
  564. {
  565. .modalias = "wm8731",
  566. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  567. .bus_num = 0,
  568. .chip_select = 5,
  569. .controller_data = &spi_wm8731_chip_info,
  570. .mode = SPI_MODE_0,
  571. },
  572. #endif
  573. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  574. {
  575. .modalias = "spidev",
  576. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  577. .bus_num = 0,
  578. .chip_select = 1,
  579. .controller_data = &spidev_chip_info,
  580. },
  581. #endif
  582. };
  583. /* SPI controller data */
  584. static struct bfin5xx_spi_master bfin_spi0_info = {
  585. .num_chipselect = 8,
  586. .enable_dma = 1, /* master has the ability to do dma transfer */
  587. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  588. };
  589. /* SPI (0) */
  590. static struct resource bfin_spi0_resource[] = {
  591. [0] = {
  592. .start = SPI0_REGBASE,
  593. .end = SPI0_REGBASE + 0xFF,
  594. .flags = IORESOURCE_MEM,
  595. },
  596. [1] = {
  597. .start = CH_SPI,
  598. .end = CH_SPI,
  599. .flags = IORESOURCE_IRQ,
  600. },
  601. };
  602. static struct platform_device bfin_spi0_device = {
  603. .name = "bfin-spi",
  604. .id = 0, /* Bus number */
  605. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  606. .resource = bfin_spi0_resource,
  607. .dev = {
  608. .platform_data = &bfin_spi0_info, /* Passed to driver */
  609. },
  610. };
  611. #endif /* spi master and devices */
  612. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  613. static struct platform_device bfin_fb_device = {
  614. .name = "bf537-lq035",
  615. };
  616. #endif
  617. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  618. static struct platform_device bfin_fb_adv7393_device = {
  619. .name = "bfin-adv7393",
  620. };
  621. #endif
  622. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  623. static struct resource bfin_uart_resources[] = {
  624. #ifdef CONFIG_SERIAL_BFIN_UART0
  625. {
  626. .start = 0xFFC00400,
  627. .end = 0xFFC004FF,
  628. .flags = IORESOURCE_MEM,
  629. },
  630. #endif
  631. #ifdef CONFIG_SERIAL_BFIN_UART1
  632. {
  633. .start = 0xFFC02000,
  634. .end = 0xFFC020FF,
  635. .flags = IORESOURCE_MEM,
  636. },
  637. #endif
  638. };
  639. static struct platform_device bfin_uart_device = {
  640. .name = "bfin-uart",
  641. .id = 1,
  642. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  643. .resource = bfin_uart_resources,
  644. };
  645. #endif
  646. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  647. static struct resource bfin_twi0_resource[] = {
  648. [0] = {
  649. .start = TWI0_REGBASE,
  650. .end = TWI0_REGBASE,
  651. .flags = IORESOURCE_MEM,
  652. },
  653. [1] = {
  654. .start = IRQ_TWI,
  655. .end = IRQ_TWI,
  656. .flags = IORESOURCE_IRQ,
  657. },
  658. };
  659. static struct platform_device i2c_bfin_twi_device = {
  660. .name = "i2c-bfin-twi",
  661. .id = 0,
  662. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  663. .resource = bfin_twi0_resource,
  664. };
  665. #endif
  666. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  667. static struct platform_device bfin_sport0_uart_device = {
  668. .name = "bfin-sport-uart",
  669. .id = 0,
  670. };
  671. static struct platform_device bfin_sport1_uart_device = {
  672. .name = "bfin-sport-uart",
  673. .id = 1,
  674. };
  675. #endif
  676. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  677. #define PATA_INT 55
  678. static struct pata_platform_info bfin_pata_platform_data = {
  679. .ioport_shift = 1,
  680. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  681. };
  682. static struct resource bfin_pata_resources[] = {
  683. {
  684. .start = 0x20314020,
  685. .end = 0x2031403F,
  686. .flags = IORESOURCE_MEM,
  687. },
  688. {
  689. .start = 0x2031401C,
  690. .end = 0x2031401F,
  691. .flags = IORESOURCE_MEM,
  692. },
  693. {
  694. .start = PATA_INT,
  695. .end = PATA_INT,
  696. .flags = IORESOURCE_IRQ,
  697. },
  698. };
  699. static struct platform_device bfin_pata_device = {
  700. .name = "pata_platform",
  701. .id = -1,
  702. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  703. .resource = bfin_pata_resources,
  704. .dev = {
  705. .platform_data = &bfin_pata_platform_data,
  706. }
  707. };
  708. #endif
  709. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  710. #include <linux/input.h>
  711. #include <linux/gpio_keys.h>
  712. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  713. {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
  714. {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
  715. };
  716. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  717. .buttons = bfin_gpio_keys_table,
  718. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  719. };
  720. static struct platform_device bfin_device_gpiokeys = {
  721. .name = "gpio-keys",
  722. .dev = {
  723. .platform_data = &bfin_gpio_keys_data,
  724. },
  725. };
  726. #endif
  727. static struct resource bfin_gpios_resources = {
  728. .start = 0,
  729. .end = MAX_BLACKFIN_GPIOS - 1,
  730. .flags = IORESOURCE_IRQ,
  731. };
  732. static struct platform_device bfin_gpios_device = {
  733. .name = "simple-gpio",
  734. .id = -1,
  735. .num_resources = 1,
  736. .resource = &bfin_gpios_resources,
  737. };
  738. static struct platform_device *stamp_devices[] __initdata = {
  739. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  740. &bf5xx_nand_device,
  741. #endif
  742. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  743. &bfin_pcmcia_cf_device,
  744. #endif
  745. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  746. &rtc_device,
  747. #endif
  748. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  749. &sl811_hcd_device,
  750. #endif
  751. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  752. &isp1362_hcd_device,
  753. #endif
  754. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  755. &musb_device,
  756. #endif
  757. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  758. &smc91x_device,
  759. #endif
  760. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  761. &dm9000_device,
  762. #endif
  763. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  764. &bfin_mac_device,
  765. #endif
  766. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  767. &net2272_bfin_device,
  768. #endif
  769. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  770. &bfin_spi0_device,
  771. #endif
  772. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  773. &bfin_fb_device,
  774. #endif
  775. #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
  776. &bf52x_t350mcqb_device,
  777. #endif
  778. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  779. &bfin_fb_adv7393_device,
  780. #endif
  781. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  782. &bfin_uart_device,
  783. #endif
  784. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  785. &i2c_bfin_twi_device,
  786. #endif
  787. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  788. &bfin_sport0_uart_device,
  789. &bfin_sport1_uart_device,
  790. #endif
  791. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  792. &bfin_pata_device,
  793. #endif
  794. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  795. &bfin_device_gpiokeys,
  796. #endif
  797. &bfin_gpios_device,
  798. };
  799. static int __init stamp_init(void)
  800. {
  801. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  802. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  803. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  804. spi_register_board_info(bfin_spi_board_info,
  805. ARRAY_SIZE(bfin_spi_board_info));
  806. #endif
  807. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  808. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  809. #endif
  810. return 0;
  811. }
  812. arch_initcall(stamp_init);
  813. void native_machine_restart(char *cmd)
  814. {
  815. /* workaround reboot hang when booting from SPI */
  816. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  817. bfin_gpio_reset_spi0_ssel1();
  818. }
  819. void bfin_get_ether_addr(char *addr)
  820. {
  821. /* the MAC is stored in OTP memory page 0xDF */
  822. u32 ret;
  823. u64 otp_mac;
  824. u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
  825. ret = otp_read(0xDF, 0x00, &otp_mac);
  826. if (!(ret & 0x1)) {
  827. char *otp_mac_p = (char *)&otp_mac;
  828. for (ret = 0; ret < 6; ++ret)
  829. addr[ret] = otp_mac_p[5 - ret];
  830. }
  831. }
  832. EXPORT_SYMBOL(bfin_get_ether_addr);