From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] net: ethernet: mvneta: Add back interface mode validation
Date: Wed, 24 Jun 2020 10:55:02 +0100 [thread overview]
Message-ID: <20200624095502.GZ1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200624070045.8878-2-s.hauer@pengutronix.de>
On Wed, Jun 24, 2020 at 09:00:45AM +0200, Sascha Hauer wrote:
> When writing the serdes configuration register was moved to
> mvneta_config_interface() the whole code block was removed from
> mvneta_port_power_up() in the assumption that its only purpose was to
> write the serdes configuration register. As mentioned by Russell King
> its purpose was also to check for valid interface modes early so that
> later in the driver we do not have to care for unexpected interface
> modes.
> Add back the test to let the driver bail out early on unhandled
> interface modes.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes: b4748553f53f ("net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy")
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Thanks.
> ---
> drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index c4552f868157c..c639e3a293024 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -5009,10 +5009,18 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
> }
>
> /* Power up the port */
> -static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
> +static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
> {
> /* MAC Cause register should be cleared */
> mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
> +
> + if (phy_mode != PHY_INTERFACE_MODE_QSGMII &&
> + phy_mode != PHY_INTERFACE_MODE_SGMII &&
> + !phy_interface_mode_is_8023z(phy_mode) &&
> + !phy_interface_mode_is_rgmii(phy_mode))
> + return -EINVAL;
> +
> + return 0;
> }
>
> /* Device initialization routine */
> @@ -5198,7 +5206,11 @@ static int mvneta_probe(struct platform_device *pdev)
> if (err < 0)
> goto err_netdev;
>
> - mvneta_port_power_up(pp, phy_mode);
> + err = mvneta_port_power_up(pp, pp->phy_interface);
> + if (err < 0) {
> + dev_err(&pdev->dev, "can't power up port\n");
> + return err;
> + }
>
> /* Armada3700 network controller does not support per-cpu
> * operation, so only single NAPI should be initialized.
> @@ -5352,7 +5364,11 @@ static int mvneta_resume(struct device *device)
> }
> }
> mvneta_defaults_set(pp);
> - mvneta_port_power_up(pp, pp->phy_interface);
> + err = mvneta_port_power_up(pp, pp->phy_interface);
> + if (err < 0) {
> + dev_err(device, "can't power up port\n");
> + return err;
> + }
>
> netif_device_attach(dev);
>
> --
> 2.27.0
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: netdev@vger.kernel.org, kernel@pengutronix.de,
linux-kernel@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] net: ethernet: mvneta: Add back interface mode validation
Date: Wed, 24 Jun 2020 10:55:02 +0100 [thread overview]
Message-ID: <20200624095502.GZ1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200624070045.8878-2-s.hauer@pengutronix.de>
On Wed, Jun 24, 2020 at 09:00:45AM +0200, Sascha Hauer wrote:
> When writing the serdes configuration register was moved to
> mvneta_config_interface() the whole code block was removed from
> mvneta_port_power_up() in the assumption that its only purpose was to
> write the serdes configuration register. As mentioned by Russell King
> its purpose was also to check for valid interface modes early so that
> later in the driver we do not have to care for unexpected interface
> modes.
> Add back the test to let the driver bail out early on unhandled
> interface modes.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes: b4748553f53f ("net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy")
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Thanks.
> ---
> drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index c4552f868157c..c639e3a293024 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -5009,10 +5009,18 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
> }
>
> /* Power up the port */
> -static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
> +static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
> {
> /* MAC Cause register should be cleared */
> mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
> +
> + if (phy_mode != PHY_INTERFACE_MODE_QSGMII &&
> + phy_mode != PHY_INTERFACE_MODE_SGMII &&
> + !phy_interface_mode_is_8023z(phy_mode) &&
> + !phy_interface_mode_is_rgmii(phy_mode))
> + return -EINVAL;
> +
> + return 0;
> }
>
> /* Device initialization routine */
> @@ -5198,7 +5206,11 @@ static int mvneta_probe(struct platform_device *pdev)
> if (err < 0)
> goto err_netdev;
>
> - mvneta_port_power_up(pp, phy_mode);
> + err = mvneta_port_power_up(pp, pp->phy_interface);
> + if (err < 0) {
> + dev_err(&pdev->dev, "can't power up port\n");
> + return err;
> + }
>
> /* Armada3700 network controller does not support per-cpu
> * operation, so only single NAPI should be initialized.
> @@ -5352,7 +5364,11 @@ static int mvneta_resume(struct device *device)
> }
> }
> mvneta_defaults_set(pp);
> - mvneta_port_power_up(pp, pp->phy_interface);
> + err = mvneta_port_power_up(pp, pp->phy_interface);
> + if (err < 0) {
> + dev_err(device, "can't power up port\n");
> + return err;
> + }
>
> netif_device_attach(dev);
>
> --
> 2.27.0
--
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:[~2020-06-24 9:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 7:00 [PATCH 1/2] net: ethernet: mvneta: Do not error out in non serdes modes Sascha Hauer
2020-06-24 7:00 ` Sascha Hauer
2020-06-24 7:00 ` [PATCH 2/2] net: ethernet: mvneta: Add back interface mode validation Sascha Hauer
2020-06-24 7:00 ` Sascha Hauer
2020-06-24 9:55 ` Russell King - ARM Linux admin [this message]
2020-06-24 9:55 ` Russell King - ARM Linux admin
2020-06-24 21:48 ` David Miller
2020-06-24 21:48 ` David Miller
2020-06-24 9:53 ` [PATCH 1/2] net: ethernet: mvneta: Do not error out in non serdes modes Russell King - ARM Linux admin
2020-06-24 9:53 ` Russell King - ARM Linux admin
2020-06-24 21:48 ` David Miller
2020-06-24 21:48 ` David Miller
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=20200624095502.GZ1551@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=thomas.petazzoni@bootlin.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 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.