From patchwork Mon May 20 09:28:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 164577 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp54775ili; Mon, 20 May 2019 02:29:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaFu2ffaFP6C8AjYRK7u6SWuRhvciXdFj49CU+euQmNMJ/buYGc6SxRxEe+nxI5r3cPVDT X-Received: by 2002:a17:902:e708:: with SMTP id co8mr73530384plb.141.1558344583760; Mon, 20 May 2019 02:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558344583; cv=none; d=google.com; s=arc-20160816; b=zV9voak7oLzm7l63IvCiTc17bUD36SctIudBYz5CW35tv6c9uRstrMHTq1WvalBuqT 4XADEorfsRu55KL/4W6BuKpVxxBSmMo959uXv7a/G9GVaBezUJwk3bx2fB8hq3I+sIs4 X54OFgAQjbT03CY0qhz1goq7FcBFdTYRpYlMQqcS1KGZtNweNE4G2+RrFlsqqyjx9Fil g++p12Ni0cD+Ri80ad0zLtJjXW5h/71Tzt3D0LqFpkjTgzx7TqMQR8pCY+VPChnfjTA3 HVlcMblJ+3gsXs+RMxlMS3WCdg7jBQVvjkiOzfRzVOqmGfK9PnuXcH2Jv0cBIQQxv20B BI/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=7zNhByx278yRPPSei/tiEqUup3t3T64vzIvnm89UL8A=; b=vhQXEwbL0L4CJTSPSS4vQcRJGK78dZcSMi/9WsKx3LZ+PxpJoIVqkyXiP1eejX38qD mHYdzDS9ifWvPGjj4YiNfpkMpMvNKm0G28b9BnvB3PVi0Fy0md/bKwyeU5qDk7TJz/+B FKNWklwrqNZgT5479gtmZmbysm9sfIwocMeuIg/6alJI4hlNT9uV7y+eEk58Ho1nl9wW 1magJJFStqIhZr9fb9fTDIbWGF8hd9UG2uOTwXtHUclOWgiA874zBTl8SzKTedz7m1aE KjGidL3YsFiHtyCozs+hx3lZl+aaO2cF18hLPDf3vbgDqNaz9JcQjRNdE8uyTdjmWSi+ URVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w2SjOATd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si18017427pgk.221.2019.05.20.02.29.43; Mon, 20 May 2019 02:29:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w2SjOATd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732153AbfETJ3m (ORCPT + 30 others); Mon, 20 May 2019 05:29:42 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:38104 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730966AbfETJ3m (ORCPT ); Mon, 20 May 2019 05:29:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x4K9T4UJ030614; Mon, 20 May 2019 18:29:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x4K9T4UJ030614 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558344545; bh=7zNhByx278yRPPSei/tiEqUup3t3T64vzIvnm89UL8A=; h=From:To:Cc:Subject:Date:From; b=w2SjOATdXkW9Tf4JJCsQMIRmdAeKSbp4HXC08a/3RWMYotNOM4k5quOwB52AUKAkd W8h4pFo/7KHAR9mE0qNQhVu79YDzV0wIdr62Z+kqv3FaA8x1Oz5e66PRiWPqN+u5pT TaTkfIGdtQY/C/9jCaA71In1oO3vGZy6gkWIRT4wuyS43R/1hLHXJruHUQXkptCCMu DjNXOi1Nbhr3LXaYt0SGjSn6iUf22Pg6EXy1o190unxDgHcLUlQgME6j9BrBOgV0V4 CbDshgde9vjjfZy1BgCKZHv38R8FpGst3YwzUBZsNm0RvVaE9u6G6O1UvF3cD/ob1h cnO/Cg8ISAz7g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Felipe Balbi Cc: linux-usb@vger.kernel.org, Thinh Nguyen , Masahiro Yamada , Greg Kroah-Hartman , Felipe Balbi , linux-kernel@vger.kernel.org Subject: [PATCH] usb: dwc3: move core validatation after clock enable and reset deassert Date: Mon, 20 May 2019 18:28:56 +0900 Message-Id: <20190520092856.26307-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit b873e2d0ea1e ("usb: dwc3: Do core validation early on probe"), the DWC3 USB3 does not work for Socionext UniPhier platform. It moved dwc3_core_is_valid() really early, where no clock is enabled, no reset is deasserted. Any attempt to register access causes the system stall on my platform. Move it after clk_bulk_enable(), and still before dwc3_get_dr_mode(). Fixes: b873e2d0ea1e ("usb: dwc3: Do core validation early on probe") Signed-off-by: Masahiro Yamada --- drivers/usb/dwc3/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 4aff1d8dbc4f..93b96e6abddb 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,12 @@ 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"); + ret = -ENODEV; + goto disable_clks; + } + platform_set_drvdata(pdev, dwc); dwc3_cache_hwparams(dwc); @@ -1524,7 +1525,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);