From 67f63e768d8860ebc6bae5987e2d928efabcf7c4 Mon Sep 17 00:00:00 2001 From: Mario Scheithauer Date: Wed, 2 Nov 2022 15:57:10 +0100 Subject: src/device + util/sconfig: Introduce new device 'mdio' This patch extends the available device paths with a new device 'mdio'. MDIO is the 'Management Data Input/Output' called interface which is used to access an Ethernet PHY behind a MAC to change settings. The real payload data path is not handled by this interface. To address the PHY correctly on the MDIO bus, there is a 5 bit address needed, which often can be configured via pins on the mainboard. Therefore, the new introduced device has an 'addr' field to define its address. If one wants to use a MDIO device in devicetree, the syntax is straight forward (example): device mdio 0x2 on end As the MDIO interface is driven by the MAC, most likely this MDIO device will be hooked in as a child device of the (PCI attached) MAC device. With the new introduced ops_mdio a new interface is added to provide an API for read and write access over MDIO. Change-Id: I6691f92c4233bc30afc9029840b06f74bb1eb4b2 Signed-off-by: Mario Scheithauer Signed-off-by: Werner Zeh Reviewed-on: https://review.coreboot.org/c/coreboot/+/69382 Reviewed-by: Angel Pons Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) --- src/device/device_util.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/device/device_util.c') diff --git a/src/device/device_util.c b/src/device/device_util.c index 9beb2ce8e2e8..c5e03f20795f 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -135,6 +135,9 @@ u32 dev_path_encode(const struct device *dev) case DEVICE_PATH_GPIO: ret |= dev->path.gpio.id; break; + case DEVICE_PATH_MDIO: + ret |= dev->path.mdio.addr; + break; case DEVICE_PATH_NONE: case DEVICE_PATH_MMIO: /* don't care */ default: @@ -223,6 +226,9 @@ const char *dev_path(const struct device *dev) case DEVICE_PATH_GPIO: snprintf(buffer, sizeof(buffer), "GPIO: %d", dev->path.gpio.id); break; + case DEVICE_PATH_MDIO: + snprintf(buffer, sizeof(buffer), "MDIO: %02x", dev->path.mdio.addr); + break; default: printk(BIOS_ERR, "Unknown device path type: %d\n", dev->path.type); -- cgit v1.2.3