From patchwork Tue Dec 19 16:04:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 755912 Delivered-To: patch@linaro.org Received: by 2002:adf:b181:0:b0:336:6142:bf13 with SMTP id q1csp1499856wra; Tue, 19 Dec 2023 08:04:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbLCXD42mECb9vdiW74er1KaOkM2A2Bwv8YZGm1V3jHFwbBEtRhDImsw5J6+EYds5vZsnm X-Received: by 2002:a05:651c:20e:b0:2cc:6cba:ae7f with SMTP id y14-20020a05651c020e00b002cc6cbaae7fmr2178649ljn.92.1703001895875; Tue, 19 Dec 2023 08:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703001895; cv=none; d=google.com; s=arc-20160816; b=D9TmCLNq/4qU2DB0qlSIhc70fwhAmt2MWv6KCoI9KAUOMfhr+6bf2LQv5Q7DWgxO/0 JRyA4I8b3hpRZe6dtfTxwFHJHi33rqPrSnf3j/tkIrpWfiyGYLdnHXps8I22Ui5EqATK 7GAOs4gll7wryx9YnjhiACIE2KCUIhmIBcE+MGOm5SuFurl9SZg0hFXbHLuN81ZDSnEI hQMuuZLHPsdc7UmUdMpKzho8Gaf5mwsfG66bfbp+4oziKAn8tnubw9t/3i9nqXYtcBBd DF31MYQ51TqwBaYeoEwywu89LoJ8V9FDb76caVIEt4NdO3XYxm8Snr4CPVKcPu/3oruv HWUg== 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=Om1t6UKWDMP001PjX5VQiCbJ34ybCqyxTxRkz8WT5dyPbJYVy+x1Kth9aSf/4aVe4R fDzq8S1ha9urTaBmyaX+CJdqxVt+TJAiLUSar5klhJ5kie/HpYBW1Az8Kn6A4a7rAWK/ dDj6G39pSNP9yuFpUf2iub7lurZ0NVwb5DG19+1gQsjrl9XRBM+iP9d5TkbtwYqO1c2j iZRT8AVTGNSpi9IlSGGupD/c4pVOxC2yapoBBF+Ip1JmcXVIfslBfnJnpKSbucYtm+dR jLRAQPx1/cbWXy17oxrjWsBjd811+LI6QaF5h4DlqNkqkBTPYf3qWVIg0hBEByktssa+ tfog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pnM1GS6Z; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id m8-20020a5d56c8000000b0033676552300si384510wrw.514.2023.12.19.08.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:04:55 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pnM1GS6Z; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 CF21A8752B; Tue, 19 Dec 2023 17:04:34 +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="pnM1GS6Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA6FF87729; Tue, 19 Dec 2023 17:04:29 +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-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (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 C53B787646 for ; Tue, 19 Dec 2023 17:04:24 +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-x32a.google.com with SMTP id 5b1f17b1804b1-40c3fe6c1b5so51933935e9.2 for ; Tue, 19 Dec 2023 08:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703001864; x=1703606664; 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=pnM1GS6ZsvKWXzgFHqWvpkyqwzyo+vUrk8NnjKbTh5ohBEpwTh0WdO+smB+xK5JgRz h0GsyJ6GncoXiIqh4kmCgzFyCCFjSAGQTwVDCgTUtHFOu4ahzj2XVVoXy27dhq2k5DLW nyB29+Cm3viMba9nw+hlXmQ/fivvrz88nXPcfQeGLFpL/26vd1vGrIjoJ4EcMIlf/Aut HZZqa3jyR9W+ztI9XUCsdY1OQUxV1ZkA6oaeCCBftp6ZYWPOf54u0TuEx4uCF7BXv0Dt 2Okithxb5AP7UXL+nRsXO9GaCmkTC2R7Sc2eqwuVzA4JgM8+ehCgOBkj2NZY/L+dQcm3 aYYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703001864; x=1703606664; 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=jsLNbYZ1jvMvhNzrMJEwWauESf/H4Gg2ktOj1roWZiS03pvqbQj0ofOwUKxbBRDSFh 7opGl682WWedpbVaAi5a+h9QtTqDbAzLPkFNHCpXi3LsAK2mPrW4jLaB1+fYw30P8kNo DBOlC3XjKMzYv5hV/U5THT0OwYzQANkxH3ClR8DFXvsycJzZv5LHCR6aNERz6mBJCkQw axWbAl2LCz1knO49FubA4ydYCl8bqf93QhiIKJ3394WVYvEe0nF4ZgHyMGk36z8INFyy ImPSo5kxWKt4Bs5XLIC2W4Zi9WJPYnJOppz09ji9M1IJTAxIZkdrR6YakiWrxDnBl/2b ELFg== X-Gm-Message-State: AOJu0Yz3zsJKGbzCmd6plHfEqrY4+Tdz8CksAC+VvJPQiP+8Ahm2b275 qrw22VdqtawUlOAWMxezEv1irQ== X-Received: by 2002:a05:600c:450e:b0:40c:2b2b:6414 with SMTP id t14-20020a05600c450e00b0040c2b2b6414mr8572973wmo.100.1703001864274; Tue, 19 Dec 2023 08:04:24 -0800 (PST) Received: from lion.localdomain (host-92-17-96-230.as13285.net. [92.17.96.230]) by smtp.gmail.com with ESMTPSA id je17-20020a05600c1f9100b0040d1450ca7esm3429723wmb.7.2023.12.19.08.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:04:23 -0800 (PST) From: Caleb Connolly Date: Tue, 19 Dec 2023 16:04:03 +0000 Subject: [PATCH v2 02/32] usb: dwc3-generic: support external vbus regulator MIME-Version: 1.0 Message-Id: <20231219-b4-qcom-common-target-v2-2-b6dd9704219e@linaro.org> References: <20231219-b4-qcom-common-target-v2-0-b6dd9704219e@linaro.org> In-Reply-To: <20231219-b4-qcom-common-target-v2-0-b6dd9704219e@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=owGbwMvMwCFYaeA6f6eBkTjjabUkhtTG/YxrjO5dkpz4pqh1dUexN4fOyV+fYxZ3b43crxP0Z tqv8pAHHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAit48y/FOQ2uPkxTZ91q63 8TbFlnqvVnpOq5//lTPz7tOqPR/VexQZGSZ4vt/yJu/a05VpLK/CopQWn/33+cFbq0Pq+skOtaJ ua74CAA== 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 Reviewed-by: Neil Armstrong --- 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); }