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_mii_bus = {
  296. .name = "bfin_mii_bus",
  297. };
  298. static struct platform_device bfin_mac_device = {
  299. .name = "bfin_mac",
  300. .dev.platform_data = &bfin_mii_bus,
  301. };
  302. #endif
  303. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  304. static struct resource net2272_bfin_resources[] = {
  305. {
  306. .start = 0x20300000,
  307. .end = 0x20300000 + 0x100,
  308. .flags = IORESOURCE_MEM,
  309. }, {
  310. .start = IRQ_PF7,
  311. .end = IRQ_PF7,
  312. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  313. },
  314. };
  315. static struct platform_device net2272_bfin_device = {
  316. .name = "net2272",
  317. .id = -1,
  318. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  319. .resource = net2272_bfin_resources,
  320. };
  321. #endif
  322. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  323. #ifdef CONFIG_MTD_PARTITIONS
  324. const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
  325. static struct mtd_partition bfin_plat_nand_partitions[] = {
  326. {
  327. .name = "linux kernel(nand)",
  328. .size = 0x400000,
  329. .offset = 0,
  330. }, {
  331. .name = "file system(nand)",
  332. .size = MTDPART_SIZ_FULL,
  333. .offset = MTDPART_OFS_APPEND,
  334. },
  335. };
  336. #endif
  337. #define BFIN_NAND_PLAT_CLE 2
  338. #define BFIN_NAND_PLAT_ALE 1
  339. static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  340. {
  341. struct nand_chip *this = mtd->priv;
  342. if (cmd == NAND_CMD_NONE)
  343. return;
  344. if (ctrl & NAND_CLE)
  345. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
  346. else
  347. writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
  348. }
  349. #define BFIN_NAND_PLAT_READY GPIO_PF3
  350. static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
  351. {
  352. return gpio_get_value(BFIN_NAND_PLAT_READY);
  353. }
  354. static struct platform_nand_data bfin_plat_nand_data = {
  355. .chip = {
  356. .chip_delay = 30,
  357. #ifdef CONFIG_MTD_PARTITIONS
  358. .part_probe_types = part_probes,
  359. .partitions = bfin_plat_nand_partitions,
  360. .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
  361. #endif
  362. },
  363. .ctrl = {
  364. .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
  365. .dev_ready = bfin_plat_nand_dev_ready,
  366. },
  367. };
  368. #define MAX(x, y) (x > y ? x : y)
  369. static struct resource bfin_plat_nand_resources = {
  370. .start = 0x20212000,
  371. .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
  372. .flags = IORESOURCE_IO,
  373. };
  374. static struct platform_device bfin_async_nand_device = {
  375. .name = "gen_nand",
  376. .id = -1,
  377. .num_resources = 1,
  378. .resource = &bfin_plat_nand_resources,
  379. .dev = {
  380. .platform_data = &bfin_plat_nand_data,
  381. },
  382. };
  383. static void bfin_plat_nand_init(void)
  384. {
  385. gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
  386. }
  387. #else
  388. static void bfin_plat_nand_init(void) {}
  389. #endif
  390. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  391. static struct mtd_partition stamp_partitions[] = {
  392. {
  393. .name = "bootloader(nor)",
  394. .size = 0x40000,
  395. .offset = 0,
  396. }, {
  397. .name = "linux kernel(nor)",
  398. .size = 0x180000,
  399. .offset = MTDPART_OFS_APPEND,
  400. }, {
  401. .name = "file system(nor)",
  402. .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
  403. .offset = MTDPART_OFS_APPEND,
  404. }, {
  405. .name = "MAC Address(nor)",
  406. .size = MTDPART_SIZ_FULL,
  407. .offset = 0x3F0000,
  408. .mask_flags = MTD_WRITEABLE,
  409. }
  410. };
  411. static struct physmap_flash_data stamp_flash_data = {
  412. .width = 2,
  413. .parts = stamp_partitions,
  414. .nr_parts = ARRAY_SIZE(stamp_partitions),
  415. };
  416. static struct resource stamp_flash_resource = {
  417. .start = 0x20000000,
  418. .end = 0x203fffff,
  419. .flags = IORESOURCE_MEM,
  420. };
  421. static struct platform_device stamp_flash_device = {
  422. .name = "physmap-flash",
  423. .id = 0,
  424. .dev = {
  425. .platform_data = &stamp_flash_data,
  426. },
  427. .num_resources = 1,
  428. .resource = &stamp_flash_resource,
  429. };
  430. #endif
  431. #if defined(CONFIG_MTD_M25P80) \
  432. || defined(CONFIG_MTD_M25P80_MODULE)
  433. static struct mtd_partition bfin_spi_flash_partitions[] = {
  434. {
  435. .name = "bootloader(spi)",
  436. .size = 0x00040000,
  437. .offset = 0,
  438. .mask_flags = MTD_CAP_ROM
  439. }, {
  440. .name = "linux kernel(spi)",
  441. .size = 0x180000,
  442. .offset = MTDPART_OFS_APPEND,
  443. }, {
  444. .name = "file system(spi)",
  445. .size = MTDPART_SIZ_FULL,
  446. .offset = MTDPART_OFS_APPEND,
  447. }
  448. };
  449. static struct flash_platform_data bfin_spi_flash_data = {
  450. .name = "m25p80",
  451. .parts = bfin_spi_flash_partitions,
  452. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  453. /* .type = "m25p64", */
  454. };
  455. /* SPI flash chip (m25p64) */
  456. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  457. .enable_dma = 0, /* use dma transfer with this chip*/
  458. .bits_per_word = 8,
  459. };
  460. #endif
  461. #if defined(CONFIG_SPI_ADC_BF533) \
  462. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  463. /* SPI ADC chip */
  464. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  465. .enable_dma = 1, /* use dma transfer with this chip*/
  466. .bits_per_word = 16,
  467. };
  468. #endif
  469. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  470. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  471. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  472. .enable_dma = 0,
  473. .bits_per_word = 16,
  474. };
  475. #endif
  476. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  477. static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
  478. .enable_dma = 0,
  479. .bits_per_word = 16,
  480. };
  481. #endif
  482. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  483. #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
  484. static int bfin_mmc_spi_init(struct device *dev,
  485. irqreturn_t (*detect_int)(int, void *), void *data)
  486. {
  487. return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
  488. IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
  489. }
  490. static void bfin_mmc_spi_exit(struct device *dev, void *data)
  491. {
  492. free_irq(MMC_SPI_CARD_DETECT_INT, data);
  493. }
  494. static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
  495. .init = bfin_mmc_spi_init,
  496. .exit = bfin_mmc_spi_exit,
  497. .detect_delay = 100, /* msecs */
  498. };
  499. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  500. .enable_dma = 0,
  501. .bits_per_word = 8,
  502. };
  503. #endif
  504. #if defined(CONFIG_PBX)
  505. static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
  506. .ctl_reg = 0x4, /* send zero */
  507. .enable_dma = 0,
  508. .bits_per_word = 8,
  509. .cs_change_per_word = 1,
  510. };
  511. #endif
  512. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  513. #include <linux/spi/ad7877.h>
  514. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  515. .enable_dma = 0,
  516. .bits_per_word = 16,
  517. };
  518. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  519. .model = 7877,
  520. .vref_delay_usecs = 50, /* internal, no capacitor */
  521. .x_plate_ohms = 419,
  522. .y_plate_ohms = 486,
  523. .pressure_max = 1000,
  524. .pressure_min = 0,
  525. .stopacq_polarity = 1,
  526. .first_conversion_delay = 3,
  527. .acquisition_time = 1,
  528. .averaging = 1,
  529. .pen_down_acc_interval = 1,
  530. };
  531. #endif
  532. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  533. #include <linux/spi/ad7879.h>
  534. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  535. .model = 7879, /* Model = AD7879 */
  536. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  537. .pressure_max = 10000,
  538. .pressure_min = 0,
  539. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  540. .acquisition_time = 1, /* 4us acquisition time per sample */
  541. .median = 2, /* do 8 measurements */
  542. .averaging = 1, /* take the average of 4 middle samples */
  543. .pen_down_acc_interval = 255, /* 9.4 ms */
  544. .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
  545. .gpio_default = 1, /* During initialization set GPIO = HIGH */
  546. };
  547. #endif
  548. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  549. static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
  550. .enable_dma = 0,
  551. .bits_per_word = 16,
  552. };
  553. #endif
  554. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  555. static struct bfin5xx_spi_chip spidev_chip_info = {
  556. .enable_dma = 0,
  557. .bits_per_word = 8,
  558. };
  559. #endif
  560. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  561. static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
  562. .enable_dma = 0,
  563. .bits_per_word = 8,
  564. };
  565. #endif
  566. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  567. static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
  568. .enable_dma = 1,
  569. .bits_per_word = 8,
  570. .cs_gpio = GPIO_PF10,
  571. };
  572. #endif
  573. #if defined(CONFIG_MTD_DATAFLASH) \
  574. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  575. static struct mtd_partition bfin_spi_dataflash_partitions[] = {
  576. {
  577. .name = "bootloader(spi)",
  578. .size = 0x00040000,
  579. .offset = 0,
  580. .mask_flags = MTD_CAP_ROM
  581. }, {
  582. .name = "linux kernel(spi)",
  583. .size = 0x180000,
  584. .offset = MTDPART_OFS_APPEND,
  585. }, {
  586. .name = "file system(spi)",
  587. .size = MTDPART_SIZ_FULL,
  588. .offset = MTDPART_OFS_APPEND,
  589. }
  590. };
  591. static struct flash_platform_data bfin_spi_dataflash_data = {
  592. .name = "SPI Dataflash",
  593. .parts = bfin_spi_dataflash_partitions,
  594. .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
  595. };
  596. /* DataFlash chip */
  597. static struct bfin5xx_spi_chip data_flash_chip_info = {
  598. .enable_dma = 0, /* use dma transfer with this chip*/
  599. .bits_per_word = 8,
  600. };
  601. #endif
  602. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  603. #if defined(CONFIG_MTD_M25P80) \
  604. || defined(CONFIG_MTD_M25P80_MODULE)
  605. {
  606. /* the modalias must be the same as spi device driver name */
  607. .modalias = "m25p80", /* Name of spi_driver for this device */
  608. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  609. .bus_num = 0, /* Framework bus number */
  610. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  611. .platform_data = &bfin_spi_flash_data,
  612. .controller_data = &spi_flash_chip_info,
  613. .mode = SPI_MODE_3,
  614. },
  615. #endif
  616. #if defined(CONFIG_MTD_DATAFLASH) \
  617. || defined(CONFIG_MTD_DATAFLASH_MODULE)
  618. { /* DataFlash chip */
  619. .modalias = "mtd_dataflash",
  620. .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
  621. .bus_num = 0, /* Framework bus number */
  622. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  623. .platform_data = &bfin_spi_dataflash_data,
  624. .controller_data = &data_flash_chip_info,
  625. .mode = SPI_MODE_3,
  626. },
  627. #endif
  628. #if defined(CONFIG_SPI_ADC_BF533) \
  629. || defined(CONFIG_SPI_ADC_BF533_MODULE)
  630. {
  631. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  632. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  633. .bus_num = 0, /* Framework bus number */
  634. .chip_select = 1, /* Framework chip select. */
  635. .platform_data = NULL, /* No spi_driver specific config */
  636. .controller_data = &spi_adc_chip_info,
  637. },
  638. #endif
  639. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  640. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  641. {
  642. .modalias = "ad1836-spi",
  643. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  644. .bus_num = 0,
  645. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  646. .controller_data = &ad1836_spi_chip_info,
  647. },
  648. #endif
  649. #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
  650. {
  651. .modalias = "ad9960-spi",
  652. .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
  653. .bus_num = 0,
  654. .chip_select = 1,
  655. .controller_data = &ad9960_spi_chip_info,
  656. },
  657. #endif
  658. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  659. {
  660. .modalias = "mmc_spi",
  661. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  662. .bus_num = 0,
  663. .chip_select = 4,
  664. .platform_data = &bfin_mmc_spi_pdata,
  665. .controller_data = &mmc_spi_chip_info,
  666. .mode = SPI_MODE_3,
  667. },
  668. #endif
  669. #if defined(CONFIG_PBX)
  670. {
  671. .modalias = "fxs-spi",
  672. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  673. .bus_num = 0,
  674. .chip_select = 8 - CONFIG_J11_JUMPER,
  675. .controller_data = &spi_si3xxx_chip_info,
  676. .mode = SPI_MODE_3,
  677. },
  678. {
  679. .modalias = "fxo-spi",
  680. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  681. .bus_num = 0,
  682. .chip_select = 8 - CONFIG_J19_JUMPER,
  683. .controller_data = &spi_si3xxx_chip_info,
  684. .mode = SPI_MODE_3,
  685. },
  686. #endif
  687. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  688. {
  689. .modalias = "ad7877",
  690. .platform_data = &bfin_ad7877_ts_info,
  691. .irq = IRQ_PF6,
  692. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  693. .bus_num = 0,
  694. .chip_select = 1,
  695. .controller_data = &spi_ad7877_chip_info,
  696. },
  697. #endif
  698. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  699. {
  700. .modalias = "ad7879",
  701. .platform_data = &bfin_ad7879_ts_info,
  702. .irq = IRQ_PF7,
  703. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  704. .bus_num = 0,
  705. .chip_select = 1,
  706. .controller_data = &spi_ad7879_chip_info,
  707. .mode = SPI_CPHA | SPI_CPOL,
  708. },
  709. #endif
  710. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  711. {
  712. .modalias = "spidev",
  713. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  714. .bus_num = 0,
  715. .chip_select = 1,
  716. .controller_data = &spidev_chip_info,
  717. },
  718. #endif
  719. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  720. {
  721. .modalias = "bfin-lq035q1-spi",
  722. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  723. .bus_num = 0,
  724. .chip_select = 2,
  725. .controller_data = &lq035q1_spi_chip_info,
  726. .mode = SPI_CPHA | SPI_CPOL,
  727. },
  728. #endif
  729. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  730. {
  731. .modalias = "enc28j60",
  732. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  733. .irq = IRQ_PF6,
  734. .bus_num = 0,
  735. .chip_select = 0, /* GPIO controlled SSEL */
  736. .controller_data = &enc28j60_spi_chip_info,
  737. .mode = SPI_MODE_0,
  738. },
  739. #endif
  740. };
  741. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  742. /* SPI controller data */
  743. static struct bfin5xx_spi_master bfin_spi0_info = {
  744. .num_chipselect = 8,
  745. .enable_dma = 1, /* master has the ability to do dma transfer */
  746. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  747. };
  748. /* SPI (0) */
  749. static struct resource bfin_spi0_resource[] = {
  750. [0] = {
  751. .start = SPI0_REGBASE,
  752. .end = SPI0_REGBASE + 0xFF,
  753. .flags = IORESOURCE_MEM,
  754. },
  755. [1] = {
  756. .start = CH_SPI,
  757. .end = CH_SPI,
  758. .flags = IORESOURCE_IRQ,
  759. },
  760. };
  761. static struct platform_device bfin_spi0_device = {
  762. .name = "bfin-spi",
  763. .id = 0, /* Bus number */
  764. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  765. .resource = bfin_spi0_resource,
  766. .dev = {
  767. .platform_data = &bfin_spi0_info, /* Passed to driver */
  768. },
  769. };
  770. #endif /* spi master and devices */
  771. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  772. static struct platform_device bfin_fb_device = {
  773. .name = "bf537-lq035",
  774. };
  775. #endif
  776. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  777. static struct platform_device bfin_fb_adv7393_device = {
  778. .name = "bfin-adv7393",
  779. };
  780. #endif
  781. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  782. #include <asm/bfin-lq035q1.h>
  783. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  784. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  785. .use_bl = 0, /* let something else control the LCD Blacklight */
  786. .gpio_bl = GPIO_PF7,
  787. };
  788. static struct resource bfin_lq035q1_resources[] = {
  789. {
  790. .start = IRQ_PPI_ERROR,
  791. .end = IRQ_PPI_ERROR,
  792. .flags = IORESOURCE_IRQ,
  793. },
  794. };
  795. static struct platform_device bfin_lq035q1_device = {
  796. .name = "bfin-lq035q1",
  797. .id = -1,
  798. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  799. .resource = bfin_lq035q1_resources,
  800. .dev = {
  801. .platform_data = &bfin_lq035q1_data,
  802. },
  803. };
  804. #endif
  805. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  806. static struct resource bfin_uart_resources[] = {
  807. #ifdef CONFIG_SERIAL_BFIN_UART0
  808. {
  809. .start = 0xFFC00400,
  810. .end = 0xFFC004FF,
  811. .flags = IORESOURCE_MEM,
  812. },
  813. #endif
  814. #ifdef CONFIG_SERIAL_BFIN_UART1
  815. {
  816. .start = 0xFFC02000,
  817. .end = 0xFFC020FF,
  818. .flags = IORESOURCE_MEM,
  819. },
  820. #endif
  821. };
  822. static struct platform_device bfin_uart_device = {
  823. .name = "bfin-uart",
  824. .id = 1,
  825. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  826. .resource = bfin_uart_resources,
  827. };
  828. #endif
  829. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  830. #ifdef CONFIG_BFIN_SIR0
  831. static struct resource bfin_sir0_resources[] = {
  832. {
  833. .start = 0xFFC00400,
  834. .end = 0xFFC004FF,
  835. .flags = IORESOURCE_MEM,
  836. },
  837. {
  838. .start = IRQ_UART0_RX,
  839. .end = IRQ_UART0_RX+1,
  840. .flags = IORESOURCE_IRQ,
  841. },
  842. {
  843. .start = CH_UART0_RX,
  844. .end = CH_UART0_RX+1,
  845. .flags = IORESOURCE_DMA,
  846. },
  847. };
  848. static struct platform_device bfin_sir0_device = {
  849. .name = "bfin_sir",
  850. .id = 0,
  851. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  852. .resource = bfin_sir0_resources,
  853. };
  854. #endif
  855. #ifdef CONFIG_BFIN_SIR1
  856. static struct resource bfin_sir1_resources[] = {
  857. {
  858. .start = 0xFFC02000,
  859. .end = 0xFFC020FF,
  860. .flags = IORESOURCE_MEM,
  861. },
  862. {
  863. .start = IRQ_UART1_RX,
  864. .end = IRQ_UART1_RX+1,
  865. .flags = IORESOURCE_IRQ,
  866. },
  867. {
  868. .start = CH_UART1_RX,
  869. .end = CH_UART1_RX+1,
  870. .flags = IORESOURCE_DMA,
  871. },
  872. };
  873. static struct platform_device bfin_sir1_device = {
  874. .name = "bfin_sir",
  875. .id = 1,
  876. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  877. .resource = bfin_sir1_resources,
  878. };
  879. #endif
  880. #endif
  881. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  882. static struct resource bfin_twi0_resource[] = {
  883. [0] = {
  884. .start = TWI0_REGBASE,
  885. .end = TWI0_REGBASE,
  886. .flags = IORESOURCE_MEM,
  887. },
  888. [1] = {
  889. .start = IRQ_TWI,
  890. .end = IRQ_TWI,
  891. .flags = IORESOURCE_IRQ,
  892. },
  893. };
  894. static struct platform_device i2c_bfin_twi_device = {
  895. .name = "i2c-bfin-twi",
  896. .id = 0,
  897. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  898. .resource = bfin_twi0_resource,
  899. };
  900. #endif
  901. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  902. #include <linux/input.h>
  903. #include <linux/i2c/adp5588_keys.h>
  904. static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
  905. [0] = KEY_GRAVE,
  906. [1] = KEY_1,
  907. [2] = KEY_2,
  908. [3] = KEY_3,
  909. [4] = KEY_4,
  910. [5] = KEY_5,
  911. [6] = KEY_6,
  912. [7] = KEY_7,
  913. [8] = KEY_8,
  914. [9] = KEY_9,
  915. [10] = KEY_0,
  916. [11] = KEY_MINUS,
  917. [12] = KEY_EQUAL,
  918. [13] = KEY_BACKSLASH,
  919. [15] = KEY_KP0,
  920. [16] = KEY_Q,
  921. [17] = KEY_W,
  922. [18] = KEY_E,
  923. [19] = KEY_R,
  924. [20] = KEY_T,
  925. [21] = KEY_Y,
  926. [22] = KEY_U,
  927. [23] = KEY_I,
  928. [24] = KEY_O,
  929. [25] = KEY_P,
  930. [26] = KEY_LEFTBRACE,
  931. [27] = KEY_RIGHTBRACE,
  932. [29] = KEY_KP1,
  933. [30] = KEY_KP2,
  934. [31] = KEY_KP3,
  935. [32] = KEY_A,
  936. [33] = KEY_S,
  937. [34] = KEY_D,
  938. [35] = KEY_F,
  939. [36] = KEY_G,
  940. [37] = KEY_H,
  941. [38] = KEY_J,
  942. [39] = KEY_K,
  943. [40] = KEY_L,
  944. [41] = KEY_SEMICOLON,
  945. [42] = KEY_APOSTROPHE,
  946. [43] = KEY_BACKSLASH,
  947. [45] = KEY_KP4,
  948. [46] = KEY_KP5,
  949. [47] = KEY_KP6,
  950. [48] = KEY_102ND,
  951. [49] = KEY_Z,
  952. [50] = KEY_X,
  953. [51] = KEY_C,
  954. [52] = KEY_V,
  955. [53] = KEY_B,
  956. [54] = KEY_N,
  957. [55] = KEY_M,
  958. [56] = KEY_COMMA,
  959. [57] = KEY_DOT,
  960. [58] = KEY_SLASH,
  961. [60] = KEY_KPDOT,
  962. [61] = KEY_KP7,
  963. [62] = KEY_KP8,
  964. [63] = KEY_KP9,
  965. [64] = KEY_SPACE,
  966. [65] = KEY_BACKSPACE,
  967. [66] = KEY_TAB,
  968. [67] = KEY_KPENTER,
  969. [68] = KEY_ENTER,
  970. [69] = KEY_ESC,
  971. [70] = KEY_DELETE,
  972. [74] = KEY_KPMINUS,
  973. [76] = KEY_UP,
  974. [77] = KEY_DOWN,
  975. [78] = KEY_RIGHT,
  976. [79] = KEY_LEFT,
  977. };
  978. static struct adp5588_kpad_platform_data adp5588_kpad_data = {
  979. .rows = 8,
  980. .cols = 10,
  981. .keymap = adp5588_keymap,
  982. .keymapsize = ARRAY_SIZE(adp5588_keymap),
  983. .repeat = 0,
  984. };
  985. #endif
  986. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  987. #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
  988. {
  989. I2C_BOARD_INFO("ad7142_joystick", 0x2C),
  990. .irq = IRQ_PF5,
  991. },
  992. #endif
  993. #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  994. {
  995. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  996. },
  997. #endif
  998. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  999. {
  1000. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1001. .irq = IRQ_PG6,
  1002. },
  1003. #endif
  1004. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  1005. {
  1006. I2C_BOARD_INFO("ad7879", 0x2F),
  1007. .irq = IRQ_PG5,
  1008. .platform_data = (void *)&bfin_ad7879_ts_info,
  1009. },
  1010. #endif
  1011. #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
  1012. {
  1013. I2C_BOARD_INFO("adp5588-keys", 0x34),
  1014. .irq = IRQ_PG0,
  1015. .platform_data = (void *)&adp5588_kpad_data,
  1016. },
  1017. #endif
  1018. };
  1019. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1020. static struct platform_device bfin_sport0_uart_device = {
  1021. .name = "bfin-sport-uart",
  1022. .id = 0,
  1023. };
  1024. static struct platform_device bfin_sport1_uart_device = {
  1025. .name = "bfin-sport-uart",
  1026. .id = 1,
  1027. };
  1028. #endif
  1029. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1030. #define PATA_INT IRQ_PF5
  1031. static struct pata_platform_info bfin_pata_platform_data = {
  1032. .ioport_shift = 1,
  1033. .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
  1034. };
  1035. static struct resource bfin_pata_resources[] = {
  1036. {
  1037. .start = 0x20314020,
  1038. .end = 0x2031403F,
  1039. .flags = IORESOURCE_MEM,
  1040. },
  1041. {
  1042. .start = 0x2031401C,
  1043. .end = 0x2031401F,
  1044. .flags = IORESOURCE_MEM,
  1045. },
  1046. {
  1047. .start = PATA_INT,
  1048. .end = PATA_INT,
  1049. .flags = IORESOURCE_IRQ,
  1050. },
  1051. };
  1052. static struct platform_device bfin_pata_device = {
  1053. .name = "pata_platform",
  1054. .id = -1,
  1055. .num_resources = ARRAY_SIZE(bfin_pata_resources),
  1056. .resource = bfin_pata_resources,
  1057. .dev = {
  1058. .platform_data = &bfin_pata_platform_data,
  1059. }
  1060. };
  1061. #endif
  1062. static const unsigned int cclk_vlev_datasheet[] =
  1063. {
  1064. VRPAIR(VLEV_085, 250000000),
  1065. VRPAIR(VLEV_090, 376000000),
  1066. VRPAIR(VLEV_095, 426000000),
  1067. VRPAIR(VLEV_100, 426000000),
  1068. VRPAIR(VLEV_105, 476000000),
  1069. VRPAIR(VLEV_110, 476000000),
  1070. VRPAIR(VLEV_115, 476000000),
  1071. VRPAIR(VLEV_120, 500000000),
  1072. VRPAIR(VLEV_125, 533000000),
  1073. VRPAIR(VLEV_130, 600000000),
  1074. };
  1075. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1076. .tuple_tab = cclk_vlev_datasheet,
  1077. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1078. .vr_settling_time = 25 /* us */,
  1079. };
  1080. static struct platform_device bfin_dpmc = {
  1081. .name = "bfin dpmc",
  1082. .dev = {
  1083. .platform_data = &bfin_dmpc_vreg_data,
  1084. },
  1085. };
  1086. static struct platform_device *stamp_devices[] __initdata = {
  1087. &bfin_dpmc,
  1088. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  1089. &bfin_pcmcia_cf_device,
  1090. #endif
  1091. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1092. &rtc_device,
  1093. #endif
  1094. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  1095. &sl811_hcd_device,
  1096. #endif
  1097. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  1098. &isp1362_hcd_device,
  1099. #endif
  1100. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1101. &bfin_isp1760_device,
  1102. #endif
  1103. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  1104. &smc91x_device,
  1105. #endif
  1106. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  1107. &dm9000_device,
  1108. #endif
  1109. #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
  1110. &ax88180_device,
  1111. #endif
  1112. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  1113. &bfin_mii_bus,
  1114. &bfin_mac_device,
  1115. #endif
  1116. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  1117. &net2272_bfin_device,
  1118. #endif
  1119. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1120. &bfin_spi0_device,
  1121. #endif
  1122. #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
  1123. &bfin_fb_device,
  1124. #endif
  1125. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  1126. &bfin_lq035q1_device,
  1127. #endif
  1128. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  1129. &bfin_fb_adv7393_device,
  1130. #endif
  1131. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1132. &bfin_uart_device,
  1133. #endif
  1134. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1135. #ifdef CONFIG_BFIN_SIR0
  1136. &bfin_sir0_device,
  1137. #endif
  1138. #ifdef CONFIG_BFIN_SIR1
  1139. &bfin_sir1_device,
  1140. #endif
  1141. #endif
  1142. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1143. &i2c_bfin_twi_device,
  1144. #endif
  1145. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1146. &bfin_sport0_uart_device,
  1147. &bfin_sport1_uart_device,
  1148. #endif
  1149. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1150. &bfin_pata_device,
  1151. #endif
  1152. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1153. &bfin_device_gpiokeys,
  1154. #endif
  1155. &bfin_gpios_device,
  1156. #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  1157. &bfin_async_nand_device,
  1158. #endif
  1159. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1160. &stamp_flash_device,
  1161. #endif
  1162. };
  1163. static int __init stamp_init(void)
  1164. {
  1165. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1166. i2c_register_board_info(0, bfin_i2c_board_info,
  1167. ARRAY_SIZE(bfin_i2c_board_info));
  1168. bfin_plat_nand_init();
  1169. platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
  1170. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1171. #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
  1172. irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
  1173. #endif
  1174. return 0;
  1175. }
  1176. arch_initcall(stamp_init);
  1177. void native_machine_restart(char *cmd)
  1178. {
  1179. /* workaround reboot hang when booting from SPI */
  1180. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  1181. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  1182. }
  1183. /*
  1184. * Currently the MAC address is saved in Flash by U-Boot
  1185. */
  1186. #define FLASH_MAC 0x203f0000
  1187. void bfin_get_ether_addr(char *addr)
  1188. {
  1189. *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
  1190. *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
  1191. }
  1192. EXPORT_SYMBOL(bfin_get_ether_addr);