Skip to contentSkip to conversation

spi: Micrel eth switch: declare missing of table

PATCH Applied Daniel Gomez 5 participants 8 messages Apr 22, 2019 – Apr 25, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 spi: Micrel eth switch: declare missing of table

Add missing <of_device_id> table for SPI driver relying on SPI device match since compatible is in a DT binding or in a DTS.

Before this patch:
modinfo drivers/net/phy/spi_ks8995.ko | grep alias

alias:          spi:ksz8795
alias:          spi:ksz8864
alias:          spi:ks8995

After this patch:
modinfo drivers/net/phy/spi_ks8995.ko | grep alias

alias:          spi:ksz8795
alias:          spi:ksz8864
alias:          spi:ks8995
alias:          of:N*T*Cmicrel,ksz8795C*
alias:          of:N*T*Cmicrel,ksz8795
alias:          of:N*T*Cmicrel,ksz8864C*
alias:          of:N*T*Cmicrel,ksz8864
alias:          of:N*T*Cmicrel,ks8995C*
alias:          of:N*T*Cmicrel,ks8995
---
 drivers/net/phy/spi_ks8995.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/phy/spi_ks8995.c +9 -0
index 92b64e2..7475cef 100644
@@ -159,6 +159,14 @@ static const struct spi_device_id ks8995_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, ks8995_id);
 
+static const struct of_device_id ks8895_spi_of_match[] = {
+        { .compatible = "micrel,ks8995" },
+        { .compatible = "micrel,ksz8864" },
+        { .compatible = "micrel,ksz8795" },
+        { },
+ };
+MODULE_DEVICE_TABLE(of, ks8895_spi_of_match);
+
 static inline u8 get_chip_id(u8 val)
 {
 	return (val >> ID1_CHIPID_S) & ID1_CHIPID_M;
@@ -526,6 +534,7 @@ static int ks8995_remove(struct spi_device *spi)
 static struct spi_driver ks8995_driver = {
 	.driver = {
 		.name	    = "spi-ks8995",
+		.of_match_table = of_match_ptr(ks8895_spi_of_match),
 	},
 	.probe	  = ks8995_probe,
 	.remove	  = ks8995_remove,
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 spi: ST ST95HF NFC: declare missing of table

Add missing <of_device_id> table for SPI driver relying on SPI device match since compatible is in a DT binding or in a DTS.

Before this patch:
modinfo drivers/nfc/st95hf/st95hf.ko | grep alias
alias: spi:st95hf

After this patch:
modinfo drivers/nfc/st95hf/st95hf.ko | grep alias

alias:          spi:st95hf
alias:          of:N*T*Cst,st95hfC*
alias:          of:N*T*Cst,st95hf
---
 drivers/nfc/st95hf/core.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nfc/st95hf/core.c +7 -0
index 2b26f76..01acb6e 100644
@@ -1074,6 +1074,12 @@ static const struct spi_device_id st95hf_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, st95hf_id);
 
+static const struct of_device_id st95hf_spi_of_match[] = {
+        { .compatible = "st,st95hf" },
+        { },
+};
+MODULE_DEVICE_TABLE(of, st95hf_spi_of_match);
+
 static int st95hf_probe(struct spi_device *nfc_spi_dev)
 {
 	int ret;
@@ -1260,6 +1266,7 @@ static struct spi_driver st95hf_driver = {
 	.driver = {
 		.name = "st95hf",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(st95hf_spi_of_match),
 	},
 	.id_table = st95hf_id,
 	.probe = st95hf_probe,
Signature · 1 line
2.7.4
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] spi: ST ST95HF NFC: declare missing of table

From: Daniel Gomez <[email protected]>
Date: Mon, 22 Apr 2019 21:08:04 +0200

Quoted 7 lines

Add missing <of_device_id> table for SPI driver relying on SPI device match since compatible is in a DT binding or in a DTS.

Before this patch:
modinfo drivers/nfc/st95hf/st95hf.ko | grep alias
alias: spi:st95hf

Quoted 8 lines

After this patch:
modinfo drivers/nfc/st95hf/st95hf.ko | grep alias

alias:          spi:st95hf
alias:          of:N*T*Cst,st95hfC*
alias:          of:N*T*Cst,st95hf

Applied.

maintainer
#3 lore raw
In reply to Daniel Gomez
Quoted 21 lines · Daniel Gomez

Add missing <of_device_id> table for SPI driver relying on SPI device match since compatible is in a DT binding or in a DTS.

Before this patch:
modinfo drivers/net/phy/spi_ks8995.ko | grep alias

alias:          spi:ksz8795
alias:          spi:ksz8864
alias:          spi:ks8995

After this patch:
modinfo drivers/net/phy/spi_ks8995.ko | grep alias

alias:          spi:ksz8795
alias:          spi:ksz8864
alias:          spi:ks8995
alias:          of:N*T*Cmicrel,ksz8795C*
alias:          of:N*T*Cmicrel,ksz8795
alias:          of:N*T*Cmicrel,ksz8864C*
alias:          of:N*T*Cmicrel,ksz8864
alias:          of:N*T*Cmicrel,ks8995C*
alias:          of:N*T*Cmicrel,ks8995
Quoted 6 lines
---
 drivers/net/phy/spi_ks8995.c | 9 +++++++++
 1 file changed, 9 insertions(+)

I wonder why this SPI driver is under drivers/net/phy. Just because the SPI IP is found on an ethernet switch chip? And even then it would be wrong, I see no link to a PHY at all. I'd say the driver belongs to drivers/spi. Shouldn't we move it?

maintainer
#4 lore raw
Quoted 4 lines

I wonder why this SPI driver is under drivers/net/phy. Just because the SPI IP is found on an ethernet switch chip? And even then it would be wrong, I see no link to a PHY at all. I'd say the driver belongs to drivers/spi. Shouldn't we move it?

This driver is old. It is probably from before the time of DSA. At least in the OpenWRT world, switches have been thought of as PHY devices, since they connect to a MAC. All the OpenWRT switch drivers are in the phy directory.

There is no good place for this. It is not a PHY, but it is a network driver so should be somewhere under driver/net. There are no other net drivers in driver/spi, etc.

Since there is not a good place for it, not moving it is the easiest thing to do.

Andrew

maintainer
#5 lore raw
Quoted 5 lines · Andrew Lunn
Quoted 4 lines

I wonder why this SPI driver is under drivers/net/phy. Just because the SPI IP is found on an ethernet switch chip? And even then it would be wrong, I see no link to a PHY at all. I'd say the driver belongs to drivers/spi. Shouldn't we move it?

Quoted 9 lines

This driver is old. It is probably from before the time of DSA. At least in the OpenWRT world, switches have been thought of as PHY devices, since they connect to a MAC. All the OpenWRT switch drivers are in the phy directory.

There is no good place for this. It is not a PHY, but it is a network driver so should be somewhere under driver/net. There are no other net drivers in driver/spi, etc.

Except having "switch" in the name this driver is solely a SPI driver and it uses no network code at all. And it has no dependency on any network driver. Therefore I wouldn't consider it a network driver. Else any functionality found on a SoC would need to be under drivers/soc ;)

Quoted 5 lines

Since there is not a good place for it, not moving it is the easiest thing to do.

Andrew

Heiner

maintainer
#6 lore raw
Quoted 4 lines · Heiner Kallweit

Except having "switch" in the name this driver is solely a SPI driver and it uses no network code at all. And it has no dependency on any network driver. Therefore I wouldn't consider it a network driver. Else any functionality found on a SoC would need to be under drivers/soc ;)

Not seen the code here but what Heiner says makes sense to me - note also that we did at some point add some network framework support for ethernet switch chips so the device end of the SPI link should be supportable via standard frameworks now.

maintainer Applied
#7 lore raw
In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>
Date: Mon, 22 Apr 2019 21:08:03 +0200

Quoted 21 lines

Add missing <of_device_id> table for SPI driver relying on SPI device match since compatible is in a DT binding or in a DTS.

Before this patch:
modinfo drivers/net/phy/spi_ks8995.ko | grep alias

alias:          spi:ksz8795
alias:          spi:ksz8864
alias:          spi:ks8995

After this patch:
modinfo drivers/net/phy/spi_ks8995.ko | grep alias

alias:          spi:ksz8795
alias:          spi:ksz8864
alias:          spi:ks8995
alias:          of:N*T*Cmicrel,ksz8795C*
alias:          of:N*T*Cmicrel,ksz8795
alias:          of:N*T*Cmicrel,ksz8864C*
alias:          of:N*T*Cmicrel,ksz8864
alias:          of:N*T*Cmicrel,ks8995C*
alias:          of:N*T*Cmicrel,ks8995
Quoted 2 lines

The discussion of where these drivers should really live is interesting, but these two changes are valid so I am applying them.

Applied.