stamp.c 47 KB

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