linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled
@ 2020-05-04 16:52 Michael Walle
  2020-05-04 17:47 ` Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Walle @ 2020-05-04 16:52 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, netdev
  Cc: David S . Miller, Florian Fainelli, Vivien Didelot, Andrew Lunn,
	Claudiu Manoil, Vladimir Oltean, Shawn Guo, Michael Walle

If there is no specific configuration of the felix switch in the device
tree, but only the default configuration (ie. given by the SoCs dtsi
file), the probe fails because no CPU port has been set. On the other
hand you cannot set a default CPU port because that depends on the
actual board using the switch.

[    2.701300] DSA: tree 0 has no CPU port
[    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22

Thus let the device tree disable this device entirely, like it is also
done with the enetc driver of the same SoC.

Signed-off-by: Michael Walle <michael@walle.cc>
---
This was part of a two patch series. The second patch is already merged.
This patch was never picked up, although it was Acked-by: David Miller,
see:
https://lore.kernel.org/netdev/20200314.205335.907987569817755804.davem@davemloft.net/

Since there is no more dependency, this patch could go through the
net-next queue.

 drivers/net/dsa/ocelot/felix.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 69546383a382..531c7710063f 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -699,6 +699,11 @@ static int felix_pci_probe(struct pci_dev *pdev,
 	struct felix *felix;
 	int err;
 
+	if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
+		dev_info(&pdev->dev, "device is disabled, skipping\n");
+		return -ENODEV;
+	}
+
 	err = pci_enable_device(pdev);
 	if (err) {
 		dev_err(&pdev->dev, "device enable failed\n");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled
  2020-05-04 16:52 [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled Michael Walle
@ 2020-05-04 17:47 ` Vladimir Oltean
  2020-05-04 17:48 ` Florian Fainelli
  2020-05-04 18:16 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2020-05-04 17:47 UTC (permalink / raw)
  To: Michael Walle
  Cc: moderated list:ARM/Mediatek SoC support, lkml, netdev,
	David S . Miller, Florian Fainelli, Vivien Didelot, Andrew Lunn,
	Claudiu Manoil, Vladimir Oltean, Shawn Guo

On Mon, 4 May 2020 at 19:55, Michael Walle <michael@walle.cc> wrote:
>
> If there is no specific configuration of the felix switch in the device
> tree, but only the default configuration (ie. given by the SoCs dtsi
> file), the probe fails because no CPU port has been set. On the other
> hand you cannot set a default CPU port because that depends on the
> actual board using the switch.
>
> [    2.701300] DSA: tree 0 has no CPU port
> [    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
> [    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22
>
> Thus let the device tree disable this device entirely, like it is also
> done with the enetc driver of the same SoC.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

> This was part of a two patch series. The second patch is already merged.
> This patch was never picked up, although it was Acked-by: David Miller,
> see:
> https://lore.kernel.org/netdev/20200314.205335.907987569817755804.davem@davemloft.net/
>
> Since there is no more dependency, this patch could go through the
> net-next queue.
>
>  drivers/net/dsa/ocelot/felix.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
> index 69546383a382..531c7710063f 100644
> --- a/drivers/net/dsa/ocelot/felix.c
> +++ b/drivers/net/dsa/ocelot/felix.c
> @@ -699,6 +699,11 @@ static int felix_pci_probe(struct pci_dev *pdev,
>         struct felix *felix;
>         int err;
>
> +       if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
> +               dev_info(&pdev->dev, "device is disabled, skipping\n");
> +               return -ENODEV;
> +       }
> +
>         err = pci_enable_device(pdev);
>         if (err) {
>                 dev_err(&pdev->dev, "device enable failed\n");
> --
> 2.20.1
>

Thanks, Michael!
-Vladimir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled
  2020-05-04 16:52 [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled Michael Walle
  2020-05-04 17:47 ` Vladimir Oltean
@ 2020-05-04 17:48 ` Florian Fainelli
  2020-05-04 18:16 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2020-05-04 17:48 UTC (permalink / raw)
  To: Michael Walle, linux-arm-kernel, linux-kernel, netdev
  Cc: David S . Miller, Vivien Didelot, Andrew Lunn, Claudiu Manoil,
	Vladimir Oltean, Shawn Guo



On 5/4/2020 9:52 AM, Michael Walle wrote:
> If there is no specific configuration of the felix switch in the device
> tree, but only the default configuration (ie. given by the SoCs dtsi
> file), the probe fails because no CPU port has been set. On the other
> hand you cannot set a default CPU port because that depends on the
> actual board using the switch.
> 
> [    2.701300] DSA: tree 0 has no CPU port
> [    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
> [    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22
> 
> Thus let the device tree disable this device entirely, like it is also
> done with the enetc driver of the same SoC.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled
  2020-05-04 16:52 [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled Michael Walle
  2020-05-04 17:47 ` Vladimir Oltean
  2020-05-04 17:48 ` Florian Fainelli
@ 2020-05-04 18:16 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-04 18:16 UTC (permalink / raw)
  To: michael
  Cc: linux-arm-kernel, linux-kernel, netdev, f.fainelli,
	vivien.didelot, andrew, claudiu.manoil, vladimir.oltean,
	shawnguo

From: Michael Walle <michael@walle.cc>
Date: Mon,  4 May 2020 18:52:28 +0200

> If there is no specific configuration of the felix switch in the device
> tree, but only the default configuration (ie. given by the SoCs dtsi
> file), the probe fails because no CPU port has been set. On the other
> hand you cannot set a default CPU port because that depends on the
> actual board using the switch.
> 
> [    2.701300] DSA: tree 0 has no CPU port
> [    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
> [    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22
> 
> Thus let the device tree disable this device entirely, like it is also
> done with the enetc driver of the same SoC.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-04 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 16:52 [PATCH RESEND net-next] net: dsa: felix: allow the device to be disabled Michael Walle
2020-05-04 17:47 ` Vladimir Oltean
2020-05-04 17:48 ` Florian Fainelli
2020-05-04 18:16 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).