stamp.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. /*
  2. * File: arch/blackfin/mach-bf533/stamp.c
  3. * Based on: arch/blackfin/mach-bf533/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created: 2005
  7. * Description: Board Info File for the BF533-STAMP
  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/mtd/physmap.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/ata_platform.h>
  41. #include <linux/irq.h>
  42. #include <linux/i2c.h>
  43. #include <asm/dma.h>
  44. #include <asm/bfin5xx_spi.h>
  45. #include <asm/reboot.h>
  46. #include <asm/portmux.h>
  47. #include <asm/dpmc.h>
  48. /*
  49. * Name the Board for the /proc/cpuinfo
  50. */
  51. const char bfin_board_name[] = "ADDS-BF533-STAMP";
  52. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  53. static struct platform_device rtc_device = {
  54. .name = "rtc-bfin",
  55. .id = -1,
  56. };
  57. #endif
  58. /*
  59. * Driver needs to know address, irq and flag pin.
  60. */
  61. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  62. static struct resource smc91x_resources[] = {
  63. {
  64. .name = "smc91x-regs",
  65. .start = 0x20300300,
  66. .end = 0x20300300 + 16,
  67. .flags = IORESOURCE_MEM,
  68. }, {
  69. .start = IRQ_PF7,
  70. .end = IRQ_PF7,
  71. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  72. },
  73. };
  74. static struct platform_device smc91x_device = {
  75. .name = "smc91x",
  76. .id = 0,
  77. .num_resources = ARRAY_SIZE(smc91x_resources),
  78. .resource = smc91x_resources,
  79. };
  80. #endif
  81. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  82. static struct platform_device bfin_fb_adv7393_device = {
  83. .name = "bfin-adv7393",
  84. };
  85. #endif
  86. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  87. static struct resource net2272_bfin_resources[] = {
  88. {
  89. .start = 0x20300000,
  90. .end = 0x20300000 + 0x100,
  91. .flags = IORESOURCE_MEM,
  92. }, {
  93. .start = IRQ_PF10,
  94. .end = IRQ_PF10,
  95. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  96. },
  97. };
  98. static struct platform_device net2272_bfin_device = {
  99. .name = "net2272",
  100. .id = -1,
  101. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  102. .resource = net2272_bfin_resources,
  103. };
  104. #endif
  105. #if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE)
  106. static struct mtd_partition stamp_partitions[] = {
  107. {
  108. .name = "Bootloader",
  109. .size = 0x40000,
  110. .offset = 0,
  111. }, {
  112. .name = "Kernel",
  113. .size = 0xE0000,
  114. .offset = MTDPART_OFS_APPEND,
  115. }, {
  116. .name = "RootFS",
  117. .size = MTDPART_SIZ_FULL,
  118. .offset = MTDPART_OFS_APPEND,
  119. }
  120. };
  121. static struct physmap_flash_data stamp_flash_data = {
  122. .width = 2,
  123. .parts = stamp_partitions,
  124. .nr_parts = ARRAY_SIZE(stamp_partitions),
  125. };
  126. static struct resource stamp_flash_resource[] = {
  127. {
  128. .name = "cfi_probe",
  129. .start = 0x20000000,
  130. .end = 0x203fffff,
  131. .flags = IORESOURCE_MEM,
  132. }, {
  133. .start = CONFIG_ENET_FLASH_PIN,
  134. .flags = IORESOURCE_IRQ,
  135. }
  136. };
  137. static struct platform_device stamp_flash_device = {
  138. .name = "BF5xx-Flash",
  139. .id = 0,
  140. .dev = {
  141. .platform_data = &stamp_flash_data,
  142. },
  143. .num_resources = ARRAY_SIZE(stamp_flash_resource),
  144. .resource = stamp_flash_resource,
  145. };
  146. #endif
  147. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  148. /* all SPI peripherals info goes here */
  149. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  150. static struct mtd_partition bfin_spi_flash_partitions[] = {
  151. {
  152. .name = "bootloader",
  153. .size = 0x00040000,
  154. .offset = 0,
  155. .mask_flags = MTD_CAP_ROM
  156. }, {
  157. .name = "kernel",
  158. .size = 0xe0000,
  159. .offset = MTDPART_OFS_APPEND,
  160. }, {
  161. .name = "file system",
  162. .size = MTDPART_SIZ_FULL,
  163. .offset = MTDPART_OFS_APPEND,
  164. }
  165. };
  166. static struct flash_platform_data bfin_spi_flash_data = {
  167. .name = "m25p80",
  168. .parts = bfin_spi_flash_partitions,
  169. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  170. .type = "m25p64",
  171. };
  172. /* SPI flash chip (m25p64) */
  173. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  174. .enable_dma = 0, /* use dma transfer with this chip*/
  175. .bits_per_word = 8,
  176. };
  177. #endif
  178. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  179. /* SPI ADC chip */
  180. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  181. .enable_dma = 1, /* use dma transfer with this chip*/
  182. .bits_per_word = 16,
  183. };
  184. #endif
  185. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  186. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  187. .enable_dma = 0,
  188. .bits_per_word = 16,
  189. };
  190. #endif
  191. #if defined(CONFIG_PBX)
  192. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  193. .ctl_reg = 0x4, /* send zero */
  194. .enable_dma = 0,
  195. .bits_per_word = 8,
  196. .cs_change_per_word = 1,
  197. };
  198. #endif
  199. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  200. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  201. .enable_dma = 1,
  202. .bits_per_word = 8,
  203. };
  204. #endif
  205. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  206. static struct bfin5xx_spi_chip spidev_chip_info = {
  207. .enable_dma = 0,
  208. .bits_per_word = 8,
  209. };
  210. #endif
  211. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  212. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  213. {
  214. /* the modalias must be the same as spi device driver name */
  215. .modalias = "m25p80", /* Name of spi_driver for this device */
  216. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  217. .bus_num = 0, /* Framework bus number */
  218. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  219. .platform_data = &bfin_spi_flash_data,
  220. .controller_data = &spi_flash_chip_info,
  221. .mode = SPI_MODE_3,
  222. },
  223. #endif
  224. #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
  225. {
  226. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  227. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  228. .bus_num = 0, /* Framework bus number */
  229. .chip_select = 1, /* Framework chip select. */
  230. .platform_data = NULL, /* No spi_driver specific config */
  231. .controller_data = &spi_adc_chip_info,
  232. },
  233. #endif
  234. #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  235. {
  236. .modalias = "ad1836-spi",
  237. .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
  238. .bus_num = 0,
  239. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  240. .controller_data = &ad1836_spi_chip_info,
  241. },
  242. #endif
  243. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  244. {
  245. .modalias = "spi_mmc_dummy",
  246. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  247. .bus_num = 0,
  248. .chip_select = 0,
  249. .platform_data = NULL,
  250. .controller_data = &spi_mmc_chip_info,
  251. .mode = SPI_MODE_3,
  252. },
  253. {
  254. .modalias = "spi_mmc",
  255. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  256. .bus_num = 0,
  257. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  258. .platform_data = NULL,
  259. .controller_data = &spi_mmc_chip_info,
  260. .mode = SPI_MODE_3,
  261. },
  262. #endif
  263. #if defined(CONFIG_PBX)
  264. {
  265. .modalias = "fxs-spi",
  266. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  267. .bus_num = 0,
  268. .chip_select = 8 - CONFIG_J11_JUMPER,
  269. .controller_data = &spi_si3xxx_chip_info,
  270. .mode = SPI_MODE_3,
  271. },
  272. {
  273. .modalias = "fxo-spi",
  274. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  275. .bus_num = 0,
  276. .chip_select = 8 - CONFIG_J19_JUMPER,
  277. .controller_data = &spi_si3xxx_chip_info,
  278. .mode = SPI_MODE_3,
  279. },
  280. #endif
  281. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  282. {
  283. .modalias = "spidev",
  284. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  285. .bus_num = 0,
  286. .chip_select = 1,
  287. .controller_data = &spidev_chip_info,
  288. },
  289. #endif
  290. };
  291. /* SPI (0) */
  292. static struct resource bfin_spi0_resource[] = {
  293. [0] = {
  294. .start = SPI0_REGBASE,
  295. .end = SPI0_REGBASE + 0xFF,
  296. .flags = IORESOURCE_MEM,
  297. },
  298. [1] = {
  299. .start = CH_SPI,
  300. .end = CH_SPI,
  301. .flags = IORESOURCE_IRQ,
  302. }
  303. };
  304. /* SPI controller data */
  305. static struct bfin5xx_spi_master bfin_spi0_info = {
  306. .num_chipselect = 8,
  307. .enable_dma = 1, /* master has the ability to do dma transfer */
  308. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  309. };
  310. static struct platform_device bfin_spi0_device = {
  311. .name = "bfin-spi",
  312. .id = 0, /* Bus number */
  313. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  314. .resource = bfin_spi0_resource,
  315. .dev = {
  316. .platform_data = &bfin_spi0_info, /* Passed to driver */
  317. },
  318. };
  319. #endif /* spi master and devices */
  320. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  321. static struct platform_device bfin_fb_device = {
  322. .name = "bf537-fb",
  323. };
  324. #endif
  325. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  326. static struct resource bfin_uart_resources[] = {
  327. {
  328. .start = 0xFFC00400,
  329. .end = 0xFFC004FF,
  330. .flags = IORESOURCE_MEM,
  331. },
  332. };
  333. static struct platform_device bfin_uart_device = {
  334. .name = "bfin-uart",
  335. .id = 1,
  336. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  337. .resource = bfin_uart_resources,
  338. };
  339. #endif
  340. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  341. static struct resource bfin_sir_resources[] = {
  342. #ifdef CONFIG_BFIN_SIR0
  343. {
  344. .start = 0xFFC00400,
  345. .end = 0xFFC004FF,
  346. .flags = IORESOURCE_MEM,
  347. },
  348. #endif
  349. };
  350. static struct platform_device bfin_sir_device = {
  351. .name = "bfin_sir",
  352. .id = 0,
  353. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  354. .resource = bfin_sir_resources,
  355. };
  356. #endif
  357. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  358. static struct platform_device bfin_sport0_uart_device = {
  359. .name = "bfin-sport-uart",
  360. .id = 0,
  361. };
  362. static struct platform_device bfin_sport1_uart_device = {
  363. .name = "bfin-sport-uart",
  364. .id = 1,
  365. };
  366. #endif
  367. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  368. #define PATA_INT 55
  369. static struct pata_platform_info bfin_pata_platform_data = {
  370. .ioport_shift = 1,
  371. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  372. };
  373. static struct resource bfin_pata_resources[] = {
  374. {
  375. .start = 0x20314020,
  376. .end = 0x2031403F,
  377. .flags = IORESOURCE_MEM,
  378. },
  379. {
  380. .start = 0x2031401C,
  381. .end = 0x2031401F,
  382. .flags = IORESOURCE_MEM,
  383. },
  384. {
  385. .start = PATA_INT,
  386. .end = PATA_INT,
  387. .flags = IORESOURCE_IRQ,
  388. },
  389. };
  390. static struct platform_device bfin_pata_device = {
  391. .name = "pata_platform",
  392. .id = -1,
  393. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  394. .resource = bfin_pata_resources,
  395. .dev = {
  396. .platform_data = &bfin_pata_platform_data,
  397. }
  398. };
  399. #endif
  400. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  401. #include <linux/input.h>
  402. #include <linux/gpio_keys.h>
  403. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  404. {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
  405. {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
  406. {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
  407. };
  408. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  409. .buttons = bfin_gpio_keys_table,
  410. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  411. };
  412. static struct platform_device bfin_device_gpiokeys = {
  413. .name = "gpio-keys",
  414. .dev = {
  415. .platform_data = &bfin_gpio_keys_data,
  416. },
  417. };
  418. #endif
  419. static struct resource bfin_gpios_resources = {
  420. .start = 0,
  421. .end = MAX_BLACKFIN_GPIOS - 1,
  422. .flags = IORESOURCE_IRQ,
  423. };
  424. static struct platform_device bfin_gpios_device = {
  425. .name = "simple-gpio",
  426. .id = -1,
  427. .num_resources = 1,
  428. .resource = &bfin_gpios_resources,
  429. };
  430. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  431. #include <linux/i2c-gpio.h>
  432. static struct i2c_gpio_platform_data i2c_gpio_data = {
  433. .sda_pin = 2,
  434. .scl_pin = 3,
  435. .sda_is_open_drain = 0,
  436. .scl_is_open_drain = 0,
  437. .udelay = 40,
  438. };
  439. static struct platform_device i2c_gpio_device = {
  440. .name = "i2c-gpio",
  441. .id = 0,
  442. .dev = {
  443. .platform_data = &i2c_gpio_data,
  444. },
  445. };
  446. #endif
  447. #ifdef CONFIG_I2C_BOARDINFO
  448. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  449. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  450. {
  451. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  452. .irq = 39,
  453. },
  454. #endif
  455. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  456. {
  457. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  458. },
  459. #endif
  460. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  461. {
  462. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  463. .irq = 39,
  464. },
  465. #endif
  466. };
  467. #endif
  468. static const unsigned int cclk_vlev_datasheet[] =
  469. {
  470. VRPAIR(VLEV_085, 250000000),
  471. VRPAIR(VLEV_090, 376000000),
  472. VRPAIR(VLEV_095, 426000000),
  473. VRPAIR(VLEV_100, 426000000),
  474. VRPAIR(VLEV_105, 476000000),
  475. VRPAIR(VLEV_110, 476000000),
  476. VRPAIR(VLEV_115, 476000000),
  477. VRPAIR(VLEV_120, 600000000),
  478. VRPAIR(VLEV_125, 600000000),
  479. VRPAIR(VLEV_130, 600000000),
  480. };
  481. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  482. .tuple_tab = cclk_vlev_datasheet,
  483. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  484. .vr_settling_time = 25 /* us */,
  485. };
  486. static struct platform_device bfin_dpmc = {
  487. .name = "bfin dpmc",
  488. .dev = {
  489. .platform_data = &bfin_dmpc_vreg_data,
  490. },
  491. };
  492. static struct platform_device *stamp_devices[] __initdata = {
  493. &bfin_dpmc,
  494. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  495. &rtc_device,
  496. #endif
  497. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  498. &smc91x_device,
  499. #endif
  500. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  501. &bfin_fb_adv7393_device,
  502. #endif
  503. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  504. &net2272_bfin_device,
  505. #endif
  506. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  507. &bfin_spi0_device,
  508. #endif
  509. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  510. &bfin_uart_device,
  511. #endif
  512. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  513. &bfin_sir_device,
  514. #endif
  515. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  516. &bfin_sport0_uart_device,
  517. &bfin_sport1_uart_device,
  518. #endif
  519. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  520. &bfin_pata_device,
  521. #endif
  522. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  523. &bfin_device_gpiokeys,
  524. #endif
  525. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  526. &i2c_gpio_device,
  527. #endif
  528. &bfin_gpios_device,
  529. #if defined(CONFIG_MTD_BF5xx) || defined(CONFIG_MTD_BF5xx_MODULE)
  530. &stamp_flash_device,
  531. #endif
  532. };
  533. static int __init stamp_init(void)
  534. {
  535. int ret;
  536. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  537. #ifdef CONFIG_I2C_BOARDINFO
  538. i2c_register_board_info(0, bfin_i2c_board_info,
  539. ARRAY_SIZE(bfin_i2c_board_info));
  540. #endif
  541. ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  542. if (ret < 0)
  543. return ret;
  544. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  545. /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
  546. bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
  547. bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
  548. SSYNC();
  549. #endif
  550. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  551. spi_register_board_info(bfin_spi_board_info,
  552. ARRAY_SIZE(bfin_spi_board_info));
  553. #endif
  554. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  555. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  556. #endif
  557. return 0;
  558. }
  559. arch_initcall(stamp_init);
  560. void native_machine_restart(char *cmd)
  561. {
  562. #define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
  563. bfin_write_FIO_INEN(~BIT_TO_SET);
  564. bfin_write_FIO_DIR(BIT_TO_SET);
  565. bfin_write_FIO_FLAG_C(BIT_TO_SET);
  566. }