* [PATCH v3] reset: mchp: sparx5: Fix for lan966x
@ 2025-02-26 14:46 Horatiu Vultur
2025-02-26 16:32 ` Philipp Zabel
0 siblings, 1 reply; 5+ messages in thread
From: Horatiu Vultur @ 2025-02-26 14:46 UTC (permalink / raw)
To: p.zabel, Steen.Hegelund, daniel.machon, UNGLinuxDriver,
herve.codina
Cc: linux-arm-kernel, linux-kernel, Horatiu Vultur
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 of_iomap, 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>
---
v2->v3:
- forward error from of_address_to_resource
- use devm_ioremap instead of_iomap
v1->v2:
- make sure to use iounmap when driver is removed
---
drivers/reset/reset-microchip-sparx5.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
index aa5464be7053b..176b3f46e9243 100644
--- a/drivers/reset/reset-microchip-sparx5.c
+++ b/drivers/reset/reset-microchip-sparx5.c
@@ -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>
@@ -72,14 +73,19 @@ 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);
+ 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, ®map_config);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v3] reset: mchp: sparx5: Fix for lan966x
2025-02-26 14:46 [PATCH v3] reset: mchp: sparx5: Fix for lan966x Horatiu Vultur
@ 2025-02-26 16:32 ` Philipp Zabel
2025-02-26 17:24 ` Herve Codina
2025-02-27 8:51 ` Horatiu Vultur
0 siblings, 2 replies; 5+ messages in thread
From: Philipp Zabel @ 2025-02-26 16:32 UTC (permalink / raw)
To: Horatiu Vultur, Steen.Hegelund, daniel.machon, UNGLinuxDriver,
herve.codina
Cc: linux-arm-kernel, linux-kernel
On Mi, 2025-02-26 at 15:46 +0100, Horatiu Vultur wrote:
> 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 of_iomap, this seems to fix the issue as we use the same
^^^^^^^^
The is not accurate anymore.
> 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>
Is this still correct?
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
> v2->v3:
> - forward error from of_address_to_resource
> - use devm_ioremap instead of_iomap
> v1->v2:
> - make sure to use iounmap when driver is removed
> ---
> drivers/reset/reset-microchip-sparx5.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
> index aa5464be7053b..176b3f46e9243 100644
> --- a/drivers/reset/reset-microchip-sparx5.c
> +++ b/drivers/reset/reset-microchip-sparx5.c
> @@ -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>
> @@ -72,14 +73,19 @@ 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 would be nice to add a comment here that devm_of_iomap() can't be
used because the resource is shared with other devices. Do you know
which ones?
Otherwise, this looks good to me.
regards
Philipp
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] reset: mchp: sparx5: Fix for lan966x
2025-02-26 16:32 ` Philipp Zabel
@ 2025-02-26 17:24 ` Herve Codina
2025-02-27 10:25 ` Philipp Zabel
2025-02-27 8:51 ` Horatiu Vultur
1 sibling, 1 reply; 5+ messages in thread
From: Herve Codina @ 2025-02-26 17:24 UTC (permalink / raw)
To: Philipp Zabel, Horatiu Vultur
Cc: Steen.Hegelund, daniel.machon, UNGLinuxDriver, linux-arm-kernel,
linux-kernel
Hi Philipp, Horatiu,
On Wed, 26 Feb 2025 17:32:22 +0100
Philipp Zabel <p.zabel@pengutronix.de> wrote:
...
> > 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>
>
> Is this still correct?
Yes, it is correct.
Reviewed this v3, saw Philipp's comments and I have nothing more to add.
Also tested this v3 and no regression were detected.
Best regards,
Hervé
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] reset: mchp: sparx5: Fix for lan966x
2025-02-26 17:24 ` Herve Codina
@ 2025-02-27 10:25 ` Philipp Zabel
0 siblings, 0 replies; 5+ messages in thread
From: Philipp Zabel @ 2025-02-27 10:25 UTC (permalink / raw)
To: Herve Codina, Horatiu Vultur
Cc: Steen.Hegelund, daniel.machon, UNGLinuxDriver, linux-arm-kernel,
linux-kernel
On Mi, 2025-02-26 at 18:24 +0100, Herve Codina wrote:
> Hi Philipp, Horatiu,
>
> On Wed, 26 Feb 2025 17:32:22 +0100
> Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> ...
>
> > > 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>
> >
> > Is this still correct?
>
> Yes, it is correct.
>
> Reviewed this v3, saw Philipp's comments and I have nothing more to add.
>
> Also tested this v3 and no regression were detected.
Excellent, thank you.
regards
Philipp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] reset: mchp: sparx5: Fix for lan966x
2025-02-26 16:32 ` Philipp Zabel
2025-02-26 17:24 ` Herve Codina
@ 2025-02-27 8:51 ` Horatiu Vultur
1 sibling, 0 replies; 5+ messages in thread
From: Horatiu Vultur @ 2025-02-27 8:51 UTC (permalink / raw)
To: Philipp Zabel
Cc: Steen.Hegelund, daniel.machon, UNGLinuxDriver, herve.codina,
linux-arm-kernel, linux-kernel
The 02/26/2025 17:32, Philipp Zabel wrote:
Hi,
>
> On Mi, 2025-02-26 at 15:46 +0100, Horatiu Vultur wrote:
> > 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 of_iomap, this seems to fix the issue as we use the same
> ^^^^^^^^
> The is not accurate anymore.
Good catch. I will update in the next version.
>
> > 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>
>
> Is this still correct?
>
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> > ---
> > v2->v3:
> > - forward error from of_address_to_resource
> > - use devm_ioremap instead of_iomap
> > v1->v2:
> > - make sure to use iounmap when driver is removed
> > ---
> > drivers/reset/reset-microchip-sparx5.c | 16 +++++++++++-----
> > 1 file changed, 11 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
> > index aa5464be7053b..176b3f46e9243 100644
> > --- a/drivers/reset/reset-microchip-sparx5.c
> > +++ b/drivers/reset/reset-microchip-sparx5.c
> > @@ -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>
> > @@ -72,14 +73,19 @@ 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 would be nice to add a comment here that devm_of_iomap() can't be
> used because the resource is shared with other devices. Do you know
> which ones?
Yes, I will add a comment in the next version.
Looking at the device trees (lan966x.dtsi), it looks like it is shared
with the clock driver (clks).
>
> Otherwise, this looks good to me.
>
>
> regards
> Philipp
--
/Horatiu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-02-27 10:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 14:46 [PATCH v3] reset: mchp: sparx5: Fix for lan966x Horatiu Vultur
2025-02-26 16:32 ` Philipp Zabel
2025-02-26 17:24 ` Herve Codina
2025-02-27 10:25 ` Philipp Zabel
2025-02-27 8:51 ` Horatiu Vultur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).