ezkit.c 23 KB

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