From patchwork Thu Aug 15 22:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13765264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6314C52D7F for ; Thu, 15 Aug 2024 23:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: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:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cQNUR4eo2grqHmWzloaYQ1piFbFOSyvLprH/Wsr2BKQ=; b=zGTa79lxvImk1lNiphcfI/VFb5 //OKE3WDobSFV5tjMggcQU0rGpYezCIfsEcG5DtFj58h+UKNq7a6PxCuy2H2irpbM7DcBSIYrDyqJ HxjNSWCO/AtVFV/rOfy8HGmqOzdAE93l2gDdkXbgiinP3TmznqiHdpr5V8pZRzzmo6F1CC4CCrk7K 1l/P5du90nmgh6O8KzGRs2D9R4xn+WAcT0Hu6Iuj9vKFpQJNH+FMfHHBoL27Jv37gKiVz9SuuGAYP scAwUOxrTV6bgguypG6DW826R1c8ZGTjWcIbRC3Utwb1lh4ot6LPZon+02vsw4sRE4mzM+EEEPtmA 9+G9gn8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejTs-0000000BFQR-3FDi; Thu, 15 Aug 2024 23:02:08 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPv-0000000BE5C-13Cq for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:04 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7c6b03c414fso530939a12.2 for ; Thu, 15 Aug 2024 15:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762682; x=1724367482; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=cQNUR4eo2grqHmWzloaYQ1piFbFOSyvLprH/Wsr2BKQ=; b=CntQe9ULKhe7c6K9EE1bn3Ap7Mw8ciZDaSS6ASmzaUeEjLsU7L+PxF9rJcBi/PVXt+ VqC0URvDoyfCGEKP9MUaLNbn/dtu+s9d00xPiCRIe5qx/wTsk6R+myB+G6VQ5f0VVvlX dTEwoAuPF9q1XU86p6LIEOaHRgXdKl9WIg+70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762682; x=1724367482; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cQNUR4eo2grqHmWzloaYQ1piFbFOSyvLprH/Wsr2BKQ=; b=iIsLe4i5iDBcQC9jB4UhX5JaQ9HLcXQlLPa6FSO7yA0klYS6rDH2GHvlb0A097BUmA 5IfAT0UsbqFJchLvDsJPFMsFGeP7E2IbbFrWiUFzSVUEv4o6ZfCs8bxh8bZbrkN69xRX xyTkgQsdq5qvp+dglP5CpT5ki8/0/ynOHYPc5KFWIu0YHij2vgRFHZDaLMSklgesMDHp g4noq+JcciTE/7ocHLQfwRfIcgBGxcZdHhneKO+vyZ91nb+LDxuDaGTILOwE9HiUX0MM 5kyISfNYp0eyQZoInySO/e3ctw3tWJVgHAxrnADbdbqvR8u2yY0FOH/91Ye3ifagBBFr 7weA== X-Forwarded-Encrypted: i=1; AJvYcCVsmdahF9xPSIUAW7HZgWNkaseXFZuRfpoxcinkK8VZEZ3U7BWQCfWc/8dDn7+cGUlBS2qH1jgActs4RDUUz88vTIKGsAqJOjJLqnjglB7v+xywv2s= X-Gm-Message-State: AOJu0YxDWDxi8qwoK45VHBLj6UUcK59SExyFrH4IQH04lzJE7bccqVqs rKMx+6yV+VNnT2am+04w1tIxuEmJAdFf63vTHgnvHO9YPFrDanMWcustL7z+8A== X-Google-Smtp-Source: AGHT+IHhhzzPytfNy1akq9lEmeO1LBTMtBLfCNyTCRSEt91lpkiU1VmEpGZ8WkgxTVaHZ49GNZvZ5w== X-Received: by 2002:a17:90b:1208:b0:2cb:5455:8018 with SMTP id 98e67ed59e1d1-2d3dfd8c73cmr1309322a91.23.1723762682128; Thu, 15 Aug 2024 15:58:02 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:01 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , 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 06/13] PCI: brcmstb: Use swinit reset if available Date: Thu, 15 Aug 2024 18:57:19 -0400 Message-Id: <20240815225731.40276-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155803_301125_FE49D613 X-CRM114-Status: GOOD ( 13.80 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 7712 SOC adds a software init reset device for the PCIe HW. If found in the DT node, use it. Signed-off-by: Jim Quinlan Reviewed-by: Manivannan Sadhasivam Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index af14debd81d0..aa21c4c7b7f7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -266,6 +266,7 @@ struct brcm_pcie { struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge_reset; + struct reset_control *swinit_reset; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -1633,12 +1634,35 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->bridge_reset)) return PTR_ERR(pcie->bridge_reset); + pcie->swinit_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "swinit"); + if (IS_ERR(pcie->swinit_reset)) + return PTR_ERR(pcie->swinit_reset); + ret = clk_prepare_enable(pcie->clk); if (ret) return dev_err_probe(&pdev->dev, ret, "could not enable clock\n"); pcie->bridge_sw_init_set(pcie, 0); + if (pcie->swinit_reset) { + ret = reset_control_assert(pcie->swinit_reset); + if (ret) { + clk_disable_unprepare(pcie->clk); + return dev_err_probe(&pdev->dev, ret, + "could not assert reset 'swinit'\n"); + } + + /* HW team recommends 1us for proper sync and propagation of reset */ + udelay(1); + + ret = reset_control_deassert(pcie->swinit_reset); + if (ret) { + clk_disable_unprepare(pcie->clk); + return dev_err_probe(&pdev->dev, ret, + "could not de-assert reset 'swinit'\n"); + } + } + ret = reset_control_reset(pcie->rescal); if (ret) { clk_disable_unprepare(pcie->clk);