Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp14058499ybl; Mon, 30 Dec 2019 03:17:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxkXtfhvEldDbHllLXv1gV43shBcGQWjumADfW36hnhEbi13wZkXGFP1mGnGfFz2OEstY+b X-Received: by 2002:a9d:6b06:: with SMTP id g6mr64890788otp.93.1577704635720; Mon, 30 Dec 2019 03:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577704635; cv=none; d=google.com; s=arc-20160816; b=A646A5vfMMkwIZRZ4jBIC2BIq53FAd5brKwbWuWI2kY5tSyJ+nQSJXgM/DItBamsXk iniSNyhCGM/bCaunGTCuV+XbaZ/ImPW6Il6SV93a0aImk7bgQl7gkYBfZHvc2aKcU9nU 8PvC2VJYI0Ouxj5Scn+O1ihxxWNRxDY5aX+mZkMEPrGPU97HqGIZfT+oNtsbzRXGoKwW 5WG8L7b6cAAsq58OxUW21DW3Q3kyP0ZoUBG01/4IVKE/iUGkz8+Nlj2BC8pDZqavQuY5 OSqb36iplw0zcj7v5ZpiOcyLjZ3US6gASEv1/81vc1dO+cMrwcay6agff5r/TUDHSqV3 qSYw== 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=z8Yeclp45av6JIcan0hG4QBuZhiucFPJPF7O9X3HewQ=; b=PLCLaQEDyijP2bVB4FE6FNzGxKv1230OlC1TeSGHqzZPheEThYxwUq9DrMqhbldzfD UiSNJMEMzxt5Ivb2AURDjM5mA13o8+sbkvHu1wb+DNDzvG7u5DI1qMV68Jn5nIeE0oHm ZJtl8Smm03HAmairTnzckABYx9dqoUzICGzvvVY5Z9hk2hOxqK6gvCodocoZu5QRim2x lnkolaYhfmr2uJ5mS9V355jupwSo5bc6CYwYUgTJjsYwvTSHPopZsDlFw3T8SWu9RYnF 39YyrzMcmPtj6E/4Z+0jfBQpEy8rsMmN7r7rhZBxpY0bhoraPyjWS8EMRPg8grJNBn+2 +KvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=XaNDs+ZL; 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 d3si5340340oia.236.2019.12.30.03.17.02; Mon, 30 Dec 2019 03:17:15 -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=XaNDs+ZL; 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 S1727486AbfL3LN7 (ORCPT + 99 others); Mon, 30 Dec 2019 06:13:59 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:15540 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727471AbfL3LN5 (ORCPT ); Mon, 30 Dec 2019 06:13:57 -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, 30 Dec 2019 03:13:16 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 30 Dec 2019 03:13:56 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 30 Dec 2019 03:13:56 -0800 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 30 Dec 2019 11:13:55 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 30 Dec 2019 11:13:55 +0000 Received: from nkristam-ubuntu.nvidia.com (Not Verified[10.19.64.167]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 30 Dec 2019 03:13:55 -0800 From: Nagarjuna Kristam To: , , , , , , CC: , , , , Nagarjuna Kristam Subject: [Patch V3 05/18] phy: tegra: xusb: Add support to get companion USB 3 port Date: Mon, 30 Dec 2019 16:39:42 +0530 Message-ID: <1577704195-2535-6-git-send-email-nkristam@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1577704195-2535-1-git-send-email-nkristam@nvidia.com> References: <1577704195-2535-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=1577704396; bh=z8Yeclp45av6JIcan0hG4QBuZhiucFPJPF7O9X3HewQ=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=XaNDs+ZL7+TXa4du44Ea8uBqLpKmtxZ7jmj6mhu5t1n0nfjYG7hpz48tzZnng/nwi 4Hz3SjFa8lDq84/pMW2oFe56Q2jckRPaUAIUtZi1tB6tPQHD0CU+Z0JKcYtbSYQQNr VmcjY4mDO25LZGkDXLOhLRZGKQCz5OlR7FJ2FUbrpC2XCakjm1s6eSEdxKiHjxgbt0 uhLLR1PhZ5LG75hvfPyPJLNVDnKpafayR5Fj3l01gxd8RJU4LHTVbCqVqAfgPxdD0t s8VFb/XdNXqzCBcgMnyejnCNV+q38sj2QN2O1uchZoVMEdD+yoGqQH4afhcV6V/f2m +ya/6JS1HKNCA== 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 --- 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 536b2fc..80dbc57 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c @@ -1274,6 +1274,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 = tegra_xusb_find_usb2_port(padctl, + port); + struct tegra_xusb_usb3_port *usb3; + int i; + + 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