Hi Frank,

On Mon, 15 Jul 2024 at 21:50, Frank Wunderlich <fran...@public-files.de> wrote:
>
> > Gesendet: Samstag, 13. Juli 2024 um 17:13 Uhr
> > Von: "Simon Glass" <s...@chromium.org>
> > Betreff: Re: avoid syscon fallback class for getting regmap
> >
> > Hi Frank,
> >
> > On Wed, 10 Jul 2024 at 14:43, Frank Wunderlich <fran...@public-files.de> 
> > wrote:
> > >
> > > Hi,
> > >
> > > i'm working on OF_UPSTREAM for mediatek boards and noticed missing 
> > > syscon-fallback on some (mt7988) devicetree nodes.
> > >
> > > i know that u-boot uses this fallback to get the regmap shared across 
> > > drivers, but only initializing once with the syscon_uclass.
> > >
> > > i tried adding the syscon-fallback to linux device tree and got pointed 
> > > [1] back to uboot to solve the issue there...
> > >
> > > are there any ways to avoid syscon in device tree and get the regmap of 
> > > different node?
> > >
> > > i guess i could use [2], but then it is possible to aquire same regmap 
> > > multiple times which may result in issues (e.g. race-conditions).
> > > I also want to avoid creating multiple drivers doing the exactily same 
> > > thing like syscon.
> > >
> > > one easy (but maybe unwanted way) is to add all compatibles for affected 
> > > syscons to the syscon driver...but then it is no more generic (baed on 
> > > compatibles then vendor-specific).
> >
> > One option is to create a new driver in a new file and have its ops
> > use the syscon ops. See for example
> > arch/arm/mach-rockchip/rk3399/syscon_rk3399.c
>
> Hi Simon,
>
> thanks for the suggestion, but i have not got it working yet
>
>
> still fails here (drivers/net/mtk_eth.c):
>
>                 priv->xfi_pll_regmap = syscon_node_to_regmap(args.node);

It isn't node, it's a 'driver data' value (see comments for
syscon_get_by_driver_data()). So:

syscon_get_regmap_by_driver_data(MEDIATEK_SYSCON_WDT)

>
> this is how i tried:
> https://github.com/frank-w/u-boot/commit/a1060c88152fe8aa8a092f087591240f930146b3
>
> do i miss something (i guess i do not need the data-field as i only need the 
> regmap)?

The driver_data field is set automatically by driver model - see [1]

The data field is the thing being looked up by
syscon_get_regmap_by_driver_data(), so you do need it.

Regards,
Simon

[1] 
https://docs.u-boot.org/en/latest/develop/driver-model/design.html#bind-stage

Reply via email to