diff options
author | Mario Scheithauer <mario.scheithauer@siemens.com> | 2022-11-02 15:57:10 +0100 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2022-11-24 05:53:55 +0000 |
commit | 67f63e768d8860ebc6bae5987e2d928efabcf7c4 (patch) | |
tree | 79b4434bbc318750dc4e3ba45436277aefb27c27 /src/include | |
parent | 66e44e325278f8a4b4227eb7d1c5d6c56e1686cd (diff) |
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 <mario.scheithauer@siemens.com>
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69382
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/device/device.h | 2 | ||||
-rw-r--r-- | src/include/device/mdio.h | 17 | ||||
-rw-r--r-- | src/include/device/path.h | 7 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h index 0f9c39f17e..8b1dde1109 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -20,6 +20,7 @@ struct pnp_mode_ops; struct spi_bus_operations; struct usb_bus_operations; struct gpio_operations; +struct mdio_bus_operations; /* Chip operations */ struct chip_operations { @@ -67,6 +68,7 @@ struct device_operations { const struct smbus_bus_operations *ops_smbus_bus; const struct pnp_mode_ops *ops_pnp_mode; const struct gpio_operations *ops_gpio; + const struct mdio_bus_operations *ops_mdio; }; /** diff --git a/src/include/device/mdio.h b/src/include/device/mdio.h new file mode 100644 index 0000000000..39e60f582d --- /dev/null +++ b/src/include/device/mdio.h @@ -0,0 +1,17 @@ +/* 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); + +#endif /* __DEVICE_MDIO_H__ */ diff --git a/src/include/device/path.h b/src/include/device/path.h index 1be7e7299f..28c932ad8e 100644 --- a/src/include/device/path.h +++ b/src/include/device/path.h @@ -22,6 +22,7 @@ enum device_path_type { DEVICE_PATH_USB, DEVICE_PATH_MMIO, DEVICE_PATH_GPIO, + DEVICE_PATH_MDIO, /* * When adding path types to this table, please also update the @@ -46,6 +47,7 @@ enum device_path_type { "DEVICE_PATH_USB", \ "DEVICE_PATH_MMIO", \ "DEVICE_PATH_GPIO", \ + "DEVICE_PATH_MDIO", \ } struct domain_path { @@ -112,6 +114,10 @@ struct gpio_path { unsigned int id; }; +struct mdio_path { + unsigned int addr; +}; + struct device_path { enum device_path_type type; union { @@ -129,6 +135,7 @@ struct device_path { struct usb_path usb; struct mmio_path mmio; struct gpio_path gpio; + struct mdio_path mdio; }; }; |