Skip to contentSkip to conversation

package/freescale-imx: clean-up proposal

PATCH New Stephane Viau 3 participants 11 messages Jul 10, 2020 – Jul 12, 2020 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

v3 cover package/freescale-imx: clean-up proposal

Here is the third version of this patch set whose aim is to clean up the firmware-imx package. Thank you all for the feedback in the previous version.

BR,
Stephane.

Stephane Viau (4):
package/freescale-imx: Move DDR FW choice down to firmware-imx package package/freescale-imx/firmware-imx: Fix sdma/vpu firmware install path package/freescale-imx/firmware-imx: Add option for all i.MX FW needs package/freescale-imx/firmware-imx: Clean up the image/target semantic

 configs/freescale_imx8mnevk_defconfig              |  2 +-
 package/freescale-imx/Config.in                    |  6 --
 package/freescale-imx/firmware-imx/Config.in       | 52 +++++++++++++++--
 package/freescale-imx/firmware-imx/firmware-imx.mk | 67 ++++++++++++++++------
 4 files changed, 96 insertions(+), 31 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/4 package/freescale-imx: Move DDR FW choice down to firmware-imx package

The DDR FW along with all other FW code that need to be used in bootloader or installed on target are related to the firmware-imx package.

This patch does this job as well as fixing the conjugation of NEED*s* in the symbol name. Also take advantage of this patch to make the DDR FW dependant on BR2_PACKAGE_FIRMWARE_IMX.

Note that BR2_PACKAGE_FIRMWARE_IMX_xxx is the preferred naming convention for the upcoming couple of patches.

--
v2:
- Fix attributes order (make check-package)

---
 configs/freescale_imx8mnevk_defconfig              |  2 +-
 package/freescale-imx/Config.in                    |  6 ------
 package/freescale-imx/firmware-imx/Config.in       | 15 +++++++++++----
 package/freescale-imx/firmware-imx/firmware-imx.mk |  6 +++---
 4 files changed, 15 insertions(+), 14 deletions(-)
configs/freescale_imx8mnevk_defconfig +1 -1
index a859d1c..6d91e3a 100644
@@ -15,7 +15,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
 BR2_PACKAGE_FREESCALE_IMX=y
 BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MN=y
 BR2_PACKAGE_FIRMWARE_IMX=y
-BR2_PACKAGE_FIRMWARE_DDRFW_DDR4=y
+BR2_PACKAGE_FIRMWARE_IMX_DDR4=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
package/freescale-imx/Config.in +0 -6
index 0be37ce..b0c7de8 100644
@@ -45,15 +45,12 @@ config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8
 
 config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
 	bool "imx8m"
-	select BR2_PACKAGE_FREESCALE_IMX_NEED_DDR_FW
 
 config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM
 	bool "imx8mm"
-	select BR2_PACKAGE_FREESCALE_IMX_NEED_DDR_FW
 
 config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MN
 	bool "imx8mn"
-	select BR2_PACKAGE_FREESCALE_IMX_NEED_DDR_FW
 
 config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X
 	bool "imx8x"
@@ -99,9 +96,6 @@ config BR2_PACKAGE_FREESCALE_IMX_HAS_VIV_GPU
 		BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MN || \
 		BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X
 
-config BR2_PACKAGE_FREESCALE_IMX_NEED_DDR_FW
-	bool
-
 source "package/freescale-imx/imx-alsa-plugins/Config.in"
 source "package/freescale-imx/imx-codec/Config.in"
 source "package/freescale-imx/imx-kobs/Config.in"
package/freescale-imx/firmware-imx/Config.in +11 -4
index 4962992..7ff37ed 100644
@@ -9,22 +9,29 @@ config BR2_PACKAGE_FIRMWARE_IMX
 	  This library is provided by Freescale as-is and doesn't have
 	  an upstream.
 
-if BR2_PACKAGE_FREESCALE_IMX_NEED_DDR_FW
+config BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MN
+	depends on BR2_PACKAGE_FIRMWARE_IMX
+
+if BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
 
 choice
 	bool "DDR training binaries"
-	default BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4
+	default BR2_PACKAGE_FIRMWARE_IMX_LPDDR4
 	help
 	  Choose the DDR training binaries to be used depending on the
 	  kind of memory that is available on the target board (DDR4,
 	  LPDDR4, etc...).
 
-config BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4
+config BR2_PACKAGE_FIRMWARE_IMX_LPDDR4
 	bool "lpddr4"
 	help
 	  Use LPDDR4 binaries (i.e.: lpddr4_pmu_train_*.bin)
 
-config BR2_PACKAGE_FIRMWARE_DDRFW_DDR4
+config BR2_PACKAGE_FIRMWARE_IMX_DDR4
 	bool "DDR4"
 	help
 	  Use DDR4 binaries (i.e.: ddr4_*_201810.bin).
package/freescale-imx/firmware-imx/firmware-imx.mk +3 -3
index 6beacc0..55ca6fc 100644
@@ -18,10 +18,10 @@ define FIRMWARE_IMX_EXTRACT_CMDS
 	$(call FREESCALE_IMX_EXTRACT_HELPER,$(FIRMWARE_IMX_DL_DIR)/$(FIRMWARE_IMX_SOURCE))
 endef
 
-ifeq ($(BR2_PACKAGE_FREESCALE_IMX_NEED_DDR_FW),y)
+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW),y)
 FIRMWARE_IMX_INSTALL_IMAGES = YES
 
-ifeq ($(BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4),y)
+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y)
 FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys
 define FIRMWARE_IMX_PREPARE_LPDDR4_FW
 	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \
@@ -46,7 +46,7 @@ define FIRMWARE_IMX_PREPARE_DDR_FW
 		$(BINARIES_DIR)/lpddr4_pmu_train_fw.bin
 	ln -sf $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin $(BINARIES_DIR)/ddr_fw.bin
 endef
-else ifeq ($(BR2_PACKAGE_FIRMWARE_DDRFW_DDR4),y)
+else ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR4),y)
 FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys
 define FIRMWARE_IMX_PREPARE_DDR4_FW
 	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 1/4 package/freescale-imx: Move DDR FW choice down to firmware-imx package

Hello,

Quoted 7 lines · On Fri, 10 Jul 2020 14:00:42 +0200 Stephane Viau <[email protected]>…

The DDR FW along with all other FW code that need to be used in bootloader or installed on target are related to the firmware-imx package.

This patch does this job as well as fixing the conjugation of NEED*s* in the symbol name. Also take advantage of this patch to make the DDR FW dependant on BR2_PACKAGE_FIRMWARE_IMX.

Quoted 5 lines

Note that BR2_PACKAGE_FIRMWARE_IMX_xxx is the preferred naming convention for the upcoming couple of patches.

I have applied, with some changes. See below.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 29

Quoted 11 lines

choice

package/freescale-imx/firmware-imx/Config.in +2 -2
 	bool "DDR training binaries"
-	default BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4
+	default BR2_PACKAGE_FIRMWARE_IMX_LPDDR4
 	help
 	  Choose the DDR training binaries to be used depending on the
 	  kind of memory that is available on the target board (DDR4,
 	  LPDDR4, etc...).
 
-config BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4
+config BR2_PACKAGE_FIRMWARE_IMX_LPDDR4

When renaming options, we need to keep the old option name in Config.in.legacy so that it doesn't get silently dropped when users update to a newer Buildroot version.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 34

Quoted 6 lines
package/freescale-imx/firmware-imx/Config.in +1 -1
 	bool "lpddr4"
 	help
 	  Use LPDDR4 binaries (i.e.: lpddr4_pmu_train_*.bin)
 
-config BR2_PACKAGE_FIRMWARE_DDRFW_DDR4
+config BR2_PACKAGE_FIRMWARE_IMX_DDR4

Same here.

I fixed that when applying.

Thanks!

Thomas

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

PATCH v3 1/4 package/freescale-imx: Move DDR FW choice down to firmware-imx package

Thomas, All,

On 2020-07-11 22:48 +0200, Thomas Petazzoni spake thusly:

Quoted 2 lines

On Fri, 10 Jul 2020 14:00:42 +0200
Stephane Viau <[email protected]> wrote:

[--SNIP--]

Quoted 6 lines

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 29

Quoted 2 lines
package/freescale-imx/firmware-imx/Config.in +1 -1
-config BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4
+config BR2_PACKAGE_FIRMWARE_IMX_LPDDR4

When renaming options, we need to keep the old option name in Config.in.legacy so that it doesn't get silently dropped when users update to a newer Buildroot version.

That was not necessary, because BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4 was only introduced after 2020.05, so we have no release with the symbol.

Quoted 8 lines

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 34

Quoted 6 lines
package/freescale-imx/firmware-imx/Config.in +1 -1
 	bool "lpddr4"
 	help
 	  Use LPDDR4 binaries (i.e.: lpddr4_pmu_train_*.bin)
 
-config BR2_PACKAGE_FIRMWARE_DDRFW_DDR4
+config BR2_PACKAGE_FIRMWARE_IMX_DDR4

Same here.

Ditto.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v3 1/4 package/freescale-imx: Move DDR FW choice down to firmware-imx package

Quoted 6 lines · On Sun, 12 Jul 2020 08:10:11 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 3 lines

When renaming options, we need to keep the old option name in Config.in.legacy so that it doesn't get silently dropped when users update to a newer Buildroot version.

That was not necessary, because BR2_PACKAGE_FIRMWARE_DDRFW_LPDDR4 was only introduced after 2020.05, so we have no release with the symbol.

Gah, indeed, I missed that. I fixed it up in a follow-up commit. Thanks for noticing!

Thomas

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

PATCH v3 2/4 package/freescale-imx/firmware-imx: Fix sdma/vpu firmware install path

In reply to Stephane Viau

In a patch set that did not get in for other reasons, Sebastien proposed to fix the install path directory of the sdma and vpu firmware code [1]:

"Mainline and NXP kernels expect the sdma firmware to be in /lib/firmware/imx/sdma so fix the install path [...]"

By looking at the code, I believe this is correct even though I have no means to test it.

[1] http://lists.busybox.net/pipermail/buildroot/2020-June/284875.html

---
 package/freescale-imx/firmware-imx/firmware-imx.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/freescale-imx/firmware-imx/firmware-imx.mk +1 -1
index 55ca6fc..c4ac5f7 100644
@@ -95,7 +95,7 @@ else
 define FIRMWARE_IMX_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/lib/firmware/imx
 	for blobdir in $(FIRMWARE_IMX_BLOBS); do \
-		cp -r $(@D)/firmware/$${blobdir} $(TARGET_DIR)/lib/firmware; \
+		cp -r $(@D)/firmware/$${blobdir} $(TARGET_DIR)/lib/firmware/imx; \
 	done
 	cp -r $(@D)/firmware/epdc $(TARGET_DIR)/lib/firmware/imx
 	mv $(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw.nonrestricted \
Signature · 1 line
2.7.4
#6 lore raw

PATCH v3 2/4 package/freescale-imx/firmware-imx: Fix sdma/vpu firmware install path

Quoted 9 lines · On Fri, 10 Jul 2020 14:00:43 +0200 Stephane Viau <[email protected]>…

In a patch set that did not get in for other reasons, Sebastien proposed to fix the install path directory of the sdma and vpu firmware code [1]:

"Mainline and NXP kernels expect the sdma firmware to be in /lib/firmware/imx/sdma so fix the install path [...]"

By looking at the code, I believe this is correct even though I have no means to test it.

Quoted 7 lines

[1] http://lists.busybox.net/pipermail/buildroot/2020-June/284875.html

---
 package/freescale-imx/firmware-imx/firmware-imx.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas

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

PATCH v3 3/4 package/freescale-imx/firmware-imx: Add option for all i.MX FW needs

In reply to Stephane Viau

Some SoC need a HDMI FW for their bootloader, some other require EPDC, SDMA and/or VPU.
Instead of trying to "guess" what firmware images need to be installed in firmware-imx.mk, let the Config framework do the job and allow each SoC to pick what firmware they need.

Note that this patch should also help introducing an eventual DP FW, as Gary mentioned in a separate thread [1].

[1] http://lists.busybox.net/pipermail/buildroot/2020-May/283181.html

---
v3:
- only copy the VPU (and SDMA) blob associated to the platform selected (Gary)
- Fix attributes order (make check-package)

v2:
- Do not embed VPU FW for i.MX 6S/6UL/7 (Fabio)
- Name VPU FW after IP name (Fabio)
- Rename symbols using the "_NEED_" in their name (Thomas)

---
 package/freescale-imx/firmware-imx/Config.in | 37 +++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
package/freescale-imx/firmware-imx/Config.in +36 -1
index 7ff37ed..2c00ee1 100644
@@ -4,11 +4,46 @@ config BR2_PACKAGE_FIRMWARE_IMX
 	help
 	  Firmware blobs for the Freescale i.MX SoCs.
 
-	  It contains blobs for SDMA and VPU.
+	  It contains blobs for SDMA, VPU, etc...
 
 	  This library is provided by Freescale as-is and doesn't have
 	  an upstream.
 
+config BR2_PACKAGE_FIRMWARE_IMX_SDMA
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX25_3STACK
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX27ADS
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX37_3STACK
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX50
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX51
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX53
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6S
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6UL
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX7
+	depends on BR2_PACKAGE_FIRMWARE_IMX
+
+config BR2_PACKAGE_FIRMWARE_IMX_VPU
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX27ADS
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX51
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX53
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X
+	depends on BR2_PACKAGE_FIRMWARE_IMX
+
+config BR2_PACKAGE_FIRMWARE_IMX_HDMI
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
+	depends on BR2_PACKAGE_FIRMWARE_IMX
+
+config BR2_PACKAGE_FIRMWARE_IMX_EPDC
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6S
+	depends on BR2_PACKAGE_FIRMWARE_IMX
+
 config BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
 	bool
 	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
Signature · 1 line
2.7.4
#8 lore raw

PATCH v3 3/4 package/freescale-imx/firmware-imx: Add option for all i.MX FW needs

Quoted 6 lines · On Fri, 10 Jul 2020 14:00:44 +0200 Stephane Viau <[email protected]>…

Some SoC need a HDMI FW for their bootloader, some other require EPDC, SDMA and/or VPU.
Instead of trying to "guess" what firmware images need to be installed in firmware-imx.mk, let the Config framework do the job and allow each SoC to pick what firmware they need.

Quoted 8 lines

Note that this patch should also help introducing an eventual DP FW, as Gary mentioned in a separate thread [1].

[1] http://lists.busybox.net/pipermail/buildroot/2020-May/283181.html

I have applied with some changes. See below.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 7

Quoted 2 lines
package/freescale-imx/firmware-imx/Config.in +1 -1
-	  It contains blobs for SDMA and VPU.
+	  It contains blobs for SDMA, VPU, etc...

I've improved this with a complete list of the firmware that it can potentially install.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 12

Quoted 5 lines
package/freescale-imx/firmware-imx/Config.in +1 -0
 	  This library is provided by Freescale as-is and doesn't have
 	  an upstream.
 
+config BR2_PACKAGE_FIRMWARE_IMX_SDMA

Renamed to:

BR2_PACKAGE_FIRMWARE_IMX_NEEDS_SDMA_FW

to match the naming of the DDR firmware option.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 23

Quoted 11 lines
package/freescale-imx/firmware-imx/Config.in +11 -0
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX25_3STACK
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX27ADS
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX37_3STACK
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX50
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX51
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX53
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6S
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6UL
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX7

When you look at the sdma folder, it contains:

sdma-imx25-to1.bin
sdma-imx31-to1.bin
sdma-imx31-to2.bin
sdma-imx35-to1.bin
sdma-imx35-to2.bin
sdma-imx51-to3.bin
sdma-imx53-to1.bin
sdma-imx6q.bin
sdma-imx7d.bin

So there is no firmware for i.MX37, i.MX50, i.MX6S and i.MX6UL, so I dropped these from the supported platform.

Review

Quoted 1 line
(quoted diff) +1 -0
+	depends on BR2_PACKAGE_FIRMWARE_IMX

Instead of repeating this, I've enclosed all options in a "if BR2_PACKAGE_FIRMWARE_IMX ... endif" block.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 26

Quoted 2 lines
package/freescale-imx/firmware-imx/Config.in +2 -0
+
+config BR2_PACKAGE_FIRMWARE_IMX_VPU

Ditto naming.

package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX · line 34

Quoted 8 lines
package/freescale-imx/firmware-imx/Config.in +8 -0
+	bool
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX27ADS
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX51
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX53
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8
+	default y if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X
+	depends on BR2_PACKAGE_FIRMWARE_IMX

Ditto dependency.

And same for the other options as well.

I fixed these issues when applying.

Thanks!

Thomas

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

PATCH v3 4/4 package/freescale-imx/firmware-imx: Clean up the image/target semantic

In reply to Stephane Viau

The newly introduced BR2_PACKAGE_FIRMWARE_IMX_xxx symbols shall be used in lieue of the SoC type when installing images or binaries on target.

These new symbols let us define FIRMWARE_IMX_INSTALL_IMAGES_CMDS and FIRMWARE_IMX_INSTALL_TARGET_CMDS based on platform needs rather than SoC type.

---
v3:
- Only copy the VPU (and SDMA) blob associated to the platform selected (Gary)
- Set FIRMWARE_IMX_INSTALL_IMAGES_CMDS to YES at the beginning (Gary)
- Remove FIRMWARE_IMX_INSTALL_TARGET useless default value (make check-package)

v2:
- Name VPU FW after IP name (Fabio)
- Rename symbols using the "_NEED_" in their name (Thomas)
- Remove unnecessary comments & move INSTALL_IMAGES down (Thomas)

---
 package/freescale-imx/firmware-imx/firmware-imx.mk | 61 ++++++++++++++++------
 1 file changed, 45 insertions(+), 16 deletions(-)
package/freescale-imx/firmware-imx/firmware-imx.mk +45 -16
index c4ac5f7..ef2923e 100644
@@ -12,14 +12,15 @@ FIRMWARE_IMX_LICENSE = NXP Semiconductor Software License Agreement
 FIRMWARE_IMX_LICENSE_FILES = EULA COPYING
 FIRMWARE_IMX_REDISTRIBUTE = NO
 
-FIRMWARE_IMX_BLOBS = sdma vpu
+FIRMWARE_IMX_INSTALL_IMAGES = YES
+
+FIRMWARE_IMX_PLATFORM_LOWER = $(shell echo $(BR2_PACKAGE_FREESCALE_IMX_PLATFORM) | tr A-Z a-z | head -c 5)
 
 define FIRMWARE_IMX_EXTRACT_CMDS
 	$(call FREESCALE_IMX_EXTRACT_HELPER,$(FIRMWARE_IMX_DL_DIR)/$(FIRMWARE_IMX_SOURCE))
 endef
 
 ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW),y)
-FIRMWARE_IMX_INSTALL_IMAGES = YES
 
 ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y)
 FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys
@@ -72,35 +73,63 @@ define FIRMWARE_IMX_PREPARE_DDR_FW
 	ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin
 endef
 endif
+endif # IMX_NEEDS_DDR_FW
+
+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_HDMI),y)
 
-ifeq ($(BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M),y)
 define FIRMWARE_IMX_PREPARE_HDMI_FW
 	cp $(@D)/firmware/hdmi/cadence/signed_hdmi_imx8m.bin \
 		$(BINARIES_DIR)/signed_hdmi_imx8m.bin
 endef
 endif
 
-define FIRMWARE_IMX_INSTALL_IMAGES_CMDS
-	$(FIRMWARE_IMX_PREPARE_DDR_FW)
-	$(FIRMWARE_IMX_PREPARE_HDMI_FW)
+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_EPDC),y)
+
+define FIRMWARE_IMX_INSTALL_TARGET_EPDC_FW
+	mkdir -p $(TARGET_DIR)/lib/firmware/imx
+	cp -r $(@D)/firmware/epdc $(TARGET_DIR)/lib/firmware/imx
+	mv $(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw.nonrestricted \
+		$(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw
 endef
-else ifeq ($(BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X),y)
-define FIRMWARE_IMX_INSTALL_TARGET_CMDS
+endif
+
+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_SDMA),y)
+
+define FIRMWARE_IMX_INSTALL_TARGET_SDMA_FW
+	mkdir -p $(TARGET_DIR)/lib/firmware/imx/sdma
+	cp -r $(@D)/firmware/sdma/sdma-$(FIRMWARE_IMX_PLATFORM_LOWER)*.bin \
+	       $(TARGET_DIR)/lib/firmware/imx/sdma/
+endef
+endif
+
+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_VPU),y)
+
+ifeq ($(BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X),y)
+define FIRMWARE_IMX_INSTALL_TARGET_VPU_FW
 	$(INSTALL) -D -m 0644 $(@D)/firmware/vpu/vpu_fw_imx8_dec.bin \
 		$(TARGET_DIR)/lib/firmware/vpu/vpu_fw_imx8_dec.bin
 	$(INSTALL) -D -m 0644 $(@D)/firmware/vpu/vpu_fw_imx8_enc.bin \
 		$(TARGET_DIR)/lib/firmware/vpu/vpu_fw_imx8_enc.bin
 endef
+
 else
-define FIRMWARE_IMX_INSTALL_TARGET_CMDS
-	mkdir -p $(TARGET_DIR)/lib/firmware/imx
-	for blobdir in $(FIRMWARE_IMX_BLOBS); do \
-		cp -r $(@D)/firmware/$${blobdir} $(TARGET_DIR)/lib/firmware/imx; \
-	done
-	cp -r $(@D)/firmware/epdc $(TARGET_DIR)/lib/firmware/imx
-	mv $(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw.nonrestricted \
-		$(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw
+define FIRMWARE_IMX_INSTALL_TARGET_VPU_FW
+	mkdir -p $(TARGET_DIR)/lib/firmware/imx/vpu
+	cp $(@D)/firmware/vpu/vpu_fw_$(FIRMWARE_IMX_PLATFORM_LOWER)*.bin \
+		$(TARGET_DIR)/lib/firmware/imx/vpu/
 endef
 endif
+endif
+
+define FIRMWARE_IMX_INSTALL_IMAGES_CMDS
+	$(FIRMWARE_IMX_PREPARE_DDR_FW)
+	$(FIRMWARE_IMX_PREPARE_HDMI_FW)
+endef
+
+define FIRMWARE_IMX_INSTALL_TARGET_CMDS
+	$(FIRMWARE_IMX_INSTALL_TARGET_EPDC_FW)
+	$(FIRMWARE_IMX_INSTALL_TARGET_SDMA_FW)
+	$(FIRMWARE_IMX_INSTALL_TARGET_VPU_FW)
+endef
 
 $(eval $(generic-package))
Signature · 1 line
2.7.4
#10 lore raw

PATCH v3 4/4 package/freescale-imx/firmware-imx: Clean up the image/target semantic

Quoted 10 lines · On Fri, 10 Jul 2020 14:00:45 +0200 Stephane Viau <[email protected]>…

The newly introduced BR2_PACKAGE_FIRMWARE_IMX_xxx symbols shall be used in lieue of the SoC type when installing images or binaries on target.

These new symbols let us define FIRMWARE_IMX_INSTALL_IMAGES_CMDS and FIRMWARE_IMX_INSTALL_TARGET_CMDS based on platform needs rather than SoC type.

I've applied, with some changes:

- I dropped the BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW conditional, and instead just use conditions on BR2_PACKAGE_FIRMWARE_IMX_LPDDR4 and BR2_PACKAGE_FIRMWARE_IMX_DDR4

- I renamed FIRMWARE_IMX_PREPARE_DDR_FW to FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW, because what it does is really install the firmware.

- I've used the correct option names after my changes on PATCH 3/4.

- I simplified the VPU installation tweak for i.MX8X.

I've done a few tests, but if you can have a second look at what I committed, it would be useful.

Thanks a lot!

Thomas

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