[PATCH 7/8] arm: kirkwood: Pogoplug-V4 : Add board implementation
Marek Behún
marek.behun at nic.cz
Sun Dec 19 00:42:37 CET 2021
On Sat, 18 Dec 2021 15:28:49 -0800
Tony Dinh <mibodhi at gmail.com> wrote:
> Hi Marek,
>
> On Sat, Dec 18, 2021 at 2:59 PM Marek Behún <marek.behun at nic.cz> wrote:
> >
> > > +#if defined(CONFIG_RESET_PHY_R)
> > > +/* Configure and initialize PHY */
> > > +void reset_phy(void)
> > > +{
> > > + u16 reg;
> > > + int phyaddr;
> > > + char *name = "ethernet-controller at 72000";
> > > + char *eth0_path = "/ocp at f1000000/ethernet-controller at 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...
>
> Thanks for the advice! That would be best.
>
> Will look into this for another separate patch, to see if it is
> possible to factor out similar code in other Kirkwood boards too.
Also implement the .readext and .writeext methods as M88E151x_driver
and you won't need to alwyas change page by hand.
Marek
More information about the U-Boot
mailing list