stamp.c 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/kernel.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/io.h>
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/nand.h>
  14. #include <linux/mtd/partitions.h>
  15. #include <linux/mtd/plat-ram.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <linux/spi/spi.h>
  18. #include <linux/spi/flash.h>
  19. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  20. #include <linux/usb/isp1362.h>
  21. #endif
  22. #include <linux/i2c.h>
  23. #include <linux/i2c/adp5588.h>
  24. #include <linux/etherdevice.h>
  25. #include <linux/ata_platform.h>
  26. #include <linux/irq.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/usb/sl811.h>
  29. #include <linux/spi/mmc_spi.h>
  30. #include <linux/leds.h>
  31. #include <linux/input.h>
  32. #include <asm/dma.h>
  33. #include <asm/bfin5xx_spi.h>
  34. #include <asm/reboot.h>
  35. #include <asm/portmux.h>
  36. #include <asm/dpmc.h>
  37. #ifdef CONFIG_REGULATOR_ADP_SWITCH
  38. #include <linux/regulator/adp_switch.h>
  39. #endif
  40. #ifdef CONFIG_REGULATOR_AD5398
  41. #include <linux/regulator/ad5398.h>
  42. #endif
  43. #include <linux/regulator/consumer.h>
  44. #include <linux/regulator/userspace-consumer.h>
  45. /*
  46. * Name the Board for the /proc/cpuinfo
  47. */
  48. const char bfin_board_name[] = "ADI BF537-STAMP";
  49. /*
  50. * Driver needs to know address, irq and flag pin.
  51. */
  52. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  53. #include <linux/usb/isp1760.h>
  54. static struct resource bfin_isp1760_resources[] = {
  55. [0] = {
  56. .start = 0x203C0000,
  57. .end = 0x203C0000 + 0x000fffff,
  58. .flags = IORESOURCE_MEM,
  59. },
  60. [1] = {
  61. .start = IRQ_PF7,
  62. .end = IRQ_PF7,
  63. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  64. },
  65. };
  66. static struct isp1760_platform_data isp1760_priv = {
  67. .is_isp1761 = 0,
  68. .bus_width_16 = 1,
  69. .port1_otg = 0,
  70. .analog_oc = 0,
  71. .dack_polarity_high = 0,
  72. .dreq_polarity_high = 0,
  73. };
  74. static struct platform_device bfin_isp1760_device = {
  75. .name = "isp1760",
  76. .id = 0,
  77. .dev = {
  78. .platform_data = &isp1760_priv,
  79. },
  80. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  81. .resource = bfin_isp1760_resources,
  82. };
  83. #endif
  84. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  85. #include <linux/gpio_keys.h>
  86. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  87. {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
  88. {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
  89. {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
  90. {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
  91. };
  92. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  93. .buttons = bfin_gpio_keys_table,
  94. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  95. };
  96. static struct platform_device bfin_device_gpiokeys = {
  97. .name = "gpio-keys",
  98. .dev = {
  99. .platform_data = &bfin_gpio_keys_data,
  100. },
  101. };
  102. #endif
  103. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  104. static struct resource bfin_pcmcia_cf_resources[] = {
  105. {
  106. .start = 0x20310000, /* IO PORT */
  107. .end = 0x20312000,
  108. .flags = IORESOURCE_MEM,
  109. }, {
  110. .start = 0x20311000, /* Attribute Memory */
  111. .end = 0x20311FFF,
  112. .flags = IORESOURCE_MEM,
  113. }, {
  114. .start = IRQ_PF4,
  115. .end = IRQ_PF4,
  116. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  117. }, {
  118. .start = 6, /* Card Detect PF6 */
  119. .end = 6,
  120. .flags = IORESOURCE_IRQ,
  121. },
  122. };
  123. static struct platform_device bfin_pcmcia_cf_device = {
  124. .name = "bfin_cf_pcmcia",
  125. .id = -1,
  126. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  127. .resource = bfin_pcmcia_cf_resources,
  128. };
  129. #endif
  130. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  131. static struct platform_device rtc_device = {
  132. .name = "rtc-bfin",
  133. .id = -1,
  134. };
  135. #endif
  136. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  137. #include <linux/smc91x.h>
  138. static struct smc91x_platdata smc91x_info = {
  139. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  140. .leda = RPC_LED_100_10,
  141. .ledb = RPC_LED_TX_RX,
  142. };
  143. static struct resource smc91x_resources[] = {
  144. {
  145. .name = "smc91x-regs",
  146. .start = 0x20300300,
  147. .end = 0x20300300 + 16,
  148. .flags = IORESOURCE_MEM,
  149. }, {
  150. .start = IRQ_PF7,
  151. .end = IRQ_PF7,
  152. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  153. },
  154. };
  155. static struct platform_device smc91x_device = {
  156. .name = "smc91x",
  157. .id = 0,
  158. .num_resources = ARRAY_SIZE(smc91x_resources),
  159. .resource = smc91x_resources,
  160. .dev = {
  161. .platform_data = &smc91x_info,
  162. },
  163. };
  164. #endif
  165. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  166. static struct resource dm9000_resources[] = {
  167. [0] = {
  168. .start = 0x203FB800,
  169. .end = 0x203FB800 + 1,
  170. .flags = IORESOURCE_MEM,
  171. },
  172. [1] = {
  173. .start = 0x203FB804,
  174. .end = 0x203FB804 + 1,
  175. .flags = IORESOURCE_MEM,
  176. },
  177. [2] = {
  178. .start = IRQ_PF9,
  179. .end = IRQ_PF9,
  180. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  181. },
  182. };
  183. static struct platform_device dm9000_device = {
  184. .name = "dm9000",
  185. .id = -1,
  186. .num_resources = ARRAY_SIZE(dm9000_resources),
  187. .resource = dm9000_resources,
  188. };
  189. #endif
  190. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  191. static struct resource sl811_hcd_resources[] = {
  192. {
  193. .start = 0x20340000,
  194. .end = 0x20340000,
  195. .flags = IORESOURCE_MEM,
  196. }, {
  197. .start = 0x20340004,
  198. .end = 0x20340004,
  199. .flags = IORESOURCE_MEM,
  200. }, {
  201. .start = IRQ_PF4,
  202. .end = IRQ_PF4,
  203. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  204. },
  205. };
  206. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  207. void sl811_port_power(struct device *dev, int is_on)
  208. {
  209. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  210. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  211. }
  212. #endif
  213. static struct sl811_platform_data sl811_priv = {
  214. .potpg = 10,
  215. .power = 250, /* == 500mA */
  216. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  217. .port_power = &sl811_port_power,
  218. #endif
  219. };
  220. static struct platform_device sl811_hcd_device = {
  221. .name = "sl811-hcd",
  222. .id = 0,
  223. .dev = {
  224. .platform_data = &sl811_priv,
  225. },
  226. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  227. .resource = sl811_hcd_resources,
  228. };
  229. #endif
  230. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  231. static struct resource isp1362_hcd_resources[] = {
  232. {
  233. .start = 0x20360000,
  234. .end = 0x20360000,
  235. .flags = IORESOURCE_MEM,
  236. }, {
  237. .start = 0x20360004,
  238. .end = 0x20360004,
  239. .flags = IORESOURCE_MEM,
  240. }, {
  241. .start = IRQ_PF3,
  242. .end = IRQ_PF3,
  243. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  244. },
  245. };
  246. static struct isp1362_platform_data isp1362_priv = {
  247. .sel15Kres = 1,
  248. .clknotstop = 0,
  249. .oc_enable = 0,
  250. .int_act_high = 0,
  251. .int_edge_triggered = 0,
  252. .remote_wakeup_connected = 0,
  253. .no_power_switching = 1,
  254. .power_switching_mode = 0,
  255. };
  256. static struct platform_device isp1362_hcd_device = {
  257. .name = "isp1362-hcd",
  258. .id = 0,
  259. .dev = {
  260. .platform_data = &isp1362_priv,
  261. },
  262. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  263. .resource = isp1362_hcd_resources,
  264. };
  265. #endif
  266. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  267. unsigned short bfin_can_peripherals[] = {
  268. P_CAN0_RX, P_CAN0_TX, 0
  269. };
  270. static struct resource bfin_can_resources[] = {
  271. {
  272. .start = 0xFFC02A00,
  273. .end = 0xFFC02FFF,
  274. .flags = IORESOURCE_MEM,
  275. },
  276. {
  277. .start = IRQ_CAN_RX,
  278. .end = IRQ_CAN_RX,
  279. .flags = IORESOURCE_IRQ,
  280. },
  281. {
  282. .start = IRQ_CAN_TX,
  283. .end = IRQ_CAN_TX,
  284. .flags = IORESOURCE_IRQ,
  285. },
  286. {
  287. .start = IRQ_CAN_ERROR,
  288. .end = IRQ_CAN_ERROR,
  289. .flags = IORESOURCE_IRQ,
  290. },
  291. };
  292. static struct platform_device bfin_can_device = {
  293. .name = "bfin_can",
  294. .num_resources = ARRAY_SIZE(bfin_can_resources),
  295. .resource = bfin_can_resources,
  296. .dev = {
  297. .platform_data = &bfin_can_peripherals, /* Passed to driver */
  298. },
  299. };
  300. #endif
  301. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  302. static struct platform_device bfin_mii_bus = {
  303. .name = "bfin_mii_bus",
  304. };
  305. static struct platform_device bfin_mac_device = {
  306. .name = "bfin_mac",
  307. .dev.platform_data = &bfin_mii_bus,
  308. };
  309. #endif
  310. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  311. static struct resource net2272_bfin_resources[] = {
  312. {
  313. .start = 0x20300000,
  314. .end = 0x20300000 + 0x100,
  315. .flags = IORESOURCE_MEM,
  316. }, {
  317. .start = IRQ_PF7,
  318. .end = IRQ_PF7,
  319. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  320. },
  321. };
  322. static struct platform_device net2272_bfin_device = {
  323. .name = "net2272",
  324. .id = -1,
  325. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  326. .resource = net2272_bfin_resources,
  327. };
  328. #endif
  329. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  330. #ifdef CONFIG_MTD_PARTITIONS
  331. const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
  332. static struct mtd_partition bfin_plat_nand_partitions[] = {
  333. {
  334. .name = "linux kernel(nand)",
  335. .size = 0x400000,
  336. .offset = 0,
  337. }, {
  338. .name = "file system(nand)",
  339. .size = MTDPART_SIZ_FULL,
  340. .offset = MTDPART_OFS_APPEND,
  341. },
  342. };
  343. #endif
  344. #define BFIN_NAND_PLAT_CLE 2
  345. #define BFIN_NAND_PLAT_ALE 1
  346. static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  347. {
  348. struct nand_chip *this = mtd->priv;
  349. if (cmd == NAND_CMD_NONE)
  350. return;
  351. if (ctrl & NAND_CLE)
  352. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
  353. else
  354. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
  355. }
  356. #define BFIN_NAND_PLAT_READY GPIO_PF3
  357. static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
  358. {
  359. return gpio_get_value(BFIN_NAND_PLAT_READY);
  360. }
  361. static struct platform_nand_data bfin_plat_nand_data = {
  362. .chip = {
  363. .chip_delay = 30,
  364. #ifdef CONFIG_MTD_PARTITIONS
  365. .part_probe_types = part_probes,
  366. .partitions = bfin_plat_nand_partitions,
  367. .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
  368. #endif
  369. },
  370. .ctrl = {
  371. .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
  372. .dev_ready = bfin_plat_nand_dev_ready,
  373. },
  374. };
  375. #define MAX(x, y) (x > y ? x : y)
  376. static struct resource bfin_plat_nand_resources = {
  377. .start = 0x20212000,
  378. .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
  379. .flags = IORESOURCE_IO,
  380. };
  381. static struct platform_device bfin_async_nand_device = {
  382. .name = "gen_nand",
  383. .id = -1,
  384. .num_resources = 1,
  385. .resource = &bfin_plat_nand_resources,
  386. .dev = {
  387. .platform_data = &bfin_plat_nand_data,
  388. },
  389. };
  390. static void bfin_plat_nand_init(void)
  391. {
  392. gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
  393. }
  394. #else
  395. static void bfin_plat_nand_init(void) {}
  396. #endif
  397. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  398. static struct mtd_partition stamp_partitions[] = {
  399. {
  400. .name = "bootloader(nor)",
  401. .size = 0x40000,
  402. .offset = 0,
  403. }, {
  404. .name = "linux kernel(nor)",
  405. .size = 0x180000,
  406. .offset = MTDPART_OFS_APPEND,
  407. }, {
  408. .name = "file system(nor)",
  409. .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
  410. .offset = MTDPART_OFS_APPEND,
  411. }, {
  412. .name = "MAC Address(nor)",
  413. .size = MTDPART_SIZ_FULL,
  414. .offset = 0x3F0000,
  415. .mask_flags = MTD_WRITEABLE,
  416. }
  417. };
  418. static struct physmap_flash_data stamp_flash_data = {
  419. .width = 2,
  420. .parts = stamp_partitions,
  421. .nr_parts = ARRAY_SIZE(stamp_partitions),
  422. #ifdef CONFIG_ROMKERNEL
  423. .probe_type = "map_rom",
  424. #endif
  425. };
  426. static struct resource stamp_flash_resource = {
  427. .start = 0x20000000,
  428. .end = 0x203fffff,
  429. .flags = IORESOURCE_MEM,
  430. };
  431. static struct platform_device stamp_flash_device = {
  432. .name = "physmap-flash",
  433. .id = 0,
  434. .dev = {
  435. .platform_data = &stamp_flash_data,
  436. },
  437. .num_resources = 1,
  438. .resource = &stamp_flash_resource,
  439. };
  440. #endif
  441. #if defined(CONFIG_MTD_M25P80) \
  442. || defined(CONFIG_MTD_M25P80_MODULE)
  443. static struct mtd_partition bfin_spi_flash_partitions[] = {
  444. {
  445. .name = "bootloader(spi)",
  446. .size = 0x00040000,
  447. .offset = 0,
  448. .mask_flags = MTD_CAP_ROM
  449. }, {
  450. .name = "linux kernel(spi)",
  451. .size = 0x180000,
  452. .offset = MTDPART_OFS_APPEND,
  453. }, {
  454. .name = "file system(spi)",
  455. .size = MTDPART_SIZ_FULL,
  456. .offset = MTDPART_OFS_APPEND,
  457. }
  458. };
  459. static struct flash_platform_data bfin_spi_flash_data = {
  460. .name = "m25p80",
  461. .parts = bfin_spi_flash_partitions,
  462. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  463. /* .type = "m25p64", */
  464. };
  465. /* SPI flash chip (m25p64) */
  466. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  467. .enable_dma = 0, /* use dma transfer with this chip*/
  468. .bits_per_word = 8,
  469. };
  470. #endif
  471. #if defined(CONFIG_BFIN_SPI_ADC) \
  472. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  473. /* SPI ADC chip */
  474. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  475. .enable_dma = 1, /* use dma transfer with this chip*/
  476. .bits_per_word = 16,
  477. };
  478. #endif
  479. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  480. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  481. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  482. .enable_dma = 0,
  483. .bits_per_word = 16,
  484. };
  485. #endif
  486. #if defined(CONFIG_SND_BF5XX_SOC_AD193X) \
  487. || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
  488. static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
  489. .enable_dma = 0,
  490. .bits_per_word = 8,
  491. };
  492. #endif
  493. #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
  494. #include <linux/input/ad714x.h>
  495. static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
  496. .enable_dma = 0,
  497. .bits_per_word = 16,
  498. };
  499. static struct ad714x_slider_plat ad7147_spi_slider_plat[] = {
  500. {
  501. .start_stage = 0,
  502. .end_stage = 7,
  503. .max_coord = 128,
  504. },
  505. };
  506. static struct ad714x_button_plat ad7147_spi_button_plat[] = {
  507. {
  508. .keycode = BTN_FORWARD,
  509. .l_mask = 0,
  510. .h_mask = 0x600,
  511. },
  512. {
  513. .keycode = BTN_LEFT,
  514. .l_mask = 0,
  515. .h_mask = 0x500,
  516. },
  517. {
  518. .keycode = BTN_MIDDLE,
  519. .l_mask = 0,
  520. .h_mask = 0x800,
  521. },
  522. {
  523. .keycode = BTN_RIGHT,
  524. .l_mask = 0x100,
  525. .h_mask = 0x400,
  526. },
  527. {
  528. .keycode = BTN_BACK,
  529. .l_mask = 0x200,
  530. .h_mask = 0x400,
  531. },
  532. };
  533. static struct ad714x_platform_data ad7147_spi_platform_data = {
  534. .slider_num = 1,
  535. .button_num = 5,
  536. .slider = ad7147_spi_slider_plat,
  537. .button = ad7147_spi_button_plat,
  538. .stage_cfg_reg = {
  539. {0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
  540. {0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
  541. {0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
  542. {0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
  543. {0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
  544. {0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
  545. {0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
  546. {0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
  547. {0xFF7B, 0x3FFF, 0x506, 0x2626, 1100, 1100, 1150, 1150},
  548. {0xFDFE, 0x3FFF, 0x606, 0x2626, 1100, 1100, 1150, 1150},
  549. {0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
  550. {0xFFEF, 0x1FFF, 0x0, 0x2626, 1100, 1100, 1150, 1150},
  551. },
  552. .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
  553. };
  554. #endif
  555. #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
  556. #include <linux/input/ad714x.h>
  557. static struct ad714x_button_plat ad7142_i2c_button_plat[] = {
  558. {
  559. .keycode = BTN_1,
  560. .l_mask = 0,
  561. .h_mask = 0x1,
  562. },
  563. {
  564. .keycode = BTN_2,
  565. .l_mask = 0,
  566. .h_mask = 0x2,
  567. },
  568. {
  569. .keycode = BTN_3,
  570. .l_mask = 0,
  571. .h_mask = 0x4,
  572. },
  573. {
  574. .keycode = BTN_4,
  575. .l_mask = 0x0,
  576. .h_mask = 0x8,
  577. },
  578. };
  579. static struct ad714x_platform_data ad7142_i2c_platform_data = {
  580. .button_num = 4,
  581. .button = ad7142_i2c_button_plat,
  582. .stage_cfg_reg = {
  583. /* fixme: figure out right setting for all comoponent according
  584. * to hardware feature of EVAL-AD7142EB board */
  585. {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  586. {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  587. {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  588. {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
  589. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  590. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  591. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  592. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  593. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  594. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  595. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  596. {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
  597. },
  598. .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
  599. };
  600. #endif
  601. #if defined(CONFIG_AD2S90) || defined(CONFIG_AD2S90_MODULE)
  602. static struct bfin5xx_spi_chip ad2s90_spi_chip_info = {
  603. .enable_dma = 0,
  604. .bits_per_word = 16,
  605. };
  606. #endif
  607. #if defined(CONFIG_AD2S120X) || defined(CONFIG_AD2S120X_MODULE)
  608. unsigned short ad2s120x_platform_data[] = {
  609. /* used as SAMPLE and RDVEL */
  610. GPIO_PF5, GPIO_PF6, 0
  611. };
  612. static struct bfin5xx_spi_chip ad2s120x_spi_chip_info = {
  613. .enable_dma = 0,
  614. .bits_per_word = 16,
  615. };
  616. #endif
  617. #if defined(CONFIG_AD2S1210) || defined(CONFIG_AD2S1210_MODULE)
  618. unsigned short ad2s1210_platform_data[] = {
  619. /* use as SAMPLE, A0, A1 */
  620. GPIO_PF7, GPIO_PF8, GPIO_PF9,
  621. # if defined(CONFIG_AD2S1210_GPIO_INPUT) || defined(CONFIG_AD2S1210_GPIO_OUTPUT)
  622. /* the RES0 and RES1 pins */
  623. GPIO_PF4, GPIO_PF5,
  624. # endif
  625. 0,
  626. };
  627. static struct bfin5xx_spi_chip ad2s1210_spi_chip_info = {
  628. .enable_dma = 0,
  629. .bits_per_word = 8,
  630. };
  631. #endif
  632. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  633. #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
  634. static int bfin_mmc_spi_init(struct device *dev,
  635. irqreturn_t (*detect_int)(int, void *), void *data)
  636. {
  637. return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
  638. IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
  639. }
  640. static void bfin_mmc_spi_exit(struct device *dev, void *data)
  641. {
  642. free_irq(MMC_SPI_CARD_DETECT_INT, data);
  643. }
  644. static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
  645. .init = bfin_mmc_spi_init,
  646. .exit = bfin_mmc_spi_exit,
  647. .detect_delay = 100, /* msecs */
  648. };
  649. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  650. .enable_dma = 0,
  651. .bits_per_word = 8,
  652. .pio_interrupt = 0,
  653. };
  654. #endif
  655. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  656. #include <linux/spi/ad7877.h>
  657. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  658. .enable_dma = 0,
  659. .bits_per_word = 16,
  660. };
  661. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  662. .model = 7877,
  663. .vref_delay_usecs = 50, /* internal, no capacitor */
  664. .x_plate_ohms = 419,
  665. .y_plate_ohms = 486,
  666. .pressure_max = 1000,
  667. .pressure_min = 0,
  668. .stopacq_polarity = 1,
  669. .first_conversion_delay = 3,
  670. .acquisition_time = 1,
  671. .averaging = 1,
  672. .pen_down_acc_interval = 1,
  673. };
  674. #endif
  675. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  676. #include <linux/spi/ad7879.h>
  677. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  678. .model = 7879, /* Model = AD7879 */
  679. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  680. .pressure_max = 10000,
  681. .pressure_min = 0,
  682. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  683. .acquisition_time = 1, /* 4us acquisition time per sample */
  684. .median = 2, /* do 8 measurements */
  685. .averaging = 1, /* take the average of 4 middle samples */
  686. .pen_down_acc_interval = 255, /* 9.4 ms */
  687. .gpio_export = 1, /* Export GPIO to gpiolib */
  688. .gpio_base = -1, /* Dynamic allocation */
  689. };
  690. #endif
  691. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  692. #include <linux/input/adxl34x.h>
  693. static const struct adxl34x_platform_data adxl34x_info = {
  694. .x_axis_offset = 0,
  695. .y_axis_offset = 0,
  696. .z_axis_offset = 0,
  697. .tap_threshold = 0x31,
  698. .tap_duration = 0x10,
  699. .tap_latency = 0x60,
  700. .tap_window = 0xF0,
  701. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  702. .act_axis_control = 0xFF,
  703. .activity_threshold = 5,
  704. .inactivity_threshold = 3,
  705. .inactivity_time = 4,
  706. .free_fall_threshold = 0x7,
  707. .free_fall_time = 0x20,
  708. .data_rate = 0x8,
  709. .data_range = ADXL_FULL_RES,
  710. .ev_type = EV_ABS,
  711. .ev_code_x = ABS_X, /* EV_REL */
  712. .ev_code_y = ABS_Y, /* EV_REL */
  713. .ev_code_z = ABS_Z, /* EV_REL */
  714. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  715. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  716. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  717. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  718. .fifo_mode = ADXL_FIFO_STREAM,
  719. };
  720. #endif
  721. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  722. static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
  723. .enable_dma = 0,
  724. .bits_per_word = 16,
  725. };
  726. #endif
  727. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  728. static struct bfin5xx_spi_chip spidev_chip_info = {
  729. .enable_dma = 0,
  730. .bits_per_word = 8,
  731. };
  732. #endif
  733. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  734. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  735. .enable_dma = 0,
  736. .bits_per_word = 8,
  737. };
  738. #endif
  739. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  740. static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
  741. .enable_dma = 1,
  742. .bits_per_word = 8,
  743. .cs_gpio = GPIO_PF10,
  744. };
  745. #endif
  746. #if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
  747. static struct bfin5xx_spi_chip adf7021_spi_chip_info = {
  748. .bits_per_word = 16,
  749. .cs_gpio = GPIO_PF10,
  750. };
  751. #include <linux/spi/adf702x.h>
  752. #define TXREG 0x0160A470
  753. static const u32 adf7021_regs[] = {
  754. 0x09608FA0,
  755. 0x00575011,
  756. 0x00A7F092,
  757. 0x2B141563,
  758. 0x81F29E94,
  759. 0x00003155,
  760. 0x050A4F66,
  761. 0x00000007,
  762. 0x00000008,
  763. 0x000231E9,
  764. 0x3296354A,
  765. 0x891A2B3B,
  766. 0x00000D9C,
  767. 0x0000000D,
  768. 0x0000000E,
  769. 0x0000000F,
  770. };
  771. static struct adf702x_platform_data adf7021_platform_data = {
  772. .regs_base = (void *)SPORT1_TCR1,
  773. .dma_ch_rx = CH_SPORT1_RX,
  774. .dma_ch_tx = CH_SPORT1_TX,
  775. .irq_sport_err = IRQ_SPORT1_ERROR,
  776. .gpio_int_rfs = GPIO_PF8,
  777. .pin_req = {P_SPORT1_DTPRI, P_SPORT1_RFS, P_SPORT1_DRPRI,
  778. P_SPORT1_RSCLK, P_SPORT1_TSCLK, 0},
  779. .adf702x_model = MODEL_ADF7021,
  780. .adf702x_regs = adf7021_regs,
  781. .tx_reg = TXREG,
  782. };
  783. static inline void adf702x_mac_init(void)
  784. {
  785. random_ether_addr(adf7021_platform_data.mac_addr);
  786. }
  787. #else
  788. static inline void adf702x_mac_init(void) {}
  789. #endif
  790. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  791. #include <linux/spi/ads7846.h>
  792. static struct bfin5xx_spi_chip ad7873_spi_chip_info = {
  793. .bits_per_word = 8,
  794. };
  795. static int ads7873_get_pendown_state(void)
  796. {
  797. return gpio_get_value(GPIO_PF6);
  798. }
  799. static struct ads7846_platform_data __initdata ad7873_pdata = {
  800. .model = 7873, /* AD7873 */
  801. .x_max = 0xfff,
  802. .y_max = 0xfff,
  803. .x_plate_ohms = 620,
  804. .debounce_max = 1,
  805. .debounce_rep = 0,
  806. .debounce_tol = (~0),
  807. .get_pendown_state = ads7873_get_pendown_state,
  808. };
  809. #endif
  810. #if defined(CONFIG_MTD_DATAFLASH) \
  811. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  812. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  813. {
  814. .name = "bootloader(spi)",
  815. .size = 0x00040000,
  816. .offset = 0,
  817. .mask_flags = MTD_CAP_ROM
  818. }, {
  819. .name = "linux kernel(spi)",
  820. .size = 0x180000,
  821. .offset = MTDPART_OFS_APPEND,
  822. }, {
  823. .name = "file system(spi)",
  824. .size = MTDPART_SIZ_FULL,
  825. .offset = MTDPART_OFS_APPEND,
  826. }
  827. };
  828. static struct flash_platform_data bfin_spi_dataflash_data = {
  829. .name = "SPI Dataflash",
  830. .parts = bfin_spi_dataflash_partitions,
  831. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  832. };
  833. /* DataFlash chip */
  834. static struct bfin5xx_spi_chip data_flash_chip_info = {
  835. .enable_dma = 0, /* use dma transfer with this chip*/
  836. .bits_per_word = 8,
  837. };
  838. #endif
  839. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  840. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  841. .enable_dma = 0, /* use dma transfer with this chip*/
  842. .bits_per_word = 8,
  843. };
  844. #endif
  845. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  846. #if defined(CONFIG_MTD_M25P80) \
  847. || defined(CONFIG_MTD_M25P80_MODULE)
  848. {
  849. /* the modalias must be the same as spi device driver name */
  850. .modalias = "m25p80", /* Name of spi_driver for this device */
  851. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  852. .bus_num = 0, /* Framework bus number */
  853. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  854. .platform_data = &bfin_spi_flash_data,
  855. .controller_data = &spi_flash_chip_info,
  856. .mode = SPI_MODE_3,
  857. },
  858. #endif
  859. #if defined(CONFIG_MTD_DATAFLASH) \
  860. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  861. { /* DataFlash chip */
  862. .modalias = "mtd_dataflash",
  863. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  864. .bus_num = 0, /* Framework bus number */
  865. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  866. .platform_data = &bfin_spi_dataflash_data,
  867. .controller_data = &data_flash_chip_info,
  868. .mode = SPI_MODE_3,
  869. },
  870. #endif
  871. #if defined(CONFIG_BFIN_SPI_ADC) \
  872. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  873. {
  874. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  875. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  876. .bus_num = 0, /* Framework bus number */
  877. .chip_select = 1, /* Framework chip select. */
  878. .platform_data = NULL, /* No spi_driver specific config */
  879. .controller_data = &spi_adc_chip_info,
  880. },
  881. #endif
  882. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  883. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  884. {
  885. .modalias = "ad183x",
  886. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  887. .bus_num = 0,
  888. .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
  889. .platform_data = "ad1836", /* only includes chip name for the moment */
  890. .controller_data = &ad1836_spi_chip_info,
  891. .mode = SPI_MODE_3,
  892. },
  893. #endif
  894. #if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
  895. {
  896. .modalias = "ad193x",
  897. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  898. .bus_num = 0,
  899. .chip_select = 5,
  900. .controller_data = &ad1938_spi_chip_info,
  901. .mode = SPI_MODE_3,
  902. },
  903. #endif
  904. #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
  905. {
  906. .modalias = "ad714x_captouch",
  907. .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
  908. .irq = IRQ_PF4,
  909. .bus_num = 0,
  910. .chip_select = 5,
  911. .mode = SPI_MODE_3,
  912. .platform_data = &ad7147_spi_platform_data,
  913. .controller_data = &ad7147_spi_chip_info,
  914. },
  915. #endif
  916. #if defined(CONFIG_AD2S90) || defined(CONFIG_AD2S90_MODULE)
  917. {
  918. .modalias = "ad2s90",
  919. .bus_num = 0,
  920. .chip_select = 3, /* change it for your board */
  921. .platform_data = NULL,
  922. .controller_data = &ad2s90_spi_chip_info,
  923. },
  924. #endif
  925. #if defined(CONFIG_AD2S120X) || defined(CONFIG_AD2S120X_MODULE)
  926. {
  927. .modalias = "ad2s120x",
  928. .bus_num = 0,
  929. .chip_select = 4, /* CS, change it for your board */
  930. .platform_data = ad2s120x_platform_data,
  931. .controller_data = &ad2s120x_spi_chip_info,
  932. },
  933. #endif
  934. #if defined(CONFIG_AD2S1210) || defined(CONFIG_AD2S1210_MODULE)
  935. {
  936. .modalias = "ad2s1210",
  937. .max_speed_hz = 8192000,
  938. .bus_num = 0,
  939. .chip_select = 4, /* CS, change it for your board */
  940. .platform_data = ad2s1210_platform_data,
  941. .controller_data = &ad2s1210_spi_chip_info,
  942. },
  943. #endif
  944. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  945. {
  946. .modalias = "mmc_spi",
  947. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  948. .bus_num = 0,
  949. .chip_select = 4,
  950. .platform_data = &bfin_mmc_spi_pdata,
  951. .controller_data = &mmc_spi_chip_info,
  952. .mode = SPI_MODE_3,
  953. },
  954. #endif
  955. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  956. {
  957. .modalias = "ad7877",
  958. .platform_data = &bfin_ad7877_ts_info,
  959. .irq = IRQ_PF6,
  960. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  961. .bus_num = 0,
  962. .chip_select = 1,
  963. .controller_data = &spi_ad7877_chip_info,
  964. },
  965. #endif
  966. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  967. {
  968. .modalias = "ad7879",
  969. .platform_data = &bfin_ad7879_ts_info,
  970. .irq = IRQ_PF7,
  971. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  972. .bus_num = 0,
  973. .chip_select = 1,
  974. .controller_data = &spi_ad7879_chip_info,
  975. .mode = SPI_CPHA | SPI_CPOL,
  976. },
  977. #endif
  978. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  979. {
  980. .modalias = "spidev",
  981. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  982. .bus_num = 0,
  983. .chip_select = 1,
  984. .controller_data = &spidev_chip_info,
  985. },
  986. #endif
  987. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  988. {
  989. .modalias = "bfin-lq035q1-spi",
  990. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  991. .bus_num = 0,
  992. .chip_select = 2,
  993. .controller_data = &lq035q1_spi_chip_info,
  994. .mode = SPI_CPHA | SPI_CPOL,
  995. },
  996. #endif
  997. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  998. {
  999. .modalias = "enc28j60",
  1000. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  1001. .irq = IRQ_PF6,
  1002. .bus_num = 0,
  1003. .chip_select = 0, /* GPIO controlled SSEL */
  1004. .controller_data = &enc28j60_spi_chip_info,
  1005. .mode = SPI_MODE_0,
  1006. },
  1007. #endif
  1008. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  1009. {
  1010. .modalias = "adxl34x",
  1011. .platform_data = &adxl34x_info,
  1012. .irq = IRQ_PF6,
  1013. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1014. .bus_num = 0,
  1015. .chip_select = 2,
  1016. .controller_data = &spi_adxl34x_chip_info,
  1017. .mode = SPI_MODE_3,
  1018. },
  1019. #endif
  1020. #if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
  1021. {
  1022. .modalias = "adf702x",
  1023. .max_speed_hz = 16000000, /* max spi clock (SCK) speed in HZ */
  1024. .bus_num = 0,
  1025. .chip_select = 0, /* GPIO controlled SSEL */
  1026. .controller_data = &adf7021_spi_chip_info,
  1027. .platform_data = &adf7021_platform_data,
  1028. .mode = SPI_MODE_0,
  1029. },
  1030. #endif
  1031. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  1032. {
  1033. .modalias = "ads7846",
  1034. .max_speed_hz = 2000000, /* max spi clock (SCK) speed in HZ */
  1035. .bus_num = 0,
  1036. .irq = IRQ_PF6,
  1037. .chip_select = GPIO_PF10 + MAX_CTRL_CS, /* GPIO controlled SSEL */
  1038. .controller_data = &ad7873_spi_chip_info,
  1039. .platform_data = &ad7873_pdata,
  1040. .mode = SPI_MODE_0,
  1041. },
  1042. #endif
  1043. };
  1044. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1045. /* SPI controller data */
  1046. static struct bfin5xx_spi_master bfin_spi0_info = {
  1047. .num_chipselect = 8,
  1048. .enable_dma = 1, /* master has the ability to do dma transfer */
  1049. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1050. };
  1051. /* SPI (0) */
  1052. static struct resource bfin_spi0_resource[] = {
  1053. [0] = {
  1054. .start = SPI0_REGBASE,
  1055. .end = SPI0_REGBASE + 0xFF,
  1056. .flags = IORESOURCE_MEM,
  1057. },
  1058. [1] = {
  1059. .start = CH_SPI,
  1060. .end = CH_SPI,
  1061. .flags = IORESOURCE_DMA,
  1062. },
  1063. [2] = {
  1064. .start = IRQ_SPI,
  1065. .end = IRQ_SPI,
  1066. .flags = IORESOURCE_IRQ,
  1067. },
  1068. };
  1069. static struct platform_device bfin_spi0_device = {
  1070. .name = "bfin-spi",
  1071. .id = 0, /* Bus number */
  1072. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1073. .resource = bfin_spi0_resource,
  1074. .dev = {
  1075. .platform_data = &bfin_spi0_info, /* Passed to driver */
  1076. },
  1077. };
  1078. #endif /* spi master and devices */
  1079. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  1080. /* SPORT SPI controller data */
  1081. static struct bfin5xx_spi_master bfin_sport_spi0_info = {
  1082. .num_chipselect = 1, /* master only supports one device */
  1083. .enable_dma = 0, /* master don't support DMA */
  1084. .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
  1085. P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
  1086. };
  1087. static struct resource bfin_sport_spi0_resource[] = {
  1088. [0] = {
  1089. .start = SPORT0_TCR1,
  1090. .end = SPORT0_TCR1 + 0xFF,
  1091. .flags = IORESOURCE_MEM,
  1092. },
  1093. [1] = {
  1094. .start = IRQ_SPORT0_ERROR,
  1095. .end = IRQ_SPORT0_ERROR,
  1096. .flags = IORESOURCE_IRQ,
  1097. },
  1098. };
  1099. static struct platform_device bfin_sport_spi0_device = {
  1100. .name = "bfin-sport-spi",
  1101. .id = 1, /* Bus number */
  1102. .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
  1103. .resource = bfin_sport_spi0_resource,
  1104. .dev = {
  1105. .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
  1106. },
  1107. };
  1108. static struct bfin5xx_spi_master bfin_sport_spi1_info = {
  1109. .num_chipselect = 1, /* master only supports one device */
  1110. .enable_dma = 0, /* master don't support DMA */
  1111. .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
  1112. P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
  1113. };
  1114. static struct resource bfin_sport_spi1_resource[] = {
  1115. [0] = {
  1116. .start = SPORT1_TCR1,
  1117. .end = SPORT1_TCR1 + 0xFF,
  1118. .flags = IORESOURCE_MEM,
  1119. },
  1120. [1] = {
  1121. .start = IRQ_SPORT1_ERROR,
  1122. .end = IRQ_SPORT1_ERROR,
  1123. .flags = IORESOURCE_IRQ,
  1124. },
  1125. };
  1126. static struct platform_device bfin_sport_spi1_device = {
  1127. .name = "bfin-sport-spi",
  1128. .id = 2, /* Bus number */
  1129. .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
  1130. .resource = bfin_sport_spi1_resource,
  1131. .dev = {
  1132. .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
  1133. },
  1134. };
  1135. #endif /* sport spi master and devices */
  1136. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  1137. static struct platform_device bfin_fb_device = {
  1138. .name = "bf537-lq035",
  1139. };
  1140. #endif
  1141. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  1142. #include <asm/bfin-lq035q1.h>
  1143. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  1144. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  1145. .ppi_mode = USE_RGB565_16_BIT_PPI,
  1146. .use_bl = 0, /* let something else control the LCD Blacklight */
  1147. .gpio_bl = GPIO_PF7,
  1148. };
  1149. static struct resource bfin_lq035q1_resources[] = {
  1150. {
  1151. .start = IRQ_PPI_ERROR,
  1152. .end = IRQ_PPI_ERROR,
  1153. .flags = IORESOURCE_IRQ,
  1154. },
  1155. };
  1156. static struct platform_device bfin_lq035q1_device = {
  1157. .name = "bfin-lq035q1",
  1158. .id = -1,
  1159. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  1160. .resource = bfin_lq035q1_resources,
  1161. .dev = {
  1162. .platform_data = &bfin_lq035q1_data,
  1163. },
  1164. };
  1165. #endif
  1166. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1167. #ifdef CONFIG_SERIAL_BFIN_UART0
  1168. static struct resource bfin_uart0_resources[] = {
  1169. {
  1170. .start = UART0_THR,
  1171. .end = UART0_GCTL+2,
  1172. .flags = IORESOURCE_MEM,
  1173. },
  1174. {
  1175. .start = IRQ_UART0_RX,
  1176. .end = IRQ_UART0_RX+1,
  1177. .flags = IORESOURCE_IRQ,
  1178. },
  1179. {
  1180. .start = IRQ_UART0_ERROR,
  1181. .end = IRQ_UART0_ERROR,
  1182. .flags = IORESOURCE_IRQ,
  1183. },
  1184. {
  1185. .start = CH_UART0_TX,
  1186. .end = CH_UART0_TX,
  1187. .flags = IORESOURCE_DMA,
  1188. },
  1189. {
  1190. .start = CH_UART0_RX,
  1191. .end = CH_UART0_RX,
  1192. .flags = IORESOURCE_DMA,
  1193. },
  1194. #ifdef CONFIG_BFIN_UART0_CTSRTS
  1195. { /* CTS pin */
  1196. .start = GPIO_PG7,
  1197. .end = GPIO_PG7,
  1198. .flags = IORESOURCE_IO,
  1199. },
  1200. { /* RTS pin */
  1201. .start = GPIO_PG6,
  1202. .end = GPIO_PG6,
  1203. .flags = IORESOURCE_IO,
  1204. },
  1205. #endif
  1206. };
  1207. unsigned short bfin_uart0_peripherals[] = {
  1208. P_UART0_TX, P_UART0_RX, 0
  1209. };
  1210. static struct platform_device bfin_uart0_device = {
  1211. .name = "bfin-uart",
  1212. .id = 0,
  1213. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  1214. .resource = bfin_uart0_resources,
  1215. .dev = {
  1216. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  1217. },
  1218. };
  1219. #endif
  1220. #ifdef CONFIG_SERIAL_BFIN_UART1
  1221. static struct resource bfin_uart1_resources[] = {
  1222. {
  1223. .start = UART1_THR,
  1224. .end = UART1_GCTL+2,
  1225. .flags = IORESOURCE_MEM,
  1226. },
  1227. {
  1228. .start = IRQ_UART1_RX,
  1229. .end = IRQ_UART1_RX+1,
  1230. .flags = IORESOURCE_IRQ,
  1231. },
  1232. {
  1233. .start = IRQ_UART1_ERROR,
  1234. .end = IRQ_UART1_ERROR,
  1235. .flags = IORESOURCE_IRQ,
  1236. },
  1237. {
  1238. .start = CH_UART1_TX,
  1239. .end = CH_UART1_TX,
  1240. .flags = IORESOURCE_DMA,
  1241. },
  1242. {
  1243. .start = CH_UART1_RX,
  1244. .end = CH_UART1_RX,
  1245. .flags = IORESOURCE_DMA,
  1246. },
  1247. };
  1248. unsigned short bfin_uart1_peripherals[] = {
  1249. P_UART1_TX, P_UART1_RX, 0
  1250. };
  1251. static struct platform_device bfin_uart1_device = {
  1252. .name = "bfin-uart",
  1253. .id = 1,
  1254. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  1255. .resource = bfin_uart1_resources,
  1256. .dev = {
  1257. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  1258. },
  1259. };
  1260. #endif
  1261. #endif
  1262. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1263. #ifdef CONFIG_BFIN_SIR0
  1264. static struct resource bfin_sir0_resources[] = {
  1265. {
  1266. .start = 0xFFC00400,
  1267. .end = 0xFFC004FF,
  1268. .flags = IORESOURCE_MEM,
  1269. },
  1270. {
  1271. .start = IRQ_UART0_RX,
  1272. .end = IRQ_UART0_RX+1,
  1273. .flags = IORESOURCE_IRQ,
  1274. },
  1275. {
  1276. .start = CH_UART0_RX,
  1277. .end = CH_UART0_RX+1,
  1278. .flags = IORESOURCE_DMA,
  1279. },
  1280. };
  1281. static struct platform_device bfin_sir0_device = {
  1282. .name = "bfin_sir",
  1283. .id = 0,
  1284. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  1285. .resource = bfin_sir0_resources,
  1286. };
  1287. #endif
  1288. #ifdef CONFIG_BFIN_SIR1
  1289. static struct resource bfin_sir1_resources[] = {
  1290. {
  1291. .start = 0xFFC02000,
  1292. .end = 0xFFC020FF,
  1293. .flags = IORESOURCE_MEM,
  1294. },
  1295. {
  1296. .start = IRQ_UART1_RX,
  1297. .end = IRQ_UART1_RX+1,
  1298. .flags = IORESOURCE_IRQ,
  1299. },
  1300. {
  1301. .start = CH_UART1_RX,
  1302. .end = CH_UART1_RX+1,
  1303. .flags = IORESOURCE_DMA,
  1304. },
  1305. };
  1306. static struct platform_device bfin_sir1_device = {
  1307. .name = "bfin_sir",
  1308. .id = 1,
  1309. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  1310. .resource = bfin_sir1_resources,
  1311. };
  1312. #endif
  1313. #endif
  1314. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1315. static struct resource bfin_twi0_resource[] = {
  1316. [0] = {
  1317. .start = TWI0_REGBASE,
  1318. .end = TWI0_REGBASE,
  1319. .flags = IORESOURCE_MEM,
  1320. },
  1321. [1] = {
  1322. .start = IRQ_TWI,
  1323. .end = IRQ_TWI,
  1324. .flags = IORESOURCE_IRQ,
  1325. },
  1326. };
  1327. static struct platform_device i2c_bfin_twi_device = {
  1328. .name = "i2c-bfin-twi",
  1329. .id = 0,
  1330. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1331. .resource = bfin_twi0_resource,
  1332. };
  1333. #endif
  1334. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1335. static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
  1336. [0] = KEY_GRAVE,
  1337. [1] = KEY_1,
  1338. [2] = KEY_2,
  1339. [3] = KEY_3,
  1340. [4] = KEY_4,
  1341. [5] = KEY_5,
  1342. [6] = KEY_6,
  1343. [7] = KEY_7,
  1344. [8] = KEY_8,
  1345. [9] = KEY_9,
  1346. [10] = KEY_0,
  1347. [11] = KEY_MINUS,
  1348. [12] = KEY_EQUAL,
  1349. [13] = KEY_BACKSLASH,
  1350. [15] = KEY_KP0,
  1351. [16] = KEY_Q,
  1352. [17] = KEY_W,
  1353. [18] = KEY_E,
  1354. [19] = KEY_R,
  1355. [20] = KEY_T,
  1356. [21] = KEY_Y,
  1357. [22] = KEY_U,
  1358. [23] = KEY_I,
  1359. [24] = KEY_O,
  1360. [25] = KEY_P,
  1361. [26] = KEY_LEFTBRACE,
  1362. [27] = KEY_RIGHTBRACE,
  1363. [29] = KEY_KP1,
  1364. [30] = KEY_KP2,
  1365. [31] = KEY_KP3,
  1366. [32] = KEY_A,
  1367. [33] = KEY_S,
  1368. [34] = KEY_D,
  1369. [35] = KEY_F,
  1370. [36] = KEY_G,
  1371. [37] = KEY_H,
  1372. [38] = KEY_J,
  1373. [39] = KEY_K,
  1374. [40] = KEY_L,
  1375. [41] = KEY_SEMICOLON,
  1376. [42] = KEY_APOSTROPHE,
  1377. [43] = KEY_BACKSLASH,
  1378. [45] = KEY_KP4,
  1379. [46] = KEY_KP5,
  1380. [47] = KEY_KP6,
  1381. [48] = KEY_102ND,
  1382. [49] = KEY_Z,
  1383. [50] = KEY_X,
  1384. [51] = KEY_C,
  1385. [52] = KEY_V,
  1386. [53] = KEY_B,
  1387. [54] = KEY_N,
  1388. [55] = KEY_M,
  1389. [56] = KEY_COMMA,
  1390. [57] = KEY_DOT,
  1391. [58] = KEY_SLASH,
  1392. [60] = KEY_KPDOT,
  1393. [61] = KEY_KP7,
  1394. [62] = KEY_KP8,
  1395. [63] = KEY_KP9,
  1396. [64] = KEY_SPACE,
  1397. [65] = KEY_BACKSPACE,
  1398. [66] = KEY_TAB,
  1399. [67] = KEY_KPENTER,
  1400. [68] = KEY_ENTER,
  1401. [69] = KEY_ESC,
  1402. [70] = KEY_DELETE,
  1403. [74] = KEY_KPMINUS,
  1404. [76] = KEY_UP,
  1405. [77] = KEY_DOWN,
  1406. [78] = KEY_RIGHT,
  1407. [79] = KEY_LEFT,
  1408. };
  1409. static struct adp5588_kpad_platform_data adp5588_kpad_data = {
  1410. .rows = 8,
  1411. .cols = 10,
  1412. .keymap = adp5588_keymap,
  1413. .keymapsize = ARRAY_SIZE(adp5588_keymap),
  1414. .repeat = 0,
  1415. };
  1416. #endif
  1417. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1418. #include <linux/mfd/adp5520.h>
  1419. /*
  1420. * ADP5520/5501 Backlight Data
  1421. */
  1422. static struct adp5520_backlight_platform_data adp5520_backlight_data = {
  1423. .fade_in = ADP5520_FADE_T_1200ms,
  1424. .fade_out = ADP5520_FADE_T_1200ms,
  1425. .fade_led_law = ADP5520_BL_LAW_LINEAR,
  1426. .en_ambl_sens = 1,
  1427. .abml_filt = ADP5520_BL_AMBL_FILT_640ms,
  1428. .l1_daylight_max = ADP5520_BL_CUR_mA(15),
  1429. .l1_daylight_dim = ADP5520_BL_CUR_mA(0),
  1430. .l2_office_max = ADP5520_BL_CUR_mA(7),
  1431. .l2_office_dim = ADP5520_BL_CUR_mA(0),
  1432. .l3_dark_max = ADP5520_BL_CUR_mA(3),
  1433. .l3_dark_dim = ADP5520_BL_CUR_mA(0),
  1434. .l2_trip = ADP5520_L2_COMP_CURR_uA(700),
  1435. .l2_hyst = ADP5520_L2_COMP_CURR_uA(50),
  1436. .l3_trip = ADP5520_L3_COMP_CURR_uA(80),
  1437. .l3_hyst = ADP5520_L3_COMP_CURR_uA(20),
  1438. };
  1439. /*
  1440. * ADP5520/5501 LEDs Data
  1441. */
  1442. static struct led_info adp5520_leds[] = {
  1443. {
  1444. .name = "adp5520-led1",
  1445. .default_trigger = "none",
  1446. .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
  1447. },
  1448. #ifdef ADP5520_EN_ALL_LEDS
  1449. {
  1450. .name = "adp5520-led2",
  1451. .default_trigger = "none",
  1452. .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
  1453. },
  1454. {
  1455. .name = "adp5520-led3",
  1456. .default_trigger = "none",
  1457. .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
  1458. },
  1459. #endif
  1460. };
  1461. static struct adp5520_leds_platform_data adp5520_leds_data = {
  1462. .num_leds = ARRAY_SIZE(adp5520_leds),
  1463. .leds = adp5520_leds,
  1464. .fade_in = ADP5520_FADE_T_600ms,
  1465. .fade_out = ADP5520_FADE_T_600ms,
  1466. .led_on_time = ADP5520_LED_ONT_600ms,
  1467. };
  1468. /*
  1469. * ADP5520 GPIO Data
  1470. */
  1471. static struct adp5520_gpio_platform_data adp5520_gpio_data = {
  1472. .gpio_start = 50,
  1473. .gpio_en_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
  1474. .gpio_pullup_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
  1475. };
  1476. /*
  1477. * ADP5520 Keypad Data
  1478. */
  1479. static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
  1480. [ADP5520_KEY(0, 0)] = KEY_GRAVE,
  1481. [ADP5520_KEY(0, 1)] = KEY_1,
  1482. [ADP5520_KEY(0, 2)] = KEY_2,
  1483. [ADP5520_KEY(0, 3)] = KEY_3,
  1484. [ADP5520_KEY(1, 0)] = KEY_4,
  1485. [ADP5520_KEY(1, 1)] = KEY_5,
  1486. [ADP5520_KEY(1, 2)] = KEY_6,
  1487. [ADP5520_KEY(1, 3)] = KEY_7,
  1488. [ADP5520_KEY(2, 0)] = KEY_8,
  1489. [ADP5520_KEY(2, 1)] = KEY_9,
  1490. [ADP5520_KEY(2, 2)] = KEY_0,
  1491. [ADP5520_KEY(2, 3)] = KEY_MINUS,
  1492. [ADP5520_KEY(3, 0)] = KEY_EQUAL,
  1493. [ADP5520_KEY(3, 1)] = KEY_BACKSLASH,
  1494. [ADP5520_KEY(3, 2)] = KEY_BACKSPACE,
  1495. [ADP5520_KEY(3, 3)] = KEY_ENTER,
  1496. };
  1497. static struct adp5520_keys_platform_data adp5520_keys_data = {
  1498. .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
  1499. .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
  1500. .keymap = adp5520_keymap,
  1501. .keymapsize = ARRAY_SIZE(adp5520_keymap),
  1502. .repeat = 0,
  1503. };
  1504. /*
  1505. * ADP5520/5501 Multifuction Device Init Data
  1506. */
  1507. static struct adp5520_platform_data adp5520_pdev_data = {
  1508. .backlight = &adp5520_backlight_data,
  1509. .leds = &adp5520_leds_data,
  1510. .gpio = &adp5520_gpio_data,
  1511. .keys = &adp5520_keys_data,
  1512. };
  1513. #endif
  1514. #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
  1515. static struct adp5588_gpio_platform_data adp5588_gpio_data = {
  1516. .gpio_start = 50,
  1517. .pullup_dis_mask = 0,
  1518. };
  1519. #endif
  1520. #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
  1521. #include <linux/i2c/adp8870.h>
  1522. static struct led_info adp8870_leds[] = {
  1523. {
  1524. .name = "adp8870-led7",
  1525. .default_trigger = "none",
  1526. .flags = ADP8870_LED_D7 | ADP8870_LED_OFFT_600ms,
  1527. },
  1528. };
  1529. static struct adp8870_backlight_platform_data adp8870_pdata = {
  1530. .bl_led_assign = ADP8870_BL_D1 | ADP8870_BL_D2 | ADP8870_BL_D3 |
  1531. ADP8870_BL_D4 | ADP8870_BL_D5 | ADP8870_BL_D6, /* 1 = Backlight 0 = Individual LED */
  1532. .pwm_assign = 0, /* 1 = Enables PWM mode */
  1533. .bl_fade_in = ADP8870_FADE_T_1200ms, /* Backlight Fade-In Timer */
  1534. .bl_fade_out = ADP8870_FADE_T_1200ms, /* Backlight Fade-Out Timer */
  1535. .bl_fade_law = ADP8870_FADE_LAW_CUBIC1, /* fade-on/fade-off transfer characteristic */
  1536. .en_ambl_sens = 1, /* 1 = enable ambient light sensor */
  1537. .abml_filt = ADP8870_BL_AMBL_FILT_320ms, /* Light sensor filter time */
  1538. .l1_daylight_max = ADP8870_BL_CUR_mA(20), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1539. .l1_daylight_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1540. .l2_bright_max = ADP8870_BL_CUR_mA(14), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1541. .l2_bright_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1542. .l3_office_max = ADP8870_BL_CUR_mA(6), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1543. .l3_office_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1544. .l4_indoor_max = ADP8870_BL_CUR_mA(3), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1545. .l4_indor_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1546. .l5_dark_max = ADP8870_BL_CUR_mA(2), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1547. .l5_dark_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1548. .l2_trip = ADP8870_L2_COMP_CURR_uA(710), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
  1549. .l2_hyst = ADP8870_L2_COMP_CURR_uA(73), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
  1550. .l3_trip = ADP8870_L3_COMP_CURR_uA(389), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
  1551. .l3_hyst = ADP8870_L3_COMP_CURR_uA(54), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
  1552. .l4_trip = ADP8870_L4_COMP_CURR_uA(167), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
  1553. .l4_hyst = ADP8870_L4_COMP_CURR_uA(16), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
  1554. .l5_trip = ADP8870_L5_COMP_CURR_uA(43), /* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */
  1555. .l5_hyst = ADP8870_L5_COMP_CURR_uA(11), /* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */
  1556. .leds = adp8870_leds,
  1557. .num_leds = ARRAY_SIZE(adp8870_leds),
  1558. .led_fade_law = ADP8870_FADE_LAW_SQUARE, /* fade-on/fade-off transfer characteristic */
  1559. .led_fade_in = ADP8870_FADE_T_600ms,
  1560. .led_fade_out = ADP8870_FADE_T_600ms,
  1561. .led_on_time = ADP8870_LED_ONT_200ms,
  1562. };
  1563. #endif
  1564. #if defined(CONFIG_BACKLIGHT_ADP8860) || defined(CONFIG_BACKLIGHT_ADP8860_MODULE)
  1565. #include <linux/i2c/adp8860.h>
  1566. static struct led_info adp8860_leds[] = {
  1567. {
  1568. .name = "adp8860-led7",
  1569. .default_trigger = "none",
  1570. .flags = ADP8860_LED_D7 | ADP8860_LED_OFFT_600ms,
  1571. },
  1572. };
  1573. static struct adp8860_backlight_platform_data adp8860_pdata = {
  1574. .bl_led_assign = ADP8860_BL_D1 | ADP8860_BL_D2 | ADP8860_BL_D3 |
  1575. ADP8860_BL_D4 | ADP8860_BL_D5 | ADP8860_BL_D6, /* 1 = Backlight 0 = Individual LED */
  1576. .bl_fade_in = ADP8860_FADE_T_1200ms, /* Backlight Fade-In Timer */
  1577. .bl_fade_out = ADP8860_FADE_T_1200ms, /* Backlight Fade-Out Timer */
  1578. .bl_fade_law = ADP8860_FADE_LAW_CUBIC1, /* fade-on/fade-off transfer characteristic */
  1579. .en_ambl_sens = 1, /* 1 = enable ambient light sensor */
  1580. .abml_filt = ADP8860_BL_AMBL_FILT_320ms, /* Light sensor filter time */
  1581. .l1_daylight_max = ADP8860_BL_CUR_mA(20), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1582. .l1_daylight_dim = ADP8860_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1583. .l2_office_max = ADP8860_BL_CUR_mA(6), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1584. .l2_office_dim = ADP8860_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1585. .l3_dark_max = ADP8860_BL_CUR_mA(2), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1586. .l3_dark_dim = ADP8860_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  1587. .l2_trip = ADP8860_L2_COMP_CURR_uA(710), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
  1588. .l2_hyst = ADP8860_L2_COMP_CURR_uA(73), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
  1589. .l3_trip = ADP8860_L3_COMP_CURR_uA(43), /* use L3_COMP_CURR_uA(I) 0 <= I <= 138 uA */
  1590. .l3_hyst = ADP8860_L3_COMP_CURR_uA(11), /* use L3_COMP_CURR_uA(I) 0 <= I <= 138 uA */
  1591. .leds = adp8860_leds,
  1592. .num_leds = ARRAY_SIZE(adp8860_leds),
  1593. .led_fade_law = ADP8860_FADE_LAW_SQUARE, /* fade-on/fade-off transfer characteristic */
  1594. .led_fade_in = ADP8860_FADE_T_600ms,
  1595. .led_fade_out = ADP8860_FADE_T_600ms,
  1596. .led_on_time = ADP8860_LED_ONT_200ms,
  1597. };
  1598. #endif
  1599. #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
  1600. static struct regulator_consumer_supply ad5398_consumer = {
  1601. .supply = "current",
  1602. };
  1603. static struct regulator_init_data ad5398_regulator_data = {
  1604. .constraints = {
  1605. .name = "current range",
  1606. .max_uA = 120000,
  1607. .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
  1608. },
  1609. .num_consumer_supplies = 1,
  1610. .consumer_supplies = &ad5398_consumer,
  1611. };
  1612. static struct ad5398_platform_data ad5398_i2c_platform_data = {
  1613. .current_bits = 10,
  1614. .current_offset = 4,
  1615. .regulator_data = &ad5398_regulator_data,
  1616. };
  1617. #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
  1618. defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
  1619. static struct platform_device ad5398_virt_consumer_device = {
  1620. .name = "reg-virt-consumer",
  1621. .id = 0,
  1622. .dev = {
  1623. .platform_data = "current", /* Passed to driver */
  1624. },
  1625. };
  1626. #endif
  1627. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  1628. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  1629. static struct regulator_bulk_data ad5398_bulk_data = {
  1630. .supply = "current",
  1631. };
  1632. static struct regulator_userspace_consumer_data ad5398_userspace_comsumer_data = {
  1633. .name = "ad5398",
  1634. .num_supplies = 1,
  1635. .supplies = &ad5398_bulk_data,
  1636. };
  1637. static struct platform_device ad5398_userspace_consumer_device = {
  1638. .name = "reg-userspace-consumer",
  1639. .id = 0,
  1640. .dev = {
  1641. .platform_data = &ad5398_userspace_comsumer_data,
  1642. },
  1643. };
  1644. #endif
  1645. #endif
  1646. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  1647. #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
  1648. {
  1649. I2C_BOARD_INFO("ad7142_captouch", 0x2C),
  1650. .irq = IRQ_PG5,
  1651. .platform_data = (void *)&ad7142_i2c_platform_data,
  1652. },
  1653. #endif
  1654. #if defined(CONFIG_AD7150) || defined(CONFIG_AD7150_MODULE)
  1655. {
  1656. I2C_BOARD_INFO("ad7150", 0x48),
  1657. .irq = IRQ_PG5, /* fixme: use real interrupt number */
  1658. },
  1659. #endif
  1660. #if defined(CONFIG_AD7152) || defined(CONFIG_AD7152_MODULE)
  1661. {
  1662. I2C_BOARD_INFO("ad7152", 0x48),
  1663. },
  1664. #endif
  1665. #if defined(CONFIG_AD774X) || defined(CONFIG_AD774X_MODULE)
  1666. {
  1667. I2C_BOARD_INFO("ad774x", 0x48),
  1668. },
  1669. #endif
  1670. #if defined(CONFIG_AD7414) || defined(CONFIG_AD7414_MODULE)
  1671. {
  1672. I2C_BOARD_INFO("ad7414", 0x9),
  1673. .irq = IRQ_PG5,
  1674. /*
  1675. * platform_data pointer is borrwoed by the driver to
  1676. * store custimer defined IRQ ALART level mode.
  1677. * only IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW are valid.
  1678. */
  1679. .platform_data = (void *)IRQF_TRIGGER_LOW,
  1680. },
  1681. #endif
  1682. #if defined(CONFIG_AD7416) || defined(CONFIG_AD7416_MODULE)
  1683. {
  1684. I2C_BOARD_INFO("ad7417", 0xb),
  1685. .irq = IRQ_PG5,
  1686. /*
  1687. * platform_data pointer is borrwoed by the driver to
  1688. * store custimer defined IRQ ALART level mode.
  1689. * only IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW are valid.
  1690. */
  1691. .platform_data = (void *)IRQF_TRIGGER_LOW,
  1692. },
  1693. #endif
  1694. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1695. {
  1696. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1697. },
  1698. #endif
  1699. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  1700. {
  1701. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1702. .irq = IRQ_PG6,
  1703. },
  1704. #endif
  1705. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  1706. {
  1707. I2C_BOARD_INFO("ad7879", 0x2F),
  1708. .irq = IRQ_PG5,
  1709. .platform_data = (void *)&bfin_ad7879_ts_info,
  1710. },
  1711. #endif
  1712. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1713. {
  1714. I2C_BOARD_INFO("adp5588-keys", 0x34),
  1715. .irq = IRQ_PG0,
  1716. .platform_data = (void *)&adp5588_kpad_data,
  1717. },
  1718. #endif
  1719. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1720. {
  1721. I2C_BOARD_INFO("pmic-adp5520", 0x32),
  1722. .irq = IRQ_PG0,
  1723. .platform_data = (void *)&adp5520_pdev_data,
  1724. },
  1725. #endif
  1726. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1727. {
  1728. I2C_BOARD_INFO("adxl34x", 0x53),
  1729. .irq = IRQ_PG3,
  1730. .platform_data = (void *)&adxl34x_info,
  1731. },
  1732. #endif
  1733. #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
  1734. {
  1735. I2C_BOARD_INFO("adp5588-gpio", 0x34),
  1736. .platform_data = (void *)&adp5588_gpio_data,
  1737. },
  1738. #endif
  1739. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  1740. {
  1741. I2C_BOARD_INFO("bfin-adv7393", 0x2B),
  1742. },
  1743. #endif
  1744. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  1745. {
  1746. I2C_BOARD_INFO("bf537-lq035-ad5280", 0x2C),
  1747. },
  1748. #endif
  1749. #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
  1750. {
  1751. I2C_BOARD_INFO("adp8870", 0x2B),
  1752. .platform_data = (void *)&adp8870_pdata,
  1753. },
  1754. #endif
  1755. #if defined(CONFIG_SND_SOC_ADAU1371) || defined(CONFIG_SND_SOC_ADAU1371_MODULE)
  1756. {
  1757. I2C_BOARD_INFO("adau1371", 0x1A),
  1758. },
  1759. #endif
  1760. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  1761. {
  1762. I2C_BOARD_INFO("adau1761", 0x38),
  1763. },
  1764. #endif
  1765. #if defined(CONFIG_SND_SOC_ADAU1361) || defined(CONFIG_SND_SOC_ADAU1361_MODULE)
  1766. {
  1767. I2C_BOARD_INFO("adau1361", 0x38),
  1768. },
  1769. #endif
  1770. #if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)
  1771. {
  1772. I2C_BOARD_INFO("ad5258", 0x18),
  1773. },
  1774. #endif
  1775. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  1776. {
  1777. I2C_BOARD_INFO("ssm2602", 0x1b),
  1778. },
  1779. #endif
  1780. #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
  1781. {
  1782. I2C_BOARD_INFO("ad5398", 0xC),
  1783. .platform_data = (void *)&ad5398_i2c_platform_data,
  1784. },
  1785. #endif
  1786. #if defined(CONFIG_BACKLIGHT_ADP8860) || defined(CONFIG_BACKLIGHT_ADP8860_MODULE)
  1787. {
  1788. I2C_BOARD_INFO("adp8860", 0x2A),
  1789. .platform_data = (void *)&adp8860_pdata,
  1790. },
  1791. #endif
  1792. };
  1793. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1794. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1795. static struct resource bfin_sport0_uart_resources[] = {
  1796. {
  1797. .start = SPORT0_TCR1,
  1798. .end = SPORT0_MRCS3+4,
  1799. .flags = IORESOURCE_MEM,
  1800. },
  1801. {
  1802. .start = IRQ_SPORT0_RX,
  1803. .end = IRQ_SPORT0_RX+1,
  1804. .flags = IORESOURCE_IRQ,
  1805. },
  1806. {
  1807. .start = IRQ_SPORT0_ERROR,
  1808. .end = IRQ_SPORT0_ERROR,
  1809. .flags = IORESOURCE_IRQ,
  1810. },
  1811. };
  1812. unsigned short bfin_sport0_peripherals[] = {
  1813. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  1814. P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
  1815. };
  1816. static struct platform_device bfin_sport0_uart_device = {
  1817. .name = "bfin-sport-uart",
  1818. .id = 0,
  1819. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  1820. .resource = bfin_sport0_uart_resources,
  1821. .dev = {
  1822. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  1823. },
  1824. };
  1825. #endif
  1826. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1827. static struct resource bfin_sport1_uart_resources[] = {
  1828. {
  1829. .start = SPORT1_TCR1,
  1830. .end = SPORT1_MRCS3+4,
  1831. .flags = IORESOURCE_MEM,
  1832. },
  1833. {
  1834. .start = IRQ_SPORT1_RX,
  1835. .end = IRQ_SPORT1_RX+1,
  1836. .flags = IORESOURCE_IRQ,
  1837. },
  1838. {
  1839. .start = IRQ_SPORT1_ERROR,
  1840. .end = IRQ_SPORT1_ERROR,
  1841. .flags = IORESOURCE_IRQ,
  1842. },
  1843. };
  1844. unsigned short bfin_sport1_peripherals[] = {
  1845. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  1846. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
  1847. };
  1848. static struct platform_device bfin_sport1_uart_device = {
  1849. .name = "bfin-sport-uart",
  1850. .id = 1,
  1851. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  1852. .resource = bfin_sport1_uart_resources,
  1853. .dev = {
  1854. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  1855. },
  1856. };
  1857. #endif
  1858. #endif
  1859. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1860. #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1861. /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
  1862. #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1863. #define PATA_INT IRQ_PF5
  1864. static struct pata_platform_info bfin_pata_platform_data = {
  1865. .ioport_shift = 1,
  1866. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  1867. };
  1868. static struct resource bfin_pata_resources[] = {
  1869. {
  1870. .start = 0x20314020,
  1871. .end = 0x2031403F,
  1872. .flags = IORESOURCE_MEM,
  1873. },
  1874. {
  1875. .start = 0x2031401C,
  1876. .end = 0x2031401F,
  1877. .flags = IORESOURCE_MEM,
  1878. },
  1879. {
  1880. .start = PATA_INT,
  1881. .end = PATA_INT,
  1882. .flags = IORESOURCE_IRQ,
  1883. },
  1884. };
  1885. #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
  1886. static struct pata_platform_info bfin_pata_platform_data = {
  1887. .ioport_shift = 0,
  1888. };
  1889. /* CompactFlash Storage Card Memory Mapped Adressing
  1890. * /REG = A11 = 1
  1891. */
  1892. static struct resource bfin_pata_resources[] = {
  1893. {
  1894. .start = 0x20211800,
  1895. .end = 0x20211807,
  1896. .flags = IORESOURCE_MEM,
  1897. },
  1898. {
  1899. .start = 0x2021180E, /* Device Ctl */
  1900. .end = 0x2021180E,
  1901. .flags = IORESOURCE_MEM,
  1902. },
  1903. };
  1904. #endif
  1905. static struct platform_device bfin_pata_device = {
  1906. .name = "pata_platform",
  1907. .id = -1,
  1908. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  1909. .resource = bfin_pata_resources,
  1910. .dev = {
  1911. .platform_data = &bfin_pata_platform_data,
  1912. }
  1913. };
  1914. #endif
  1915. static const unsigned int cclk_vlev_datasheet[] =
  1916. {
  1917. VRPAIR(VLEV_085, 250000000),
  1918. VRPAIR(VLEV_090, 376000000),
  1919. VRPAIR(VLEV_095, 426000000),
  1920. VRPAIR(VLEV_100, 426000000),
  1921. VRPAIR(VLEV_105, 476000000),
  1922. VRPAIR(VLEV_110, 476000000),
  1923. VRPAIR(VLEV_115, 476000000),
  1924. VRPAIR(VLEV_120, 500000000),
  1925. VRPAIR(VLEV_125, 533000000),
  1926. VRPAIR(VLEV_130, 600000000),
  1927. };
  1928. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1929. .tuple_tab = cclk_vlev_datasheet,
  1930. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1931. .vr_settling_time = 25 /* us */,
  1932. };
  1933. static struct platform_device bfin_dpmc = {
  1934. .name = "bfin dpmc",
  1935. .dev = {
  1936. .platform_data = &bfin_dmpc_vreg_data,
  1937. },
  1938. };
  1939. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1940. static struct platform_device bfin_i2s = {
  1941. .name = "bfin-i2s",
  1942. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1943. /* TODO: add platform data here */
  1944. };
  1945. #endif
  1946. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1947. static struct platform_device bfin_tdm = {
  1948. .name = "bfin-tdm",
  1949. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1950. /* TODO: add platform data here */
  1951. };
  1952. #endif
  1953. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1954. static struct platform_device bfin_ac97 = {
  1955. .name = "bfin-ac97",
  1956. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1957. /* TODO: add platform data here */
  1958. };
  1959. #endif
  1960. #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
  1961. #define REGULATOR_ADP122 "adp122"
  1962. #define REGULATOR_ADP150 "adp150"
  1963. static struct regulator_consumer_supply adp122_consumers = {
  1964. .supply = REGULATOR_ADP122,
  1965. };
  1966. static struct regulator_consumer_supply adp150_consumers = {
  1967. .supply = REGULATOR_ADP150,
  1968. };
  1969. static struct regulator_init_data adp_switch_regulator_data[] = {
  1970. {
  1971. .constraints = {
  1972. .name = REGULATOR_ADP122,
  1973. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  1974. .min_uA = 0,
  1975. .max_uA = 300000,
  1976. },
  1977. .num_consumer_supplies = 1, /* only 1 */
  1978. .consumer_supplies = &adp122_consumers,
  1979. .driver_data = (void *)GPIO_PF2, /* gpio port only */
  1980. },
  1981. {
  1982. .constraints = {
  1983. .name = REGULATOR_ADP150,
  1984. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  1985. .min_uA = 0,
  1986. .max_uA = 150000,
  1987. },
  1988. .num_consumer_supplies = 1, /* only 1 */
  1989. .consumer_supplies = &adp150_consumers,
  1990. .driver_data = (void *)GPIO_PF3, /* gpio port only */
  1991. },
  1992. };
  1993. static struct adp_switch_platform_data adp_switch_pdata = {
  1994. .regulator_num = ARRAY_SIZE(adp_switch_regulator_data),
  1995. .regulator_data = adp_switch_regulator_data,
  1996. };
  1997. static struct platform_device adp_switch_device = {
  1998. .name = "adp_switch",
  1999. .id = 0,
  2000. .dev = {
  2001. .platform_data = &adp_switch_pdata,
  2002. },
  2003. };
  2004. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  2005. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  2006. static struct regulator_bulk_data adp122_bulk_data = {
  2007. .supply = REGULATOR_ADP122,
  2008. };
  2009. static struct regulator_userspace_consumer_data adp122_userspace_comsumer_data = {
  2010. .name = REGULATOR_ADP122,
  2011. .num_supplies = 1,
  2012. .supplies = &adp122_bulk_data,
  2013. };
  2014. static struct platform_device adp122_userspace_consumer_device = {
  2015. .name = "reg-userspace-consumer",
  2016. .id = 0,
  2017. .dev = {
  2018. .platform_data = &adp122_userspace_comsumer_data,
  2019. },
  2020. };
  2021. static struct regulator_bulk_data adp150_bulk_data = {
  2022. .supply = REGULATOR_ADP150,
  2023. };
  2024. static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = {
  2025. .name = REGULATOR_ADP150,
  2026. .num_supplies = 1,
  2027. .supplies = &adp150_bulk_data,
  2028. };
  2029. static struct platform_device adp150_userspace_consumer_device = {
  2030. .name = "reg-userspace-consumer",
  2031. .id = 1,
  2032. .dev = {
  2033. .platform_data = &adp150_userspace_comsumer_data,
  2034. },
  2035. };
  2036. #endif
  2037. #endif
  2038. static struct platform_device *stamp_devices[] __initdata = {
  2039. &bfin_dpmc,
  2040. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  2041. &bfin_pcmcia_cf_device,
  2042. #endif
  2043. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  2044. &rtc_device,
  2045. #endif
  2046. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  2047. &sl811_hcd_device,
  2048. #endif
  2049. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  2050. &isp1362_hcd_device,
  2051. #endif
  2052. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  2053. &bfin_isp1760_device,
  2054. #endif
  2055. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  2056. &smc91x_device,
  2057. #endif
  2058. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  2059. &dm9000_device,
  2060. #endif
  2061. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  2062. &bfin_can_device,
  2063. #endif
  2064. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  2065. &bfin_mii_bus,
  2066. &bfin_mac_device,
  2067. #endif
  2068. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  2069. &net2272_bfin_device,
  2070. #endif
  2071. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  2072. &bfin_spi0_device,
  2073. #endif
  2074. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  2075. &bfin_sport_spi0_device,
  2076. &bfin_sport_spi1_device,
  2077. #endif
  2078. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  2079. &bfin_fb_device,
  2080. #endif
  2081. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  2082. &bfin_lq035q1_device,
  2083. #endif
  2084. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  2085. #ifdef CONFIG_SERIAL_BFIN_UART0
  2086. &bfin_uart0_device,
  2087. #endif
  2088. #ifdef CONFIG_SERIAL_BFIN_UART1
  2089. &bfin_uart1_device,
  2090. #endif
  2091. #endif
  2092. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  2093. #ifdef CONFIG_BFIN_SIR0
  2094. &bfin_sir0_device,
  2095. #endif
  2096. #ifdef CONFIG_BFIN_SIR1
  2097. &bfin_sir1_device,
  2098. #endif
  2099. #endif
  2100. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  2101. &i2c_bfin_twi_device,
  2102. #endif
  2103. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  2104. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  2105. &bfin_sport0_uart_device,
  2106. #endif
  2107. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  2108. &bfin_sport1_uart_device,
  2109. #endif
  2110. #endif
  2111. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  2112. &bfin_pata_device,
  2113. #endif
  2114. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  2115. &bfin_device_gpiokeys,
  2116. #endif
  2117. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  2118. &bfin_async_nand_device,
  2119. #endif
  2120. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  2121. &stamp_flash_device,
  2122. #endif
  2123. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  2124. &bfin_i2s,
  2125. #endif
  2126. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  2127. &bfin_tdm,
  2128. #endif
  2129. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  2130. &bfin_ac97,
  2131. #endif
  2132. #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
  2133. #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
  2134. defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
  2135. &ad5398_virt_consumer_device,
  2136. #endif
  2137. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  2138. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  2139. &ad5398_userspace_consumer_device,
  2140. #endif
  2141. #endif
  2142. #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
  2143. &adp_switch_device,
  2144. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  2145. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  2146. &adp122_userspace_consumer_device,
  2147. &adp150_userspace_consumer_device,
  2148. #endif
  2149. #endif
  2150. };
  2151. static int __init stamp_init(void)
  2152. {
  2153. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  2154. bfin_plat_nand_init();
  2155. adf702x_mac_init();
  2156. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  2157. i2c_register_board_info(0, bfin_i2c_board_info,
  2158. ARRAY_SIZE(bfin_i2c_board_info));
  2159. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  2160. return 0;
  2161. }
  2162. arch_initcall(stamp_init);
  2163. static struct platform_device *stamp_early_devices[] __initdata = {
  2164. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  2165. #ifdef CONFIG_SERIAL_BFIN_UART0
  2166. &bfin_uart0_device,
  2167. #endif
  2168. #ifdef CONFIG_SERIAL_BFIN_UART1
  2169. &bfin_uart1_device,
  2170. #endif
  2171. #endif
  2172. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  2173. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  2174. &bfin_sport0_uart_device,
  2175. #endif
  2176. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  2177. &bfin_sport1_uart_device,
  2178. #endif
  2179. #endif
  2180. };
  2181. void __init native_machine_early_platform_add_devices(void)
  2182. {
  2183. printk(KERN_INFO "register early platform devices\n");
  2184. early_platform_add_devices(stamp_early_devices,
  2185. ARRAY_SIZE(stamp_early_devices));
  2186. }
  2187. void native_machine_restart(char *cmd)
  2188. {
  2189. /* workaround reboot hang when booting from SPI */
  2190. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  2191. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  2192. }
  2193. /*
  2194. * Currently the MAC address is saved in Flash by U-Boot
  2195. */
  2196. #define FLASH_MAC 0x203f0000
  2197. void bfin_get_ether_addr(char *addr)
  2198. {
  2199. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  2200. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  2201. }
  2202. EXPORT_SYMBOL(bfin_get_ether_addr);