generic_board.c 18 KB

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