From patchwork Tue Jul 16 21:31:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734963 X-Patchwork-Delegate: kw@linux.com Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.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 E06E71411E6 for ; Tue, 16 Jul 2024 21:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165530; cv=none; b=jsDt5eGRevWxa0fT9qutUUg/1KSwkduAknasP0jN/uZ5PWTNGq3b8n5pGAL/OlM/bqvoDkoKxYztiURDRpBruVBduvAkGZ7ul7OR9v4DsicuHVk9Tm14zUAtdByOBEPgOkHp9CsgQGHFtNnOlAp9O9pqGfKZ43OwIafprj9NSIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165530; c=relaxed/simple; bh=UCqbxCQdkx6VBRZexx0+Cn68RR4Zg17QY3Bc93dODxE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=F+DZ3xc+ZRoF0MTzcV4KNk7IcvdKzok7TlR8wP9siucmOI7sIsDdHbDw1Lj8qSkA4Kusui9FvpYRzsZEo/TTpjhVp5PHzAl8Fuoq/aZldY39eA0+LEqz4kf5pZtx8gHUQKwMv8idN3VcrVowdXTdj8tSn8X/M6np1ck6Db2KBz8= 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=HXWQxZgV; arc=none smtp.client-ip=209.85.215.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="HXWQxZgV" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-78c84837564so2409436a12.3 for ; Tue, 16 Jul 2024 14:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165528; x=1721770328; 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=+pyiUAb7p4STfXsJ/emlUrsA1NC1nfalZ2FHcpYfjAc=; b=HXWQxZgVoNjbu+0QA8n4ZX/M6sVogA87g1iPiNOPESRcc3XCGEN1ldvERb5/b/MVBe 0AOIgDw+7Jq12plew9UzQ76Jlz2N08NM2eqlTtg65pqIMdWEekbrdBnPaU1/Gg9btMLn D69U9fcJrEMNe8vGmkrvFaKgCaRX+7PoTXHlI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165528; x=1721770328; 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=+pyiUAb7p4STfXsJ/emlUrsA1NC1nfalZ2FHcpYfjAc=; b=pbA6dmtXnYElrfV3OaTWtyWCFSYKZZ78TpYaCID4fiT404OBi92HjN6bQ210O+LZ8v q61R2U/MqS3V5QRhgH/QC93dXduML9r3Bb5137lp9eQflo3Y9q6x8dYZPNWh3Bc8P6AB +K3d+PBgZEJw4CV5pxmwDFsNQnr8Q3YR5d/IkONXhe7hb/HdNM8j5/bJR79ufyG808kI aAE+mPK0qF1WgFLCf+T+G/cbfXH+3VUrFFH+jkIHlgUnkrEqWyl2QKzDrHUuvF17ryd5 CnkuoerQ5+BvpYtXkYruhAANUo84PoCkM/q9PXBO8tAmtVD9u7rOzJ+A5cXZ4sAGUQJM 4oog== X-Gm-Message-State: AOJu0YxUcElkj3RroPkjS5hz5kHmaOQldg75lZQlISnjhVrmVlFkDOWZ bP6tl1jAXkMIJ2mkfFTU3qpIj7u9rtVYKMhGsMpMS4KX52+jOLNtv3KzdwMOO1CWMJUTVuTEM1U nWGTVsCW7Icyw1xPbExRIZOPad8EYgY+of9/ggUa0I7bpc5kiBSwrMrM6FkQNIj7xIaScsygmyL YI7Kw6tYf5q9NSBeck5GVWxvXbR8FHdpVoaOQEfUxhY/Pq2lwI X-Google-Smtp-Source: AGHT+IHMq7sIS5fikUr98UkxmIBVwJilGApJCxfCRLVg1iE2jvb1wLcaHJgx2XWdM6RSZ2NA/mSTgg== X-Received: by 2002:a05:6a21:9985:b0:1be:c947:f17a with SMTP id adf61e73a8af0-1c3f122bb89mr4312395637.24.1721165527534; Tue, 16 Jul 2024 14:32:07 -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.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:06 -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 , 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 08/12] PCI: brcmstb: Don't conflate the reset rescal with phy ctrl Date: Tue, 16 Jul 2024 17:31:23 -0400 Message-Id: <20240716213131.6036-9-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: We've been assuming that if an SOC has a "rescal" reset controller that we should automatically invoke brcm_phy_cntl(...). This will not be true in future SOCs, so we create a bool "has_phy" and adjust the cfg_data appropriately (we need to give 7216 its own cfg_data structure instead of sharing one). Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index dfb404748ad8..8ab5a8ca05b4 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -222,6 +222,7 @@ enum pcie_type { struct pcie_cfg_data { const int *offsets; const enum pcie_type type; + const bool has_phy; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -272,6 +273,7 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; + bool has_phy; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -1311,12 +1313,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start) static inline int brcm_phy_start(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 1) : 0; } static inline int brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } static void brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1559,12 +1561,20 @@ static const struct pcie_cfg_data bcm2711_cfg = { .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, }; +static const struct pcie_cfg_data bcm7216_cfg = { + .offsets = pcie_offset_bcm7278, + .type = BCM7278, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .has_phy = true, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, - { .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, + { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg }, { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, @@ -1612,6 +1622,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->type = data->type; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; + pcie->has_phy = data->has_phy; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base))