mdio.h 983 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2016 - 2021, Broadcom
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MDIO_H
  7. #define MDIO_H
  8. #define CMIC_MIIM_PARAM (PLAT_CMIC_MIIM_BASE + 0x23cU)
  9. #define MDIO_PARAM_MIIM_CYCLE 29U
  10. #define MDIO_PARAM_INTERNAL_SEL 25U
  11. #define MDIO_PARAM_BUSID 22U
  12. #define MDIO_PARAM_BUSID_MASK 0x7U
  13. #define MDIO_PARAM_C45_SEL 21U
  14. #define MDIO_PARAM_PHYID 16U
  15. #define MDIO_PARAM_PHYID_MASK 0x1FU
  16. #define MDIO_PARAM_DATA 0U
  17. #define MDIO_PARAM_DATA_MASK 0xFFFFU
  18. #define CMIC_MIIM_READ_DATA (PLAT_CMIC_MIIM_BASE + 0x240U)
  19. #define MDIO_READ_DATA_MASK 0xffffU
  20. #define CMIC_MIIM_ADDRESS (PLAT_CMIC_MIIM_BASE + 0x244U)
  21. #define CMIC_MIIM_CTRL (PLAT_CMIC_MIIM_BASE + 0x248U)
  22. #define MDIO_CTRL_WRITE_OP 0x1U
  23. #define MDIO_CTRL_READ_OP 0x2U
  24. #define CMIC_MIIM_STAT (PLAT_CMIC_MIIM_BASE + 0x24cU)
  25. #define MDIO_STAT_DONE 1U
  26. int mdio_write(uint16_t busid, uint16_t phyid, uint32_t reg, uint16_t val);
  27. int mdio_read(uint16_t busid, uint16_t phyid, uint32_t reg);
  28. #endif /* MDIO_H */