Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3738895ybl; Sun, 8 Dec 2019 22:27:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyuP7tlJZrJDHFwPBM9hpn+mplBRXdqsA0eh8P+B2PZs6uvAZkUSNlrWoR1YkJ6weCv1t9H X-Received: by 2002:a9d:7085:: with SMTP id l5mr21071176otj.25.1575872839256; Sun, 08 Dec 2019 22:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575872839; cv=none; d=google.com; s=arc-20160816; b=CXSxJ3Oc5/j8NqenCJ+Zuvyax6g2vPFHl8QUf/QKToysqjoHFhzbEzcAIi4HtKHGMp T+qvO6ObxEOUPaEBw4z+1fm3nCl3Ul+bFDUNckmJoIGvKILV4P4J9gi7+3Z/nnHdzL6e QhydX/qXXUFDUvaROGwJEaf1HP5qxGr4DpM3xzJxBSC0E5nFuzGjV/YpvMpWhIvbvOis fr8EnlyvyO/xg3V3pFcbk3dqlFJDJvlvQyRdRChk5qVpq2wC+saYrYBdPW56M+SLot5X rG1PM6EwJO04q8Olp5AdMV2Dck+N94F3uphNJoTgrmWKz0S8H7f0UDTvy/NPbHOBuN6j XHuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=0DnxoHmVITIxx4h5aZuGgGhKbqv7i4rF32jKL7JlfcQ=; b=Anu+Gv6RCKtLiexmNL12aTYQGb5ZJoJSqlfMVdS/d6gMOrMMLt36yfYC+4FIZIjaGn 3Pjq+1d5clwiYKV2cOs3w5IbaNcYYWqeWV7IXz4INXFE1xGxqsNmAiyEMemUdDGAt3bf PAsynjT6xm3bXoapR9ySNmE+mpAE5iolOQ2LfjejcwOp8ZKGdhRxJjIzsF4ksAru8g2B n3ok3dV5bb/2iYK3UoloNy+cXx4vS7DgLxXo+JUvEgQcFDwuVteUlX6LzquTcLHouEA4 r6YkPE0MlF/5Yop6Jk7j1FZWLsNX3jamuN9pqKVbPWRn/YeMhrSPwXtiFhdPlnYFDyUc PvcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Pk51j2EP; 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 y6si8404108oih.217.2019.12.08.22.27.07; Sun, 08 Dec 2019 22:27:19 -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=Pk51j2EP; 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 S1727111AbfLIG0C (ORCPT + 99 others); Mon, 9 Dec 2019 01:26:02 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:2520 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726165AbfLIG0C (ORCPT ); Mon, 9 Dec 2019 01:26:02 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sun, 08 Dec 2019 22:25:55 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sun, 08 Dec 2019 22:26:01 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sun, 08 Dec 2019 22:26:01 -0800 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 9 Dec 2019 06:26:00 +0000 Received: from [10.24.193.46] (172.20.13.39) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 9 Dec 2019 06:25:57 +0000 Subject: Re: [PATCH 05/18] phy: tegra: xusb: Add support to get companion USB 3 port To: Thierry Reding CC: , , , , , , , , , References: <1575629421-7039-1-git-send-email-nkristam@nvidia.com> <1575629421-7039-6-git-send-email-nkristam@nvidia.com> <20191206145740.GE2085684@ulmo> X-Nvconfidentiality: public From: Nagarjuna Kristam Message-ID: <9c93d4ff-29aa-0a59-c667-643939c46c5a@nvidia.com> Date: Mon, 9 Dec 2019 11:57:51 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191206145740.GE2085684@ulmo> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1575872755; bh=0DnxoHmVITIxx4h5aZuGgGhKbqv7i4rF32jKL7JlfcQ=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=Pk51j2EPm2iQ6FZZ1kgnH7zz9zsW+yZOHRhwtuWClOuwX2cUAtiOVRuZ/PA/rXldK F5msMJAgIdkDCFc3z24CxouQ2b2pxajthmutBL/xTn2N/BcSu/F9yYMbe+cZCX8faz ZS0fQlT1Ko0Ypd14VGlMGVYeo5HmfHhN2BpdIgATggDVyvGKFpR4NO+wRHn2dT0Ih3 8iX2R/OQStyHEiG5F1d8X0YrBkbxpwwOpClAFGizEUaoCiOw0/354E+B04uUjpKgSj zWpL63KBqjJXVI81lkQIh4pU5AZCcbpfsj+LJHsuxLuEpWPzo/Jb+QEX8KMmnKC027 U3ZogvHr6bRwg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06-12-2019 20:27, Thierry Reding wrote: > On Fri, Dec 06, 2019 at 04:20:08PM +0530, Nagarjuna Kristam wrote: >> 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 >> --- >> 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 4c86c99..2e73cf8 100644 >> --- a/drivers/phy/tegra/xusb.c >> +++ b/drivers/phy/tegra/xusb.c >> @@ -1254,6 +1254,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 -1; > Since you return -EINVAL above, callers will have to interpret negative > return values as standard errors, which would make this EPERM. That does > not really make sense. Perhaps something like -ENODEV would be more > appropriate in this case? > > Thierry > Yes, making -ENODEV instead of -1 makes it inline with generic error codes. Will update accordingly. -Nagarjuna >> +} >> +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 >>