* [PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function
[not found] <93AF473E2DA327428DE3D46B72B1E9FD411218F4@CHN-SV-EXMX02.mchp-main.com>
@ 2017-09-07 21:09 ` Tristram.Ha
2017-09-07 21:40 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Tristram.Ha @ 2017-09-07 21:09 UTC (permalink / raw)
To: andrew, muvarov, pavel, nathan.leigh.conrad, vivien.didelot,
f.fainelli, netdev, linux-kernel, Woojung.Huh
From: Tristram Ha <Tristram.Ha@microchip.com>
SPI driver calls own specific switch register function.
Shutdown callback function is added to reset switch to default state.
Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
---
diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
index c519469..d03eb83 100644
--- a/drivers/net/dsa/microchip/ksz_spi.c
+++ b/drivers/net/dsa/microchip/ksz_spi.c
@@ -25,6 +25,8 @@
#include "ksz_priv.h"
+int ksz9477_switch_register(struct ksz_device *dev);
+
/* SPI frame opcodes */
#define KS_SPIOP_RD 3
#define KS_SPIOP_WR 2
@@ -174,7 +176,7 @@ static int ksz_spi_probe(struct spi_device *spi)
if (spi->dev.platform_data)
dev->pdata = spi->dev.platform_data;
- ret = ksz_switch_register(dev);
+ ret = ksz9477_switch_register(dev);
if (ret)
return ret;
@@ -193,6 +195,14 @@ static int ksz_spi_remove(struct spi_device *spi)
return 0;
}
+static void ksz_spi_shutdown(struct spi_device *spi) {
+ struct ksz_device *dev = spi_get_drvdata(spi);
+
+ if (dev)
+ dev->dev_ops->reset(dev);
+}
+
static const struct of_device_id ksz_dt_ids[] = {
{ .compatible = "microchip,ksz9477" },
{},
@@ -207,6 +217,7 @@ static int ksz_spi_remove(struct spi_device *spi)
},
.probe = ksz_spi_probe,
.remove = ksz_spi_remove,
+ .shutdown = ksz_spi_shutdown,
};
module_spi_driver(ksz_spi_driver);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function
2017-09-07 21:09 ` [PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function Tristram.Ha
@ 2017-09-07 21:40 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2017-09-07 21:40 UTC (permalink / raw)
To: Tristram.Ha
Cc: muvarov, pavel, nathan.leigh.conrad, vivien.didelot, f.fainelli,
netdev, linux-kernel, Woojung.Huh
On Thu, Sep 07, 2017 at 09:09:22PM +0000, Tristram.Ha@microchip.com wrote:
> From: Tristram Ha <Tristram.Ha@microchip.com>
>
> SPI driver calls own specific switch register function.
> Shutdown callback function is added to reset switch to default state.
>
> Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
> ---
> diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
> index c519469..d03eb83 100644
> --- a/drivers/net/dsa/microchip/ksz_spi.c
> +++ b/drivers/net/dsa/microchip/ksz_spi.c
> @@ -25,6 +25,8 @@
>
> #include "ksz_priv.h"
>
> +int ksz9477_switch_register(struct ksz_device *dev);
Hi Tristram
This should be placed in a header file somewhere, not here.
> +static void ksz_spi_shutdown(struct spi_device *spi) {
> + struct ksz_device *dev = spi_get_drvdata(spi);
> +
> + if (dev)
> + dev->dev_ops->reset(dev);
shutdown seems like a better name for this op, not reset.
> +}
> +
> static const struct of_device_id ksz_dt_ids[] = {
> { .compatible = "microchip,ksz9477" },
> {},
> @@ -207,6 +217,7 @@ static int ksz_spi_remove(struct spi_device *spi)
> },
> .probe = ksz_spi_probe,
> .remove = ksz_spi_remove,
> + .shutdown = ksz_spi_shutdown,
> };
>
> module_spi_driver(ksz_spi_driver);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-07 21:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <93AF473E2DA327428DE3D46B72B1E9FD411218F4@CHN-SV-EXMX02.mchp-main.com>
2017-09-07 21:09 ` [PATCH RFC 5/6] Switch SPI driver calls its own driver switch register function Tristram.Ha
2017-09-07 21:40 ` 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).