cm_bf537e.c 21 KB

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