ezkit.c 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
  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_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  410. /* all SPI peripherals info goes here */
  411. #if defined(CONFIG_MTD_M25P80) \
  412. || defined(CONFIG_MTD_M25P80_MODULE)
  413. static struct mtd_partition bfin_spi_flash_partitions[] = {
  414. {
  415. .name = "bootloader",
  416. .size = 0x00040000,
  417. .offset = 0,
  418. .mask_flags = MTD_CAP_ROM
  419. }, {
  420. .name = "linux kernel",
  421. .size = MTDPART_SIZ_FULL,
  422. .offset = MTDPART_OFS_APPEND,
  423. }
  424. };
  425. static struct flash_platform_data bfin_spi_flash_data = {
  426. .name = "m25p80",
  427. .parts = bfin_spi_flash_partitions,
  428. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  429. .type = "m25p16",
  430. };
  431. /* SPI flash chip (m25p64) */
  432. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  433. .enable_dma = 0, /* use dma transfer with this chip*/
  434. .bits_per_word = 8,
  435. };
  436. #endif
  437. #if defined(CONFIG_SPI_ADC_BF533) \
  438. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  439. /* SPI ADC chip */
  440. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  441. .enable_dma = 1, /* use dma transfer with this chip*/
  442. .bits_per_word = 16,
  443. };
  444. #endif
  445. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  446. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  447. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  448. .enable_dma = 0,
  449. .bits_per_word = 16,
  450. };
  451. #endif
  452. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  453. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  454. .enable_dma = 0,
  455. .bits_per_word = 16,
  456. };
  457. #endif
  458. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  459. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  460. .enable_dma = 1,
  461. .bits_per_word = 8,
  462. };
  463. #endif
  464. #if defined(CONFIG_PBX)
  465. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  466. .ctl_reg = 0x4, /* send zero */
  467. .enable_dma = 0,
  468. .bits_per_word = 8,
  469. .cs_change_per_word = 1,
  470. };
  471. #endif
  472. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  473. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  474. .enable_dma = 0,
  475. .bits_per_word = 16,
  476. };
  477. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  478. .model = 7877,
  479. .vref_delay_usecs = 50, /* internal, no capacitor */
  480. .x_plate_ohms = 419,
  481. .y_plate_ohms = 486,
  482. .pressure_max = 1000,
  483. .pressure_min = 0,
  484. .stopacq_polarity = 1,
  485. .first_conversion_delay = 3,
  486. .acquisition_time = 1,
  487. .averaging = 1,
  488. .pen_down_acc_interval = 1,
  489. };
  490. #endif
  491. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  492. && defined(CONFIG_SND_SOC_WM8731_SPI)
  493. static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
  494. .enable_dma = 0,
  495. .bits_per_word = 16,
  496. };
  497. #endif
  498. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  499. static struct bfin5xx_spi_chip spidev_chip_info = {
  500. .enable_dma = 0,
  501. .bits_per_word = 8,
  502. };
  503. #endif
  504. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  505. #if defined(CONFIG_MTD_M25P80) \
  506. || defined(CONFIG_MTD_M25P80_MODULE)
  507. {
  508. /* the modalias must be the same as spi device driver name */
  509. .modalias = "m25p80", /* Name of spi_driver for this device */
  510. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  511. .bus_num = 0, /* Framework bus number */
  512. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  513. .platform_data = &bfin_spi_flash_data,
  514. .controller_data = &spi_flash_chip_info,
  515. .mode = SPI_MODE_3,
  516. },
  517. #endif
  518. #if defined(CONFIG_SPI_ADC_BF533) \
  519. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  520. {
  521. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  522. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  523. .bus_num = 0, /* Framework bus number */
  524. .chip_select = 1, /* Framework chip select. */
  525. .platform_data = NULL, /* No spi_driver specific config */
  526. .controller_data = &spi_adc_chip_info,
  527. },
  528. #endif
  529. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  530. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  531. {
  532. .modalias = "ad1836-spi",
  533. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  534. .bus_num = 0,
  535. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  536. .controller_data = &ad1836_spi_chip_info,
  537. },
  538. #endif
  539. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  540. {
  541. .modalias = "ad9960-spi",
  542. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  543. .bus_num = 0,
  544. .chip_select = 1,
  545. .controller_data = &ad9960_spi_chip_info,
  546. },
  547. #endif
  548. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  549. {
  550. .modalias = "spi_mmc_dummy",
  551. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  552. .bus_num = 0,
  553. .chip_select = 0,
  554. .platform_data = NULL,
  555. .controller_data = &spi_mmc_chip_info,
  556. .mode = SPI_MODE_3,
  557. },
  558. {
  559. .modalias = "spi_mmc",
  560. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  561. .bus_num = 0,
  562. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  563. .platform_data = NULL,
  564. .controller_data = &spi_mmc_chip_info,
  565. .mode = SPI_MODE_3,
  566. },
  567. #endif
  568. #if defined(CONFIG_PBX)
  569. {
  570. .modalias = "fxs-spi",
  571. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  572. .bus_num = 0,
  573. .chip_select = 8 - CONFIG_J11_JUMPER,
  574. .controller_data = &spi_si3xxx_chip_info,
  575. .mode = SPI_MODE_3,
  576. },
  577. {
  578. .modalias = "fxo-spi",
  579. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  580. .bus_num = 0,
  581. .chip_select = 8 - CONFIG_J19_JUMPER,
  582. .controller_data = &spi_si3xxx_chip_info,
  583. .mode = SPI_MODE_3,
  584. },
  585. #endif
  586. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  587. {
  588. .modalias = "ad7877",
  589. .platform_data = &bfin_ad7877_ts_info,
  590. .irq = IRQ_PF8,
  591. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  592. .bus_num = 0,
  593. .chip_select = 2,
  594. .controller_data = &spi_ad7877_chip_info,
  595. },
  596. #endif
  597. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  598. && defined(CONFIG_SND_SOC_WM8731_SPI)
  599. {
  600. .modalias = "wm8731",
  601. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  602. .bus_num = 0,
  603. .chip_select = 5,
  604. .controller_data = &spi_wm8731_chip_info,
  605. .mode = SPI_MODE_0,
  606. },
  607. #endif
  608. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  609. {
  610. .modalias = "spidev",
  611. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  612. .bus_num = 0,
  613. .chip_select = 1,
  614. .controller_data = &spidev_chip_info,
  615. },
  616. #endif
  617. };
  618. /* SPI controller data */
  619. static struct bfin5xx_spi_master bfin_spi0_info = {
  620. .num_chipselect = 8,
  621. .enable_dma = 1, /* master has the ability to do dma transfer */
  622. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  623. };
  624. /* SPI (0) */
  625. static struct resource bfin_spi0_resource[] = {
  626. [0] = {
  627. .start = SPI0_REGBASE,
  628. .end = SPI0_REGBASE + 0xFF,
  629. .flags = IORESOURCE_MEM,
  630. },
  631. [1] = {
  632. .start = CH_SPI,
  633. .end = CH_SPI,
  634. .flags = IORESOURCE_IRQ,
  635. },
  636. };
  637. static struct platform_device bfin_spi0_device = {
  638. .name = "bfin-spi",
  639. .id = 0, /* Bus number */
  640. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  641. .resource = bfin_spi0_resource,
  642. .dev = {
  643. .platform_data = &bfin_spi0_info, /* Passed to driver */
  644. },
  645. };
  646. #endif /* spi master and devices */
  647. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  648. static struct platform_device bfin_fb_device = {
  649. .name = "bf537-lq035",
  650. };
  651. #endif
  652. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  653. static struct platform_device bfin_fb_adv7393_device = {
  654. .name = "bfin-adv7393",
  655. };
  656. #endif
  657. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  658. static struct resource bfin_uart_resources[] = {
  659. #ifdef CONFIG_SERIAL_BFIN_UART0
  660. {
  661. .start = 0xFFC00400,
  662. .end = 0xFFC004FF,
  663. .flags = IORESOURCE_MEM,
  664. },
  665. #endif
  666. #ifdef CONFIG_SERIAL_BFIN_UART1
  667. {
  668. .start = 0xFFC02000,
  669. .end = 0xFFC020FF,
  670. .flags = IORESOURCE_MEM,
  671. },
  672. #endif
  673. };
  674. static struct platform_device bfin_uart_device = {
  675. .name = "bfin-uart",
  676. .id = 1,
  677. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  678. .resource = bfin_uart_resources,
  679. };
  680. #endif
  681. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  682. static struct resource bfin_sir_resources[] = {
  683. #ifdef CONFIG_BFIN_SIR0
  684. {
  685. .start = 0xFFC00400,
  686. .end = 0xFFC004FF,
  687. .flags = IORESOURCE_MEM,
  688. },
  689. #endif
  690. #ifdef CONFIG_BFIN_SIR1
  691. {
  692. .start = 0xFFC02000,
  693. .end = 0xFFC020FF,
  694. .flags = IORESOURCE_MEM,
  695. },
  696. #endif
  697. };
  698. static struct platform_device bfin_sir_device = {
  699. .name = "bfin_sir",
  700. .id = 0,
  701. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  702. .resource = bfin_sir_resources,
  703. };
  704. #endif
  705. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  706. static struct resource bfin_twi0_resource[] = {
  707. [0] = {
  708. .start = TWI0_REGBASE,
  709. .end = TWI0_REGBASE,
  710. .flags = IORESOURCE_MEM,
  711. },
  712. [1] = {
  713. .start = IRQ_TWI,
  714. .end = IRQ_TWI,
  715. .flags = IORESOURCE_IRQ,
  716. },
  717. };
  718. static struct platform_device i2c_bfin_twi_device = {
  719. .name = "i2c-bfin-twi",
  720. .id = 0,
  721. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  722. .resource = bfin_twi0_resource,
  723. };
  724. #endif
  725. #ifdef CONFIG_I2C_BOARDINFO
  726. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  727. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  728. {
  729. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  730. },
  731. #endif
  732. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  733. {
  734. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  735. .irq = IRQ_PF8,
  736. },
  737. #endif
  738. };
  739. #endif
  740. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  741. static struct platform_device bfin_sport0_uart_device = {
  742. .name = "bfin-sport-uart",
  743. .id = 0,
  744. };
  745. static struct platform_device bfin_sport1_uart_device = {
  746. .name = "bfin-sport-uart",
  747. .id = 1,
  748. };
  749. #endif
  750. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  751. #define PATA_INT 55
  752. static struct pata_platform_info bfin_pata_platform_data = {
  753. .ioport_shift = 1,
  754. .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  755. };
  756. static struct resource bfin_pata_resources[] = {
  757. {
  758. .start = 0x20314020,
  759. .end = 0x2031403F,
  760. .flags = IORESOURCE_MEM,
  761. },
  762. {
  763. .start = 0x2031401C,
  764. .end = 0x2031401F,
  765. .flags = IORESOURCE_MEM,
  766. },
  767. {
  768. .start = PATA_INT,
  769. .end = PATA_INT,
  770. .flags = IORESOURCE_IRQ,
  771. },
  772. };
  773. static struct platform_device bfin_pata_device = {
  774. .name = "pata_platform",
  775. .id = -1,
  776. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  777. .resource = bfin_pata_resources,
  778. .dev = {
  779. .platform_data = &bfin_pata_platform_data,
  780. }
  781. };
  782. #endif
  783. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  784. #include <linux/input.h>
  785. #include <linux/gpio_keys.h>
  786. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  787. {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
  788. {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
  789. };
  790. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  791. .buttons = bfin_gpio_keys_table,
  792. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  793. };
  794. static struct platform_device bfin_device_gpiokeys = {
  795. .name = "gpio-keys",
  796. .dev = {
  797. .platform_data = &bfin_gpio_keys_data,
  798. },
  799. };
  800. #endif
  801. static struct resource bfin_gpios_resources = {
  802. .start = 0,
  803. .end = MAX_BLACKFIN_GPIOS - 1,
  804. .flags = IORESOURCE_IRQ,
  805. };
  806. static struct platform_device bfin_gpios_device = {
  807. .name = "simple-gpio",
  808. .id = -1,
  809. .num_resources = 1,
  810. .resource = &bfin_gpios_resources,
  811. };
  812. static const unsigned int cclk_vlev_datasheet[] =
  813. {
  814. VRPAIR(VLEV_100, 400000000),
  815. VRPAIR(VLEV_105, 426000000),
  816. VRPAIR(VLEV_110, 500000000),
  817. VRPAIR(VLEV_115, 533000000),
  818. VRPAIR(VLEV_120, 600000000),
  819. };
  820. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  821. .tuple_tab = cclk_vlev_datasheet,
  822. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  823. .vr_settling_time = 25 /* us */,
  824. };
  825. static struct platform_device bfin_dpmc = {
  826. .name = "bfin dpmc",
  827. .dev = {
  828. .platform_data = &bfin_dmpc_vreg_data,
  829. },
  830. };
  831. static struct platform_device *stamp_devices[] __initdata = {
  832. &bfin_dpmc,
  833. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  834. &bf5xx_nand_device,
  835. #endif
  836. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  837. &bfin_pcmcia_cf_device,
  838. #endif
  839. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  840. &rtc_device,
  841. #endif
  842. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  843. &sl811_hcd_device,
  844. #endif
  845. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  846. &isp1362_hcd_device,
  847. #endif
  848. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  849. &musb_device,
  850. #endif
  851. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  852. &smc91x_device,
  853. #endif
  854. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  855. &dm9000_device,
  856. #endif
  857. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  858. &bfin_mac_device,
  859. #endif
  860. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  861. &net2272_bfin_device,
  862. #endif
  863. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  864. &bfin_spi0_device,
  865. #endif
  866. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  867. &bfin_fb_device,
  868. #endif
  869. #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
  870. &bf52x_t350mcqb_device,
  871. #endif
  872. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  873. &bfin_fb_adv7393_device,
  874. #endif
  875. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  876. &bfin_uart_device,
  877. #endif
  878. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  879. &bfin_sir_device,
  880. #endif
  881. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  882. &i2c_bfin_twi_device,
  883. #endif
  884. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  885. &bfin_sport0_uart_device,
  886. &bfin_sport1_uart_device,
  887. #endif
  888. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  889. &bfin_pata_device,
  890. #endif
  891. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  892. &bfin_device_gpiokeys,
  893. #endif
  894. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  895. &ezkit_flash_device,
  896. #endif
  897. &bfin_gpios_device,
  898. };
  899. static int __init stamp_init(void)
  900. {
  901. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  902. #ifdef CONFIG_I2C_BOARDINFO
  903. i2c_register_board_info(0, bfin_i2c_board_info,
  904. ARRAY_SIZE(bfin_i2c_board_info));
  905. #endif
  906. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  907. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  908. spi_register_board_info(bfin_spi_board_info,
  909. ARRAY_SIZE(bfin_spi_board_info));
  910. #endif
  911. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  912. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  913. #endif
  914. return 0;
  915. }
  916. arch_initcall(stamp_init);
  917. void native_machine_restart(char *cmd)
  918. {
  919. /* workaround reboot hang when booting from SPI */
  920. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  921. bfin_gpio_reset_spi0_ssel1();
  922. }
  923. void bfin_get_ether_addr(char *addr)
  924. {
  925. /* the MAC is stored in OTP memory page 0xDF */
  926. u32 ret;
  927. u64 otp_mac;
  928. u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
  929. ret = otp_read(0xDF, 0x00, &otp_mac);
  930. if (!(ret & 0x1)) {
  931. char *otp_mac_p = (char *)&otp_mac;
  932. for (ret = 0; ret < 6; ++ret)
  933. addr[ret] = otp_mac_p[5 - ret];
  934. }
  935. }
  936. EXPORT_SYMBOL(bfin_get_ether_addr);