From 5a86d67e31998a3d47c684dcd55705f65c8cff4f Mon Sep 17 00:00:00 2001 From: Tony Dinh Date: Mon, 8 Aug 2022 20:01:34 -0700 Subject: arm: kirkwood: pogo_v4: Add Distro boot capability - Add distro boot to board include file and deconfig file - Miscellaneous changes: - Add CONFIG_SUPPORT_PASSING_ATAGS and friends to support legacy kernel method of booting (e.g. OpenWrt) with appended DTB. - Add CONFIG_LTO and CONFIG_UBIFS_SILENCE_MSG, and disable some unused configs to reduce binary size. Note that this patch is depended on the following patch: https://patchwork.ozlabs.org/project/uboot/patch/20220807192709.21717-1-pali@kernel.org/ Signed-off-by: Tony Dinh --- include/configs/pogo_v4.h | 54 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/configs/pogo_v4.h b/include/configs/pogo_v4.h index 7fff78b7b5d..b5ce2dd13d0 100644 --- a/include/configs/pogo_v4.h +++ b/include/configs/pogo_v4.h @@ -21,15 +21,53 @@ */ #include "mv-common.h" -/* - * Default environment variables - */ +/* Include the common distro boot environment */ +#ifndef CONFIG_SPL_BUILD + +#ifdef CONFIG_MMC +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC(func) +#endif + +#ifdef CONFIG_SATA +#define BOOT_TARGET_DEVICES_SATA(func) func(SATA, sata, 0) +#else +#define BOOT_TARGET_DEVICES_SATA(func) +#endif + +#ifdef CONFIG_USB_STORAGE +#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + BOOT_TARGET_DEVICES_MMC(func) \ + BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SATA(func) \ + func(DHCP, dhcp, na) + +#define KERNEL_ADDR_R __stringify(0x800000) +#define FDT_ADDR_R __stringify(0x2c00000) +#define RAMDISK_ADDR_R __stringify(0x01100000) +#define SCRIPT_ADDR_R __stringify(0x200000) + +#define LOAD_ADDRESS_ENV_SETTINGS \ + "kernel_addr_r=" KERNEL_ADDR_R "\0" \ + "fdt_addr_r=" FDT_ADDR_R "\0" \ + "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ + "scriptaddr=" SCRIPT_ADDR_R "\0" + +#include + #define CONFIG_EXTRA_ENV_SETTINGS \ - "dtb_file=/boot/dts/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ - "bootargs_console=console=ttyS0,115200\0" \ - "bootcmd_usb=usb start; load usb 0:1 0x00800000 /boot/uImage; " \ - "load usb 0:1 0x01100000 /boot/uInitrd; " \ - "load usb 0:1 0x2c00000 $dtb_file\0" + LOAD_ADDRESS_ENV_SETTINGS \ + "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ + "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ + "console=ttyS0,115200\0" \ + BOOTENV +#endif /* CONFIG_SPL_BUILD */ /* * Ethernet Driver configuration -- cgit v1.3.1 From 5692e5b2445b5e45d463e9e21c7a296ee4d3d96c Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Wed, 10 Aug 2022 14:46:09 +0200 Subject: arm: mvebu: mbus: Fix mbus driver to work also after U-Boot relocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mbus driver is initialized from arch_cpu_init() callback which is called before relocation. This driver stores lot of functions and structure pointers into global variables, so it is data position dependent. Therefore after relocations all pointers are invalid and driver does not work anymore as all pointers referes to the old memory, which overlaps with CONFIG_SYS_LOAD_ADDR and ${loadaddr}. For example U-Boot fuse command crashes if loadaddr memory is cleared or rewritten by some image loaded by U-Boot load command. mw.w ${loadaddr} 0x0 10000 fuse read 0 1 2 Fix this issue by removing of all mbus global variables in which are stored pointers to structures or functions which changes during relocation. And replace it by direct function calls (not via pointers). With this change fuse command finally works. Signed-off-by: Pali Rohár Reviewed-by: Chris Packham Reviewed-by: Stefan Roese --- arch/arm/mach-kirkwood/include/mach/cpu.h | 3 - arch/arm/mach-mvebu/include/mach/cpu.h | 3 - arch/arm/mach-mvebu/mbus.c | 167 ++++++++++++------------------ board/alliedtelesis/x530/x530.c | 2 +- board/maxbcm/maxbcm.c | 8 +- board/theadorable/theadorable.c | 4 +- include/linux/mbus.h | 13 +-- 7 files changed, 75 insertions(+), 125 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-kirkwood/include/mach/cpu.h b/arch/arm/mach-kirkwood/include/mach/cpu.h index 71c546f9acf..d8639c60352 100644 --- a/arch/arm/mach-kirkwood/include/mach/cpu.h +++ b/arch/arm/mach-kirkwood/include/mach/cpu.h @@ -144,9 +144,6 @@ struct kwgpio_registers { u32 irq_level; }; -/* Needed for dynamic (board-specific) mbus configuration */ -extern struct mvebu_mbus_state mbus_state; - /* * functions */ diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h index 689c96bd4ea..d9fa1f32aa5 100644 --- a/arch/arm/mach-mvebu/include/mach/cpu.h +++ b/arch/arm/mach-mvebu/include/mach/cpu.h @@ -122,9 +122,6 @@ struct sar_freq_modes { u32 d_clk; }; -/* Needed for dynamic (board-specific) mbus configuration */ -extern struct mvebu_mbus_state mbus_state; - /* * functions */ diff --git a/arch/arm/mach-mvebu/mbus.c b/arch/arm/mach-mvebu/mbus.c index 3b1b9f73ebf..7092f6cc10c 100644 --- a/arch/arm/mach-mvebu/mbus.c +++ b/arch/arm/mach-mvebu/mbus.c @@ -88,31 +88,34 @@ #define DOVE_DDR_BASE_CS_OFF(n) ((n) << 4) -struct mvebu_mbus_state; - -struct mvebu_mbus_soc_data { - unsigned int num_wins; - unsigned int num_remappable_wins; - unsigned int (*win_cfg_offset)(const int win); - void (*setup_cpu_target)(struct mvebu_mbus_state *s); -}; - -struct mvebu_mbus_state mbus_state - __section(".data"); static struct mbus_dram_target_info mbus_dram_info __section(".data"); +#if defined(CONFIG_ARCH_MVEBU) + #define MVEBU_MBUS_NUM_WINS 20 + #define MVEBU_MBUS_NUM_REMAPPABLE_WINS 8 + #define MVEBU_MBUS_WIN_CFG_OFFSET(win) armada_370_xp_mbus_win_offset(win) +#elif defined(CONFIG_ARCH_KIRKWOOD) + #define MVEBU_MBUS_NUM_WINS 8 + #define MVEBU_MBUS_NUM_REMAPPABLE_WINS 4 + #define MVEBU_MBUS_WIN_CFG_OFFSET(win) orion5x_mbus_win_offset(win) +#else + #error "No supported architecture" +#endif + +static unsigned int armada_370_xp_mbus_win_offset(int win); +static unsigned int orion5x_mbus_win_offset(int win); + /* * Functions to manipulate the address decoding windows */ -static void mvebu_mbus_read_window(struct mvebu_mbus_state *mbus, - int win, int *enabled, u64 *base, +static void mvebu_mbus_read_window(int win, int *enabled, u64 *base, u32 *size, u8 *target, u8 *attr, u64 *remap) { - void __iomem *addr = mbus->mbuswins_base + - mbus->soc->win_cfg_offset(win); + void __iomem *addr = (void __iomem *)MVEBU_CPU_WIN_BASE + + MVEBU_MBUS_WIN_CFG_OFFSET(win); u32 basereg = readl(addr + WIN_BASE_OFF); u32 ctrlreg = readl(addr + WIN_CTRL_OFF); @@ -133,7 +136,7 @@ static void mvebu_mbus_read_window(struct mvebu_mbus_state *mbus, *attr = (ctrlreg & WIN_CTRL_ATTR_MASK) >> WIN_CTRL_ATTR_SHIFT; if (remap) { - if (win < mbus->soc->num_remappable_wins) { + if (win < MVEBU_MBUS_NUM_REMAPPABLE_WINS) { u32 remap_low = readl(addr + WIN_REMAP_LO_OFF); u32 remap_hi = readl(addr + WIN_REMAP_HI_OFF); *remap = ((u64)remap_hi << 32) | remap_low; @@ -143,27 +146,25 @@ static void mvebu_mbus_read_window(struct mvebu_mbus_state *mbus, } } -static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus, - int win) +static void mvebu_mbus_disable_window(int win) { void __iomem *addr; - addr = mbus->mbuswins_base + mbus->soc->win_cfg_offset(win); + addr = (void __iomem *)MVEBU_CPU_WIN_BASE + MVEBU_MBUS_WIN_CFG_OFFSET(win); writel(0, addr + WIN_BASE_OFF); writel(0, addr + WIN_CTRL_OFF); - if (win < mbus->soc->num_remappable_wins) { + if (win < MVEBU_MBUS_NUM_REMAPPABLE_WINS) { writel(0, addr + WIN_REMAP_LO_OFF); writel(0, addr + WIN_REMAP_HI_OFF); } } /* Checks whether the given window number is available */ -static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, - const int win) +static int mvebu_mbus_window_is_free(const int win) { - void __iomem *addr = mbus->mbuswins_base + - mbus->soc->win_cfg_offset(win); + void __iomem *addr = (void __iomem *)MVEBU_CPU_WIN_BASE + + MVEBU_MBUS_WIN_CFG_OFFSET(win); u32 ctrl = readl(addr + WIN_CTRL_OFF); return !(ctrl & WIN_CTRL_ENABLE); } @@ -172,20 +173,19 @@ static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, * Checks whether the given (base, base+size) area doesn't overlap an * existing region */ -static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, - phys_addr_t base, size_t size, +static int mvebu_mbus_window_conflicts(phys_addr_t base, size_t size, u8 target, u8 attr) { u64 end = (u64)base + size; int win; - for (win = 0; win < mbus->soc->num_wins; win++) { + for (win = 0; win < MVEBU_MBUS_NUM_WINS; win++) { u64 wbase, wend; u32 wsize; u8 wtarget, wattr; int enabled; - mvebu_mbus_read_window(mbus, win, + mvebu_mbus_read_window(win, &enabled, &wbase, &wsize, &wtarget, &wattr, NULL); @@ -211,17 +211,16 @@ static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, return 1; } -static int mvebu_mbus_find_window(struct mvebu_mbus_state *mbus, - phys_addr_t base, size_t size) +static int mvebu_mbus_find_window(phys_addr_t base, size_t size) { int win; - for (win = 0; win < mbus->soc->num_wins; win++) { + for (win = 0; win < MVEBU_MBUS_NUM_WINS; win++) { u64 wbase; u32 wsize; int enabled; - mvebu_mbus_read_window(mbus, win, + mvebu_mbus_read_window(win, &enabled, &wbase, &wsize, NULL, NULL, NULL); @@ -235,13 +234,12 @@ static int mvebu_mbus_find_window(struct mvebu_mbus_state *mbus, return -ENODEV; } -static int mvebu_mbus_setup_window(struct mvebu_mbus_state *mbus, - int win, phys_addr_t base, size_t size, +static int mvebu_mbus_setup_window(int win, phys_addr_t base, size_t size, phys_addr_t remap, u8 target, u8 attr) { - void __iomem *addr = mbus->mbuswins_base + - mbus->soc->win_cfg_offset(win); + void __iomem *addr = (void __iomem *)MVEBU_CPU_WIN_BASE + + MVEBU_MBUS_WIN_CFG_OFFSET(win); u32 ctrl, remap_addr; ctrl = ((size - 1) & WIN_CTRL_SIZE_MASK) | @@ -251,7 +249,7 @@ static int mvebu_mbus_setup_window(struct mvebu_mbus_state *mbus, writel(base & WIN_BASE_LOW, addr + WIN_BASE_OFF); writel(ctrl, addr + WIN_CTRL_OFF); - if (win < mbus->soc->num_remappable_wins) { + if (win < MVEBU_MBUS_NUM_REMAPPABLE_WINS) { if (remap == MVEBU_MBUS_NO_REMAP) remap_addr = base; else @@ -263,26 +261,25 @@ static int mvebu_mbus_setup_window(struct mvebu_mbus_state *mbus, return 0; } -static int mvebu_mbus_alloc_window(struct mvebu_mbus_state *mbus, - phys_addr_t base, size_t size, +static int mvebu_mbus_alloc_window(phys_addr_t base, size_t size, phys_addr_t remap, u8 target, u8 attr) { int win; if (remap == MVEBU_MBUS_NO_REMAP) { - for (win = mbus->soc->num_remappable_wins; - win < mbus->soc->num_wins; win++) - if (mvebu_mbus_window_is_free(mbus, win)) - return mvebu_mbus_setup_window(mbus, win, base, + for (win = MVEBU_MBUS_NUM_REMAPPABLE_WINS; + win < MVEBU_MBUS_NUM_WINS; win++) + if (mvebu_mbus_window_is_free(win)) + return mvebu_mbus_setup_window(win, base, size, remap, target, attr); } - for (win = 0; win < mbus->soc->num_wins; win++) - if (mvebu_mbus_window_is_free(mbus, win)) - return mvebu_mbus_setup_window(mbus, win, base, size, + for (win = 0; win < MVEBU_MBUS_NUM_WINS; win++) + if (mvebu_mbus_window_is_free(win)) + return mvebu_mbus_setup_window(win, base, size, remap, target, attr); return -ENOMEM; @@ -292,7 +289,7 @@ static int mvebu_mbus_alloc_window(struct mvebu_mbus_state *mbus, * SoC-specific functions and definitions */ -static unsigned int armada_370_xp_mbus_win_offset(int win) +static unsigned int __maybe_unused armada_370_xp_mbus_win_offset(int win) { /* The register layout is a bit annoying and the below code * tries to cope with it. @@ -312,12 +309,12 @@ static unsigned int armada_370_xp_mbus_win_offset(int win) return 0x90 + ((win - 8) << 3); } -static unsigned int orion5x_mbus_win_offset(int win) +static unsigned int __maybe_unused orion5x_mbus_win_offset(int win) { return win << 4; } -static void mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus) +static void mvebu_mbus_default_setup_cpu_target(void) { int i; int cs; @@ -325,8 +322,8 @@ static void mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus) mbus_dram_info.mbus_dram_target_id = TARGET_DDR; for (i = 0, cs = 0; i < 4; i++) { - u32 base = readl(mbus->sdramwins_base + DDR_BASE_CS_OFF(i)); - u32 size = readl(mbus->sdramwins_base + DDR_SIZE_CS_OFF(i)); + u32 base = readl((void __iomem *)MVEBU_SDRAM_BASE + DDR_BASE_CS_OFF(i)); + u32 size = readl((void __iomem *)MVEBU_SDRAM_BASE + DDR_SIZE_CS_OFF(i)); /* * We only take care of entries for which the chip @@ -349,26 +346,10 @@ static void mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus) #if defined(CONFIG_ARMADA_MSYS) /* Disable MBUS Err Prop - in order to avoid data aborts */ - clrbits_le32(mbus->mbuswins_base + 0x200, BIT(8)); + clrbits_le32((void __iomem *)MVEBU_CPU_WIN_BASE + 0x200, BIT(8)); #endif } -static const struct mvebu_mbus_soc_data -armada_370_xp_mbus_data __maybe_unused = { - .num_wins = 20, - .num_remappable_wins = 8, - .win_cfg_offset = armada_370_xp_mbus_win_offset, - .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, -}; - -static const struct mvebu_mbus_soc_data -kirkwood_mbus_data __maybe_unused = { - .num_wins = 8, - .num_remappable_wins = 4, - .win_cfg_offset = orion5x_mbus_win_offset, - .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, -}; - /* * Public API of the driver */ @@ -382,15 +363,13 @@ int mvebu_mbus_add_window_remap_by_id(unsigned int target, phys_addr_t base, size_t size, phys_addr_t remap) { - struct mvebu_mbus_state *s = &mbus_state; - - if (!mvebu_mbus_window_conflicts(s, base, size, target, attribute)) { + if (!mvebu_mbus_window_conflicts(base, size, target, attribute)) { printf("Cannot add window '%x:%x', conflicts with another window\n", target, attribute); return -EINVAL; } - return mvebu_mbus_alloc_window(s, base, size, remap, target, attribute); + return mvebu_mbus_alloc_window(base, size, remap, target, attribute); } int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute, @@ -404,28 +383,27 @@ int mvebu_mbus_del_window(phys_addr_t base, size_t size) { int win; - win = mvebu_mbus_find_window(&mbus_state, base, size); + win = mvebu_mbus_find_window(base, size); if (win < 0) return win; - mvebu_mbus_disable_window(&mbus_state, win); + mvebu_mbus_disable_window(win); return 0; } #ifndef CONFIG_ARCH_KIRKWOOD -static void mvebu_mbus_get_lowest_base(struct mvebu_mbus_state *mbus, - phys_addr_t *base) +static void mvebu_mbus_get_lowest_base(phys_addr_t *base) { int win; *base = 0xffffffff; - for (win = 0; win < mbus->soc->num_wins; win++) { + for (win = 0; win < MVEBU_MBUS_NUM_WINS; win++) { u64 wbase; u32 wsize; u8 wtarget, wattr; int enabled; - mvebu_mbus_read_window(mbus, win, + mvebu_mbus_read_window(win, &enabled, &wbase, &wsize, &wtarget, &wattr, NULL); @@ -437,14 +415,14 @@ static void mvebu_mbus_get_lowest_base(struct mvebu_mbus_state *mbus, } } -static void mvebu_config_mbus_bridge(struct mvebu_mbus_state *mbus) +static void mvebu_config_mbus_bridge(void) { phys_addr_t base; u32 val; u32 size; /* Set MBUS bridge base/ctrl */ - mvebu_mbus_get_lowest_base(&mbus_state, &base); + mvebu_mbus_get_lowest_base(&base); size = 0xffffffff - base + 1; if (!is_power_of_2(size)) { @@ -461,10 +439,9 @@ static void mvebu_config_mbus_bridge(struct mvebu_mbus_state *mbus) } #endif -int mbus_dt_setup_win(struct mvebu_mbus_state *mbus, - u32 base, u32 size, u8 target, u8 attr) +int mbus_dt_setup_win(u32 base, u32 size, u8 target, u8 attr) { - if (!mvebu_mbus_window_conflicts(mbus, base, size, target, attr)) { + if (!mvebu_mbus_window_conflicts(base, size, target, attr)) { printf("Cannot add window '%04x:%04x', conflicts with another window\n", target, attr); return -EBUSY; @@ -474,8 +451,8 @@ int mbus_dt_setup_win(struct mvebu_mbus_state *mbus, * In U-Boot we first try to add the mbus window to the remap windows. * If this fails, lets try to add the windows to the non-remap windows. */ - if (mvebu_mbus_alloc_window(mbus, base, size, base, target, attr)) { - if (mvebu_mbus_alloc_window(mbus, base, size, + if (mvebu_mbus_alloc_window(base, size, base, target, attr)) { + if (mvebu_mbus_alloc_window(base, size, MVEBU_MBUS_NO_REMAP, target, attr)) return -ENOMEM; } @@ -486,7 +463,7 @@ int mbus_dt_setup_win(struct mvebu_mbus_state *mbus, * is called. Since it may get called from the board code in * later boot stages as well. */ - mvebu_config_mbus_bridge(mbus); + mvebu_config_mbus_bridge(); #endif return 0; @@ -498,20 +475,10 @@ int mvebu_mbus_probe(struct mbus_win windows[], int count) int ret; int i; -#if defined(CONFIG_ARCH_KIRKWOOD) - mbus_state.soc = &kirkwood_mbus_data; -#endif -#if defined(CONFIG_ARCH_MVEBU) - mbus_state.soc = &armada_370_xp_mbus_data; -#endif - - mbus_state.mbuswins_base = (void __iomem *)MVEBU_CPU_WIN_BASE; - mbus_state.sdramwins_base = (void __iomem *)MVEBU_SDRAM_BASE; - - for (win = 0; win < mbus_state.soc->num_wins; win++) - mvebu_mbus_disable_window(&mbus_state, win); + for (win = 0; win < MVEBU_MBUS_NUM_WINS; win++) + mvebu_mbus_disable_window(win); - mbus_state.soc->setup_cpu_target(&mbus_state); + mvebu_mbus_default_setup_cpu_target(); /* Setup statically declared windows in the DT */ for (i = 0; i < count; i++) { @@ -522,7 +489,7 @@ int mvebu_mbus_probe(struct mbus_win windows[], int count) attr = windows[i].attr; base = windows[i].base; size = windows[i].size; - ret = mbus_dt_setup_win(&mbus_state, base, size, target, attr); + ret = mbus_dt_setup_win(base, size, target, attr); if (ret < 0) return ret; } diff --git a/board/alliedtelesis/x530/x530.c b/board/alliedtelesis/x530/x530.c index cbf4533e78d..0cfb7c522f6 100644 --- a/board/alliedtelesis/x530/x530.c +++ b/board/alliedtelesis/x530/x530.c @@ -109,7 +109,7 @@ int board_init(void) gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; /* window for NVS */ - mbus_dt_setup_win(&mbus_state, CONFIG_NVS_LOCATION, CONFIG_NVS_SIZE, + mbus_dt_setup_win(CONFIG_NVS_LOCATION, CONFIG_NVS_SIZE, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS1); /* DEV_READYn is not needed for NVS, ignore it when accessing CS1 */ diff --git a/board/maxbcm/maxbcm.c b/board/maxbcm/maxbcm.c index e92132ad19a..aad3dc86429 100644 --- a/board/maxbcm/maxbcm.c +++ b/board/maxbcm/maxbcm.c @@ -112,13 +112,13 @@ int board_early_init_f(void) /* * Setup some board specific mbus address windows */ - mbus_dt_setup_win(&mbus_state, DEV_CS0_BASE, 16 << 20, + mbus_dt_setup_win(DEV_CS0_BASE, 16 << 20, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS0); - mbus_dt_setup_win(&mbus_state, DEV_CS1_BASE, 16 << 20, + mbus_dt_setup_win(DEV_CS1_BASE, 16 << 20, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS1); - mbus_dt_setup_win(&mbus_state, DEV_CS2_BASE, 16 << 20, + mbus_dt_setup_win(DEV_CS2_BASE, 16 << 20, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS2); - mbus_dt_setup_win(&mbus_state, DEV_CS3_BASE, 16 << 20, + mbus_dt_setup_win(DEV_CS3_BASE, 16 << 20, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS3); return 0; diff --git a/board/theadorable/theadorable.c b/board/theadorable/theadorable.c index 6e41ca23991..144f122bb20 100644 --- a/board/theadorable/theadorable.c +++ b/board/theadorable/theadorable.c @@ -208,9 +208,9 @@ int board_init(void) * Map SPI devices via MBUS so that they can be accessed via * the SPI direct access mode */ - mbus_dt_setup_win(&mbus_state, SPI_BUS0_DEV1_BASE, SPI_BUS0_DEV1_SIZE, + mbus_dt_setup_win(SPI_BUS0_DEV1_BASE, SPI_BUS0_DEV1_SIZE, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_SPI0_CS1); - mbus_dt_setup_win(&mbus_state, SPI_BUS1_DEV2_BASE, SPI_BUS0_DEV1_SIZE, + mbus_dt_setup_win(SPI_BUS1_DEV2_BASE, SPI_BUS0_DEV1_SIZE, CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_SPI1_CS2); /* diff --git a/include/linux/mbus.h b/include/linux/mbus.h index 717cbeab37f..04112eabe1c 100644 --- a/include/linux/mbus.h +++ b/include/linux/mbus.h @@ -33,16 +33,6 @@ struct mbus_dram_target_info { } cs[4]; }; -struct mvebu_mbus_state { - void __iomem *mbuswins_base; - void __iomem *sdramwins_base; - struct dentry *debugfs_root; - struct dentry *debugfs_sdram; - struct dentry *debugfs_devs; - const struct mvebu_mbus_soc_data *soc; - int hw_io_coherency; -}; - /* Flags for PCI/PCIe address decoding regions */ #define MVEBU_MBUS_PCI_IO 0x1 #define MVEBU_MBUS_PCI_MEM 0x2 @@ -67,7 +57,6 @@ int mvebu_mbus_add_window_remap_by_id(unsigned int target, int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute, phys_addr_t base, size_t size); int mvebu_mbus_del_window(phys_addr_t base, size_t size); -int mbus_dt_setup_win(struct mvebu_mbus_state *mbus, - u32 base, u32 size, u8 target, u8 attr); +int mbus_dt_setup_win(u32 base, u32 size, u8 target, u8 attr); #endif /* __LINUX_MBUS_H */ -- cgit v1.3.1 From 7875f8019c15ee557d4d7807cd1164876b47e8f3 Mon Sep 17 00:00:00 2001 From: Tony Dinh Date: Thu, 11 Aug 2022 16:40:25 -0700 Subject: arm: kirkwood: nsa310s: Add Distro boot capability - Add distro boot to board include file and deconfig file - Miscellaneous changes: - Remove Gerald from maintainer list (email bounced) - Add CONFIG_SUPPORT_PASSING_ATAGS and friends to support legacy kernel method of booting (e.g. OpenWrt) with appended DTB. - Add CONFIG_UBIFS_SILENCE_MSG to reduce binary size. Note that this patch is depended on the following patch: https://patchwork.ozlabs.org/project/uboot/patch/20220807192709.21717-1-pali@kernel.org/ Signed-off-by: Tony Dinh --- board/zyxel/nsa310s/MAINTAINERS | 1 - configs/nsa310s_defconfig | 17 +++++------------ include/configs/nsa310s.h | 31 +++++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/board/zyxel/nsa310s/MAINTAINERS b/board/zyxel/nsa310s/MAINTAINERS index d153758c218..11106acf3e9 100644 --- a/board/zyxel/nsa310s/MAINTAINERS +++ b/board/zyxel/nsa310s/MAINTAINERS @@ -1,5 +1,4 @@ NSA310S BOARD -M: Gerald Kerma M: Tony Dinh M: Luka Perkov S: Maintained diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig index 2b39ae74b31..a5f01ef88e5 100644 --- a/configs/nsa310s_defconfig +++ b/configs/nsa310s_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/zyxel/nsa310s/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x600000 CONFIG_SYS_MALLOC_F_LEN=0x400 @@ -14,35 +17,25 @@ CONFIG_ENV_OFFSET=0xE0000 CONFIG_DEFAULT_DEVICE_TREE="kirkwood-nsa310s" CONFIG_IDENT_STRING="\nZyXEL NSA310S/320S 1/2-Bay Power Media Server" CONFIG_SYS_LOAD_ADDR=0x800000 +CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 CONFIG_BOOTDELAY=3 -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="setenv bootargs ${console} ${mtdparts} ${bootargs_root}; ubi part root; ubifsmount ubi:rootfs; ubifsload 0x800000 ${kernel}; ubifsload 0x700000 ${fdt}; ubifsumount; fdt addr 0x700000; fdt resize; fdt chosen; bootz 0x800000 - 0x700000" CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="NSA310s> " CONFIG_SYS_MAXARGS=32 CONFIG_SYS_PBSIZE=1050 -CONFIG_CMD_BOOTZ=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_NAND=y CONFIG_CMD_SATA=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y -CONFIG_CMD_MII=y -CONFIG_CMD_PING=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_JFFS2=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=orion_nand" CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(root)" CONFIG_CMD_UBI=y -CONFIG_ISO_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y @@ -65,6 +58,6 @@ CONFIG_MII=y CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y -CONFIG_USB_STORAGE=y +CONFIG_UBIFS_SILENCE_MSG=y CONFIG_LZMA=y CONFIG_BZIP2=y diff --git a/include/configs/nsa310s.h b/include/configs/nsa310s.h index 027a47b5a32..62f07011809 100644 --- a/include/configs/nsa310s.h +++ b/include/configs/nsa310s.h @@ -9,15 +9,42 @@ #ifndef _CONFIG_NSA310S_H #define _CONFIG_NSA310S_H +/* + * mv-common.h should be defined after CMD configs since it used them + * to enable certain macros + */ #include "mv-common.h" -/* default environment variables */ +/* Include the common distro boot environment */ +#ifndef CONFIG_SPL_BUILD + +#define BOOT_TARGET_DEVICES(func) \ + func(USB, usb, 0) \ + func(SATA, sata, 0) \ + func(DHCP, dhcp, na) + +#define KERNEL_ADDR_R __stringify(0x800000) +#define FDT_ADDR_R __stringify(0x2c00000) +#define RAMDISK_ADDR_R __stringify(0x01100000) +#define SCRIPT_ADDR_R __stringify(0x200000) + +#define LOAD_ADDRESS_ENV_SETTINGS \ + "kernel_addr_r=" KERNEL_ADDR_R "\0" \ + "fdt_addr_r=" FDT_ADDR_R "\0" \ + "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ + "scriptaddr=" SCRIPT_ADDR_R "\0" + +#include #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "kernel=/boot/zImage\0" \ "fdt=/boot/nsa310s.dtb\0" \ - "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" + "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" \ + LOAD_ADDRESS_ENV_SETTINGS \ + BOOTENV + +#endif /* CONFIG_SPL_BUILD */ /* Ethernet driver configuration */ #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ -- cgit v1.3.1 From 857065403a481a768e0c509bb2d3766e4feb2f86 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:37:55 +0200 Subject: board: lsxl: remove eraseenv script This is not needed. The user can do a "env default -f -a". Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index e1108619f21..db5f7a93f92 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -62,9 +62,6 @@ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ - "eraseenv=sf probe 0 " \ - "&& sf erase " __stringify(CONFIG_ENV_OFFSET) \ - " +" __stringify(CONFIG_ENV_SIZE) "\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ "&& bootp " \ -- cgit v1.3.1 From 111e1e110b3740802b56cb901f941cc3b6199d85 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:37:59 +0200 Subject: board: lsxl: use CONFIG_DEFAULT_FDT_FILE Drop our own CONFIG_FDTFILE handling in favor of the generic CONFIG_DEFAULT_FDT_FILE one. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- configs/lschlv2_defconfig | 1 + configs/lsxhl_defconfig | 1 + include/configs/lsxl.h | 14 +++----------- 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 081a2448fc3..d5cd0d55751 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -25,6 +25,7 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" +CONFIG_DEFAULT_FDT_FILE="kirkwood-lschlv2.dtb" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index 33bec601474..8f0672b1899 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -26,6 +26,7 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" +CONFIG_DEFAULT_FDT_FILE="kirkwood-lsxhl.dtb" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index db5f7a93f92..fb9a8c5032f 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -22,21 +22,13 @@ /* * Default environment variables */ - -#if defined(CONFIG_LSXHL) -#define CONFIG_FDTFILE "kirkwood-lsxhl.dtb" -#elif defined(CONFIG_LSCHLV2) -#define CONFIG_FDTFILE "kirkwood-lschlv2.dtb" -#else -#error "Unsupported board" -#endif - #define CONFIG_EXTRA_ENV_SETTINGS \ "bootsource=legacy\0" \ "hdpart=0:1\0" \ "kernel_addr=0x00800000\0" \ "ramdisk_addr=0x01000000\0" \ "fdt_addr=0x00ff0000\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_legacy=sata init " \ "&& load sata ${hdpart} ${kernel_addr} /uImage.buffalo "\ "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ @@ -44,7 +36,7 @@ "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ "&& tftpboot ${ramdisk_addr} initrd.img " \ "&& setenv ramdisk_len ${filesize} " \ - "&& tftpboot ${fdt_addr} " CONFIG_FDTFILE " " \ + "&& tftpboot ${fdt_addr} ${fdtfile} " \ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_hdd=sata init " \ @@ -58,7 +50,7 @@ "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ "&& setenv ramdisk_len ${filesize} " \ - "&& load usb 0:1 ${fdt_addr} " CONFIG_FDTFILE " " \ + "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ -- cgit v1.3.1 From 148b3aef9a6348a9363ec177bf718d32be3840ee Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:00 +0200 Subject: board: lsxl: reorder image loading and remove ramdisk_len We can load the ramdisk as the last step. This way we don't have to set the intermediate variable 'ramdisk_len' and can remove it. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index fb9a8c5032f..7c2c0e22ad8 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -34,25 +34,22 @@ "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ - "&& tftpboot ${ramdisk_addr} initrd.img " \ - "&& setenv ramdisk_len ${filesize} " \ "&& tftpboot ${fdt_addr} ${fdtfile} " \ + "&& tftpboot ${ramdisk_addr} initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_hdd=sata init " \ "&& load sata ${hdpart} ${kernel_addr} /vmlinuz " \ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ - "&& setenv ramdisk_len ${filesize} " \ "&& load sata ${hdpart} ${fdt_addr} /dtb " \ + "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_usb=usb start " \ "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ - "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ - "&& setenv ramdisk_len ${filesize} " \ "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ + "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ -- cgit v1.3.1 From f5631b2c84dcbb225ae33532fa039763732363b8 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:01 +0200 Subject: board: lsxl: use proper *_r variables Use the common kernel_addr_r, ramdisk_addr_r and fdt_addr_r variable names. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 7c2c0e22ad8..162f07790ff 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -25,31 +25,31 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "bootsource=legacy\0" \ "hdpart=0:1\0" \ - "kernel_addr=0x00800000\0" \ - "ramdisk_addr=0x01000000\0" \ - "fdt_addr=0x00ff0000\0" \ + "kernel_addr_r=0x00800000\0" \ + "ramdisk_addr_r=0x01000000\0" \ + "fdt_addr_r=0x00ff0000\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_legacy=sata init " \ - "&& load sata ${hdpart} ${kernel_addr} /uImage.buffalo "\ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ - "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ - "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ - "&& tftpboot ${fdt_addr} ${fdtfile} " \ - "&& tftpboot ${ramdisk_addr} initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load sata ${hdpart} ${kernel_addr_r} /uImage.buffalo "\ + "&& load sata ${hdpart} ${ramdisk_addr_r} /initrd.buffalo "\ + "&& bootm ${kernel_addr_r} ${ramdisk_addr_r}\0" \ + "bootcmd_net=bootp ${kernel_addr_r} vmlinuz " \ + "&& tftpboot ${fdt_addr_r} ${fdtfile} " \ + "&& tftpboot ${ramdisk_addr_r} initrd.img " \ + "&& bootz ${kernel_addr_r} " \ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_hdd=sata init " \ - "&& load sata ${hdpart} ${kernel_addr} /vmlinuz " \ - "&& load sata ${hdpart} ${fdt_addr} /dtb " \ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load sata ${hdpart} ${kernel_addr_r} /vmlinuz " \ + "&& load sata ${hdpart} ${fdt_addr_r} /dtb " \ + "&& load sata ${hdpart} ${ramdisk_addr_r} /initrd.img " \ + "&& bootz ${kernel_addr_r} " \ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_usb=usb start " \ - "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ - "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ - "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load usb 0:1 ${kernel_addr_r} /vmlinuz " \ + "&& load usb 0:1 ${fdt_addr_r} ${fdtfile} " \ + "&& load usb 0:1 ${ramdisk_addr_r} /initrd.img " \ + "&& bootz ${kernel_addr_r} " \ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ -- cgit v1.3.1 From aa088beac3aca0dd9b40f60b0b1e5ab1c6bae471 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:03 +0200 Subject: board: lsxl: make last resort recovery more reliable If something is wrong with the environment, we cannot rely on a proper u-boot operation anymore. In fact, it is possible, that we never reach misc_init_r() with a broken environment. Also don't enable the netconsole by environment settings. This way the user don't have to reconfigure the environment. Instead the network console is only enabled when the push button is pressed during boot. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- arch/arm/mach-kirkwood/Kconfig | 1 + board/buffalo/lsxl/lsxl.c | 14 ++++++++++++-- configs/lschlv2_defconfig | 1 - configs/lsxhl_defconfig | 1 - include/configs/lsxl.h | 10 ---------- 5 files changed, 13 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index f5460f3bd36..c8a193dd4cd 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -45,6 +45,7 @@ config TARGET_LSXL bool "lsxl Board" select FEROCEON_88FR131 select KW88F6281 + select BOARD_EARLY_INIT_R select MISC_INIT_R config TARGET_POGO_E02 diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index eca7da2f6da..7fab5fbe444 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -42,6 +42,8 @@ DECLARE_GLOBAL_DATA_PTR; +static bool force_rescue_mode; + int board_early_init_f(void) { /* @@ -247,14 +249,22 @@ static void check_push_button(void) if (i >= 100) erase_environment(); else if (i >= 10) - rescue_mode(); + force_rescue_mode = true; +} + +int board_early_init_r(void) +{ + check_push_button(); + + return 0; } int misc_init_r(void) { check_power_switch(); check_enetaddr(); - check_push_button(); + if (force_rescue_mode) + rescue_mode(); return 0; } diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index f4ffb9c6a20..b3ad20c4dbc 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -29,7 +29,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" CONFIG_DEFAULT_FDT_FILE="kirkwood-lschlv2.dtb" -CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_MAXARGS=32 diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index e8fb87ddda2..747a224999e 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -30,7 +30,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" CONFIG_DEFAULT_FDT_FILE="kirkwood-lsxhl.dtb" -CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_MAXARGS=32 diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 162f07790ff..4d5908d2360 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -57,17 +57,7 @@ "&& setenv ncip " \ "&& setenv autoload ${autoload_old}; " \ "setenv autoload_old\0" \ - "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \ - "setenv ncip; setenv gatewayip; setenv ethact; " \ - "setenv bootfile; setenv dnsip; " \ - "setenv bootsource legacy; run ser\0" \ - "restore_env=run standard_env; saveenv; reset\0" \ - "ser=setenv stdin serial; setenv stdout serial; " \ - "setenv stderr serial\0" \ "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ - "stdin=serial\0" \ - "stdout=serial\0" \ - "stderr=serial\0" /* * Ethernet Driver configuration -- cgit v1.3.1 From cb75d02ab13d71dda92e8925e8ec07d3890815bc Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:05 +0200 Subject: board: lsxl: convert to DM_ETH Just enabling the Kconfig option for DM_ETH and DM_MDIO is enough. Additionally, we can remove the old hardcoded config. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- configs/lschlv2_defconfig | 2 ++ configs/lsxhl_defconfig | 2 ++ include/configs/lsxl.h | 8 -------- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 2146a332768..4e356fb1505 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -61,6 +61,8 @@ CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=25000000 CONFIG_SPI_FLASH_STMICRO=y +CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_MVGBE=y CONFIG_MII=y CONFIG_DM_REGULATOR=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index d8953128e08..6de0322bfad 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -62,6 +62,8 @@ CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=25000000 CONFIG_SPI_FLASH_STMICRO=y +CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_MVGBE=y CONFIG_MII=y CONFIG_DM_REGULATOR=y diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 4d5908d2360..c82eb8b04bf 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -59,12 +59,4 @@ "setenv autoload_old\0" \ "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ -/* - * Ethernet Driver configuration - */ -#ifdef CONFIG_CMD_NET -#define CONFIG_MVGBE_PORTS {0, 1} /* enable port 1 only */ -#define CONFIG_PHY_BASE_ADR 7 -#endif /* CONFIG_CMD_NET */ - #endif /* _CONFIG_LSXL_H */ -- cgit v1.3.1