From: Andrew Lunn <andrew@lunn.ch>
To: Lukasz Majewski <lukma@denx.de>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
davem@davemloft.net, Andrew Lunn <andrew+netdev@lunn.ch>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org,
Maxime Chevallier <maxime.chevallier@bootlin.com>
Subject: Re: [PATCH 5/5] net: mtip: The L2 switch driver for imx287
Date: Tue, 25 Mar 2025 16:34:37 +0100 [thread overview]
Message-ID: <0a908dc7-55eb-4e23-8452-7b7d2e0f4289@lunn.ch> (raw)
In-Reply-To: <20250325142810.0aa07912@wsk>
> > > +config FEC_MTIP_L2SW
> > > + tristate "MoreThanIP L2 switch support to FEC driver"
> > > + depends on OF
> > > + depends on NET_SWITCHDEV
> > > + depends on BRIDGE
> > > + depends on ARCH_MXS || ARCH_MXC
> >
> > Missing compile test
>
> Could you be more specific?
config FEC
tristate "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \
ARCH_MXC || ARCH_S32 || SOC_IMX28 || COMPILE_TEST)
|| COMPILE_TEST
So that it also gets build on amd64, s390, powerpc etc. The code
should cleanly build on all architectures. It if does not, it probably
means the code is using the kernel abstractions wrong. Also, most
developers build test on amd64, not arm, so if they are making tree
wide changes, you want this driver to build on amd64 so such tree wide
changes get build tested.
> There have been attempts to upstream this driver since 2020...
> The original code is from - v4.4 for vf610 and 2.6.35 for imx287.
>
> It has been then subsequently updated/rewritten for:
>
> - 4.19-cip
> - 5.12 (two versions for switchdev and DSA)
> - 6.6 LTS
> - net-next.
>
> The pr_err() were probably added by me as replacement for
> "printk(KERN_ERR". I can change them to dev_* or netdev_*. This shall
> not be a problem.
With Ethernet switches, you need to look at the context. Is it
something specific to one interface? The netdev_err(). If it is global
to the whole switch, then dev_err().
> > > + pr_info("Ethernet Switch Version %s\n", VERSION);
> >
> > Drivers use dev, not pr. Anyway drop. Drivers do not have versions and
> > should be silent on success.
>
> As I've written above - there are several "versions" on this particular
> driver. Hence the information.
There is only one version in mainline, this version (maybe). Mainline
does not care about other versions. Such version information is also
useless, because once it is merged, it never changes. What you
actually want to know is the kernel git hash, so you can find the
exact sources. ethtool -I will return that, assuming your ethtool code
is correct.
> > > + pr_info("Ethernet Switch HW rev 0x%x:0x%x\n",
> > > + MCF_MTIP_REVISION_CUSTOMER_REVISION(rev),
> > > + MCF_MTIP_REVISION_CORE_REVISION(rev));
> >
> > Drop
>
> Ok.
You can report this via ethtool -I. But i suggest you leave that for
later patches.
> > > + fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
> > > + if (!IS_ERR(fep->reg_phy)) {
> > > + ret = regulator_enable(fep->reg_phy);
> > > + if (ret) {
> > > + dev_err(&pdev->dev,
> > > + "Failed to enable phy regulator:
> > > %d\n", ret);
> > > + goto failed_regulator;
> > > + }
> > > + } else {
> > > + if (PTR_ERR(fep->reg_phy) == -EPROBE_DEFER) {
> > > + ret = -EPROBE_DEFER;
> > > + goto failed_regulator;
> > > + }
> > > + fep->reg_phy = NULL;
> >
> > I don't understand this code. Do you want to re-implement
> > get_optional? But why?
>
> Here the get_optional() shall be used.
This is the problem with trying to use old code. It needs more work
than just making it compile. It needs to be brought up to HEAD of
mainline standard, which often nearly ends in a re-write.
> > > + fep->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
> > > + if (IS_ERR(fep->clk_ipg))
> > > + fep->clk_ipg = NULL;
> >
> > Why?
>
> I will update the code.
FYI: NULL is a valid clock. But do you actually want _optional()?
This is the sort of thing a 10 year old codebase will be missing, and
you need to re-write. You might also be able to use the clk _bulk_
API?
Andrew
next prev parent reply other threads:[~2025-03-25 15:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 11:57 [PATCH 0/5] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
2025-03-25 11:57 ` [PATCH 1/5] MAINTAINERS: Add myself as the MTIP L2 switch maintainer (IMX SoCs: imx287) Lukasz Majewski
2025-03-25 12:01 ` Krzysztof Kozlowski
2025-03-25 12:15 ` Lukasz Majewski
2025-03-25 11:57 ` [PATCH 2/5] dt-bindings: net: Add MTIP L2 switch description (fec,mtip-switch.yaml) Lukasz Majewski
2025-03-25 12:04 ` Krzysztof Kozlowski
2025-03-25 12:15 ` Lukasz Majewski
2025-03-25 12:24 ` Krzysztof Kozlowski
2025-03-25 12:39 ` Lukasz Majewski
2025-03-25 12:43 ` Krzysztof Kozlowski
2025-03-25 14:27 ` Lukasz Majewski
2025-03-25 13:25 ` Rob Herring (Arm)
2025-03-25 15:05 ` Andrew Lunn
2025-03-25 15:11 ` Krzysztof Kozlowski
2025-03-25 16:12 ` Lukasz Majewski
2025-03-26 13:43 ` Lukasz Majewski
2025-03-26 14:15 ` Krzysztof Kozlowski
2025-03-26 15:24 ` Andrew Lunn
2025-03-25 11:57 ` [PATCH 3/5] arm: dts: Adjust the 'reg' range for imx287 L2 switch description Lukasz Majewski
2025-03-25 12:04 ` Krzysztof Kozlowski
2025-03-25 12:19 ` Lukasz Majewski
2025-03-25 11:57 ` [PATCH 4/5] arm: dts: imx287: Provide description for MTIP L2 switch Lukasz Majewski
2025-03-25 15:14 ` Andrew Lunn
2025-03-25 16:16 ` Lukasz Majewski
2025-03-25 11:57 ` [PATCH 5/5] net: mtip: The L2 switch driver for imx287 Lukasz Majewski
2025-03-25 12:11 ` Krzysztof Kozlowski
2025-03-25 13:28 ` Lukasz Majewski
2025-03-25 14:36 ` Krzysztof Kozlowski
2025-03-25 15:34 ` Andrew Lunn [this message]
2025-03-25 16:38 ` Lukasz Majewski
2025-03-25 17:13 ` Krzysztof Kozlowski
2025-03-25 17:30 ` Lukasz Majewski
2025-03-25 14:51 ` [PATCH 0/5] net: mtip: Add support for MTIP imx287 L2 switch driver Rob Herring (Arm)
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=0a908dc7-55eb-4e23-8452-7b7d2e0f4289@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukma@denx.de \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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
all inboxes | Powered by JetHome®