From f92bf3ffbc0d7523aece48b26aa5939b9d82a347 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 18 Oct 2022 23:49:18 +0200 Subject: [PATCH] ipq806x: 6.1: replace ZRELADDR HACK patch with new version With 6.1 lots have changed and the platform for Makefile.boot got dropped. Replace the patch with a new version that is alligned to the new implementation. Signed-off-by: Christian Marangi --- ...RM-mach-qcom-fix-support-for-ipq806x.patch | 67 +++++++++++++++++++ ...arch-arm-force-ZRELADDR-on-arch-qcom.patch | 62 ----------------- 2 files changed, 67 insertions(+), 62 deletions(-) create mode 100644 target/linux/ipq806x/patches-6.1/0060-ARM-mach-qcom-fix-support-for-ipq806x.patch delete mode 100644 target/linux/ipq806x/patches-6.1/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch diff --git a/target/linux/ipq806x/patches-6.1/0060-ARM-mach-qcom-fix-support-for-ipq806x.patch b/target/linux/ipq806x/patches-6.1/0060-ARM-mach-qcom-fix-support-for-ipq806x.patch new file mode 100644 index 000000000000..41c102e30a39 --- /dev/null +++ b/target/linux/ipq806x/patches-6.1/0060-ARM-mach-qcom-fix-support-for-ipq806x.patch @@ -0,0 +1,67 @@ +From 9c896e9fc2ef1209e4a56d8c9fdd183847c2c814 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Tue, 18 Oct 2022 22:02:46 +0200 +Subject: [PATCH] ARM: mach-qcom: fix support for ipq806x + +Add a specific config flag for Qcom IPQ806x as this SoC can't use +AUTO_ZRELADDR and require the PHYS_OFFSET set to 0x42000000. + +This is needed as some legacy board (or some wrongly configured +bootloader) pass the wrong memory map and doesn't exclude the first +~20MB of RAM reserved for the hardware network accellerators. + +With this change we can correctly support each board and prevent any +kind of misconfiguration done by the OEM. + +Signed-off-by: Christian Marangi +--- + arch/arm/Kconfig | 3 ++- + arch/arm/mach-qcom/Kconfig | 13 +++++++++++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 1af63e17b4ad..0818d35973ad 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -282,6 +282,7 @@ config PHYS_OFFSET + default 0x30000000 if ARCH_S3C24XX + default 0xa0000000 if ARCH_IOP32X || ARCH_PXA + default 0xc0000000 if ARCH_EP93XX || ARCH_SA1100 ++ default 0x42000000 if ARCH_IPQ806X + default 0 + help + Please provide the physical address corresponding to the +@@ -1701,7 +1702,7 @@ config CRASH_DUMP + + config AUTO_ZRELADDR + bool "Auto calculation of the decompressed kernel image address" if !ARCH_MULTIPLATFORM +- default !(ARCH_FOOTBRIDGE || ARCH_RPC || ARCH_SA1100) ++ default !(ARCH_FOOTBRIDGE || ARCH_RPC || ARCH_SA1100 || ARCH_IPQ806X) + help + ZRELADDR is the physical address where the decompressed kernel + image will be placed. If AUTO_ZRELADDR is selected, the address +diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig +index 12a812e61c16..b11b6e391ff0 100644 +--- a/arch/arm/mach-qcom/Kconfig ++++ b/arch/arm/mach-qcom/Kconfig +@@ -46,4 +46,17 @@ config ARCH_MDM9615 + bool "Enable support for MDM9615" + select CLKSRC_QCOM + ++config ARCH_IPQ806X ++ bool "Enable support for IPQ806x" ++ help ++ Enable support for the Qualcomm IPQ806x. ++ ++ IPQ806x require special PHYS_OFFSET and can't use AUTO_ZRELADDR. ++ The first ~20MB of RAM is reserved for the hardware network accelerators, ++ and the bootloader removes this section from the layout passed from the ++ ATAGS (when used by some bootloader doesn't even do that). ++ ++ To support every system and handle legacy systems, hardcode PHYS_OFFSET and ++ disable AUTO_ZRELADDR. ++ + endif +-- +2.37.2 + diff --git a/target/linux/ipq806x/patches-6.1/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch b/target/linux/ipq806x/patches-6.1/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch deleted file mode 100644 index 1860cef80034..000000000000 --- a/target/linux/ipq806x/patches-6.1/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch +++ /dev/null @@ -1,62 +0,0 @@ -From fa71139b55e114aa8c3c4823ff8ee7d49ee810d4 Mon Sep 17 00:00:00 2001 -From: Mathieu Olivari -Date: Wed, 29 Apr 2015 15:21:46 -0700 -Subject: [PATCH 60/69] HACK: arch: arm: force ZRELADDR on arch-qcom - -ARCH_QCOM is using the ARCH_MULTIPLATFORM option, as now recommended -on most ARM architectures. This automatically calculate ZRELADDR by -masking PHYS_OFFSET with 0xf8000000. - -However, on IPQ806x, the first ~20MB of RAM is reserved for the hardware -network accelerators, and the bootloader removes this section from the -layout passed from the ATAGS (when used). - -For newer bootloader, when DT is used, this is not a problem, we just -reserve this memory in the device tree. But if the bootloader doesn't -have DT support, then ATAGS have to be used. In this case, the ARM -decompressor will position the kernel in this low mem, which will not be -in the RAM section mapped by the bootloader, which means the kernel will -freeze in the middle of the boot process trying to map the memory. - -As a work around, this patch allows disabling AUTO_ZRELADDR when -ARCH_QCOM is selected. It makes the zImage usage possible on bootloaders -which don't support device-tree, which is the case on certain early -IPQ806x based designs. - -Signed-off-by: Mathieu Olivari ---- - arch/arm/Kconfig | 2 +- - arch/arm/Makefile | 2 ++ - arch/arm/mach-qcom/Makefile.boot | 1 + - 3 files changed, 4 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/mach-qcom/Makefile.boot - ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -317,7 +317,7 @@ config ARCH_MULTIPLATFORM - select ARCH_SELECT_MEMORY_MODEL - select ARM_HAS_SG_CHAIN - select ARM_PATCH_PHYS_VIRT -- select AUTO_ZRELADDR -+ select AUTO_ZRELADDR if !ARCH_QCOM - select TIMER_OF - select COMMON_CLK - select GENERIC_IRQ_MULTI_HANDLER ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -237,9 +237,11 @@ MACHINE := arch/arm/mach-$(word 1,$(mac - else - MACHINE := - endif -+ifeq ($(CONFIG_ARCH_QCOM),) - ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y) - MACHINE := - endif -+endif - - machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) - platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y))) ---- /dev/null -+++ b/arch/arm/mach-qcom/Makefile.boot -@@ -0,0 +1 @@ -+zreladdr-y+= 0x42208000 -- 2.30.2