13#ifndef ZEPHYR_INCLUDE_DRIVERS_MDIO_H_
14#define ZEPHYR_INCLUDE_DRIVERS_MDIO_H_
36__subsystem
struct mdio_driver_api {
38 void (*bus_enable)(
const struct device *dev);
41 void (*bus_disable)(
const struct device *dev);
71static inline void z_impl_mdio_bus_enable(
const struct device *dev)
73 const struct mdio_driver_api *api =
74 (
const struct mdio_driver_api *)dev->
api;
76 if (api->bus_enable != NULL) {
89static inline void z_impl_mdio_bus_disable(
const struct device *dev)
91 const struct mdio_driver_api *api =
92 (
const struct mdio_driver_api *)dev->
api;
94 if (api->bus_disable != NULL) {
95 api->bus_disable(dev);
118static inline int z_impl_mdio_read(
const struct device *dev,
uint8_t prtad,
121 const struct mdio_driver_api *api =
122 (
const struct mdio_driver_api *)dev->
api;
124 if (api->read == NULL) {
128 return api->read(dev, prtad, regad, data);
151static inline int z_impl_mdio_write(
const struct device *dev,
uint8_t prtad,
154 const struct mdio_driver_api *api =
155 (
const struct mdio_driver_api *)dev->
api;
157 if (api->write == NULL) {
161 return api->write(dev, prtad, regad, data);
184static inline int z_impl_mdio_read_c45(
const struct device *dev,
uint8_t prtad,
188 const struct mdio_driver_api *api =
189 (
const struct mdio_driver_api *)dev->
api;
191 if (api->read_c45 == NULL) {
195 return api->read_c45(dev, prtad, devad, regad, data);
218static inline int z_impl_mdio_write_c45(
const struct device *dev,
uint8_t prtad,
222 const struct mdio_driver_api *api =
223 (
const struct mdio_driver_api *)dev->
api;
225 if (api->write_c45 == NULL) {
229 return api->write_c45(dev, prtad, devad, regad, data);
240#include <zephyr/syscalls/mdio.h>
int mdio_write(const struct device *dev, uint8_t prtad, uint8_t regad, uint16_t data)
Write to MDIO bus.
void mdio_bus_enable(const struct device *dev)
Enable MDIO bus.
int mdio_read_c45(const struct device *dev, uint8_t prtad, uint8_t devad, uint16_t regad, uint16_t *data)
Read from MDIO Bus using Clause 45 access.
void mdio_bus_disable(const struct device *dev)
Disable MDIO bus and tri-state drivers.
int mdio_write_c45(const struct device *dev, uint8_t prtad, uint8_t devad, uint16_t regad, uint16_t data)
Write to MDIO bus using Clause 45 access.
int mdio_read(const struct device *dev, uint8_t prtad, uint8_t regad, uint16_t *data)
Read from MDIO Bus.
#define ENOSYS
Function not implemented.
Definition errno.h:82
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417