diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2016-05-09 19:22:39 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-09 20:26:08 +0200 |
commit | 8c9983a2249269f9b0f22bf070bf856ec1ff58d7 (patch) | |
tree | a242438f9979a8ef5ffbcc9ab1de05ae2e76f22e /drivers/net/dsa/mv88e6xxx.h | |
parent | net: dsa: mv88e6xxx: add flags to info (diff) | |
download | linux-8c9983a2249269f9b0f22bf070bf856ec1ff58d7.tar.xz linux-8c9983a2249269f9b0f22bf070bf856ec1ff58d7.zip |
net: dsa: mv88e6xxx: factorize PHY access with PPU
Add a MV88E6XXX_FLAG_PPU flag to describe switch models with a PHY
Polling Unit. This allows to merge PPU specific PHY access code in the
share code.
Make the mv88e6xxx_ppu_disable and mv88e6xxx_phy_{read,write}_ppu
functions use unlocked register accesses in order to call them in
mv88e6xxx_phy_{read,write} in a locked context.
Since the PPU code is shared, also remove NET_DSA_MV88E6XXX_NEED_PPU.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx.h')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.h | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h index c67b72af9af1..52ca24efec64 100644 --- a/drivers/net/dsa/mv88e6xxx.h +++ b/drivers/net/dsa/mv88e6xxx.h @@ -350,13 +350,26 @@ enum mv88e6xxx_family { MV88E6XXX_FAMILY_6352, /* 6172 6176 6240 6352 */ }; -#define MV88E6XXX_FLAGS_FAMILY_6095 0 +enum mv88e6xxx_cap { + /* PHY Polling Unit. + * See GLOBAL_CONTROL_PPU_ENABLE and GLOBAL_STATUS_PPU_POLLING. + */ + MV88E6XXX_CAP_PPU, +}; + +/* Bitmask of capabilities */ +#define MV88E6XXX_FLAG_PPU BIT(MV88E6XXX_CAP_PPU) -#define MV88E6XXX_FLAGS_FAMILY_6097 0 +#define MV88E6XXX_FLAGS_FAMILY_6095 \ + MV88E6XXX_FLAG_PPU + +#define MV88E6XXX_FLAGS_FAMILY_6097 \ + MV88E6XXX_FLAG_PPU #define MV88E6XXX_FLAGS_FAMILY_6165 0 -#define MV88E6XXX_FLAGS_FAMILY_6185 0 +#define MV88E6XXX_FLAGS_FAMILY_6185 \ + MV88E6XXX_FLAG_PPU #define MV88E6XXX_FLAGS_FAMILY_6320 0 @@ -418,7 +431,6 @@ struct mv88e6xxx_priv_state { struct mii_bus *bus; int sw_addr; -#ifdef CONFIG_NET_DSA_MV88E6XXX_NEED_PPU /* Handles automatic disabling and re-enabling of the PHY * polling unit. */ @@ -426,7 +438,6 @@ struct mv88e6xxx_priv_state { int ppu_disabled; struct work_struct ppu_work; struct timer_list ppu_timer; -#endif /* This mutex serialises access to the statistics unit. * Hold this mutex over snapshot + dump sequences. @@ -489,10 +500,6 @@ int mv88e6xxx_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val); int mv88e6xxx_phy_read_indirect(struct dsa_switch *ds, int port, int regnum); int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int port, int regnum, u16 val); -void mv88e6xxx_ppu_state_init(struct mv88e6xxx_priv_state *ps); -int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum); -int mv88e6xxx_phy_write_ppu(struct dsa_switch *ds, int addr, - int regnum, u16 val); void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, uint8_t *data); void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data); |