stamp.c 61 KB

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