xref: /openbmc/linux/drivers/net/dsa/lan9303.h (revision 10b62a2f)
1 #include <linux/regmap.h>
2 #include <linux/device.h>
3 #include <net/dsa.h>
4 
5 struct lan9303;
6 
7 struct lan9303_phy_ops {
8 	/* PHY 1 and 2 access*/
9 	int	(*phy_read)(struct lan9303 *chip, int port, int regnum);
10 	int	(*phy_write)(struct lan9303 *chip, int port,
11 			     int regnum, u16 val);
12 };
13 
14 struct lan9303 {
15 	struct device *dev;
16 	struct regmap *regmap;
17 	struct regmap_irq_chip_data *irq_data;
18 	struct gpio_desc *reset_gpio;
19 	u32 reset_duration; /* in [ms] */
20 	bool phy_addr_sel_strap;
21 	struct dsa_switch *ds;
22 	struct mutex indirect_mutex; /* protect indexed register access */
23 	const struct lan9303_phy_ops *ops;
24 };
25 
26 extern const struct regmap_access_table lan9303_register_set;
27 extern const struct lan9303_phy_ops lan9303_indirect_phy_ops;
28 
29 int lan9303_probe(struct lan9303 *chip, struct device_node *np);
30 int lan9303_remove(struct lan9303 *chip);
31