Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4860182ybl; Tue, 4 Feb 2020 03:20:34 -0800 (PST) X-Google-Smtp-Source: APXvYqxL/nwmBfqjT4waCXVwwRPAj/seY3Xf5QhcFVpEK8RWI9Pz46pulU5Gmef2HCTobuA3WplC X-Received: by 2002:a9d:7498:: with SMTP id t24mr8622112otk.290.1580815234433; Tue, 04 Feb 2020 03:20:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580815234; cv=none; d=google.com; s=arc-20160816; b=ufEhx2zkQkmCMzoaDYtrcic/fSuhEBsM/stz9CoMfzjBWklEY/d2UHCcxC+yTsrVFv DKoLkC1M7gKZSNol7p1FaNvS+J1+ZEVk9QNgPiW/AHuyRP8Lq2lQt1xpFWr5QQ4nlfvI dr3wd74DoDCRbGI318GsIgf3/F2ftHc8q19cFViXuUwo660wwaUQ2oFyvcPyZNAI7c5g mfqGb6tS5yFkRwd0NvX1sGncn7O7aH8cPVintReENtJKwyfx0eC4KV1K+yBkwF25ezev 2wVMw9LSeVittJpPPXWAMBh3Cesgh8NpyiMq6dybkeDrDpaSpJAV4lQtWsZseXjXFxsE 6cXA== 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=+LHfXAfut5jNIM4RKz/C79YRvIVVypk+r6fq2YZz/18=; b=VZZxuGVpn6halmnv7nRsLqmjtF1PYjIOE/xkTUnFLb+QWXA8xF98wiQu/JpL6QHGsq dWnMQav43bjFn/zplmst+Zxt73J7oQpd2GOp6nveVr+9q8FqN8MhKkGNBgluZIjUyvSC I3Snd9Yok4/0SeP8VzYHjYJNDnpAvK3l8nq0WUEtUuCCElrhEKx9zOPn79x09mZeIJ5J BgiUHTM5OH14kKek5dPaiOB6hoOGlmp4zbx/L9n4skU1TtVN3TpE4Ii+ic9avKz8z2E7 XHOom/8YGNhTIvEpfG16SWKnsR4ETLu54/zUkJCWV4t+kvrybvAGK8b+eibOXuMcaE51 4WDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=rX5wJWME; 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 q9si11852121otc.86.2020.02.04.03.20.22; Tue, 04 Feb 2020 03:20:34 -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=rX5wJWME; 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 S1727336AbgBDLTO (ORCPT + 99 others); Tue, 4 Feb 2020 06:19:14 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:19206 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbgBDLTN (ORCPT ); Tue, 4 Feb 2020 06:19:13 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 04 Feb 2020 03:18:49 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 04 Feb 2020 03:19:12 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 04 Feb 2020 03:19:12 -0800 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 4 Feb 2020 11:19:12 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 4 Feb 2020 11:19:11 +0000 Received: from nkristam-ubuntu.nvidia.com (Not Verified[10.19.67.128]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 04 Feb 2020 03:19:10 -0800 From: Nagarjuna Kristam To: , , , , , , CC: , , , , Nagarjuna Kristam Subject: [Patch V4 05/19] phy: tegra: xusb: Add support to get companion USB 3 port Date: Tue, 4 Feb 2020 16:46:51 +0530 Message-ID: <1580815025-10915-6-git-send-email-nkristam@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1580815025-10915-1-git-send-email-nkristam@nvidia.com> References: <1580815025-10915-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=1580815129; bh=+LHfXAfut5jNIM4RKz/C79YRvIVVypk+r6fq2YZz/18=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=rX5wJWME2LHwtb98njAS1iMK5foOuo13dnmGTQFu3zyJYntDF5WLj668ce8MtQCBm 1DoEox1uf3GO9Rhb4dNrEL1mrQlCWLFOKTyHPmS9sj+nmQz6zpNT/kj2B6tUO18C2d 49RybVkRx6Gce9olJvgQT06zrkp+ay1Sz/om6uDqMQhzbAwv2tPtAKEuAo7bNLnF/8 RIMZ1vszokfstNK3lo5oAsaxp1PYbx1y0PPzEq2VFqnaHm6tl1hR3vLGrcVelRAF+t ZH5HeBJsCK5ldoLrtZhnQLjLjrmOYwhq1oYksl7VdtWvjGvhBLwjy/UjcS8URMSuRz XcjSK9BFRm+fw== 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 --- 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