From: Alexandru Marginean <alexm.osslist@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 4/6] drivers: net: add Felix DSA switch driver
Date: Tue, 17 Dec 2019 08:28:52 +0100 [thread overview]
Message-ID: <25eb6ed5-a554-ed6f-2b4a-51da6844c8f8@gmail.com> (raw)
In-Reply-To: <CA+h21hru-Pm5Hgrs18X15GRvtn=DdV_-Ct_TG_T23bZt_NQAUw@mail.gmail.com>
On 12/15/2019 1:53 PM, Vladimir Oltean wrote:
> Hi Alex,
>
> On Tue, 3 Dec 2019 at 18:18, Alex Marginean <alexandru.marginean@nxp.com> wrote:
>> +static int felix_port_enable(struct udevice *dev, int port,
>> + struct phy_device *phy)
>> +{
>> + struct felix_priv *priv = dev_get_priv(dev);
>> + void *base = priv->regs_base;
>> +
>> + out_le32(base + FELIX_GMII_MAC_ENA_CFG(port),
>> + FELIX_GMII_MAX_ENA_CFG_TX | FELIX_GMII_MAX_ENA_CFG_RX);
>> +
>> + out_le32(base + FELIX_QSYS_SYSTEM_SW_PORT_MODE(port),
>> + FELIX_QSYS_SYSTEM_SW_PORT_ENA |
>> + FELIX_QSYS_SYSTEM_SW_PORT_LOSSY |
>> + FELIX_QSYS_SYSTEM_SW_PORT_SCH(1));
>> +
>> + if (phy)
>> + phy_startup(phy);
>> + return 0;
>> +}
>> +
>> +static void felix_port_disable(struct udevice *dev, int port,
>> + struct phy_device *phy)
>> +{
>> + struct felix_priv *priv = dev_get_priv(dev);
>> + void *base = priv->regs_base;
>> +
>> + out_le32(base + FELIX_GMII_MAC_ENA_CFG(port), 0);
>> +
>> + out_le32(base + FELIX_QSYS_SYSTEM_SW_PORT_MODE(port),
>> + FELIX_QSYS_SYSTEM_SW_PORT_LOSSY |
>> + FELIX_QSYS_SYSTEM_SW_PORT_SCH(1));
>> +
>> + /*
>> + * we don't call phy_shutdown here to avoind waiting next time we use
>> + * the port, but the downside is that remote side will think we're
>> + * actively processing traffic although we are not.
>> + */
>> +}
>> --
>> 2.17.1
>>
>
> What is the correct general procedure here, is it to call phy_startup
> so late (felix_port_enable)? I'm trying to take this driver as an
> example for sja1105, which has RGMII so PCS and no autonomous in-band
> AN like felix does. On this switch, it is too late to do phy_startup
> now.
Why is it too late? Is it a functional problem, or you're looking to
reduce the waiting time?
> Instead, I would need to look at phy->speed which should have
> been settled by now, and reprogram my MAC with it.
> My question is: don't you think phy_startup() and phy_shutdown()
> belong in the DSA uclass code?
>
> Thanks,
> -Vladimir
>
The API is similar to the one in Linux, plus I didn't want to force a
specific PHY related behavior to drivers. Sometimes it's fine to start
up the PHYs at probe and then just send/receive as needed, but that
behavior is not always acceptable. Assume there is some other host
connected to one of the front panel ports, if it sees link up it may
start doing DHCP, IPv6 discovery. I think it's generally better to keep
links down unless the port is actually in use for the benefit of the
remote end. I didn't want to force this by moving the PHY calls to
uclass code. This approach is also similar to eth uclass, it doesn't
handle phy calls for the driver either.
Alex
next prev parent reply other threads:[~2019-12-17 7:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 14:56 [PATCH v3 0/6] Introduce DSA Ethernet switch class and Felix driver Alex Marginean
2019-12-03 14:56 ` [PATCH v3 1/6] net: introduce DSA class for Ethernet switches Alex Marginean
2019-12-15 12:44 ` Vladimir Oltean
2019-12-17 7:11 ` Alexandru Marginean
2019-12-15 13:08 ` Vladimir Oltean
2019-12-17 7:18 ` Alexandru Marginean
2019-12-17 9:41 ` Vladimir Oltean
2019-12-17 10:36 ` Alexandru Marginean
2019-12-17 10:47 ` Vladimir Oltean
2020-02-09 13:10 ` Vladimir Oltean
2019-12-03 14:56 ` [PATCH v3 2/6] drivers: net: add a DSA sandbox driver Alex Marginean
2019-12-03 14:56 ` [PATCH v3 3/6] test: dm: add a simple unit test for DSA class Alex Marginean
2019-12-04 4:14 ` Priyanka Jain
2019-12-03 14:56 ` [PATCH v3 4/6] drivers: net: add Felix DSA switch driver Alex Marginean
2019-12-15 12:53 ` Vladimir Oltean
2019-12-15 12:53 ` Vladimir Oltean
2019-12-15 14:16 ` Vladimir Oltean
2019-12-17 7:29 ` Alexandru Marginean
2019-12-17 7:28 ` Alexandru Marginean [this message]
2019-12-03 14:56 ` [PATCH v3 5/6] arm: dts: ls1028a: adds Ethernet switch node and its dependencies Alex Marginean
2019-12-03 14:56 ` [PATCH v3 6/6] configs: ls1028a: enable the Ethernet switch driver in defconfig Alex Marginean
2020-03-13 14:33 ` Vladimir Oltean
2020-03-17 9:49 ` Alexandru Marginean
2020-02-08 13:19 ` [PATCH v3 0/6] Introduce DSA Ethernet switch class and Felix driver Vladimir Oltean
2020-03-17 9:58 ` Alexandru Marginean
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=25eb6ed5-a554-ed6f-2b4a-51da6844c8f8@gmail.com \
--to=alexm.osslist@gmail.com \
--cc=u-boot@lists.denx.de \
/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