uec_phy.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. /*
  2. * Copyright (C) 2005 Freescale Semiconductor, Inc.
  3. *
  4. * Author: Shlomi Gridish
  5. *
  6. * Description: UCC GETH Driver -- PHY handling
  7. * Driver for UEC on QE
  8. * Based on 8260_io/fcc_enet.c
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. */
  16. #include "common.h"
  17. #include "net.h"
  18. #include "malloc.h"
  19. #include "asm/errno.h"
  20. #include "asm/immap_qe.h"
  21. #include "asm/io.h"
  22. #include "qe.h"
  23. #include "uccf.h"
  24. #include "uec.h"
  25. #include "uec_phy.h"
  26. #include "miiphy.h"
  27. #if defined(CONFIG_QE)
  28. #define ugphy_printk(format, arg...) \
  29. printf(format "\n", ## arg)
  30. #define ugphy_dbg(format, arg...) \
  31. ugphy_printk(format , ## arg)
  32. #define ugphy_err(format, arg...) \
  33. ugphy_printk(format , ## arg)
  34. #define ugphy_info(format, arg...) \
  35. ugphy_printk(format , ## arg)
  36. #define ugphy_warn(format, arg...) \
  37. ugphy_printk(format , ## arg)
  38. #ifdef UEC_VERBOSE_DEBUG
  39. #define ugphy_vdbg ugphy_dbg
  40. #else
  41. #define ugphy_vdbg(ugeth, fmt, args...) do { } while (0)
  42. #endif /* UEC_VERBOSE_DEBUG */
  43. static void config_genmii_advert (struct uec_mii_info *mii_info);
  44. static void genmii_setup_forced (struct uec_mii_info *mii_info);
  45. static void genmii_restart_aneg (struct uec_mii_info *mii_info);
  46. static int gbit_config_aneg (struct uec_mii_info *mii_info);
  47. static int genmii_config_aneg (struct uec_mii_info *mii_info);
  48. static int genmii_update_link (struct uec_mii_info *mii_info);
  49. static int genmii_read_status (struct uec_mii_info *mii_info);
  50. u16 phy_read (struct uec_mii_info *mii_info, u16 regnum);
  51. void phy_write (struct uec_mii_info *mii_info, u16 regnum, u16 val);
  52. /* Write value to the PHY for this device to the register at regnum, */
  53. /* waiting until the write is done before it returns. All PHY */
  54. /* configuration has to be done through the TSEC1 MIIM regs */
  55. void uec_write_phy_reg (struct eth_device *dev, int mii_id, int regnum, int value)
  56. {
  57. uec_private_t *ugeth = (uec_private_t *) dev->priv;
  58. uec_mii_t *ug_regs;
  59. enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum;
  60. u32 tmp_reg;
  61. ug_regs = ugeth->uec_mii_regs;
  62. /* Stop the MII management read cycle */
  63. out_be32 (&ug_regs->miimcom, 0);
  64. /* Setting up the MII Mangement Address Register */
  65. tmp_reg = ((u32) mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | mii_reg;
  66. out_be32 (&ug_regs->miimadd, tmp_reg);
  67. /* Setting up the MII Mangement Control Register with the value */
  68. out_be32 (&ug_regs->miimcon, (u32) value);
  69. sync();
  70. /* Wait till MII management write is complete */
  71. while ((in_be32 (&ug_regs->miimind)) & MIIMIND_BUSY);
  72. }
  73. /* Reads from register regnum in the PHY for device dev, */
  74. /* returning the value. Clears miimcom first. All PHY */
  75. /* configuration has to be done through the TSEC1 MIIM regs */
  76. int uec_read_phy_reg (struct eth_device *dev, int mii_id, int regnum)
  77. {
  78. uec_private_t *ugeth = (uec_private_t *) dev->priv;
  79. uec_mii_t *ug_regs;
  80. enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum;
  81. u32 tmp_reg;
  82. u16 value;
  83. ug_regs = ugeth->uec_mii_regs;
  84. /* Setting up the MII Mangement Address Register */
  85. tmp_reg = ((u32) mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | mii_reg;
  86. out_be32 (&ug_regs->miimadd, tmp_reg);
  87. /* clear MII management command cycle */
  88. out_be32 (&ug_regs->miimcom, 0);
  89. sync();
  90. /* Perform an MII management read cycle */
  91. out_be32 (&ug_regs->miimcom, MIIMCOM_READ_CYCLE);
  92. /* Wait till MII management write is complete */
  93. while ((in_be32 (&ug_regs->miimind)) &
  94. (MIIMIND_NOT_VALID | MIIMIND_BUSY));
  95. /* Read MII management status */
  96. value = (u16) in_be32 (&ug_regs->miimstat);
  97. if (value == 0xffff)
  98. ugphy_vdbg
  99. ("read wrong value : mii_id %d,mii_reg %d, base %08x",
  100. mii_id, mii_reg, (u32) & (ug_regs->miimcfg));
  101. return (value);
  102. }
  103. void mii_clear_phy_interrupt (struct uec_mii_info *mii_info)
  104. {
  105. if (mii_info->phyinfo->ack_interrupt)
  106. mii_info->phyinfo->ack_interrupt (mii_info);
  107. }
  108. void mii_configure_phy_interrupt (struct uec_mii_info *mii_info,
  109. u32 interrupts)
  110. {
  111. mii_info->interrupts = interrupts;
  112. if (mii_info->phyinfo->config_intr)
  113. mii_info->phyinfo->config_intr (mii_info);
  114. }
  115. /* Writes MII_ADVERTISE with the appropriate values, after
  116. * sanitizing advertise to make sure only supported features
  117. * are advertised
  118. */
  119. static void config_genmii_advert (struct uec_mii_info *mii_info)
  120. {
  121. u32 advertise;
  122. u16 adv;
  123. /* Only allow advertising what this PHY supports */
  124. mii_info->advertising &= mii_info->phyinfo->features;
  125. advertise = mii_info->advertising;
  126. /* Setup standard advertisement */
  127. adv = phy_read (mii_info, PHY_ANAR);
  128. adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
  129. if (advertise & ADVERTISED_10baseT_Half)
  130. adv |= ADVERTISE_10HALF;
  131. if (advertise & ADVERTISED_10baseT_Full)
  132. adv |= ADVERTISE_10FULL;
  133. if (advertise & ADVERTISED_100baseT_Half)
  134. adv |= ADVERTISE_100HALF;
  135. if (advertise & ADVERTISED_100baseT_Full)
  136. adv |= ADVERTISE_100FULL;
  137. phy_write (mii_info, PHY_ANAR, adv);
  138. }
  139. static void genmii_setup_forced (struct uec_mii_info *mii_info)
  140. {
  141. u16 ctrl;
  142. u32 features = mii_info->phyinfo->features;
  143. ctrl = phy_read (mii_info, PHY_BMCR);
  144. ctrl &= ~(PHY_BMCR_DPLX | PHY_BMCR_100_MBPS |
  145. PHY_BMCR_1000_MBPS | PHY_BMCR_AUTON);
  146. ctrl |= PHY_BMCR_RESET;
  147. switch (mii_info->speed) {
  148. case SPEED_1000:
  149. if (features & (SUPPORTED_1000baseT_Half
  150. | SUPPORTED_1000baseT_Full)) {
  151. ctrl |= PHY_BMCR_1000_MBPS;
  152. break;
  153. }
  154. mii_info->speed = SPEED_100;
  155. case SPEED_100:
  156. if (features & (SUPPORTED_100baseT_Half
  157. | SUPPORTED_100baseT_Full)) {
  158. ctrl |= PHY_BMCR_100_MBPS;
  159. break;
  160. }
  161. mii_info->speed = SPEED_10;
  162. case SPEED_10:
  163. if (features & (SUPPORTED_10baseT_Half
  164. | SUPPORTED_10baseT_Full))
  165. break;
  166. default: /* Unsupported speed! */
  167. ugphy_err ("%s: Bad speed!", mii_info->dev->name);
  168. break;
  169. }
  170. phy_write (mii_info, PHY_BMCR, ctrl);
  171. }
  172. /* Enable and Restart Autonegotiation */
  173. static void genmii_restart_aneg (struct uec_mii_info *mii_info)
  174. {
  175. u16 ctl;
  176. ctl = phy_read (mii_info, PHY_BMCR);
  177. ctl |= (PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
  178. phy_write (mii_info, PHY_BMCR, ctl);
  179. }
  180. static int gbit_config_aneg (struct uec_mii_info *mii_info)
  181. {
  182. u16 adv;
  183. u32 advertise;
  184. if (mii_info->autoneg) {
  185. /* Configure the ADVERTISE register */
  186. config_genmii_advert (mii_info);
  187. advertise = mii_info->advertising;
  188. adv = phy_read (mii_info, MII_1000BASETCONTROL);
  189. adv &= ~(MII_1000BASETCONTROL_FULLDUPLEXCAP |
  190. MII_1000BASETCONTROL_HALFDUPLEXCAP);
  191. if (advertise & SUPPORTED_1000baseT_Half)
  192. adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
  193. if (advertise & SUPPORTED_1000baseT_Full)
  194. adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
  195. phy_write (mii_info, MII_1000BASETCONTROL, adv);
  196. /* Start/Restart aneg */
  197. genmii_restart_aneg (mii_info);
  198. } else
  199. genmii_setup_forced (mii_info);
  200. return 0;
  201. }
  202. static int marvell_config_aneg (struct uec_mii_info *mii_info)
  203. {
  204. /* The Marvell PHY has an errata which requires
  205. * that certain registers get written in order
  206. * to restart autonegotiation */
  207. phy_write (mii_info, PHY_BMCR, PHY_BMCR_RESET);
  208. phy_write (mii_info, 0x1d, 0x1f);
  209. phy_write (mii_info, 0x1e, 0x200c);
  210. phy_write (mii_info, 0x1d, 0x5);
  211. phy_write (mii_info, 0x1e, 0);
  212. phy_write (mii_info, 0x1e, 0x100);
  213. gbit_config_aneg (mii_info);
  214. return 0;
  215. }
  216. static int genmii_config_aneg (struct uec_mii_info *mii_info)
  217. {
  218. if (mii_info->autoneg) {
  219. config_genmii_advert (mii_info);
  220. genmii_restart_aneg (mii_info);
  221. } else
  222. genmii_setup_forced (mii_info);
  223. return 0;
  224. }
  225. static int genmii_update_link (struct uec_mii_info *mii_info)
  226. {
  227. u16 status;
  228. /* Status is read once to clear old link state */
  229. phy_read (mii_info, PHY_BMSR);
  230. /*
  231. * Wait if the link is up, and autonegotiation is in progress
  232. * (ie - we're capable and it's not done)
  233. */
  234. status = phy_read(mii_info, PHY_BMSR);
  235. if ((status & PHY_BMSR_LS) && (status & PHY_BMSR_AUTN_ABLE)
  236. && !(status & PHY_BMSR_AUTN_COMP)) {
  237. int i = 0;
  238. while (!(status & PHY_BMSR_AUTN_COMP)) {
  239. /*
  240. * Timeout reached ?
  241. */
  242. if (i > UGETH_AN_TIMEOUT) {
  243. mii_info->link = 0;
  244. return 0;
  245. }
  246. udelay(1000); /* 1 ms */
  247. status = phy_read(mii_info, PHY_BMSR);
  248. }
  249. mii_info->link = 1;
  250. udelay(500000); /* another 500 ms (results in faster booting) */
  251. } else {
  252. if (status & PHY_BMSR_LS)
  253. mii_info->link = 1;
  254. else
  255. mii_info->link = 0;
  256. }
  257. return 0;
  258. }
  259. static int genmii_read_status (struct uec_mii_info *mii_info)
  260. {
  261. u16 status;
  262. int err;
  263. /* Update the link, but return if there
  264. * was an error */
  265. err = genmii_update_link (mii_info);
  266. if (err)
  267. return err;
  268. if (mii_info->autoneg) {
  269. status = phy_read (mii_info, PHY_ANLPAR);
  270. if (status & (PHY_ANLPAR_10FD | PHY_ANLPAR_TXFD))
  271. mii_info->duplex = DUPLEX_FULL;
  272. else
  273. mii_info->duplex = DUPLEX_HALF;
  274. if (status & (PHY_ANLPAR_TXFD | PHY_ANLPAR_TX))
  275. mii_info->speed = SPEED_100;
  276. else
  277. mii_info->speed = SPEED_10;
  278. mii_info->pause = 0;
  279. }
  280. /* On non-aneg, we assume what we put in BMCR is the speed,
  281. * though magic-aneg shouldn't prevent this case from occurring
  282. */
  283. return 0;
  284. }
  285. static int marvell_read_status (struct uec_mii_info *mii_info)
  286. {
  287. u16 status;
  288. int err;
  289. /* Update the link, but return if there
  290. * was an error */
  291. err = genmii_update_link (mii_info);
  292. if (err)
  293. return err;
  294. /* If the link is up, read the speed and duplex */
  295. /* If we aren't autonegotiating, assume speeds
  296. * are as set */
  297. if (mii_info->autoneg && mii_info->link) {
  298. int speed;
  299. status = phy_read (mii_info, MII_M1011_PHY_SPEC_STATUS);
  300. /* Get the duplexity */
  301. if (status & MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX)
  302. mii_info->duplex = DUPLEX_FULL;
  303. else
  304. mii_info->duplex = DUPLEX_HALF;
  305. /* Get the speed */
  306. speed = status & MII_M1011_PHY_SPEC_STATUS_SPD_MASK;
  307. switch (speed) {
  308. case MII_M1011_PHY_SPEC_STATUS_1000:
  309. mii_info->speed = SPEED_1000;
  310. break;
  311. case MII_M1011_PHY_SPEC_STATUS_100:
  312. mii_info->speed = SPEED_100;
  313. break;
  314. default:
  315. mii_info->speed = SPEED_10;
  316. break;
  317. }
  318. mii_info->pause = 0;
  319. }
  320. return 0;
  321. }
  322. static int marvell_ack_interrupt (struct uec_mii_info *mii_info)
  323. {
  324. /* Clear the interrupts by reading the reg */
  325. phy_read (mii_info, MII_M1011_IEVENT);
  326. return 0;
  327. }
  328. static int marvell_config_intr (struct uec_mii_info *mii_info)
  329. {
  330. if (mii_info->interrupts == MII_INTERRUPT_ENABLED)
  331. phy_write (mii_info, MII_M1011_IMASK, MII_M1011_IMASK_INIT);
  332. else
  333. phy_write (mii_info, MII_M1011_IMASK, MII_M1011_IMASK_CLEAR);
  334. return 0;
  335. }
  336. static int dm9161_init (struct uec_mii_info *mii_info)
  337. {
  338. /* Reset the PHY */
  339. phy_write (mii_info, PHY_BMCR, phy_read (mii_info, PHY_BMCR) |
  340. PHY_BMCR_RESET);
  341. /* PHY and MAC connect */
  342. phy_write (mii_info, PHY_BMCR, phy_read (mii_info, PHY_BMCR) &
  343. ~PHY_BMCR_ISO);
  344. phy_write (mii_info, MII_DM9161_SCR, MII_DM9161_SCR_INIT);
  345. config_genmii_advert (mii_info);
  346. /* Start/restart aneg */
  347. genmii_config_aneg (mii_info);
  348. return 0;
  349. }
  350. static int dm9161_config_aneg (struct uec_mii_info *mii_info)
  351. {
  352. return 0;
  353. }
  354. static int dm9161_read_status (struct uec_mii_info *mii_info)
  355. {
  356. u16 status;
  357. int err;
  358. /* Update the link, but return if there was an error */
  359. err = genmii_update_link (mii_info);
  360. if (err)
  361. return err;
  362. /* If the link is up, read the speed and duplex
  363. If we aren't autonegotiating assume speeds are as set */
  364. if (mii_info->autoneg && mii_info->link) {
  365. status = phy_read (mii_info, MII_DM9161_SCSR);
  366. if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_100H))
  367. mii_info->speed = SPEED_100;
  368. else
  369. mii_info->speed = SPEED_10;
  370. if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_10F))
  371. mii_info->duplex = DUPLEX_FULL;
  372. else
  373. mii_info->duplex = DUPLEX_HALF;
  374. }
  375. return 0;
  376. }
  377. static int dm9161_ack_interrupt (struct uec_mii_info *mii_info)
  378. {
  379. /* Clear the interrupt by reading the reg */
  380. phy_read (mii_info, MII_DM9161_INTR);
  381. return 0;
  382. }
  383. static int dm9161_config_intr (struct uec_mii_info *mii_info)
  384. {
  385. if (mii_info->interrupts == MII_INTERRUPT_ENABLED)
  386. phy_write (mii_info, MII_DM9161_INTR, MII_DM9161_INTR_INIT);
  387. else
  388. phy_write (mii_info, MII_DM9161_INTR, MII_DM9161_INTR_STOP);
  389. return 0;
  390. }
  391. static void dm9161_close (struct uec_mii_info *mii_info)
  392. {
  393. }
  394. static struct phy_info phy_info_dm9161 = {
  395. .phy_id = 0x0181b880,
  396. .phy_id_mask = 0x0ffffff0,
  397. .name = "Davicom DM9161E",
  398. .init = dm9161_init,
  399. .config_aneg = dm9161_config_aneg,
  400. .read_status = dm9161_read_status,
  401. .close = dm9161_close,
  402. };
  403. static struct phy_info phy_info_dm9161a = {
  404. .phy_id = 0x0181b8a0,
  405. .phy_id_mask = 0x0ffffff0,
  406. .name = "Davicom DM9161A",
  407. .features = MII_BASIC_FEATURES,
  408. .init = dm9161_init,
  409. .config_aneg = dm9161_config_aneg,
  410. .read_status = dm9161_read_status,
  411. .ack_interrupt = dm9161_ack_interrupt,
  412. .config_intr = dm9161_config_intr,
  413. .close = dm9161_close,
  414. };
  415. static struct phy_info phy_info_marvell = {
  416. .phy_id = 0x01410c00,
  417. .phy_id_mask = 0xffffff00,
  418. .name = "Marvell 88E11x1",
  419. .features = MII_GBIT_FEATURES,
  420. .config_aneg = &marvell_config_aneg,
  421. .read_status = &marvell_read_status,
  422. .ack_interrupt = &marvell_ack_interrupt,
  423. .config_intr = &marvell_config_intr,
  424. };
  425. static struct phy_info phy_info_genmii = {
  426. .phy_id = 0x00000000,
  427. .phy_id_mask = 0x00000000,
  428. .name = "Generic MII",
  429. .features = MII_BASIC_FEATURES,
  430. .config_aneg = genmii_config_aneg,
  431. .read_status = genmii_read_status,
  432. };
  433. static struct phy_info *phy_info[] = {
  434. &phy_info_dm9161,
  435. &phy_info_dm9161a,
  436. &phy_info_marvell,
  437. &phy_info_genmii,
  438. NULL
  439. };
  440. u16 phy_read (struct uec_mii_info *mii_info, u16 regnum)
  441. {
  442. return mii_info->mdio_read (mii_info->dev, mii_info->mii_id, regnum);
  443. }
  444. void phy_write (struct uec_mii_info *mii_info, u16 regnum, u16 val)
  445. {
  446. mii_info->mdio_write (mii_info->dev, mii_info->mii_id, regnum, val);
  447. }
  448. /* Use the PHY ID registers to determine what type of PHY is attached
  449. * to device dev. return a struct phy_info structure describing that PHY
  450. */
  451. struct phy_info *uec_get_phy_info (struct uec_mii_info *mii_info)
  452. {
  453. u16 phy_reg;
  454. u32 phy_ID;
  455. int i;
  456. struct phy_info *theInfo = NULL;
  457. /* Grab the bits from PHYIR1, and put them in the upper half */
  458. phy_reg = phy_read (mii_info, PHY_PHYIDR1);
  459. phy_ID = (phy_reg & 0xffff) << 16;
  460. /* Grab the bits from PHYIR2, and put them in the lower half */
  461. phy_reg = phy_read (mii_info, PHY_PHYIDR2);
  462. phy_ID |= (phy_reg & 0xffff);
  463. /* loop through all the known PHY types, and find one that */
  464. /* matches the ID we read from the PHY. */
  465. for (i = 0; phy_info[i]; i++)
  466. if (phy_info[i]->phy_id ==
  467. (phy_ID & phy_info[i]->phy_id_mask)) {
  468. theInfo = phy_info[i];
  469. break;
  470. }
  471. /* This shouldn't happen, as we have generic PHY support */
  472. if (theInfo == NULL) {
  473. ugphy_info ("UEC: PHY id %x is not supported!", phy_ID);
  474. return NULL;
  475. } else {
  476. ugphy_info ("UEC: PHY is %s (%x)", theInfo->name, phy_ID);
  477. }
  478. return theInfo;
  479. }
  480. void marvell_phy_interface_mode (struct eth_device *dev,
  481. enet_interface_e mode)
  482. {
  483. uec_private_t *uec = (uec_private_t *) dev->priv;
  484. struct uec_mii_info *mii_info;
  485. if (!uec->mii_info) {
  486. printf ("%s: the PHY not intialized\n", __FUNCTION__);
  487. return;
  488. }
  489. mii_info = uec->mii_info;
  490. if (mode == ENET_100_RGMII) {
  491. phy_write (mii_info, 0x00, 0x9140);
  492. phy_write (mii_info, 0x1d, 0x001f);
  493. phy_write (mii_info, 0x1e, 0x200c);
  494. phy_write (mii_info, 0x1d, 0x0005);
  495. phy_write (mii_info, 0x1e, 0x0000);
  496. phy_write (mii_info, 0x1e, 0x0100);
  497. phy_write (mii_info, 0x09, 0x0e00);
  498. phy_write (mii_info, 0x04, 0x01e1);
  499. phy_write (mii_info, 0x00, 0x9140);
  500. phy_write (mii_info, 0x00, 0x1000);
  501. udelay (100000);
  502. phy_write (mii_info, 0x00, 0x2900);
  503. phy_write (mii_info, 0x14, 0x0cd2);
  504. phy_write (mii_info, 0x00, 0xa100);
  505. phy_write (mii_info, 0x09, 0x0000);
  506. phy_write (mii_info, 0x1b, 0x800b);
  507. phy_write (mii_info, 0x04, 0x05e1);
  508. phy_write (mii_info, 0x00, 0xa100);
  509. phy_write (mii_info, 0x00, 0x2100);
  510. udelay (1000000);
  511. } else if (mode == ENET_10_RGMII) {
  512. phy_write (mii_info, 0x14, 0x8e40);
  513. phy_write (mii_info, 0x1b, 0x800b);
  514. phy_write (mii_info, 0x14, 0x0c82);
  515. phy_write (mii_info, 0x00, 0x8100);
  516. udelay (1000000);
  517. }
  518. }
  519. void change_phy_interface_mode (struct eth_device *dev, enet_interface_e mode)
  520. {
  521. #ifdef CONFIG_PHY_MODE_NEED_CHANGE
  522. marvell_phy_interface_mode (dev, mode);
  523. #endif
  524. }
  525. #endif /* CONFIG_QE */