From patchwork Thu Dec 10 18:04:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1414414 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ouA21ufz; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CsMKb6w2Fz9sWQ for ; Fri, 11 Dec 2020 05:05:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392560AbgLJSFa (ORCPT ); Thu, 10 Dec 2020 13:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392606AbgLJSFV (ORCPT ); Thu, 10 Dec 2020 13:05:21 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C412C0613D6; Thu, 10 Dec 2020 10:04:41 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id a12so9542990lfl.6; Thu, 10 Dec 2020 10:04:40 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=zHZq5IcsODsBA+xd+pp9DCxwMsfVs5qrOgu8wwXvBvg=; b=ouA21ufznCroJw5M10QYHgbCCH9Q2Bm4UNuYdY1IAYv3enbq3Q4cMbCZ9vxAkYeDNU 542M5G5XKU1e+qtcKg2nJgOCkvCQ4gNCPOOYKun8CSVQKmIKF59bmlU0j3STg5qENyWo YzGPxZXnCfj/4+D818gaTwYaX0Bn0eFiDItdDAWp3cNPkE3k7XzH06sjNxwKTtbrCAon 9lc7cdC/689tbOmRIY5dbegKtJnehR6kVLRxiZJ+/DhabiOExlbGFxd02r03e0mNaNLM qu9Mi8x7J17hvX1n8xzkCRGmPdsiA54WwdX0mg0UgaFI9WGtB8NxbqtS3ak6hBtdqnZj A7jQ== 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:mime-version:content-transfer-encoding; bh=zHZq5IcsODsBA+xd+pp9DCxwMsfVs5qrOgu8wwXvBvg=; b=m+aS1aDewSE3Xyhf4Nulo6pri6ova2pJlJUAj6ttNTtuKFOHDTezaIOHWMEGHbJ//T xJBd8rDNFVtrmVK0X/JjCKjNAmoKvrjb3WtK5cG8CoKMCkEIDsod0i7ALmGQziVxStbm CUq+ZjBYFbetaZ1BNLHRt2KG0tUhQFJgdhlKLelr578s9Ufjn3V6av74Y5pPoacNd/yg uS3+GNjD34abOPZQ0+xJucyf/VqRRyYoMlLei1Ix0pnBh+c1fWkfxv/WQaZV9yk3lfBr +VLGeskrfSAyFQqyTKcoeHQ8xV5JqUp/gJQpL1gc+++5HXy5RnqTGQfc6wQRk/w+Y576 AoYA== X-Gm-Message-State: AOAM531mghtpGnNVcMMXGHsJrE0zIrPgOs5qjNcH9eJ/yZmIsiXQtg7J jcYTObzby7sN1SHCH2ymw7986fDPIe4= X-Google-Smtp-Source: ABdhPJwGsjmtg3DUvco4+4Cbw+I9+b9OHmtYv69jKIerggLQX3sHF25eD39AKfOrb+JK720caEQd1Q== X-Received: by 2002:a19:c001:: with SMTP id q1mr2464524lff.55.1607623479567; Thu, 10 Dec 2020 10:04:39 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id c136sm601855lfg.306.2020.12.10.10.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 10:04:38 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Lorenzo Pieralisi , Rob Herring Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, Florian Fainelli , Nicolas Saenz Julienne , Philipp Zabel , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH v3 1/2] dt-bindings: PCI: brcmstb: add BCM4908 binding Date: Thu, 10 Dec 2020 19:04:20 +0100 Message-Id: <20201210180421.7230-2-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201210180421.7230-1-zajec5@gmail.com> References: <20201210180421.7230-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Rafał Miłecki BCM4908 is a SoC family with PCIe controller sharing design with the one for STB. BCM4908 has different power management and memory controller so few tweaks are required. PERST# signal on BCM4908 is handled by an external MISC block so it needs specifying a reset phandle. Signed-off-by: Rafał Miłecki Acked-by: Florian Fainelli Reviewed-by: Rob Herring --- V3: Drop "reset-names" from the generic "properties" - it's now defined as "compatible" specific property Drop "$ref" from the "resets" - thanks Rob. --- .../bindings/pci/brcm,stb-pcie.yaml | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 807694b4f41f..f90557f6deb8 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -14,6 +14,7 @@ properties: items: - enum: - brcm,bcm2711-pcie # The Raspberry Pi 4 + - brcm,bcm4908-pcie - brcm,bcm7211-pcie # Broadcom STB version of RPi4 - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7216-pcie # Broadcom 7216 Arm @@ -63,15 +64,6 @@ properties: aspm-no-l0s: true - resets: - description: for "brcm,bcm7216-pcie", must be a valid reset - phandle pointing to the RESCAL reset controller provider node. - $ref: "/schemas/types.yaml#/definitions/phandle" - - reset-names: - items: - - const: rescal - brcm,scb-sizes: description: u64 giving the 64bit PCIe memory viewport size of a memory controller. There may be up to @@ -98,12 +90,39 @@ required: allOf: - $ref: /schemas/pci/pci-bus.yaml# + - if: + properties: + compatible: + contains: + const: brcm,bcm4908-pcie + then: + properties: + resets: + items: + - description: reset controller handling the PERST# signal + + reset-names: + items: + - const: perst + + required: + - resets + - reset-names - if: properties: compatible: contains: const: brcm,bcm7216-pcie then: + properties: + resets: + items: + - description: phandle pointing to the RESCAL reset controller + + reset-names: + items: + - const: rescal + required: - resets - reset-names From patchwork Thu Dec 10 18:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1414411 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=neIjQRqL; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CsMKY40Jpz9sWS for ; Fri, 11 Dec 2020 05:05:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404046AbgLJSFa (ORCPT ); Thu, 10 Dec 2020 13:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391429AbgLJSFY (ORCPT ); Thu, 10 Dec 2020 13:05:24 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36778C061793; Thu, 10 Dec 2020 10:04:44 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id b10so5398717ljp.6; Thu, 10 Dec 2020 10:04:44 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=C2pscJBqzkM2zDI7JC2pNLpw87RIapi+iZ8V2MUxssg=; b=neIjQRqLRs8+RHrvKWzprlomtojZHDMDVa3OnL58IjT/RQP66axILI0xv1SLZPembe b6w6ji9JnkDciiztRW/o0rRDJIh+LlBPjPrgt89psKH0zuncU8zovy4f6Sp0wudHsopD AjedyzYbOUGZG+5CLICQVdUq/MNFeFNqqC0DyZma1tjkAKRpWSXvStnp7+SQ7/oRdiXg j0HWueI3Ns9vUFPmBfruzSY9PSYemn+zZ81Hg+LMvN+hjMtCB1lxSMTKFC92QoXxCvqN vt0pdcUHZMzKqNzEX05wKWMys3jA4eRpXnQQ0/QdVQdKukv1fAifhTBfZtg2KlTSBZMP ELdQ== 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:mime-version:content-transfer-encoding; bh=C2pscJBqzkM2zDI7JC2pNLpw87RIapi+iZ8V2MUxssg=; b=dfhRlKRTTsVpIq8nlsBwImNVMwRdpyOwjFy3PXN5Yqbl0fjhATDWQGLc7X+LWZH/hO 2fFJqJ9zyGKmST9NaJla2PFHZp8eJRSQ3cHGdSfKki5N9Vs421KEk9hB4hDaOtTCFzTm jk8tt1k009CWDxHdeiw+B9XGY+P0j3jIWb9nfY7dUcdqeo/CmbP9sVIHoRdePzEJzrmZ vnnbyHjW/TI9fouACpRYf1s6MALUX+qJqxswm+pOOe94D/Zoh6qZ2sC2VWBRB+/ZHT06 B3GRglqSt0GSw3UqpNK7x++ScHFfDI8ALGth93In6BqVqb444Jp+d/lPsUSAL0/oQnoP 9Yww== X-Gm-Message-State: AOAM531hVGa1r8FBKpSPAbJ6KAj9388C3UTi+KePwOk8bv7hDIdAkkuL WQp7f8SRCBYM/RH9jCVelug= X-Google-Smtp-Source: ABdhPJw1BV90OYZi0tKInUs0nesy6tFd9q+9u63aIEriW/zyil4vnntrEVS+x9RYY4np1Vt9h9dKjw== X-Received: by 2002:a2e:8346:: with SMTP id l6mr3517312ljh.132.1607623482765; Thu, 10 Dec 2020 10:04:42 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id c136sm601855lfg.306.2020.12.10.10.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 10:04:42 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Lorenzo Pieralisi , Rob Herring Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, Florian Fainelli , Nicolas Saenz Julienne , Philipp Zabel , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH v3 2/2] PCI: brcmstb: support BCM4908 with external PERST# signal controller Date: Thu, 10 Dec 2020 19:04:21 +0100 Message-Id: <20201210180421.7230-3-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201210180421.7230-1-zajec5@gmail.com> References: <20201210180421.7230-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Rafał Miłecki BCM4908 uses external MISC block for controlling PERST# signal. Use it as a reset controller. Signed-off-by: Rafał Miłecki Acked-by: Florian Fainelli --- V2: Reorder BCM4908 in the enum pcie_type Use devm_reset_control_get_optional_exclusive() Don't move hw_rev read up in the code --- drivers/pci/controller/Kconfig | 2 +- drivers/pci/controller/pcie-brcmstb.c | 32 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 64e2f5e379aa..d44c70bb88f6 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -273,7 +273,7 @@ config VMD config PCIE_BRCMSTB tristate "Broadcom Brcmstb PCIe host controller" - depends on ARCH_BRCMSTB || ARCH_BCM2835 || COMPILE_TEST + depends on ARCH_BRCMSTB || ARCH_BCM2835 || ARCH_BCM4908 || COMPILE_TEST depends on OF depends on PCI_MSI_IRQ_DOMAIN default ARCH_BRCMSTB diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 9c3d2982248d..98536cf3af58 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -96,6 +96,7 @@ #define PCIE_MISC_REVISION 0x406c #define BRCM_PCIE_HW_REV_33 0x0303 +#define BRCM_PCIE_HW_REV_3_20 0x0320 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT 0x4070 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT_MASK 0xfff00000 @@ -190,6 +191,7 @@ struct brcm_pcie; static inline void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val); +static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val); @@ -206,6 +208,7 @@ enum { enum pcie_type { GENERIC, + BCM4908, BCM7278, BCM2711, }; @@ -230,6 +233,13 @@ static const struct pcie_cfg_data generic_cfg = { .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, }; +static const struct pcie_cfg_data bcm4908_cfg = { + .offsets = pcie_offsets, + .type = BCM4908, + .perst_set = brcm_pcie_perst_set_4908, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, +}; + static const int pcie_offset_bcm7278[] = { [RGR1_SW_INIT_1] = 0xc010, [EXT_CFG_INDEX] = 0x9000, @@ -282,6 +292,7 @@ struct brcm_pcie { const int *reg_offsets; enum pcie_type type; struct reset_control *rescal; + struct reset_control *perst_reset; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -747,6 +758,17 @@ static inline void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } +static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) +{ + if (WARN_ONCE(!pcie->perst_reset, "missing PERST# reset controller\n")) + return; + + if (val) + reset_control_assert(pcie->perst_reset); + else + reset_control_deassert(pcie->perst_reset); +} + static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) { u32 tmp; @@ -1206,6 +1228,7 @@ static int brcm_pcie_remove(struct platform_device *pdev) 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 }, @@ -1262,6 +1285,11 @@ static int brcm_pcie_probe(struct platform_device *pdev) clk_disable_unprepare(pcie->clk); return PTR_ERR(pcie->rescal); } + pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst"); + if (IS_ERR(pcie->perst_reset)) { + clk_disable_unprepare(pcie->clk); + return PTR_ERR(pcie->perst_reset); + } ret = reset_control_deassert(pcie->rescal); if (ret) @@ -1279,6 +1307,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto fail; pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION); + if (pcie->type == BCM4908 && pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) { + dev_err(pcie->dev, "hardware revision with unsupported PERST# setup\n"); + goto fail; + } msi_np = of_parse_phandle(pcie->np, "msi-parent", 0); if (pci_msi_enabled() && msi_np == pcie->np) {