ezkit.c 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644
  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/irq.h>
  16. #include <linux/i2c.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/usb/musb.h>
  19. #include <asm/bfin_spi3.h>
  20. #include <asm/dma.h>
  21. #include <asm/gpio.h>
  22. #include <asm/nand.h>
  23. #include <asm/dpmc.h>
  24. #include <asm/portmux.h>
  25. #include <asm/bfin_sdh.h>
  26. #include <linux/input.h>
  27. #include <linux/spi/ad7877.h>
  28. /*
  29. * Name the Board for the /proc/cpuinfo
  30. */
  31. const char bfin_board_name[] = "ADI BF609-EZKIT";
  32. /*
  33. * Driver needs to know address, irq and flag pin.
  34. */
  35. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  36. #include <linux/usb/isp1760.h>
  37. static struct resource bfin_isp1760_resources[] = {
  38. [0] = {
  39. .start = 0x2C0C0000,
  40. .end = 0x2C0C0000 + 0xfffff,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .start = IRQ_PG7,
  45. .end = IRQ_PG7,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. static struct isp1760_platform_data isp1760_priv = {
  50. .is_isp1761 = 0,
  51. .bus_width_16 = 1,
  52. .port1_otg = 0,
  53. .analog_oc = 0,
  54. .dack_polarity_high = 0,
  55. .dreq_polarity_high = 0,
  56. };
  57. static struct platform_device bfin_isp1760_device = {
  58. .name = "isp1760",
  59. .id = 0,
  60. .dev = {
  61. .platform_data = &isp1760_priv,
  62. },
  63. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  64. .resource = bfin_isp1760_resources,
  65. };
  66. #endif
  67. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  68. #include <asm/bfin_rotary.h>
  69. static struct bfin_rotary_platform_data bfin_rotary_data = {
  70. /*.rotary_up_key = KEY_UP,*/
  71. /*.rotary_down_key = KEY_DOWN,*/
  72. .rotary_rel_code = REL_WHEEL,
  73. .rotary_button_key = KEY_ENTER,
  74. .debounce = 10, /* 0..17 */
  75. .mode = ROT_QUAD_ENC | ROT_DEBE,
  76. };
  77. static struct resource bfin_rotary_resources[] = {
  78. {
  79. .start = IRQ_CNT,
  80. .end = IRQ_CNT,
  81. .flags = IORESOURCE_IRQ,
  82. },
  83. };
  84. static struct platform_device bfin_rotary_device = {
  85. .name = "bfin-rotary",
  86. .id = -1,
  87. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  88. .resource = bfin_rotary_resources,
  89. .dev = {
  90. .platform_data = &bfin_rotary_data,
  91. },
  92. };
  93. #endif
  94. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  95. #include <linux/stmmac.h>
  96. static unsigned short pins[] = P_RMII0;
  97. static struct stmmac_mdio_bus_data phy_private_data = {
  98. .phy_mask = 1,
  99. };
  100. static struct plat_stmmacenet_data eth_private_data = {
  101. .bus_id = 0,
  102. .enh_desc = 1,
  103. .phy_addr = 1,
  104. .mdio_bus_data = &phy_private_data,
  105. };
  106. static struct platform_device bfin_eth_device = {
  107. .name = "stmmaceth",
  108. .id = 0,
  109. .num_resources = 2,
  110. .resource = (struct resource[]) {
  111. {
  112. .start = EMAC0_MACCFG,
  113. .end = EMAC0_MACCFG + 0x1274,
  114. .flags = IORESOURCE_MEM,
  115. },
  116. {
  117. .name = "macirq",
  118. .start = IRQ_EMAC0_STAT,
  119. .end = IRQ_EMAC0_STAT,
  120. .flags = IORESOURCE_IRQ,
  121. },
  122. },
  123. .dev = {
  124. .power.can_wakeup = 1,
  125. .platform_data = &eth_private_data,
  126. }
  127. };
  128. #endif
  129. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  130. #include <linux/input/adxl34x.h>
  131. static const struct adxl34x_platform_data adxl34x_info = {
  132. .x_axis_offset = 0,
  133. .y_axis_offset = 0,
  134. .z_axis_offset = 0,
  135. .tap_threshold = 0x31,
  136. .tap_duration = 0x10,
  137. .tap_latency = 0x60,
  138. .tap_window = 0xF0,
  139. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  140. .act_axis_control = 0xFF,
  141. .activity_threshold = 5,
  142. .inactivity_threshold = 3,
  143. .inactivity_time = 4,
  144. .free_fall_threshold = 0x7,
  145. .free_fall_time = 0x20,
  146. .data_rate = 0x8,
  147. .data_range = ADXL_FULL_RES,
  148. .ev_type = EV_ABS,
  149. .ev_code_x = ABS_X, /* EV_REL */
  150. .ev_code_y = ABS_Y, /* EV_REL */
  151. .ev_code_z = ABS_Z, /* EV_REL */
  152. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  153. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  154. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  155. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  156. .fifo_mode = ADXL_FIFO_STREAM,
  157. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  158. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  159. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  160. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  161. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  162. };
  163. #endif
  164. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  165. static struct platform_device rtc_device = {
  166. .name = "rtc-bfin",
  167. .id = -1,
  168. };
  169. #endif
  170. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  171. #ifdef CONFIG_SERIAL_BFIN_UART0
  172. static struct resource bfin_uart0_resources[] = {
  173. {
  174. .start = UART0_REVID,
  175. .end = UART0_RXDIV+4,
  176. .flags = IORESOURCE_MEM,
  177. },
  178. {
  179. .start = IRQ_UART0_TX,
  180. .end = IRQ_UART0_TX,
  181. .flags = IORESOURCE_IRQ,
  182. },
  183. {
  184. .start = IRQ_UART0_RX,
  185. .end = IRQ_UART0_RX,
  186. .flags = IORESOURCE_IRQ,
  187. },
  188. {
  189. .start = IRQ_UART0_STAT,
  190. .end = IRQ_UART0_STAT,
  191. .flags = IORESOURCE_IRQ,
  192. },
  193. {
  194. .start = CH_UART0_TX,
  195. .end = CH_UART0_TX,
  196. .flags = IORESOURCE_DMA,
  197. },
  198. {
  199. .start = CH_UART0_RX,
  200. .end = CH_UART0_RX,
  201. .flags = IORESOURCE_DMA,
  202. },
  203. #ifdef CONFIG_BFIN_UART0_CTSRTS
  204. { /* CTS pin -- 0 means not supported */
  205. .start = GPIO_PD10,
  206. .end = GPIO_PD10,
  207. .flags = IORESOURCE_IO,
  208. },
  209. { /* RTS pin -- 0 means not supported */
  210. .start = GPIO_PD9,
  211. .end = GPIO_PD9,
  212. .flags = IORESOURCE_IO,
  213. },
  214. #endif
  215. };
  216. static unsigned short bfin_uart0_peripherals[] = {
  217. P_UART0_TX, P_UART0_RX,
  218. #ifdef CONFIG_BFIN_UART0_CTSRTS
  219. P_UART0_RTS, P_UART0_CTS,
  220. #endif
  221. 0
  222. };
  223. static struct platform_device bfin_uart0_device = {
  224. .name = "bfin-uart",
  225. .id = 0,
  226. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  227. .resource = bfin_uart0_resources,
  228. .dev = {
  229. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  230. },
  231. };
  232. #endif
  233. #ifdef CONFIG_SERIAL_BFIN_UART1
  234. static struct resource bfin_uart1_resources[] = {
  235. {
  236. .start = UART1_REVID,
  237. .end = UART1_RXDIV+4,
  238. .flags = IORESOURCE_MEM,
  239. },
  240. {
  241. .start = IRQ_UART1_TX,
  242. .end = IRQ_UART1_TX,
  243. .flags = IORESOURCE_IRQ,
  244. },
  245. {
  246. .start = IRQ_UART1_RX,
  247. .end = IRQ_UART1_RX,
  248. .flags = IORESOURCE_IRQ,
  249. },
  250. {
  251. .start = IRQ_UART1_STAT,
  252. .end = IRQ_UART1_STAT,
  253. .flags = IORESOURCE_IRQ,
  254. },
  255. {
  256. .start = CH_UART1_TX,
  257. .end = CH_UART1_TX,
  258. .flags = IORESOURCE_DMA,
  259. },
  260. {
  261. .start = CH_UART1_RX,
  262. .end = CH_UART1_RX,
  263. .flags = IORESOURCE_DMA,
  264. },
  265. #ifdef CONFIG_BFIN_UART1_CTSRTS
  266. { /* CTS pin -- 0 means not supported */
  267. .start = GPIO_PG13,
  268. .end = GPIO_PG13,
  269. .flags = IORESOURCE_IO,
  270. },
  271. { /* RTS pin -- 0 means not supported */
  272. .start = GPIO_PG10,
  273. .end = GPIO_PG10,
  274. .flags = IORESOURCE_IO,
  275. },
  276. #endif
  277. };
  278. static unsigned short bfin_uart1_peripherals[] = {
  279. P_UART1_TX, P_UART1_RX,
  280. #ifdef CONFIG_BFIN_UART1_CTSRTS
  281. P_UART1_RTS, P_UART1_CTS,
  282. #endif
  283. 0
  284. };
  285. static struct platform_device bfin_uart1_device = {
  286. .name = "bfin-uart",
  287. .id = 1,
  288. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  289. .resource = bfin_uart1_resources,
  290. .dev = {
  291. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  292. },
  293. };
  294. #endif
  295. #endif
  296. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  297. #ifdef CONFIG_BFIN_SIR0
  298. static struct resource bfin_sir0_resources[] = {
  299. {
  300. .start = 0xFFC00400,
  301. .end = 0xFFC004FF,
  302. .flags = IORESOURCE_MEM,
  303. },
  304. {
  305. .start = IRQ_UART0_TX,
  306. .end = IRQ_UART0_TX+1,
  307. .flags = IORESOURCE_IRQ,
  308. },
  309. {
  310. .start = CH_UART0_TX,
  311. .end = CH_UART0_TX+1,
  312. .flags = IORESOURCE_DMA,
  313. },
  314. };
  315. static struct platform_device bfin_sir0_device = {
  316. .name = "bfin_sir",
  317. .id = 0,
  318. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  319. .resource = bfin_sir0_resources,
  320. };
  321. #endif
  322. #ifdef CONFIG_BFIN_SIR1
  323. static struct resource bfin_sir1_resources[] = {
  324. {
  325. .start = 0xFFC02000,
  326. .end = 0xFFC020FF,
  327. .flags = IORESOURCE_MEM,
  328. },
  329. {
  330. .start = IRQ_UART1_TX,
  331. .end = IRQ_UART1_TX+1,
  332. .flags = IORESOURCE_IRQ,
  333. },
  334. {
  335. .start = CH_UART1_TX,
  336. .end = CH_UART1_TX+1,
  337. .flags = IORESOURCE_DMA,
  338. },
  339. };
  340. static struct platform_device bfin_sir1_device = {
  341. .name = "bfin_sir",
  342. .id = 1,
  343. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  344. .resource = bfin_sir1_resources,
  345. };
  346. #endif
  347. #endif
  348. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  349. static struct resource musb_resources[] = {
  350. [0] = {
  351. .start = 0xFFCC1000,
  352. .end = 0xFFCC1398,
  353. .flags = IORESOURCE_MEM,
  354. },
  355. [1] = { /* general IRQ */
  356. .start = IRQ_USB_STAT,
  357. .end = IRQ_USB_STAT,
  358. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  359. .name = "mc"
  360. },
  361. [2] = { /* DMA IRQ */
  362. .start = IRQ_USB_DMA,
  363. .end = IRQ_USB_DMA,
  364. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  365. .name = "dma"
  366. },
  367. };
  368. static struct musb_hdrc_config musb_config = {
  369. .multipoint = 1,
  370. .dyn_fifo = 0,
  371. .dma = 1,
  372. .num_eps = 16,
  373. .dma_channels = 8,
  374. .clkin = 48, /* musb CLKIN in MHZ */
  375. };
  376. static struct musb_hdrc_platform_data musb_plat = {
  377. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  378. .mode = MUSB_OTG,
  379. #elif defined(CONFIG_USB_MUSB_HDRC)
  380. .mode = MUSB_HOST,
  381. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  382. .mode = MUSB_PERIPHERAL,
  383. #endif
  384. .config = &musb_config,
  385. };
  386. static u64 musb_dmamask = ~(u32)0;
  387. static struct platform_device musb_device = {
  388. .name = "musb-blackfin",
  389. .id = 0,
  390. .dev = {
  391. .dma_mask = &musb_dmamask,
  392. .coherent_dma_mask = 0xffffffff,
  393. .platform_data = &musb_plat,
  394. },
  395. .num_resources = ARRAY_SIZE(musb_resources),
  396. .resource = musb_resources,
  397. };
  398. #endif
  399. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  400. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  401. static struct resource bfin_sport0_uart_resources[] = {
  402. {
  403. .start = SPORT0_TCR1,
  404. .end = SPORT0_MRCS3+4,
  405. .flags = IORESOURCE_MEM,
  406. },
  407. {
  408. .start = IRQ_SPORT0_RX,
  409. .end = IRQ_SPORT0_RX+1,
  410. .flags = IORESOURCE_IRQ,
  411. },
  412. {
  413. .start = IRQ_SPORT0_ERROR,
  414. .end = IRQ_SPORT0_ERROR,
  415. .flags = IORESOURCE_IRQ,
  416. },
  417. };
  418. static unsigned short bfin_sport0_peripherals[] = {
  419. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  420. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  421. };
  422. static struct platform_device bfin_sport0_uart_device = {
  423. .name = "bfin-sport-uart",
  424. .id = 0,
  425. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  426. .resource = bfin_sport0_uart_resources,
  427. .dev = {
  428. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  429. },
  430. };
  431. #endif
  432. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  433. static struct resource bfin_sport1_uart_resources[] = {
  434. {
  435. .start = SPORT1_TCR1,
  436. .end = SPORT1_MRCS3+4,
  437. .flags = IORESOURCE_MEM,
  438. },
  439. {
  440. .start = IRQ_SPORT1_RX,
  441. .end = IRQ_SPORT1_RX+1,
  442. .flags = IORESOURCE_IRQ,
  443. },
  444. {
  445. .start = IRQ_SPORT1_ERROR,
  446. .end = IRQ_SPORT1_ERROR,
  447. .flags = IORESOURCE_IRQ,
  448. },
  449. };
  450. static unsigned short bfin_sport1_peripherals[] = {
  451. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  452. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  453. };
  454. static struct platform_device bfin_sport1_uart_device = {
  455. .name = "bfin-sport-uart",
  456. .id = 1,
  457. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  458. .resource = bfin_sport1_uart_resources,
  459. .dev = {
  460. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  461. },
  462. };
  463. #endif
  464. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  465. static struct resource bfin_sport2_uart_resources[] = {
  466. {
  467. .start = SPORT2_TCR1,
  468. .end = SPORT2_MRCS3+4,
  469. .flags = IORESOURCE_MEM,
  470. },
  471. {
  472. .start = IRQ_SPORT2_RX,
  473. .end = IRQ_SPORT2_RX+1,
  474. .flags = IORESOURCE_IRQ,
  475. },
  476. {
  477. .start = IRQ_SPORT2_ERROR,
  478. .end = IRQ_SPORT2_ERROR,
  479. .flags = IORESOURCE_IRQ,
  480. },
  481. };
  482. static unsigned short bfin_sport2_peripherals[] = {
  483. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  484. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  485. };
  486. static struct platform_device bfin_sport2_uart_device = {
  487. .name = "bfin-sport-uart",
  488. .id = 2,
  489. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  490. .resource = bfin_sport2_uart_resources,
  491. .dev = {
  492. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  493. },
  494. };
  495. #endif
  496. #endif
  497. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  498. static unsigned short bfin_can0_peripherals[] = {
  499. P_CAN0_RX, P_CAN0_TX, 0
  500. };
  501. static struct resource bfin_can0_resources[] = {
  502. {
  503. .start = 0xFFC00A00,
  504. .end = 0xFFC00FFF,
  505. .flags = IORESOURCE_MEM,
  506. },
  507. {
  508. .start = IRQ_CAN0_RX,
  509. .end = IRQ_CAN0_RX,
  510. .flags = IORESOURCE_IRQ,
  511. },
  512. {
  513. .start = IRQ_CAN0_TX,
  514. .end = IRQ_CAN0_TX,
  515. .flags = IORESOURCE_IRQ,
  516. },
  517. {
  518. .start = IRQ_CAN0_STAT,
  519. .end = IRQ_CAN0_STAT,
  520. .flags = IORESOURCE_IRQ,
  521. },
  522. };
  523. static struct platform_device bfin_can0_device = {
  524. .name = "bfin_can",
  525. .id = 0,
  526. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  527. .resource = bfin_can0_resources,
  528. .dev = {
  529. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  530. },
  531. };
  532. #endif
  533. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  534. static struct mtd_partition partition_info[] = {
  535. {
  536. .name = "bootloader(nand)",
  537. .offset = 0,
  538. .size = 0x80000,
  539. }, {
  540. .name = "linux kernel(nand)",
  541. .offset = MTDPART_OFS_APPEND,
  542. .size = 4 * 1024 * 1024,
  543. },
  544. {
  545. .name = "file system(nand)",
  546. .offset = MTDPART_OFS_APPEND,
  547. .size = MTDPART_SIZ_FULL,
  548. },
  549. };
  550. static struct bf5xx_nand_platform bfin_nand_platform = {
  551. .data_width = NFC_NWIDTH_8,
  552. .partitions = partition_info,
  553. .nr_partitions = ARRAY_SIZE(partition_info),
  554. .rd_dly = 3,
  555. .wr_dly = 3,
  556. };
  557. static struct resource bfin_nand_resources[] = {
  558. {
  559. .start = 0xFFC03B00,
  560. .end = 0xFFC03B4F,
  561. .flags = IORESOURCE_MEM,
  562. },
  563. {
  564. .start = CH_NFC,
  565. .end = CH_NFC,
  566. .flags = IORESOURCE_IRQ,
  567. },
  568. };
  569. static struct platform_device bfin_nand_device = {
  570. .name = "bfin-nand",
  571. .id = 0,
  572. .num_resources = ARRAY_SIZE(bfin_nand_resources),
  573. .resource = bfin_nand_resources,
  574. .dev = {
  575. .platform_data = &bfin_nand_platform,
  576. },
  577. };
  578. #endif
  579. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  580. static struct bfin_sd_host bfin_sdh_data = {
  581. .dma_chan = CH_RSI,
  582. .irq_int0 = IRQ_RSI_INT0,
  583. .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
  584. };
  585. static struct platform_device bfin_sdh_device = {
  586. .name = "bfin-sdh",
  587. .id = 0,
  588. .dev = {
  589. .platform_data = &bfin_sdh_data,
  590. },
  591. };
  592. #endif
  593. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  594. static struct mtd_partition ezkit_partitions[] = {
  595. {
  596. .name = "bootloader(nor)",
  597. .size = 0x80000,
  598. .offset = 0,
  599. }, {
  600. .name = "linux kernel(nor)",
  601. .size = 0x400000,
  602. .offset = MTDPART_OFS_APPEND,
  603. }, {
  604. .name = "file system(nor)",
  605. .size = 0x1000000 - 0x80000 - 0x400000,
  606. .offset = MTDPART_OFS_APPEND,
  607. },
  608. };
  609. int bf609_nor_flash_init(struct platform_device *dev)
  610. {
  611. #define CONFIG_SMC_GCTL_VAL 0x00000010
  612. const unsigned short pins[] = {
  613. P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
  614. P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
  615. P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
  616. };
  617. peripheral_request_list(pins, "smc0");
  618. bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
  619. bfin_write32(SMC_B0CTL, 0x01002011);
  620. bfin_write32(SMC_B0TIM, 0x08170977);
  621. bfin_write32(SMC_B0ETIM, 0x00092231);
  622. return 0;
  623. }
  624. void bf609_nor_flash_exit(struct platform_device *dev)
  625. {
  626. const unsigned short pins[] = {
  627. P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
  628. P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
  629. P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
  630. };
  631. peripheral_free_list(pins);
  632. bfin_write32(SMC_GCTL, 0);
  633. }
  634. static struct physmap_flash_data ezkit_flash_data = {
  635. .width = 2,
  636. .parts = ezkit_partitions,
  637. .init = bf609_nor_flash_init,
  638. .exit = bf609_nor_flash_exit,
  639. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  640. #ifdef CONFIG_ROMKERNEL
  641. .probe_type = "map_rom",
  642. #endif
  643. };
  644. static struct resource ezkit_flash_resource = {
  645. .start = 0xb0000000,
  646. .end = 0xb0ffffff,
  647. .flags = IORESOURCE_MEM,
  648. };
  649. static struct platform_device ezkit_flash_device = {
  650. .name = "physmap-flash",
  651. .id = 0,
  652. .dev = {
  653. .platform_data = &ezkit_flash_data,
  654. },
  655. .num_resources = 1,
  656. .resource = &ezkit_flash_resource,
  657. };
  658. #endif
  659. #if defined(CONFIG_MTD_M25P80) \
  660. || defined(CONFIG_MTD_M25P80_MODULE)
  661. /* SPI flash chip (w25q32) */
  662. static struct mtd_partition bfin_spi_flash_partitions[] = {
  663. {
  664. .name = "bootloader(spi)",
  665. .size = 0x00080000,
  666. .offset = 0,
  667. .mask_flags = MTD_CAP_ROM
  668. }, {
  669. .name = "linux kernel(spi)",
  670. .size = 0x00180000,
  671. .offset = MTDPART_OFS_APPEND,
  672. }, {
  673. .name = "file system(spi)",
  674. .size = MTDPART_SIZ_FULL,
  675. .offset = MTDPART_OFS_APPEND,
  676. }
  677. };
  678. static struct flash_platform_data bfin_spi_flash_data = {
  679. .name = "m25p80",
  680. .parts = bfin_spi_flash_partitions,
  681. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  682. .type = "w25q32",
  683. };
  684. static struct bfin_spi3_chip spi_flash_chip_info = {
  685. .enable_dma = true, /* use dma transfer with this chip*/
  686. };
  687. #endif
  688. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  689. static struct bfin_spi3_chip spidev_chip_info = {
  690. .enable_dma = true,
  691. };
  692. #endif
  693. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  694. static struct platform_device bfin_i2s_pcm = {
  695. .name = "bfin-i2s-pcm-audio",
  696. .id = -1,
  697. };
  698. #endif
  699. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  700. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  701. #include <asm/bfin_sport3.h>
  702. static struct resource bfin_snd_resources[] = {
  703. {
  704. .start = SPORT0_CTL_A,
  705. .end = SPORT0_CTL_A,
  706. .flags = IORESOURCE_MEM,
  707. },
  708. {
  709. .start = SPORT0_CTL_B,
  710. .end = SPORT0_CTL_B,
  711. .flags = IORESOURCE_MEM,
  712. },
  713. {
  714. .start = CH_SPORT0_TX,
  715. .end = CH_SPORT0_TX,
  716. .flags = IORESOURCE_DMA,
  717. },
  718. {
  719. .start = CH_SPORT0_RX,
  720. .end = CH_SPORT0_RX,
  721. .flags = IORESOURCE_DMA,
  722. },
  723. {
  724. .start = IRQ_SPORT0_TX_STAT,
  725. .end = IRQ_SPORT0_TX_STAT,
  726. .flags = IORESOURCE_IRQ,
  727. },
  728. {
  729. .start = IRQ_SPORT0_RX_STAT,
  730. .end = IRQ_SPORT0_RX_STAT,
  731. .flags = IORESOURCE_IRQ,
  732. },
  733. };
  734. static const unsigned short bfin_snd_pin[] = {
  735. P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
  736. P_SPORT0_BFS, P_SPORT0_BD0, 0,
  737. };
  738. static struct bfin_snd_platform_data bfin_snd_data = {
  739. .pin_req = bfin_snd_pin,
  740. };
  741. static struct platform_device bfin_i2s = {
  742. .name = "bfin-i2s",
  743. .num_resources = ARRAY_SIZE(bfin_snd_resources),
  744. .resource = bfin_snd_resources,
  745. .dev = {
  746. .platform_data = &bfin_snd_data,
  747. },
  748. };
  749. #endif
  750. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
  751. || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  752. static const char * const ad1836_link[] = {
  753. "bfin-i2s.0",
  754. "spi0.76",
  755. };
  756. static struct platform_device bfin_ad1836_machine = {
  757. .name = "bfin-snd-ad1836",
  758. .id = -1,
  759. .dev = {
  760. .platform_data = (void *)ad1836_link,
  761. },
  762. };
  763. #endif
  764. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  765. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  766. static struct platform_device adau1761_device = {
  767. .name = "bfin-eval-adau1x61",
  768. };
  769. #endif
  770. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  771. #include <sound/adau17x1.h>
  772. static struct adau1761_platform_data adau1761_info = {
  773. .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
  774. .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
  775. };
  776. #endif
  777. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  778. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  779. #include <linux/videodev2.h>
  780. #include <media/blackfin/bfin_capture.h>
  781. #include <media/blackfin/ppi.h>
  782. static const unsigned short ppi_req[] = {
  783. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  784. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  785. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  786. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  787. #if !defined(CONFIG_VIDEO_VS6624) && !defined(CONFIG_VIDEO_VS6624_MODULE)
  788. P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
  789. P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
  790. #endif
  791. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  792. 0,
  793. };
  794. static const struct ppi_info ppi_info = {
  795. .type = PPI_TYPE_EPPI3,
  796. .dma_ch = CH_EPPI0_CH0,
  797. .irq_err = IRQ_EPPI0_STAT,
  798. .base = (void __iomem *)EPPI0_STAT,
  799. .pin_req = ppi_req,
  800. };
  801. #if defined(CONFIG_VIDEO_VS6624) \
  802. || defined(CONFIG_VIDEO_VS6624_MODULE)
  803. static struct v4l2_input vs6624_inputs[] = {
  804. {
  805. .index = 0,
  806. .name = "Camera",
  807. .type = V4L2_INPUT_TYPE_CAMERA,
  808. .std = V4L2_STD_UNKNOWN,
  809. },
  810. };
  811. static struct bcap_route vs6624_routes[] = {
  812. {
  813. .input = 0,
  814. .output = 0,
  815. },
  816. };
  817. static const unsigned vs6624_ce_pin = GPIO_PE4;
  818. static struct bfin_capture_config bfin_capture_data = {
  819. .card_name = "BF609",
  820. .inputs = vs6624_inputs,
  821. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  822. .routes = vs6624_routes,
  823. .i2c_adapter_id = 0,
  824. .board_info = {
  825. .type = "vs6624",
  826. .addr = 0x10,
  827. .platform_data = (void *)&vs6624_ce_pin,
  828. },
  829. .ppi_info = &ppi_info,
  830. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
  831. | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  832. .blank_pixels = 4,
  833. };
  834. #endif
  835. #if defined(CONFIG_VIDEO_ADV7842) \
  836. || defined(CONFIG_VIDEO_ADV7842_MODULE)
  837. #include <media/adv7842.h>
  838. static struct v4l2_input adv7842_inputs[] = {
  839. {
  840. .index = 0,
  841. .name = "Composite",
  842. .type = V4L2_INPUT_TYPE_CAMERA,
  843. .std = V4L2_STD_ALL,
  844. .capabilities = V4L2_IN_CAP_STD,
  845. },
  846. {
  847. .index = 1,
  848. .name = "S-Video",
  849. .type = V4L2_INPUT_TYPE_CAMERA,
  850. .std = V4L2_STD_ALL,
  851. .capabilities = V4L2_IN_CAP_STD,
  852. },
  853. {
  854. .index = 2,
  855. .name = "Component",
  856. .type = V4L2_INPUT_TYPE_CAMERA,
  857. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  858. },
  859. {
  860. .index = 3,
  861. .name = "VGA",
  862. .type = V4L2_INPUT_TYPE_CAMERA,
  863. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  864. },
  865. {
  866. .index = 4,
  867. .name = "HDMI",
  868. .type = V4L2_INPUT_TYPE_CAMERA,
  869. .capabilities = V4L2_IN_CAP_DV_TIMINGS,
  870. },
  871. };
  872. static struct bcap_route adv7842_routes[] = {
  873. {
  874. .input = 3,
  875. .output = 0,
  876. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  877. | EPPI_CTL_ACTIVE656),
  878. },
  879. {
  880. .input = 4,
  881. .output = 0,
  882. },
  883. {
  884. .input = 2,
  885. .output = 0,
  886. },
  887. {
  888. .input = 1,
  889. .output = 0,
  890. },
  891. {
  892. .input = 0,
  893. .output = 1,
  894. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  895. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC2
  896. | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  897. },
  898. };
  899. static struct adv7842_output_format adv7842_opf[] = {
  900. {
  901. .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
  902. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
  903. .op_656_range = 1,
  904. .blank_data = 1,
  905. .insert_av_codes = 1,
  906. },
  907. {
  908. .op_ch_sel = ADV7842_OP_CH_SEL_RGB,
  909. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_16,
  910. .op_656_range = 1,
  911. .blank_data = 1,
  912. },
  913. };
  914. static struct adv7842_platform_data adv7842_data = {
  915. .opf = adv7842_opf,
  916. .num_opf = ARRAY_SIZE(adv7842_opf),
  917. .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
  918. .prim_mode = ADV7842_PRIM_MODE_SDP,
  919. .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
  920. .inp_color_space = ADV7842_INP_COLOR_SPACE_AUTO,
  921. .i2c_sdp_io = 0x40,
  922. .i2c_sdp = 0x41,
  923. .i2c_cp = 0x42,
  924. .i2c_vdp = 0x43,
  925. .i2c_afe = 0x44,
  926. .i2c_hdmi = 0x45,
  927. .i2c_repeater = 0x46,
  928. .i2c_edid = 0x47,
  929. .i2c_infoframe = 0x48,
  930. .i2c_cec = 0x49,
  931. .i2c_avlink = 0x4a,
  932. .i2c_ex = 0x26,
  933. };
  934. static struct bfin_capture_config bfin_capture_data = {
  935. .card_name = "BF609",
  936. .inputs = adv7842_inputs,
  937. .num_inputs = ARRAY_SIZE(adv7842_inputs),
  938. .routes = adv7842_routes,
  939. .i2c_adapter_id = 0,
  940. .board_info = {
  941. .type = "adv7842",
  942. .addr = 0x20,
  943. .platform_data = (void *)&adv7842_data,
  944. },
  945. .ppi_info = &ppi_info,
  946. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  947. | EPPI_CTL_ACTIVE656),
  948. };
  949. #endif
  950. static struct platform_device bfin_capture_device = {
  951. .name = "bfin_capture",
  952. .dev = {
  953. .platform_data = &bfin_capture_data,
  954. },
  955. };
  956. #endif
  957. #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
  958. || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
  959. #include <linux/videodev2.h>
  960. #include <media/blackfin/bfin_display.h>
  961. #include <media/blackfin/ppi.h>
  962. static const unsigned short ppi_req_disp[] = {
  963. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  964. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  965. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  966. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  967. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  968. 0,
  969. };
  970. static const struct ppi_info ppi_info = {
  971. .type = PPI_TYPE_EPPI3,
  972. .dma_ch = CH_EPPI0_CH0,
  973. .irq_err = IRQ_EPPI0_STAT,
  974. .base = (void __iomem *)EPPI0_STAT,
  975. .pin_req = ppi_req_disp,
  976. };
  977. #if defined(CONFIG_VIDEO_ADV7511) \
  978. || defined(CONFIG_VIDEO_ADV7511_MODULE)
  979. #include <media/adv7511.h>
  980. static struct v4l2_output adv7511_outputs[] = {
  981. {
  982. .index = 0,
  983. .name = "HDMI",
  984. .type = V4L2_INPUT_TYPE_CAMERA,
  985. .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
  986. },
  987. };
  988. static struct disp_route adv7511_routes[] = {
  989. {
  990. .output = 0,
  991. },
  992. };
  993. static struct adv7511_platform_data adv7511_data = {
  994. .edid_addr = 0x7e,
  995. .i2c_ex = 0x25,
  996. };
  997. static struct bfin_display_config bfin_display_data = {
  998. .card_name = "BF609",
  999. .outputs = adv7511_outputs,
  1000. .num_outputs = ARRAY_SIZE(adv7511_outputs),
  1001. .routes = adv7511_routes,
  1002. .i2c_adapter_id = 0,
  1003. .board_info = {
  1004. .type = "adv7511",
  1005. .addr = 0x39,
  1006. .platform_data = (void *)&adv7511_data,
  1007. },
  1008. .ppi_info = &ppi_info,
  1009. .ppi_control = (EPPI_CTL_SPLTWRD | PACK_EN | DLEN_16
  1010. | EPPI_CTL_FS1LO_FS2LO | EPPI_CTL_POLC3
  1011. | EPPI_CTL_IFSGEN | EPPI_CTL_SYNC2
  1012. | EPPI_CTL_NON656 | EPPI_CTL_DIR),
  1013. };
  1014. #endif
  1015. static struct platform_device bfin_display_device = {
  1016. .name = "bfin_display",
  1017. .dev = {
  1018. .platform_data = &bfin_display_data,
  1019. },
  1020. };
  1021. #endif
  1022. #if defined(CONFIG_BFIN_CRC)
  1023. #define BFIN_CRC_NAME "bfin-crc"
  1024. static struct resource bfin_crc0_resources[] = {
  1025. {
  1026. .start = REG_CRC0_CTL,
  1027. .end = REG_CRC0_REVID+4,
  1028. .flags = IORESOURCE_MEM,
  1029. },
  1030. {
  1031. .start = IRQ_CRC0_DCNTEXP,
  1032. .end = IRQ_CRC0_DCNTEXP,
  1033. .flags = IORESOURCE_IRQ,
  1034. },
  1035. {
  1036. .start = CH_MEM_STREAM0_SRC_CRC0,
  1037. .end = CH_MEM_STREAM0_SRC_CRC0,
  1038. .flags = IORESOURCE_DMA,
  1039. },
  1040. {
  1041. .start = CH_MEM_STREAM0_DEST_CRC0,
  1042. .end = CH_MEM_STREAM0_DEST_CRC0,
  1043. .flags = IORESOURCE_DMA,
  1044. },
  1045. };
  1046. static struct platform_device bfin_crc0_device = {
  1047. .name = BFIN_CRC_NAME,
  1048. .id = 0,
  1049. .num_resources = ARRAY_SIZE(bfin_crc0_resources),
  1050. .resource = bfin_crc0_resources,
  1051. };
  1052. static struct resource bfin_crc1_resources[] = {
  1053. {
  1054. .start = REG_CRC1_CTL,
  1055. .end = REG_CRC1_REVID+4,
  1056. .flags = IORESOURCE_MEM,
  1057. },
  1058. {
  1059. .start = IRQ_CRC1_DCNTEXP,
  1060. .end = IRQ_CRC1_DCNTEXP,
  1061. .flags = IORESOURCE_IRQ,
  1062. },
  1063. {
  1064. .start = CH_MEM_STREAM1_SRC_CRC1,
  1065. .end = CH_MEM_STREAM1_SRC_CRC1,
  1066. .flags = IORESOURCE_DMA,
  1067. },
  1068. {
  1069. .start = CH_MEM_STREAM1_DEST_CRC1,
  1070. .end = CH_MEM_STREAM1_DEST_CRC1,
  1071. .flags = IORESOURCE_DMA,
  1072. },
  1073. };
  1074. static struct platform_device bfin_crc1_device = {
  1075. .name = BFIN_CRC_NAME,
  1076. .id = 1,
  1077. .num_resources = ARRAY_SIZE(bfin_crc1_resources),
  1078. .resource = bfin_crc1_resources,
  1079. };
  1080. #endif
  1081. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1082. #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
  1083. #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
  1084. static struct resource bfin_crypto_crc_resources[] = {
  1085. {
  1086. .start = REG_CRC0_CTL,
  1087. .end = REG_CRC0_REVID+4,
  1088. .flags = IORESOURCE_MEM,
  1089. },
  1090. {
  1091. .start = IRQ_CRC0_DCNTEXP,
  1092. .end = IRQ_CRC0_DCNTEXP,
  1093. .flags = IORESOURCE_IRQ,
  1094. },
  1095. {
  1096. .start = CH_MEM_STREAM0_SRC_CRC0,
  1097. .end = CH_MEM_STREAM0_SRC_CRC0,
  1098. .flags = IORESOURCE_DMA,
  1099. },
  1100. };
  1101. static struct platform_device bfin_crypto_crc_device = {
  1102. .name = BFIN_CRYPTO_CRC_NAME,
  1103. .id = 0,
  1104. .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
  1105. .resource = bfin_crypto_crc_resources,
  1106. .dev = {
  1107. .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
  1108. },
  1109. };
  1110. #endif
  1111. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1112. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1113. .model = 7877,
  1114. .vref_delay_usecs = 50, /* internal, no capacitor */
  1115. .x_plate_ohms = 419,
  1116. .y_plate_ohms = 486,
  1117. .pressure_max = 1000,
  1118. .pressure_min = 0,
  1119. .stopacq_polarity = 1,
  1120. .first_conversion_delay = 3,
  1121. .acquisition_time = 1,
  1122. .averaging = 1,
  1123. .pen_down_acc_interval = 1,
  1124. };
  1125. #endif
  1126. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1127. #include <linux/input.h>
  1128. #include <linux/gpio_keys.h>
  1129. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1130. {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
  1131. {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
  1132. };
  1133. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1134. .buttons = bfin_gpio_keys_table,
  1135. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1136. };
  1137. static struct platform_device bfin_device_gpiokeys = {
  1138. .name = "gpio-keys",
  1139. .dev = {
  1140. .platform_data = &bfin_gpio_keys_data,
  1141. },
  1142. };
  1143. #endif
  1144. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1145. #if defined(CONFIG_MTD_M25P80) \
  1146. || defined(CONFIG_MTD_M25P80_MODULE)
  1147. {
  1148. /* the modalias must be the same as spi device driver name */
  1149. .modalias = "m25p80", /* Name of spi_driver for this device */
  1150. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1151. .bus_num = 0, /* Framework bus number */
  1152. .chip_select = 1, /* SPI_SSEL1*/
  1153. .platform_data = &bfin_spi_flash_data,
  1154. .controller_data = &spi_flash_chip_info,
  1155. .mode = SPI_MODE_3,
  1156. },
  1157. #endif
  1158. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1159. {
  1160. .modalias = "ad7877",
  1161. .platform_data = &bfin_ad7877_ts_info,
  1162. .irq = IRQ_PD9,
  1163. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1164. .bus_num = 0,
  1165. .chip_select = 4,
  1166. },
  1167. #endif
  1168. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  1169. {
  1170. .modalias = "spidev",
  1171. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1172. .bus_num = 0,
  1173. .chip_select = 1,
  1174. .controller_data = &spidev_chip_info,
  1175. },
  1176. #endif
  1177. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  1178. {
  1179. .modalias = "adxl34x",
  1180. .platform_data = &adxl34x_info,
  1181. .irq = IRQ_PC5,
  1182. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1183. .bus_num = 1,
  1184. .chip_select = 2,
  1185. .mode = SPI_MODE_3,
  1186. },
  1187. #endif
  1188. };
  1189. #if IS_ENABLED(CONFIG_SPI_BFIN_V3)
  1190. /* SPI (0) */
  1191. static struct resource bfin_spi0_resource[] = {
  1192. {
  1193. .start = SPI0_REGBASE,
  1194. .end = SPI0_REGBASE + 0xFF,
  1195. .flags = IORESOURCE_MEM,
  1196. },
  1197. {
  1198. .start = CH_SPI0_TX,
  1199. .end = CH_SPI0_TX,
  1200. .flags = IORESOURCE_DMA,
  1201. },
  1202. {
  1203. .start = CH_SPI0_RX,
  1204. .end = CH_SPI0_RX,
  1205. .flags = IORESOURCE_DMA,
  1206. },
  1207. };
  1208. /* SPI (1) */
  1209. static struct resource bfin_spi1_resource[] = {
  1210. {
  1211. .start = SPI1_REGBASE,
  1212. .end = SPI1_REGBASE + 0xFF,
  1213. .flags = IORESOURCE_MEM,
  1214. },
  1215. {
  1216. .start = CH_SPI1_TX,
  1217. .end = CH_SPI1_TX,
  1218. .flags = IORESOURCE_DMA,
  1219. },
  1220. {
  1221. .start = CH_SPI1_RX,
  1222. .end = CH_SPI1_RX,
  1223. .flags = IORESOURCE_DMA,
  1224. },
  1225. };
  1226. /* SPI controller data */
  1227. static struct bfin_spi3_master bf60x_spi_master_info0 = {
  1228. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1229. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1230. };
  1231. static struct platform_device bf60x_spi_master0 = {
  1232. .name = "bfin-spi3",
  1233. .id = 0, /* Bus number */
  1234. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1235. .resource = bfin_spi0_resource,
  1236. .dev = {
  1237. .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
  1238. },
  1239. };
  1240. static struct bfin_spi3_master bf60x_spi_master_info1 = {
  1241. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1242. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1243. };
  1244. static struct platform_device bf60x_spi_master1 = {
  1245. .name = "bfin-spi3",
  1246. .id = 1, /* Bus number */
  1247. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1248. .resource = bfin_spi1_resource,
  1249. .dev = {
  1250. .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
  1251. },
  1252. };
  1253. #endif /* spi master and devices */
  1254. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1255. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1256. static struct resource bfin_twi0_resource[] = {
  1257. [0] = {
  1258. .start = TWI0_CLKDIV,
  1259. .end = TWI0_CLKDIV + 0xFF,
  1260. .flags = IORESOURCE_MEM,
  1261. },
  1262. [1] = {
  1263. .start = IRQ_TWI0,
  1264. .end = IRQ_TWI0,
  1265. .flags = IORESOURCE_IRQ,
  1266. },
  1267. };
  1268. static struct platform_device i2c_bfin_twi0_device = {
  1269. .name = "i2c-bfin-twi",
  1270. .id = 0,
  1271. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1272. .resource = bfin_twi0_resource,
  1273. .dev = {
  1274. .platform_data = &bfin_twi0_pins,
  1275. },
  1276. };
  1277. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1278. static struct resource bfin_twi1_resource[] = {
  1279. [0] = {
  1280. .start = TWI1_CLKDIV,
  1281. .end = TWI1_CLKDIV + 0xFF,
  1282. .flags = IORESOURCE_MEM,
  1283. },
  1284. [1] = {
  1285. .start = IRQ_TWI1,
  1286. .end = IRQ_TWI1,
  1287. .flags = IORESOURCE_IRQ,
  1288. },
  1289. };
  1290. static struct platform_device i2c_bfin_twi1_device = {
  1291. .name = "i2c-bfin-twi",
  1292. .id = 1,
  1293. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1294. .resource = bfin_twi1_resource,
  1295. .dev = {
  1296. .platform_data = &bfin_twi1_pins,
  1297. },
  1298. };
  1299. #endif
  1300. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1301. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1302. {
  1303. I2C_BOARD_INFO("adxl34x", 0x53),
  1304. .irq = IRQ_PC5,
  1305. .platform_data = (void *)&adxl34x_info,
  1306. },
  1307. #endif
  1308. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  1309. {
  1310. I2C_BOARD_INFO("adau1761", 0x38),
  1311. .platform_data = (void *)&adau1761_info
  1312. },
  1313. #endif
  1314. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  1315. {
  1316. I2C_BOARD_INFO("ssm2602", 0x1b),
  1317. },
  1318. #endif
  1319. };
  1320. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1321. };
  1322. static const unsigned int cclk_vlev_datasheet[] =
  1323. {
  1324. /*
  1325. * Internal VLEV BF54XSBBC1533
  1326. ****temporarily using these values until data sheet is updated
  1327. */
  1328. VRPAIR(VLEV_085, 150000000),
  1329. VRPAIR(VLEV_090, 250000000),
  1330. VRPAIR(VLEV_110, 276000000),
  1331. VRPAIR(VLEV_115, 301000000),
  1332. VRPAIR(VLEV_120, 525000000),
  1333. VRPAIR(VLEV_125, 550000000),
  1334. VRPAIR(VLEV_130, 600000000),
  1335. };
  1336. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1337. .tuple_tab = cclk_vlev_datasheet,
  1338. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1339. .vr_settling_time = 25 /* us */,
  1340. };
  1341. static struct platform_device bfin_dpmc = {
  1342. .name = "bfin dpmc",
  1343. .dev = {
  1344. .platform_data = &bfin_dmpc_vreg_data,
  1345. },
  1346. };
  1347. static struct platform_device *ezkit_devices[] __initdata = {
  1348. &bfin_dpmc,
  1349. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1350. &rtc_device,
  1351. #endif
  1352. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1353. #ifdef CONFIG_SERIAL_BFIN_UART0
  1354. &bfin_uart0_device,
  1355. #endif
  1356. #ifdef CONFIG_SERIAL_BFIN_UART1
  1357. &bfin_uart1_device,
  1358. #endif
  1359. #endif
  1360. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1361. #ifdef CONFIG_BFIN_SIR0
  1362. &bfin_sir0_device,
  1363. #endif
  1364. #ifdef CONFIG_BFIN_SIR1
  1365. &bfin_sir1_device,
  1366. #endif
  1367. #endif
  1368. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1369. &bfin_eth_device,
  1370. #endif
  1371. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1372. &musb_device,
  1373. #endif
  1374. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1375. &bfin_isp1760_device,
  1376. #endif
  1377. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1378. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1379. &bfin_sport0_uart_device,
  1380. #endif
  1381. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1382. &bfin_sport1_uart_device,
  1383. #endif
  1384. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1385. &bfin_sport2_uart_device,
  1386. #endif
  1387. #endif
  1388. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1389. &bfin_can0_device,
  1390. #endif
  1391. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1392. &bfin_nand_device,
  1393. #endif
  1394. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1395. &bfin_sdh_device,
  1396. #endif
  1397. #if IS_ENABLED(CONFIG_SPI_BFIN_V3)
  1398. &bf60x_spi_master0,
  1399. &bf60x_spi_master1,
  1400. #endif
  1401. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1402. &bfin_rotary_device,
  1403. #endif
  1404. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1405. &i2c_bfin_twi0_device,
  1406. #if !defined(CONFIG_BF542)
  1407. &i2c_bfin_twi1_device,
  1408. #endif
  1409. #endif
  1410. #if defined(CONFIG_BFIN_CRC)
  1411. &bfin_crc0_device,
  1412. &bfin_crc1_device,
  1413. #endif
  1414. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1415. &bfin_crypto_crc_device,
  1416. #endif
  1417. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1418. &bfin_device_gpiokeys,
  1419. #endif
  1420. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1421. &ezkit_flash_device,
  1422. #endif
  1423. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1424. &bfin_i2s_pcm,
  1425. #endif
  1426. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  1427. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  1428. &bfin_i2s,
  1429. #endif
  1430. #if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \
  1431. defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
  1432. &bfin_ad1836_machine,
  1433. #endif
  1434. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  1435. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  1436. &adau1761_device,
  1437. #endif
  1438. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  1439. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  1440. &bfin_capture_device,
  1441. #endif
  1442. #if defined(CONFIG_VIDEO_BLACKFIN_DISPLAY) \
  1443. || defined(CONFIG_VIDEO_BLACKFIN_DISPLAY_MODULE)
  1444. &bfin_display_device,
  1445. #endif
  1446. };
  1447. static int __init ezkit_init(void)
  1448. {
  1449. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1450. i2c_register_board_info(0, bfin_i2c_board_info0,
  1451. ARRAY_SIZE(bfin_i2c_board_info0));
  1452. i2c_register_board_info(1, bfin_i2c_board_info1,
  1453. ARRAY_SIZE(bfin_i2c_board_info1));
  1454. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1455. if (!peripheral_request_list(pins, "emac0"))
  1456. printk(KERN_ERR "%s(): request emac pins failed\n", __func__);
  1457. #endif
  1458. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1459. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1460. return 0;
  1461. }
  1462. arch_initcall(ezkit_init);
  1463. static struct platform_device *ezkit_early_devices[] __initdata = {
  1464. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1465. #ifdef CONFIG_SERIAL_BFIN_UART0
  1466. &bfin_uart0_device,
  1467. #endif
  1468. #ifdef CONFIG_SERIAL_BFIN_UART1
  1469. &bfin_uart1_device,
  1470. #endif
  1471. #endif
  1472. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1473. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1474. &bfin_sport0_uart_device,
  1475. #endif
  1476. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1477. &bfin_sport1_uart_device,
  1478. #endif
  1479. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1480. &bfin_sport2_uart_device,
  1481. #endif
  1482. #endif
  1483. };
  1484. void __init native_machine_early_platform_add_devices(void)
  1485. {
  1486. printk(KERN_INFO "register early platform devices\n");
  1487. early_platform_add_devices(ezkit_early_devices,
  1488. ARRAY_SIZE(ezkit_early_devices));
  1489. }