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, 27 struct mii_bus *bus, 28 int addr, int reg, u16 *val); 29 int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, 30 struct mii_bus *bus, 31 int addr, int reg, u16 val); 32 int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); 33 34 int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, 35 struct ethtool_eeprom *eeprom, u8 *data); 36 int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, 37 struct ethtool_eeprom *eeprom, u8 *data); 38 39 int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, 40 struct ethtool_eeprom *eeprom, u8 *data); 41 int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, 42 struct ethtool_eeprom *eeprom, u8 *data); 43 44 int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip); 45 int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip); 46 void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip); 47 int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); 48 49 extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops; 50 extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops; 51 52 #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ 53 54 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) 55 { 56 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) { 57 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n"); 58 return -EOPNOTSUPP; 59 } 60 61 return 0; 62 } 63 64 static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, 65 struct mii_bus *bus, 66 int addr, int reg, u16 *val) 67 { 68 return -EOPNOTSUPP; 69 } 70 71 static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, 72 struct mii_bus *bus, 73 int addr, int reg, u16 val) 74 { 75 return -EOPNOTSUPP; 76 } 77 78 static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, 79 u8 *addr) 80 { 81 return -EOPNOTSUPP; 82 } 83 84 static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, 85 struct ethtool_eeprom *eeprom, 86 u8 *data) 87 { 88 return -EOPNOTSUPP; 89 } 90 91 static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, 92 struct ethtool_eeprom *eeprom, 93 u8 *data) 94 { 95 return -EOPNOTSUPP; 96 } 97 98 static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, 99 struct ethtool_eeprom *eeprom, 100 u8 *data) 101 { 102 return -EOPNOTSUPP; 103 } 104 105 static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, 106 struct ethtool_eeprom *eeprom, 107 u8 *data) 108 { 109 return -EOPNOTSUPP; 110 } 111 112 static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip) 113 { 114 return -EOPNOTSUPP; 115 } 116 117 static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) 118 { 119 return -EOPNOTSUPP; 120 } 121 122 static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip) 123 { 124 } 125 126 static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) 127 { 128 return -EOPNOTSUPP; 129 } 130 131 static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {}; 132 static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = {}; 133 134 #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ 135 136 #endif /* _MV88E6XXX_GLOBAL2_H */ 137