uboot-tools/db410c-fixes.patch
2018-01-16 03:31:08 +00:00

531 lines
15 KiB
Diff

From 38527d254b1d2c439c9e3ebbe2c82ecd7c729023 Mon Sep 17 00:00:00 2001
From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Date: Wed, 13 Dec 2017 21:55:10 +0100
Subject: [PATCH 09/15] db410c: configs: increase gunzip buffer size for the
kernel
the kernel fails to boot when it goes over the limit.
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
include/configs/dragonboard410c.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
index d2447b27d8..3c5bb8a678 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -23,7 +23,7 @@
#define CONFIG_SYS_TEXT_BASE 0x80080000
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x80000)
-#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16MB max kernel size */
+#define CONFIG_SYS_BOOTM_LEN SZ_64M
/* UART */
--
2.14.3
From ddc4e0d38d32d6a8a65780cf00a337c639628ca1 Mon Sep 17 00:00:00 2001
From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Date: Thu, 14 Dec 2017 11:12:12 +0100
Subject: [PATCH 10/15] db410c: update wlan and bt mac addresses from firmware
The firmware that runs before u-boot modifies u-boot's device tree
adding the local-mac-address and local-bd-address properties for the
compatibles "qcom,wcnss-bt" and "qcom,wcnss-wlan".
This commit reads that firmware, retrieves the properties and fixups
the device tree that is passed to the kernel before booting.
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
arch/arm/dts/dragonboard410c.dts | 10 +++++
board/qualcomm/dragonboard410c/Makefile | 1 +
board/qualcomm/dragonboard410c/dragonboard410c.c | 49 +++++++++++++++++++++---
board/qualcomm/dragonboard410c/lowlevel_init.S | 28 ++++++++++++++
configs/dragonboard410c_defconfig | 3 ++
5 files changed, 85 insertions(+), 6 deletions(-)
create mode 100644 board/qualcomm/dragonboard410c/lowlevel_init.S
diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts
index 7746622dda..25aeac46b1 100644
--- a/arch/arm/dts/dragonboard410c.dts
+++ b/arch/arm/dts/dragonboard410c.dts
@@ -86,6 +86,16 @@
clock-frequency = <200000000>;
};
+ wcnss {
+ bt {
+ compatible="qcom,wcnss-bt";
+ };
+
+ wifi {
+ compatible="qcom,wcnss-wlan";
+ };
+ };
+
spmi@200f000 {
compatible = "qcom,spmi-pmic-arb";
reg = <0x200f800 0x200 0x2400000 0x400000 0x2c00000 0x400000>;
diff --git a/board/qualcomm/dragonboard410c/Makefile b/board/qualcomm/dragonboard410c/Makefile
index cd678088fa..5082383be4 100644
--- a/board/qualcomm/dragonboard410c/Makefile
+++ b/board/qualcomm/dragonboard410c/Makefile
@@ -5,4 +5,5 @@
#
obj-y := dragonboard410c.o
+obj-y += lowlevel_init.o
extra-y += head.o
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 848e27848b..9e5242170d 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -10,9 +10,16 @@
#include <dm.h>
#include <usb.h>
#include <asm/gpio.h>
+#include <fdt_support.h>
DECLARE_GLOBAL_DATA_PTR;
+/* pointer to the device tree ammended by the firmware */
+extern const void *fw_dtb;
+
+static char wlan_mac[ARP_HLEN];
+static char bt_mac[ARP_HLEN];
+
int dram_init(void)
{
gd->ram_size = PHYS_SDRAM_1_SIZE;
@@ -27,7 +34,6 @@ int dram_init_banksize(void)
return 0;
}
-
int board_prepare_usb(enum usb_init_type type)
{
static struct udevice *pmic_gpio;
@@ -96,11 +102,6 @@ int board_prepare_usb(enum usb_init_type type)
return 0;
}
-int board_init(void)
-{
- return 0;
-}
-
/* Check for vol- button - if pressed - stop autoboot */
int misc_init_r(void)
{
@@ -134,3 +135,39 @@ int misc_init_r(void)
return 0;
}
+
+int board_init(void)
+{
+ int offset, len;
+ const char *mac;
+
+ /* take a copy of the firmware information (the user could unknownly
+ overwrite that DDR via tftp or other means) */
+
+ offset = fdt_node_offset_by_compatible(fw_dtb, -1, "qcom,wcnss-wlan");
+ if (offset >= 0) {
+ mac = fdt_getprop(fw_dtb, offset, "local-mac-address", &len);
+ if (mac)
+ memcpy(wlan_mac, mac, ARP_HLEN);
+ }
+
+ offset = fdt_node_offset_by_compatible(fw_dtb, -1, "qcom,wcnss-bt");
+ if (offset >= 0) {
+ mac = fdt_getprop(fw_dtb, offset, "local-bd-address", &len);
+ if (mac)
+ memcpy(bt_mac, mac, ARP_HLEN);
+ }
+
+ return 0;
+}
+
+int ft_board_setup(void *blob, bd_t *bd)
+{
+ do_fixup_by_compat(blob, "qcom,wcnss-wlan", "local-mac-address",
+ wlan_mac, ARP_HLEN, 1);
+
+ do_fixup_by_compat(blob, "qcom,wcnss-bt", "local-bd-address",
+ bt_mac, ARP_HLEN, 1);
+
+ return 0;
+}
diff --git a/board/qualcomm/dragonboard410c/lowlevel_init.S b/board/qualcomm/dragonboard410c/lowlevel_init.S
new file mode 100644
index 0000000000..15b2d0c7fd
--- /dev/null
+++ b/board/qualcomm/dragonboard410c/lowlevel_init.S
@@ -0,0 +1,28 @@
+/*
+ * (C) Copyright 2016
+ * Cédric Schieli <cschieli@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <config.h>
+
+.align 8
+.global fw_dtb
+fw_dtb:
+ .dword 0x0
+
+/*
+ * Routine: save_boot_params (called after reset from start.S)
+ * Description: save ATAG/FDT address provided by the firmware at boot time
+ */
+
+.global save_boot_params
+save_boot_params:
+
+ /* The firmware provided ATAG/FDT address can be found in r2/x0 */
+ adr x8, fw_dtb
+ str x0, [x8]
+
+ /* Returns */
+ b save_boot_params_ret
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index b71bff7592..cfe9be97f3 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -44,3 +44,6 @@ CONFIG_USB_ETHER_ASIX88179=y
CONFIG_USB_ETHER_MCS7830=y
CONFIG_USB_ETHER_SMSC95XX=y
CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_OF_CONTROL=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_OF_BOARD_SETUP=y
--
2.14.3
From 5bdb47f83df86729d770601e294207dc42fb68be Mon Sep 17 00:00:00 2001
From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Date: Thu, 21 Dec 2017 11:27:56 +0100
Subject: [PATCH 11/15] db410c: replace reset driver with psci
this should be the norm for armv8 platforms.
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
arch/arm/dts/dragonboard410c.dts | 5 ---
board/qualcomm/dragonboard410c/dragonboard410c.c | 5 +++
configs/dragonboard410c_defconfig | 2 +-
drivers/sysreset/Makefile | 2 --
drivers/sysreset/sysreset_snapdragon.c | 40 ------------------------
5 files changed, 6 insertions(+), 48 deletions(-)
delete mode 100644 drivers/sysreset/sysreset_snapdragon.c
diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts
index 25aeac46b1..b67e58882a 100644
--- a/arch/arm/dts/dragonboard410c.dts
+++ b/arch/arm/dts/dragonboard410c.dts
@@ -48,11 +48,6 @@
clock = <&clkc 4>;
};
- restart@4ab000 {
- compatible = "qcom,pshold";
- reg = <0x4ab000 0x4>;
- };
-
soc_gpios: pinctrl@1000000 {
compatible = "qcom,apq8016-pinctrl";
reg = <0x1000000 0x300000>;
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 9e5242170d..1c5ab7b175 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -171,3 +171,8 @@ int ft_board_setup(void *blob, bd_t *bd)
return 0;
}
+
+void reset_cpu(ulong addr)
+{
+ psci_system_reset();
+}
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index cfe9be97f3..de923adbc3 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -30,7 +30,6 @@ CONFIG_DM_PMIC=y
CONFIG_PMIC_PM8916=y
CONFIG_MSM_SERIAL=y
CONFIG_SPMI_MSM=y
-CONFIG_SYSRESET=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
@@ -47,3 +46,4 @@ CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_OF_CONTROL=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_OF_BOARD_SETUP=y
+CONFIG_PSCI_RESET=y
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index 2e9598e300..000c288eeb 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -8,10 +8,8 @@ obj-$(CONFIG_SYSRESET) += sysreset-uclass.o
obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
-
obj-$(CONFIG_ARCH_ROCKCHIP) += sysreset_rockchip.o
obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o
-obj-$(CONFIG_ARCH_SNAPDRAGON) += sysreset_snapdragon.o
obj-$(CONFIG_ARCH_STI) += sysreset_sti.o
obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o
obj-$(CONFIG_ARCH_ASPEED) += sysreset_ast.o
diff --git a/drivers/sysreset/sysreset_snapdragon.c b/drivers/sysreset/sysreset_snapdragon.c
deleted file mode 100644
index 9869813978..0000000000
--- a/drivers/sysreset/sysreset_snapdragon.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Qualcomm APQ8016 reset controller driver
- *
- * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <dm.h>
-#include <errno.h>
-#include <sysreset.h>
-#include <asm/io.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static int msm_sysreset_request(struct udevice *dev, enum sysreset_t type)
-{
- phys_addr_t addr = devfdt_get_addr(dev);
- if (!addr)
- return -EINVAL;
- writel(0, addr);
- return -EINPROGRESS;
-}
-
-static struct sysreset_ops msm_sysreset_ops = {
- .request = msm_sysreset_request,
-};
-
-static const struct udevice_id msm_sysreset_ids[] = {
- { .compatible = "qcom,pshold" },
- { }
-};
-
-U_BOOT_DRIVER(msm_reset) = {
- .name = "msm_sysreset",
- .id = UCLASS_SYSRESET,
- .of_match = msm_sysreset_ids,
- .ops = &msm_sysreset_ops,
-};
--
2.14.3
From 0d607c98eaead3b14b15da821128b920b2bb7b13 Mon Sep 17 00:00:00 2001
From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Date: Thu, 4 Jan 2018 19:27:56 +0100
Subject: [PATCH 13/15] db410c: use the device tree parsed by the lk loader.
We dont need to keep copies of the properties that we are going to
fixup since we will be using the dtb provided by the firmware.
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
board/qualcomm/dragonboard410c/dragonboard410c.c | 71 ++++++++++++++----------
configs/dragonboard410c_defconfig | 1 +
2 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 1c5ab7b175..236160afd4 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -15,14 +15,22 @@
DECLARE_GLOBAL_DATA_PTR;
/* pointer to the device tree ammended by the firmware */
-extern const void *fw_dtb;
+extern void *fw_dtb;
-static char wlan_mac[ARP_HLEN];
-static char bt_mac[ARP_HLEN];
+void *board_fdt_blob_setup(void)
+{
+ if (fdt_magic(fw_dtb) != FDT_MAGIC) {
+ printf("Firmware provided invalid dtb!\n");
+ return NULL;
+ }
+
+ return fw_dtb;
+}
int dram_init(void)
{
gd->ram_size = PHYS_SDRAM_1_SIZE;
+
return 0;
}
@@ -138,36 +146,43 @@ int misc_init_r(void)
int board_init(void)
{
- int offset, len;
- const char *mac;
-
- /* take a copy of the firmware information (the user could unknownly
- overwrite that DDR via tftp or other means) */
-
- offset = fdt_node_offset_by_compatible(fw_dtb, -1, "qcom,wcnss-wlan");
- if (offset >= 0) {
- mac = fdt_getprop(fw_dtb, offset, "local-mac-address", &len);
- if (mac)
- memcpy(wlan_mac, mac, ARP_HLEN);
- }
-
- offset = fdt_node_offset_by_compatible(fw_dtb, -1, "qcom,wcnss-bt");
- if (offset >= 0) {
- mac = fdt_getprop(fw_dtb, offset, "local-bd-address", &len);
- if (mac)
- memcpy(bt_mac, mac, ARP_HLEN);
- }
-
return 0;
}
int ft_board_setup(void *blob, bd_t *bd)
{
- do_fixup_by_compat(blob, "qcom,wcnss-wlan", "local-mac-address",
- wlan_mac, ARP_HLEN, 1);
-
- do_fixup_by_compat(blob, "qcom,wcnss-bt", "local-bd-address",
- bt_mac, ARP_HLEN, 1);
+ int offset, len, i;
+ const char *mac;
+ struct {
+ const char *compatible;
+ const char *property;
+ } fix[] = {
+ [0] = {
+ /* update the kernel's dtb with wlan mac */
+ .compatible = "qcom,wcnss-wlan",
+ .property = "local-mac-address",
+ },
+ [1] = {
+ /* update the kernel's dtb with bt mac */
+ .compatible = "qcom,wcnss-bt",
+ .property = "local-bd-address",
+ },
+ };
+
+ for ( i = 0; i < sizeof(fix)/sizeof(fix[0]); i++) {
+
+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1,
+ fix[i].compatible);
+ if (offset < 0)
+ continue;
+
+ mac = fdt_getprop(gd->fdt_blob, offset, fix[i].property, &len);
+ if (mac)
+ do_fixup_by_compat(blob,
+ fix[i].compatible,
+ fix[i].property,
+ mac, ARP_HLEN, 1);
+ }
return 0;
}
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index de923adbc3..4389f52b5c 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -47,3 +47,4 @@ CONFIG_OF_CONTROL=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_PSCI_RESET=y
+CONFIG_OF_SEPARATE=y
--
2.14.3
From ff6b1225ccc02e5bb963bd72f68a5a36f96ca816 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Wed, 19 Jul 2017 11:40:15 -0400
Subject: [PATCH 14/15] db410c: add reserved-memory node to dts
If lk lights up display and populates simple-framebuffer node, it will
also setup a reserved-memory node (needed by simplefb on linux). But
it isn't clever enough to cope when the reserved-memory node is not
present.
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
arch/arm/dts/dragonboard410c.dts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts
index b67e58882a..5ccfe7f8c8 100644
--- a/arch/arm/dts/dragonboard410c.dts
+++ b/arch/arm/dts/dragonboard410c.dts
@@ -23,11 +23,16 @@
reg = <0 0x80000000 0 0x3da00000>;
};
+ reserved-memory {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+ };
+
chosen {
stdout-path = "/soc/serial@78b0000";
};
-
soc {
#address-cells = <0x1>;
#size-cells = <0x1>;
--
2.14.3
From ab8c14f869c2cdfe09a36619c965785fd60b9a3c Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Mon, 26 Jun 2017 10:29:40 -0400
Subject: [PATCH 15/15] db410c: on aarch64 the fdtfile is in per-vendor
subdirectory
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
include/configs/dragonboard410c.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h
index 3c5bb8a678..530d667da8 100644
--- a/include/configs/dragonboard410c.h
+++ b/include/configs/dragonboard410c.h
@@ -92,7 +92,7 @@ REFLASH(dragonboard/u-boot.img, 8)\
"initrd_high=0xffffffffffffffff\0" \
"linux_image=Image\0" \
"kernel_addr_r=0x81000000\0"\
- "fdtfile=apq8016-sbc.dtb\0" \
+ "fdtfile=qcom/apq8016-sbc.dtb\0" \
"fdt_addr_r=0x83000000\0"\
"ramdisk_addr_r=0x84000000\0"\
"scriptaddr=0x90000000\0"\
--
2.14.3