mdio-bitbang.h 1.1 KB

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