emac-sgmii.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef _EMAC_SGMII_H_
  5. #define _EMAC_SGMII_H_
  6. struct emac_adapter;
  7. struct platform_device;
  8. /** emac_sgmii - internal emac phy
  9. * @init initialization function
  10. * @open called when the driver is opened
  11. * @close called when the driver is closed
  12. * @link_change called when the link state changes
  13. */
  14. struct sgmii_ops {
  15. int (*init)(struct emac_adapter *adpt);
  16. int (*open)(struct emac_adapter *adpt);
  17. void (*close)(struct emac_adapter *adpt);
  18. int (*link_change)(struct emac_adapter *adpt, bool link_state);
  19. void (*reset)(struct emac_adapter *adpt);
  20. };
  21. /** emac_sgmii - internal emac phy
  22. * @base base address
  23. * @digital per-lane digital block
  24. * @irq the interrupt number
  25. * @decode_error_count reference count of consecutive decode errors
  26. * @sgmii_ops sgmii ops
  27. */
  28. struct emac_sgmii {
  29. void __iomem *base;
  30. void __iomem *digital;
  31. unsigned int irq;
  32. atomic_t decode_error_count;
  33. struct sgmii_ops *sgmii_ops;
  34. };
  35. int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
  36. int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
  37. int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
  38. int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
  39. int emac_sgmii_init(struct emac_adapter *adpt);
  40. int emac_sgmii_open(struct emac_adapter *adpt);
  41. void emac_sgmii_close(struct emac_adapter *adpt);
  42. int emac_sgmii_link_change(struct emac_adapter *adpt, bool link_state);
  43. void emac_sgmii_reset(struct emac_adapter *adpt);
  44. #endif