From c02eff8fcf05ca61db7794c2d5dbee7ff5abb6f5 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Wed, 10 Aug 2022 12:54:11 +0200
Subject: [PATCH] arm: mvebu: turris_mox: Set "sfp" label in eth1 DT node when
 only Mox SFP is detected
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

When Mox SFP module is connected after Topaz or Peridot module then port DT
node already contains "sfp" label. But Mox SFP module can be connected also
without Topaz or Peridot module in which case it is connected directly into
he eth1 DT node, which is without any label. So add "sfp" label into eth1
DT node in this case.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
---
 board/CZ.NIC/turris_mox/turris_mox.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 28259e7140..3dbd68e523 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -821,6 +821,11 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 						 "sgmii");
 			if (res < 0)
 				return res;
+
+			res = fdt_setprop_string(blob, node, "label",
+						 "sfp");
+			if (res < 0)
+				return res;
 		}
 
 		res = fdt_status_okay_by_compatible(blob, "cznic,moxtet-gpio");
-- 
2.39.5