diff mbox series

[V3,3/6] ARM: stm32: Implement board coding on AV96

Message ID 20200422111814.121060-3-marex@denx.de
State Accepted
Commit 731fd50e27fb3e9e55eb508cebebc7a111616a30
Headers show
Series [V3,1/6] ARM: stm32: Add default config for DHCOR | expand

Commit Message

Marek Vasut April 22, 2020, 11:18 a.m. UTC
The AV96 board does exist in multiple variants. To cater for all of
them, implement board code handling. There are two GPIOs which code
the type of the board, read them out and use the value to pick the
correct device tree from an fitImage.

Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
Cc: Patrick Delaunay <patrick.delaunay at st.com>
Cc: Patrice Chotard <patrice.chotard at st.com>
---
V2: No change
V3: Drop dm-pre-reloc and gpio-cells from config node
---
 arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
 .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
 arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
 board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
 board/dhelectronics/dh_stm32mp1/board.c       | 61 +++++++++++++++++++
 .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
 .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
 configs/stm32mp15_dhcom_basic_defconfig       |  3 +
 configs/stm32mp15_dhcor_basic_defconfig       |  3 +
 include/configs/dh_stm32mp1.h                 | 15 +++++
 10 files changed, 170 insertions(+), 1 deletion(-)
 create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
 create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
 create mode 100644 include/configs/dh_stm32mp1.h

Comments

Patrick Delaunay April 22, 2020, 3:04 p.m. UTC | #1
Hi Marek,

> From: Marek Vasut <marex at denx.de>
> Sent: mercredi 22 avril 2020 13:18
> 
> The AV96 board does exist in multiple variants. To cater for all of them, implement
> board code handling. There are two GPIOs which code the type of the board, read
> them out and use the value to pick the correct device tree from an fitImage.
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
> Cc: Patrick Delaunay <patrick.delaunay at st.com>
> Cc: Patrice Chotard <patrice.chotard at st.com>
> ---
> V2: No change
> V3: Drop dm-pre-reloc and gpio-cells from config node
> ---
>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
>  board/dhelectronics/dh_stm32mp1/board.c       | 61 +++++++++++++++++++
>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
>  include/configs/dh_stm32mp1.h                 | 15 +++++
>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode 100644
> board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
>  create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
>  create mode 100644 include/configs/dh_stm32mp1.h
> 

I have 2 compilation issue on this patch with buildman

tools/buildman/buildman -v -V stm32mp15_dhcom_basic stm32mp15_dhcor_basic

Building current source for 2 boards (2 threads, 6 jobs per thread)
       arm:  +   stm32mp15_dhcor_basic
+FATAL ERROR: Couldn't open "board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its": No such file or directory
+./tools/mkimage: Can't open u-boot.itb.tmp: No such file or directory
+/local/home/frq07632/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: common/built-in.o: in function `fit_find_config_node':
+common/common_fit.c:66: undefined reference to `board_fit_config_name_match'
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2
       arm:  +   stm32mp15_dhcom_basic                   
+FATAL ERROR: Couldn't open "board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its": No such file or directory
+./tools/mkimage: Can't open u-boot.itb.tmp: No such file or directory
+/local/home/frq07632/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: common/built-in.o: in function `fit_find_config_node':
+common/common_fit.c:66: undefined reference to `board_fit_config_name_match'
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
+make: *** [sub-make] Error 2
    0    0    2 /2      stm32mp15_dhcom_basic
 

The 'board_fit_config_name_match'  error 
is just because CONFIG_BOARD_EARLY_INIT_F=y is missing in the 2 defconfig 
(added in PATH 6/6 but needed in patch 3)


But I reproduce of other buildman just with out of dir compilation
KBUILD_OUTPUT=../build

I think that Makefile  serach CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its" 
in the builddir but it is present in the srcdir.

And you are the first user of CONFIG_SPL_FIT_SOURCE...

I want to propose to copy the file with:

----------------------------------- Makefile -----------------------------------
index 26307fd4a6..2dbf96a073 100644
@@ -1320,7 +1320,12 @@ endif
 # Boards with more complex image requirements can provide an .its source file
 # or a generator script
 ifneq ($(CONFIG_SPL_FIT_SOURCE),"")
-U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
+
+U_BOOT_ITS := u-boot.its
+
+$(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
+	$(call if_changed,copy)
+
 else
 ifneq ($(CONFIG_SPL_FIT_GENERATOR),"")
 U_BOOT_ITS := u-boot.its


But then you need to update the patch in .its files....

=> remove no more necessary "../../../"

Regards

Patrick
Marek Vasut April 22, 2020, 3:18 p.m. UTC | #2
On 4/22/20 5:04 PM, Patrick DELAUNAY wrote:
> Hi Marek,

Hi,

>> From: Marek Vasut <marex at denx.de>
>> Sent: mercredi 22 avril 2020 13:18
>>
>> The AV96 board does exist in multiple variants. To cater for all of them, implement
>> board code handling. There are two GPIOs which code the type of the board, read
>> them out and use the value to pick the correct device tree from an fitImage.
>>
>> Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
>> Signed-off-by: Marek Vasut <marex at denx.de>
>> Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
>> Cc: Patrick Delaunay <patrick.delaunay at st.com>
>> Cc: Patrice Chotard <patrice.chotard at st.com>
>> ---
>> V2: No change
>> V3: Drop dm-pre-reloc and gpio-cells from config node
>> ---
>>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
>>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
>>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
>>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
>>  board/dhelectronics/dh_stm32mp1/board.c       | 61 +++++++++++++++++++
>>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
>>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
>>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
>>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
>>  include/configs/dh_stm32mp1.h                 | 15 +++++
>>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode 100644
>> board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
>>  create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
>>  create mode 100644 include/configs/dh_stm32mp1.h
>>
> 
> I have 2 compilation issue on this patch with buildman
> 
> tools/buildman/buildman -v -V stm32mp15_dhcom_basic stm32mp15_dhcor_basic
> 
> Building current source for 2 boards (2 threads, 6 jobs per thread)
>        arm:  +   stm32mp15_dhcor_basic
> +FATAL ERROR: Couldn't open "board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its": No such file or directory
> +./tools/mkimage: Can't open u-boot.itb.tmp: No such file or directory
> +/local/home/frq07632/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: common/built-in.o: in function `fit_find_config_node':
> +common/common_fit.c:66: undefined reference to `board_fit_config_name_match'
> +make[2]: *** [spl/u-boot-spl] Error 1
> +make[1]: *** [spl/u-boot-spl] Error 2
> +make: *** [sub-make] Error 2
>        arm:  +   stm32mp15_dhcom_basic                   
> +FATAL ERROR: Couldn't open "board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its": No such file or directory
> +./tools/mkimage: Can't open u-boot.itb.tmp: No such file or directory
> +/local/home/frq07632/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: common/built-in.o: in function `fit_find_config_node':
> +common/common_fit.c:66: undefined reference to `board_fit_config_name_match'
> +make[2]: *** [spl/u-boot-spl] Error 1
> +make[1]: *** [spl/u-boot-spl] Error 2
> +make: *** [sub-make] Error 2
>     0    0    2 /2      stm32mp15_dhcom_basic
>  
> 
> The 'board_fit_config_name_match'  error 
> is just because CONFIG_BOARD_EARLY_INIT_F=y is missing in the 2 defconfig 
> (added in PATH 6/6 but needed in patch 3)

Ha, OK, I'll move that in V4.

> But I reproduce of other buildman just with out of dir compilation
> KBUILD_OUTPUT=../build
> 
> I think that Makefile  serach CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its" 
> in the builddir but it is present in the srcdir.
> 
> And you are the first user of CONFIG_SPL_FIT_SOURCE...

Most certainly not the first, this was used before.

> I want to propose to copy the file with:
> 
> ----------------------------------- Makefile -----------------------------------
> index 26307fd4a6..2dbf96a073 100644
> @@ -1320,7 +1320,12 @@ endif
>  # Boards with more complex image requirements can provide an .its source file
>  # or a generator script
>  ifneq ($(CONFIG_SPL_FIT_SOURCE),"")
> -U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
> +
> +U_BOOT_ITS := u-boot.its
> +
> +$(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
> +	$(call if_changed,copy)
> +
>  else
>  ifneq ($(CONFIG_SPL_FIT_GENERATOR),"")
>  U_BOOT_ITS := u-boot.its
> 
> 
> But then you need to update the patch in .its files....
> 
> => remove no more necessary "../../../"

Cam you send this patch, so I can rebase on top of it ?
Patrick Delaunay April 23, 2020, 7:42 a.m. UTC | #3
Dear Marek,

> From: Marek Vasut <marex at denx.de>
> Sent: mercredi 22 avril 2020 17:19
> 
> On 4/22/20 5:04 PM, Patrick DELAUNAY wrote:
> > Hi Marek,
> 
> Hi,
> 
> >> From: Marek Vasut <marex at denx.de>
> >> Sent: mercredi 22 avril 2020 13:18
> >>
> >> The AV96 board does exist in multiple variants. To cater for all of
> >> them, implement board code handling. There are two GPIOs which code
> >> the type of the board, read them out and use the value to pick the correct
> device tree from an fitImage.
> >>
> >> Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
> >> Signed-off-by: Marek Vasut <marex at denx.de>
> >> Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
> >> Cc: Patrick Delaunay <patrick.delaunay at st.com>
> >> Cc: Patrice Chotard <patrice.chotard at st.com>
> >> ---
> >> V2: No change
> >> V3: Drop dm-pre-reloc and gpio-cells from config node
> >> ---
> >>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
> >>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
> >>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
> >>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
> >>  board/dhelectronics/dh_stm32mp1/board.c       | 61 +++++++++++++++++++
> >>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
> >>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
> >>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
> >>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
> >>  include/configs/dh_stm32mp1.h                 | 15 +++++
> >>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode
> >> 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
> >>  create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
> >>  create mode 100644 include/configs/dh_stm32mp1.h
> >>
> >
> > I have 2 compilation issue on this patch with buildman
> >


[...]

> >
> > And you are the first user of CONFIG_SPL_FIT_SOURCE...
> 
> Most certainly not the first, this was used before.
> 

At least the last one ? checked by grep.

> > I want to propose to copy the file with:
> >
> > ----------------------------------- Makefile


[....]

> > But then you need to update the patch in .its files....
> >
> > => remove no more necessary "../../../"
> 
> Cam you send this patch, so I can rebase on top of it ?

Done in :

[PATCH] Makefile: copy SPL_FIT_SOURCE in build directory
http://patchwork.ozlabs.org/project/uboot/patch/20200423093845.1.Idf086bdb530238139f0066b3fecc01529d7c0b7d at changeid/

Regards

Patrick
Marek Vasut April 27, 2020, 11:40 a.m. UTC | #4
On 4/23/20 9:42 AM, Patrick DELAUNAY wrote:
[...]
>>>>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
>>>>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
>>>>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
>>>>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
>>>>  board/dhelectronics/dh_stm32mp1/board.c       | 61 +++++++++++++++++++
>>>>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
>>>>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
>>>>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
>>>>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
>>>>  include/configs/dh_stm32mp1.h                 | 15 +++++
>>>>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode
>>>> 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
>>>>  create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
>>>>  create mode 100644 include/configs/dh_stm32mp1.h
>>>>
>>>
>>> I have 2 compilation issue on this patch with buildman
>>>
> 
> 
> [...]
> 
>>>
>>> And you are the first user of CONFIG_SPL_FIT_SOURCE...
>>
>> Most certainly not the first, this was used before.
>>
> 
> At least the last one ? checked by grep.

Seems a lot of the boards moved over to the script-generated approach in
the meantime, oh well.

>>> I want to propose to copy the file with:
>>>
>>> ----------------------------------- Makefile
> 
> 
> [....]
> 
>>> But then you need to update the patch in .its files....
>>>
>>> => remove no more necessary "../../../"
>>
>> Cam you send this patch, so I can rebase on top of it ?
> 
> Done in :
> 
> [PATCH] Makefile: copy SPL_FIT_SOURCE in build directory
> http://patchwork.ozlabs.org/project/uboot/patch/20200423093845.1.Idf086bdb530238139f0066b3fecc01529d7c0b7d at changeid/

Thanks, that works fine. Do you want a V4 of this series with this
adjustment ?
Patrick Delaunay April 27, 2020, 12:09 p.m. UTC | #5
> -----Original Message-----
> From: Marek Vasut <marex at denx.de>
> Sent: lundi 27 avril 2020 13:41
> To: Patrick DELAUNAY <patrick.delaunay at st.com>; u-boot at lists.denx.de
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>; Patrice
> CHOTARD <patrice.chotard at st.com>
> Subject: Re: [PATCH V3 3/6] ARM: stm32: Implement board coding on AV96
> Importance: High
> 
> On 4/23/20 9:42 AM, Patrick DELAUNAY wrote:
> [...]
> >>>>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
> >>>>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
> >>>>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
> >>>>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
> >>>>  board/dhelectronics/dh_stm32mp1/board.c       | 61
> +++++++++++++++++++
> >>>>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
> >>>>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
> >>>>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
> >>>>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
> >>>>  include/configs/dh_stm32mp1.h                 | 15 +++++
> >>>>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode
> >>>> 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
> >>>>  create mode 100644
> >>>> board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
> >>>>  create mode 100644 include/configs/dh_stm32mp1.h
> >>>>
> >>>
> >>> I have 2 compilation issue on this patch with buildman
> >>>
> >
> >
> > [...]
> >
> >>>
> >>> And you are the first user of CONFIG_SPL_FIT_SOURCE...
> >>
> >> Most certainly not the first, this was used before.
> >>
> >
> > At least the last one ? checked by grep.
> 
> Seems a lot of the boards moved over to the script-generated approach in the
> meantime, oh well.
> 
> >>> I want to propose to copy the file with:
> >>>
> >>> ----------------------------------- Makefile
> >
> >
> > [....]
> >
> >>> But then you need to update the patch in .its files....
> >>>
> >>> => remove no more necessary "../../../"
> >>
> >> Cam you send this patch, so I can rebase on top of it ?
> >
> > Done in :
> >
> > [PATCH] Makefile: copy SPL_FIT_SOURCE in build directory
> > http://patchwork.ozlabs.org/project/uboot/patch/20200423093845.1.Idf08
> > 6bdb530238139f0066b3fecc01529d7c0b7d at changeid/
> 
> Thanks, that works fine. Do you want a V4 of this series with this adjustment ?

It is not necessary, I made the needed updates => present in stm32 next branch.

I will be in the next pull request as soon the Makefile update will  be accepted by Tom.

Regards

Patrick
Marek Vasut April 27, 2020, 12:18 p.m. UTC | #6
On 4/27/20 2:09 PM, Patrick DELAUNAY wrote:
> 
> 
>> -----Original Message-----
>> From: Marek Vasut <marex at denx.de>
>> Sent: lundi 27 avril 2020 13:41
>> To: Patrick DELAUNAY <patrick.delaunay at st.com>; u-boot at lists.denx.de
>> Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>; Patrice
>> CHOTARD <patrice.chotard at st.com>
>> Subject: Re: [PATCH V3 3/6] ARM: stm32: Implement board coding on AV96
>> Importance: High
>>
>> On 4/23/20 9:42 AM, Patrick DELAUNAY wrote:
>> [...]
>>>>>>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
>>>>>>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
>>>>>>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
>>>>>>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
>>>>>>  board/dhelectronics/dh_stm32mp1/board.c       | 61
>> +++++++++++++++++++
>>>>>>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
>>>>>>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
>>>>>>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
>>>>>>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
>>>>>>  include/configs/dh_stm32mp1.h                 | 15 +++++
>>>>>>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode
>>>>>> 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
>>>>>>  create mode 100644
>>>>>> board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
>>>>>>  create mode 100644 include/configs/dh_stm32mp1.h
>>>>>>
>>>>>
>>>>> I have 2 compilation issue on this patch with buildman
>>>>>
>>>
>>>
>>> [...]
>>>
>>>>>
>>>>> And you are the first user of CONFIG_SPL_FIT_SOURCE...
>>>>
>>>> Most certainly not the first, this was used before.
>>>>
>>>
>>> At least the last one ? checked by grep.
>>
>> Seems a lot of the boards moved over to the script-generated approach in the
>> meantime, oh well.
>>
>>>>> I want to propose to copy the file with:
>>>>>
>>>>> ----------------------------------- Makefile
>>>
>>>
>>> [....]
>>>
>>>>> But then you need to update the patch in .its files....
>>>>>
>>>>> => remove no more necessary "../../../"
>>>>
>>>> Cam you send this patch, so I can rebase on top of it ?
>>>
>>> Done in :
>>>
>>> [PATCH] Makefile: copy SPL_FIT_SOURCE in build directory
>>> http://patchwork.ozlabs.org/project/uboot/patch/20200423093845.1.Idf08
>>> 6bdb530238139f0066b3fecc01529d7c0b7d at changeid/
>>
>> Thanks, that works fine. Do you want a V4 of this series with this adjustment ?
> 
> It is not necessary, I made the needed updates => present in stm32 next branch.
> 
> I will be in the next pull request as soon the Makefile update will  be accepted by Tom.

Great, thanks!
Patrick Delaunay May 14, 2020, 7:36 a.m. UTC | #7
Hi,

> From: Marek Vasut <marex at denx.de>
> Sent: mercredi 22 avril 2020 13:18
> 
> The AV96 board does exist in multiple variants. To cater for all of them, implement
> board code handling. There are two GPIOs which code the type of the board, read
> them out and use the value to pick the correct device tree from an fitImage.
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
> Cc: Patrick Delaunay <patrick.delaunay at st.com>
> Cc: Patrice Chotard <patrice.chotard at st.com>
> ---
> V2: No change
> V3: Drop dm-pre-reloc and gpio-cells from config node
> ---
>  arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi    |  1 +
>  .../stm32mp15xx-dhcor-avenger96-u-boot.dtsi   |  1 +
>  arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi    |  7 +++
>  board/dhelectronics/dh_stm32mp1/Kconfig       |  2 +-
>  board/dhelectronics/dh_stm32mp1/board.c       | 61 +++++++++++++++++++
>  .../dh_stm32mp1/u-boot-dhcom.its              | 39 ++++++++++++
>  .../dh_stm32mp1/u-boot-dhcor.its              | 39 ++++++++++++
>  configs/stm32mp15_dhcom_basic_defconfig       |  3 +
>  configs/stm32mp15_dhcor_basic_defconfig       |  3 +
>  include/configs/dh_stm32mp1.h                 | 15 +++++
>  10 files changed, 170 insertions(+), 1 deletion(-)  create mode 100644
> board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
>  create mode 100644 board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
>  create mode 100644 include/configs/dh_stm32mp1.h
> 

Applied to u-boot-stm/master, thanks!

Regards

Patrick
diff mbox series

Patch

diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi
index 26bd6418c1..fa747f7974 100644
--- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi
@@ -23,6 +23,7 @@ 
 		u-boot,error-led = "error";
 		st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
 		st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
+		dh,som-coding-gpios = <&gpiof 12 0>, <&gpiof 13 0>, <&gpiof 15 0>;
 	};
 
 	led {
diff --git a/arch/arm/dts/stm32mp15xx-dhcor-avenger96-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcor-avenger96-u-boot.dtsi
index 4207a96618..7ccec95f15 100644
--- a/arch/arm/dts/stm32mp15xx-dhcor-avenger96-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp15xx-dhcor-avenger96-u-boot.dtsi
@@ -15,6 +15,7 @@ 
 	config {
 		u-boot,boot-led = "led1";
 		u-boot,error-led = "led4";
+		dh,board-coding-gpios = <&gpiog 13 0>, <&gpiod 9 0>;
 	};
 };
 
diff --git a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi
index 298239986f..915c3a8ae7 100644
--- a/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi
@@ -11,6 +11,13 @@ 
 #include "stm32mp15-u-boot.dtsi"
 #include "stm32mp15-ddr3-2x4Gb-1066-binG.dtsi"
 
+/ {
+	u-boot,dm-pre-reloc;
+	config {
+		dh,som-coding-gpios = <&gpioz 7 0>, <&gpiof 3 0>;
+	};
+};
+
 &i2c4 {
 	u-boot,dm-pre-reloc;
 };
diff --git a/board/dhelectronics/dh_stm32mp1/Kconfig b/board/dhelectronics/dh_stm32mp1/Kconfig
index 8eab986640..0a839f2546 100644
--- a/board/dhelectronics/dh_stm32mp1/Kconfig
+++ b/board/dhelectronics/dh_stm32mp1/Kconfig
@@ -7,7 +7,7 @@  config SYS_VENDOR
 	default "dhelectronics"
 
 config SYS_CONFIG_NAME
-	default "stm32mp1"
+	default "dh_stm32mp1"
 
 config ENV_SECT_SIZE
 	default 0x10000 if ENV_IS_IN_SPI_FLASH
diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c
index 322558157e..5193868d7c 100644
--- a/board/dhelectronics/dh_stm32mp1/board.c
+++ b/board/dhelectronics/dh_stm32mp1/board.c
@@ -133,6 +133,62 @@  int checkboard(void)
 	return 0;
 }
 
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+static u8 brdcode __section("data");
+static u8 somcode __section("data");
+
+static void board_get_coding_straps(void)
+{
+	struct gpio_desc gpio[4];
+	ofnode node;
+	int i, ret;
+
+	node = ofnode_path("/config");
+	if (!ofnode_valid(node)) {
+		printf("%s: no /config node?\n", __func__);
+		return;
+	}
+
+	brdcode = 0;
+	somcode = 0;
+
+	ret = gpio_request_list_by_name_nodev(node, "dh,som-coding-gpios",
+					      gpio, ARRAY_SIZE(gpio),
+					      GPIOD_IS_IN);
+	for (i = 0; i < ret; i++)
+		somcode |= !!dm_gpio_get_value(&(gpio[i])) << i;
+
+	ret = gpio_request_list_by_name_nodev(node, "dh,board-coding-gpios",
+					      gpio, ARRAY_SIZE(gpio),
+					      GPIOD_IS_IN);
+	for (i = 0; i < ret; i++)
+		brdcode |= !!dm_gpio_get_value(&(gpio[i])) << i;
+
+	printf("Code:  SoM:rev=%d Board:rev=%d\n", somcode, brdcode);
+}
+
+int board_early_init_f(void)
+{
+	board_get_coding_straps();
+
+	return 0;
+}
+
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	char test[20];
+
+	snprintf(test, sizeof(test), "somrev%d_boardrev%d", somcode, brdcode);
+
+	if (!strcmp(name, test))
+		return 0;
+
+	return -EINVAL;
+}
+#endif
+#endif
+
 static void board_key_check(void)
 {
 #if defined(CONFIG_FASTBOOT) || defined(CONFIG_CMD_STM32PROG)
@@ -478,6 +534,11 @@  int board_late_init(void)
 	if (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb"))
 		env_set("bootdelay", "0");
 
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+	env_set_ulong("dh_som_rev", somcode);
+	env_set_ulong("dh_board_rev", brdcode);
+#endif
+
 	return 0;
 }
 
diff --git a/board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its b/board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
new file mode 100644
index 0000000000..a4574ea135
--- /dev/null
+++ b/board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
@@ -0,0 +1,39 @@ 
+/dts-v1/;
+
+/ {
+	description = "U-Boot mainline";
+	#address-cells = <1>;
+
+	images {
+		uboot {
+			description = "U-Boot (32-bit)";
+			data = /incbin/("../../../u-boot-nodtb.bin");
+			type = "standalone";
+			os = "U-Boot";
+			arch = "arm";
+			compression = "none";
+			load = <0xc0100000>;
+			entry = <0xc0100000>;
+		};
+
+		fdt-1 {
+			description = ".dtb";
+			data = /incbin/("../../../arch/arm/dts/stm32mp15xx-dhcom-pdk2.dtb");
+			type = "flat_dt";
+			arch = "arm";
+			compression = "none";
+		};
+	};
+
+	configurations {
+		default = "config-1";
+
+		config-1 {
+			description = "somrev0_boardrev0"; /* SoM+board model */
+			loadables = "uboot";
+			fdt = "fdt-1";
+		};
+
+		/* Add 587-100..587-400 with fdt-2..fdt-4 here */
+	};
+};
diff --git a/board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its b/board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
new file mode 100644
index 0000000000..0a8b6ac857
--- /dev/null
+++ b/board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
@@ -0,0 +1,39 @@ 
+/dts-v1/;
+
+/ {
+	description = "U-Boot mainline";
+	#address-cells = <1>;
+
+	images {
+		uboot {
+			description = "U-Boot (32-bit)";
+			data = /incbin/("../../../u-boot-nodtb.bin");
+			type = "standalone";
+			os = "U-Boot";
+			arch = "arm";
+			compression = "none";
+			load = <0xc0100000>;
+			entry = <0xc0100000>;
+		};
+
+		fdt-1 {
+			description = ".dtb";
+			data = /incbin/("../../../arch/arm/dts/stm32mp15xx-dhcor-avenger96.dtb");
+			type = "flat_dt";
+			arch = "arm";
+			compression = "none";
+		};
+	};
+
+	configurations {
+		default = "config-1";
+
+		config-1 {
+			description = "somrev0_boardrev1"; /* SoM+board model */
+			loadables = "uboot";
+			fdt = "fdt-1";
+		};
+
+		/* Add 586-200..586-400 with fdt-2..fdt-4 here */
+	};
+};
diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig
index 40afef2ece..58c15fb582 100644
--- a/configs/stm32mp15_dhcom_basic_defconfig
+++ b/configs/stm32mp15_dhcom_basic_defconfig
@@ -11,7 +11,10 @@  CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its"
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
+CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_I2C_SUPPORT=y
diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig
index 4a968609fe..e75ed1a932 100644
--- a/configs/stm32mp15_dhcor_basic_defconfig
+++ b/configs/stm32mp15_dhcor_basic_defconfig
@@ -11,7 +11,10 @@  CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its"
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
+CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_I2C_SUPPORT=y
diff --git a/include/configs/dh_stm32mp1.h b/include/configs/dh_stm32mp1.h
new file mode 100644
index 0000000000..89d317ba2b
--- /dev/null
+++ b/include/configs/dh_stm32mp1.h
@@ -0,0 +1,15 @@ 
+/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
+/*
+ * Copyright (C) 2020 Marek Vasut <marex at denx.de>
+ *
+ * Configuration settings for the DH STM32MP15x SoMs
+ */
+
+#ifndef __CONFIG_DH_STM32MP1_H__
+#define __CONFIG_DH_STM32MP1_H__
+
+#include <configs/stm32mp1.h>
+
+#define CONFIG_SPL_TARGET		"u-boot.itb"
+
+#endif