cm_bf527.c 23 KB

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