mac.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
  2. /*
  3. * Copyright 2008 - 2015 Freescale Semiconductor Inc.
  4. */
  5. #ifndef __MAC_H
  6. #define __MAC_H
  7. #include <linux/device.h>
  8. #include <linux/if_ether.h>
  9. #include <linux/phy.h>
  10. #include <linux/phylink.h>
  11. #include <linux/list.h>
  12. #include "fman_port.h"
  13. #include "fman.h"
  14. #include "fman_mac.h"
  15. struct ethtool_eth_ctrl_stats;
  16. struct ethtool_eth_mac_stats;
  17. struct ethtool_pause_stats;
  18. struct ethtool_rmon_stats;
  19. struct ethtool_rmon_hist_range;
  20. struct fman_mac;
  21. struct mac_priv_s;
  22. #define PORT_NUM 2
  23. struct mac_device {
  24. void __iomem *vaddr;
  25. struct device *dev;
  26. struct resource *res;
  27. u8 addr[ETH_ALEN];
  28. struct fman_port *port[PORT_NUM];
  29. struct phylink *phylink;
  30. struct phylink_config phylink_config;
  31. phy_interface_t phy_if;
  32. bool promisc;
  33. bool allmulti;
  34. const struct phylink_mac_ops *phylink_ops;
  35. int (*enable)(struct fman_mac *mac_dev);
  36. void (*disable)(struct fman_mac *mac_dev);
  37. int (*set_promisc)(struct fman_mac *mac_dev, bool enable);
  38. int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr);
  39. int (*set_allmulti)(struct fman_mac *mac_dev, bool enable);
  40. int (*set_tstamp)(struct fman_mac *mac_dev, bool enable);
  41. int (*set_exception)(struct fman_mac *mac_dev,
  42. enum fman_mac_exceptions exception, bool enable);
  43. int (*add_hash_mac_addr)(struct fman_mac *mac_dev,
  44. enet_addr_t *eth_addr);
  45. int (*remove_hash_mac_addr)(struct fman_mac *mac_dev,
  46. enet_addr_t *eth_addr);
  47. void (*get_pause_stats)(struct fman_mac *memac,
  48. struct ethtool_pause_stats *s);
  49. void (*get_rmon_stats)(struct fman_mac *memac,
  50. struct ethtool_rmon_stats *s,
  51. const struct ethtool_rmon_hist_range **ranges);
  52. void (*get_eth_ctrl_stats)(struct fman_mac *memac,
  53. struct ethtool_eth_ctrl_stats *s);
  54. void (*get_eth_mac_stats)(struct fman_mac *memac,
  55. struct ethtool_eth_mac_stats *s);
  56. void (*update_speed)(struct mac_device *mac_dev, int speed);
  57. struct fman_mac *fman_mac;
  58. struct mac_priv_s *priv;
  59. struct device *fman_dev;
  60. struct device *fman_port_devs[PORT_NUM];
  61. };
  62. static inline struct mac_device
  63. *fman_config_to_mac(struct phylink_config *config)
  64. {
  65. return container_of(config, struct mac_device, phylink_config);
  66. }
  67. struct dpaa_eth_data {
  68. struct mac_device *mac_dev;
  69. int mac_hw_id;
  70. int fman_hw_id;
  71. };
  72. extern const char *mac_driver_description;
  73. int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev);
  74. #endif /* __MAC_H */