[PATCH u-boot-marvell 5/9] arm: mvebu: turris_mox: Remove hardcoded ethernet node names
Stefan Roese
sr at denx.de
Tue Feb 15 10:27:18 CET 2022
On 2/14/22 11:34, Pali Rohár wrote:
> Armada 3720 DTS files in upstream kernel use ethernet nodes named
> 'ethernet at 30000' and 'ethernet at 40000'. U-Boot have them named 'neta at 30000'
> and 'neta at 40000'. To have Turris Mox U-Boot board code independent of
> ethernet node names, find ethernet node via alias.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
Reviewed-by: Stefan Roese <sr at denx.de>
Thanks,
Stefan
> ---
> board/CZ.NIC/turris_mox/turris_mox.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
> index f0c5aa6a520b..8888a2dcabcd 100644
> --- a/board/CZ.NIC/turris_mox/turris_mox.c
> +++ b/board/CZ.NIC/turris_mox/turris_mox.c
> @@ -375,8 +375,22 @@ static void mox_phy_leds_start_blinking(void)
> {
> struct phy_device *phydev;
> struct mii_dev *bus;
> + const char *node_name;
> + int node;
> +
> + node = fdt_path_offset(gd->fdt_blob, "ethernet0");
> + if (node < 0) {
> + printf("Cannot get eth0!\n");
> + return;
> + }
>
> - bus = miiphy_get_dev_by_name("neta at 30000");
> + node_name = fdt_get_name(gd->fdt_blob, node, NULL);
> + if (!node_name) {
> + printf("Cannot get eth0 node name!\n");
> + return;
> + }
> +
> + bus = miiphy_get_dev_by_name(node_name);
> if (!bus) {
> printf("Cannot get MDIO bus device!\n");
> return;
> @@ -623,8 +637,12 @@ int last_stage_init(void)
> */
> if (peridot || topaz) {
> struct mii_dev *bus;
> + const char *node_name;
> + int node;
>
> - bus = miiphy_get_dev_by_name("neta at 30000");
> + node = fdt_path_offset(gd->fdt_blob, "ethernet0");
> + node_name = (node >= 0) ? fdt_get_name(gd->fdt_blob, node, NULL) : NULL;
> + bus = node_name ? miiphy_get_dev_by_name(node_name) : NULL;
> if (!bus) {
> printf("Cannot get MDIO bus device!\n");
> } else {
Viele Grüße,
Stefan Roese
--
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