1 /* 2 * Marvell 88E6xxx Switch Global 2 Registers support (device address 0x1C) 3 * 4 * Copyright (c) 2008 Marvell Semiconductor 5 * 6 * Copyright (c) 2016 Vivien Didelot <vivien.didelot@savoirfairelinux.com> 7 * 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. 12 */ 13 14 #ifndef _MV88E6XXX_GLOBAL2_H 15 #define _MV88E6XXX_GLOBAL2_H 16 17 #include "mv88e6xxx.h" 18 19 #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 20 21 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) 22 { 23 return 0; 24 } 25 26 int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, int addr, int reg, 27 u16 *val); 28 int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, int addr, int reg, 29 u16 val); 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); 36 int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip); 37 void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip); 38 int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); 39 40 #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ 41 42 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) 43 { 44 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) { 45 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n"); 46 return -EOPNOTSUPP; 47 } 48 49 return 0; 50 } 51 52 static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, 53 int addr, int reg, u16 *val) 54 { 55 return -EOPNOTSUPP; 56 } 57 58 static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, 59 int addr, int reg, u16 val) 60 { 61 return -EOPNOTSUPP; 62 } 63 64 static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, 65 u8 *addr) 66 { 67 return -EOPNOTSUPP; 68 } 69 70 static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, 71 struct ethtool_eeprom *eeprom, 72 u8 *data) 73 { 74 return -EOPNOTSUPP; 75 } 76 77 static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, 78 struct ethtool_eeprom *eeprom, 79 u8 *data) 80 { 81 return -EOPNOTSUPP; 82 } 83 84 static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip) 85 { 86 return -EOPNOTSUPP; 87 } 88 89 static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) 90 { 91 return -EOPNOTSUPP; 92 } 93 94 static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip) 95 { 96 } 97 98 static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) 99 { 100 return -EOPNOTSUPP; 101 } 102 103 #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ 104 105 #endif /* _MV88E6XXX_GLOBAL2_H */ 106