[RFC PATCH 2/2] net: stmmac: dwmac-sun8i: Allow runtime AC200/AC300 phy selection
James Hilliard
james.hilliard1 at gmail.com
Mon May 26 12:05:14 PDT 2025
On Mon, May 26, 2025 at 8:14 AM Andrew Lunn <andrew at lunn.ch> wrote:
>
> On Mon, May 26, 2025 at 09:04:40AM +0100, Russell King (Oracle) wrote:
> > On Sun, May 25, 2025 at 06:29:22PM -0600, James Hilliard wrote:
> > > + if (!nvmem_cell_read_u16(dev, "ac300", &val)) {
> > > + const char *phy_name = (val & AC300_KEY) ? "ac300" : "ac200";
> > > + int index = of_property_match_string(dev->of_node, "phy-names", phy_name);
> > > + if (index < 0) {
> > > + dev_err(dev, "PHY name not found in device tree\n");
> > > + return -EINVAL;
> > > + }
> > > +
> > > + plat_dat->phy_node = of_parse_phandle(dev->of_node, "phys", index);
> > > + if (!plat_dat->phy_node) {
> > > + dev_err(dev, "Failed to get PHY node from phys property\n");
> > > + return -EINVAL;
> > > + }
> > > + }
> >
> > 1. You are re-using the drivers/phy binding for ethernet PHYs driven by
> > phylib here.
> > 2. You need to update
> > Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
> > in a separate patch.
>
> A real user, i.e. a patch to a .dts file, would also be good.
That will be added that down the line, for now I added an example in the docs:
https://lore.kernel.org/netdev/20250526182939.2593553-3-james.hilliard1@gmail.com/
Currently there's a few other drivers needed to fully bring up the h616 emac1
with AC200/AC300 PHY's such as PWM driver support.
i.e. this(which will also need a few additional patches for the H616
PWM variant):
https://lore.kernel.org/all/20250427142500.151925-3-privatesub2@gmail.com/
I'm currently doing most of the PHY initialization in u-boot to simplify testing
of the efuse based PHY selection logic in the kernel. I'm sending this
separately as a number of subsequent drivers for kernel side PHY
initialization will be dependent upon specific PHY's being discovered at
runtime via the ac300 efuse bit.
I've currently verified this works on AC200 and AC300 boards by checking
that the appropriate phy address is used(address 0 on AC300 and address 1
on AC200).
>
> Andrew
More information about the linux-arm-kernel
mailing list