global2.h (ec5612761c47ec7ab91b61df1bbcfd65cb0dbec8) global2.h (ca070c1097eb647e87619af5037d8a8a53a3248b)
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
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
19#ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
20
21static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
22{
23 return 0;
24}
25
19int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, int addr, int reg,
20 u16 *val);
21int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, int addr, int reg,
22 u16 val);
23int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
24int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
25 struct ethtool_eeprom *eeprom, u8 *data);
26int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
27 struct ethtool_eeprom *eeprom, u8 *data);
28int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
29
26int 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);
36
37#else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
38
39static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
40{
41 if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
42 dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
43 return -EOPNOTSUPP;
44 }
45
46 return 0;
47}
48
49static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
50 int addr, int reg, u16 *val)
51{
52 return -EOPNOTSUPP;
53}
54
55static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
56 int addr, int reg, u16 val)
57{
58 return -EOPNOTSUPP;
59}
60
61static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
62 u8 *addr)
63{
64 return -EOPNOTSUPP;
65}
66
67static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
68 struct ethtool_eeprom *eeprom,
69 u8 *data)
70{
71 return -EOPNOTSUPP;
72}
73
74static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
75 struct ethtool_eeprom *eeprom,
76 u8 *data)
77{
78 return -EOPNOTSUPP;
79}
80
81static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
82{
83 return -EOPNOTSUPP;
84}
85
86#endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
87
30#endif /* _MV88E6XXX_GLOBAL2_H */
88#endif /* _MV88E6XXX_GLOBAL2_H */