[PATCH 4/4] ARM: stm32mp: dk2: have barebox image support DK1 as well

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Oct 1 05:14:45 EDT 2020


Hello,

On 9/30/20 2:53 PM, Ahmad Fatoum wrote:
> The STM32MP157C-DK2 and STM32MP157A-DK1 are basically the same board
> except the DK2 has a MIPI-DSI display attached and the SoC has a
> crypto IP block.
> 
> Allow the same barebox image to run on both boards by deciding
> that if we are compiled with a 157C-DK2 device tree, but we have
> a 157A SoC, it must be a DK1 instead.

Please dismiss this one patch. Doing it in the PBL is much cleaner
and I can tolerate the 12K size increase in having two device trees.

The other three would be nice to have though.

> 
> Cc: Holger Assmann <h.assmann at pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  arch/arm/boards/stm32mp157c-dk2/board.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/boards/stm32mp157c-dk2/board.c b/arch/arm/boards/stm32mp157c-dk2/board.c
> index 46366031218d..55afdd49e6e5 100644
> --- a/arch/arm/boards/stm32mp157c-dk2/board.c
> +++ b/arch/arm/boards/stm32mp157c-dk2/board.c
> @@ -2,17 +2,23 @@
>  #include <common.h>
>  #include <init.h>
>  #include <mach/bbu.h>
> +#include <mach/revision.h>
> +#include <of.h>
>  
> -static int dk2_postcore_init(void)
> +static int dkx_postcore_init(void)
>  {
>  	if (!of_machine_is_compatible("st,stm32mp157c-dk2"))
>  		return 0;
>  
> -	stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
> -					 BBU_HANDLER_FLAG_DEFAULT);
> +	if (stm32mp_cputype() == CPU_STM32MP157Axx) {
> +		of_property_write_strings(of_get_root_node(), "compatible",
> +					  "st,stm32mp157a-dk1", "st,stm32mp157", NULL);
> +		barebox_set_model("STM32MP157A-DK1");
> +	} else {
> +		barebox_set_model("STM32MP157C-DK2");
> +	}
>  
> -	barebox_set_model("STM32MP157C-DK2");
> -
> -	return 0;
> +	return stm32mp_bbu_mmc_register_handler("sd", "/dev/mmc0.ssbl",
> +						BBU_HANDLER_FLAG_DEFAULT);
>  }
> -postcore_initcall(dk2_postcore_init);
> +postcore_initcall(dkx_postcore_init);
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list