xenpack.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /****************************************************************************
  2. * Driver for Solarflare Solarstorm network controllers and boards
  3. * Copyright 2006 Solarflare Communications Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published
  7. * by the Free Software Foundation, incorporated herein by reference.
  8. */
  9. #ifndef EFX_XENPACK_H
  10. #define EFX_XENPACK_H
  11. /* Exported functions from Xenpack standard PHY control */
  12. #include "mdio_10g.h"
  13. /****************************************************************************/
  14. /* XENPACK MDIO register extensions */
  15. #define MDIO_XP_LASI_RX_CTRL (0x9000)
  16. #define MDIO_XP_LASI_TX_CTRL (0x9001)
  17. #define MDIO_XP_LASI_CTRL (0x9002)
  18. #define MDIO_XP_LASI_RX_STAT (0x9003)
  19. #define MDIO_XP_LASI_TX_STAT (0x9004)
  20. #define MDIO_XP_LASI_STAT (0x9005)
  21. /* Control/Status bits */
  22. #define XP_LASI_LS_ALARM (1 << 0)
  23. #define XP_LASI_TX_ALARM (1 << 1)
  24. #define XP_LASI_RX_ALARM (1 << 2)
  25. /* These two are Quake vendor extensions to the standard XENPACK defines */
  26. #define XP_LASI_LS_INTB (1 << 3)
  27. #define XP_LASI_TEST (1 << 7)
  28. /* Enable LASI interrupts for PHY */
  29. static inline void xenpack_enable_lasi_irqs(struct efx_nic *efx)
  30. {
  31. /* Read to clear LASI status register */
  32. efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_STAT);
  33. efx_mdio_write(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_CTRL,
  34. XP_LASI_LS_ALARM);
  35. }
  36. /* Read the LASI interrupt status to clear the interrupt. */
  37. static inline int xenpack_clear_lasi_irqs(struct efx_nic *efx)
  38. {
  39. /* Read to clear link status alarm */
  40. return efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_STAT);
  41. }
  42. /* Turn off LASI interrupts */
  43. static inline void xenpack_disable_lasi_irqs(struct efx_nic *efx)
  44. {
  45. efx_mdio_write(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_CTRL, 0);
  46. }
  47. #endif /* EFX_XENPACK_H */