From patchwork Fri Apr 30 15:21:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12233669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5231C433ED for ; Fri, 30 Apr 2021 15:24:14 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20DD460FE4 for ; Fri, 30 Apr 2021 15:24:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20DD460FE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J8z3/TOAD0t3M39fh0fUHeghqX25QjzJEzaB180jzPA=; b=aLH2AcTH3ch6BkSqWJ1TaSEfwF pwLIkzZfNRY3CF2Q6tPqkZQ+esO6+kACu37WJMzmV8D8hOUORQ40JE4YEOUHjee7qI0AAhsgssfPd 896Vfg6zUoaB+JO/aBLRg0GN51YompX3DCkH3wjejpEVI0rGm/8b9KqudiRkYuwDMDwbFoIag2pPC peHTqxPOVzih33gvh3Hidj09/yogMflVO3XW4xFSTW0df0gbC5ZDGI+d5/Xcl/K3Yh5sTASlPLlOX 2UGF8r1V/3pFDstGWKyUXbWWB7BdSZcYVSWm+Ao3Q975QtPg+UYcbCF5U/ZHFgXcvBV+2hGpGMEM3 Mmbv+Tfw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcUyJ-0084yy-LH; Fri, 30 Apr 2021 15:22:27 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcUy8-0084yM-5i; Fri, 30 Apr 2021 15:22:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=S1RYFyHGpmuSBGVIKtF2cRB9Rxzfh1Zoo7ktedPdj8k=; b=vT9takge1dwOHbzcHnA/C9kJGi mL1Om8wiJyNLpcenKGE95wt/GOycylysL0f3eXiYvnZ8+fTk5Wlz+pTAXgA9Yw7aCijfNoQEKWA6K 6WHwUMQ+u0T2B9RPfWNWOkvGH8DN+rKX1uAECVjQXR55X/zZ3ioILocaMIxqf58yEDmxJmurn8W5P lOBSYHMxHoa7bVBcOei6sBd4WOtxOowTXe9PLPntOMuw9FhtmQgVTeIdmpM+ai1Thg00E57d4APUG nqYEPMchc6NzSZDSsG2jYOjwkJwIcrzKniBnldO4LgajeU9ZUgplRUhV8w8lPIvQDZb0OVSO0m0Bh 1ApRpHAQ==; Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcUy5-001Tna-JM; Fri, 30 Apr 2021 15:22:14 +0000 Received: by mail-pg1-x52b.google.com with SMTP id z16so8713884pga.1; Fri, 30 Apr 2021 08:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S1RYFyHGpmuSBGVIKtF2cRB9Rxzfh1Zoo7ktedPdj8k=; b=ijh00j9ZNOdICIFEeE+Blmg5hYFoxcaZjUS7BVCRANVXzftCwMyg1l2wjuJn6FSKxN mtKQFNFrLUIQkI+79cfkoryy6c+jjXYziq7uN31OnEZELbSRLhG7gvulAeAJH2uVz9Bs t20A6nUKrPZfc2IoNcFc9mG+/Zi+bL1FlEetVfY63TZjlfHkYWKToijLxuzK9WC4K6kV SEC3QENjgaG+mqDhc2d/+AKaShFGrOgsyvBB5s7+3FlXcPItQnUouaEt6hsAUYPBen8F UMTGrtzk1kq3MRb+KfWYkdWPq3whQSwyqbZfjXUjR4BzHW9FujJ0+QNGlqoICJKFHIga hUOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S1RYFyHGpmuSBGVIKtF2cRB9Rxzfh1Zoo7ktedPdj8k=; b=fD0y4fRMzPVaZHkiY9EnZtzDN0FACNVuj95igs/aj9DAzD1dok8qiABkOhwLoOi384 IirZ5HpTDR+Vt9cv+9Cay27fSlhZQ//ht+u2sqOgaRl/kDluI2Zk4PE2atncRQuOXTm+ 3YglOlSV40DUqFIjZxEiEwWnN3fNc6itfuB08yvOH+PVuWtJjuSdIT7reAeA750rlkfX nSYjH4e/DBKePVmK9VT55ar3SxmYt6vPvAWWGqOircFUUMSgrIit2WP7P9Fe543x64BH RRDObP93TzGnpLNT44ErpZHp6vOeXI3wc3Jgpoki1VzonVJDfRlLVRHNbEnZ1CmB9OS9 7UuQ== X-Gm-Message-State: AOAM533eh0d0pWOXv94jC2f+oRdwQHiS0x8ZkS0lsuK4r/IYkkJDdl5g 65P3dflAf3pd82BagtCCKTM= X-Google-Smtp-Source: ABdhPJx21aO2czAx4J1Wd952RkDiotpIsu+3OxvKIr7dWfLKb4o/OwejjnrGvx2h0udaMDO/3pHcBw== X-Received: by 2002:a63:4442:: with SMTP id t2mr5220942pgk.232.1619796132567; Fri, 30 Apr 2021 08:22:12 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id q128sm2543034pfb.67.2021.04.30.08.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 08:22:12 -0700 (PDT) From: Jim Quinlan To: Bjorn Helgaas , Amjad Ouled-Ameur , Philipp Zabel , linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com, jim2101024@gmail.com Cc: Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Florian Fainelli , Jim Quinlan , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v6 3/3] PCI: brcmstb: Use reset/rearm instead of deassert/assert Date: Fri, 30 Apr 2021 11:21:56 -0400 Message-Id: <20210430152156.21162-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210430152156.21162-1-jim2101024@gmail.com> References: <20210430152156.21162-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210430_082213_658198_67DE803D X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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") Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- 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 e330e6811f0b..3b35d629035e 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; }