stamp.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  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/kernel.h>
  32. #include <linux/platform_device.h>
  33. #include <linux/mtd/mtd.h>
  34. #include <linux/mtd/nand.h>
  35. #include <linux/mtd/partitions.h>
  36. #include <linux/mtd/plat-ram.h>
  37. #include <linux/mtd/physmap.h>
  38. #include <linux/spi/spi.h>
  39. #include <linux/spi/flash.h>
  40. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  41. #include <linux/usb/isp1362.h>
  42. #endif
  43. #include <linux/ata_platform.h>
  44. #include <linux/irq.h>
  45. #include <linux/interrupt.h>
  46. #include <linux/i2c.h>
  47. #include <linux/usb/sl811.h>
  48. #include <asm/dma.h>
  49. #include <asm/bfin5xx_spi.h>
  50. #include <asm/reboot.h>
  51. #include <asm/portmux.h>
  52. #include <asm/dpmc.h>
  53. /*
  54. * Name the Board for the /proc/cpuinfo
  55. */
  56. const char bfin_board_name[] = "ADI BF537-STAMP";
  57. /*
  58. * Driver needs to know address, irq and flag pin.
  59. */
  60. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  61. #include <linux/usb/isp1760.h>
  62. static struct resource bfin_isp1760_resources[] = {
  63. [0] = {
  64. .start = 0x203C0000,
  65. .end = 0x203C0000 + 0x000fffff,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. [1] = {
  69. .start = IRQ_PF7,
  70. .end = IRQ_PF7,
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. static struct isp1760_platform_data isp1760_priv = {
  75. .is_isp1761 = 0,
  76. .port1_disable = 0,
  77. .bus_width_16 = 1,
  78. .port1_otg = 0,
  79. .analog_oc = 0,
  80. .dack_polarity_high = 0,
  81. .dreq_polarity_high = 0,
  82. };
  83. static struct platform_device bfin_isp1760_device = {
  84. .name = "isp1760-hcd",
  85. .id = 0,
  86. .dev = {
  87. .platform_data = &isp1760_priv,
  88. },
  89. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  90. .resource = bfin_isp1760_resources,
  91. };
  92. #endif
  93. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  94. #include <linux/input.h>
  95. #include <linux/gpio_keys.h>
  96. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  97. {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
  98. {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
  99. {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
  100. {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
  101. };
  102. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  103. .buttons = bfin_gpio_keys_table,
  104. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  105. };
  106. static struct platform_device bfin_device_gpiokeys = {
  107. .name = "gpio-keys",
  108. .dev = {
  109. .platform_data = &bfin_gpio_keys_data,
  110. },
  111. };
  112. #endif
  113. static struct resource bfin_gpios_resources = {
  114. .start = 0,
  115. .end = MAX_BLACKFIN_GPIOS - 1,
  116. .flags = IORESOURCE_IRQ,
  117. };
  118. static struct platform_device bfin_gpios_device = {
  119. .name = "simple-gpio",
  120. .id = -1,
  121. .num_resources = 1,
  122. .resource = &bfin_gpios_resources,
  123. };
  124. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  125. static struct resource bfin_pcmcia_cf_resources[] = {
  126. {
  127. .start = 0x20310000, /* IO PORT */
  128. .end = 0x20312000,
  129. .flags = IORESOURCE_MEM,
  130. }, {
  131. .start = 0x20311000, /* Attribute Memory */
  132. .end = 0x20311FFF,
  133. .flags = IORESOURCE_MEM,
  134. }, {
  135. .start = IRQ_PF4,
  136. .end = IRQ_PF4,
  137. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  138. }, {
  139. .start = 6, /* Card Detect PF6 */
  140. .end = 6,
  141. .flags = IORESOURCE_IRQ,
  142. },
  143. };
  144. static struct platform_device bfin_pcmcia_cf_device = {
  145. .name = "bfin_cf_pcmcia",
  146. .id = -1,
  147. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  148. .resource = bfin_pcmcia_cf_resources,
  149. };
  150. #endif
  151. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  152. static struct platform_device rtc_device = {
  153. .name = "rtc-bfin",
  154. .id = -1,
  155. };
  156. #endif
  157. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  158. static struct resource smc91x_resources[] = {
  159. {
  160. .name = "smc91x-regs",
  161. .start = 0x20300300,
  162. .end = 0x20300300 + 16,
  163. .flags = IORESOURCE_MEM,
  164. }, {
  165. .start = IRQ_PF7,
  166. .end = IRQ_PF7,
  167. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  168. },
  169. };
  170. static struct platform_device smc91x_device = {
  171. .name = "smc91x",
  172. .id = 0,
  173. .num_resources = ARRAY_SIZE(smc91x_resources),
  174. .resource = smc91x_resources,
  175. };
  176. #endif
  177. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  178. static struct resource dm9000_resources[] = {
  179. [0] = {
  180. .start = 0x203FB800,
  181. .end = 0x203FB800 + 8,
  182. .flags = IORESOURCE_MEM,
  183. },
  184. [1] = {
  185. .start = IRQ_PF9,
  186. .end = IRQ_PF9,
  187. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  188. },
  189. };
  190. static struct platform_device dm9000_device = {
  191. .name = "dm9000",
  192. .id = -1,
  193. .num_resources = ARRAY_SIZE(dm9000_resources),
  194. .resource = dm9000_resources,
  195. };
  196. #endif
  197. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  198. static struct resource ax88180_resources[] = {
  199. [0] = {
  200. .start = 0x20300000,
  201. .end = 0x20300000 + 0x8000,
  202. .flags = IORESOURCE_MEM,
  203. },
  204. [1] = {
  205. .start = IRQ_PF7,
  206. .end = IRQ_PF7,
  207. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
  208. },
  209. };
  210. static struct platform_device ax88180_device = {
  211. .name = "ax88180",
  212. .id = -1,
  213. .num_resources = ARRAY_SIZE(ax88180_resources),
  214. .resource = ax88180_resources,
  215. };
  216. #endif
  217. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  218. static struct resource sl811_hcd_resources[] = {
  219. {
  220. .start = 0x20340000,
  221. .end = 0x20340000,
  222. .flags = IORESOURCE_MEM,
  223. }, {
  224. .start = 0x20340004,
  225. .end = 0x20340004,
  226. .flags = IORESOURCE_MEM,
  227. }, {
  228. .start = CONFIG_USB_SL811_BFIN_IRQ,
  229. .end = CONFIG_USB_SL811_BFIN_IRQ,
  230. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  231. },
  232. };
  233. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  234. void sl811_port_power(struct device *dev, int is_on)
  235. {
  236. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  237. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  238. }
  239. #endif
  240. static struct sl811_platform_data sl811_priv = {
  241. .potpg = 10,
  242. .power = 250, /* == 500mA */
  243. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  244. .port_power = &sl811_port_power,
  245. #endif
  246. };
  247. static struct platform_device sl811_hcd_device = {
  248. .name = "sl811-hcd",
  249. .id = 0,
  250. .dev = {
  251. .platform_data = &sl811_priv,
  252. },
  253. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  254. .resource = sl811_hcd_resources,
  255. };
  256. #endif
  257. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  258. static struct resource isp1362_hcd_resources[] = {
  259. {
  260. .start = 0x20360000,
  261. .end = 0x20360000,
  262. .flags = IORESOURCE_MEM,
  263. }, {
  264. .start = 0x20360004,
  265. .end = 0x20360004,
  266. .flags = IORESOURCE_MEM,
  267. }, {
  268. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  269. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  270. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  271. },
  272. };
  273. static struct isp1362_platform_data isp1362_priv = {
  274. .sel15Kres = 1,
  275. .clknotstop = 0,
  276. .oc_enable = 0,
  277. .int_act_high = 0,
  278. .int_edge_triggered = 0,
  279. .remote_wakeup_connected = 0,
  280. .no_power_switching = 1,
  281. .power_switching_mode = 0,
  282. };
  283. static struct platform_device isp1362_hcd_device = {
  284. .name = "isp1362-hcd",
  285. .id = 0,
  286. .dev = {
  287. .platform_data = &isp1362_priv,
  288. },
  289. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  290. .resource = isp1362_hcd_resources,
  291. };
  292. #endif
  293. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  294. static struct platform_device bfin_mac_device = {
  295. .name = "bfin_mac",
  296. };
  297. #endif
  298. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  299. static struct resource net2272_bfin_resources[] = {
  300. {
  301. .start = 0x20300000,
  302. .end = 0x20300000 + 0x100,
  303. .flags = IORESOURCE_MEM,
  304. }, {
  305. .start = IRQ_PF7,
  306. .end = IRQ_PF7,
  307. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  308. },
  309. };
  310. static struct platform_device net2272_bfin_device = {
  311. .name = "net2272",
  312. .id = -1,
  313. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  314. .resource = net2272_bfin_resources,
  315. };
  316. #endif
  317. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  318. #ifdef CONFIG_MTD_PARTITIONS
  319. const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
  320. static struct mtd_partition bfin_plat_nand_partitions[] = {
  321. {
  322. .name = "linux kernel(nand)",
  323. .size = 0x400000,
  324. .offset = 0,
  325. }, {
  326. .name = "file system(nand)",
  327. .size = MTDPART_SIZ_FULL,
  328. .offset = MTDPART_OFS_APPEND,
  329. },
  330. };
  331. #endif
  332. #define BFIN_NAND_PLAT_CLE 2
  333. #define BFIN_NAND_PLAT_ALE 1
  334. static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  335. {
  336. struct nand_chip *this = mtd->priv;
  337. if (cmd == NAND_CMD_NONE)
  338. return;
  339. if (ctrl & NAND_CLE)
  340. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
  341. else
  342. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
  343. }
  344. #define BFIN_NAND_PLAT_READY GPIO_PF3
  345. static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
  346. {
  347. return gpio_get_value(BFIN_NAND_PLAT_READY);
  348. }
  349. static struct platform_nand_data bfin_plat_nand_data = {
  350. .chip = {
  351. .chip_delay = 30,
  352. #ifdef CONFIG_MTD_PARTITIONS
  353. .part_probe_types = part_probes,
  354. .partitions = bfin_plat_nand_partitions,
  355. .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
  356. #endif
  357. },
  358. .ctrl = {
  359. .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
  360. .dev_ready = bfin_plat_nand_dev_ready,
  361. },
  362. };
  363. #define MAX(x, y) (x > y ? x : y)
  364. static struct resource bfin_plat_nand_resources = {
  365. .start = 0x20212000,
  366. .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
  367. .flags = IORESOURCE_IO,
  368. };
  369. static struct platform_device bfin_async_nand_device = {
  370. .name = "gen_nand",
  371. .id = -1,
  372. .num_resources = 1,
  373. .resource = &bfin_plat_nand_resources,
  374. .dev = {
  375. .platform_data = &bfin_plat_nand_data,
  376. },
  377. };
  378. static void bfin_plat_nand_init(void)
  379. {
  380. gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
  381. }
  382. #else
  383. static void bfin_plat_nand_init(void) {}
  384. #endif
  385. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  386. static struct mtd_partition stamp_partitions[] = {
  387. {
  388. .name = "bootloader(nor)",
  389. .size = 0x40000,
  390. .offset = 0,
  391. }, {
  392. .name = "linux kernel(nor)",
  393. .size = 0xE0000,
  394. .offset = MTDPART_OFS_APPEND,
  395. }, {
  396. .name = "file system(nor)",
  397. .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
  398. .offset = MTDPART_OFS_APPEND,
  399. }, {
  400. .name = "MAC Address(nor)",
  401. .size = MTDPART_SIZ_FULL,
  402. .offset = 0x3F0000,
  403. .mask_flags = MTD_WRITEABLE,
  404. }
  405. };
  406. static struct physmap_flash_data stamp_flash_data = {
  407. .width = 2,
  408. .parts = stamp_partitions,
  409. .nr_parts = ARRAY_SIZE(stamp_partitions),
  410. };
  411. static struct resource stamp_flash_resource = {
  412. .start = 0x20000000,
  413. .end = 0x203fffff,
  414. .flags = IORESOURCE_MEM,
  415. };
  416. static struct platform_device stamp_flash_device = {
  417. .name = "physmap-flash",
  418. .id = 0,
  419. .dev = {
  420. .platform_data = &stamp_flash_data,
  421. },
  422. .num_resources = 1,
  423. .resource = &stamp_flash_resource,
  424. };
  425. #endif
  426. #if defined(CONFIG_MTD_M25P80) \
  427. || defined(CONFIG_MTD_M25P80_MODULE)
  428. static struct mtd_partition bfin_spi_flash_partitions[] = {
  429. {
  430. .name = "bootloader(spi)",
  431. .size = 0x00040000,
  432. .offset = 0,
  433. .mask_flags = MTD_CAP_ROM
  434. }, {
  435. .name = "linux kernel(spi)",
  436. .size = 0xe0000,
  437. .offset = MTDPART_OFS_APPEND,
  438. }, {
  439. .name = "file system(spi)",
  440. .size = MTDPART_SIZ_FULL,
  441. .offset = MTDPART_OFS_APPEND,
  442. }
  443. };
  444. static struct flash_platform_data bfin_spi_flash_data = {
  445. .name = "m25p80",
  446. .parts = bfin_spi_flash_partitions,
  447. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  448. /* .type = "m25p64", */
  449. };
  450. /* SPI flash chip (m25p64) */
  451. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  452. .enable_dma = 0, /* use dma transfer with this chip*/
  453. .bits_per_word = 8,
  454. };
  455. #endif
  456. #if defined(CONFIG_SPI_ADC_BF533) \
  457. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  458. /* SPI ADC chip */
  459. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  460. .enable_dma = 1, /* use dma transfer with this chip*/
  461. .bits_per_word = 16,
  462. };
  463. #endif
  464. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  465. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  466. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  467. .enable_dma = 0,
  468. .bits_per_word = 16,
  469. };
  470. #endif
  471. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  472. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  473. .enable_dma = 0,
  474. .bits_per_word = 16,
  475. };
  476. #endif
  477. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  478. static struct bfin5xx_spi_chip spi_mmc_chip_info = {
  479. .enable_dma = 0,
  480. .bits_per_word = 8,
  481. };
  482. #endif
  483. #if defined(CONFIG_PBX)
  484. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  485. .ctl_reg = 0x4, /* send zero */
  486. .enable_dma = 0,
  487. .bits_per_word = 8,
  488. .cs_change_per_word = 1,
  489. };
  490. #endif
  491. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  492. #include <linux/spi/ad7877.h>
  493. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  494. .enable_dma = 0,
  495. .bits_per_word = 16,
  496. };
  497. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  498. .model = 7877,
  499. .vref_delay_usecs = 50, /* internal, no capacitor */
  500. .x_plate_ohms = 419,
  501. .y_plate_ohms = 486,
  502. .pressure_max = 1000,
  503. .pressure_min = 0,
  504. .stopacq_polarity = 1,
  505. .first_conversion_delay = 3,
  506. .acquisition_time = 1,
  507. .averaging = 1,
  508. .pen_down_acc_interval = 1,
  509. };
  510. #endif
  511. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  512. #include <linux/spi/ad7879.h>
  513. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  514. .model = 7879, /* Model = AD7879 */
  515. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  516. .pressure_max = 10000,
  517. .pressure_min = 0,
  518. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  519. .acquisition_time = 1, /* 4us acquisition time per sample */
  520. .median = 2, /* do 8 measurements */
  521. .averaging = 1, /* take the average of 4 middle samples */
  522. .pen_down_acc_interval = 255, /* 9.4 ms */
  523. .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
  524. .gpio_default = 1, /* During initialization set GPIO = HIGH */
  525. };
  526. #endif
  527. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  528. static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
  529. .enable_dma = 0,
  530. .bits_per_word = 16,
  531. };
  532. #endif
  533. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  534. static struct bfin5xx_spi_chip spidev_chip_info = {
  535. .enable_dma = 0,
  536. .bits_per_word = 8,
  537. };
  538. #endif
  539. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  540. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  541. .enable_dma = 0,
  542. .bits_per_word = 8,
  543. };
  544. #endif
  545. #if defined(CONFIG_MTD_DATAFLASH) \
  546. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  547. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  548. {
  549. .name = "bootloader(spi)",
  550. .size = 0x00040000,
  551. .offset = 0,
  552. .mask_flags = MTD_CAP_ROM
  553. }, {
  554. .name = "linux kernel(spi)",
  555. .size = 0xe0000,
  556. .offset = MTDPART_OFS_APPEND,
  557. }, {
  558. .name = "file system(spi)",
  559. .size = MTDPART_SIZ_FULL,
  560. .offset = MTDPART_OFS_APPEND,
  561. }
  562. };
  563. static struct flash_platform_data bfin_spi_dataflash_data = {
  564. .name = "SPI Dataflash",
  565. .parts = bfin_spi_dataflash_partitions,
  566. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  567. };
  568. /* DataFlash chip */
  569. static struct bfin5xx_spi_chip data_flash_chip_info = {
  570. .enable_dma = 0, /* use dma transfer with this chip*/
  571. .bits_per_word = 8,
  572. };
  573. #endif
  574. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  575. #if defined(CONFIG_MTD_M25P80) \
  576. || defined(CONFIG_MTD_M25P80_MODULE)
  577. {
  578. /* the modalias must be the same as spi device driver name */
  579. .modalias = "m25p80", /* Name of spi_driver for this device */
  580. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  581. .bus_num = 0, /* Framework bus number */
  582. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  583. .platform_data = &bfin_spi_flash_data,
  584. .controller_data = &spi_flash_chip_info,
  585. .mode = SPI_MODE_3,
  586. },
  587. #endif
  588. #if defined(CONFIG_MTD_DATAFLASH) \
  589. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  590. { /* DataFlash chip */
  591. .modalias = "mtd_dataflash",
  592. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  593. .bus_num = 0, /* Framework bus number */
  594. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  595. .platform_data = &bfin_spi_dataflash_data,
  596. .controller_data = &data_flash_chip_info,
  597. .mode = SPI_MODE_3,
  598. },
  599. #endif
  600. #if defined(CONFIG_SPI_ADC_BF533) \
  601. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  602. {
  603. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  604. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  605. .bus_num = 0, /* Framework bus number */
  606. .chip_select = 1, /* Framework chip select. */
  607. .platform_data = NULL, /* No spi_driver specific config */
  608. .controller_data = &spi_adc_chip_info,
  609. },
  610. #endif
  611. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  612. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  613. {
  614. .modalias = "ad1836-spi",
  615. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  616. .bus_num = 0,
  617. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  618. .controller_data = &ad1836_spi_chip_info,
  619. },
  620. #endif
  621. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  622. {
  623. .modalias = "ad9960-spi",
  624. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  625. .bus_num = 0,
  626. .chip_select = 1,
  627. .controller_data = &ad9960_spi_chip_info,
  628. },
  629. #endif
  630. #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
  631. {
  632. .modalias = "spi_mmc_dummy",
  633. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  634. .bus_num = 0,
  635. .chip_select = 0,
  636. .platform_data = NULL,
  637. .controller_data = &spi_mmc_chip_info,
  638. .mode = SPI_MODE_3,
  639. },
  640. {
  641. .modalias = "spi_mmc",
  642. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  643. .bus_num = 0,
  644. .chip_select = CONFIG_SPI_MMC_CS_CHAN,
  645. .platform_data = NULL,
  646. .controller_data = &spi_mmc_chip_info,
  647. .mode = SPI_MODE_3,
  648. },
  649. #endif
  650. #if defined(CONFIG_PBX)
  651. {
  652. .modalias = "fxs-spi",
  653. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  654. .bus_num = 0,
  655. .chip_select = 8 - CONFIG_J11_JUMPER,
  656. .controller_data = &spi_si3xxx_chip_info,
  657. .mode = SPI_MODE_3,
  658. },
  659. {
  660. .modalias = "fxo-spi",
  661. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  662. .bus_num = 0,
  663. .chip_select = 8 - CONFIG_J19_JUMPER,
  664. .controller_data = &spi_si3xxx_chip_info,
  665. .mode = SPI_MODE_3,
  666. },
  667. #endif
  668. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  669. {
  670. .modalias = "ad7877",
  671. .platform_data = &bfin_ad7877_ts_info,
  672. .irq = IRQ_PF6,
  673. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  674. .bus_num = 0,
  675. .chip_select = 1,
  676. .controller_data = &spi_ad7877_chip_info,
  677. },
  678. #endif
  679. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  680. {
  681. .modalias = "ad7879",
  682. .platform_data = &bfin_ad7879_ts_info,
  683. .irq = IRQ_PF7,
  684. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  685. .bus_num = 0,
  686. .chip_select = 1,
  687. .controller_data = &spi_ad7879_chip_info,
  688. .mode = SPI_CPHA | SPI_CPOL,
  689. },
  690. #endif
  691. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  692. {
  693. .modalias = "spidev",
  694. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  695. .bus_num = 0,
  696. .chip_select = 1,
  697. .controller_data = &spidev_chip_info,
  698. },
  699. #endif
  700. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  701. {
  702. .modalias = "bfin-lq035q1-spi",
  703. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  704. .bus_num = 0,
  705. .chip_select = 2,
  706. .controller_data = &lq035q1_spi_chip_info,
  707. .mode = SPI_CPHA | SPI_CPOL,
  708. },
  709. #endif
  710. };
  711. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  712. /* SPI controller data */
  713. static struct bfin5xx_spi_master bfin_spi0_info = {
  714. .num_chipselect = 8,
  715. .enable_dma = 1, /* master has the ability to do dma transfer */
  716. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  717. };
  718. /* SPI (0) */
  719. static struct resource bfin_spi0_resource[] = {
  720. [0] = {
  721. .start = SPI0_REGBASE,
  722. .end = SPI0_REGBASE + 0xFF,
  723. .flags = IORESOURCE_MEM,
  724. },
  725. [1] = {
  726. .start = CH_SPI,
  727. .end = CH_SPI,
  728. .flags = IORESOURCE_IRQ,
  729. },
  730. };
  731. static struct platform_device bfin_spi0_device = {
  732. .name = "bfin-spi",
  733. .id = 0, /* Bus number */
  734. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  735. .resource = bfin_spi0_resource,
  736. .dev = {
  737. .platform_data = &bfin_spi0_info, /* Passed to driver */
  738. },
  739. };
  740. #endif /* spi master and devices */
  741. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  742. static struct platform_device bfin_fb_device = {
  743. .name = "bf537-lq035",
  744. };
  745. #endif
  746. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  747. static struct platform_device bfin_fb_adv7393_device = {
  748. .name = "bfin-adv7393",
  749. };
  750. #endif
  751. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  752. #include <asm/bfin-lq035q1.h>
  753. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  754. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  755. .use_bl = 0, /* let something else control the LCD Blacklight */
  756. .gpio_bl = GPIO_PF7,
  757. };
  758. static struct resource bfin_lq035q1_resources[] = {
  759. {
  760. .start = IRQ_PPI_ERROR,
  761. .end = IRQ_PPI_ERROR,
  762. .flags = IORESOURCE_IRQ,
  763. },
  764. };
  765. static struct platform_device bfin_lq035q1_device = {
  766. .name = "bfin-lq035q1",
  767. .id = -1,
  768. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  769. .resource = bfin_lq035q1_resources,
  770. .dev = {
  771. .platform_data = &bfin_lq035q1_data,
  772. },
  773. };
  774. #endif
  775. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  776. static struct resource bfin_uart_resources[] = {
  777. #ifdef CONFIG_SERIAL_BFIN_UART0
  778. {
  779. .start = 0xFFC00400,
  780. .end = 0xFFC004FF,
  781. .flags = IORESOURCE_MEM,
  782. },
  783. #endif
  784. #ifdef CONFIG_SERIAL_BFIN_UART1
  785. {
  786. .start = 0xFFC02000,
  787. .end = 0xFFC020FF,
  788. .flags = IORESOURCE_MEM,
  789. },
  790. #endif
  791. };
  792. static struct platform_device bfin_uart_device = {
  793. .name = "bfin-uart",
  794. .id = 1,
  795. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  796. .resource = bfin_uart_resources,
  797. };
  798. #endif
  799. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  800. static struct resource bfin_sir_resources[] = {
  801. #ifdef CONFIG_BFIN_SIR0
  802. {
  803. .start = 0xFFC00400,
  804. .end = 0xFFC004FF,
  805. .flags = IORESOURCE_MEM,
  806. },
  807. #endif
  808. #ifdef CONFIG_BFIN_SIR1
  809. {
  810. .start = 0xFFC02000,
  811. .end = 0xFFC020FF,
  812. .flags = IORESOURCE_MEM,
  813. },
  814. #endif
  815. };
  816. static struct platform_device bfin_sir_device = {
  817. .name = "bfin_sir",
  818. .id = 0,
  819. .num_resources = ARRAY_SIZE(bfin_sir_resources),
  820. .resource = bfin_sir_resources,
  821. };
  822. #endif
  823. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  824. static struct resource bfin_twi0_resource[] = {
  825. [0] = {
  826. .start = TWI0_REGBASE,
  827. .end = TWI0_REGBASE,
  828. .flags = IORESOURCE_MEM,
  829. },
  830. [1] = {
  831. .start = IRQ_TWI,
  832. .end = IRQ_TWI,
  833. .flags = IORESOURCE_IRQ,
  834. },
  835. };
  836. static struct platform_device i2c_bfin_twi_device = {
  837. .name = "i2c-bfin-twi",
  838. .id = 0,
  839. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  840. .resource = bfin_twi0_resource,
  841. };
  842. #endif
  843. #ifdef CONFIG_I2C_BOARDINFO
  844. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  845. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  846. {
  847. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  848. .irq = IRQ_PF5,
  849. },
  850. #endif
  851. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  852. {
  853. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  854. },
  855. #endif
  856. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  857. {
  858. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  859. .irq = IRQ_PG6,
  860. },
  861. #endif
  862. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  863. {
  864. I2C_BOARD_INFO("ad7879", 0x2F),
  865. .irq = IRQ_PG5,
  866. .platform_data = (void *)&bfin_ad7879_ts_info,
  867. },
  868. #endif
  869. };
  870. #endif
  871. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  872. static struct platform_device bfin_sport0_uart_device = {
  873. .name = "bfin-sport-uart",
  874. .id = 0,
  875. };
  876. static struct platform_device bfin_sport1_uart_device = {
  877. .name = "bfin-sport-uart",
  878. .id = 1,
  879. };
  880. #endif
  881. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  882. #define PATA_INT IRQ_PF5
  883. static struct pata_platform_info bfin_pata_platform_data = {
  884. .ioport_shift = 1,
  885. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  886. };
  887. static struct resource bfin_pata_resources[] = {
  888. {
  889. .start = 0x20314020,
  890. .end = 0x2031403F,
  891. .flags = IORESOURCE_MEM,
  892. },
  893. {
  894. .start = 0x2031401C,
  895. .end = 0x2031401F,
  896. .flags = IORESOURCE_MEM,
  897. },
  898. {
  899. .start = PATA_INT,
  900. .end = PATA_INT,
  901. .flags = IORESOURCE_IRQ,
  902. },
  903. };
  904. static struct platform_device bfin_pata_device = {
  905. .name = "pata_platform",
  906. .id = -1,
  907. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  908. .resource = bfin_pata_resources,
  909. .dev = {
  910. .platform_data = &bfin_pata_platform_data,
  911. }
  912. };
  913. #endif
  914. static const unsigned int cclk_vlev_datasheet[] =
  915. {
  916. VRPAIR(VLEV_085, 250000000),
  917. VRPAIR(VLEV_090, 376000000),
  918. VRPAIR(VLEV_095, 426000000),
  919. VRPAIR(VLEV_100, 426000000),
  920. VRPAIR(VLEV_105, 476000000),
  921. VRPAIR(VLEV_110, 476000000),
  922. VRPAIR(VLEV_115, 476000000),
  923. VRPAIR(VLEV_120, 500000000),
  924. VRPAIR(VLEV_125, 533000000),
  925. VRPAIR(VLEV_130, 600000000),
  926. };
  927. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  928. .tuple_tab = cclk_vlev_datasheet,
  929. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  930. .vr_settling_time = 25 /* us */,
  931. };
  932. static struct platform_device bfin_dpmc = {
  933. .name = "bfin dpmc",
  934. .dev = {
  935. .platform_data = &bfin_dmpc_vreg_data,
  936. },
  937. };
  938. static struct platform_device *stamp_devices[] __initdata = {
  939. &bfin_dpmc,
  940. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  941. &bfin_pcmcia_cf_device,
  942. #endif
  943. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  944. &rtc_device,
  945. #endif
  946. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  947. &sl811_hcd_device,
  948. #endif
  949. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  950. &isp1362_hcd_device,
  951. #endif
  952. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  953. &bfin_isp1760_device,
  954. #endif
  955. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  956. &smc91x_device,
  957. #endif
  958. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  959. &dm9000_device,
  960. #endif
  961. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  962. &ax88180_device,
  963. #endif
  964. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  965. &bfin_mac_device,
  966. #endif
  967. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  968. &net2272_bfin_device,
  969. #endif
  970. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  971. &bfin_spi0_device,
  972. #endif
  973. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  974. &bfin_fb_device,
  975. #endif
  976. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  977. &bfin_lq035q1_device,
  978. #endif
  979. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  980. &bfin_fb_adv7393_device,
  981. #endif
  982. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  983. &bfin_uart_device,
  984. #endif
  985. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  986. &bfin_sir_device,
  987. #endif
  988. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  989. &i2c_bfin_twi_device,
  990. #endif
  991. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  992. &bfin_sport0_uart_device,
  993. &bfin_sport1_uart_device,
  994. #endif
  995. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  996. &bfin_pata_device,
  997. #endif
  998. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  999. &bfin_device_gpiokeys,
  1000. #endif
  1001. &bfin_gpios_device,
  1002. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  1003. &bfin_async_nand_device,
  1004. #endif
  1005. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1006. &stamp_flash_device,
  1007. #endif
  1008. };
  1009. static int __init stamp_init(void)
  1010. {
  1011. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1012. #ifdef CONFIG_I2C_BOARDINFO
  1013. i2c_register_board_info(0, bfin_i2c_board_info,
  1014. ARRAY_SIZE(bfin_i2c_board_info));
  1015. #endif
  1016. bfin_plat_nand_init();
  1017. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  1018. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1019. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1020. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  1021. #endif
  1022. return 0;
  1023. }
  1024. arch_initcall(stamp_init);
  1025. void native_machine_restart(char *cmd)
  1026. {
  1027. /* workaround reboot hang when booting from SPI */
  1028. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  1029. bfin_gpio_reset_spi0_ssel1();
  1030. }
  1031. /*
  1032. * Currently the MAC address is saved in Flash by U-Boot
  1033. */
  1034. #define FLASH_MAC 0x203f0000
  1035. void bfin_get_ether_addr(char *addr)
  1036. {
  1037. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  1038. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  1039. }
  1040. EXPORT_SYMBOL(bfin_get_ether_addr);