common: add usbplug support
- disable some message - add "usbplug.bin" generation - add minimum usbplug dtb support - add individual board_init_r() init sequence. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: If48ee49247fca6108db3a1fbab3b403241b3a8eb
This commit is contained in:
parent
9542469246
commit
4a2b8db466
15
Makefile
15
Makefile
|
|
@ -771,6 +771,7 @@ endif
|
||||||
|
|
||||||
# Always append ALL so that arch config.mk's can add custom ones
|
# Always append ALL so that arch config.mk's can add custom ones
|
||||||
ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
|
ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
|
||||||
|
ALL-$(CONFIG_SUPPORT_USBPLUG) += usbplug.bin
|
||||||
|
|
||||||
ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
|
ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
|
||||||
ifeq ($(CONFIG_SPL_FSL_PBL),y)
|
ifeq ($(CONFIG_SPL_FSL_PBL),y)
|
||||||
|
|
@ -922,6 +923,11 @@ u-boot.bin: u-boot-nodtb.bin FORCE
|
||||||
$(call if_changed,copy)
|
$(call if_changed,copy)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SUPPORT_USBPLUG),y)
|
||||||
|
usbplug.bin: u-boot.bin
|
||||||
|
$(call if_changed,copy)
|
||||||
|
endif
|
||||||
|
|
||||||
%.imx: %.bin
|
%.imx: %.bin
|
||||||
$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
|
$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
|
||||||
|
|
||||||
|
|
@ -1355,12 +1361,21 @@ prepare: prepare0
|
||||||
# Generate some files
|
# Generate some files
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SUPPORT_USBPLUG),)
|
||||||
define filechk_version.h
|
define filechk_version.h
|
||||||
(echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
|
(echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
|
||||||
echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \
|
echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \
|
||||||
echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \
|
echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \
|
||||||
echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
|
echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
|
||||||
endef
|
endef
|
||||||
|
else
|
||||||
|
define filechk_version.h
|
||||||
|
(echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
|
||||||
|
echo \#define U_BOOT_VERSION \"USB-PLUG \" PLAIN_VERSION; \
|
||||||
|
echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \
|
||||||
|
echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
# The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date.
|
# The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date.
|
||||||
# The BSD date on the other hand behaves different and would produce errors
|
# The BSD date on the other hand behaves different and would produce errors
|
||||||
|
|
|
||||||
|
|
@ -674,3 +674,4 @@ config HASH
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
source "common/spl/Kconfig"
|
source "common/spl/Kconfig"
|
||||||
|
source "common/usbplug/Kconfig"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
# core
|
# core
|
||||||
ifndef CONFIG_SPL_BUILD
|
ifndef CONFIG_SPL_BUILD
|
||||||
obj-y += init/
|
obj-y += init/
|
||||||
|
obj-$(CONFIG_SUPPORT_USBPLUG) += usbplug/
|
||||||
|
|
||||||
obj-y += main.o
|
obj-y += main.o
|
||||||
obj-y += exports.o
|
obj-y += exports.o
|
||||||
obj-$(CONFIG_HASH) += hash.o
|
obj-$(CONFIG_HASH) += hash.o
|
||||||
|
|
@ -21,7 +23,9 @@ endif
|
||||||
|
|
||||||
# # boards
|
# # boards
|
||||||
obj-y += board_f.o
|
obj-y += board_f.o
|
||||||
|
ifndef CONFIG_SUPPORT_USBPLUG
|
||||||
obj-y += board_r.o
|
obj-y += board_r.o
|
||||||
|
endif
|
||||||
obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
|
obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
|
||||||
obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
|
obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,9 @@ static int announce_pre_serial(void)
|
||||||
|
|
||||||
static int announce_dram_init(void)
|
static int announce_dram_init(void)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_SUPPORT_USBPLUG
|
||||||
puts("DRAM: ");
|
puts("DRAM: ");
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,10 +190,12 @@ static int show_dram_config(void)
|
||||||
#ifdef CONFIG_BIDRAM
|
#ifdef CONFIG_BIDRAM
|
||||||
size += bidram_append_size();
|
size += bidram_append_size();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_SUPPORT_USBPLUG
|
||||||
print_size(size, "");
|
print_size(size, "");
|
||||||
board_add_ram_info(0);
|
board_add_ram_info(0);
|
||||||
putc('\n');
|
putc('\n');
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -672,8 +676,10 @@ static int setup_reloc(void)
|
||||||
#endif
|
#endif
|
||||||
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
|
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
|
||||||
|
|
||||||
|
#ifndef CONFIG_SUPPORT_USBPLUG
|
||||||
printf("Relocation Offset: %08lx, fdt: %08lx\n",
|
printf("Relocation Offset: %08lx, fdt: %08lx\n",
|
||||||
gd->reloc_off, (ulong)gd->new_fdt);
|
gd->reloc_off, (ulong)gd->new_fdt);
|
||||||
|
#endif
|
||||||
debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n",
|
debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n",
|
||||||
gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd),
|
gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd),
|
||||||
gd->start_addr_sp);
|
gd->start_addr_sp);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
menu "USBPLUG"
|
||||||
|
|
||||||
|
config SUPPORT_USBPLUG
|
||||||
|
bool "Support USB PLUG"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Support to build U-Boot as usb plug image for download firmware.
|
||||||
|
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
obj-y += usbplug.o
|
||||||
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2020 Rockchip Electronics Co., Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <mapmem.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <dm/root.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
static void initr_reloc(void)
|
||||||
|
{
|
||||||
|
/* tell others: relocation done */
|
||||||
|
gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARM
|
||||||
|
static void initr_caches(void)
|
||||||
|
{
|
||||||
|
icache_enable();
|
||||||
|
dcache_enable();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void initr_malloc(void)
|
||||||
|
{
|
||||||
|
ulong malloc_start;
|
||||||
|
|
||||||
|
/* The malloc area is immediately below the monitor copy in DRAM */
|
||||||
|
malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN;
|
||||||
|
mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN),
|
||||||
|
TOTAL_MALLOC_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_DM
|
||||||
|
static int initr_dm(void)
|
||||||
|
{
|
||||||
|
/* Save the pre-reloc driver model and start a new one */
|
||||||
|
gd->dm_root_f = gd->dm_root;
|
||||||
|
gd->dm_root = NULL;
|
||||||
|
|
||||||
|
return dm_init_and_scan(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The below functions are all __weak declared.
|
||||||
|
*/
|
||||||
|
int dram_init(void)
|
||||||
|
{
|
||||||
|
#if CONFIG_SYS_MALLOC_LEN > SZ_64M
|
||||||
|
"CONFIG_SYS_MALLOC_LEN is over 64MB"
|
||||||
|
#endif
|
||||||
|
gd->ram_size = SZ_64M; /* default */
|
||||||
|
|
||||||
|
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
|
||||||
|
gd->bd->bi_dram[0].size = gd->ram_size;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Refers to common/board_r.c */
|
||||||
|
void board_init_r(gd_t *new_gd, ulong dest_addr)
|
||||||
|
{
|
||||||
|
initr_reloc();
|
||||||
|
#ifdef CONFIG_ARM
|
||||||
|
initr_caches();
|
||||||
|
#endif
|
||||||
|
initr_malloc();
|
||||||
|
#ifdef CONFIG_DM
|
||||||
|
initr_dm();
|
||||||
|
#endif
|
||||||
|
/* Setup chipselects, entering usb-plug mode */
|
||||||
|
board_init();
|
||||||
|
|
||||||
|
hang();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ $(obj)/dt-spl.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
|
||||||
$(call if_changed,fdtgrep)
|
$(call if_changed,fdtgrep)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USING_KERNEL_DTB),y)
|
ifneq ($(CONFIG_USING_KERNEL_DTB)$(CONFIG_SUPPORT_USBPLUG),)
|
||||||
$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
|
$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE
|
||||||
$(call if_changed,fdtgrep)
|
$(call if_changed,fdtgrep)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue