ezkit.c 19 KB

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