[v2,03/10] gadget: rockchip: USB_GADGET_PRODUCT_NUM

Message ID 20191119082623.6165-4-jagan@amarulasolutions.com
State New
Headers show
Series
  • rockchip: rk3399: Add fastboot support
Related show

Commit Message

Jagan Teki Nov. 19, 2019, 8:26 a.m. UTC
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 <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 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(-)

Comments

Kever Yang Nov. 23, 2019, 2:20 p.m. UTC | #1
On 2019/11/19 下午4:26, Jagan Teki wrote:
> 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 <djw@t-chip.com.cn>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   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 7bf26f7497..8d7d11c3e8 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.

Patch

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 7bf26f7497..8d7d11c3e8 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.