u-boot-mvebu: clearfog: implement distro-boot
[openwrt/openwrt.git] / package / boot / uboot-mvebu / patches / 0003-clearfog-enable-distro-boot-code.patch
1 From 9653921eadd5d5268afbee6c928708158fc4e844 Mon Sep 17 00:00:00 2001
2 From: Josua Mayer <josua.mayer97@gmail.com>
3 Date: Tue, 22 Nov 2016 16:33:23 +0100
4 Subject: [PATCH 3/4] clearfog: enable distro boot code
5
6 load addresses start at 0x02000000, leaving enough space for fdt,
7 boot scripts and ramdisk at the end.
8 Only boot from mmc, the other options are not in working order.
9 Removed *_high variables in good faith. They can be re-added with sane
10 values when, and if required.
11
12 Signed-off-by: Josua Mayer <josua.mayer97@gmail.com>
13 ---
14 Kconfig | 1 +
15 include/configs/clearfog.h | 47 +++++++++++++++++++++++++++++++++++++++++-----
16 2 files changed, 43 insertions(+), 5 deletions(-)
17
18 diff --git a/Kconfig b/Kconfig
19 index 81b4226463..f7aec2255b 100644
20 --- a/Kconfig
21 +++ b/Kconfig
22 @@ -59,6 +59,7 @@ config DISTRO_DEFAULTS
23 default y if ARCH_LS2080A
24 default y if ARCH_MESON
25 default y if ARCH_ROCKCHIP
26 + default y if TARGET_CLEARFOG
27 default n
28 select CMD_BOOTZ if ARM && !ARM64
29 select CMD_BOOTI if ARM64
30 diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
31 index 0c51d2a288..890dd84b5d 100644
32 --- a/include/configs/clearfog.h
33 +++ b/include/configs/clearfog.h
34 @@ -79,11 +79,6 @@
35
36 #define CONFIG_SYS_ALT_MEMTEST
37
38 -/* Keep device tree and initrd in lower memory so the kernel can access them */
39 -#define CONFIG_EXTRA_ENV_SETTINGS \
40 - "fdt_high=0x10000000\0" \
41 - "initrd_high=0x10000000\0"
42 -
43 /* SPL */
44 /*
45 * Select the boot device here
46 @@ -128,6 +123,48 @@
47 #endif
48 #endif
49
50 +#ifndef CONFIG_SPL_BUILD
51 +/*
52 + * Add standard bootenv from distro boot code:
53 + * Keep device tree and initrd in lower memory so the kernel can access them
54 + * Set default load addresses:
55 + * - 63MiB space for kernel
56 + * - 1MiB space for fdt
57 + * - 1MiB space for extlinux file, or boot script
58 + * - remainder for ramdisk
59 + * Keep device tree and initrd in lower memory so the kernel can access them
60 + * Set name of fdt file (default to Clearfog Pro)
61 + * specify console device
62 + */
63 +#define CONFIG_EXTRA_ENV_SETTINGS \
64 + "kernel_addr_r=0x02000000\0" \
65 + "fdt_addr_r=0x05f00000\0" \
66 + "pxefile_addr_r=0x06000000\0" \
67 + "scriptaddr=0x06000000\0" \
68 + "ramdisk_addr_r=0x06100000\0" \
69 + "fdt_high=0x10000000\0" \
70 + "initrd_high=0x10000000\0" \
71 + "fdtfile=armada-388-clearfog-pro.dtb\0" \
72 + "console=ttyS0," __stringify(CONFIG_BAUDRATE) "\0" \
73 + BOOTENV
74 +
75 +/* include distro boot code defaults */
76 +#include <config_distro_defaults.h>
77 +
78 +/*
79 + * specify boot order
80 + * sdcard or emmc -> usb -> network
81 + */
82 +#define BOOT_TARGET_DEVICES(func) \
83 + func(MMC, mmc, 0) \
84 + func(USB, usb, 0) \
85 + func(PXE, pxe, na) \
86 + func(DHCP, dhcp, na)
87 +
88 +/* include the actual distro boot code */
89 +#include <config_distro_bootcmd.h>
90 +#endif
91 +
92 /*
93 * mv-common.h should be defined after CMD configs since it used them
94 * to enable certain macros
95 --
96 2.12.2
97