ezkit.c 31 KB

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