ezbrd.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. /*
  2. * File: arch/blackfin/mach-bf518/boards/ezbrd.c
  3. * Based on: arch/blackfin/mach-bf527/boards/ezbrd.c
  4. * Author: Bryan Wu <cooloney@kernel.org>
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2008 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. #include <linux/i2c.h>
  38. #include <linux/irq.h>
  39. #include <linux/interrupt.h>
  40. #include <asm/dma.h>
  41. #include <asm/bfin5xx_spi.h>
  42. #include <asm/reboot.h>
  43. #include <asm/portmux.h>
  44. #include <asm/dpmc.h>
  45. #include <asm/bfin_sdh.h>
  46. #include <linux/spi/ad7877.h>
  47. /*
  48. * Name the Board for the /proc/cpuinfo
  49. */
  50. const char bfin_board_name[] = "ADI BF518F-EZBRD";
  51. /*
  52. * Driver needs to know address, irq and flag pin.
  53. */
  54. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  55. static struct mtd_partition ezbrd_partitions[] = {
  56. {
  57. .name = "bootloader(nor)",
  58. .size = 0x40000,
  59. .offset = 0,
  60. }, {
  61. .name = "linux kernel(nor)",
  62. .size = 0x1C0000,
  63. .offset = MTDPART_OFS_APPEND,
  64. }, {
  65. .name = "file system(nor)",
  66. .size = MTDPART_SIZ_FULL,
  67. .offset = MTDPART_OFS_APPEND,
  68. }
  69. };
  70. static struct physmap_flash_data ezbrd_flash_data = {
  71. .width = 2,
  72. .parts = ezbrd_partitions,
  73. .nr_parts = ARRAY_SIZE(ezbrd_partitions),
  74. };
  75. static struct resource ezbrd_flash_resource = {
  76. .start = 0x20000000,
  77. .end = 0x203fffff,
  78. .flags = IORESOURCE_MEM,
  79. };
  80. static struct platform_device ezbrd_flash_device = {
  81. .name = "physmap-flash",
  82. .id = 0,
  83. .dev = {
  84. .platform_data = &ezbrd_flash_data,
  85. },
  86. .num_resources = 1,
  87. .resource = &ezbrd_flash_resource,
  88. };
  89. #endif
  90. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  91. static struct platform_device rtc_device = {
  92. .name = "rtc-bfin",
  93. .id = -1,
  94. };
  95. #endif
  96. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  97. static struct platform_device bfin_mac_device = {
  98. .name = "bfin_mac",
  99. };
  100. #endif
  101. #if defined(CONFIG_MTD_M25P80) \
  102. || defined(CONFIG_MTD_M25P80_MODULE)
  103. static struct mtd_partition bfin_spi_flash_partitions[] = {
  104. {
  105. .name = "bootloader(spi)",
  106. .size = 0x00040000,
  107. .offset = 0,
  108. .mask_flags = MTD_CAP_ROM
  109. }, {
  110. .name = "linux kernel(spi)",
  111. .size = MTDPART_SIZ_FULL,
  112. .offset = MTDPART_OFS_APPEND,
  113. }
  114. };
  115. static struct flash_platform_data bfin_spi_flash_data = {
  116. .name = "m25p80",
  117. .parts = bfin_spi_flash_partitions,
  118. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  119. .type = "m25p16",
  120. };
  121. /* SPI flash chip (m25p64) */
  122. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  123. .enable_dma = 0, /* use dma transfer with this chip*/
  124. .bits_per_word = 8,
  125. };
  126. #endif
  127. #if defined(CONFIG_SPI_ADC_BF533) \
  128. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  129. /* SPI ADC chip */
  130. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  131. .enable_dma = 1, /* use dma transfer with this chip*/
  132. .bits_per_word = 16,
  133. };
  134. #endif
  135. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  136. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  137. .enable_dma = 1,
  138. .bits_per_word = 8,
  139. };
  140. #endif
  141. #if defined(CONFIG_PBX)
  142. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  143. .ctl_reg = 0x4, /* send zero */
  144. .enable_dma = 0,
  145. .bits_per_word = 8,
  146. .cs_change_per_word = 1,
  147. };
  148. #endif
  149. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  150. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  151. .enable_dma = 0,
  152. .bits_per_word = 16,
  153. };
  154. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  155. .model = 7877,
  156. .vref_delay_usecs = 50, /* internal, no capacitor */
  157. .x_plate_ohms = 419,
  158. .y_plate_ohms = 486,
  159. .pressure_max = 1000,
  160. .pressure_min = 0,
  161. .stopacq_polarity = 1,
  162. .first_conversion_delay = 3,
  163. .acquisition_time = 1,
  164. .averaging = 1,
  165. .pen_down_acc_interval = 1,
  166. };
  167. #endif
  168. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  169. && defined(CONFIG_SND_SOC_WM8731_SPI)
  170. static struct bfin5xx_spi_chip spi_wm8731_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. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  182. #if defined(CONFIG_MTD_M25P80) \
  183. || defined(CONFIG_MTD_M25P80_MODULE)
  184. {
  185. /* the modalias must be the same as spi device driver name */
  186. .modalias = "m25p80", /* Name of spi_driver for this device */
  187. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  188. .bus_num = 0, /* Framework bus number */
  189. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  190. .platform_data = &bfin_spi_flash_data,
  191. .controller_data = &spi_flash_chip_info,
  192. .mode = SPI_MODE_3,
  193. },
  194. #endif
  195. #if defined(CONFIG_SPI_ADC_BF533) \
  196. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  197. {
  198. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  199. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  200. .bus_num = 0, /* Framework bus number */
  201. .chip_select = 1, /* Framework chip select. */
  202. .platform_data = NULL, /* No spi_driver specific config */
  203. .controller_data = &spi_adc_chip_info,
  204. },
  205. #endif
  206. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  207. {
  208. .modalias = "spi_mmc_dummy",
  209. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  210. .bus_num = 0,
  211. .chip_select = 0,
  212. .platform_data = NULL,
  213. .controller_data = &spi_mmc_chip_info,
  214. .mode = SPI_MODE_3,
  215. },
  216. {
  217. .modalias = "spi_mmc",
  218. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  219. .bus_num = 0,
  220. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  221. .platform_data = NULL,
  222. .controller_data = &spi_mmc_chip_info,
  223. .mode = SPI_MODE_3,
  224. },
  225. #endif
  226. #if defined(CONFIG_PBX)
  227. {
  228. .modalias = "fxs-spi",
  229. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  230. .bus_num = 0,
  231. .chip_select = 8 - CONFIG_J11_JUMPER,
  232. .controller_data = &spi_si3xxx_chip_info,
  233. .mode = SPI_MODE_3,
  234. },
  235. {
  236. .modalias = "fxo-spi",
  237. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  238. .bus_num = 0,
  239. .chip_select = 8 - CONFIG_J19_JUMPER,
  240. .controller_data = &spi_si3xxx_chip_info,
  241. .mode = SPI_MODE_3,
  242. },
  243. #endif
  244. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  245. {
  246. .modalias = "ad7877",
  247. .platform_data = &bfin_ad7877_ts_info,
  248. .irq = IRQ_PF8,
  249. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  250. .bus_num = 0,
  251. .chip_select = 2,
  252. .controller_data = &spi_ad7877_chip_info,
  253. },
  254. #endif
  255. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  256. && defined(CONFIG_SND_SOC_WM8731_SPI)
  257. {
  258. .modalias = "wm8731",
  259. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  260. .bus_num = 0,
  261. .chip_select = 5,
  262. .controller_data = &spi_wm8731_chip_info,
  263. .mode = SPI_MODE_0,
  264. },
  265. #endif
  266. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  267. {
  268. .modalias = "spidev",
  269. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  270. .bus_num = 0,
  271. .chip_select = 1,
  272. .controller_data = &spidev_chip_info,
  273. },
  274. #endif
  275. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  276. {
  277. .modalias = "bfin-lq035q1-spi",
  278. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  279. .bus_num = 0,
  280. .chip_select = 1,
  281. .controller_data = &lq035q1_spi_chip_info,
  282. .mode = SPI_CPHA | SPI_CPOL,
  283. },
  284. #endif
  285. };
  286. /* SPI controller data */
  287. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  288. /* SPI (0) */
  289. static struct bfin5xx_spi_master bfin_spi0_info = {
  290. .num_chipselect = 5,
  291. .enable_dma = 1, /* master has the ability to do dma transfer */
  292. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  293. };
  294. static struct resource bfin_spi0_resource[] = {
  295. [0] = {
  296. .start = SPI0_REGBASE,
  297. .end = SPI0_REGBASE + 0xFF,
  298. .flags = IORESOURCE_MEM,
  299. },
  300. [1] = {
  301. .start = CH_SPI0,
  302. .end = CH_SPI0,
  303. .flags = IORESOURCE_IRQ,
  304. },
  305. };
  306. static struct platform_device bfin_spi0_device = {
  307. .name = "bfin-spi",
  308. .id = 0, /* Bus number */
  309. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  310. .resource = bfin_spi0_resource,
  311. .dev = {
  312. .platform_data = &bfin_spi0_info, /* Passed to driver */
  313. },
  314. };
  315. /* SPI (1) */
  316. static struct bfin5xx_spi_master bfin_spi1_info = {
  317. .num_chipselect = 5,
  318. .enable_dma = 1, /* master has the ability to do dma transfer */
  319. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  320. };
  321. static struct resource bfin_spi1_resource[] = {
  322. [0] = {
  323. .start = SPI1_REGBASE,
  324. .end = SPI1_REGBASE + 0xFF,
  325. .flags = IORESOURCE_MEM,
  326. },
  327. [1] = {
  328. .start = CH_SPI1,
  329. .end = CH_SPI1,
  330. .flags = IORESOURCE_IRQ,
  331. },
  332. };
  333. static struct platform_device bfin_spi1_device = {
  334. .name = "bfin-spi",
  335. .id = 1, /* Bus number */
  336. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  337. .resource = bfin_spi1_resource,
  338. .dev = {
  339. .platform_data = &bfin_spi1_info, /* Passed to driver */
  340. },
  341. };
  342. #endif /* spi master and devices */
  343. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  344. static struct resource bfin_uart_resources[] = {
  345. #ifdef CONFIG_SERIAL_BFIN_UART0
  346. {
  347. .start = 0xFFC00400,
  348. .end = 0xFFC004FF,
  349. .flags = IORESOURCE_MEM,
  350. },
  351. #endif
  352. #ifdef CONFIG_SERIAL_BFIN_UART1
  353. {
  354. .start = 0xFFC02000,
  355. .end = 0xFFC020FF,
  356. .flags = IORESOURCE_MEM,
  357. },
  358. #endif
  359. };
  360. static struct platform_device bfin_uart_device = {
  361. .name = "bfin-uart",
  362. .id = 1,
  363. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  364. .resource = bfin_uart_resources,
  365. };
  366. #endif
  367. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  368. #ifdef CONFIG_BFIN_SIR0
  369. static struct resource bfin_sir0_resources[] = {
  370. {
  371. .start = 0xFFC00400,
  372. .end = 0xFFC004FF,
  373. .flags = IORESOURCE_MEM,
  374. },
  375. {
  376. .start = IRQ_UART0_RX,
  377. .end = IRQ_UART0_RX+1,
  378. .flags = IORESOURCE_IRQ,
  379. },
  380. {
  381. .start = CH_UART0_RX,
  382. .end = CH_UART0_RX+1,
  383. .flags = IORESOURCE_DMA,
  384. },
  385. };
  386. static struct platform_device bfin_sir0_device = {
  387. .name = "bfin_sir",
  388. .id = 0,
  389. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  390. .resource = bfin_sir0_resources,
  391. };
  392. #endif
  393. #ifdef CONFIG_BFIN_SIR1
  394. static struct resource bfin_sir1_resources[] = {
  395. {
  396. .start = 0xFFC02000,
  397. .end = 0xFFC020FF,
  398. .flags = IORESOURCE_MEM,
  399. },
  400. {
  401. .start = IRQ_UART1_RX,
  402. .end = IRQ_UART1_RX+1,
  403. .flags = IORESOURCE_IRQ,
  404. },
  405. {
  406. .start = CH_UART1_RX,
  407. .end = CH_UART1_RX+1,
  408. .flags = IORESOURCE_DMA,
  409. },
  410. };
  411. static struct platform_device bfin_sir1_device = {
  412. .name = "bfin_sir",
  413. .id = 1,
  414. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  415. .resource = bfin_sir1_resources,
  416. };
  417. #endif
  418. #endif
  419. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  420. static struct resource bfin_twi0_resource[] = {
  421. [0] = {
  422. .start = TWI0_REGBASE,
  423. .end = TWI0_REGBASE,
  424. .flags = IORESOURCE_MEM,
  425. },
  426. [1] = {
  427. .start = IRQ_TWI,
  428. .end = IRQ_TWI,
  429. .flags = IORESOURCE_IRQ,
  430. },
  431. };
  432. static struct platform_device i2c_bfin_twi_device = {
  433. .name = "i2c-bfin-twi",
  434. .id = 0,
  435. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  436. .resource = bfin_twi0_resource,
  437. };
  438. #endif
  439. #ifdef CONFIG_I2C_BOARDINFO
  440. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  441. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  442. {
  443. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  444. },
  445. #endif
  446. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  447. {
  448. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  449. .irq = IRQ_PF8,
  450. },
  451. #endif
  452. };
  453. #endif
  454. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  455. static struct platform_device bfin_sport0_uart_device = {
  456. .name = "bfin-sport-uart",
  457. .id = 0,
  458. };
  459. static struct platform_device bfin_sport1_uart_device = {
  460. .name = "bfin-sport-uart",
  461. .id = 1,
  462. };
  463. #endif
  464. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  465. #include <linux/input.h>
  466. #include <linux/gpio_keys.h>
  467. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  468. {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
  469. {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
  470. };
  471. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  472. .buttons = bfin_gpio_keys_table,
  473. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  474. };
  475. static struct platform_device bfin_device_gpiokeys = {
  476. .name = "gpio-keys",
  477. .dev = {
  478. .platform_data = &bfin_gpio_keys_data,
  479. },
  480. };
  481. #endif
  482. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  483. static struct bfin_sd_host bfin_sdh_data = {
  484. .dma_chan = CH_RSI,
  485. .irq_int0 = IRQ_RSI_INT0,
  486. .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
  487. };
  488. static struct platform_device bf51x_sdh_device = {
  489. .name = "bfin-sdh",
  490. .id = 0,
  491. .dev = {
  492. .platform_data = &bfin_sdh_data,
  493. },
  494. };
  495. #endif
  496. static struct resource bfin_gpios_resources = {
  497. .start = 0,
  498. .end = MAX_BLACKFIN_GPIOS - 1,
  499. .flags = IORESOURCE_IRQ,
  500. };
  501. static struct platform_device bfin_gpios_device = {
  502. .name = "simple-gpio",
  503. .id = -1,
  504. .num_resources = 1,
  505. .resource = &bfin_gpios_resources,
  506. };
  507. static const unsigned int cclk_vlev_datasheet[] =
  508. {
  509. VRPAIR(VLEV_100, 400000000),
  510. VRPAIR(VLEV_105, 426000000),
  511. VRPAIR(VLEV_110, 500000000),
  512. VRPAIR(VLEV_115, 533000000),
  513. VRPAIR(VLEV_120, 600000000),
  514. };
  515. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  516. .tuple_tab = cclk_vlev_datasheet,
  517. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  518. .vr_settling_time = 25 /* us */,
  519. };
  520. static struct platform_device bfin_dpmc = {
  521. .name = "bfin dpmc",
  522. .dev = {
  523. .platform_data = &bfin_dmpc_vreg_data,
  524. },
  525. };
  526. static struct platform_device *stamp_devices[] __initdata = {
  527. &bfin_dpmc,
  528. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  529. &rtc_device,
  530. #endif
  531. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  532. &bfin_mac_device,
  533. #endif
  534. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  535. &bfin_spi0_device,
  536. &bfin_spi1_device,
  537. #endif
  538. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  539. &bfin_uart_device,
  540. #endif
  541. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  542. #ifdef CONFIG_BFIN_SIR0
  543. &bfin_sir0_device,
  544. #endif
  545. #ifdef CONFIG_BFIN_SIR1
  546. &bfin_sir1_device,
  547. #endif
  548. #endif
  549. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  550. &i2c_bfin_twi_device,
  551. #endif
  552. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  553. &bfin_sport0_uart_device,
  554. &bfin_sport1_uart_device,
  555. #endif
  556. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  557. &bfin_device_gpiokeys,
  558. #endif
  559. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  560. &bf51x_sdh_device,
  561. #endif
  562. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  563. &ezbrd_flash_device,
  564. #endif
  565. &bfin_gpios_device,
  566. };
  567. static int __init ezbrd_init(void)
  568. {
  569. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  570. #ifdef CONFIG_I2C_BOARDINFO
  571. i2c_register_board_info(0, bfin_i2c_board_info,
  572. ARRAY_SIZE(bfin_i2c_board_info));
  573. #endif
  574. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  575. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  576. return 0;
  577. }
  578. arch_initcall(ezbrd_init);
  579. void native_machine_restart(char *cmd)
  580. {
  581. /* workaround reboot hang when booting from SPI */
  582. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  583. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  584. }
  585. void bfin_get_ether_addr(char *addr)
  586. {
  587. /* the MAC is stored in OTP memory page 0xDF */
  588. u32 ret;
  589. u64 otp_mac;
  590. u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
  591. ret = otp_read(0xDF, 0x00, &otp_mac);
  592. if (!(ret & 0x1)) {
  593. char *otp_mac_p = (char *)&otp_mac;
  594. for (ret = 0; ret < 6; ++ret)
  595. addr[ret] = otp_mac_p[5 - ret];
  596. }
  597. }
  598. EXPORT_SYMBOL(bfin_get_ether_addr);