Back to home page

OSCL-LXR

 
 

    


0001 /* Included by drivers/net/dsa/lan9303.h and net/dsa/tag_lan9303.c */
0002 #include <linux/if_ether.h>
0003 
0004 struct lan9303;
0005 
0006 struct lan9303_phy_ops {
0007     /* PHY 1 and 2 access*/
0008     int (*phy_read)(struct lan9303 *chip, int port, int regnum);
0009     int (*phy_write)(struct lan9303 *chip, int port,
0010                  int regnum, u16 val);
0011 };
0012 
0013 #define LAN9303_NUM_ALR_RECORDS 512
0014 struct lan9303_alr_cache_entry {
0015     u8  mac_addr[ETH_ALEN];
0016     u8  port_map;         /* Bitmap of ports. Zero if unused entry */
0017     u8  stp_override;     /* non zero if set LAN9303_ALR_DAT1_AGE_OVERRID */
0018 };
0019 
0020 struct lan9303 {
0021     struct device *dev;
0022     struct regmap *regmap;
0023     struct regmap_irq_chip_data *irq_data;
0024     struct gpio_desc *reset_gpio;
0025     u32 reset_duration; /* in [ms] */
0026     int phy_addr_base;
0027     struct dsa_switch *ds;
0028     struct mutex indirect_mutex; /* protect indexed register access */
0029     struct mutex alr_mutex; /* protect ALR access */
0030     const struct lan9303_phy_ops *ops;
0031     bool is_bridged; /* true if port 1 and 2 are bridged */
0032 
0033     /* remember LAN9303_SWE_PORT_STATE while not bridged */
0034     u32 swe_port_state;
0035     /* LAN9303 do not offer reading specific ALR entry. Cache all
0036      * static entries in a flat table
0037      **/
0038     struct lan9303_alr_cache_entry alr_cache[LAN9303_NUM_ALR_RECORDS];
0039 };