ezkit.c 29 KB

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