stamp.c 19 KB

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