stamp.c 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602
  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_BFIN_SPI_ADC) \
  462. || defined(CONFIG_BFIN_SPI_ADC_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_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  549. #include <linux/input.h>
  550. #include <linux/spi/adxl34x.h>
  551. static const struct adxl34x_platform_data adxl34x_info = {
  552. .x_axis_offset = 0,
  553. .y_axis_offset = 0,
  554. .z_axis_offset = 0,
  555. .tap_threshold = 0x31,
  556. .tap_duration = 0x10,
  557. .tap_latency = 0x60,
  558. .tap_window = 0xF0,
  559. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  560. .act_axis_control = 0xFF,
  561. .activity_threshold = 5,
  562. .inactivity_threshold = 3,
  563. .inactivity_time = 4,
  564. .free_fall_threshold = 0x7,
  565. .free_fall_time = 0x20,
  566. .data_rate = 0x8,
  567. .data_range = ADXL_FULL_RES,
  568. .ev_type = EV_ABS,
  569. .ev_code_x = ABS_X, /* EV_REL */
  570. .ev_code_y = ABS_Y, /* EV_REL */
  571. .ev_code_z = ABS_Z, /* EV_REL */
  572. .ev_code_tap_x = BTN_TOUCH, /* EV_KEY */
  573. .ev_code_tap_y = BTN_TOUCH, /* EV_KEY */
  574. .ev_code_tap_z = BTN_TOUCH, /* EV_KEY */
  575. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  576. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  577. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  578. .fifo_mode = ADXL_FIFO_STREAM,
  579. };
  580. #endif
  581. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  582. static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
  583. .enable_dma = 0,
  584. .bits_per_word = 16,
  585. };
  586. #endif
  587. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  588. static struct bfin5xx_spi_chip spidev_chip_info = {
  589. .enable_dma = 0,
  590. .bits_per_word = 8,
  591. };
  592. #endif
  593. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  594. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  595. .enable_dma = 0,
  596. .bits_per_word = 8,
  597. };
  598. #endif
  599. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  600. static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
  601. .enable_dma = 1,
  602. .bits_per_word = 8,
  603. .cs_gpio = GPIO_PF10,
  604. };
  605. #endif
  606. #if defined(CONFIG_MTD_DATAFLASH) \
  607. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  608. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  609. {
  610. .name = "bootloader(spi)",
  611. .size = 0x00040000,
  612. .offset = 0,
  613. .mask_flags = MTD_CAP_ROM
  614. }, {
  615. .name = "linux kernel(spi)",
  616. .size = 0x180000,
  617. .offset = MTDPART_OFS_APPEND,
  618. }, {
  619. .name = "file system(spi)",
  620. .size = MTDPART_SIZ_FULL,
  621. .offset = MTDPART_OFS_APPEND,
  622. }
  623. };
  624. static struct flash_platform_data bfin_spi_dataflash_data = {
  625. .name = "SPI Dataflash",
  626. .parts = bfin_spi_dataflash_partitions,
  627. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  628. };
  629. /* DataFlash chip */
  630. static struct bfin5xx_spi_chip data_flash_chip_info = {
  631. .enable_dma = 0, /* use dma transfer with this chip*/
  632. .bits_per_word = 8,
  633. };
  634. #endif
  635. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  636. #if defined(CONFIG_MTD_M25P80) \
  637. || defined(CONFIG_MTD_M25P80_MODULE)
  638. {
  639. /* the modalias must be the same as spi device driver name */
  640. .modalias = "m25p80", /* Name of spi_driver for this device */
  641. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  642. .bus_num = 0, /* Framework bus number */
  643. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  644. .platform_data = &bfin_spi_flash_data,
  645. .controller_data = &spi_flash_chip_info,
  646. .mode = SPI_MODE_3,
  647. },
  648. #endif
  649. #if defined(CONFIG_MTD_DATAFLASH) \
  650. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  651. { /* DataFlash chip */
  652. .modalias = "mtd_dataflash",
  653. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  654. .bus_num = 0, /* Framework bus number */
  655. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  656. .platform_data = &bfin_spi_dataflash_data,
  657. .controller_data = &data_flash_chip_info,
  658. .mode = SPI_MODE_3,
  659. },
  660. #endif
  661. #if defined(CONFIG_BFIN_SPI_ADC) \
  662. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  663. {
  664. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  665. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  666. .bus_num = 0, /* Framework bus number */
  667. .chip_select = 1, /* Framework chip select. */
  668. .platform_data = NULL, /* No spi_driver specific config */
  669. .controller_data = &spi_adc_chip_info,
  670. },
  671. #endif
  672. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  673. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  674. {
  675. .modalias = "ad1836-spi",
  676. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  677. .bus_num = 0,
  678. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  679. .controller_data = &ad1836_spi_chip_info,
  680. },
  681. #endif
  682. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  683. {
  684. .modalias = "ad9960-spi",
  685. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  686. .bus_num = 0,
  687. .chip_select = 1,
  688. .controller_data = &ad9960_spi_chip_info,
  689. },
  690. #endif
  691. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  692. {
  693. .modalias = "mmc_spi",
  694. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  695. .bus_num = 0,
  696. .chip_select = 4,
  697. .platform_data = &bfin_mmc_spi_pdata,
  698. .controller_data = &mmc_spi_chip_info,
  699. .mode = SPI_MODE_3,
  700. },
  701. #endif
  702. #if defined(CONFIG_PBX)
  703. {
  704. .modalias = "fxs-spi",
  705. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  706. .bus_num = 0,
  707. .chip_select = 8 - CONFIG_J11_JUMPER,
  708. .controller_data = &spi_si3xxx_chip_info,
  709. .mode = SPI_MODE_3,
  710. },
  711. {
  712. .modalias = "fxo-spi",
  713. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  714. .bus_num = 0,
  715. .chip_select = 8 - CONFIG_J19_JUMPER,
  716. .controller_data = &spi_si3xxx_chip_info,
  717. .mode = SPI_MODE_3,
  718. },
  719. #endif
  720. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  721. {
  722. .modalias = "ad7877",
  723. .platform_data = &bfin_ad7877_ts_info,
  724. .irq = IRQ_PF6,
  725. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  726. .bus_num = 0,
  727. .chip_select = 1,
  728. .controller_data = &spi_ad7877_chip_info,
  729. },
  730. #endif
  731. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  732. {
  733. .modalias = "ad7879",
  734. .platform_data = &bfin_ad7879_ts_info,
  735. .irq = IRQ_PF7,
  736. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  737. .bus_num = 0,
  738. .chip_select = 1,
  739. .controller_data = &spi_ad7879_chip_info,
  740. .mode = SPI_CPHA | SPI_CPOL,
  741. },
  742. #endif
  743. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  744. {
  745. .modalias = "spidev",
  746. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  747. .bus_num = 0,
  748. .chip_select = 1,
  749. .controller_data = &spidev_chip_info,
  750. },
  751. #endif
  752. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  753. {
  754. .modalias = "bfin-lq035q1-spi",
  755. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  756. .bus_num = 0,
  757. .chip_select = 2,
  758. .controller_data = &lq035q1_spi_chip_info,
  759. .mode = SPI_CPHA | SPI_CPOL,
  760. },
  761. #endif
  762. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  763. {
  764. .modalias = "enc28j60",
  765. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  766. .irq = IRQ_PF6,
  767. .bus_num = 0,
  768. .chip_select = 0, /* GPIO controlled SSEL */
  769. .controller_data = &enc28j60_spi_chip_info,
  770. .mode = SPI_MODE_0,
  771. },
  772. #endif
  773. };
  774. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  775. /* SPI controller data */
  776. static struct bfin5xx_spi_master bfin_spi0_info = {
  777. .num_chipselect = 8,
  778. .enable_dma = 1, /* master has the ability to do dma transfer */
  779. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  780. };
  781. /* SPI (0) */
  782. static struct resource bfin_spi0_resource[] = {
  783. [0] = {
  784. .start = SPI0_REGBASE,
  785. .end = SPI0_REGBASE + 0xFF,
  786. .flags = IORESOURCE_MEM,
  787. },
  788. [1] = {
  789. .start = CH_SPI,
  790. .end = CH_SPI,
  791. .flags = IORESOURCE_IRQ,
  792. },
  793. };
  794. static struct platform_device bfin_spi0_device = {
  795. .name = "bfin-spi",
  796. .id = 0, /* Bus number */
  797. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  798. .resource = bfin_spi0_resource,
  799. .dev = {
  800. .platform_data = &bfin_spi0_info, /* Passed to driver */
  801. },
  802. };
  803. #endif /* spi master and devices */
  804. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  805. /* SPORT SPI controller data */
  806. static struct bfin5xx_spi_master bfin_sport_spi0_info = {
  807. .num_chipselect = 1, /* master only supports one device */
  808. .enable_dma = 0, /* master don't support DMA */
  809. .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
  810. P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
  811. };
  812. static struct resource bfin_sport_spi0_resource[] = {
  813. [0] = {
  814. .start = SPORT0_TCR1,
  815. .end = SPORT0_TCR1 + 0xFF,
  816. .flags = IORESOURCE_MEM,
  817. },
  818. [1] = {
  819. .start = IRQ_SPORT0_ERROR,
  820. .end = IRQ_SPORT0_ERROR,
  821. .flags = IORESOURCE_IRQ,
  822. },
  823. };
  824. static struct platform_device bfin_sport_spi0_device = {
  825. .name = "bfin-sport-spi",
  826. .id = 1, /* Bus number */
  827. .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
  828. .resource = bfin_sport_spi0_resource,
  829. .dev = {
  830. .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
  831. },
  832. };
  833. static struct bfin5xx_spi_master bfin_sport_spi1_info = {
  834. .num_chipselect = 1, /* master only supports one device */
  835. .enable_dma = 0, /* master don't support DMA */
  836. .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
  837. P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
  838. };
  839. static struct resource bfin_sport_spi1_resource[] = {
  840. [0] = {
  841. .start = SPORT1_TCR1,
  842. .end = SPORT1_TCR1 + 0xFF,
  843. .flags = IORESOURCE_MEM,
  844. },
  845. [1] = {
  846. .start = IRQ_SPORT1_ERROR,
  847. .end = IRQ_SPORT1_ERROR,
  848. .flags = IORESOURCE_IRQ,
  849. },
  850. };
  851. static struct platform_device bfin_sport_spi1_device = {
  852. .name = "bfin-sport-spi",
  853. .id = 2, /* Bus number */
  854. .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
  855. .resource = bfin_sport_spi1_resource,
  856. .dev = {
  857. .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
  858. },
  859. };
  860. #endif /* sport spi master and devices */
  861. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  862. static struct platform_device bfin_fb_device = {
  863. .name = "bf537-lq035",
  864. };
  865. #endif
  866. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  867. static struct platform_device bfin_fb_adv7393_device = {
  868. .name = "bfin-adv7393",
  869. };
  870. #endif
  871. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  872. #include <asm/bfin-lq035q1.h>
  873. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  874. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  875. .use_bl = 0, /* let something else control the LCD Blacklight */
  876. .gpio_bl = GPIO_PF7,
  877. };
  878. static struct resource bfin_lq035q1_resources[] = {
  879. {
  880. .start = IRQ_PPI_ERROR,
  881. .end = IRQ_PPI_ERROR,
  882. .flags = IORESOURCE_IRQ,
  883. },
  884. };
  885. static struct platform_device bfin_lq035q1_device = {
  886. .name = "bfin-lq035q1",
  887. .id = -1,
  888. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  889. .resource = bfin_lq035q1_resources,
  890. .dev = {
  891. .platform_data = &bfin_lq035q1_data,
  892. },
  893. };
  894. #endif
  895. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  896. static struct resource bfin_uart_resources[] = {
  897. #ifdef CONFIG_SERIAL_BFIN_UART0
  898. {
  899. .start = 0xFFC00400,
  900. .end = 0xFFC004FF,
  901. .flags = IORESOURCE_MEM,
  902. },
  903. #endif
  904. #ifdef CONFIG_SERIAL_BFIN_UART1
  905. {
  906. .start = 0xFFC02000,
  907. .end = 0xFFC020FF,
  908. .flags = IORESOURCE_MEM,
  909. },
  910. #endif
  911. };
  912. static struct platform_device bfin_uart_device = {
  913. .name = "bfin-uart",
  914. .id = 1,
  915. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  916. .resource = bfin_uart_resources,
  917. };
  918. #endif
  919. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  920. #ifdef CONFIG_BFIN_SIR0
  921. static struct resource bfin_sir0_resources[] = {
  922. {
  923. .start = 0xFFC00400,
  924. .end = 0xFFC004FF,
  925. .flags = IORESOURCE_MEM,
  926. },
  927. {
  928. .start = IRQ_UART0_RX,
  929. .end = IRQ_UART0_RX+1,
  930. .flags = IORESOURCE_IRQ,
  931. },
  932. {
  933. .start = CH_UART0_RX,
  934. .end = CH_UART0_RX+1,
  935. .flags = IORESOURCE_DMA,
  936. },
  937. };
  938. static struct platform_device bfin_sir0_device = {
  939. .name = "bfin_sir",
  940. .id = 0,
  941. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  942. .resource = bfin_sir0_resources,
  943. };
  944. #endif
  945. #ifdef CONFIG_BFIN_SIR1
  946. static struct resource bfin_sir1_resources[] = {
  947. {
  948. .start = 0xFFC02000,
  949. .end = 0xFFC020FF,
  950. .flags = IORESOURCE_MEM,
  951. },
  952. {
  953. .start = IRQ_UART1_RX,
  954. .end = IRQ_UART1_RX+1,
  955. .flags = IORESOURCE_IRQ,
  956. },
  957. {
  958. .start = CH_UART1_RX,
  959. .end = CH_UART1_RX+1,
  960. .flags = IORESOURCE_DMA,
  961. },
  962. };
  963. static struct platform_device bfin_sir1_device = {
  964. .name = "bfin_sir",
  965. .id = 1,
  966. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  967. .resource = bfin_sir1_resources,
  968. };
  969. #endif
  970. #endif
  971. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  972. static struct resource bfin_twi0_resource[] = {
  973. [0] = {
  974. .start = TWI0_REGBASE,
  975. .end = TWI0_REGBASE,
  976. .flags = IORESOURCE_MEM,
  977. },
  978. [1] = {
  979. .start = IRQ_TWI,
  980. .end = IRQ_TWI,
  981. .flags = IORESOURCE_IRQ,
  982. },
  983. };
  984. static struct platform_device i2c_bfin_twi_device = {
  985. .name = "i2c-bfin-twi",
  986. .id = 0,
  987. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  988. .resource = bfin_twi0_resource,
  989. };
  990. #endif
  991. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  992. #include <linux/input.h>
  993. #include <linux/i2c/adp5588_keys.h>
  994. static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
  995. [0] = KEY_GRAVE,
  996. [1] = KEY_1,
  997. [2] = KEY_2,
  998. [3] = KEY_3,
  999. [4] = KEY_4,
  1000. [5] = KEY_5,
  1001. [6] = KEY_6,
  1002. [7] = KEY_7,
  1003. [8] = KEY_8,
  1004. [9] = KEY_9,
  1005. [10] = KEY_0,
  1006. [11] = KEY_MINUS,
  1007. [12] = KEY_EQUAL,
  1008. [13] = KEY_BACKSLASH,
  1009. [15] = KEY_KP0,
  1010. [16] = KEY_Q,
  1011. [17] = KEY_W,
  1012. [18] = KEY_E,
  1013. [19] = KEY_R,
  1014. [20] = KEY_T,
  1015. [21] = KEY_Y,
  1016. [22] = KEY_U,
  1017. [23] = KEY_I,
  1018. [24] = KEY_O,
  1019. [25] = KEY_P,
  1020. [26] = KEY_LEFTBRACE,
  1021. [27] = KEY_RIGHTBRACE,
  1022. [29] = KEY_KP1,
  1023. [30] = KEY_KP2,
  1024. [31] = KEY_KP3,
  1025. [32] = KEY_A,
  1026. [33] = KEY_S,
  1027. [34] = KEY_D,
  1028. [35] = KEY_F,
  1029. [36] = KEY_G,
  1030. [37] = KEY_H,
  1031. [38] = KEY_J,
  1032. [39] = KEY_K,
  1033. [40] = KEY_L,
  1034. [41] = KEY_SEMICOLON,
  1035. [42] = KEY_APOSTROPHE,
  1036. [43] = KEY_BACKSLASH,
  1037. [45] = KEY_KP4,
  1038. [46] = KEY_KP5,
  1039. [47] = KEY_KP6,
  1040. [48] = KEY_102ND,
  1041. [49] = KEY_Z,
  1042. [50] = KEY_X,
  1043. [51] = KEY_C,
  1044. [52] = KEY_V,
  1045. [53] = KEY_B,
  1046. [54] = KEY_N,
  1047. [55] = KEY_M,
  1048. [56] = KEY_COMMA,
  1049. [57] = KEY_DOT,
  1050. [58] = KEY_SLASH,
  1051. [60] = KEY_KPDOT,
  1052. [61] = KEY_KP7,
  1053. [62] = KEY_KP8,
  1054. [63] = KEY_KP9,
  1055. [64] = KEY_SPACE,
  1056. [65] = KEY_BACKSPACE,
  1057. [66] = KEY_TAB,
  1058. [67] = KEY_KPENTER,
  1059. [68] = KEY_ENTER,
  1060. [69] = KEY_ESC,
  1061. [70] = KEY_DELETE,
  1062. [74] = KEY_KPMINUS,
  1063. [76] = KEY_UP,
  1064. [77] = KEY_DOWN,
  1065. [78] = KEY_RIGHT,
  1066. [79] = KEY_LEFT,
  1067. };
  1068. static struct adp5588_kpad_platform_data adp5588_kpad_data = {
  1069. .rows = 8,
  1070. .cols = 10,
  1071. .keymap = adp5588_keymap,
  1072. .keymapsize = ARRAY_SIZE(adp5588_keymap),
  1073. .repeat = 0,
  1074. };
  1075. #endif
  1076. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1077. #include <linux/mfd/adp5520.h>
  1078. /*
  1079. * ADP5520/5501 Backlight Data
  1080. */
  1081. static struct adp5520_backlight_platfrom_data adp5520_backlight_data = {
  1082. .fade_in = FADE_T_1200ms,
  1083. .fade_out = FADE_T_1200ms,
  1084. .fade_led_law = BL_LAW_LINEAR,
  1085. .en_ambl_sens = 1,
  1086. .abml_filt = BL_AMBL_FILT_640ms,
  1087. .l1_daylight_max = BL_CUR_mA(15),
  1088. .l1_daylight_dim = BL_CUR_mA(0),
  1089. .l2_office_max = BL_CUR_mA(7),
  1090. .l2_office_dim = BL_CUR_mA(0),
  1091. .l3_dark_max = BL_CUR_mA(3),
  1092. .l3_dark_dim = BL_CUR_mA(0),
  1093. .l2_trip = L2_COMP_CURR_uA(700),
  1094. .l2_hyst = L2_COMP_CURR_uA(50),
  1095. .l3_trip = L3_COMP_CURR_uA(80),
  1096. .l3_hyst = L3_COMP_CURR_uA(20),
  1097. };
  1098. /*
  1099. * ADP5520/5501 LEDs Data
  1100. */
  1101. #include <linux/leds.h>
  1102. static struct led_info adp5520_leds[] = {
  1103. {
  1104. .name = "adp5520-led1",
  1105. .default_trigger = "none",
  1106. .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | LED_OFFT_600ms,
  1107. },
  1108. #ifdef ADP5520_EN_ALL_LEDS
  1109. {
  1110. .name = "adp5520-led2",
  1111. .default_trigger = "none",
  1112. .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
  1113. },
  1114. {
  1115. .name = "adp5520-led3",
  1116. .default_trigger = "none",
  1117. .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
  1118. },
  1119. #endif
  1120. };
  1121. static struct adp5520_leds_platfrom_data adp5520_leds_data = {
  1122. .num_leds = ARRAY_SIZE(adp5520_leds),
  1123. .leds = adp5520_leds,
  1124. .fade_in = FADE_T_600ms,
  1125. .fade_out = FADE_T_600ms,
  1126. .led_on_time = LED_ONT_600ms,
  1127. };
  1128. /*
  1129. * ADP5520 GPIO Data
  1130. */
  1131. static struct adp5520_gpio_platfrom_data adp5520_gpio_data = {
  1132. .gpio_start = 50,
  1133. .gpio_en_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
  1134. .gpio_pullup_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
  1135. };
  1136. /*
  1137. * ADP5520 Keypad Data
  1138. */
  1139. #include <linux/input.h>
  1140. static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
  1141. [KEY(0, 0)] = KEY_GRAVE,
  1142. [KEY(0, 1)] = KEY_1,
  1143. [KEY(0, 2)] = KEY_2,
  1144. [KEY(0, 3)] = KEY_3,
  1145. [KEY(1, 0)] = KEY_4,
  1146. [KEY(1, 1)] = KEY_5,
  1147. [KEY(1, 2)] = KEY_6,
  1148. [KEY(1, 3)] = KEY_7,
  1149. [KEY(2, 0)] = KEY_8,
  1150. [KEY(2, 1)] = KEY_9,
  1151. [KEY(2, 2)] = KEY_0,
  1152. [KEY(2, 3)] = KEY_MINUS,
  1153. [KEY(3, 0)] = KEY_EQUAL,
  1154. [KEY(3, 1)] = KEY_BACKSLASH,
  1155. [KEY(3, 2)] = KEY_BACKSPACE,
  1156. [KEY(3, 3)] = KEY_ENTER,
  1157. };
  1158. static struct adp5520_keys_platfrom_data adp5520_keys_data = {
  1159. .rows_en_mask = ROW_R3 | ROW_R2 | ROW_R1 | ROW_R0,
  1160. .cols_en_mask = COL_C3 | COL_C2 | COL_C1 | COL_C0,
  1161. .keymap = adp5520_keymap,
  1162. .keymapsize = ARRAY_SIZE(adp5520_keymap),
  1163. .repeat = 0,
  1164. };
  1165. /*
  1166. * ADP5520/5501 Multifuction Device Init Data
  1167. */
  1168. static struct adp5520_subdev_info adp5520_subdevs[] = {
  1169. {
  1170. .name = "adp5520-backlight",
  1171. .id = ID_ADP5520,
  1172. .platform_data = &adp5520_backlight_data,
  1173. },
  1174. {
  1175. .name = "adp5520-led",
  1176. .id = ID_ADP5520,
  1177. .platform_data = &adp5520_leds_data,
  1178. },
  1179. {
  1180. .name = "adp5520-gpio",
  1181. .id = ID_ADP5520,
  1182. .platform_data = &adp5520_gpio_data,
  1183. },
  1184. {
  1185. .name = "adp5520-keys",
  1186. .id = ID_ADP5520,
  1187. .platform_data = &adp5520_keys_data,
  1188. },
  1189. };
  1190. static struct adp5520_platform_data adp5520_pdev_data = {
  1191. .num_subdevs = ARRAY_SIZE(adp5520_subdevs),
  1192. .subdevs = adp5520_subdevs,
  1193. };
  1194. #endif
  1195. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  1196. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  1197. {
  1198. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  1199. .irq = IRQ_PF5,
  1200. },
  1201. #endif
  1202. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  1203. {
  1204. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1205. },
  1206. #endif
  1207. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  1208. {
  1209. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1210. .irq = IRQ_PG6,
  1211. },
  1212. #endif
  1213. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  1214. {
  1215. I2C_BOARD_INFO("ad7879", 0x2F),
  1216. .irq = IRQ_PG5,
  1217. .platform_data = (void *)&bfin_ad7879_ts_info,
  1218. },
  1219. #endif
  1220. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1221. {
  1222. I2C_BOARD_INFO("adp5588-keys", 0x34),
  1223. .irq = IRQ_PG0,
  1224. .platform_data = (void *)&adp5588_kpad_data,
  1225. },
  1226. #endif
  1227. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  1228. {
  1229. I2C_BOARD_INFO("pmic-adp5520", 0x32),
  1230. .irq = IRQ_PG0,
  1231. .platform_data = (void *)&adp5520_pdev_data,
  1232. },
  1233. #endif
  1234. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1235. {
  1236. I2C_BOARD_INFO("adxl34x", 0x53),
  1237. .irq = IRQ_PG3,
  1238. .platform_data = (void *)&adxl34x_info,
  1239. },
  1240. #endif
  1241. };
  1242. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1243. static struct platform_device bfin_sport0_uart_device = {
  1244. .name = "bfin-sport-uart",
  1245. .id = 0,
  1246. };
  1247. static struct platform_device bfin_sport1_uart_device = {
  1248. .name = "bfin-sport-uart",
  1249. .id = 1,
  1250. };
  1251. #endif
  1252. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1253. #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1254. /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
  1255. #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
  1256. #define PATA_INT IRQ_PF5
  1257. static struct pata_platform_info bfin_pata_platform_data = {
  1258. .ioport_shift = 1,
  1259. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  1260. };
  1261. static struct resource bfin_pata_resources[] = {
  1262. {
  1263. .start = 0x20314020,
  1264. .end = 0x2031403F,
  1265. .flags = IORESOURCE_MEM,
  1266. },
  1267. {
  1268. .start = 0x2031401C,
  1269. .end = 0x2031401F,
  1270. .flags = IORESOURCE_MEM,
  1271. },
  1272. {
  1273. .start = PATA_INT,
  1274. .end = PATA_INT,
  1275. .flags = IORESOURCE_IRQ,
  1276. },
  1277. };
  1278. #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
  1279. static struct pata_platform_info bfin_pata_platform_data = {
  1280. .ioport_shift = 0,
  1281. };
  1282. /* CompactFlash Storage Card Memory Mapped Adressing
  1283. * /REG = A11 = 1
  1284. */
  1285. static struct resource bfin_pata_resources[] = {
  1286. {
  1287. .start = 0x20211800,
  1288. .end = 0x20211807,
  1289. .flags = IORESOURCE_MEM,
  1290. },
  1291. {
  1292. .start = 0x2021180E, /* Device Ctl */
  1293. .end = 0x2021180E,
  1294. .flags = IORESOURCE_MEM,
  1295. },
  1296. };
  1297. #endif
  1298. static struct platform_device bfin_pata_device = {
  1299. .name = "pata_platform",
  1300. .id = -1,
  1301. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  1302. .resource = bfin_pata_resources,
  1303. .dev = {
  1304. .platform_data = &bfin_pata_platform_data,
  1305. }
  1306. };
  1307. #endif
  1308. static const unsigned int cclk_vlev_datasheet[] =
  1309. {
  1310. VRPAIR(VLEV_085, 250000000),
  1311. VRPAIR(VLEV_090, 376000000),
  1312. VRPAIR(VLEV_095, 426000000),
  1313. VRPAIR(VLEV_100, 426000000),
  1314. VRPAIR(VLEV_105, 476000000),
  1315. VRPAIR(VLEV_110, 476000000),
  1316. VRPAIR(VLEV_115, 476000000),
  1317. VRPAIR(VLEV_120, 500000000),
  1318. VRPAIR(VLEV_125, 533000000),
  1319. VRPAIR(VLEV_130, 600000000),
  1320. };
  1321. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1322. .tuple_tab = cclk_vlev_datasheet,
  1323. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1324. .vr_settling_time = 25 /* us */,
  1325. };
  1326. static struct platform_device bfin_dpmc = {
  1327. .name = "bfin dpmc",
  1328. .dev = {
  1329. .platform_data = &bfin_dmpc_vreg_data,
  1330. },
  1331. };
  1332. static struct platform_device *stamp_devices[] __initdata = {
  1333. &bfin_dpmc,
  1334. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  1335. &bfin_pcmcia_cf_device,
  1336. #endif
  1337. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1338. &rtc_device,
  1339. #endif
  1340. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  1341. &sl811_hcd_device,
  1342. #endif
  1343. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  1344. &isp1362_hcd_device,
  1345. #endif
  1346. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1347. &bfin_isp1760_device,
  1348. #endif
  1349. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  1350. &smc91x_device,
  1351. #endif
  1352. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  1353. &dm9000_device,
  1354. #endif
  1355. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  1356. &ax88180_device,
  1357. #endif
  1358. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  1359. &bfin_mii_bus,
  1360. &bfin_mac_device,
  1361. #endif
  1362. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  1363. &net2272_bfin_device,
  1364. #endif
  1365. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1366. &bfin_spi0_device,
  1367. #endif
  1368. #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
  1369. &bfin_sport_spi0_device,
  1370. &bfin_sport_spi1_device,
  1371. #endif
  1372. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  1373. &bfin_fb_device,
  1374. #endif
  1375. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  1376. &bfin_lq035q1_device,
  1377. #endif
  1378. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  1379. &bfin_fb_adv7393_device,
  1380. #endif
  1381. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1382. &bfin_uart_device,
  1383. #endif
  1384. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1385. #ifdef CONFIG_BFIN_SIR0
  1386. &bfin_sir0_device,
  1387. #endif
  1388. #ifdef CONFIG_BFIN_SIR1
  1389. &bfin_sir1_device,
  1390. #endif
  1391. #endif
  1392. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1393. &i2c_bfin_twi_device,
  1394. #endif
  1395. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1396. &bfin_sport0_uart_device,
  1397. &bfin_sport1_uart_device,
  1398. #endif
  1399. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1400. &bfin_pata_device,
  1401. #endif
  1402. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1403. &bfin_device_gpiokeys,
  1404. #endif
  1405. &bfin_gpios_device,
  1406. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  1407. &bfin_async_nand_device,
  1408. #endif
  1409. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1410. &stamp_flash_device,
  1411. #endif
  1412. };
  1413. static int __init stamp_init(void)
  1414. {
  1415. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1416. i2c_register_board_info(0, bfin_i2c_board_info,
  1417. ARRAY_SIZE(bfin_i2c_board_info));
  1418. bfin_plat_nand_init();
  1419. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  1420. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1421. #if (defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)) \
  1422. && defined(PATA_INT)
  1423. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  1424. #endif
  1425. return 0;
  1426. }
  1427. arch_initcall(stamp_init);
  1428. void native_machine_restart(char *cmd)
  1429. {
  1430. /* workaround reboot hang when booting from SPI */
  1431. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  1432. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  1433. }
  1434. /*
  1435. * Currently the MAC address is saved in Flash by U-Boot
  1436. */
  1437. #define FLASH_MAC 0x203f0000
  1438. void bfin_get_ether_addr(char *addr)
  1439. {
  1440. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  1441. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  1442. }
  1443. EXPORT_SYMBOL(bfin_get_ether_addr);