From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32104C46467 for ; Wed, 11 Jan 2023 08:13:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 62618851CF; Wed, 11 Jan 2023 09:13:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com 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; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="l5bVldaQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 699C884A16; Wed, 11 Jan 2023 09:13:22 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9509A856E9 for ; Wed, 11 Jan 2023 09:13:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mkorpershoek@baylibre.com Received: by mail-wr1-x42a.google.com with SMTP id d17so14224606wrs.2 for ; Wed, 11 Jan 2023 00:13:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=eJ2H7oKtevuBgVmrPYAGXxGYv3n/xBsfiqz9pdkpTyg=; b=l5bVldaQyqkSzKsiGX6XZsBXYOQMV7C1r+UZY/MaTn2m1amuxUV9kdEr2/BCT/AwKX jFGh7HVArqt3SR3rsdtGKSeQLcHapihoCSYoPY57Crhk4s9+TQHudZehpnsarOmzrBYg wyAduN5zUDvwp/qdOtlrVuAyGxV4haugWaEL1eA/SBFe3Shxfo5E1kKTkiq63H0H+9Wx m77BuXCDzlncLxJY5ynNIzYicu1r+GoVlwYwHL+2r/n+5TkzVCVbxAw8GRYsKbJwnkR3 Fbdd8Y6GuB1wkp3PGs1JA+24dBzto09ffDCZoTPeZVDKZokp6am2Az+F4DW8KYDkxJmr tc8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eJ2H7oKtevuBgVmrPYAGXxGYv3n/xBsfiqz9pdkpTyg=; b=CzG35A0yllT+Hr1oFm1gIAAP5es5cHIKFZEK/+mIWO80thv+p+K01uJJD8gldF6PwB QxEGuWYcO0y3OPkq/DenIAi3WCyqMHMCGjY4yaoIiYbILRBHCugVFYjcNV93SFYbs5hj fA4Od+wBoQa11WM0M5eCvfRLbZgazHQHPZWB90q3aZ74r3UuTUvA2PRg98uqnI09Yw20 ntbo54es+mR8ax6EoUy2i5qEA2S5iJCk7BoTbyMmwXDhiagQNXskvcC9C3BiPrytAdwV pGnwDei68C4uYeX38jxqpn0lHwfFb6DIprbhmiTGGTa+oKuXBqMxVT48YSwk7ZcIwoXH OFag== X-Gm-Message-State: AFqh2koO+1XW7642bAojUpqqtOUwolCpYiTvU7fVKNQVvF5F654wMI0F rtg/w1zxOnt2vZgg1qgmVb5ofg== X-Google-Smtp-Source: AMrXdXtxJQMsAT0VLTqGqTo6N66LtHS2SBWV2yHLVUiinA1L737Jufn0cfjARR/zcPmQVclwa5fTSQ== X-Received: by 2002:a05:6000:1c05:b0:261:d8be:3046 with SMTP id ba5-20020a0560001c0500b00261d8be3046mr48386159wrb.0.1673424797092; Wed, 11 Jan 2023 00:13:17 -0800 (PST) Received: from localhost ([2a01:cb19:85e6:1900:2bf7:7388:731d:c4e1]) by smtp.gmail.com with ESMTPSA id w6-20020adfd4c6000000b0027cb20605e3sm12934745wrk.105.2023.01.11.00.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 00:13:16 -0800 (PST) From: Mattijs Korpershoek To: Marek Vasut , Lukasz Majewski Cc: Harald Seiler , Dario Binacchi , Michael Trimarchi , u-boot@lists.denx.de Subject: Re: [PATCH v2] usb: gadget: dwc2_udc_otg: implement pullup() In-Reply-To: <9f66db6e-8c31-2f69-9ae1-667ca54c7bc4@denx.de> References: <20230110-dwc2-pullup-v2-1-d4c0e75a939d@baylibre.com> <9f66db6e-8c31-2f69-9ae1-667ca54c7bc4@denx.de> Date: Wed, 11 Jan 2023 09:13:15 +0100 Message-ID: <87wn5t7alg.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain 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.6 at phobos.denx.de X-Virus-Status: Clean On Tue, Jan 10, 2023 at 18:23, Marek Vasut wrote: > On 1/10/23 17:29, Mattijs Korpershoek wrote: > > [...] > >> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c >> index 77988f78ab30..d0a9be49ad9c 100644 >> --- a/drivers/usb/gadget/dwc2_udc_otg.c >> +++ b/drivers/usb/gadget/dwc2_udc_otg.c >> @@ -236,6 +236,14 @@ static int udc_enable(struct dwc2_udc *dev) >> return 0; >> } >> >> +static int dwc2_gadget_pullup(struct usb_gadget *g, int is_on) >> +{ >> + clrsetbits_le32(®->dctl, SOFT_DISCONNECT, >> + (!is_on) << SOFT_DISCONNECT_BIT); > > Use > > is_on ? 0 : SOFT_DISCONNECT > > and you get rid of SOFT_DISCONNECT_BIT macro and the extra parenthesis > around (!is_on) which are not needed. Will do. thank you for your patience and your good advice !