[U-Boot] [PATCH 06/13] usb: gadget: usb_ether: Move settings to common

Ɓukasz Majewski lukma at denx.de
Sat Sep 9 04:45:36 UTC 2017


On 09/08/2017 07:34 PM, Maxime Ripard wrote:
> The usb_ether gadget duplicates the USB settings for the manufacturer,
> product ID and vendor ID.
> 
> Make sure we use the common option so that we can expect a single VID/PID
> couple for a single device.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>

Reviewed-by: Lukasz Majewski <lukma at denx.de>

> ---
>   configs/sama5d2_ptc_nandflash_defconfig |  1 +
>   configs/sama5d2_ptc_spiflash_defconfig  |  1 +
>   configs/vinco_defconfig                 |  1 +
>   drivers/usb/gadget/ether.c              | 16 ++++++++--------
>   include/configs/ma5d4evk.h              |  1 -
>   include/configs/sama5d2_ptc.h           |  1 -
>   include/configs/vinco.h                 |  1 -
>   scripts/config_whitelist.txt            |  1 -
>   8 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/configs/sama5d2_ptc_nandflash_defconfig b/configs/sama5d2_ptc_nandflash_defconfig
> index 6672a5ce11f7..431056a50a8b 100644
> --- a/configs/sama5d2_ptc_nandflash_defconfig
> +++ b/configs/sama5d2_ptc_nandflash_defconfig
> @@ -29,5 +29,6 @@ CONFIG_USB=y
>   CONFIG_USB_EHCI_HCD=y
>   CONFIG_USB_STORAGE=y
>   CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="Atmel SAMA5D2_PTC"
>   CONFIG_USB_GADGET_ATMEL_USBA=y
>   CONFIG_USB_ETHER=y
> diff --git a/configs/sama5d2_ptc_spiflash_defconfig b/configs/sama5d2_ptc_spiflash_defconfig
> index 9a23a808f1b3..66bb671820a6 100644
> --- a/configs/sama5d2_ptc_spiflash_defconfig
> +++ b/configs/sama5d2_ptc_spiflash_defconfig
> @@ -30,5 +30,6 @@ CONFIG_USB=y
>   CONFIG_USB_EHCI_HCD=y
>   CONFIG_USB_STORAGE=y
>   CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="Atmel SAMA5D2_PTC"
>   CONFIG_USB_GADGET_ATMEL_USBA=y
>   CONFIG_USB_ETHER=y
> diff --git a/configs/vinco_defconfig b/configs/vinco_defconfig
> index b0df6b3c7805..8d7f9f99ab81 100644
> --- a/configs/vinco_defconfig
> +++ b/configs/vinco_defconfig
> @@ -33,3 +33,4 @@ CONFIG_USB_STORAGE=y
>   CONFIG_USB_GADGET=y
>   CONFIG_USB_GADGET_ATMEL_USBA=y
>   CONFIG_USB_ETHER=y
> +CONFIG_USB_GADGET_MANUFACTURER="L+G VInCo"
> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index 2cf5c8d31e25..dbb578258f96 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -273,8 +273,8 @@ static inline int BITRATE(struct usb_gadget *g)
>    * static ushort idProduct;
>    */
>   
> -#if defined(CONFIG_USBNET_MANUFACTURER)
> -static char *iManufacturer = CONFIG_USBNET_MANUFACTURER;
> +#if defined(CONFIG_USB_GADGET_MANUFACTURER)
> +static char *iManufacturer = CONFIG_USB_GADGET_MANUFACTURER;
>   #else
>   static char *iManufacturer = "U-Boot";
>   #endif
> @@ -2073,11 +2073,11 @@ static int eth_bind(struct usb_gadget *gadget)
>   	 * to choose the right configuration otherwise.
>   	 */
>   	if (rndis) {
> -#if defined(CONFIG_USB_RNDIS_VENDOR_ID) && defined(CONFIG_USB_RNDIS_PRODUCT_ID)
> +#if defined(CONFIG_USB_GADGET_VENDOR_NUM) && defined(CONFIG_USB_GADGET_PRODUCT_NUM)
>   		device_desc.idVendor =
> -			__constant_cpu_to_le16(CONFIG_USB_RNDIS_VENDOR_ID);
> +			__constant_cpu_to_le16(CONFIG_USB_GADGET_VENDOR_NUM);
>   		device_desc.idProduct =
> -			__constant_cpu_to_le16(CONFIG_USB_RNDIS_PRODUCT_ID);
> +			__constant_cpu_to_le16(CONFIG_USB_GADGET_PRODUCT_NUM);
>   #else
>   		device_desc.idVendor =
>   			__constant_cpu_to_le16(RNDIS_VENDOR_NUM);
> @@ -2092,9 +2092,9 @@ static int eth_bind(struct usb_gadget *gadget)
>   	 * supporting one submode of the "SAFE" variant of MDLM.)
>   	 */
>   	} else {
> -#if defined(CONFIG_USB_CDC_VENDOR_ID) && defined(CONFIG_USB_CDC_PRODUCT_ID)
> -		device_desc.idVendor = cpu_to_le16(CONFIG_USB_CDC_VENDOR_ID);
> -		device_desc.idProduct = cpu_to_le16(CONFIG_USB_CDC_PRODUCT_ID);
> +#if defined(CONFIG_USB_GADGET_VENDOR_NUM) && defined(CONFIG_USB_GADGET_PRODUCT_NUM)
> +		device_desc.idVendor = cpu_to_le16(CONFIG_USB_GADGET_VENDOR_NUM);
> +		device_desc.idProduct = cpu_to_le16(CONFIG_USB_GADGET_PRODUCT_NUM);
>   #else
>   		if (!cdc) {
>   			device_desc.idVendor =
> diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h
> index 6d25d84c6eb6..3aeb7e6ef136 100644
> --- a/include/configs/ma5d4evk.h
> +++ b/include/configs/ma5d4evk.h
> @@ -97,7 +97,6 @@
>   #ifdef CONFIG_CMD_USB
>   
>   /* USB device */
> -#define CONFIG_USBNET_MANUFACTURER      "AriesEmbedded"
>   #define CONFIG_USB_FUNCTION_MASS_STORAGE
>   #define CONFIG_SYS_DFU_DATA_BUF_SIZE	(1 * 1024 * 1024)
>   #define DFU_DEFAULT_POLL_TIMEOUT	300
> diff --git a/include/configs/sama5d2_ptc.h b/include/configs/sama5d2_ptc.h
> index 543592e3a574..2328c7614ed7 100644
> --- a/include/configs/sama5d2_ptc.h
> +++ b/include/configs/sama5d2_ptc.h
> @@ -60,7 +60,6 @@
>   #endif
>   
>   /* USB device */
> -#define CONFIG_USBNET_MANUFACTURER      "Atmel SAMA5D2_PTC"
>   
>   /* Ethernet Hardware */
>   #define CONFIG_MACB
> diff --git a/include/configs/vinco.h b/include/configs/vinco.h
> index d3d5dc8f7732..265da84fc0cc 100644
> --- a/include/configs/vinco.h
> +++ b/include/configs/vinco.h
> @@ -64,7 +64,6 @@
>   #endif
>   
>   /* USB device */
> -#define CONFIG_USBNET_MANUFACTURER      "L+G VInCo"
>   
>   /* Ethernet Hardware */
>   #define CONFIG_PHY_SMSC
> diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
> index c1285ce27fec..1020d6db9f8c 100644
> --- a/scripts/config_whitelist.txt
> +++ b/scripts/config_whitelist.txt
> @@ -4993,7 +4993,6 @@ CONFIG_USBD_SERIAL_OUT_PKTSIZE
>   CONFIG_USBD_VENDORID
>   CONFIG_USBID_ADDR
>   CONFIG_USBNET_DEV_ADDR
> -CONFIG_USBNET_MANUFACTURER
>   CONFIG_USBTTY
>   CONFIG_USB_AM35X
>   CONFIG_USB_ATMEL
> 


-- 
Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de


More information about the U-Boot mailing list