Re: [PATCH 2/2] clk: set flags in the ccf registration routines

2020-04-13 Thread dariobin


> Il 13 aprile 2020 alle 15.02 Sean Anderson  ha scritto:
> 
> 
> On 4/13/20 8:36 AM, Dario Binacchi wrote:
> > The top-level framework flags are passed as parameter to the common
> > clock framework (ccf) registration routines without being used.
> > Checks of the flags setting added by the patch have been added in the
> > ccf test.
> > 
> > Signed-off-by: Dario Binacchi 
> 
> Are you planning on making behaviour depend on the flags? 
No, I am not planning developments depending on flags. 
Except that during the implementation of a driver for an omap clock divider I 
had the opportunity to take a look at the code of the ccf clock-divider driver, 
and more generally to the ccf drivers. I was amazed that in the registration 
routines the flags parameter was not assigned to the clk structure flags field.

Thanks and regards
Dario Binacchi
> As far as I
> can tell, none of them are actually used in the CCF. It seems like they
> were carried over from Linux.
> 
> --Sean


Re: [PATCH 3/3] dm: core: refactor functions reading an u32 from dt

2020-04-04 Thread dariobin
> Il 2 aprile 2020 alle 20.54 Simon Glass  ha scritto:
> 
> 
> Hi Dario,
> 
> On Wed, 1 Apr 2020 at 13:34,  wrote:
> >
> >
> > > Il 31 marzo 2020 alle 1.57 Simon Glass  ha scritto:
> > >
> > >
> > > On Sun, 29 Mar 2020 at 10:05, Dario Binacchi  wrote:
> > > >
> > > > Now reading a 32 bit value from a device-tree property can be expressed
> > > > as reading the first element of an array with a single value.
> > > >
> > > > Signed-off-by: Dario Binacchi 
> > > >
> > > > ---
> > > >
> > > >  drivers/core/of_access.c | 16 +---
> > > >  drivers/core/ofnode.c| 23 ++-
> > > >  2 files changed, 3 insertions(+), 36 deletions(-)
> > >
> > > Reviewed-by: Simon Glass 
> > >
> > > Can you please check the code-size delta in SPL on a suitable board?
> >
> > I have a black beaglebone available (am335x_evm_defconfig).
> >
> > u-boot-spl.map generated without applying the refactoring patch
> > 
> >  .text.ofnode_read_u32
> > 0x   0x2e drivers/built-in.o
> >  .text.ofnode_read_u32_index
> > 0x   0x38 drivers/built-in.o
> >  .text.ofnode_read_u32_default
> > 0x   0x12 drivers/built-in.o
> >
> > u-boot-spl.map genarated with the refactoring patch applied
> > 
> >  .text.ofnode_read_u32_index
> > 0x   0x38 drivers/built-in.o
> >  .text.ofnode_read_u32
> > 0x0x8 drivers/built-in.o
> >  .text.ofnode_read_u32_default
> > 0x   0x14 drivers/built-in.o
> 
> Possibly, but a better test is to build your branch with the patch in:
> 
> buildman -b  
> 
> Then check the size:
> 
> buildman -b  -sS
> 
> or function detail:
> 
> buildman -b  -sSB
> 
> That will give us a true picture for SPL. It will show incremental
> size increase with your patch.

Hi Simon, 
this is the buildman response:
...
03: dm: core: support reading a single indexed u32 value
04: dm: core: refactor functions reading an u32 from dt
   arm: (for 4/708 boards) all +11.5 bss -10.0 text +21.5
am335x_hs_evm  : all +24 text +24
   u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
 function   old new   delta
 ofnode_read_u32_index-  62 +62
 ofnode_read_u32_default 18  20  +2
 ofnode_read_u32 46   8 -38
am335x_hs_evm_uart: all +24 text +24
   u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
 function   old new   delta
 ofnode_read_u32_index-  62 +62
 ofnode_read_u32_default 18  20  +2
 ofnode_read_u32 46   8 -38
am335x_evm : bss -24 text +24
   u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
 function   old new   delta
 ofnode_read_u32_index-  62 +62
 ofnode_read_u32_default 18  20  +2
 ofnode_read_u32 46   8 -38
am335x_boneblack_vboot: all -2 bss -16 text +14
   u-boot: add: 1/0, grow: 1/-1 bytes: 64/-38 (26)
 function   old new   delta
 ofnode_read_u32_index-  62 +62
 ofnode_read_u32_default 18  20  +2
 ofnode_read_u32 46   8 -38

Regards,
Dario
> 
> See buildman docs for more info.
> 
> Regards,
> Simon


Re: [PATCH 2/3] dm: core: support reading a single indexed u32 value

2020-04-01 Thread dariobin
Do you think it would make sense to add indexed access also for the s32, u32u 
and u64 types or at least some of those ?

Thanks and regards
Dario Binacchi

> Il 31 marzo 2020 alle 1.57 Simon Glass  ha scritto:
> 
> 
> On Sun, 29 Mar 2020 at 10:05, Dario Binacchi  wrote:
> >
> > The patch adds helper functions to allow reading a single indexed u32
> > value from a device-tree property containing multiple u32 values, that
> > is an array of integers.
> >
> > Signed-off-by: Dario Binacchi 
> > ---
> >
> >  arch/sandbox/dts/test.dts |  1 +
> >  drivers/core/of_access.c  | 22 +
> >  drivers/core/ofnode.c | 40 +++
> >  drivers/core/read.c   | 13 +
> >  include/dm/of_access.h| 19 +++
> >  include/dm/ofnode.h   | 25 
> >  include/dm/read.h | 40 +++
> >  test/dm/test-fdt.c| 29 
> >  8 files changed, 189 insertions(+)
> >
> 
> Reviewed-by: Simon Glass 
> 
> Very nice


Re: [PATCH 3/3] dm: core: refactor functions reading an u32 from dt

2020-04-01 Thread dariobin


> Il 31 marzo 2020 alle 1.57 Simon Glass  ha scritto:
> 
> 
> On Sun, 29 Mar 2020 at 10:05, Dario Binacchi  wrote:
> >
> > Now reading a 32 bit value from a device-tree property can be expressed
> > as reading the first element of an array with a single value.
> >
> > Signed-off-by: Dario Binacchi 
> >
> > ---
> >
> >  drivers/core/of_access.c | 16 +---
> >  drivers/core/ofnode.c| 23 ++-
> >  2 files changed, 3 insertions(+), 36 deletions(-)
> 
> Reviewed-by: Simon Glass 
> 
> Can you please check the code-size delta in SPL on a suitable board?

I have a black beaglebone available (am335x_evm_defconfig).

u-boot-spl.map generated without applying the refactoring patch

 .text.ofnode_read_u32
0x   0x2e drivers/built-in.o
 .text.ofnode_read_u32_index
0x   0x38 drivers/built-in.o
 .text.ofnode_read_u32_default
0x   0x12 drivers/built-in.o

u-boot-spl.map genarated with the refactoring patch applied

 .text.ofnode_read_u32_index
0x   0x38 drivers/built-in.o
 .text.ofnode_read_u32
0x0x8 drivers/built-in.o
 .text.ofnode_read_u32_default
0x   0x14 drivers/built-in.o

I hope I have correctly answered what you asked me. Otherwise I am available to 
perform the right checks on your indications.

Thanks and regards,
Dario Binacchi


Re: [PATCH v2 10/13] arm: dts: am335x: add 'u-boot,dm-pre-reloc' to panel

2020-02-17 Thread dariobin


> Il 17 febbraio 2020 alle 11.56 Felix Brack  ha scritto:
> 
> 
> 
> 
> On 16.02.20 16:09, Dario Binacchi wrote:
> > Add the "u-boot,dm-pre-reloc" property to the "ti,tilcdc,panel"
> > compatible node. In this way the video-uclass module can allocate the
> > amount of memory needed to be assigned to the frame buffer.
> > In the case of the boards that support Linux, the addition of the
> > property in the *-u-boot.dtsi file still required  changing its dts
> > file adding a label to the panel node in order to be referenced.
> > 
> > Signed-off-by: Dario Binacchi 
> > 
> > 
> >  - Change subject line in: arm: dts: am335x:
> >  - Move 'u-boot,dm-pre-reloc' property in *-u-boot.dtsi files for
> >boards tha support Linux
> >  - Ran building tests with CONFIG_AM335X_LCD enabled and disabled for
> >following configurations:
> > - brxre1_defconfig   --> success
> > - am335x_guardian_defconfig  --> success
> > - am335x_evm_defconfig   --> success
> > - da850evm_defconfig --> failure with CONFIG_AM335X_LCD enabled
> > 
> >Enabling CONFIG_AM335X_LCD causes building errors even without applying
> >the patch. The driver has never been enabled on the da850 and must be
> >adapted for this platform.
> > 
> > ---
> > 
> > Changes in v2: None
> > 
> >  arch/arm/dts/am335x-brppt1-mmc.dts   |  2 ++
> >  arch/arm/dts/am335x-brppt1-nand.dts  |  2 ++
> >  arch/arm/dts/am335x-brppt1-spi.dts   |  2 ++
> >  arch/arm/dts/am335x-brsmarc1.dts |  1 +
> >  arch/arm/dts/am335x-brxre1.dts   |  2 ++
> >  arch/arm/dts/am335x-evm-u-boot.dtsi  |  4 
> >  arch/arm/dts/am335x-evm.dts  |  2 +-
> >  arch/arm/dts/am335x-evmsk-u-boot.dtsi| 10 ++
> >  arch/arm/dts/am335x-evmsk.dts|  2 +-
> >  arch/arm/dts/am335x-guardian-u-boot.dtsi |  4 
> >  arch/arm/dts/am335x-guardian.dts |  2 +-
> >  arch/arm/dts/am335x-pdu001-u-boot.dtsi   |  4 
> >  arch/arm/dts/am335x-pdu001.dts   |  2 +-
> >  arch/arm/dts/am335x-pxm50-u-boot.dtsi| 10 ++
> >  arch/arm/dts/am335x-pxm50.dts|  2 +-
> >  arch/arm/dts/am335x-rut-u-boot.dtsi  | 10 ++
> >  arch/arm/dts/am335x-rut.dts  |  2 +-
> >  arch/arm/dts/da850-evm-u-boot.dtsi   |  4 
> >  arch/arm/dts/da850-evm.dts   |  2 +-
> >  19 files changed, 62 insertions(+), 7 deletions(-)
> >  create mode 100644 arch/arm/dts/am335x-evmsk-u-boot.dtsi
> >  create mode 100644 arch/arm/dts/am335x-pxm50-u-boot.dtsi
> >  create mode 100644 arch/arm/dts/am335x-rut-u-boot.dtsi
> > 
> > diff --git a/arch/arm/dts/am335x-brppt1-mmc.dts 
> > b/arch/arm/dts/am335x-brppt1-mmc.dts
> > index 9be34d9da0..6f919711f0 100644
> > --- a/arch/arm/dts/am335x-brppt1-mmc.dts
> > +++ b/arch/arm/dts/am335x-brppt1-mmc.dts
> > @@ -53,6 +53,8 @@
> > bkl-pwm = <&pwmbacklight>;
> > bkl-tps = <&tps_bl>;
> >  
> > +   u-boot,dm-pre-reloc;
> > +
> > panel-info {
> > ac-bias = <255>;
> > ac-bias-intrpt  = <0>;
> > diff --git a/arch/arm/dts/am335x-brppt1-nand.dts 
> > b/arch/arm/dts/am335x-brppt1-nand.dts
> > index 11bd5c551c..9d4340f591 100644
> > --- a/arch/arm/dts/am335x-brppt1-nand.dts
> > +++ b/arch/arm/dts/am335x-brppt1-nand.dts
> > @@ -53,6 +53,8 @@
> > bkl-pwm = <&pwmbacklight>;
> > bkl-tps = <&tps_bl>;
> >  
> > +   u-boot,dm-pre-reloc;
> > +
> > panel-info {
> > ac-bias = <255>;
> > ac-bias-intrpt  = <0>;
> > diff --git a/arch/arm/dts/am335x-brppt1-spi.dts 
> > b/arch/arm/dts/am335x-brppt1-spi.dts
> > index 01ab74be5e..c078af8fba 100644
> > --- a/arch/arm/dts/am335x-brppt1-spi.dts
> > +++ b/arch/arm/dts/am335x-brppt1-spi.dts
> > @@ -54,6 +54,8 @@
> > bkl-pwm = <&pwmbacklight>;
> > bkl-tps = <&tps_bl>;
> >  
> > +   u-boot,dm-pre-reloc;
> > +
> > panel-info {
> > ac-bias = <255>;
> > ac-bias-intrpt  = <0>;
> > diff --git a/arch/arm/dts/am335x-brsmarc1.dts 
> > b/arch/arm/dts/am335x-brsmarc1.dts
> > index a63fc2da22..7e9516e8f8 100644
> > --- a/arch/arm/dts/am335x-brsmarc1.dts
> > +++ b/arch/arm/dts/am335x-brsmarc1.dts
> > @@ -59,6 +59,7 @@
> > /*backlight = <&tps_bl>; */
> > compatible = "ti,tilcdc,panel";
> > status = "okay";
> > +   u-boot,dm-pre-reloc;
> >  
> > panel-info {
> > ac-bias = <255>;
> > diff --git a/arch/arm/dts/am335x-brxre1.dts b/arch/arm/dts/am335x-brxre1.dts
> > index 33d8ab78d8..6091a12fb7 100644
> > --- a/arch/arm/dts/am335x-brxre1.dts
> > +++ b/arch/arm/dts/am335x-brxre1.dts
> > @@ -79,6 +79,8 @@
> >  
> > backlight = <&tps_bl>;
> >  
> > +   u-boot,dm-pre-reloc;
> > +
> > panel-info {
> > ac-bias = <255>;
> >

Re: [PATCH 10/11] arm: fdt: omap: update dts panel node

2020-02-11 Thread dariobin


> Il 11 febbraio 2020 alle 5.11 Lokesh Vutla  ha scritto:
> 
> 
> 
> 
> On 11/02/20 1:49 AM, dario...@libero.it wrote:
> > Hi Lokesh
> > 
> >> Il 10 febbraio 2020 alle 5.22 Lokesh Vutla  ha scritto:
> >>
> >>
> >>
> >>
> >> On 10/02/20 12:17 AM, Dario Binacchi wrote:
> >>> Add the "u-boot,dm-pre-reloc" property to the "ti,tilcdc,panel"
> >>> compatible node. In this way the video-uclass module can allocate the
> >>> amount of memory needed to be assigned to the frame buffer.
> >>
> >> hmm..why do you need to add pre-reloc for allocating the memory? pre-reloc 
> >> flag
> >> is needed only when probing before relocation.
> >>
> > u-boot told me with an error message. 
> > Following the message I arrived at the video-uclass.c:
> > 
> > /* Device tree node may need the 'u-boot,dm-pre-reloc' or
> >  * 'u-boot,dm-pre-proper' tag
> >  */
> > printf("Video device '%s' cannot allocate frame buffer memory 
> > -ensure the device is set up before relocation\n",
> >dev->name);
> > return -ENOSPC;
> 
> When does your driver gets probed?
The driver is probed in 
int board_late_init(void)
{
ret = uclass_get_device(UCLASS_VIDEO, 0, &dev);
if (ret)
printf("Unable to get VIDEO device (%d)\n", ret);

ret = uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con);
if (ret)
printf("Unable to get VIDEO CONSOLE device (%d)\n", ret);

snprintf(buf, sizeof(buf), "%s\n%s\n", U_BOOT_VERSION, corp);
vidconsole_position_cursor(con, 0, 0);
for (s = buf; *s; s++)
vidconsole_put_char(con, *s);

}

but, without the "u-boot,dm-pre-reloc" property, the error occurs early, during 
the video device post_binding.
I enabled debug messages in :
- drivers/core/device.c
- drivers/core/uclass.c
- drivers/video/video-uclass.c
and this is what is displayed by u-boot console:
U-Boot SPL 2018.11-rc2 (Feb 11 2020 - 17:34:58 +0100)
Trying to boot from NAND
## Checking hash(es) for Image uboot ... sha1+ OK
## Checking hash(es) for Image fdt ... sha1+ OK


U-Boot 2018.11-rc2 (Feb 11 2020 - 17:34:58 +0100)

CPU  : AM335X-GP rev 2.1
Model: TI AM335x
DRAM:  Video frame buffers from 8fff to 8fff
256 MiB
uclass_find_device_by_seq: 0 -1
uclass_find_device_by_seq: 0 0
   - -1 -1 'root_driver'
   - not found
Bound device mod_exp_sw to root_driver
Bound device scm@21 to l4_wkup@44c0
Bound device l4_wkup@44c0 to ocp
Bound device gpio@44e07000 to ocp
Bound device gpio@4804c000 to ocp
Bound device gpio@481ac000 to ocp
Bound device gpio@481ae000 to ocp
Bound device serial@44e09000 to ocp
Bound device serial@48022000 to ocp
Bound device serial@48024000 to ocp
Bound device serial@481a6000 to ocp
Bound device i2c@44e0b000 to ocp
Bound device i2c@4802a000 to ocp
Bound device mmc@4806 to ocp
Bound device timer@4804 to ocp
Bound device timer@48042000 to ocp
Bound device timer@48044000 to ocp
Bound device timer@48046000 to ocp
Bound device timer@48048000 to ocp
Bound device timer@4804a000 to ocp
Bound device usb@47401000 to usb@4740
Bound device usb@47401800 to usb@4740
Bound device usb@4740 to ocp
Bound device ethernet@4a10 to ocp
Bound device ocp to root_driver
Video device 'panel' cannot allocate frame buffer memory -ensure the device is 
set up before relocation
Error binding driver 'am335x_fb': -28
Some drivers failed to bind
initcall sequence 8ffca898 failed at call 8080f71f (err=-28)
### ERROR ### Please RESET the board ###  

Thanks
Best Regards
Dario 
> 
> Thanks and regards,
> Lokesh
> 
> >>>
> >>> Signed-off-by: Dario Binacchi 
> >>
> >> $subject should be : arm: dts: am335x:
> > Ok. I will change it.
> > 
> >>
> >>> ---
> >>>
> >>>  arch/arm/dts/am335x-brppt1-mmc.dts  | 2 ++
> >>>  arch/arm/dts/am335x-brppt1-nand.dts | 2 ++
> >>>  arch/arm/dts/am335x-brppt1-spi.dts  | 2 ++
> >>>  arch/arm/dts/am335x-brsmarc1.dts| 1 +
> >>>  arch/arm/dts/am335x-brxre1.dts  | 2 ++
> >>>  arch/arm/dts/am335x-evm.dts | 1 +
> >>>  arch/arm/dts/am335x-evmsk.dts   | 1 +
> >>>  arch/arm/dts/am335x-guardian.dts| 1 +
> >>>  arch/arm/dts/am335x-pdu001.dts  | 1 +
> >>>  arch/arm/dts/am335x-pxm50.dts   | 1 +
> >>>  arch/arm/dts/am335x-rut.dts | 1 +
> >>>  arch/arm/dts/da850-evm.dts  | 1 +
> >>>  12 files changed, 16 insertions(+)
> >>>
> >>> diff --git a/arch/arm/dts/am335x-brppt1-mmc.dts 
> >>> b/arch/arm/dts/am335x-brppt1-mmc.dts
> >>> index 9be34d9da0..6f919711f0 100644
> >>> --- a/arch/arm/dts/am335x-brppt1-mmc.dts
> >>> +++ b/arch/arm/dts/am335x-brppt1-mmc.dts
> >>> @@ -53,6 +53,8 @@
> >>>   bkl-pwm = <&pwmbacklight>;
> >>>   bkl-tps = <&tps_bl>;
> >>>  
> >>> + u-boot,dm-pre-reloc;
> >>
> >> This is u-boot specific dt flag. Please use it under *-u-boot.dtsi file.
> > Ok. I will fix it.
> > 
> > ---
> > Dario
> >>
> >> Thanks and regards,
> >> Lokesh