David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #include <linux/device.h> |
| 3 | #include <linux/etherdevice.h> |
| 4 | #include <linux/gpio/driver.h> |
| 5 | |
| 6 | /** |
| 7 | * struct vsc73xx - VSC73xx state container |
| 8 | */ |
| 9 | struct vsc73xx { |
| 10 | struct device *dev; |
| 11 | struct gpio_desc *reset; |
| 12 | struct dsa_switch *ds; |
| 13 | struct gpio_chip gc; |
| 14 | u16 chipid; |
| 15 | u8 addr[ETH_ALEN]; |
| 16 | const struct vsc73xx_ops *ops; |
| 17 | void *priv; |
| 18 | }; |
| 19 | |
| 20 | struct vsc73xx_ops { |
| 21 | int (*read)(struct vsc73xx *vsc, u8 block, u8 subblock, u8 reg, |
| 22 | u32 *val); |
| 23 | int (*write)(struct vsc73xx *vsc, u8 block, u8 subblock, u8 reg, |
| 24 | u32 val); |
| 25 | }; |
| 26 | |
| 27 | int vsc73xx_is_addr_valid(u8 block, u8 subblock); |
| 28 | int vsc73xx_probe(struct vsc73xx *vsc); |
| 29 | int vsc73xx_remove(struct vsc73xx *vsc); |