
Add include header file include/fdt_support_net.h
Signed-off-by: Tony Dinh mibodhi@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@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@f1000000/ethernet-controller@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@30000"; + * phyaddr = fdt_get_phy_addr(eth1_path); + */ +int fdt_get_phy_addr(const char *path); + +#endif