The shift is performed in function stm32mp1_configure_pmcr:@@ -348,8 +360,15 @@ static int stm32_dwmac_parse_data(struct stm32_dwmac *dwmac,
return PTR_ERR(dwmac->regmap);
err = of_property_read_u32_index(np, "st,syscon", 1, &dwmac->mode_reg);
- if (err)
+ if (err) {
dev_err(dev, "Can't get sysconfig mode offset (%d)\n", err);
+ return err;
+ }
+
+ dwmac->mode_mask = SYSCFG_MP1_ETH_MASK;
+ err = of_property_read_u32_index(np, "st,syscon", 2, &dwmac->mode_mask);
+ if (err)
+ pr_debug("Warning sysconfig register mask not set\n");
I _think_ you need to left-shift the mode mask by 8 for STM32MP13xx second GMAC somewhere in here, right ?
/* Shift value at correct ethernet MAC offset in SYSCFG_PMCSETR */
val <<= ffs(dwmac->mode_mask) - ffs(SYSCFG_MP1_ETH_MASK);
In case of MP13 Ethernet1 or MP15, shift equal 0
In case of MP13 Ethernet2 , shift equal 8 ;-)