stamp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <linux/mtd/physmap.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #include <linux/spi/mmc_spi.h>
  16. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  17. #include <linux/usb/isp1362.h>
  18. #endif
  19. #include <linux/irq.h>
  20. #include <linux/i2c.h>
  21. #include <asm/dma.h>
  22. #include <asm/bfin5xx_spi.h>
  23. #include <asm/reboot.h>
  24. #include <asm/portmux.h>
  25. #include <asm/dpmc.h>
  26. /*
  27. * Name the Board for the /proc/cpuinfo
  28. */
  29. const char bfin_board_name[] = "ADI BF533-STAMP";
  30. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  31. static struct platform_device rtc_device = {
  32. .name = "rtc-bfin",
  33. .id = -1,
  34. };
  35. #endif
  36. /*
  37. * Driver needs to know address, irq and flag pin.
  38. */
  39. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  40. #include <linux/smc91x.h>
  41. static struct smc91x_platdata smc91x_info = {
  42. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  43. .leda = RPC_LED_100_10,
  44. .ledb = RPC_LED_TX_RX,
  45. };
  46. static struct resource smc91x_resources[] = {
  47. {
  48. .name = "smc91x-regs",
  49. .start = 0x20300300,
  50. .end = 0x20300300 + 16,
  51. .flags = IORESOURCE_MEM,
  52. }, {
  53. .start = IRQ_PF7,
  54. .end = IRQ_PF7,
  55. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  56. },
  57. };
  58. static struct platform_device smc91x_device = {
  59. .name = "smc91x",
  60. .id = 0,
  61. .num_resources = ARRAY_SIZE(smc91x_resources),
  62. .resource = smc91x_resources,
  63. .dev = {
  64. .platform_data = &smc91x_info,
  65. },
  66. };
  67. #endif
  68. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  69. static struct resource net2272_bfin_resources[] = {
  70. {
  71. .start = 0x20300000,
  72. .end = 0x20300000 + 0x100,
  73. .flags = IORESOURCE_MEM,
  74. }, {
  75. .start = IRQ_PF10,
  76. .end = IRQ_PF10,
  77. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  78. },
  79. };
  80. static struct platform_device net2272_bfin_device = {
  81. .name = "net2272",
  82. .id = -1,
  83. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  84. .resource = net2272_bfin_resources,
  85. };
  86. #endif
  87. #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
  88. static struct mtd_partition stamp_partitions[] = {
  89. {
  90. .name = "bootloader(nor)",
  91. .size = 0x40000,
  92. .offset = 0,
  93. }, {
  94. .name = "linux kernel(nor)",
  95. .size = 0x180000,
  96. .offset = MTDPART_OFS_APPEND,
  97. }, {
  98. .name = "file system(nor)",
  99. .size = MTDPART_SIZ_FULL,
  100. .offset = MTDPART_OFS_APPEND,
  101. }
  102. };
  103. static struct physmap_flash_data stamp_flash_data = {
  104. .width = 2,
  105. .parts = stamp_partitions,
  106. .nr_parts = ARRAY_SIZE(stamp_partitions),
  107. };
  108. static struct resource stamp_flash_resource[] = {
  109. {
  110. .name = "cfi_probe",
  111. .start = 0x20000000,
  112. .end = 0x203fffff,
  113. .flags = IORESOURCE_MEM,
  114. }, {
  115. .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
  116. .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
  117. .flags = IORESOURCE_MEM,
  118. }, {
  119. .start = GPIO_PF0,
  120. .flags = IORESOURCE_IRQ,
  121. }
  122. };
  123. static struct platform_device stamp_flash_device = {
  124. .name = "bfin-async-flash",
  125. .id = 0,
  126. .dev = {
  127. .platform_data = &stamp_flash_data,
  128. },
  129. .num_resources = ARRAY_SIZE(stamp_flash_resource),
  130. .resource = stamp_flash_resource,
  131. };
  132. #endif
  133. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  134. static struct mtd_partition bfin_spi_flash_partitions[] = {
  135. {
  136. .name = "bootloader(spi)",
  137. .size = 0x00040000,
  138. .offset = 0,
  139. .mask_flags = MTD_CAP_ROM
  140. }, {
  141. .name = "linux kernel(spi)",
  142. .size = 0x180000,
  143. .offset = MTDPART_OFS_APPEND,
  144. }, {
  145. .name = "file system(spi)",
  146. .size = MTDPART_SIZ_FULL,
  147. .offset = MTDPART_OFS_APPEND,
  148. }
  149. };
  150. static struct flash_platform_data bfin_spi_flash_data = {
  151. .name = "m25p80",
  152. .parts = bfin_spi_flash_partitions,
  153. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  154. .type = "m25p64",
  155. };
  156. /* SPI flash chip (m25p64) */
  157. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  158. .enable_dma = 0, /* use dma transfer with this chip*/
  159. .bits_per_word = 8,
  160. };
  161. #endif
  162. #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  163. /* SPI ADC chip */
  164. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  165. .enable_dma = 1, /* use dma transfer with this chip*/
  166. .bits_per_word = 16,
  167. };
  168. #endif
  169. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  170. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  171. .enable_dma = 0,
  172. .bits_per_word = 16,
  173. };
  174. #endif
  175. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  176. static struct bfin5xx_spi_chip spidev_chip_info = {
  177. .enable_dma = 0,
  178. .bits_per_word = 8,
  179. };
  180. #endif
  181. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  182. #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
  183. static int bfin_mmc_spi_init(struct device *dev,
  184. irqreturn_t (*detect_int)(int, void *), void *data)
  185. {
  186. return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
  187. IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
  188. "mmc-spi-detect", data);
  189. }
  190. static void bfin_mmc_spi_exit(struct device *dev, void *data)
  191. {
  192. free_irq(MMC_SPI_CARD_DETECT_INT, data);
  193. }
  194. static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
  195. .init = bfin_mmc_spi_init,
  196. .exit = bfin_mmc_spi_exit,
  197. .detect_delay = 100, /* msecs */
  198. };
  199. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  200. .enable_dma = 0,
  201. .bits_per_word = 8,
  202. .pio_interrupt = 0,
  203. };
  204. #endif
  205. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  206. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  207. {
  208. /* the modalias must be the same as spi device driver name */
  209. .modalias = "m25p80", /* Name of spi_driver for this device */
  210. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  211. .bus_num = 0, /* Framework bus number */
  212. .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
  213. .platform_data = &bfin_spi_flash_data,
  214. .controller_data = &spi_flash_chip_info,
  215. .mode = SPI_MODE_3,
  216. },
  217. #endif
  218. #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  219. {
  220. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  221. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  222. .bus_num = 0, /* Framework bus number */
  223. .chip_select = 1, /* Framework chip select. */
  224. .platform_data = NULL, /* No spi_driver specific config */
  225. .controller_data = &spi_adc_chip_info,
  226. },
  227. #endif
  228. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  229. {
  230. .modalias = "ad183x",
  231. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  232. .bus_num = 0,
  233. .chip_select = 4,
  234. .platform_data = "ad1836", /* only includes chip name for the moment */
  235. .controller_data = &ad1836_spi_chip_info,
  236. .mode = SPI_MODE_3,
  237. },
  238. #endif
  239. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  240. {
  241. .modalias = "spidev",
  242. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  243. .bus_num = 0,
  244. .chip_select = 1,
  245. .controller_data = &spidev_chip_info,
  246. },
  247. #endif
  248. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  249. {
  250. .modalias = "mmc_spi",
  251. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  252. .bus_num = 0,
  253. .chip_select = 4,
  254. .platform_data = &bfin_mmc_spi_pdata,
  255. .controller_data = &mmc_spi_chip_info,
  256. .mode = SPI_MODE_3,
  257. },
  258. #endif
  259. };
  260. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  261. /* SPI (0) */
  262. static struct resource bfin_spi0_resource[] = {
  263. [0] = {
  264. .start = SPI0_REGBASE,
  265. .end = SPI0_REGBASE + 0xFF,
  266. .flags = IORESOURCE_MEM,
  267. },
  268. [1] = {
  269. .start = CH_SPI,
  270. .end = CH_SPI,
  271. .flags = IORESOURCE_DMA,
  272. },
  273. [2] = {
  274. .start = IRQ_SPI,
  275. .end = IRQ_SPI,
  276. .flags = IORESOURCE_IRQ,
  277. }
  278. };
  279. /* SPI controller data */
  280. static struct bfin5xx_spi_master bfin_spi0_info = {
  281. .num_chipselect = 8,
  282. .enable_dma = 1, /* master has the ability to do dma transfer */
  283. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  284. };
  285. static struct platform_device bfin_spi0_device = {
  286. .name = "bfin-spi",
  287. .id = 0, /* Bus number */
  288. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  289. .resource = bfin_spi0_resource,
  290. .dev = {
  291. .platform_data = &bfin_spi0_info, /* Passed to driver */
  292. },
  293. };
  294. #endif /* spi master and devices */
  295. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  296. #ifdef CONFIG_SERIAL_BFIN_UART0
  297. static struct resource bfin_uart0_resources[] = {
  298. {
  299. .start = BFIN_UART_THR,
  300. .end = BFIN_UART_GCTL+2,
  301. .flags = IORESOURCE_MEM,
  302. },
  303. {
  304. .start = IRQ_UART0_RX,
  305. .end = IRQ_UART0_RX + 1,
  306. .flags = IORESOURCE_IRQ,
  307. },
  308. {
  309. .start = IRQ_UART0_ERROR,
  310. .end = IRQ_UART0_ERROR,
  311. .flags = IORESOURCE_IRQ,
  312. },
  313. {
  314. .start = CH_UART0_TX,
  315. .end = CH_UART0_TX,
  316. .flags = IORESOURCE_DMA,
  317. },
  318. {
  319. .start = CH_UART0_RX,
  320. .end = CH_UART0_RX,
  321. .flags = IORESOURCE_DMA,
  322. },
  323. };
  324. static unsigned short bfin_uart0_peripherals[] = {
  325. P_UART0_TX, P_UART0_RX, 0
  326. };
  327. static struct platform_device bfin_uart0_device = {
  328. .name = "bfin-uart",
  329. .id = 0,
  330. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  331. .resource = bfin_uart0_resources,
  332. .dev = {
  333. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  334. },
  335. };
  336. #endif
  337. #endif
  338. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  339. #ifdef CONFIG_BFIN_SIR0
  340. static struct resource bfin_sir0_resources[] = {
  341. {
  342. .start = 0xFFC00400,
  343. .end = 0xFFC004FF,
  344. .flags = IORESOURCE_MEM,
  345. },
  346. {
  347. .start = IRQ_UART0_RX,
  348. .end = IRQ_UART0_RX+1,
  349. .flags = IORESOURCE_IRQ,
  350. },
  351. {
  352. .start = CH_UART0_RX,
  353. .end = CH_UART0_RX+1,
  354. .flags = IORESOURCE_DMA,
  355. },
  356. };
  357. static struct platform_device bfin_sir0_device = {
  358. .name = "bfin_sir",
  359. .id = 0,
  360. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  361. .resource = bfin_sir0_resources,
  362. };
  363. #endif
  364. #endif
  365. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  366. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  367. static struct resource bfin_sport0_uart_resources[] = {
  368. {
  369. .start = SPORT0_TCR1,
  370. .end = SPORT0_MRCS3+4,
  371. .flags = IORESOURCE_MEM,
  372. },
  373. {
  374. .start = IRQ_SPORT0_RX,
  375. .end = IRQ_SPORT0_RX+1,
  376. .flags = IORESOURCE_IRQ,
  377. },
  378. {
  379. .start = IRQ_SPORT0_ERROR,
  380. .end = IRQ_SPORT0_ERROR,
  381. .flags = IORESOURCE_IRQ,
  382. },
  383. };
  384. static unsigned short bfin_sport0_peripherals[] = {
  385. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  386. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  387. };
  388. static struct platform_device bfin_sport0_uart_device = {
  389. .name = "bfin-sport-uart",
  390. .id = 0,
  391. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  392. .resource = bfin_sport0_uart_resources,
  393. .dev = {
  394. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  395. },
  396. };
  397. #endif
  398. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  399. static struct resource bfin_sport1_uart_resources[] = {
  400. {
  401. .start = SPORT1_TCR1,
  402. .end = SPORT1_MRCS3+4,
  403. .flags = IORESOURCE_MEM,
  404. },
  405. {
  406. .start = IRQ_SPORT1_RX,
  407. .end = IRQ_SPORT1_RX+1,
  408. .flags = IORESOURCE_IRQ,
  409. },
  410. {
  411. .start = IRQ_SPORT1_ERROR,
  412. .end = IRQ_SPORT1_ERROR,
  413. .flags = IORESOURCE_IRQ,
  414. },
  415. };
  416. static unsigned short bfin_sport1_peripherals[] = {
  417. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  418. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  419. };
  420. static struct platform_device bfin_sport1_uart_device = {
  421. .name = "bfin-sport-uart",
  422. .id = 1,
  423. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  424. .resource = bfin_sport1_uart_resources,
  425. .dev = {
  426. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  427. },
  428. };
  429. #endif
  430. #endif
  431. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  432. #include <linux/input.h>
  433. #include <linux/gpio_keys.h>
  434. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  435. {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
  436. {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
  437. {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
  438. };
  439. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  440. .buttons = bfin_gpio_keys_table,
  441. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  442. };
  443. static struct platform_device bfin_device_gpiokeys = {
  444. .name = "gpio-keys",
  445. .dev = {
  446. .platform_data = &bfin_gpio_keys_data,
  447. },
  448. };
  449. #endif
  450. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  451. #include <linux/i2c-gpio.h>
  452. static struct i2c_gpio_platform_data i2c_gpio_data = {
  453. .sda_pin = GPIO_PF2,
  454. .scl_pin = GPIO_PF3,
  455. .sda_is_open_drain = 0,
  456. .scl_is_open_drain = 0,
  457. .udelay = 40,
  458. };
  459. static struct platform_device i2c_gpio_device = {
  460. .name = "i2c-gpio",
  461. .id = 0,
  462. .dev = {
  463. .platform_data = &i2c_gpio_data,
  464. },
  465. };
  466. #endif
  467. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  468. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  469. {
  470. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  471. .irq = 39,
  472. },
  473. #endif
  474. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  475. {
  476. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  477. },
  478. #endif
  479. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  480. {
  481. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  482. .irq = 39,
  483. },
  484. #endif
  485. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  486. {
  487. I2C_BOARD_INFO("bfin-adv7393", 0x2B),
  488. },
  489. #endif
  490. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  491. {
  492. I2C_BOARD_INFO("ad5252", 0x2f),
  493. },
  494. #endif
  495. };
  496. static const unsigned int cclk_vlev_datasheet[] =
  497. {
  498. VRPAIR(VLEV_085, 250000000),
  499. VRPAIR(VLEV_090, 376000000),
  500. VRPAIR(VLEV_095, 426000000),
  501. VRPAIR(VLEV_100, 426000000),
  502. VRPAIR(VLEV_105, 476000000),
  503. VRPAIR(VLEV_110, 476000000),
  504. VRPAIR(VLEV_115, 476000000),
  505. VRPAIR(VLEV_120, 600000000),
  506. VRPAIR(VLEV_125, 600000000),
  507. VRPAIR(VLEV_130, 600000000),
  508. };
  509. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  510. .tuple_tab = cclk_vlev_datasheet,
  511. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  512. .vr_settling_time = 25 /* us */,
  513. };
  514. static struct platform_device bfin_dpmc = {
  515. .name = "bfin dpmc",
  516. .dev = {
  517. .platform_data = &bfin_dmpc_vreg_data,
  518. },
  519. };
  520. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  521. static struct platform_device bfin_i2s = {
  522. .name = "bfin-i2s",
  523. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  524. /* TODO: add platform data here */
  525. };
  526. #endif
  527. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  528. static struct platform_device bfin_tdm = {
  529. .name = "bfin-tdm",
  530. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  531. /* TODO: add platform data here */
  532. };
  533. #endif
  534. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  535. static struct platform_device bfin_ac97 = {
  536. .name = "bfin-ac97",
  537. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  538. /* TODO: add platform data here */
  539. };
  540. #endif
  541. static struct platform_device *stamp_devices[] __initdata = {
  542. &bfin_dpmc,
  543. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  544. &rtc_device,
  545. #endif
  546. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  547. &smc91x_device,
  548. #endif
  549. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  550. &net2272_bfin_device,
  551. #endif
  552. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  553. &bfin_spi0_device,
  554. #endif
  555. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  556. #ifdef CONFIG_SERIAL_BFIN_UART0
  557. &bfin_uart0_device,
  558. #endif
  559. #endif
  560. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  561. #ifdef CONFIG_BFIN_SIR0
  562. &bfin_sir0_device,
  563. #endif
  564. #endif
  565. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  566. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  567. &bfin_sport0_uart_device,
  568. #endif
  569. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  570. &bfin_sport1_uart_device,
  571. #endif
  572. #endif
  573. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  574. &bfin_device_gpiokeys,
  575. #endif
  576. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  577. &i2c_gpio_device,
  578. #endif
  579. #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
  580. &stamp_flash_device,
  581. #endif
  582. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  583. &bfin_i2s,
  584. #endif
  585. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  586. &bfin_tdm,
  587. #endif
  588. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  589. &bfin_ac97,
  590. #endif
  591. };
  592. static int __init stamp_init(void)
  593. {
  594. int ret;
  595. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  596. i2c_register_board_info(0, bfin_i2c_board_info,
  597. ARRAY_SIZE(bfin_i2c_board_info));
  598. ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  599. if (ret < 0)
  600. return ret;
  601. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  602. /*
  603. * setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC.
  604. * the bfin-async-map driver takes care of flipping between
  605. * flash and ethernet when necessary.
  606. */
  607. ret = gpio_request(GPIO_PF0, "enet_cpld");
  608. if (!ret) {
  609. gpio_direction_output(GPIO_PF0, 1);
  610. gpio_free(GPIO_PF0);
  611. }
  612. #endif
  613. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  614. return 0;
  615. }
  616. arch_initcall(stamp_init);
  617. static struct platform_device *stamp_early_devices[] __initdata = {
  618. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  619. #ifdef CONFIG_SERIAL_BFIN_UART0
  620. &bfin_uart0_device,
  621. #endif
  622. #endif
  623. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  624. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  625. &bfin_sport0_uart_device,
  626. #endif
  627. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  628. &bfin_sport1_uart_device,
  629. #endif
  630. #endif
  631. };
  632. void __init native_machine_early_platform_add_devices(void)
  633. {
  634. printk(KERN_INFO "register early platform devices\n");
  635. early_platform_add_devices(stamp_early_devices,
  636. ARRAY_SIZE(stamp_early_devices));
  637. }
  638. void native_machine_restart(char *cmd)
  639. {
  640. /* workaround pull up on cpld / flash pin not being strong enough */
  641. gpio_request(GPIO_PF0, "flash_cpld");
  642. gpio_direction_output(GPIO_PF0, 0);
  643. }