global2.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Marvell 88E6xxx Switch Global 2 Registers support (device address 0x1C)
  3. *
  4. * Copyright (c) 2008 Marvell Semiconductor
  5. *
  6. * Copyright (c) 2016-2017 Savoir-faire Linux Inc.
  7. * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
  8. *
  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. #ifndef _MV88E6XXX_GLOBAL2_H
  15. #define _MV88E6XXX_GLOBAL2_H
  16. #include "mv88e6xxx.h"
  17. #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
  18. static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
  19. {
  20. return 0;
  21. }
  22. int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
  23. struct mii_bus *bus,
  24. int addr, int reg, u16 *val);
  25. int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
  26. struct mii_bus *bus,
  27. int addr, int reg, u16 val);
  28. int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
  29. int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
  30. struct ethtool_eeprom *eeprom, u8 *data);
  31. int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
  32. struct ethtool_eeprom *eeprom, u8 *data);
  33. int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
  34. struct ethtool_eeprom *eeprom, u8 *data);
  35. int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
  36. struct ethtool_eeprom *eeprom, u8 *data);
  37. int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev,
  38. int src_port, u16 data);
  39. int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip);
  40. int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
  41. int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip);
  42. void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip);
  43. int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip);
  44. extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
  45. extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops;
  46. #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
  47. static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
  48. {
  49. if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
  50. dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
  51. return -EOPNOTSUPP;
  52. }
  53. return 0;
  54. }
  55. static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
  56. struct mii_bus *bus,
  57. int addr, int reg, u16 *val)
  58. {
  59. return -EOPNOTSUPP;
  60. }
  61. static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
  62. struct mii_bus *bus,
  63. int addr, int reg, u16 val)
  64. {
  65. return -EOPNOTSUPP;
  66. }
  67. static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
  68. u8 *addr)
  69. {
  70. return -EOPNOTSUPP;
  71. }
  72. static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
  73. struct ethtool_eeprom *eeprom,
  74. u8 *data)
  75. {
  76. return -EOPNOTSUPP;
  77. }
  78. static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
  79. struct ethtool_eeprom *eeprom,
  80. u8 *data)
  81. {
  82. return -EOPNOTSUPP;
  83. }
  84. static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
  85. struct ethtool_eeprom *eeprom,
  86. u8 *data)
  87. {
  88. return -EOPNOTSUPP;
  89. }
  90. static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
  91. struct ethtool_eeprom *eeprom,
  92. u8 *data)
  93. {
  94. return -EOPNOTSUPP;
  95. }
  96. int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev,
  97. int src_port, u16 data)
  98. {
  99. return -EOPNOTSUPP;
  100. }
  101. int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip)
  102. {
  103. return -EOPNOTSUPP;
  104. }
  105. static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
  106. {
  107. return -EOPNOTSUPP;
  108. }
  109. static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
  110. {
  111. return -EOPNOTSUPP;
  112. }
  113. static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip)
  114. {
  115. }
  116. static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip)
  117. {
  118. return -EOPNOTSUPP;
  119. }
  120. static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {};
  121. static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = {};
  122. #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
  123. #endif /* _MV88E6XXX_GLOBAL2_H */