Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3069179pxj; Mon, 17 May 2021 17:00:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxczRRq44B+1JZLTMZTXRsNRtn8sPfXcnlWoPcSh0N3VSidWbdd0ljei0QjSGV6LCdR6wHD X-Received: by 2002:a17:906:2dd4:: with SMTP id h20mr2737316eji.131.1621296001588; Mon, 17 May 2021 17:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621296001; cv=none; d=google.com; s=arc-20160816; b=YcBzURcXzrMXZ0ipkcCHpD1EN7oEzwPTeJsxxUp8Yf4gdqLk6s4KKpA11+wmwvijNY /+JzbhLiwqt6wPGEljfvlZ7zjXkvZgkOVy8nhJDga0mmj8BRcDZrrCHLXK5eWNlXO5Hq DtECZXEQj8iutw+Ib8DBbuW4Jn4jvmU6nR+NWcCWT16tCXEE2zEouf/6dA8nbzHP4iiA /1n5mJkeHrGbllNz/Y5EfsPn436LVU9A9UlFQ9hUJmO1nKhXFwi0K+bK76Q/QLRJ64bp uS+kB9lEnisUh/arNYJQ1P3siiKqEpeutNEyjJtDoFntSWijJs46DuTFFg0uErYx+SPe eQEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YTDAFcIwPx/lae1i059pSwXKqxUmgrT+g9ON4pEbsko=; b=qQdl8vvSZeQVNDN15oht26WmBZJcmlDaD3o7vOptMvG3PU28mkOoE2/scMJLvdNTKo tuxJxZF8WYTzelnThx1DaM4czBFXHWDgVbR/E/r1dCRCs3dOOQGLrsvQMgXG3EMpc1+p uu6q1/XCPe/sWE3o2ZFBoyhUZCDVVNuQy1iNLQtPQBYEOvvttcXZYfafrqTqg4a94U89 7hIv8PxkLSWWjbQBfwJtLi5B+PbUvYEstzVCwaKbaBiooP0Rj7/lKC69Q0YVaDCgjwbL XL6Qj75iZ6j7IE6Q/d9u0lBNoVh/WRqsGEhoCzgx4cwt1gFSmDL7FOTh7BfZQtY4hL4J ZQ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G9FQ/E+o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si4304924ejq.623.2021.05.17.16.59.38; Mon, 17 May 2021 17:00:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G9FQ/E+o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235871AbhEQOZk (ORCPT + 99 others); Mon, 17 May 2021 10:25:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239212AbhEQOWX (ORCPT ); Mon, 17 May 2021 10:22:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7125161285; Mon, 17 May 2021 14:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260714; bh=PEOqu0ZRJMUuDv4a3XyK6Or/hZs8JcJHsqf8AyVV0Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G9FQ/E+o+ZQZMiUwRbbOagMhU3RXd1fv2yktkCQyOTsb1F8tOVnDb8yKyWO1cjyIn T8rF9jQkgGvENL6Qjb+mSyhf6hXN2VT4hmDjs8GLtWnNUtqVGbFv6z1Qf8QxTJ/dK/ tRttw6Gd04JX2WJ8ROe0MZG8r9ininTbWcEpEkHQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Quinlan , Bjorn Helgaas , Florian Fainelli , Sasha Levin Subject: [PATCH 5.12 206/363] PCI: brcmstb: Use reset/rearm instead of deassert/assert Date: Mon, 17 May 2021 16:01:12 +0200 Message-Id: <20210517140309.546556088@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jim Quinlan [ Upstream commit bb610757fcd74558ad94fe19993fd4470208dd02 ] The Broadcom STB PCIe RC uses a reset control "rescal" for certain chips. The "rescal" implements a "pulse reset" so using assert/deassert is wrong for this device. Instead, we use reset/rearm. We need to use rearm so that we can reset it after a suspend/resume cycle; w/o using "rearm", the "rescal" device will only ever fire once. Of course for suspend/resume to work we also need to put the reset/rearm calls in the suspend and resume routines. Fixes: 740d6c3708a9 ("PCI: brcmstb: Add control of rescal reset") Link: https://lore.kernel.org/r/20210430152156.21162-4-jim2101024@gmail.com Signed-off-by: Jim Quinlan Signed-off-by: Bjorn Helgaas Acked-by: Florian Fainelli Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-brcmstb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 69c999222cc8..08bc788d9422 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1148,6 +1148,7 @@ static int brcm_pcie_suspend(struct device *dev) brcm_pcie_turn_off(pcie); ret = brcm_phy_stop(pcie); + reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); return ret; @@ -1163,9 +1164,13 @@ static int brcm_pcie_resume(struct device *dev) base = pcie->base; clk_prepare_enable(pcie->clk); + ret = reset_control_reset(pcie->rescal); + if (ret) + goto err_disable_clk; + ret = brcm_phy_start(pcie); if (ret) - goto err; + goto err_reset; /* Take bridge out of reset so we can access the SERDES reg */ pcie->bridge_sw_init_set(pcie, 0); @@ -1180,14 +1185,16 @@ static int brcm_pcie_resume(struct device *dev) ret = brcm_pcie_setup(pcie); if (ret) - goto err; + goto err_reset; if (pcie->msi) brcm_msi_set_regs(pcie->msi); return 0; -err: +err_reset: + reset_control_rearm(pcie->rescal); +err_disable_clk: clk_disable_unprepare(pcie->clk); return ret; } @@ -1197,7 +1204,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) brcm_msi_remove(pcie); brcm_pcie_turn_off(pcie); brcm_phy_stop(pcie); - reset_control_assert(pcie->rescal); + reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); } @@ -1278,13 +1285,13 @@ static int brcm_pcie_probe(struct platform_device *pdev) return PTR_ERR(pcie->perst_reset); } - ret = reset_control_deassert(pcie->rescal); + ret = reset_control_reset(pcie->rescal); if (ret) dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); ret = brcm_phy_start(pcie); if (ret) { - reset_control_assert(pcie->rescal); + reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); return ret; } -- 2.30.2