[PATCH 1/3] Add fdt network helper header file

Stefan Roese sr at denx.de
Thu Aug 12 08:17:34 CEST 2021


On 06.08.21 06:49, Tony Dinh wrote:
> Add include header file include/fdt_support_net.h
> 
> Signed-off-by: Tony Dinh <mibodhi at gmail.com>
> ---
> 
>   include/fdt_support_net.h | 39 +++++++++++++++++++++++++++++++++++++++
>   1 file changed, 39 insertions(+)
>   create mode 100644 include/fdt_support_net.h
> 
> diff --git a/include/fdt_support_net.h b/include/fdt_support_net.h
> new file mode 100644
> index 0000000000..4fe447f803
> --- /dev/null
> +++ b/include/fdt_support_net.h
> @@ -0,0 +1,39 @@
> +/* SPDX-License-Identifier: GPL-2.0+
> + *
> + * Copyright (C) 2021 Tony Dinh <mibodhi at gmail.com>
> + */
> +
> +#ifndef __fdt_support_net_h
> +#define __fdt_support_net_h
> +
> +/**
> + * This file contains convenience functions for decoding network related
> + * information from FDTs. It is intended to be used by board-specific code
> + * within U-Boot.
> + */
> +
> +/*
> + * fdt_get_phy_addr - Return the Ethernet PHY address
> + *
> + * Convenience function to return the PHY address of an
> + * ethernet device given its full path as defined in the device tree
> + *
> + * @path	full path to the network device node
> + * @return	PHY address, or -1 if it does not exist

Please change from "-1" to some meaningful error return code.

Other than that:

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> + *
> + * Usage examples:
> + *
> + * Get PHY address of eth0 for a Kirkwood board as defined in kirkwood.dtsi
> + *	int phyaddr;
> + *	char *eth0_path = "/ocp at f1000000/ethernet-controller at 72000";
> + *	phyaddr = fdt_get_phy_addr(eth0_path);
> + *
> + * Get PHY address of eth1 for a Armada 38x board as defined
> + * in armada-38x.dtsi
> + *	int phyaddr;
> + *	char *eth1_path = "/soc/ethernet at 30000";
> + *	phyaddr = fdt_get_phy_addr(eth1_path);
> + */
> +int fdt_get_phy_addr(const char *path);
> +
> +#endif
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list