From 09b32b41f240f8271fead1fe35dbb052c9e7da28 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Thu, 17 Jan 2019 13:43:02 -0600 Subject: [PATCH] UPSTREAM: spl: Kconfig: Drop the _SUPPORT postfix from SPL_DFU The symbol CONFIG_SPL_DFU_SUPPORT in SPL build has the same meaning as CONFIG_DFU in regular U-Boot. Drop the _SUPPORT to allow for cleaner use in code. Conflicts: arch/arm/mach-zynqmp/spl.c common/Makefile common/spl/Kconfig common/spl/spl_ram.c Change-Id: I93f09d5953284d511df135e6e71c03c0552719a2 Signed-off-by: Andrew F. Davis Reviewed-by: Tom Rini Acked-by: Lukasz Majewski (cherry picked from commit 6536ca4d6676bf38e50784298e713edc30b9cde9) --- arch/arm/cpu/armv8/zynqmp/spl.c | 2 +- arch/arm/mach-omap2/boot-common.c | 2 +- arch/arm/mach-zynqmp/spl.c | 134 ++++++++++++++++++++++++++++++ common/Makefile | 6 +- common/spl/Kconfig | 8 +- common/spl/Makefile | 2 +- common/spl/spl_ram.c | 4 +- configs/evb-rk3066_defconfig | 2 +- configs/mk808_defconfig | 2 +- drivers/Makefile | 2 +- drivers/usb/gadget/Makefile | 2 +- include/configs/dra7xx_evm.h | 2 +- include/configs/xilinx_zynqmp.h | 4 +- 13 files changed, 154 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-zynqmp/spl.c diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/spl.c index 468dc1dc4d..971de15d94 100644 --- a/arch/arm/cpu/armv8/zynqmp/spl.c +++ b/arch/arm/cpu/armv8/zynqmp/spl.c @@ -94,7 +94,7 @@ u32 spl_boot_device(void) case EMMC_MODE: return BOOT_DEVICE_MMC1; #endif -#ifdef CONFIG_SPL_DFU_SUPPORT +#ifdef CONFIG_SPL_DFU case USB_MODE: return BOOT_DEVICE_DFU; #endif diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c index 26245aa169..7221016db3 100644 --- a/arch/arm/mach-omap2/boot-common.c +++ b/arch/arm/mach-omap2/boot-common.c @@ -109,7 +109,7 @@ void save_omap_boot_params(void) sys_boot_device = 1; break; #endif -#if defined(BOOT_DEVICE_DFU) && !defined(CONFIG_SPL_DFU_SUPPORT) +#if defined(BOOT_DEVICE_DFU) && !defined(CONFIG_SPL_DFU) case BOOT_DEVICE_DFU: sys_boot_device = 1; break; diff --git a/arch/arm/mach-zynqmp/spl.c b/arch/arm/mach-zynqmp/spl.c new file mode 100644 index 0000000000..fb3955c93f --- /dev/null +++ b/arch/arm/mach-zynqmp/spl.c @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2015 - 2016 Xilinx, Inc. + * + * Michal Simek + */ + +#include +#include +#include + +#include +#include +#include +#include + +void board_init_f(ulong dummy) +{ + board_early_init_f(); + board_early_init_r(); + +#ifdef CONFIG_DEBUG_UART + /* Uart debug for sure */ + debug_uart_init(); + puts("Debug uart enabled\n"); /* or printch() */ +#endif + /* Delay is required for clocks to be propagated */ + udelay(1000000); + + /* Clear the BSS */ + memset(__bss_start, 0, __bss_end - __bss_start); + + /* No need to call timer init - it is empty for ZynqMP */ + board_init_r(NULL, 0); +} + +static void ps_mode_reset(ulong mode) +{ + writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT, + &crlapb_base->boot_pin_ctrl); + udelay(5); + writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT | + mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT, + &crlapb_base->boot_pin_ctrl); +} + +/* + * Set default PS_MODE1 which is used for USB ULPI phy reset + * Also other resets can be connected to this certain pin + */ +#ifndef MODE_RESET +# define MODE_RESET PS_MODE1 +#endif + +#ifdef CONFIG_SPL_BOARD_INIT +void spl_board_init(void) +{ + preloader_console_init(); + ps_mode_reset(MODE_RESET); + board_init(); +} +#endif + +u32 spl_boot_device(void) +{ + u32 reg = 0; + u8 bootmode; + +#if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED) + /* Change default boot mode at run-time */ + writel(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT, + &crlapb_base->boot_mode); +#endif + + reg = readl(&crlapb_base->boot_mode); + if (reg >> BOOT_MODE_ALT_SHIFT) + reg >>= BOOT_MODE_ALT_SHIFT; + + bootmode = reg & BOOT_MODES_MASK; + + switch (bootmode) { + case JTAG_MODE: + return BOOT_DEVICE_RAM; +#ifdef CONFIG_SPL_MMC_SUPPORT + case SD_MODE1: + case SD1_LSHFT_MODE: /* not working on silicon v1 */ +/* if both controllers enabled, then these two are the second controller */ +#if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1) + return BOOT_DEVICE_MMC2; +/* else, fall through, the one SDHCI controller that is enabled is number 1 */ +#endif + case SD_MODE: + case EMMC_MODE: + return BOOT_DEVICE_MMC1; +#endif +#ifdef CONFIG_SPL_DFU + case USB_MODE: + return BOOT_DEVICE_DFU; +#endif +#ifdef CONFIG_SPL_SATA_SUPPORT + case SW_SATA_MODE: + return BOOT_DEVICE_SATA; +#endif +#ifdef CONFIG_SPL_SPI_SUPPORT + case QSPI_MODE_24BIT: + case QSPI_MODE_32BIT: + return BOOT_DEVICE_SPI; +#endif + default: + printf("Invalid Boot Mode:0x%x\n", bootmode); + break; + } + + return 0; +} + +#ifdef CONFIG_SPL_OS_BOOT +int spl_start_uboot(void) +{ + handoff_setup(); + + return 0; +} +#endif + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match(const char *name) +{ + /* Just empty function now - can't decide what to choose */ + debug("%s: %s\n", __func__, name); + + return 0; +} +#endif diff --git a/common/Makefile b/common/Makefile index 29a5555988..913dd5d16a 100644 --- a/common/Makefile +++ b/common/Makefile @@ -67,8 +67,10 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTAGE) += bootstage.o ifdef CONFIG_SPL_BUILD ifndef CONFIG_TPL_BUILD -obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o -obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o +ifdef CONFIG_SPL_DFU +obj-$(CONFIG_DFU_OVER_USB) += dfu.o +endif +obj-$(CONFIG_SPL_DFU) += cli_hush.o obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 6a101be5c7..0920720ae0 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -698,8 +698,8 @@ config SPL_USBETH_SUPPORT since the network stack uses a number of environment variables. See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT. -config SPL_DFU_SUPPORT - bool "Support DFU (Device Firmware Upgarde)" +config SPL_DFU + bool "Support DFU (Device Firmware Upgrade)" select SPL_HASH_SUPPORT select SPL_DFU_NO_RESET depends on SPL_RAM_SUPPORT @@ -713,11 +713,11 @@ config SPL_DFU_SUPPORT choice bool "DFU device selection" - depends on SPL_DFU_SUPPORT + depends on SPL_DFU config SPL_DFU_RAM bool "RAM device" - depends on SPL_DFU_SUPPORT && SPL_RAM_SUPPORT + depends on SPL_DFU && SPL_RAM_SUPPORT help select RAM/DDR memory device for loading binary images (u-boot/kernel) to the selected device partition using diff --git a/common/spl/Makefile b/common/spl/Makefile index 26c37ddffe..65ba4480c7 100644 --- a/common/spl/Makefile +++ b/common/spl/Makefile @@ -40,7 +40,7 @@ obj-$(CONFIG_$(SPL_TPL_)USB_SUPPORT) += spl_usb.o obj-$(CONFIG_$(SPL_TPL_)FAT_SUPPORT) += spl_fat.o obj-$(CONFIG_$(SPL_TPL_)EXT_SUPPORT) += spl_ext.o obj-$(CONFIG_$(SPL_TPL_)SATA_SUPPORT) += spl_sata.o -obj-$(CONFIG_$(SPL_TPL_)DFU_SUPPORT) += spl_dfu.o +obj-$(CONFIG_$(SPL_TPL_)DFU) += spl_dfu.o obj-$(CONFIG_$(SPL_TPL_)SPI_LOAD) += spl_spi.o obj-$(CONFIG_$(SPL_TPL_)RAM_SUPPORT) += spl_ram.o obj-$(CONFIG_$(SPL_TPL_)USB_SDP_SUPPORT) += spl_sdp.o diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c index 1b1a16c9c1..28663d8915 100644 --- a/common/spl/spl_ram.c +++ b/common/spl/spl_ram.c @@ -34,7 +34,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS; -#if defined(CONFIG_SPL_DFU_SUPPORT) +#if CONFIG_IS_ENABLED(DFU) if (bootdev->boot_device == BOOT_DEVICE_DFU) spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0"); #endif @@ -66,7 +66,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, #if defined(CONFIG_SPL_RAM_DEVICE) SPL_LOAD_IMAGE_METHOD("RAM", 0, BOOT_DEVICE_RAM, spl_ram_load_image); #endif -#if defined(CONFIG_SPL_DFU_SUPPORT) +#if CONFIG_IS_ENABLED(DFU) SPL_LOAD_IMAGE_METHOD("DFU", 0, BOOT_DEVICE_DFU, spl_ram_load_image); #endif diff --git a/configs/evb-rk3066_defconfig b/configs/evb-rk3066_defconfig index 01b0fa6c96..14523e8587 100644 --- a/configs/evb-rk3066_defconfig +++ b/configs/evb-rk3066_defconfig @@ -71,7 +71,7 @@ CONFIG_CMD_DFU=y CONFIG_SPL_BLK=y CONFIG_SPL_CLK=y CONFIG_SPL_DFU_RAM=y -CONFIG_SPL_DFU_SUPPORT=y +CONFIG_SPL_DFU=y CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_OF_CONTROL=y diff --git a/configs/mk808_defconfig b/configs/mk808_defconfig index 6d72902589..6377de0b1a 100644 --- a/configs/mk808_defconfig +++ b/configs/mk808_defconfig @@ -72,7 +72,7 @@ CONFIG_CMD_DFU=y CONFIG_SPL_BLK=y CONFIG_SPL_CLK=y CONFIG_SPL_DFU_RAM=y -CONFIG_SPL_DFU_SUPPORT=y +CONFIG_SPL_DFU=y CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_MTD_SUPPORT=y diff --git a/drivers/Makefile b/drivers/Makefile index 252bd22e2f..c93dd90820 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -47,7 +47,7 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/ obj-$(CONFIG_SPL_USB_GADGET) += usb/common/ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/ -obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/ +obj-$(CONFIG_SPL_DFU) += dfu/ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index e6d0b4baaa..97b904de85 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -10,7 +10,7 @@ obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_USB_GADGET) += g_dnl.o -obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o +obj-$(CONFIG_SPL_DFU) += f_dfu.o obj-$(CONFIG_SPL_USB_SDP_SUPPORT) += f_sdp.o endif diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index e25eef8df5..db2d91c831 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -80,7 +80,7 @@ #ifdef CONFIG_SPL_BUILD #undef CONFIG_CMD_BOOTD -#ifdef CONFIG_SPL_DFU_SUPPORT +#ifdef CONFIG_SPL_DFU #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000 #define DFUARGS \ "dfu_bufsiz=0x10000\0" \ diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 92438db0e9..fe7a17de64 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -215,7 +215,7 @@ #endif /* SPL can't handle all huge variables - define just DFU */ -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT) +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU) #undef CONFIG_EXTRA_ENV_SETTINGS # define CONFIG_EXTRA_ENV_SETTINGS \ "dfu_alt_info_ram=uboot.bin ram 0x8000000 0x1000000;" \ @@ -254,7 +254,7 @@ # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" #endif -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT) +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU) # undef CONFIG_CMD_BOOTD # define CONFIG_SPL_ENV_SUPPORT # define CONFIG_SPL_HASH_SUPPORT