stamp.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. /*
  2. * File: arch/blackfin/mach-bf537/boards/stamp.c
  3. * Based on: arch/blackfin/mach-bf533/boards/ezkit.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-2006 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/kernel.h>
  32. #include <linux/platform_device.h>
  33. #include <linux/mtd/mtd.h>
  34. #include <linux/mtd/nand.h>
  35. #include <linux/mtd/partitions.h>
  36. #include <linux/mtd/plat-ram.h>
  37. #include <linux/mtd/physmap.h>
  38. #include <linux/spi/spi.h>
  39. #include <linux/spi/flash.h>
  40. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  41. #include <linux/usb/isp1362.h>
  42. #endif
  43. #include <linux/ata_platform.h>
  44. #include <linux/irq.h>
  45. #include <linux/interrupt.h>
  46. #include <linux/i2c.h>
  47. #include <linux/usb/sl811.h>
  48. #include <asm/dma.h>
  49. #include <asm/bfin5xx_spi.h>
  50. #include <asm/reboot.h>
  51. #include <asm/portmux.h>
  52. #include <asm/dpmc.h>
  53. #include <linux/spi/ad7877.h>
  54. /*
  55. * Name the Board for the /proc/cpuinfo
  56. */
  57. const char bfin_board_name[] = "ADDS-BF537-STAMP";
  58. /*
  59. * Driver needs to know address, irq and flag pin.
  60. */
  61. #define ISP1761_BASE 0x203C0000
  62. #define ISP1761_IRQ IRQ_PF7
  63. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  64. static struct resource bfin_isp1761_resources[] = {
  65. [0] = {
  66. .name = "isp1761-regs",
  67. .start = ISP1761_BASE + 0x00000000,
  68. .end = ISP1761_BASE + 0x000fffff,
  69. .flags = IORESOURCE_MEM,
  70. },
  71. [1] = {
  72. .start = ISP1761_IRQ,
  73. .end = ISP1761_IRQ,
  74. .flags = IORESOURCE_IRQ,
  75. },
  76. };
  77. static struct platform_device bfin_isp1761_device = {
  78. .name = "isp1761",
  79. .id = 0,
  80. .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
  81. .resource = bfin_isp1761_resources,
  82. };
  83. static struct platform_device *bfin_isp1761_devices[] = {
  84. &bfin_isp1761_device,
  85. };
  86. int __init bfin_isp1761_init(void)
  87. {
  88. unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
  89. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  90. set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
  91. return platform_add_devices(bfin_isp1761_devices, num_devices);
  92. }
  93. void __exit bfin_isp1761_exit(void)
  94. {
  95. platform_device_unregister(&bfin_isp1761_device);
  96. }
  97. arch_initcall(bfin_isp1761_init);
  98. #endif
  99. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  100. #include <linux/input.h>
  101. #include <linux/gpio_keys.h>
  102. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  103. {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
  104. {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
  105. {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
  106. {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
  107. };
  108. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  109. .buttons = bfin_gpio_keys_table,
  110. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  111. };
  112. static struct platform_device bfin_device_gpiokeys = {
  113. .name = "gpio-keys",
  114. .dev = {
  115. .platform_data = &bfin_gpio_keys_data,
  116. },
  117. };
  118. #endif
  119. static struct resource bfin_gpios_resources = {
  120. .start = 0,
  121. .end = MAX_BLACKFIN_GPIOS - 1,
  122. .flags = IORESOURCE_IRQ,
  123. };
  124. static struct platform_device bfin_gpios_device = {
  125. .name = "simple-gpio",
  126. .id = -1,
  127. .num_resources = 1,
  128. .resource = &bfin_gpios_resources,
  129. };
  130. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  131. static struct resource bfin_pcmcia_cf_resources[] = {
  132. {
  133. .start = 0x20310000, /* IO PORT */
  134. .end = 0x20312000,
  135. .flags = IORESOURCE_MEM,
  136. }, {
  137. .start = 0x20311000, /* Attribute Memory */
  138. .end = 0x20311FFF,
  139. .flags = IORESOURCE_MEM,
  140. }, {
  141. .start = IRQ_PF4,
  142. .end = IRQ_PF4,
  143. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  144. }, {
  145. .start = 6, /* Card Detect PF6 */
  146. .end = 6,
  147. .flags = IORESOURCE_IRQ,
  148. },
  149. };
  150. static struct platform_device bfin_pcmcia_cf_device = {
  151. .name = "bfin_cf_pcmcia",
  152. .id = -1,
  153. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  154. .resource = bfin_pcmcia_cf_resources,
  155. };
  156. #endif
  157. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  158. static struct platform_device rtc_device = {
  159. .name = "rtc-bfin",
  160. .id = -1,
  161. };
  162. #endif
  163. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  164. static struct resource smc91x_resources[] = {
  165. {
  166. .name = "smc91x-regs",
  167. .start = 0x20300300,
  168. .end = 0x20300300 + 16,
  169. .flags = IORESOURCE_MEM,
  170. }, {
  171. .start = IRQ_PF7,
  172. .end = IRQ_PF7,
  173. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  174. },
  175. };
  176. static struct platform_device smc91x_device = {
  177. .name = "smc91x",
  178. .id = 0,
  179. .num_resources = ARRAY_SIZE(smc91x_resources),
  180. .resource = smc91x_resources,
  181. };
  182. #endif
  183. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  184. static struct resource dm9000_resources[] = {
  185. [0] = {
  186. .start = 0x203FB800,
  187. .end = 0x203FB800 + 8,
  188. .flags = IORESOURCE_MEM,
  189. },
  190. [1] = {
  191. .start = IRQ_PF9,
  192. .end = IRQ_PF9,
  193. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  194. },
  195. };
  196. static struct platform_device dm9000_device = {
  197. .name = "dm9000",
  198. .id = -1,
  199. .num_resources = ARRAY_SIZE(dm9000_resources),
  200. .resource = dm9000_resources,
  201. };
  202. #endif
  203. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  204. static struct resource ax88180_resources[] = {
  205. [0] = {
  206. .start = 0x20300000,
  207. .end = 0x20300000 + 0x8000,
  208. .flags = IORESOURCE_MEM,
  209. },
  210. [1] = {
  211. .start = IRQ_PF7,
  212. .end = IRQ_PF7,
  213. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
  214. },
  215. };
  216. static struct platform_device ax88180_device = {
  217. .name = "ax88180",
  218. .id = -1,
  219. .num_resources = ARRAY_SIZE(ax88180_resources),
  220. .resource = ax88180_resources,
  221. };
  222. #endif
  223. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  224. static struct resource sl811_hcd_resources[] = {
  225. {
  226. .start = 0x20340000,
  227. .end = 0x20340000,
  228. .flags = IORESOURCE_MEM,
  229. }, {
  230. .start = 0x20340004,
  231. .end = 0x20340004,
  232. .flags = IORESOURCE_MEM,
  233. }, {
  234. .start = CONFIG_USB_SL811_BFIN_IRQ,
  235. .end = CONFIG_USB_SL811_BFIN_IRQ,
  236. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  237. },
  238. };
  239. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  240. void sl811_port_power(struct device *dev, int is_on)
  241. {
  242. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  243. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  244. }
  245. #endif
  246. static struct sl811_platform_data sl811_priv = {
  247. .potpg = 10,
  248. .power = 250, /* == 500mA */
  249. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  250. .port_power = &sl811_port_power,
  251. #endif
  252. };
  253. static struct platform_device sl811_hcd_device = {
  254. .name = "sl811-hcd",
  255. .id = 0,
  256. .dev = {
  257. .platform_data = &sl811_priv,
  258. },
  259. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  260. .resource = sl811_hcd_resources,
  261. };
  262. #endif
  263. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  264. static struct resource isp1362_hcd_resources[] = {
  265. {
  266. .start = 0x20360000,
  267. .end = 0x20360000,
  268. .flags = IORESOURCE_MEM,
  269. }, {
  270. .start = 0x20360004,
  271. .end = 0x20360004,
  272. .flags = IORESOURCE_MEM,
  273. }, {
  274. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  275. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  276. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  277. },
  278. };
  279. static struct isp1362_platform_data isp1362_priv = {
  280. .sel15Kres = 1,
  281. .clknotstop = 0,
  282. .oc_enable = 0,
  283. .int_act_high = 0,
  284. .int_edge_triggered = 0,
  285. .remote_wakeup_connected = 0,
  286. .no_power_switching = 1,
  287. .power_switching_mode = 0,
  288. };
  289. static struct platform_device isp1362_hcd_device = {
  290. .name = "isp1362-hcd",
  291. .id = 0,
  292. .dev = {
  293. .platform_data = &isp1362_priv,
  294. },
  295. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  296. .resource = isp1362_hcd_resources,
  297. };
  298. #endif
  299. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  300. static struct platform_device bfin_mac_device = {
  301. .name = "bfin_mac",
  302. };
  303. #endif
  304. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  305. static struct resource net2272_bfin_resources[] = {
  306. {
  307. .start = 0x20300000,
  308. .end = 0x20300000 + 0x100,
  309. .flags = IORESOURCE_MEM,
  310. }, {
  311. .start = IRQ_PF7,
  312. .end = IRQ_PF7,
  313. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  314. },
  315. };
  316. static struct platform_device net2272_bfin_device = {
  317. .name = "net2272",
  318. .id = -1,
  319. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  320. .resource = net2272_bfin_resources,
  321. };
  322. #endif
  323. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  324. #ifdef CONFIG_MTD_PARTITIONS
  325. const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
  326. static struct mtd_partition bfin_plat_nand_partitions[] = {
  327. {
  328. .name = "linux kernel(nand)",
  329. .size = 0x400000,
  330. .offset = 0,
  331. }, {
  332. .name = "file system(nand)",
  333. .size = MTDPART_SIZ_FULL,
  334. .offset = MTDPART_OFS_APPEND,
  335. },
  336. };
  337. #endif
  338. #define BFIN_NAND_PLAT_CLE 2
  339. #define BFIN_NAND_PLAT_ALE 1
  340. static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  341. {
  342. struct nand_chip *this = mtd->priv;
  343. if (cmd == NAND_CMD_NONE)
  344. return;
  345. if (ctrl & NAND_CLE)
  346. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
  347. else
  348. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
  349. }
  350. #define BFIN_NAND_PLAT_READY GPIO_PF3
  351. static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
  352. {
  353. return gpio_get_value(BFIN_NAND_PLAT_READY);
  354. }
  355. static struct platform_nand_data bfin_plat_nand_data = {
  356. .chip = {
  357. .chip_delay = 30,
  358. #ifdef CONFIG_MTD_PARTITIONS
  359. .part_probe_types = part_probes,
  360. .partitions = bfin_plat_nand_partitions,
  361. .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
  362. #endif
  363. },
  364. .ctrl = {
  365. .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
  366. .dev_ready = bfin_plat_nand_dev_ready,
  367. },
  368. };
  369. #define MAX(x, y) (x > y ? x : y)
  370. static struct resource bfin_plat_nand_resources = {
  371. .start = 0x20212000,
  372. .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
  373. .flags = IORESOURCE_IO,
  374. };
  375. static struct platform_device bfin_async_nand_device = {
  376. .name = "gen_nand",
  377. .id = -1,
  378. .num_resources = 1,
  379. .resource = &bfin_plat_nand_resources,
  380. .dev = {
  381. .platform_data = &bfin_plat_nand_data,
  382. },
  383. };
  384. static void bfin_plat_nand_init(void)
  385. {
  386. gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
  387. }
  388. #else
  389. static void bfin_plat_nand_init(void) {}
  390. #endif
  391. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  392. static struct mtd_partition stamp_partitions[] = {
  393. {
  394. .name = "bootloader(nor)",
  395. .size = 0x40000,
  396. .offset = 0,
  397. }, {
  398. .name = "linux kernel(nor)",
  399. .size = 0xE0000,
  400. .offset = MTDPART_OFS_APPEND,
  401. }, {
  402. .name = "file system(nor)",
  403. .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
  404. .offset = MTDPART_OFS_APPEND,
  405. }, {
  406. .name = "MAC Address(nor)",
  407. .size = MTDPART_SIZ_FULL,
  408. .offset = 0x3F0000,
  409. .mask_flags = MTD_WRITEABLE,
  410. }
  411. };
  412. static struct physmap_flash_data stamp_flash_data = {
  413. .width = 2,
  414. .parts = stamp_partitions,
  415. .nr_parts = ARRAY_SIZE(stamp_partitions),
  416. };
  417. static struct resource stamp_flash_resource = {
  418. .start = 0x20000000,
  419. .end = 0x203fffff,
  420. .flags = IORESOURCE_MEM,
  421. };
  422. static struct platform_device stamp_flash_device = {
  423. .name = "physmap-flash",
  424. .id = 0,
  425. .dev = {
  426. .platform_data = &stamp_flash_data,
  427. },
  428. .num_resources = 1,
  429. .resource = &stamp_flash_resource,
  430. };
  431. #endif
  432. #if defined(CONFIG_MTD_M25P80) \
  433. || defined(CONFIG_MTD_M25P80_MODULE)
  434. static struct mtd_partition bfin_spi_flash_partitions[] = {
  435. {
  436. .name = "bootloader(spi)",
  437. .size = 0x00040000,
  438. .offset = 0,
  439. .mask_flags = MTD_CAP_ROM
  440. }, {
  441. .name = "linux kernel(spi)",
  442. .size = 0xe0000,
  443. .offset = MTDPART_OFS_APPEND,
  444. }, {
  445. .name = "file system(spi)",
  446. .size = MTDPART_SIZ_FULL,
  447. .offset = MTDPART_OFS_APPEND,
  448. }
  449. };
  450. static struct flash_platform_data bfin_spi_flash_data = {
  451. .name = "m25p80",
  452. .parts = bfin_spi_flash_partitions,
  453. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  454. .type = "m25p64",
  455. };
  456. /* SPI flash chip (m25p64) */
  457. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  458. .enable_dma = 0, /* use dma transfer with this chip*/
  459. .bits_per_word = 8,
  460. };
  461. #endif
  462. #if defined(CONFIG_SPI_ADC_BF533) \
  463. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  464. /* SPI ADC chip */
  465. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  466. .enable_dma = 1, /* use dma transfer with this chip*/
  467. .bits_per_word = 16,
  468. };
  469. #endif
  470. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  471. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  472. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  473. .enable_dma = 0,
  474. .bits_per_word = 16,
  475. };
  476. #endif
  477. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  478. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  479. .enable_dma = 0,
  480. .bits_per_word = 16,
  481. };
  482. #endif
  483. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  484. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  485. .enable_dma = 1,
  486. .bits_per_word = 8,
  487. };
  488. #endif
  489. #if defined(CONFIG_PBX)
  490. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  491. .ctl_reg = 0x4, /* send zero */
  492. .enable_dma = 0,
  493. .bits_per_word = 8,
  494. .cs_change_per_word = 1,
  495. };
  496. #endif
  497. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  498. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  499. .enable_dma = 0,
  500. .bits_per_word = 16,
  501. };
  502. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  503. .model = 7877,
  504. .vref_delay_usecs = 50, /* internal, no capacitor */
  505. .x_plate_ohms = 419,
  506. .y_plate_ohms = 486,
  507. .pressure_max = 1000,
  508. .pressure_min = 0,
  509. .stopacq_polarity = 1,
  510. .first_conversion_delay = 3,
  511. .acquisition_time = 1,
  512. .averaging = 1,
  513. .pen_down_acc_interval = 1,
  514. };
  515. #endif
  516. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  517. static struct bfin5xx_spi_chip spidev_chip_info = {
  518. .enable_dma = 0,
  519. .bits_per_word = 8,
  520. };
  521. #endif
  522. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  523. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  524. .enable_dma = 0,
  525. .bits_per_word = 8,
  526. };
  527. #endif
  528. #if defined(CONFIG_MTD_DATAFLASH) \
  529. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  530. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  531. {
  532. .name = "bootloader(spi)",
  533. .size = 0x00040000,
  534. .offset = 0,
  535. .mask_flags = MTD_CAP_ROM
  536. }, {
  537. .name = "linux kernel(spi)",
  538. .size = 0xe0000,
  539. .offset = MTDPART_OFS_APPEND,
  540. }, {
  541. .name = "file system(spi)",
  542. .size = MTDPART_SIZ_FULL,
  543. .offset = MTDPART_OFS_APPEND,
  544. }
  545. };
  546. static struct flash_platform_data bfin_spi_dataflash_data = {
  547. .name = "SPI Dataflash",
  548. .parts = bfin_spi_dataflash_partitions,
  549. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  550. };
  551. /* DataFlash chip */
  552. static struct bfin5xx_spi_chip data_flash_chip_info = {
  553. .enable_dma = 0, /* use dma transfer with this chip*/
  554. .bits_per_word = 8,
  555. };
  556. #endif
  557. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  558. #if defined(CONFIG_MTD_M25P80) \
  559. || defined(CONFIG_MTD_M25P80_MODULE)
  560. {
  561. /* the modalias must be the same as spi device driver name */
  562. .modalias = "m25p80", /* Name of spi_driver for this device */
  563. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  564. .bus_num = 0, /* Framework bus number */
  565. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  566. .platform_data = &bfin_spi_flash_data,
  567. .controller_data = &spi_flash_chip_info,
  568. .mode = SPI_MODE_3,
  569. },
  570. #endif
  571. #if defined(CONFIG_MTD_DATAFLASH) \
  572. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  573. { /* DataFlash chip */
  574. .modalias = "mtd_dataflash",
  575. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  576. .bus_num = 0, /* Framework bus number */
  577. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  578. .platform_data = &bfin_spi_dataflash_data,
  579. .controller_data = &data_flash_chip_info,
  580. .mode = SPI_MODE_3,
  581. },
  582. #endif
  583. #if defined(CONFIG_SPI_ADC_BF533) \
  584. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  585. {
  586. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  587. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  588. .bus_num = 0, /* Framework bus number */
  589. .chip_select = 1, /* Framework chip select. */
  590. .platform_data = NULL, /* No spi_driver specific config */
  591. .controller_data = &spi_adc_chip_info,
  592. },
  593. #endif
  594. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  595. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  596. {
  597. .modalias = "ad1836-spi",
  598. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  599. .bus_num = 0,
  600. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  601. .controller_data = &ad1836_spi_chip_info,
  602. },
  603. #endif
  604. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  605. {
  606. .modalias = "ad9960-spi",
  607. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  608. .bus_num = 0,
  609. .chip_select = 1,
  610. .controller_data = &ad9960_spi_chip_info,
  611. },
  612. #endif
  613. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  614. {
  615. .modalias = "spi_mmc_dummy",
  616. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  617. .bus_num = 0,
  618. .chip_select = 0,
  619. .platform_data = NULL,
  620. .controller_data = &spi_mmc_chip_info,
  621. .mode = SPI_MODE_3,
  622. },
  623. {
  624. .modalias = "spi_mmc",
  625. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  626. .bus_num = 0,
  627. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  628. .platform_data = NULL,
  629. .controller_data = &spi_mmc_chip_info,
  630. .mode = SPI_MODE_3,
  631. },
  632. #endif
  633. #if defined(CONFIG_PBX)
  634. {
  635. .modalias = "fxs-spi",
  636. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  637. .bus_num = 0,
  638. .chip_select = 8 - CONFIG_J11_JUMPER,
  639. .controller_data = &spi_si3xxx_chip_info,
  640. .mode = SPI_MODE_3,
  641. },
  642. {
  643. .modalias = "fxo-spi",
  644. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  645. .bus_num = 0,
  646. .chip_select = 8 - CONFIG_J19_JUMPER,
  647. .controller_data = &spi_si3xxx_chip_info,
  648. .mode = SPI_MODE_3,
  649. },
  650. #endif
  651. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  652. {
  653. .modalias = "ad7877",
  654. .platform_data = &bfin_ad7877_ts_info,
  655. .irq = IRQ_PF6,
  656. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  657. .bus_num = 0,
  658. .chip_select = 1,
  659. .controller_data = &spi_ad7877_chip_info,
  660. },
  661. #endif
  662. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  663. {
  664. .modalias = "spidev",
  665. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  666. .bus_num = 0,
  667. .chip_select = 1,
  668. .controller_data = &spidev_chip_info,
  669. },
  670. #endif
  671. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  672. {
  673. .modalias = "bfin-lq035q1-spi",
  674. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  675. .bus_num = 0,
  676. .chip_select = 1,
  677. .controller_data = &lq035q1_spi_chip_info,
  678. .mode = SPI_CPHA | SPI_CPOL,
  679. },
  680. #endif
  681. };
  682. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  683. /* SPI controller data */
  684. static struct bfin5xx_spi_master bfin_spi0_info = {
  685. .num_chipselect = 8,
  686. .enable_dma = 1, /* master has the ability to do dma transfer */
  687. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  688. };
  689. /* SPI (0) */
  690. static struct resource bfin_spi0_resource[] = {
  691. [0] = {
  692. .start = SPI0_REGBASE,
  693. .end = SPI0_REGBASE + 0xFF,
  694. .flags = IORESOURCE_MEM,
  695. },
  696. [1] = {
  697. .start = CH_SPI,
  698. .end = CH_SPI,
  699. .flags = IORESOURCE_IRQ,
  700. },
  701. };
  702. static struct platform_device bfin_spi0_device = {
  703. .name = "bfin-spi",
  704. .id = 0, /* Bus number */
  705. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  706. .resource = bfin_spi0_resource,
  707. .dev = {
  708. .platform_data = &bfin_spi0_info, /* Passed to driver */
  709. },
  710. };
  711. #endif /* spi master and devices */
  712. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  713. static struct platform_device bfin_fb_device = {
  714. .name = "bf537-lq035",
  715. };
  716. #endif
  717. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  718. static struct platform_device bfin_fb_adv7393_device = {
  719. .name = "bfin-adv7393",
  720. };
  721. #endif
  722. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  723. #include <asm/bfin-lq035q1.h>
  724. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  725. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  726. .use_bl = 1,
  727. .gpio_bl = GPIO_PF7,
  728. };
  729. static struct resource bfin_lq035q1_resources[] = {
  730. {
  731. .start = IRQ_PPI_ERROR,
  732. .end = IRQ_PPI_ERROR,
  733. .flags = IORESOURCE_IRQ,
  734. },
  735. };
  736. static struct platform_device bfin_lq035q1_device = {
  737. .name = "bfin-lq035q1",
  738. .id = -1,
  739. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  740. .resource = bfin_lq035q1_resources,
  741. .dev = {
  742. .platform_data = &bfin_lq035q1_data,
  743. },
  744. };
  745. #endif
  746. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  747. static struct resource bfin_uart_resources[] = {
  748. #ifdef CONFIG_SERIAL_BFIN_UART0
  749. {
  750. .start = 0xFFC00400,
  751. .end = 0xFFC004FF,
  752. .flags = IORESOURCE_MEM,
  753. },
  754. #endif
  755. #ifdef CONFIG_SERIAL_BFIN_UART1
  756. {
  757. .start = 0xFFC02000,
  758. .end = 0xFFC020FF,
  759. .flags = IORESOURCE_MEM,
  760. },
  761. #endif
  762. };
  763. static struct platform_device bfin_uart_device = {
  764. .name = "bfin-uart",
  765. .id = 1,
  766. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  767. .resource = bfin_uart_resources,
  768. };
  769. #endif
  770. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  771. static struct resource bfin_sir_resources[] = {
  772. #ifdef CONFIG_BFIN_SIR0
  773. {
  774. .start = 0xFFC00400,
  775. .end = 0xFFC004FF,
  776. .flags = IORESOURCE_MEM,
  777. },
  778. #endif
  779. #ifdef CONFIG_BFIN_SIR1
  780. {
  781. .start = 0xFFC02000,
  782. .end = 0xFFC020FF,
  783. .flags = IORESOURCE_MEM,
  784. },
  785. #endif
  786. };
  787. static struct platform_device bfin_sir_device = {
  788. .name = "bfin_sir",
  789. .id = 0,
  790. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  791. .resource = bfin_sir_resources,
  792. };
  793. #endif
  794. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  795. static struct resource bfin_twi0_resource[] = {
  796. [0] = {
  797. .start = TWI0_REGBASE,
  798. .end = TWI0_REGBASE,
  799. .flags = IORESOURCE_MEM,
  800. },
  801. [1] = {
  802. .start = IRQ_TWI,
  803. .end = IRQ_TWI,
  804. .flags = IORESOURCE_IRQ,
  805. },
  806. };
  807. static struct platform_device i2c_bfin_twi_device = {
  808. .name = "i2c-bfin-twi",
  809. .id = 0,
  810. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  811. .resource = bfin_twi0_resource,
  812. };
  813. #endif
  814. #ifdef CONFIG_I2C_BOARDINFO
  815. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  816. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  817. {
  818. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  819. .irq = 55,
  820. },
  821. #endif
  822. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  823. {
  824. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  825. },
  826. #endif
  827. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  828. {
  829. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  830. .irq = 72,
  831. },
  832. #endif
  833. };
  834. #endif
  835. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  836. static struct platform_device bfin_sport0_uart_device = {
  837. .name = "bfin-sport-uart",
  838. .id = 0,
  839. };
  840. static struct platform_device bfin_sport1_uart_device = {
  841. .name = "bfin-sport-uart",
  842. .id = 1,
  843. };
  844. #endif
  845. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  846. #define PATA_INT IRQ_PF5
  847. static struct pata_platform_info bfin_pata_platform_data = {
  848. .ioport_shift = 1,
  849. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  850. };
  851. static struct resource bfin_pata_resources[] = {
  852. {
  853. .start = 0x20314020,
  854. .end = 0x2031403F,
  855. .flags = IORESOURCE_MEM,
  856. },
  857. {
  858. .start = 0x2031401C,
  859. .end = 0x2031401F,
  860. .flags = IORESOURCE_MEM,
  861. },
  862. {
  863. .start = PATA_INT,
  864. .end = PATA_INT,
  865. .flags = IORESOURCE_IRQ,
  866. },
  867. };
  868. static struct platform_device bfin_pata_device = {
  869. .name = "pata_platform",
  870. .id = -1,
  871. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  872. .resource = bfin_pata_resources,
  873. .dev = {
  874. .platform_data = &bfin_pata_platform_data,
  875. }
  876. };
  877. #endif
  878. static const unsigned int cclk_vlev_datasheet[] =
  879. {
  880. VRPAIR(VLEV_085, 250000000),
  881. VRPAIR(VLEV_090, 376000000),
  882. VRPAIR(VLEV_095, 426000000),
  883. VRPAIR(VLEV_100, 426000000),
  884. VRPAIR(VLEV_105, 476000000),
  885. VRPAIR(VLEV_110, 476000000),
  886. VRPAIR(VLEV_115, 476000000),
  887. VRPAIR(VLEV_120, 500000000),
  888. VRPAIR(VLEV_125, 533000000),
  889. VRPAIR(VLEV_130, 600000000),
  890. };
  891. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  892. .tuple_tab = cclk_vlev_datasheet,
  893. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  894. .vr_settling_time = 25 /* us */,
  895. };
  896. static struct platform_device bfin_dpmc = {
  897. .name = "bfin dpmc",
  898. .dev = {
  899. .platform_data = &bfin_dmpc_vreg_data,
  900. },
  901. };
  902. static struct platform_device *stamp_devices[] __initdata = {
  903. &bfin_dpmc,
  904. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  905. &bfin_pcmcia_cf_device,
  906. #endif
  907. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  908. &rtc_device,
  909. #endif
  910. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  911. &sl811_hcd_device,
  912. #endif
  913. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  914. &isp1362_hcd_device,
  915. #endif
  916. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  917. &smc91x_device,
  918. #endif
  919. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  920. &dm9000_device,
  921. #endif
  922. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  923. &ax88180_device,
  924. #endif
  925. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  926. &bfin_mac_device,
  927. #endif
  928. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  929. &net2272_bfin_device,
  930. #endif
  931. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  932. &bfin_spi0_device,
  933. #endif
  934. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  935. &bfin_fb_device,
  936. #endif
  937. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  938. &bfin_lq035q1_device,
  939. #endif
  940. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  941. &bfin_fb_adv7393_device,
  942. #endif
  943. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  944. &bfin_uart_device,
  945. #endif
  946. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  947. &bfin_sir_device,
  948. #endif
  949. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  950. &i2c_bfin_twi_device,
  951. #endif
  952. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  953. &bfin_sport0_uart_device,
  954. &bfin_sport1_uart_device,
  955. #endif
  956. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  957. &bfin_pata_device,
  958. #endif
  959. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  960. &bfin_device_gpiokeys,
  961. #endif
  962. &bfin_gpios_device,
  963. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  964. &bfin_async_nand_device,
  965. #endif
  966. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  967. &stamp_flash_device,
  968. #endif
  969. };
  970. static int __init stamp_init(void)
  971. {
  972. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  973. #ifdef CONFIG_I2C_BOARDINFO
  974. i2c_register_board_info(0, bfin_i2c_board_info,
  975. ARRAY_SIZE(bfin_i2c_board_info));
  976. #endif
  977. bfin_plat_nand_init();
  978. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  979. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  980. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  981. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  982. #endif
  983. return 0;
  984. }
  985. arch_initcall(stamp_init);
  986. void native_machine_restart(char *cmd)
  987. {
  988. /* workaround reboot hang when booting from SPI */
  989. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  990. bfin_gpio_reset_spi0_ssel1();
  991. }
  992. /*
  993. * Currently the MAC address is saved in Flash by U-Boot
  994. */
  995. #define FLASH_MAC 0x203f0000
  996. void bfin_get_ether_addr(char *addr)
  997. {
  998. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  999. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  1000. }
  1001. EXPORT_SYMBOL(bfin_get_ether_addr);