From 65325fba5a8d6bcafb2fc1662bd82b348b735dc2 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Fri, 15 Nov 2019 10:27:07 +0800 Subject: [PATCH 01/18] rockchip: Convert to use FIT generator for optee Use generator script so that we can use environment for TEE source. $TEE for tee.bin, and if file not exist, the script can report a warning, and meke the build success without a error. Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/fit_spl_optee.its | 50 --------------- arch/arm/mach-rockchip/fit_spl_optee.sh | 78 ++++++++++++++++++++++++ configs/evb-rk3229_defconfig | 2 +- 3 files changed, 79 insertions(+), 51 deletions(-) delete mode 100644 arch/arm/mach-rockchip/fit_spl_optee.its create mode 100755 arch/arm/mach-rockchip/fit_spl_optee.sh diff --git a/arch/arm/mach-rockchip/fit_spl_optee.its b/arch/arm/mach-rockchip/fit_spl_optee.its deleted file mode 100644 index 6ed5d486f2..0000000000 --- a/arch/arm/mach-rockchip/fit_spl_optee.its +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2017 Rockchip Electronic Co.,Ltd - * - * Simple U-boot fit source file containing U-Boot, dtb and optee - */ - -/dts-v1/; - -/ { - description = "Simple image with OP-TEE support"; - #address-cells = <1>; - - images { - uboot { - description = "U-Boot"; - data = /incbin/("../../../u-boot-nodtb.bin"); - type = "standalone"; - os = "U-Boot"; - arch = "arm"; - compression = "none"; - load = <0x61000000>; - }; - optee { - description = "OP-TEE"; - data = /incbin/("../../../tee.bin"); - type = "firmware"; - arch = "arm"; - os = "tee"; - compression = "none"; - load = <0x68400000>; - entry = <0x68400000>; - }; - fdt { - description = "dtb"; - data = /incbin/("../../../u-boot.dtb"); - type = "flat_dt"; - compression = "none"; - }; - }; - - configurations { - default = "conf"; - conf { - description = "Rockchip armv7 with OP-TEE"; - firmware = "optee"; - loadables = "uboot"; - fdt = "fdt"; - }; - }; -}; diff --git a/arch/arm/mach-rockchip/fit_spl_optee.sh b/arch/arm/mach-rockchip/fit_spl_optee.sh new file mode 100755 index 0000000000..89ef04312c --- /dev/null +++ b/arch/arm/mach-rockchip/fit_spl_optee.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2019 Rockchip Electronic Co.,Ltd +# +# Script to generate FIT image source for 32-bit Rockchip SoCs with +# U-Boot proper, OPTEE, and devicetree. +# +# usage: $0 + +[ -z "$TEE" ] && TEE="tee.bin" + +if [ ! -f $TEE ]; then + echo "WARNING: TEE file $TEE NOT found, U-Boot.itb is non-functional" >&2 + echo "Please export path for TEE or copy tee.bin to U-Boot folder" >&2 + TEE=/dev/null +fi + +dtname=$1 + +cat << __HEADER_EOF +/* + * Copyright (C) 2017-2019 Rockchip Electronic Co.,Ltd + * + * Simple U-boot FIT source file containing U-Boot, dtb and optee + */ + +/dts-v1/; + +/ { + description = "FIT image with OP-TEE support"; + #address-cells = <1>; + + images { + uboot { + description = "U-Boot"; + data = /incbin/("u-boot-nodtb.bin"); + type = "standalone"; + os = "U-Boot"; + arch = "arm"; + compression = "none"; + load = <0x61000000>; + }; + optee { + description = "OP-TEE"; + data = /incbin/("$TEE"); + type = "firmware"; + arch = "arm"; + os = "tee"; + compression = "none"; + load = <0x68400000>; + entry = <0x68400000>; + }; + fdt { + description = "$(basename $dtname .dtb)"; + data = /incbin/("$dtname"); + type = "flat_dt"; + compression = "none"; + }; +__HEADER_EOF + +cat << __CONF_HEADER_EOF + }; + + configurations { + default = "conf"; + conf { + description = "$(basename $dtname .dtb)"; + firmware = "optee"; + loadables = "uboot"; + fdt = "fdt"; + }; +__CONF_HEADER_EOF + +cat << __ITS_EOF + }; +}; +__ITS_EOF diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 745fdd1c0f..11a2d01847 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -14,7 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x60000000 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y -CONFIG_SPL_FIT_SOURCE="arch/arm/mach-rockchip/fit_spl_optee.its" +CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/fit_spl_optee.sh" CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rk3229-evb.dtb" # CONFIG_DISPLAY_CPUINFO is not set From 5561a9a229dccb471d6538e6d3b3237284723364 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Fri, 15 Nov 2019 10:40:28 +0800 Subject: [PATCH 02/18] rockchip: lion-rk3368: Migrate to use common FIT generator The RK3368 lion board ATF can use bl31.elf like RK3399 and get the FIT source with generic FIT generator script at: arch/arm/mach-rockchip/make_fit_atf.py And then we can use 'BL31' environment to get the path of bl31.elf instead of copy it into U-Boot folder. CC: Philipp Tomsich Signed-off-by: Kever Yang --- .../lion_rk3368/fit_spl_atf.its | 52 ------------------- configs/lion-rk3368_defconfig | 1 - 2 files changed, 53 deletions(-) delete mode 100644 board/theobroma-systems/lion_rk3368/fit_spl_atf.its diff --git a/board/theobroma-systems/lion_rk3368/fit_spl_atf.its b/board/theobroma-systems/lion_rk3368/fit_spl_atf.its deleted file mode 100644 index 6b04fbc7da..0000000000 --- a/board/theobroma-systems/lion_rk3368/fit_spl_atf.its +++ /dev/null @@ -1,52 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR X11 */ -/* - * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH - * - * Minimal dts for a SPL FIT image payload. - */ - -/dts-v1/; - -/ { - description = "FIT image with U-Boot proper, ATF bl31, DTB"; - #address-cells = <1>; - - images { - uboot { - description = "U-Boot (64-bit)"; - data = /incbin/("../../../u-boot-nodtb.bin"); - type = "standalone"; - os = "U-Boot"; - arch = "arm64"; - compression = "none"; - load = <0x00200000>; - }; - atf { - description = "ARM Trusted Firmware"; - data = /incbin/("../../../bl31-rk3368.bin"); - type = "firmware"; - os = "arm-trusted-firmware"; - arch = "arm64"; - compression = "none"; - load = <0x00100000>; - entry = <0x00100000>; - }; - - fdt { - description = "RK3368-uQ7 (Lion) flat device-tree"; - data = /incbin/("../../../u-boot.dtb"); - type = "flat_dt"; - compression = "none"; - }; - }; - - configurations { - default = "conf"; - conf { - description = "Theobroma Systems RK3368-uQ7 (Puma) SoM"; - firmware = "atf"; - loadables = "uboot"; - fdt = "fdt"; - }; - }; -}; diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig index 1d02d65a37..c66b28eda1 100644 --- a/configs/lion-rk3368_defconfig +++ b/configs/lion-rk3368_defconfig @@ -20,7 +20,6 @@ CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_LOAD_FIT=y -CONFIG_SPL_FIT_SOURCE="board/theobroma-systems/lion_rk3368/fit_spl_atf.its" CONFIG_BOOTSTAGE=y CONFIG_SPL_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y From d8765e2422cd755ad9f589eed47ec53b1aafdb1f Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Thu, 17 Oct 2019 12:08:34 -0700 Subject: [PATCH 03/18] Kconfig: Enable building of u-boot.itb on Rockchip platform For all the Rockchip SoCs with SPL_LOAD_FIT enable, we need to build u-boot.itb with U-Boot proper and ATF/OPTEE. All the Rockchip boards with SPL_LOAD_FIT now supports FIT generator to get ATF/OPTEE binary path from environment and pass the build even if no ATF/OPTEE binary exist, so we can enable this feature for the rockchip platform. Signed-off-by: Kever Yang --- Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kconfig b/Kconfig index cda4f58ff7..e22417ec44 100644 --- a/Kconfig +++ b/Kconfig @@ -252,7 +252,7 @@ config BUILD_TARGET default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_GEN5 default "u-boot-spl.kwb" if ARCH_MVEBU && SPL default "u-boot-elf.srec" if RCAR_GEN3 - default "u-boot.itb" if SPL_LOAD_FIT && (ROCKCHIP_RK3399 || \ + default "u-boot.itb" if SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ ARCH_SUNXI || RISCV) default "u-boot.kwb" if KIRKWOOD default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT From 5ef1e02e997ade6e482e589a5c5ed7cf442b173b Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sat, 16 Nov 2019 11:32:03 -0800 Subject: [PATCH 04/18] power: fan53555: add support for Silergy SYR82X and SYR83X SYR82X and SYR83X are almost identical to FAN53555, the only difference is different die ID and revision, voltage ranges and steps. Signed-off-by: Vasily Khoruzhick Tested-by: Anand Moon Reviewed-by: Kever Yang --- drivers/power/pmic/fan53555.c | 7 +++-- drivers/power/regulator/fan53555.c | 45 ++++++++++++++++++++++-------- include/power/fan53555.h | 14 ++++++++++ 3 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 include/power/fan53555.h diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c index 1ca59c5f0c..11304d2146 100644 --- a/drivers/power/pmic/fan53555.c +++ b/drivers/power/pmic/fan53555.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -58,7 +59,7 @@ static int pmic_fan53555_bind(struct udevice *dev) return -ENOENT; } - return device_bind_with_driver_data(dev, drv, "SW", 0, + return device_bind_with_driver_data(dev, drv, "SW", dev->driver_data, dev_ofnode(dev), &child); }; @@ -69,7 +70,9 @@ static struct dm_pmic_ops pmic_fan53555_ops = { }; static const struct udevice_id pmic_fan53555_match[] = { - { .compatible = "fcs,fan53555" }, + { .compatible = "fcs,fan53555", .data = FAN53555_VENDOR_FAIRCHILD, }, + { .compatible = "silergy,syr827", .data = FAN53555_VENDOR_SILERGY, }, + { .compatible = "silergy,syr828", .data = FAN53555_VENDOR_SILERGY, }, { }, }; diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c index dbd5502377..9c48b26216 100644 --- a/drivers/power/regulator/fan53555.c +++ b/drivers/power/regulator/fan53555.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -27,21 +28,37 @@ * See http://www.onsemi.com/pub/Collateral/FAN53555-D.pdf for details. */ static const struct { + unsigned int vendor; u8 die_id; u8 die_rev; + bool check_rev; u32 vsel_min; u32 vsel_step; } ic_types[] = { - { 0x0, 0x3, 600000, 10000 }, /* Option 00 */ - { 0x0, 0xf, 800000, 10000 }, /* Option 13 */ - { 0x0, 0xc, 600000, 12500 }, /* Option 23 */ - { 0x1, 0x3, 600000, 10000 }, /* Option 01 */ - { 0x3, 0x3, 600000, 10000 }, /* Option 03 */ - { 0x4, 0xf, 603000, 12826 }, /* Option 04 */ - { 0x5, 0x3, 600000, 10000 }, /* Option 05 */ - { 0x8, 0x1, 600000, 10000 }, /* Option 08 */ - { 0x8, 0xf, 600000, 10000 }, /* Option 08 */ - { 0xc, 0xf, 603000, 12826 }, /* Option 09 */ + /* Option 00 */ + { FAN53555_VENDOR_FAIRCHILD, 0x0, 0x3, true, 600000, 10000 }, + /* Option 13 */ + { FAN53555_VENDOR_FAIRCHILD, 0x0, 0xf, true, 800000, 10000 }, + /* Option 23 */ + { FAN53555_VENDOR_FAIRCHILD, 0x0, 0xc, true, 600000, 12500 }, + /* Option 01 */ + { FAN53555_VENDOR_FAIRCHILD, 0x1, 0x3, true, 600000, 10000 }, + /* Option 03 */ + { FAN53555_VENDOR_FAIRCHILD, 0x3, 0x3, true, 600000, 10000 }, + /* Option 04 */ + { FAN53555_VENDOR_FAIRCHILD, 0x4, 0xf, true, 603000, 12826 }, + /* Option 05 */ + { FAN53555_VENDOR_FAIRCHILD, 0x5, 0x3, true, 600000, 10000 }, + /* Option 08 */ + { FAN53555_VENDOR_FAIRCHILD, 0x8, 0x1, true, 600000, 10000 }, + /* Option 08 */ + { FAN53555_VENDOR_FAIRCHILD, 0x8, 0xf, true, 600000, 10000 }, + /* Option 09 */ + { FAN53555_VENDOR_FAIRCHILD, 0xc, 0xf, true, 603000, 12826 }, + /* SYL82X */ + { FAN53555_VENDOR_SILERGY, 0x8, 0x0, false, 712500, 12500 }, + /* SYL83X */ + { FAN53555_VENDOR_SILERGY, 0x9, 0x0, false, 712500, 12500 }, }; /* I2C-accessible byte-sized registers */ @@ -152,10 +169,14 @@ static int fan53555_voltages_setup(struct udevice *dev) /* Init voltage range and step */ for (i = 0; i < ARRAY_SIZE(ic_types); ++i) { + if (ic_types[i].vendor != priv->vendor) + continue; + if (ic_types[i].die_id != priv->die_id) continue; - if (ic_types[i].die_rev != priv->die_rev) + if (ic_types[i].check_rev && + ic_types[i].die_rev != priv->die_rev) continue; priv->vsel_min = ic_types[i].vsel_min; @@ -193,7 +214,7 @@ static int fan53555_probe(struct udevice *dev) return ID2; /* extract vendor, die_id and die_rev */ - priv->vendor = bitfield_extract(ID1, 5, 3); + priv->vendor = dev->driver_data; priv->die_id = ID1 & GENMASK(3, 0); priv->die_rev = ID2 & GENMASK(3, 0); diff --git a/include/power/fan53555.h b/include/power/fan53555.h new file mode 100644 index 0000000000..c039f06071 --- /dev/null +++ b/include/power/fan53555.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2019 Vasily Khoruzhick + */ + +#ifndef _FAN53555_H_ +#define _FAN53555_H_ + +enum fan53555_vendor { + FAN53555_VENDOR_FAIRCHILD, + FAN53555_VENDOR_SILERGY, +}; + +#endif From c9fca5ec8849b8fa16b16cece091645e7d3aa02b Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sat, 16 Nov 2019 11:32:57 -0800 Subject: [PATCH 05/18] rockchip: i2c: don't sent stop bit after each message That's not correct and it breaks SMBUS-style reads and and writes for some chips (e.g. SYR82X/SYR83X). Stop bit should be sent only after the last message. Signed-off-by: Vasily Khoruzhick Reviewed-by: Kever Yang --- drivers/i2c/rk_i2c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c index cdd94bb05a..32b2ee8578 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -253,7 +253,6 @@ static int rk_i2c_read(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len, } i2c_exit: - rk_i2c_send_stop_bit(i2c); rk_i2c_disable(i2c); return err; @@ -332,7 +331,6 @@ static int rk_i2c_write(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len, } i2c_exit: - rk_i2c_send_stop_bit(i2c); rk_i2c_disable(i2c); return err; @@ -360,6 +358,9 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, } } + rk_i2c_send_stop_bit(i2c); + rk_i2c_disable(i2c); + return 0; } From e82692ab325088fe78beba727862c377ced0fc8b Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sun, 17 Nov 2019 10:47:36 -0800 Subject: [PATCH 06/18] power: fan53555: fix fan53555_regulator_set_value fan53555_regulator_set_value() passes its own dev to pmic_clrsetbits() instead of its parent (pmic). As result u-boot crashes when you try to set voltage on fan53555 regulator Signed-off-by: Vasily Khoruzhick Reviewed-by: Kever Yang --- drivers/power/regulator/fan53555.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c index 9c48b26216..24a9b67586 100644 --- a/drivers/power/regulator/fan53555.c +++ b/drivers/power/regulator/fan53555.c @@ -159,7 +159,7 @@ static int fan53555_regulator_set_value(struct udevice *dev, int uV) debug("%s: uV=%d; writing volume %d: %02x\n", __func__, uV, pdata->vol_reg, vol); - return pmic_clrsetbits(dev, pdata->vol_reg, GENMASK(6, 0), vol); + return pmic_clrsetbits(dev->parent, pdata->vol_reg, GENMASK(6, 0), vol); } static int fan53555_voltages_setup(struct udevice *dev) From 89e311d494c9179d7b44787ca2f2c84654b83425 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:14 +0530 Subject: [PATCH 07/18] gadget: Select USB_GADGET_MANUFACTURER for rockchip Select the gadget manufacturer as 'Rockchip' for all rockchip platform SoC's. This eventually drop the explicit defined added on supported board defconfig files. Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- configs/elgin-rv1108_defconfig | 1 - configs/evb-rk3036_defconfig | 1 - configs/evb-rk3229_defconfig | 1 - configs/evb-rk3288_defconfig | 1 - configs/evb-rk3328_defconfig | 1 - configs/evb-rv1108_defconfig | 1 - configs/firefly-rk3288_defconfig | 1 - configs/kylin-rk3036_defconfig | 1 - configs/miqi-rk3288_defconfig | 1 - configs/phycore-rk3288_defconfig | 1 - configs/popmetal-rk3288_defconfig | 1 - configs/rock2_defconfig | 1 - configs/rock64-rk3328_defconfig | 1 - configs/tinker-rk3288_defconfig | 1 - configs/tinker-s-rk3288_defconfig | 1 - configs/vyasa-rk3288_defconfig | 1 - drivers/usb/gadget/Kconfig | 1 + 17 files changed, 1 insertion(+), 16 deletions(-) diff --git a/configs/elgin-rv1108_defconfig b/configs/elgin-rv1108_defconfig index b3d8d28bea..c9d703a0f5 100644 --- a/configs/elgin-rv1108_defconfig +++ b/configs/elgin-rv1108_defconfig @@ -49,7 +49,6 @@ CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x110a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig index 5dd5f43f7c..c9882ded98 100644 --- a/configs/evb-rk3036_defconfig +++ b/configs/evb-rk3036_defconfig @@ -52,7 +52,6 @@ CONFIG_SYSRESET=y # CONFIG_SPL_SYSRESET is not set CONFIG_USB=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x310a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 11a2d01847..01675dbfcb 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -64,7 +64,6 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig index c2a78bd065..12d454b410 100644 --- a/configs/evb-rk3288_defconfig +++ b/configs/evb-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig index a59dab4853..8f97ef2c34 100644 --- a/configs/evb-rk3328_defconfig +++ b/configs/evb-rk3328_defconfig @@ -86,7 +86,6 @@ CONFIG_USB_DWC2=y CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x330a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/evb-rv1108_defconfig b/configs/evb-rv1108_defconfig index 037715cbc0..18bc6529ac 100644 --- a/configs/evb-rv1108_defconfig +++ b/configs/evb-rv1108_defconfig @@ -44,7 +44,6 @@ CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x110a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig index 65e839214c..fa3715cf7e 100644 --- a/configs/firefly-rk3288_defconfig +++ b/configs/firefly-rk3288_defconfig @@ -75,7 +75,6 @@ CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig index 1906d1d93f..4fc0c3e491 100644 --- a/configs/kylin-rk3036_defconfig +++ b/configs/kylin-rk3036_defconfig @@ -56,7 +56,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x310a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig index 30b05ecf44..c007c90a90 100644 --- a/configs/miqi-rk3288_defconfig +++ b/configs/miqi-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/phycore-rk3288_defconfig b/configs/phycore-rk3288_defconfig index d33f079dac..0329a8aa55 100644 --- a/configs/phycore-rk3288_defconfig +++ b/configs/phycore-rk3288_defconfig @@ -75,7 +75,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/popmetal-rk3288_defconfig b/configs/popmetal-rk3288_defconfig index 7642ea38b1..95a0a4b4d1 100644 --- a/configs/popmetal-rk3288_defconfig +++ b/configs/popmetal-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/rock2_defconfig b/configs/rock2_defconfig index 3723a7e0dd..b7f6646381 100644 --- a/configs/rock2_defconfig +++ b/configs/rock2_defconfig @@ -72,7 +72,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig index 021f982e68..d9a170ba26 100644 --- a/configs/rock64-rk3328_defconfig +++ b/configs/rock64-rk3328_defconfig @@ -87,7 +87,6 @@ CONFIG_USB_DWC2=y CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x330a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index 0fd1612f87..bb561fac23 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -77,7 +77,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig index c851a93f31..38cb1984d8 100644 --- a/configs/tinker-s-rk3288_defconfig +++ b/configs/tinker-s-rk3288_defconfig @@ -83,7 +83,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig index 6611080784..081e32d67d 100644 --- a/configs/vyasa-rk3288_defconfig +++ b/configs/vyasa-rk3288_defconfig @@ -69,7 +69,6 @@ CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_MANUFACTURER="Rockchip" CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 26b4d12a09..1959a390f3 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -39,6 +39,7 @@ if USB_GADGET config USB_GADGET_MANUFACTURER string "Vendor name of the USB device" default "Allwinner Technology" if ARCH_SUNXI + default "Rockchip" if ARCH_ROCKCHIP default "U-Boot" help Vendor name of the USB device emulated, reported to the host device. From 89cbceb3888b665b39967a7b9035efedf2708ad3 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:15 +0530 Subject: [PATCH 08/18] gadget: Select USB_GADGET_VENDOR_NUM for rockchip Gadget vendor number, 0x2207 is common across all platfroms supported in Rockchip SoC. So, select the same number globally, if ARCH_ROCKCHIP. This eventually drop the explicit configs defined in supported board defconfig files. Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- configs/elgin-rv1108_defconfig | 1 - configs/evb-rk3036_defconfig | 1 - configs/evb-rk3229_defconfig | 1 - configs/evb-rk3288_defconfig | 1 - configs/evb-rk3328_defconfig | 1 - configs/evb-rv1108_defconfig | 1 - configs/firefly-rk3288_defconfig | 1 - configs/kylin-rk3036_defconfig | 1 - configs/miqi-rk3288_defconfig | 1 - configs/phycore-rk3288_defconfig | 1 - configs/popmetal-rk3288_defconfig | 1 - configs/rock2_defconfig | 1 - configs/rock64-rk3328_defconfig | 1 - configs/tinker-rk3288_defconfig | 1 - configs/tinker-s-rk3288_defconfig | 1 - configs/vyasa-rk3288_defconfig | 1 - drivers/usb/gadget/Kconfig | 1 + 17 files changed, 1 insertion(+), 16 deletions(-) diff --git a/configs/elgin-rv1108_defconfig b/configs/elgin-rv1108_defconfig index c9d703a0f5..48351bb1dd 100644 --- a/configs/elgin-rv1108_defconfig +++ b/configs/elgin-rv1108_defconfig @@ -49,7 +49,6 @@ CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x110a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_ERRNO_STR=y diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig index c9882ded98..bb3e2c8f7d 100644 --- a/configs/evb-rk3036_defconfig +++ b/configs/evb-rk3036_defconfig @@ -52,7 +52,6 @@ CONFIG_SYSRESET=y # CONFIG_SPL_SYSRESET is not set CONFIG_USB=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x310a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_SPL_TINY_MEMSET=y diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 01675dbfcb..2dbf5bcca0 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -64,7 +64,6 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_TPL_TINY_MEMSET=y diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig index 12d454b410..8f2f13adae 100644 --- a/configs/evb-rk3288_defconfig +++ b/configs/evb-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_DM_VIDEO=y diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig index 8f97ef2c34..747089435d 100644 --- a/configs/evb-rk3328_defconfig +++ b/configs/evb-rk3328_defconfig @@ -86,7 +86,6 @@ CONFIG_USB_DWC2=y CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x330a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_SPL_TINY_MEMSET=y diff --git a/configs/evb-rv1108_defconfig b/configs/evb-rv1108_defconfig index 18bc6529ac..c9cad2bb4a 100644 --- a/configs/evb-rv1108_defconfig +++ b/configs/evb-rv1108_defconfig @@ -44,7 +44,6 @@ CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x110a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_ERRNO_STR=y diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig index fa3715cf7e..92eeffda01 100644 --- a/configs/firefly-rk3288_defconfig +++ b/configs/firefly-rk3288_defconfig @@ -75,7 +75,6 @@ CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig index 4fc0c3e491..08b47c84ef 100644 --- a/configs/kylin-rk3036_defconfig +++ b/configs/kylin-rk3036_defconfig @@ -56,7 +56,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x310a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig index c007c90a90..b06175958e 100644 --- a/configs/miqi-rk3288_defconfig +++ b/configs/miqi-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/phycore-rk3288_defconfig b/configs/phycore-rk3288_defconfig index 0329a8aa55..a86f689858 100644 --- a/configs/phycore-rk3288_defconfig +++ b/configs/phycore-rk3288_defconfig @@ -75,7 +75,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/popmetal-rk3288_defconfig b/configs/popmetal-rk3288_defconfig index 95a0a4b4d1..0cb67f33fe 100644 --- a/configs/popmetal-rk3288_defconfig +++ b/configs/popmetal-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/rock2_defconfig b/configs/rock2_defconfig index b7f6646381..1afb12d015 100644 --- a/configs/rock2_defconfig +++ b/configs/rock2_defconfig @@ -72,7 +72,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_DM_VIDEO=y diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig index d9a170ba26..ec13a7710a 100644 --- a/configs/rock64-rk3328_defconfig +++ b/configs/rock64-rk3328_defconfig @@ -87,7 +87,6 @@ CONFIG_USB_DWC2=y CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x330a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_SPL_TINY_MEMSET=y diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index bb561fac23..e46eb1cd91 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -77,7 +77,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig index 38cb1984d8..3acb2ac5f5 100644 --- a/configs/tinker-s-rk3288_defconfig +++ b/configs/tinker-s-rk3288_defconfig @@ -83,7 +83,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig index 081e32d67d..997d9a3877 100644 --- a/configs/vyasa-rk3288_defconfig +++ b/configs/vyasa-rk3288_defconfig @@ -69,7 +69,6 @@ CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_VENDOR_NUM=0x2207 CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_FUNCTION_MASS_STORAGE=y diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1959a390f3..844c3be16f 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -48,6 +48,7 @@ config USB_GADGET_MANUFACTURER config USB_GADGET_VENDOR_NUM hex "Vendor ID of the USB device" default 0x1f3a if ARCH_SUNXI + default 0x2207 if ARCH_ROCKCHIP default 0x0 help Vendor ID of the USB device emulated, reported to the host device. From 132b012edef93855204243d6f0a7380e11a78392 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:16 +0530 Subject: [PATCH 09/18] gadget: rockchip: USB_GADGET_PRODUCT_NUM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rockchip support differnet or common gadget product number between Rockchip SoCs like, 0x310a - rk3036 0x320a - rk3229, rk3288 0x330a - rk3328 So, select them on Kconfig based on platform specific config defined.     This eventually drop the explicit configs defined in supporting board defconfig files. Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- configs/evb-rk3036_defconfig | 1 - configs/evb-rk3229_defconfig | 1 - configs/evb-rk3288_defconfig | 1 - configs/evb-rk3328_defconfig | 1 - configs/firefly-rk3288_defconfig | 1 - configs/kylin-rk3036_defconfig | 1 - configs/miqi-rk3288_defconfig | 1 - configs/phycore-rk3288_defconfig | 1 - configs/popmetal-rk3288_defconfig | 1 - configs/rock64-rk3328_defconfig | 1 - configs/tinker-rk3288_defconfig | 1 - configs/tinker-s-rk3288_defconfig | 1 - configs/vyasa-rk3288_defconfig | 1 - drivers/usb/gadget/Kconfig | 3 +++ 14 files changed, 3 insertions(+), 13 deletions(-) diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig index bb3e2c8f7d..79e413145f 100644 --- a/configs/evb-rk3036_defconfig +++ b/configs/evb-rk3036_defconfig @@ -52,7 +52,6 @@ CONFIG_SYSRESET=y # CONFIG_SPL_SYSRESET is not set CONFIG_USB=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x310a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_SPL_TINY_MEMSET=y CONFIG_CMD_DHRYSTONE=y diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index 2dbf5bcca0..e3a9177dfb 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -64,7 +64,6 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_TPL_TINY_MEMSET=y CONFIG_ERRNO_STR=y diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig index 8f2f13adae..db7e6fa7b1 100644 --- a/configs/evb-rk3288_defconfig +++ b/configs/evb-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_DM_VIDEO=y CONFIG_DISPLAY=y diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig index 747089435d..0293546b04 100644 --- a/configs/evb-rk3328_defconfig +++ b/configs/evb-rk3328_defconfig @@ -86,7 +86,6 @@ CONFIG_USB_DWC2=y CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x330a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_SPL_TINY_MEMSET=y CONFIG_TPL_TINY_MEMSET=y diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig index 92eeffda01..6efc5735f9 100644 --- a/configs/firefly-rk3288_defconfig +++ b/configs/firefly-rk3288_defconfig @@ -75,7 +75,6 @@ CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig index 08b47c84ef..c1607e52fb 100644 --- a/configs/kylin-rk3036_defconfig +++ b/configs/kylin-rk3036_defconfig @@ -56,7 +56,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x310a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig index b06175958e..4590e38ad3 100644 --- a/configs/miqi-rk3288_defconfig +++ b/configs/miqi-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/phycore-rk3288_defconfig b/configs/phycore-rk3288_defconfig index a86f689858..51bd8adcbc 100644 --- a/configs/phycore-rk3288_defconfig +++ b/configs/phycore-rk3288_defconfig @@ -75,7 +75,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/popmetal-rk3288_defconfig b/configs/popmetal-rk3288_defconfig index 0cb67f33fe..8cc55bdbe0 100644 --- a/configs/popmetal-rk3288_defconfig +++ b/configs/popmetal-rk3288_defconfig @@ -71,7 +71,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig index ec13a7710a..0dab5d7e54 100644 --- a/configs/rock64-rk3328_defconfig +++ b/configs/rock64-rk3328_defconfig @@ -87,7 +87,6 @@ CONFIG_USB_DWC2=y CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x330a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_SPL_TINY_MEMSET=y CONFIG_TPL_TINY_MEMSET=y diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index e46eb1cd91..c350c0d8ba 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -77,7 +77,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig index 3acb2ac5f5..c016a264b2 100644 --- a/configs/tinker-s-rk3288_defconfig +++ b/configs/tinker-s-rk3288_defconfig @@ -83,7 +83,6 @@ CONFIG_USB=y CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig index 997d9a3877..32c3502683 100644 --- a/configs/vyasa-rk3288_defconfig +++ b/configs/vyasa-rk3288_defconfig @@ -69,7 +69,6 @@ CONFIG_USB_DWC2=y CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_PRODUCT_NUM=0x320a CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_FUNCTION_MASS_STORAGE=y CONFIG_USB_HOST_ETHER=y diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 844c3be16f..e120b48b33 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -58,6 +58,9 @@ config USB_GADGET_VENDOR_NUM config USB_GADGET_PRODUCT_NUM hex "Product ID of the USB device" default 0x1010 if ARCH_SUNXI + default 0x310a if ROCKCHIP_RK3036 + default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 + default 0x330a if ROCKCHIP_RK3328 default 0x0 help Product ID of the USB device emulated, reported to the host device. From b032061405ca42a94a5a0ccf1c97fcbf0f616243 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:17 +0530 Subject: [PATCH 10/18] gadget: rockchip: Add rk3128 USB_GADGET_PRODUCT_NUM Add 0x310c for rk3128 gadget product number. Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index e120b48b33..2da8b40e05 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -59,6 +59,7 @@ config USB_GADGET_PRODUCT_NUM hex "Product ID of the USB device" default 0x1010 if ARCH_SUNXI default 0x310a if ROCKCHIP_RK3036 + default 0x310c if ROCKCHIP_RK3128 default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 default 0x330a if ROCKCHIP_RK3328 default 0x0 From a9af59a30ab8e701e4247a0bc8dfe1b155ffdb8a Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:18 +0530 Subject: [PATCH 11/18] fastboot: rockchip: Select FASTBOOT_FLASH[_MMC_DEV] Select CONFIG_FASTBOOT_FLASH, CONFIG_FASTBOOT_FLASH_MMC_DEV for rockchip SoC plaforms in fastboot Kconfig file instead of defined it in board defconfig. This eventually drop the explicit configs defined in supporting board defconfig files. Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- configs/evb-rk3036_defconfig | 2 -- configs/evb-rk3128_defconfig | 2 -- configs/evb-rk3229_defconfig | 2 -- configs/evb-rk3288_defconfig | 2 -- configs/evb-rk3328_defconfig | 2 -- configs/firefly-rk3288_defconfig | 2 -- configs/kylin-rk3036_defconfig | 2 -- configs/miqi-rk3288_defconfig | 2 -- configs/phycore-rk3288_defconfig | 2 -- configs/popmetal-rk3288_defconfig | 2 -- configs/rock64-rk3328_defconfig | 2 -- configs/tinker-rk3288_defconfig | 2 -- configs/tinker-s-rk3288_defconfig | 2 -- drivers/fastboot/Kconfig | 4 +++- 14 files changed, 3 insertions(+), 27 deletions(-) diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig index 79e413145f..4bed28f102 100644 --- a/configs/evb-rk3036_defconfig +++ b/configs/evb-rk3036_defconfig @@ -35,8 +35,6 @@ CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_SPL_BLK is not set CONFIG_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/evb-rk3128_defconfig b/configs/evb-rk3128_defconfig index cb3c5372aa..bf91c642dd 100644 --- a/configs/evb-rk3128_defconfig +++ b/configs/evb-rk3128_defconfig @@ -23,8 +23,6 @@ CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_FASTBOOT_BUF_ADDR=0x60800800 CONFIG_FASTBOOT_BUF_SIZE=0x04000000 -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig index e3a9177dfb..84d29e2c44 100644 --- a/configs/evb-rk3229_defconfig +++ b/configs/evb-rk3229_defconfig @@ -44,8 +44,6 @@ CONFIG_CLK=y CONFIG_SPL_CLK=y CONFIG_TPL_CLK=y CONFIG_FASTBOOT_BUF_SIZE=0x04000000 -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig index db7e6fa7b1..833b0b6a6d 100644 --- a/configs/evb-rk3288_defconfig +++ b/configs/evb-rk3288_defconfig @@ -43,8 +43,6 @@ CONFIG_SYSCON=y CONFIG_SPL_SYSCON=y CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig index 0293546b04..74b7295e62 100644 --- a/configs/evb-rk3328_defconfig +++ b/configs/evb-rk3328_defconfig @@ -46,8 +46,6 @@ CONFIG_TPL_SYSCON=y CONFIG_CLK=y CONFIG_SPL_CLK=y CONFIG_FASTBOOT_BUF_ADDR=0x800800 -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig index 6efc5735f9..178029cc47 100644 --- a/configs/firefly-rk3288_defconfig +++ b/configs/firefly-rk3288_defconfig @@ -44,8 +44,6 @@ CONFIG_SPL_SYSCON=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig index c1607e52fb..6c13c4c080 100644 --- a/configs/kylin-rk3036_defconfig +++ b/configs/kylin-rk3036_defconfig @@ -37,8 +37,6 @@ CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_SPL_BLK is not set CONFIG_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/miqi-rk3288_defconfig b/configs/miqi-rk3288_defconfig index 4590e38ad3..488cc54203 100644 --- a/configs/miqi-rk3288_defconfig +++ b/configs/miqi-rk3288_defconfig @@ -45,8 +45,6 @@ CONFIG_SPL_SYSCON=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/phycore-rk3288_defconfig b/configs/phycore-rk3288_defconfig index 51bd8adcbc..75de1d68e5 100644 --- a/configs/phycore-rk3288_defconfig +++ b/configs/phycore-rk3288_defconfig @@ -47,8 +47,6 @@ CONFIG_SPL_SYSCON=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/popmetal-rk3288_defconfig b/configs/popmetal-rk3288_defconfig index 8cc55bdbe0..320f34bd04 100644 --- a/configs/popmetal-rk3288_defconfig +++ b/configs/popmetal-rk3288_defconfig @@ -45,8 +45,6 @@ CONFIG_SPL_SYSCON=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig index 0dab5d7e54..73ca535ff8 100644 --- a/configs/rock64-rk3328_defconfig +++ b/configs/rock64-rk3328_defconfig @@ -48,8 +48,6 @@ CONFIG_TPL_SYSCON=y CONFIG_CLK=y CONFIG_SPL_CLK=y CONFIG_FASTBOOT_BUF_ADDR=0x800800 -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index c350c0d8ba..56fcbb94d3 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -47,8 +47,6 @@ CONFIG_SPL_SYSCON=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig index c016a264b2..458e1695a2 100644 --- a/configs/tinker-s-rk3288_defconfig +++ b/configs/tinker-s-rk3288_defconfig @@ -52,8 +52,6 @@ CONFIG_SPL_SYSCON=y # CONFIG_SPL_SIMPLE_BUS is not set CONFIG_CLK=y CONFIG_SPL_CLK=y -CONFIG_FASTBOOT_FLASH=y -CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index d63ecdd27e..34864ca613 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -64,7 +64,7 @@ config FASTBOOT_USB_DEV config FASTBOOT_FLASH bool "Enable FASTBOOT FLASH command" - default y if ARCH_SUNXI + default y if ARCH_SUNXI || ARCH_ROCKCHIP depends on MMC || (NAND && CMD_MTDPARTS) select IMAGE_SPARSE help @@ -89,6 +89,8 @@ endchoice config FASTBOOT_FLASH_MMC_DEV int "Define FASTBOOT MMC FLASH default device" depends on FASTBOOT_FLASH_MMC + default 1 if ROCKCHIP_RK3328 + default 0 if ARCH_ROCKCHIP default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 help From 35172ac02f2f2bba3daf1f3d68e8e2348491239e Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:19 +0530 Subject: [PATCH 12/18] fastboot: rockchip: Fix rk3328 default mmc device Technically the default mmc device for fastboot would use eMMC if the board support for it. Rockchip platform access device 0 for eMMC so, use the same device number for rk3328. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/fastboot/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index 34864ca613..433ea0dc3b 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -89,7 +89,6 @@ endchoice config FASTBOOT_FLASH_MMC_DEV int "Define FASTBOOT MMC FLASH default device" depends on FASTBOOT_FLASH_MMC - default 1 if ROCKCHIP_RK3328 default 0 if ARCH_ROCKCHIP default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 From 6b7ebff00190649d2136b34f6feebc0dbe85bfdc Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:20 +0530 Subject: [PATCH 13/18] usb: dwc3: Add phy interface for dwc3_uboot U-Boot has two different variants of dwc3 initializations, - with dm variant gadget, so the respective dm driver would call the dwc3_init in core. - with non-dm variant gadget, so the usage board file would call dwc3_uboot_init in core. The driver probe would handle all respective gadget properties including phy interface via phy_type property and then trigger dwc3_init for dm-variant gadgets. So, to support the phy interface for non-dm variant gadgets, the better option is dwc3_uboot_init since there is no dedicated controller for non-dm variant gadgets. This patch support for adding phy interface like 8/16-bit UTMI+ code for dwc3_uboot. This change used Linux phy.h enum list, to make proper code compatibility. Cc: Marek Vasut Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Marek Vasut Reviewed-by: Kever Yang --- drivers/usb/dwc3/core.c | 27 +++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 12 ++++++++++++ include/dwc3-uboot.h | 2 ++ include/linux/usb/phy.h | 19 +++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 include/linux/usb/phy.h diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 23af60c98d..f779562de2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -613,6 +613,31 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) dwc3_gadget_run(dwc); } +static void dwc3_uboot_hsphy_mode(struct dwc3_device *dwc3_dev, + struct dwc3 *dwc) +{ + enum usb_phy_interface hsphy_mode = dwc3_dev->hsphy_mode; + u32 reg; + + /* Set dwc3 usb2 phy config */ + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); + reg |= DWC3_GUSB2PHYCFG_PHYIF; + reg &= ~DWC3_GUSB2PHYCFG_USBTRDTIM_MASK; + + switch (hsphy_mode) { + case USBPHY_INTERFACE_MODE_UTMI: + reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT; + break; + case USBPHY_INTERFACE_MODE_UTMIW: + reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_16BIT; + break; + default: + break; + } + + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); +} + #define DWC3_ALIGN_MASK (16 - 1) /** @@ -721,6 +746,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) goto err0; } + dwc3_uboot_hsphy_mode(dwc3_dev, dwc); + ret = dwc3_event_buffers_setup(dwc); if (ret) { dev_err(dwc->dev, "failed to setup event buffers\n"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index be9672266a..bff53e072b 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -162,6 +162,18 @@ /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) #define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6) +#define DWC3_GUSB2PHYCFG_PHYIF BIT(3) + +/* Global USB2 PHY Configuration Mask */ +#define DWC3_GUSB2PHYCFG_USBTRDTIM_MASK (0xf << 10) + +/* Global USB2 PHY Configuration Offset */ +#define DWC3_GUSB2PHYCFG_USBTRDTIM_OFFSET 10 + +#define DWC3_GUSB2PHYCFG_USBTRDTIM_16BIT (0x5 << \ + DWC3_GUSB2PHYCFG_USBTRDTIM_OFFSET) +#define DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT (0x9 << \ + DWC3_GUSB2PHYCFG_USBTRDTIM_OFFSET) /* Global USB3 PIPE Control Register */ #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31) diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index 9941cc37a3..3c9e204cf0 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -10,10 +10,12 @@ #define __DWC3_UBOOT_H_ #include +#include struct dwc3_device { unsigned long base; enum usb_dr_mode dr_mode; + enum usb_phy_interface hsphy_mode; u32 maximum_speed; unsigned tx_fifo_resize:1; unsigned has_lpm_erratum; diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h new file mode 100644 index 0000000000..158ca9cd85 --- /dev/null +++ b/include/linux/usb/phy.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * USB PHY defines + * + * These APIs may be used between USB controllers. USB device drivers + * (for either host or peripheral roles) don't use these calls; they + * continue to use just usb_device and usb_gadget. + */ + +#ifndef __LINUX_USB_PHY_H +#define __LINUX_USB_PHY_H + +enum usb_phy_interface { + USBPHY_INTERFACE_MODE_UNKNOWN, + USBPHY_INTERFACE_MODE_UTMI, + USBPHY_INTERFACE_MODE_UTMIW, +}; + +#endif /* __LINUX_USB_PHY_H */ From 3d3b83a5731bab26e8d822659e7d8ff906f6149a Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:21 +0530 Subject: [PATCH 14/18] gadget: rockchip: Add rk3399 USB_GADGET_PRODUCT_NUM Add 0x330c for rk3399 gadget product number. Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 2da8b40e05..58ca82d4de 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -62,6 +62,7 @@ config USB_GADGET_PRODUCT_NUM default 0x310c if ROCKCHIP_RK3128 default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 default 0x330a if ROCKCHIP_RK3328 + default 0x330c if ROCKCHIP_RK3399 default 0x0 help Product ID of the USB device emulated, reported to the host device. From c618bb00429238ab23b1607f8190bda1575ec990 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:22 +0530 Subject: [PATCH 15/18] rockchip: Setup dwc3_device (for non-dm gadgets) Setup dwc3_device structure for non-dm gadgets, which is used in rk3399 platforms. dwc3_device would have basic regbase, dr_mode, high speed and 16-bit UTMI+ etc. Cc: Marek Vasut Tested-by: Levin Du Signed-off-by: Jagan Teki Reviewed-by: Kever Yang (Fix to use CONFIG_USB_DWC3_GADGET instead of CONFIG_USB_DWC3) Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/board.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index c90eb976d0..8cd8911ad3 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -49,8 +49,10 @@ void enable_caches(void) } #endif -#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) +#if defined(CONFIG_USB_GADGET) #include + +#if defined(CONFIG_USB_GADGET_DWC2_OTG) #include static struct dwc2_plat_otg_data otg_data = { @@ -117,7 +119,33 @@ int board_usb_cleanup(int index, enum usb_init_type init) { return 0; } -#endif +#endif /* CONFIG_USB_GADGET_DWC2_OTG */ + +#if defined(CONFIG_USB_DWC3_GADGET) && !defined(CONFIG_DM_USB_GADGET) +#include + +static struct dwc3_device dwc3_device_data = { + .maximum_speed = USB_SPEED_HIGH, + .base = 0xfe800000, + .dr_mode = USB_DR_MODE_PERIPHERAL, + .index = 0, + .dis_u2_susphy_quirk = 1, + .hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW, +}; + +int usb_gadget_handle_interrupts(void) +{ + dwc3_uboot_handle_interrupt(0); + return 0; +} + +int board_usb_init(int index, enum usb_init_type init) +{ + return dwc3_uboot_init(&dwc3_device_data); +} +#endif /* CONFIG_USB_DWC3_GADGET */ + +#endif /* CONFIG_USB_GADGET */ #if CONFIG_IS_ENABLED(FASTBOOT) int fastboot_set_reboot_flag(void) From d4fba131bb8a773bf6026abef3496fed28287145 Mon Sep 17 00:00:00 2001 From: Jagan Teki Date: Tue, 19 Nov 2019 13:56:23 +0530 Subject: [PATCH 16/18] rock960: Enable USB Gadget Enable DWC3 core, gadget for rock960 board. This would help to use fastboot by default. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- configs/rock960-rk3399_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig index 979ca0f93b..d0ad6865cf 100644 --- a/configs/rock960-rk3399_defconfig +++ b/configs/rock960-rk3399_defconfig @@ -57,6 +57,8 @@ CONFIG_USB_ETHER_ASIX88179=y CONFIG_USB_ETHER_MCS7830=y CONFIG_USB_ETHER_RTL8152=y CONFIG_USB_ETHER_SMSC95XX=y +CONFIG_USB_GADGET=y +CONFIG_USB_DWC3=y CONFIG_USE_TINY_PRINTF=y CONFIG_SPL_TINY_MEMSET=y CONFIG_ERRNO_STR=y From c8dd0e42d709c9734f313c547d0707e27ca0de51 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Tue, 19 Nov 2019 12:04:01 +0100 Subject: [PATCH 17/18] rockchip: dwmmc: add handling for u-boot, spl-fifo-mode Rockchips dwmmc controllers can't do dma to non-ddr addresses, like for example the soc-internal sram but during boot parts of TrustedFirmware need to be placed there from the read FIT image. So add handling for a u-boot,spl-fifo-mode to not put the mmc controllers into fifo mode for all time. The regular fifo-mode property still takes precedent and only if not set do we check for the spl-specific property. Suggested-by: Philipp Tomsich Signed-off-by: Heiko Stuebner Reviewed-by: Kever Yang Signed-off-by: Philipp Tomsich Reviewed-by: Philipp Tomsich --- drivers/mmc/rockchip_dw_mmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index b2a1201631..a0e1be8794 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) return -EINVAL; priv->fifo_mode = dev_read_bool(dev, "fifo-mode"); +#ifdef CONFIG_SPL_BUILD + if (!priv->fifo_mode) + priv->fifo_mode = dev_read_bool(dev, "u-boot,spl-fifo-mode"); +#endif + /* * 'clock-freq-min-max' is deprecated * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b) From 8019d32c4701b95410113541deb7f28d5c2b02a5 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Tue, 19 Nov 2019 12:04:02 +0100 Subject: [PATCH 18/18] rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb As part of loading trustedfirmware, the SPL is required to place portions of code into the socs sram but the mmc controllers can only do dma transfers into the regular memory, not sram. The results of this are not directly visible in u-boot itself, but manifest as security-relate cpu aborts during boot of for example Linux. There were a number of attempts to solve this elegantly but so far discussion is still ongoing, so to make the board at least boot correctly put both mmc controllers into fifo-mode, which also circumvents the issue for now. Signed-off-by: Heiko Stuebner Reviewed-by: Kever Yang Reviewed-by: Philipp Tomsich --- arch/arm/dts/px30-evb-u-boot.dtsi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/px30-evb-u-boot.dtsi b/arch/arm/dts/px30-evb-u-boot.dtsi index 3de9c7068e..a2a2c07dcc 100644 --- a/arch/arm/dts/px30-evb-u-boot.dtsi +++ b/arch/arm/dts/px30-evb-u-boot.dtsi @@ -31,12 +31,15 @@ &sdmmc { u-boot,dm-pre-reloc; - /* temporary till I find out why dma mode doesn't work */ - fifo-mode; + /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */ + u-boot,spl-fifo-mode; }; &emmc { u-boot,dm-pre-reloc; + + /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */ + u-boot,spl-fifo-mode; }; &grf {