generic_board.c 19 KB

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