From patchwork Tue Aug 24 17:16:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 502103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F214C4338F for ; Tue, 24 Aug 2021 17:21:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3906061214 for ; Tue, 24 Aug 2021 17:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233036AbhHXRUM (ORCPT ); Tue, 24 Aug 2021 13:20:12 -0400 Received: from mail-co1nam11on2083.outbound.protection.outlook.com ([40.107.220.83]:34592 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239751AbhHXRR6 (ORCPT ); Tue, 24 Aug 2021 13:17:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cfG5/Mm5RCYSW4zVMx8LZT8kkFDXqMeTboDOPejPr39kbYshwjf0Fbj5raErf+3JnhXaShwuwduWNf8OaE/maYEUrysF8aHwWDZO7OBmLcP2tFnS1F2PVIMgD2R3R4flJhlt9DHPSKQLwUFnhCxnC5GWNw/1xB7JdMDfwNrB9facdsIaCK6sJntY43Bm3NX45GlRICL6vqSZPToiGziF926t0afDOoNGV/nswHacirfxtscWMPUJU2YD03hjWICZVf5fSQqKI2DU3/En6Qb087+lfV1DEr2XC+ad4qilurgW17Ex/gxFS9CcBvhClaPV4D47styz2oh34Qnyd+GMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OIRsXvEaD9tuH2VK/N0yvHqxPF6XJQVOZCpAr6m3E30=; b=lSiliK8Qvci8+cxXYVqG4h7A/kG0Z3mM7zsNQIQnY03cJya/ITasc/77jjVkodZsKLPCOY1OsXmbtpAn+92HwpVMMlPm1t5tM8Anbtmu0cX7BlmI+tnfG2s3y1sjuPmNu6JqP+d++yRsYNu7/DcJMRpHF6Kf4mJ3Jti151Is+MpZUoMYXOf3gxFn/qKUDBg7eRyvLpNMR3eUPkncRZyqMx+v6NhHAt2Qfu0QQPVUkjEL/ETJf0kcaqtV9Ry78AyWob9Xep2Hm6n4Y3UkNtwyOAAjYuTpmph7rgaemu7KQl0WyGT7QmhQWj69gY6Ic0uUHcZ/reybGfhg+0TQ0snfeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OIRsXvEaD9tuH2VK/N0yvHqxPF6XJQVOZCpAr6m3E30=; b=ndSqUn5aapHon6qOMjvyDBuvwrJSRHE8y2j3E8ycu6mGurq0TYg+NyrkbCkmqmKyGB1a0UQvHFBOia6EE5WtJPQJzxMhSkL+tM9HD7zyHqoTT0Wypn5T2Pc+jzAsz9FiaOIK8uWrLfdGOB0fgamAW7dlnYR54Vrul54J9R8CASo= Received: from BN9PR03CA0556.namprd03.prod.outlook.com (2603:10b6:408:138::21) by SA1PR02MB8477.namprd02.prod.outlook.com (2603:10b6:806:1f8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 17:17:11 +0000 Received: from BN1NAM02FT039.eop-nam02.prod.protection.outlook.com (2603:10b6:408:138:cafe::c5) by BN9PR03CA0556.outlook.office365.com (2603:10b6:408:138::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT039.mail.protection.outlook.com (10.13.2.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:11 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 10:16:40 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 10:16:40 -0700 Envelope-to: git@xilinx.com, peter.chen@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Received: from [172.23.64.8] (port=48475 helo=xhdvnc108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mIa2R-00004w-4f; Tue, 24 Aug 2021 10:16:39 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 16987) id 37CED604AC; Tue, 24 Aug 2021 22:46:30 +0530 (IST) From: Manish Narani To: , , CC: , , , Manish Narani , "Subbaraya Sundeep Bhatta" Subject: [PATCH 1/6] usb: chipidea: Add support for VBUS control with PHY Date: Tue, 24 Aug 2021 22:46:13 +0530 Message-ID: <1629825378-8089-2-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> References: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53f3cdc5-e229-442c-15cc-08d9672302b5 X-MS-TrafficTypeDiagnostic: SA1PR02MB8477: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ApskRnLdmi+dhj1LskUYl9FcXNnoIFKsKrcWBcUnpaBugwlvOec/BQvO4A8bE1D9Za39ASJq2LVhKBHGyqRD5GeHzul66mA42bHTMWw4zP2uq6dZ4Ho8oRRnxPyKGoquv/+aswJpOoTI9RwzMny/0WKWOCIqeDYF221zJfTUYJfZv1wGGex+nNBlvSPBMW03Wpbuk5qHkViJzo0Ni+cD0uijDUBB1M0mdeccrPQW/3XZFaBSlJtt33HCMQSqRUyX2hViOYpe0d39dIZSCWWyA9OveWtTtZr0LZOs5p0RpoScJgIng8uSM4z678mTsAaaLXCp+CxSZEH1Rc5AFJa3c0SwEOKZGnv/L2lCXwZig24ehyOB/ejU2stzYeIg9bJTGFPqZOiIztRa8DTt0gImZdMJSKOg0PffCBTW3fD6hB/c+qSnOChToHLR3iZ9rHn6yhUi57qAcV+brEbDncNEsRv4wFryy87sxa89GBP5zqWjlvglg2QPuEmYMu7AgDce7h28vbd096OPFcxTiEbvEtlruyaYnOHVUnoRXrpu+5QmiKmC6Q4KGx6eG/FpLkcsKVEdwuXUs9ysttEwdSm7wTvAebdtklk7Y53hp96APiKrN1qIoZka9SP4XZPo/eOP8pTqDbfym50jIakyy+EznS+hDpswndH0V1mTnj5T6tLYUodKZBAe30IF2Po56SGX1XllxDBVjbsLxGogiYJPkjgjBhaypGLfgHHDL/Vdbtw= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(39860400002)(136003)(396003)(376002)(46966006)(36840700001)(36756003)(36906005)(26005)(47076005)(8936002)(107886003)(110136005)(82740400003)(478600001)(7636003)(186003)(6266002)(44832011)(6666004)(356005)(36860700001)(316002)(70206006)(70586007)(42186006)(2616005)(82310400003)(426003)(336012)(6636002)(2906002)(8676002)(4326008)(5660300002)(83380400001)(54906003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:17:11.5254 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53f3cdc5-e229-442c-15cc-08d9672302b5 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT039.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8477 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some platforms make use of VBUS control over PHY which means controller driver has to access PHY registers to turn on/off VBUS line.This patch adds support for such platforms in chipidea. Signed-off-by: Subbaraya Sundeep Bhatta Signed-off-by: Michal Simek Signed-off-by: Manish Narani Acked-by: Peter Chen --- drivers/usb/chipidea/ci_hdrc_usb2.c | 1 + drivers/usb/chipidea/host.c | 9 +++++++++ drivers/usb/chipidea/otg_fsm.c | 7 +++++++ include/linux/usb/chipidea.h | 1 + 4 files changed, 18 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index 89e1d82..dc86b12 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -30,6 +30,7 @@ static const struct ci_hdrc_platform_data ci_default_pdata = { static const struct ci_hdrc_platform_data ci_zynq_pdata = { .capoffset = DEF_CAPOFFSET, + .flags = CI_HDRC_PHY_VBUS_CONTROL, }; static const struct ci_hdrc_platform_data ci_zevio_pdata = { diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index e86d13c..578968d 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -63,6 +63,14 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) priv->enabled = enable; } + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL && + ci->usb_phy && ci->usb_phy->set_vbus) { + if (enable) + ci->usb_phy->set_vbus(ci->usb_phy, 1); + else + ci->usb_phy->set_vbus(ci->usb_phy, 0); + } + if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) { /* * Marvell 28nm HSIC PHY requires forcing the port to HS mode. @@ -71,6 +79,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) hw_port_test_set(ci, 5); hw_port_test_set(ci, 0); } + return 0; }; diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 6ed4b00..2f7f94d 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -471,6 +471,10 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) return; } } + + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL) + ci->usb_phy->set_vbus(ci->usb_phy, 1); + /* Disable data pulse irq */ hw_write_otgsc(ci, OTGSC_DPIE, 0); @@ -480,6 +484,9 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) if (ci->platdata->reg_vbus) regulator_disable(ci->platdata->reg_vbus); + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL) + ci->usb_phy->set_vbus(ci->usb_phy, 0); + fsm->a_bus_drop = 1; fsm->a_bus_req = 0; } diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index edf3342..ee38835 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -62,6 +62,7 @@ struct ci_hdrc_platform_data { #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) #define CI_HDRC_IMX_IS_HSIC BIT(14) #define CI_HDRC_PMQOS BIT(15) +#define CI_HDRC_PHY_VBUS_CONTROL BIT(16) enum usb_dr_mode dr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 From patchwork Tue Aug 24 17:16:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 502687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E48A4C43214 for ; Tue, 24 Aug 2021 17:19:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C681B61373 for ; Tue, 24 Aug 2021 17:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240245AbhHXRUN (ORCPT ); Tue, 24 Aug 2021 13:20:13 -0400 Received: from mail-co1nam11on2080.outbound.protection.outlook.com ([40.107.220.80]:53216 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233726AbhHXRSD (ORCPT ); Tue, 24 Aug 2021 13:18:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oi6nbfNyR+VzE5ho8huNQg8ULQNQUPhAiHk1CQKQ4XeBWehHCk57FYaJ/KFPloSsWdPdohLgNpaq5lk3dnpMyxJXbwDJPRTm8JWsspMEkA9smNgVl+YRCXOPkTy04GQdg3rE8pbVLNKLtn2yF/rhF85ndxI9BNwQnDAk+Xu8TSEUFxr+R0g0jXRamzmPwY2uHNRk3QWM7JTyFFl2j19VLSCMT6S0rQTrHbrHwlkkjZWoR9u3EZZiJ/m2Ghcezkmp3ooDpoS61aqyTtk97Hrs6Ko2nGh3p00eptJYfcyCEJagEMBDWnbVmcHVgnBZFjp/zCCl6VOXxwGVR6Dwm0xMiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G4ADCqfJjuJ02u4rET5jF2ZfTTT2AcEoc5lUlRM+ykY=; b=j0xA4MIrOOZo4uk/8ZwbbQInl/k5aE3fPMuqPLJ1T803Gknzb7YpcV/wrjj0uoOlKvRp4WR94+/utKg3ymhwQO+4hC1M7EXYYoz5/PW0Z5CzQpvXufywRTNZ5noYs2/vj07MDpqVBvoS5o/J9eee0Dc5i6K5A4ReUlXAoQ3jaHn1AB7leTvC8SrUkkH9cpMa3xHTdVXWvu6AvZnoxYJ3KRhBV0leMMNl6/r+Qxx3rvnNQlGUSvgIh/67L4OgQxE3mU77r6sRqlr7/k4dz+jvvl6H6tAmoybU1VwhSEKXsVvCA7moXbxQiQmPu14hOtOpFDQPX2nod6mtTt8nyVe2hA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G4ADCqfJjuJ02u4rET5jF2ZfTTT2AcEoc5lUlRM+ykY=; b=gGAlYUnsShYsdEJRuhfkF+navHRHbQmRM/VPlqHZzn+55O3wHDmMjEHhbKkDShjad3VdRGzjYShD4SRhlRinNUhTZJGg84VcVUaKjOv7DnNMfPn266BXpLVzVibfVPbSlltjs/nxlQiSyES05p2GCe0hUId+Lu6OvyLCBEcIrGE= Received: from BN9PR03CA0094.namprd03.prod.outlook.com (2603:10b6:408:fd::9) by SJ0PR02MB7264.namprd02.prod.outlook.com (2603:10b6:a03:291::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.21; Tue, 24 Aug 2021 17:17:17 +0000 Received: from BN1NAM02FT045.eop-nam02.prod.protection.outlook.com (2603:10b6:408:fd:cafe::8c) by BN9PR03CA0094.outlook.office365.com (2603:10b6:408:fd::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT045.mail.protection.outlook.com (10.13.2.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:16 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 10:16:53 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 10:16:53 -0700 Envelope-to: git@xilinx.com, peter.chen@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Received: from [172.23.64.8] (port=48478 helo=xhdvnc108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mIa2e-000EdE-7c; Tue, 24 Aug 2021 10:16:52 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 16987) id DC834604AE; Tue, 24 Aug 2021 22:46:31 +0530 (IST) From: Manish Narani To: , , CC: , , , Manish Narani , "Subbaraya Sundeep Bhatta" Subject: [PATCH 2/6] usb: chipidea: Use usb2 phy for Zynq platform Date: Tue, 24 Aug 2021 22:46:14 +0530 Message-ID: <1629825378-8089-3-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> References: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf1267a5-e6b6-4724-327b-08d9672305cc X-MS-TrafficTypeDiagnostic: SJ0PR02MB7264: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:279; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lc02GI1pSqDkjLAgHzf6YM38aw6ktUNwUXXtBZhHwEj9n6CjoX/jhhgfFTWsdmChamcJA4hrZyHv+s29Sa9opUW2iij2zJPyhSpgZhYTq2GyK6JYUMJ7KYv3FXXRQ5C9K9VQoY5+bhpB5r/EYLLPPGLj9qCtOpVpW2rkKK7kykMGgIe8TXN8j6AKz8v/edYBplfnz68Il530SKDMf5nw9KOg7bPwbY6WYAM+D7wU0ULbX3zcmjRaHtjqCwODPNyY0AZDO0w6xG9+DfGRZjIDf9IKtVCEpUQC8qVJOMJwvCoi0VP6J+Qp7kEsIjg5zhTyl6oMSe+RnAeJtlNuWjQ/xf9YDXxnnrsKJyKlhnxAn1XTRB4llRTHNzDt+EtGXmQ6Nk5mrGWnNLPXW0trPXMQexdIK6FuXs9SVw/Die1VzNMqP5tV5UUzr5zIQMg+syd6LSvfYD9divF+5E6FGPdPChpvTZlNXLhZiZt0zJ3SNuGRxC/uAq44QeHUSzBB0P7pHsDPOg/BSnIJx97/5NMeW4nIo+hG3DnPm/+k+3ZP0QTjqQIdD76PVUqPVc8XngsLaIuuUCyUt3ZywhUrAPOeqq0LZEsIxwmdA9QVZqB64GnKu90ZvQsjXoUl/xIuBSMb5YKuXMPx6Wd+zxcqH0m4I8TD2KjlI7E1I0TyqvbSCqG5vEzNeDkMciuRFp9G6Ua7DEtjRwnCo0f4kybbxTY8MIyKlKYhJLPwXKT1mXfWSJk= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(376002)(136003)(39860400002)(396003)(46966006)(36840700001)(36860700001)(70206006)(82310400003)(70586007)(4326008)(4744005)(6636002)(478600001)(186003)(426003)(336012)(5660300002)(6266002)(110136005)(26005)(44832011)(316002)(47076005)(8676002)(2906002)(8936002)(54906003)(42186006)(36906005)(82740400003)(7636003)(356005)(6666004)(2616005)(36756003)(107886003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:17:16.7081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf1267a5-e6b6-4724-327b-08d9672305cc X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT045.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7264 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add usb2 phy to Zynq platform data. Signed-off-by: Subbaraya Sundeep Bhatta Signed-off-by: Michal Simek Signed-off-by: Manish Narani --- drivers/usb/chipidea/ci_hdrc_usb2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index dc86b12..be58869 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -65,6 +65,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) if (match && match->data) { /* struct copy */ *ci_pdata = *(struct ci_hdrc_platform_data *)match->data; + ci_pdata->usb_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", + 0); + if (IS_ERR(ci_pdata->usb_phy)) + return PTR_ERR(ci_pdata->usb_phy); } priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); From patchwork Tue Aug 24 17:16:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 502105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E16CDC43216 for ; Tue, 24 Aug 2021 17:19:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD8CF61206 for ; Tue, 24 Aug 2021 17:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236701AbhHXRUO (ORCPT ); Tue, 24 Aug 2021 13:20:14 -0400 Received: from mail-mw2nam12on2083.outbound.protection.outlook.com ([40.107.244.83]:30176 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239880AbhHXRSM (ORCPT ); Tue, 24 Aug 2021 13:18:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QkeB6050ooqj1u9uZY+WNufiYpduWH2GpXJm01kcbYm9ErkWHYayBy1uqL3oE2Roq5EgB1GTo2612qJrptQXSt6nN/bpgrQw41Dn80TVjOv1mWiWOuFVOk4gjygsj0mVa3il+5jIumddQF2XZF8vWT/oDCBbNYYnVUqJ42hyuFBDyTSxV7VEepgWE3E0CckYHJIkgrPBdUb9MY1ss1o8InAgkLjswbpFKkGREtWpjAF7TgdFjoRrZEvjTbg13OODmHj13EAMzYV4mGuCT33+f5YhvigcaNhbUq5NQP7TFZellq9j83L2JDWTIVKcPN17puAP9mdkocA6ezGlw2kw0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rfy02Cl0w6CyGciC8JFZa/SZn8yCtQL2V7ejDpTdZJY=; b=EgVldQXgz0+IHI8Ttv7Wj0xD3S8uQeCUwmuV6Lh4UMMY8yNA7dpNlF94gN13yg7HGWt538ML0Iqmc/ngV741pUxYm0ZsMzcsfc/SbFivltrfZje1am28raCIt26Oui2RO9UjpUcdFzLHTgcTZBlEgKTGYhezaDUc2zzaVlu0lpeXqrjqJxPlvAWYx4ZMEvvOOKXgksY0BPmbkbH5BtdtD3KXMDHUv7fG4YTW1K6Eu23GDSI1YjjCN2X0EIaaysBTiXvrTK+ZxDbDZ7hiA9hGdRpo1WpdN5ACo0u3Wj3qNwF5uM5drAIYOYAKkzpA1ndSuTeYRXd3ZALxuB3mrRHhCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rfy02Cl0w6CyGciC8JFZa/SZn8yCtQL2V7ejDpTdZJY=; b=FA1a4nBB8yCB9rVFzQFwJhe7uIMd6Q5BYn+sIZ9QqTYlXMIDRWWCVFmq3jEu1XXtlJwbOW0ALFhT1lbW63CF5rYlY/tTuS1jBE82bgOmYZNpDkWfLyFWgsufgAOTfrtCdl8swtpGFNOoUgTNSgdHTdMSCUNtZpek4yAyV2kK83M= Received: from DM5PR10CA0005.namprd10.prod.outlook.com (2603:10b6:4:2::15) by DM5PR0201MB3574.namprd02.prod.outlook.com (2603:10b6:4:77::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Tue, 24 Aug 2021 17:17:22 +0000 Received: from DM3NAM02FT004.eop-nam02.prod.protection.outlook.com (2603:10b6:4:2:cafe::55) by DM5PR10CA0005.outlook.office365.com (2603:10b6:4:2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT004.mail.protection.outlook.com (10.13.5.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:22 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 10:17:06 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 10:17:06 -0700 Envelope-to: git@xilinx.com, peter.chen@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Received: from [172.23.64.8] (port=48481 helo=xhdvnc108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mIa2r-000EeV-AW; Tue, 24 Aug 2021 10:17:05 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 16987) id 86B15604B4; Tue, 24 Aug 2021 22:46:34 +0530 (IST) From: Manish Narani To: , , CC: , , , Manish Narani , "Subbaraya Sundeep Bhatta" Subject: [PATCH 3/6] usb: chipidea: Check usb_phy exists before using it Date: Tue, 24 Aug 2021 22:46:15 +0530 Message-ID: <1629825378-8089-4-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> References: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34c6cca0-420c-4014-0672-08d9672308f3 X-MS-TrafficTypeDiagnostic: DM5PR0201MB3574: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F/+6uY76FbmbK59fZJYfS0wAeuPLILf7lL6pOtO/2gdBS7RApuxHcEemCcDCIUbSJauDxfOQOlkp1HonanbCvkbt6XIZQmTL11IslrgphDxkJ+JOwo9TFp9P707I41IVtRQ7+tlDU1/H5w/Rp536552f6Hmk30YTgUMq0OZVUi6gP6Pm4JUIBYonDan6aPgIQDAqgStF378kte0NUU4Rh6xmU7ZkLldWqyPmbETg+Kti473olzYpyspc2EAEPZzaXfaqbSQVu1LxHzBWViMYxyO6tMPgOnnL0RatLTnfKAkWneKMU6WWXisVQlYCa16MB/pH/7m7yqs4M/4H+zwXOT+hk7lPtdUC+ciogYf35L7zrZNsyo3kaAlqSDkuJXMMw+NXhapFOHZoRpNlm2NSD3wrZLrkwDHMRXlZHZX731HwZq/IYeKzB2yHSNeMLXBWfNgADrhKV+H3vCWZycqYgPjEcpHirl2zFVbrYAtUnyccAxIUdC0Glwt6zlqgdezFY7gPxILnUjk23Z9pLDFidZyYkXL0mZLjOnjbNEAZ+SLXqcIDAIcItnmN2xCnChr4fyBMrM2VnYup++XSPvbua5DCf9eq2nVXELHlSrlFIzPtiT+0eASR0JU+HmnB6Lqpt4b9pc6HSj9RoXRrCJ+TBS+lcxBhsIwJvmr7F7aeC2w0AVhehPkMoGFWACf/yIHyk11KdetzJuZCCScUxVldBIcRVIsJgLyGidiJB28yN1s= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(39860400002)(346002)(46966006)(36840700001)(70586007)(110136005)(6636002)(70206006)(4326008)(54906003)(316002)(82740400003)(7636003)(478600001)(356005)(5660300002)(47076005)(36906005)(8936002)(26005)(42186006)(36756003)(107886003)(44832011)(36860700001)(83380400001)(2616005)(336012)(426003)(6666004)(82310400003)(6266002)(186003)(2906002)(8676002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:17:22.0387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34c6cca0-420c-4014-0672-08d9672308f3 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT004.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0201MB3574 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org usb_phy and usb_phy->set_vbus may not be present all the times based on PHY driver used. So check for it. Signed-off-by: Subbaraya Sundeep Bhatta Signed-off-by: Michal Simek Signed-off-by: Manish Narani --- drivers/usb/chipidea/otg_fsm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 2f7f94d..5f8f5d2 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -472,7 +472,8 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) } } - if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL) + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL && + ci->usb_phy && ci->usb_phy->set_vbus) ci->usb_phy->set_vbus(ci->usb_phy, 1); /* Disable data pulse irq */ @@ -484,7 +485,8 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on) if (ci->platdata->reg_vbus) regulator_disable(ci->platdata->reg_vbus); - if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL) + if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL && + ci->usb_phy && ci->usb_phy->set_vbus) ci->usb_phy->set_vbus(ci->usb_phy, 0); fsm->a_bus_drop = 1; From patchwork Tue Aug 24 17:16:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 502686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC2B5C432BE for ; Tue, 24 Aug 2021 17:19:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7CD661206 for ; Tue, 24 Aug 2021 17:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239741AbhHXRUP (ORCPT ); Tue, 24 Aug 2021 13:20:15 -0400 Received: from mail-mw2nam12on2057.outbound.protection.outlook.com ([40.107.244.57]:18657 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233045AbhHXRSQ (ORCPT ); Tue, 24 Aug 2021 13:18:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BIf71Bw0LueNY3hYBLGVxix0YF1c+9vHUHk6DPvEvRPz1zyY1jgSj7n1lsExHf6SHpdsvoxh43m/oWMKhl3UqZyHFT94PxD0WpK6KVizrkzOM7KFVN6qTDOU3oAc5zf8jMBCrLzJxSNGiQ16uTReGFRppXGk9adSJDOpYHybyFhtGao70HdO/zIHkrNlyHXfZ+HhFQls0T8MSrpaNP7NCa+9YaGxK6OkG4Zt+m7514nsS81ObObhCltOMAxRNNooylrYrn3A5sfeDIn4DmdCv9DAkYT9oeX0Yo38Jz4yi7lEWGGNNNUs5YZCCoOhH2bMKzloEmGkJUbSfr95IjHoJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zPe9yQ1qhJzQqArksSp1RSTlaT0uzYtV2w49DQfVp3g=; b=ReNGT4ryqX0qv0NsTv+o44EnuyrQ/6WcjRvGe7pXQ51k8cdFMo5R83YlP4d1e+WRjK7BPGL4pGv7JopFV8dZLoApiiaIun5nMLP8Et2VCuUeiWESIrf0mEMfPluzhuDcHBi/y3sTYwnbp1CmM7KJuiNGAdjOibGslJWRMFsJ0I339PETc8XWroqjEpRslg85A/GVcy5CU4qy4ODmgzZo0+B97NWhvTioPmIKbhkYundPowHBC+7gsZz5bAW+Z1GuQ43wSvPCwmmchzz1UMm6Gs5vZLtQfK6k5+WQ4ysh7nkv7dBLtje6EBIhE7M0DhAScnNZ2WFvW0d4Nq63sCQt2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zPe9yQ1qhJzQqArksSp1RSTlaT0uzYtV2w49DQfVp3g=; b=FUM4UqcFE+xFUivObWbiFQTBpvSRSR1yGC7ew1XFzS8XTFsgTf6NuRiKWVy2ZTRxZAGkXk8Wi8FrxHBzBRyi0oJDVWE3iQe3k1rFYtD2DQ9xUEm8Nu3tdeZHpOw4yxh0zA6/7lAgIzggjxxnbvRumM0WGGHNs0C1FEelg/aJiHE= Received: from DM5PR05CA0020.namprd05.prod.outlook.com (2603:10b6:3:d4::30) by CY4PR02MB3208.namprd02.prod.outlook.com (2603:10b6:910:7d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Tue, 24 Aug 2021 17:17:29 +0000 Received: from DM3NAM02FT045.eop-nam02.prod.protection.outlook.com (2603:10b6:3:d4:cafe::fc) by DM5PR05CA0020.outlook.office365.com (2603:10b6:3:d4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.8 via Frontend Transport; Tue, 24 Aug 2021 17:17:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT045.mail.protection.outlook.com (10.13.4.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:28 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 10:17:19 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 10:17:19 -0700 Envelope-to: git@xilinx.com, peter.chen@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Received: from [172.23.64.8] (port=48483 helo=xhdvnc108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mIa34-00008Y-DA; Tue, 24 Aug 2021 10:17:18 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 16987) id B4F916053F; Tue, 24 Aug 2021 22:46:36 +0530 (IST) From: Manish Narani To: , , CC: , , , Piyush Mehta , Manish Narani Subject: [PATCH 4/6] usb: chipidea: Fix return value handling Date: Tue, 24 Aug 2021 22:46:16 +0530 Message-ID: <1629825378-8089-5-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> References: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a9266e2-e869-4bfd-0ab0-08d967230d06 X-MS-TrafficTypeDiagnostic: CY4PR02MB3208: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:632; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iUMbi+EWJEAR644EBYkNOEQdjjrixPMzOgGptm29QDKEwVroZXzbwaY5djPUxIK20qxbU30EhpoXFphVvajJ/Vnw7Nr5qSDg1PljM6lW6v1Y46g6Mu4lAdUWiyAE/4XkdzbuILGF3Ha0fxkYwm1eQUUYcaSa8NM+Bcie/G96mFJTCnB2TTd1MOOnk80O5VUJzgtYCt3iPIHNZlGsGvdu6VN9kTxH7fGxVt1mHlbgaSrKH7h0yUVJ8ZIe6dMvwytBCh/jwke9HF/+YkxfWSrqMafHN6Hvdgrw0I8s5WR/oZYN0BtNH0sQlSbZf/EaUYg7a1/naLNOnXKpawQSSpxh82AT1q+iYwwp4hHtYi9XfnVuLf29KX6lMP5uKecpoUQqQefPqA2TtaBZ8+5TuwlTL7EGtJfn6jtwISCN0UaiKJIF56S2WLb35H5IyIdUE4fz6DP793YVV+sFzlVthRZtJpMIfIMNylBAbE7r6xAHW6nmL3DrZIyLLo9JgRfCMa767U8nNh5KZz8LP/yfuKKWV+4wKKY63WTup29+BacafZ5kuazQyHBzyOTCL2SRdlaGF9iYgqmmmbWj5STPhsvv2maRTe1igLmXpV+agpoXUvvMxb509pdypEt4iHgAKvU7+D0ucmEi3Oc5K8J54oBmCHHDp1Xq5mjvbh53Coq0+EPiDnrkT6cctLnr0sn0y9j968xPa7n0yoIkO6cZ7dQPDzZXV7Zze9/OzRxLshxvBKo= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(36840700001)(46966006)(356005)(4326008)(26005)(36756003)(82310400003)(83380400001)(36906005)(110136005)(70586007)(47076005)(44832011)(107886003)(54906003)(2616005)(6266002)(426003)(8676002)(316002)(82740400003)(6666004)(42186006)(70206006)(7636003)(8936002)(5660300002)(6636002)(478600001)(2906002)(336012)(36860700001)(186003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:17:28.8742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a9266e2-e869-4bfd-0ab0-08d967230d06 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT045.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB3208 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Piyush Mehta API was neither captured nor checked.Fixed it by capturing the return value and then checking for any error. Addresses-Coverity: "Calling without checking return" Addresses-Coverity: "CHECKED_RETURN" Signed-off-by: Piyush Mehta Signed-off-by: Manish Narani --- drivers/usb/chipidea/core.c | 11 +++++++---- drivers/usb/chipidea/otg.c | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 2b18f50..676346f 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -700,13 +700,16 @@ static int ci_get_platdata(struct device *dev, if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) platdata->flags |= CI_HDRC_FORCE_FULLSPEED; - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", - &platdata->phy_clkgate_delay_us); + if (of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", + &platdata->phy_clkgate_delay_us)) + dev_dbg(dev, "Missing phy-clkgate-delay-us property\n"); platdata->itc_setting = 1; - of_property_read_u32(dev->of_node, "itc-setting", - &platdata->itc_setting); + if (of_property_read_u32(dev->of_node, "itc-setting", + &platdata->itc_setting)) + dev_dbg(dev, "Missing itc-setting property\n"); + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", &platdata->ahb_burst_config); diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 8dd5928..d527d9d 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -168,6 +168,7 @@ static int hw_wait_vbus_lower_bsv(struct ci_hdrc *ci) static void ci_handle_id_switch(struct ci_hdrc *ci) { enum ci_role role = ci_otg_role(ci); + int ret; if (role != ci->role) { dev_dbg(ci->dev, "switching from %s to %s\n", @@ -193,7 +194,10 @@ static void ci_handle_id_switch(struct ci_hdrc *ci) */ hw_wait_vbus_lower_bsv(ci); - ci_role_start(ci, role); + ret = ci_role_start(ci, role); + if (ret < 0) + dev_dbg(ci->dev, "switching err %d\n", ret); + /* vbus change may have already occurred */ if (role == CI_ROLE_GADGET) ci_handle_vbus_change(ci); From patchwork Tue Aug 24 17:16:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 502104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF7D7C432BE for ; Tue, 24 Aug 2021 17:19:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D758A61357 for ; Tue, 24 Aug 2021 17:19:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240259AbhHXRUS (ORCPT ); Tue, 24 Aug 2021 13:20:18 -0400 Received: from mail-bn8nam11on2052.outbound.protection.outlook.com ([40.107.236.52]:30817 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239504AbhHXRS2 (ORCPT ); Tue, 24 Aug 2021 13:18:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nSuOkG0XUTPKhUlnU6zHhHHxQqNDfcGU29KNtloUuw4CmlRKcxK17MOU4UoGB8NgtKI3iN2OYrDCmSifBdBiONY1f5dpIzN+QPqKWXFiGUalidOHjyq/ys3hGfxQFgmcIU7RZzrhvh+4nBxYjewR25CpLAwu1jHPODNkf+d/zBzZYmVuY+i+IeONtMuxG3cs3TG1lPhb0ECEOxK5Bc8NeQyDGiOIOE9xQSqlwTLzVmQc0JLtJL5WcQwqwczdBNxa2w6LKK8GYkzOyo0UjfhGR8cIN+l227CJfLlpEqi75+aJ/03xnzXx1+CRjVp4xuUrptUbHeBhXfD6wwr2lshJsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zTyg4IEu+LpJiHDbbckPs34+/Yzt10Cuf/+CMBWMYQs=; b=ZyCtiX1Nag7YuJAYXVGp/p4Vif0jJ+ndK8zwVH73ErOBwIboRWof1AEmjzHw69j2RuPPYdcXcBltY+Vp1rXceV/qptp9fXCXzVbOLnLOymIy2tg0XkEYcU8HEtdDPESxpWsB/UqcIau/3Z6cy6pBwLAkVT2ssdRB1WxW+p7G9KbmL23JoK7Tu6lP0w4a0c65WAguB4weieJKsaGqNFKM+Pyfni7GhezXKHcsFc+5giWwXne1hZ26aZ2VuofsJm0lcVCiFRPX8PNS9sTOouAKegw9VO2u0aZy1Ae0W+vle2GuiMlVtl5kkXkNQ0R33hYKIAlLVGPSvxEO15+lK88oXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zTyg4IEu+LpJiHDbbckPs34+/Yzt10Cuf/+CMBWMYQs=; b=OtQqiJITZFcNaxWYKewHaTTslJSFMhuLqsa3kMxCFxhDzji4RCpB4JaBLyFcS93d5JbVCNXM7LpbGHawBgwUS3AKOxk/Ft5QR6qAMR53Szz2ZWIOUZ4IWL+kxGKSWvqNKCCZwzJrNLJb2pORlK9zv4Kxx+edqfXTBMhidBEregg= Received: from BN9PR03CA0984.namprd03.prod.outlook.com (2603:10b6:408:109::29) by DM6PR02MB5690.namprd02.prod.outlook.com (2603:10b6:5:7c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 17:17:40 +0000 Received: from BN1NAM02FT026.eop-nam02.prod.protection.outlook.com (2603:10b6:408:109:cafe::ca) by BN9PR03CA0984.outlook.office365.com (2603:10b6:408:109::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Tue, 24 Aug 2021 17:17:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT026.mail.protection.outlook.com (10.13.2.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:40 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 10:17:32 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 10:17:32 -0700 Envelope-to: git@xilinx.com, peter.chen@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Received: from [172.23.64.8] (port=48485 helo=xhdvnc108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mIa3H-000Efu-Fx; Tue, 24 Aug 2021 10:17:31 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 16987) id A207460540; Tue, 24 Aug 2021 22:46:37 +0530 (IST) From: Manish Narani To: , , CC: , , , Piyush Mehta , Manish Narani Subject: [PATCH 5/6] usb: chipidea: core: Add return value function check Date: Tue, 24 Aug 2021 22:46:17 +0530 Message-ID: <1629825378-8089-6-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> References: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1f04210-074e-4282-2cce-08d9672313d1 X-MS-TrafficTypeDiagnostic: DM6PR02MB5690: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1728; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9p5rLdm8XogQNkP9Q1RxUNh9AEYyicZhgOlG7iC+IrNzfru0Zy3KG1SM9fUKri8IRVKJRb8FVUBMY8cCCcJ9Hp2NRSu0fEgJLra03LpDoI/w9OfsILGyXukg/6pz/k3UeSQafA0jW8PZhYyVoNav0f2xsiK+aPw3GLYODBulfFz8ht7LAQ6MFRFJnmeqU0R86IwLbNnvI4bFXus6xRbTvLQJvARLyXxOz3PZbGo2/zYZ+c6fQBbNpLEyIWjolEUrERzmDI1L1Y/FH0rBBTEktAv0wkURQAfwFw4rFudUXUZcWOpL20BBi+I6/B/Pd1QhvUOOKIqS6po/UZuqDKwgrTR5VDHccbRDAuewTlGOJW8sWX+Ht5oabiyp+BxtkLpSvM0SNuNnY54h/9j0KpPNzwdLDMuMWogTodakcux2BxfDMDAfM8fuHP9lFO9I5YSqB0Af+Um1u+UbKAVx3z1vDLHNjs2ipqBB1aclVnWLccf5oXCdsRv4ArQw79ruF9wutHo30UcCWvysS+ejhEtgJUrH3kdiVD4JtumeM3nsmG1ZaVoak0Z/S9cspmkTWHaEVxTIXa9y1fzLFVcGUEXByWynIcvWVHvIQUGkYA7v+qXLanIHOjnxSNkCSLMdl/p9P2tdg6fxuyaaZQM+IAmQrihJaHUoRf24vP5yMzzA1Q+J6SpV8c6KtatSHJ/36dWE237+IqikoC1ZAxnwVEPtPXzdZCNtpAklyZ/RjLhFykY= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(8676002)(107886003)(6636002)(8936002)(4326008)(356005)(42186006)(5660300002)(36756003)(70586007)(2906002)(83380400001)(7636003)(47076005)(26005)(44832011)(6266002)(2616005)(426003)(336012)(36860700001)(186003)(70206006)(110136005)(54906003)(82310400003)(6666004)(36906005)(508600001)(316002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:17:40.2318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1f04210-074e-4282-2cce-08d9672313d1 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT026.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5690 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Piyush Mehta Add return value validation for function phy exit and phy power off. Addresses-Coverity: "USELESS_CALL" Signed-off-by: Piyush Mehta Signed-off-by: Manish Narani --- drivers/usb/chipidea/core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 676346f..37f619e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -324,7 +324,8 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci) ret = phy_power_on(ci->phy); if (ret) { - phy_exit(ci->phy); + if (phy_exit(ci->phy) < 0) + dev_dbg(ci->dev, "phy exit failed\r\n"); return ret; } } else { @@ -341,12 +342,20 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci) */ static void ci_usb_phy_exit(struct ci_hdrc *ci) { + int ret; + if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL) return; if (ci->phy) { - phy_power_off(ci->phy); - phy_exit(ci->phy); + ret = phy_power_off(ci->phy); + if (ret < 0) + dev_dbg(ci->dev, "phy poweroff failed\r\n"); + + ret = phy_exit(ci->phy); + if (ret < 0) + dev_dbg(ci->dev, "phy exit failed\r\n"); + } else { usb_phy_shutdown(ci->usb_phy); } From patchwork Tue Aug 24 17:16:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 502685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11CBCC4320A for ; Tue, 24 Aug 2021 17:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F10676135F for ; Tue, 24 Aug 2021 17:19:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240147AbhHXRUT (ORCPT ); Tue, 24 Aug 2021 13:20:19 -0400 Received: from mail-bn8nam11on2048.outbound.protection.outlook.com ([40.107.236.48]:38112 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240011AbhHXRSd (ORCPT ); Tue, 24 Aug 2021 13:18:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KJ2j9NIp5gboc5DVWQEW6ZZJAa178N3AmyN0NPpj8nkpU/gys9siYpGpNUjnsanlGOCuWpzJHO2WJv65w/uTqRwba2pXEPBqLnJWl5/ecHF67W0Nof0rJMfaA4iHj4fVk/DJJEPBfJD8JuGYC98UXjx/hJcI3vlvqnaYqekPPcnvyO4kdMBRpZkOeyuBf/53grb89nBMFZXSwQg8pwUKrJymfnAfSeT6ZEj+o6HNN6trP80qnXdkCBOR6oYGqxwHeds7s4DzDg7EAvaj5l1WNNugJ7LA4/uxpPh9tcNGeuXxMWPn3/dSOQBT5497O3Xuh7nAuE5Y/cEjOsNKXINW8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7knTfQSDfMufJP+ojSC1wtxOeUxx+4Rdvq6I68xMd0k=; b=VxD8pOlB7KW+vxBnom2vSmtAOziTmKIzBZtS4PS9KBSUtHY3r3teXBYVM76am8TUYxQyNAUXtWSt1I+NRs6cEnQUk9vW5Z/oq1zLFv58m59coZiy54z2Uzx0SH/YISXHWkRrPbLZ3ZMShj/g4UisKIbxi4/tSfR3CUFTRFFTQunG/D1ka9fvj/a5bd3+yCCpfx1TDWV+4LJspjiqUy80WvFdT0S1Q7onNUadyLPkO0uWXcg2NPRE3+pOqF9xvXtPsUS9kMWznm1zRhGiFUa6ONDH0t2dRoxQwjPnn6fGpAwOMjIYKV8kIJC+vLN339wmsNfOa9zfKgrcY2BiOWQzLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7knTfQSDfMufJP+ojSC1wtxOeUxx+4Rdvq6I68xMd0k=; b=n5JAf4QbEWP1rYEbqClsyXiQJOA5hABZbCkFAJupM24QMBXKEr7e6aRtd4MZzGARS4uB/8CR3lX+eX//A3+iHAY9xyRgmRn9WosfSRmom8YPX7WxROIxvCOj36UzUZh6SukTK0T9BDroA78e/JTDgMhbbUHMXdsip376xpBs6Ys= Received: from DM5PR15CA0049.namprd15.prod.outlook.com (2603:10b6:3:ae::11) by BN6PR02MB3315.namprd02.prod.outlook.com (2603:10b6:405:68::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.23; Tue, 24 Aug 2021 17:17:47 +0000 Received: from DM3NAM02FT043.eop-nam02.prod.protection.outlook.com (2603:10b6:3:ae:cafe::8b) by DM5PR15CA0049.outlook.office365.com (2603:10b6:3:ae::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Tue, 24 Aug 2021 17:17:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT043.mail.protection.outlook.com (10.13.4.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:17:47 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 10:17:45 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 10:17:45 -0700 Envelope-to: git@xilinx.com, peter.chen@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Received: from [172.23.64.8] (port=48488 helo=xhdvnc108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mIa3U-0000Q5-Ik; Tue, 24 Aug 2021 10:17:44 -0700 Received: by xhdvnc108.xilinx.com (Postfix, from userid 16987) id 61AA660546; Tue, 24 Aug 2021 22:46:38 +0530 (IST) From: Manish Narani To: , , CC: , , , Piyush Mehta , Manish Narani Subject: [PATCH 6/6] usb: chipidea: udc: Add xilinx revision support Date: Tue, 24 Aug 2021 22:46:18 +0530 Message-ID: <1629825378-8089-7-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> References: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d05b435-1beb-4e01-912a-08d967231802 X-MS-TrafficTypeDiagnostic: BN6PR02MB3315: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: txjzeAXG27GBNya055fTLhmGCJc9bhW9Cn/dc9R9MKyqCFpBD+S6x4C8lMzMl2pw1S40DbGtWQcVIygFbHBzcQD/afEpwlnheqyWw7dQp9cBTQaZ63Uzfa3rWqDrOYz2q9cu6XpPl/u8MaI/LN2QBP3fpbJI7OJjG3nl0zr3J55SWedMrYTfD/M+kCR51W1UaxF7sSw0GSgRuwWWbi2KidBsjlOr5vS7N5pm7ozoXcrqQxODB0t00OSbJlr5IC0KMEgvBCostg6s63Snf6ZTeF1EczVmmcs8nZNFWnu92PZ1UhQDGb5xDGxnsmfu2UAGp5N/i+qqoOrYF86N8cSnX7BC+d7xOa6h7WT+aE0+ATiwQtvoGnI1q/ecivU+8cyOSjymumwlqkTMuOxVDfJu18FnQ+58bh7zQYFswDLa4rMsLFh7fHbNaU5J4JKMwiq6oTKUirItUfKyaaVdn5eI6T+D7ouj96SlKKcTQDYODKGR7Ej92aHafbG2MtMGdOf09ySKFteZH7Qe6ybhRWWVuK9Q2NZonNkj2BbdU163hipHF82rmJaIK/xaDOpKVHtBqTtgAyj3Ups+KNFwrqZLYyJ69xI2BtSnGVqqMj1d0oSIZRXg8rdRvw2o41bS6OCxs1kKKofHLU0FL5l/eWCGg3dgodzuymISJ+tITs3ifPhF0EpV/69g9Zl/z5tGWi81rnU2AcvLFmUmyLttsupjnLBpQ5VoEJumK1LuZqhYo4w= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(4326008)(336012)(5660300002)(186003)(36860700001)(426003)(44832011)(36756003)(8936002)(356005)(107886003)(110136005)(47076005)(2616005)(42186006)(70586007)(316002)(6266002)(6666004)(8676002)(70206006)(36906005)(54906003)(83380400001)(6636002)(82310400003)(7636003)(26005)(508600001)(2906002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:17:47.3053 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d05b435-1beb-4e01-912a-08d967231802 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT043.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB3315 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Piyush Mehta Issue: Adding a dTD to a Primed Endpoint May Not Get Recognized with revision 2.20a. There is an issue with the add dTD tripwire semaphore (ATDTW bit in USBCMD register) that can cause the controller to ignore a dTD that is added to a primed endpoint. When this happens, the software can read the tripwire bit and the status bit at '1' even though the endpoint is unprimed. This issue observed with the Windows host machine. Workaround: The software must implement a periodic cycle, and check for each dTD pending on execution (Active = 1), if the endpoint is primed. It can do this by reading the corresponding bits in the ENDPTPRIME and ENDPTSTAT registers. If these bits are read at 0, the software needs to re-prime the endpoint by writing 1 to the corresponding bit in the ENDPTPRIME register. Added conditional revision check of 2.20[CI_REVISION_22] along with 2.40. Signed-off-by: Piyush Mehta Signed-off-by: Manish Narani Acked-by: Peter Chen --- drivers/usb/chipidea/udc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8834ca6..b440205 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -680,7 +680,8 @@ static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) if ((TD_STATUS_ACTIVE & tmptoken) != 0) { int n = hw_ep_bit(hwep->num, hwep->dir); - if (ci->rev == CI_REVISION_24) + if (ci->rev == CI_REVISION_24 || + ci->rev == CI_REVISION_22) if (!hw_read(ci, OP_ENDPTSTAT, BIT(n))) reprime_dtd(ci, hwep, node); hwreq->req.status = -EALREADY;