devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nagarjuna Kristam <nkristam@nvidia.com>
To: <balbi@kernel.org>, <gregkh@linuxfoundation.org>,
	<thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
	<mark.rutland@arm.com>, <robh+dt@kernel.org>, <kishon@ti.com>
Cc: <devicetree@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Nagarjuna Kristam" <nkristam@nvidia.com>
Subject: [Patch V11 04/11] phy: tegra: xusb: Add vbus override support on Tegra186
Date: Fri, 18 Oct 2019 15:08:09 +0530	[thread overview]
Message-ID: <1571391496-20834-5-git-send-email-nkristam@nvidia.com> (raw)
In-Reply-To: <1571391496-20834-1-git-send-email-nkristam@nvidia.com>

Tegra XUSB device control driver needs to control vbus override
during its operations, add API for the support.

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
---
 drivers/phy/tegra/xusb-tegra186.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c
index 6f3afaf..84c2739 100644
--- a/drivers/phy/tegra/xusb-tegra186.c
+++ b/drivers/phy/tegra/xusb-tegra186.c
@@ -857,9 +857,32 @@ static void tegra186_xusb_padctl_remove(struct tegra_xusb_padctl *padctl)
 {
 }
 
+static int tegra186_xusb_padctl_vbus_override(struct tegra_xusb_padctl *padctl,
+					       bool status)
+{
+	u32 value;
+
+	dev_dbg(padctl->dev, "%s vbus override\n", status ? "set" : "clear");
+
+	value = padctl_readl(padctl, USB2_VBUS_ID);
+
+	if (status) {
+		value |= VBUS_OVERRIDE;
+		value &= ~ID_OVERRIDE(~0);
+		value |= ID_OVERRIDE_FLOATING;
+	} else {
+		value &= ~VBUS_OVERRIDE;
+	}
+
+	padctl_writel(padctl, value, USB2_VBUS_ID);
+
+	return 0;
+}
+
 static const struct tegra_xusb_padctl_ops tegra186_xusb_padctl_ops = {
 	.probe = tegra186_xusb_padctl_probe,
 	.remove = tegra186_xusb_padctl_remove,
+	.vbus_override = tegra186_xusb_padctl_vbus_override,
 };
 
 static const char * const tegra186_xusb_padctl_supply_names[] = {
-- 
2.7.4


  parent reply	other threads:[~2019-10-18  9:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  9:38 [Patch V11 00/11] Tegra XUSB gadget driver support Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 01/11] phy: tegra: xusb: Add XUSB dual mode support on Tegra210 Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 02/11] phy: tegra: xusb: Add usb3 port fake " Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 03/11] phy: tegra: xusb: Add vbus override " Nagarjuna Kristam
2019-10-18  9:38 ` Nagarjuna Kristam [this message]
2019-10-18  9:38 ` [Patch V11 05/11] dt-bindings: usb: Add NVIDIA Tegra XUSB device mode controller binding Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 06/11] arm64: tegra: Add xudc node for Tegra210 Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 07/11] arm64: tegra: Enable xudc on Jetson TX1 Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 08/11] arm64: tegra: Add xudc node for Tegra186 Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 09/11] arm64: tegra: Enable xudc on Jetson TX2 Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 10/11] usb: gadget: Add UDC driver for tegra XUSB device mode controller Nagarjuna Kristam
2019-10-18  9:38 ` [Patch V11 11/11] arm64: defconfig: Enable tegra XUDC support Nagarjuna Kristam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1571391496-20834-5-git-send-email-nkristam@nvidia.com \
    --to=nkristam@nvidia.com \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).