From patchwork Wed May 8 04:24:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10934167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4453B92A for ; Wed, 8 May 2019 04:25:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2460E27CAF for ; Wed, 8 May 2019 04:25:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 119FF283E7; Wed, 8 May 2019 04:25:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FABD27CAF for ; Wed, 8 May 2019 04:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725884AbfEHEY7 (ORCPT ); Wed, 8 May 2019 00:24:59 -0400 Received: from mail-eopbgr130045.outbound.protection.outlook.com ([40.107.13.45]:54190 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725825AbfEHEY7 (ORCPT ); Wed, 8 May 2019 00:24:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZhiFVhaftahPwXQcWqU8kAzSTN6IuCWPofA8J8QJvIY=; b=hg7O48d9kXO+BWhCy6cHSOTG7J862dNQV6n0H/xYj8lw3k4KO3CiD2c0LrDL4e3bNO0JyupUEjU8nQ/apCkIKR3zDHfaU0gx3xnntozRWSHUUaS+hTtZu67z0vqAl4v9EbrQdHdkw3Vy98DyFyli9gmGM0UedK3yuqH34eNW6XI= Received: from VI1PR04MB4558.eurprd04.prod.outlook.com (20.177.55.216) by VI1PR04MB3213.eurprd04.prod.outlook.com (10.170.227.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.11; Wed, 8 May 2019 04:24:52 +0000 Received: from VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::7c70:2812:86ad:7e1c]) by VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::7c70:2812:86ad:7e1c%3]) with mapi id 15.20.1856.012; Wed, 8 May 2019 04:24:52 +0000 From: Jun Li To: "balbi@kernel.org" , "gregkh@linuxfoundation.org" CC: "thinhn@synopsys.com" , "linux-usb@vger.kernel.org" , dl-linux-imx Subject: [PATCH] usb: dwc3: move core validation to be after clks enable Thread-Topic: [PATCH] usb: dwc3: move core validation to be after clks enable Thread-Index: AQHVBVX75mSUr4osh0SkRZR1EPQnbw== Date: Wed, 8 May 2019 04:24:51 +0000 Message-ID: <1557288102-26129-1-git-send-email-jun.li@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0204.apcprd02.prod.outlook.com (2603:1096:201:20::16) To VI1PR04MB4558.eurprd04.prod.outlook.com (2603:10a6:803:6f::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 680f7345-d7e6-45c3-29c7-08d6d36d1d6b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB3213; x-ms-traffictypediagnostic: VI1PR04MB3213: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-forefront-prvs: 0031A0FFAF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(136003)(39860400002)(346002)(366004)(189003)(199004)(86362001)(478600001)(8676002)(110136005)(2616005)(256004)(14444005)(386003)(8936002)(5660300002)(50226002)(6116002)(53936002)(81156014)(66066001)(81166006)(68736007)(4326008)(2906002)(52116002)(186003)(99286004)(14454004)(71200400001)(71190400001)(6436002)(102836004)(6506007)(26005)(3846002)(6486002)(316002)(6512007)(7736002)(54906003)(64756008)(66556008)(66446008)(73956011)(2501003)(66476007)(66946007)(36756003)(305945005)(476003)(25786009)(486006)(44832011);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB3213;H:VI1PR04MB4558.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: nWrEIhaDmYUJIIgbPzpvFoV9N0SJAMkBUQrwPV4bvMC4WgUMpWt/dLBvuj14gB+zVxd/m1ieVICOyJEwEh1dPi5wUPxGS1+ZmoENWpBmfOmepl4A+VWZu2jckdtIec3Uxl1/dNqmU51ZBHk/EE0aFVxq8HHw/+sI+vjUZTXEOToNxJhgkyt+550li4KP2qiqzGag9KFvDq14sNJBhQGW/Quv3NB1Z+MQobMrkcK06VehrUuSxfZBw+Is9JrqLfconh7PiOLGE9J8GmPUko+sYcZOQ0WsXb1IeKSzYW4v+Pol7+YiMCkjF21t5PbJb5VKxe3in2+veKIM/KvUMedDMVkxnbvzlxiTU8179UL//0hnzOs/4CQF5WMRdmn/E/nwxnO5FGjoS/nE4unuW0HotBiq8hXGDDWqA4ssJfmSnkg= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 680f7345-d7e6-45c3-29c7-08d6d36d1d6b X-MS-Exchange-CrossTenant-originalarrivaltime: 08 May 2019 04:24:52.0133 (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-Transport-CrossTenantHeadersStamped: VI1PR04MB3213 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jun Li Register access in core validation may hang before the bulk clks are enabled. Fixes: b873e2d0ea1e ("usb: dwc3: Do core validation early on probe") Signed-off-by: Jun Li --- drivers/usb/dwc3/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 4aff1d8..0e49ff3 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1423,11 +1423,6 @@ static int dwc3_probe(struct platform_device *pdev) dwc->regs = regs; dwc->regs_size = resource_size(&dwc_res); - if (!dwc3_core_is_valid(dwc)) { - dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); - return -ENODEV; - } - dwc3_get_properties(dwc); dwc->reset = devm_reset_control_get_optional_shared(dev, NULL); @@ -1460,6 +1455,11 @@ static int dwc3_probe(struct platform_device *pdev) if (ret) goto unprepare_clks; + if (!dwc3_core_is_valid(dwc)) { + dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); + goto disable_clks; + } + platform_set_drvdata(pdev, dwc); dwc3_cache_hwparams(dwc); @@ -1524,7 +1524,7 @@ static int dwc3_probe(struct platform_device *pdev) err1: pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - +disable_clks: clk_bulk_disable(dwc->num_clks, dwc->clks); unprepare_clks: clk_bulk_unprepare(dwc->num_clks, dwc->clks);