uec_phy.c 16 KB

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