From patchwork Tue Jan 30 14:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768065 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1384924wro; Tue, 30 Jan 2024 06:05:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxyUnzDdq3ZfQYHNTiOCLctC08NamY79NyNkpd/25Bf7RXgbNYmK5Fg6BHI+9UT+iTA9Rv X-Received: by 2002:a5d:4a89:0:b0:33a:e559:5357 with SMTP id o9-20020a5d4a89000000b0033ae5595357mr1839823wrq.28.1706623535212; Tue, 30 Jan 2024 06:05:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706623535; cv=none; d=google.com; s=arc-20160816; b=1C8IrlZBQA1eOHndmWJ3KxapVfG5G+BjOfwDYPAR2o4itDeChecdHc6yP0W8tO1Cbd CnQ2zoQlRVT6kdjjx+nXFGEuJHegyrkty84XkMDqvrhn3kXztVPo6Hus4CI7PhtqVXVH Ym8pX9u/I945apczEOC+6YKldt5NIf/ygcP2AMxlZUbdKEdo0rCa/F2QZ2VOW7nkEdoR y+tB8jixdYxrRB85rDRkr0T+j8TBpHehU79846GGFfp2ufmrfmkz/fOYebTvD1Z6EoWH i6ZJMRy8TLt8jAXlJpM3UJRNzE84SRcbg1/4I5VAqrzRZ4km5jGn+SaoZIdyASUSf3YI Hk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=EVXtAJt0RWPFPqCspXGKKXYX/CTnEDPhz3G28EzFNWY=; fh=GB9E9KzRIiNXhkRWIZbZpSMjbCjxnqnvE8nYuQxq8UI=; b=urAh6hqg4DeDem30QDwXCi3llpvh76Z+cYlKrlUwSnQUS2B2vvDKcIzoA1IQMo1rbd sG70ID3ZFBNo9c+9MA1aHZDIVLpAoh3s6skZVAbkbmTX3OntWVqNzROUqQJ9uXOKiYut TcI33nQQFNeS04WCum0ToUW1e0Z2XVNszFrh2kiTPezvyuQnmttosmvaLE0hLsHOB/wt KmrP1BabykOlqM2EfdPBEfB6iZEoXpokpOcbqnZ0S5EQ3FnzG/x1t/p3wofpOtcmg4Hl 9Y7TC3r0V6OgNLzoiatr4vlzrNoErN3ImREs6m2vOyflUTsFAcn6ckUGp6A0JtQ16W+T 89sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VbhMKu6f; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id f3-20020a5d6643000000b0033ae6e47d98si3666269wrw.1031.2024.01.30.06.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:05:35 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VbhMKu6f; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0971C87DE1; Tue, 30 Jan 2024 15:05:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VbhMKu6f"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F35A787D07; Tue, 30 Jan 2024 15:05:15 +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, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 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 3E02987DD9 for ; Tue, 30 Jan 2024 15:05:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3394bec856fso2883152f8f.0 for ; Tue, 30 Jan 2024 06:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706623510; x=1707228310; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EVXtAJt0RWPFPqCspXGKKXYX/CTnEDPhz3G28EzFNWY=; b=VbhMKu6fAzmVRVfeq7Orh8vVRLfow57d4tJd+F1eEyF8p/2PnrxoFmaa2yHtiOvAc2 uqKNQYhsUz9QIhQ5H3Uh2nJ8hmOqRoQYgxdUG2mpzSLzcy+24u25Z8Bvo4qH+ebbLkfN bPuGIAtIVxl1JWK38HAnHHxVneR4Ux+j0mo1gWdiGnKIRiRtJInSU/98l2Bh7iiYpOAf WzKf/uUVX4jY641GC+GuHwPFFwjnkoXQn1sYFcTPJUDx85rZ5PJxfibl3odH2KCoFgUV WfT/htE7WT5/36yjKj+b9CEKT+ng124Lktvg+fLPM0AFb6I23H8UDhKOWES5+M9ZWQ9N SCCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706623510; x=1707228310; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EVXtAJt0RWPFPqCspXGKKXYX/CTnEDPhz3G28EzFNWY=; b=Jal8fbns7VPOy0nWtBYBYRlFFIPcmK2eeXkIdhHCMu8I0D0f+H0ocDq72CJefZyqLn RGixyOs70CPLZo7dA620sKZkRAWp0nr2QmlTaZ7E4ONjQElaF23tMhr2qVZXH6z1yD3c hmHz7+MaexZdqOFVPqLoHA/XsBnQZvroPQ/IHiVBylBuAyNaYzdEIkffjgWgGPyrlCfx K7z3dxaRbiO5DaxMHQ2gqdJpC0+VrcySSK/+e3grP8kzGVekEAsQ7+8a5vJ7Xyt35Rpk dwMUMsCTwM5Ql4fUlVyDWWZYhPrrAuRyXHUXWMdqPQBjZ8Yu/tu+0AuaRm02+Hn4j7wj pDGA== X-Gm-Message-State: AOJu0YxK31h/11BgYvfgLcA9kgATppT9ke2v2jQcxDsZavLXKRBSXpBh aeQ0ZbZJ9reO14JXiHz0HmHG6qK67qCcvRq4eBcBwbuaKa256E+Q3urTgGv+9lg= X-Received: by 2002:adf:f851:0:b0:338:ba2:46c7 with SMTP id d17-20020adff851000000b003380ba246c7mr1515193wrq.25.1706623510625; Tue, 30 Jan 2024 06:05:10 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b0040f035bebfcsm1799017wmo.12.2024.01.30.06.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:05:10 -0800 (PST) From: Caleb Connolly Date: Tue, 30 Jan 2024 14:04:50 +0000 Subject: [PATCH v3 02/36] usb: dwc3-generic: support external vbus regulator MIME-Version: 1.0 Message-Id: <20240130-b4-qcom-common-target-v3-2-e523cbf9e556@linaro.org> References: <20240130-b4-qcom-common-target-v3-0-e523cbf9e556@linaro.org> In-Reply-To: <20240130-b4-qcom-common-target-v3-0-e523cbf9e556@linaro.org> To: Neil Armstrong , Sumit Garg , Ramon Fried , Dzmitry Sankouski , Caleb Connolly , Peng Fan , Jaehoon Chung , Rayagonda Kokatanur , Lukasz Majewski , Sean Anderson , Jorge Ramirez-Ortiz , Stephan Gerhold Cc: Marek Vasut , u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1815; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=7kDelKlGUqK6+fQsLaAztxpo9tkTDfdhIho8Tum7TpM=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSdTPz60Wyvo9yef1V0qXhoLepY8Wph9KXQp7en6S3s8 foxq2VvRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZhI5SlGhr7yrk9blbVM0x9M VtgxjyMh0nNP7DJTsz0xKd82Vm9+zsfwz2b+lF2xMQcDxN/JLnGPjrlwak6vZpNkPnf09yLWi2d f3AAA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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 Add support for a vbus-supply regulator specified in devicetree. This provides generic support to avoid hardcoded GPIO configuration in board init code. Reviewed-by: Neil Armstrong Signed-off-by: Caleb Connolly --- This patch has no dependencies Cc: Marek Vasut --- drivers/usb/dwc3/dwc3-generic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 6fb2de8a5ace..48da621ba966 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "core.h" #include "gadget.h" @@ -47,6 +48,7 @@ struct dwc3_generic_priv { struct dwc3_generic_host_priv { struct xhci_ctrl xhci_ctrl; struct dwc3_generic_priv gen_priv; + struct udevice *vbus_dev; }; static int dwc3_generic_probe(struct udevice *dev, @@ -240,6 +242,13 @@ static int dwc3_generic_host_probe(struct udevice *dev) if (rc) return rc; + rc = device_get_supply_regulator(dev, "vbus-supply", &priv->vbus_dev); + if (rc) + debug("%s: No vbus regulator found: %d\n", dev->name, rc); + + if (priv->vbus_dev) + regulator_set_enable(priv->vbus_dev, true); + hccr = (struct xhci_hccr *)priv->gen_priv.base; hcor = (struct xhci_hcor *)(priv->gen_priv.base + HC_LENGTH(xhci_readl(&(hccr)->cr_capbase))); @@ -256,6 +265,9 @@ static int dwc3_generic_host_remove(struct udevice *dev) if (rc) return rc; + if (priv->vbus_dev) + regulator_set_enable(priv->vbus_dev, false); + return dwc3_generic_remove(dev, &priv->gen_priv); }