From patchwork Sun Jun 9 21:32:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1945584 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=tM52zrzC; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=VHiNmQDR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (unknown [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vy7XH6cS1z20KL for ; Mon, 10 Jun 2024 07:35:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 11FA0883E0; Sun, 9 Jun 2024 23:35:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=mailbox.org header.i=@mailbox.org header.b="tM52zrzC"; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="VHiNmQDR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36AE8883C9; Sun, 9 Jun 2024 23:35:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3317B87C7F for ; Sun, 9 Jun 2024 23:35:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut+renesas@mailbox.org Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Vy7Wl6cg2z9sTl; Sun, 9 Jun 2024 23:35:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1717968915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2xSVONT16PwA+a/CpLj5ZUXm7aFId6SulpytgZltXm8=; b=tM52zrzCDl46rKXRfCH2ZosaQZMOARdCKGONUyHGFzBJRF/IirI5epoRRxj47iijw7tvgZ 1e9A7IzGBhebT2a+X3M80Tl+5PfEwiiceIEBGD5yGOZMeGN+Lf2ufzodE9yfPFsF0AlLER /TPZMRJdU90XyXKPN8uqw6dETUE622r/gM7y6Nlm9tqHnhnkNQIOWIySrnhkM2h9bHUZv8 LPAqlt/zq4wf2B+gWoR23zueNNMm4fwr0iQInKIZIw65+4zC9OMxGIADL5fmC0roseYQ3m fisiWrAK0symquUZfzHf1V92yYQe6a3A3GC0Q0AAc62uGEb+hqLWlNjGv8gRXg== From: Marek Vasut DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1717968914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2xSVONT16PwA+a/CpLj5ZUXm7aFId6SulpytgZltXm8=; b=VHiNmQDR6uxSA9Z3AkqUToDsiSJTF5uvWfbv0fiFRVgtkf3mwh5/nfiz0wlV4Azi9AWknt wgtAdBntbVvO2TxRnpe6bzx9/a3stQKGBvTdDipzMTCNKsLs40man8sZ8AGUQJqE8CqNLL FUMNRWLqgOd/cJu9OhLfD0L6CSkKXiJHdulKTvIooAc95KEqPyCfWxGvQoPzoUoAizoSEr bb3x9r/O1uwGY5EfkM9Mz4HSz8j2eiz2ygZE/ZmXD2A4C5Y18z3hHQFvt4XNQQYZiDuh3L uU1kgXQUhqS72HxzjxJ/hPczbEFX4Zb3k2TKW2jiCDY6DDqEulUt8R054l2KiQ== To: u-boot@lists.denx.de Cc: Marek Vasut , Alexander Sverdlin , Felipe Balbi , Lukasz Majewski , Mattijs Korpershoek , Nishanth Menon , Simon Glass , Thinh Nguyen , Tom Rini Subject: [PATCH 2/6] usb: gadget: ether: Drop usb_gadget_controller_number() Date: Sun, 9 Jun 2024 23:32:15 +0200 Message-ID: <20240609213449.194762-2-marek.vasut+renesas@mailbox.org> In-Reply-To: <20240609213449.194762-1-marek.vasut+renesas@mailbox.org> References: <20240609213449.194762-1-marek.vasut+renesas@mailbox.org> MIME-Version: 1.0 X-MBO-RS-ID: 737371ff3f782e486fe X-MBO-RS-META: oh4rhjj1fxum78kbwd5uqr91uue6wc3e X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The bcdDevice field is defined as |Device release number in binary-coded decimal in the USB 2.0 specification. We use this field to distinguish the UDCs from each other. In theory this could be used on the host side to apply certain quirks if the "special" UDC in combination with this gadget is used. This hasn't been done as far as I am aware. In practice it would be better to fix the UDC driver before shipping since a later release might not need this quirk anymore. This patch converts this gadget to use the U-Boot version instead of a random 2 or 3 plus the UDC number. Linux stopped using this functionality in 2012, remove it from U-Boot as well. Matching Linux kernel commit: ed9cbda63d45 ("usb: gadget: remove usb_gadget_controller_number()") Signed-off-by: Marek Vasut Reviewed-by: Mattijs Korpershoek Tested-by: Mattijs Korpershoek # on vim3 --- Cc: Alexander Sverdlin Cc: Felipe Balbi Cc: Lukasz Majewski Cc: Mattijs Korpershoek Cc: Nishanth Menon Cc: Simon Glass Cc: Thinh Nguyen Cc: Tom Rini Cc: u-boot@lists.denx.de --- drivers/usb/gadget/ether.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index b8b29d399b1..e76464e121b 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -22,8 +22,8 @@ #include #include #include +#include -#include "gadget_chips.h" #include "rndis.h" #include @@ -1998,19 +1998,8 @@ static int eth_bind(struct usb_gadget *gadget) rndis = 0; } - gcnum = usb_gadget_controller_number(gadget); - if (gcnum >= 0) - device_desc.bcdDevice = cpu_to_le16(0x0300 + gcnum); - else { - /* - * can't assume CDC works. don't want to default to - * anything less functional on CDC-capable hardware, - * so we fail in this case. - */ - pr_err("controller '%s' not recognized", - gadget->name); - return -ENODEV; - } + gcnum = (U_BOOT_VERSION_NUM << 4) | U_BOOT_VERSION_NUM_PATCH; + device_desc.bcdDevice = cpu_to_le16(gcnum); /* * If there's an RNDIS configuration, that's what Windows wants to