From patchwork Tue Jul 16 21:31:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734960 X-Patchwork-Delegate: kw@linux.com Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 443771448F1 for ; Tue, 16 Jul 2024 21:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165519; cv=none; b=JOqiAsAuSxGrql4ZCVbW9YqdKY8dp/DYfhlYgF3vY0W5L+Bmz9MV5QdZTN8VYC6ZSOOOwWjK8iWJ9nx7Cgjwh5OTQ8IXavrzO/VkgmtGM+cMry8zDfRvKgICfuC7VU5PmWZrGN1nZ9c2W0Ca4//zywnm4ltCnTa+c+P7BeczoIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165519; c=relaxed/simple; bh=+7ieHMcX+iIdqbT+JC+8LCENwbG4ctB/hzHZ4B22b9g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=k2Xuf1F19F/tYbhy7A+F/9wYT54k+Xyi2RJVbPzSmaKySlLLd44pup020e4z88bAnyYck21NZ/i3jJi5R0N5FprAh4olZ7qIcbQysSkLXoyy9cb3zMwLCNEehU5VkOMFUY1+QYaIrJaNa0YeKZmW7N3vdZP2iv5Ekp0I6F/V/zE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=EarFbL48; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="EarFbL48" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3d6301e7279so3884028b6e.3 for ; Tue, 16 Jul 2024 14:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165517; x=1721770317; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=sTW6B8Xrqx+YAC0m+RwDbcjfQ0NaMyuJPXv+58jb8vI=; b=EarFbL48DlVUS/Z3804pJBk+Man+AuTcmLI4RiZ04lTd2m+tV+7agtU0fPKak37sSM UGkZMpYqEfABDaw/0hwVRiF6SSFNAUo343kB61RgzJXXDef+BKj4A6WR372Shf1qPwDY syYZxLvlboRK7/qG5wuid8czlxLx3ywx5WTG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165517; x=1721770317; 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=sTW6B8Xrqx+YAC0m+RwDbcjfQ0NaMyuJPXv+58jb8vI=; b=m1NXpt2kB4fgZi5XnrU05dngd4q/0lgXSB3ulKS9HH7IQo/QsxIlg5gLJjebv8tVse 0+M3SaRhDGtVBG4C+CXZ2nWBFFXiHrdDS32DACAhsHM7RGfEPR0t53Zl7lSxUmK1d0kU /3nYcaAa/kqfATuPtUTaCGWUITk+DHx5YSdJImrmfCJmfOkeawzkQN91cNgmE3bK+3ne 7F52ZZ79HjvH7J1cZfxYusO8cWnyhTAD6Biy0XD++5Fcu9NssIJk+RUvEbqJw00i5Rgh 2CwgjuEoCI6vTWRBBkNJs7dzgDOo1AR/I7xwXqg5AUZw4JGKfxdjHPb9I5MeA7Ytl0g9 qbmg== X-Gm-Message-State: AOJu0YzfwthyNzd3OEZfZo3nMbgzDfa9J3zDvRQq8tYURXj1FjcQt4y8 gJDDX/ON5knzT7jVoOFvyy0AZVHV4iOKK9ZeUot4um5AGz8VttJd6eJLqKvvr0IUeJdldT3e7bG fHeOzDPeCRSB0/5Nb8ieUGnkIZ4NSWT2s9hSYvVUdY0p8SdbvD+1l1dBTgHMAwEMHOH5ShF4Abx nnQBPLd44h9HO9Lm3AiTEo+jxyl6btQb2v8y8VGbaE8DSb+w== X-Google-Smtp-Source: AGHT+IGyvYI3DfDEeXUXLaFD+3RzhfvFtKKmjP11NVlZDdaMFKZ7eqxSsGXCqSDwk+jvWaZ5X+QkeQ== X-Received: by 2002:a05:6870:c1d2:b0:25d:f8bb:c0b1 with SMTP id 586e51a60fabf-260bdd0b0b7mr2808568fac.2.1721165516721; Tue, 16 Jul 2024 14:31:56 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:56 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v4 05/12] PCI: brcmstb: Use swinit reset if available Date: Tue, 16 Jul 2024 17:31:20 -0400 Message-Id: <20240716213131.6036-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 92816d8d215a..4dc2ff7f3167 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; + struct reset_control *swinit; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -1633,12 +1634,27 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->bridge)) return PTR_ERR(pcie->bridge); + pcie->swinit = devm_reset_control_get_optional_exclusive(&pdev->dev, "swinit"); + if (IS_ERR(pcie->swinit)) + return PTR_ERR(pcie->swinit); + ret = clk_prepare_enable(pcie->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n"); return ret; } + ret = reset_control_assert(pcie->swinit); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not assert reset 'swinit'\n"); + goto clk_out; + } + ret = reset_control_deassert(pcie->swinit); + if (ret) { + dev_err(&pdev->dev, "could not de-assert reset 'swinit' after asserting\n"); + goto clk_out; + } + ret = reset_control_reset(pcie->rescal); if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n");