mac.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/list.h>
  11. #include "fman_port.h"
  12. #include "fman.h"
  13. #include "fman_mac.h"
  14. struct fman_mac;
  15. struct mac_priv_s;
  16. struct mac_device {
  17. void __iomem *vaddr;
  18. struct device *dev;
  19. struct resource *res;
  20. u8 addr[ETH_ALEN];
  21. struct fman_port *port[2];
  22. u32 if_support;
  23. struct phy_device *phy_dev;
  24. phy_interface_t phy_if;
  25. struct device_node *phy_node;
  26. struct net_device *net_dev;
  27. bool autoneg_pause;
  28. bool rx_pause_req;
  29. bool tx_pause_req;
  30. bool rx_pause_active;
  31. bool tx_pause_active;
  32. bool promisc;
  33. bool allmulti;
  34. int (*enable)(struct fman_mac *mac_dev);
  35. void (*disable)(struct fman_mac *mac_dev);
  36. void (*adjust_link)(struct mac_device *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_multi)(struct net_device *net_dev,
  42. struct mac_device *mac_dev);
  43. int (*set_rx_pause)(struct fman_mac *mac_dev, bool en);
  44. int (*set_tx_pause)(struct fman_mac *mac_dev, u8 priority,
  45. u16 pause_time, u16 thresh_time);
  46. int (*set_exception)(struct fman_mac *mac_dev,
  47. enum fman_mac_exceptions exception, bool enable);
  48. int (*add_hash_mac_addr)(struct fman_mac *mac_dev,
  49. enet_addr_t *eth_addr);
  50. int (*remove_hash_mac_addr)(struct fman_mac *mac_dev,
  51. enet_addr_t *eth_addr);
  52. void (*update_speed)(struct mac_device *mac_dev, int speed);
  53. struct fman_mac *fman_mac;
  54. struct mac_priv_s *priv;
  55. };
  56. struct dpaa_eth_data {
  57. struct mac_device *mac_dev;
  58. int mac_hw_id;
  59. int fman_hw_id;
  60. };
  61. extern const char *mac_driver_description;
  62. int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx);
  63. void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause,
  64. bool *tx_pause);
  65. int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev);
  66. #endif /* __MAC_H */