Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3471600ybv; Mon, 10 Feb 2020 00:13:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyjUVBU90QjXnE5IcCJCCl4IPcMi2MYNx8/AfdSd7fNH5S7j7w6T3rx30ntKC75NjPOuAMO X-Received: by 2002:a9d:4c8c:: with SMTP id m12mr222360otf.312.1581322400100; Mon, 10 Feb 2020 00:13:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581322400; cv=none; d=google.com; s=arc-20160816; b=vXOOmAt9aka07rPg9s6Ia4PwQ2aaf86T0Pjknr2djxnFgjm9XeLTKtsEoooUBZPj0T qdW+W7jRVTdUMzJN+oo/KS0x5ni1kGbGMxY/tqY4V24Ymh/LRkjHr01/PTUUBM0myWiF XpYG35O2WqfAMGgPat+cU8JpgLfFW6Uj7ePHt+AZJ46Va3uvZugOCtpQJwHIQutf5dHU kED3JPoo3vMBTkPwVzGDDzG/v1a2I5pxm/7ThRjt8nyQkQlaOXfvuCS2xFKevFRnhGDQ Meo5VQHUeYwskvTIJDZui3UlOAyO2j7DmqyZpklluZ5NjLOTuqhNlNg+2Uw+7wNFhz1i XJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=eBnuefhuFya1eFMImrrioIcd8pR6hTz5yEIVQS0im1I=; b=FTB8s7/eAzCF2jNVqyG+4HrdUqpRK82rPPJZsau6hrUqHKY8gaNJ1acjN7KNxzMNvW hrZQT9ZW/312ZSTAI/JkAXsYvel718c+7Ej9ZGeYM004z2AokCde3+8O4S/1jsvdFCm7 u5npzEfoY2V/ucgOvtpgMfS8Rz+ymvKf+mW1nniC2QvZSqz2FPlSWtWhhLyniceuFeCA Zz1i59c7n+DP9bycmSGPLqxKyjOXCgEgvQcdrqRrzE0RNBH15jvz3gzdbYKkpVG6lSQM W7NkWqBGlEpmH9+NUgmnirsF2X4X6HH9KxGwRrRwWjBl6RURzfU5p2jTaJnLlpPiULJk MgOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=fsmaMYVu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si7642473oih.70.2020.02.10.00.13.09; Mon, 10 Feb 2020 00:13:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=fsmaMYVu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbgBJIMq (ORCPT + 99 others); Mon, 10 Feb 2020 03:12:46 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:3662 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727508AbgBJIMp (ORCPT ); Mon, 10 Feb 2020 03:12:45 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 10 Feb 2020 00:11:41 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 10 Feb 2020 00:12:43 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 10 Feb 2020 00:12:43 -0800 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 10 Feb 2020 08:12:40 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 10 Feb 2020 08:12:40 +0000 Received: from nkristam-ubuntu.nvidia.com (Not Verified[10.19.67.128]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 10 Feb 2020 00:12:39 -0800 From: Nagarjuna Kristam To: , , , , , , CC: , , , , Nagarjuna Kristam Subject: [Patch V5 05/21] phy: tegra: xusb: Add support to get companion USB 3 port Date: Mon, 10 Feb 2020 13:41:31 +0530 Message-ID: <1581322307-11140-6-git-send-email-nkristam@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581322307-11140-1-git-send-email-nkristam@nvidia.com> References: <1581322307-11140-1-git-send-email-nkristam@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1581322301; bh=eBnuefhuFya1eFMImrrioIcd8pR6hTz5yEIVQS0im1I=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=fsmaMYVuDAS00TQhzAPtgbIjE7bIF8cVtuBIGFKDb3R72zPfbhz1pp+Dl68887aDM WklamtwgA4vjDAGzR3UnP4viCc3My6BxEPDh7Af0ZTUPPvfls/UJ5Ry6XPViB4gO/x LOIX0p/0xjiIhJ3W/RWq4chsBWN5HeeM3mUqPkwWkZs1yofMCuPo4NIblTWA4BXuCo 6CuOL7m6Ktp99oWbkSTVqrmVHgwDCqvk7YqumToxUektYomta+jMziQ2Gmv9mdL9XX G4lSXmXZ35u3WpXIG6PHmFwsEB0zkUy8BXnPBe8F948BBoWW3w4cbyOXijAEC4UIrg JKpgWRLgxTVFA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tegra XUSB host, device mode driver requires the USB 3 companion port number for corresponding USB 2 port. Add API to retrieve the same. Signed-off-by: Nagarjuna Kristam Reviewed-by: JC Kuo Acked-by: Thierry Reding --- V5: - No changes. --- V4: - Addressed comment from Thierry. - Added Acked-by info. --- V3: - Added Reviewed-by updates to commit message. --- V2: - Added -ENODEV as return instead of -1, to sync other errors. --- drivers/phy/tegra/xusb.c | 21 +++++++++++++++++++++ include/linux/phy/tegra/xusb.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c index 2c0e29c..a8f0a0b 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c @@ -1294,6 +1294,27 @@ int tegra_phy_xusb_utmi_port_reset(struct phy *phy) } EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset); +int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl, + unsigned int port) +{ + struct tegra_xusb_usb2_port *usb2; + struct tegra_xusb_usb3_port *usb3; + int i; + + usb2 = tegra_xusb_find_usb2_port(padctl, port); + if (!usb2) + return -EINVAL; + + for (i = 0; i < padctl->soc->ports.usb3.count; i++) { + usb3 = tegra_xusb_find_usb3_port(padctl, i); + if (usb3 && usb3->port == usb2->base.index) + return usb3->base.index; + } + + return -ENODEV; +} +EXPORT_SYMBOL_GPL(tegra_xusb_padctl_get_usb3_companion); + MODULE_AUTHOR("Thierry Reding "); MODULE_DESCRIPTION("Tegra XUSB Pad Controller driver"); MODULE_LICENSE("GPL v2"); diff --git a/include/linux/phy/tegra/xusb.h b/include/linux/phy/tegra/xusb.h index 1235865..71d9569 100644 --- a/include/linux/phy/tegra/xusb.h +++ b/include/linux/phy/tegra/xusb.h @@ -21,4 +21,6 @@ int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl, int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl, bool val); int tegra_phy_xusb_utmi_port_reset(struct phy *phy); +int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl, + unsigned int port); #endif /* PHY_TEGRA_XUSB_H */ -- 2.7.4