From patchwork Tue Nov 21 17:09:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 745702 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1997815wrt; Tue, 21 Nov 2023 09:10:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNuTQ54+m+U1QCy0uDUHHl9i7+iT6LLsG7ynhdv8JaCxhw8OhYEPnM7sJRZFA3Ii3bVXZS X-Received: by 2002:a05:6402:1b08:b0:542:f0af:21e6 with SMTP id by8-20020a0564021b0800b00542f0af21e6mr2697998edb.14.1700586614171; Tue, 21 Nov 2023 09:10:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700586614; cv=none; d=google.com; s=arc-20160816; b=LNlQpYXOKlo6XKRgdNFm/Of43Krq/DCs9iKJmEWxP5jSn2ZrbpEVNM7bL20HspZPx9 0wjceafqjvLT5PFyqGJEL/DEce2DtdSCUv4wQLbU9nqJxasshCXXZqYJ7uqqP11uL2F8 9c0+Gwxax0QUP5uKkFO//nHPbq4HlHv3PTWirDcEzpMRdh9hKdck038Fy26Qp9Jlu+vH WILwv04+QewUbNN8OjuCj2klM3fGVRjzDwEjakjegCwKmxCqZhlOxgBgWK7v8bYwi6NJ cpL1mqLA0Pqzeo6OM1JE+xzjXUnL/weiyjNoN5skpV/vD/NJpg1YD/7F/VQ3qi/uM1VH GxRQ== 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=fck7kwG7s/JPNczN5pI04EsIr9yeduUZAtln9zEiAhs=; fh=GB9E9KzRIiNXhkRWIZbZpSMjbCjxnqnvE8nYuQxq8UI=; b=YSxGPw1pUxJU61ssyYLQW/A7LRGLYu9y7j+No5L/SB9Hz3ePyt0PsSFxdkvlNw9qUH 0s9z1TFTNCeCpWO6GT3kFdptfV30AKudLJB67H6BgCydF9cd7eXhjZ/B3pYoVjRUgfQS CDWMmtBJwy8ji7Ys5WJv806cX3wZ4n8soBUF0Wbd4E/k2OIBfzhEMzAOXmeISWWXSydo sb/duwdd96T/1rU4vUd4UFKV615SscudGdALPIsyPZaz8/gRJ50la4QszDJCY0BRrT9G UBpFYFWSv1Ntb9P/GvyDE9rve23LwleLZz/9DPftX/5ZOVeJ6bLS6dx8VOQxwXsGbS9U +38Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b3K1yhjj; 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 v21-20020a056402185500b00548b7eed242si2591697edy.310.2023.11.21.09.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 09:10:14 -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=b3K1yhjj; 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 4CA2E8763C; Tue, 21 Nov 2023 18:09:40 +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="b3K1yhjj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E954C8762A; Tue, 21 Nov 2023 18:09:36 +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=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 97F99875FD for ; Tue, 21 Nov 2023 18:09:32 +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-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40b2ad4953cso4721625e9.0 for ; Tue, 21 Nov 2023 09:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700586572; x=1701191372; 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=fck7kwG7s/JPNczN5pI04EsIr9yeduUZAtln9zEiAhs=; b=b3K1yhjjBJiUIuaobvXKoGzScUTWSw6ol6GVM0R30sFbMkEl2CzkG76REJJvbo+ck4 cqvWsNZwldOM1mStjpXL3PuVd4aAkbqYN5wFmr2Llq6d6kjqrOxBJ5l0aCRqDkrB6AWq qXJtIgi1xJo3+400jj/oHTj5X1Ffo1629I/xdSXnmadqXKy7+qQLS0xTgqhlsEuGRNiA 0XsMnIyazTAG3RTlj/D4iKRKlQSxSQiC1evR9/pvSWEX5luNvlxKOAYqH/8/IXgyhlew 7w9IFFYzXzb3qKJMVgCL7hCzw0YdrZGelndvRyPvDtzVYetdpKHLq5JseqEJ/oPvkyul o80g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700586572; x=1701191372; 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=fck7kwG7s/JPNczN5pI04EsIr9yeduUZAtln9zEiAhs=; b=LnTvk+SRZFWy6PrRMxCIZSBk5Qz5E0BtaK+pBfPFVWUkyzMu+bwcsMo175RoL0NlTY yNGEfRVVgPvujecZJpQkPBR0TPNEZxBeq0SU6eyNAXLAbrtKyKiXQXCyPMJAFP6thIgW R2rIAdEX0/CZm1q1Saosq9qw/IqrtZY/MrhwV6G/Wv/zsBSiq6RK2U8sqAXG0wITwLEy L4Y2ozkWt1TG9uk+NTVz7+NVAbh26rD+WU8szfgrocfvRXrAgtUGJZXMPoKOSRdZMYCq 5HSQlYfNPNj/Hlh6XKOj8gkriLDWt5Lb8OolO+xJprssU42o6nTUpzp4CUrKY69UgI7s sCSQ== X-Gm-Message-State: AOJu0YxpgN3mQyXi7WqgS0OqeIHy/G9RwHA44a1gGS3H6SQn6/CvlaN4 51XVraysnCZAEXqlLpj6iHGR/A== X-Received: by 2002:a05:600c:a2a2:b0:3fe:d67d:5040 with SMTP id hu34-20020a05600ca2a200b003fed67d5040mr2886468wmb.5.1700586572059; Tue, 21 Nov 2023 09:09:32 -0800 (PST) Received: from lion.localdomain ([79.79.179.141]) by smtp.gmail.com with ESMTPSA id 1-20020a05600c230100b003fefb94ccc9sm17345812wmo.11.2023.11.21.09.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 09:09:31 -0800 (PST) From: Caleb Connolly Date: Tue, 21 Nov 2023 17:09:26 +0000 Subject: [PATCH 03/21] usb: dwc3-generic: support external vbus regulator MIME-Version: 1.0 Message-Id: <20231121-b4-qcom-common-target-v1-3-9492198e0c15@linaro.org> References: <20231121-b4-qcom-common-target-v1-0-9492198e0c15@linaro.org> In-Reply-To: <20231121-b4-qcom-common-target-v1-0-9492198e0c15@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=1758; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=AYKQKTYOB4WSQ5O/zOkvXjHUummdDNXBGhhB4keYTpE=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSYJ64LH320/HUusrxbJYb5S9Fd/Q3374dyc97g9bdK+ Hgz7WxuRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZiI9mlGhnU2c1aVb0n/5ZL+ OS3FLXWH7IJSdh5dfaMIiTyBh4sXMzEyTJMJqj/yz+5xWlCz1IX5e9ujX8s6rWKxKWBgEdLtDX4 tDgA= 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. 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 744fde806948..e66e7961c70f 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); }