cm_bf527.c 24 KB

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