generic_board.c 18 KB

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