Skip to contentSkip to conversation

package/freescale-imx/firmware-imx: custom padding

PATCH Superseded Pieter De Gendt 4 participants 7 messages Sep 10, 2020 – Nov 3, 2020 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/freescale-imx/firmware-imx: custom padding

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) require the training data to be padded to a different loading address.

---
 package/freescale-imx/firmware-imx/Config.in       | 12 ++++++++++++
 package/freescale-imx/firmware-imx/firmware-imx.mk |  6 ++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
package/freescale-imx/firmware-imx/Config.in +12 -0
index 5becf8b6a9..c947248ee1 100644
@@ -69,6 +69,18 @@ config BR2_PACKAGE_FIRMWARE_IMX_DDR4
 
 endchoice # DDR training FW
 
+config BR2_PACKAGE_FIRMWARE_IMX_IMEM_ADDR
+	hex "(lp)ddr imem load address"
+	default 0x8000
+	help
+	  The training FW will be padded to start at this load address
+
+config BR2_PACKAGE_FIRMWARE_IMX_DMEM_ADDR
+	hex "(lp)ddr dmem load address"
+	default 0x4000
+	help
+	  The training FW will be padded to start at this load address
+
 endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
 
 endif # BR2_PACKAGE_FIRMWARE_IMX
package/freescale-imx/firmware-imx/firmware-imx.mk +4 -2
index eb8595f022..1ace002d5b 100644
@@ -23,10 +23,12 @@ endef
 #
 
 define FIRMWARE_IMX_PREPARE_DDR_FW
-	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \
+	$(TARGET_OBJCOPY) -I binary -O binary \
+		--pad-to $(BR2_PACKAGE_FIRMWARE_IMX_IMEM_ADDR) --gap-fill=0x0 \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1)).bin \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin
-	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 \
+	$(TARGET_OBJCOPY) -I binary -O binary \
+		--pad-to $(BR2_PACKAGE_FIRMWARE_IMX_DMEM_ADDR) --gap-fill=0x0 \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2)).bin \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2))_pad.bin
 	cat $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin \
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 package/freescale-imx/firmware-imx: custom padding

Quoted 8 lines

________________________________________
From: buildroot <[email protected]> on behalf of Pieter De Gendt <[email protected]>
Sent: Thursday, September 10, 2020 2:18 PM
To: buildroot at buildroot.org
Cc: Refik Tuzakli; Pieter De Gendt; Tibault Damman; Gary Bisson
Subject: [Buildroot] [PATCH 1/1] package/freescale-imx/firmware-imx: custom padding

Quoted 7 lines

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) require the training data to be padded to a different loading address.

Tested-by Stephane Viau stephane.viau at oss.nxp.com
[Stephane: tested on i.MX8MNano EVK with DDR4]
Quoted 55 lines

---
package/freescale-imx/firmware-imx/Config.in | 12 ++++++++++++
package/freescale-imx/firmware-imx/firmware-imx.mk | 6 ++++--

2 files changed, 16 insertions(+), 2 deletions(-)
package/freescale-imx/firmware-imx/Config.in +0 -0
index 5becf8b6a9..c947248ee1 100644
@@ -69,6 +69,18 @@ config BR2_PACKAGE_FIRMWARE_IMX_DDR4
 

endchoice # DDR training FW

package/freescale-imx/firmware-imx/Config.in +12 -0
+config BR2_PACKAGE_FIRMWARE_IMX_IMEM_ADDR
+       hex "(lp)ddr imem load address"
+       default 0x8000
+       help
+         The training FW will be padded to start at this load address
+
+config BR2_PACKAGE_FIRMWARE_IMX_DMEM_ADDR
+       hex "(lp)ddr dmem load address"
+       default 0x4000
+       help
+         The training FW will be padded to start at this load address
+

endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW

endif # BR2_PACKAGE_FIRMWARE_IMX

package/freescale-imx/firmware-imx/firmware-imx.mk +0 -0
index eb8595f022..1ace002d5b 100644
@@ -23,10 +23,12 @@ endef
 #
 

define FIRMWARE_IMX_PREPARE_DDR_FW

package/freescale-imx/firmware-imx/firmware-imx.mk +4 -3
-       $(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \
+       $(TARGET_OBJCOPY) -I binary -O binary \
+               --pad-to $(BR2_PACKAGE_FIRMWARE_IMX_IMEM_ADDR) --gap-fill=0x0 \
               $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1)).bin \
               $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin
-       $(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 \
+       $(TARGET_OBJCOPY) -I binary -O binary \
+               --pad-to $(BR2_PACKAGE_FIRMWARE_IMX_DMEM_ADDR) --gap-fill=0x0 \
               $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2)).bin \
               $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2))_pad.bin
       cat $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin \
--

2.25.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw

PATCH 1/1 package/freescale-imx/firmware-imx: custom padding

In reply to Pieter De Gendt

Hi,

Overall the patch is good, below are some small comments about the log and the variable naming.

Quoted 4 lines · Pieter De Gendt

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) require the training data to be padded to a different loading address.

On IRC you pointed to the varigit commit were that change is made, might be good to include it here for reference.
https://github.com/varigit/uboot-imx/commit/5f8d814f

That also explains the motivation behind that change.

Quoted 12 lines
---
 package/freescale-imx/firmware-imx/Config.in       | 12 ++++++++++++
 package/freescale-imx/firmware-imx/firmware-imx.mk |  6 ++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
package/freescale-imx/firmware-imx/Config.in +0 -0
index 5becf8b6a9..c947248ee1 100644

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX_DDR4 · line 76

Quoted 8 lines
package/freescale-imx/firmware-imx/Config.in +5 -0
@@ -69,6 +69,18 @@ config BR2_PACKAGE_FIRMWARE_IMX_DDR4
 
 endchoice # DDR training FW
 
+config BR2_PACKAGE_FIRMWARE_IMX_IMEM_ADDR
+	hex "(lp)ddr imem load address"
+	default 0x8000
+	help
+	  The training FW will be padded to start at this load address

Not sure the description matches my understanding of that value. Isn't that value what the binary will be padded to (--pad-to). So I wouldn't say the training FW will be padded to start at the load address but instead to end at this address.
Maybe the variable should be renamed to IMEM_LEN (matching U-Boot naming) or IMEM_PAD_ADDR.

Quoted 18 lines
package/freescale-imx/firmware-imx/Config.in +6 -0
+config BR2_PACKAGE_FIRMWARE_IMX_DMEM_ADDR
+	hex "(lp)ddr dmem load address"
+	default 0x4000
+	help
+	  The training FW will be padded to start at this load address
+
 endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
 
 endif # BR2_PACKAGE_FIRMWARE_IMX
package/freescale-imx/firmware-imx/firmware-imx.mk +0 -1
index eb8595f022..1ace002d5b 100644
@@ -23,10 +23,12 @@ endef
 #
 
 define FIRMWARE_IMX_PREPARE_DDR_FW
-	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \

package/freescale-imx/firmware-imx/firmware-imx.mk endef · line 34

Quoted 10 lines
package/freescale-imx/firmware-imx/firmware-imx.mk +4 -1
+	$(TARGET_OBJCOPY) -I binary -O binary \
+		--pad-to $(BR2_PACKAGE_FIRMWARE_IMX_IMEM_ADDR) --gap-fill=0x0 \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1)).bin \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin
-	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 \
+	$(TARGET_OBJCOPY) -I binary -O binary \
+		--pad-to $(BR2_PACKAGE_FIRMWARE_IMX_DMEM_ADDR) --gap-fill=0x0 \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2)).bin \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2))_pad.bin
 	cat $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin \

Other than that I'm okay with the patch.

Regards,
Gary

#3 lore raw

PATCH v2 1/1 package/freescale-imx/firmware-imx: custom padding

In reply to Pieter De Gendt

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) expect the (LP)DDR4 training data to be padded to a different length.

eg: https://github.com/varigit/uboot-imx/commit/5f8d814f

This patch makes the padding length configurable.

---
Changes v1 -> v2:
- improved description
- renamed variables to match U-Boot (suggested by Gary Bisson)

---
 package/freescale-imx/firmware-imx/Config.in       | 12 ++++++++++++
 package/freescale-imx/firmware-imx/firmware-imx.mk |  6 ++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
package/freescale-imx/firmware-imx/Config.in +12 -0
index 5becf8b6a9..587f402426 100644
@@ -69,6 +69,18 @@ config BR2_PACKAGE_FIRMWARE_IMX_DDR4
 
 endchoice # DDR training FW
 
+config BR2_PACKAGE_FIRMWARE_IMX_IMEM_LEN
+	hex "(LP)DDR IMEM padding length"
+	default 0x8000
+	help
+	  The IMEM firmware will be padded to this length
+
+config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN
+	hex "(LP)DDR DMEM padding length"
+	default 0x4000
+	help
+	  The DMEM firmware will be padded to this length
+
 endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
 
 endif # BR2_PACKAGE_FIRMWARE_IMX
package/freescale-imx/firmware-imx/firmware-imx.mk +4 -2
index eb8595f022..fb3cfe640b 100644
@@ -23,10 +23,12 @@ endef
 #
 
 define FIRMWARE_IMX_PREPARE_DDR_FW
-	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \
+	$(TARGET_OBJCOPY) -I binary -O binary \
+		--pad-to $(BR2_PACKAGE_FIRMWARE_IMX_IMEM_LEN) --gap-fill=0x0 \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1)).bin \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin
-	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 \
+	$(TARGET_OBJCOPY) -I binary -O binary \
+		--pad-to $(BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN) --gap-fill=0x0 \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2)).bin \
 		$(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(2))_pad.bin
 	cat $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(1))_pad.bin \
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 1/1 package/freescale-imx/firmware-imx: custom padding

Hi Pieter,

Quoted 12 lines · Pieter De Gendt

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) expect the (LP)DDR4 training data to be padded to a different length.

eg: https://github.com/varigit/uboot-imx/commit/5f8d814f

This patch makes the padding length configurable.

Quoted 6 lines

---
Changes v1 -> v2:
- improved description
- renamed variables to match U-Boot (suggested by Gary Bisson)

Thanks for your contribution!

Regards,
Gary

#5 lore raw

PATCH v2 1/1 package/freescale-imx/firmware-imx: custom padding

Hi Pieter, Gary and all,

Quoted 16 lines

Hi Pieter,

Quoted 12 lines · Pieter De Gendt

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) expect the (LP)DDR4 training data to be padded to a different length.

eg: https://github.com/varigit/uboot-imx/commit/5f8d814f

This patch makes the padding length configurable.

Quoted 8 lines
Quoted 6 lines

---
Changes v1 -> v2:
- improved description
- renamed variables to match U-Boot (suggested by Gary Bisson)

[Stephane: tested on i.MX8MM, i.MX8MN(ddr4) and i.MX8MQ EVK]
Quoted 10 lines

Thanks for your contribution!

Regards,
Gary
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#6 lore raw

PATCH v2 1/1 package/freescale-imx/firmware-imx: custom padding

In reply to Pieter De Gendt
Quoted 9 lines · On Tue, 15 Sep 2020 15:04:14 +0200 Pieter De Gendt <[email protected]>…

From: Tibault Damman <[email protected]>

Some derivatives (such as Variscite imx8mm) expect the (LP)DDR4 training data to be padded to a different length.

eg: https://github.com/varigit/uboot-imx/commit/5f8d814f

This patch makes the padding length configurable.

Quoted 7 lines

---
Changes v1 -> v2:
- improved description
- renamed variables to match U-Boot (suggested by Gary Bisson)

Applied to master, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com