Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

reset: mchp: sparx5: Fix for lan966x

With the blamed commit it seems that lan966x doesn't seem to boot
anymore when the internal CPU is used.
The reason seems to be the usage of the devm_of_iomap, if we replace
this with devm_ioremap, this seems to fix the issue as we use the same
region also for other devices.

Fixes: 0426a920d6269c ("reset: mchp: sparx5: Map cpu-syscon locally in case of LAN966x")
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Tested-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://lore.kernel.org/r/20250227105502.25125-1-horatiu.vultur@microchip.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

authored by

Horatiu Vultur and committed by
Philipp Zabel
0e2268f8 2014c95a

+14 -5
+14 -5
drivers/reset/reset-microchip-sparx5.c
··· 8 8 */ 9 9 #include <linux/mfd/syscon.h> 10 10 #include <linux/of.h> 11 + #include <linux/of_address.h> 11 12 #include <linux/module.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/property.h> ··· 73 72 struct device_node *syscon_np) 74 73 { 75 74 struct regmap_config regmap_config = mchp_lan966x_syscon_regmap_config; 76 - resource_size_t size; 75 + struct resource res; 77 76 void __iomem *base; 77 + int err; 78 78 79 - base = devm_of_iomap(dev, syscon_np, 0, &size); 80 - if (IS_ERR(base)) 81 - return ERR_CAST(base); 79 + err = of_address_to_resource(syscon_np, 0, &res); 80 + if (err) 81 + return ERR_PTR(err); 82 82 83 - regmap_config.max_register = size - 4; 83 + /* It is not possible to use devm_of_iomap because this resource is 84 + * shared with other drivers. 85 + */ 86 + base = devm_ioremap(dev, res.start, resource_size(&res)); 87 + if (!base) 88 + return ERR_PTR(-ENOMEM); 89 + 90 + regmap_config.max_register = resource_size(&res) - 4; 84 91 85 92 return devm_regmap_init_mmio(dev, base, &regmap_config); 86 93 }