
18 Dec
2021
18 Dec
'21
11:59 p.m.
+#if defined(CONFIG_RESET_PHY_R) +/* Configure and initialize PHY */ +void reset_phy(void) +{
- u16 reg;
- int phyaddr;
- char *name = "ethernet-controller@72000";
- char *eth0_path = "/ocp@f1000000/ethernet-controller@72000";
- if (miiphy_set_current_dev(name))
return;
- phyaddr = fdt_get_phy_addr(eth0_path);
- if (phyaddr < 0)
return;
- /*
* Enable RGMII delay on Tx and Rx for CPU port
* Ref: sec 4.7.2 of chip datasheet
*/
- miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 2);
- miiphy_read(name, phyaddr, MV88E1116_MAC_CTRL_REG, ®);
- reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
- miiphy_write(name, phyaddr, MV88E1116_MAC_CTRL_REG, reg);
- miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 0);
- /* reset the phy */
- miiphy_reset(name, phyaddr);
- printf("88E1116 Initialized on %s\n", name);
+}
This PHY has a driver in U-Boot, drivers/net/phy/marvell.c, structure M88E1118_driver.
There the m88e1118_config() method already does one thing of what you are doing here: enabling rgmii delays. It also sets LED config, but does not reset the PHY. You can add call to phy_reset() there...
Marek