generic_board.c 18 KB

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