2 * Marvell 88E6xxx Switch Global 2 Registers support (device address 0x1C)
4 * Copyright (c) 2008 Marvell Semiconductor
6 * Copyright (c) 2016 Vivien Didelot <vivien.didelot@savoirfairelinux.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
14 #ifndef _MV88E6XXX_GLOBAL2_H
15 #define _MV88E6XXX_GLOBAL2_H
17 #include "mv88e6xxx.h"
19 #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
21 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
26 int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, int addr, int reg,
28 int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, int addr, int reg,
30 int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
31 int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
32 struct ethtool_eeprom *eeprom, u8 *data);
33 int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
34 struct ethtool_eeprom *eeprom, u8 *data);
35 int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
37 #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
39 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
41 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
42 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
49 static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
50 int addr, int reg, u16 *val)
55 static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
56 int addr, int reg, u16 val)
61 static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
67 static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
68 struct ethtool_eeprom *eeprom,
74 static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
75 struct ethtool_eeprom *eeprom,
81 static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
86 #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
88 #endif /* _MV88E6XXX_GLOBAL2_H */