cm_bf537e.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2008-2009 Bluetechnix
  4. * 2005 National ICT Australia (NICTA)
  5. * Aidan Williams <aidan@nicta.com.au>
  6. *
  7. * Licensed under the GPL-2 or later.
  8. */
  9. #include <linux/device.h>
  10. #include <linux/etherdevice.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/partitions.h>
  14. #include <linux/mtd/physmap.h>
  15. #include <linux/spi/spi.h>
  16. #include <linux/spi/flash.h>
  17. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  18. #include <linux/usb/isp1362.h>
  19. #endif
  20. #include <linux/ata_platform.h>
  21. #include <linux/irq.h>
  22. #include <asm/dma.h>
  23. #include <asm/bfin5xx_spi.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[] = "Bluetechnix CM BF537E";
  30. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  31. /* all SPI peripherals info goes here */
  32. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  33. static struct mtd_partition bfin_spi_flash_partitions[] = {
  34. {
  35. .name = "bootloader(spi)",
  36. .size = 0x00020000,
  37. .offset = 0,
  38. .mask_flags = MTD_CAP_ROM
  39. }, {
  40. .name = "linux kernel(spi)",
  41. .size = 0xe0000,
  42. .offset = 0x20000
  43. }, {
  44. .name = "file system(spi)",
  45. .size = 0x700000,
  46. .offset = 0x00100000,
  47. }
  48. };
  49. static struct flash_platform_data bfin_spi_flash_data = {
  50. .name = "m25p80",
  51. .parts = bfin_spi_flash_partitions,
  52. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  53. .type = "m25p64",
  54. };
  55. /* SPI flash chip (m25p64) */
  56. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  57. .enable_dma = 0, /* use dma transfer with this chip*/
  58. };
  59. #endif
  60. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  61. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  62. .enable_dma = 0,
  63. };
  64. #endif
  65. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  66. #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  67. {
  68. /* the modalias must be the same as spi device driver name */
  69. .modalias = "m25p80", /* Name of spi_driver for this device */
  70. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  71. .bus_num = 0, /* Framework bus number */
  72. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  73. .platform_data = &bfin_spi_flash_data,
  74. .controller_data = &spi_flash_chip_info,
  75. .mode = SPI_MODE_3,
  76. },
  77. #endif
  78. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  79. {
  80. .modalias = "ad183x",
  81. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  82. .bus_num = 0,
  83. .chip_select = 4,
  84. },
  85. #endif
  86. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  87. {
  88. .modalias = "mmc_spi",
  89. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  90. .bus_num = 0,
  91. .chip_select = 1,
  92. .controller_data = &mmc_spi_chip_info,
  93. .mode = SPI_MODE_3,
  94. },
  95. #endif
  96. };
  97. /* SPI (0) */
  98. static struct resource bfin_spi0_resource[] = {
  99. [0] = {
  100. .start = SPI0_REGBASE,
  101. .end = SPI0_REGBASE + 0xFF,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. [1] = {
  105. .start = CH_SPI,
  106. .end = CH_SPI,
  107. .flags = IORESOURCE_DMA,
  108. },
  109. [2] = {
  110. .start = IRQ_SPI,
  111. .end = IRQ_SPI,
  112. .flags = IORESOURCE_IRQ,
  113. },
  114. };
  115. /* SPI controller data */
  116. static struct bfin5xx_spi_master bfin_spi0_info = {
  117. .num_chipselect = 8,
  118. .enable_dma = 1, /* master has the ability to do dma transfer */
  119. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  120. };
  121. static struct platform_device bfin_spi0_device = {
  122. .name = "bfin-spi",
  123. .id = 0, /* Bus number */
  124. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  125. .resource = bfin_spi0_resource,
  126. .dev = {
  127. .platform_data = &bfin_spi0_info, /* Passed to driver */
  128. },
  129. };
  130. #endif /* spi master and devices */
  131. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  132. static struct platform_device rtc_device = {
  133. .name = "rtc-bfin",
  134. .id = -1,
  135. };
  136. #endif
  137. #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
  138. static struct platform_device hitachi_fb_device = {
  139. .name = "hitachi-tx09",
  140. };
  141. #endif
  142. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  143. #include <linux/smc91x.h>
  144. static struct smc91x_platdata smc91x_info = {
  145. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  146. .leda = RPC_LED_100_10,
  147. .ledb = RPC_LED_TX_RX,
  148. };
  149. static struct resource smc91x_resources[] = {
  150. {
  151. .start = 0x20200300,
  152. .end = 0x20200300 + 16,
  153. .flags = IORESOURCE_MEM,
  154. }, {
  155. .start = IRQ_PF14,
  156. .end = IRQ_PF14,
  157. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  158. },
  159. };
  160. static struct platform_device smc91x_device = {
  161. .name = "smc91x",
  162. .id = 0,
  163. .num_resources = ARRAY_SIZE(smc91x_resources),
  164. .resource = smc91x_resources,
  165. .dev = {
  166. .platform_data = &smc91x_info,
  167. },
  168. };
  169. #endif
  170. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  171. static struct resource isp1362_hcd_resources[] = {
  172. {
  173. .start = 0x20308000,
  174. .end = 0x20308000,
  175. .flags = IORESOURCE_MEM,
  176. }, {
  177. .start = 0x20308004,
  178. .end = 0x20308004,
  179. .flags = IORESOURCE_MEM,
  180. }, {
  181. .start = IRQ_PG15,
  182. .end = IRQ_PG15,
  183. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  184. },
  185. };
  186. static struct isp1362_platform_data isp1362_priv = {
  187. .sel15Kres = 1,
  188. .clknotstop = 0,
  189. .oc_enable = 0,
  190. .int_act_high = 0,
  191. .int_edge_triggered = 0,
  192. .remote_wakeup_connected = 0,
  193. .no_power_switching = 1,
  194. .power_switching_mode = 0,
  195. };
  196. static struct platform_device isp1362_hcd_device = {
  197. .name = "isp1362-hcd",
  198. .id = 0,
  199. .dev = {
  200. .platform_data = &isp1362_priv,
  201. },
  202. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  203. .resource = isp1362_hcd_resources,
  204. };
  205. #endif
  206. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  207. static struct resource net2272_bfin_resources[] = {
  208. {
  209. .start = 0x20300000,
  210. .end = 0x20300000 + 0x100,
  211. .flags = IORESOURCE_MEM,
  212. }, {
  213. .start = IRQ_PG13,
  214. .end = IRQ_PG13,
  215. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  216. },
  217. };
  218. static struct platform_device net2272_bfin_device = {
  219. .name = "net2272",
  220. .id = -1,
  221. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  222. .resource = net2272_bfin_resources,
  223. };
  224. #endif
  225. #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
  226. static struct mtd_partition cm_partitions[] = {
  227. {
  228. .name = "bootloader(nor)",
  229. .size = 0x40000,
  230. .offset = 0,
  231. }, {
  232. .name = "linux kernel(nor)",
  233. .size = 0x100000,
  234. .offset = MTDPART_OFS_APPEND,
  235. }, {
  236. .name = "file system(nor)",
  237. .size = MTDPART_SIZ_FULL,
  238. .offset = MTDPART_OFS_APPEND,
  239. }
  240. };
  241. static struct physmap_flash_data cm_flash_data = {
  242. .width = 2,
  243. .parts = cm_partitions,
  244. .nr_parts = ARRAY_SIZE(cm_partitions),
  245. };
  246. static unsigned cm_flash_gpios[] = { GPIO_PF4 };
  247. static struct resource cm_flash_resource[] = {
  248. {
  249. .name = "cfi_probe",
  250. .start = 0x20000000,
  251. .end = 0x201fffff,
  252. .flags = IORESOURCE_MEM,
  253. }, {
  254. .start = (unsigned long)cm_flash_gpios,
  255. .end = ARRAY_SIZE(cm_flash_gpios),
  256. .flags = IORESOURCE_IRQ,
  257. }
  258. };
  259. static struct platform_device cm_flash_device = {
  260. .name = "gpio-addr-flash",
  261. .id = 0,
  262. .dev = {
  263. .platform_data = &cm_flash_data,
  264. },
  265. .num_resources = ARRAY_SIZE(cm_flash_resource),
  266. .resource = cm_flash_resource,
  267. };
  268. #endif
  269. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  270. #ifdef CONFIG_SERIAL_BFIN_UART0
  271. static struct resource bfin_uart0_resources[] = {
  272. {
  273. .start = UART0_THR,
  274. .end = UART0_GCTL+2,
  275. .flags = IORESOURCE_MEM,
  276. },
  277. {
  278. .start = IRQ_UART0_RX,
  279. .end = IRQ_UART0_RX+1,
  280. .flags = IORESOURCE_IRQ,
  281. },
  282. {
  283. .start = IRQ_UART0_ERROR,
  284. .end = IRQ_UART0_ERROR,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. {
  288. .start = CH_UART0_TX,
  289. .end = CH_UART0_TX,
  290. .flags = IORESOURCE_DMA,
  291. },
  292. {
  293. .start = CH_UART0_RX,
  294. .end = CH_UART0_RX,
  295. .flags = IORESOURCE_DMA,
  296. },
  297. #ifdef CONFIG_BFIN_UART0_CTSRTS
  298. {
  299. /*
  300. * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
  301. */
  302. .start = -1,
  303. .end = -1,
  304. .flags = IORESOURCE_IO,
  305. },
  306. {
  307. /*
  308. * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
  309. */
  310. .start = -1,
  311. .end = -1,
  312. .flags = IORESOURCE_IO,
  313. },
  314. #endif
  315. };
  316. static unsigned short bfin_uart0_peripherals[] = {
  317. P_UART0_TX, P_UART0_RX, 0
  318. };
  319. static struct platform_device bfin_uart0_device = {
  320. .name = "bfin-uart",
  321. .id = 0,
  322. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  323. .resource = bfin_uart0_resources,
  324. .dev = {
  325. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  326. },
  327. };
  328. #endif
  329. #ifdef CONFIG_SERIAL_BFIN_UART1
  330. static struct resource bfin_uart1_resources[] = {
  331. {
  332. .start = UART1_THR,
  333. .end = UART1_GCTL+2,
  334. .flags = IORESOURCE_MEM,
  335. },
  336. {
  337. .start = IRQ_UART1_RX,
  338. .end = IRQ_UART1_RX+1,
  339. .flags = IORESOURCE_IRQ,
  340. },
  341. {
  342. .start = IRQ_UART1_ERROR,
  343. .end = IRQ_UART1_ERROR,
  344. .flags = IORESOURCE_IRQ,
  345. },
  346. {
  347. .start = CH_UART1_TX,
  348. .end = CH_UART1_TX,
  349. .flags = IORESOURCE_DMA,
  350. },
  351. {
  352. .start = CH_UART1_RX,
  353. .end = CH_UART1_RX,
  354. .flags = IORESOURCE_DMA,
  355. },
  356. #ifdef CONFIG_BFIN_UART1_CTSRTS
  357. {
  358. /*
  359. * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
  360. */
  361. .start = -1,
  362. .end = -1,
  363. .flags = IORESOURCE_IO,
  364. },
  365. {
  366. /*
  367. * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
  368. */
  369. .start = -1,
  370. .end = -1,
  371. .flags = IORESOURCE_IO,
  372. },
  373. #endif
  374. };
  375. static unsigned short bfin_uart1_peripherals[] = {
  376. P_UART1_TX, P_UART1_RX, 0
  377. };
  378. static struct platform_device bfin_uart1_device = {
  379. .name = "bfin-uart",
  380. .id = 1,
  381. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  382. .resource = bfin_uart1_resources,
  383. .dev = {
  384. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  385. },
  386. };
  387. #endif
  388. #endif
  389. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  390. #ifdef CONFIG_BFIN_SIR0
  391. static struct resource bfin_sir0_resources[] = {
  392. {
  393. .start = 0xFFC00400,
  394. .end = 0xFFC004FF,
  395. .flags = IORESOURCE_MEM,
  396. },
  397. {
  398. .start = IRQ_UART0_RX,
  399. .end = IRQ_UART0_RX+1,
  400. .flags = IORESOURCE_IRQ,
  401. },
  402. {
  403. .start = CH_UART0_RX,
  404. .end = CH_UART0_RX+1,
  405. .flags = IORESOURCE_DMA,
  406. },
  407. };
  408. static struct platform_device bfin_sir0_device = {
  409. .name = "bfin_sir",
  410. .id = 0,
  411. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  412. .resource = bfin_sir0_resources,
  413. };
  414. #endif
  415. #ifdef CONFIG_BFIN_SIR1
  416. static struct resource bfin_sir1_resources[] = {
  417. {
  418. .start = 0xFFC02000,
  419. .end = 0xFFC020FF,
  420. .flags = IORESOURCE_MEM,
  421. },
  422. {
  423. .start = IRQ_UART1_RX,
  424. .end = IRQ_UART1_RX+1,
  425. .flags = IORESOURCE_IRQ,
  426. },
  427. {
  428. .start = CH_UART1_RX,
  429. .end = CH_UART1_RX+1,
  430. .flags = IORESOURCE_DMA,
  431. },
  432. };
  433. static struct platform_device bfin_sir1_device = {
  434. .name = "bfin_sir",
  435. .id = 1,
  436. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  437. .resource = bfin_sir1_resources,
  438. };
  439. #endif
  440. #endif
  441. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  442. static struct resource bfin_twi0_resource[] = {
  443. [0] = {
  444. .start = TWI0_REGBASE,
  445. .end = TWI0_REGBASE,
  446. .flags = IORESOURCE_MEM,
  447. },
  448. [1] = {
  449. .start = IRQ_TWI,
  450. .end = IRQ_TWI,
  451. .flags = IORESOURCE_IRQ,
  452. },
  453. };
  454. static struct platform_device i2c_bfin_twi_device = {
  455. .name = "i2c-bfin-twi",
  456. .id = 0,
  457. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  458. .resource = bfin_twi0_resource,
  459. };
  460. #endif
  461. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  462. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  463. static struct resource bfin_sport0_uart_resources[] = {
  464. {
  465. .start = SPORT0_TCR1,
  466. .end = SPORT0_MRCS3+4,
  467. .flags = IORESOURCE_MEM,
  468. },
  469. {
  470. .start = IRQ_SPORT0_RX,
  471. .end = IRQ_SPORT0_RX+1,
  472. .flags = IORESOURCE_IRQ,
  473. },
  474. {
  475. .start = IRQ_SPORT0_ERROR,
  476. .end = IRQ_SPORT0_ERROR,
  477. .flags = IORESOURCE_IRQ,
  478. },
  479. };
  480. static unsigned short bfin_sport0_peripherals[] = {
  481. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  482. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  483. };
  484. static struct platform_device bfin_sport0_uart_device = {
  485. .name = "bfin-sport-uart",
  486. .id = 0,
  487. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  488. .resource = bfin_sport0_uart_resources,
  489. .dev = {
  490. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  491. },
  492. };
  493. #endif
  494. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  495. static struct resource bfin_sport1_uart_resources[] = {
  496. {
  497. .start = SPORT1_TCR1,
  498. .end = SPORT1_MRCS3+4,
  499. .flags = IORESOURCE_MEM,
  500. },
  501. {
  502. .start = IRQ_SPORT1_RX,
  503. .end = IRQ_SPORT1_RX+1,
  504. .flags = IORESOURCE_IRQ,
  505. },
  506. {
  507. .start = IRQ_SPORT1_ERROR,
  508. .end = IRQ_SPORT1_ERROR,
  509. .flags = IORESOURCE_IRQ,
  510. },
  511. };
  512. static unsigned short bfin_sport1_peripherals[] = {
  513. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  514. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  515. };
  516. static struct platform_device bfin_sport1_uart_device = {
  517. .name = "bfin-sport-uart",
  518. .id = 1,
  519. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  520. .resource = bfin_sport1_uart_resources,
  521. .dev = {
  522. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  523. },
  524. };
  525. #endif
  526. #endif
  527. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  528. #include <linux/bfin_mac.h>
  529. #include <linux/export.h>
  530. static const unsigned short bfin_mac_peripherals[] = P_MII0;
  531. static struct bfin_phydev_platform_data bfin_phydev_data[] = {
  532. {
  533. .addr = 1,
  534. .irq = IRQ_MAC_PHYINT,
  535. },
  536. };
  537. static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
  538. .phydev_number = 1,
  539. .phydev_data = bfin_phydev_data,
  540. .phy_mode = PHY_INTERFACE_MODE_MII,
  541. .mac_peripherals = bfin_mac_peripherals,
  542. };
  543. static struct platform_device bfin_mii_bus = {
  544. .name = "bfin_mii_bus",
  545. .dev = {
  546. .platform_data = &bfin_mii_bus_data,
  547. }
  548. };
  549. static struct platform_device bfin_mac_device = {
  550. .name = "bfin_mac",
  551. .dev = {
  552. .platform_data = &bfin_mii_bus,
  553. }
  554. };
  555. #endif
  556. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  557. #define PATA_INT IRQ_PF14
  558. static struct pata_platform_info bfin_pata_platform_data = {
  559. .ioport_shift = 2,
  560. .irq_type = IRQF_TRIGGER_HIGH,
  561. };
  562. static struct resource bfin_pata_resources[] = {
  563. {
  564. .start = 0x2030C000,
  565. .end = 0x2030C01F,
  566. .flags = IORESOURCE_MEM,
  567. },
  568. {
  569. .start = 0x2030D018,
  570. .end = 0x2030D01B,
  571. .flags = IORESOURCE_MEM,
  572. },
  573. {
  574. .start = PATA_INT,
  575. .end = PATA_INT,
  576. .flags = IORESOURCE_IRQ,
  577. },
  578. };
  579. static struct platform_device bfin_pata_device = {
  580. .name = "pata_platform",
  581. .id = -1,
  582. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  583. .resource = bfin_pata_resources,
  584. .dev = {
  585. .platform_data = &bfin_pata_platform_data,
  586. }
  587. };
  588. #endif
  589. static const unsigned int cclk_vlev_datasheet[] =
  590. {
  591. VRPAIR(VLEV_085, 250000000),
  592. VRPAIR(VLEV_090, 376000000),
  593. VRPAIR(VLEV_095, 426000000),
  594. VRPAIR(VLEV_100, 426000000),
  595. VRPAIR(VLEV_105, 476000000),
  596. VRPAIR(VLEV_110, 476000000),
  597. VRPAIR(VLEV_115, 476000000),
  598. VRPAIR(VLEV_120, 500000000),
  599. VRPAIR(VLEV_125, 533000000),
  600. VRPAIR(VLEV_130, 600000000),
  601. };
  602. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  603. .tuple_tab = cclk_vlev_datasheet,
  604. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  605. .vr_settling_time = 25 /* us */,
  606. };
  607. static struct platform_device bfin_dpmc = {
  608. .name = "bfin dpmc",
  609. .dev = {
  610. .platform_data = &bfin_dmpc_vreg_data,
  611. },
  612. };
  613. static struct platform_device *cm_bf537e_devices[] __initdata = {
  614. &bfin_dpmc,
  615. #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
  616. &hitachi_fb_device,
  617. #endif
  618. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  619. &rtc_device,
  620. #endif
  621. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  622. #ifdef CONFIG_SERIAL_BFIN_UART0
  623. &bfin_uart0_device,
  624. #endif
  625. #ifdef CONFIG_SERIAL_BFIN_UART1
  626. &bfin_uart1_device,
  627. #endif
  628. #endif
  629. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  630. #ifdef CONFIG_BFIN_SIR0
  631. &bfin_sir0_device,
  632. #endif
  633. #ifdef CONFIG_BFIN_SIR1
  634. &bfin_sir1_device,
  635. #endif
  636. #endif
  637. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  638. &i2c_bfin_twi_device,
  639. #endif
  640. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  641. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  642. &bfin_sport0_uart_device,
  643. #endif
  644. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  645. &bfin_sport1_uart_device,
  646. #endif
  647. #endif
  648. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  649. &isp1362_hcd_device,
  650. #endif
  651. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  652. &smc91x_device,
  653. #endif
  654. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  655. &bfin_mii_bus,
  656. &bfin_mac_device,
  657. #endif
  658. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  659. &net2272_bfin_device,
  660. #endif
  661. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  662. &bfin_spi0_device,
  663. #endif
  664. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  665. &bfin_pata_device,
  666. #endif
  667. #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
  668. &cm_flash_device,
  669. #endif
  670. };
  671. static int __init net2272_init(void)
  672. {
  673. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  674. int ret;
  675. ret = gpio_request(GPIO_PG14, "net2272");
  676. if (ret)
  677. return ret;
  678. /* Reset USB Chip, PG14 */
  679. gpio_direction_output(GPIO_PG14, 0);
  680. mdelay(2);
  681. gpio_set_value(GPIO_PG14, 1);
  682. #endif
  683. return 0;
  684. }
  685. static int __init cm_bf537e_init(void)
  686. {
  687. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  688. platform_add_devices(cm_bf537e_devices, ARRAY_SIZE(cm_bf537e_devices));
  689. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  690. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  691. #endif
  692. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  693. irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
  694. #endif
  695. if (net2272_init())
  696. pr_warning("unable to configure net2272; it probably won't work\n");
  697. return 0;
  698. }
  699. arch_initcall(cm_bf537e_init);
  700. static struct platform_device *cm_bf537e_early_devices[] __initdata = {
  701. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  702. #ifdef CONFIG_SERIAL_BFIN_UART0
  703. &bfin_uart0_device,
  704. #endif
  705. #ifdef CONFIG_SERIAL_BFIN_UART1
  706. &bfin_uart1_device,
  707. #endif
  708. #endif
  709. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  710. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  711. &bfin_sport0_uart_device,
  712. #endif
  713. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  714. &bfin_sport1_uart_device,
  715. #endif
  716. #endif
  717. };
  718. void __init native_machine_early_platform_add_devices(void)
  719. {
  720. printk(KERN_INFO "register early platform devices\n");
  721. early_platform_add_devices(cm_bf537e_early_devices,
  722. ARRAY_SIZE(cm_bf537e_early_devices));
  723. }
  724. void bfin_get_ether_addr(char *addr)
  725. {
  726. random_ether_addr(addr);
  727. printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
  728. }
  729. EXPORT_SYMBOL(bfin_get_ether_addr);