From patchwork Sat Nov 26 22:30:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 1709363 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kemnade.info header.i=@kemnade.info header.a=rsa-sha256 header.s=20220719 header.b=pMHE9CsT; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NKqMF0Jpkz23nJ for ; Mon, 28 Nov 2022 00:34:17 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 701E884D54; Sun, 27 Nov 2022 14:33:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kemnade.info header.i=@kemnade.info header.b="pMHE9CsT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A912985215; Sat, 26 Nov 2022 23:30:26 +0100 (CET) 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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9C241851AF for ; Sat, 26 Nov 2022 23:30:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andreas@kemnade.info DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QaBUMFnh1aLaVk2zPBIWyZXkXzZ/5KIlSfJTjptWibU=; b=pMHE9CsTLY2rxhH/iWp5fqxHI8 Gfq7uNUgOJ+Zp5WTQqBHqywoqt/CFlZlmqtvOv8ugu9toFmoJtJdfJ7E84BJuX5VQ5tQCO47X52Bh +aIP4+WfBbe0do1fu4VD7yMTiRaW4xYKkuSC7IABLhEZeARjq0JqwQKpG+wXVgeo1EfOm0DaGx4vD ipWr3apGLhs8neAC1YahDzZ8mq+FR0HvGY8tIAQPxQ5WRjuaQdhd1AlR+a3XQgaPqqO2GM1m66cJ6 hK63Plj8pAFsh16Ym+bfizYekxXFLHEDaHldKnDKQ4lPggHgmGzNSUdzfUvjS4+6JdXGkoRJnG/Vx QUGMGLVA==; Received: from p200300ccff3327001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff33:2700:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1oz3gm-000886-78; Sat, 26 Nov 2022 23:30:24 +0100 Received: from andi by aktux with local (Exim 4.94.2) (envelope-from ) id 1oz3gl-00DvRV-C7; Sat, 26 Nov 2022 23:30:23 +0100 From: Andreas Kemnade To: marex@denx.de, andreas@kemnade.info, u-boot@lists.denx.de, t-kristo@ti.com, kristo@kernel.org, tony@atomide.com Subject: [PATCH 1/2] omap4: make musb probeable by simple bus Date: Sat, 26 Nov 2022 23:30:09 +0100 Message-Id: <20221126223010.3319020-2-andreas@kemnade.info> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126223010.3319020-1-andreas@kemnade.info> References: <20221126223010.3319020-1-andreas@kemnade.info> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 27 Nov 2022 14:33:56 +0100 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 Like other peripherals important for booting, do not rely on ti-sysc compatibility alone Signed-off-by: Andreas Kemnade --- arch/arm/dts/omap4-u-boot.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/dts/omap4-u-boot.dtsi b/arch/arm/dts/omap4-u-boot.dtsi index e33b3722e1..49e388caa5 100644 --- a/arch/arm/dts/omap4-u-boot.dtsi +++ b/arch/arm/dts/omap4-u-boot.dtsi @@ -17,6 +17,14 @@ compatible = "simple-bus"; }; }; + + segment@80000 { + /* USB OTG */ + target-module@2b000 { + compatible = "simple-bus"; + }; + }; + }; &l4_per { From patchwork Sat Nov 26 22:30:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 1709364 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kemnade.info header.i=@kemnade.info header.a=rsa-sha256 header.s=20220719 header.b=opWjcs2D; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NKqMR4Mh0z23nJ for ; Mon, 28 Nov 2022 00:34:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 358D584E3B; Sun, 27 Nov 2022 14:34:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kemnade.info header.i=@kemnade.info header.b="opWjcs2D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D6C28517E; Sat, 26 Nov 2022 23:30:28 +0100 (CET) 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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 54BD7850C3 for ; Sat, 26 Nov 2022 23:30:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andreas@kemnade.info DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PQxiWAa+3CywLooBZ2tioqd0/j2fVkJPWwfg3jhysVs=; b=opWjcs2DvS3jTJ6EH9EYr3eUE+ 1gZFggZDlgQzWH1V0Wjo7/7W/YE7aioOD8SsAOtJ59yomFUU82vxbO4CWWylFN2rNxpVeLtpYkMf7 Wt8I2E9fB5Hbj/l0dwOwOZz/Ce8g6PtMApqi7zePn+eofXrneUxFm2arIG7sMT0JsuARKDQyNYa8h soBstLioF84Lj4kFKtbyInwGJRwRiY9kBm9drKb3OjGmeEjSGBBlaOZwjLV9YncopxC7XJFe1FZTF xN7ehWlMOhPXbicvYGy31lfSScDiN9IgLa0J2+I0kEl6vb4kKCrxU00/R+b8xNQLGuKfvTOMqCAl7 OdyRNviQ==; Received: from p200300ccff3327001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff33:2700:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1oz3gn-00088Z-V3; Sat, 26 Nov 2022 23:30:26 +0100 Received: from andi by aktux with local (Exim 4.94.2) (envelope-from ) id 1oz3gn-00DvRZ-4g; Sat, 26 Nov 2022 23:30:25 +0100 From: Andreas Kemnade To: marex@denx.de, andreas@kemnade.info, u-boot@lists.denx.de, t-kristo@ti.com, kristo@kernel.org, tony@atomide.com Subject: [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode Date: Sat, 26 Nov 2022 23:30:10 +0100 Message-Id: <20221126223010.3319020-3-andreas@kemnade.info> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126223010.3319020-1-andreas@kemnade.info> References: <20221126223010.3319020-1-andreas@kemnade.info> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 27 Nov 2022 14:33:56 +0100 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 Host mode structures were accessed but not initialized and gadget dm did not compile at all. Signed-off-by: Andreas Kemnade --- drivers/usb/musb-new/omap2430.c | 42 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index 7d15b94a6c..607592a1d0 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -46,6 +46,13 @@ static inline void omap2430_low_level_init(struct musb *musb) musb_writel(musb->mregs, OTG_FORCESTDBY, l); } +int dm_usb_gadget_handle_interrupts(struct udevice *dev) +{ + struct musb_host_data *host = dev_get_priv(dev); + + host->host->isr(0, host->host); + return 0; +} static int omap2430_musb_init(struct musb *musb) { @@ -214,37 +221,38 @@ static int omap2430_musb_of_to_plat(struct udevice *dev) static int omap2430_musb_probe(struct udevice *dev) { -#ifdef CONFIG_USB_MUSB_HOST struct musb_host_data *host = dev_get_priv(dev); -#else - struct musb *musbp; -#endif + struct omap2430_musb_plat *plat = dev_get_plat(dev); - struct usb_bus_priv *priv = dev_get_uclass_priv(dev); struct omap_musb_board_data *otg_board_data; int ret = 0; void *base = dev_read_addr_ptr(dev); - priv->desc_before_addr = true; otg_board_data = &plat->otg_board_data; -#ifdef CONFIG_USB_MUSB_HOST + if (IS_ENABLED(CONFIG_USB_MUSB_HOST)) { + struct usb_bus_priv *priv = dev_get_uclass_priv(dev); + + priv->desc_before_addr = true; + host->host = musb_init_controller(&plat->plat, + (struct device *)otg_board_data, + plat->base); + if (!host->host) + return -EIO; + + return musb_lowlevel_init(host); + } + + /* OTG still not supported, so forcing peripheral */ + plat->plat.mode = MUSB_PERIPHERAL; host->host = musb_init_controller(&plat->plat, (struct device *)otg_board_data, plat->base); - if (!host->host) { + if (!host->host) return -EIO; - } - ret = musb_lowlevel_init(host); -#else - musbp = musb_register(&plat->plat, (struct device *)otg_board_data, - plat->base); - if (IS_ERR_OR_NULL(musbp)) - return -EINVAL; -#endif - return ret; + return usb_add_gadget_udc((struct device *)otg_board_data, &host->host->g); } static int omap2430_musb_remove(struct udevice *dev)