stamp.c 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470
  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. };
  1824. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1825. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1826. static struct resource bfin_sport0_uart_resources[] = {
  1827. {
  1828. .start = SPORT0_TCR1,
  1829. .end = SPORT0_MRCS3+4,
  1830. .flags = IORESOURCE_MEM,
  1831. },
  1832. {
  1833. .start = IRQ_SPORT0_RX,
  1834. .end = IRQ_SPORT0_RX+1,
  1835. .flags = IORESOURCE_IRQ,
  1836. },
  1837. {
  1838. .start = IRQ_SPORT0_ERROR,
  1839. .end = IRQ_SPORT0_ERROR,
  1840. .flags = IORESOURCE_IRQ,
  1841. },
  1842. };
  1843. unsigned short bfin_sport0_peripherals[] = {
  1844. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  1845. P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
  1846. };
  1847. static struct platform_device bfin_sport0_uart_device = {
  1848. .name = "bfin-sport-uart",
  1849. .id = 0,
  1850. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  1851. .resource = bfin_sport0_uart_resources,
  1852. .dev = {
  1853. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  1854. },
  1855. };
  1856. #endif
  1857. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1858. static struct resource bfin_sport1_uart_resources[] = {
  1859. {
  1860. .start = SPORT1_TCR1,
  1861. .end = SPORT1_MRCS3+4,
  1862. .flags = IORESOURCE_MEM,
  1863. },
  1864. {
  1865. .start = IRQ_SPORT1_RX,
  1866. .end = IRQ_SPORT1_RX+1,
  1867. .flags = IORESOURCE_IRQ,
  1868. },
  1869. {
  1870. .start = IRQ_SPORT1_ERROR,
  1871. .end = IRQ_SPORT1_ERROR,
  1872. .flags = IORESOURCE_IRQ,
  1873. },
  1874. };
  1875. unsigned short bfin_sport1_peripherals[] = {
  1876. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  1877. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
  1878. };
  1879. static struct platform_device bfin_sport1_uart_device = {
  1880. .name = "bfin-sport-uart",
  1881. .id = 1,
  1882. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  1883. .resource = bfin_sport1_uart_resources,
  1884. .dev = {
  1885. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  1886. },
  1887. };
  1888. #endif
  1889. #endif
  1890. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1891. #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1892. /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
  1893. #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1894. #define PATA_INT IRQ_PF5
  1895. static struct pata_platform_info bfin_pata_platform_data = {
  1896. .ioport_shift = 1,
  1897. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  1898. };
  1899. static struct resource bfin_pata_resources[] = {
  1900. {
  1901. .start = 0x20314020,
  1902. .end = 0x2031403F,
  1903. .flags = IORESOURCE_MEM,
  1904. },
  1905. {
  1906. .start = 0x2031401C,
  1907. .end = 0x2031401F,
  1908. .flags = IORESOURCE_MEM,
  1909. },
  1910. {
  1911. .start = PATA_INT,
  1912. .end = PATA_INT,
  1913. .flags = IORESOURCE_IRQ,
  1914. },
  1915. };
  1916. #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
  1917. static struct pata_platform_info bfin_pata_platform_data = {
  1918. .ioport_shift = 0,
  1919. };
  1920. /* CompactFlash Storage Card Memory Mapped Adressing
  1921. * /REG = A11 = 1
  1922. */
  1923. static struct resource bfin_pata_resources[] = {
  1924. {
  1925. .start = 0x20211800,
  1926. .end = 0x20211807,
  1927. .flags = IORESOURCE_MEM,
  1928. },
  1929. {
  1930. .start = 0x2021180E, /* Device Ctl */
  1931. .end = 0x2021180E,
  1932. .flags = IORESOURCE_MEM,
  1933. },
  1934. };
  1935. #endif
  1936. static struct platform_device bfin_pata_device = {
  1937. .name = "pata_platform",
  1938. .id = -1,
  1939. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  1940. .resource = bfin_pata_resources,
  1941. .dev = {
  1942. .platform_data = &bfin_pata_platform_data,
  1943. }
  1944. };
  1945. #endif
  1946. static const unsigned int cclk_vlev_datasheet[] =
  1947. {
  1948. VRPAIR(VLEV_085, 250000000),
  1949. VRPAIR(VLEV_090, 376000000),
  1950. VRPAIR(VLEV_095, 426000000),
  1951. VRPAIR(VLEV_100, 426000000),
  1952. VRPAIR(VLEV_105, 476000000),
  1953. VRPAIR(VLEV_110, 476000000),
  1954. VRPAIR(VLEV_115, 476000000),
  1955. VRPAIR(VLEV_120, 500000000),
  1956. VRPAIR(VLEV_125, 533000000),
  1957. VRPAIR(VLEV_130, 600000000),
  1958. };
  1959. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1960. .tuple_tab = cclk_vlev_datasheet,
  1961. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1962. .vr_settling_time = 25 /* us */,
  1963. };
  1964. static struct platform_device bfin_dpmc = {
  1965. .name = "bfin dpmc",
  1966. .dev = {
  1967. .platform_data = &bfin_dmpc_vreg_data,
  1968. },
  1969. };
  1970. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1971. static struct platform_device bfin_i2s = {
  1972. .name = "bfin-i2s",
  1973. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1974. /* TODO: add platform data here */
  1975. };
  1976. #endif
  1977. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1978. static struct platform_device bfin_tdm = {
  1979. .name = "bfin-tdm",
  1980. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1981. /* TODO: add platform data here */
  1982. };
  1983. #endif
  1984. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1985. static struct platform_device bfin_ac97 = {
  1986. .name = "bfin-ac97",
  1987. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1988. /* TODO: add platform data here */
  1989. };
  1990. #endif
  1991. #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
  1992. #define REGULATOR_ADP122 "adp122"
  1993. #define REGULATOR_ADP150 "adp150"
  1994. static struct regulator_consumer_supply adp122_consumers = {
  1995. .supply = REGULATOR_ADP122,
  1996. };
  1997. static struct regulator_consumer_supply adp150_consumers = {
  1998. .supply = REGULATOR_ADP150,
  1999. };
  2000. static struct regulator_init_data adp_switch_regulator_data[] = {
  2001. {
  2002. .constraints = {
  2003. .name = REGULATOR_ADP122,
  2004. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  2005. .min_uA = 0,
  2006. .max_uA = 300000,
  2007. },
  2008. .num_consumer_supplies = 1, /* only 1 */
  2009. .consumer_supplies = &adp122_consumers,
  2010. .driver_data = (void *)GPIO_PF2, /* gpio port only */
  2011. },
  2012. {
  2013. .constraints = {
  2014. .name = REGULATOR_ADP150,
  2015. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  2016. .min_uA = 0,
  2017. .max_uA = 150000,
  2018. },
  2019. .num_consumer_supplies = 1, /* only 1 */
  2020. .consumer_supplies = &adp150_consumers,
  2021. .driver_data = (void *)GPIO_PF3, /* gpio port only */
  2022. },
  2023. };
  2024. static struct adp_switch_platform_data adp_switch_pdata = {
  2025. .regulator_num = ARRAY_SIZE(adp_switch_regulator_data),
  2026. .regulator_data = adp_switch_regulator_data,
  2027. };
  2028. static struct platform_device adp_switch_device = {
  2029. .name = "adp_switch",
  2030. .id = 0,
  2031. .dev = {
  2032. .platform_data = &adp_switch_pdata,
  2033. },
  2034. };
  2035. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  2036. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  2037. static struct regulator_bulk_data adp122_bulk_data = {
  2038. .supply = REGULATOR_ADP122,
  2039. };
  2040. static struct regulator_userspace_consumer_data adp122_userspace_comsumer_data = {
  2041. .name = REGULATOR_ADP122,
  2042. .num_supplies = 1,
  2043. .supplies = &adp122_bulk_data,
  2044. };
  2045. static struct platform_device adp122_userspace_consumer_device = {
  2046. .name = "reg-userspace-consumer",
  2047. .id = 0,
  2048. .dev = {
  2049. .platform_data = &adp122_userspace_comsumer_data,
  2050. },
  2051. };
  2052. static struct regulator_bulk_data adp150_bulk_data = {
  2053. .supply = REGULATOR_ADP150,
  2054. };
  2055. static struct regulator_userspace_consumer_data adp150_userspace_comsumer_data = {
  2056. .name = REGULATOR_ADP150,
  2057. .num_supplies = 1,
  2058. .supplies = &adp150_bulk_data,
  2059. };
  2060. static struct platform_device adp150_userspace_consumer_device = {
  2061. .name = "reg-userspace-consumer",
  2062. .id = 1,
  2063. .dev = {
  2064. .platform_data = &adp150_userspace_comsumer_data,
  2065. },
  2066. };
  2067. #endif
  2068. #endif
  2069. static struct platform_device *stamp_devices[] __initdata = {
  2070. &bfin_dpmc,
  2071. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  2072. &bfin_pcmcia_cf_device,
  2073. #endif
  2074. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  2075. &rtc_device,
  2076. #endif
  2077. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  2078. &sl811_hcd_device,
  2079. #endif
  2080. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  2081. &isp1362_hcd_device,
  2082. #endif
  2083. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  2084. &bfin_isp1760_device,
  2085. #endif
  2086. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  2087. &smc91x_device,
  2088. #endif
  2089. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  2090. &dm9000_device,
  2091. #endif
  2092. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  2093. &bfin_can_device,
  2094. #endif
  2095. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  2096. &bfin_mii_bus,
  2097. &bfin_mac_device,
  2098. #endif
  2099. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  2100. &net2272_bfin_device,
  2101. #endif
  2102. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  2103. &bfin_spi0_device,
  2104. #endif
  2105. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  2106. &bfin_sport_spi0_device,
  2107. &bfin_sport_spi1_device,
  2108. #endif
  2109. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  2110. &bfin_fb_device,
  2111. #endif
  2112. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  2113. &bfin_lq035q1_device,
  2114. #endif
  2115. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  2116. #ifdef CONFIG_SERIAL_BFIN_UART0
  2117. &bfin_uart0_device,
  2118. #endif
  2119. #ifdef CONFIG_SERIAL_BFIN_UART1
  2120. &bfin_uart1_device,
  2121. #endif
  2122. #endif
  2123. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  2124. #ifdef CONFIG_BFIN_SIR0
  2125. &bfin_sir0_device,
  2126. #endif
  2127. #ifdef CONFIG_BFIN_SIR1
  2128. &bfin_sir1_device,
  2129. #endif
  2130. #endif
  2131. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  2132. &i2c_bfin_twi_device,
  2133. #endif
  2134. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  2135. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  2136. &bfin_sport0_uart_device,
  2137. #endif
  2138. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  2139. &bfin_sport1_uart_device,
  2140. #endif
  2141. #endif
  2142. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  2143. &bfin_pata_device,
  2144. #endif
  2145. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  2146. &bfin_device_gpiokeys,
  2147. #endif
  2148. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  2149. &bfin_async_nand_device,
  2150. #endif
  2151. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  2152. &stamp_flash_device,
  2153. #endif
  2154. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  2155. &bfin_i2s,
  2156. #endif
  2157. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  2158. &bfin_tdm,
  2159. #endif
  2160. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  2161. &bfin_ac97,
  2162. #endif
  2163. #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
  2164. #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \
  2165. defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE)
  2166. &ad5398_virt_consumer_device,
  2167. #endif
  2168. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  2169. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  2170. &ad5398_userspace_consumer_device,
  2171. #endif
  2172. #endif
  2173. #if defined(CONFIG_REGULATOR_ADP_SWITCH) || defined(CONFIG_REGULATOR_ADP_SWITCH_MODULE)
  2174. &adp_switch_device,
  2175. #if defined(CONFIG_REGULATOR_USERSPACE_CONSUMER) || \
  2176. defined(CONFIG_REGULATOR_USERSPACE_CONSUMER_MODULE)
  2177. &adp122_userspace_consumer_device,
  2178. &adp150_userspace_consumer_device,
  2179. #endif
  2180. #endif
  2181. };
  2182. static int __init stamp_init(void)
  2183. {
  2184. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  2185. bfin_plat_nand_init();
  2186. adf702x_mac_init();
  2187. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  2188. i2c_register_board_info(0, bfin_i2c_board_info,
  2189. ARRAY_SIZE(bfin_i2c_board_info));
  2190. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  2191. return 0;
  2192. }
  2193. arch_initcall(stamp_init);
  2194. static struct platform_device *stamp_early_devices[] __initdata = {
  2195. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  2196. #ifdef CONFIG_SERIAL_BFIN_UART0
  2197. &bfin_uart0_device,
  2198. #endif
  2199. #ifdef CONFIG_SERIAL_BFIN_UART1
  2200. &bfin_uart1_device,
  2201. #endif
  2202. #endif
  2203. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  2204. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  2205. &bfin_sport0_uart_device,
  2206. #endif
  2207. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  2208. &bfin_sport1_uart_device,
  2209. #endif
  2210. #endif
  2211. };
  2212. void __init native_machine_early_platform_add_devices(void)
  2213. {
  2214. printk(KERN_INFO "register early platform devices\n");
  2215. early_platform_add_devices(stamp_early_devices,
  2216. ARRAY_SIZE(stamp_early_devices));
  2217. }
  2218. void native_machine_restart(char *cmd)
  2219. {
  2220. /* workaround reboot hang when booting from SPI */
  2221. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  2222. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  2223. }
  2224. /*
  2225. * Currently the MAC address is saved in Flash by U-Boot
  2226. */
  2227. #define FLASH_MAC 0x203f0000
  2228. void bfin_get_ether_addr(char *addr)
  2229. {
  2230. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  2231. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  2232. }
  2233. EXPORT_SYMBOL(bfin_get_ether_addr);