stamp.c 63 KB

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