Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 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 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 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 | |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 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); |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 32 | int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 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 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 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); |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 43 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 44 | int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip); |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 45 | int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip); |
| 46 | void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip); |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 47 | int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 48 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 49 | #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ |
| 50 | |
| 51 | static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) |
| 52 | { |
| 53 | if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) { |
| 54 | dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n"); |
| 55 | return -EOPNOTSUPP; |
| 56 | } |
| 57 | |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 62 | struct mii_bus *bus, |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 63 | int addr, int reg, u16 *val) |
| 64 | { |
| 65 | return -EOPNOTSUPP; |
| 66 | } |
| 67 | |
| 68 | static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, |
Andrew Lunn | ee26a22 | 2017-01-24 14:53:48 +0100 | [diff] [blame] | 69 | struct mii_bus *bus, |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 70 | int addr, int reg, u16 val) |
| 71 | { |
| 72 | return -EOPNOTSUPP; |
| 73 | } |
| 74 | |
| 75 | static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, |
| 76 | u8 *addr) |
| 77 | { |
| 78 | return -EOPNOTSUPP; |
| 79 | } |
| 80 | |
Vivien Didelot | 98fc3c6 | 2017-01-12 18:07:16 -0500 | [diff] [blame] | 81 | static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, |
| 82 | struct ethtool_eeprom *eeprom, |
| 83 | u8 *data) |
| 84 | { |
| 85 | return -EOPNOTSUPP; |
| 86 | } |
| 87 | |
| 88 | static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, |
| 89 | struct ethtool_eeprom *eeprom, |
| 90 | u8 *data) |
| 91 | { |
| 92 | return -EOPNOTSUPP; |
| 93 | } |
| 94 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 95 | static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, |
| 96 | struct ethtool_eeprom *eeprom, |
| 97 | u8 *data) |
| 98 | { |
| 99 | return -EOPNOTSUPP; |
| 100 | } |
| 101 | |
| 102 | static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, |
| 103 | struct ethtool_eeprom *eeprom, |
| 104 | u8 *data) |
| 105 | { |
| 106 | return -EOPNOTSUPP; |
| 107 | } |
| 108 | |
| 109 | static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip) |
| 110 | { |
| 111 | return -EOPNOTSUPP; |
| 112 | } |
| 113 | |
Andrew Lunn | dc30c35 | 2016-10-16 19:56:49 +0200 | [diff] [blame] | 114 | static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) |
| 115 | { |
| 116 | return -EOPNOTSUPP; |
| 117 | } |
| 118 | |
| 119 | static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip) |
| 120 | { |
| 121 | } |
| 122 | |
Andrew Lunn | 6e55f69 | 2016-12-03 04:45:16 +0100 | [diff] [blame] | 123 | static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) |
| 124 | { |
| 125 | return -EOPNOTSUPP; |
| 126 | } |
| 127 | |
Vivien Didelot | ca070c1 | 2016-09-02 14:45:34 -0400 | [diff] [blame] | 128 | #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ |
| 129 | |
Vivien Didelot | ec56127 | 2016-09-02 14:45:33 -0400 | [diff] [blame] | 130 | #endif /* _MV88E6XXX_GLOBAL2_H */ |