ARM: stm32mp: Add Avenger96 board support
Subsystems (4)
cover ARM: stm32mp: Add Avenger96 board support
Add support for Arrow STM32MP157A Avenger96 board with bootloader update handlers for MMC and NOR flash.
---
Sohaib Mohamed (3):
common: bbu: refactor flash operations into separate function
ARM: stm32mp: bbu: add NOR flash FIP update handler
ARM: stm32mp: add support for STM32MP157A Avenger96 board
arch/arm/boards/Makefile | 1 + arch/arm/boards/dhcor-stm32mp1/Makefile | 2 + arch/arm/boards/dhcor-stm32mp1/board.c | 47 ++++++++++++++++++ arch/arm/configs/multi_v7_defconfig | 2 + arch/arm/configs/stm32mp_defconfig | 2 + arch/arm/dts/Makefile | 1 + arch/arm/dts/stm32mp157a-dhcor-stm32mp1.dts | 4 ++ arch/arm/mach-stm32mp/Kconfig | 4 ++ arch/arm/mach-stm32mp/bbu.c | 77 +++++++++++++++++++++++++++++ common/bbu.c | 17 ++++--- include/bbu.h | 2 + include/mach/stm32mp/bbu.h | 10 ++++ 12 files changed, 163 insertions(+), 6 deletions(-)
---
base-commit: a831f32782a5ce216301ccb52e4d27e3462632f3
change-id: 20251128-avenger96-2b70277cdd7a
Best regards,
Signature · 1 line
Sohaib Mohamed <[email protected]>
PATCH 1/3 common: bbu: refactor flash operations into separate function
Extract flash logic (protect, erase, write) from bbu_std_file_handler() into a new flash() function that accepts an offset parameter, so it can be used from further barebox update handlers as well.
--- common/bbu.c | 17 +++++++++++------ include/bbu.h | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-)
common/bbu.c +11 -6
@@ -431,8 +431,7 @@ int bbu_mmcboot_register_handler(const char *name,return ret; } -int bbu_std_file_handler (struct bbu_handler *handler, -struct bbu_data *data) +int bbu_flash (struct bbu_data *data,loff_t offset) {int fd, ret;struct stat s;
@@ -458,25 +457,25 @@ int bbu_std_file_handler(struct bbu_handler *handler,if (fd <0 )return fd; - ret =protect (fd, data->len,0 ,0 ); + ret =protect (fd, data->len, offset,0 );if (ret && (ret != -ENOSYS ) && (ret != -ENOTSUPP )) {printf ("unprotecting %s failed with %pe\n" , data->devicefile,ERR_PTR (ret)); goto err_close; } - ret =erase (fd, data->len,0 ,ERASE_TO_WRITE ); + ret =erase (fd, data->len, offset,ERASE_TO_WRITE );if (ret && ret != -ENOSYS ) {printf ("erasing %s failed with %pe\n" , data->devicefile,ERR_PTR (ret)); goto err_close; } - ret =write_full (fd, data->image, data->len); + ret =pwrite_full (fd, data->image, data->len, offset);if (ret <0 ) goto err_close; -protect (fd, data->len,0 ,1 ); +protect (fd, data->len, offset,1 ); ret =0 ;
@@ -486,6 +485,12 @@ int bbu_std_file_handler(struct bbu_handler *handler,return ret; } +int bbu_std_file_handler (struct bbu_handler *handler, +struct bbu_data *data) +{ +return bbu_flash (data,0 ); +} +static int bbu_std_file_handler_checked (struct bbu_handler *handler,struct bbu_data *data) {
include/bbu.h +2 -0
@@ -56,6 +56,8 @@ int bbu_mmcboot_handler(struct bbu_handler *, struct bbu_data *,int bbu_std_file_handler (struct bbu_handler *handler,struct bbu_data *data); +int bbu_flash (struct bbu_data *data,loff_t offset); +#ifdef CONFIG_BAREBOX_UPDATE bool bbu_handlers_available (void );
Signature · 1 line
2.43.0
Re: [PATCH 1/3] common: bbu: refactor flash operations into separate function
Quoted 5 lines · Sohaib Mohamed
Extract flash logic (protect, erase, write) from
bbu_std_file_handler()into a newflash()function that accepts an offset parameter, so it can be used from further barebox update handlers as well.Signed-off-by Sohaib Mohamed <[email protected]>
Quoted 76 lines
--- common/bbu.c | 17 +++++++++++------ include/bbu.h | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-)common/bbu.c +11
-6@@ -431,8 +431,7 @@ int bbu_mmcboot_register_handler(const char *name,return ret; } -int bbu_std_file_handler (struct bbu_handler *handler, -struct bbu_data *data) +int bbu_flash (struct bbu_data *data,loff_t offset) {int fd, ret;struct stat s;@@ -458,25 +457,25 @@ int bbu_std_file_handler(struct bbu_handler *handler,if (fd <0 )return fd; - ret =protect (fd, data->len,0 ,0 ); + ret =protect (fd, data->len, offset,0 );if (ret && (ret != -ENOSYS ) && (ret != -ENOTSUPP )) {printf ("unprotecting %s failed with %pe\n" , data->devicefile,ERR_PTR (ret)); goto err_close; } - ret =erase (fd, data->len,0 ,ERASE_TO_WRITE ); + ret =erase (fd, data->len, offset,ERASE_TO_WRITE );if (ret && ret != -ENOSYS ) {printf ("erasing %s failed with %pe\n" , data->devicefile,ERR_PTR (ret)); goto err_close; } - ret =write_full (fd, data->image, data->len); + ret =pwrite_full (fd, data->image, data->len, offset);if (ret <0 ) goto err_close; -protect (fd, data->len,0 ,1 ); +protect (fd, data->len, offset,1 ); ret =0 ;@@ -486,6 +485,12 @@ int bbu_std_file_handler(struct bbu_handler *handler,return ret; } +int bbu_std_file_handler (struct bbu_handler *handler, +struct bbu_data *data) +{ +return bbu_flash (data,0 ); +} +static int bbu_std_file_handler_checked (struct bbu_handler *handler,struct bbu_data *data) {include/bbu.h +2
-0@@ -56,6 +56,8 @@ int bbu_mmcboot_handler(struct bbu_handler *, struct bbu_data *,int bbu_std_file_handler (struct bbu_handler *handler,struct bbu_data *data); +int bbu_flash (struct bbu_data *data,loff_t offset); +#ifdef CONFIG_BAREBOX_UPDATE bool bbu_handlers_available (void );
Signature · 4 lines
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 |
PATCH 2/3 ARM: stm32mp: bbu: add NOR flash FIP update handler
In reply to Sohaib MohamedAdd support for updating STM32MP1 bootloader in NOR flash. The handler automatically detects FIP location (256K or 512K offset) and flashes FSBL at offset 0 and FIP at offset 512K. FIP is truncated if it exceeds available space.
The handler detects the FIP location within the image (at either 256K or 512K offset) and flashes components to their appropriate locations:
- FSBL at offset 0 (first 256K)
- FIP at offset 512K (remainder of flash)
When flashing from eMMC boot partitions to NOR, the FIP is truncated if needed since eMMC boot partitions are typically larger than available NOR flash space.
--- arch/arm/mach-stm32mp/bbu.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ include/mach/stm32mp/bbu.h | 10 ++++++ 2 files changed, 87 insertions(+)
arch/arm/mach-stm32mp/bbu.c +77 -0
@@ -193,3 +193,80 @@ int stm32mp_bbu_mmc_fip_register(const char *name,return ret; } + +static int stm32mp_bbu_nor_fip_handler (struct bbu_handler *handler, +struct bbu_data *data) +{ +struct bbu_data *fsbl_data, *fip_data; +enum filetype filetype; +int ret; + + filetype =file_detect_type (data->image, data->len); +if (filetype == filetype_fip) { +pr_debug ("Flashing FIP at offset 512K\n" ); +return bbu_flash (data,SZ_512K ); + } + +if (filetype != filetype_stm32_image_fsbl_v1) { +if (!bbu_force (data,"incorrect image type. Expected: %s, got %s" , +file_type_to_string (filetype_stm32_image_fsbl_v1), +file_type_to_string (filetype))) +return -EINVAL ; + +/* Force: Let's assume it's an FSBL and flash anyway */ + } + +if (data->len >SZ_256K ) + filetype =file_detect_type (data->image +SZ_256K , + data->len -SZ_256K ); +else + filetype = filetype_unknown; + +/* Not an eMMC image, just flash 1:1 */ +if (filetype != filetype_fip) { +pr_debug ("Flashing FSBL at offset 0\n" ); +return bbu_flash (data,0 ); + } + +/* On SPI-NOR, offset 256K is FSBL2. If we get a FIP image there +* instead, let's assume that's an eMMC boot partition image +* and flash the FSBL to offset 0 and the remainder to offset 512K +*/ + +pr_debug ("Flashing FSBL at offset 0\n" ); + fsbl_data = data; + fsbl_data->image = data->image; + fsbl_data->len =SZ_256K ; + + ret =bbu_flash (fsbl_data,0 ); +if (ret <0 ) +return ret; + +pr_debug ("Flashing FIP from file offset 256K at offset 512K\n" ); + fip_data = data; + fip_data->image = data->image +SZ_256K ; + fip_data->len = data->len -SZ_256K ; + +return bbu_flash (fip_data,SZ_512K ); +} + +int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +struct stm32mp_bbu_handler *priv; +int ret; + + priv =xzalloc (sizeof (*priv)); + + priv->handler.flags = flags; + priv->handler.devicefile = devicefile; + priv->handler.name = name; + priv->handler.handler = stm32mp_bbu_nor_fip_handler; + + ret =bbu_register_handler (&priv->handler); +if (ret) +free (priv); + +return ret; +}
include/mach/stm32mp/bbu.h +10 -0
@@ -10,6 +10,9 @@int stm32mp_bbu_mmc_fip_register (const char *name,const char *devicefile,unsigned long flags); +int stm32mp_bbu_nor_fip_register (const char *name,const char *devicefile, +unsigned long flags); +#else static inline int stm32mp_bbu_mmc_fip_register(const char *name,
@@ -19,6 +22,13 @@ static inline int stm32mp_bbu_mmc_fip_register(const char *name,return -ENOSYS ; } +static inline int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +return -ENOSYS ; +} +#endif #endif /* MACH_STM32MP_BBU_H_ */
Signature · 1 line
2.43.0
Re: [PATCH 2/3] ARM: stm32mp: bbu: add NOR flash FIP update handler
Quoted 9 lines · Sohaib Mohamed
Add support for updating STM32MP1 bootloader in NOR flash. The handler automatically detects FIP location (256K or 512K offset) and flashes FSBL at offset 0 and FIP at offset 512K. FIP is truncated if it exceeds available space.
The handler detects the FIP location within the image (at either 256K or 512K offset) and flashes components to their appropriate locations:
- FSBL at offset 0 (first 256K)
- FIP at offset 512K (remainder of flash)
Above two paragraphs just repeat the same info.
Quoted 3 lines
When flashing from eMMC boot partitions to NOR, the FIP is truncated if needed since eMMC boot partitions are typically larger than available NOR flash space.
This doesn't reflect what the code is doing. It just passes it along to bbu_flash. I would expect flashing a too big image would just fail with -ENOSPC, because pwrite_full() couldn't write all bytes and not truncation as the commit message claims.
Quoted 1 line
Signed-off-by Sohaib Mohamed <[email protected]>
Quoted 119 lines
--- arch/arm/mach-stm32mp/bbu.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ include/mach/stm32mp/bbu.h | 10 ++++++ 2 files changed, 87 insertions(+)arch/arm/mach-stm32mp/bbu.c +77
-0@@ -193,3 +193,80 @@ int stm32mp_bbu_mmc_fip_register(const char *name,return ret; } + +static int stm32mp_bbu_nor_fip_handler (struct bbu_handler *handler, +struct bbu_data *data) +{ +struct bbu_data *fsbl_data, *fip_data; +enum filetype filetype; +int ret; + + filetype =file_detect_type (data->image, data->len); +if (filetype == filetype_fip) { +pr_debug ("Flashing FIP at offset 512K\n" ); +return bbu_flash (data,SZ_512K ); + } + +if (filetype != filetype_stm32_image_fsbl_v1) { +if (!bbu_force (data,"incorrect image type. Expected: %s, got %s" , +file_type_to_string (filetype_stm32_image_fsbl_v1), +file_type_to_string (filetype))) +return -EINVAL ; + +/* Force: Let's assume it's an FSBL and flash anyway */ + } + +if (data->len >SZ_256K ) + filetype =file_detect_type (data->image +SZ_256K , + data->len -SZ_256K ); +else + filetype = filetype_unknown; + +/* Not an eMMC image, just flash 1:1 */ +if (filetype != filetype_fip) { +pr_debug ("Flashing FSBL at offset 0\n" ); +return bbu_flash (data,0 ); + } + +/* On SPI-NOR, offset 256K is FSBL2. If we get a FIP image there +* instead, let's assume that's an eMMC boot partition image +* and flash the FSBL to offset 0 and the remainder to offset 512K +*/ + +pr_debug ("Flashing FSBL at offset 0\n" ); + fsbl_data = data; + fsbl_data->image = data->image; + fsbl_data->len =SZ_256K ; + + ret =bbu_flash (fsbl_data,0 ); +if (ret <0 ) +return ret; + +pr_debug ("Flashing FIP from file offset 256K at offset 512K\n" ); + fip_data = data; + fip_data->image = data->image +SZ_256K ; + fip_data->len = data->len -SZ_256K ; + +return bbu_flash (fip_data,SZ_512K ); +} + +int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +struct stm32mp_bbu_handler *priv; +int ret; + + priv =xzalloc (sizeof (*priv)); + + priv->handler.flags = flags; + priv->handler.devicefile = devicefile; + priv->handler.name = name; + priv->handler.handler = stm32mp_bbu_nor_fip_handler; + + ret =bbu_register_handler (&priv->handler); +if (ret) +free (priv); + +return ret; +}include/mach/stm32mp/bbu.h +10
-0@@ -10,6 +10,9 @@int stm32mp_bbu_mmc_fip_register (const char *name,const char *devicefile,unsigned long flags); +int stm32mp_bbu_nor_fip_register (const char *name,const char *devicefile, +unsigned long flags); +#else static inline int stm32mp_bbu_mmc_fip_register(const char *name,@@ -19,6 +22,13 @@ static inline int stm32mp_bbu_mmc_fip_register(const char *name,return -ENOSYS ; } +static inline int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +return -ENOSYS ; +} +#endif #endif /* MACH_STM32MP_BBU_H_ */
Signature · 4 lines
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 |
Re: [PATCH 2/3] ARM: stm32mp: bbu: add NOR flash FIP update handler
In reply to Sohaib MohamedQuoted 2 lines · Sohaib Mohamed
Add support for updating STM32MP1 bootloader in NOR flash. The handler automatically detects FIP location (256K or 512K offset) and flashes
The "or 512K offset" part isn't implemented, right?
Quoted 11 lines
FSBL at offset 0 and FIP at offset 512K. FIP is truncated if it exceeds available space.
The handler detects the FIP location within the image (at either 256K or 512K offset) and flashes components to their appropriate locations:
- FSBL at offset 0 (first 256K)
- FIP at offset 512K (remainder of flash)When flashing from eMMC boot partitions to NOR, the FIP is truncated if needed since eMMC boot partitions are typically larger than available NOR flash space.
I guess you mean that not the FIP image is truncated, but the input image (/dev/mmcx.boot) is truncated to the actual FIP image size.
But like Ahmad I can't find this part implemented. Should we just drop this sentence for now?
Sascha
Quoted 125 lines
Signed-off-by Sohaib Mohamed <[email protected]>--- arch/arm/mach-stm32mp/bbu.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ include/mach/stm32mp/bbu.h | 10 ++++++ 2 files changed, 87 insertions(+)arch/arm/mach-stm32mp/bbu.c +77
-0@@ -193,3 +193,80 @@ int stm32mp_bbu_mmc_fip_register(const char *name,return ret; } + +static int stm32mp_bbu_nor_fip_handler (struct bbu_handler *handler, +struct bbu_data *data) +{ +struct bbu_data *fsbl_data, *fip_data; +enum filetype filetype; +int ret; + + filetype =file_detect_type (data->image, data->len); +if (filetype == filetype_fip) { +pr_debug ("Flashing FIP at offset 512K\n" ); +return bbu_flash (data,SZ_512K ); + } + +if (filetype != filetype_stm32_image_fsbl_v1) { +if (!bbu_force (data,"incorrect image type. Expected: %s, got %s" , +file_type_to_string (filetype_stm32_image_fsbl_v1), +file_type_to_string (filetype))) +return -EINVAL ; + +/* Force: Let's assume it's an FSBL and flash anyway */ + } + +if (data->len >SZ_256K ) + filetype =file_detect_type (data->image +SZ_256K , + data->len -SZ_256K ); +else + filetype = filetype_unknown; + +/* Not an eMMC image, just flash 1:1 */ +if (filetype != filetype_fip) { +pr_debug ("Flashing FSBL at offset 0\n" ); +return bbu_flash (data,0 ); + } + +/* On SPI-NOR, offset 256K is FSBL2. If we get a FIP image there +* instead, let's assume that's an eMMC boot partition image +* and flash the FSBL to offset 0 and the remainder to offset 512K +*/ + +pr_debug ("Flashing FSBL at offset 0\n" ); + fsbl_data = data; + fsbl_data->image = data->image; + fsbl_data->len =SZ_256K ; + + ret =bbu_flash (fsbl_data,0 ); +if (ret <0 ) +return ret; + +pr_debug ("Flashing FIP from file offset 256K at offset 512K\n" ); + fip_data = data; + fip_data->image = data->image +SZ_256K ; + fip_data->len = data->len -SZ_256K ; + +return bbu_flash (fip_data,SZ_512K ); +} + +int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +struct stm32mp_bbu_handler *priv; +int ret; + + priv =xzalloc (sizeof (*priv)); + + priv->handler.flags = flags; + priv->handler.devicefile = devicefile; + priv->handler.name = name; + priv->handler.handler = stm32mp_bbu_nor_fip_handler; + + ret =bbu_register_handler (&priv->handler); +if (ret) +free (priv); + +return ret; +}include/mach/stm32mp/bbu.h +10
-0@@ -10,6 +10,9 @@int stm32mp_bbu_mmc_fip_register (const char *name,const char *devicefile,unsigned long flags); +int stm32mp_bbu_nor_fip_register (const char *name,const char *devicefile, +unsigned long flags); +#else static inline int stm32mp_bbu_mmc_fip_register(const char *name,@@ -19,6 +22,13 @@ static inline int stm32mp_bbu_mmc_fip_register(const char *name,return -ENOSYS ; } +static inline int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +return -ENOSYS ; +} +#endif #endif /* MACH_STM32MP_BBU_H_ */ Signature · 2 lines
-- 2.43.0
Signature · 4 lines
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 |
Re: [PATCH 2/3] ARM: stm32mp: bbu: add NOR flash FIP update handler
Quoted 5 lines · Sascha Hauer
Quoted 2 lines · Sohaib Mohamed
Add support for updating STM32MP1 bootloader in NOR flash. The handler automatically detects FIP location (256K or 512K offset) and flashes
The "or 512K offset" part isn't implemented, right?
You're correct. Offset 512K is actually the default location for FIP images in NOR flash layout. I will clarify this in the commit message.
Quoted 152 lines
Quoted 4 lines
FSBL at offset 0 and FIP at offset 512K. FIP is truncated if it exceeds available space.
Quoted 8 lines
The handler detects the FIP location within the image (at either 256K or 512K offset) and flashes components to their appropriate locations:
- FSBL at offset 0 (first 256K)
- FIP at offset 512K (remainder of flash)When flashing from eMMC boot partitions to NOR, the FIP is truncated if needed since eMMC boot partitions are typically larger than available NOR flash space.
I guess you mean that not the FIP image is truncated, but the input image (
/dev/mmcx.boot) is truncated to the actual FIP image size.But like Ahmad I can't find this part implemented. Should we just drop this sentence for now?
Sascha
Quoted 122 lines
Signed-off-by Sohaib Mohamed <[email protected]>--- arch/arm/mach-stm32mp/bbu.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ include/mach/stm32mp/bbu.h | 10 ++++++ 2 files changed, 87 insertions(+)arch/arm/mach-stm32mp/bbu.c +77
-0@@ -193,3 +193,80 @@ int stm32mp_bbu_mmc_fip_register(const char *name,return ret; } + +static int stm32mp_bbu_nor_fip_handler (struct bbu_handler *handler, +struct bbu_data *data) +{ +struct bbu_data *fsbl_data, *fip_data; +enum filetype filetype; +int ret; + + filetype =file_detect_type (data->image, data->len); +if (filetype == filetype_fip) { +pr_debug ("Flashing FIP at offset 512K\n" ); +return bbu_flash (data,SZ_512K ); + } + +if (filetype != filetype_stm32_image_fsbl_v1) { +if (!bbu_force (data,"incorrect image type. Expected: %s, got %s" , +file_type_to_string (filetype_stm32_image_fsbl_v1), +file_type_to_string (filetype))) +return -EINVAL ; + +/* Force: Let's assume it's an FSBL and flash anyway */ + } + +if (data->len >SZ_256K ) + filetype =file_detect_type (data->image +SZ_256K , + data->len -SZ_256K ); +else + filetype = filetype_unknown; + +/* Not an eMMC image, just flash 1:1 */ +if (filetype != filetype_fip) { +pr_debug ("Flashing FSBL at offset 0\n" ); +return bbu_flash (data,0 ); + } + +/* On SPI-NOR, offset 256K is FSBL2. If we get a FIP image there +* instead, let's assume that's an eMMC boot partition image +* and flash the FSBL to offset 0 and the remainder to offset 512K +*/ + +pr_debug ("Flashing FSBL at offset 0\n" ); + fsbl_data = data; + fsbl_data->image = data->image; + fsbl_data->len =SZ_256K ; + + ret =bbu_flash (fsbl_data,0 ); +if (ret <0 ) +return ret; + +pr_debug ("Flashing FIP from file offset 256K at offset 512K\n" ); + fip_data = data; + fip_data->image = data->image +SZ_256K ; + fip_data->len = data->len -SZ_256K ; + +return bbu_flash (fip_data,SZ_512K ); +} + +int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +struct stm32mp_bbu_handler *priv; +int ret; + + priv =xzalloc (sizeof (*priv)); + + priv->handler.flags = flags; + priv->handler.devicefile = devicefile; + priv->handler.name = name; + priv->handler.handler = stm32mp_bbu_nor_fip_handler; + + ret =bbu_register_handler (&priv->handler); +if (ret) +free (priv); + +return ret; +}include/mach/stm32mp/bbu.h +10
-1@@ -10,6 +10,9 @@int stm32mp_bbu_mmc_fip_register (const char *name,const char *devicefile,unsigned long flags); +int stm32mp_bbu_nor_fip_register (const char *name,const char *devicefile, +unsigned long flags); +#else static inline int stm32mp_bbu_mmc_fip_register(const char *name,@@ -19,6 +22,13 @@ static inline int stm32mp_bbu_mmc_fip_register(const char *name,return -ENOSYS ; } +static inline int stm32mp_bbu_nor_fip_register (const char *name, +const char *devicefile, +unsigned long flags) +{ +return -ENOSYS ; +} +#endif #endif /* MACH_STM32MP_BBU_H_ */ --Quoted 3 lines
2.43.0
--
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 |
PATCH 3/3 ARM: stm32mp: add support for STM32MP157A Avenger96 board
In reply to Sohaib MohamedAdd board support for the Arrow Electronics STM32MP157A Avenger96 board.
This commit adds:
- Board initialization code with boot source detection
- barebox_update handlers for SD card, eMMC
Tested with STM32MP157A DHCOR SoM on Avenger96 carrier board.
--- arch/arm/boards/Makefile | 1 + arch/arm/boards/dhcor-stm32mp1/Makefile | 2 ++ arch/arm/boards/dhcor-stm32mp1/board.c | 47 +++++++++++++++++++++++++++++ arch/arm/configs/multi_v7_defconfig | 2 ++ arch/arm/configs/stm32mp_defconfig | 2 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/stm32mp157a-dhcor-stm32mp1.dts | 4 +++ arch/arm/mach-stm32mp/Kconfig | 4 +++ 8 files changed, 63 insertions(+)
arch/arm/boards/Makefile +1 -0
@@ -135,6 +135,7 @@ obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/ obj-$(CONFIG_MACH_LXA_TAC) += lxa-tac/ obj-$(CONFIG_MACH_LXA_FAIRYTUX2) += lxa-fairytux2/ obj-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp15x-ev1/ +obj-$(CONFIG_MACH_DHCOR_STM32MP1) += dhcor-stm32mp1/ obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/ obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/ obj-$(CONFIG_MACH_TNY_A9260) += tny-a926x/
arch/arm/boards/dhcor-stm32mp1/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0+ +obj-y += board.o
arch/arm/boards/dhcor-stm32mp1/board.c new file +47 -0
47 lines not on this page · raw message
arch/arm/configs/multi_v7_defconfig +2 -0
@@ -82,6 +82,7 @@ CONFIG_MACH_STM32MP15XX_DKX=y CONFIG_MACH_LXA_MC1=y CONFIG_MACH_LXA_TAC=y CONFIG_MACH_LXA_FAIRYTUX2=y +CONFIG_MACH_DHCOR_STM32MP1=y CONFIG_MACH_SEEED_ODYSSEY=y CONFIG_MACH_STM32MP15X_EV1=y CONFIG_MACH_PROTONIC_STM32MP1=y
@@ -214,6 +215,7 @@ CONFIG_DEEP_PROBE_DEFAULT=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_AIODEV=y CONFIG_STM32_ADC=y +CONFIG_STM32_QSPI=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_DRIVER_SERIAL_STM32=y CONFIG_DRIVER_SERIAL_NS16550=y
arch/arm/configs/stm32mp_defconfig +2 -0
@@ -4,6 +4,7 @@ CONFIG_MACH_STM32MP15XX_DKX=y CONFIG_MACH_LXA_MC1=y CONFIG_MACH_LXA_TAC=y CONFIG_MACH_LXA_FAIRYTUX2=y +CONFIG_MACH_DHCOR_STM32MP1=y CONFIG_MACH_SEEED_ODYSSEY=y CONFIG_MACH_STM32MP15X_EV1=y CONFIG_MACH_PROTONIC_STM32MP1=y
@@ -104,6 +105,7 @@ CONFIG_NET_FASTBOOT=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_AIODEV=y CONFIG_STM32_ADC=y +CONFIG_STM32_QSPI=y CONFIG_DRIVER_SERIAL_STM32=y CONFIG_DRIVER_NET_DESIGNWARE_STM32=y CONFIG_AT803X_PHY=y
arch/arm/dts/Makefile +1 -0
@@ -169,6 +169,7 @@ lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o stm32mp157c-lxa-mc1-scmi lwl-$(CONFIG_MACH_LXA_TAC) += stm32mp157c-lxa-tac-gen1.dtb.o stm32mp157c-lxa-tac-gen2.dtb.o \ stm32mp153c-lxa-tac-gen3.dtb.o lwl-$(CONFIG_MACH_LXA_FAIRYTUX2) += stm32mp153c-lxa-fairytux2-gen1.dtb.o stm32mp153c-lxa-fairytux2-gen2.dtb.o +lwl-$(CONFIG_MACH_DHCOR_STM32MP1) += stm32mp157a-dhcor-stm32mp1.dtb.o lwl-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp157c-ev1.dtb.o stm32mp157c-ev1-scmi.dtb.o lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
arch/arm/dts/stm32mp157a-dhcor-stm32mp1.dts new file +4 -0
@@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause + +#include <arm/st/stm32mp157a-dhcor-avenger96.dts> +#include "stm32mp151.dtsi"
arch/arm/mach-stm32mp/Kconfig +4 -0
@@ -39,6 +39,10 @@ config MACH_LXA_FAIRYTUX2 bool "Linux Automation FairyTux 2" select BOARD_LXA +config MACH_DHCOR_STM32MP1 + select ARCH_STM32MP157 + bool "DHCOR STM32MP1 boards including Arrow Avenger96" + config MACH_SEEED_ODYSSEY select ARCH_STM32MP157 bool "Seeed Studio Odyssey"
Signature · 1 line
2.43.0
Re: [PATCH 3/3] ARM: stm32mp: add support for STM32MP157A Avenger96 board
Quoted 9 lines · Sohaib Mohamed
Add board support for the Arrow Electronics STM32MP157A Avenger96 board.
This commit adds:
- Board initialization code with boot source detection
-barebox_updatehandlers for SD card, eMMCTested with STM32MP157A DHCOR SoM on Avenger96 carrier board.
Signed-off-by Sohaib Mohamed <[email protected]>
Quoted 162 lines
--- arch/arm/boards/Makefile | 1 + arch/arm/boards/dhcor-stm32mp1/Makefile | 2 ++ arch/arm/boards/dhcor-stm32mp1/board.c | 47 +++++++++++++++++++++++++++++ arch/arm/configs/multi_v7_defconfig | 2 ++ arch/arm/configs/stm32mp_defconfig | 2 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/stm32mp157a-dhcor-stm32mp1.dts | 4 +++ arch/arm/mach-stm32mp/Kconfig | 4 +++ 8 files changed, 63 insertions(+)arch/arm/boards/Makefile +1
-0@@ -135,6 +135,7 @@ obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/ obj-$(CONFIG_MACH_LXA_TAC) += lxa-tac/ obj-$(CONFIG_MACH_LXA_FAIRYTUX2) += lxa-fairytux2/ obj-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp15x-ev1/ +obj-$(CONFIG_MACH_DHCOR_STM32MP1) += dhcor-stm32mp1/ obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/ obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/ obj-$(CONFIG_MACH_TNY_A9260) += tny-a926x/arch/arm/boards/dhcor-stm32mp1/Makefile new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0+ +obj-y += board.oarch/arm/boards/dhcor-stm32mp1/board.c new file +47
-0@@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0 +// SPDX-FileCopyrightText: Copyright (c) 2025, Sohaib Mohamed <[email protected]> +#include <filetype.h> +#include <common.h> +#include <init.h> +#include <asm/memory.h> +#include <mach/stm32mp/bbu.h> +#include <bootsource.h> +#include <of.h> + +static int dhcor_stm32mp1_probe (struct device *dev) +{ +int emmc_bbu_flag =0 ; +int sd_bbu_flag =0 ; +int nor_bbu_flag =0 ; + +if (bootsource_get () ==BOOTSOURCE_MMC ) { +if (bootsource_get_instance () ==2 ) + emmc_bbu_flag =BBU_HANDLER_FLAG_DEFAULT ; +else + sd_bbu_flag =BBU_HANDLER_FLAG_DEFAULT ; + }else if (bootsource_get () ==BOOTSOURCE_NOR ) { + nor_bbu_flag =BBU_HANDLER_FLAG_DEFAULT ; + }else { + emmc_bbu_flag =BBU_HANDLER_FLAG_DEFAULT ; + } + +stm32mp_bbu_mmc_fip_register ("sd" ,"/dev/mmc0" , sd_bbu_flag); +stm32mp_bbu_mmc_fip_register ("emmc" ,"/dev/mmc1" , emmc_bbu_flag); +stm32mp_bbu_nor_fip_register ("nor" ,"/dev/m25p0" , nor_bbu_flag); + +return 0 ; +} + +static const struct of_device_id dhcor_stm32mp1_of_match[] = { + { .compatible ="dh,stm32mp157a-dhcor-som" }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, dhcor_stm32mp1_of_match); +BAREBOX_DEEP_PROBE_ENABLE (dhcor_stm32mp1_of_match); + +static struct driver dhcor_stm32mp1_driver = { + .name ="dhcor_stm32mp1" , + .probe = dhcor_stm32mp1_probe, + .of_compatible = dhcor_stm32mp1_of_match, +}; +device_platform_driver (dhcor_stm32mp1_driver);arch/arm/configs/multi_v7_defconfig +2
-0@@ -82,6 +82,7 @@ CONFIG_MACH_STM32MP15XX_DKX=y CONFIG_MACH_LXA_MC1=y CONFIG_MACH_LXA_TAC=y CONFIG_MACH_LXA_FAIRYTUX2=y +CONFIG_MACH_DHCOR_STM32MP1=y CONFIG_MACH_SEEED_ODYSSEY=y CONFIG_MACH_STM32MP15X_EV1=y CONFIG_MACH_PROTONIC_STM32MP1=y@@ -214,6 +215,7 @@ CONFIG_DEEP_PROBE_DEFAULT=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_AIODEV=y CONFIG_STM32_ADC=y +CONFIG_STM32_QSPI=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_DRIVER_SERIAL_STM32=y CONFIG_DRIVER_SERIAL_NS16550=yarch/arm/configs/stm32mp_defconfig +2
-0@@ -4,6 +4,7 @@ CONFIG_MACH_STM32MP15XX_DKX=y CONFIG_MACH_LXA_MC1=y CONFIG_MACH_LXA_TAC=y CONFIG_MACH_LXA_FAIRYTUX2=y +CONFIG_MACH_DHCOR_STM32MP1=y CONFIG_MACH_SEEED_ODYSSEY=y CONFIG_MACH_STM32MP15X_EV1=y CONFIG_MACH_PROTONIC_STM32MP1=y@@ -104,6 +105,7 @@ CONFIG_NET_FASTBOOT=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_AIODEV=y CONFIG_STM32_ADC=y +CONFIG_STM32_QSPI=y CONFIG_DRIVER_SERIAL_STM32=y CONFIG_DRIVER_NET_DESIGNWARE_STM32=y CONFIG_AT803X_PHY=yarch/arm/dts/Makefile +1
-0@@ -169,6 +169,7 @@ lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o stm32mp157c-lxa-mc1-scmi lwl-$(CONFIG_MACH_LXA_TAC) += stm32mp157c-lxa-tac-gen1.dtb.o stm32mp157c-lxa-tac-gen2.dtb.o \ stm32mp153c-lxa-tac-gen3.dtb.o lwl-$(CONFIG_MACH_LXA_FAIRYTUX2) += stm32mp153c-lxa-fairytux2-gen1.dtb.o stm32mp153c-lxa-fairytux2-gen2.dtb.o +lwl-$(CONFIG_MACH_DHCOR_STM32MP1) += stm32mp157a-dhcor-stm32mp1.dtb.o lwl-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp157c-ev1.dtb.o stm32mp157c-ev1-scmi.dtb.o lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.oarch/arm/dts/stm32mp157a-dhcor-stm32mp1.dts new file +4
-0@@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause + +#include <arm/st/stm32mp157a-dhcor-avenger96.dts> +#include "stm32mp151.dtsi"arch/arm/mach-stm32mp/Kconfig +4
-0@@ -39,6 +39,10 @@ config MACH_LXA_FAIRYTUX2 bool "Linux Automation FairyTux 2" select BOARD_LXA +config MACH_DHCOR_STM32MP1 + select ARCH_STM32MP157 + bool "DHCOR STM32MP1 boards including Arrow Avenger96" + config MACH_SEEED_ODYSSEY select ARCH_STM32MP157 bool "Seeed Studio Odyssey"
Signature · 4 lines
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 |