ezkit.c 25 KB

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