From 9bdcbebe4b666a372d86a9832db4aca036fa6423 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 21 Feb 2018 17:41:13 +0100
Subject: [PATCH] rpi: Use firmware provided device tree

Currently the firmware generates a device tree for us that we could
just use to adjust ourselves. We then on boot throw that away and
use our own built-in device tree to configure device access.

This is bad for a multitude of reasons. For starters, it breaks
overlay support in config.txt, confusing users. Much worse however
is that we are stuck with individual U-Boot builds per board.
The firmware can easily give us the right DT depending on the
target board and revision though.

So let's use the firmware provided device tree instead. That way
U-Boot as well as payloads loaded by it can automatically adapt
to variants of RPi hardware.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 configs/rpi_0_w_defconfig   | 2 +-
 configs/rpi_2_defconfig     | 2 +-
 configs/rpi_3_32b_defconfig | 2 +-
 configs/rpi_3_defconfig     | 2 +-
 configs/rpi_defconfig       | 2 +-
 include/configs/rpi.h       | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig
index 04717d5e50..3b7e4f7ad9 100644
--- a/configs/rpi_0_w_defconfig
+++ b/configs/rpi_0_w_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
 CONFIG_ENV_FAT_INTERFACE="mmc"
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_DM_KEYBOARD=y
diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index f8203c9d47..de9c0e1937 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
 CONFIG_ENV_FAT_INTERFACE="mmc"
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_DM_KEYBOARD=y
diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
index 317fc28f71..2bbe687359 100644
--- a/configs/rpi_3_32b_defconfig
+++ b/configs/rpi_3_32b_defconfig
@@ -13,7 +13,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
 CONFIG_ENV_FAT_INTERFACE="mmc"
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_DM_KEYBOARD=y
diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
index 0f3a54ec9a..ca55f8dc66 100644
--- a/configs/rpi_3_defconfig
+++ b/configs/rpi_3_defconfig
@@ -13,7 +13,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
 CONFIG_ENV_FAT_INTERFACE="mmc"
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_DM_KEYBOARD=y
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
index d13d3d3e2e..d75032c420 100644
--- a/configs/rpi_defconfig
+++ b/configs/rpi_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_BOARD=y
 CONFIG_ENV_FAT_INTERFACE="mmc"
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_DM_KEYBOARD=y
diff --git a/include/configs/rpi.h b/include/configs/rpi.h
index 17cdecd1c3..bea4ab1b9a 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
@@ -125,7 +125,7 @@
 #define ENV_MEM_LAYOUT_SETTINGS \
 	"fdt_high=ffffffff\0" \
 	"initrd_high=ffffffff\0" \
-	"fdt_addr_r=0x00000100\0" \
+	"fdt_addr_r=0x01f00000\0" \
 	"pxefile_addr_r=0x00100000\0" \
 	"kernel_addr_r=0x01000000\0" \
 	"scriptaddr=0x02000000\0" \
