stamp.c 39 KB

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