stamp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  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_BLACKFIN_AD183X) || defined(CONFIG_SND_BLACKFIN_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_BLACKFIN_AD183X) || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
  229. {
  230. .modalias = "ad1836",
  231. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  232. .bus_num = 0,
  233. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  234. .controller_data = &ad1836_spi_chip_info,
  235. },
  236. #endif
  237. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  238. {
  239. .modalias = "spidev",
  240. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  241. .bus_num = 0,
  242. .chip_select = 1,
  243. .controller_data = &spidev_chip_info,
  244. },
  245. #endif
  246. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  247. {
  248. .modalias = "mmc_spi",
  249. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  250. .bus_num = 0,
  251. .chip_select = 4,
  252. .platform_data = &bfin_mmc_spi_pdata,
  253. .controller_data = &mmc_spi_chip_info,
  254. .mode = SPI_MODE_3,
  255. },
  256. #endif
  257. };
  258. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  259. /* SPI (0) */
  260. static struct resource bfin_spi0_resource[] = {
  261. [0] = {
  262. .start = SPI0_REGBASE,
  263. .end = SPI0_REGBASE + 0xFF,
  264. .flags = IORESOURCE_MEM,
  265. },
  266. [1] = {
  267. .start = CH_SPI,
  268. .end = CH_SPI,
  269. .flags = IORESOURCE_DMA,
  270. },
  271. [2] = {
  272. .start = IRQ_SPI,
  273. .end = IRQ_SPI,
  274. .flags = IORESOURCE_IRQ,
  275. }
  276. };
  277. /* SPI controller data */
  278. static struct bfin5xx_spi_master bfin_spi0_info = {
  279. .num_chipselect = 8,
  280. .enable_dma = 1, /* master has the ability to do dma transfer */
  281. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  282. };
  283. static struct platform_device bfin_spi0_device = {
  284. .name = "bfin-spi",
  285. .id = 0, /* Bus number */
  286. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  287. .resource = bfin_spi0_resource,
  288. .dev = {
  289. .platform_data = &bfin_spi0_info, /* Passed to driver */
  290. },
  291. };
  292. #endif /* spi master and devices */
  293. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  294. #ifdef CONFIG_SERIAL_BFIN_UART0
  295. static struct resource bfin_uart0_resources[] = {
  296. {
  297. .start = BFIN_UART_THR,
  298. .end = BFIN_UART_GCTL+2,
  299. .flags = IORESOURCE_MEM,
  300. },
  301. {
  302. .start = IRQ_UART0_RX,
  303. .end = IRQ_UART0_RX + 1,
  304. .flags = IORESOURCE_IRQ,
  305. },
  306. {
  307. .start = IRQ_UART0_ERROR,
  308. .end = IRQ_UART0_ERROR,
  309. .flags = IORESOURCE_IRQ,
  310. },
  311. {
  312. .start = CH_UART0_TX,
  313. .end = CH_UART0_TX,
  314. .flags = IORESOURCE_DMA,
  315. },
  316. {
  317. .start = CH_UART0_RX,
  318. .end = CH_UART0_RX,
  319. .flags = IORESOURCE_DMA,
  320. },
  321. };
  322. unsigned short bfin_uart0_peripherals[] = {
  323. P_UART0_TX, P_UART0_RX, 0
  324. };
  325. static struct platform_device bfin_uart0_device = {
  326. .name = "bfin-uart",
  327. .id = 0,
  328. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  329. .resource = bfin_uart0_resources,
  330. .dev = {
  331. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  332. },
  333. };
  334. #endif
  335. #endif
  336. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  337. #ifdef CONFIG_BFIN_SIR0
  338. static struct resource bfin_sir0_resources[] = {
  339. {
  340. .start = 0xFFC00400,
  341. .end = 0xFFC004FF,
  342. .flags = IORESOURCE_MEM,
  343. },
  344. {
  345. .start = IRQ_UART0_RX,
  346. .end = IRQ_UART0_RX+1,
  347. .flags = IORESOURCE_IRQ,
  348. },
  349. {
  350. .start = CH_UART0_RX,
  351. .end = CH_UART0_RX+1,
  352. .flags = IORESOURCE_DMA,
  353. },
  354. };
  355. static struct platform_device bfin_sir0_device = {
  356. .name = "bfin_sir",
  357. .id = 0,
  358. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  359. .resource = bfin_sir0_resources,
  360. };
  361. #endif
  362. #endif
  363. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  364. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  365. static struct resource bfin_sport0_uart_resources[] = {
  366. {
  367. .start = SPORT0_TCR1,
  368. .end = SPORT0_MRCS3+4,
  369. .flags = IORESOURCE_MEM,
  370. },
  371. {
  372. .start = IRQ_SPORT0_RX,
  373. .end = IRQ_SPORT0_RX+1,
  374. .flags = IORESOURCE_IRQ,
  375. },
  376. {
  377. .start = IRQ_SPORT0_ERROR,
  378. .end = IRQ_SPORT0_ERROR,
  379. .flags = IORESOURCE_IRQ,
  380. },
  381. };
  382. unsigned short bfin_sport0_peripherals[] = {
  383. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  384. P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
  385. };
  386. static struct platform_device bfin_sport0_uart_device = {
  387. .name = "bfin-sport-uart",
  388. .id = 0,
  389. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  390. .resource = bfin_sport0_uart_resources,
  391. .dev = {
  392. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  393. },
  394. };
  395. #endif
  396. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  397. static struct resource bfin_sport1_uart_resources[] = {
  398. {
  399. .start = SPORT1_TCR1,
  400. .end = SPORT1_MRCS3+4,
  401. .flags = IORESOURCE_MEM,
  402. },
  403. {
  404. .start = IRQ_SPORT1_RX,
  405. .end = IRQ_SPORT1_RX+1,
  406. .flags = IORESOURCE_IRQ,
  407. },
  408. {
  409. .start = IRQ_SPORT1_ERROR,
  410. .end = IRQ_SPORT1_ERROR,
  411. .flags = IORESOURCE_IRQ,
  412. },
  413. };
  414. unsigned short bfin_sport1_peripherals[] = {
  415. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  416. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
  417. };
  418. static struct platform_device bfin_sport1_uart_device = {
  419. .name = "bfin-sport-uart",
  420. .id = 1,
  421. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  422. .resource = bfin_sport1_uart_resources,
  423. .dev = {
  424. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  425. },
  426. };
  427. #endif
  428. #endif
  429. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  430. #include <linux/input.h>
  431. #include <linux/gpio_keys.h>
  432. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  433. {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
  434. {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
  435. {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
  436. };
  437. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  438. .buttons = bfin_gpio_keys_table,
  439. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  440. };
  441. static struct platform_device bfin_device_gpiokeys = {
  442. .name = "gpio-keys",
  443. .dev = {
  444. .platform_data = &bfin_gpio_keys_data,
  445. },
  446. };
  447. #endif
  448. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  449. #include <linux/i2c-gpio.h>
  450. static struct i2c_gpio_platform_data i2c_gpio_data = {
  451. .sda_pin = 2,
  452. .scl_pin = 3,
  453. .sda_is_open_drain = 0,
  454. .scl_is_open_drain = 0,
  455. .udelay = 40,
  456. };
  457. static struct platform_device i2c_gpio_device = {
  458. .name = "i2c-gpio",
  459. .id = 0,
  460. .dev = {
  461. .platform_data = &i2c_gpio_data,
  462. },
  463. };
  464. #endif
  465. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  466. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  467. {
  468. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  469. .irq = 39,
  470. },
  471. #endif
  472. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  473. {
  474. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  475. },
  476. #endif
  477. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  478. {
  479. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  480. .irq = 39,
  481. },
  482. #endif
  483. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  484. {
  485. I2C_BOARD_INFO("bfin-adv7393", 0x2B),
  486. },
  487. #endif
  488. };
  489. static const unsigned int cclk_vlev_datasheet[] =
  490. {
  491. VRPAIR(VLEV_085, 250000000),
  492. VRPAIR(VLEV_090, 376000000),
  493. VRPAIR(VLEV_095, 426000000),
  494. VRPAIR(VLEV_100, 426000000),
  495. VRPAIR(VLEV_105, 476000000),
  496. VRPAIR(VLEV_110, 476000000),
  497. VRPAIR(VLEV_115, 476000000),
  498. VRPAIR(VLEV_120, 600000000),
  499. VRPAIR(VLEV_125, 600000000),
  500. VRPAIR(VLEV_130, 600000000),
  501. };
  502. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  503. .tuple_tab = cclk_vlev_datasheet,
  504. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  505. .vr_settling_time = 25 /* us */,
  506. };
  507. static struct platform_device bfin_dpmc = {
  508. .name = "bfin dpmc",
  509. .dev = {
  510. .platform_data = &bfin_dmpc_vreg_data,
  511. },
  512. };
  513. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  514. static struct platform_device bfin_i2s = {
  515. .name = "bfin-i2s",
  516. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  517. /* TODO: add platform data here */
  518. };
  519. #endif
  520. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  521. static struct platform_device bfin_tdm = {
  522. .name = "bfin-tdm",
  523. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  524. /* TODO: add platform data here */
  525. };
  526. #endif
  527. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  528. static struct platform_device bfin_ac97 = {
  529. .name = "bfin-ac97",
  530. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  531. /* TODO: add platform data here */
  532. };
  533. #endif
  534. static struct platform_device *stamp_devices[] __initdata = {
  535. &bfin_dpmc,
  536. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  537. &rtc_device,
  538. #endif
  539. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  540. &smc91x_device,
  541. #endif
  542. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  543. &net2272_bfin_device,
  544. #endif
  545. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  546. &bfin_spi0_device,
  547. #endif
  548. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  549. #ifdef CONFIG_SERIAL_BFIN_UART0
  550. &bfin_uart0_device,
  551. #endif
  552. #endif
  553. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  554. #ifdef CONFIG_BFIN_SIR0
  555. &bfin_sir0_device,
  556. #endif
  557. #endif
  558. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  559. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  560. &bfin_sport0_uart_device,
  561. #endif
  562. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  563. &bfin_sport1_uart_device,
  564. #endif
  565. #endif
  566. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  567. &bfin_device_gpiokeys,
  568. #endif
  569. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  570. &i2c_gpio_device,
  571. #endif
  572. #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
  573. &stamp_flash_device,
  574. #endif
  575. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  576. &bfin_i2s,
  577. #endif
  578. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  579. &bfin_tdm,
  580. #endif
  581. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  582. &bfin_ac97,
  583. #endif
  584. };
  585. static int __init stamp_init(void)
  586. {
  587. int ret;
  588. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  589. i2c_register_board_info(0, bfin_i2c_board_info,
  590. ARRAY_SIZE(bfin_i2c_board_info));
  591. ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  592. if (ret < 0)
  593. return ret;
  594. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  595. /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
  596. bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
  597. bfin_write_FIO_FLAG_S(PF0);
  598. SSYNC();
  599. #endif
  600. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  601. return 0;
  602. }
  603. arch_initcall(stamp_init);
  604. static struct platform_device *stamp_early_devices[] __initdata = {
  605. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  606. #ifdef CONFIG_SERIAL_BFIN_UART0
  607. &bfin_uart0_device,
  608. #endif
  609. #endif
  610. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  611. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  612. &bfin_sport0_uart_device,
  613. #endif
  614. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  615. &bfin_sport1_uart_device,
  616. #endif
  617. #endif
  618. };
  619. void __init native_machine_early_platform_add_devices(void)
  620. {
  621. printk(KERN_INFO "register early platform devices\n");
  622. early_platform_add_devices(stamp_early_devices,
  623. ARRAY_SIZE(stamp_early_devices));
  624. }
  625. void native_machine_restart(char *cmd)
  626. {
  627. /* workaround pull up on cpld / flash pin not being strong enough */
  628. bfin_write_FIO_INEN(~PF0);
  629. bfin_write_FIO_DIR(PF0);
  630. bfin_write_FIO_FLAG_C(PF0);
  631. }