You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mii_bit.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _IPXE_MII_BIT_H
  2. #define _IPXE_MII_BIT_H
  3. /** @file
  4. *
  5. * MII bit-bashing interface
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <ipxe/mii.h>
  10. #include <ipxe/bitbash.h>
  11. #define MII_BIT_START 0xffffffff /**< Start */
  12. #define MII_BIT_START_MASK 0x80000000 /**< Start mask */
  13. #define MII_BIT_CMD_MASK 0x00000008 /**< Command mask */
  14. #define MII_BIT_CMD_READ 0x00000006 /**< Command read */
  15. #define MII_BIT_CMD_WRITE 0x00000005 /**< Command write */
  16. #define MII_BIT_CMD_RW 0x00000001 /**< Command read or write */
  17. #define MII_BIT_PHY_MASK 0x00000010 /**< PHY mask */
  18. #define MII_BIT_REG_MASK 0x00000010 /**< Register mask */
  19. #define MII_BIT_SWITCH 0x00000002 /**< Switch */
  20. #define MII_BIT_SWITCH_MASK 0x00000002 /**< Switch mask */
  21. #define MII_BIT_DATA_MASK 0x00008000 /**< Data mask */
  22. /** A bit-bashing MII interface */
  23. struct mii_bit_basher {
  24. /** MII interface */
  25. struct mii_interface mdio;
  26. /** Bit-bashing interface */
  27. struct bit_basher basher;
  28. };
  29. /** Bit indices used for MII bit-bashing interface */
  30. enum {
  31. /** MII clock */
  32. MII_BIT_MDC = 0,
  33. /** MII data */
  34. MII_BIT_MDIO,
  35. /** MII data direction */
  36. MII_BIT_DRIVE,
  37. };
  38. /** Delay between MDC transitions */
  39. #define MII_BIT_UDELAY 1
  40. extern void init_mii_bit_basher ( struct mii_bit_basher *miibit );
  41. #endif /* _IPXE_MII_BIT_H */