[U-Boot] [PATCH v4 1/2] dm: mdio: add a uclass for MDIO

Michal Simek michal.simek at xilinx.com
Mon Jul 9 08:05:28 UTC 2018


On 5.7.2018 09:34, make at marvell.com wrote:
> From: Ken Ma <make at marvell.com>
> 
> Add a uclass which provides access to MDIO busses and includes
> operations required by MDIO.
> The implementation is based on the existing mii/phy/mdio data
> structures and APIs.
> This patch also adds device tree binding for MDIO bus.
> 
> Signed-off-by: Ken Ma <make at marvell.com>
> Reviewed-by: sjg at chromium.org, joe.hershberger at ni.com
> ---
> 
> Changes in v4:
> - Minor updates for comments and Maintainer.
> 
> Changes in v3:
> - Move mdio uclass implementation to driver/net folder;
> - Replace flat-tree functions with livetree functions and update codes
>   and comments to be consistent with driver-model codes style;
> - Put struct mii_dev to uclass platdata to avoid the mdio alloc and
>   let driver model framework to alloc the memroy automatically,
>   meanwhile the mii bus link initialization is added.
> 
> Changes in v2:
> - Fix error printing:
> - Change some debug to pr_err;
> - mii bus has no parent member and it is not a udevice, so dev_err
>   is changed to pr_err for mii bus error printings.
> 
>  MAINTAINERS                               |   1 +
>  doc/device-tree-bindings/net/mdio-bus.txt |  54 ++++++++++++++
>  drivers/Kconfig                           |   2 +
>  drivers/net/Makefile                      |   1 +
>  drivers/net/mdio/Kconfig                  |  18 +++++
>  drivers/net/mdio/Makefile                 |   6 ++
>  drivers/net/mdio/mdio-uclass.c            | 112 ++++++++++++++++++++++++++++++
>  include/dm/uclass-id.h                    |   1 +
>  include/net/mdio.h                        |  62 +++++++++++++++++
>  9 files changed, 257 insertions(+)
>  create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt
>  create mode 100644 drivers/net/mdio/Kconfig
>  create mode 100644 drivers/net/mdio/Makefile
>  create mode 100644 drivers/net/mdio/mdio-uclass.c
>  create mode 100644 include/net/mdio.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 642c448..07f7c66 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -432,6 +432,7 @@ M:	Joe Hershberger <joe.hershberger at ni.com>
>  S:	Maintained
>  T:	git git://git.denx.de/u-boot-net.git
>  F:	drivers/net/
> +F:	drivers/net/mdio/
>  F:	net/
>  
>  NIOS
> diff --git a/doc/device-tree-bindings/net/mdio-bus.txt b/doc/device-tree-bindings/net/mdio-bus.txt
> new file mode 100644
> index 0000000..68d8b25
> --- /dev/null
> +++ b/doc/device-tree-bindings/net/mdio-bus.txt
> @@ -0,0 +1,54 @@
> +MDIO (Management Data Input/Output) busses
> +
> +MDIO busses can be described with a node for the MDIO master device
> +and a set of child nodes for each phy on the bus.
> +
> +The MDIO node requires the following properties:
> +- #address-cells  - number of cells required to define phy address on
> +                    the MDIO bus.
> +- #size-cells     - should be zero.
> +- compatible      - name of MDIO bus controller following generic names
> +                    recommended practice.
> +- reg	          - address and length of the MDIO register.
> +
> +Optional property:
> +- mdio-name       - MDIO bus name
> +
> +The child nodes of the MDIO driver are the individual PHY devices
> +connected to this MDIO bus. They must have a "reg" property given the
> +PHY address on the MDIO bus.
> +- reg             - (required) phy address in MDIO bus.
> +
> +Example for cp110 MDIO node at the SoC level:
> +	cp0_mdio: mdio at 12a200 {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		compatible = "marvell,orion-mdio";
> +		reg = <0x12a200 0x10>;
> +		mdio-name = "cp0-mdio";
> +	};
> +
> +	cp0_xmdio: mdio at 12a600 {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		compatible = "marvell,xmdio";
> +		reg = <0x12a600 0x200>;
> +		mdio-name = "cp0-xmdio";
> +	};
> +
> +And at the board level, example for armada-8040-mcbin board:
> +	&cp0_mdio {
> +		ge_phy: ethernet-phy at 0 {
> +			reg = <0>;
> +		};
> +	};
> +
> +	&cp0_xmdio {
> +		phy0: ethernet-phy at 0 {
> +			reg = <0>;
> +		};
> +
> +		phy8: ethernet-phy at 8 {
> +			reg = <8>;
> +		};
> +	};

this binding should be in separate patch and it is not align with what
it is in the kernel. mdio-name is not there. You should send a patch to
kernel.

Thanks,
Michal


More information about the U-Boot mailing list