generic_board.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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/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/pata_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_AD5304) || defined(CONFIG_AD5304_MODULE)
  335. static struct bfin5xx_spi_chip ad5304_chip_info = {
  336. .enable_dma = 0,
  337. .bits_per_word = 16,
  338. };
  339. #endif
  340. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  341. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  342. .enable_dma = 0,
  343. .bits_per_word = 16,
  344. };
  345. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  346. .model = 7877,
  347. .vref_delay_usecs = 50, /* internal, no capacitor */
  348. .x_plate_ohms = 419,
  349. .y_plate_ohms = 486,
  350. .pressure_max = 1000,
  351. .pressure_min = 0,
  352. .stopacq_polarity = 1,
  353. .first_conversion_delay = 3,
  354. .acquisition_time = 1,
  355. .averaging = 1,
  356. .pen_down_acc_interval = 1,
  357. };
  358. #endif
  359. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  360. #if defined(CONFIG_MTD_M25P80) \
  361. || defined(CONFIG_MTD_M25P80_MODULE)
  362. {
  363. /* the modalias must be the same as spi device driver name */
  364. .modalias = "m25p80", /* Name of spi_driver for this device */
  365. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  366. .bus_num = 0, /* Framework bus number */
  367. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  368. .platform_data = &bfin_spi_flash_data,
  369. .controller_data = &spi_flash_chip_info,
  370. .mode = SPI_MODE_3,
  371. },
  372. #endif
  373. #if defined(CONFIG_SPI_ADC_BF533) \
  374. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  375. {
  376. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  377. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  378. .bus_num = 0, /* Framework bus number */
  379. .chip_select = 1, /* Framework chip select. */
  380. .platform_data = NULL, /* No spi_driver specific config */
  381. .controller_data = &spi_adc_chip_info,
  382. },
  383. #endif
  384. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  385. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  386. {
  387. .modalias = "ad1836-spi",
  388. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  389. .bus_num = 0,
  390. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  391. .controller_data = &ad1836_spi_chip_info,
  392. },
  393. #endif
  394. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  395. {
  396. .modalias = "ad9960-spi",
  397. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  398. .bus_num = 0,
  399. .chip_select = 1,
  400. .controller_data = &ad9960_spi_chip_info,
  401. },
  402. #endif
  403. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  404. {
  405. .modalias = "spi_mmc_dummy",
  406. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  407. .bus_num = 0,
  408. .chip_select = 0,
  409. .platform_data = NULL,
  410. .controller_data = &spi_mmc_chip_info,
  411. .mode = SPI_MODE_3,
  412. },
  413. {
  414. .modalias = "spi_mmc",
  415. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  416. .bus_num = 0,
  417. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  418. .platform_data = NULL,
  419. .controller_data = &spi_mmc_chip_info,
  420. .mode = SPI_MODE_3,
  421. },
  422. #endif
  423. #if defined(CONFIG_PBX)
  424. {
  425. .modalias = "fxs-spi",
  426. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  427. .bus_num = 0,
  428. .chip_select = 8 - CONFIG_J11_JUMPER,
  429. .controller_data = &spi_si3xxx_chip_info,
  430. .mode = SPI_MODE_3,
  431. },
  432. {
  433. .modalias = "fxo-spi",
  434. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  435. .bus_num = 0,
  436. .chip_select = 8 - CONFIG_J19_JUMPER,
  437. .controller_data = &spi_si3xxx_chip_info,
  438. .mode = SPI_MODE_3,
  439. },
  440. #endif
  441. #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
  442. {
  443. .modalias = "ad5304_spi",
  444. .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */
  445. .bus_num = 0,
  446. .chip_select = 2,
  447. .platform_data = NULL,
  448. .controller_data = &ad5304_chip_info,
  449. .mode = SPI_MODE_2,
  450. },
  451. #endif
  452. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  453. {
  454. .modalias = "ad7877",
  455. .platform_data = &bfin_ad7877_ts_info,
  456. .irq = IRQ_PF6,
  457. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  458. .bus_num = 0,
  459. .chip_select = 1,
  460. .controller_data = &spi_ad7877_chip_info,
  461. },
  462. #endif
  463. };
  464. /* SPI controller data */
  465. static struct bfin5xx_spi_master bfin_spi0_info = {
  466. .num_chipselect = 8,
  467. .enable_dma = 1, /* master has the ability to do dma transfer */
  468. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  469. };
  470. /* SPI (0) */
  471. static struct resource bfin_spi0_resource[] = {
  472. [0] = {
  473. .start = SPI0_REGBASE,
  474. .end = SPI0_REGBASE + 0xFF,
  475. .flags = IORESOURCE_MEM,
  476. },
  477. [1] = {
  478. .start = CH_SPI,
  479. .end = CH_SPI,
  480. .flags = IORESOURCE_IRQ,
  481. },
  482. };
  483. static struct platform_device bfin_spi0_device = {
  484. .name = "bfin-spi",
  485. .id = 0, /* Bus number */
  486. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  487. .resource = bfin_spi0_resource,
  488. .dev = {
  489. .platform_data = &bfin_spi0_info, /* Passed to driver */
  490. },
  491. };
  492. #endif /* spi master and devices */
  493. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  494. static struct platform_device bfin_fb_device = {
  495. .name = "bf537-lq035",
  496. };
  497. #endif
  498. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  499. static struct platform_device bfin_fb_adv7393_device = {
  500. .name = "bfin-adv7393",
  501. };
  502. #endif
  503. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  504. static struct resource bfin_uart_resources[] = {
  505. {
  506. .start = 0xFFC00400,
  507. .end = 0xFFC004FF,
  508. .flags = IORESOURCE_MEM,
  509. }, {
  510. .start = 0xFFC02000,
  511. .end = 0xFFC020FF,
  512. .flags = IORESOURCE_MEM,
  513. },
  514. };
  515. static struct platform_device bfin_uart_device = {
  516. .name = "bfin-uart",
  517. .id = 1,
  518. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  519. .resource = bfin_uart_resources,
  520. };
  521. #endif
  522. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  523. static struct resource bfin_twi0_resource[] = {
  524. [0] = {
  525. .start = TWI0_REGBASE,
  526. .end = TWI0_REGBASE + 0xFF,
  527. .flags = IORESOURCE_MEM,
  528. },
  529. [1] = {
  530. .start = IRQ_TWI,
  531. .end = IRQ_TWI,
  532. .flags = IORESOURCE_IRQ,
  533. },
  534. };
  535. static struct platform_device i2c_bfin_twi_device = {
  536. .name = "i2c-bfin-twi",
  537. .id = 0,
  538. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  539. .resource = bfin_twi0_resource,
  540. };
  541. #endif
  542. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  543. static struct platform_device bfin_sport0_uart_device = {
  544. .name = "bfin-sport-uart",
  545. .id = 0,
  546. };
  547. static struct platform_device bfin_sport1_uart_device = {
  548. .name = "bfin-sport-uart",
  549. .id = 1,
  550. };
  551. #endif
  552. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  553. #define PATA_INT 55
  554. static struct pata_platform_info bfin_pata_platform_data = {
  555. .ioport_shift = 1,
  556. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  557. };
  558. static struct resource bfin_pata_resources[] = {
  559. {
  560. .start = 0x20314020,
  561. .end = 0x2031403F,
  562. .flags = IORESOURCE_MEM,
  563. },
  564. {
  565. .start = 0x2031401C,
  566. .end = 0x2031401F,
  567. .flags = IORESOURCE_MEM,
  568. },
  569. {
  570. .start = PATA_INT,
  571. .end = PATA_INT,
  572. .flags = IORESOURCE_IRQ,
  573. },
  574. };
  575. static struct platform_device bfin_pata_device = {
  576. .name = "pata_platform",
  577. .id = -1,
  578. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  579. .resource = bfin_pata_resources,
  580. .dev = {
  581. .platform_data = &bfin_pata_platform_data,
  582. }
  583. };
  584. #endif
  585. static struct platform_device *stamp_devices[] __initdata = {
  586. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  587. &bfin_pcmcia_cf_device,
  588. #endif
  589. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  590. &rtc_device,
  591. #endif
  592. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  593. &sl811_hcd_device,
  594. #endif
  595. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  596. &isp1362_hcd_device,
  597. #endif
  598. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  599. &smc91x_device,
  600. #endif
  601. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  602. &dm9000_device,
  603. #endif
  604. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  605. &bfin_mac_device,
  606. #endif
  607. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  608. &net2272_bfin_device,
  609. #endif
  610. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  611. &bfin_spi0_device,
  612. #endif
  613. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  614. &bfin_fb_device,
  615. #endif
  616. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  617. &bfin_fb_adv7393_device,
  618. #endif
  619. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  620. &bfin_uart_device,
  621. #endif
  622. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  623. &i2c_bfin_twi_device,
  624. #endif
  625. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  626. &bfin_sport0_uart_device,
  627. &bfin_sport1_uart_device,
  628. #endif
  629. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  630. &bfin_pata_device,
  631. #endif
  632. };
  633. static int __init stamp_init(void)
  634. {
  635. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  636. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  637. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  638. spi_register_board_info(bfin_spi_board_info,
  639. ARRAY_SIZE(bfin_spi_board_info));
  640. #endif
  641. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  642. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  643. #endif
  644. return 0;
  645. }
  646. arch_initcall(stamp_init);
  647. void native_machine_restart(char *cmd)
  648. {
  649. /* workaround reboot hang when booting from SPI */
  650. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  651. bfin_gpio_reset_spi0_ssel1();
  652. }
  653. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  654. void bfin_get_ether_addr(char *addr)
  655. {
  656. random_ether_addr(addr);
  657. printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
  658. }
  659. EXPORT_SYMBOL(bfin_get_ether_addr);
  660. #endif