2 * Marvell 88E6xxx Switch Global 2 Registers support (device address 0x1C)
4 * Copyright (c) 2008 Marvell Semiconductor
6 * Copyright (c) 2016-2017 Savoir-faire Linux Inc.
7 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
15 #ifndef _MV88E6XXX_GLOBAL2_H
16 #define _MV88E6XXX_GLOBAL2_H
18 #include "mv88e6xxx.h"
20 #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
22 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip
*chip
)
27 int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip
*chip
,
29 int addr
, int reg
, u16
*val
);
30 int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip
*chip
,
32 int addr
, int reg
, u16 val
);
33 int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip
*chip
, u8
*addr
);
35 int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip
*chip
,
36 struct ethtool_eeprom
*eeprom
, u8
*data
);
37 int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip
*chip
,
38 struct ethtool_eeprom
*eeprom
, u8
*data
);
40 int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip
*chip
,
41 struct ethtool_eeprom
*eeprom
, u8
*data
);
42 int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip
*chip
,
43 struct ethtool_eeprom
*eeprom
, u8
*data
);
45 int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip
*chip
, int src_dev
,
46 int src_port
, u16 data
);
47 int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip
*chip
);
49 int mv88e6xxx_g2_setup(struct mv88e6xxx_chip
*chip
);
50 int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip
*chip
);
51 void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip
*chip
);
52 int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip
*chip
);
54 extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops
;
55 extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops
;
57 #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
59 static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip
*chip
)
61 if (mv88e6xxx_has(chip
, MV88E6XXX_FLAG_GLOBAL2
)) {
62 dev_err(chip
->dev
, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
69 static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip
*chip
,
71 int addr
, int reg
, u16
*val
)
76 static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip
*chip
,
78 int addr
, int reg
, u16 val
)
83 static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip
*chip
,
89 static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip
*chip
,
90 struct ethtool_eeprom
*eeprom
,
96 static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip
*chip
,
97 struct ethtool_eeprom
*eeprom
,
103 static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip
*chip
,
104 struct ethtool_eeprom
*eeprom
,
110 static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip
*chip
,
111 struct ethtool_eeprom
*eeprom
,
117 int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip
*chip
, int src_dev
,
118 int src_port
, u16 data
)
123 int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip
*chip
)
128 static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip
*chip
)
133 static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip
*chip
)
138 static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip
*chip
)
142 static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip
*chip
)
147 static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops
= {};
148 static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops
= {};
150 #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
152 #endif /* _MV88E6XXX_GLOBAL2_H */