stamp.c 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736
  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 <linux/spi/mmc_spi.h>
  49. #include <asm/dma.h>
  50. #include <asm/bfin5xx_spi.h>
  51. #include <asm/reboot.h>
  52. #include <asm/portmux.h>
  53. #include <asm/dpmc.h>
  54. /*
  55. * Name the Board for the /proc/cpuinfo
  56. */
  57. const char bfin_board_name[] = "ADI BF537-STAMP";
  58. /*
  59. * Driver needs to know address, irq and flag pin.
  60. */
  61. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  62. #include <linux/usb/isp1760.h>
  63. static struct resource bfin_isp1760_resources[] = {
  64. [0] = {
  65. .start = 0x203C0000,
  66. .end = 0x203C0000 + 0x000fffff,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. .start = IRQ_PF7,
  71. .end = IRQ_PF7,
  72. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  73. },
  74. };
  75. static struct isp1760_platform_data isp1760_priv = {
  76. .is_isp1761 = 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. #include <linux/smc91x.h>
  159. static struct smc91x_platdata smc91x_info = {
  160. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  161. .leda = RPC_LED_100_10,
  162. .ledb = RPC_LED_TX_RX,
  163. };
  164. static struct resource smc91x_resources[] = {
  165. {
  166. .name = "smc91x-regs",
  167. .start = 0x20300300,
  168. .end = 0x20300300 + 16,
  169. .flags = IORESOURCE_MEM,
  170. }, {
  171. .start = IRQ_PF7,
  172. .end = IRQ_PF7,
  173. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  174. },
  175. };
  176. static struct platform_device smc91x_device = {
  177. .name = "smc91x",
  178. .id = 0,
  179. .num_resources = ARRAY_SIZE(smc91x_resources),
  180. .resource = smc91x_resources,
  181. .dev = {
  182. .platform_data = &smc91x_info,
  183. },
  184. };
  185. #endif
  186. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  187. static struct resource dm9000_resources[] = {
  188. [0] = {
  189. .start = 0x203FB800,
  190. .end = 0x203FB800 + 1,
  191. .flags = IORESOURCE_MEM,
  192. },
  193. [1] = {
  194. .start = 0x203FB804,
  195. .end = 0x203FB804 + 1,
  196. .flags = IORESOURCE_MEM,
  197. },
  198. [2] = {
  199. .start = IRQ_PF9,
  200. .end = IRQ_PF9,
  201. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  202. },
  203. };
  204. static struct platform_device dm9000_device = {
  205. .name = "dm9000",
  206. .id = -1,
  207. .num_resources = ARRAY_SIZE(dm9000_resources),
  208. .resource = dm9000_resources,
  209. };
  210. #endif
  211. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  212. static struct resource ax88180_resources[] = {
  213. [0] = {
  214. .start = 0x20300000,
  215. .end = 0x20300000 + 0x8000,
  216. .flags = IORESOURCE_MEM,
  217. },
  218. [1] = {
  219. .start = IRQ_PF7,
  220. .end = IRQ_PF7,
  221. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
  222. },
  223. };
  224. static struct platform_device ax88180_device = {
  225. .name = "ax88180",
  226. .id = -1,
  227. .num_resources = ARRAY_SIZE(ax88180_resources),
  228. .resource = ax88180_resources,
  229. };
  230. #endif
  231. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  232. static struct resource sl811_hcd_resources[] = {
  233. {
  234. .start = 0x20340000,
  235. .end = 0x20340000,
  236. .flags = IORESOURCE_MEM,
  237. }, {
  238. .start = 0x20340004,
  239. .end = 0x20340004,
  240. .flags = IORESOURCE_MEM,
  241. }, {
  242. .start = CONFIG_USB_SL811_BFIN_IRQ,
  243. .end = CONFIG_USB_SL811_BFIN_IRQ,
  244. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  245. },
  246. };
  247. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  248. void sl811_port_power(struct device *dev, int is_on)
  249. {
  250. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  251. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  252. }
  253. #endif
  254. static struct sl811_platform_data sl811_priv = {
  255. .potpg = 10,
  256. .power = 250, /* == 500mA */
  257. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  258. .port_power = &sl811_port_power,
  259. #endif
  260. };
  261. static struct platform_device sl811_hcd_device = {
  262. .name = "sl811-hcd",
  263. .id = 0,
  264. .dev = {
  265. .platform_data = &sl811_priv,
  266. },
  267. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  268. .resource = sl811_hcd_resources,
  269. };
  270. #endif
  271. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  272. static struct resource isp1362_hcd_resources[] = {
  273. {
  274. .start = 0x20360000,
  275. .end = 0x20360000,
  276. .flags = IORESOURCE_MEM,
  277. }, {
  278. .start = 0x20360004,
  279. .end = 0x20360004,
  280. .flags = IORESOURCE_MEM,
  281. }, {
  282. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  283. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  284. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  285. },
  286. };
  287. static struct isp1362_platform_data isp1362_priv = {
  288. .sel15Kres = 1,
  289. .clknotstop = 0,
  290. .oc_enable = 0,
  291. .int_act_high = 0,
  292. .int_edge_triggered = 0,
  293. .remote_wakeup_connected = 0,
  294. .no_power_switching = 1,
  295. .power_switching_mode = 0,
  296. };
  297. static struct platform_device isp1362_hcd_device = {
  298. .name = "isp1362-hcd",
  299. .id = 0,
  300. .dev = {
  301. .platform_data = &isp1362_priv,
  302. },
  303. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  304. .resource = isp1362_hcd_resources,
  305. };
  306. #endif
  307. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  308. static struct platform_device bfin_mii_bus = {
  309. .name = "bfin_mii_bus",
  310. };
  311. static struct platform_device bfin_mac_device = {
  312. .name = "bfin_mac",
  313. .dev.platform_data = &bfin_mii_bus,
  314. };
  315. #endif
  316. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  317. static struct resource net2272_bfin_resources[] = {
  318. {
  319. .start = 0x20300000,
  320. .end = 0x20300000 + 0x100,
  321. .flags = IORESOURCE_MEM,
  322. }, {
  323. .start = IRQ_PF7,
  324. .end = IRQ_PF7,
  325. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  326. },
  327. };
  328. static struct platform_device net2272_bfin_device = {
  329. .name = "net2272",
  330. .id = -1,
  331. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  332. .resource = net2272_bfin_resources,
  333. };
  334. #endif
  335. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  336. #ifdef CONFIG_MTD_PARTITIONS
  337. const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
  338. static struct mtd_partition bfin_plat_nand_partitions[] = {
  339. {
  340. .name = "linux kernel(nand)",
  341. .size = 0x400000,
  342. .offset = 0,
  343. }, {
  344. .name = "file system(nand)",
  345. .size = MTDPART_SIZ_FULL,
  346. .offset = MTDPART_OFS_APPEND,
  347. },
  348. };
  349. #endif
  350. #define BFIN_NAND_PLAT_CLE 2
  351. #define BFIN_NAND_PLAT_ALE 1
  352. static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  353. {
  354. struct nand_chip *this = mtd->priv;
  355. if (cmd == NAND_CMD_NONE)
  356. return;
  357. if (ctrl & NAND_CLE)
  358. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
  359. else
  360. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
  361. }
  362. #define BFIN_NAND_PLAT_READY GPIO_PF3
  363. static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
  364. {
  365. return gpio_get_value(BFIN_NAND_PLAT_READY);
  366. }
  367. static struct platform_nand_data bfin_plat_nand_data = {
  368. .chip = {
  369. .chip_delay = 30,
  370. #ifdef CONFIG_MTD_PARTITIONS
  371. .part_probe_types = part_probes,
  372. .partitions = bfin_plat_nand_partitions,
  373. .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
  374. #endif
  375. },
  376. .ctrl = {
  377. .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
  378. .dev_ready = bfin_plat_nand_dev_ready,
  379. },
  380. };
  381. #define MAX(x, y) (x > y ? x : y)
  382. static struct resource bfin_plat_nand_resources = {
  383. .start = 0x20212000,
  384. .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
  385. .flags = IORESOURCE_IO,
  386. };
  387. static struct platform_device bfin_async_nand_device = {
  388. .name = "gen_nand",
  389. .id = -1,
  390. .num_resources = 1,
  391. .resource = &bfin_plat_nand_resources,
  392. .dev = {
  393. .platform_data = &bfin_plat_nand_data,
  394. },
  395. };
  396. static void bfin_plat_nand_init(void)
  397. {
  398. gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
  399. }
  400. #else
  401. static void bfin_plat_nand_init(void) {}
  402. #endif
  403. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  404. static struct mtd_partition stamp_partitions[] = {
  405. {
  406. .name = "bootloader(nor)",
  407. .size = 0x40000,
  408. .offset = 0,
  409. }, {
  410. .name = "linux kernel(nor)",
  411. .size = 0x180000,
  412. .offset = MTDPART_OFS_APPEND,
  413. }, {
  414. .name = "file system(nor)",
  415. .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
  416. .offset = MTDPART_OFS_APPEND,
  417. }, {
  418. .name = "MAC Address(nor)",
  419. .size = MTDPART_SIZ_FULL,
  420. .offset = 0x3F0000,
  421. .mask_flags = MTD_WRITEABLE,
  422. }
  423. };
  424. static struct physmap_flash_data stamp_flash_data = {
  425. .width = 2,
  426. .parts = stamp_partitions,
  427. .nr_parts = ARRAY_SIZE(stamp_partitions),
  428. };
  429. static struct resource stamp_flash_resource = {
  430. .start = 0x20000000,
  431. .end = 0x203fffff,
  432. .flags = IORESOURCE_MEM,
  433. };
  434. static struct platform_device stamp_flash_device = {
  435. .name = "physmap-flash",
  436. .id = 0,
  437. .dev = {
  438. .platform_data = &stamp_flash_data,
  439. },
  440. .num_resources = 1,
  441. .resource = &stamp_flash_resource,
  442. };
  443. #endif
  444. #if defined(CONFIG_MTD_M25P80) \
  445. || defined(CONFIG_MTD_M25P80_MODULE)
  446. static struct mtd_partition bfin_spi_flash_partitions[] = {
  447. {
  448. .name = "bootloader(spi)",
  449. .size = 0x00040000,
  450. .offset = 0,
  451. .mask_flags = MTD_CAP_ROM
  452. }, {
  453. .name = "linux kernel(spi)",
  454. .size = 0x180000,
  455. .offset = MTDPART_OFS_APPEND,
  456. }, {
  457. .name = "file system(spi)",
  458. .size = MTDPART_SIZ_FULL,
  459. .offset = MTDPART_OFS_APPEND,
  460. }
  461. };
  462. static struct flash_platform_data bfin_spi_flash_data = {
  463. .name = "m25p80",
  464. .parts = bfin_spi_flash_partitions,
  465. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  466. /* .type = "m25p64", */
  467. };
  468. /* SPI flash chip (m25p64) */
  469. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  470. .enable_dma = 0, /* use dma transfer with this chip*/
  471. .bits_per_word = 8,
  472. };
  473. #endif
  474. #if defined(CONFIG_BFIN_SPI_ADC) \
  475. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  476. /* SPI ADC chip */
  477. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  478. .enable_dma = 1, /* use dma transfer with this chip*/
  479. .bits_per_word = 16,
  480. };
  481. #endif
  482. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
  483. || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  484. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  485. .enable_dma = 0,
  486. .bits_per_word = 16,
  487. };
  488. #endif
  489. #if defined(CONFIG_SND_BF5XX_SOC_AD1938) \
  490. || defined(CONFIG_SND_BF5XX_SOC_AD1938_MODULE)
  491. static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
  492. .enable_dma = 0,
  493. .bits_per_word = 8,
  494. .cs_gpio = GPIO_PF5,
  495. };
  496. #endif
  497. #if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
  498. #include <linux/input.h>
  499. #include <linux/input/ad714x.h>
  500. static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
  501. .enable_dma = 0,
  502. .bits_per_word = 16,
  503. };
  504. static struct ad714x_slider_plat slider_plat[] = {
  505. {
  506. .start_stage = 0,
  507. .end_stage = 7,
  508. .max_coord = 128,
  509. },
  510. };
  511. static struct ad714x_button_plat button_plat[] = {
  512. {
  513. .keycode = BTN_FORWARD,
  514. .l_mask = 0,
  515. .h_mask = 0x600,
  516. },
  517. {
  518. .keycode = BTN_LEFT,
  519. .l_mask = 0,
  520. .h_mask = 0x500,
  521. },
  522. {
  523. .keycode = BTN_MIDDLE,
  524. .l_mask = 0,
  525. .h_mask = 0x800,
  526. },
  527. {
  528. .keycode = BTN_RIGHT,
  529. .l_mask = 0x100,
  530. .h_mask = 0x400,
  531. },
  532. {
  533. .keycode = BTN_BACK,
  534. .l_mask = 0x200,
  535. .h_mask = 0x400,
  536. },
  537. };
  538. static struct ad714x_platform_data ad7147_platfrom_data = {
  539. .slider_num = 1,
  540. .button_num = 5,
  541. .slider = slider_plat,
  542. .button = button_plat,
  543. .stage_cfg_reg = {
  544. {0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
  545. {0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
  546. {0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
  547. {0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
  548. {0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
  549. {0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
  550. {0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
  551. {0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
  552. {0xFF7B, 0x3FFF, 0x506, 0x2626, 1100, 1100, 1150, 1150},
  553. {0xFDFE, 0x3FFF, 0x606, 0x2626, 1100, 1100, 1150, 1150},
  554. {0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
  555. {0xFFEF, 0x1FFF, 0x0, 0x2626, 1100, 1100, 1150, 1150},
  556. },
  557. .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
  558. };
  559. #endif
  560. #if defined(CONFIG_INPUT_EVAL_AD7142EB)
  561. #include <linux/input.h>
  562. #include <linux/input/ad714x.h>
  563. static struct ad714x_button_plat button_plat[] = {
  564. {
  565. .keycode = BTN_1,
  566. .l_mask = 0,
  567. .h_mask = 0x1,
  568. },
  569. {
  570. .keycode = BTN_2,
  571. .l_mask = 0,
  572. .h_mask = 0x2,
  573. },
  574. {
  575. .keycode = BTN_3,
  576. .l_mask = 0,
  577. .h_mask = 0x4,
  578. },
  579. {
  580. .keycode = BTN_4,
  581. .l_mask = 0x0,
  582. .h_mask = 0x8,
  583. },
  584. };
  585. static struct ad714x_platform_data ad7142_platfrom_data = {
  586. .button_num = 4,
  587. .button = button_plat,
  588. .stage_cfg_reg = {
  589. /* fixme: figure out right setting for all comoponent according
  590. * to hardware feature of EVAL-AD7142EB board */
  591. {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  592. {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  593. {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  594. {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  595. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  596. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  597. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  598. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  599. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  600. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  601. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  602. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  603. },
  604. .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
  605. };
  606. #endif
  607. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  608. #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
  609. static int bfin_mmc_spi_init(struct device *dev,
  610. irqreturn_t (*detect_int)(int, void *), void *data)
  611. {
  612. return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
  613. IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
  614. }
  615. static void bfin_mmc_spi_exit(struct device *dev, void *data)
  616. {
  617. free_irq(MMC_SPI_CARD_DETECT_INT, data);
  618. }
  619. static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
  620. .init = bfin_mmc_spi_init,
  621. .exit = bfin_mmc_spi_exit,
  622. .detect_delay = 100, /* msecs */
  623. };
  624. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  625. .enable_dma = 0,
  626. .bits_per_word = 8,
  627. .pio_interrupt = 0,
  628. };
  629. #endif
  630. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  631. #include <linux/spi/ad7877.h>
  632. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  633. .enable_dma = 0,
  634. .bits_per_word = 16,
  635. };
  636. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  637. .model = 7877,
  638. .vref_delay_usecs = 50, /* internal, no capacitor */
  639. .x_plate_ohms = 419,
  640. .y_plate_ohms = 486,
  641. .pressure_max = 1000,
  642. .pressure_min = 0,
  643. .stopacq_polarity = 1,
  644. .first_conversion_delay = 3,
  645. .acquisition_time = 1,
  646. .averaging = 1,
  647. .pen_down_acc_interval = 1,
  648. };
  649. #endif
  650. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  651. #include <linux/spi/ad7879.h>
  652. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  653. .model = 7879, /* Model = AD7879 */
  654. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  655. .pressure_max = 10000,
  656. .pressure_min = 0,
  657. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  658. .acquisition_time = 1, /* 4us acquisition time per sample */
  659. .median = 2, /* do 8 measurements */
  660. .averaging = 1, /* take the average of 4 middle samples */
  661. .pen_down_acc_interval = 255, /* 9.4 ms */
  662. .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
  663. .gpio_default = 1, /* During initialization set GPIO = HIGH */
  664. };
  665. #endif
  666. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  667. #include <linux/input.h>
  668. #include <linux/spi/adxl34x.h>
  669. static const struct adxl34x_platform_data adxl34x_info = {
  670. .x_axis_offset = 0,
  671. .y_axis_offset = 0,
  672. .z_axis_offset = 0,
  673. .tap_threshold = 0x31,
  674. .tap_duration = 0x10,
  675. .tap_latency = 0x60,
  676. .tap_window = 0xF0,
  677. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  678. .act_axis_control = 0xFF,
  679. .activity_threshold = 5,
  680. .inactivity_threshold = 3,
  681. .inactivity_time = 4,
  682. .free_fall_threshold = 0x7,
  683. .free_fall_time = 0x20,
  684. .data_rate = 0x8,
  685. .data_range = ADXL_FULL_RES,
  686. .ev_type = EV_ABS,
  687. .ev_code_x = ABS_X, /* EV_REL */
  688. .ev_code_y = ABS_Y, /* EV_REL */
  689. .ev_code_z = ABS_Z, /* EV_REL */
  690. .ev_code_tap_x = BTN_TOUCH, /* EV_KEY */
  691. .ev_code_tap_y = BTN_TOUCH, /* EV_KEY */
  692. .ev_code_tap_z = BTN_TOUCH, /* EV_KEY */
  693. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  694. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  695. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  696. .fifo_mode = ADXL_FIFO_STREAM,
  697. };
  698. #endif
  699. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  700. static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
  701. .enable_dma = 0,
  702. .bits_per_word = 16,
  703. };
  704. #endif
  705. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  706. static struct bfin5xx_spi_chip spidev_chip_info = {
  707. .enable_dma = 0,
  708. .bits_per_word = 8,
  709. };
  710. #endif
  711. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  712. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  713. .enable_dma = 0,
  714. .bits_per_word = 8,
  715. };
  716. #endif
  717. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  718. static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
  719. .enable_dma = 1,
  720. .bits_per_word = 8,
  721. .cs_gpio = GPIO_PF10,
  722. };
  723. #endif
  724. #if defined(CONFIG_MTD_DATAFLASH) \
  725. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  726. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  727. {
  728. .name = "bootloader(spi)",
  729. .size = 0x00040000,
  730. .offset = 0,
  731. .mask_flags = MTD_CAP_ROM
  732. }, {
  733. .name = "linux kernel(spi)",
  734. .size = 0x180000,
  735. .offset = MTDPART_OFS_APPEND,
  736. }, {
  737. .name = "file system(spi)",
  738. .size = MTDPART_SIZ_FULL,
  739. .offset = MTDPART_OFS_APPEND,
  740. }
  741. };
  742. static struct flash_platform_data bfin_spi_dataflash_data = {
  743. .name = "SPI Dataflash",
  744. .parts = bfin_spi_dataflash_partitions,
  745. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  746. };
  747. /* DataFlash chip */
  748. static struct bfin5xx_spi_chip data_flash_chip_info = {
  749. .enable_dma = 0, /* use dma transfer with this chip*/
  750. .bits_per_word = 8,
  751. };
  752. #endif
  753. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  754. #if defined(CONFIG_MTD_M25P80) \
  755. || defined(CONFIG_MTD_M25P80_MODULE)
  756. {
  757. /* the modalias must be the same as spi device driver name */
  758. .modalias = "m25p80", /* Name of spi_driver for this device */
  759. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  760. .bus_num = 0, /* Framework bus number */
  761. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  762. .platform_data = &bfin_spi_flash_data,
  763. .controller_data = &spi_flash_chip_info,
  764. .mode = SPI_MODE_3,
  765. },
  766. #endif
  767. #if defined(CONFIG_MTD_DATAFLASH) \
  768. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  769. { /* DataFlash chip */
  770. .modalias = "mtd_dataflash",
  771. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  772. .bus_num = 0, /* Framework bus number */
  773. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  774. .platform_data = &bfin_spi_dataflash_data,
  775. .controller_data = &data_flash_chip_info,
  776. .mode = SPI_MODE_3,
  777. },
  778. #endif
  779. #if defined(CONFIG_BFIN_SPI_ADC) \
  780. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  781. {
  782. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  783. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  784. .bus_num = 0, /* Framework bus number */
  785. .chip_select = 1, /* Framework chip select. */
  786. .platform_data = NULL, /* No spi_driver specific config */
  787. .controller_data = &spi_adc_chip_info,
  788. },
  789. #endif
  790. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
  791. || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  792. {
  793. .modalias = "ad1836",
  794. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  795. .bus_num = 0,
  796. .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
  797. .controller_data = &ad1836_spi_chip_info,
  798. .mode = SPI_MODE_3,
  799. },
  800. #endif
  801. #if defined(CONFIG_SND_BF5XX_SOC_AD1938) || defined(CONFIG_SND_BF5XX_SOC_AD1938_MODULE)
  802. {
  803. .modalias = "ad1938",
  804. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  805. .bus_num = 0,
  806. .chip_select = 0,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
  807. .controller_data = &ad1938_spi_chip_info,
  808. .mode = SPI_MODE_3,
  809. },
  810. #endif
  811. #if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
  812. {
  813. .modalias = "ad714x_captouch",
  814. .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
  815. .irq = IRQ_PF4,
  816. .bus_num = 0,
  817. .chip_select = 5,
  818. .mode = SPI_MODE_3,
  819. .platform_data = &ad7147_platfrom_data,
  820. .controller_data = &ad7147_spi_chip_info,
  821. },
  822. #endif
  823. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  824. {
  825. .modalias = "mmc_spi",
  826. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  827. .bus_num = 0,
  828. .chip_select = 4,
  829. .platform_data = &bfin_mmc_spi_pdata,
  830. .controller_data = &mmc_spi_chip_info,
  831. .mode = SPI_MODE_3,
  832. },
  833. #endif
  834. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  835. {
  836. .modalias = "ad7877",
  837. .platform_data = &bfin_ad7877_ts_info,
  838. .irq = IRQ_PF6,
  839. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  840. .bus_num = 0,
  841. .chip_select = 1,
  842. .controller_data = &spi_ad7877_chip_info,
  843. },
  844. #endif
  845. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  846. {
  847. .modalias = "ad7879",
  848. .platform_data = &bfin_ad7879_ts_info,
  849. .irq = IRQ_PF7,
  850. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  851. .bus_num = 0,
  852. .chip_select = 1,
  853. .controller_data = &spi_ad7879_chip_info,
  854. .mode = SPI_CPHA | SPI_CPOL,
  855. },
  856. #endif
  857. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  858. {
  859. .modalias = "spidev",
  860. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  861. .bus_num = 0,
  862. .chip_select = 1,
  863. .controller_data = &spidev_chip_info,
  864. },
  865. #endif
  866. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  867. {
  868. .modalias = "bfin-lq035q1-spi",
  869. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  870. .bus_num = 0,
  871. .chip_select = 2,
  872. .controller_data = &lq035q1_spi_chip_info,
  873. .mode = SPI_CPHA | SPI_CPOL,
  874. },
  875. #endif
  876. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  877. {
  878. .modalias = "enc28j60",
  879. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  880. .irq = IRQ_PF6,
  881. .bus_num = 0,
  882. .chip_select = 0, /* GPIO controlled SSEL */
  883. .controller_data = &enc28j60_spi_chip_info,
  884. .mode = SPI_MODE_0,
  885. },
  886. #endif
  887. };
  888. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  889. /* SPI controller data */
  890. static struct bfin5xx_spi_master bfin_spi0_info = {
  891. .num_chipselect = 8,
  892. .enable_dma = 1, /* master has the ability to do dma transfer */
  893. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  894. };
  895. /* SPI (0) */
  896. static struct resource bfin_spi0_resource[] = {
  897. [0] = {
  898. .start = SPI0_REGBASE,
  899. .end = SPI0_REGBASE + 0xFF,
  900. .flags = IORESOURCE_MEM,
  901. },
  902. [1] = {
  903. .start = CH_SPI,
  904. .end = CH_SPI,
  905. .flags = IORESOURCE_DMA,
  906. },
  907. [2] = {
  908. .start = IRQ_SPI,
  909. .end = IRQ_SPI,
  910. .flags = IORESOURCE_IRQ,
  911. },
  912. };
  913. static struct platform_device bfin_spi0_device = {
  914. .name = "bfin-spi",
  915. .id = 0, /* Bus number */
  916. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  917. .resource = bfin_spi0_resource,
  918. .dev = {
  919. .platform_data = &bfin_spi0_info, /* Passed to driver */
  920. },
  921. };
  922. #endif /* spi master and devices */
  923. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  924. /* SPORT SPI controller data */
  925. static struct bfin5xx_spi_master bfin_sport_spi0_info = {
  926. .num_chipselect = 1, /* master only supports one device */
  927. .enable_dma = 0, /* master don't support DMA */
  928. .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
  929. P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
  930. };
  931. static struct resource bfin_sport_spi0_resource[] = {
  932. [0] = {
  933. .start = SPORT0_TCR1,
  934. .end = SPORT0_TCR1 + 0xFF,
  935. .flags = IORESOURCE_MEM,
  936. },
  937. [1] = {
  938. .start = IRQ_SPORT0_ERROR,
  939. .end = IRQ_SPORT0_ERROR,
  940. .flags = IORESOURCE_IRQ,
  941. },
  942. };
  943. static struct platform_device bfin_sport_spi0_device = {
  944. .name = "bfin-sport-spi",
  945. .id = 1, /* Bus number */
  946. .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
  947. .resource = bfin_sport_spi0_resource,
  948. .dev = {
  949. .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
  950. },
  951. };
  952. static struct bfin5xx_spi_master bfin_sport_spi1_info = {
  953. .num_chipselect = 1, /* master only supports one device */
  954. .enable_dma = 0, /* master don't support DMA */
  955. .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
  956. P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
  957. };
  958. static struct resource bfin_sport_spi1_resource[] = {
  959. [0] = {
  960. .start = SPORT1_TCR1,
  961. .end = SPORT1_TCR1 + 0xFF,
  962. .flags = IORESOURCE_MEM,
  963. },
  964. [1] = {
  965. .start = IRQ_SPORT1_ERROR,
  966. .end = IRQ_SPORT1_ERROR,
  967. .flags = IORESOURCE_IRQ,
  968. },
  969. };
  970. static struct platform_device bfin_sport_spi1_device = {
  971. .name = "bfin-sport-spi",
  972. .id = 2, /* Bus number */
  973. .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
  974. .resource = bfin_sport_spi1_resource,
  975. .dev = {
  976. .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
  977. },
  978. };
  979. #endif /* sport spi master and devices */
  980. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  981. static struct platform_device bfin_fb_device = {
  982. .name = "bf537-lq035",
  983. };
  984. #endif
  985. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  986. static struct platform_device bfin_fb_adv7393_device = {
  987. .name = "bfin-adv7393",
  988. };
  989. #endif
  990. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  991. #include <asm/bfin-lq035q1.h>
  992. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  993. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  994. .use_bl = 0, /* let something else control the LCD Blacklight */
  995. .gpio_bl = GPIO_PF7,
  996. };
  997. static struct resource bfin_lq035q1_resources[] = {
  998. {
  999. .start = IRQ_PPI_ERROR,
  1000. .end = IRQ_PPI_ERROR,
  1001. .flags = IORESOURCE_IRQ,
  1002. },
  1003. };
  1004. static struct platform_device bfin_lq035q1_device = {
  1005. .name = "bfin-lq035q1",
  1006. .id = -1,
  1007. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  1008. .resource = bfin_lq035q1_resources,
  1009. .dev = {
  1010. .platform_data = &bfin_lq035q1_data,
  1011. },
  1012. };
  1013. #endif
  1014. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1015. static struct resource bfin_uart_resources[] = {
  1016. #ifdef CONFIG_SERIAL_BFIN_UART0
  1017. {
  1018. .start = 0xFFC00400,
  1019. .end = 0xFFC004FF,
  1020. .flags = IORESOURCE_MEM,
  1021. },
  1022. #endif
  1023. #ifdef CONFIG_SERIAL_BFIN_UART1
  1024. {
  1025. .start = 0xFFC02000,
  1026. .end = 0xFFC020FF,
  1027. .flags = IORESOURCE_MEM,
  1028. },
  1029. #endif
  1030. };
  1031. static struct platform_device bfin_uart_device = {
  1032. .name = "bfin-uart",
  1033. .id = 1,
  1034. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  1035. .resource = bfin_uart_resources,
  1036. };
  1037. #endif
  1038. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1039. #ifdef CONFIG_BFIN_SIR0
  1040. static struct resource bfin_sir0_resources[] = {
  1041. {
  1042. .start = 0xFFC00400,
  1043. .end = 0xFFC004FF,
  1044. .flags = IORESOURCE_MEM,
  1045. },
  1046. {
  1047. .start = IRQ_UART0_RX,
  1048. .end = IRQ_UART0_RX+1,
  1049. .flags = IORESOURCE_IRQ,
  1050. },
  1051. {
  1052. .start = CH_UART0_RX,
  1053. .end = CH_UART0_RX+1,
  1054. .flags = IORESOURCE_DMA,
  1055. },
  1056. };
  1057. static struct platform_device bfin_sir0_device = {
  1058. .name = "bfin_sir",
  1059. .id = 0,
  1060. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  1061. .resource = bfin_sir0_resources,
  1062. };
  1063. #endif
  1064. #ifdef CONFIG_BFIN_SIR1
  1065. static struct resource bfin_sir1_resources[] = {
  1066. {
  1067. .start = 0xFFC02000,
  1068. .end = 0xFFC020FF,
  1069. .flags = IORESOURCE_MEM,
  1070. },
  1071. {
  1072. .start = IRQ_UART1_RX,
  1073. .end = IRQ_UART1_RX+1,
  1074. .flags = IORESOURCE_IRQ,
  1075. },
  1076. {
  1077. .start = CH_UART1_RX,
  1078. .end = CH_UART1_RX+1,
  1079. .flags = IORESOURCE_DMA,
  1080. },
  1081. };
  1082. static struct platform_device bfin_sir1_device = {
  1083. .name = "bfin_sir",
  1084. .id = 1,
  1085. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  1086. .resource = bfin_sir1_resources,
  1087. };
  1088. #endif
  1089. #endif
  1090. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1091. static struct resource bfin_twi0_resource[] = {
  1092. [0] = {
  1093. .start = TWI0_REGBASE,
  1094. .end = TWI0_REGBASE,
  1095. .flags = IORESOURCE_MEM,
  1096. },
  1097. [1] = {
  1098. .start = IRQ_TWI,
  1099. .end = IRQ_TWI,
  1100. .flags = IORESOURCE_IRQ,
  1101. },
  1102. };
  1103. static struct platform_device i2c_bfin_twi_device = {
  1104. .name = "i2c-bfin-twi",
  1105. .id = 0,
  1106. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1107. .resource = bfin_twi0_resource,
  1108. };
  1109. #endif
  1110. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1111. #include <linux/input.h>
  1112. #include <linux/i2c/adp5588.h>
  1113. static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
  1114. [0] = KEY_GRAVE,
  1115. [1] = KEY_1,
  1116. [2] = KEY_2,
  1117. [3] = KEY_3,
  1118. [4] = KEY_4,
  1119. [5] = KEY_5,
  1120. [6] = KEY_6,
  1121. [7] = KEY_7,
  1122. [8] = KEY_8,
  1123. [9] = KEY_9,
  1124. [10] = KEY_0,
  1125. [11] = KEY_MINUS,
  1126. [12] = KEY_EQUAL,
  1127. [13] = KEY_BACKSLASH,
  1128. [15] = KEY_KP0,
  1129. [16] = KEY_Q,
  1130. [17] = KEY_W,
  1131. [18] = KEY_E,
  1132. [19] = KEY_R,
  1133. [20] = KEY_T,
  1134. [21] = KEY_Y,
  1135. [22] = KEY_U,
  1136. [23] = KEY_I,
  1137. [24] = KEY_O,
  1138. [25] = KEY_P,
  1139. [26] = KEY_LEFTBRACE,
  1140. [27] = KEY_RIGHTBRACE,
  1141. [29] = KEY_KP1,
  1142. [30] = KEY_KP2,
  1143. [31] = KEY_KP3,
  1144. [32] = KEY_A,
  1145. [33] = KEY_S,
  1146. [34] = KEY_D,
  1147. [35] = KEY_F,
  1148. [36] = KEY_G,
  1149. [37] = KEY_H,
  1150. [38] = KEY_J,
  1151. [39] = KEY_K,
  1152. [40] = KEY_L,
  1153. [41] = KEY_SEMICOLON,
  1154. [42] = KEY_APOSTROPHE,
  1155. [43] = KEY_BACKSLASH,
  1156. [45] = KEY_KP4,
  1157. [46] = KEY_KP5,
  1158. [47] = KEY_KP6,
  1159. [48] = KEY_102ND,
  1160. [49] = KEY_Z,
  1161. [50] = KEY_X,
  1162. [51] = KEY_C,
  1163. [52] = KEY_V,
  1164. [53] = KEY_B,
  1165. [54] = KEY_N,
  1166. [55] = KEY_M,
  1167. [56] = KEY_COMMA,
  1168. [57] = KEY_DOT,
  1169. [58] = KEY_SLASH,
  1170. [60] = KEY_KPDOT,
  1171. [61] = KEY_KP7,
  1172. [62] = KEY_KP8,
  1173. [63] = KEY_KP9,
  1174. [64] = KEY_SPACE,
  1175. [65] = KEY_BACKSPACE,
  1176. [66] = KEY_TAB,
  1177. [67] = KEY_KPENTER,
  1178. [68] = KEY_ENTER,
  1179. [69] = KEY_ESC,
  1180. [70] = KEY_DELETE,
  1181. [74] = KEY_KPMINUS,
  1182. [76] = KEY_UP,
  1183. [77] = KEY_DOWN,
  1184. [78] = KEY_RIGHT,
  1185. [79] = KEY_LEFT,
  1186. };
  1187. static struct adp5588_kpad_platform_data adp5588_kpad_data = {
  1188. .rows = 8,
  1189. .cols = 10,
  1190. .keymap = adp5588_keymap,
  1191. .keymapsize = ARRAY_SIZE(adp5588_keymap),
  1192. .repeat = 0,
  1193. };
  1194. #endif
  1195. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1196. #include <linux/mfd/adp5520.h>
  1197. /*
  1198. * ADP5520/5501 Backlight Data
  1199. */
  1200. static struct adp5520_backlight_platfrom_data adp5520_backlight_data = {
  1201. .fade_in = FADE_T_1200ms,
  1202. .fade_out = FADE_T_1200ms,
  1203. .fade_led_law = BL_LAW_LINEAR,
  1204. .en_ambl_sens = 1,
  1205. .abml_filt = BL_AMBL_FILT_640ms,
  1206. .l1_daylight_max = BL_CUR_mA(15),
  1207. .l1_daylight_dim = BL_CUR_mA(0),
  1208. .l2_office_max = BL_CUR_mA(7),
  1209. .l2_office_dim = BL_CUR_mA(0),
  1210. .l3_dark_max = BL_CUR_mA(3),
  1211. .l3_dark_dim = BL_CUR_mA(0),
  1212. .l2_trip = L2_COMP_CURR_uA(700),
  1213. .l2_hyst = L2_COMP_CURR_uA(50),
  1214. .l3_trip = L3_COMP_CURR_uA(80),
  1215. .l3_hyst = L3_COMP_CURR_uA(20),
  1216. };
  1217. /*
  1218. * ADP5520/5501 LEDs Data
  1219. */
  1220. #include <linux/leds.h>
  1221. static struct led_info adp5520_leds[] = {
  1222. {
  1223. .name = "adp5520-led1",
  1224. .default_trigger = "none",
  1225. .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | LED_OFFT_600ms,
  1226. },
  1227. #ifdef ADP5520_EN_ALL_LEDS
  1228. {
  1229. .name = "adp5520-led2",
  1230. .default_trigger = "none",
  1231. .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
  1232. },
  1233. {
  1234. .name = "adp5520-led3",
  1235. .default_trigger = "none",
  1236. .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
  1237. },
  1238. #endif
  1239. };
  1240. static struct adp5520_leds_platfrom_data adp5520_leds_data = {
  1241. .num_leds = ARRAY_SIZE(adp5520_leds),
  1242. .leds = adp5520_leds,
  1243. .fade_in = FADE_T_600ms,
  1244. .fade_out = FADE_T_600ms,
  1245. .led_on_time = LED_ONT_600ms,
  1246. };
  1247. /*
  1248. * ADP5520 GPIO Data
  1249. */
  1250. static struct adp5520_gpio_platfrom_data adp5520_gpio_data = {
  1251. .gpio_start = 50,
  1252. .gpio_en_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
  1253. .gpio_pullup_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
  1254. };
  1255. /*
  1256. * ADP5520 Keypad Data
  1257. */
  1258. #include <linux/input.h>
  1259. static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
  1260. [KEY(0, 0)] = KEY_GRAVE,
  1261. [KEY(0, 1)] = KEY_1,
  1262. [KEY(0, 2)] = KEY_2,
  1263. [KEY(0, 3)] = KEY_3,
  1264. [KEY(1, 0)] = KEY_4,
  1265. [KEY(1, 1)] = KEY_5,
  1266. [KEY(1, 2)] = KEY_6,
  1267. [KEY(1, 3)] = KEY_7,
  1268. [KEY(2, 0)] = KEY_8,
  1269. [KEY(2, 1)] = KEY_9,
  1270. [KEY(2, 2)] = KEY_0,
  1271. [KEY(2, 3)] = KEY_MINUS,
  1272. [KEY(3, 0)] = KEY_EQUAL,
  1273. [KEY(3, 1)] = KEY_BACKSLASH,
  1274. [KEY(3, 2)] = KEY_BACKSPACE,
  1275. [KEY(3, 3)] = KEY_ENTER,
  1276. };
  1277. static struct adp5520_keys_platfrom_data adp5520_keys_data = {
  1278. .rows_en_mask = ROW_R3 | ROW_R2 | ROW_R1 | ROW_R0,
  1279. .cols_en_mask = COL_C3 | COL_C2 | COL_C1 | COL_C0,
  1280. .keymap = adp5520_keymap,
  1281. .keymapsize = ARRAY_SIZE(adp5520_keymap),
  1282. .repeat = 0,
  1283. };
  1284. /*
  1285. * ADP5520/5501 Multifuction Device Init Data
  1286. */
  1287. static struct adp5520_subdev_info adp5520_subdevs[] = {
  1288. {
  1289. .name = "adp5520-backlight",
  1290. .id = ID_ADP5520,
  1291. .platform_data = &adp5520_backlight_data,
  1292. },
  1293. {
  1294. .name = "adp5520-led",
  1295. .id = ID_ADP5520,
  1296. .platform_data = &adp5520_leds_data,
  1297. },
  1298. {
  1299. .name = "adp5520-gpio",
  1300. .id = ID_ADP5520,
  1301. .platform_data = &adp5520_gpio_data,
  1302. },
  1303. {
  1304. .name = "adp5520-keys",
  1305. .id = ID_ADP5520,
  1306. .platform_data = &adp5520_keys_data,
  1307. },
  1308. };
  1309. static struct adp5520_platform_data adp5520_pdev_data = {
  1310. .num_subdevs = ARRAY_SIZE(adp5520_subdevs),
  1311. .subdevs = adp5520_subdevs,
  1312. };
  1313. #endif
  1314. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  1315. #if defined(CONFIG_INPUT_EVAL_AD7142EB)
  1316. {
  1317. I2C_BOARD_INFO("ad7142_captouch", 0x2C),
  1318. .irq = IRQ_PG5,
  1319. .platform_data = (void *)&ad7142_platfrom_data,
  1320. },
  1321. #endif
  1322. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1323. {
  1324. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1325. },
  1326. #endif
  1327. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  1328. {
  1329. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1330. .irq = IRQ_PG6,
  1331. },
  1332. #endif
  1333. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  1334. {
  1335. I2C_BOARD_INFO("ad7879", 0x2F),
  1336. .irq = IRQ_PG5,
  1337. .platform_data = (void *)&bfin_ad7879_ts_info,
  1338. },
  1339. #endif
  1340. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1341. {
  1342. I2C_BOARD_INFO("adp5588-keys", 0x34),
  1343. .irq = IRQ_PG0,
  1344. .platform_data = (void *)&adp5588_kpad_data,
  1345. },
  1346. #endif
  1347. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1348. {
  1349. I2C_BOARD_INFO("pmic-adp5520", 0x32),
  1350. .irq = IRQ_PG0,
  1351. .platform_data = (void *)&adp5520_pdev_data,
  1352. },
  1353. #endif
  1354. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1355. {
  1356. I2C_BOARD_INFO("adxl34x", 0x53),
  1357. .irq = IRQ_PG3,
  1358. .platform_data = (void *)&adxl34x_info,
  1359. },
  1360. #endif
  1361. };
  1362. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1363. static struct platform_device bfin_sport0_uart_device = {
  1364. .name = "bfin-sport-uart",
  1365. .id = 0,
  1366. };
  1367. static struct platform_device bfin_sport1_uart_device = {
  1368. .name = "bfin-sport-uart",
  1369. .id = 1,
  1370. };
  1371. #endif
  1372. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1373. #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1374. /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
  1375. #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1376. #define PATA_INT IRQ_PF5
  1377. static struct pata_platform_info bfin_pata_platform_data = {
  1378. .ioport_shift = 1,
  1379. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  1380. };
  1381. static struct resource bfin_pata_resources[] = {
  1382. {
  1383. .start = 0x20314020,
  1384. .end = 0x2031403F,
  1385. .flags = IORESOURCE_MEM,
  1386. },
  1387. {
  1388. .start = 0x2031401C,
  1389. .end = 0x2031401F,
  1390. .flags = IORESOURCE_MEM,
  1391. },
  1392. {
  1393. .start = PATA_INT,
  1394. .end = PATA_INT,
  1395. .flags = IORESOURCE_IRQ,
  1396. },
  1397. };
  1398. #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
  1399. static struct pata_platform_info bfin_pata_platform_data = {
  1400. .ioport_shift = 0,
  1401. };
  1402. /* CompactFlash Storage Card Memory Mapped Adressing
  1403. * /REG = A11 = 1
  1404. */
  1405. static struct resource bfin_pata_resources[] = {
  1406. {
  1407. .start = 0x20211800,
  1408. .end = 0x20211807,
  1409. .flags = IORESOURCE_MEM,
  1410. },
  1411. {
  1412. .start = 0x2021180E, /* Device Ctl */
  1413. .end = 0x2021180E,
  1414. .flags = IORESOURCE_MEM,
  1415. },
  1416. };
  1417. #endif
  1418. static struct platform_device bfin_pata_device = {
  1419. .name = "pata_platform",
  1420. .id = -1,
  1421. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  1422. .resource = bfin_pata_resources,
  1423. .dev = {
  1424. .platform_data = &bfin_pata_platform_data,
  1425. }
  1426. };
  1427. #endif
  1428. static const unsigned int cclk_vlev_datasheet[] =
  1429. {
  1430. VRPAIR(VLEV_085, 250000000),
  1431. VRPAIR(VLEV_090, 376000000),
  1432. VRPAIR(VLEV_095, 426000000),
  1433. VRPAIR(VLEV_100, 426000000),
  1434. VRPAIR(VLEV_105, 476000000),
  1435. VRPAIR(VLEV_110, 476000000),
  1436. VRPAIR(VLEV_115, 476000000),
  1437. VRPAIR(VLEV_120, 500000000),
  1438. VRPAIR(VLEV_125, 533000000),
  1439. VRPAIR(VLEV_130, 600000000),
  1440. };
  1441. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1442. .tuple_tab = cclk_vlev_datasheet,
  1443. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1444. .vr_settling_time = 25 /* us */,
  1445. };
  1446. static struct platform_device bfin_dpmc = {
  1447. .name = "bfin dpmc",
  1448. .dev = {
  1449. .platform_data = &bfin_dmpc_vreg_data,
  1450. },
  1451. };
  1452. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1453. static struct platform_device bfin_tdm = {
  1454. .name = "bfin-tdm",
  1455. /* TODO: add platform data here */
  1456. };
  1457. #endif
  1458. static struct platform_device *stamp_devices[] __initdata = {
  1459. &bfin_dpmc,
  1460. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  1461. &bfin_pcmcia_cf_device,
  1462. #endif
  1463. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1464. &rtc_device,
  1465. #endif
  1466. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  1467. &sl811_hcd_device,
  1468. #endif
  1469. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  1470. &isp1362_hcd_device,
  1471. #endif
  1472. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1473. &bfin_isp1760_device,
  1474. #endif
  1475. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  1476. &smc91x_device,
  1477. #endif
  1478. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  1479. &dm9000_device,
  1480. #endif
  1481. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  1482. &ax88180_device,
  1483. #endif
  1484. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  1485. &bfin_mii_bus,
  1486. &bfin_mac_device,
  1487. #endif
  1488. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  1489. &net2272_bfin_device,
  1490. #endif
  1491. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1492. &bfin_spi0_device,
  1493. #endif
  1494. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  1495. &bfin_sport_spi0_device,
  1496. &bfin_sport_spi1_device,
  1497. #endif
  1498. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  1499. &bfin_fb_device,
  1500. #endif
  1501. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  1502. &bfin_lq035q1_device,
  1503. #endif
  1504. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  1505. &bfin_fb_adv7393_device,
  1506. #endif
  1507. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1508. &bfin_uart_device,
  1509. #endif
  1510. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1511. #ifdef CONFIG_BFIN_SIR0
  1512. &bfin_sir0_device,
  1513. #endif
  1514. #ifdef CONFIG_BFIN_SIR1
  1515. &bfin_sir1_device,
  1516. #endif
  1517. #endif
  1518. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1519. &i2c_bfin_twi_device,
  1520. #endif
  1521. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1522. &bfin_sport0_uart_device,
  1523. &bfin_sport1_uart_device,
  1524. #endif
  1525. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1526. &bfin_pata_device,
  1527. #endif
  1528. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1529. &bfin_device_gpiokeys,
  1530. #endif
  1531. &bfin_gpios_device,
  1532. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  1533. &bfin_async_nand_device,
  1534. #endif
  1535. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1536. &stamp_flash_device,
  1537. #endif
  1538. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1539. &bfin_tdm,
  1540. #endif
  1541. };
  1542. static int __init stamp_init(void)
  1543. {
  1544. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1545. i2c_register_board_info(0, bfin_i2c_board_info,
  1546. ARRAY_SIZE(bfin_i2c_board_info));
  1547. bfin_plat_nand_init();
  1548. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  1549. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1550. return 0;
  1551. }
  1552. arch_initcall(stamp_init);
  1553. void native_machine_restart(char *cmd)
  1554. {
  1555. /* workaround reboot hang when booting from SPI */
  1556. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  1557. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  1558. }
  1559. /*
  1560. * Currently the MAC address is saved in Flash by U-Boot
  1561. */
  1562. #define FLASH_MAC 0x203f0000
  1563. void bfin_get_ether_addr(char *addr)
  1564. {
  1565. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  1566. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  1567. }
  1568. EXPORT_SYMBOL(bfin_get_ether_addr);