From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org,
leoyang.li@nxp.com, linux-phy@lists.infradead.org,
devicetree@vger.kernel.org, shawnguo@kernel.org,
hongxing.zhu@nxp.com
Subject: Re: [PATCH net-next v3 7/8] dpaa2-mac: configure the SerDes phy on a protocol change
Date: Thu, 10 Mar 2022 15:05:50 +0000 [thread overview]
Message-ID: <YioTznpNwldCnJpm@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220310145200.3645763-8-ioana.ciornei@nxp.com>
On Thu, Mar 10, 2022 at 04:51:59PM +0200, Ioana Ciornei wrote:
> This patch integrates the dpaa2-eth driver with the generic PHY
> infrastructure in order to search, find and reconfigure the SerDes lanes
> in case of a protocol change.
>
> On the .mac_config() callback, the phy_set_mode_ext() API is called so
> that the Lynx 28G SerDes PHY driver can change the lane's configuration.
> In the same phylink callback the MC firmware is called so that it
> reconfigures the MAC side to run using the new protocol.
>
> The consumer drivers - dpaa2-eth and dpaa2-switch - are updated to call
> the dpaa2_mac_start/stop functions newly added which will
> power_on/power_off the associated SerDes lane.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Looks better, there's a minor thing that I missed, sorry:
> + if (mac->features & DPAA2_MAC_FEATURE_PROTOCOL_CHANGE &&
> + !phy_interface_mode_is_rgmii(mac->if_mode) &&
> + is_of_node(dpmac_node)) {
> + serdes_phy = of_phy_get(to_of_node(dpmac_node), NULL);
> +
> + if (IS_ERR(serdes_phy)) {
> + if (PTR_ERR(serdes_phy) == -ENODEV)
> + serdes_phy = NULL;
> + else
> + return PTR_ERR(serdes_phy);
> + } else {
> + phy_init(serdes_phy);
> + }
Would:
if (PTR_ERR(serdes_phy) == -ENODEV)
serdes_phy = NULL;
else if (IS_ERR(serdes_phy))
return PTR_ERR(serdes_phy);
else
phy_init(serdes_phy);
be neater? There is no need to check IS_ERR() before testing PTR_ERR().
One may also prefer the pointer-comparison approach:
if (serdes_phy == ERR_PTR(-ENODEV))
to remove any question about PTR_ERR(p) on a !IS_ERR(p) value too, but
it really doesn't make any difference.
I suspect this is just a code formatting issue, I'd think the compiler
would generate reasonable code either way, so as I said above, it's
quite minor.
--
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
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org,
leoyang.li@nxp.com, linux-phy@lists.infradead.org,
devicetree@vger.kernel.org, shawnguo@kernel.org,
hongxing.zhu@nxp.com
Subject: Re: [PATCH net-next v3 7/8] dpaa2-mac: configure the SerDes phy on a protocol change
Date: Thu, 10 Mar 2022 15:05:50 +0000 [thread overview]
Message-ID: <YioTznpNwldCnJpm@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220310145200.3645763-8-ioana.ciornei@nxp.com>
On Thu, Mar 10, 2022 at 04:51:59PM +0200, Ioana Ciornei wrote:
> This patch integrates the dpaa2-eth driver with the generic PHY
> infrastructure in order to search, find and reconfigure the SerDes lanes
> in case of a protocol change.
>
> On the .mac_config() callback, the phy_set_mode_ext() API is called so
> that the Lynx 28G SerDes PHY driver can change the lane's configuration.
> In the same phylink callback the MC firmware is called so that it
> reconfigures the MAC side to run using the new protocol.
>
> The consumer drivers - dpaa2-eth and dpaa2-switch - are updated to call
> the dpaa2_mac_start/stop functions newly added which will
> power_on/power_off the associated SerDes lane.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Looks better, there's a minor thing that I missed, sorry:
> + if (mac->features & DPAA2_MAC_FEATURE_PROTOCOL_CHANGE &&
> + !phy_interface_mode_is_rgmii(mac->if_mode) &&
> + is_of_node(dpmac_node)) {
> + serdes_phy = of_phy_get(to_of_node(dpmac_node), NULL);
> +
> + if (IS_ERR(serdes_phy)) {
> + if (PTR_ERR(serdes_phy) == -ENODEV)
> + serdes_phy = NULL;
> + else
> + return PTR_ERR(serdes_phy);
> + } else {
> + phy_init(serdes_phy);
> + }
Would:
if (PTR_ERR(serdes_phy) == -ENODEV)
serdes_phy = NULL;
else if (IS_ERR(serdes_phy))
return PTR_ERR(serdes_phy);
else
phy_init(serdes_phy);
be neater? There is no need to check IS_ERR() before testing PTR_ERR().
One may also prefer the pointer-comparison approach:
if (serdes_phy == ERR_PTR(-ENODEV))
to remove any question about PTR_ERR(p) on a !IS_ERR(p) value too, but
it really doesn't make any difference.
I suspect this is just a code formatting issue, I'd think the compiler
would generate reasonable code either way, so as I said above, it's
quite minor.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2022-03-10 15:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 14:51 [PATCH net-next v3 0/8] dpaa2-mac: add support for changing the protocol at runtime Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 1/8] phy: add support for the Layerscape SerDes 28G Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Ioana Ciornei
2022-03-10 16:47 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Krzysztof Kozlowski
2022-03-10 16:47 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Krzysztof Kozlowski
2022-03-10 17:32 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Ioana Ciornei
2022-03-10 17:32 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Ioana Ciornei
2022-03-10 21:19 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Krzysztof Kozlowski
2022-03-10 21:19 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Krzysztof Kozlowski
2022-03-10 17:58 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Russell King (Oracle)
2022-03-10 17:58 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Russell King (Oracle)
2022-03-10 19:06 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl, lynx-28g" compatible Ioana Ciornei
2022-03-10 19:06 ` [PATCH net-next v3 2/8] dt-bindings: phy: add the "fsl,lynx-28g" compatible Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 3/8] dpaa2-mac: add the MC API for retrieving the version Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 4/8] dpaa2-mac: add the MC API for reconfiguring the protocol Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 5/8] dpaa2-mac: retrieve API version and detect features Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 6/8] dpaa2-mac: move setting up supported_interfaces into a function Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 14:51 ` [PATCH net-next v3 7/8] dpaa2-mac: configure the SerDes phy on a protocol change Ioana Ciornei
2022-03-10 14:51 ` Ioana Ciornei
2022-03-10 15:05 ` Russell King (Oracle) [this message]
2022-03-10 15:05 ` Russell King (Oracle)
2022-03-10 15:57 ` Ioana Ciornei
2022-03-10 15:57 ` Ioana Ciornei
2022-03-10 14:52 ` [PATCH net-next v3 8/8] arch: arm64: dts: lx2160a: describe the SerDes block #1 Ioana Ciornei
2022-03-10 14:52 ` Ioana Ciornei
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=YioTznpNwldCnJpm@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=hongxing.zhu@nxp.com \
--cc=ioana.ciornei@nxp.com \
--cc=kishon@ti.com \
--cc=kuba@kernel.org \
--cc=leoyang.li@nxp.com \
--cc=linux-phy@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.org \
--cc=vkoul@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.