diff mbox series

[2/5] brppt1: Fix SPL boot stage

Message ID 20220825065404.161821-3-bernhard.messerklinger@br-automation.com
State Accepted
Commit b0a18f1f9fe822d6a0c6d8ca7161193a86a66332
Delegated to: Tom Rini
Headers show
Series Fix, update and cleanup brppt1 board | expand

Commit Message

Bernhard Messerklinger Aug. 25, 2022, 6:54 a.m. UTC
Commit 6337d53fdf45 ("arm: dts: sync am33xx with Linux 5.9-rc7") syncs
the am335x device tree with the latest linux kernel am335x device tree.
That causes problems with device tree in SPL stage.
To fix the issues CONFIG_SPL_OF_TRANSLATE must be set to handle the
synced bus addresses correctly.
A custom U-Boot device tree is also needed since the SPL build removes
bus properties from bus nodes which are not explicitly marked with the
u-boot,dm-spl or u-boot,dm-pre-reloc flag. Therefore all parent buses of
the in the SPL needed devices must be marked with u-boot,dm-pre-reloc.
Also since there is no driver for "ti,sysc" compatible property in SPL
the buses marked with this compatible string must also be marked with
compatible = "simple-bus" to make the underlying devices visible in
SPL. Otherwise the matching device drivers aren't found and the uclass
drivers are dropped.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
---

 arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi | 80 ++++++++++++++++++++++
 configs/brppt1_mmc_defconfig               |  2 +-
 2 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi

Comments

Wolfgang Wallner Aug. 29, 2022, 12:55 p.m. UTC | #1
From: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Sent: Thursday, August 25, 2022 8:54
Subject: [PATCH 2/5] brppt1: Fix SPL boot stage 
 
> Commit 6337d53fdf45 ("arm: dts: sync am33xx with Linux 5.9-rc7") syncs
> the am335x device tree with the latest linux kernel am335x device tree.
> That causes problems with device tree in SPL stage.
> To fix the issues CONFIG_SPL_OF_TRANSLATE must be set to handle the
> synced bus addresses correctly.
> A custom U-Boot device tree is also needed since the SPL build removes
> bus properties from bus nodes which are not explicitly marked with the
> u-boot,dm-spl or u-boot,dm-pre-reloc flag. Therefore all parent buses of
> the in the SPL needed devices must be marked with u-boot,dm-pre-reloc.
> Also since there is no driver for "ti,sysc" compatible property in SPL
> the buses marked with this compatible string must also be marked with
> compatible = "simple-bus" to make the underlying devices visible in
> SPL. Otherwise the matching device drivers aren't found and the uclass
> drivers are dropped.
> 
> Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
> ---
> 
>  arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi | 80 ++++++++++++++++++++++
>  configs/brppt1_mmc_defconfig               |  2 +-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi

Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Tom Rini Sept. 15, 2022, 9:54 p.m. UTC | #2
On Thu, Aug 25, 2022 at 08:54:01AM +0200, Bernhard Messerklinger wrote:

> Commit 6337d53fdf45 ("arm: dts: sync am33xx with Linux 5.9-rc7") syncs
> the am335x device tree with the latest linux kernel am335x device tree.
> That causes problems with device tree in SPL stage.
> To fix the issues CONFIG_SPL_OF_TRANSLATE must be set to handle the
> synced bus addresses correctly.
> A custom U-Boot device tree is also needed since the SPL build removes
> bus properties from bus nodes which are not explicitly marked with the
> u-boot,dm-spl or u-boot,dm-pre-reloc flag. Therefore all parent buses of
> the in the SPL needed devices must be marked with u-boot,dm-pre-reloc.
> Also since there is no driver for "ti,sysc" compatible property in SPL
> the buses marked with this compatible string must also be marked with
> compatible = "simple-bus" to make the underlying devices visible in
> SPL. Otherwise the matching device drivers aren't found and the uclass
> drivers are dropped.
> 
> Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi b/arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi
new file mode 100644
index 0000000000..0b9a1ccef4
--- /dev/null
+++ b/arch/arm/dts/am335x-brppt1-mmc-u-boot.dtsi
@@ -0,0 +1,80 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 B&R Industrial Automation GmbH -
+ * https://www.br-automation.com/
+ */
+
+/ {
+	ocp {
+		u-boot,dm-pre-reloc;
+	};
+};
+
+&l4_wkup {
+	u-boot,dm-pre-reloc;
+	segment@200000 {
+		u-boot,dm-pre-reloc;
+		target-module@0
+		{
+			u-boot,dm-pre-reloc;
+			compatible = "simple-bus";
+		};
+		target-module@7000 {
+			u-boot,dm-pre-reloc;
+			compatible = "simple-bus";
+		};
+		target-module@9000 {
+			u-boot,dm-pre-reloc;
+			compatible = "simple-bus";
+		};
+	};
+};
+
+&wkup_cm {
+	u-boot,dm-pre-reloc;
+};
+
+&l4_wkup_clkctrl {
+	u-boot,dm-pre-reloc;
+};
+
+&l4_per {
+	u-boot,dm-pre-reloc;
+	segment@0 {
+		u-boot,dm-pre-reloc;
+		compatible = "simple-bus";
+		target-module@4c000 {
+			u-boot,dm-pre-reloc;
+			compatible = "simple-bus";
+		};
+	};
+
+	segment@100000 {
+		u-boot,dm-pre-reloc;
+		compatible = "simple-bus";
+		target-module@ac000 {
+			u-boot,dm-pre-reloc;
+			compatible = "simple-bus";
+		};
+		target-module@ae000 {
+			u-boot,dm-pre-reloc;
+			compatible = "simple-bus";
+		};
+	};
+};
+
+&prcm {
+	u-boot,dm-pre-reloc;
+};
+
+&gpio0_target {
+	u-boot,dm-pre-reloc;
+};
+
+&prcm_clocks {
+	compatible = "simple-bus";
+};
+
+&scm_clocks {
+	compatible = "simple-bus";
+};
diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index b1ed2bcd68..716650aac9 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -90,7 +90,7 @@  CONFIG_NETCONSOLE=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
-# CONFIG_OF_TRANSLATE is not set
+CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DM_I2C=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y