Skip to contentSkip to conversation

imx6qdl.dtsi: use MAC-address from nvmem

PATCH Applied Nikolaus Voss 3 participants 5 messages Nov 28, 2022 – Jan 1, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 imx6qdl.dtsi: use MAC-address from nvmem

IMX6QDL has fuse locations specified for storing the MAC for the built-in ethernet (Table 5-8 in Reference Manual).
Define the fuse location in ocotp and refer to them in fec-ethernet.

If the cells are not flashed, the driver behavior is unchanged, i.e. other MAC sources will be probed and a random MAC will be used as a last resort.

---
 arch/arm/boot/dts/imx6qdl.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6qdl.dtsi +6 -0
index 4f7fefc14d0ac..7449d554ef1aa 100644
@@ -1053,6 +1053,8 @@ fec: ethernet@2188000 {
 					 <&clks IMX6QDL_CLK_ENET_REF>;
 				clock-names = "ipg", "ahb", "ptp", "enet_out";
 				fsl,stop-mode = <&gpr 0x34 27>;
+				nvmem-cells = <&fec_mac_addr>;
+				nvmem-cell-names = "mac-address";
 				status = "disabled";
 			};
 
@@ -1186,6 +1188,10 @@ tempmon_calib: calib@38 {
 				tempmon_temp_grade: temp-grade@20 {
 					reg = <0x20 4>;
 				};
+
+				fec_mac_addr: mac-addr@88 {
+					reg = <0x88 6>;
+				};
 			};
 
 			tzasc@21d0000 { /* TZASC1 */
Signature · 1 line
2.34.1
#1 lore raw
Quoted 18 lines · Nikolaus Voss

IMX6QDL has fuse locations specified for storing the MAC for the built-in ethernet (Table 5-8 in Reference Manual).
Define the fuse location in ocotp and refer to them in fec-ethernet.

If the cells are not flashed, the driver behavior is unchanged, i.e. other MAC sources will be probed and a random MAC will be used as a last resort.

---
 arch/arm/boot/dts/imx6qdl.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6qdl.dtsi +0 -0
index 4f7fefc14d0ac..7449d554ef1aa 100644

arch/arm/boot/dts/imx6qdl.dtsi fec: ethernet@2188000 { · line 1057

Quoted 5 lines
arch/arm/boot/dts/imx6qdl.dtsi +2 -0
@@ -1053,6 +1053,8 @@ fec: ethernet@2188000 {
 					 <&clks IMX6QDL_CLK_ENET_REF>;
 				clock-names = "ipg", "ahb", "ptp", "enet_out";
 				fsl,stop-mode = <&gpr 0x34 27>;
+				nvmem-cells = <&fec_mac_addr>;
+				nvmem-cell-names = "mac-address";

May I ask where is the support of FEC driver for this?

Shawn

Quoted 17 lines
arch/arm/boot/dts/imx6qdl.dtsi +4 -0
 				status = "disabled";
 			};
 
@@ -1186,6 +1188,10 @@ tempmon_calib: calib@38 {
 				tempmon_temp_grade: temp-grade@20 {
 					reg = <0x20 4>;
 				};
+
+				fec_mac_addr: mac-addr@88 {
+					reg = <0x88 6>;
+				};
 			};
 
 			tzasc@21d0000 { /* TZASC1 */
Signature · 1 line
2.34.1
#2 lore raw
Quoted 8 lines

arch/arm/boot/dts/imx6qdl.dtsi fec: ethernet@2188000 { · line 1057

Quoted 6 lines
arch/arm/boot/dts/imx6qdl.dtsi +2 -0
@@ -1053,6 +1053,8 @@ fec: ethernet@2188000 {
 					 <&clks IMX6QDL_CLK_ENET_REF>;
 				clock-names = "ipg", "ahb", "ptp", "enet_out";
 				fsl,stop-mode = <&gpr 0x34 27>;
+				nvmem-cells = <&fec_mac_addr>;
+				nvmem-cell-names = "mac-address";

May I ask where is the support of FEC driver for this?

The fec uses of_get_mac_address() which calls of_get_mac_address_nvmem() as its last place to look for the MAC address.

Andrew

#3 lore raw
Quoted 9 lines · Andrew Lunn
Quoted 8 lines

arch/arm/boot/dts/imx6qdl.dtsi fec: ethernet@2188000 { · line 1057

Quoted 6 lines
arch/arm/boot/dts/imx6qdl.dtsi +2 -0
@@ -1053,6 +1053,8 @@ fec: ethernet@2188000 {
 					 <&clks IMX6QDL_CLK_ENET_REF>;
 				clock-names = "ipg", "ahb", "ptp", "enet_out";
 				fsl,stop-mode = <&gpr 0x34 27>;
+				nvmem-cells = <&fec_mac_addr>;
+				nvmem-cell-names = "mac-address";

May I ask where is the support of FEC driver for this?

Quoted 3 lines

The fec uses of_get_mac_address() which calls of_get_mac_address_nvmem() as its last place to look for the MAC address.

Ah, of_get_mac_address() gets extended to call of_get_mac_address_nvmem() nowadays. Thanks, Andrew!

Shawn

Applied
#4 lore raw
In reply to Nikolaus Voss
Quoted 9 lines · Nikolaus Voss

IMX6QDL has fuse locations specified for storing the MAC for the built-in ethernet (Table 5-8 in Reference Manual).
Define the fuse location in ocotp and refer to them in fec-ethernet.

If the cells are not flashed, the driver behavior is unchanged, i.e. other MAC sources will be probed and a random MAC will be used as a last resort.

I fixed the patch subject prefix like:

ARM: dts: imx6qdl: use MAC-address from nvmem

Applied, thanks!

Shawn