diff mbox series

ARM: stm32: Add update_sf script to install U-Boot into SF on DHSOM

Message ID 20211113022513.231840-1-marex@denx.de
State Accepted
Commit 1aba8e51d85293360150028297c5c2b479c86078
Delegated to: Patrice Chotard
Headers show
Series ARM: stm32: Add update_sf script to install U-Boot into SF on DHSOM | expand

Commit Message

Marek Vasut Nov. 13, 2021, 2:25 a.m. UTC
Add script to read U-Boot from SD card and write it to matching
locations in the SPI NOR, thus making the SPI NOR bootable. The
script erases the entire SPI NOR, including U-Boot environment,
to make sure the installation is clean. To retain environment
from current running U-Boot, run 'saveenv' after running the
'update_sf' script.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
 include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Patrice CHOTARD Nov. 15, 2021, 8:10 a.m. UTC | #1
Hi Marek

On 11/13/21 3:25 AM, Marek Vasut wrote:
> Add script to read U-Boot from SD card and write it to matching
> locations in the SPI NOR, thus making the SPI NOR bootable. The
> script erases the entire SPI NOR, including U-Boot environment,
> to make sure the installation is clean. To retain environment
> from current running U-Boot, run 'saveenv' after running the
> 'update_sf' script.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>  include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h
> index bac9e8388a7..b68e153f10b 100644
> --- a/include/configs/stm32mp15_dh_dhsom.h
> +++ b/include/configs/stm32mp15_dh_dhsom.h
> @@ -9,7 +9,17 @@
>  #define __CONFIG_STM32MP15_DH_DHSOM_H__
>  
>  #define STM32MP_BOARD_EXTRA_ENV \
> -	"usb_pgood_delay=1000\0"
> +	"usb_pgood_delay=1000\0" \
> +	"update_sf=" /* Erase SPI NOR and install U-Boot from SD */	\
> +		"setexpr loadaddr1 ${loadaddr} + 0x1000000 && "		\
> +		"load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "	\
> +		"env set filesize1 ${filesize} && "			\
> +		"load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "		\
> +		"sf probe && sf erase 0 0x200000 && "			\
> +		"sf update ${loadaddr1} 0 ${filesize1} && "		\
> +		"sf update ${loadaddr1} 0x40000 ${filesize1} && "	\
> +		"sf update ${loadaddr} 0x80000 ${filesize} && "		\
> +		"env set filesize1 && env set loadaddr1\0"
>  
>  #include <configs/stm32mp15_common.h>
>  
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
Patrick DELAUNAY Nov. 15, 2021, 11:23 a.m. UTC | #2
Hi Marek,

On 11/13/21 3:25 AM, Marek Vasut wrote:
> Add script to read U-Boot from SD card and write it to matching
> locations in the SPI NOR, thus making the SPI NOR bootable. The
> script erases the entire SPI NOR, including U-Boot environment,
> to make sure the installation is clean. To retain environment
> from current running U-Boot, run 'saveenv' after running the
> 'update_sf' script.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>   include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h
> index bac9e8388a7..b68e153f10b 100644
> --- a/include/configs/stm32mp15_dh_dhsom.h
> +++ b/include/configs/stm32mp15_dh_dhsom.h
> @@ -9,7 +9,17 @@
>   #define __CONFIG_STM32MP15_DH_DHSOM_H__
>   
>   #define STM32MP_BOARD_EXTRA_ENV \
> -	"usb_pgood_delay=1000\0"
> +	"usb_pgood_delay=1000\0" \
> +	"update_sf=" /* Erase SPI NOR and install U-Boot from SD */	\
> +		"setexpr loadaddr1 ${loadaddr} + 0x1000000 && "		\
> +		"load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "	\
> +		"env set filesize1 ${filesize} && "			\
> +		"load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "		\
> +		"sf probe && sf erase 0 0x200000 && "			\
> +		"sf update ${loadaddr1} 0 ${filesize1} && "		\
> +		"sf update ${loadaddr1} 0x40000 ${filesize1} && "	\
> +		"sf update ${loadaddr} 0x80000 ${filesize} && "		\
> +		"env set filesize1 && env set loadaddr1\0"
>   
>   #include <configs/stm32mp15_common.h>
>   



Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks
Patrick
Patrice CHOTARD Nov. 30, 2021, 10:28 a.m. UTC | #3
HI Marek

On 11/15/21 12:23 PM, Patrick DELAUNAY wrote:
> Hi Marek,
> 
> On 11/13/21 3:25 AM, Marek Vasut wrote:
>> Add script to read U-Boot from SD card and write it to matching
>> locations in the SPI NOR, thus making the SPI NOR bootable. The
>> script erases the entire SPI NOR, including U-Boot environment,
>> to make sure the installation is clean. To retain environment
>> from current running U-Boot, run 'saveenv' after running the
>> 'update_sf' script.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
>> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
>> ---
>>   include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h
>> index bac9e8388a7..b68e153f10b 100644
>> --- a/include/configs/stm32mp15_dh_dhsom.h
>> +++ b/include/configs/stm32mp15_dh_dhsom.h
>> @@ -9,7 +9,17 @@
>>   #define __CONFIG_STM32MP15_DH_DHSOM_H__
>>     #define STM32MP_BOARD_EXTRA_ENV \
>> -    "usb_pgood_delay=1000\0"
>> +    "usb_pgood_delay=1000\0" \
>> +    "update_sf=" /* Erase SPI NOR and install U-Boot from SD */    \
>> +        "setexpr loadaddr1 ${loadaddr} + 0x1000000 && "        \
>> +        "load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "    \
>> +        "env set filesize1 ${filesize} && "            \
>> +        "load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "        \
>> +        "sf probe && sf erase 0 0x200000 && "            \
>> +        "sf update ${loadaddr1} 0 ${filesize1} && "        \
>> +        "sf update ${loadaddr1} 0x40000 ${filesize1} && "    \
>> +        "sf update ${loadaddr} 0x80000 ${filesize} && "        \
>> +        "env set filesize1 && env set loadaddr1\0"
>>     #include <configs/stm32mp15_common.h>
>>   
> 
> 
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> 
> Thanks
> Patrick
> 
> 
> 
Applied to u-boot-stm32/next

Thanks
Patrice
Marek Vasut Nov. 30, 2021, 10:32 a.m. UTC | #4
On 11/30/21 11:28, Patrice CHOTARD wrote:
> HI Marek
> 
> On 11/15/21 12:23 PM, Patrick DELAUNAY wrote:
>> Hi Marek,
>>
>> On 11/13/21 3:25 AM, Marek Vasut wrote:
>>> Add script to read U-Boot from SD card and write it to matching
>>> locations in the SPI NOR, thus making the SPI NOR bootable. The
>>> script erases the entire SPI NOR, including U-Boot environment,
>>> to make sure the installation is clean. To retain environment
>>> from current running U-Boot, run 'saveenv' after running the
>>> 'update_sf' script.
>>>
>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
>>> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
>>> ---
>>>    include/configs/stm32mp15_dh_dhsom.h | 12 +++++++++++-
>>>    1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h
>>> index bac9e8388a7..b68e153f10b 100644
>>> --- a/include/configs/stm32mp15_dh_dhsom.h
>>> +++ b/include/configs/stm32mp15_dh_dhsom.h
>>> @@ -9,7 +9,17 @@
>>>    #define __CONFIG_STM32MP15_DH_DHSOM_H__
>>>      #define STM32MP_BOARD_EXTRA_ENV \
>>> -    "usb_pgood_delay=1000\0"
>>> +    "usb_pgood_delay=1000\0" \
>>> +    "update_sf=" /* Erase SPI NOR and install U-Boot from SD */    \
>>> +        "setexpr loadaddr1 ${loadaddr} + 0x1000000 && "        \
>>> +        "load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "    \
>>> +        "env set filesize1 ${filesize} && "            \
>>> +        "load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "        \
>>> +        "sf probe && sf erase 0 0x200000 && "            \
>>> +        "sf update ${loadaddr1} 0 ${filesize1} && "        \
>>> +        "sf update ${loadaddr1} 0x40000 ${filesize1} && "    \
>>> +        "sf update ${loadaddr} 0x80000 ${filesize} && "        \
>>> +        "env set filesize1 && env set loadaddr1\0"
>>>      #include <configs/stm32mp15_common.h>
>>>    
>>
>>
>>
>> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
>>
>> Thanks
>> Patrick
>>
>>
>>
> Applied to u-boot-stm32/next

I would prefer if all this stuff went into 2022.01 , it is isolated to 
the DH boards after all and it was posted before rc2.
diff mbox series

Patch

diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h
index bac9e8388a7..b68e153f10b 100644
--- a/include/configs/stm32mp15_dh_dhsom.h
+++ b/include/configs/stm32mp15_dh_dhsom.h
@@ -9,7 +9,17 @@ 
 #define __CONFIG_STM32MP15_DH_DHSOM_H__
 
 #define STM32MP_BOARD_EXTRA_ENV \
-	"usb_pgood_delay=1000\0"
+	"usb_pgood_delay=1000\0" \
+	"update_sf=" /* Erase SPI NOR and install U-Boot from SD */	\
+		"setexpr loadaddr1 ${loadaddr} + 0x1000000 && "		\
+		"load mmc 0:4 ${loadaddr1} /boot/u-boot-spl.stm32 && "	\
+		"env set filesize1 ${filesize} && "			\
+		"load mmc 0:4 ${loadaddr} /boot/u-boot.itb && "		\
+		"sf probe && sf erase 0 0x200000 && "			\
+		"sf update ${loadaddr1} 0 ${filesize1} && "		\
+		"sf update ${loadaddr1} 0x40000 ${filesize1} && "	\
+		"sf update ${loadaddr} 0x80000 ${filesize} && "		\
+		"env set filesize1 && env set loadaddr1\0"
 
 #include <configs/stm32mp15_common.h>