cm_bf527.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  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. static struct resource smc91x_resources[] = {
  256. {
  257. .name = "smc91x-regs",
  258. .start = 0x20300300,
  259. .end = 0x20300300 + 16,
  260. .flags = IORESOURCE_MEM,
  261. }, {
  262. .start = IRQ_PF7,
  263. .end = IRQ_PF7,
  264. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  265. },
  266. };
  267. static struct platform_device smc91x_device = {
  268. .name = "smc91x",
  269. .id = 0,
  270. .num_resources = ARRAY_SIZE(smc91x_resources),
  271. .resource = smc91x_resources,
  272. };
  273. #endif
  274. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  275. static struct resource dm9000_resources[] = {
  276. [0] = {
  277. .start = 0x203FB800,
  278. .end = 0x203FB800 + 8,
  279. .flags = IORESOURCE_MEM,
  280. },
  281. [1] = {
  282. .start = IRQ_PF9,
  283. .end = IRQ_PF9,
  284. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  285. },
  286. };
  287. static struct platform_device dm9000_device = {
  288. .name = "dm9000",
  289. .id = -1,
  290. .num_resources = ARRAY_SIZE(dm9000_resources),
  291. .resource = dm9000_resources,
  292. };
  293. #endif
  294. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  295. static struct resource sl811_hcd_resources[] = {
  296. {
  297. .start = 0x20340000,
  298. .end = 0x20340000,
  299. .flags = IORESOURCE_MEM,
  300. }, {
  301. .start = 0x20340004,
  302. .end = 0x20340004,
  303. .flags = IORESOURCE_MEM,
  304. }, {
  305. .start = CONFIG_USB_SL811_BFIN_IRQ,
  306. .end = CONFIG_USB_SL811_BFIN_IRQ,
  307. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  308. },
  309. };
  310. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  311. void sl811_port_power(struct device *dev, int is_on)
  312. {
  313. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  314. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  315. }
  316. #endif
  317. static struct sl811_platform_data sl811_priv = {
  318. .potpg = 10,
  319. .power = 250, /* == 500mA */
  320. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  321. .port_power = &sl811_port_power,
  322. #endif
  323. };
  324. static struct platform_device sl811_hcd_device = {
  325. .name = "sl811-hcd",
  326. .id = 0,
  327. .dev = {
  328. .platform_data = &sl811_priv,
  329. },
  330. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  331. .resource = sl811_hcd_resources,
  332. };
  333. #endif
  334. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  335. static struct resource isp1362_hcd_resources[] = {
  336. {
  337. .start = 0x20360000,
  338. .end = 0x20360000,
  339. .flags = IORESOURCE_MEM,
  340. }, {
  341. .start = 0x20360004,
  342. .end = 0x20360004,
  343. .flags = IORESOURCE_MEM,
  344. }, {
  345. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  346. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  347. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  348. },
  349. };
  350. static struct isp1362_platform_data isp1362_priv = {
  351. .sel15Kres = 1,
  352. .clknotstop = 0,
  353. .oc_enable = 0,
  354. .int_act_high = 0,
  355. .int_edge_triggered = 0,
  356. .remote_wakeup_connected = 0,
  357. .no_power_switching = 1,
  358. .power_switching_mode = 0,
  359. };
  360. static struct platform_device isp1362_hcd_device = {
  361. .name = "isp1362-hcd",
  362. .id = 0,
  363. .dev = {
  364. .platform_data = &isp1362_priv,
  365. },
  366. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  367. .resource = isp1362_hcd_resources,
  368. };
  369. #endif
  370. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  371. static struct platform_device bfin_mii_bus = {
  372. .name = "bfin_mii_bus",
  373. };
  374. static struct platform_device bfin_mac_device = {
  375. .name = "bfin_mac",
  376. .dev.platform_data = &bfin_mii_bus,
  377. };
  378. #endif
  379. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  380. static struct resource net2272_bfin_resources[] = {
  381. {
  382. .start = 0x20300000,
  383. .end = 0x20300000 + 0x100,
  384. .flags = IORESOURCE_MEM,
  385. }, {
  386. .start = IRQ_PF7,
  387. .end = IRQ_PF7,
  388. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  389. },
  390. };
  391. static struct platform_device net2272_bfin_device = {
  392. .name = "net2272",
  393. .id = -1,
  394. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  395. .resource = net2272_bfin_resources,
  396. };
  397. #endif
  398. #if defined(CONFIG_MTD_M25P80) \
  399. || defined(CONFIG_MTD_M25P80_MODULE)
  400. static struct mtd_partition bfin_spi_flash_partitions[] = {
  401. {
  402. .name = "bootloader(spi)",
  403. .size = 0x00040000,
  404. .offset = 0,
  405. .mask_flags = MTD_CAP_ROM
  406. }, {
  407. .name = "linux kernel(spi)",
  408. .size = MTDPART_SIZ_FULL,
  409. .offset = MTDPART_OFS_APPEND,
  410. }
  411. };
  412. static struct flash_platform_data bfin_spi_flash_data = {
  413. .name = "m25p80",
  414. .parts = bfin_spi_flash_partitions,
  415. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  416. .type = "m25p16",
  417. };
  418. /* SPI flash chip (m25p64) */
  419. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  420. .enable_dma = 0, /* use dma transfer with this chip*/
  421. .bits_per_word = 8,
  422. };
  423. #endif
  424. #if defined(CONFIG_BFIN_SPI_ADC) \
  425. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  426. /* SPI ADC chip */
  427. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  428. .enable_dma = 1, /* use dma transfer with this chip*/
  429. .bits_per_word = 16,
  430. };
  431. #endif
  432. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  433. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  434. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  435. .enable_dma = 0,
  436. .bits_per_word = 16,
  437. };
  438. #endif
  439. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  440. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  441. .enable_dma = 0,
  442. .bits_per_word = 16,
  443. };
  444. #endif
  445. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  446. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  447. .enable_dma = 0,
  448. .bits_per_word = 8,
  449. };
  450. #endif
  451. #if defined(CONFIG_PBX)
  452. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  453. .ctl_reg = 0x4, /* send zero */
  454. .enable_dma = 0,
  455. .bits_per_word = 8,
  456. .cs_change_per_word = 1,
  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-spi",
  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_AD9960) || defined(CONFIG_AD9960_MODULE)
  527. {
  528. .modalias = "ad9960-spi",
  529. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  530. .bus_num = 0,
  531. .chip_select = 1,
  532. .controller_data = &ad9960_spi_chip_info,
  533. },
  534. #endif
  535. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  536. {
  537. .modalias = "mmc_spi",
  538. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  539. .bus_num = 0,
  540. .chip_select = 5,
  541. .controller_data = &mmc_spi_chip_info,
  542. .mode = SPI_MODE_3,
  543. },
  544. #endif
  545. #if defined(CONFIG_PBX)
  546. {
  547. .modalias = "fxs-spi",
  548. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  549. .bus_num = 0,
  550. .chip_select = 8 - CONFIG_J11_JUMPER,
  551. .controller_data = &spi_si3xxx_chip_info,
  552. .mode = SPI_MODE_3,
  553. },
  554. {
  555. .modalias = "fxo-spi",
  556. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  557. .bus_num = 0,
  558. .chip_select = 8 - CONFIG_J19_JUMPER,
  559. .controller_data = &spi_si3xxx_chip_info,
  560. .mode = SPI_MODE_3,
  561. },
  562. #endif
  563. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  564. {
  565. .modalias = "ad7877",
  566. .platform_data = &bfin_ad7877_ts_info,
  567. .irq = IRQ_PF8,
  568. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  569. .bus_num = 0,
  570. .chip_select = 2,
  571. .controller_data = &spi_ad7877_chip_info,
  572. },
  573. #endif
  574. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  575. && defined(CONFIG_SND_SOC_WM8731_SPI)
  576. {
  577. .modalias = "wm8731",
  578. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  579. .bus_num = 0,
  580. .chip_select = 5,
  581. .controller_data = &spi_wm8731_chip_info,
  582. .mode = SPI_MODE_0,
  583. },
  584. #endif
  585. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  586. {
  587. .modalias = "spidev",
  588. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  589. .bus_num = 0,
  590. .chip_select = 1,
  591. .controller_data = &spidev_chip_info,
  592. },
  593. #endif
  594. };
  595. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  596. /* SPI controller data */
  597. static struct bfin5xx_spi_master bfin_spi0_info = {
  598. .num_chipselect = 8,
  599. .enable_dma = 1, /* master has the ability to do dma transfer */
  600. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  601. };
  602. /* SPI (0) */
  603. static struct resource bfin_spi0_resource[] = {
  604. [0] = {
  605. .start = SPI0_REGBASE,
  606. .end = SPI0_REGBASE + 0xFF,
  607. .flags = IORESOURCE_MEM,
  608. },
  609. [1] = {
  610. .start = CH_SPI,
  611. .end = CH_SPI,
  612. .flags = IORESOURCE_DMA,
  613. },
  614. [2] = {
  615. .start = IRQ_SPI,
  616. .end = IRQ_SPI,
  617. .flags = IORESOURCE_IRQ,
  618. },
  619. };
  620. static struct platform_device bfin_spi0_device = {
  621. .name = "bfin-spi",
  622. .id = 0, /* Bus number */
  623. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  624. .resource = bfin_spi0_resource,
  625. .dev = {
  626. .platform_data = &bfin_spi0_info, /* Passed to driver */
  627. },
  628. };
  629. #endif /* spi master and devices */
  630. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  631. static struct platform_device bfin_fb_adv7393_device = {
  632. .name = "bfin-adv7393",
  633. };
  634. #endif
  635. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  636. static struct resource bfin_uart_resources[] = {
  637. #ifdef CONFIG_SERIAL_BFIN_UART0
  638. {
  639. .start = 0xFFC00400,
  640. .end = 0xFFC004FF,
  641. .flags = IORESOURCE_MEM,
  642. },
  643. #endif
  644. #ifdef CONFIG_SERIAL_BFIN_UART1
  645. {
  646. .start = 0xFFC02000,
  647. .end = 0xFFC020FF,
  648. .flags = IORESOURCE_MEM,
  649. },
  650. #endif
  651. };
  652. static struct platform_device bfin_uart_device = {
  653. .name = "bfin-uart",
  654. .id = 1,
  655. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  656. .resource = bfin_uart_resources,
  657. };
  658. #endif
  659. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  660. #ifdef CONFIG_BFIN_SIR0
  661. static struct resource bfin_sir0_resources[] = {
  662. {
  663. .start = 0xFFC00400,
  664. .end = 0xFFC004FF,
  665. .flags = IORESOURCE_MEM,
  666. },
  667. {
  668. .start = IRQ_UART0_RX,
  669. .end = IRQ_UART0_RX+1,
  670. .flags = IORESOURCE_IRQ,
  671. },
  672. {
  673. .start = CH_UART0_RX,
  674. .end = CH_UART0_RX+1,
  675. .flags = IORESOURCE_DMA,
  676. },
  677. };
  678. static struct platform_device bfin_sir0_device = {
  679. .name = "bfin_sir",
  680. .id = 0,
  681. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  682. .resource = bfin_sir0_resources,
  683. };
  684. #endif
  685. #ifdef CONFIG_BFIN_SIR1
  686. static struct resource bfin_sir1_resources[] = {
  687. {
  688. .start = 0xFFC02000,
  689. .end = 0xFFC020FF,
  690. .flags = IORESOURCE_MEM,
  691. },
  692. {
  693. .start = IRQ_UART1_RX,
  694. .end = IRQ_UART1_RX+1,
  695. .flags = IORESOURCE_IRQ,
  696. },
  697. {
  698. .start = CH_UART1_RX,
  699. .end = CH_UART1_RX+1,
  700. .flags = IORESOURCE_DMA,
  701. },
  702. };
  703. static struct platform_device bfin_sir1_device = {
  704. .name = "bfin_sir",
  705. .id = 1,
  706. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  707. .resource = bfin_sir1_resources,
  708. };
  709. #endif
  710. #endif
  711. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  712. static struct resource bfin_twi0_resource[] = {
  713. [0] = {
  714. .start = TWI0_REGBASE,
  715. .end = TWI0_REGBASE,
  716. .flags = IORESOURCE_MEM,
  717. },
  718. [1] = {
  719. .start = IRQ_TWI,
  720. .end = IRQ_TWI,
  721. .flags = IORESOURCE_IRQ,
  722. },
  723. };
  724. static struct platform_device i2c_bfin_twi_device = {
  725. .name = "i2c-bfin-twi",
  726. .id = 0,
  727. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  728. .resource = bfin_twi0_resource,
  729. };
  730. #endif
  731. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  732. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  733. {
  734. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  735. .type = "pcf8574_lcd",
  736. },
  737. #endif
  738. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  739. {
  740. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  741. .type = "pcf8574_keypad",
  742. .irq = IRQ_PF8,
  743. },
  744. #endif
  745. };
  746. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  747. static struct platform_device bfin_sport0_uart_device = {
  748. .name = "bfin-sport-uart",
  749. .id = 0,
  750. };
  751. static struct platform_device bfin_sport1_uart_device = {
  752. .name = "bfin-sport-uart",
  753. .id = 1,
  754. };
  755. #endif
  756. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  757. #include <linux/input.h>
  758. #include <linux/gpio_keys.h>
  759. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  760. {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
  761. };
  762. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  763. .buttons = bfin_gpio_keys_table,
  764. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  765. };
  766. static struct platform_device bfin_device_gpiokeys = {
  767. .name = "gpio-keys",
  768. .dev = {
  769. .platform_data = &bfin_gpio_keys_data,
  770. },
  771. };
  772. #endif
  773. static struct resource bfin_gpios_resources = {
  774. .start = 0,
  775. .end = MAX_BLACKFIN_GPIOS - 1,
  776. .flags = IORESOURCE_IRQ,
  777. };
  778. static struct platform_device bfin_gpios_device = {
  779. .name = "simple-gpio",
  780. .id = -1,
  781. .num_resources = 1,
  782. .resource = &bfin_gpios_resources,
  783. };
  784. static const unsigned int cclk_vlev_datasheet[] =
  785. {
  786. VRPAIR(VLEV_100, 400000000),
  787. VRPAIR(VLEV_105, 426000000),
  788. VRPAIR(VLEV_110, 500000000),
  789. VRPAIR(VLEV_115, 533000000),
  790. VRPAIR(VLEV_120, 600000000),
  791. };
  792. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  793. .tuple_tab = cclk_vlev_datasheet,
  794. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  795. .vr_settling_time = 25 /* us */,
  796. };
  797. static struct platform_device bfin_dpmc = {
  798. .name = "bfin dpmc",
  799. .dev = {
  800. .platform_data = &bfin_dmpc_vreg_data,
  801. },
  802. };
  803. static struct platform_device *stamp_devices[] __initdata = {
  804. &bfin_dpmc,
  805. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  806. &bf5xx_nand_device,
  807. #endif
  808. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  809. &bfin_pcmcia_cf_device,
  810. #endif
  811. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  812. &rtc_device,
  813. #endif
  814. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  815. &sl811_hcd_device,
  816. #endif
  817. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  818. &isp1362_hcd_device,
  819. #endif
  820. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  821. &bfin_isp1760_device,
  822. #endif
  823. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  824. &musb_device,
  825. #endif
  826. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  827. &smc91x_device,
  828. #endif
  829. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  830. &dm9000_device,
  831. #endif
  832. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  833. &bfin_mii_bus,
  834. &bfin_mac_device,
  835. #endif
  836. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  837. &net2272_bfin_device,
  838. #endif
  839. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  840. &bfin_spi0_device,
  841. #endif
  842. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  843. &bfin_fb_adv7393_device,
  844. #endif
  845. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  846. &bfin_uart_device,
  847. #endif
  848. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  849. #ifdef CONFIG_BFIN_SIR0
  850. &bfin_sir0_device,
  851. #endif
  852. #ifdef CONFIG_BFIN_SIR1
  853. &bfin_sir1_device,
  854. #endif
  855. #endif
  856. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  857. &i2c_bfin_twi_device,
  858. #endif
  859. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  860. &bfin_sport0_uart_device,
  861. &bfin_sport1_uart_device,
  862. #endif
  863. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  864. &bfin_device_gpiokeys,
  865. #endif
  866. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  867. &ezkit_flash_device,
  868. #endif
  869. &bfin_gpios_device,
  870. };
  871. static int __init cm_init(void)
  872. {
  873. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  874. i2c_register_board_info(0, bfin_i2c_board_info,
  875. ARRAY_SIZE(bfin_i2c_board_info));
  876. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  877. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  878. return 0;
  879. }
  880. arch_initcall(cm_init);
  881. void native_machine_restart(char *cmd)
  882. {
  883. /* workaround reboot hang when booting from SPI */
  884. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  885. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  886. }
  887. void bfin_get_ether_addr(char *addr)
  888. {
  889. random_ether_addr(addr);
  890. printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
  891. }
  892. EXPORT_SYMBOL(bfin_get_ether_addr);