* [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues
@ 2024-12-06 18:46 Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 1/2] qca_spi: Fix clock speed for multiple QCA7000 Stefan Wahren
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Wahren @ 2024-12-06 18:46 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: chf.fritz, netdev, linux-kernel, Stefan Wahren
This small series address two annoying SPI specific issues of
the qca_spi driver.
Changes in V2:
- drop member clkspeed from struct qcaspi as suggested by Jakub Kicinski
- add new patch "Make driver probing reliable"
Stefan Wahren (2):
qca_spi: Fix clock speed for multiple QCA7000
qca_spi: Make driver probing reliable
drivers/net/ethernet/qualcomm/qca_spi.c | 26 +++++++++++--------------
drivers/net/ethernet/qualcomm/qca_spi.h | 1 -
2 files changed, 11 insertions(+), 16 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2 net 1/2] qca_spi: Fix clock speed for multiple QCA7000
2024-12-06 18:46 [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Stefan Wahren
@ 2024-12-06 18:46 ` Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 2/2] qca_spi: Make driver probing reliable Stefan Wahren
2024-12-10 14:40 ` [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Paolo Abeni
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Wahren @ 2024-12-06 18:46 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: chf.fritz, netdev, linux-kernel, Stefan Wahren
Storing the maximum clock speed in module parameter qcaspi_clkspeed
has the unintended side effect that the first probed instance
defines the value for all other instances. Fix this issue by storing
it in max_speed_hz of the relevant SPI device.
This fix keeps the priority of the speed parameter (module parameter,
device tree property, driver default). Btw this uses the opportunity
to get the rid of the unused member clkspeed.
Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/net/ethernet/qualcomm/qca_spi.c | 24 ++++++++++--------------
drivers/net/ethernet/qualcomm/qca_spi.h | 1 -
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index ef9c02b000e4..d328e770bcbe 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -818,7 +818,6 @@ qcaspi_netdev_init(struct net_device *dev)
dev->mtu = QCAFRM_MAX_MTU;
dev->type = ARPHRD_ETHER;
- qca->clkspeed = qcaspi_clkspeed;
qca->burst_len = qcaspi_burst_len;
qca->spi_thread = NULL;
qca->buffer_size = (QCAFRM_MAX_MTU + VLAN_ETH_HLEN + QCAFRM_HEADER_LEN +
@@ -909,17 +908,15 @@ qca_spi_probe(struct spi_device *spi)
legacy_mode = of_property_read_bool(spi->dev.of_node,
"qca,legacy-mode");
- if (qcaspi_clkspeed == 0) {
- if (spi->max_speed_hz)
- qcaspi_clkspeed = spi->max_speed_hz;
- else
- qcaspi_clkspeed = QCASPI_CLK_SPEED;
- }
+ if (qcaspi_clkspeed)
+ spi->max_speed_hz = qcaspi_clkspeed;
+ else if (!spi->max_speed_hz)
+ spi->max_speed_hz = QCASPI_CLK_SPEED;
- if ((qcaspi_clkspeed < QCASPI_CLK_SPEED_MIN) ||
- (qcaspi_clkspeed > QCASPI_CLK_SPEED_MAX)) {
- dev_err(&spi->dev, "Invalid clkspeed: %d\n",
- qcaspi_clkspeed);
+ if (spi->max_speed_hz < QCASPI_CLK_SPEED_MIN ||
+ spi->max_speed_hz > QCASPI_CLK_SPEED_MAX) {
+ dev_err(&spi->dev, "Invalid clkspeed: %u\n",
+ spi->max_speed_hz);
return -EINVAL;
}
@@ -944,14 +941,13 @@ qca_spi_probe(struct spi_device *spi)
return -EINVAL;
}
- dev_info(&spi->dev, "ver=%s, clkspeed=%d, burst_len=%d, pluggable=%d\n",
+ dev_info(&spi->dev, "ver=%s, clkspeed=%u, burst_len=%d, pluggable=%d\n",
QCASPI_DRV_VERSION,
- qcaspi_clkspeed,
+ spi->max_speed_hz,
qcaspi_burst_len,
qcaspi_pluggable);
spi->mode = SPI_MODE_3;
- spi->max_speed_hz = qcaspi_clkspeed;
if (spi_setup(spi) < 0) {
dev_err(&spi->dev, "Unable to setup SPI device\n");
return -EFAULT;
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h
index 7ba5c9e2f61c..90b290f94c27 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.h
+++ b/drivers/net/ethernet/qualcomm/qca_spi.h
@@ -89,7 +89,6 @@ struct qcaspi {
#endif
/* user configurable options */
- u32 clkspeed;
u8 legacy_mode;
u16 burst_len;
};
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2 net 2/2] qca_spi: Make driver probing reliable
2024-12-06 18:46 [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 1/2] qca_spi: Fix clock speed for multiple QCA7000 Stefan Wahren
@ 2024-12-06 18:46 ` Stefan Wahren
2024-12-10 14:40 ` [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Paolo Abeni
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Wahren @ 2024-12-06 18:46 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: chf.fritz, netdev, linux-kernel, Stefan Wahren
The module parameter qcaspi_pluggable controls if QCA7000 signature
should be checked at driver probe (current default) or not. Unfortunately
this could fail in case the chip is temporary in reset, which isn't under
total control by the Linux host. So disable this check per default
in order to avoid unexpected probe failures.
Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/net/ethernet/qualcomm/qca_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index d328e770bcbe..38a779f4b866 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(qcaspi_burst_len, "Number of data bytes per burst. Use 1-5000."
#define QCASPI_PLUGGABLE_MIN 0
#define QCASPI_PLUGGABLE_MAX 1
-static int qcaspi_pluggable = QCASPI_PLUGGABLE_MIN;
+static int qcaspi_pluggable = QCASPI_PLUGGABLE_MAX;
module_param(qcaspi_pluggable, int, 0);
MODULE_PARM_DESC(qcaspi_pluggable, "Pluggable SPI connection (yes/no).");
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues
2024-12-06 18:46 [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 1/2] qca_spi: Fix clock speed for multiple QCA7000 Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 2/2] qca_spi: Make driver probing reliable Stefan Wahren
@ 2024-12-10 14:40 ` Paolo Abeni
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2024-12-10 14:40 UTC (permalink / raw)
To: Stefan Wahren, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski
Cc: chf.fritz, netdev, linux-kernel
On 12/6/24 19:46, Stefan Wahren wrote:
> This small series address two annoying SPI specific issues of
> the qca_spi driver.
>
> Changes in V2:
> - drop member clkspeed from struct qcaspi as suggested by Jakub Kicinski
> - add new patch "Make driver probing reliable"
>
> Stefan Wahren (2):
> qca_spi: Fix clock speed for multiple QCA7000
> qca_spi: Make driver probing reliable
>
> drivers/net/ethernet/qualcomm/qca_spi.c | 26 +++++++++++--------------
> drivers/net/ethernet/qualcomm/qca_spi.h | 1 -
> 2 files changed, 11 insertions(+), 16 deletions(-)
Even if the bot did not notice, this has been applied by Jakub.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-10 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-06 18:46 [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 1/2] qca_spi: Fix clock speed for multiple QCA7000 Stefan Wahren
2024-12-06 18:46 ` [PATCH V2 net 2/2] qca_spi: Make driver probing reliable Stefan Wahren
2024-12-10 14:40 ` [PATCH V2 net 0/2] qca_spi: Fix SPI specific issues Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®