swconfig: add (PHY) generic helper setting port link
[openwrt/openwrt.git] / target / linux / generic / files / include / linux / switch.h
index 42913645629a401724f2cba511b5e31f7185d714..0c4cce7fa5ba0d3590b75d3c298ce1444207e0b4 100644 (file)
@@ -95,8 +95,13 @@ struct switch_dev_ops {
 
        int (*get_port_link)(struct switch_dev *dev, int port,
                             struct switch_port_link *link);
+       int (*set_port_link)(struct switch_dev *dev, int port,
+                            struct switch_port_link *link);
        int (*get_port_stats)(struct switch_dev *dev, int port,
                              struct switch_port_stats *stats);
+
+       int (*phy_read16)(struct switch_dev *dev, int addr, u8 reg, u16 *value);
+       int (*phy_write16)(struct switch_dev *dev, int addr, u8 reg, u16 value);
 };
 
 struct switch_dev {
@@ -122,6 +127,7 @@ struct switch_dev {
        struct mutex sw_mutex;
        struct switch_port *portbuf;
        struct switch_portmap *portmap;
+       struct switch_port_link linkbuf;
 
        char buf[128];
 
@@ -148,6 +154,7 @@ struct switch_val {
                const char *s;
                u32 i;
                struct switch_port *ports;
+               struct switch_port_link *link;
        } value;
 };
 
@@ -166,4 +173,7 @@ struct switch_attr {
        int max;
 };
 
+int switch_generic_set_link(struct switch_dev *dev, int port,
+                           struct switch_port_link *link);
+
 #endif /* _LINUX_SWITCH_H */