cm_bf527.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  1. /*
  2. * File: arch/blackfin/mach-bf527/boards/cm-bf527.c
  3. * Based on: arch/blackfin/mach-bf537/boards/stamp.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  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/etherdevice.h>
  38. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  39. #include <linux/usb/isp1362.h>
  40. #endif
  41. #include <linux/i2c.h>
  42. #include <linux/irq.h>
  43. #include <linux/interrupt.h>
  44. #include <linux/usb/sl811.h>
  45. #include <linux/usb/musb.h>
  46. #include <asm/dma.h>
  47. #include <asm/bfin5xx_spi.h>
  48. #include <asm/reboot.h>
  49. #include <asm/nand.h>
  50. #include <asm/portmux.h>
  51. #include <asm/dpmc.h>
  52. #include <linux/spi/ad7877.h>
  53. /*
  54. * Name the Board for the /proc/cpuinfo
  55. */
  56. const char bfin_board_name[] = "Bluetechnix CM-BF527";
  57. /*
  58. * Driver needs to know address, irq and flag pin.
  59. */
  60. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  61. #include <linux/usb/isp1760.h>
  62. static struct resource bfin_isp1760_resources[] = {
  63. [0] = {
  64. .start = 0x203C0000,
  65. .end = 0x203C0000 + 0x000fffff,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. [1] = {
  69. .start = IRQ_PF7,
  70. .end = IRQ_PF7,
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. static struct isp1760_platform_data isp1760_priv = {
  75. .is_isp1761 = 0,
  76. .bus_width_16 = 1,
  77. .port1_otg = 0,
  78. .analog_oc = 0,
  79. .dack_polarity_high = 0,
  80. .dreq_polarity_high = 0,
  81. };
  82. static struct platform_device bfin_isp1760_device = {
  83. .name = "isp1760-hcd",
  84. .id = 0,
  85. .dev = {
  86. .platform_data = &isp1760_priv,
  87. },
  88. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  89. .resource = bfin_isp1760_resources,
  90. };
  91. #endif
  92. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  93. static struct resource musb_resources[] = {
  94. [0] = {
  95. .start = 0xffc03800,
  96. .end = 0xffc03cff,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. [1] = { /* general IRQ */
  100. .start = IRQ_USB_INT0,
  101. .end = IRQ_USB_INT0,
  102. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  103. },
  104. [2] = { /* DMA IRQ */
  105. .start = IRQ_USB_DMA,
  106. .end = IRQ_USB_DMA,
  107. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  108. },
  109. };
  110. static struct musb_hdrc_config musb_config = {
  111. .multipoint = 0,
  112. .dyn_fifo = 0,
  113. .soft_con = 1,
  114. .dma = 1,
  115. .num_eps = 8,
  116. .dma_channels = 8,
  117. .gpio_vrsel = GPIO_PF11,
  118. };
  119. static struct musb_hdrc_platform_data musb_plat = {
  120. #if defined(CONFIG_USB_MUSB_OTG)
  121. .mode = MUSB_OTG,
  122. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  123. .mode = MUSB_HOST,
  124. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  125. .mode = MUSB_PERIPHERAL,
  126. #endif
  127. .config = &musb_config,
  128. };
  129. static u64 musb_dmamask = ~(u32)0;
  130. static struct platform_device musb_device = {
  131. .name = "musb_hdrc",
  132. .id = 0,
  133. .dev = {
  134. .dma_mask = &musb_dmamask,
  135. .coherent_dma_mask = 0xffffffff,
  136. .platform_data = &musb_plat,
  137. },
  138. .num_resources = ARRAY_SIZE(musb_resources),
  139. .resource = musb_resources,
  140. };
  141. #endif
  142. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  143. static struct mtd_partition ezkit_partitions[] = {
  144. {
  145. .name = "bootloader(nor)",
  146. .size = 0x40000,
  147. .offset = 0,
  148. }, {
  149. .name = "linux kernel(nor)",
  150. .size = 0x1C0000,
  151. .offset = MTDPART_OFS_APPEND,
  152. }, {
  153. .name = "file system(nor)",
  154. .size = MTDPART_SIZ_FULL,
  155. .offset = MTDPART_OFS_APPEND,
  156. }
  157. };
  158. static struct physmap_flash_data ezkit_flash_data = {
  159. .width = 2,
  160. .parts = ezkit_partitions,
  161. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  162. };
  163. static struct resource ezkit_flash_resource = {
  164. .start = 0x20000000,
  165. .end = 0x201fffff,
  166. .flags = IORESOURCE_MEM,
  167. };
  168. static struct platform_device ezkit_flash_device = {
  169. .name = "physmap-flash",
  170. .id = 0,
  171. .dev = {
  172. .platform_data = &ezkit_flash_data,
  173. },
  174. .num_resources = 1,
  175. .resource = &ezkit_flash_resource,
  176. };
  177. #endif
  178. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  179. static struct mtd_partition partition_info[] = {
  180. {
  181. .name = "linux kernel(nand)",
  182. .offset = 0,
  183. .size = 4 * 1024 * 1024,
  184. },
  185. {
  186. .name = "file system(nand)",
  187. .offset = MTDPART_OFS_APPEND,
  188. .size = MTDPART_SIZ_FULL,
  189. },
  190. };
  191. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  192. .page_size = NFC_PG_SIZE_256,
  193. .data_width = NFC_NWIDTH_8,
  194. .partitions = partition_info,
  195. .nr_partitions = ARRAY_SIZE(partition_info),
  196. .rd_dly = 3,
  197. .wr_dly = 3,
  198. };
  199. static struct resource bf5xx_nand_resources[] = {
  200. {
  201. .start = NFC_CTL,
  202. .end = NFC_DATA_RD + 2,
  203. .flags = IORESOURCE_MEM,
  204. },
  205. {
  206. .start = CH_NFC,
  207. .end = CH_NFC,
  208. .flags = IORESOURCE_IRQ,
  209. },
  210. };
  211. static struct platform_device bf5xx_nand_device = {
  212. .name = "bf5xx-nand",
  213. .id = 0,
  214. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  215. .resource = bf5xx_nand_resources,
  216. .dev = {
  217. .platform_data = &bf5xx_nand_platform,
  218. },
  219. };
  220. #endif
  221. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  222. static struct resource bfin_pcmcia_cf_resources[] = {
  223. {
  224. .start = 0x20310000, /* IO PORT */
  225. .end = 0x20312000,
  226. .flags = IORESOURCE_MEM,
  227. }, {
  228. .start = 0x20311000, /* Attribute Memory */
  229. .end = 0x20311FFF,
  230. .flags = IORESOURCE_MEM,
  231. }, {
  232. .start = IRQ_PF4,
  233. .end = IRQ_PF4,
  234. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  235. }, {
  236. .start = 6, /* Card Detect PF6 */
  237. .end = 6,
  238. .flags = IORESOURCE_IRQ,
  239. },
  240. };
  241. static struct platform_device bfin_pcmcia_cf_device = {
  242. .name = "bfin_cf_pcmcia",
  243. .id = -1,
  244. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  245. .resource = bfin_pcmcia_cf_resources,
  246. };
  247. #endif
  248. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  249. static struct platform_device rtc_device = {
  250. .name = "rtc-bfin",
  251. .id = -1,
  252. };
  253. #endif
  254. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  255. #include <linux/smc91x.h>
  256. static struct smc91x_platdata smc91x_info = {
  257. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  258. .leda = RPC_LED_100_10,
  259. .ledb = RPC_LED_TX_RX,
  260. };
  261. static struct resource smc91x_resources[] = {
  262. {
  263. .name = "smc91x-regs",
  264. .start = 0x20300300,
  265. .end = 0x20300300 + 16,
  266. .flags = IORESOURCE_MEM,
  267. }, {
  268. .start = IRQ_PF7,
  269. .end = IRQ_PF7,
  270. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  271. },
  272. };
  273. static struct platform_device smc91x_device = {
  274. .name = "smc91x",
  275. .id = 0,
  276. .num_resources = ARRAY_SIZE(smc91x_resources),
  277. .resource = smc91x_resources,
  278. .dev = {
  279. .platform_data = &smc91x_info,
  280. },
  281. };
  282. #endif
  283. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  284. static struct resource dm9000_resources[] = {
  285. [0] = {
  286. .start = 0x203FB800,
  287. .end = 0x203FB800 + 1,
  288. .flags = IORESOURCE_MEM,
  289. },
  290. [1] = {
  291. .start = 0x203FB804,
  292. .end = 0x203FB804 + 1,
  293. .flags = IORESOURCE_MEM,
  294. },
  295. [2] = {
  296. .start = IRQ_PF9,
  297. .end = IRQ_PF9,
  298. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  299. },
  300. };
  301. static struct platform_device dm9000_device = {
  302. .name = "dm9000",
  303. .id = -1,
  304. .num_resources = ARRAY_SIZE(dm9000_resources),
  305. .resource = dm9000_resources,
  306. };
  307. #endif
  308. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  309. static struct resource sl811_hcd_resources[] = {
  310. {
  311. .start = 0x20340000,
  312. .end = 0x20340000,
  313. .flags = IORESOURCE_MEM,
  314. }, {
  315. .start = 0x20340004,
  316. .end = 0x20340004,
  317. .flags = IORESOURCE_MEM,
  318. }, {
  319. .start = CONFIG_USB_SL811_BFIN_IRQ,
  320. .end = CONFIG_USB_SL811_BFIN_IRQ,
  321. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  322. },
  323. };
  324. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  325. void sl811_port_power(struct device *dev, int is_on)
  326. {
  327. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  328. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  329. }
  330. #endif
  331. static struct sl811_platform_data sl811_priv = {
  332. .potpg = 10,
  333. .power = 250, /* == 500mA */
  334. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  335. .port_power = &sl811_port_power,
  336. #endif
  337. };
  338. static struct platform_device sl811_hcd_device = {
  339. .name = "sl811-hcd",
  340. .id = 0,
  341. .dev = {
  342. .platform_data = &sl811_priv,
  343. },
  344. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  345. .resource = sl811_hcd_resources,
  346. };
  347. #endif
  348. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  349. static struct resource isp1362_hcd_resources[] = {
  350. {
  351. .start = 0x20360000,
  352. .end = 0x20360000,
  353. .flags = IORESOURCE_MEM,
  354. }, {
  355. .start = 0x20360004,
  356. .end = 0x20360004,
  357. .flags = IORESOURCE_MEM,
  358. }, {
  359. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  360. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  361. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  362. },
  363. };
  364. static struct isp1362_platform_data isp1362_priv = {
  365. .sel15Kres = 1,
  366. .clknotstop = 0,
  367. .oc_enable = 0,
  368. .int_act_high = 0,
  369. .int_edge_triggered = 0,
  370. .remote_wakeup_connected = 0,
  371. .no_power_switching = 1,
  372. .power_switching_mode = 0,
  373. };
  374. static struct platform_device isp1362_hcd_device = {
  375. .name = "isp1362-hcd",
  376. .id = 0,
  377. .dev = {
  378. .platform_data = &isp1362_priv,
  379. },
  380. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  381. .resource = isp1362_hcd_resources,
  382. };
  383. #endif
  384. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  385. static struct platform_device bfin_mii_bus = {
  386. .name = "bfin_mii_bus",
  387. };
  388. static struct platform_device bfin_mac_device = {
  389. .name = "bfin_mac",
  390. .dev.platform_data = &bfin_mii_bus,
  391. };
  392. #endif
  393. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  394. static struct resource net2272_bfin_resources[] = {
  395. {
  396. .start = 0x20300000,
  397. .end = 0x20300000 + 0x100,
  398. .flags = IORESOURCE_MEM,
  399. }, {
  400. .start = IRQ_PF7,
  401. .end = IRQ_PF7,
  402. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  403. },
  404. };
  405. static struct platform_device net2272_bfin_device = {
  406. .name = "net2272",
  407. .id = -1,
  408. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  409. .resource = net2272_bfin_resources,
  410. };
  411. #endif
  412. #if defined(CONFIG_MTD_M25P80) \
  413. || defined(CONFIG_MTD_M25P80_MODULE)
  414. static struct mtd_partition bfin_spi_flash_partitions[] = {
  415. {
  416. .name = "bootloader(spi)",
  417. .size = 0x00040000,
  418. .offset = 0,
  419. .mask_flags = MTD_CAP_ROM
  420. }, {
  421. .name = "linux kernel(spi)",
  422. .size = MTDPART_SIZ_FULL,
  423. .offset = MTDPART_OFS_APPEND,
  424. }
  425. };
  426. static struct flash_platform_data bfin_spi_flash_data = {
  427. .name = "m25p80",
  428. .parts = bfin_spi_flash_partitions,
  429. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  430. .type = "m25p16",
  431. };
  432. /* SPI flash chip (m25p64) */
  433. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  434. .enable_dma = 0, /* use dma transfer with this chip*/
  435. .bits_per_word = 8,
  436. };
  437. #endif
  438. #if defined(CONFIG_BFIN_SPI_ADC) \
  439. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  440. /* SPI ADC chip */
  441. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  442. .enable_dma = 1, /* use dma transfer with this chip*/
  443. .bits_per_word = 16,
  444. };
  445. #endif
  446. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  447. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  448. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  449. .enable_dma = 0,
  450. .bits_per_word = 16,
  451. };
  452. #endif
  453. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  454. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  455. .enable_dma = 0,
  456. .bits_per_word = 8,
  457. };
  458. #endif
  459. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  460. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  461. .enable_dma = 0,
  462. .bits_per_word = 16,
  463. };
  464. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  465. .model = 7877,
  466. .vref_delay_usecs = 50, /* internal, no capacitor */
  467. .x_plate_ohms = 419,
  468. .y_plate_ohms = 486,
  469. .pressure_max = 1000,
  470. .pressure_min = 0,
  471. .stopacq_polarity = 1,
  472. .first_conversion_delay = 3,
  473. .acquisition_time = 1,
  474. .averaging = 1,
  475. .pen_down_acc_interval = 1,
  476. };
  477. #endif
  478. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  479. && defined(CONFIG_SND_SOC_WM8731_SPI)
  480. static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
  481. .enable_dma = 0,
  482. .bits_per_word = 16,
  483. };
  484. #endif
  485. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  486. static struct bfin5xx_spi_chip spidev_chip_info = {
  487. .enable_dma = 0,
  488. .bits_per_word = 8,
  489. };
  490. #endif
  491. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  492. #if defined(CONFIG_MTD_M25P80) \
  493. || defined(CONFIG_MTD_M25P80_MODULE)
  494. {
  495. /* the modalias must be the same as spi device driver name */
  496. .modalias = "m25p80", /* Name of spi_driver for this device */
  497. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  498. .bus_num = 0, /* Framework bus number */
  499. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  500. .platform_data = &bfin_spi_flash_data,
  501. .controller_data = &spi_flash_chip_info,
  502. .mode = SPI_MODE_3,
  503. },
  504. #endif
  505. #if defined(CONFIG_BFIN_SPI_ADC) \
  506. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  507. {
  508. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  509. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  510. .bus_num = 0, /* Framework bus number */
  511. .chip_select = 1, /* Framework chip select. */
  512. .platform_data = NULL, /* No spi_driver specific config */
  513. .controller_data = &spi_adc_chip_info,
  514. },
  515. #endif
  516. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  517. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  518. {
  519. .modalias = "ad1836",
  520. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  521. .bus_num = 0,
  522. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  523. .controller_data = &ad1836_spi_chip_info,
  524. },
  525. #endif
  526. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  527. {
  528. .modalias = "mmc_spi",
  529. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  530. .bus_num = 0,
  531. .chip_select = 5,
  532. .controller_data = &mmc_spi_chip_info,
  533. .mode = SPI_MODE_3,
  534. },
  535. #endif
  536. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  537. {
  538. .modalias = "ad7877",
  539. .platform_data = &bfin_ad7877_ts_info,
  540. .irq = IRQ_PF8,
  541. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  542. .bus_num = 0,
  543. .chip_select = 2,
  544. .controller_data = &spi_ad7877_chip_info,
  545. },
  546. #endif
  547. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  548. && defined(CONFIG_SND_SOC_WM8731_SPI)
  549. {
  550. .modalias = "wm8731",
  551. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  552. .bus_num = 0,
  553. .chip_select = 5,
  554. .controller_data = &spi_wm8731_chip_info,
  555. .mode = SPI_MODE_0,
  556. },
  557. #endif
  558. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  559. {
  560. .modalias = "spidev",
  561. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  562. .bus_num = 0,
  563. .chip_select = 1,
  564. .controller_data = &spidev_chip_info,
  565. },
  566. #endif
  567. };
  568. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  569. /* SPI controller data */
  570. static struct bfin5xx_spi_master bfin_spi0_info = {
  571. .num_chipselect = 8,
  572. .enable_dma = 1, /* master has the ability to do dma transfer */
  573. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  574. };
  575. /* SPI (0) */
  576. static struct resource bfin_spi0_resource[] = {
  577. [0] = {
  578. .start = SPI0_REGBASE,
  579. .end = SPI0_REGBASE + 0xFF,
  580. .flags = IORESOURCE_MEM,
  581. },
  582. [1] = {
  583. .start = CH_SPI,
  584. .end = CH_SPI,
  585. .flags = IORESOURCE_DMA,
  586. },
  587. [2] = {
  588. .start = IRQ_SPI,
  589. .end = IRQ_SPI,
  590. .flags = IORESOURCE_IRQ,
  591. },
  592. };
  593. static struct platform_device bfin_spi0_device = {
  594. .name = "bfin-spi",
  595. .id = 0, /* Bus number */
  596. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  597. .resource = bfin_spi0_resource,
  598. .dev = {
  599. .platform_data = &bfin_spi0_info, /* Passed to driver */
  600. },
  601. };
  602. #endif /* spi master and devices */
  603. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  604. static struct platform_device bfin_fb_adv7393_device = {
  605. .name = "bfin-adv7393",
  606. };
  607. #endif
  608. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  609. static struct resource bfin_uart_resources[] = {
  610. #ifdef CONFIG_SERIAL_BFIN_UART0
  611. {
  612. .start = 0xFFC00400,
  613. .end = 0xFFC004FF,
  614. .flags = IORESOURCE_MEM,
  615. },
  616. #endif
  617. #ifdef CONFIG_SERIAL_BFIN_UART1
  618. {
  619. .start = 0xFFC02000,
  620. .end = 0xFFC020FF,
  621. .flags = IORESOURCE_MEM,
  622. },
  623. #endif
  624. };
  625. static struct platform_device bfin_uart_device = {
  626. .name = "bfin-uart",
  627. .id = 1,
  628. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  629. .resource = bfin_uart_resources,
  630. };
  631. #endif
  632. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  633. #ifdef CONFIG_BFIN_SIR0
  634. static struct resource bfin_sir0_resources[] = {
  635. {
  636. .start = 0xFFC00400,
  637. .end = 0xFFC004FF,
  638. .flags = IORESOURCE_MEM,
  639. },
  640. {
  641. .start = IRQ_UART0_RX,
  642. .end = IRQ_UART0_RX+1,
  643. .flags = IORESOURCE_IRQ,
  644. },
  645. {
  646. .start = CH_UART0_RX,
  647. .end = CH_UART0_RX+1,
  648. .flags = IORESOURCE_DMA,
  649. },
  650. };
  651. static struct platform_device bfin_sir0_device = {
  652. .name = "bfin_sir",
  653. .id = 0,
  654. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  655. .resource = bfin_sir0_resources,
  656. };
  657. #endif
  658. #ifdef CONFIG_BFIN_SIR1
  659. static struct resource bfin_sir1_resources[] = {
  660. {
  661. .start = 0xFFC02000,
  662. .end = 0xFFC020FF,
  663. .flags = IORESOURCE_MEM,
  664. },
  665. {
  666. .start = IRQ_UART1_RX,
  667. .end = IRQ_UART1_RX+1,
  668. .flags = IORESOURCE_IRQ,
  669. },
  670. {
  671. .start = CH_UART1_RX,
  672. .end = CH_UART1_RX+1,
  673. .flags = IORESOURCE_DMA,
  674. },
  675. };
  676. static struct platform_device bfin_sir1_device = {
  677. .name = "bfin_sir",
  678. .id = 1,
  679. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  680. .resource = bfin_sir1_resources,
  681. };
  682. #endif
  683. #endif
  684. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  685. static struct resource bfin_twi0_resource[] = {
  686. [0] = {
  687. .start = TWI0_REGBASE,
  688. .end = TWI0_REGBASE,
  689. .flags = IORESOURCE_MEM,
  690. },
  691. [1] = {
  692. .start = IRQ_TWI,
  693. .end = IRQ_TWI,
  694. .flags = IORESOURCE_IRQ,
  695. },
  696. };
  697. static struct platform_device i2c_bfin_twi_device = {
  698. .name = "i2c-bfin-twi",
  699. .id = 0,
  700. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  701. .resource = bfin_twi0_resource,
  702. };
  703. #endif
  704. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  705. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  706. {
  707. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  708. },
  709. #endif
  710. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  711. {
  712. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  713. .irq = IRQ_PF8,
  714. },
  715. #endif
  716. };
  717. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  718. static struct platform_device bfin_sport0_uart_device = {
  719. .name = "bfin-sport-uart",
  720. .id = 0,
  721. };
  722. static struct platform_device bfin_sport1_uart_device = {
  723. .name = "bfin-sport-uart",
  724. .id = 1,
  725. };
  726. #endif
  727. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  728. #include <linux/input.h>
  729. #include <linux/gpio_keys.h>
  730. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  731. {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
  732. };
  733. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  734. .buttons = bfin_gpio_keys_table,
  735. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  736. };
  737. static struct platform_device bfin_device_gpiokeys = {
  738. .name = "gpio-keys",
  739. .dev = {
  740. .platform_data = &bfin_gpio_keys_data,
  741. },
  742. };
  743. #endif
  744. static struct resource bfin_gpios_resources = {
  745. .start = 0,
  746. .end = MAX_BLACKFIN_GPIOS - 1,
  747. .flags = IORESOURCE_IRQ,
  748. };
  749. static struct platform_device bfin_gpios_device = {
  750. .name = "simple-gpio",
  751. .id = -1,
  752. .num_resources = 1,
  753. .resource = &bfin_gpios_resources,
  754. };
  755. static const unsigned int cclk_vlev_datasheet[] =
  756. {
  757. VRPAIR(VLEV_100, 400000000),
  758. VRPAIR(VLEV_105, 426000000),
  759. VRPAIR(VLEV_110, 500000000),
  760. VRPAIR(VLEV_115, 533000000),
  761. VRPAIR(VLEV_120, 600000000),
  762. };
  763. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  764. .tuple_tab = cclk_vlev_datasheet,
  765. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  766. .vr_settling_time = 25 /* us */,
  767. };
  768. static struct platform_device bfin_dpmc = {
  769. .name = "bfin dpmc",
  770. .dev = {
  771. .platform_data = &bfin_dmpc_vreg_data,
  772. },
  773. };
  774. static struct platform_device *stamp_devices[] __initdata = {
  775. &bfin_dpmc,
  776. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  777. &bf5xx_nand_device,
  778. #endif
  779. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  780. &bfin_pcmcia_cf_device,
  781. #endif
  782. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  783. &rtc_device,
  784. #endif
  785. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  786. &sl811_hcd_device,
  787. #endif
  788. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  789. &isp1362_hcd_device,
  790. #endif
  791. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  792. &bfin_isp1760_device,
  793. #endif
  794. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  795. &musb_device,
  796. #endif
  797. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  798. &smc91x_device,
  799. #endif
  800. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  801. &dm9000_device,
  802. #endif
  803. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  804. &bfin_mii_bus,
  805. &bfin_mac_device,
  806. #endif
  807. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  808. &net2272_bfin_device,
  809. #endif
  810. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  811. &bfin_spi0_device,
  812. #endif
  813. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  814. &bfin_fb_adv7393_device,
  815. #endif
  816. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  817. &bfin_uart_device,
  818. #endif
  819. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  820. #ifdef CONFIG_BFIN_SIR0
  821. &bfin_sir0_device,
  822. #endif
  823. #ifdef CONFIG_BFIN_SIR1
  824. &bfin_sir1_device,
  825. #endif
  826. #endif
  827. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  828. &i2c_bfin_twi_device,
  829. #endif
  830. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  831. &bfin_sport0_uart_device,
  832. &bfin_sport1_uart_device,
  833. #endif
  834. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  835. &bfin_device_gpiokeys,
  836. #endif
  837. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  838. &ezkit_flash_device,
  839. #endif
  840. &bfin_gpios_device,
  841. };
  842. static int __init cm_init(void)
  843. {
  844. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  845. i2c_register_board_info(0, bfin_i2c_board_info,
  846. ARRAY_SIZE(bfin_i2c_board_info));
  847. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  848. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  849. return 0;
  850. }
  851. arch_initcall(cm_init);
  852. void native_machine_restart(char *cmd)
  853. {
  854. /* workaround reboot hang when booting from SPI */
  855. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  856. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  857. }
  858. void bfin_get_ether_addr(char *addr)
  859. {
  860. random_ether_addr(addr);
  861. printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
  862. }
  863. EXPORT_SYMBOL(bfin_get_ether_addr);