diff options
author | Pawel Dembicki <paweldembicki@gmail.com> | 2019-07-05 00:29:05 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-07 23:16:32 +0200 |
commit | 95711cd5f0b4b0394f2e0c30fdd99b853317ed49 (patch) | |
tree | 65050561813d6b554f3bdeb2e2c4d58ffcda3eb3 /drivers/net/dsa/vitesse-vsc73xx.h | |
parent | net: dsa: Change DT bindings for Vitesse VSC73xx switches (diff) | |
download | linux-95711cd5f0b4b0394f2e0c30fdd99b853317ed49.tar.xz linux-95711cd5f0b4b0394f2e0c30fdd99b853317ed49.zip |
net: dsa: vsc73xx: Split vsc73xx driver
This driver (currently) only takes control of the switch chip over
SPI and configures it to route packages around when connected to a
CPU port. But Vitesse chip support also parallel interface.
This patch split driver into two parts: core and spi. It is required
for add support to another managing interface.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/vitesse-vsc73xx.h')
-rw-r--r-- | drivers/net/dsa/vitesse-vsc73xx.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/dsa/vitesse-vsc73xx.h b/drivers/net/dsa/vitesse-vsc73xx.h new file mode 100644 index 000000000000..7478f8d4e0a9 --- /dev/null +++ b/drivers/net/dsa/vitesse-vsc73xx.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include <linux/device.h> +#include <linux/etherdevice.h> +#include <linux/gpio/driver.h> + +/** + * struct vsc73xx - VSC73xx state container + */ +struct vsc73xx { + struct device *dev; + struct gpio_desc *reset; + struct dsa_switch *ds; + struct gpio_chip gc; + u16 chipid; + u8 addr[ETH_ALEN]; + const struct vsc73xx_ops *ops; + void *priv; +}; + +struct vsc73xx_ops { + int (*read)(struct vsc73xx *vsc, u8 block, u8 subblock, u8 reg, + u32 *val); + int (*write)(struct vsc73xx *vsc, u8 block, u8 subblock, u8 reg, + u32 val); +}; + +int vsc73xx_is_addr_valid(u8 block, u8 subblock); +int vsc73xx_probe(struct vsc73xx *vsc); +int vsc73xx_remove(struct vsc73xx *vsc); |