From: Jonas Gorski Date: Sun, 5 Jul 2015 11:28:46 +0000 (+0000) Subject: brcm63xx: 4.1: switch to upstream UHI interface X-Git-Tag: reboot~2632 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=761fc3f0353cd404b647d88cb1de05dbc9fd49bb;p=openwrt%2Fstaging%2Fxback.git brcm63xx: 4.1: switch to upstream UHI interface Replace the appended dtb patch with the upstream accepted version and update the code to work with the changed interface. Signed-off-by: Jonas Gorski SVN-Revision: 46181 --- diff --git a/target/linux/brcm63xx/config-4.1 b/target/linux/brcm63xx/config-4.1 index ccd2741815..2f80127314 100644 --- a/target/linux/brcm63xx/config-4.1 +++ b/target/linux/brcm63xx/config-4.1 @@ -144,11 +144,12 @@ CONFIG_LIBFDT=y # CONFIG_LZ4_DECOMPRESS is not set CONFIG_MDIO_BOARDINFO=y CONFIG_MIPS=y -CONFIG_MIPS_APPENDED_DTB=y # CONFIG_MIPS_HUGE_TLB_SUPPORT is not set CONFIG_MIPS_L1_CACHE_SHIFT=4 CONFIG_MIPS_L1_CACHE_SHIFT_4=y # CONFIG_MIPS_MACHINE is not set +# CONFIG_MIPS_NO_APPENDED_DTB is not set +CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_MODULE_FORCE_LOAD=y CONFIG_MODULE_FORCE_UNLOAD=y diff --git a/target/linux/brcm63xx/patches-4.1/001-4.2-MIPS-Add-support-for-vmlinux.bin-appended-dtb.patch b/target/linux/brcm63xx/patches-4.1/001-4.2-MIPS-Add-support-for-vmlinux.bin-appended-dtb.patch new file mode 100644 index 0000000000..4154fd3bb4 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.1/001-4.2-MIPS-Add-support-for-vmlinux.bin-appended-dtb.patch @@ -0,0 +1,112 @@ +From 1da8f1798e307fb8422753984339beb00025f97d Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Sun, 12 Apr 2015 12:24:58 +0200 +Subject: [PATCH] MIPS: Add support for vmlinux.bin appended dtb + +Add support for detecting a vmlinux.bin appended dtb and overriding +the boot arguments to match the UHI interface. + +Due to the PERCPU section being empty for !SMP, but still modifying +the current address by aligning it to the page size, do not define +it for !SMP builds to allow __appended_dtb to still point to +the actual end of the data. + +Signed-off-by: Jonas Gorski +Cc: linux-mips@linux-mips.org +Cc: devicetree@vger.kernel.org +Cc: John Crispin +Cc: Kevin Cernekee +Cc: Florian Fainelli +Cc: Aaro Koskinen +Cc: Markos Chandras +Cc: Andrew Bresticker +Cc: Daniel Schwierzeck +Cc: Paul Burton +Cc: James Hartley +Patchwork: https://patchwork.linux-mips.org/patch/9739/ +Signed-off-by: Ralf Baechle +--- + arch/mips/Kconfig | 27 +++++++++++++++++++++++++++ + arch/mips/kernel/head.S | 16 ++++++++++++++++ + arch/mips/kernel/vmlinux.lds.S | 8 +++++++- + 3 files changed, 50 insertions(+), 1 deletion(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -2702,6 +2702,33 @@ config BOOT_RAW + + + ++choice ++ prompt "Kernel appended dtb support" if OF ++ default MIPS_NO_APPENDED_DTB ++ ++ config MIPS_NO_APPENDED_DTB ++ bool "None" ++ help ++ Do not enable appended dtb support. ++ ++ config MIPS_RAW_APPENDED_DTB ++ bool "vmlinux.bin" ++ help ++ With this option, the boot code will look for a device tree binary ++ DTB) appended to raw vmlinux.bin (without decompressor). ++ (e.g. cat vmlinux.bin .dtb > vmlinux_w_dtb). ++ ++ This is meant as a backward compatibility convenience for those ++ systems with a bootloader that can't be upgraded to accommodate ++ the documented boot protocol using a device tree. ++ ++ Beware that there is very little in terms of protection against ++ this option being confused by leftover garbage in memory that might ++ look like a DTB header after a reboot if no actual DTB is appended ++ to vmlinux.bin. Do not leave this option active in a production kernel ++ if you don't intend to always append a DTB. ++endchoice ++ + endmenu + + config LOCKDEP_SUPPORT +--- a/arch/mips/kernel/head.S ++++ b/arch/mips/kernel/head.S +@@ -100,6 +100,22 @@ NESTED(kernel_entry, 16, sp) # kernel + jr t0 + 0: + ++#ifdef CONFIG_MIPS_RAW_APPENDED_DTB ++ PTR_LA t0, __appended_dtb ++ ++#ifdef CONFIG_CPU_BIG_ENDIAN ++ li t1, 0xd00dfeed ++#else ++ li t1, 0xedfe0dd0 ++#endif ++ lw t2, (t0) ++ bne t1, t2, not_found ++ nop ++ ++ move a1, t0 ++ PTR_LI a0, -2 ++not_found: ++#endif + PTR_LA t0, __bss_start # clear .bss + LONG_S zero, (t0) + PTR_LA t1, __bss_stop - LONGSIZE +--- a/arch/mips/kernel/vmlinux.lds.S ++++ b/arch/mips/kernel/vmlinux.lds.S +@@ -125,8 +125,14 @@ SECTIONS + .exit.data : { + EXIT_DATA + } +- ++#ifdef CONFIG_SMP + PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) ++#endif ++#ifdef CONFIG_MIPS_RAW_APPENDED_DTB ++ __appended_dtb = .; ++ /* leave space for appended DTB */ ++ . += 0x100000; ++#endif + /* + * Align to 64K in attempt to eliminate holes before the + * .bss..swapper_pg_dir section at the start of .bss. This diff --git a/target/linux/brcm63xx/patches-4.1/366-MIPS-add-support-for-vmlinux.bin-appended-DTB.patch b/target/linux/brcm63xx/patches-4.1/366-MIPS-add-support-for-vmlinux.bin-appended-DTB.patch deleted file mode 100644 index 90e03829f8..0000000000 --- a/target/linux/brcm63xx/patches-4.1/366-MIPS-add-support-for-vmlinux.bin-appended-DTB.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 318c1fce4aeef298cbb6153416c499c94ad7cda0 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 24 Jun 2014 10:53:15 +0200 -Subject: [PATCH RFC v3] MIPS: add support for vmlinux.bin appended DTB - -Add support for populating initial_boot_params through a dtb -blob appended to raw vmlinux.bin. - -Signed-off-by: Jonas Gorski ---- -Changes RFC v2 -> v3 - -* fixed !smp kernels (TODO: move it to its own patch - -Changes RFC v1 -> v2 - -* changed all occurences of vmlinux to vmlinux.bin -* clarified this applies to the raw vmlinux.bin without decompressor -* s/initial_device_params/initial_boot_params/ - -Initial comments by me still valid: - -Mostly adapted from how ARM is doing it. - -Sent as an RFC PATCH because I am not sure if this is the right way to -it, and whether storing the pointer in initial_boot_params is a good -idea, or a new variable should be introduced. - -The reasoning for initial_boot_params is that there is no common -MIPS interface yet, so the next best thing was using that. This also -has the advantage of keeping the original fw_args intact. - -This patch works for me on bcm63xx, where the bootloader expects -an lzma compressed kernel, so I didn't want to double compress using -the in-kernel compressed kernel support. - -Completely untested on anything except MIPS32 / big endian. - - arch/mips/Kconfig | 18 ++++++++++++++++++ - arch/mips/kernel/head.S | 19 +++++++++++++++++++ - arch/mips/kernel/vmlinux.lds.S | 7 +++++++ - 3 files changed, 43 insertions(+) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -2831,6 +2831,24 @@ config RAPIDIO - - source "drivers/rapidio/Kconfig" - -+config MIPS_APPENDED_DTB -+ bool "Use appended device tree blob to vmlinux.bin (EXPERIMENTAL)" -+ depends on OF -+ help -+ With this option, the boot code will look for a device tree binary -+ DTB) appended to raw vmlinux.bin (without decompressor). -+ (e.g. cat vmlinux.bin .dtb > vmlinux_w_dtb). -+ -+ This is meant as a backward compatibility convenience for those -+ systems with a bootloader that can't be upgraded to accommodate -+ the documented boot protocol using a device tree. -+ -+ Beware that there is very little in terms of protection against -+ this option being confused by leftover garbage in memory that might -+ look like a DTB header after a reboot if no actual DTB is appended -+ to vmlinux.bin. Do not leave this option active in a production kernel -+ if you don't intend to always append a DTB. -+ - endmenu - - menu "Executable file formats" ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -100,6 +100,22 @@ NESTED(kernel_entry, 16, sp) # kernel - jr t0 - 0: - -+#ifdef CONFIG_MIPS_APPENDED_DTB -+ PTR_LA t0, __appended_dtb -+ PTR_LI t3, 0 -+ -+#ifdef CONFIG_CPU_BIG_ENDIAN -+ PTR_LI t1, 0xd00dfeed -+#else -+ PTR_LI t1, 0xedfe0dd0 -+#endif -+ LONG_L t2, (t0) -+ bne t1, t2, not_found -+ -+ PTR_LA t3, __appended_dtb -+ -+not_found: -+#endif - PTR_LA t0, __bss_start # clear .bss - LONG_S zero, (t0) - PTR_LA t1, __bss_stop - LONGSIZE -@@ -113,6 +129,10 @@ NESTED(kernel_entry, 16, sp) # kernel - LONG_S a2, fw_arg2 - LONG_S a3, fw_arg3 - -+#ifdef CONFIG_MIPS_APPENDED_DTB -+ LONG_S t3, initial_boot_params -+#endif -+ - MTC0 zero, CP0_CONTEXT # clear context register - PTR_LA $28, init_thread_union - /* Set the SP after an empty pt_regs. */ ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -125,8 +125,14 @@ SECTIONS - .exit.data : { - EXIT_DATA - } -- -+#ifdef CONFIG_SMP - PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT) -+#endif -+#ifdef CONFIG_MIPS_APPENDED_DTB -+ __appended_dtb = .; -+ /* leave space for appended DTB */ -+ . = . + 0x100000; -+#endif - /* - * Align to 64K in attempt to eliminate holes before the - * .bss..swapper_pg_dir section at the start of .bss. This diff --git a/target/linux/brcm63xx/patches-4.1/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch b/target/linux/brcm63xx/patches-4.1/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch index 577df55d0e..26f7f51647 100644 --- a/target/linux/brcm63xx/patches-4.1/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch +++ b/target/linux/brcm63xx/patches-4.1/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch @@ -1,12 +1,14 @@ -From db896341299cbcb703821228574ba9b79b6a3565 Mon Sep 17 00:00:00 2001 +From 26546e5499d98616322fb3472b977e2e86603f3a Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Tue, 24 Jun 2014 10:57:51 +0200 Subject: [PATCH 45/48] MIPS: BCM63XX: add support for loading DTB +Signed-off-by: Jonas Gorski --- - arch/mips/bcm63xx/boards/Kconfig | 4 ++++ - arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++++ - 2 files changed, 38 insertions(+) + arch/mips/bcm63xx/boards/Kconfig | 4 ++++ + arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++ + arch/mips/bcm63xx/prom.c | 6 ++++++ + 3 files changed, 44 insertions(+) --- a/arch/mips/bcm63xx/boards/Kconfig +++ b/arch/mips/bcm63xx/boards/Kconfig @@ -94,3 +96,25 @@ Subject: [PATCH 45/48] MIPS: BCM63XX: add support for loading DTB if (board.has_uart0) bcm63xx_uart_register(0); +--- a/arch/mips/bcm63xx/prom.c ++++ b/arch/mips/bcm63xx/prom.c +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -23,6 +24,11 @@ void __init prom_init(void) + { + u32 reg, mask; + ++#if CONFIG_OF ++ if (fw_arg0 == -2) ++ early_init_dt_verify((void *)fw_arg1); ++#endif ++ + bcm63xx_cpu_init(); + + /* stop any running watchdog */