dpaa2-mac.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2. /* Copyright 2019 NXP */
  3. #ifndef DPAA2_MAC_H
  4. #define DPAA2_MAC_H
  5. #include <linux/of.h>
  6. #include <linux/of_mdio.h>
  7. #include <linux/of_net.h>
  8. #include <linux/phylink.h>
  9. #include "dpmac.h"
  10. #include "dpmac-cmd.h"
  11. struct dpaa2_mac {
  12. struct fsl_mc_device *mc_dev;
  13. struct dpmac_link_state state;
  14. struct net_device *net_dev;
  15. struct fsl_mc_io *mc_io;
  16. struct dpmac_attr attr;
  17. u16 ver_major, ver_minor;
  18. unsigned long features;
  19. struct phylink_config phylink_config;
  20. struct phylink *phylink;
  21. phy_interface_t if_mode;
  22. enum dpmac_link_type if_link_type;
  23. struct phylink_pcs *pcs;
  24. struct fwnode_handle *fw_node;
  25. struct phy *serdes_phy;
  26. };
  27. static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac)
  28. {
  29. if (!mac)
  30. return false;
  31. return mac->attr.link_type == DPMAC_LINK_TYPE_PHY ||
  32. mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE;
  33. }
  34. int dpaa2_mac_open(struct dpaa2_mac *mac);
  35. void dpaa2_mac_close(struct dpaa2_mac *mac);
  36. int dpaa2_mac_connect(struct dpaa2_mac *mac);
  37. void dpaa2_mac_disconnect(struct dpaa2_mac *mac);
  38. int dpaa2_mac_get_sset_count(void);
  39. void dpaa2_mac_get_strings(u8 **data);
  40. void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data);
  41. void dpaa2_mac_start(struct dpaa2_mac *mac);
  42. void dpaa2_mac_stop(struct dpaa2_mac *mac);
  43. #endif /* DPAA2_MAC_H */