stamp.c 32 KB

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