[U-Boot] [PATCH 1/4] rockchip: rk3229: move usb gadget into defconfig

Use the defconfig for all usb gadget and function related option instead of define then in header file.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
configs/evb-rk3229_defconfig | 20 ++++++++++++++++++-- include/configs/evb_rk3229.h | 1 - include/configs/rk322x_common.h | 20 -------------------- 3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 0c3b6f7..b048597 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -8,13 +8,23 @@ CONFIG_ROCKCHIP_SPL_BACK_TO_BROM=y CONFIG_TARGET_EVB_RK3229=y CONFIG_SPL_STACK_R_ADDR=0x80000 CONFIG_DEFAULT_DEVICE_TREE="rk3229-evb" +CONFIG_DEBUG_UART=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200 CONFIG_FASTBOOT=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_CMD_FASTBOOT=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FASTBOOT_BUF_ADDR=0x60800800 +CONFIG_FASTBOOT_BUF_SIZE=0x04000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 # CONFIG_CMD_IMLS is not set CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y CONFIG_SPL_OF_CONTROL=y @@ -31,14 +41,20 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ROCKCHIP_RK322X=y -# CONFIG_SPL_PINCTRL_FULL is not set CONFIG_RAM=y CONFIG_SPL_RAM=y CONFIG_BAUDRATE=1500000 -CONFIG_DEBUG_UART=y CONFIG_DEBUG_UART_BASE=0x11030000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_SYSRESET=y +CONFIG_USB=y +CONFIG_USB_DWC2=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="Rockchip" +CONFIG_G_DNL_VENDOR_NUM=0x2207 +CONFIG_G_DNL_PRODUCT_NUM=0x320a CONFIG_ERRNO_STR=y diff --git a/include/configs/evb_rk3229.h b/include/configs/evb_rk3229.h index 8f8e50f..df441f6 100644 --- a/include/configs/evb_rk3229.h +++ b/include/configs/evb_rk3229.h @@ -41,7 +41,6 @@
#define CONFIG_PREBOOT
-#define CONFIG_ANDROID_BOOT_IMAGE #define CONFIG_SYS_BOOT_RAMDISK_HIGH
#undef CONFIG_BOOTCOMMAND diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h index 56565b6..d01dc80 100644 --- a/include/configs/rk322x_common.h +++ b/include/configs/rk322x_common.h @@ -40,28 +40,8 @@ #define SDRAM_MAX_SIZE 0x80000000
#ifndef CONFIG_SPL_BUILD -/* usb otg */ -#define CONFIG_USB_GADGET -#define CONFIG_USB_GADGET_DUALSPEED -#define CONFIG_USB_GADGET_DWC2_OTG -#define CONFIG_USB_GADGET_VBUS_DRAW 0 - -/* fastboot */ -#define CONFIG_CMD_FASTBOOT -#define CONFIG_USB_FUNCTION_FASTBOOT -#define CONFIG_FASTBOOT_FLASH -#define CONFIG_FASTBOOT_FLASH_MMC_DEV 0 -#define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR -#define CONFIG_FASTBOOT_BUF_SIZE 0x08000000 - /* usb mass storage */ #define CONFIG_USB_FUNCTION_MASS_STORAGE -#define CONFIG_CMD_USB_MASS_STORAGE - -#define CONFIG_USB_GADGET_DOWNLOAD -#define CONFIG_G_DNL_MANUFACTURER "Rockchip" -#define CONFIG_G_DNL_VENDOR_NUM 0x2207 -#define CONFIG_G_DNL_PRODUCT_NUM 0x320a
/* usb host */ #ifdef CONFIG_CMD_USB

The boot mode for rk322x is stored in sysreg 0, update it.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk322x-board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c index b6543a5..41ce12d 100644 --- a/arch/arm/mach-rockchip/rk322x-board.c +++ b/arch/arm/mach-rockchip/rk322x-board.c @@ -20,12 +20,12 @@ DECLARE_GLOBAL_DATA_PTR; static void setup_boot_mode(void) { struct rk322x_grf *const grf = (void *)GRF_BASE; - int boot_mode = readl(&grf->os_reg[4]); + int boot_mode = readl(&grf->os_reg[0]);
debug("boot mode %x.\n", boot_mode);
/* Clear boot mode */ - writel(BOOT_NORMAL, &grf->os_reg[4]); + writel(BOOT_NORMAL, &grf->os_reg[0]);
switch (boot_mode) { case BOOT_FASTBOOT:

The boot mode for rk322x is stored in sysreg 0, update it.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk322x-board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Rockchip using rockusb for flash emmc via USB, people use 'reboot loader' in kernel and then want to get a rockusb device in bootloader for firmware update.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk3036-board.c | 4 ++++ arch/arm/mach-rockchip/rk322x-board.c | 4 ++++ arch/arm/mach-rockchip/rk3288-board.c | 4 ++++ 3 files changed, 12 insertions(+)
diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c index bf2b268..b38883e 100644 --- a/arch/arm/mach-rockchip/rk3036-board.c +++ b/arch/arm/mach-rockchip/rk3036-board.c @@ -40,6 +40,10 @@ static void setup_boot_mode(void) printf("enter UMS!\n"); setenv("preboot", "setenv preboot; ums mmc 0"); break; + case BOOT_LOADER: + printf("enter Rockusb!\n"); + setenv("preboot", "setenv preboot; rockusb 0 mmc 0"); + break; } }
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c index 41ce12d..9768ea7 100644 --- a/arch/arm/mach-rockchip/rk322x-board.c +++ b/arch/arm/mach-rockchip/rk322x-board.c @@ -36,6 +36,10 @@ static void setup_boot_mode(void) printf("enter UMS!\n"); setenv("preboot", "setenv preboot; ums mmc 0"); break; + case BOOT_LOADER: + printf("enter Rockusb!\n"); + setenv("preboot", "setenv preboot; rockusb 0 mmc 0"); + break; } }
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c index c9d16a9..48a891d 100644 --- a/arch/arm/mach-rockchip/rk3288-board.c +++ b/arch/arm/mach-rockchip/rk3288-board.c @@ -44,6 +44,10 @@ static void setup_boot_mode(void) setenv("preboot", "setenv preboot; if mmc dev 0;" "then ums mmc 0; else ums mmc 1;fi"); break; + case BOOT_LOADER: + printf("enter Rockusb!\n"); + setenv("preboot", "setenv preboot; rockusb 0 mmc 0"); + break; } }

Rockchip using rockusb for flash emmc via USB, people use 'reboot loader' in kernel and then want to get a rockusb device in bootloader for firmware update.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3036-board.c | 4 ++++ arch/arm/mach-rockchip/rk322x-board.c | 4 ++++ arch/arm/mach-rockchip/rk3288-board.c | 4 ++++ 3 files changed, 12 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Hold this patch for a moment, the setenv() has changed to env_set().
I will update for it.
Thanks, - Kever On 08/05/2017 06:43 AM, Philipp Tomsich wrote:
Rockchip using rockusb for flash emmc via USB, people use 'reboot loader' in kernel and then want to get a rockusb device in bootloader for firmware update.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3036-board.c | 4 ++++ arch/arm/mach-rockchip/rk322x-board.c | 4 ++++ arch/arm/mach-rockchip/rk3288-board.c | 4 ++++ 3 files changed, 12 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Rockusb will be used by all the rockchip SoCs, enable it by default in Kconfig, and it can be work if USB gadget is available.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dce4105..a5c1197 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1039,6 +1039,8 @@ config ARCH_ROCKCHIP select DM_PWM select DM_REGULATOR imply FAT_WRITE + imply USB_FUNCTION_ROCKUSB + imply CMD_ROCKUSB
config TARGET_THUNDERX_88XX bool "Support ThunderX 88xx"

Rockusb will be used by all the rockchip SoCs, enable it by default in Kconfig, and it can be work if USB gadget is available.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Use the defconfig for all usb gadget and function related option instead of define then in header file.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
configs/evb-rk3229_defconfig | 20 ++++++++++++++++++-- include/configs/evb_rk3229.h | 1 - include/configs/rk322x_common.h | 20 -------------------- 3 files changed, 18 insertions(+), 23 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
participants (2)
-
Kever Yang
-
Philipp Tomsich