generic_board.c 18 KB

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