stamp.c 17 KB

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