ezkit.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/export.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/mtd/mtd.h>
  12. #include <linux/mtd/partitions.h>
  13. #include <linux/mtd/physmap.h>
  14. #include <linux/spi/spi.h>
  15. #include <linux/spi/flash.h>
  16. #include <linux/i2c.h>
  17. #include <linux/irq.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/usb/musb.h>
  20. #include <linux/leds.h>
  21. #include <linux/input.h>
  22. #include <asm/dma.h>
  23. #include <asm/bfin5xx_spi.h>
  24. #include <asm/reboot.h>
  25. #include <asm/nand.h>
  26. #include <asm/portmux.h>
  27. #include <asm/dpmc.h>
  28. #include <linux/spi/ad7877.h>
  29. #include <asm/bfin_sport.h>
  30. /*
  31. * Name the Board for the /proc/cpuinfo
  32. */
  33. #ifdef CONFIG_BFIN527_EZKIT_V2
  34. const char bfin_board_name[] = "ADI BF527-EZKIT V2";
  35. #else
  36. const char bfin_board_name[] = "ADI BF527-EZKIT";
  37. #endif
  38. /*
  39. * Driver needs to know address, irq and flag pin.
  40. */
  41. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  42. #include <linux/usb/isp1760.h>
  43. static struct resource bfin_isp1760_resources[] = {
  44. [0] = {
  45. .start = 0x203C0000,
  46. .end = 0x203C0000 + 0x000fffff,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. [1] = {
  50. .start = IRQ_PF7,
  51. .end = IRQ_PF7,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. static struct isp1760_platform_data isp1760_priv = {
  56. .is_isp1761 = 0,
  57. .bus_width_16 = 1,
  58. .port1_otg = 0,
  59. .analog_oc = 0,
  60. .dack_polarity_high = 0,
  61. .dreq_polarity_high = 0,
  62. };
  63. static struct platform_device bfin_isp1760_device = {
  64. .name = "isp1760",
  65. .id = 0,
  66. .dev = {
  67. .platform_data = &isp1760_priv,
  68. },
  69. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  70. .resource = bfin_isp1760_resources,
  71. };
  72. #endif
  73. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  74. static struct resource musb_resources[] = {
  75. [0] = {
  76. .start = 0xffc03800,
  77. .end = 0xffc03cff,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = { /* general IRQ */
  81. .start = IRQ_USB_INT0,
  82. .end = IRQ_USB_INT0,
  83. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  84. .name = "mc"
  85. },
  86. [2] = { /* DMA IRQ */
  87. .start = IRQ_USB_DMA,
  88. .end = IRQ_USB_DMA,
  89. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  90. .name = "dma"
  91. },
  92. };
  93. static struct musb_hdrc_config musb_config = {
  94. .multipoint = 0,
  95. .dyn_fifo = 0,
  96. .soft_con = 1,
  97. .dma = 1,
  98. .num_eps = 8,
  99. .dma_channels = 8,
  100. .gpio_vrsel = GPIO_PG13,
  101. /* Some custom boards need to be active low, just set it to "0"
  102. * if it is the case.
  103. */
  104. .gpio_vrsel_active = 1,
  105. .clkin = 24, /* musb CLKIN in MHZ */
  106. };
  107. static struct musb_hdrc_platform_data musb_plat = {
  108. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  109. .mode = MUSB_OTG,
  110. #elif defined(CONFIG_USB_MUSB_HDRC)
  111. .mode = MUSB_HOST,
  112. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  113. .mode = MUSB_PERIPHERAL,
  114. #endif
  115. .config = &musb_config,
  116. };
  117. static u64 musb_dmamask = ~(u32)0;
  118. static struct platform_device musb_device = {
  119. .name = "musb-blackfin",
  120. .id = 0,
  121. .dev = {
  122. .dma_mask = &musb_dmamask,
  123. .coherent_dma_mask = 0xffffffff,
  124. .platform_data = &musb_plat,
  125. },
  126. .num_resources = ARRAY_SIZE(musb_resources),
  127. .resource = musb_resources,
  128. };
  129. #endif
  130. #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
  131. static struct resource bf52x_t350mcqb_resources[] = {
  132. {
  133. .start = IRQ_PPI_ERROR,
  134. .end = IRQ_PPI_ERROR,
  135. .flags = IORESOURCE_IRQ,
  136. },
  137. };
  138. static struct platform_device bf52x_t350mcqb_device = {
  139. .name = "bfin-t350mcqb",
  140. .id = -1,
  141. .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
  142. .resource = bf52x_t350mcqb_resources,
  143. };
  144. #endif
  145. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  146. #include <asm/bfin-lq035q1.h>
  147. static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
  148. .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
  149. .ppi_mode = USE_RGB565_8_BIT_PPI,
  150. };
  151. static struct resource bfin_lq035q1_resources[] = {
  152. {
  153. .start = IRQ_PPI_ERROR,
  154. .end = IRQ_PPI_ERROR,
  155. .flags = IORESOURCE_IRQ,
  156. },
  157. };
  158. static struct platform_device bfin_lq035q1_device = {
  159. .name = "bfin-lq035q1",
  160. .id = -1,
  161. .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
  162. .resource = bfin_lq035q1_resources,
  163. .dev = {
  164. .platform_data = &bfin_lq035q1_data,
  165. },
  166. };
  167. #endif
  168. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  169. static struct mtd_partition ezkit_partitions[] = {
  170. {
  171. .name = "bootloader(nor)",
  172. .size = 0x40000,
  173. .offset = 0,
  174. }, {
  175. .name = "linux kernel(nor)",
  176. .size = 0x1C0000,
  177. .offset = MTDPART_OFS_APPEND,
  178. }, {
  179. .name = "file system(nor)",
  180. .size = MTDPART_SIZ_FULL,
  181. .offset = MTDPART_OFS_APPEND,
  182. }
  183. };
  184. static struct physmap_flash_data ezkit_flash_data = {
  185. .width = 2,
  186. .parts = ezkit_partitions,
  187. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  188. };
  189. static struct resource ezkit_flash_resource = {
  190. .start = 0x20000000,
  191. .end = 0x203fffff,
  192. .flags = IORESOURCE_MEM,
  193. };
  194. static struct platform_device ezkit_flash_device = {
  195. .name = "physmap-flash",
  196. .id = 0,
  197. .dev = {
  198. .platform_data = &ezkit_flash_data,
  199. },
  200. .num_resources = 1,
  201. .resource = &ezkit_flash_resource,
  202. };
  203. #endif
  204. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  205. static struct mtd_partition partition_info[] = {
  206. {
  207. .name = "bootloader(nand)",
  208. .offset = 0,
  209. .size = 0x40000,
  210. }, {
  211. .name = "linux kernel(nand)",
  212. .offset = MTDPART_OFS_APPEND,
  213. .size = 4 * 1024 * 1024,
  214. },
  215. {
  216. .name = "file system(nand)",
  217. .offset = MTDPART_OFS_APPEND,
  218. .size = MTDPART_SIZ_FULL,
  219. },
  220. };
  221. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  222. .data_width = NFC_NWIDTH_8,
  223. .partitions = partition_info,
  224. .nr_partitions = ARRAY_SIZE(partition_info),
  225. .rd_dly = 3,
  226. .wr_dly = 3,
  227. };
  228. static struct resource bf5xx_nand_resources[] = {
  229. {
  230. .start = NFC_CTL,
  231. .end = NFC_DATA_RD + 2,
  232. .flags = IORESOURCE_MEM,
  233. },
  234. {
  235. .start = CH_NFC,
  236. .end = CH_NFC,
  237. .flags = IORESOURCE_IRQ,
  238. },
  239. };
  240. static struct platform_device bf5xx_nand_device = {
  241. .name = "bf5xx-nand",
  242. .id = 0,
  243. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  244. .resource = bf5xx_nand_resources,
  245. .dev = {
  246. .platform_data = &bf5xx_nand_platform,
  247. },
  248. };
  249. #endif
  250. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  251. static struct resource bfin_pcmcia_cf_resources[] = {
  252. {
  253. .start = 0x20310000, /* IO PORT */
  254. .end = 0x20312000,
  255. .flags = IORESOURCE_MEM,
  256. }, {
  257. .start = 0x20311000, /* Attribute Memory */
  258. .end = 0x20311FFF,
  259. .flags = IORESOURCE_MEM,
  260. }, {
  261. .start = IRQ_PF4,
  262. .end = IRQ_PF4,
  263. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  264. }, {
  265. .start = 6, /* Card Detect PF6 */
  266. .end = 6,
  267. .flags = IORESOURCE_IRQ,
  268. },
  269. };
  270. static struct platform_device bfin_pcmcia_cf_device = {
  271. .name = "bfin_cf_pcmcia",
  272. .id = -1,
  273. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  274. .resource = bfin_pcmcia_cf_resources,
  275. };
  276. #endif
  277. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  278. static struct platform_device rtc_device = {
  279. .name = "rtc-bfin",
  280. .id = -1,
  281. };
  282. #endif
  283. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  284. #include <linux/smc91x.h>
  285. static struct smc91x_platdata smc91x_info = {
  286. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  287. .leda = RPC_LED_100_10,
  288. .ledb = RPC_LED_TX_RX,
  289. };
  290. static struct resource smc91x_resources[] = {
  291. {
  292. .name = "smc91x-regs",
  293. .start = 0x20300300,
  294. .end = 0x20300300 + 16,
  295. .flags = IORESOURCE_MEM,
  296. }, {
  297. .start = IRQ_PF7,
  298. .end = IRQ_PF7,
  299. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  300. },
  301. };
  302. static struct platform_device smc91x_device = {
  303. .name = "smc91x",
  304. .id = 0,
  305. .num_resources = ARRAY_SIZE(smc91x_resources),
  306. .resource = smc91x_resources,
  307. .dev = {
  308. .platform_data = &smc91x_info,
  309. },
  310. };
  311. #endif
  312. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  313. static struct resource dm9000_resources[] = {
  314. [0] = {
  315. .start = 0x203FB800,
  316. .end = 0x203FB800 + 1,
  317. .flags = IORESOURCE_MEM,
  318. },
  319. [1] = {
  320. .start = 0x203FB800 + 4,
  321. .end = 0x203FB800 + 5,
  322. .flags = IORESOURCE_MEM,
  323. },
  324. [2] = {
  325. .start = IRQ_PF9,
  326. .end = IRQ_PF9,
  327. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  328. },
  329. };
  330. static struct platform_device dm9000_device = {
  331. .name = "dm9000",
  332. .id = -1,
  333. .num_resources = ARRAY_SIZE(dm9000_resources),
  334. .resource = dm9000_resources,
  335. };
  336. #endif
  337. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  338. #include <linux/bfin_mac.h>
  339. static const unsigned short bfin_mac_peripherals[] = P_RMII0;
  340. static struct bfin_phydev_platform_data bfin_phydev_data[] = {
  341. {
  342. .addr = 1,
  343. .irq = IRQ_MAC_PHYINT,
  344. },
  345. };
  346. static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
  347. .phydev_number = 1,
  348. .phydev_data = bfin_phydev_data,
  349. .phy_mode = PHY_INTERFACE_MODE_RMII,
  350. .mac_peripherals = bfin_mac_peripherals,
  351. };
  352. static struct platform_device bfin_mii_bus = {
  353. .name = "bfin_mii_bus",
  354. .dev = {
  355. .platform_data = &bfin_mii_bus_data,
  356. }
  357. };
  358. static struct platform_device bfin_mac_device = {
  359. .name = "bfin_mac",
  360. .dev = {
  361. .platform_data = &bfin_mii_bus,
  362. }
  363. };
  364. #endif
  365. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  366. static struct resource net2272_bfin_resources[] = {
  367. {
  368. .start = 0x20300000,
  369. .end = 0x20300000 + 0x100,
  370. .flags = IORESOURCE_MEM,
  371. }, {
  372. .start = 1,
  373. .flags = IORESOURCE_BUS,
  374. }, {
  375. .start = IRQ_PF7,
  376. .end = IRQ_PF7,
  377. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  378. },
  379. };
  380. static struct platform_device net2272_bfin_device = {
  381. .name = "net2272",
  382. .id = -1,
  383. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  384. .resource = net2272_bfin_resources,
  385. };
  386. #endif
  387. #if defined(CONFIG_MTD_M25P80) \
  388. || defined(CONFIG_MTD_M25P80_MODULE)
  389. static struct mtd_partition bfin_spi_flash_partitions[] = {
  390. {
  391. .name = "bootloader(spi)",
  392. .size = 0x00040000,
  393. .offset = 0,
  394. .mask_flags = MTD_CAP_ROM
  395. }, {
  396. .name = "linux kernel(spi)",
  397. .size = MTDPART_SIZ_FULL,
  398. .offset = MTDPART_OFS_APPEND,
  399. }
  400. };
  401. static struct flash_platform_data bfin_spi_flash_data = {
  402. .name = "m25p80",
  403. .parts = bfin_spi_flash_partitions,
  404. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  405. .type = "m25p16",
  406. };
  407. /* SPI flash chip (m25p64) */
  408. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  409. .enable_dma = 0, /* use dma transfer with this chip*/
  410. };
  411. #endif
  412. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  413. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  414. .enable_dma = 0,
  415. };
  416. #endif
  417. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  418. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  419. .model = 7877,
  420. .vref_delay_usecs = 50, /* internal, no capacitor */
  421. .x_plate_ohms = 419,
  422. .y_plate_ohms = 486,
  423. .pressure_max = 1000,
  424. .pressure_min = 0,
  425. .stopacq_polarity = 1,
  426. .first_conversion_delay = 3,
  427. .acquisition_time = 1,
  428. .averaging = 1,
  429. .pen_down_acc_interval = 1,
  430. };
  431. #endif
  432. #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
  433. #include <linux/spi/ad7879.h>
  434. static const struct ad7879_platform_data bfin_ad7879_ts_info = {
  435. .model = 7879, /* Model = AD7879 */
  436. .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
  437. .pressure_max = 10000,
  438. .pressure_min = 0,
  439. .first_conversion_delay = 3, /* wait 512us before do a first conversion */
  440. .acquisition_time = 1, /* 4us acquisition time per sample */
  441. .median = 2, /* do 8 measurements */
  442. .averaging = 1, /* take the average of 4 middle samples */
  443. .pen_down_acc_interval = 255, /* 9.4 ms */
  444. .gpio_export = 0, /* Export GPIO to gpiolib */
  445. };
  446. #endif
  447. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
  448. defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  449. static const u16 bfin_snd_pin[][7] = {
  450. {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  451. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0, 0},
  452. {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  453. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_TFS, 0},
  454. };
  455. static struct bfin_snd_platform_data bfin_snd_data[] = {
  456. {
  457. .pin_req = &bfin_snd_pin[0][0],
  458. },
  459. {
  460. .pin_req = &bfin_snd_pin[1][0],
  461. },
  462. };
  463. #define BFIN_SND_RES(x) \
  464. [x] = { \
  465. { \
  466. .start = SPORT##x##_TCR1, \
  467. .end = SPORT##x##_TCR1, \
  468. .flags = IORESOURCE_MEM \
  469. }, \
  470. { \
  471. .start = CH_SPORT##x##_RX, \
  472. .end = CH_SPORT##x##_RX, \
  473. .flags = IORESOURCE_DMA, \
  474. }, \
  475. { \
  476. .start = CH_SPORT##x##_TX, \
  477. .end = CH_SPORT##x##_TX, \
  478. .flags = IORESOURCE_DMA, \
  479. }, \
  480. { \
  481. .start = IRQ_SPORT##x##_ERROR, \
  482. .end = IRQ_SPORT##x##_ERROR, \
  483. .flags = IORESOURCE_IRQ, \
  484. } \
  485. }
  486. static struct resource bfin_snd_resources[][4] = {
  487. BFIN_SND_RES(0),
  488. BFIN_SND_RES(1),
  489. };
  490. #endif
  491. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  492. static struct platform_device bfin_i2s_pcm = {
  493. .name = "bfin-i2s-pcm-audio",
  494. .id = -1,
  495. };
  496. #endif
  497. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  498. static struct platform_device bfin_tdm_pcm = {
  499. .name = "bfin-tdm-pcm-audio",
  500. .id = -1,
  501. };
  502. #endif
  503. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  504. static struct platform_device bfin_ac97_pcm = {
  505. .name = "bfin-ac97-pcm-audio",
  506. .id = -1,
  507. };
  508. #endif
  509. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  510. static struct platform_device bfin_i2s = {
  511. .name = "bfin-i2s",
  512. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  513. .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
  514. .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
  515. .dev = {
  516. .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
  517. },
  518. };
  519. #endif
  520. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  521. static struct platform_device bfin_tdm = {
  522. .name = "bfin-tdm",
  523. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  524. .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
  525. .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
  526. .dev = {
  527. .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
  528. },
  529. };
  530. #endif
  531. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
  532. || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  533. static const char * const ad1836_link[] = {
  534. "bfin-tdm.0",
  535. "spi0.4",
  536. };
  537. static struct platform_device bfin_ad1836_machine = {
  538. .name = "bfin-snd-ad1836",
  539. .id = -1,
  540. .dev = {
  541. .platform_data = (void *)ad1836_link,
  542. },
  543. };
  544. #endif
  545. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  546. #if defined(CONFIG_MTD_M25P80) \
  547. || defined(CONFIG_MTD_M25P80_MODULE)
  548. {
  549. /* the modalias must be the same as spi device driver name */
  550. .modalias = "m25p80", /* Name of spi_driver for this device */
  551. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  552. .bus_num = 0, /* Framework bus number */
  553. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  554. .platform_data = &bfin_spi_flash_data,
  555. .controller_data = &spi_flash_chip_info,
  556. .mode = SPI_MODE_3,
  557. },
  558. #endif
  559. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  560. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  561. {
  562. .modalias = "ad183x",
  563. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  564. .bus_num = 0,
  565. .chip_select = 4,
  566. .platform_data = "ad1836",
  567. .mode = SPI_MODE_3,
  568. },
  569. #endif
  570. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  571. {
  572. .modalias = "mmc_spi",
  573. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  574. .bus_num = 0,
  575. .chip_select = 3,
  576. .controller_data = &mmc_spi_chip_info,
  577. .mode = SPI_MODE_0,
  578. },
  579. #endif
  580. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  581. {
  582. .modalias = "ad7877",
  583. .platform_data = &bfin_ad7877_ts_info,
  584. .irq = IRQ_PF8,
  585. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  586. .bus_num = 0,
  587. .chip_select = 2,
  588. },
  589. #endif
  590. #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
  591. {
  592. .modalias = "ad7879",
  593. .platform_data = &bfin_ad7879_ts_info,
  594. .irq = IRQ_PF8,
  595. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  596. .bus_num = 0,
  597. .chip_select = 3,
  598. .mode = SPI_CPHA | SPI_CPOL,
  599. },
  600. #endif
  601. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  602. {
  603. .modalias = "spidev",
  604. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  605. .bus_num = 0,
  606. .chip_select = 1,
  607. },
  608. #endif
  609. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  610. {
  611. .modalias = "bfin-lq035q1-spi",
  612. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  613. .bus_num = 0,
  614. .chip_select = 7,
  615. .mode = SPI_CPHA | SPI_CPOL,
  616. },
  617. #endif
  618. };
  619. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  620. /* SPI controller data */
  621. static struct bfin5xx_spi_master bfin_spi0_info = {
  622. .num_chipselect = 8,
  623. .enable_dma = 1, /* master has the ability to do dma transfer */
  624. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  625. };
  626. /* SPI (0) */
  627. static struct resource bfin_spi0_resource[] = {
  628. [0] = {
  629. .start = SPI0_REGBASE,
  630. .end = SPI0_REGBASE + 0xFF,
  631. .flags = IORESOURCE_MEM,
  632. },
  633. [1] = {
  634. .start = CH_SPI,
  635. .end = CH_SPI,
  636. .flags = IORESOURCE_DMA,
  637. },
  638. [2] = {
  639. .start = IRQ_SPI,
  640. .end = IRQ_SPI,
  641. .flags = IORESOURCE_IRQ,
  642. },
  643. };
  644. static struct platform_device bfin_spi0_device = {
  645. .name = "bfin-spi",
  646. .id = 0, /* Bus number */
  647. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  648. .resource = bfin_spi0_resource,
  649. .dev = {
  650. .platform_data = &bfin_spi0_info, /* Passed to driver */
  651. },
  652. };
  653. #endif /* spi master and devices */
  654. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  655. #ifdef CONFIG_SERIAL_BFIN_UART0
  656. static struct resource bfin_uart0_resources[] = {
  657. {
  658. .start = UART0_THR,
  659. .end = UART0_GCTL+2,
  660. .flags = IORESOURCE_MEM,
  661. },
  662. {
  663. .start = IRQ_UART0_TX,
  664. .end = IRQ_UART0_TX,
  665. .flags = IORESOURCE_IRQ,
  666. },
  667. {
  668. .start = IRQ_UART0_RX,
  669. .end = IRQ_UART0_RX,
  670. .flags = IORESOURCE_IRQ,
  671. },
  672. {
  673. .start = IRQ_UART0_ERROR,
  674. .end = IRQ_UART0_ERROR,
  675. .flags = IORESOURCE_IRQ,
  676. },
  677. {
  678. .start = CH_UART0_TX,
  679. .end = CH_UART0_TX,
  680. .flags = IORESOURCE_DMA,
  681. },
  682. {
  683. .start = CH_UART0_RX,
  684. .end = CH_UART0_RX,
  685. .flags = IORESOURCE_DMA,
  686. },
  687. };
  688. static unsigned short bfin_uart0_peripherals[] = {
  689. P_UART0_TX, P_UART0_RX, 0
  690. };
  691. static struct platform_device bfin_uart0_device = {
  692. .name = "bfin-uart",
  693. .id = 0,
  694. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  695. .resource = bfin_uart0_resources,
  696. .dev = {
  697. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  698. },
  699. };
  700. #endif
  701. #ifdef CONFIG_SERIAL_BFIN_UART1
  702. static struct resource bfin_uart1_resources[] = {
  703. {
  704. .start = UART1_THR,
  705. .end = UART1_GCTL+2,
  706. .flags = IORESOURCE_MEM,
  707. },
  708. {
  709. .start = IRQ_UART1_TX,
  710. .end = IRQ_UART1_TX,
  711. .flags = IORESOURCE_IRQ,
  712. },
  713. {
  714. .start = IRQ_UART1_RX,
  715. .end = IRQ_UART1_RX,
  716. .flags = IORESOURCE_IRQ,
  717. },
  718. {
  719. .start = IRQ_UART1_ERROR,
  720. .end = IRQ_UART1_ERROR,
  721. .flags = IORESOURCE_IRQ,
  722. },
  723. {
  724. .start = CH_UART1_TX,
  725. .end = CH_UART1_TX,
  726. .flags = IORESOURCE_DMA,
  727. },
  728. {
  729. .start = CH_UART1_RX,
  730. .end = CH_UART1_RX,
  731. .flags = IORESOURCE_DMA,
  732. },
  733. #ifdef CONFIG_BFIN_UART1_CTSRTS
  734. { /* CTS pin */
  735. .start = GPIO_PF9,
  736. .end = GPIO_PF9,
  737. .flags = IORESOURCE_IO,
  738. },
  739. { /* RTS pin */
  740. .start = GPIO_PF10,
  741. .end = GPIO_PF10,
  742. .flags = IORESOURCE_IO,
  743. },
  744. #endif
  745. };
  746. static unsigned short bfin_uart1_peripherals[] = {
  747. P_UART1_TX, P_UART1_RX, 0
  748. };
  749. static struct platform_device bfin_uart1_device = {
  750. .name = "bfin-uart",
  751. .id = 1,
  752. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  753. .resource = bfin_uart1_resources,
  754. .dev = {
  755. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  756. },
  757. };
  758. #endif
  759. #endif
  760. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  761. #ifdef CONFIG_BFIN_SIR0
  762. static struct resource bfin_sir0_resources[] = {
  763. {
  764. .start = 0xFFC00400,
  765. .end = 0xFFC004FF,
  766. .flags = IORESOURCE_MEM,
  767. },
  768. {
  769. .start = IRQ_UART0_RX,
  770. .end = IRQ_UART0_RX+1,
  771. .flags = IORESOURCE_IRQ,
  772. },
  773. {
  774. .start = CH_UART0_RX,
  775. .end = CH_UART0_RX+1,
  776. .flags = IORESOURCE_DMA,
  777. },
  778. };
  779. static struct platform_device bfin_sir0_device = {
  780. .name = "bfin_sir",
  781. .id = 0,
  782. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  783. .resource = bfin_sir0_resources,
  784. };
  785. #endif
  786. #ifdef CONFIG_BFIN_SIR1
  787. static struct resource bfin_sir1_resources[] = {
  788. {
  789. .start = 0xFFC02000,
  790. .end = 0xFFC020FF,
  791. .flags = IORESOURCE_MEM,
  792. },
  793. {
  794. .start = IRQ_UART1_RX,
  795. .end = IRQ_UART1_RX+1,
  796. .flags = IORESOURCE_IRQ,
  797. },
  798. {
  799. .start = CH_UART1_RX,
  800. .end = CH_UART1_RX+1,
  801. .flags = IORESOURCE_DMA,
  802. },
  803. };
  804. static struct platform_device bfin_sir1_device = {
  805. .name = "bfin_sir",
  806. .id = 1,
  807. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  808. .resource = bfin_sir1_resources,
  809. };
  810. #endif
  811. #endif
  812. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  813. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  814. static struct resource bfin_twi0_resource[] = {
  815. [0] = {
  816. .start = TWI0_REGBASE,
  817. .end = TWI0_REGBASE,
  818. .flags = IORESOURCE_MEM,
  819. },
  820. [1] = {
  821. .start = IRQ_TWI,
  822. .end = IRQ_TWI,
  823. .flags = IORESOURCE_IRQ,
  824. },
  825. };
  826. static struct platform_device i2c_bfin_twi_device = {
  827. .name = "i2c-bfin-twi",
  828. .id = 0,
  829. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  830. .resource = bfin_twi0_resource,
  831. .dev = {
  832. .platform_data = &bfin_twi0_pins,
  833. },
  834. };
  835. #endif
  836. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  837. #include <linux/mfd/adp5520.h>
  838. /*
  839. * ADP5520/5501 LEDs Data
  840. */
  841. static struct led_info adp5520_leds[] = {
  842. {
  843. .name = "adp5520-led1",
  844. .default_trigger = "none",
  845. .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
  846. },
  847. };
  848. static struct adp5520_leds_platform_data adp5520_leds_data = {
  849. .num_leds = ARRAY_SIZE(adp5520_leds),
  850. .leds = adp5520_leds,
  851. .fade_in = ADP5520_FADE_T_600ms,
  852. .fade_out = ADP5520_FADE_T_600ms,
  853. .led_on_time = ADP5520_LED_ONT_600ms,
  854. };
  855. /*
  856. * ADP5520 Keypad Data
  857. */
  858. static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
  859. [ADP5520_KEY(3, 3)] = KEY_1,
  860. [ADP5520_KEY(2, 3)] = KEY_2,
  861. [ADP5520_KEY(1, 3)] = KEY_3,
  862. [ADP5520_KEY(0, 3)] = KEY_UP,
  863. [ADP5520_KEY(3, 2)] = KEY_4,
  864. [ADP5520_KEY(2, 2)] = KEY_5,
  865. [ADP5520_KEY(1, 2)] = KEY_6,
  866. [ADP5520_KEY(0, 2)] = KEY_DOWN,
  867. [ADP5520_KEY(3, 1)] = KEY_7,
  868. [ADP5520_KEY(2, 1)] = KEY_8,
  869. [ADP5520_KEY(1, 1)] = KEY_9,
  870. [ADP5520_KEY(0, 1)] = KEY_DOT,
  871. [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
  872. [ADP5520_KEY(2, 0)] = KEY_0,
  873. [ADP5520_KEY(1, 0)] = KEY_HELP,
  874. [ADP5520_KEY(0, 0)] = KEY_ENTER,
  875. };
  876. static struct adp5520_keys_platform_data adp5520_keys_data = {
  877. .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
  878. .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
  879. .keymap = adp5520_keymap,
  880. .keymapsize = ARRAY_SIZE(adp5520_keymap),
  881. .repeat = 0,
  882. };
  883. /*
  884. * ADP5520/5501 Multifunction Device Init Data
  885. */
  886. static struct adp5520_platform_data adp5520_pdev_data = {
  887. .leds = &adp5520_leds_data,
  888. .keys = &adp5520_keys_data,
  889. };
  890. #endif
  891. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  892. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  893. {
  894. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  895. },
  896. #endif
  897. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  898. {
  899. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  900. .irq = IRQ_PF8,
  901. },
  902. #endif
  903. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  904. {
  905. I2C_BOARD_INFO("bfin-adv7393", 0x2B),
  906. },
  907. #endif
  908. #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
  909. {
  910. I2C_BOARD_INFO("ad7879", 0x2C),
  911. .irq = IRQ_PF8,
  912. .platform_data = (void *)&bfin_ad7879_ts_info,
  913. },
  914. #endif
  915. #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
  916. {
  917. I2C_BOARD_INFO("pmic-adp5520", 0x32),
  918. .irq = IRQ_PF9,
  919. .platform_data = (void *)&adp5520_pdev_data,
  920. },
  921. #endif
  922. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  923. {
  924. I2C_BOARD_INFO("ssm2602", 0x1b),
  925. },
  926. #endif
  927. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  928. {
  929. I2C_BOARD_INFO("ad5252", 0x2f),
  930. },
  931. #endif
  932. #if defined(CONFIG_SND_SOC_ADAU1373) || defined(CONFIG_SND_SOC_ADAU1373_MODULE)
  933. {
  934. I2C_BOARD_INFO("adau1373", 0x1A),
  935. },
  936. #endif
  937. };
  938. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  939. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  940. static struct resource bfin_sport0_uart_resources[] = {
  941. {
  942. .start = SPORT0_TCR1,
  943. .end = SPORT0_MRCS3+4,
  944. .flags = IORESOURCE_MEM,
  945. },
  946. {
  947. .start = IRQ_SPORT0_RX,
  948. .end = IRQ_SPORT0_RX+1,
  949. .flags = IORESOURCE_IRQ,
  950. },
  951. {
  952. .start = IRQ_SPORT0_ERROR,
  953. .end = IRQ_SPORT0_ERROR,
  954. .flags = IORESOURCE_IRQ,
  955. },
  956. };
  957. static unsigned short bfin_sport0_peripherals[] = {
  958. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  959. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  960. };
  961. static struct platform_device bfin_sport0_uart_device = {
  962. .name = "bfin-sport-uart",
  963. .id = 0,
  964. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  965. .resource = bfin_sport0_uart_resources,
  966. .dev = {
  967. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  968. },
  969. };
  970. #endif
  971. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  972. static struct resource bfin_sport1_uart_resources[] = {
  973. {
  974. .start = SPORT1_TCR1,
  975. .end = SPORT1_MRCS3+4,
  976. .flags = IORESOURCE_MEM,
  977. },
  978. {
  979. .start = IRQ_SPORT1_RX,
  980. .end = IRQ_SPORT1_RX+1,
  981. .flags = IORESOURCE_IRQ,
  982. },
  983. {
  984. .start = IRQ_SPORT1_ERROR,
  985. .end = IRQ_SPORT1_ERROR,
  986. .flags = IORESOURCE_IRQ,
  987. },
  988. };
  989. static unsigned short bfin_sport1_peripherals[] = {
  990. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  991. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  992. };
  993. static struct platform_device bfin_sport1_uart_device = {
  994. .name = "bfin-sport-uart",
  995. .id = 1,
  996. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  997. .resource = bfin_sport1_uart_resources,
  998. .dev = {
  999. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  1000. },
  1001. };
  1002. #endif
  1003. #endif
  1004. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1005. #include <linux/gpio_keys.h>
  1006. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1007. {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
  1008. {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
  1009. };
  1010. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1011. .buttons = bfin_gpio_keys_table,
  1012. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1013. };
  1014. static struct platform_device bfin_device_gpiokeys = {
  1015. .name = "gpio-keys",
  1016. .dev = {
  1017. .platform_data = &bfin_gpio_keys_data,
  1018. },
  1019. };
  1020. #endif
  1021. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1022. #include <asm/bfin_rotary.h>
  1023. static struct bfin_rotary_platform_data bfin_rotary_data = {
  1024. /*.rotary_up_key = KEY_UP,*/
  1025. /*.rotary_down_key = KEY_DOWN,*/
  1026. .rotary_rel_code = REL_WHEEL,
  1027. .rotary_button_key = KEY_ENTER,
  1028. .debounce = 10, /* 0..17 */
  1029. .mode = ROT_QUAD_ENC | ROT_DEBE,
  1030. .pm_wakeup = 1,
  1031. };
  1032. static struct resource bfin_rotary_resources[] = {
  1033. {
  1034. .start = IRQ_CNT,
  1035. .end = IRQ_CNT,
  1036. .flags = IORESOURCE_IRQ,
  1037. },
  1038. };
  1039. static struct platform_device bfin_rotary_device = {
  1040. .name = "bfin-rotary",
  1041. .id = -1,
  1042. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  1043. .resource = bfin_rotary_resources,
  1044. .dev = {
  1045. .platform_data = &bfin_rotary_data,
  1046. },
  1047. };
  1048. #endif
  1049. static const unsigned int cclk_vlev_datasheet[] =
  1050. {
  1051. VRPAIR(VLEV_100, 400000000),
  1052. VRPAIR(VLEV_105, 426000000),
  1053. VRPAIR(VLEV_110, 500000000),
  1054. VRPAIR(VLEV_115, 533000000),
  1055. VRPAIR(VLEV_120, 600000000),
  1056. };
  1057. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1058. .tuple_tab = cclk_vlev_datasheet,
  1059. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1060. .vr_settling_time = 25 /* us */,
  1061. };
  1062. static struct platform_device bfin_dpmc = {
  1063. .name = "bfin dpmc",
  1064. .dev = {
  1065. .platform_data = &bfin_dmpc_vreg_data,
  1066. },
  1067. };
  1068. static struct platform_device *stamp_devices[] __initdata = {
  1069. &bfin_dpmc,
  1070. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1071. &bf5xx_nand_device,
  1072. #endif
  1073. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  1074. &bfin_pcmcia_cf_device,
  1075. #endif
  1076. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1077. &rtc_device,
  1078. #endif
  1079. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1080. &bfin_isp1760_device,
  1081. #endif
  1082. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1083. &musb_device,
  1084. #endif
  1085. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  1086. &smc91x_device,
  1087. #endif
  1088. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  1089. &dm9000_device,
  1090. #endif
  1091. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  1092. &bfin_mii_bus,
  1093. &bfin_mac_device,
  1094. #endif
  1095. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  1096. &net2272_bfin_device,
  1097. #endif
  1098. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  1099. &bfin_spi0_device,
  1100. #endif
  1101. #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
  1102. &bf52x_t350mcqb_device,
  1103. #endif
  1104. #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
  1105. &bfin_lq035q1_device,
  1106. #endif
  1107. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1108. #ifdef CONFIG_SERIAL_BFIN_UART0
  1109. &bfin_uart0_device,
  1110. #endif
  1111. #ifdef CONFIG_SERIAL_BFIN_UART1
  1112. &bfin_uart1_device,
  1113. #endif
  1114. #endif
  1115. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1116. #ifdef CONFIG_BFIN_SIR0
  1117. &bfin_sir0_device,
  1118. #endif
  1119. #ifdef CONFIG_BFIN_SIR1
  1120. &bfin_sir1_device,
  1121. #endif
  1122. #endif
  1123. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1124. &i2c_bfin_twi_device,
  1125. #endif
  1126. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1127. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1128. &bfin_sport0_uart_device,
  1129. #endif
  1130. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1131. &bfin_sport1_uart_device,
  1132. #endif
  1133. #endif
  1134. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1135. &bfin_device_gpiokeys,
  1136. #endif
  1137. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1138. &bfin_rotary_device,
  1139. #endif
  1140. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1141. &ezkit_flash_device,
  1142. #endif
  1143. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1144. &bfin_i2s_pcm,
  1145. #endif
  1146. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1147. &bfin_tdm_pcm,
  1148. #endif
  1149. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1150. &bfin_ac97_pcm,
  1151. #endif
  1152. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1153. &bfin_i2s,
  1154. #endif
  1155. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1156. &bfin_tdm,
  1157. #endif
  1158. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \
  1159. defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  1160. &bfin_ad1836_machine,
  1161. #endif
  1162. };
  1163. static int __init ezkit_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. 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. return 0;
  1171. }
  1172. arch_initcall(ezkit_init);
  1173. static struct platform_device *ezkit_early_devices[] __initdata = {
  1174. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1175. #ifdef CONFIG_SERIAL_BFIN_UART0
  1176. &bfin_uart0_device,
  1177. #endif
  1178. #ifdef CONFIG_SERIAL_BFIN_UART1
  1179. &bfin_uart1_device,
  1180. #endif
  1181. #endif
  1182. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1183. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1184. &bfin_sport0_uart_device,
  1185. #endif
  1186. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1187. &bfin_sport1_uart_device,
  1188. #endif
  1189. #endif
  1190. };
  1191. void __init native_machine_early_platform_add_devices(void)
  1192. {
  1193. printk(KERN_INFO "register early platform devices\n");
  1194. early_platform_add_devices(ezkit_early_devices,
  1195. ARRAY_SIZE(ezkit_early_devices));
  1196. }
  1197. void native_machine_restart(char *cmd)
  1198. {
  1199. /* workaround reboot hang when booting from SPI */
  1200. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  1201. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  1202. }
  1203. int bfin_get_ether_addr(char *addr)
  1204. {
  1205. /* the MAC is stored in OTP memory page 0xDF */
  1206. u32 ret;
  1207. u64 otp_mac;
  1208. u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
  1209. ret = otp_read(0xDF, 0x00, &otp_mac);
  1210. if (!(ret & 0x1)) {
  1211. char *otp_mac_p = (char *)&otp_mac;
  1212. for (ret = 0; ret < 6; ++ret)
  1213. addr[ret] = otp_mac_p[5 - ret];
  1214. }
  1215. return 0;
  1216. }
  1217. EXPORT_SYMBOL(bfin_get_ether_addr);