blob: 14c0be98e0a4d449aa4122c2db6e9ef6af007c84 [file] [log] [blame]
Vivien Didelotec561272016-09-02 14:45:33 -04001/*
2 * Marvell 88E6xxx Switch Global 2 Registers support (device address 0x1C)
3 *
4 * Copyright (c) 2008 Marvell Semiconductor
5 *
Vivien Didelot4333d612017-03-28 15:10:36 -04006 * Copyright (c) 2016-2017 Savoir-faire Linux Inc.
7 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Vivien Didelotec561272016-09-02 14:45:33 -04008 *
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.
13 */
14
15#ifndef _MV88E6XXX_GLOBAL2_H
16#define _MV88E6XXX_GLOBAL2_H
17
18#include "mv88e6xxx.h"
19
Vivien Didelotca070c12016-09-02 14:45:34 -040020#ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
21
22static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
23{
24 return 0;
25}
26
Andrew Lunnee26a222017-01-24 14:53:48 +010027int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
28 struct mii_bus *bus,
29 int addr, int reg, u16 *val);
30int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
31 struct mii_bus *bus,
32 int addr, int reg, u16 val);
Vivien Didelotec561272016-09-02 14:45:33 -040033int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
Vivien Didelot98fc3c62017-01-12 18:07:16 -050034
35int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
36 struct ethtool_eeprom *eeprom, u8 *data);
37int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
38 struct ethtool_eeprom *eeprom, u8 *data);
39
Vivien Didelotec561272016-09-02 14:45:33 -040040int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
41 struct ethtool_eeprom *eeprom, u8 *data);
42int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
43 struct ethtool_eeprom *eeprom, u8 *data);
Vivien Didelot98fc3c62017-01-12 18:07:16 -050044
Vivien Didelot17a15942017-03-30 17:37:09 -040045int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev,
46 int src_port, u16 data);
Vivien Didelot81228992017-03-30 17:37:08 -040047int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip);
48
Vivien Didelotec561272016-09-02 14:45:33 -040049int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
Andrew Lunndc30c352016-10-16 19:56:49 +020050int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip);
51void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip);
Andrew Lunn6e55f692016-12-03 04:45:16 +010052int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip);
Vivien Didelotec561272016-09-02 14:45:33 -040053
Andrew Lunnfcd25162017-02-09 00:03:42 +010054extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
Andrew Lunn61303732017-02-09 00:03:43 +010055extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops;
Andrew Lunnfcd25162017-02-09 00:03:42 +010056
Vivien Didelotca070c12016-09-02 14:45:34 -040057#else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
58
59static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
60{
61 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
62 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
63 return -EOPNOTSUPP;
64 }
65
66 return 0;
67}
68
69static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
Andrew Lunnee26a222017-01-24 14:53:48 +010070 struct mii_bus *bus,
Vivien Didelotca070c12016-09-02 14:45:34 -040071 int addr, int reg, u16 *val)
72{
73 return -EOPNOTSUPP;
74}
75
76static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
Andrew Lunnee26a222017-01-24 14:53:48 +010077 struct mii_bus *bus,
Vivien Didelotca070c12016-09-02 14:45:34 -040078 int addr, int reg, u16 val)
79{
80 return -EOPNOTSUPP;
81}
82
83static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
84 u8 *addr)
85{
86 return -EOPNOTSUPP;
87}
88
Vivien Didelot98fc3c62017-01-12 18:07:16 -050089static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
90 struct ethtool_eeprom *eeprom,
91 u8 *data)
92{
93 return -EOPNOTSUPP;
94}
95
96static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
97 struct ethtool_eeprom *eeprom,
98 u8 *data)
99{
100 return -EOPNOTSUPP;
101}
102
Vivien Didelotca070c12016-09-02 14:45:34 -0400103static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
104 struct ethtool_eeprom *eeprom,
105 u8 *data)
106{
107 return -EOPNOTSUPP;
108}
109
110static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
111 struct ethtool_eeprom *eeprom,
112 u8 *data)
113{
114 return -EOPNOTSUPP;
115}
116
Arnd Bergmann59b2c312017-05-29 14:56:01 +0200117static inline int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip,
118 int src_dev, int src_port, u16 data)
Vivien Didelot17a15942017-03-30 17:37:09 -0400119{
120 return -EOPNOTSUPP;
121}
122
Arnd Bergmann59b2c312017-05-29 14:56:01 +0200123static inline int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip)
Vivien Didelot81228992017-03-30 17:37:08 -0400124{
125 return -EOPNOTSUPP;
126}
127
Vivien Didelotca070c12016-09-02 14:45:34 -0400128static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
129{
130 return -EOPNOTSUPP;
131}
132
Andrew Lunndc30c352016-10-16 19:56:49 +0200133static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
134{
135 return -EOPNOTSUPP;
136}
137
138static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip)
139{
140}
141
Andrew Lunn6e55f692016-12-03 04:45:16 +0100142static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip)
143{
144 return -EOPNOTSUPP;
145}
146
Andrew Lunnfcd25162017-02-09 00:03:42 +0100147static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {};
Andrew Lunn61303732017-02-09 00:03:43 +0100148static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = {};
Andrew Lunnfcd25162017-02-09 00:03:42 +0100149
Vivien Didelotca070c12016-09-02 14:45:34 -0400150#endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
151
Vivien Didelotec561272016-09-02 14:45:33 -0400152#endif /* _MV88E6XXX_GLOBAL2_H */