stamp.c 24 KB

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