mdio-bitbang.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __LINUX_MDIO_BITBANG_H
  3. #define __LINUX_MDIO_BITBANG_H
  4. #include <linux/phy.h>
  5. struct module;
  6. struct mdiobb_ctrl;
  7. struct mdiobb_ops {
  8. struct module *owner;
  9. /* Set the Management Data Clock high if level is one,
  10. * low if level is zero.
  11. */
  12. void (*set_mdc)(struct mdiobb_ctrl *ctrl, int level);
  13. /* Configure the Management Data I/O pin as an input if
  14. * "output" is zero, or an output if "output" is one.
  15. */
  16. void (*set_mdio_dir)(struct mdiobb_ctrl *ctrl, int output);
  17. /* Set the Management Data I/O pin high if value is one,
  18. * low if "value" is zero. This may only be called
  19. * when the MDIO pin is configured as an output.
  20. */
  21. void (*set_mdio_data)(struct mdiobb_ctrl *ctrl, int value);
  22. /* Retrieve the state Management Data I/O pin. */
  23. int (*get_mdio_data)(struct mdiobb_ctrl *ctrl);
  24. };
  25. struct mdiobb_ctrl {
  26. const struct mdiobb_ops *ops;
  27. };
  28. /* The returned bus is not yet registered with the phy layer. */
  29. struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl);
  30. /* The bus must already have been unregistered. */
  31. void free_mdio_bitbang(struct mii_bus *bus);
  32. #endif