stamp.c 22 KB

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