linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3 net] microchip: lan865x: Fix probing issues
@ 2025-08-11 15:48 Stefan Wahren
  2025-08-11 15:48 ` [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup Stefan Wahren
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stefan Wahren @ 2025-08-11 15:48 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-spi, netdev, Stefan Wahren

Recently I setup a customer i.MX93 board which contains a LAN8651 chip.
During this process I discovered some probing related issues.

Stefan Wahren (3):
  net: ethernet: oa_tc6: Handle failure of spi_setup
  microchip: lan865x: fix module autoloading
  microchip: lan865x: Fix LAN8651 autoloading

 drivers/net/ethernet/microchip/lan865x/lan865x.c | 6 ++++--
 drivers/net/ethernet/oa_tc6.c                    | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.34.1


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

* [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup
  2025-08-11 15:48 [PATCH 0/3 net] microchip: lan865x: Fix probing issues Stefan Wahren
@ 2025-08-11 15:48 ` Stefan Wahren
  2025-08-11 18:18   ` Andrew Lunn
  2025-08-11 15:48 ` [PATCH 2/3 net] microchip: lan865x: fix module autoloading Stefan Wahren
  2025-08-11 15:48 ` [PATCH 3/3 net] microchip: lan865x: Fix LAN8651 autoloading Stefan Wahren
  2 siblings, 1 reply; 7+ messages in thread
From: Stefan Wahren @ 2025-08-11 15:48 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-spi, netdev, Stefan Wahren

There is no guarantee that spi_setup succeed, so properly handle
the error case.

Fixes: aa58bec064ab ("net: ethernet: oa_tc6: implement register write operation")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/oa_tc6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
index db200e4ec284..91a906a7918a 100644
--- a/drivers/net/ethernet/oa_tc6.c
+++ b/drivers/net/ethernet/oa_tc6.c
@@ -1249,7 +1249,8 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
 
 	/* Set the SPI controller to pump at realtime priority */
 	tc6->spi->rt = true;
-	spi_setup(tc6->spi);
+	if (spi_setup(tc6->spi) < 0)
+		return NULL;
 
 	tc6->spi_ctrl_tx_buf = devm_kzalloc(&tc6->spi->dev,
 					    OA_TC6_CTRL_SPI_BUF_SIZE,
-- 
2.34.1


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

* [PATCH 2/3 net] microchip: lan865x: fix module autoloading
  2025-08-11 15:48 [PATCH 0/3 net] microchip: lan865x: Fix probing issues Stefan Wahren
  2025-08-11 15:48 ` [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup Stefan Wahren
@ 2025-08-11 15:48 ` Stefan Wahren
  2025-08-11 18:19   ` Andrew Lunn
  2025-08-11 15:48 ` [PATCH 3/3 net] microchip: lan865x: Fix LAN8651 autoloading Stefan Wahren
  2 siblings, 1 reply; 7+ messages in thread
From: Stefan Wahren @ 2025-08-11 15:48 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-spi, netdev, Stefan Wahren

Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from spi_device_id table. While at this, fix
the misleading variable name (spidev is unrelated to this driver).

Fixes: 5cd2340cb6a3 ("microchip: lan865x: add driver support for Microchip's LAN865X MAC-PHY")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/microchip/lan865x/lan865x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
index dd436bdff0f8..190122feb2a4 100644
--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
@@ -402,10 +402,11 @@ static void lan865x_remove(struct spi_device *spi)
 	free_netdev(priv->netdev);
 }
 
-static const struct spi_device_id spidev_spi_ids[] = {
+static const struct spi_device_id lan865x_ids[] = {
 	{ .name = "lan8650" },
 	{},
 };
+MODULE_DEVICE_TABLE(spi, lan865x_ids);
 
 static const struct of_device_id lan865x_dt_ids[] = {
 	{ .compatible = "microchip,lan8650" },
@@ -420,7 +421,7 @@ static struct spi_driver lan865x_driver = {
 	 },
 	.probe = lan865x_probe,
 	.remove = lan865x_remove,
-	.id_table = spidev_spi_ids,
+	.id_table = lan865x_ids,
 };
 module_spi_driver(lan865x_driver);
 
-- 
2.34.1


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

* [PATCH 3/3 net] microchip: lan865x: Fix LAN8651 autoloading
  2025-08-11 15:48 [PATCH 0/3 net] microchip: lan865x: Fix probing issues Stefan Wahren
  2025-08-11 15:48 ` [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup Stefan Wahren
  2025-08-11 15:48 ` [PATCH 2/3 net] microchip: lan865x: fix module autoloading Stefan Wahren
@ 2025-08-11 15:48 ` Stefan Wahren
  2025-08-11 18:22   ` Andrew Lunn
  2 siblings, 1 reply; 7+ messages in thread
From: Stefan Wahren @ 2025-08-11 15:48 UTC (permalink / raw)
  To: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-spi, netdev, Stefan Wahren

Add SPI ID for LAN8651 devices, which is also defined in the DT bindings.

Fixes: 5cd2340cb6a3 ("microchip: lan865x: add driver support for Microchip's LAN865X MAC-PHY")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/microchip/lan865x/lan865x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
index 190122feb2a4..bf2f8291d817 100644
--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
@@ -404,6 +404,7 @@ static void lan865x_remove(struct spi_device *spi)
 
 static const struct spi_device_id lan865x_ids[] = {
 	{ .name = "lan8650" },
+	{ .name = "lan8651" },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, lan865x_ids);
-- 
2.34.1


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

* Re: [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup
  2025-08-11 15:48 ` [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup Stefan Wahren
@ 2025-08-11 18:18   ` Andrew Lunn
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2025-08-11 18:18 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-spi, netdev

On Mon, Aug 11, 2025 at 05:48:56PM +0200, Stefan Wahren wrote:
> There is no guarantee that spi_setup succeed, so properly handle
> the error case.
> 
> Fixes: aa58bec064ab ("net: ethernet: oa_tc6: implement register write operation")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH 2/3 net] microchip: lan865x: fix module autoloading
  2025-08-11 15:48 ` [PATCH 2/3 net] microchip: lan865x: fix module autoloading Stefan Wahren
@ 2025-08-11 18:19   ` Andrew Lunn
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2025-08-11 18:19 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-spi, netdev

On Mon, Aug 11, 2025 at 05:48:57PM +0200, Stefan Wahren wrote:
> Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
> based on the alias from spi_device_id table. While at this, fix
> the misleading variable name (spidev is unrelated to this driver).
> 
> Fixes: 5cd2340cb6a3 ("microchip: lan865x: add driver support for Microchip's LAN865X MAC-PHY")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH 3/3 net] microchip: lan865x: Fix LAN8651 autoloading
  2025-08-11 15:48 ` [PATCH 3/3 net] microchip: lan865x: Fix LAN8651 autoloading Stefan Wahren
@ 2025-08-11 18:22   ` Andrew Lunn
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2025-08-11 18:22 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Parthiban Veerasooran, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-spi, netdev

On Mon, Aug 11, 2025 at 05:48:58PM +0200, Stefan Wahren wrote:
> Add SPI ID for LAN8651 devices, which is also defined in the DT bindings.

Maybe this patch should also add to lan865x_dt_ids[] ?

	Andrew

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

end of thread, other threads:[~2025-08-11 18:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 15:48 [PATCH 0/3 net] microchip: lan865x: Fix probing issues Stefan Wahren
2025-08-11 15:48 ` [PATCH 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup Stefan Wahren
2025-08-11 18:18   ` Andrew Lunn
2025-08-11 15:48 ` [PATCH 2/3 net] microchip: lan865x: fix module autoloading Stefan Wahren
2025-08-11 18:19   ` Andrew Lunn
2025-08-11 15:48 ` [PATCH 3/3 net] microchip: lan865x: Fix LAN8651 autoloading Stefan Wahren
2025-08-11 18:22   ` Andrew Lunn

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).