Skip to contentSkip to conversation

arm: socfpga: misc_s10: Fix EMAC register address calculation

PATCH New Ley Foon Tan 1 participant 1 message Jun 25, 2020

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

PATCH 1/1 arm: socfpga: misc_s10: Fix EMAC register address calculation

Fix EMAC register address calculation, address need to multiply with sizeof(u32) or 4.

This fixes write to invalid address.

---
 arch/arm/mach-socfpga/misc_s10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-socfpga/misc_s10.c +1 -1
index ccff78a2307f..670bfa1a31fd 100644
@@ -68,7 +68,7 @@ static u32 socfpga_phymode_setup(u32 gmac_index, const char *phymode)
 		return -EINVAL;
 
 	clrsetbits_le32(socfpga_get_sysmgr_addr() + SYSMGR_SOC64_EMAC0 +
-			gmac_index,
+			(gmac_index * sizeof(u32)),
 			SYSMGR_EMACGRP_CTRL_PHYSEL_MASK, modereg);
 
 	return 0;
Signature · 1 line
2.19.0