global2.h 2.8 KB

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