blob: 8305f6941fd178aaf7a9e5c3799ad3e312ac74f0 [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 *
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 Didelotca070c12016-09-02 14:45:34 -040019#ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
20
21static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
22{
23 return 0;
24}
25
Andrew Lunnee26a222017-01-24 14:53:48 +010026int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
27 struct mii_bus *bus,
28 int addr, int reg, u16 *val);
29int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
30 struct mii_bus *bus,
31 int addr, int reg, u16 val);
Vivien Didelotec561272016-09-02 14:45:33 -040032int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
Vivien Didelot98fc3c62017-01-12 18:07:16 -050033
34int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
35 struct ethtool_eeprom *eeprom, u8 *data);
36int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
37 struct ethtool_eeprom *eeprom, u8 *data);
38
Vivien Didelotec561272016-09-02 14:45:33 -040039int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
40 struct ethtool_eeprom *eeprom, u8 *data);
41int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
42 struct ethtool_eeprom *eeprom, u8 *data);
Vivien Didelot98fc3c62017-01-12 18:07:16 -050043
Vivien Didelotec561272016-09-02 14:45:33 -040044int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
Andrew Lunndc30c352016-10-16 19:56:49 +020045int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip);
46void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip);
Andrew Lunn6e55f692016-12-03 04:45:16 +010047int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip);
Vivien Didelotec561272016-09-02 14:45:33 -040048
Andrew Lunnfcd25162017-02-09 00:03:42 +010049extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
50
Vivien Didelotca070c12016-09-02 14:45:34 -040051#else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
52
53static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
54{
55 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
56 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
57 return -EOPNOTSUPP;
58 }
59
60 return 0;
61}
62
63static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
Andrew Lunnee26a222017-01-24 14:53:48 +010064 struct mii_bus *bus,
Vivien Didelotca070c12016-09-02 14:45:34 -040065 int addr, int reg, u16 *val)
66{
67 return -EOPNOTSUPP;
68}
69
70static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
Andrew Lunnee26a222017-01-24 14:53:48 +010071 struct mii_bus *bus,
Vivien Didelotca070c12016-09-02 14:45:34 -040072 int addr, int reg, u16 val)
73{
74 return -EOPNOTSUPP;
75}
76
77static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
78 u8 *addr)
79{
80 return -EOPNOTSUPP;
81}
82
Vivien Didelot98fc3c62017-01-12 18:07:16 -050083static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
84 struct ethtool_eeprom *eeprom,
85 u8 *data)
86{
87 return -EOPNOTSUPP;
88}
89
90static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
91 struct ethtool_eeprom *eeprom,
92 u8 *data)
93{
94 return -EOPNOTSUPP;
95}
96
Vivien Didelotca070c12016-09-02 14:45:34 -040097static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
98 struct ethtool_eeprom *eeprom,
99 u8 *data)
100{
101 return -EOPNOTSUPP;
102}
103
104static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
105 struct ethtool_eeprom *eeprom,
106 u8 *data)
107{
108 return -EOPNOTSUPP;
109}
110
111static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
112{
113 return -EOPNOTSUPP;
114}
115
Andrew Lunndc30c352016-10-16 19:56:49 +0200116static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
117{
118 return -EOPNOTSUPP;
119}
120
121static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip)
122{
123}
124
Andrew Lunn6e55f692016-12-03 04:45:16 +0100125static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip)
126{
127 return -EOPNOTSUPP;
128}
129
Andrew Lunnfcd25162017-02-09 00:03:42 +0100130static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {};
131
Vivien Didelotca070c12016-09-02 14:45:34 -0400132#endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
133
Vivien Didelotec561272016-09-02 14:45:33 -0400134#endif /* _MV88E6XXX_GLOBAL2_H */