All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: Micrel eth switch: declare missing of table
@ 2019-04-22 19:08 Daniel Gomez
  2019-04-22 19:08 ` [PATCH 2/2] spi: ST ST95HF NFC: " Daniel Gomez
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Daniel Gomez @ 2019-04-22 19:08 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1; +Cc: davem, netdev, dagmcr, javier

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

Reported-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Daniel Gomez <dagmcr@gmail.com>
---
 drivers/net/phy/spi_ks8995.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c
index 92b64e2..7475cef 100644
--- a/drivers/net/phy/spi_ks8995.c
+++ b/drivers/net/phy/spi_ks8995.c
@@ -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,
-- 
2.7.4


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

* [PATCH 2/2] spi: ST ST95HF NFC: declare missing of table
  2019-04-22 19:08 [PATCH 1/2] spi: Micrel eth switch: declare missing of table Daniel Gomez
@ 2019-04-22 19:08 ` Daniel Gomez
  2019-04-23 17:45   ` David Miller
  2019-04-23  6:04 ` [PATCH 1/2] spi: Micrel eth switch: " Heiner Kallweit
  2019-04-23 17:45 ` David Miller
  2 siblings, 1 reply; 8+ messages in thread
From: Daniel Gomez @ 2019-04-22 19:08 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1; +Cc: davem, netdev, dagmcr, javier

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

Reported-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Daniel Gomez <dagmcr@gmail.com>
---
 drivers/nfc/st95hf/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 2b26f76..01acb6e 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -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,
-- 
2.7.4


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

* Re: [PATCH 1/2] spi: Micrel eth switch: declare missing of table
  2019-04-22 19:08 [PATCH 1/2] spi: Micrel eth switch: declare missing of table Daniel Gomez
  2019-04-22 19:08 ` [PATCH 2/2] spi: ST ST95HF NFC: " Daniel Gomez
@ 2019-04-23  6:04 ` Heiner Kallweit
  2019-04-23 12:28   ` Andrew Lunn
  2019-04-23 17:45 ` David Miller
  2 siblings, 1 reply; 8+ messages in thread
From: Heiner Kallweit @ 2019-04-23  6:04 UTC (permalink / raw)
  To: Daniel Gomez, andrew, f.fainelli
  Cc: davem, netdev, javier, linux-spi, Mark Brown

On 22.04.2019 21:08, Daniel Gomez wrote:
> 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
> 
> Reported-by: Javier Martinez Canillas <javier@dowhile0.org>
> Signed-off-by: Daniel Gomez <dagmcr@gmail.com>
> ---
>  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?

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

* Re: [PATCH 1/2] spi: Micrel eth switch: declare missing of table
  2019-04-23  6:04 ` [PATCH 1/2] spi: Micrel eth switch: " Heiner Kallweit
@ 2019-04-23 12:28   ` Andrew Lunn
  2019-04-23 17:33     ` Heiner Kallweit
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2019-04-23 12:28 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Daniel Gomez, f.fainelli, davem, netdev, javier, linux-spi, Mark Brown

> 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

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

* Re: [PATCH 1/2] spi: Micrel eth switch: declare missing of table
  2019-04-23 12:28   ` Andrew Lunn
@ 2019-04-23 17:33     ` Heiner Kallweit
  2019-04-25 18:04       ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Heiner Kallweit @ 2019-04-23 17:33 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Daniel Gomez, f.fainelli, davem, netdev, javier, linux-spi, Mark Brown

On 23.04.2019 14:28, Andrew Lunn wrote:
>> 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.
> 
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 ;)

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

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

* Re: [PATCH 1/2] spi: Micrel eth switch: declare missing of table
  2019-04-22 19:08 [PATCH 1/2] spi: Micrel eth switch: declare missing of table Daniel Gomez
  2019-04-22 19:08 ` [PATCH 2/2] spi: ST ST95HF NFC: " Daniel Gomez
  2019-04-23  6:04 ` [PATCH 1/2] spi: Micrel eth switch: " Heiner Kallweit
@ 2019-04-23 17:45 ` David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2019-04-23 17:45 UTC (permalink / raw)
  To: dagmcr; +Cc: andrew, f.fainelli, hkallweit1, netdev, javier

From: Daniel Gomez <dagmcr@gmail.com>
Date: Mon, 22 Apr 2019 21:08:03 +0200

> 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
> 
> Reported-by: Javier Martinez Canillas <javier@dowhile0.org>
> Signed-off-by: Daniel Gomez <dagmcr@gmail.com>

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

Applied.

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

* Re: [PATCH 2/2] spi: ST ST95HF NFC: declare missing of table
  2019-04-22 19:08 ` [PATCH 2/2] spi: ST ST95HF NFC: " Daniel Gomez
@ 2019-04-23 17:45   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2019-04-23 17:45 UTC (permalink / raw)
  To: dagmcr; +Cc: andrew, f.fainelli, hkallweit1, netdev, javier

From: Daniel Gomez <dagmcr@gmail.com>
Date: Mon, 22 Apr 2019 21:08:04 +0200

> 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
> 
> Reported-by: Javier Martinez Canillas <javier@dowhile0.org>
> Signed-off-by: Daniel Gomez <dagmcr@gmail.com>

Applied.

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

* Re: [PATCH 1/2] spi: Micrel eth switch: declare missing of table
  2019-04-23 17:33     ` Heiner Kallweit
@ 2019-04-25 18:04       ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-04-25 18:04 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Andrew Lunn, Daniel Gomez, f.fainelli, davem, netdev, javier, linux-spi

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

On Tue, Apr 23, 2019 at 07:33:10PM +0200, Heiner Kallweit wrote:

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 19:08 [PATCH 1/2] spi: Micrel eth switch: declare missing of table Daniel Gomez
2019-04-22 19:08 ` [PATCH 2/2] spi: ST ST95HF NFC: " Daniel Gomez
2019-04-23 17:45   ` David Miller
2019-04-23  6:04 ` [PATCH 1/2] spi: Micrel eth switch: " Heiner Kallweit
2019-04-23 12:28   ` Andrew Lunn
2019-04-23 17:33     ` Heiner Kallweit
2019-04-25 18:04       ` Mark Brown
2019-04-23 17:45 ` David Miller

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.