ezkit.c 30 KB

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