diff mbox series

[v2] ti-k3-r5-loader: support devicetree customization

Message ID 20240430133754.1288162-1-gero.schwaericke@grandcentrix.net
State Accepted
Headers show
Series [v2] ti-k3-r5-loader: support devicetree customization | expand

Commit Message

Gero Schwäricke April 30, 2024, 1:37 p.m. UTC
This is duplicated from the U-Boot makefile & Kconfig.

Similarly to U-Boot custom boards sometimes need to adjust the U-Boot
devicetree. For example, the AM64x SDRAM controller supports inline ECC
which needs to be enabled in the R5 loader devicetree.

Please note that some versions of U-Boot have broken external devicetree
support and may require manual patching to build. See commit
3609e1dc5f4d4c238dcd23e045ba6223310feffa in the U-Boot tree.

Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Signed-off-by: Gero Schwäricke <gero.schwaericke@grandcentrix.net>
---
v1 -> v2:
  - make it apply on current master
  - move the config option into  if BR2_TARGET_TI_K3_R5_LOADER
  - fix help string mentioning ARCH though it's fixed to arm in .mk
---
 boot/ti-k3-r5-loader/Config.in          | 10 ++++++++++
 boot/ti-k3-r5-loader/ti-k3-r5-loader.mk |  5 +++++
 2 files changed, 15 insertions(+)

Comments

Gero Schwäricke April 30, 2024, 1:42 p.m. UTC | #1
Note: This is v2 for

  [PATCH] ti-k3-r5-loader: support devicetree customisation

  https://patchwork.ozlabs.org/project/buildroot/patch/20230905003412.67305-2-patrick.oppenlander@gmail.com/

I think patchwork didn't catch that because I spelled the subject line
differently.

Best,
Gero
Romain Naour May 1, 2024, 9:53 p.m. UTC | #2
Hello Gero,

Le 30/04/2024 à 15:37, Gero Schwäricke via buildroot a écrit :
> This is duplicated from the U-Boot makefile & Kconfig.
> 
> Similarly to U-Boot custom boards sometimes need to adjust the U-Boot
> devicetree. For example, the AM64x SDRAM controller supports inline ECC
> which needs to be enabled in the R5 loader devicetree.
> 
> Please note that some versions of U-Boot have broken external devicetree
> support and may require manual patching to build. See commit
> 3609e1dc5f4d4c238dcd23e045ba6223310feffa in the U-Boot tree.

I added the URL to gitlab instead:
https://source.denx.de/u-boot/u-boot/-/commit/3609e1dc5f4d4c238dcd23e045ba6223310feffa

Applied to master, thanks.

Best regards,
Romain


> 
> Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> Signed-off-by: Gero Schwäricke <gero.schwaericke@grandcentrix.net>
> ---
> v1 -> v2:
>   - make it apply on current master
>   - move the config option into  if BR2_TARGET_TI_K3_R5_LOADER
>   - fix help string mentioning ARCH though it's fixed to arm in .mk
> ---
>  boot/ti-k3-r5-loader/Config.in          | 10 ++++++++++
>  boot/ti-k3-r5-loader/ti-k3-r5-loader.mk |  5 +++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
> index 6d1adbeac3..df885cc2af 100644
> --- a/boot/ti-k3-r5-loader/Config.in
> +++ b/boot/ti-k3-r5-loader/Config.in
> @@ -95,6 +95,16 @@ config BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_CONFIG_FILE
>  	help
>  	  Path to the TI K3 R5 Loader configuration file.
>  
> +config BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_DTS_PATH
> +	string "Device Tree Source file paths"
> +	help
> +	  Space-separated list of paths to device tree source files
> +	  that will be copied to arch/arm/dts/ before starting the
> +	  build.
> +
> +	  To use this device tree source file, the U-Boot configuration
> +	  file must refer to it.
> +
>  config BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN
>  	string "tiboot3.bin binary name"
>  	default "tiboot3.bin"
> diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> index 891783e40f..98a6d473f1 100644
> --- a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> +++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
> @@ -88,7 +88,12 @@ define TI_K3_R5_LOADER_INSTALL_SWSFW_ITB
>  	fi
>  endef
>  
> +TI_K3_R5_LOADER_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_DTS_PATH))
> +
>  define TI_K3_R5_LOADER_BUILD_CMDS
> +	$(if $(TI_K3_R5_LOADER_CUSTOM_DTS_PATH),
> +		cp -f $(TI_K3_R5_LOADER_CUSTOM_DTS_PATH) $(@D)/arch/arm/dts/
> +	)
>  	$(TARGET_CONFIGURE_OPTS) $(TI_K3_R5_LOADER_MAKE) -C $(@D) $(TI_K3_R5_LOADER_MAKE_OPTS)
>  endef
>
diff mbox series

Patch

diff --git a/boot/ti-k3-r5-loader/Config.in b/boot/ti-k3-r5-loader/Config.in
index 6d1adbeac3..df885cc2af 100644
--- a/boot/ti-k3-r5-loader/Config.in
+++ b/boot/ti-k3-r5-loader/Config.in
@@ -95,6 +95,16 @@  config BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_CONFIG_FILE
 	help
 	  Path to the TI K3 R5 Loader configuration file.
 
+config BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_DTS_PATH
+	string "Device Tree Source file paths"
+	help
+	  Space-separated list of paths to device tree source files
+	  that will be copied to arch/arm/dts/ before starting the
+	  build.
+
+	  To use this device tree source file, the U-Boot configuration
+	  file must refer to it.
+
 config BR2_TARGET_TI_K3_R5_LOADER_TIBOOT3_BIN
 	string "tiboot3.bin binary name"
 	default "tiboot3.bin"
diff --git a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
index 891783e40f..98a6d473f1 100644
--- a/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
+++ b/boot/ti-k3-r5-loader/ti-k3-r5-loader.mk
@@ -88,7 +88,12 @@  define TI_K3_R5_LOADER_INSTALL_SWSFW_ITB
 	fi
 endef
 
+TI_K3_R5_LOADER_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_TI_K3_R5_LOADER_CUSTOM_DTS_PATH))
+
 define TI_K3_R5_LOADER_BUILD_CMDS
+	$(if $(TI_K3_R5_LOADER_CUSTOM_DTS_PATH),
+		cp -f $(TI_K3_R5_LOADER_CUSTOM_DTS_PATH) $(@D)/arch/arm/dts/
+	)
 	$(TARGET_CONFIGURE_OPTS) $(TI_K3_R5_LOADER_MAKE) -C $(@D) $(TI_K3_R5_LOADER_MAKE_OPTS)
 endef