Unable to set MAC address on RDB2 with BSP v33

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to set MAC address on RDB2 with BSP v33

Jump to solution
4,615 Views
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 Kudos
Reply
1 Solution
4,518 Views
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.

View solution in original post

0 Kudos
Reply
8 Replies
4,519 Views
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 Kudos
Reply
4,320 Views
rishabh-j-dev
Contributor I
This patch worked. Thanks!
0 Kudos
Reply
4,305 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Thanks for your feedback.

Have a great day.

0 Kudos
Reply
4,594 Views
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 Kudos
Reply
4,593 Views
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 Kudos
Reply
4,584 Views
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 Kudos
Reply
4,576 Views
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 Kudos
Reply
4,574 Views
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 Kudos
Reply