stamp.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  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_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  425. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  426. .enable_dma = 0,
  427. .bits_per_word = 16,
  428. };
  429. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  430. .model = 7877,
  431. .vref_delay_usecs = 50, /* internal, no capacitor */
  432. .x_plate_ohms = 419,
  433. .y_plate_ohms = 486,
  434. .pressure_max = 1000,
  435. .pressure_min = 0,
  436. .stopacq_polarity = 1,
  437. .first_conversion_delay = 3,
  438. .acquisition_time = 1,
  439. .averaging = 1,
  440. .pen_down_acc_interval = 1,
  441. };
  442. #endif
  443. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  444. static struct bfin5xx_spi_chip spidev_chip_info = {
  445. .enable_dma = 0,
  446. .bits_per_word = 8,
  447. };
  448. #endif
  449. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  450. #if defined(CONFIG_MTD_M25P80) \
  451. || defined(CONFIG_MTD_M25P80_MODULE)
  452. {
  453. /* the modalias must be the same as spi device driver name */
  454. .modalias = "m25p80", /* Name of spi_driver for this device */
  455. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  456. .bus_num = 0, /* Framework bus number */
  457. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  458. .platform_data = &bfin_spi_flash_data,
  459. .controller_data = &spi_flash_chip_info,
  460. .mode = SPI_MODE_3,
  461. },
  462. #endif
  463. #if defined(CONFIG_SPI_ADC_BF533) \
  464. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  465. {
  466. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  467. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  468. .bus_num = 0, /* Framework bus number */
  469. .chip_select = 1, /* Framework chip select. */
  470. .platform_data = NULL, /* No spi_driver specific config */
  471. .controller_data = &spi_adc_chip_info,
  472. },
  473. #endif
  474. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  475. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  476. {
  477. .modalias = "ad1836-spi",
  478. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  479. .bus_num = 0,
  480. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  481. .controller_data = &ad1836_spi_chip_info,
  482. },
  483. #endif
  484. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  485. {
  486. .modalias = "ad9960-spi",
  487. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  488. .bus_num = 0,
  489. .chip_select = 1,
  490. .controller_data = &ad9960_spi_chip_info,
  491. },
  492. #endif
  493. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  494. {
  495. .modalias = "spi_mmc_dummy",
  496. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  497. .bus_num = 0,
  498. .chip_select = 0,
  499. .platform_data = NULL,
  500. .controller_data = &spi_mmc_chip_info,
  501. .mode = SPI_MODE_3,
  502. },
  503. {
  504. .modalias = "spi_mmc",
  505. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  506. .bus_num = 0,
  507. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  508. .platform_data = NULL,
  509. .controller_data = &spi_mmc_chip_info,
  510. .mode = SPI_MODE_3,
  511. },
  512. #endif
  513. #if defined(CONFIG_PBX)
  514. {
  515. .modalias = "fxs-spi",
  516. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  517. .bus_num = 0,
  518. .chip_select = 8 - CONFIG_J11_JUMPER,
  519. .controller_data = &spi_si3xxx_chip_info,
  520. .mode = SPI_MODE_3,
  521. },
  522. {
  523. .modalias = "fxo-spi",
  524. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  525. .bus_num = 0,
  526. .chip_select = 8 - CONFIG_J19_JUMPER,
  527. .controller_data = &spi_si3xxx_chip_info,
  528. .mode = SPI_MODE_3,
  529. },
  530. #endif
  531. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  532. {
  533. .modalias = "ad7877",
  534. .platform_data = &bfin_ad7877_ts_info,
  535. .irq = IRQ_PF6,
  536. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  537. .bus_num = 0,
  538. .chip_select = 1,
  539. .controller_data = &spi_ad7877_chip_info,
  540. },
  541. #endif
  542. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  543. {
  544. .modalias = "spidev",
  545. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  546. .bus_num = 0,
  547. .chip_select = 1,
  548. .controller_data = &spidev_chip_info,
  549. },
  550. #endif
  551. };
  552. /* SPI controller data */
  553. static struct bfin5xx_spi_master bfin_spi0_info = {
  554. .num_chipselect = 8,
  555. .enable_dma = 1, /* master has the ability to do dma transfer */
  556. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  557. };
  558. /* SPI (0) */
  559. static struct resource bfin_spi0_resource[] = {
  560. [0] = {
  561. .start = SPI0_REGBASE,
  562. .end = SPI0_REGBASE + 0xFF,
  563. .flags = IORESOURCE_MEM,
  564. },
  565. [1] = {
  566. .start = CH_SPI,
  567. .end = CH_SPI,
  568. .flags = IORESOURCE_IRQ,
  569. },
  570. };
  571. static struct platform_device bfin_spi0_device = {
  572. .name = "bfin-spi",
  573. .id = 0, /* Bus number */
  574. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  575. .resource = bfin_spi0_resource,
  576. .dev = {
  577. .platform_data = &bfin_spi0_info, /* Passed to driver */
  578. },
  579. };
  580. #endif /* spi master and devices */
  581. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  582. static struct platform_device bfin_fb_device = {
  583. .name = "bf537-lq035",
  584. };
  585. #endif
  586. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  587. static struct platform_device bfin_fb_adv7393_device = {
  588. .name = "bfin-adv7393",
  589. };
  590. #endif
  591. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  592. static struct resource bfin_uart_resources[] = {
  593. #ifdef CONFIG_SERIAL_BFIN_UART0
  594. {
  595. .start = 0xFFC00400,
  596. .end = 0xFFC004FF,
  597. .flags = IORESOURCE_MEM,
  598. },
  599. #endif
  600. #ifdef CONFIG_SERIAL_BFIN_UART1
  601. {
  602. .start = 0xFFC02000,
  603. .end = 0xFFC020FF,
  604. .flags = IORESOURCE_MEM,
  605. },
  606. #endif
  607. };
  608. static struct platform_device bfin_uart_device = {
  609. .name = "bfin-uart",
  610. .id = 1,
  611. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  612. .resource = bfin_uart_resources,
  613. };
  614. #endif
  615. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  616. static struct resource bfin_twi0_resource[] = {
  617. [0] = {
  618. .start = TWI0_REGBASE,
  619. .end = TWI0_REGBASE,
  620. .flags = IORESOURCE_MEM,
  621. },
  622. [1] = {
  623. .start = IRQ_TWI,
  624. .end = IRQ_TWI,
  625. .flags = IORESOURCE_IRQ,
  626. },
  627. };
  628. static struct platform_device i2c_bfin_twi_device = {
  629. .name = "i2c-bfin-twi",
  630. .id = 0,
  631. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  632. .resource = bfin_twi0_resource,
  633. };
  634. #endif
  635. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  636. static struct platform_device bfin_sport0_uart_device = {
  637. .name = "bfin-sport-uart",
  638. .id = 0,
  639. };
  640. static struct platform_device bfin_sport1_uart_device = {
  641. .name = "bfin-sport-uart",
  642. .id = 1,
  643. };
  644. #endif
  645. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  646. #define PATA_INT 55
  647. static struct pata_platform_info bfin_pata_platform_data = {
  648. .ioport_shift = 1,
  649. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  650. };
  651. static struct resource bfin_pata_resources[] = {
  652. {
  653. .start = 0x20314020,
  654. .end = 0x2031403F,
  655. .flags = IORESOURCE_MEM,
  656. },
  657. {
  658. .start = 0x2031401C,
  659. .end = 0x2031401F,
  660. .flags = IORESOURCE_MEM,
  661. },
  662. {
  663. .start = PATA_INT,
  664. .end = PATA_INT,
  665. .flags = IORESOURCE_IRQ,
  666. },
  667. };
  668. static struct platform_device bfin_pata_device = {
  669. .name = "pata_platform",
  670. .id = -1,
  671. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  672. .resource = bfin_pata_resources,
  673. .dev = {
  674. .platform_data = &bfin_pata_platform_data,
  675. }
  676. };
  677. #endif
  678. static struct platform_device *stamp_devices[] __initdata = {
  679. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  680. &bfin_pcmcia_cf_device,
  681. #endif
  682. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  683. &rtc_device,
  684. #endif
  685. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  686. &sl811_hcd_device,
  687. #endif
  688. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  689. &isp1362_hcd_device,
  690. #endif
  691. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  692. &smc91x_device,
  693. #endif
  694. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  695. &dm9000_device,
  696. #endif
  697. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  698. &ax88180_device,
  699. #endif
  700. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  701. &bfin_mac_device,
  702. #endif
  703. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  704. &net2272_bfin_device,
  705. #endif
  706. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  707. &bfin_spi0_device,
  708. #endif
  709. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  710. &bfin_fb_device,
  711. #endif
  712. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  713. &bfin_fb_adv7393_device,
  714. #endif
  715. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  716. &bfin_uart_device,
  717. #endif
  718. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  719. &i2c_bfin_twi_device,
  720. #endif
  721. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  722. &bfin_sport0_uart_device,
  723. &bfin_sport1_uart_device,
  724. #endif
  725. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  726. &bfin_pata_device,
  727. #endif
  728. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  729. &bfin_device_gpiokeys,
  730. #endif
  731. &bfin_gpios_device,
  732. &stamp_flash_device,
  733. };
  734. static int __init stamp_init(void)
  735. {
  736. printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
  737. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  738. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  739. spi_register_board_info(bfin_spi_board_info,
  740. ARRAY_SIZE(bfin_spi_board_info));
  741. #endif
  742. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  743. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  744. #endif
  745. return 0;
  746. }
  747. arch_initcall(stamp_init);
  748. void native_machine_restart(char *cmd)
  749. {
  750. /* workaround reboot hang when booting from SPI */
  751. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  752. bfin_gpio_reset_spi0_ssel1();
  753. }
  754. /*
  755. * Currently the MAC address is saved in Flash by U-Boot
  756. */
  757. #define FLASH_MAC 0x203f0000
  758. void bfin_get_ether_addr(char *addr)
  759. {
  760. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  761. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  762. }
  763. EXPORT_SYMBOL(bfin_get_ether_addr);