blob: 1eb3ddd2155121adfd276b3af7e2b7294e00b82f [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
Vivien Didelotec561272016-09-02 14:45:33 -040026int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, int addr, int reg,
27 u16 *val);
28int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, int addr, int reg,
29 u16 val);
30int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
31int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
32 struct ethtool_eeprom *eeprom, u8 *data);
33int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
34 struct ethtool_eeprom *eeprom, u8 *data);
35int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
Andrew Lunndc30c352016-10-16 19:56:49 +020036int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip);
37void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip);
Vivien Didelotec561272016-09-02 14:45:33 -040038
Vivien Didelotca070c12016-09-02 14:45:34 -040039#else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
40
41static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
42{
43 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
44 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
45 return -EOPNOTSUPP;
46 }
47
48 return 0;
49}
50
51static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
52 int addr, int reg, u16 *val)
53{
54 return -EOPNOTSUPP;
55}
56
57static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
58 int addr, int reg, u16 val)
59{
60 return -EOPNOTSUPP;
61}
62
63static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
64 u8 *addr)
65{
66 return -EOPNOTSUPP;
67}
68
69static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
70 struct ethtool_eeprom *eeprom,
71 u8 *data)
72{
73 return -EOPNOTSUPP;
74}
75
76static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
77 struct ethtool_eeprom *eeprom,
78 u8 *data)
79{
80 return -EOPNOTSUPP;
81}
82
83static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
84{
85 return -EOPNOTSUPP;
86}
87
Andrew Lunndc30c352016-10-16 19:56:49 +020088static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
89{
90 return -EOPNOTSUPP;
91}
92
93static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip)
94{
95}
96
Vivien Didelotca070c12016-09-02 14:45:34 -040097#endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
98
Vivien Didelotec561272016-09-02 14:45:33 -040099#endif /* _MV88E6XXX_GLOBAL2_H */