From: Josua Mayer Date: Sun, 23 Apr 2017 17:22:32 +0000 (+0200) Subject: u-boot-mvebu: clearfog: implement distro-boot X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c4f94740598a7516fd8b9fc471872b6e3397fbdb;p=openwrt%2Fstaging%2Fflorian.git u-boot-mvebu: clearfog: implement distro-boot Add a patchfile that implements distro-boot and is meant to go upstream Also make the other patches git-am'able for easier maintenance. Signed-off-by: Josua Mayer --- diff --git a/package/boot/uboot-mvebu/patches/0001-clearfog-generate-random-MAC-address.patch b/package/boot/uboot-mvebu/patches/0001-clearfog-generate-random-MAC-address.patch new file mode 100644 index 0000000000..c34616292a --- /dev/null +++ b/package/boot/uboot-mvebu/patches/0001-clearfog-generate-random-MAC-address.patch @@ -0,0 +1,28 @@ +From ee16ee20205ea374613c3ac7f50209451eb29068 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Sun, 23 Apr 2017 18:02:40 +0200 +Subject: [PATCH 1/4] clearfog: generate random MAC address + +The Clearfog does not come with predetermined MACs. +Falling back to random ones ensures ethernet can still operate anyway. + +Signed-off-by: Josua Mayer >josua.mayer97@gmail.com> +--- + configs/clearfog_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig +index 1264871e83..41e94e6daf 100644 +--- a/configs/clearfog_defconfig ++++ b/configs/clearfog_defconfig +@@ -47,6 +47,7 @@ CONFIG_DEBUG_UART=y + CONFIG_DEBUG_UART_BASE=0xd0012000 + CONFIG_DEBUG_UART_CLOCK=250000000 + CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_NET_RANDOM_ETHADDR=y + CONFIG_SYS_NS16550=y + CONFIG_USB=y + CONFIG_DM_USB=y +-- +2.12.2 + diff --git a/package/boot/uboot-mvebu/patches/0002-clearfog-reset-usom-onboard-1512-phy.patch b/package/boot/uboot-mvebu/patches/0002-clearfog-reset-usom-onboard-1512-phy.patch new file mode 100644 index 0000000000..164c6f3f25 --- /dev/null +++ b/package/boot/uboot-mvebu/patches/0002-clearfog-reset-usom-onboard-1512-phy.patch @@ -0,0 +1,37 @@ +From 98848106b9558244ae36a85229caabcdb57d0f7b Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Fri, 23 Sep 2016 13:58:14 +0200 +Subject: [PATCH 2/4] clearfog: reset usom onboard 1512 phy + +Use GPIO19 which is wired to the uSOM phy reset signal in order to reset +the uSOM's 88E81512 gigabit Ethernet phy. + +This GPIO is valid on ClearFog rev 2.1 and newer. + +Signed-off-by: Rabeeh Khoury +[jonas.gorski: adapted to upstream u-boot code] +Signed-off-by: Jonas Gorski +--- + board/solidrun/clearfog/clearfog.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c +index 2773f5957e..3a8257cac3 100644 +--- a/board/solidrun/clearfog/clearfog.c ++++ b/board/solidrun/clearfog/clearfog.c +@@ -131,8 +131,12 @@ int board_init(void) + /* Toggle GPIO41 to reset onboard switch and phy */ + clrbits_le32(MVEBU_GPIO1_BASE + 0x0, BIT(9)); + clrbits_le32(MVEBU_GPIO1_BASE + 0x4, BIT(9)); ++ /* GPIO 19 on ClearFog rev 2.1 controls the uSOM onboard phy reset */ ++ clrbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); ++ clrbits_le32(MVEBU_GPIO0_BASE + 0x4, BIT(19)); + mdelay(1); + setbits_le32(MVEBU_GPIO1_BASE + 0x0, BIT(9)); ++ setbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); + mdelay(10); + + /* Init I2C IO expanders */ +-- +2.12.2 + diff --git a/package/boot/uboot-mvebu/patches/0003-clearfog-enable-distro-boot-code.patch b/package/boot/uboot-mvebu/patches/0003-clearfog-enable-distro-boot-code.patch new file mode 100644 index 0000000000..97b2d1f250 --- /dev/null +++ b/package/boot/uboot-mvebu/patches/0003-clearfog-enable-distro-boot-code.patch @@ -0,0 +1,97 @@ +From 9653921eadd5d5268afbee6c928708158fc4e844 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Tue, 22 Nov 2016 16:33:23 +0100 +Subject: [PATCH 3/4] clearfog: enable distro boot code + +load addresses start at 0x02000000, leaving enough space for fdt, +boot scripts and ramdisk at the end. +Only boot from mmc, the other options are not in working order. +Removed *_high variables in good faith. They can be re-added with sane +values when, and if required. + +Signed-off-by: Josua Mayer +--- + Kconfig | 1 + + include/configs/clearfog.h | 47 +++++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 43 insertions(+), 5 deletions(-) + +diff --git a/Kconfig b/Kconfig +index 81b4226463..f7aec2255b 100644 +--- a/Kconfig ++++ b/Kconfig +@@ -59,6 +59,7 @@ config DISTRO_DEFAULTS + default y if ARCH_LS2080A + default y if ARCH_MESON + default y if ARCH_ROCKCHIP ++ default y if TARGET_CLEARFOG + default n + select CMD_BOOTZ if ARM && !ARM64 + select CMD_BOOTI if ARM64 +diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h +index 0c51d2a288..890dd84b5d 100644 +--- a/include/configs/clearfog.h ++++ b/include/configs/clearfog.h +@@ -79,11 +79,6 @@ + + #define CONFIG_SYS_ALT_MEMTEST + +-/* Keep device tree and initrd in lower memory so the kernel can access them */ +-#define CONFIG_EXTRA_ENV_SETTINGS \ +- "fdt_high=0x10000000\0" \ +- "initrd_high=0x10000000\0" +- + /* SPL */ + /* + * Select the boot device here +@@ -128,6 +123,48 @@ + #endif + #endif + ++#ifndef CONFIG_SPL_BUILD ++/* ++ * Add standard bootenv from distro boot code: ++ * Keep device tree and initrd in lower memory so the kernel can access them ++ * Set default load addresses: ++ * - 63MiB space for kernel ++ * - 1MiB space for fdt ++ * - 1MiB space for extlinux file, or boot script ++ * - remainder for ramdisk ++ * Keep device tree and initrd in lower memory so the kernel can access them ++ * Set name of fdt file (default to Clearfog Pro) ++ * specify console device ++ */ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr_r=0x02000000\0" \ ++ "fdt_addr_r=0x05f00000\0" \ ++ "pxefile_addr_r=0x06000000\0" \ ++ "scriptaddr=0x06000000\0" \ ++ "ramdisk_addr_r=0x06100000\0" \ ++ "fdt_high=0x10000000\0" \ ++ "initrd_high=0x10000000\0" \ ++ "fdtfile=armada-388-clearfog-pro.dtb\0" \ ++ "console=ttyS0," __stringify(CONFIG_BAUDRATE) "\0" \ ++ BOOTENV ++ ++/* include distro boot code defaults */ ++#include ++ ++/* ++ * specify boot order ++ * sdcard or emmc -> usb -> network ++ */ ++#define BOOT_TARGET_DEVICES(func) \ ++ func(MMC, mmc, 0) \ ++ func(USB, usb, 0) \ ++ func(PXE, pxe, na) \ ++ func(DHCP, dhcp, na) ++ ++/* include the actual distro boot code */ ++#include ++#endif ++ + /* + * mv-common.h should be defined after CMD configs since it used them + * to enable certain macros +-- +2.12.2 + diff --git a/package/boot/uboot-mvebu/patches/002-enable_random_mac_addr.patch b/package/boot/uboot-mvebu/patches/002-enable_random_mac_addr.patch deleted file mode 100644 index 85bd03f40b..0000000000 --- a/package/boot/uboot-mvebu/patches/002-enable_random_mac_addr.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig -index 1264871e83..41e94e6daf 100644 ---- a/configs/clearfog_defconfig -+++ b/configs/clearfog_defconfig -@@ -47,6 +47,7 @@ CONFIG_DEBUG_UART=y - CONFIG_DEBUG_UART_BASE=0xd0012000 - CONFIG_DEBUG_UART_CLOCK=250000000 - CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_NET_RANDOM_ETHADDR=y - CONFIG_SYS_NS16550=y - CONFIG_USB=y - CONFIG_DM_USB=y diff --git a/package/boot/uboot-mvebu/patches/003-boot_script.patch b/package/boot/uboot-mvebu/patches/003-boot_script.patch deleted file mode 100644 index 9bb679dad5..0000000000 --- a/package/boot/uboot-mvebu/patches/003-boot_script.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig -index 41e94e6daf..f23e65e345 100644 ---- a/configs/clearfog_defconfig -+++ b/configs/clearfog_defconfig -@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog" - CONFIG_BOOTDELAY=3 - CONFIG_SYS_CONSOLE_INFO_QUIET=y - # CONFIG_DISPLAY_BOARDINFO is not set -+CONFIG_HUSH_PARSER=y - CONFIG_SPL=y - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x141 - CONFIG_SPL_I2C_SUPPORT=y -diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h -index 0c51d2a288..e52ba8145f 100644 ---- a/include/configs/clearfog.h -+++ b/include/configs/clearfog.h -@@ -82,7 +82,18 @@ - /* Keep device tree and initrd in lower memory so the kernel can access them */ - #define CONFIG_EXTRA_ENV_SETTINGS \ - "fdt_high=0x10000000\0" \ -- "initrd_high=0x10000000\0" -+ "initrd_high=0x10000000\0" \ -+ "script=boot.scr\0" \ -+ "loadaddr=0x01000000\0" \ -+ "mmcdev=0\0" \ -+ "mmcpart=1\0" \ -+ "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "bootscript=echo Running bootscript from mmc ...; source ${loadaddr}\0" -+ -+#define CONFIG_BOOTCOMMAND \ -+ "if run loadbootscript; then " \ -+ "run bootscript; " \ -+ "fi" - - /* SPL */ - /* diff --git a/package/boot/uboot-mvebu/patches/200-clearfog-reset-usom-onboard-1512-phy.patch b/package/boot/uboot-mvebu/patches/200-clearfog-reset-usom-onboard-1512-phy.patch deleted file mode 100644 index 4954353611..0000000000 --- a/package/boot/uboot-mvebu/patches/200-clearfog-reset-usom-onboard-1512-phy.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 98848106b9558244ae36a85229caabcdb57d0f7b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 23 Sep 2016 13:58:14 +0200 -Subject: [PATCH] clearfog: reset usom onboard 1512 phy - -Use GPIO19 which is wired to the uSOM phy reset signal in order to reset -the uSOM's 88E81512 gigabit Ethernet phy. - -This GPIO is valid on ClearFog rev 2.1 and newer. - -Signed-off-by: Rabeeh Khoury -[jonas.gorski: adapted to upstream u-boot code] -Signed-off-by: Jonas Gorski ---- - board/solidrun/clearfog/clearfog.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c -index 2773f5957e..3a8257cac3 100644 ---- a/board/solidrun/clearfog/clearfog.c -+++ b/board/solidrun/clearfog/clearfog.c -@@ -131,8 +131,12 @@ int board_init(void) - /* Toggle GPIO41 to reset onboard switch and phy */ - clrbits_le32(MVEBU_GPIO1_BASE + 0x0, BIT(9)); - clrbits_le32(MVEBU_GPIO1_BASE + 0x4, BIT(9)); -+ /* GPIO 19 on ClearFog rev 2.1 controls the uSOM onboard phy reset */ -+ clrbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); -+ clrbits_le32(MVEBU_GPIO0_BASE + 0x4, BIT(19)); - mdelay(1); - setbits_le32(MVEBU_GPIO1_BASE + 0x0, BIT(9)); -+ setbits_le32(MVEBU_GPIO0_BASE + 0x0, BIT(19)); - mdelay(10); - - /* Init I2C IO expanders */ --- -2.12.2 -