49ec39fa7f
This patch provides helper functions to read or write a register via the MDIO bus. They can be used from drivers to easily access registers on the MDIO bus. Change-Id: I293d93435d27269a071b4b9b94a1b55307c575a7 Signed-off-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69611 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
20 lines
619 B
C
20 lines
619 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef __DEVICE_MDIO_H__
|
|
#define __DEVICE_MDIO_H__
|
|
|
|
#include <device/device.h>
|
|
#include <types.h>
|
|
|
|
struct mdio_bus_operations {
|
|
uint16_t (*read)(struct device *dev, uint8_t phy_adr, uint8_t reg_adr);
|
|
void (*write)(struct device *dev, uint8_t phy_adr, uint8_t reg_adr, uint16_t data);
|
|
};
|
|
|
|
/* Helper for getting mdio operations from a device */
|
|
const struct mdio_bus_operations *dev_get_mdio_ops(struct device *dev);
|
|
|
|
uint16_t mdio_read(struct device *dev, uint8_t offset);
|
|
void mdio_write(struct device *dev, uint8_t offset, uint16_t val);
|
|
|
|
#endif /* __DEVICE_MDIO_H__ */
|