From patchwork Sat May 23 23:22:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C04D90 for ; Sat, 23 May 2020 23:23:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E79F207FB for ; Sat, 23 May 2020 23:23:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="RD8C2IAR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388117AbgEWXXC (ORCPT ); Sat, 23 May 2020 19:23:02 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388047AbgEWXXC (ORCPT ); Sat, 23 May 2020 19:23:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eP87jLrlqo1ZZ1bGLkyJONyrpD768DDHuneA2B7tGB0QVZpWYM4sI9PCNC4As4azI/5rVbfaKJVoM5RdbjVLkSMviUIQfBRp0Lrj6uHmz9cd1p5dKrB4sd2cN0Nw/nYEtw8IpAhK6Wz/MKBznAfCWAOAOjvMGSbJ8ysFVhUfQ3TAzhlteRDtIB+GutDbCl+1F+8lWH6pNvgB42Pcg5FWd0xdtCRG5g0ueb/xGRaFHQpsIXGDwIW5xBPx4ANKhVtgmcBXm4veTeTFjRyw3A5kDMcIi1Lo7MP2f56833JByi7I5edvCSwfBQMnD33hmALjlHvVHPec+aAOH8osQENzdQ== 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=l0G8Zb6XJUTT773hqb6jhHN4QNVRflHkt6ARwDkUeTE=; b=kzvV/Ion3j2tioMLb5HTGUBVDK73tzxrJC0yLa+TvmVyoDIPActYl98/X4e3GZ6Gj2XldPoOKz/7HnDVPsK5D1QRx3pv7916rwEPdfMVsCgPN3v05GuQ1AyohmRmbGdlFNBRFRIXZYTqwa5D5A0GFmP6hCBKQswLfUVYzC/LrHx90jbngBM27A0M0MaDUa9mgrplyhVj9MM5o2sVN2xtpgdgADcc8SloBt7D3Y77t+P10Et2MOwqx7NreQiIxA8hzWK5z42y6L8wZh/p3JPClTsgX81dqodp8gn1+yZjF5s3PcuQ/9a43rfGS+1bdJx1qygi8Da1Ezt0f9H4Mg7zmw== 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=l0G8Zb6XJUTT773hqb6jhHN4QNVRflHkt6ARwDkUeTE=; b=RD8C2IARAFUSSxn7B1lEAgqwaXmtaQGAQrNrkw1LwkdgqwTW2RGU67qDoGWbdaz6duLNMzQJGi91ollccj/gOnLSZzwQi8VBD/Z7wdaEKlQeMCIiBNoTxwlWsm99I3rAJvtsMK66ZEtzTdigydHHVVVGTj7Gq9V35NsNgFHsba0= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:22:55 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:22:54 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 1/9] usb: cdns3: introduce cdns3_set_phy_power API Date: Sun, 24 May 2020 07:22:56 +0800 Message-Id: <20200523232304.23976-2-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:22:52 +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: e74fc0a4-3927-4a84-dd3b-08d7ff703891 X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sGcwVJvipvKbcQGLRuu74tbiCGRQWG3Ig1jyfFX3vXB1zd1K2c3k+4snuhfRbBYQlqbHhyUbXA16E18Nxc3S4H3A4qEiDsasCB/XAYYq1sFY/3BzmBNlNgcaP7PY83TLagwKn9dbDgsVa5gNszg3lI7I5VH8QpTaYlRjzkF7zQhj04hkI+02MHfXhGx5el5xM8hu2c9yDRxduuAuAMs0Q2JTWkn8xupIRH9EE49Vy9wWNl6MQsBnp8dub7AnLsBBBWZeYbvbunsGkqDppLtdDD1PKxIFyP+V+dO2v4/FYLxRxAw1OmGI8lB/sB4y1979H9qAis2oFFPc1oRVH1YpZg== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RHjJ9xOGv8IAirllFrS4MDnvhamh6klw4yPXL4mIx9NDqASMf3dCZcQVAYVx3yskZLIOajHGGZh7XkEn1UC9F40RE4VHHpkw59Dj0R0b35hlNtuiUOGF6+7g65bfC0kCSQ24l5jgfDHxZWPNyy73JIqFc2G2TRf7S3vQHiy4I/Nlk+UtdznYm5gvHJmZyKWi91zOyqAs/GXCffhKmzZimCBR+SAtttr7PTq8inoks6ZEAnDCLZxm9QMg5eKPcudZyG6Y6blevXyH262JhaQykqGJvoU+k1Znawzqa9jT/qu1H4Jol+bMI2MwD+kDkZlxR18oSxkOspB8x+zyNhnjRgl/u5QCOueBHc4G1ou+mPywYn4y11uiuUx2PmVFeVx1zS/561XgCshOxXBvh1NRMD5S4BblPG7sL3c0e51tkVC4mwuqQc7FeayEzEZy/IOiwscOSoYKoepTWucgKOmGjzBoYNu7aomFD4EmL3YC2ZQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e74fc0a4-3927-4a84-dd3b-08d7ff703891 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:22:54.8888 (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: Nzob9tai4EX7v/vQQkzWmrWdV7YHOhRmrMdnyouBhFZBW/X6tdIAZ4U/IDHnPfrl57LJIzpNy6lx7iSd7SrA7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since we have both USB2 and USB3 PHYs for cdns3 controller, it is better we have a unity API to handle both USB2 and USB3's power, it could simplify code for error handling and further power management implementation. Signed-off-by: Peter Chen Reviewed-by: Jun Li --- drivers/usb/cdns3/core.c | 44 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 19bbb5b7e6b6..bfd09aa98c12 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -384,6 +384,28 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role) return ret; } +static int cdns3_set_phy_power(struct cdns3 *cdns, bool on) +{ + int ret = 0; + + if (on) { + ret = phy_power_on(cdns->usb2_phy); + if (ret) + return ret; + + ret = phy_power_on(cdns->usb3_phy); + if (ret) { + phy_power_off(cdns->usb2_phy); + return ret; + } + } else { + phy_power_off(cdns->usb3_phy); + phy_power_off(cdns->usb2_phy); + } + + return 0; +} + /** * cdns3_probe - probe for cdns3 core device * @pdev: Pointer to cdns3 core platform device @@ -477,14 +499,10 @@ static int cdns3_probe(struct platform_device *pdev) if (ret) goto err1; - ret = phy_power_on(cdns->usb2_phy); + ret = cdns3_set_phy_power(cdns, true); if (ret) goto err2; - ret = phy_power_on(cdns->usb3_phy); - if (ret) - goto err3; - sw_desc.set = cdns3_role_set; sw_desc.get = cdns3_role_get; sw_desc.allow_userspace_control = true; @@ -496,16 +514,16 @@ static int cdns3_probe(struct platform_device *pdev) if (IS_ERR(cdns->role_sw)) { ret = PTR_ERR(cdns->role_sw); dev_warn(dev, "Unable to register Role Switch\n"); - goto err4; + goto err3; } ret = cdns3_drd_init(cdns); if (ret) - goto err5; + goto err4; ret = cdns3_core_init_role(cdns); if (ret) - goto err5; + goto err4; device_set_wakeup_capable(dev, true); pm_runtime_set_active(dev); @@ -522,14 +540,11 @@ static int cdns3_probe(struct platform_device *pdev) dev_dbg(dev, "Cadence USB3 core: probe succeed\n"); return 0; -err5: +err4: cdns3_drd_exit(cdns); usb_role_switch_unregister(cdns->role_sw); -err4: - phy_power_off(cdns->usb3_phy); - err3: - phy_power_off(cdns->usb2_phy); + cdns3_set_phy_power(cdns, false); err2: phy_exit(cdns->usb3_phy); err1: @@ -553,8 +568,7 @@ static int cdns3_remove(struct platform_device *pdev) pm_runtime_put_noidle(&pdev->dev); cdns3_exit_roles(cdns); usb_role_switch_unregister(cdns->role_sw); - phy_power_off(cdns->usb2_phy); - phy_power_off(cdns->usb3_phy); + cdns3_set_phy_power(cdns, false); phy_exit(cdns->usb2_phy); phy_exit(cdns->usb3_phy); return 0; From patchwork Sat May 23 23:22:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567063 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C66D90 for ; Sat, 23 May 2020 23:23:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D87C20823 for ; Sat, 23 May 2020 23:23:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="NoVA5SR6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388123AbgEWXXH (ORCPT ); Sat, 23 May 2020 19:23:07 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388010AbgEWXXH (ORCPT ); Sat, 23 May 2020 19:23:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLGUJ5a7JSGEvf/BFJ5epbZcnMoEwnjDLjGCJFJ759VbxMPbDvMn/6QZq/LZef9qfMgjQE6SkisObL11SULjud/y7DuwaWjOYbgrLp1V/BxaSDtCzCHCotz+Z/VCnuS2rIS9nbuP71egSy0j+GThH/tpB0QIcUNT9rBOXGAF18DXgjmy6zmCmORXq4id2BiYhN9mmwNENR4+3vztC5SmvCVt3vf7ZdxfRI3DFPm3tQJpgvX2hyiK4AgP8+PTUuSYLomjX+AEvq3gnvo7PH4au1vLwY9cj6uXUJejcgNprMNPNA93TFzYnVvteL4O8toWpdScbuuJxf/C6Mx+OBfgew== 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=FWf+sEZnIKU+XEeDXp2XhnWdxSDkWIzISJWNdejQ5m0=; b=LwzbyFSotYNT2M1Lz3n906H/6EkXVy7L0VPillqRLzal8DyupKmkR8Tl2oe4i/Jk98w/Ez4SKnFtWiMMZSouhQdz7NJsmq97g/XtrHw3Z7pfxHkd6M/0zNJOMc39KOlcrwJA0/UmEH7Vms0QaWxtyckMNATk7C3lRkpMWOsf3TnJo99eGwHMNvm4BTSbxNstFmV67J0RqzZzBZDc0g/YCzDER3wr0yqoHt3SbsyUYRBINDtxCGVW6damoGIN1o0Evia9EX1fyuWSBdt1aukn7mIv6jJLoeHzmMh5CAZu8dTI/GnSTup1fEE+7K9Wuczr+GMwWa/8spRXKI3z8nlNlQ== 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=FWf+sEZnIKU+XEeDXp2XhnWdxSDkWIzISJWNdejQ5m0=; b=NoVA5SR6s/tHiyVGOztwn/Q4wlXjULlaBUwoe8ofdX5HSk9oYufdetn/8SQYoCYIdPca3G+vNGsID/gPHerDqZWRRWW3pOCiJOgXwPDabA1Kd+8dgAKhnIY8Hq179VLBQcaFhJPlt0TbrhT9HM4ZczHtNfeAcolOB5nNTzKvtFE= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:22:58 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:22:58 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 2/9] usb: cdns3: add runtime PM support Date: Sun, 24 May 2020 07:22:57 +0800 Message-Id: <20200523232304.23976-3-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:22:55 +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: 711a7cd9-47dd-4caf-f4d2-08d7ff703a6a X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ShV/b0k0mSAduAQdYAFAuYtGgkqr6iT/dZzXMJTfXA1CvNywYkyIB1uQmEV8nnComYfxRxQqQ81DZ7BGskVTd/9iYoV9yK/KvCRlJpr39VA9GeWXFT4MHx/t4oPHHvkHfhP4X5h+yAdZP/kM9glJD8PzL6lYv0RyAE6lNMpaLSuem+Un0fhziGILADyuQdwp9eUNLrOzfenr94Wh4FY9jcdxKIIGIe98VbfKGqVSy91r/m/E8E1K70n6gs+VwBCkdWccmCL+gievxKifK89k1OUr77tJzjV7EjJBEpQ3HvuoZoJKkFbhGAWrPpBD8na3NQ8vMcBkcxXMeAt0rZoFSQ== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xiniNINaCVNg/wUIudeAWiX6RGGLMEctJOdxg/ngevpka4Fl92l+8hFAKVnv78KW5vRWMtoqRZZd1ZsMRLfkO8bZWXgx36F8YjQE5Ej7LoAmgO7HwwaGNKJkvczmjHG/MwPWwctMOyUVUAb4T6gv+AVgFcOcsRMPoo9teT/GRjWB14m/lPYxXDNG0xjfvE+Cz2fvr184fSPdbezxppVWKkl6uWvgPxDzB5RHrivXOp9I94VcgK/dbcKGHBGLd/rkSLO4ydDImfsoHFzqD1pYt8iQQ0Cq1cDCSYffE/TyScev9IMXKdmLgtXV3+97GOmklYROa36ldvONZddkKUSrTkepR9Qw6B+yd1xayIEWbzj3QUaClqFkdHdoz6YJgmgy6ONYgawimmU1zJx9nXngEgg2jvgodQSQL0R7qrWVviMolvqN4hbDc6+tf8UWevYRTBIdKxRE2M0ck5sLJrm4ALECx3NSq+aJcWoVd8fUx3w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 711a7cd9-47dd-4caf-f4d2-08d7ff703a6a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:22:58.0570 (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: lVXCOiEqmg8vwH2YgbO2b/c4frsD8XV+lTR4fMBZsyJroDn8ILBZPfU1wTAYLUJoam7Kxv2MJomznOceYoflkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Introduce runtime PM and wakeup interrupt handler for cdns3, the runtime PM is default off since other cdns3 has not implemented glue layer support for runtime PM. When the controller is in low power mode, the lpm flag will be set. The interrupt triggered later than lpm flag is set considers as wakeup interrupt and handled at cdns_drd_irq. Once the wakeup occurs, it first disables interrupt to avoid later interrupt occurrence since the controller is in low power mode at that time, and access registers may be invalid at that time. At wakeup handler, it will call pm_runtime_get to wakeup controller, and at runtime resume handler, it will enable interrupt again. The API platform_suspend is introduced for glue layer to implement platform specific PM sequence. Signed-off-by: Peter Chen --- drivers/usb/cdns3/core.c | 119 +++++++++++++++++++++++++++++++------ drivers/usb/cdns3/core.h | 14 +++++ drivers/usb/cdns3/drd.c | 7 +++ drivers/usb/cdns3/gadget.c | 4 ++ drivers/usb/cdns3/host.c | 7 +++ 5 files changed, 134 insertions(+), 17 deletions(-) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index bfd09aa98c12..5221c1306e64 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -432,6 +432,7 @@ static int cdns3_probe(struct platform_device *pdev) return -ENOMEM; cdns->dev = dev; + cdns->pdata = dev_get_platdata(dev); platform_set_drvdata(pdev, cdns); @@ -525,9 +526,11 @@ static int cdns3_probe(struct platform_device *pdev) if (ret) goto err4; + spin_lock_init(&cdns->lock); device_set_wakeup_capable(dev, true); pm_runtime_set_active(dev); pm_runtime_enable(dev); + pm_runtime_forbid(dev); /* * The controller needs less time between bus and controller suspend, @@ -574,52 +577,134 @@ static int cdns3_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM -static int cdns3_suspend(struct device *dev) +static int cdns3_set_platform_suspend(struct device *dev, + bool suspend, bool wakeup) +{ + struct cdns3 *cdns = dev_get_drvdata(dev); + int ret = 0; + unsigned long flags; + + spin_lock_irqsave(&cdns->lock, flags); + if (cdns->pdata && cdns->pdata->platform_suspend) + ret = cdns->pdata->platform_suspend(dev, suspend, wakeup); + + spin_unlock_irqrestore(&cdns->lock, flags); + + return ret; +} + +static int cdns3_controller_suspend(struct device *dev, pm_message_t msg) { struct cdns3 *cdns = dev_get_drvdata(dev); + bool wakeup; unsigned long flags; - if (cdns->role == USB_ROLE_HOST) + if (cdns->in_lpm) return 0; - if (pm_runtime_status_suspended(dev)) - pm_runtime_resume(dev); + if (PMSG_IS_AUTO(msg)) + wakeup = true; + else + wakeup = false; - if (cdns->roles[cdns->role]->suspend) { - spin_lock_irqsave(&cdns->gadget_dev->lock, flags); - cdns->roles[cdns->role]->suspend(cdns, false); - spin_unlock_irqrestore(&cdns->gadget_dev->lock, flags); - } + cdns3_set_platform_suspend(cdns->dev, true, wakeup); + cdns3_set_phy_power(cdns, false); + spin_lock_irqsave(&cdns->lock, flags); + cdns->in_lpm = true; + spin_unlock_irqrestore(&cdns->lock, flags); return 0; } -static int cdns3_resume(struct device *dev) +static int cdns3_controller_resume(struct device *dev, pm_message_t msg) { struct cdns3 *cdns = dev_get_drvdata(dev); + int ret; unsigned long flags; - if (cdns->role == USB_ROLE_HOST) + if (!cdns->in_lpm) return 0; - if (cdns->roles[cdns->role]->resume) { - spin_lock_irqsave(&cdns->gadget_dev->lock, flags); + ret = cdns3_set_phy_power(cdns, true); + if (ret) + return ret; + + cdns3_set_platform_suspend(cdns->dev, false, false); + + spin_lock_irqsave(&cdns->lock, flags); + if (cdns->roles[cdns->role]->resume && !PMSG_IS_AUTO(msg)) cdns->roles[cdns->role]->resume(cdns, false); - spin_unlock_irqrestore(&cdns->gadget_dev->lock, flags); + + cdns->in_lpm = false; + spin_unlock_irqrestore(&cdns->lock, flags); + if (cdns->wakeup_int) { + cdns->wakeup_int = false; + if (cdns->role == USB_ROLE_HOST) { + /* Trigger xhci-plat.c runtime runtime */ + pm_runtime_get(&cdns->host_dev->dev); + pm_runtime_mark_last_busy(&cdns->host_dev->dev); + pm_runtime_put_autosuspend(&cdns->host_dev->dev); + /* balence the pm_runtime_get at cdns3_drd_irq */ + pm_runtime_mark_last_busy(cdns->dev); + pm_runtime_put_autosuspend(cdns->dev); + } + + enable_irq(cdns->otg_irq); + } + + return ret; +} + +static int cdns3_runtime_suspend(struct device *dev) +{ + return cdns3_controller_suspend(dev, PMSG_AUTO_SUSPEND); +} + +static int cdns3_runtime_resume(struct device *dev) +{ + return cdns3_controller_resume(dev, PMSG_AUTO_RESUME); +} +#ifdef CONFIG_PM_SLEEP + +static int cdns3_suspend(struct device *dev) +{ + struct cdns3 *cdns = dev_get_drvdata(dev); + unsigned long flags; + + if (pm_runtime_status_suspended(dev)) + pm_runtime_resume(dev); + + if (cdns->roles[cdns->role]->suspend) { + spin_lock_irqsave(&cdns->lock, flags); + cdns->roles[cdns->role]->suspend(cdns, false); + spin_unlock_irqrestore(&cdns->lock, flags); } + return cdns3_controller_suspend(dev, PMSG_SUSPEND); +} + +static int cdns3_resume(struct device *dev) +{ + int ret; + + ret = cdns3_controller_resume(dev, PMSG_RESUME); + if (ret) + return ret; + pm_runtime_disable(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); - return 0; + return ret; } -#endif +#endif /* CONFIG_PM_SLEEP */ +#endif /* CONFIG_PM */ static const struct dev_pm_ops cdns3_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(cdns3_suspend, cdns3_resume) + SET_RUNTIME_PM_OPS(cdns3_runtime_suspend, cdns3_runtime_resume, NULL) }; #ifdef CONFIG_OF diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h index 1ad1f1fe61e9..9eb8aeea2d20 100644 --- a/drivers/usb/cdns3/core.h +++ b/drivers/usb/cdns3/core.h @@ -38,6 +38,12 @@ struct cdns3_role_driver { }; #define CDNS3_XHCI_RESOURCES_NUM 2 + +struct cdns3_platform_data { + int (*platform_suspend)(struct device *dev, + bool suspend, bool wakeup); +}; + /** * struct cdns3 - Representation of Cadence USB3 DRD controller. * @dev: pointer to Cadence device struct @@ -62,6 +68,10 @@ struct cdns3_role_driver { * This field based on firmware setting, kernel configuration * and hardware configuration. * @role_sw: pointer to role switch object. + * @in_lpm: indicate the controller is in low power mode + * @wakeup_int: wakeup interrupt occurs + * @pdata: platform data from glue layer + * @lock: spinlock structure */ struct cdns3 { struct device *dev; @@ -89,6 +99,10 @@ struct cdns3 { struct mutex mutex; enum usb_dr_mode dr_mode; struct usb_role_switch *role_sw; + bool in_lpm; + bool wakeup_int; + struct cdns3_platform_data *pdata; + spinlock_t lock; }; int cdns3_hw_role_switch(struct cdns3 *cdns); diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index 58089841ed52..292ea248c0ec 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -278,6 +278,13 @@ static irqreturn_t cdns3_drd_irq(int irq, void *data) struct cdns3 *cdns = data; u32 reg; + if (cdns->in_lpm) { + disable_irq_nosync(irq); + cdns->wakeup_int = true; + pm_runtime_get(cdns->dev); + return IRQ_HANDLED; + } + if (cdns->dr_mode != USB_DR_MODE_OTG) return ret; diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 559e5c01c2b0..ccb257d9daa6 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -1766,9 +1766,13 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev, static irqreturn_t cdns3_device_irq_handler(int irq, void *data) { struct cdns3_device *priv_dev = data; + struct cdns3 *cdns = dev_get_drvdata(priv_dev->dev); irqreturn_t ret = IRQ_NONE; u32 reg; + if (cdns->in_lpm) + return ret; + /* check USB device interrupt */ reg = readl(&priv_dev->regs->usb_ists); if (reg) { diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index ad788bf3fe4f..b579ef15f4e0 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -13,11 +13,13 @@ #include "core.h" #include "drd.h" #include "host-export.h" +#include static int __cdns3_host_init(struct cdns3 *cdns) { struct platform_device *xhci; int ret; + struct usb_hcd *hcd; cdns3_drd_switch_host(cdns, 1); @@ -43,6 +45,11 @@ static int __cdns3_host_init(struct cdns3 *cdns) goto err1; } + /* Glue needs to access xHCI region register for Power management */ + hcd = platform_get_drvdata(xhci); + if (hcd) + cdns->xhci_regs = hcd->regs; + return 0; err1: platform_device_put(xhci); From patchwork Sat May 23 23:22:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36ACD90 for ; Sat, 23 May 2020 23:23:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B24420823 for ; Sat, 23 May 2020 23:23:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Pp3pT63I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388131AbgEWXXL (ORCPT ); Sat, 23 May 2020 19:23:11 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388047AbgEWXXL (ORCPT ); Sat, 23 May 2020 19:23:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYzOm/KoNQ7iUGl6lPyhZ1Fer++K7P3+IUhtwMGIYEs93cyXShLgQXCqDyN0bveK1ueorS+zj4cKxuR1mbcCYj15loERboQxSyCxFE82UgC/GF3F83kXIzmp0Uu9C57jJFJIWqMiKgmJefaeT91hoREzhhH7NYr9c3juOF6xm6hXIyNWcjgQzurlvJYfWgVIC41QEningBKobpxwqreyTwzDNi8Q8rA6S6yPzanXiQacnP7o/cte/Y6VwqQajh/Ew4hqHEU/nd85x2r6Y7gg+XboH8K7RbojE2K4juaIvSVMUQ9K7rNuNbLGvo7/mDVJM7TEJpjhSLkLlWETP2TO/Q== 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=uT+DKnQMSqid1P7HUGXEc7h60iy9sSbHaOr2UlWRZOo=; b=EKpiQIHieHe1vaMS73vCbOxjTnOn84PBzLZfgW/PLiiHjOOjD48xFssksH09yvMlodgJIb2nDjugnH/HOWMimHbAJmsPssTUAd5CLPwjb6uQUkWwd0SsxuOBtCVYh6iUESiOcdKmYEpwhlVaxa4x9VSft7r2eWKsroS/ibYCLdGkHbaoeV9xHdrtk9lBqANh31g0iAdPbsKCdpxgO4OgrJNCMVwbN9KPl1bvYXLxoRtA9sNmDOBlXHDPmuq1zXgNMjGzIm396PeBJvTB6ZuqdJL1PaGLRerlmVeqDLl1lB2PmRrBLwYWwJ80yq78Y6UWN3Idry3jUCltiF5nD0guhw== 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=uT+DKnQMSqid1P7HUGXEc7h60iy9sSbHaOr2UlWRZOo=; b=Pp3pT63IoMSdxpGDy0vLwokmqFTr7EjuxBGUZn7o7rmjRxpjtGkkapRcMOAZ/ipDz26L63tUjhr2fV65E/ROg0GvvJ2tETr/ol6VA8iAeQkowwcXqqInmyuWqdMPSVZHVnCnjs2FCXLWoKpflv0nEvEZtQ+ZCPQV3E0GwOs+6YA= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:01 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:01 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 3/9] usb: cdns3: imx: add glue layer runtime pm implementation Date: Sun, 24 May 2020 07:22:58 +0800 Message-Id: <20200523232304.23976-4-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:22:58 +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: dce2a399-7ba2-4295-a195-08d7ff703c46 X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dLmt16/BU7OvIv46uOIUpTx5x7jNNyKNH78UYzGXkRuS3CDEJIjILVObXTgJugAYJ02vaA/WjTWmQeuKAPfVYlAX9WcrX9wXdhYkyzZsVZhx9dLCjil4w2/hd/9xFiSSxW7OVLoKqGi5oMR01vzSpx1kKLnHlWFp/6BHLQjubmdbDRnSl5AnxiNusunn2+IeGV15sWmZGW3uhkgY5DJHnQnFk/mdUHcfDCxKM7i/2aZCTawKh07eLesmmQjflbjJ0m7CJ8svM+AiFMRIrA77LK4F40LkhMpQ2gEdI+pnn4lFa+d35NgGpPe6cZh4RJSjq7GKQm9DRpMwDQh2P4JoiQ== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IpapHXONqGFmhLUxMYyTxGl2rwJ1qVoYwvVh7ouLk1mCNSVhNZQvoo2CoxpFCf3WiEJX66fZ9B1FaHI9EEd2xpfB07jzmc9RqUIj9FGiDNVbXU2iiujb0vCbYmc4ZfK0985/FTikd5Zw2sjEhYsKFpOwWo5kElDY6rCwT52TXhFE8Crjkn+PHQbmYD7hSsH/dd64EIXQJf1/or3NBZJvYyFPdTV1X6qxsDBXDzurm5ZiW0PzY/o7+RL3EDBU7BGOtVObM4CmyWPWq523ni6y0aRA3my/N8W0gMWPRmRLo3iegFNPDR8llc2HCwU/FUFjKj0zGxfu8TdVsJwXkheGdiRnC5ppHZ92AHCNHhjr/11uR0xDLOifQJi7H/0KM4C+MSqAEzXYZAIM5QGDGOeHfQI68tYWsSknvfhRXdUcYGiIiU78z8031bcU5MEiDh/y8pOBuuNjEBs8+oFTlTFDr/nqpITfyUq1k+/60kksSPI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dce2a399-7ba2-4295-a195-08d7ff703c46 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:01.0539 (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: qvK41MOsKKaFack9IkpGIArKUaIhBknXFGIceXnoILA6HJa9iVVvyXDtFEGEYq1zgVHCQrOE2RUhRpaQA5aF3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add imx glue layer runtime pm implementation, and the runtime pm is default off. Signed-off-by: Peter Chen Reported-by: kbuild test robot Reported-by: kbuild test robot --- drivers/usb/cdns3/cdns3-imx.c | 179 +++++++++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c index aba988e71958..9d247de8e7eb 100644 --- a/drivers/usb/cdns3/cdns3-imx.c +++ b/drivers/usb/cdns3/cdns3-imx.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include "core.h" #define USB3_CORE_CTRL1 0x00 #define USB3_CORE_CTRL2 0x04 @@ -66,11 +68,30 @@ #define CLK_VALID_COMPARE_BITS (0xf << 28) #define PHY_REFCLK_REQ (1 << 0) +/* OTG registers definition */ +#define OTGSTS 0x4 +/* OTGSTS */ +#define OTG_NRDY (1 << 11) + +/* xHCI registers definition */ +#define XECP_PM_PMCSR 0x8018 +#define XECP_AUX_CTRL_REG1 0x8120 + +/* Register bits definition */ +/* XECP_AUX_CTRL_REG1 */ +#define CFG_RXDET_P3_EN (1 << 15) + +/* XECP_PM_PMCSR */ +#define PS_MASK (3 << 0) +#define PS_D0 0 +#define PS_D1 (1 << 0) + struct cdns_imx { struct device *dev; void __iomem *noncore; struct clk_bulk_data *clks; int num_clks; + struct platform_device *cdns3_pdev; }; static inline u32 cdns_imx_readl(struct cdns_imx *data, u32 offset) @@ -126,6 +147,20 @@ static int cdns_imx_noncore_init(struct cdns_imx *data) return ret; } +static int cdns_imx_platform_suspend(struct device *dev, + bool suspend, bool wakeup); +static struct cdns3_platform_data cdns_imx_pdata = { + .platform_suspend = cdns_imx_platform_suspend, +}; + +static struct of_dev_auxdata cdns_imx_auxdata[] = { + { + .compatible = "cdns,usb3", + .platform_data = &cdns_imx_pdata, + }, + {}, +}; + static int cdns_imx_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -162,14 +197,18 @@ static int cdns_imx_probe(struct platform_device *pdev) if (ret) goto err; - ret = of_platform_populate(node, NULL, NULL, dev); + ret = of_platform_populate(node, NULL, cdns_imx_auxdata, dev); if (ret) { dev_err(dev, "failed to create children: %d\n", ret); goto err; } - return ret; + device_set_wakeup_capable(dev, true); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + pm_runtime_forbid(dev); + return ret; err: clk_bulk_disable_unprepare(data->num_clks, data->clks); return ret; @@ -194,6 +233,141 @@ static int cdns_imx_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static void cdns3_set_wakeup(struct cdns_imx *data, bool enable) +{ + u32 value; + + value = cdns_imx_readl(data, USB3_INT_REG); + if (enable) + value |= OTG_WAKEUP_EN | DEVU3_WAEKUP_EN; + else + value &= ~(OTG_WAKEUP_EN | DEVU3_WAEKUP_EN); + + cdns_imx_writel(data, USB3_INT_REG, value); +} + +static int cdns_imx_platform_suspend(struct device *dev, + bool suspend, bool wakeup) +{ + struct cdns3 *cdns = dev_get_drvdata(dev); + struct device *parent = dev->parent; + struct cdns_imx *data = dev_get_drvdata(parent); + void __iomem *otg_regs = cdns->otg_regs; + void __iomem *xhci_regs = cdns->xhci_regs; + u32 value; + int ret = 0; + + if (cdns->role != USB_ROLE_HOST) + return 0; + + if (suspend) { + /* SW request low power when all usb ports allow to it ??? */ + value = readl(xhci_regs + XECP_PM_PMCSR); + value &= ~PS_MASK; + value |= PS_D1; + writel(value, xhci_regs + XECP_PM_PMCSR); + + /* mdctrl_clk_sel */ + value = cdns_imx_readl(data, USB3_CORE_CTRL1); + value |= MDCTRL_CLK_SEL; + cdns_imx_writel(data, USB3_CORE_CTRL1, value); + + /* wait for mdctrl_clk_status */ + value = cdns_imx_readl(data, USB3_CORE_STATUS); + ret = readl_poll_timeout_atomic(data->noncore + USB3_CORE_STATUS, value, + (value & MDCTRL_CLK_STATUS) == MDCTRL_CLK_STATUS, + 10, 100000); + if (ret) + dev_warn(parent, "wait mdctrl_clk_status timeout\n"); + + /* wait lpm_clk_req to be 0 */ + value = cdns_imx_readl(data, USB3_INT_REG); + ret = readl_poll_timeout_atomic(data->noncore + USB3_INT_REG, value, + (value & LPM_CLK_REQ) != LPM_CLK_REQ, + 10, 100000); + if (ret) + dev_warn(parent, "wait lpm_clk_req timeout\n"); + + /* wait phy_refclk_req to be 0 */ + value = cdns_imx_readl(data, USB3_SSPHY_STATUS); + ret = readl_poll_timeout_atomic(data->noncore + USB3_SSPHY_STATUS, value, + (value & PHY_REFCLK_REQ) != PHY_REFCLK_REQ, + 10, 100000); + if (ret) + dev_warn(parent, "wait phy_refclk_req timeout\n"); + + cdns3_set_wakeup(data, wakeup); + } else { + /* wait CLK_125_REQ to be 1 */ + value = cdns_imx_readl(data, USB3_INT_REG); + ret = readl_poll_timeout_atomic(data->noncore + USB3_INT_REG, value, + (value & CLK_125_REQ) != CLK_125_REQ, + 10, 100000); + if (ret) + dev_warn(parent, "wait CLK_125_REQ timeout\n"); + + cdns3_set_wakeup(data, false); + + /* SW request D0 */ + value = readl(xhci_regs + XECP_PM_PMCSR); + value &= ~PS_MASK; + value |= PS_D0; + writel(value, xhci_regs + XECP_PM_PMCSR); + + /* clr CFG_RXDET_P3_EN */ + value = readl(xhci_regs + XECP_AUX_CTRL_REG1); + value &= ~CFG_RXDET_P3_EN; + writel(value, xhci_regs + XECP_AUX_CTRL_REG1); + + /* clear mdctrl_clk_sel */ + value = cdns_imx_readl(data, USB3_CORE_CTRL1); + value &= ~MDCTRL_CLK_SEL; + cdns_imx_writel(data, USB3_CORE_CTRL1, value); + + /* wait for mdctrl_clk_status is cleared */ + value = cdns_imx_readl(data, USB3_CORE_STATUS); + ret = readl_poll_timeout_atomic(data->noncore + USB3_CORE_STATUS, value, + (value & MDCTRL_CLK_STATUS) != MDCTRL_CLK_STATUS, + 10, 100000); + if (ret) + dev_warn(parent, "wait mdctrl_clk_status cleared timeout\n"); + + /* Wait until OTG_NRDY is 0 */ + value = readl(otg_regs + OTGSTS); + ret = readl_poll_timeout_atomic(otg_regs + OTGSTS, value, + (value & OTG_NRDY) != OTG_NRDY, + 10, 100000); + if (ret) + dev_warn(parent, "wait OTG ready timeout\n"); + } + + return ret; + +} + +static int cdns_imx_resume(struct device *dev) +{ + struct cdns_imx *data = dev_get_drvdata(dev); + + return clk_bulk_prepare_enable(data->num_clks, data->clks); +} + +static int cdns_imx_suspend(struct device *dev) +{ + struct cdns_imx *data = dev_get_drvdata(dev); + + clk_bulk_disable_unprepare(data->num_clks, data->clks); + + return 0; +} + +#endif /* CONFIG_PM */ + +static const struct dev_pm_ops cdns_imx_pm_ops = { + SET_RUNTIME_PM_OPS(cdns_imx_suspend, cdns_imx_resume, NULL) +}; + static const struct of_device_id cdns_imx_of_match[] = { { .compatible = "fsl,imx8qm-usb3", }, {}, @@ -206,6 +380,7 @@ static struct platform_driver cdns_imx_driver = { .driver = { .name = "cdns3-imx", .of_match_table = cdns_imx_of_match, + .pm = &cdns_imx_pm_ops, }, }; module_platform_driver(cdns_imx_driver); From patchwork Sat May 23 23:22:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567071 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BBA290 for ; Sat, 23 May 2020 23:23:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 234B2207FB for ; Sat, 23 May 2020 23:23:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="g5MXQVsk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388135AbgEWXXN (ORCPT ); Sat, 23 May 2020 19:23:13 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388010AbgEWXXM (ORCPT ); Sat, 23 May 2020 19:23:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aDPBgZAdnJZQwPaI7u6cKO1xABA59unWtjO99fcK/wOV6DK2ULUgfro6Rr+caqegbCLymZOhS7eKZDfKWx1W2nRayt+nMk7USGf5MeQEiWQ4ndNSXsGhXCfX6/32WhZl9gLnPj9FpGX5EWwsSltJG6FKc26Bgw3eDD/PCWx+CkXGkMgM7lIQj/zfJvx266rmhT9VccJL4sv2eU29gE7NYf0h45O5hgw9sGf2iGBwAflzF0m520bSUXT7wGCE1imfjhbBGMqecHmCbd5VSfM30XwgGMSQe6XtUd8de5p8YO0HzzoDkNybtLy84W611PnQpEesruhcZGGSVDmEqcXOpw== 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=WL2dfqy33EElH1eL9prBdZEKCxJXKD5C09fQnjD21A0=; b=lLLy4Y2OvOzjKU5DfO66TC+6fAzGm9XA263DDhLJl/EkHI8uNmP/J5aygaTWl1LTMsmZz+5mRhMoLqttC08UVYBRH1WIW3o3bzjN1GLwvpMyK8Pg0CvphshCTSuH04vjJMBhD5FL1z9tJyPFWTnZ0yaAHnyA8cha7plNhnvwqqpZSbjNVn1PBcBskrwvp/G3NgmOGNcdTmHW4/3KXLc0YyRRzD3MnIEp0nWSsJPYypGmHOaZS0/GBtvXFGrWrDQKfLDACTBjdWGuHECJlf0ZKQHhc8jb3a9mY9zcySzP2LdRmvTgXMo4rTaq3lzmiLRi+jR5UdOSwP4+j1Ytzr98ZA== 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=WL2dfqy33EElH1eL9prBdZEKCxJXKD5C09fQnjD21A0=; b=g5MXQVskZ0Ka/7+pLZcY/VlMtnYp5ZEyvMWdCBPRoBf5tREtXfe9mCWGFjSHwOSipRZpRWqxQWlH6EbWTnJuAO1mIOctQwH665cUtJZ87xKejmmNLxK/tNNmNY0ntn9RBQcoCo4VE8rHWAPU9EGWqtO3a7nI/fVk6ocGzSnh5XQ= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:04 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:04 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 4/9] usb: host: xhci-plat: add platform data support Date: Sun, 24 May 2020 07:22:59 +0800 Message-Id: <20200523232304.23976-5-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:23:01 +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: 6ffcb6f1-cc85-4c31-fc8c-08d7ff703e10 X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BO7OqMtOVKIvWlZ7XW/09Hgu33YxFJWBEG8s5+TDjuD+VQmlKbLEyfIYfsbKBC5WVJJkpyWj0XxG7zcpGxuA0G3BL7A1U13PIB7+kwafuezpqoznp8XOIBjNK7ppeUHgcJaZypsx2VA/yj11D4QujLB7IMguXTmKWA2KPA9b+KlbixXN/nNjhQj1PjBTVeX542vpOkBmZDI4dkUM9e2J0wdNsqYEJeHVwaIxzXQox3abByZlk+D2Co5AQIXfxM+koLUhobHQeLHV2etI8qPJEZ5FWQxhd/9v5SgZFSYvZ4TfIl+V/bNg+ipSK6xX0kW/1yslDHllD2aEeZFqEJdKPA== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(4744005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: cg5RwjTd9PaVTVGSqFhxEcXV6rOPLeaXPDa25hGpTae8y9LtDpaYn5FBCBsT0mZ94BVtwEhRvqwYrpGIIcEEi6l231DH7d5HDtSElL+I8pKaYQmPvLvNv+9KMHr0bISvAswgCKu5HpctH9QcxAvfjHjtAcFjR3T0Ews+faSYu+EqSzzFRmUNfV8plctAE7EGMwDHGsb9XHnmxNaYsRBcZOI9kdxnpuXHqCWKkd+07ZGfMjslWI92OViMt41OaavNAYR0TSqtiNgkAjoxOQE0P73nliY8+OHkEG5lgdwrX+LOtgQD1EMZQso5Onl29Lhy2x/p0PsndGbwrck65PAuy5xUp8uGhGvZ/VrBa62kJNEP4sEoU0tyaWtKuQavneFyb0d70yTP5x+ysRMo2x49LTIqjYTyngySew6ggf0fy2HR7oKz4b4oFH742oFpKWD0bGc4aF6zo/V0vPlsEHYSLOZRGBHzr2RLBeqa0uziuyU= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ffcb6f1-cc85-4c31-fc8c-08d7ff703e10 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:04.1812 (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: 4XPj6q30EorF/8dK7lp+Am46/7dFLbtBVNbLkxdtv0xdRS7MqbEKFRI0TXYEwn2JkDHftXI21lUcHtOJxqphxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some xhci hosts (eg dwc3 and cdns3) do not use OF to create platform device, they create xhci-plat platform device runtime. And these platforms may also have quirks, and the quirks could be supplied by their parent device through platform data. Signed-off-by: Peter Chen Acked-by: Mathias Nyman --- drivers/usb/host/xhci-plat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index f6b4089bfc4a..38bea2b6a17d 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -264,7 +264,11 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) goto disable_reg_clk; - priv_match = of_device_get_match_data(&pdev->dev); + if (pdev->dev.of_node) + priv_match = of_device_get_match_data(&pdev->dev); + else + priv_match = dev_get_platdata(&pdev->dev); + if (priv_match) { struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); From patchwork Sat May 23 23:23:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567073 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5AE490 for ; Sat, 23 May 2020 23:23:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB04620823 for ; Sat, 23 May 2020 23:23:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mo22g+Pz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388140AbgEWXXT (ORCPT ); Sat, 23 May 2020 19:23:19 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388047AbgEWXXS (ORCPT ); Sat, 23 May 2020 19:23:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YKip/8N7wXFWhezUzgz6bBybL0bSfoDzbSEpYDcQ1FGz/rXz3SvaTv9ux6yX5NFs7B+pqFOT/Mvdxg4MGNrtzfV0hU7OXxhAWD1+bgmXE9XexbHRnmegacVIA9Zc3/lwdbOYUg9qGab4AFcObLLBkenZHpAQWfJkNCIvkeixjI63RITECFtwdEhPd1R34M7iGohZIOoH+6SOAnKEXX4+l7mRdnbogk5fFvqvbn1va9ovMk7BAN/Qut4XUt6MfGVKlBaxJ024saMEog1SXUu+CLefb509HbSXQ4CxhcfV4w+hD2PYpupRZ/HNYVU5wXetoY5Ndrn6ykW5tSzeerzJBA== 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=7zYPHqZggGbZCeqQx7aK4CzhnlnQJPLSxIkcwYP5TVA=; b=Rx4OdEeP7gVZGsU0szOIliKA7DlN93VSbP+gjUj8pf7ctya3SnlMazg7e6DBSRuMRCWNxbebllt5tupWAya0A+Q7j1XiB57QOkcBc530ZSyqldByl0Yhei293TFhy7lsWZZzLfJOGoEo7LntgMCRgfVrTFVYsf/U2CbHnaq2sYdGSyesx/VxyP0Du5bcF6yLpfXRLkH/ld1Kf5U1X10piPpF0UYOJcHr1QdIqymqopl4BCPpgVFs7/WCI83C+yUVO0VL3Axy8wIIhzC9dz6zWpSz8eEwqCdo5/6kZhoNH2fb0xWIi/pUxiQ389kUVzgVCJo67HTWsDQvTsTtu4487Q== 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=7zYPHqZggGbZCeqQx7aK4CzhnlnQJPLSxIkcwYP5TVA=; b=mo22g+PzOCbCE4of3ekB6ogzTmDlIrUuz/3UdtOPWutBrSSU3qKKdcxf/+Xi6ECm8mWHCE6a9DFEE7ECPezZlqKJPi6whqPuo7hx/vXstfrQSfCG5wSBMc25V1BIbuBWS/M3+8WO70LrwbSO4nCGFW7kO3keiDKXo5sXQSy7Qz0= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:07 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:07 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 5/9] usb: host: xhci-plat: add .suspend_quirk for struct xhci_plat_priv Date: Sun, 24 May 2020 07:23:00 +0800 Message-Id: <20200523232304.23976-6-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:23:04 +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: 4a5d906d-5396-418f-2e2f-08d7ff703fee X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SLHUelwsAnP31UQe2v3Sqv1uY6CZNbuRgCM6XfPGb0CdHszKwMEMfE2QFWEbBpU0E8adGtECDUz7/T7FASlCsK2AYYBuUidKk68d1mGG8avkEQ57K0D1xk0qOWkdkhkQwtt9r76obTOnhOjdfyZIfFS3D8Zbw4iLwvboW6hoN93PCABJGkpTIH2WV6ahGhMX7QPW8vxYIEruvk4bKeEQCyRfgTkZrSgj4sC8R5y6iMr1Ga3rug9qGdY1myfZb67kgmg9acwuaHa05DH6b9H9xbkewaTQu8JRvEPOeFicAhJ/iLBgNUzOh1DTY5zeKdoOU0CLc7CsWhuzLjcbQMw1NjgQCOCfTJXbQkWCjkqQk8WKmz/a7Ie5s3wmrmkuvoPI 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(15650500001)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(66946007)(6666004)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: iJAYe5ipYT1Fb+UyvRkTWxIh8buxfGhBcq1VA/KpmybaD+B2YLQRoZpmoUBdy0ePtCIiKeqexKmSAvJMQSOrqynd4sW0j0iERikSR0WZ/NTGWwruwnBNKnYq4rcWmbMR/qLKPiOM0SGul/gp9h59dLNofxdi9ek+xppVOh6F6LxW2dWfr2kKbnXcS0lvoz7uc/mrr1gyi4wtp7hr6J4BjOexfxj51ph4kDgffjXuGYix0Wzi9+D2K2rViXl7vIlVd83OZrJo9++GLAFQL+CJp23qYPSwo90+SILeci1GAxCujT+w4K7X+h8exqWsl2hhcTw3QX5Hh05azjbZCaAfaP669MovtPohCmUs+CO6Z72majDUZ0qeGApWXMVx5XdJ3XlFi5UGpQUV3zzY/0mqHdocrXfdCP2PbD2m7QmgEyUjexq5tF6DAN8UQL1oMKMqsOfkcE2FVxrXTrSDbEMSYO3KuyM37mzcqu5zp00Nf4k= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a5d906d-5396-418f-2e2f-08d7ff703fee X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:07.1791 (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: jeP3AFZreVCZ+4Ga9N64mfpiFaYyB8g7oEUhNnsD9CTz4o/IHeUJFw2xLt3XDh09KUF1sSN2MN/p/B2BSou02Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some platforms (eg cdns3) may have special sequences between xhci_bus_suspend and xhci_suspend, add .suspend_quick for it. Signed-off-by: Peter Chen Acked-by: Mathias Nyman --- drivers/usb/host/xhci-plat.c | 19 +++++++++++++++++++ drivers/usb/host/xhci-plat.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 38bea2b6a17d..51e20464fe0a 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -54,6 +54,16 @@ static int xhci_priv_init_quirk(struct usb_hcd *hcd) return priv->init_quirk(hcd); } +static int xhci_priv_suspend_quirk(struct usb_hcd *hcd) +{ + struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); + + if (!priv->suspend_quirk) + return 0; + + return priv->suspend_quirk(hcd); +} + static int xhci_priv_resume_quirk(struct usb_hcd *hcd) { struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); @@ -401,7 +411,11 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); + int ret; + ret = xhci_priv_suspend_quirk(hcd); + if (ret) + return ret; /* * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. Since xhci_plat_suspend is currently @@ -438,6 +452,11 @@ static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); + int ret; + + ret = xhci_priv_suspend_quirk(hcd); + if (ret) + return ret; return xhci_suspend(xhci, true); } diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h index b49f6447bd3a..1fb149d1fbce 100644 --- a/drivers/usb/host/xhci-plat.h +++ b/drivers/usb/host/xhci-plat.h @@ -15,6 +15,7 @@ struct xhci_plat_priv { unsigned long long quirks; void (*plat_start)(struct usb_hcd *); int (*init_quirk)(struct usb_hcd *); + int (*suspend_quirk)(struct usb_hcd *); int (*resume_quirk)(struct usb_hcd *); }; From patchwork Sat May 23 23:23:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567075 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C2BE913 for ; Sat, 23 May 2020 23:23:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7538D20823 for ; Sat, 23 May 2020 23:23:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="JOLv3sDV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388147AbgEWXXW (ORCPT ); Sat, 23 May 2020 19:23:22 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388010AbgEWXXV (ORCPT ); Sat, 23 May 2020 19:23:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YqK4RycBphjoUhiqiBXEm4Cp3HyHhrLAjkp93WA+lWl68zFXtTrxn/MPLXxeODp55AB/CYJC5+vQOhHxvcvfVEZ6KUCZexAPNGRlNnNZRRs2TchAQ5eE28EicbsW4/cbB8fDAOiqclqZ8XwWLxHQKWgXfViL3u6fm7vP+2frzFAth87rr4QCDqwB94JUCCiK18xj4fGICNIst22JmZ4EgmvuRLJgmHDZMKFXzGxyAaP0PrAGxv5LCgVUsdFBvcOmQI/5HqujD8QhoYYYxSITDNhyOMoo4zBOl1hINKKRa5Yvm6WLF62RB+HjHhte2MhiMrctXcbq2reZcQjC8lxrlQ== 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=X1YZzZ589G2IRz/LzrnhKmir3H0rRq/adHtpX3ezRlE=; b=TwIe2GJ1VwQCuAA/0VhoS6/jPBCPMS18WmqDdA8HsYXgEh3wd5Vqja2r9Khl60LJI0M3zN5xF7MYUVknget3wzDV0xuxkj3S/RCgXTpkfQg357bP4L9LuOhi8J8WvapgZzWWpCov21oBU9/hPpAoKsULA4HvX0b/nwB8oNIWntTLDLzau+1khor1tw1JNnvn78clb1IALEFQnQdExsothwncL3M5dp9ntZ2I3jfOD9YW8AgTaNa1EQKB4GenhFGT62NFK6POnyzbiAS1rCwUalWXSKmsEA6CNCujflurbGttnRyW5YJ6mOc+y4+tpsmo/q8WYdZ8sToWSJSkuiyqBQ== 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=X1YZzZ589G2IRz/LzrnhKmir3H0rRq/adHtpX3ezRlE=; b=JOLv3sDVyBzeJSWoGBh6uCbULuum/1pM5n9rkI62heEUZBncwlFCY0r6mGjr4rOH7UzbEPtfkBfvTDyMwdE66g49bS2SDAN9JkXzWuBWxk6yVdBW0e7uZcG78IKQS70PFNQKyrvXSZPKyp10kL5Mh+Zb6fXs9sy8nGNm4xOr9es= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:10 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:10 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 6/9] usb: host: xhci-plat: delete the unnecessary code Date: Sun, 24 May 2020 07:23:01 +0800 Message-Id: <20200523232304.23976-7-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:23:07 +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: 226645f0-7da3-413a-f3ef-08d7ff7041b5 X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QICih1DZ3NFaajkSogbBfTPNTu5WreuatHk1KfqqpCrj8X90jFmznBneg6DOZHiCP8i3YqFCUT2ST+/91QV9jtVVEa5fTTBtrCdsHnPkG+yfeCX55ngxBYzQTBPaEzGrA77iCE+4qCg9PtyPM5F6RYU74UuFTZg9pSnHAROgAt9ByHaMujz6qSXhGthwZk5WQv9ztxzYjwt6D1oS0Xs+GgMKNxMSN4iWFJ5mnrRRWC6T+qDKYvPK7ByHMCZCB1iNWYa3DQ+uvhguBaV+fFOxO2yR52/VXRWGBywWv/xQtaBGQ7C+uFBPB6f91Ndj3QKfSwARevbD9yK2TSEzMfkXtQ== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(4744005)(66946007)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Sk+H3c/mNw/L/GIvEr0t1cUZZu0MAnKI8U0teNxTj/4a1B97Ms4YKmlga4BRg0Ro5Ui6lV2voTCjA3+TNJG0bFA7kKyRpeTs5NfYTdC4t/ZdDT3lXopwXLVYVHcTtjdOoFqE49d1jnNxFyhebwpTjwRJ6IpHx1Wyp7Vxdm1gPFNAYydfgLfRBfKTE6iMpY0HlARwLyqAdPQf46c7oQkELP5mLZcvunMC+Hr+iOUCHUep4MwI3H3xG/Yx7nHIL+ObPgUI1Uah20TDHHQo5A4Mp6AqOUiUEiJljMy39NisSWnc7dDKgqqceglLKp95XuVLMDaWTjJyCYpvD+/8lawSiXiXSWcGBn+f8o0G+iseAVoHeeIzUUaINFdXUCImWmSHNViUqv/hYwnCKmRx7hzFMovpaoVmjA/DzzvDgilSZwG96PPeIApI9fw58icrQ2kl7XwrKGRGQBwywskNn5KWy9vFkwOZcEERJOad01mhD68= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 226645f0-7da3-413a-f3ef-08d7ff7041b5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:10.3005 (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: 0vyf1GERnXXl0rqDx69Kx333IwMdsr6nQ0l+RqoB9vSH04dfm1OkzreEN9A8SOBkptDT0X/pzQL7jdo0vHVSRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The if {} condition is duplicated with outer if {} condition. Signed-off-by: Peter Chen Reviewed-by: Jun Li Acked-by: Mathias Nyman --- drivers/usb/host/xhci-plat.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 51e20464fe0a..03d6bbe51919 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -283,8 +283,7 @@ static int xhci_plat_probe(struct platform_device *pdev) struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); /* Just copy data for now */ - if (priv_match) - *priv = *priv_match; + *priv = *priv_match; } device_wakeup_enable(hcd->self.controller); From patchwork Sat May 23 23:23:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567077 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 983F790 for ; Sat, 23 May 2020 23:23:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 813D020825 for ; Sat, 23 May 2020 23:23:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="pGAvlxTn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388160AbgEWXXZ (ORCPT ); Sat, 23 May 2020 19:23:25 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388047AbgEWXXY (ORCPT ); Sat, 23 May 2020 19:23:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XysI6klXpqbigkVh6HZujCv8+Twjs0UPzDPgK1XafOEt3dCqWrgcgTpgtt1II6IiI9Ewq7RZm3y/DM+VPWOGDGhqCMcJs604B5gS8WKnZT8qV/uqmF0NU30A+ZS17KRltf1xe0x/mORV6P1lqs2s6pMb0DDL+YuwX83cMBIeUnCMNsjMwpWuFUZvtKpIv3JcUOhPf0qMo8LDdWcoekaFDJJObs5Y/mUyYdNBBeP/q/dZPPRdeX+K6jCZ+tid682GZLPQqsa+8VZBqAcnr8nzp+u7H9QyTYKu+WI7HYgIJf4GmjM8DNDIug9+VHIHDeLlDT2S4rCnHEUkk5O2/VauEQ== 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=AcEVbLG6zordQYs4WJVrxEQTtS9H5+8QbEWPdQxlkl4=; b=QVeyv7yK5/3G4ADO32xsPqfzXLN4TvhxcK+qGImhIltnveKLRngFWDjon/EuCjuE9w6JDZHWVagInLBqYzpfk37NBPgb1FEWp7w3uUbjnDDYXSe6qG4JrnKlXeefEZqpJ3dY0JPq9yv0+HpS8FIhBFpingBoJ5amacVMpkFZxdCIJR86n4srLQxVOMN+YQNSI3paLzBPPvu4QfsQ+47GPxCDAY/8cnvbGnc+tFg3jBKpg02ax3skiAthG4kkt/am+i0gpFJKapH+WHdw8aTkRLJbMqhM3KEDq/zJ9TfuYAG7DC6zsRxbZY6WV3h+T3LQpVVpVYzgvbOal9NqLIhjRw== 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=AcEVbLG6zordQYs4WJVrxEQTtS9H5+8QbEWPdQxlkl4=; b=pGAvlxTnmNZyMA6C43PRRanjmfeSoDTWks0inKIPd0gjpkGS4WJoOB8erMAQIAEhZ/Xtr7krTkqBysvlczAORbxc0nKTT0yfLN+qisn/kw+9trq1fAP9XJZDGGb8hNfAnEdfWBvMSLXVTxPz42QQ4VQajwtdkcwZlw5totMgsk0= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:13 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:13 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 7/9] usb: host: xhci-plat: add priv flag for skip_phy_initialization Date: Sun, 24 May 2020 07:23:02 +0800 Message-Id: <20200523232304.23976-8-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:23:10 +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: 201bc19e-48c2-4fcb-89eb-08d7ff704392 X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t9J8i8TVTPyz/3Ot1doA7OpPLVhwfTenD1ok5P0WXFo9W6cOdWKxuEqwQQqzYAiNpx94R/pARZmVkIM1kjF5Aru7AadPT1LbY38pLPPgsIPMvKBTw+CRJMlcovyksrX9qpTP+d9tmqX8Xytt91b+vX56wFhxpFFopoEA5PVSRiW8DAfhCv2zWyGogAhqSEHq1J1mCaJK6G7pU6T+INLzF9Y3K8pWtfG86sYz8GEMbw71nbkNnL+/94NiZiDV3EHv6wM0oXzhQPFFwszj9Po1n4dI0JlZ/F/mFUR84pbDMjdUdzijVXMmrMaqZTCLH0dz3DnUTjsGbztaDHN97Xa+bQ== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(66946007)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: n05wFMnq0nricUaIhGi/Jenp/F74U+XzYYOJw9x0If1ZimdZ7pZiN5t34vLOQdJ6GcmknoyOGE1z0xD+wGJ7D2eQFBSQQzG1ut0O4mGpeaK3SWvMxW1Ul2k9eED2DD4ifceyc4B9clLdGSYe3UB/uSLjvyeREAjNvDPd7CYxvaLxvBmDbf637z0bdQKNjsiC8A03cnskVjlRryIfyU15iJO6ULpBd/kPdFvUhUdlyyxzLiSRJ6crLYc+QSz1r6pg7Pmw9isD0L1kdbjZGbiytGGB+zeo7XREAmVVnB6uqrsomlKUBpugX8QOyVpdN/MyHI8gG+nI5KJbzrPB4jt0vhWCqRNMoRC5hP2x4u9LgnZsQ7mr53IxK2dEyNowAkTEgYyM8AA+PXMzlJHhUHIA6HHKzUdTFYnuOobUivcTUxAUNYv0XwqC8y4S5YBq72Gj3LQlCbFMuRx4whhK5/tXa4q6uZ8xXwW6UsKd+OEX0eQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 201bc19e-48c2-4fcb-89eb-08d7ff704392 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:13.2944 (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: J7zg0n026DLIG8UxKXMMLGXQFIho0riCW6WvlpaJ8wK6KKd2Z0NWWnDABt1mHukaNAjl/jdU0/UWFnh1AuULwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some DRD controllers (eg, dwc3 & cdns3) have PHY management at their own driver to cover both device and host mode, so add one priv flag for such users to skip PHY management from HCD core. Signed-off-by: Peter Chen --- drivers/usb/host/xhci-plat.c | 8 ++++++-- drivers/usb/host/xhci-plat.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 03d6bbe51919..a3d6cb464186 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -183,6 +183,8 @@ static int xhci_plat_probe(struct platform_device *pdev) struct usb_hcd *hcd; int ret; int irq; + struct xhci_plat_priv *priv = NULL; + if (usb_disabled()) return -ENODEV; @@ -280,8 +282,7 @@ static int xhci_plat_probe(struct platform_device *pdev) priv_match = dev_get_platdata(&pdev->dev); if (priv_match) { - struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); - + priv = hcd_to_xhci_priv(hcd); /* Just copy data for now */ *priv = *priv_match; } @@ -329,6 +330,9 @@ static int xhci_plat_probe(struct platform_device *pdev) hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node); xhci->shared_hcd->tpl_support = hcd->tpl_support; + if (priv && priv->skip_phy_initialization) + hcd->skip_phy_initialization = 1; + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_usb_phy; diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h index 1fb149d1fbce..8825e8eb28d6 100644 --- a/drivers/usb/host/xhci-plat.h +++ b/drivers/usb/host/xhci-plat.h @@ -13,6 +13,7 @@ struct xhci_plat_priv { const char *firmware_name; unsigned long long quirks; + unsigned int skip_phy_initialization:1; void (*plat_start)(struct usb_hcd *); int (*init_quirk)(struct usb_hcd *); int (*suspend_quirk)(struct usb_hcd *); From patchwork Sat May 23 23:23:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567079 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B1F4913 for ; Sat, 23 May 2020 23:23:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DC01207FB for ; Sat, 23 May 2020 23:23:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="dzvr3MpX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388167AbgEWXX1 (ORCPT ); Sat, 23 May 2020 19:23:27 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388010AbgEWXX1 (ORCPT ); Sat, 23 May 2020 19:23:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8/i/iS0E3RQcur+BVSxLA0RnjlBnqD/DIDWP0A+Z7K1rY1Zm/dYpfKlfOJW9I5ugViFzNGlhqhII5MdRVY64xn/VrUdUofEuHyjAXVBeU41iejph4MFG6n8FHAL93dhH0HcJL5P+ercQO9rRdBFfwSZ0qhz1yDn1vzAb40IsgOkYjx1905H/MHh3D/LBCQZ3RKrc3FQS8wShWI4v/st2HYH6UjpxN0NzDYOdLYizGl8FTW5qfeaJaC4NlPxAJqmpnUABQWxDOH1yh+pUWK3Tz/AVUuu3L5ZJWVLZdZVDmXzYFl9bBamoBnXKW5Ai/r8KQbWM9mJFKNJIVo9oqDMHA== 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=awe7nqB8eZwjtrkIA9n1ZMYGeDJNbopX+R1gbb340Bw=; b=oX7m29qEXmYAoYWRzxr5AZX2yvPJaYfZ4G0yReudQfVjznK+Xk7xAFl64JaHHj/7gLwfd4FA0oDlUQYx42/A8cLIF0awBwzEDYpY34kcS6z7RI0WGk+z9DAfUS/6IQF7WVhDNxiwCZPHQMdRktw8miG8TYdHg0DhrLNrVoGYHGwDhNqq8ohBB5KDGe6gqUEb4o9nCtdcdI1jbcUmk+/u3V7/L0CvlXyOuhWpK8bxZSffldnenWdIIjQ1eUQ7+W9K7IkIyG0ecD2axXRMviuTUA0OMYWoDmkbOu8LqKlgsBsr62eoU9EFGQcFRyqWCV77bO2eODJ7NRNiPxQq+Y0Wag== 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=awe7nqB8eZwjtrkIA9n1ZMYGeDJNbopX+R1gbb340Bw=; b=dzvr3MpXrxJOF8vdLT7qfFERWR5FQjdUZQPMUzuQ2x2hDORYN5Unogmlszk4EbZctzrDyfi6cwt4F8NXjQ+u6zbOkZDxxjvwWE9EZyxU/x8mobAFa4CYZ5NaGF+qbG7WCqleg97vpaE0fkBvi+xrSeV65HvGrtm8Vmbl/Y1r0mg= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:16 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:16 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 8/9] usb: cdns3: host: add .suspend_quirk for xhci-plat.c Date: Sun, 24 May 2020 07:23:03 +0800 Message-Id: <20200523232304.23976-9-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:23:13 +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: 480dea07-3ba8-48ca-ce32-08d7ff70455d X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sLbRe3yoDgTkvtbawhekvuW5U4mlXhU9E5TcREjqrtPd/14RhY4Et3eB34y+mM7XIYqV9EvHo4VLk8uyJhc5857UZzUk1QVJg7sFJh2VcsyVZnMJtfaAlI73tkjc2xzxu6ZLwoDFccCY3ZCoIK1ybNUKDO8Oh9OKH3A1Dh0aWSJlPKt8uSPkX2yA720ZI25mcZfIVBJhmai4D9tskmoHTqR5xJjEtk5Mk5vW1TxQMdh4ztMBUgt6weBwEYUNcWLPXaOj4Ly5my/S+QDfuBdBc6Av5IIkzXq9i5Z/TEY9RfGWdr58dwxaRAQjsavQ/dfxqWf63v4e+j4wusc0P5isjCBGghObj3QH1dbDdR1a0T9GXeLYtu1lAZO+SDJ1OvAH 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(15650500001)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(66946007)(6666004)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5NjCr1cfxxgZSttPnoIch16+63IsdgbHTCltXa8NqNgdSTIW+vkEZYFmWVOlvIEMMxWuGstATkXm97kpGq+BXOUvYjD5IcNm7+IkOwYoiKpUU7IWsRNf9+fao4kFBjuAx0MvLKwTGAtNpzwzEKHG83V+9d/Y9XZVipDJ4pMsG+PTjNSDZcqVvweZO4HxRbIpQizt0sOIyORSUXDvqIni/J4dioYJJRS4ELI0Hw8PmaskCxiDDRL2lWfTvM/IFcEOkI6ejeteQNYcfThO9K/6KzRCC8iHGPcp+XLER79CTb1KzRf6PUv1EB+fZbstZTM1HZ9wIi2LLXzB6WLiD0p5uEN1qqyofzM9iNC2o/nPstuqPoX1bpa/7xcyVI5+nAUhiHf7q3TBcPCcupPgJADOBVEuFuhxsjT5Wp0mpDVXf79KbO+Lf3yWj3Q4p5hSd5wLB3Mi6O5fNjVqcbGMzYWmFuQdM0tPjdIiYNJDb2vbNso= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 480dea07-3ba8-48ca-ce32-08d7ff70455d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:16.2903 (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: pwsx/+hlAu+eDl7XlE4Vh7nHS+zEHHvzpe/2MlHmZ+XxPpWwTQTB/OmZMjc4X1egceYfn6SgM5xMy23oU8DQkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org cdns3 has some special PM sequence between xhci_bus_suspend and xhci_suspend, add quirk to implement it. Signed-off-by: Peter Chen --- drivers/usb/cdns3/host-export.h | 6 +++++ drivers/usb/cdns3/host.c | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/usb/cdns3/host-export.h b/drivers/usb/cdns3/host-export.h index ae11810f8826..26041718a086 100644 --- a/drivers/usb/cdns3/host-export.h +++ b/drivers/usb/cdns3/host-export.h @@ -9,9 +9,11 @@ #ifndef __LINUX_CDNS3_HOST_EXPORT #define __LINUX_CDNS3_HOST_EXPORT +struct usb_hcd; #ifdef CONFIG_USB_CDNS3_HOST int cdns3_host_init(struct cdns3 *cdns); +int xhci_cdns3_suspend_quirk(struct usb_hcd *hcd); #else @@ -21,6 +23,10 @@ static inline int cdns3_host_init(struct cdns3 *cdns) } static inline void cdns3_host_exit(struct cdns3 *cdns) { } +static inline int xhci_cdns3_suspend_quirk(struct usb_hcd *hcd) +{ + return 0; +} #endif /* CONFIG_USB_CDNS3_HOST */ diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index b579ef15f4e0..030d6421abd3 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -14,6 +14,18 @@ #include "drd.h" #include "host-export.h" #include +#include "../host/xhci.h" +#include "../host/xhci-plat.h" + +#define XECP_PORT_CAP_REG 0x8000 +#define XECP_AUX_CTRL_REG1 0x8120 + +#define CFG_RXDET_P3_EN (1 << 15) +#define LPM_2_STB_SWITCH_EN (1 << 25) + +static const struct xhci_plat_priv xhci_plat_cdns3_xhci = { + .suspend_quirk = xhci_cdns3_suspend_quirk, +}; static int __cdns3_host_init(struct cdns3 *cdns) { @@ -39,6 +51,11 @@ static int __cdns3_host_init(struct cdns3 *cdns) goto err1; } + ret = platform_device_add_data(xhci, &xhci_plat_cdns3_xhci, + sizeof(struct xhci_plat_priv)); + if (ret) + goto err1; + ret = platform_device_add(xhci); if (ret) { dev_err(cdns->dev, "failed to register xHCI device\n"); @@ -56,6 +73,29 @@ static int __cdns3_host_init(struct cdns3 *cdns) return ret; } +int xhci_cdns3_suspend_quirk(struct usb_hcd *hcd) +{ + struct xhci_hcd *xhci = hcd_to_xhci(hcd); + u32 value; + + /* set usbcmd.EU3S */ + value = readl(&xhci->op_regs->command); + value |= CMD_PM_INDEX; + writel(value, &xhci->op_regs->command); + + if (hcd->regs) { + value = readl(hcd->regs + XECP_AUX_CTRL_REG1); + value |= CFG_RXDET_P3_EN; + writel(value, hcd->regs + XECP_AUX_CTRL_REG1); + + value = readl(hcd->regs + XECP_PORT_CAP_REG); + value |= LPM_2_STB_SWITCH_EN; + writel(value, hcd->regs + XECP_PORT_CAP_REG); + } + + return 0; +} + static void cdns3_host_exit(struct cdns3 *cdns) { platform_device_unregister(cdns->host_dev); From patchwork Sat May 23 23:23:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11567081 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6944E913 for ; Sat, 23 May 2020 23:23:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5208020825 for ; Sat, 23 May 2020 23:23:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="TybqJ9zZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388169AbgEWXX3 (ORCPT ); Sat, 23 May 2020 19:23:29 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:23517 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388047AbgEWXX3 (ORCPT ); Sat, 23 May 2020 19:23:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AmUo9/LkZ525B3bkCV9yzS2g5PbGCENezj1sKbNdDvY7UD1VJ1j/5uC4iyco4ywJ8329hX6gO99bFW1ckQ+L1/hHzJDx+0MPzm44Aqx9HVnj1aF/zTN1gHwUAZU716akkqB9qOCX6NqQ5HY71EeWYnUWcgC1pnMfeh4atAiqU0VX44mYsXyj9FZIePiovnGh64cPGPN9rAxL666jdRu9jQn85mP2Yh5/LbKKLreymB/udwgNZz7doSSi5sV5sazBdT5htt8Qy1DnFIhWIwfNFtUpUAvzC1p7w1jIPTxXR6ycQV/9M1yVpMd6cIv+OqozVs1ai6h2B5o+cYL4JoeA2A== 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=PFEnKAx9z8Nqa3HrPCHrL/GMcHDUpPdw26EiTvUC4Rw=; b=PtcdOXOm8wUiArkJCRn0Xc+Tgw3+PG/OqFqaLoA124MDItS3KMYBab/i4qmQjorrSTXR/YKFxEMggMnm2IEBvX8t+YeAo6mDutJxKfyMyDYGYFaB7+3H5wttIjXWMN+Mvl/OPalAlj+tOUYMcVGEZcjytx1QVA5XEmwKGKJ3K4spC5ITQpjuilvI+UsLChQdljzjPYkW4nLd5SqjFvni5zwmQEHSSYI/fsmAmzLAJrgtusYHs4AQz8mxDZn7e5OoKVX6L6O+y19SjnkjJZsAwu13s+lNmMapop0I+BbCUEQUWpxJkwtkYLZ8qzo8B2nuegJTFoCk2rsNinLiNsac4A== 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=PFEnKAx9z8Nqa3HrPCHrL/GMcHDUpPdw26EiTvUC4Rw=; b=TybqJ9zZM+lwXtCYjbuh+2TNgQTNMMAa2yU2sLoGg3ZwlF6OpFUTCuecPH5LIm5HynRo/CO2SJlJxF4371TD5glYQvFsJ7T4nv9QhvMrRR0YT71QZ+Duy0neUwk0eegZU0CudjkFwhi6CPS+ueQjsUYynVKiS7BVhOds71zSNG4= 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 AM7PR04MB6918.eurprd04.prod.outlook.com (2603:10a6:20b:10c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Sat, 23 May 2020 23:23:19 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3021.026; Sat, 23 May 2020 23:23:19 +0000 From: Peter Chen To: balbi@kernel.org, mathias.nyman@intel.com 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 v2 9/9] usb: cdns3: host: add xhci_plat_priv's flag skip_phy_initialization Date: Sun, 24 May 2020 07:23:04 +0800 Message-Id: <20200523232304.23976-10-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200523232304.23976-1-peter.chen@nxp.com> References: <20200523232304.23976-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) 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 SG2PR04CA0153.apcprd04.prod.outlook.com (2603:1096:4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 23:23:16 +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: 6f5aa70d-436e-4e45-7d31-08d7ff704726 X-MS-TrafficTypeDiagnostic: AM7PR04MB6918: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:626; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O5pgUyUSeeFcSdeWpozLbQdW0vZVvnJBGCeh71SlOV9KBprh4jsWyGY2PJb6VEJbQuKvJqspDRmD2gysmwupI7xn9Q5RnH2p+JT3jAOmE1IWGBMfTNyCo+TgMvIUwVqXEFxsr7/UJdnhNoI5eta8jqUDVD+m0JDmSwwC/AqKhj6ZAwtw4oPLl04nurAUi6hn8wL56cswaIg12S71uuvFwtdydjfG6Bu9GW8cskDLPMLKBVoKCyjOsF1PUJU/Bm2SmwUz/1dxwuMzqnxNil0kRd0bL5rFHSoe5RnzVgUdKI2hEVcfi07+mCri/LSTSU0IN2mJL66ZwQyXbvDDfXu/Tw== 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;SFTY:;SFS:(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(8936002)(2616005)(2906002)(44832011)(186003)(6506007)(8676002)(6486002)(316002)(478600001)(66556008)(36756003)(16526019)(6512007)(52116002)(956004)(66476007)(86362001)(26005)(5660300002)(1076003)(4326008)(4744005)(66946007)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jiFYeJPuZed9uNkNATJm04849k+fdO7ZV0MbAjMZIQveF/Cw0OhmD0/K5t/0AqCU4LE8HXAFUy/cyiSqLpQG9jZEoauVqgGJ17vrsU5tr/2+9NQeIyKtulioFp+msC0JaPG7cgjLt3YgxSWIB3mHTxHgmBRlOFjGJOSFedYs2XF7AClQ3PQ/jG89mPWK6m7ATZXZOEgqEgGnSEzXgcgzmnQ+HDNHCiq5sTz6xJdIJTu8y2m+S6mYL/swaqqvyXeuyMRMk1zt9a6RrMagSeuVZ9vdCFJrIr6wgc30EtEYdl4UMe0i4MlwkppQ6z4Krs6TCNsgtZJ/DmhDYauEMj/lUPFDbOl1S6FkogI3QIrf2pteO2CrUpTM1gBNzuiCEYP5HL6OCHnHyT+0F/1yPzDXEBZDvvzQwMMX+NU/Lyy575KYeT47RpUTXCdVDEdOGScnelv1+zcytbN4UjaT5A06+7O7bGo3yU2qbCaxo3VDEwo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f5aa70d-436e-4e45-7d31-08d7ff704726 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 23:23:19.4256 (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: xiS7cvYIRJDBnxrxfe6QbSyGZUh4bHvdS19AxzbnkCrIHGswsVrHN2vH4yGMDLQOMrPK9Gm+JLAh626GtDELOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6918 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org cdns3 manages PHY by own DRD driver, so skip the management by HCD core. Signed-off-by: Peter Chen --- drivers/usb/cdns3/host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index 030d6421abd3..d681c3db25cd 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -24,6 +24,7 @@ #define LPM_2_STB_SWITCH_EN (1 << 25) static const struct xhci_plat_priv xhci_plat_cdns3_xhci = { + .skip_phy_initialization = 1, .suspend_quirk = xhci_cdns3_suspend_quirk, };