global2.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. #ifndef _MV88E6XXX_GLOBAL2_H
  14. #define _MV88E6XXX_GLOBAL2_H
  15. #include "mv88e6xxx.h"
  16. #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2
  17. static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
  18. {
  19. return 0;
  20. }
  21. int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
  22. struct mii_bus *bus,
  23. int addr, int reg, u16 *val);
  24. int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
  25. struct mii_bus *bus,
  26. int addr, int reg, u16 val);
  27. int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr);
  28. int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
  29. struct ethtool_eeprom *eeprom, u8 *data);
  30. int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
  31. struct ethtool_eeprom *eeprom, u8 *data);
  32. int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
  33. struct ethtool_eeprom *eeprom, u8 *data);
  34. int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
  35. struct ethtool_eeprom *eeprom, u8 *data);
  36. int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
  37. int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip);
  38. void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip);
  39. int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip);
  40. extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
  41. extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops;
  42. #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
  43. static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip)
  44. {
  45. if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_GLOBAL2)) {
  46. dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n");
  47. return -EOPNOTSUPP;
  48. }
  49. return 0;
  50. }
  51. static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
  52. struct mii_bus *bus,
  53. int addr, int reg, u16 *val)
  54. {
  55. return -EOPNOTSUPP;
  56. }
  57. static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
  58. struct mii_bus *bus,
  59. int addr, int reg, u16 val)
  60. {
  61. return -EOPNOTSUPP;
  62. }
  63. static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip,
  64. u8 *addr)
  65. {
  66. return -EOPNOTSUPP;
  67. }
  68. static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip,
  69. struct ethtool_eeprom *eeprom,
  70. u8 *data)
  71. {
  72. return -EOPNOTSUPP;
  73. }
  74. static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip,
  75. struct ethtool_eeprom *eeprom,
  76. u8 *data)
  77. {
  78. return -EOPNOTSUPP;
  79. }
  80. static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
  81. struct ethtool_eeprom *eeprom,
  82. u8 *data)
  83. {
  84. return -EOPNOTSUPP;
  85. }
  86. static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
  87. struct ethtool_eeprom *eeprom,
  88. u8 *data)
  89. {
  90. return -EOPNOTSUPP;
  91. }
  92. static inline int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip)
  93. {
  94. return -EOPNOTSUPP;
  95. }
  96. static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
  97. {
  98. return -EOPNOTSUPP;
  99. }
  100. static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip)
  101. {
  102. }
  103. static inline int mv88e6095_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip)
  104. {
  105. return -EOPNOTSUPP;
  106. }
  107. static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {};
  108. static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = {};
  109. #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */
  110. #endif /* _MV88E6XXX_GLOBAL2_H */