stamp.c 21 KB

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