Skip to content

Commit 0e2268f

Browse files
HoratiuVulturpH5
authored andcommitted
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: 0426a92 ("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>
1 parent 2014c95 commit 0e2268f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/reset/reset-microchip-sparx5.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
#include <linux/mfd/syscon.h>
1010
#include <linux/of.h>
11+
#include <linux/of_address.h>
1112
#include <linux/module.h>
1213
#include <linux/platform_device.h>
1314
#include <linux/property.h>
@@ -72,14 +73,22 @@ static struct regmap *mchp_lan966x_syscon_to_regmap(struct device *dev,
7273
struct device_node *syscon_np)
7374
{
7475
struct regmap_config regmap_config = mchp_lan966x_syscon_regmap_config;
75-
resource_size_t size;
76+
struct resource res;
7677
void __iomem *base;
78+
int err;
79+
80+
err = of_address_to_resource(syscon_np, 0, &res);
81+
if (err)
82+
return ERR_PTR(err);
7783

78-
base = devm_of_iomap(dev, syscon_np, 0, &size);
79-
if (IS_ERR(base))
80-
return ERR_CAST(base);
84+
/* It is not possible to use devm_of_iomap because this resource is
85+
* shared with other drivers.
86+
*/
87+
base = devm_ioremap(dev, res.start, resource_size(&res));
88+
if (!base)
89+
return ERR_PTR(-ENOMEM);
8190

82-
regmap_config.max_register = size - 4;
91+
regmap_config.max_register = resource_size(&res) - 4;
8392

8493
return devm_regmap_init_mmio(dev, base, &regmap_config);
8594
}

0 commit comments

Comments
 (0)