generic_board.c 18 KB

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