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