stamp.c 42 KB

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