Skip to content

Commit

Permalink
reset: mchp: sparx5: Fix for lan966x
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Horatiu Vultur authored and Philipp Zabel committed Mar 13, 2025
1 parent 2014c95 commit 0e2268f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions drivers/reset/reset-microchip-sparx5.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
Expand Down Expand Up @@ -72,14 +73,22 @@ static struct regmap *mchp_lan966x_syscon_to_regmap(struct device *dev,
struct device_node *syscon_np)
{
struct regmap_config regmap_config = mchp_lan966x_syscon_regmap_config;
resource_size_t size;
struct resource res;
void __iomem *base;
int err;

err = of_address_to_resource(syscon_np, 0, &res);
if (err)
return ERR_PTR(err);

base = devm_of_iomap(dev, syscon_np, 0, &size);
if (IS_ERR(base))
return ERR_CAST(base);
/* It is not possible to use devm_of_iomap because this resource is
* shared with other drivers.
*/
base = devm_ioremap(dev, res.start, resource_size(&res));
if (!base)
return ERR_PTR(-ENOMEM);

regmap_config.max_register = size - 4;
regmap_config.max_register = resource_size(&res) - 4;

return devm_regmap_init_mmio(dev, base, &regmap_config);
}
Expand Down

0 comments on commit 0e2268f

Please sign in to comment.