cm_bf527.c 24 KB

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