ezbrd.c 17 KB

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