ezkit.c 30 KB

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