[PATCH 1/3] Add fdt network helper header file
Ramon Fried
rfried.dev at gmail.com
Sat Aug 14 00:26:35 CEST 2021
On Fri, Aug 6, 2021 at 7:50 AM Tony Dinh <mibodhi at gmail.com> 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
> + *
> + * 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
> --
> 2.20.1
>
Acked-by: Ramon Fried <rfried.dev at gmail.com>
More information about the U-Boot
mailing list