ezkit.c 31 KB

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