From: Colin Foster <colin.foster@in-advantage.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: linux-phy@lists.infradead.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Kishon Vijay Abraham I <kishon@kernel.org>,
Vinod Koul <vkoul@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
UNGLinuxDriver@microchip.com,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Lee Jones <lee@kernel.org>
Subject: Re: [RFC v1 net-next 0/7] add support for ocelot external ports
Date: Thu, 16 Feb 2023 16:42:06 -0800 [thread overview]
Message-ID: <Y+7NXoFTBYVG3/+b@colin-ia-desktop> (raw)
In-Reply-To: <Y+4eLmpX9oX3JBVJ@shell.armlinux.org.uk>
Hi Russell,
On Thu, Feb 16, 2023 at 12:14:38PM +0000, Russell King (Oracle) wrote:
> On Wed, Feb 15, 2023 at 11:53:14PM -0800, Colin Foster wrote:
> > Part 3 will, at a minimum, add support for ports 4-7, which are
> > configured to use QSGMII to an external phy (Return Of The QSGMII). With
> > any luck, and some guidance, support for SGMII, SFPs, etc. will also be
> > part of this series.
> >
> >
> > This patch series is absolutely an RFC at this point. While all 8 copper
> > ports on the VSC7512 are currently functional, I recognize there are a
> > couple empty function callbacks in the last patch that likely need to be
> > implemented.
> >
> ...
> >
> > Also, with patch 7 ("net: dsa: ocelot_ext: add support for external phys")
> > my basis was the function mscc_ocelot_init_ports(), but there were several
> > changes I had to make for DSA / Phylink. Are my implementations of
> > ocelot_ext_parse_port_node() and ocelot_ext_phylink_create() barking up
> > the right tree?
>
> DSA already creates phylink instances per DSA port, and provides many
> of the phylink MAC operations to the DSA driver via the .phylink_*
> operations in the dsa_switch_ops structure, and this phylink instance
> should be used for managing the status and configuring the port
> according to phylink's callbacks. The core felix code already makes
> use of this, implementing the mac_link_down() and mac_link_up()
> operations to handle when the link comes up or goes down.
>
> I don't see why one would need to create a separate phylink instance
> to support external PHYs, SFPs, etc on a DSA switch. The phylink
> instance created by DSA is there for the DSA driver to make use of
> for the port, and should be sufficient for this.
This is essentially the feedback I was looking for. "This looks wrong"
which means I'll take a step back.
>
> I think if you use the DSA-created phylink instance, then you don't
> need any of patch 6. I'm not yet convinced that you need anything
> from patch 7, but maybe you could explain what patch 7 provides that
> the existing felix phylink implementation doesn't already provide.
I'll have to go through it again to remember exactly what I was up
against - it was a while ago now. All of the logic was based on the
logic in ocelot_port_phylink_create() - which is part of the vsc7514
switchdev implementation (a chip that is essentially identical, except
for an internal MIPS instead of external SPI control)
I believe the main gotcha was that control over the phy itself, by way
of phy_set_mode_ext(). That needed the 'struct device_node *portnp'
.... Keeps looking ....
Ahh, yes. Regmaps and regfields aren't initialized at the time of
dt parsing in felix. And the MDIO bus isn't allocated until after that.
That's the reason for patch 6 parse_port_node() - I need the tree node
to get MDIO access to the phy, which I don't have until I'm done parsing
the tree...
There might be a cleaner way for me to do that. I'm tiptoeing a little
bit to avoid any regressions with the felix_vsc9959 or seville_vsc9953.
> I do get the impression that the use of the PCS instance in patch 7
> is an attempt to work around the use of a private instance,
> redirecting the pcs_config and pcs_link_up methods to the
> corresponding MAC operations as a workaround for having the private
> instance.
I'm not convinced I don't need PCS here, and just have things working
wrong.
The configuration looks like this:
|------------------------------------------------|
| CPU |
|------------------------------------------------|
|
SPI
|
|------------------------------------------------|
| VSC7512 |
|------------------------------------------------|
|| || || || |
|-------| |-------| |-------| |-------| |
| port4 | | port5 | | port6 | | port7 | |
|-------| |-------| |-------| |-------| |
|| |
QSGMII MDIO
|| |
|------------------------------------------------|
| VSC8512 |
|------------------------------------------------|
|| || || ||
|-------| |-------| |-------| |-------|
| sw0p4 | | sw0p5 | | sw0p6 | | sw0p7 |
|-------| |-------| |-------| |-------|
Would phylink_pcs need to get involved in the QSGMII link at all, or
should the phylnk from dsa_port_phylink_create() be all that's needed?
>
> It looks like you need to hook into the mac_config(), mac_link_up()
> and mac_link_down() methods at the core felix layer, so I would
> suggest looking at the felix_info structure, adding methods there for
> each of these, and arranging for the core felix code to forward these
> calls down to the implementation as required.
Yes, I'll look at how I can clean things up.
I greatly appreciate your feedback!
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2023-02-17 0:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-16 7:53 [RFC v1 net-next 0/7] add support for ocelot external ports Colin Foster
2023-02-16 7:53 ` [RFC v1 net-next 1/7] phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration Colin Foster
2023-02-16 7:53 ` [RFC v1 net-next 2/7] mfd: ocelot: add ocelot-serdes capability Colin Foster
2023-03-03 10:48 ` Lee Jones
2023-03-03 15:12 ` Colin Foster
2023-03-03 21:57 ` Lee Jones
2023-02-16 7:53 ` [RFC v1 net-next 3/7] net: mscc: ocelot: expose ocelot_pll5_init routine Colin Foster
2023-02-16 7:53 ` [RFC v1 net-next 4/7] net: mscc: ocelot: expose generic phylink_mac_config routine Colin Foster
2023-02-16 7:53 ` [RFC v1 net-next 5/7] net: dsa: felix: attempt to initialize internal hsio plls Colin Foster
2023-02-16 7:53 ` [RFC v1 net-next 6/7] net: dsa: felix: allow external parsing of port nodes Colin Foster
2023-02-16 7:53 ` [RFC v1 net-next 7/7] net: dsa: ocelot_ext: add support for external phys Colin Foster
2023-02-16 11:17 ` Russell King (Oracle)
2023-02-17 1:31 ` Colin Foster
2023-02-16 12:14 ` [RFC v1 net-next 0/7] add support for ocelot external ports Russell King (Oracle)
2023-02-17 0:42 ` Colin Foster [this message]
2023-02-17 1:11 ` Vladimir Oltean
2023-02-17 7:02 ` Colin Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+7NXoFTBYVG3/+b@colin-ia-desktop \
--to=colin.foster@in-advantage.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kishon@kernel.org \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vkoul@kernel.org \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox