Subject: Re: [PATCH v6 2/7] reset: mchp: sparx5: Use the second reg item when cpu-syscon is not present

From: Herve Codina <[email-masked]>
Date: Wed, 2 Oct 2024 12:19:57 +0200

Hi Arnd,

On Wed, 02 Oct 2024 09:29:35 +0000
"Arnd Bergmann" <[email-masked]> wrote:

> On Tue, Oct 1, 2024, at 16:30, Herve Codina wrote:
> > On Mon, 30 Sep 2024 16:26:16 +0200
> > Herve Codina <[email-masked]> wrote:
> > --- 8< ---
> >
> > In mchp_sparx5_map_syscon(), I will call the syscon API or the local
> > function based on the device compatible string:
> > 	--- 8< ---
> > 	if (of_device_is_compatible(pdev->dev.of_node, 
> > "microchip,lan966x-switch-reset"))
> > 		regmap = mchp_lan966x_syscon_to_regmap(&pdev->dev, syscon_np);
> > 	else
> > 		regmap = syscon_node_to_regmap(syscon_np);
> > 	--- 8< ---
> >
> > Is this kind of solution you were expecting?
> > If you have thought about something different, can you give me some pointers?  
> 
> Hi Hervé,
> 
> The way I had imagined this was to not need an if() check
> at all but unconditionally map the syscon registers in the
> reset driver.
> 
> The most important part here is to have sensible bindings
> that don't need to describe the difference between PCI
> and SoC mode. This seems fine for the lan966x case, but
> I'm not sure why you need to handle sparx5 differently here.
> Do you expect the syscon to be shared with other drivers
> on sparx5 but not lan966x?

Thanks for this reply.

Exactly, on sparx5 syscon is shared...
$ git grep 'microchip,sparx5-cpu-syscon'
...
arch/arm64/boot/dts/microchip/sparx5.dtsi:                      compatible = "microchip,sparx5-cpu-syscon", "syscon",
drivers/mmc/host/sdhci-of-sparx5.c:     const char *syscon = "microchip,sparx5-cpu-syscon";
drivers/power/reset/ocelot-reset.c:     .syscon          = "microchip,sparx5-cpu-syscon",
drivers/spi/spi-dw-mmio.c:      const char *syscon_name = "microchip,sparx5-cpu-syscon";
$

> 
> I don't thinkt this bit matters too much and what you suggest
> works fine, I just want to be sure I understand what you are
> doing.
> 
>       Arnd

Best regards,
Hervé