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