Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1738346ybl; Wed, 14 Aug 2019 23:58:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6viY/Uf0gJVJCi3lrHnQovePQIIGY4lVzA/ZBxxMXGPOD0k4cgxskBGjClMUc+5lqT8SV X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr2932892plb.76.1565852283476; Wed, 14 Aug 2019 23:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565852283; cv=none; d=google.com; s=arc-20160816; b=VXzprXws4vhGLpexd1eAwrJjf7iXkGOQeou11c49gv19mUkLCzNISMyPkqpZlIoDVX L6eeyV1M8+dMF9TuCZn6e/R886mfQT0cbb3Sd8faJXiMBFry9vHS5IZQuy8P9WPDXAdL 1G4bScJb5tpKN7qL9fQQt6G6s8mSDVJL2IYvbkP6vq4BKHTi0GDKWJpvkEqmaP/A0xbf j2vRXx6hnN/yvEl5qtk3gK0sz7gCoDQhFjs/sew8XkQ7hW65k0fMB4O3CFyYY75ryFh/ qyynQdNF557i1RpM41RDOoIDkIHB1qZ/BF2A1St0UeRA/in4/kGrFHYiEytZoKrhlQI5 leVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=Y2Hw3ZNYa24bEQHSH09xptvgba52g5BDzjbeYnBSm0g=; b=CLMwSNJ5EVi3TgZomJ+4Za2g68GfXqpgmm7pABTytaSvi0E/wKQSSIf1pj1/gl0ICk CBdoZtrNY+VAEWEIml5e0pPpEaHOnvU4wKsRBo2abAytKgtqDJsdLBeY7T4m/PSwIeA9 wq7PnKLyMshFID/0OLbseWWylgBUZOpC+UNPyOzr/iy12FMbsR/v7L5Ii07y/2aAVoba ZeABmblFR6YUyWtlou/cYuRj7og4Dt6fl2g5k1KExDyi2YfkFq2x2m4Z0tZ8eD2ANKLi Iu2bkrO40hKLgLPoUZdpkEoffBJ/SbfGrfXVyK8BbbDHSd6lJQcNNmFcgDco6gxdyogV n5iw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si1295272pgj.239.2019.08.14.23.57.48; Wed, 14 Aug 2019 23:58:03 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729971AbfHOGGH (ORCPT + 99 others); Thu, 15 Aug 2019 02:06:07 -0400 Received: from mga18.intel.com ([134.134.136.126]:40175 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725977AbfHOGGH (ORCPT ); Thu, 15 Aug 2019 02:06:07 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2019 23:06:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,388,1559545200"; d="scan'208";a="181785528" Received: from pipin.fi.intel.com (HELO pipin) ([10.237.72.175]) by orsmga006.jf.intel.com with ESMTP; 14 Aug 2019 23:06:03 -0700 From: Felipe Balbi To: Vicente Bergas , Robin Murphy Cc: Heiko Stuebner , Will Deacon , Marc Zyngier , Catalin Marinas , Matthias Brugger , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: kexec on rk3399 In-Reply-To: <59055782-7fc2-4b16-af8b-a56fb845a43f@gmail.com> References: <0408cb6c-1b16-eacb-d47e-17f4ff89e2b8@arm.com> <59055782-7fc2-4b16-af8b-a56fb845a43f@gmail.com> Date: Thu, 15 Aug 2019 09:06:02 +0300 Message-ID: <87pnl7t12t.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Vicente Bergas writes: > On Wednesday, August 14, 2019 3:12:26 PM CEST, Robin Murphy wrote: >> On 14/08/2019 13:53, Vicente Bergas wrote: >>> On Monday, July 22, 2019 4:31:27 PM CEST, Vicente Bergas wrote: ... >> >> This particular change looks like it's implicitly specific to >> RK3399, which wouldn't be ideal. Presumably if the core dwc3 >> driver implemented shutdown correctly (echoing parts of >> dwc3_remove(), I guess) then the glue layers shouldn't need >> anything special anyway. >> >> Robin. > > I just checked simple->resets from dwc3-of-simple.c and it is an array > with multiple resets whereas dwc->reset from core.c is NULL. > So the reset seems specific to the glue layers. > Is there another way than resetting the thing that is > generic enough to go to core.c and allows kexec? This is a really odd 'failure'. We do full soft reset during driver initialization on dwc3. We shouldn't need to assert reset on shutdown, really. I think the problem is here: if (simple->pulse_resets) { ret = reset_control_reset(simple->resets); if (ret) goto err_resetc_put; } else { ret = reset_control_deassert(simple->resets); if (ret) goto err_resetc_put; } Note that if pulse_resets is set, we will run a reset. But if pulse_resets is false and need_reset is true, we deassert the reset. I think below patch is enough: diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c index bdac3e7d7b18..9a2f3e09aa2e 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c @@ -72,7 +72,15 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) ret = reset_control_reset(simple->resets); if (ret) goto err_resetc_put; - } else { + } + + if (simple->need_reset) { + ret = reset_control_assert(simple->resets); + if (ret) + goto err_resetc_put; + + usleep_range(1000, 2000); + ret = reset_control_deassert(simple->resets); if (ret) goto err_resetc_put; @@ -121,9 +129,6 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) clk_bulk_put_all(simple->num_clocks, simple->clks); simple->num_clocks = 0; - if (!simple->pulse_resets) - reset_control_assert(simple->resets); - reset_control_put(simple->resets); pm_runtime_disable(dev); Can you test? -- balbi