stamp.c 21 KB

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