net: qca_spi: Move reset_count to struct qcaspi
authorStefan Wahren <stefan.wahren@in-tech.com>
Wed, 20 Nov 2019 17:29:13 +0000 (18:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:24:34 +0000 (10:24 +0100)
[ Upstream commit bc19c32904e36548335b35fdce6ce734e20afc0a ]

The reset counter is specific for every QCA700x chip. So move this
into the private driver struct. Otherwise we get unpredictable reset
behavior in setups with multiple QCA700x chips.

Fixes: 291ab06ecf67 (net: qualcomm: new Ethernet over SPI driver for QCA7000)
Signed-off-by: Stefan Wahren <stefan.wahren@in-tech.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/qualcomm/qca_spi.c
drivers/net/ethernet/qualcomm/qca_spi.h

index 21f5465..31583d6 100644 (file)
@@ -438,7 +438,6 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event)
        u16 signature = 0;
        u16 spi_config;
        u16 wrbuf_space = 0;
-       static u16 reset_count;
 
        if (event == QCASPI_EVENT_CPUON) {
                /* Read signature twice, if not valid
@@ -491,13 +490,13 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event)
 
                qca->sync = QCASPI_SYNC_RESET;
                qca->stats.trig_reset++;
-               reset_count = 0;
+               qca->reset_count = 0;
                break;
        case QCASPI_SYNC_RESET:
-               reset_count++;
+               qca->reset_count++;
                netdev_dbg(qca->net_dev, "sync: waiting for CPU on, count %u.\n",
-                          reset_count);
-               if (reset_count >= QCASPI_RESET_TIMEOUT) {
+                          qca->reset_count);
+               if (qca->reset_count >= QCASPI_RESET_TIMEOUT) {
                        /* reset did not seem to take place, try again */
                        qca->sync = QCASPI_SYNC_UNKNOWN;
                        qca->stats.reset_timeout++;
index 6e31a0e..c48c314 100644 (file)
@@ -97,6 +97,7 @@ struct qcaspi {
 
        unsigned int intr_req;
        unsigned int intr_svc;
+       u16 reset_count;
 
 #ifdef CONFIG_DEBUG_FS
        struct dentry *device_root;