Unable to set MAC address on RDB2 with BSP v33

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Unable to set MAC address on RDB2 with BSP v33

跳至解决方案
4,622 次查看
rishabh-j-dev
Contributor I

We are using the GMAC interface on our RDB2 and require a stable MAC address. On AutoLinux BSP v30, we are able to set the MAC addr with the following command in u-boot. However, when we try the same command in BSP v33, the MAC address does not seem to change for the interface. 

We are checking the MAC address with the "ifconfig" utility in Linux

setenv ethaddr "66:22:00:02:22:17"

 

Is there a way to set a stable MAC address for the GMAC interface while using BSP v33? 

 

The specific board we are using is s32g274ardb2

0 项奖励
回复
1 解答
4,525 次查看
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

We have received the following comments:

"

Please add following patch into u-boot to have a try

From aaec17964098c65072dff5d11246933e94b37584 Mon Sep 17 00:00:00 2001
From: Yibo Liu <yibo.liu@nxp.com>
Date: Mon, 6 Feb 2023 11:10:03 +0800
Subject: [PATCH] gmac_addr_fix

---
 arch/arm/mach-s32/s32-cc/eth.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-s32/s32-cc/eth.c b/arch/arm/mach-s32/s32-cc/eth.c
index 3270a773e0..586e33353d 100644
--- a/arch/arm/mach-s32/s32-cc/eth.c
+++ b/arch/arm/mach-s32/s32-cc/eth.c
@@ -26,7 +26,7 @@
 #include <dm/platform_data/pfeng_dm_eth.h>
 #endif
 
-#if CONFIG_IS_ENABLED(FSL_PFENG)
+#if CONFIG_IS_ENABLED(FSL_PFENG) || CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
 static void ft_update_eth_addr_by_name(const char *name, const u8 idx,
 				       void *fdt, int nodeoff)
 {
@@ -170,6 +170,9 @@ void ft_enet_fixup(void *fdt)
 {
 	int __maybe_unused nodeoff;
 	bool __maybe_unused ena;
+#if CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
+	u8 idx = 0;
+#endif /* CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC) */
 
 	/* PFE */
 #if CONFIG_IS_ENABLED(FSL_PFENG)
@@ -191,6 +194,15 @@ void ft_enet_fixup(void *fdt)
 	}
 #endif /* CONFIG_IS_ENABLED(FSL_PFENG) */
 
+#if CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
+	nodeoff = fdt_node_offset_by_compatible(fdt, -1, "nxp,s32cc-dwmac");
+	while (nodeoff != -FDT_ERR_NOTFOUND) {
+		ft_update_eth_addr_by_name("eth", idx, fdt, nodeoff);
+		nodeoff = fdt_node_offset_by_compatible(fdt, nodeoff, "nxp,s32cc-dwmac");
+		idx++;
+	}
+#endif /* CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC) */
+
 	/* GMAC */
 #if CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
 	bool gmac0_ena = true;
-- 
2.17.1

"

Please, let us know if this works or not.

在原帖中查看解决方案

0 项奖励
回复
8 回复数
4,526 次查看
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

We have received the following comments:

"

Please add following patch into u-boot to have a try

From aaec17964098c65072dff5d11246933e94b37584 Mon Sep 17 00:00:00 2001
From: Yibo Liu <yibo.liu@nxp.com>
Date: Mon, 6 Feb 2023 11:10:03 +0800
Subject: [PATCH] gmac_addr_fix

---
 arch/arm/mach-s32/s32-cc/eth.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-s32/s32-cc/eth.c b/arch/arm/mach-s32/s32-cc/eth.c
index 3270a773e0..586e33353d 100644
--- a/arch/arm/mach-s32/s32-cc/eth.c
+++ b/arch/arm/mach-s32/s32-cc/eth.c
@@ -26,7 +26,7 @@
 #include <dm/platform_data/pfeng_dm_eth.h>
 #endif
 
-#if CONFIG_IS_ENABLED(FSL_PFENG)
+#if CONFIG_IS_ENABLED(FSL_PFENG) || CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
 static void ft_update_eth_addr_by_name(const char *name, const u8 idx,
 				       void *fdt, int nodeoff)
 {
@@ -170,6 +170,9 @@ void ft_enet_fixup(void *fdt)
 {
 	int __maybe_unused nodeoff;
 	bool __maybe_unused ena;
+#if CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
+	u8 idx = 0;
+#endif /* CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC) */
 
 	/* PFE */
 #if CONFIG_IS_ENABLED(FSL_PFENG)
@@ -191,6 +194,15 @@ void ft_enet_fixup(void *fdt)
 	}
 #endif /* CONFIG_IS_ENABLED(FSL_PFENG) */
 
+#if CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
+	nodeoff = fdt_node_offset_by_compatible(fdt, -1, "nxp,s32cc-dwmac");
+	while (nodeoff != -FDT_ERR_NOTFOUND) {
+		ft_update_eth_addr_by_name("eth", idx, fdt, nodeoff);
+		nodeoff = fdt_node_offset_by_compatible(fdt, nodeoff, "nxp,s32cc-dwmac");
+		idx++;
+	}
+#endif /* CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC) */
+
 	/* GMAC */
 #if CONFIG_IS_ENABLED(DWC_ETH_QOS_S32CC)
 	bool gmac0_ena = true;
-- 
2.17.1

"

Please, let us know if this works or not.

0 项奖励
回复
4,327 次查看
rishabh-j-dev
Contributor I
This patch worked. Thanks!
0 项奖励
回复
4,312 次查看
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Thanks for your feedback.

Have a great day.

0 项奖励
回复
4,601 次查看
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Once you set the environment, you saved it? Also, is it needed for your application to change it on u-boot? Or can you define the MAC prior to building the image?

Please, let us know.

0 项奖励
回复
4,600 次查看
rishabh-j-dev
Contributor I
Yes, I can verify I save it using "saveenv". I can also verify that the env variable is set as if do printenv I can see the value on reboot.

It can be defined during the image build, what is the way of doing that?
0 项奖励
回复
4,591 次查看
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

The Device tree files should have this information. Help us verify if the following files do help with your request.

"arch/arm64/boot/dts/freescale/s32cc.dtsi"

"arch/arm64/boot/dts/freescale/s32g-pfe.dtsi"

In the meantime, we will continue our investigation on why the environment variable did not work.

Please, let us know.

0 项奖励
回复
4,583 次查看
rishabh-j-dev
Contributor I
I do not see where those files are located. Is it a part of the yocto BSP? Can you provide some steps on where they are lcoated?
0 项奖励
回复
4,581 次查看
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

We have access to them once we copy the linux repository from codeaurora.

It will be inside the linux folder then following the different addresses we have mentioned before.

Please, let us know.

0 项奖励
回复