cm_bf527.c 24 KB

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