From patchwork Tue Sep 1 02:33:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 258712 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=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, 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 E40B5C433E6 for ; Tue, 1 Sep 2020 02:34:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0A1B214D8 for ; Tue, 1 Sep 2020 02:34:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="KyA6LgJT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbgIACe0 (ORCPT ); Mon, 31 Aug 2020 22:34:26 -0400 Received: from mail-eopbgr80041.outbound.protection.outlook.com ([40.107.8.41]:62222 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726085AbgIACeZ (ORCPT ); Mon, 31 Aug 2020 22:34:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iH9vgvwF56lrNpD97ahgVXDAFksr3LvLjfV1+Dfo5QIpsGxFh57N9pFO1Gz1kzIj2BgrrSM47l491VgeRNaEhSM9U7aXceyysSSuxTAKFUfGvAdi0d0Mxx/38tor8tq+Cbq7nqIpD5iR6ArRvUGapzYDp+FkK6hBcCOJnC0PXKPD+9w0y4utv+M0enAY263SRVmAMJIYk6DOEUXDr9+6/L0+Xwab6/NsaLBTH+rW3qHMI9RH6TOWZplkZSJtM2hqcflmSkMZ/y/HCrvVZe8cOCE8ApUYUo0RnZ1xqKE6/BwrXWzRFjLc0X7yjfa7dIjCklcK/63TxmYkpF6n5jA/4Q== 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=DsvBjETSvift2/BFN3OIEpBPLCA54eKlmaTScReFHIU=; b=XiU/U0RyR5k51ddRg/HrWoy7C7agzjWgp7NAzO9PgpdIX5hh+AnZZ9eMP2qMbiCd/9+Eqt3jRM27H7oL30rp4mifXDpnx+6dL8zK6Vw8BZHAerSz9b/rQkNdsgdEarjM+aAT3gMsStd3RcvIUCrpvVCmkV/K5rGcU6U/f/y1RzedbDdwzTlUn/qZjgJcEfScvEWnPbPaEtUq5CZpVgv95lI3bGPBGJcegU/cLNYYkEYuqopQo6bRuUjsiZLGpqDUnOODZn2kVsgd2e7xG2jypiTvFGHZqaWLTOfTq64Opg0+dX0KcWbssIbudbIkhAK4fylM/W54UMxVdHloBnIRig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DsvBjETSvift2/BFN3OIEpBPLCA54eKlmaTScReFHIU=; b=KyA6LgJTenmdGdaRIw9e5quEQYIHq0l12+ARPlAuTvIOmKVp5cxp2nmF1dV6XcwuO+CfNL5hsWeu7d7Wl1f+ZfFIGtHbBQCYEnHAFMqYbDceRWLKBQAxxPKvtOlUFCfPpoaIKoJDmAGQEF/HJJbVnCFK6MpcdfL7GgQu6lJajUo= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6998.eurprd04.prod.outlook.com (2603:10a6:20b:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Tue, 1 Sep 2020 02:34:23 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 02:34:23 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, gregkh@linuxfoundation.org, jun.li@nxp.com, Peter Chen Subject: [PATCH 1/5] usb: cdns3: core: quit if it uses role switch class Date: Tue, 1 Sep 2020 10:33:48 +0800 Message-Id: <20200901023352.25552-2-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901023352.25552-1-peter.chen@nxp.com> References: <20200901023352.25552-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 02:34:20 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 023a7871-5006-4a8e-bca1-08d84e1f8977 X-MS-TrafficTypeDiagnostic: AM7PR04MB6998: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qmVACrpvgrrrD6gmR44gXKFgwqszfgZgBTbhz/svDVxIXC2f1ZdmPjo3GIKMWXBUxK5lmg3xB5tdVzhhYYa7iRqQoH/QMW1TiXI5WTihRET7Nmiicuwmec9owcnHNem9ToisMXXr8P9BC0qwdZFId6/vKsG80CkrI95pyjs5aZcI7IMXwWopDbP5ojKbGhO6kLjMotrEffMJXE8UhwC1fCnduTkvGi685bsL6x7OQJn2VJXmsTklfNQEq5TvlTwJJw5FkI5Y39dWe9khOAsw1oRQnQ1d4ogLkLQTYA0EDXrOhLam1rlWXT+DoNsj5vGtHhWvpoD9gtpqXdAVKfViXA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7157.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(6512007)(6506007)(4326008)(16526019)(186003)(1076003)(26005)(4744005)(478600001)(6666004)(6486002)(2616005)(52116002)(8936002)(2906002)(6916009)(36756003)(86362001)(5660300002)(8676002)(66946007)(956004)(66476007)(316002)(66556008)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yNbT9kCiI4w40o3+D45P9wBZdn3aScB8F8hb52Cd2RnKnoUcnBgY+PnKho1WSxxTIITp7uY9jyiM6yYznf7XZXoVJYO9/TBASwioWmMkVMLUE/nZa78BHa4Lb1mwvPRY5up/vYSFdg6CDa7D6y+BEvmD1FayOE5I+l2CDMosOv6Ft31+EcF/YZY3ag1OLu20+5dsvUEtgy7yTp69V94qWFvq8JkaT9kd89/Pew0AA6FtN4uaojI5hCjbHT2fq3IyvvQ7MRibUyURhArdJT5WaUmXkN+wrPFDQ46TZNsNXv3hzd8Wgz8kysX3l2UyNR27OEmJVIpiybIawWljxmZcqcEVSetpZhtEzMyvwx1/95sYd1H2hdBodxyO59aYY2OynJ/ptjcE8wo0iUgVmrsgiH7RysvMic3uLpgoVoXQx0g5FACAw9FgTtQzCZljxkEl9Ar+4W4/c+v5Oji+8iCRCmVucrmEtI3WAuP/RYmz9JZ1IAhKxfzxPn/iyhmAR+xkXCFXJaftFVPC6UNfN4m62Xq3IFGsQ1E7oTZ65QbldO2/ioKa/Xyb/kN4+IRBE22N3mOoCR2I4RZMGLDpNfqsDU9l8dw4lsSEm9/z83zNTAIqQiRQVlQgjHVbg08S8voovQWMF/Sr1JIINa42MMzlig== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 023a7871-5006-4a8e-bca1-08d84e1f8977 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7157.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 02:34:23.3688 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ebGq5aH4hgTLqU5yVLYhEYAWSpKWPyOMOHT2aWMzIB6H9w7YfjRBZkzlTLJNc7LwwMBI98TDxyQUoSMH0P18vA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6998 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If the board uses role switch class for switching the role, it should not depends on SoC OTG hardware siginal any more, so quit early. Signed-off-by: Peter Chen --- drivers/usb/cdns3/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index faee5ec5fc20..96c2da4e20c5 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -280,6 +280,10 @@ int cdns3_hw_role_switch(struct cdns3 *cdns) enum usb_role real_role, current_role; int ret = 0; + /* Depends on role switch class */ + if (cdns->role_sw) + return 0; + pm_runtime_get_sync(cdns->dev); current_role = cdns->role; From patchwork Tue Sep 1 02:33:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 297794 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=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, 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 16466C433E6 for ; Tue, 1 Sep 2020 02:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3EF020707 for ; Tue, 1 Sep 2020 02:34:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fHAea0Ep" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726479AbgIACec (ORCPT ); Mon, 31 Aug 2020 22:34:32 -0400 Received: from mail-eopbgr80078.outbound.protection.outlook.com ([40.107.8.78]:38116 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726085AbgIACe3 (ORCPT ); Mon, 31 Aug 2020 22:34:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SRmknsOwh224BJxRc6kClO8yljcwBPIW65arfrySNnZtK+F8vYdUM4SEiBs+9Rv4HocglONdV+wg2myXf/8jbk+5JaBNcHzp65FGPGSKPMhe4TqsyDYaZKEYNWTlicAtKomIJmn5oFgW7vvrqwTCSS0X9r3sKv12eObtmEVfeO3ZoKapNG3QOsH4PZM4lZ35w+NTWsaZcF9Nq/dbNWMjOBG+HmUn5zO5PDM5B6iZPCSuwdyzeHx9PaVJ481nSyaeYa3aZSl6no6ah+VlNsJWiKm/abbUyZv6lKpujgO1wPpYlTrfQGhM0ZnDG2s2rdi5sZoNGCh16ZXVtohXQc1qLQ== 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=aHPhgfQ7oDZcRLbgclz6ycbeCsO6Qm31dtaydGM7EFU=; b=itUSKPNZp+ti/xIrUfyTbUWrkQFA6rCOYZT/Jb0BBXKJoXVbIFgqwqnlxObOwnOLqBBbA4YyS+WQq0FzNEfWPuE2uqFZg+fWdfun29VPisc3ZH5aio60AagcjxQcNqzVacmk9KXlB6coouk6xaDmzVUclUipWPjmrYH1vvL59USwQZmh/nfFm09nFTmDc+oBIDgqF0dJF0G47I2GKa9dDMfGW8wr9QO4FZ1MjD1LNRiqbKwZv2nJEitekPmdSBvSn6Ln+1tGkrfP2TXgr9lMY09ETBr8zpv3qk889/aMCbUjYxj0YE0xKndT6xltfSJDgXp5nMNtOAFEqx+5JWzrDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aHPhgfQ7oDZcRLbgclz6ycbeCsO6Qm31dtaydGM7EFU=; b=fHAea0Epl3QmlVO5qpFWMFfrQQO4jmQlO1gip6rrWvYVZGsv5jblENQu39n4KmQDJrSoM3LVvBmcwDeQDDw5xUj+DgE4PHXhdEC3oBIfhpiSs86gmyE4SQv6WeV68I3nQMgi3OOiYbyhSqysCnS/hpIZvgkaKtuAPxCkS1xgMg8= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6998.eurprd04.prod.outlook.com (2603:10a6:20b:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Tue, 1 Sep 2020 02:34:26 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 02:34:26 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, gregkh@linuxfoundation.org, jun.li@nxp.com, Peter Chen Subject: [PATCH 2/5] usb: cdns3: gadget: set fast access bit Date: Tue, 1 Sep 2020 10:33:49 +0800 Message-Id: <20200901023352.25552-3-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901023352.25552-1-peter.chen@nxp.com> References: <20200901023352.25552-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 02:34:23 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4f83436a-6c74-4178-57f5-08d84e1f8b52 X-MS-TrafficTypeDiagnostic: AM7PR04MB6998: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jgimX0HSAoihZ6H3nJoiVB7YtnUqGSJkOXxHfcX5dtYgUJ1M89mtpPIr40AIv7IPoI2XTiMepaqcfDKL+ykvvdlQ8O6ZzPqaonArz24iEWd239YrZc/USJQYagtG/CbrtDjFSUr+CCw/7SnnekhkbcQqxwx7uqpHdDNIe+Nili+SkR1JPbF6tICHX7enQZyRAPZUB32zJV9onACeyl+BCxdyYB+6HZeXNxaMqK3yQQ0TNWusOJJDCtffvd1ThUe3UcldGGWfBGH+CJ1MkxmKrjljSXQXQY4LPbxGgrJOO2/dVHIaBHl2qc70sA/5IgWS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7157.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(6512007)(6506007)(4326008)(16526019)(186003)(83380400001)(1076003)(26005)(478600001)(6666004)(6486002)(2616005)(52116002)(8936002)(2906002)(6916009)(36756003)(86362001)(5660300002)(8676002)(66946007)(956004)(66476007)(316002)(66556008)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: l0rMFbjKNmRlx7Bp3dowbXP5G2atGpTXCCgxhw+5DqyZmhUnSM1vvz64+2VEzJmVwd0Lvm9pOgPasTnU5IYEJ/PHp0qjtswKLEvqgcrDtMG4fPDSggDA4jmY8i9R2drYYLRb4PkG2Fzi6rYYwLM1vEEMDuSvnKcPVjwArHz/1QjYSSuDaIUULQz7TGsLoEVAMCC0v+kz8rL+HtAPDYeScjRPOXsWW/FgdDlKBEbQ7PcVModByxzgF9qJR94tW2UlK/cl/x8ggBFql3Moq2WsNKBQJOmwNqlhnREPmacMQauNZzDd/YCeY2ZEiZitYAIVGe9gGA5rBVDOTBnvXmPxFajInYOXjiYi0SkYDPm094DJHr4F+YcgpP+X//xPHSwcYegFzaU0fu1n2u9GFzlmUPcb3omMFk1b56rqXhYgjWzwPcPNW3t6JeldnYthG55kAi3cXhsPbJS860lHHrIrh+RWfGPQ2PtqMhRJZFAsPCSgma2fQKQYY13bEuPMGK3o9bSYNT5KqbTvkjDzyBueZfWoLxyINJRrfJeD3iKLvIhACQpNRnmC1U1Yi8/8bJ5XHpRHTiI78oHPU19Q5fQXujK28ARn0TIPWAxJHXM00SAQiwYl2X02Q/p57KWkALS8MnlGYzLy2Z7fAh7eY1BuTw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f83436a-6c74-4178-57f5-08d84e1f8b52 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7157.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 02:34:26.3457 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /lTuT33VDrMgVSVLotMoQ+NXJyZNIQowrehWql6F3GHsHTr0vZXtfEbcp/vQ3jJH/HSIG5DQnpOG60+DOjH5tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6998 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Below is the recommendation from Cadence designer: Using this bit to be sure that PHY clock is keeping up in active state. It's good to keep Fast Access bit enabled as long as there is any access to USB register. It is used to fix the potential ARM core hang when visit controller register after DEVDS (.pullup is cleared) is set, the threaded irq may be scheduled at that time. Cc: Pawel Laszczak Reviewed-by: Jun Li Signed-off-by: Peter Chen --- drivers/usb/cdns3/gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 2551901e8470..03b54c239944 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -2783,6 +2783,8 @@ static void cdns3_gadget_config(struct cdns3_device *priv_dev) /* enable generic interrupt*/ writel(USB_IEN_INIT, ®s->usb_ien); writel(USB_CONF_CLK2OFFDS | USB_CONF_L1DS, ®s->usb_conf); + /* keep Fast Access bit */ + writel(PUSB_PWR_FST_REG_ACCESS, &priv_dev->regs->usb_pwr); cdns3_configure_dmult(priv_dev, NULL); } @@ -2866,6 +2868,7 @@ static int cdns3_gadget_udc_stop(struct usb_gadget *gadget) /* disable interrupt for device */ writel(0, &priv_dev->regs->usb_ien); + writel(0, &priv_dev->regs->usb_pwr); writel(USB_CONF_DEVDS, &priv_dev->regs->usb_conf); return 0; From patchwork Tue Sep 1 02:33:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 258711 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=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, 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 EC2B0C433E6 for ; Tue, 1 Sep 2020 02:34:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE26F2151B for ; Tue, 1 Sep 2020 02:34:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="A17IkOdo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726490AbgIACeh (ORCPT ); Mon, 31 Aug 2020 22:34:37 -0400 Received: from mail-eopbgr80078.outbound.protection.outlook.com ([40.107.8.78]:38116 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726489AbgIACed (ORCPT ); Mon, 31 Aug 2020 22:34:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VLtUVC7i7JYNErZ4VdJLDXXDgjCn60rhBN/thwX0KHIFs9o4xKOGBfiiBqJfiqi4QvqF0MzHcoGY1Wy5ibtUCAaNkzajo5BpQuZ5WLJ4dLQmHL55MivESrgQqzBgRMU4qzVDp9yhJArHSORgl/fRqCbkz3CRv679SKzNvz8iu4pIfSSoi+PJcKCMtEfyFnVXGIv7KxOQqEyBPGYnoe+1LQyTf2nd1bvJ4A0JHKjV0YfkMc+pXGD/ZUyVhCkNkAc3xHUAc/cjRAgSbXnYLoVIYoxVUC7CrocnFqlM1MNHUT13XQ0645lXkOqEWXLBdk5MBi+uoZRwi4mDXQGHYTiYDg== 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=y257xY25EdPqAKNa8KglmdLeB570pig64BFets0G5cw=; b=lbQXxuck42a7cs6qwJZg+htHSfDkCnEF3kG/3nvlK+h0Nyt9A3SvEYK4v0EkI5sgX9dCfvPTm9OD5rHXIuNDhxfDT66I/h6DX8VE5krHsFm70+xhmi8h5iLUbPC93zndNWGzmBc8bkQZ/OMqaRjsw4zSSfgu96pBujcP1qqaCS213dG6yC8+872z5DE75jdFScaDrul2tGulngQVdnMHlWRmXBwljFAWg+x78RDK3O+6M80fO6WXdSkh26IjIx7GqjgwSm6wtmsjawqmL/wkRN4LdfaMgZrn8p0f0PRXfRP7BiQn8pvS/oBu5VIbVzKlc5E+Il8PWwLUMGvzLakFPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y257xY25EdPqAKNa8KglmdLeB570pig64BFets0G5cw=; b=A17IkOdoiXScFFK4/pHysqppIWIwgIldvBsADD/7G4LGWl21xxcYt0b7awhk3WyMuH+dVJ6gEvj41MIMQOI6U3JvFjaGQN0hn2VOcAdJbcvsKxendFTfViXYKqnOK+RP+1sZoScrJbqtrLBGshE2EDZ+IlXJtg/WUA5btzATJwo= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6998.eurprd04.prod.outlook.com (2603:10a6:20b:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Tue, 1 Sep 2020 02:34:29 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 02:34:29 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, gregkh@linuxfoundation.org, jun.li@nxp.com, Peter Chen Subject: [PATCH 3/5] usb: cdns3: gadget: clear the interrupt status when disconnect the host Date: Tue, 1 Sep 2020 10:33:50 +0800 Message-Id: <20200901023352.25552-4-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901023352.25552-1-peter.chen@nxp.com> References: <20200901023352.25552-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 02:34:26 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d9cdff27-0345-4ac3-6016-08d84e1f8d0b X-MS-TrafficTypeDiagnostic: AM7PR04MB6998: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:660; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ny5t2kRjdfIGgGMEms0+QNFMwred1AVnf9u8d4hj7ugzcM7mPda0yCXISeEkDb+qi0wpEr/mZDw7aYl1f6puMGtOmW8SZoSg9dNv8W5+58DoPdp4n9BRM4rULM1pTOOSeRTjBotUkV6zjnirrl4KdO1/FHldcyLwMKDcCvC/Q5hwhxcfErAmabus7dhosC1kZAwBbnSbRkdX/FUkSNPb9S5+b55bvlIZeZmKQB4BPtpjTVHbbg5p+WNasjY+q4iQJKEa2JKH2qo4/rOrz089xSMcwwq0iXH94A6qCIKgutQxpryWRmA1IJLSCzrUM4RB6mYQXoYkV8krp0fGLaC6bw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7157.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(6512007)(6506007)(4326008)(16526019)(186003)(83380400001)(1076003)(26005)(4744005)(478600001)(6666004)(6486002)(2616005)(52116002)(8936002)(2906002)(6916009)(36756003)(86362001)(5660300002)(8676002)(66946007)(956004)(66476007)(316002)(66556008)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0kr1mNkQTV22QVK/dwe+OtDkFC54ZI3fUROuoAdn5E5QeQHw09TOtutJ1wVDymlO2bD+YPeL/4LAOJ4lmFfaA4cVr4DN5QtTqdz2BqjxEYHXeZWGZPDebK0JthL2Kx2nNVH+fEi91dIvBumzj5Gu/cxJ7hv7UpckooKH6QzblZ6qmEn9XCdU1bvlvo/y+2623PWZAX6j+XkGYC4pZvs9TptQC0eRE5/QMO8toYMcscfljOz6O0illVSuB+Upm/gcg1LVRTEG5EmySFY65L2XNTHaWGA+fToSUqUULnfyB2j7JLBrdT9rYvst4gTGdM0hkZDEVfcuCoyu2kqeqB2DvFLQTgoIXe9sFyBVtpyYCRru7q/6Tk1mpq77FvxIfBBiIxN34gZ9bHcmKEvyr3UjMoisy1UXmn3sayzPTz4Qps9UP3fbXeAnRDN2RhM4IDIApbNDOS2qPsfAQvrmGJrFx09Vj7buHtAHPVAQ+ukjyMDjYjSOH+eSzlzHpz5oKeYNxDYaxGwqPOH9ipHt42+1fTGMYAu5t/dlkNwk2BvqJ2JST3r/LlBL1KcS3diTKfqjGk++TRlsLJBzDNU7Uurpm7KzOvqmzUyiABXcdZhszGLrWCXrk4dP3BPQrq7SON/xLDOp+AIOFHkO4/F4y2ZsDQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9cdff27-0345-4ac3-6016-08d84e1f8d0b X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7157.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 02:34:29.3536 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LixYyNpo4NlQk0t1I6Knr97/JGaSeR1TGkqFfbOQ431k69KV3FV6qL/2cMKZpU7ppoxukIIUdm/rk0tX6iH8HA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6998 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It is meaningless to handle any interrupts after disconnecting with host Signed-off-by: Peter Chen --- drivers/usb/cdns3/gadget.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 03b54c239944..829bc917df39 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -2739,10 +2739,13 @@ static int cdns3_gadget_pullup(struct usb_gadget *gadget, int is_on) { struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget); - if (is_on) + if (is_on) { writel(USB_CONF_DEVEN, &priv_dev->regs->usb_conf); - else + } else { + writel(~0, &priv_dev->regs->ep_ists); + writel(~0, &priv_dev->regs->usb_ists); writel(USB_CONF_DEVDS, &priv_dev->regs->usb_conf); + } return 0; } From patchwork Tue Sep 1 02:33:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 297793 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=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, 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 31FF1C433E6 for ; Tue, 1 Sep 2020 02:34:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DD5F20707 for ; Tue, 1 Sep 2020 02:34:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="V/4B/9mz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbgIACej (ORCPT ); Mon, 31 Aug 2020 22:34:39 -0400 Received: from mail-eopbgr80078.outbound.protection.outlook.com ([40.107.8.78]:38116 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726044AbgIACei (ORCPT ); Mon, 31 Aug 2020 22:34:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X4+pHUz3XQ4bMH2+9sLguhKq4GtL1/Fbqqp63d/Ied0ZeJTw9IIPlFvFgItuyYVUMuIulCpikkpkkI2Gvfx2HKJnQFZDFL6nCfjndyxqgsZsExGn5Z1M7jevn9bB5gMIW7iaP+vtlX4oBwDNKM62oo9iUlKbc2avB1igug6Zt8I4V3Lac+SMhr67ugRu5vKJmjyKe4u09zyJpswBemmPX8S/VpT34v8XG1Wg46cOxHHxS0lDoFlH/5OfzVMRddy6KWrwVl8MIFq/YqSsh2/tjv2Urb4NSiCpjK/o0/dqC3zWnSuN165icgy5i26nz+VTa5b+tAOf97mQtL5bRL/VAw== 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=iohVom1BNaXZs+Kz1dpltVQrMuRQVw02UmIU5d43Stw=; b=eyLYZTc88ZMtEWSv4v3mwlmwYpe64Z122pPgfxu7DoaUbrV1BfsOkP8llpYmkIeRmcxxQtO+9sECM+oChSJd+dvU2q7CsdxkBEIq1a0vja90RQ7bzlv6so+NIARZ2DABiMeoS/UubSFcq8m7v5pTaqtI7XTz971S4H+xVSEEEPHr5mCUWV+DE4X5PQvhZHNijhb3Kc4SFedutJvrsRTw+ScThF7HYaw9qNGuHQLXEZOFgfA94sgApV7v4d0WbxkYKctkFn6iX71oXdquEpo2LWx0LwUzbX8B4fcZAGAutvtfLvZg4nVtZ2dJCGpX1MbFJMEoq18LasQvnOKNYKUNug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iohVom1BNaXZs+Kz1dpltVQrMuRQVw02UmIU5d43Stw=; b=V/4B/9mzSqlo0VnofE2mSLVP3lUwOczwDraK745ehKm6HhVhZR5Ulw9MFOJ2ZVvkzxcQNlYFTHqcQSnOiq5cXmsF6CsIS14cdfM/n00mjghHQQ7iDdrJNEHKYoqNKRevUNsDeKeWGl4+6TWEBXhfEJ23+ZJwDwhkI4AsRMSlv0k= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6998.eurprd04.prod.outlook.com (2603:10a6:20b:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Tue, 1 Sep 2020 02:34:32 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 02:34:32 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, gregkh@linuxfoundation.org, jun.li@nxp.com, Peter Chen Subject: [PATCH 4/5] usb: cdns3: drd: call PHY .set_mode accordingly Date: Tue, 1 Sep 2020 10:33:51 +0800 Message-Id: <20200901023352.25552-5-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901023352.25552-1-peter.chen@nxp.com> References: <20200901023352.25552-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 02:34:29 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: eb67ab51-85e5-4d0c-c04a-08d84e1f8ed3 X-MS-TrafficTypeDiagnostic: AM7PR04MB6998: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mKpzN6ZDucliGFpWt0X4LKtaIXK5VG7LSDI6yAk+WIZB7agBvypFrMJMca9dtr00wGKuSfurY832i0gaZBGBytnSreJykQGRw7sNTOFkVJomYyHFEIe/IL3PHJRO87LKhBaYRTfVLPlC+xUjrwvm0TjpSQSTZRn4BB7acjswHv5DDcbvmq5vDPnznEosluVpr/VS73FDsXWMdi+NOvCf3Ak6Lu+aWaLo8GGw/FRs9K3yNbCz3B+x+baHDdD68EHecpdVtH6ZpRMvpd3IF5U7YuNxx3rG8geRalxcogNqlTDuRT8NSZ26ApTRZIHhYW+98UOYh7kQRYaad4hadp3RLwGBz9A+L1s5/SHvAXP9cfa040QlgXrV5n10GvlsX7/j X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7157.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(6512007)(6506007)(4326008)(16526019)(186003)(1076003)(26005)(478600001)(6666004)(6486002)(2616005)(52116002)(8936002)(2906002)(6916009)(36756003)(86362001)(5660300002)(8676002)(66946007)(956004)(66476007)(316002)(66556008)(44832011)(142923001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 68UOkRLyIeo6Q2i9ldX670sdV67Aqv4FJiaru5UcWYTNXIoq9k3f7Ktg6DnQDJnUHPdAFyUwYV2gDbKExtBp8/YouoEwSjzfjl5NSaifsxEyWHQ6s3/0xiuMqZ0SuCRcjCUknJp6TqvYYs3wdv14+8MYlLpzRvI/E9p/OHS66x+m+MmWh5kKphj5PWD1T4sDTQfcpyvEjiAOJ3vyVdlYPtdPsobiuTygcsmMDgcVLXht7+oBXuJqgQky357PUxS5KZFqmFUe2nXY+mr/Wkyp84GWZzIJpbxoU8AkaUWDhnZ886dWgm5UHhkjkudPae0/zCFCv2K2v6OlFUmewjIs8ptvLQS9n/qM1obLWltMlfAtF9RRppoCZuSqn0CdLkAIdox2N3srnoZPNTZ5I9KRWQxM3Z67vVlfQG9WIRgMcr3rt8AE113rSmTiVgxmfO9sUR/wDCEPXxDb97UPnZZYeqwmRvi71yUssyLmxOSE3ToQWzO8pMs1y8E+ztpRNjEPd7wZivxB9FAgRFmOiKl/5Z4/Hz6sJ8dgPH44rzfFeadtTVYAvpzB4Ter7zgFZBgBnWY6K2VA6cFqCzYL8STKivasLfJUYtIS2V0Zte3s5NkCRKybQ/9aCsx6sjR7aR7JUvm6MirGGfeAv5Zs5p1ylg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb67ab51-85e5-4d0c-c04a-08d84e1f8ed3 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7157.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 02:34:32.2429 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gA8569oHLtNRR5zeCuP075CgtG7JQOBpv/IAFz0P2OgMe1dRyUYoKRei3XuXwUVCZqSd7F47VjkzDdVdb6AIxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6998 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some PHYs may need to enter related mode, and do some settings. Signed-off-by: Peter Chen --- drivers/usb/cdns3/drd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index 5f2685cadf5e..31fddf84f226 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "gadget.h" #include "drd.h" @@ -145,6 +146,7 @@ int cdns3_drd_host_on(struct cdns3 *cdns) if (ret) dev_err(cdns->dev, "timeout waiting for xhci_ready\n"); + phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_HOST); return ret; } @@ -164,6 +166,7 @@ void cdns3_drd_host_off(struct cdns3 *cdns) readl_poll_timeout_atomic(&cdns->otg_regs->state, val, !(val & OTGSTATE_HOST_STATE_MASK), 1, 2000000); + phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID); } /** @@ -190,6 +193,7 @@ int cdns3_drd_gadget_on(struct cdns3 *cdns) return ret; } + phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_DEVICE); return 0; } @@ -213,6 +217,7 @@ void cdns3_drd_gadget_off(struct cdns3 *cdns) readl_poll_timeout_atomic(&cdns->otg_regs->state, val, !(val & OTGSTATE_DEV_STATE_MASK), 1, 2000000); + phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID); } /** From patchwork Tue Sep 1 02:33:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 258710 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=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, 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 70D06C433E2 for ; Tue, 1 Sep 2020 02:34:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 492A120707 for ; Tue, 1 Sep 2020 02:34:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fGS1XSQz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbgIACel (ORCPT ); Mon, 31 Aug 2020 22:34:41 -0400 Received: from mail-eopbgr80078.outbound.protection.outlook.com ([40.107.8.78]:38116 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726489AbgIACel (ORCPT ); Mon, 31 Aug 2020 22:34:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NEbYjR7EDhpCYGUX45Xw//S9tTyQNyr/RS+0PUBmPDs5KBPqUdiQC1dhiz9hRcKv37a1CNtN7ogTijzhGR8euTA1/mhshgk6skgSLIfG/v4Lr686pBXJN6g6ETj5lkjx+Ok+cx+NY8+nUjzOXbW6GpgJwUyjhdA+lTpP6U5O6g9OaPGPx0x6pTneA7uguNGVlszV56p2QS6xdxTjmxQPCgMlpCxiG1iDcM2WMNBt+WkBrij4QEQXmE2/RamZP8V5OzevIMvOL51amtv0t/ksmUBVJS7xbuMm6z7zQcr1/sig3qkUFwNSo4jYBjr9Xu7n3+PPN13PVpNBKwSaGQFNOQ== 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=9bItBgTQ7MUz6WhdxjjoI2x7sUbGIQEpF5NxMzoh/wE=; b=cHa972UVzDgRKufUfSK4TWnjXdVgLR2cYOVVL4/V6vMVsSOukOssUdSrGdvcr66BTkM9vslNOYUFygjhf8b+/0AfH0fbLCt2o6TLZUFi/xaq8mtCTbUxM9DG16R0JNnzXrkTn0PFBiA+dYAKqdrz3EEAv3mgV6/sSRWPdZhvTkOjGtq63MAJzJzZwChPC/GYqPyAsgGHwFuSFtD8pobDbcr2ey+qE9Bhge+6DBb/dZOllryeosFVfNZqQ6Yx6dtqFtoY1dFOvV8oCI1BbNNtPkwwWlv+EVVy8WWQn/c7cZkvQBbZNquRiDrfQNMnnEw3IWOKmPIvpe+/VfBmtzEZ9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9bItBgTQ7MUz6WhdxjjoI2x7sUbGIQEpF5NxMzoh/wE=; b=fGS1XSQzQK8G6Tesfw2Gpz9xPrdNaj5LAcPiG7F6mOP2IbJb5qvyqBAm0THhm+EHQiQXgZAHpAMvJycRgpi8QjhASmojoZ2uab5q/PSNR5iG3X4Hd8pN5c8qSPVIm2exA9s806MOow3ml501oRkgUNNMIlnsgmpxe7Em9AEKQ3o= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6998.eurprd04.prod.outlook.com (2603:10a6:20b:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Tue, 1 Sep 2020 02:34:35 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1023:be8d:40c:efe1%3]) with mapi id 15.20.3326.025; Tue, 1 Sep 2020 02:34:35 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, gregkh@linuxfoundation.org, jun.li@nxp.com, Peter Chen Subject: [PATCH 5/5] usb: cdns3: gadget: move wait configuration operation Date: Tue, 1 Sep 2020 10:33:52 +0800 Message-Id: <20200901023352.25552-6-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901023352.25552-1-peter.chen@nxp.com> References: <20200901023352.25552-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR02CA0046.apcprd02.prod.outlook.com (2603:1096:3:18::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 1 Sep 2020 02:34:32 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: deb838c8-309f-4ab8-6ae4-08d84e1f9097 X-MS-TrafficTypeDiagnostic: AM7PR04MB6998: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:439; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: id5FkXON/uXZI1Uo7ronp0wnr+H/0m3oXwvevEC83+OA8gTxCI6+5Bp4gkR8mBPRpE9xSD39Tc2vQXJyLvFgjE0zjGcXoK5+zb0oYsHEV8p0QYX8/R8BAGA7asXBRkoSs8/qFu26nBVlTT/oxbl++5F/XefYLfTshAd8zdhzb1eJa0cuJYdAaq8btOeT7i/jETd7PCWpUlwlt5QFUdZre4dC5KiiZchiMu+YtU+eVkBLKqyW0jrPSU4wugNYxiinyBwGSkN/PMoJrEsoM7hH04FZsI70sNn3e6lu6fsijGl91ldEvYImHxVcyt2tcWmnxIX3r8fWI4bdp74XJK0XMw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7157.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(6512007)(6506007)(4326008)(16526019)(186003)(83380400001)(1076003)(26005)(478600001)(6666004)(6486002)(2616005)(52116002)(8936002)(2906002)(6916009)(36756003)(86362001)(5660300002)(8676002)(66946007)(956004)(66476007)(316002)(66556008)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: oDGntNHuwu4HEcIh0yEgvJMJp4Zbv2l/xSi4TilfIwk9Z4PqRql3LHyNFIyUP2Z/gwrUQ35KaJTehtBCAUw97uKOK1IGvh3V5gLxr71nBkW5sRpIy/IPku8aSlN879OB1Ntlfv+5B1CxFj5+om29YFoPIm0WTgSV2aI5791fdFjRnr+8bbl2qBcGCPk43AFXM2LkVSvaVjqY+aMkX5W3zuZSLsi/7+5ISi32VMldvTu3iAmeSsicLmzSGoqKBS0NkGp75o9wFNmckXSMszhYtjJTG94svIIib+rzPGJVjHTyG7G/BCKjFOehJ67HRlz1HZlT35VIs5ZzaKI0vw93F2cfbPnuj8jLSHAWr0fP2pUsQNtiuodT1UGMyttWOPsrrclMIuIBBG097P2913nyUfoCbuMO2lJHlmB4rJtSsDajFGbb4dWN76l5CGVIx2TpA80c6j6ESGdoarGWBfCdTlkV+Nq7sLZA0FB6tB4B8j8s7ore6ZgfNyJELDqfC1mccmWOk+AL2yp248+lUxfc40zmfi3R3igZUpFwPnLjQJcoR0pus1Ij8MFKxLFuYXI5QF4r7SAbaXN20MEJ/kIn7xhfnf9lm8TvfxPpIE0m+QFQrSJAmXM3WfIFT6XVYHT2tvmB4aGsirLxpGVD1cQ5CA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: deb838c8-309f-4ab8-6ae4-08d84e1f9097 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7157.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2020 02:34:35.1751 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DcHkUvJ4cnJ3uTJo4EF/z9K/oHiqBdeh8ubzsXjB2J+4EubqeJgIUawaASS0hM0Tj5DtDe7sA7SAQe111n7h5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6998 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org After commit f4cfe5ce607d ("usb: cdns3: gadget: improve the set_configuration handling"), the software will inform the hardware the request has finished at cdns3_ep0_complete_setup. The configuration set bit is only set after request has finished, so it needs to move waiting operation after that. Meanwhile, if it is timeout, it will show warning message and return error. Signed-off-by: Peter Chen --- drivers/usb/cdns3/ep0.c | 10 +++++++++- drivers/usb/cdns3/gadget.c | 5 ----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c index d9779abc65b2..4761c852d9c4 100644 --- a/drivers/usb/cdns3/ep0.c +++ b/drivers/usb/cdns3/ep0.c @@ -717,9 +717,17 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep, /* send STATUS stage. Should be called only for SET_CONFIGURATION */ if (priv_dev->ep0_stage == CDNS3_STATUS_STAGE) { + u32 val; + cdns3_select_ep(priv_dev, 0x00); cdns3_set_hw_configuration(priv_dev); cdns3_ep0_complete_setup(priv_dev, 0, 1); + /* wait until configuration set */ + ret = readl_poll_timeout_atomic(&priv_dev->regs->usb_sts, val, + val & USB_STS_CFGSTS_MASK, 1, 100); + if (ret == -ETIMEDOUT) + dev_warn(priv_dev->dev, "timeout for waiting configuration set\n"); + request->actual = 0; priv_dev->status_completion_no_call = true; priv_dev->pending_status_request = request; @@ -731,7 +739,7 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep, * ep0_queue is back. */ queue_work(system_freezable_wq, &priv_dev->pending_status_wq); - return 0; + return ret; } if (!list_empty(&priv_ep->pending_req_list)) { diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 829bc917df39..2ea4d30e1828 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -1309,7 +1309,6 @@ void cdns3_set_hw_configuration(struct cdns3_device *priv_dev) { struct cdns3_endpoint *priv_ep; struct usb_ep *ep; - int val; if (priv_dev->hw_configured_flag) return; @@ -1319,10 +1318,6 @@ void cdns3_set_hw_configuration(struct cdns3_device *priv_dev) cdns3_set_register_bit(&priv_dev->regs->usb_conf, USB_CONF_U1EN | USB_CONF_U2EN); - /* wait until configuration set */ - readl_poll_timeout_atomic(&priv_dev->regs->usb_sts, val, - val & USB_STS_CFGSTS_MASK, 1, 100); - priv_dev->hw_configured_flag = 1; list_for_each_entry(ep, &priv_dev->gadget.ep_list, ep_list) {