Skip to content

Commit 931628a

Browse files
allemanmMaureenHelm
authored andcommitted
drivers: ethernet: nxp_enet: Fused MAC address fixes
Add required initialisation of OCOTP. The IMXRT10XX variants don't support fuseWords to be greater than 1. MAC0 fuse map address is 0x22 instead of 0x620. Fill in mac_addr buffer correctly. Signed-off-by: Matthias Alleman <[email protected]>
1 parent d642943 commit 931628a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

drivers/ethernet/nxp_enet/eth_nxp_enet.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -641,20 +641,25 @@ static inline void nxp_enet_fused_mac(uint8_t *mac_addr)
641641
#ifdef CONFIG_SOC_FAMILY_NXP_IMXRT
642642
uint32_t mac_addr_fuse[2] = {0};
643643

644-
OCOTP_ReadFuseShadowRegisterExt((OCOTP_Type *)OCOTP_BASE,
645644
#if defined(CONFIG_SOC_SERIES_IMXRT10XX)
646-
0x620,
645+
OCOTP_Init((OCOTP_Type *)OCOTP_BASE, CLOCK_GetIpgFreq());
646+
/* OTP bank 4, word 2: MAC0 */
647+
OCOTP_ReadFuseShadowRegisterExt((OCOTP_Type *)OCOTP_BASE,
648+
0x22, &mac_addr_fuse[0], 1);
649+
/* OTP bank 4, word 3: MAC1*/
650+
OCOTP_ReadFuseShadowRegisterExt((OCOTP_Type *)OCOTP_BASE,
651+
0x23, &mac_addr_fuse[1], 1);
647652
#elif defined(CONFIG_SOC_SERIES_IMXRT11XX)
648-
0xA90,
653+
OCOTP_Init((OCOTP_Type *)OCOTP_BASE, 0);
654+
OCOTP_ReadFuseShadowRegisterExt((OCOTP_Type *)OCOTP_BASE,
655+
0x28, &mac_addr_fuse[0], 2);
649656
#endif
650-
mac_addr_fuse, 2);
651-
652657
mac_addr[0] = mac_addr_fuse[0] & 0x000000FF;
653-
mac_addr[1] = mac_addr_fuse[0] & 0x0000FF00;
654-
mac_addr[2] = mac_addr_fuse[0] & 0x00FF0000;
655-
mac_addr[3] = mac_addr_fuse[0] & 0xFF000000;
656-
mac_addr[4] = mac_addr_fuse[1] & 0x00FF;
657-
mac_addr[5] = mac_addr_fuse[1] & 0xFF00;
658+
mac_addr[1] = (mac_addr_fuse[0] & 0x0000FF00) >> 8;
659+
mac_addr[2] = (mac_addr_fuse[0] & 0x00FF0000) >> 16;
660+
mac_addr[3] = (mac_addr_fuse[0] & 0xFF000000) >> 24;
661+
mac_addr[4] = (mac_addr_fuse[1] & 0x00FF);
662+
mac_addr[5] = (mac_addr_fuse[1] & 0xFF00) >> 8;
658663
#else
659664
ARG_UNUSED(mac_addr);
660665
#endif

0 commit comments

Comments
 (0)