stamp.c 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. /*
  2. * File: arch/blackfin/mach-bf537/boards/stamp.c
  3. * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2006 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #include <linux/device.h>
  31. #include <linux/kernel.h>
  32. #include <linux/platform_device.h>
  33. #include <linux/mtd/mtd.h>
  34. #include <linux/mtd/nand.h>
  35. #include <linux/mtd/partitions.h>
  36. #include <linux/mtd/plat-ram.h>
  37. #include <linux/mtd/physmap.h>
  38. #include <linux/spi/spi.h>
  39. #include <linux/spi/flash.h>
  40. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  41. #include <linux/usb/isp1362.h>
  42. #endif
  43. #include <linux/ata_platform.h>
  44. #include <linux/irq.h>
  45. #include <linux/interrupt.h>
  46. #include <linux/i2c.h>
  47. #include <linux/usb/sl811.h>
  48. #include <linux/spi/mmc_spi.h>
  49. #include <asm/dma.h>
  50. #include <asm/bfin5xx_spi.h>
  51. #include <asm/reboot.h>
  52. #include <asm/portmux.h>
  53. #include <asm/dpmc.h>
  54. /*
  55. * Name the Board for the /proc/cpuinfo
  56. */
  57. const char bfin_board_name[] = "ADI BF537-STAMP";
  58. /*
  59. * Driver needs to know address, irq and flag pin.
  60. */
  61. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  62. #include <linux/usb/isp1760.h>
  63. static struct resource bfin_isp1760_resources[] = {
  64. [0] = {
  65. .start = 0x203C0000,
  66. .end = 0x203C0000 + 0x000fffff,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. .start = IRQ_PF7,
  71. .end = IRQ_PF7,
  72. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  73. },
  74. };
  75. static struct isp1760_platform_data isp1760_priv = {
  76. .is_isp1761 = 0,
  77. .port1_disable = 0,
  78. .bus_width_16 = 1,
  79. .port1_otg = 0,
  80. .analog_oc = 0,
  81. .dack_polarity_high = 0,
  82. .dreq_polarity_high = 0,
  83. };
  84. static struct platform_device bfin_isp1760_device = {
  85. .name = "isp1760-hcd",
  86. .id = 0,
  87. .dev = {
  88. .platform_data = &isp1760_priv,
  89. },
  90. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  91. .resource = bfin_isp1760_resources,
  92. };
  93. #endif
  94. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  95. #include <linux/input.h>
  96. #include <linux/gpio_keys.h>
  97. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  98. {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
  99. {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
  100. {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
  101. {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
  102. };
  103. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  104. .buttons = bfin_gpio_keys_table,
  105. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  106. };
  107. static struct platform_device bfin_device_gpiokeys = {
  108. .name = "gpio-keys",
  109. .dev = {
  110. .platform_data = &bfin_gpio_keys_data,
  111. },
  112. };
  113. #endif
  114. static struct resource bfin_gpios_resources = {
  115. .start = 0,
  116. .end = MAX_BLACKFIN_GPIOS - 1,
  117. .flags = IORESOURCE_IRQ,
  118. };
  119. static struct platform_device bfin_gpios_device = {
  120. .name = "simple-gpio",
  121. .id = -1,
  122. .num_resources = 1,
  123. .resource = &bfin_gpios_resources,
  124. };
  125. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  126. static struct resource bfin_pcmcia_cf_resources[] = {
  127. {
  128. .start = 0x20310000, /* IO PORT */
  129. .end = 0x20312000,
  130. .flags = IORESOURCE_MEM,
  131. }, {
  132. .start = 0x20311000, /* Attribute Memory */
  133. .end = 0x20311FFF,
  134. .flags = IORESOURCE_MEM,
  135. }, {
  136. .start = IRQ_PF4,
  137. .end = IRQ_PF4,
  138. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  139. }, {
  140. .start = 6, /* Card Detect PF6 */
  141. .end = 6,
  142. .flags = IORESOURCE_IRQ,
  143. },
  144. };
  145. static struct platform_device bfin_pcmcia_cf_device = {
  146. .name = "bfin_cf_pcmcia",
  147. .id = -1,
  148. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  149. .resource = bfin_pcmcia_cf_resources,
  150. };
  151. #endif
  152. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  153. static struct platform_device rtc_device = {
  154. .name = "rtc-bfin",
  155. .id = -1,
  156. };
  157. #endif
  158. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  159. static struct resource smc91x_resources[] = {
  160. {
  161. .name = "smc91x-regs",
  162. .start = 0x20300300,
  163. .end = 0x20300300 + 16,
  164. .flags = IORESOURCE_MEM,
  165. }, {
  166. .start = IRQ_PF7,
  167. .end = IRQ_PF7,
  168. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  169. },
  170. };
  171. static struct platform_device smc91x_device = {
  172. .name = "smc91x",
  173. .id = 0,
  174. .num_resources = ARRAY_SIZE(smc91x_resources),
  175. .resource = smc91x_resources,
  176. };
  177. #endif
  178. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  179. static struct resource dm9000_resources[] = {
  180. [0] = {
  181. .start = 0x203FB800,
  182. .end = 0x203FB800 + 8,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. [1] = {
  186. .start = IRQ_PF9,
  187. .end = IRQ_PF9,
  188. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  189. },
  190. };
  191. static struct platform_device dm9000_device = {
  192. .name = "dm9000",
  193. .id = -1,
  194. .num_resources = ARRAY_SIZE(dm9000_resources),
  195. .resource = dm9000_resources,
  196. };
  197. #endif
  198. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  199. static struct resource ax88180_resources[] = {
  200. [0] = {
  201. .start = 0x20300000,
  202. .end = 0x20300000 + 0x8000,
  203. .flags = IORESOURCE_MEM,
  204. },
  205. [1] = {
  206. .start = IRQ_PF7,
  207. .end = IRQ_PF7,
  208. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
  209. },
  210. };
  211. static struct platform_device ax88180_device = {
  212. .name = "ax88180",
  213. .id = -1,
  214. .num_resources = ARRAY_SIZE(ax88180_resources),
  215. .resource = ax88180_resources,
  216. };
  217. #endif
  218. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  219. static struct resource sl811_hcd_resources[] = {
  220. {
  221. .start = 0x20340000,
  222. .end = 0x20340000,
  223. .flags = IORESOURCE_MEM,
  224. }, {
  225. .start = 0x20340004,
  226. .end = 0x20340004,
  227. .flags = IORESOURCE_MEM,
  228. }, {
  229. .start = CONFIG_USB_SL811_BFIN_IRQ,
  230. .end = CONFIG_USB_SL811_BFIN_IRQ,
  231. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  232. },
  233. };
  234. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  235. void sl811_port_power(struct device *dev, int is_on)
  236. {
  237. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  238. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  239. }
  240. #endif
  241. static struct sl811_platform_data sl811_priv = {
  242. .potpg = 10,
  243. .power = 250, /* == 500mA */
  244. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  245. .port_power = &sl811_port_power,
  246. #endif
  247. };
  248. static struct platform_device sl811_hcd_device = {
  249. .name = "sl811-hcd",
  250. .id = 0,
  251. .dev = {
  252. .platform_data = &sl811_priv,
  253. },
  254. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  255. .resource = sl811_hcd_resources,
  256. };
  257. #endif
  258. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  259. static struct resource isp1362_hcd_resources[] = {
  260. {
  261. .start = 0x20360000,
  262. .end = 0x20360000,
  263. .flags = IORESOURCE_MEM,
  264. }, {
  265. .start = 0x20360004,
  266. .end = 0x20360004,
  267. .flags = IORESOURCE_MEM,
  268. }, {
  269. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  270. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  271. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  272. },
  273. };
  274. static struct isp1362_platform_data isp1362_priv = {
  275. .sel15Kres = 1,
  276. .clknotstop = 0,
  277. .oc_enable = 0,
  278. .int_act_high = 0,
  279. .int_edge_triggered = 0,
  280. .remote_wakeup_connected = 0,
  281. .no_power_switching = 1,
  282. .power_switching_mode = 0,
  283. };
  284. static struct platform_device isp1362_hcd_device = {
  285. .name = "isp1362-hcd",
  286. .id = 0,
  287. .dev = {
  288. .platform_data = &isp1362_priv,
  289. },
  290. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  291. .resource = isp1362_hcd_resources,
  292. };
  293. #endif
  294. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  295. static struct platform_device bfin_mii_bus = {
  296. .name = "bfin_mii_bus",
  297. };
  298. static struct platform_device bfin_mac_device = {
  299. .name = "bfin_mac",
  300. .dev.platform_data = &bfin_mii_bus,
  301. };
  302. #endif
  303. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  304. static struct resource net2272_bfin_resources[] = {
  305. {
  306. .start = 0x20300000,
  307. .end = 0x20300000 + 0x100,
  308. .flags = IORESOURCE_MEM,
  309. }, {
  310. .start = IRQ_PF7,
  311. .end = IRQ_PF7,
  312. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  313. },
  314. };
  315. static struct platform_device net2272_bfin_device = {
  316. .name = "net2272",
  317. .id = -1,
  318. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  319. .resource = net2272_bfin_resources,
  320. };
  321. #endif
  322. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  323. #ifdef CONFIG_MTD_PARTITIONS
  324. const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
  325. static struct mtd_partition bfin_plat_nand_partitions[] = {
  326. {
  327. .name = "linux kernel(nand)",
  328. .size = 0x400000,
  329. .offset = 0,
  330. }, {
  331. .name = "file system(nand)",
  332. .size = MTDPART_SIZ_FULL,
  333. .offset = MTDPART_OFS_APPEND,
  334. },
  335. };
  336. #endif
  337. #define BFIN_NAND_PLAT_CLE 2
  338. #define BFIN_NAND_PLAT_ALE 1
  339. static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  340. {
  341. struct nand_chip *this = mtd->priv;
  342. if (cmd == NAND_CMD_NONE)
  343. return;
  344. if (ctrl & NAND_CLE)
  345. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
  346. else
  347. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
  348. }
  349. #define BFIN_NAND_PLAT_READY GPIO_PF3
  350. static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
  351. {
  352. return gpio_get_value(BFIN_NAND_PLAT_READY);
  353. }
  354. static struct platform_nand_data bfin_plat_nand_data = {
  355. .chip = {
  356. .chip_delay = 30,
  357. #ifdef CONFIG_MTD_PARTITIONS
  358. .part_probe_types = part_probes,
  359. .partitions = bfin_plat_nand_partitions,
  360. .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
  361. #endif
  362. },
  363. .ctrl = {
  364. .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
  365. .dev_ready = bfin_plat_nand_dev_ready,
  366. },
  367. };
  368. #define MAX(x, y) (x > y ? x : y)
  369. static struct resource bfin_plat_nand_resources = {
  370. .start = 0x20212000,
  371. .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
  372. .flags = IORESOURCE_IO,
  373. };
  374. static struct platform_device bfin_async_nand_device = {
  375. .name = "gen_nand",
  376. .id = -1,
  377. .num_resources = 1,
  378. .resource = &bfin_plat_nand_resources,
  379. .dev = {
  380. .platform_data = &bfin_plat_nand_data,
  381. },
  382. };
  383. static void bfin_plat_nand_init(void)
  384. {
  385. gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
  386. }
  387. #else
  388. static void bfin_plat_nand_init(void) {}
  389. #endif
  390. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  391. static struct mtd_partition stamp_partitions[] = {
  392. {
  393. .name = "bootloader(nor)",
  394. .size = 0x40000,
  395. .offset = 0,
  396. }, {
  397. .name = "linux kernel(nor)",
  398. .size = 0x180000,
  399. .offset = MTDPART_OFS_APPEND,
  400. }, {
  401. .name = "file system(nor)",
  402. .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
  403. .offset = MTDPART_OFS_APPEND,
  404. }, {
  405. .name = "MAC Address(nor)",
  406. .size = MTDPART_SIZ_FULL,
  407. .offset = 0x3F0000,
  408. .mask_flags = MTD_WRITEABLE,
  409. }
  410. };
  411. static struct physmap_flash_data stamp_flash_data = {
  412. .width = 2,
  413. .parts = stamp_partitions,
  414. .nr_parts = ARRAY_SIZE(stamp_partitions),
  415. };
  416. static struct resource stamp_flash_resource = {
  417. .start = 0x20000000,
  418. .end = 0x203fffff,
  419. .flags = IORESOURCE_MEM,
  420. };
  421. static struct platform_device stamp_flash_device = {
  422. .name = "physmap-flash",
  423. .id = 0,
  424. .dev = {
  425. .platform_data = &stamp_flash_data,
  426. },
  427. .num_resources = 1,
  428. .resource = &stamp_flash_resource,
  429. };
  430. #endif
  431. #if defined(CONFIG_MTD_M25P80) \
  432. || defined(CONFIG_MTD_M25P80_MODULE)
  433. static struct mtd_partition bfin_spi_flash_partitions[] = {
  434. {
  435. .name = "bootloader(spi)",
  436. .size = 0x00040000,
  437. .offset = 0,
  438. .mask_flags = MTD_CAP_ROM
  439. }, {
  440. .name = "linux kernel(spi)",
  441. .size = 0x180000,
  442. .offset = MTDPART_OFS_APPEND,
  443. }, {
  444. .name = "file system(spi)",
  445. .size = MTDPART_SIZ_FULL,
  446. .offset = MTDPART_OFS_APPEND,
  447. }
  448. };
  449. static struct flash_platform_data bfin_spi_flash_data = {
  450. .name = "m25p80",
  451. .parts = bfin_spi_flash_partitions,
  452. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  453. /* .type = "m25p64", */
  454. };
  455. /* SPI flash chip (m25p64) */
  456. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  457. .enable_dma = 0, /* use dma transfer with this chip*/
  458. .bits_per_word = 8,
  459. };
  460. #endif
  461. #if defined(CONFIG_SPI_ADC_BF533) \
  462. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  463. /* SPI ADC chip */
  464. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  465. .enable_dma = 1, /* use dma transfer with this chip*/
  466. .bits_per_word = 16,
  467. };
  468. #endif
  469. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  470. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  471. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  472. .enable_dma = 0,
  473. .bits_per_word = 16,
  474. };
  475. #endif
  476. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  477. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  478. .enable_dma = 0,
  479. .bits_per_word = 16,
  480. };
  481. #endif
  482. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  483. #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
  484. static int bfin_mmc_spi_init(struct device *dev,
  485. irqreturn_t (*detect_int)(int, void *), void *data)
  486. {
  487. return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
  488. IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
  489. }
  490. static void bfin_mmc_spi_exit(struct device *dev, void *data)
  491. {
  492. free_irq(MMC_SPI_CARD_DETECT_INT, data);
  493. }
  494. static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
  495. .init = bfin_mmc_spi_init,
  496. .exit = bfin_mmc_spi_exit,
  497. .detect_delay = 100, /* msecs */
  498. };
  499. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  500. .enable_dma = 0,
  501. .bits_per_word = 8,
  502. };
  503. #endif
  504. #if defined(CONFIG_PBX)
  505. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  506. .ctl_reg = 0x4, /* send zero */
  507. .enable_dma = 0,
  508. .bits_per_word = 8,
  509. .cs_change_per_word = 1,
  510. };
  511. #endif
  512. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  513. #include <linux/spi/ad7877.h>
  514. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  515. .enable_dma = 0,
  516. .bits_per_word = 16,
  517. };
  518. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  519. .model = 7877,
  520. .vref_delay_usecs = 50, /* internal, no capacitor */
  521. .x_plate_ohms = 419,
  522. .y_plate_ohms = 486,
  523. .pressure_max = 1000,
  524. .pressure_min = 0,
  525. .stopacq_polarity = 1,
  526. .first_conversion_delay = 3,
  527. .acquisition_time = 1,
  528. .averaging = 1,
  529. .pen_down_acc_interval = 1,
  530. };
  531. #endif
  532. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  533. #include <linux/spi/ad7879.h>
  534. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  535. .model = 7879, /* Model = AD7879 */
  536. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  537. .pressure_max = 10000,
  538. .pressure_min = 0,
  539. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  540. .acquisition_time = 1, /* 4us acquisition time per sample */
  541. .median = 2, /* do 8 measurements */
  542. .averaging = 1, /* take the average of 4 middle samples */
  543. .pen_down_acc_interval = 255, /* 9.4 ms */
  544. .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
  545. .gpio_default = 1, /* During initialization set GPIO = HIGH */
  546. };
  547. #endif
  548. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  549. static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
  550. .enable_dma = 0,
  551. .bits_per_word = 16,
  552. };
  553. #endif
  554. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  555. static struct bfin5xx_spi_chip spidev_chip_info = {
  556. .enable_dma = 0,
  557. .bits_per_word = 8,
  558. };
  559. #endif
  560. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  561. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  562. .enable_dma = 0,
  563. .bits_per_word = 8,
  564. };
  565. #endif
  566. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  567. static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
  568. .enable_dma = 1,
  569. .bits_per_word = 8,
  570. .cs_gpio = GPIO_PF10,
  571. };
  572. #endif
  573. #if defined(CONFIG_MTD_DATAFLASH) \
  574. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  575. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  576. {
  577. .name = "bootloader(spi)",
  578. .size = 0x00040000,
  579. .offset = 0,
  580. .mask_flags = MTD_CAP_ROM
  581. }, {
  582. .name = "linux kernel(spi)",
  583. .size = 0x180000,
  584. .offset = MTDPART_OFS_APPEND,
  585. }, {
  586. .name = "file system(spi)",
  587. .size = MTDPART_SIZ_FULL,
  588. .offset = MTDPART_OFS_APPEND,
  589. }
  590. };
  591. static struct flash_platform_data bfin_spi_dataflash_data = {
  592. .name = "SPI Dataflash",
  593. .parts = bfin_spi_dataflash_partitions,
  594. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  595. };
  596. /* DataFlash chip */
  597. static struct bfin5xx_spi_chip data_flash_chip_info = {
  598. .enable_dma = 0, /* use dma transfer with this chip*/
  599. .bits_per_word = 8,
  600. };
  601. #endif
  602. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  603. #if defined(CONFIG_MTD_M25P80) \
  604. || defined(CONFIG_MTD_M25P80_MODULE)
  605. {
  606. /* the modalias must be the same as spi device driver name */
  607. .modalias = "m25p80", /* Name of spi_driver for this device */
  608. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  609. .bus_num = 0, /* Framework bus number */
  610. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  611. .platform_data = &bfin_spi_flash_data,
  612. .controller_data = &spi_flash_chip_info,
  613. .mode = SPI_MODE_3,
  614. },
  615. #endif
  616. #if defined(CONFIG_MTD_DATAFLASH) \
  617. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  618. { /* DataFlash chip */
  619. .modalias = "mtd_dataflash",
  620. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  621. .bus_num = 0, /* Framework bus number */
  622. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  623. .platform_data = &bfin_spi_dataflash_data,
  624. .controller_data = &data_flash_chip_info,
  625. .mode = SPI_MODE_3,
  626. },
  627. #endif
  628. #if defined(CONFIG_SPI_ADC_BF533) \
  629. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  630. {
  631. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  632. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  633. .bus_num = 0, /* Framework bus number */
  634. .chip_select = 1, /* Framework chip select. */
  635. .platform_data = NULL, /* No spi_driver specific config */
  636. .controller_data = &spi_adc_chip_info,
  637. },
  638. #endif
  639. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  640. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  641. {
  642. .modalias = "ad1836-spi",
  643. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  644. .bus_num = 0,
  645. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  646. .controller_data = &ad1836_spi_chip_info,
  647. },
  648. #endif
  649. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  650. {
  651. .modalias = "ad9960-spi",
  652. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  653. .bus_num = 0,
  654. .chip_select = 1,
  655. .controller_data = &ad9960_spi_chip_info,
  656. },
  657. #endif
  658. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  659. {
  660. .modalias = "mmc_spi",
  661. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  662. .bus_num = 0,
  663. .chip_select = 4,
  664. .platform_data = &bfin_mmc_spi_pdata,
  665. .controller_data = &mmc_spi_chip_info,
  666. .mode = SPI_MODE_3,
  667. },
  668. #endif
  669. #if defined(CONFIG_PBX)
  670. {
  671. .modalias = "fxs-spi",
  672. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  673. .bus_num = 0,
  674. .chip_select = 8 - CONFIG_J11_JUMPER,
  675. .controller_data = &spi_si3xxx_chip_info,
  676. .mode = SPI_MODE_3,
  677. },
  678. {
  679. .modalias = "fxo-spi",
  680. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  681. .bus_num = 0,
  682. .chip_select = 8 - CONFIG_J19_JUMPER,
  683. .controller_data = &spi_si3xxx_chip_info,
  684. .mode = SPI_MODE_3,
  685. },
  686. #endif
  687. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  688. {
  689. .modalias = "ad7877",
  690. .platform_data = &bfin_ad7877_ts_info,
  691. .irq = IRQ_PF6,
  692. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  693. .bus_num = 0,
  694. .chip_select = 1,
  695. .controller_data = &spi_ad7877_chip_info,
  696. },
  697. #endif
  698. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  699. {
  700. .modalias = "ad7879",
  701. .platform_data = &bfin_ad7879_ts_info,
  702. .irq = IRQ_PF7,
  703. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  704. .bus_num = 0,
  705. .chip_select = 1,
  706. .controller_data = &spi_ad7879_chip_info,
  707. .mode = SPI_CPHA | SPI_CPOL,
  708. },
  709. #endif
  710. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  711. {
  712. .modalias = "spidev",
  713. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  714. .bus_num = 0,
  715. .chip_select = 1,
  716. .controller_data = &spidev_chip_info,
  717. },
  718. #endif
  719. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  720. {
  721. .modalias = "bfin-lq035q1-spi",
  722. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  723. .bus_num = 0,
  724. .chip_select = 2,
  725. .controller_data = &lq035q1_spi_chip_info,
  726. .mode = SPI_CPHA | SPI_CPOL,
  727. },
  728. #endif
  729. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  730. {
  731. .modalias = "enc28j60",
  732. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  733. .irq = IRQ_PF6,
  734. .bus_num = 0,
  735. .chip_select = 0, /* GPIO controlled SSEL */
  736. .controller_data = &enc28j60_spi_chip_info,
  737. .mode = SPI_MODE_0,
  738. },
  739. #endif
  740. };
  741. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  742. /* SPI controller data */
  743. static struct bfin5xx_spi_master bfin_spi0_info = {
  744. .num_chipselect = 8,
  745. .enable_dma = 1, /* master has the ability to do dma transfer */
  746. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  747. };
  748. /* SPI (0) */
  749. static struct resource bfin_spi0_resource[] = {
  750. [0] = {
  751. .start = SPI0_REGBASE,
  752. .end = SPI0_REGBASE + 0xFF,
  753. .flags = IORESOURCE_MEM,
  754. },
  755. [1] = {
  756. .start = CH_SPI,
  757. .end = CH_SPI,
  758. .flags = IORESOURCE_IRQ,
  759. },
  760. };
  761. static struct platform_device bfin_spi0_device = {
  762. .name = "bfin-spi",
  763. .id = 0, /* Bus number */
  764. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  765. .resource = bfin_spi0_resource,
  766. .dev = {
  767. .platform_data = &bfin_spi0_info, /* Passed to driver */
  768. },
  769. };
  770. #endif /* spi master and devices */
  771. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  772. /* SPORT SPI controller data */
  773. static struct bfin5xx_spi_master bfin_sport_spi0_info = {
  774. .num_chipselect = 1, /* master only supports one device */
  775. .enable_dma = 0, /* master don't support DMA */
  776. .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
  777. P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
  778. };
  779. static struct resource bfin_sport_spi0_resource[] = {
  780. [0] = {
  781. .start = SPORT0_TCR1,
  782. .end = SPORT0_TCR1 + 0xFF,
  783. .flags = IORESOURCE_MEM,
  784. },
  785. [1] = {
  786. .start = IRQ_SPORT0_ERROR,
  787. .end = IRQ_SPORT0_ERROR,
  788. .flags = IORESOURCE_IRQ,
  789. },
  790. };
  791. static struct platform_device bfin_sport_spi0_device = {
  792. .name = "bfin-sport-spi",
  793. .id = 1, /* Bus number */
  794. .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
  795. .resource = bfin_sport_spi0_resource,
  796. .dev = {
  797. .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
  798. },
  799. };
  800. static struct bfin5xx_spi_master bfin_sport_spi1_info = {
  801. .num_chipselect = 1, /* master only supports one device */
  802. .enable_dma = 0, /* master don't support DMA */
  803. .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
  804. P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
  805. };
  806. static struct resource bfin_sport_spi1_resource[] = {
  807. [0] = {
  808. .start = SPORT1_TCR1,
  809. .end = SPORT1_TCR1 + 0xFF,
  810. .flags = IORESOURCE_MEM,
  811. },
  812. [1] = {
  813. .start = IRQ_SPORT1_ERROR,
  814. .end = IRQ_SPORT1_ERROR,
  815. .flags = IORESOURCE_IRQ,
  816. },
  817. };
  818. static struct platform_device bfin_sport_spi1_device = {
  819. .name = "bfin-sport-spi",
  820. .id = 2, /* Bus number */
  821. .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
  822. .resource = bfin_sport_spi1_resource,
  823. .dev = {
  824. .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
  825. },
  826. };
  827. #endif /* sport spi master and devices */
  828. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  829. static struct platform_device bfin_fb_device = {
  830. .name = "bf537-lq035",
  831. };
  832. #endif
  833. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  834. static struct platform_device bfin_fb_adv7393_device = {
  835. .name = "bfin-adv7393",
  836. };
  837. #endif
  838. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  839. #include <asm/bfin-lq035q1.h>
  840. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  841. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  842. .use_bl = 0, /* let something else control the LCD Blacklight */
  843. .gpio_bl = GPIO_PF7,
  844. };
  845. static struct resource bfin_lq035q1_resources[] = {
  846. {
  847. .start = IRQ_PPI_ERROR,
  848. .end = IRQ_PPI_ERROR,
  849. .flags = IORESOURCE_IRQ,
  850. },
  851. };
  852. static struct platform_device bfin_lq035q1_device = {
  853. .name = "bfin-lq035q1",
  854. .id = -1,
  855. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  856. .resource = bfin_lq035q1_resources,
  857. .dev = {
  858. .platform_data = &bfin_lq035q1_data,
  859. },
  860. };
  861. #endif
  862. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  863. static struct resource bfin_uart_resources[] = {
  864. #ifdef CONFIG_SERIAL_BFIN_UART0
  865. {
  866. .start = 0xFFC00400,
  867. .end = 0xFFC004FF,
  868. .flags = IORESOURCE_MEM,
  869. },
  870. #endif
  871. #ifdef CONFIG_SERIAL_BFIN_UART1
  872. {
  873. .start = 0xFFC02000,
  874. .end = 0xFFC020FF,
  875. .flags = IORESOURCE_MEM,
  876. },
  877. #endif
  878. };
  879. static struct platform_device bfin_uart_device = {
  880. .name = "bfin-uart",
  881. .id = 1,
  882. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  883. .resource = bfin_uart_resources,
  884. };
  885. #endif
  886. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  887. #ifdef CONFIG_BFIN_SIR0
  888. static struct resource bfin_sir0_resources[] = {
  889. {
  890. .start = 0xFFC00400,
  891. .end = 0xFFC004FF,
  892. .flags = IORESOURCE_MEM,
  893. },
  894. {
  895. .start = IRQ_UART0_RX,
  896. .end = IRQ_UART0_RX+1,
  897. .flags = IORESOURCE_IRQ,
  898. },
  899. {
  900. .start = CH_UART0_RX,
  901. .end = CH_UART0_RX+1,
  902. .flags = IORESOURCE_DMA,
  903. },
  904. };
  905. static struct platform_device bfin_sir0_device = {
  906. .name = "bfin_sir",
  907. .id = 0,
  908. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  909. .resource = bfin_sir0_resources,
  910. };
  911. #endif
  912. #ifdef CONFIG_BFIN_SIR1
  913. static struct resource bfin_sir1_resources[] = {
  914. {
  915. .start = 0xFFC02000,
  916. .end = 0xFFC020FF,
  917. .flags = IORESOURCE_MEM,
  918. },
  919. {
  920. .start = IRQ_UART1_RX,
  921. .end = IRQ_UART1_RX+1,
  922. .flags = IORESOURCE_IRQ,
  923. },
  924. {
  925. .start = CH_UART1_RX,
  926. .end = CH_UART1_RX+1,
  927. .flags = IORESOURCE_DMA,
  928. },
  929. };
  930. static struct platform_device bfin_sir1_device = {
  931. .name = "bfin_sir",
  932. .id = 1,
  933. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  934. .resource = bfin_sir1_resources,
  935. };
  936. #endif
  937. #endif
  938. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  939. static struct resource bfin_twi0_resource[] = {
  940. [0] = {
  941. .start = TWI0_REGBASE,
  942. .end = TWI0_REGBASE,
  943. .flags = IORESOURCE_MEM,
  944. },
  945. [1] = {
  946. .start = IRQ_TWI,
  947. .end = IRQ_TWI,
  948. .flags = IORESOURCE_IRQ,
  949. },
  950. };
  951. static struct platform_device i2c_bfin_twi_device = {
  952. .name = "i2c-bfin-twi",
  953. .id = 0,
  954. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  955. .resource = bfin_twi0_resource,
  956. };
  957. #endif
  958. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  959. #include <linux/input.h>
  960. #include <linux/i2c/adp5588_keys.h>
  961. static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
  962. [0] = KEY_GRAVE,
  963. [1] = KEY_1,
  964. [2] = KEY_2,
  965. [3] = KEY_3,
  966. [4] = KEY_4,
  967. [5] = KEY_5,
  968. [6] = KEY_6,
  969. [7] = KEY_7,
  970. [8] = KEY_8,
  971. [9] = KEY_9,
  972. [10] = KEY_0,
  973. [11] = KEY_MINUS,
  974. [12] = KEY_EQUAL,
  975. [13] = KEY_BACKSLASH,
  976. [15] = KEY_KP0,
  977. [16] = KEY_Q,
  978. [17] = KEY_W,
  979. [18] = KEY_E,
  980. [19] = KEY_R,
  981. [20] = KEY_T,
  982. [21] = KEY_Y,
  983. [22] = KEY_U,
  984. [23] = KEY_I,
  985. [24] = KEY_O,
  986. [25] = KEY_P,
  987. [26] = KEY_LEFTBRACE,
  988. [27] = KEY_RIGHTBRACE,
  989. [29] = KEY_KP1,
  990. [30] = KEY_KP2,
  991. [31] = KEY_KP3,
  992. [32] = KEY_A,
  993. [33] = KEY_S,
  994. [34] = KEY_D,
  995. [35] = KEY_F,
  996. [36] = KEY_G,
  997. [37] = KEY_H,
  998. [38] = KEY_J,
  999. [39] = KEY_K,
  1000. [40] = KEY_L,
  1001. [41] = KEY_SEMICOLON,
  1002. [42] = KEY_APOSTROPHE,
  1003. [43] = KEY_BACKSLASH,
  1004. [45] = KEY_KP4,
  1005. [46] = KEY_KP5,
  1006. [47] = KEY_KP6,
  1007. [48] = KEY_102ND,
  1008. [49] = KEY_Z,
  1009. [50] = KEY_X,
  1010. [51] = KEY_C,
  1011. [52] = KEY_V,
  1012. [53] = KEY_B,
  1013. [54] = KEY_N,
  1014. [55] = KEY_M,
  1015. [56] = KEY_COMMA,
  1016. [57] = KEY_DOT,
  1017. [58] = KEY_SLASH,
  1018. [60] = KEY_KPDOT,
  1019. [61] = KEY_KP7,
  1020. [62] = KEY_KP8,
  1021. [63] = KEY_KP9,
  1022. [64] = KEY_SPACE,
  1023. [65] = KEY_BACKSPACE,
  1024. [66] = KEY_TAB,
  1025. [67] = KEY_KPENTER,
  1026. [68] = KEY_ENTER,
  1027. [69] = KEY_ESC,
  1028. [70] = KEY_DELETE,
  1029. [74] = KEY_KPMINUS,
  1030. [76] = KEY_UP,
  1031. [77] = KEY_DOWN,
  1032. [78] = KEY_RIGHT,
  1033. [79] = KEY_LEFT,
  1034. };
  1035. static struct adp5588_kpad_platform_data adp5588_kpad_data = {
  1036. .rows = 8,
  1037. .cols = 10,
  1038. .keymap = adp5588_keymap,
  1039. .keymapsize = ARRAY_SIZE(adp5588_keymap),
  1040. .repeat = 0,
  1041. };
  1042. #endif
  1043. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1044. #include <linux/mfd/adp5520.h>
  1045. /*
  1046. * ADP5520/5501 Backlight Data
  1047. */
  1048. static struct adp5520_backlight_platfrom_data adp5520_backlight_data = {
  1049. .fade_in = FADE_T_1200ms,
  1050. .fade_out = FADE_T_1200ms,
  1051. .fade_led_law = BL_LAW_LINEAR,
  1052. .en_ambl_sens = 1,
  1053. .abml_filt = BL_AMBL_FILT_640ms,
  1054. .l1_daylight_max = BL_CUR_mA(15),
  1055. .l1_daylight_dim = BL_CUR_mA(0),
  1056. .l2_office_max = BL_CUR_mA(7),
  1057. .l2_office_dim = BL_CUR_mA(0),
  1058. .l3_dark_max = BL_CUR_mA(3),
  1059. .l3_dark_dim = BL_CUR_mA(0),
  1060. .l2_trip = L2_COMP_CURR_uA(700),
  1061. .l2_hyst = L2_COMP_CURR_uA(50),
  1062. .l3_trip = L3_COMP_CURR_uA(80),
  1063. .l3_hyst = L3_COMP_CURR_uA(20),
  1064. };
  1065. /*
  1066. * ADP5520/5501 LEDs Data
  1067. */
  1068. #include <linux/leds.h>
  1069. static struct led_info adp5520_leds[] = {
  1070. {
  1071. .name = "adp5520-led1",
  1072. .default_trigger = "none",
  1073. .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | LED_OFFT_600ms,
  1074. },
  1075. #ifdef ADP5520_EN_ALL_LEDS
  1076. {
  1077. .name = "adp5520-led2",
  1078. .default_trigger = "none",
  1079. .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
  1080. },
  1081. {
  1082. .name = "adp5520-led3",
  1083. .default_trigger = "none",
  1084. .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
  1085. },
  1086. #endif
  1087. };
  1088. static struct adp5520_leds_platfrom_data adp5520_leds_data = {
  1089. .num_leds = ARRAY_SIZE(adp5520_leds),
  1090. .leds = adp5520_leds,
  1091. .fade_in = FADE_T_600ms,
  1092. .fade_out = FADE_T_600ms,
  1093. .led_on_time = LED_ONT_600ms,
  1094. };
  1095. /*
  1096. * ADP5520 GPIO Data
  1097. */
  1098. static struct adp5520_gpio_platfrom_data adp5520_gpio_data = {
  1099. .gpio_start = 50,
  1100. .gpio_en_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
  1101. .gpio_pullup_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
  1102. };
  1103. /*
  1104. * ADP5520 Keypad Data
  1105. */
  1106. #include <linux/input.h>
  1107. static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
  1108. [KEY(0, 0)] = KEY_GRAVE,
  1109. [KEY(0, 1)] = KEY_1,
  1110. [KEY(0, 2)] = KEY_2,
  1111. [KEY(0, 3)] = KEY_3,
  1112. [KEY(1, 0)] = KEY_4,
  1113. [KEY(1, 1)] = KEY_5,
  1114. [KEY(1, 2)] = KEY_6,
  1115. [KEY(1, 3)] = KEY_7,
  1116. [KEY(2, 0)] = KEY_8,
  1117. [KEY(2, 1)] = KEY_9,
  1118. [KEY(2, 2)] = KEY_0,
  1119. [KEY(2, 3)] = KEY_MINUS,
  1120. [KEY(3, 0)] = KEY_EQUAL,
  1121. [KEY(3, 1)] = KEY_BACKSLASH,
  1122. [KEY(3, 2)] = KEY_BACKSPACE,
  1123. [KEY(3, 3)] = KEY_ENTER,
  1124. };
  1125. static struct adp5520_keys_platfrom_data adp5520_keys_data = {
  1126. .rows_en_mask = ROW_R3 | ROW_R2 | ROW_R1 | ROW_R0,
  1127. .cols_en_mask = COL_C3 | COL_C2 | COL_C1 | COL_C0,
  1128. .keymap = adp5520_keymap,
  1129. .keymapsize = ARRAY_SIZE(adp5520_keymap),
  1130. .repeat = 0,
  1131. };
  1132. /*
  1133. * ADP5520/5501 Multifuction Device Init Data
  1134. */
  1135. static struct adp5520_subdev_info adp5520_subdevs[] = {
  1136. {
  1137. .name = "adp5520-backlight",
  1138. .id = ID_ADP5520,
  1139. .platform_data = &adp5520_backlight_data,
  1140. },
  1141. {
  1142. .name = "adp5520-led",
  1143. .id = ID_ADP5520,
  1144. .platform_data = &adp5520_leds_data,
  1145. },
  1146. {
  1147. .name = "adp5520-gpio",
  1148. .id = ID_ADP5520,
  1149. .platform_data = &adp5520_gpio_data,
  1150. },
  1151. {
  1152. .name = "adp5520-keys",
  1153. .id = ID_ADP5520,
  1154. .platform_data = &adp5520_keys_data,
  1155. },
  1156. };
  1157. static struct adp5520_platform_data adp5520_pdev_data = {
  1158. .num_subdevs = ARRAY_SIZE(adp5520_subdevs),
  1159. .subdevs = adp5520_subdevs,
  1160. };
  1161. #endif
  1162. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  1163. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  1164. {
  1165. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  1166. .irq = IRQ_PF5,
  1167. },
  1168. #endif
  1169. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  1170. {
  1171. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1172. },
  1173. #endif
  1174. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  1175. {
  1176. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1177. .irq = IRQ_PG6,
  1178. },
  1179. #endif
  1180. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  1181. {
  1182. I2C_BOARD_INFO("ad7879", 0x2F),
  1183. .irq = IRQ_PG5,
  1184. .platform_data = (void *)&bfin_ad7879_ts_info,
  1185. },
  1186. #endif
  1187. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1188. {
  1189. I2C_BOARD_INFO("adp5588-keys", 0x34),
  1190. .irq = IRQ_PG0,
  1191. .platform_data = (void *)&adp5588_kpad_data,
  1192. },
  1193. #endif
  1194. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1195. {
  1196. I2C_BOARD_INFO("pmic-adp5520", 0x32),
  1197. .irq = IRQ_PF7,
  1198. .platform_data = (void *)&adp5520_pdev_data,
  1199. },
  1200. #endif
  1201. };
  1202. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1203. static struct platform_device bfin_sport0_uart_device = {
  1204. .name = "bfin-sport-uart",
  1205. .id = 0,
  1206. };
  1207. static struct platform_device bfin_sport1_uart_device = {
  1208. .name = "bfin-sport-uart",
  1209. .id = 1,
  1210. };
  1211. #endif
  1212. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1213. #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1214. /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
  1215. #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1216. #define PATA_INT IRQ_PF5
  1217. static struct pata_platform_info bfin_pata_platform_data = {
  1218. .ioport_shift = 1,
  1219. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  1220. };
  1221. static struct resource bfin_pata_resources[] = {
  1222. {
  1223. .start = 0x20314020,
  1224. .end = 0x2031403F,
  1225. .flags = IORESOURCE_MEM,
  1226. },
  1227. {
  1228. .start = 0x2031401C,
  1229. .end = 0x2031401F,
  1230. .flags = IORESOURCE_MEM,
  1231. },
  1232. {
  1233. .start = PATA_INT,
  1234. .end = PATA_INT,
  1235. .flags = IORESOURCE_IRQ,
  1236. },
  1237. };
  1238. #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
  1239. static struct pata_platform_info bfin_pata_platform_data = {
  1240. .ioport_shift = 0,
  1241. };
  1242. static struct resource bfin_pata_resources[] = {
  1243. {
  1244. .start = 0x20211820,
  1245. .end = 0x2021183F,
  1246. .flags = IORESOURCE_MEM,
  1247. },
  1248. {
  1249. .start = 0x2021181C,
  1250. .end = 0x2021181F,
  1251. .flags = IORESOURCE_MEM,
  1252. },
  1253. };
  1254. #endif
  1255. static struct platform_device bfin_pata_device = {
  1256. .name = "pata_platform",
  1257. .id = -1,
  1258. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  1259. .resource = bfin_pata_resources,
  1260. .dev = {
  1261. .platform_data = &bfin_pata_platform_data,
  1262. }
  1263. };
  1264. #endif
  1265. static const unsigned int cclk_vlev_datasheet[] =
  1266. {
  1267. VRPAIR(VLEV_085, 250000000),
  1268. VRPAIR(VLEV_090, 376000000),
  1269. VRPAIR(VLEV_095, 426000000),
  1270. VRPAIR(VLEV_100, 426000000),
  1271. VRPAIR(VLEV_105, 476000000),
  1272. VRPAIR(VLEV_110, 476000000),
  1273. VRPAIR(VLEV_115, 476000000),
  1274. VRPAIR(VLEV_120, 500000000),
  1275. VRPAIR(VLEV_125, 533000000),
  1276. VRPAIR(VLEV_130, 600000000),
  1277. };
  1278. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1279. .tuple_tab = cclk_vlev_datasheet,
  1280. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1281. .vr_settling_time = 25 /* us */,
  1282. };
  1283. static struct platform_device bfin_dpmc = {
  1284. .name = "bfin dpmc",
  1285. .dev = {
  1286. .platform_data = &bfin_dmpc_vreg_data,
  1287. },
  1288. };
  1289. static struct platform_device *stamp_devices[] __initdata = {
  1290. &bfin_dpmc,
  1291. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  1292. &bfin_pcmcia_cf_device,
  1293. #endif
  1294. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1295. &rtc_device,
  1296. #endif
  1297. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  1298. &sl811_hcd_device,
  1299. #endif
  1300. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  1301. &isp1362_hcd_device,
  1302. #endif
  1303. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1304. &bfin_isp1760_device,
  1305. #endif
  1306. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  1307. &smc91x_device,
  1308. #endif
  1309. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  1310. &dm9000_device,
  1311. #endif
  1312. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  1313. &ax88180_device,
  1314. #endif
  1315. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  1316. &bfin_mii_bus,
  1317. &bfin_mac_device,
  1318. #endif
  1319. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  1320. &net2272_bfin_device,
  1321. #endif
  1322. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1323. &bfin_spi0_device,
  1324. #endif
  1325. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  1326. &bfin_sport_spi0_device,
  1327. &bfin_sport_spi1_device,
  1328. #endif
  1329. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  1330. &bfin_fb_device,
  1331. #endif
  1332. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  1333. &bfin_lq035q1_device,
  1334. #endif
  1335. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  1336. &bfin_fb_adv7393_device,
  1337. #endif
  1338. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1339. &bfin_uart_device,
  1340. #endif
  1341. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1342. #ifdef CONFIG_BFIN_SIR0
  1343. &bfin_sir0_device,
  1344. #endif
  1345. #ifdef CONFIG_BFIN_SIR1
  1346. &bfin_sir1_device,
  1347. #endif
  1348. #endif
  1349. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1350. &i2c_bfin_twi_device,
  1351. #endif
  1352. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1353. &bfin_sport0_uart_device,
  1354. &bfin_sport1_uart_device,
  1355. #endif
  1356. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1357. &bfin_pata_device,
  1358. #endif
  1359. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1360. &bfin_device_gpiokeys,
  1361. #endif
  1362. &bfin_gpios_device,
  1363. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  1364. &bfin_async_nand_device,
  1365. #endif
  1366. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1367. &stamp_flash_device,
  1368. #endif
  1369. };
  1370. static int __init stamp_init(void)
  1371. {
  1372. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1373. i2c_register_board_info(0, bfin_i2c_board_info,
  1374. ARRAY_SIZE(bfin_i2c_board_info));
  1375. bfin_plat_nand_init();
  1376. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  1377. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1378. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1379. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  1380. #endif
  1381. return 0;
  1382. }
  1383. arch_initcall(stamp_init);
  1384. void native_machine_restart(char *cmd)
  1385. {
  1386. /* workaround reboot hang when booting from SPI */
  1387. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  1388. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  1389. }
  1390. /*
  1391. * Currently the MAC address is saved in Flash by U-Boot
  1392. */
  1393. #define FLASH_MAC 0x203f0000
  1394. void bfin_get_ether_addr(char *addr)
  1395. {
  1396. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  1397. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  1398. }
  1399. EXPORT_SYMBOL(bfin_get_ether_addr);