emac-sgmii.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _EMAC_SGMII_H_
  13. #define _EMAC_SGMII_H_
  14. struct emac_adapter;
  15. struct platform_device;
  16. /** emac_sgmii - internal emac phy
  17. * @init initialization function
  18. * @open called when the driver is opened
  19. * @close called when the driver is closed
  20. * @link_change called when the link state changes
  21. */
  22. struct sgmii_ops {
  23. int (*init)(struct emac_adapter *adpt);
  24. int (*open)(struct emac_adapter *adpt);
  25. void (*close)(struct emac_adapter *adpt);
  26. int (*link_change)(struct emac_adapter *adpt, bool link_state);
  27. void (*reset)(struct emac_adapter *adpt);
  28. };
  29. /** emac_sgmii - internal emac phy
  30. * @base base address
  31. * @digital per-lane digital block
  32. * @irq the interrupt number
  33. * @decode_error_count reference count of consecutive decode errors
  34. * @sgmii_ops sgmii ops
  35. */
  36. struct emac_sgmii {
  37. void __iomem *base;
  38. void __iomem *digital;
  39. unsigned int irq;
  40. atomic_t decode_error_count;
  41. struct sgmii_ops *sgmii_ops;
  42. };
  43. int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
  44. int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
  45. int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
  46. int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
  47. int emac_sgmii_init(struct emac_adapter *adpt);
  48. int emac_sgmii_open(struct emac_adapter *adpt);
  49. void emac_sgmii_close(struct emac_adapter *adpt);
  50. int emac_sgmii_link_change(struct emac_adapter *adpt, bool link_state);
  51. void emac_sgmii_reset(struct emac_adapter *adpt);
  52. #endif