Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7084606A31C for ; Mon, 30 Nov 2026 14:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=j8QgeiBo; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=YxtL2SVz Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E265040535; Mon, 30 Nov 2026 14:04:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id o8h-mH6sn4hq; Mon, 30 Nov 2026 14:04:28 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org A037140346 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796047468; b=LEbqeAgAkybR/M2uf9cGVOPn+1D4W+RpDCfmx1qVc7EttYaOkS5ZD4aRMb1aaC7O0Bak YmJeARuIipQ3GSNGqNbY0Z76H0XcHiK6pZj1id1Rs/3wH1mU0h80zHdWiY6xvag4Jfq+/ L7f+XH3O1A8jFGvH6YR6XEn0M4ncu5nxh638Hpff8qVzcsMQxOuszqZ0NVuze1W6vE1Gn Z8GmK90wExOrGCEIbnlqYxqlDkIzYYjzCQIWtvbpmgKC6yuS6ofJkMu9JI9mUGjvYzmzg aGHbkJ21A0dKbhHXIXiFRCkci8ogJ+t/4DeNNlOKtmPg5itnCZRhKFguMmKM0L/dNPg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796047468; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:X-Comment:Received:Received: Received:Received:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type: X-Last-TLS-Session-Version:X-Virus-Scanned:X-Virus-Status:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Errors-To; bh=meArlAwdCfOd/pBFc1pVS+HLUNRwOOdQ5pCJ2O71CX8=; b=jnQMwE1RQn5PU+mkG9l+Zwfd7Q39uRV8EmH7qAuoBRUZNePKW0i2b9ZQeTkm0lBKk/IW HNWsocZ8yDKoJppzTktDAxFqY/or94hr/+QXAYlZHEV0EE+2hbu/YtWXZN8OJnCHNBSQh dJ3ugoZjIcqTCVhgwYRSBzsHLY+jBbMF3cYoPYdWjADdDirQK5yTRBe54FTU+eYHW418n web/VED5t46K/Po0iI9fHIWEpo+C3D7+i8FoPjWxN+gNa3BGcMnOIYoZfBUlHT1OXc/lc +Zf6DMPI6rlBRYgMyKFrEiueG1xPkH4X87WLRYY3rWofdyrMDmrLr7CKYr/WyY+G1CQ== ARC-Authentication-Results: i=1; smtp4.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1796047468; bh=meArlAwdCfOd/pBFc1pVS+HLUNRwOOdQ5pCJ2O71CX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=j8QgeiBoBRnIQfQRYUAGiK2ZIcskpsHpkjvsY7hC8Ox33+utANe6O64bnxA3hRzuf Aw9ZpaOU4Uz++Xzy+eSDy1OlJs2w4+56iGuoqCg5kddjwXolPOsUpny+PRNwvybbVn XCOB/ez7DrusgwcxUb0HHnE6BG/juGEVp51SPGCD8RsZFhqMIoJke/csymOf9e2PGS dZOdgt/szDhbqUFZbC3lvaOB2XXVbAqHKk6cIJZVj9oNXBF8uCg0LTJ9DFzbXAztaO RI/+UfooBuSntmNNW7FjEd9UDnw3d02wWLHPspESZYfjuTuRI0oRvQX+oPL0gdn1lv nzvYWDMCVFbgg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id A037140346; Mon, 30 Nov 2026 14:04:28 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists1.osuosl.org (Postfix) with ESMTP id BBA323C0 for ; Mon, 30 Nov 2026 14:04:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AD0FC40180 for ; Mon, 30 Nov 2026 14:04:27 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8tBr5xP62eih for ; Mon, 30 Nov 2026 14:04:26 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp2.osuosl.org CF78840063 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip=85.214.62.61 X-Comment: SPF check N/A for local connections - client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=romain.gantois@bootlin.com; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp2.osuosl.org; spf=fail smtp.mailfrom=bootlin.com Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=YxtL2SVz Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by smtp2.osuosl.org (Postfix) with ESMTPS id CF78840063 for ; Mon, 30 Nov 2026 14:04:23 +0000 (UTC) Received: by phobos.denx.de (Postfix, from userid 109) id C0E2D847EC; Mon, 30 Nov 2026 15:04:21 +0100 (CET) Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 71CD383FEE for ; Mon, 30 Nov 2026 15:04:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=romain.gantois@bootlin.com Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 9EA16C2AC68; Mon, 30 Nov 2026 14:04:23 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5167D6007C; Mon, 30 Nov 2026 14:04:13 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7701111EA056C; Mon, 30 Nov 2026 15:04:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796047451; h=from:subject:date:message-id:to:cc:mime-version:content-type: in-reply-to:references; bh=meArlAwdCfOd/pBFc1pVS+HLUNRwOOdQ5pCJ2O71CX8=; b=YxtL2SVzs1fJxyk4BYwMAAoEyDJm8UOPofVCjiTmM8o89kEjHwMZT6LATLZtnsHcggnqkK NeHq25iyQvv35HwWZy+hE2UApsucba+9vEkB3zoKyQg+Gc0XDP/FHsT0ZYKUeNgH5Calkr YOEGgOD38lXuWwRNR0aLDvkQZ24MH47ewSLFbypVTYr/NkWJh+c0jvoN/aZWCRt6/t9UPE K5r2JhnTn/iWtpZitwrOTlrq56VVgnTePw6UW+KectfWdryr8qmk3xeH5DIgnHbUBLEY2O a6q/NVc7+ZjG9JGjaUpZw8afdGgsFA+47awAwLA0rNuWC1CHzOJEnwZ49JGlRA== From: Romain Gantois To: u-boot@lists.denx.de, Mattijs Korpershoek Cc: Thomas Petazzoni , Tom Rini , Lukasz Majewski , Marek Vasut , Nobuhiro Iwamatsu , Quentin Schulz , Kever Yang , Peter Robinson , Jonas Karlman , George Chan , Balaji Selvanathan , Herve Codina , Neil Armstrong , Ralph Siemsen , Simon Glass , Peng Fan , Kory Maincent , Ilias Apalodimas , Kuan-Wei Chiu , Raymond Mao , Stefan Roese , Philip Molloy , Jerome Forissier , David Lechner , Julien Stephan , Johan Jonker , Bastien Curutchet Subject: Re: [PATCH v3 2/2] usb: gadget: Add Renesas RZ/N1 USBF controller support Date: Mon, 30 Nov 2026 15:04:01 +0100 Message-ID: In-Reply-To: <875x0yo0w2.fsf@kernel.org> References: <20260723-rzn1-usbf-v3-0-34dd7c4ddd99@bootlin.com> <875x0yo0w2.fsf@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPartepPHnR1dSj2Qw01k3at_ww"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Last-TLS-Session-Version: TLSv1.3 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 --nextPartepPHnR1dSj2Qw01k3at_ww Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Romain Gantois To: u-boot@lists.denx.de, Mattijs Korpershoek Date: Mon, 30 Nov 2026 15:04:01 +0100 Message-ID: In-Reply-To: <875x0yo0w2.fsf@kernel.org> MIME-Version: 1.0 Hi Mattijs, On Tuesday, 25 August 2026 14:11:41 CET Mattijs Korpershoek wrote: ... > > > >> > +static void usbf_ahb_epc_irq(struct usbf_udc *udc) > >> > +{ > >> > + unsigned long flags; > >> > + struct usbf_ep *epn; > >> > + u32 sysbint, sysben; > >> > + void (*ep_action)(struct usbf_ep *epn); > >> > + int i; > >> > + > >> > + spin_lock_irqsave(&udc->lock, flags); > >> > + > >> > + /* Read and ack interrupts */ > >> > + sysbint = usbf_reg_readl(udc, USBF_REG_AHBBINT); > >> > + sysben = usbf_reg_readl(udc, USBF_REG_AHBBINTEN); > >> > + sysbint &= sysben; > >> > >> In the linux driver, we don't read USBF_REG_AHBBINTEN. Can you explain > >> why this is needed here? > > > > This is due to the fact that U-Boot calls this handler in a polling > > manner. In Linux, when we disable bridge interrupts e.g. during DMA > > transfer operations, we can be sure that the handler won't get called, > > since the AHBBINTEN register masks interrupts. > > > > However in U-Boot, the contents of AHBBINTEN do not prevent the handler > > from being called since we're continuously calling it in polling mode. > > We've actually ran into bugs because of this while testing initial > > versions of the driver port. Therefore, we mask AHBBINT with the contents > > of AHBBINTEN to prevent bridge events from being serviced when we don't > > want them to. > Ok, since this is a deliberate (and necessary) change because we operate > in polling mode, can we please document this in a comment in the driver? > That will make it more clear when others read/diff the code against linux. > ACK, I'll add a comment in v4. > >> > + usbf_reg_writel(udc, USBF_REG_AHBBINT, sysbint); > >> > + > >> > + if ((sysbint & USBF_SYS_VBUS_INT) == USBF_SYS_VBUS_INT) { > >> > + if (usbf_reg_readl(udc, USBF_REG_EPCTR) & USBF_SYS_VBUS_LEVEL) > > > > { > > > >> > + g_dnl_clear_detach(); > >> > >> Why do we need to depend on g_dnl_*() ? > >> This is the only gadget driver that does this. It seems wrong (g_dnl* is > >> usually called from higher up (in u-boot commands or function drivers) > > > > The purpose of this is to signal to function drivers that the VBUS status > > has changed (presumably because of a cable removal) and that they should > > stop polling the UDC interrupt handler and exit cleanly. This seems like > > a correct use of this mechanism to me, but indeed I don't know why other > > UDC drivers don't use it this way. > > I see. Why can't we implement the .vbus_session operation then? > See at91_udc.c for example. I'll have a look, thanks for the tip! Thanks, -- Romain Gantois, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --nextPartepPHnR1dSj2Qw01k3at_ww Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETFOGm0tqZfYwVxBymGofZEoxB4MFAmsNglEACgkQmGofZEox B4NLzg//TDN3RdXGpW+zoV3TqXEyi0mirf0Rg4wVMDqVq1YyPUMI1PKscOGDdazy haik/4l2JyVvRi6ZUq9ZE4ERfFvYIJg9tgmTG1bO0/jiiSbKH3A0gRNn3mR9up3s ByR0e0nflD3FJWvW1mfDzhUbNOMsUA9dZun1l0ysapqNAy+iL1V7VailS3KDAtl+ w1vtHYorZzbqRY5llqvqBm3+JEEx1XA3n8l7fZLxhIwqSjghgMfvGrxU+GVaP6Yh EHpxC4OAzEPxUGPBbF88+Lb1MYcoMcxLqL8ndG4wcsJR/V4zEzb6JGnOECkfGHJX OjcvNbkBHKKZrX0PHopiXmT/gom/fa0nqaNXm9FCZC8F7cRZwJ0tn7nVpZ/Ip0W3 Dnyf1k6Am54yQp1p3rMKTT0AR47iNfqmdWwn6IZ/mwRW/JcuojGK9NhofmRa6c3S 0IBR22BkiUTsgORz1AWfPZ/siC7UU36/dyyC80G4WGntwQAXqERKBOLxe2VuxqFn mLetCAhkkwoA+WkRK/PreFvBjDN4gsNRBoZIAM2E6hUPCKMGzR8iraTc4fHZw684 5p+WgNyoNVpc1TuHD9dXA3Jb/k97IxmuMDjJ4noab6rTfoDZDJgXh6FkAHYlHoDz I89/qmVDCl2VPM4s7LCIVl2WvRZItR95Zm5LnQ4BCxJeDGOB1O4= =+oH/ -----END PGP SIGNATURE----- --nextPartepPHnR1dSj2Qw01k3at_ww--