Skip to contentSkip to conversation

arm: socfpga: arria10: allow to reprogram FPGA with warm reboot

PATCH Superseded Michał Barnaś 4 participants 18 messages Feb 22, 2024 – Mar 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm: socfpga: arria10: allow to reprogram FPGA with warm reboot

By default, the board requires power cycle (cold boot) to program the FPGA with bitstream. This change adds Kconfig that allows to enable reprogramming the FPGA with every boot. This makes the update process of the bitstream on the filesystem to be applied with simple system reboot.

Michał Barnaś (2):
arm: socfpga: arria10: add option to reprogram the FPGA every reboot
chameleonv3: set in defconfig for FPGA to reprogram every reboot

 arch/arm/mach-socfpga/Kconfig         | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c       | 8 ++++++++
 configs/socfpga_chameleonv3_defconfig | 1 +
 3 files changed, 17 insertions(+)
Signature · 1 line
2.44.0.rc1.240.g4c46232300-goog
#1 lore raw

PATCH 1/2 arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

 arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c | 8 ++++++++
 2 files changed, 16 insertions(+)
arch/arm/mach-socfpga/Kconfig +8 -0
index 114d243812..89303f1f16 100644
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
 	imply FPGA_SOCFPGA
 	imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
 config TARGET_SOCFPGA_CYCLONE5
 	bool
 	select TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c +8 -0
index 9edbbf4a29..d5d3327a42 100644
@@ -122,7 +122,11 @@ void spl_board_init(void)
 	arch_early_init_r();
 
 	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	if (is_regular_boot_valid()) {
+#else
 	if (is_fpgamgr_user_mode()) {
+#endif
 		ret = config_pins(gd->fdt_blob, "shared");
 		if (ret)
 			return;
@@ -130,7 +134,11 @@ void spl_board_init(void)
 		ret = config_pins(gd->fdt_blob, "fpga");
 		if (ret)
 			return;
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	} else {
+#else
 	} else if (!is_fpgamgr_early_user_mode()) {
+#endif
 		/* Program IOSSM(early IO release) or full FPGA */
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 
Signature · 1 line
2.44.0.rc1.240.g4c46232300-goog
Reviewed-by on v1 1/2
#2 lore raw

RE: [PATCH 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Quoted 73 lines

-----Original Message-----
From: Michał Barnaś <[email protected]>
Sent: Thursday, February 22, 2024 11:21 PM
To: [email protected]
Cc: Michał Barnaś <[email protected]>; Dinh Nguyen <[email protected]>; Marek Vasut <[email protected]>; Simon Glass <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Tom Rini <[email protected]>
Subject: [PATCH 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

 arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c | 8 ++++++++
 2 files changed, 16 insertions(+)
arch/arm/mach- renamed from arch/arm/mach-socfpga/Kconfig +0 -0

socfpga/Kconfig index 114d243812..89303f1f16 100644

arch/arm/mach-socfpga/Kconfig +8 -0
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
 	imply FPGA_SOCFPGA
 	imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
 config TARGET_SOCFPGA_CYCLONE5
 	bool
 	select TARGET_SOCFPGA_GEN5
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl_a10.c +0 -0

socfpga/spl_a10.c index 9edbbf4a29..d5d3327a42 100644

arch/arm/mach-socfpga/spl_a10.c +8 -1
@@ -122,7 +122,11 @@ void spl_board_init(void)
 	arch_early_init_r();
 
 	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	if (is_regular_boot_valid()) {
+#else
 	if (is_fpgamgr_user_mode()) {
+#endif
 		ret = config_pins(gd->fdt_blob, "shared");
 		if (ret)
 			return;
@@ -130,7 +134,11 @@ void spl_board_init(void)
 		ret = config_pins(gd->fdt_blob, "fpga");
 		if (ret)
 			return;
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	} else {
+#else
 	} else if (!is_fpgamgr_early_user_mode()) {
+#endif
 		/* Program IOSSM(early IO release) or full FPGA */
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 
--
Quoted 1 line

2.44.0.rc1.240.g4c46232300-goog

Regards
Tien Fong

maintainer
#3 lore raw

Re: [PATCH 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

In reply to Michał Barnaś
Quoted 48 lines · Michał Barnaś

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

  arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
  arch/arm/mach-socfpga/spl_a10.c | 8 ++++++++
  2 files changed, 16 insertions(+)
arch/arm/mach-socfpga/Kconfig +8 -0
index 114d243812..89303f1f16 100644
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
  	imply FPGA_SOCFPGA
  	imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
  config TARGET_SOCFPGA_CYCLONE5
  	bool
  	select TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c +4 -0
index 9edbbf4a29..d5d3327a42 100644
@@ -122,7 +122,11 @@ void spl_board_init(void)
  	arch_early_init_r();
 
  	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	if (is_regular_boot_valid()) {
+#else
  	if (is_fpgamgr_user_mode()) {
+#endif
  		ret = config_pins(gd->fdt_blob, "shared");
  		if (ret)
  			return;
@@ -130,7 +134,11 @@ void spl_board_init(void)
  		ret = config_pins(gd->fdt_blob, "fpga");

arch/arm/mach-socfpga/spl_a10.c void spl_board_init(void) · line 144

Quoted 10 lines
arch/arm/mach-socfpga/spl_a10.c +4 -0
  		if (ret)
  			return;
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	} else {
+#else
  	} else if (!is_fpgamgr_early_user_mode()) {
+#endif
  		/* Program IOSSM(early IO release) or full FPGA */
  		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 

I got an error while trying to apply this patch:

Checking patch arch/arm/mach-socfpga/Kconfig...
error: while searching for:
imply FPGA_SOCFPGA
imply SPL_USE_TINY_PRINTF

config TARGET_SOCFPGA_CYCLONE5
bool
select TARGET_SOCFPGA_GEN5

error: patch failed: arch/arm/mach-socfpga/Kconfig:80 Checking patch arch/arm/mach-socfpga/spl_a10.c...

Please rebase to the latest and re-send.

Dinh

#4 lore raw

v2 cover arm: socfpga: arria10: allow to reprogram FPGA with warm reboot

By default, the board requires power cycle (cold boot) to program the FPGA with bitstream. This change adds Kconfig that allows to enable reprogramming the FPGA with every boot. This makes the update process of the bitstream on the filesystem to be applied with simple system reboot.

Changes in v2:
- Rebase on current master branch

Michał Barnaś (2):
arm: socfpga: arria10: add option to reprogram the FPGA every reboot
chameleonv3: set in defconfig for FPGA to reprogram every reboot

 arch/arm/mach-socfpga/Kconfig         | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c       | 8 ++++++++
 configs/socfpga_chameleonv3_defconfig | 1 +
 3 files changed, 17 insertions(+)
Signature · 1 line
2.44.0.278.ge034bb2e1d-goog
#5 lore raw

PATCH v2 1/2 arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

Changes in v2:
- Rebase on current master branch

 arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c | 8 ++++++++
 2 files changed, 16 insertions(+)
arch/arm/mach-socfpga/Kconfig +8 -0
index 114d243812..89303f1f16 100644
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
 	imply FPGA_SOCFPGA
 	imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
 config TARGET_SOCFPGA_CYCLONE5
 	bool
 	select TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c +8 -0
index 9edbbf4a29..d5d3327a42 100644
@@ -122,7 +122,11 @@ void spl_board_init(void)
 	arch_early_init_r();
 
 	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	if (is_regular_boot_valid()) {
+#else
 	if (is_fpgamgr_user_mode()) {
+#endif
 		ret = config_pins(gd->fdt_blob, "shared");
 		if (ret)
 			return;
@@ -130,7 +134,11 @@ void spl_board_init(void)
 		ret = config_pins(gd->fdt_blob, "fpga");
 		if (ret)
 			return;
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	} else {
+#else
 	} else if (!is_fpgamgr_early_user_mode()) {
+#endif
 		/* Program IOSSM(early IO release) or full FPGA */
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 
Signature · 1 line
2.44.0.278.ge034bb2e1d-goog
#6 lore raw

Re: [PATCH v2 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Quoted 19 lines · Michał Barnaś

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

Changes in v2:
- Rebase on current master branch

  arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
  arch/arm/mach-socfpga/spl_a10.c | 8 ++++++++
  2 files changed, 16 insertions(+)
arch/arm/mach-socfpga/Kconfig +0 -0
index 114d243812..89303f1f16 100644

arch/arm/mach-socfpga/Kconfig config TARGET_SOCFPGA_ARRIA10 · line 83

Quoted 4 lines
arch/arm/mach-socfpga/Kconfig +1 -0
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
  	imply FPGA_SOCFPGA
  	imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM

This is not TARGET (as in SoC), but a regular config option, so please drop the TARGET_ prefix .

Quoted 15 lines
arch/arm/mach-socfpga/Kconfig +7 -0
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
  config TARGET_SOCFPGA_CYCLONE5
  	bool
  	select TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c +0 -0
index 9edbbf4a29..d5d3327a42 100644

arch/arm/mach-socfpga/spl_a10.c void spl_board_init(void) · line 129

Quoted 8 lines
arch/arm/mach-socfpga/spl_a10.c +4 -0
@@ -122,7 +122,11 @@ void spl_board_init(void)
  	arch_early_init_r();
 
  	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	if (is_regular_boot_valid()) {
+#else
  	if (is_fpgamgr_user_mode()) {
+#endif

Use CONFIG_IS_ENABLED() or IS_ENABLED() macro please .

#7 lore raw

v3 cover arm: socfpga: arria10: allow to reprogram FPGA with warm reboot

By default, the board requires power cycle (cold boot) to program the FPGA with bitstream. This change adds Kconfig that allows to enable reprogramming the FPGA with every boot. This makes the update process of the bitstream on the filesystem to be applied with simple system reboot.

Changes in v3:
- Rebase on current master branch
- Drop the TARGET_ prefix in Kconfig
- Remove #ifdefs and use IS_ENABLED
- Update defconfig to use renamed Kconfig

Changes in v2:
- Rebase on current master branch

Michał Barnaś (2):
arm: socfpga: arria10: add option to reprogram the FPGA every reboot
chameleonv3: set in defconfig for FPGA to reprogram every reboot

 arch/arm/mach-socfpga/Kconfig         | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c       | 8 ++++++--
 configs/socfpga_chameleonv3_defconfig | 1 +
 3 files changed, 15 insertions(+), 2 deletions(-)
Signature · 1 line
2.44.0.291.gc1ea87d7ee-goog
#8 lore raw

PATCH v3 1/2 arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

Changes in v3:
- Rebase on current master branch
- Drop the TARGET_ prefix in Kconfig
- Remove #ifdefs and use IS_ENABLED

Changes in v2:
- Rebase on current master branch

 arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c | 8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/Kconfig +8 -0
index 114d243812..a89bd8ca58 100644
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
 	imply FPGA_SOCFPGA
 	imply SPL_USE_TINY_PRINTF
 
+config SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
 config TARGET_SOCFPGA_CYCLONE5
 	bool
 	select TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c +6 -2
index 9edbbf4a29..3981d2d4f1 100644
@@ -122,7 +122,10 @@ void spl_board_init(void)
 	arch_early_init_r();
 
 	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
-	if (is_fpgamgr_user_mode()) {
+	if ((IS_ENABLED(CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM) &&
+	     is_regular_boot_valid()) ||
+	    (!IS_ENABLED(CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM) &&
+	     is_fpgamgr_user_mode())) {
 		ret = config_pins(gd->fdt_blob, "shared");
 		if (ret)
 			return;
@@ -130,7 +133,8 @@ void spl_board_init(void)
 		ret = config_pins(gd->fdt_blob, "fpga");
 		if (ret)
 			return;
-	} else if (!is_fpgamgr_early_user_mode()) {
+	} else if (IS_ENABLED(CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM) ||
+		   !is_fpgamgr_early_user_mode()) {
 		/* Program IOSSM(early IO release) or full FPGA */
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 
Signature · 1 line
2.44.0.291.gc1ea87d7ee-goog
Reviewed-by on v3 1/2
#9 lore raw

RE: [PATCH v3 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Quoted 82 lines

-----Original Message-----
From: Michał Barnaś <[email protected]>
Sent: Wednesday, March 20, 2024 2:18 AM
To: [email protected]
Cc: Michał Barnaś <[email protected]>; Dinh Nguyen <[email protected]>; Marek Vasut <[email protected]>; Simon Glass <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Tom Rini <[email protected]>
Subject: [PATCH v3 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

Changes in v3:
- Rebase on current master branch
- Drop the TARGET_ prefix in Kconfig
- Remove #ifdefs and use IS_ENABLED

Changes in v2:
- Rebase on current master branch

 arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
 arch/arm/mach-socfpga/spl_a10.c | 8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/Kconfig +0 -0

socfpga/Kconfig index 114d243812..a89bd8ca58 100644

arch/arm/mach-socfpga/Kconfig +8 -0
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
 	imply FPGA_SOCFPGA
 	imply SPL_USE_TINY_PRINTF
 
+config SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+	bool "Always reprogram Arria 10 FPGA"
+	depends on TARGET_SOCFPGA_ARRIA10
+	help
+	  Arria 10 FPGA is only programmed during the cold boot.
+	  This option forces the FPGA to be reprogrammed every reboot,
+	  allowing to change the bitstream and apply it with warm reboot.
+
 config TARGET_SOCFPGA_CYCLONE5
 	bool
 	select TARGET_SOCFPGA_GEN5
arch/arm/mach- renamed from arch/arm/mach-socfpga/spl_a10.c +0 -0

socfpga/spl_a10.c index 9edbbf4a29..3981d2d4f1 100644

arch/arm/mach-socfpga/spl_a10.c +1 -1
@@ -122,7 +122,10 @@ void spl_board_init(void)
 	arch_early_init_r();
 
 	/* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
-	if (is_fpgamgr_user_mode()) {
+	if

((IS_ENABLED(CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM) &&

arch/arm/mach-socfpga/spl_a10.c +2 -0
+	     is_regular_boot_valid()) ||
+

(!IS_ENABLED(CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM) &&

arch/arm/mach-socfpga/spl_a10.c +2 -1
+	     is_fpgamgr_user_mode())) {
 		ret = config_pins(gd->fdt_blob, "shared");
 		if (ret)
 			return;
@@ -130,7 +133,8 @@ void spl_board_init(void)
 		ret = config_pins(gd->fdt_blob, "fpga");
 		if (ret)
 			return;
-	} else if (!is_fpgamgr_early_user_mode()) {
+	} else if

(IS_ENABLED(CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM) ||

arch/arm/mach-socfpga/spl_a10.c +1 -1
+		   !is_fpgamgr_early_user_mode()) {
 		/* Program IOSSM(early IO release) or full FPGA */
 		fpgamgr_program(buf, FPGA_BUFSIZ, 0);
 
--
Quoted 1 line

2.44.0.291.gc1ea87d7ee-goog

Regards
Tien Fong

#10 lore raw

PATCH v3 2/2 chameleonv3: set in defconfig for FPGA to reprogram every reboot

In reply to Michał Barnaś

Set CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM as enabled in chameleon v3 board's defconfig.

---

Changes in v3:
- Update defconfig to use renamed Kconfig

 configs/socfpga_chameleonv3_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_chameleonv3_defconfig +1 -0
index 6ea61ca6ea..7506aa8d32 100644
@@ -7,6 +7,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_chameleonv3_480_2"
 CONFIG_SPL_TEXT_BASE=0xFFE00000
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_TARGET_SOCFPGA_CHAMELEONV3=y
+CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM=y
 CONFIG_SPL_FS_FAT=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT=y
Signature · 1 line
2.44.0.291.gc1ea87d7ee-goog
Reviewed-by on the v3 series
#11 lore raw

RE: [PATCH v3 2/2] chameleonv3: set in defconfig for FPGA to reprogramevery reboot

In reply to Michał Barnaś
Quoted 33 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of "Michal Barnas"
Sent: Wednesday, March 20, 2024 2:18 AM
To: [email protected]
Cc: "Michał Barnaś" <[email protected]>; "Marcel Ziswiler" <[email protected]>; "Martyn Welch" <[email protected]>; "Paweł Anikiel" <[email protected]>; "Simon Glass" <[email protected]>; "Svyatoslav Ryhel" <[email protected]>; "Tom Rini" <[email protected]>
Subject: [PATCH v3 2/2] chameleonv3: set in defconfig for FPGA to reprogramevery reboot

Set CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM as enabled in chameleon v3 board's defconfig.

---

Changes in v3:
- Update defconfig to use renamed Kconfig

 configs/socfpga_chameleonv3_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_chameleonv3_defconfig +0 -0
index 6ea61ca6ea..7506aa8d32 100644
@@ -7,6 +7,7 @@
Quoted 8 lines

CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_chameleonv3_480_2"
CONFIG_SPL_TEXT_BASE=0xFFE00000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_TARGET_SOCFPGA_CHAMELEONV3=y
+CONFIG_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM=y
CONFIG_SPL_FS_FAT=y
CONFIG_FIT=y
CONFIG_SPL_FIT=y

Regards
Tien Fong

#12 lore raw

Re: [PATCH v2 1/2] arm: socfpga: arria10: add option to reprogram the FPGA every reboot

In reply to Marek Vasut
Quoted 46 lines · Marek Vasut
Quoted 19 lines · Michał Barnaś

Add Kconfig that enables FPGA reprogramming with warm boot on Arria 10. This option allows to change the bitstream on the filesystem and apply changes with warm reboot without the need for a power cycle.

---

Changes in v2:
- Rebase on current master branch

  arch/arm/mach-socfpga/Kconfig   | 8 ++++++++
  arch/arm/mach-socfpga/spl_a10.c | 8 ++++++++
  2 files changed, 16 insertions(+)
arch/arm/mach-socfpga/Kconfig +0 -0
index 114d243812..89303f1f16 100644

arch/arm/mach-socfpga/Kconfig config TARGET_SOCFPGA_ARRIA10 · line 83

Quoted 4 lines
arch/arm/mach-socfpga/Kconfig +1 -0
@@ -80,6 +80,14 @@ config TARGET_SOCFPGA_ARRIA10
      imply FPGA_SOCFPGA
      imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM

This is not TARGET (as in SoC), but a regular config option, so please drop the TARGET_ prefix .

Quoted 17 lines
arch/arm/mach-socfpga/Kconfig +7 -0
+     bool "Always reprogram Arria 10 FPGA"
+     depends on TARGET_SOCFPGA_ARRIA10
+     help
+       Arria 10 FPGA is only programmed during the cold boot.
+       This option forces the FPGA to be reprogrammed every reboot,
+       allowing to change the bitstream and apply it with warm reboot.
+
  config TARGET_SOCFPGA_CYCLONE5
      bool
      select TARGET_SOCFPGA_GEN5
arch/arm/mach-socfpga/spl_a10.c +0 -0
index 9edbbf4a29..d5d3327a42 100644
@@ -122,7 +122,11 @@ void spl_board_init(void)
      arch_early_init_r();
 
Quoted 8 lines

arch/arm/mach-socfpga/spl_a10.c void spl_board_init(void) · line 129

Quoted 6 lines
arch/arm/mach-socfpga/spl_a10.c +4 -0
      /* If the full FPGA is already loaded, ie.from EPCQ, config fpga pins */
+#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM
+     if (is_regular_boot_valid()) {
+#else
      if (is_fpgamgr_user_mode()) {
+#endif

Use CONFIG_IS_ENABLED() or IS_ENABLED() macro please .

I used the ifdefs because I thought that it would be more readable, but changed as you requested.
Thank you for your response.

#13 lore raw

PATCH v2 2/2 chameleonv3: set in defconfig for FPGA to reprogram every reboot

In reply to Michał Barnaś

Set CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM as enabled in chameleon v3 board's defconfig.

---

(no changes since v1)

 configs/socfpga_chameleonv3_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_chameleonv3_defconfig +1 -0
index 6ea61ca6ea..25615bb4b4 100644
@@ -7,6 +7,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_chameleonv3_480_2"
 CONFIG_SPL_TEXT_BASE=0xFFE00000
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_TARGET_SOCFPGA_CHAMELEONV3=y
+CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM=y
 CONFIG_SPL_FS_FAT=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT=y
Signature · 1 line
2.44.0.278.ge034bb2e1d-goog
#14 lore raw

PATCH 2/2 chameleonv3: set in defconfig for FPGA to reprogram every reboot

In reply to Michał Barnaś

Set CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM as enabled in chameleon v3 board's defconfig.

---

 configs/socfpga_chameleonv3_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_chameleonv3_defconfig +1 -0
index 6ea61ca6ea..25615bb4b4 100644
@@ -7,6 +7,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_chameleonv3_480_2"
 CONFIG_SPL_TEXT_BASE=0xFFE00000
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_TARGET_SOCFPGA_CHAMELEONV3=y
+CONFIG_TARGET_SOCFPGA_ARRIA10_ALWAYS_REPROGRAM=y
 CONFIG_SPL_FS_FAT=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT=y
Signature · 1 line
2.44.0.rc1.240.g4c46232300-goog
maintainer
#15 lore raw
In reply to Michał Barnaś
Quoted 8 lines · Michał Barnaś

By default, the board requires power cycle (cold boot) to program the FPGA with bitstream. This change adds Kconfig that allows to enable reprogramming the FPGA with every boot. This makes the update process of the bitstream on the filesystem to be applied with simple system reboot.

If we want to enable the reprogramming on every boot, would it make sense to just do it and not even bother with the Kconfig option?

Dinh

#16 lore raw
Quoted 13 lines · Dinh Nguyen
Quoted 8 lines · Michał Barnaś

By default, the board requires power cycle (cold boot) to program the FPGA with bitstream. This change adds Kconfig that allows to enable reprogramming the FPGA with every boot. This makes the update process of the bitstream on the filesystem to be applied with simple system reboot.

Quoted 4 lines

If we want to enable the reprogramming on every boot, would it make sense to just do it and not even bother with the Kconfig option?

Dinh

The FPGA programming part takes quite a long time, so it increases the reboot time significantly.
I don't think that everyone needs the reprogramming to happen every time. We need that
because our boards are closed in the lab and the power is not easily accessible, so in case of
update to the bitstream, we should be able to remotely update it with a pure warm reboot.
So I thought that this should be set by Kconfig to not bother other users with longer reboot times.

Michał

#17 lore raw
Quoted 44 lines

-----Original Message-----
From: Michał Barnaś <[email protected]>
Sent: Thursday, February 29, 2024 9:49 PM
To: Dinh Nguyen <[email protected]>
Cc: [email protected]; Marcel Ziswiler <[email protected]>; Marek Vasut <[email protected]>; Martyn Welch <[email protected]>; Paweł Anikiel <[email protected]>; Simon Glass <[email protected]>; Simon Goldschmidt <[email protected]>; Svyatoslav Ryhel <[email protected]>; Chee, Tien Fong <[email protected]>; Tom Rini <[email protected]>
Subject: Re: [PATCH 0/2] arm: socfpga: arria10: allow to reprogram FPGA with warm reboot

Quoted 13 lines · Dinh Nguyen
Quoted 8 lines · Michał Barnaś

By default, the board requires power cycle (cold boot) to program the FPGA with bitstream. This change adds Kconfig that allows to enable reprogramming the FPGA with every boot. This makes the update process of the bitstream on the filesystem to be applied with simple system reboot.

Quoted 4 lines

If we want to enable the reprogramming on every boot, would it make sense to just do it and not even bother with the Kconfig option?

Dinh

The FPGA programming part takes quite a long time, so it increases the reboot time significantly.
I don't think that everyone needs the reprogramming to happen every time. We need that because our boards are closed in the lab and the power is not easily accessible, so in case of update to the bitstream, we should be able to remotely update it with a pure warm reboot.
So I thought that this should be set by Kconfig to not bother other users with longer reboot times.

Quoted 1 line

Michał

Reprogram should be avoided when FPGA already in user mode, this is for FPGA boot first use case.

Full reprogram is slow in SPL, because very small buffer in this small OCRAM can only be used to process the full RBF.

Since this is an optional configuration, I don't see any issue with these changes.

Tien Fong