[U-Boot] [PATCH] cmd/fdt: support single value replacement within an array

sjg at google.com sjg at google.com
Fri Jun 9 00:02:06 UTC 2017


sjg at google.com schrieb am 01.06.2017 05:11:57:

> <hannes.schmelzer at br-automation.com> wrote:
> > With this commit we can modify single values within an array of a dts
> > property.
> >
> > This is useful if we have for example a pwm-backlight where we want to
> > modifiy the pwm frequency per u-boot script.
> >
> > The pwm is described in dts like this:
> >
> > backlight {
> >         pwms = <0x0000002b 0x00000000 0x004c4b40>;
> > };
> >
> > For changing the frequency, here the 3rd parameter, we simply type:
> >
> > fdt set /backlight pwms <? ? 0x1E8480>;
> >
> > For doing all this we:
> > - backup the property content into our 'SCRATCHPAD'
> > - only modify the array-cell if the new content doesn't start with '?'
> >
> > Signed-off-by: Hannes Schmelzer <hannes.schmelzer at br-automation.com>
> >
> > ---
> >
> >  cmd/fdt.c | 29 +++++++++++++++++++++--------
> >  1 file changed, 21 insertions(+), 8 deletions(-)
>
> Reviewed-by: Simon Glass <sjg at chromium.org>
>
> I imagine this would have to be done before setting 'stdout' to
> 'vidconsole' so that the PWM is not inited before this script runs.
Yes, if lcd output is used already in u-boot this is correct.
For my case i don't have any output in u-boot, but later on within linux
environment.

But setting some pwm frequency is only one example for using this, every
other array-property can also be modified with this.

cheers,
Hannes




Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list