* [PATCH 0/3] PCI: brcmstb: Include cable-modem SoCs
@ 2025-06-09 22:17 Jim Quinlan
2025-06-09 22:17 ` [PATCH 1/3] dt bindings: " Jim Quinlan
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Jim Quinlan @ 2025-06-09 22:17 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
At Broadcom, the Cable Modem group and the Settop Box group use the same
PCIe RC driver for multiple chips. This series adds the CM SoCs to the
compatibility list as well as some CM-specific code.
Jim Quinlan (3):
dt bindings: PCI: brcmstb: Include cable-modem SoCs
PCI: brcmstb: Refactor indication of SSC status
PCI: brcmstb: Enable Broadcom Cable Modem SoCs
.../bindings/pci/brcm,stb-pcie.yaml | 4 +
drivers/pci/controller/pcie-brcmstb.c | 193 ++++++++++++++----
2 files changed, 159 insertions(+), 38 deletions(-)
base-commit: cfc4ca8986bb1f6182da6cd7bb57f228590b4643
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] dt bindings: PCI: brcmstb: Include cable-modem SoCs
2025-06-09 22:17 [PATCH 0/3] PCI: brcmstb: Include cable-modem SoCs Jim Quinlan
@ 2025-06-09 22:17 ` Jim Quinlan
2025-06-10 15:23 ` Conor Dooley
2025-06-12 20:33 ` Florian Fainelli
2025-06-09 22:17 ` [PATCH 2/3] PCI: brcmstb: Refactor indication of SSC status Jim Quinlan
2025-06-09 22:17 ` [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs Jim Quinlan
2 siblings, 2 replies; 10+ messages in thread
From: Jim Quinlan @ 2025-06-09 22:17 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
Add four Broadcom Cable Modem SoCs to the compatibility list.
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
---
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
index c4f9674e8695..5a7b0ed9464d 100644
--- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
@@ -15,6 +15,9 @@ properties:
- enum:
- brcm,bcm2711-pcie # The Raspberry Pi 4
- brcm,bcm2712-pcie # Raspberry Pi 5
+ - brcm,bcm3162-pcie # Broadcom DOCSIS 4.0 CMTS w/ 64b ARM
+ - brcm,bcm3390-pcie # Broadcom DOCSIS 3.1 CM w/ 32b ARM
+ - brcm,bcm3392-pcie # Broadcom DOCSIS 3.1 CM w/ 64b ARM
- brcm,bcm4908-pcie
- brcm,bcm7211-pcie # Broadcom STB version of RPi4
- brcm,bcm7216-pcie # Broadcom 7216 Arm
@@ -23,6 +26,7 @@ properties:
- brcm,bcm7435-pcie # Broadcom 7435 MIPs
- brcm,bcm7445-pcie # Broadcom 7445 Arm
- brcm,bcm7712-pcie # Broadcom STB sibling of Rpi 5
+ - brcm,bcm33940-pcie # Broadcom DOCSIS 4.0 CM w/ 64b ARM
reg:
maxItems: 1
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] PCI: brcmstb: Refactor indication of SSC status
2025-06-09 22:17 [PATCH 0/3] PCI: brcmstb: Include cable-modem SoCs Jim Quinlan
2025-06-09 22:17 ` [PATCH 1/3] dt bindings: " Jim Quinlan
@ 2025-06-09 22:17 ` Jim Quinlan
2025-06-12 20:33 ` Florian Fainelli
2025-06-09 22:17 ` [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs Jim Quinlan
2 siblings, 1 reply; 10+ messages in thread
From: Jim Quinlan @ 2025-06-09 22:17 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
Instead of using a bool to track the Spread Spectrum Clocking (SSC), just
use a string constant since that will be the end result anyway. The
motivation for this change is underscored by a subsequent commit that adds
Cable Modem SoCs to the driver.
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
---
drivers/pci/controller/pcie-brcmstb.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 92887b394eb4..db7872cda960 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1320,8 +1320,8 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
{
struct device *dev = pcie->dev;
void __iomem *base = pcie->base;
+ const char *ssc_str = "(!SSC)";
u16 nlw, cls, lnksta;
- bool ssc_good = false;
int ret, i;
/* Limit the generation if specified */
@@ -1357,7 +1357,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
if (pcie->ssc) {
ret = brcm_pcie_set_ssc(pcie);
if (ret == 0)
- ssc_good = true;
+ ssc_str = "(SSC)";
else
dev_err(dev, "failed attempt to enter ssc mode\n");
}
@@ -1366,8 +1366,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
cls = FIELD_GET(PCI_EXP_LNKSTA_CLS, lnksta);
nlw = FIELD_GET(PCI_EXP_LNKSTA_NLW, lnksta);
dev_info(dev, "link up, %s x%u %s\n",
- pci_speed_string(pcie_link_speed[cls]), nlw,
- ssc_good ? "(SSC)" : "(!SSC)");
+ pci_speed_string(pcie_link_speed[cls]), nlw, ssc_str);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs
2025-06-09 22:17 [PATCH 0/3] PCI: brcmstb: Include cable-modem SoCs Jim Quinlan
2025-06-09 22:17 ` [PATCH 1/3] dt bindings: " Jim Quinlan
2025-06-09 22:17 ` [PATCH 2/3] PCI: brcmstb: Refactor indication of SSC status Jim Quinlan
@ 2025-06-09 22:17 ` Jim Quinlan
2025-06-12 20:37 ` Florian Fainelli
` (2 more replies)
2 siblings, 3 replies; 10+ messages in thread
From: Jim Quinlan @ 2025-06-09 22:17 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
Broadcom's Cable Modem (CM) group also uses this PCIe driver
as it shares the PCIe HW core with the STB group.
Make the modifications to enable the CM SoCs.
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
---
drivers/pci/controller/pcie-brcmstb.c | 186 +++++++++++++++++++++-----
1 file changed, 152 insertions(+), 34 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index db7872cda960..e25dbcdc56a7 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -51,6 +51,9 @@
#define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8
#define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8
+#define PCIE_RC_DL_PDL_CONTROL_4 0x1010
+#define PCIE_RC_DL_PDL_CONTROL_4_NPH_FC_INIT_MASK 0xff000000
+
#define PCIE_RC_DL_MDIO_ADDR 0x1100
#define PCIE_RC_DL_MDIO_WR_DATA 0x1104
#define PCIE_RC_DL_MDIO_RD_DATA 0x1108
@@ -60,6 +63,7 @@
#define PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK 0xff
#define PCIE_MISC_MISC_CTRL 0x4008
+#define PCIE_MISC_MISC_CTRL_PCIE_IN_CPL_RO_MASK 0x20
#define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80
#define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400
#define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000
@@ -170,6 +174,7 @@
/* MSI target addresses */
#define BRCM_MSI_TARGET_ADDR_LT_4GB 0x0fffffffcULL
#define BRCM_MSI_TARGET_ADDR_GT_4GB 0xffffffffcULL
+#define BRCM_MSI_TARGET_ADDR_FOR_CM 0xfffffffffcULL
/* MDIO registers */
#define MDIO_PORT0 0x0
@@ -223,13 +228,23 @@ enum {
enum pcie_soc_base {
GENERIC,
BCM2711,
+ BCM3162,
+ BCM3392,
+ BCM3390,
BCM4908,
BCM7278,
BCM7425,
BCM7435,
BCM7712,
+ BCM33940,
};
+/*
+ * BCM3390 CM chip actually conforms to STB design, so it
+ * is not present in the macro below.
+ */
+#define IS_CM_SOC(t) ((t) == BCM3162 || (t) == BCM33940 || (t) == BCM3392)
+
struct inbound_win {
u64 size;
u64 pci_offset;
@@ -757,6 +772,9 @@ static int brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val)
u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT;
int ret = 0;
+ if (IS_CM_SOC(pcie->cfg->soc_base))
+ return 0;
+
if (pcie->bridge_reset) {
if (val)
ret = reset_control_assert(pcie->bridge_reset);
@@ -891,13 +909,13 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
struct inbound_win *b = b_begin;
/*
- * STB chips beside 7712 disable the first inbound window default.
- * Rather being mapped to system memory it is mapped to the
- * internal registers of the SoC. This feature is deprecated, has
- * security considerations, and is not implemented in our modern
- * SoCs.
+ * STB chips beside CM chips and 7712 disable the first inbound
+ * window default. Rather being mapped to system memory it is
+ * mapped to the internal registers of the SoC. This feature is
+ * deprecated, has security considerations, and is not
+ * implemented in our modern SoCs.
*/
- if (pcie->cfg->soc_base != BCM7712)
+ if (pcie->cfg->soc_base != BCM7712 && !IS_CM_SOC(pcie->cfg->soc_base))
add_inbound_win(b++, &n, 0, 0, 0);
resource_list_for_each_entry(entry, &bridge->dma_ranges) {
@@ -905,16 +923,32 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
u64 cpu_start = entry->res->start;
size = resource_size(entry->res);
+
+ /*
+ * For BCM3390, single dma-range may map to the SoC
+ * register space in [0xf0000000..0xffffffff]. If present,
+ * this has to be assigned to inbound window #1, as this is
+ * the only one that HW allows to map to register space.
+ * So if we see this range, place it in inbound_wins[1]
+ * which is previously disabled (zeroed out).
+ */
+ if (pcie->cfg->soc_base == BCM3390 && cpu_start >= 0xf0000000
+ && cpu_start + size - 1 <= 0xffffffff) {
+ add_inbound_win(b_begin, &n, size, cpu_start, pcie_start);
+ n--;
+ continue;
+ }
+
tot_size += size;
if (pcie_start < lowest_pcie_addr)
lowest_pcie_addr = pcie_start;
/*
- * 7712 and newer chips may have many BARs, with each
- * offering a non-overlapping viewport to system memory.
- * That being said, each BARs size must still be a power of
- * two.
+ * 7712, CM, and newer chips may have many inbound windows,
+ * with each offering a non-overlapping viewport to system
+ * memory. That being said, each window's size must still
+ * be a power of two.
*/
- if (pcie->cfg->soc_base == BCM7712)
+ if (pcie->cfg->soc_base == BCM7712 || IS_CM_SOC(pcie->cfg->soc_base))
add_inbound_win(b++, &n, size, cpu_start, pcie_start);
if (n > pcie->cfg->num_inbound_wins)
@@ -927,11 +961,11 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
}
/*
- * 7712 and newer chips do not have an internal memory mapping system
- * that enables multiple memory controllers. As such, it can return
- * now w/o doing special configuration.
+ * 7712, CM, and newer chips do not have an internal memory
+ * mapping system that enables multiple memory controllers. As
+ * such, it can return now w/o doing special configuration.
*/
- if (pcie->cfg->soc_base == BCM7712)
+ if (pcie->cfg->soc_base == BCM7712 || IS_CM_SOC(pcie->cfg->soc_base))
return n;
ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1,
@@ -1051,10 +1085,10 @@ static void set_inbound_win_registers(struct brcm_pcie *pcie,
/*
* Most STB chips:
* Do nothing.
- * 7712:
- * All of their BARs need to be set.
+ * 7712, CM:
+ * All of their inbound windows need to be set.
*/
- if (pcie->cfg->soc_base == BCM7712) {
+ if (pcie->cfg->soc_base == BCM7712 || IS_CM_SOC(pcie->cfg->soc_base)) {
/* BUS remap register settings */
reg_offset = brcm_ubus_reg_offset(i);
tmp = lower_32_bits(cpu_addr) & ~0xfff;
@@ -1118,6 +1152,8 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
burst = 0x0; /* 128 bytes */
else if (pcie->cfg->soc_base == BCM7278)
burst = 0x3; /* 512 bytes */
+ else if (pcie->cfg->soc_base == BCM3162 || pcie->cfg->soc_base == BCM33940)
+ burst = 0x1; /* Encoding: 0=64, 1=128, 2=Rsvd, 3=Rsvd */
else
burst = 0x2; /* 512 bytes */
@@ -1144,18 +1180,20 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
return -EINVAL;
}
- tmp = readl(base + PCIE_MISC_MISC_CTRL);
- for (memc = 0; memc < pcie->num_memc; memc++) {
- u32 scb_size_val = ilog2(pcie->memc_size[memc]) - 15;
-
- if (memc == 0)
- u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(0));
- else if (memc == 1)
- u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(1));
- else if (memc == 2)
- u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(2));
+ if (!IS_CM_SOC(pcie->cfg->soc_base)) {
+ tmp = readl(base + PCIE_MISC_MISC_CTRL);
+ for (memc = 0; memc < pcie->num_memc; memc++) {
+ u32 scb_size_val = ilog2(pcie->memc_size[memc]) - 15;
+
+ if (memc == 0)
+ u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(0));
+ else if (memc == 1)
+ u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(1));
+ else if (memc == 2)
+ u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(2));
+ }
+ writel(tmp, base + PCIE_MISC_MISC_CTRL);
}
- writel(tmp, base + PCIE_MISC_MISC_CTRL);
/*
* We ideally want the MSI target address to be located in the 32bit
@@ -1164,8 +1202,10 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
* 4GB or when the inbound area is smaller than 4GB (taking into
* account the rounding-up we're forced to perform).
*/
- if (inbound_wins[2].pci_offset >= SZ_4G ||
- (inbound_wins[2].size + inbound_wins[2].pci_offset) < SZ_4G)
+ if (IS_CM_SOC(pcie->cfg->soc_base))
+ pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_FOR_CM;
+ else if (inbound_wins[2].pci_offset >= SZ_4G ||
+ (inbound_wins[2].size + inbound_wins[2].pci_offset) < SZ_4G)
pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_LT_4GB;
else
pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_GT_4GB;
@@ -1226,6 +1266,29 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK);
writel(tmp, base + PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1);
+ /*
+ * Relax read ordering for chip architectures using RBUS/SCB that
+ * use WiFi Runner offload (i.e. BCM3390) to avoid deadlock where
+ * reads are blocked by writes.
+ */
+ if (pcie->cfg->soc_base == BCM3390) {
+ tmp = readl(base + PCIE_MISC_MISC_CTRL);
+ u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_IN_CPL_RO_MASK);
+ writel(tmp, base + PCIE_MISC_MISC_CTRL);
+ }
+
+ /*
+ * The 3392 has a bug that requires the NP credit advertised by the
+ * MAC to be overwritten with 0x10 in bits 31:24 of the following
+ * register.
+ */
+ if (pcie->cfg->soc_base == BCM3392) {
+ tmp = readl(base + PCIE_RC_DL_PDL_CONTROL_4);
+ u32p_replace_bits(&tmp, 0x10,
+ PCIE_RC_DL_PDL_CONTROL_4_NPH_FC_INIT_MASK);
+ writel(tmp, base + PCIE_RC_DL_PDL_CONTROL_4);
+ }
+
if (pcie->cfg->post_setup) {
ret = pcie->cfg->post_setup(pcie);
if (ret < 0)
@@ -1246,8 +1309,8 @@ static void brcm_extend_rbus_timeout(struct brcm_pcie *pcie)
const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8;
u32 timeout_us = 4000000; /* 4 seconds, our setting for L1SS */
- /* 7712 does not have this (RGR1) timer */
- if (pcie->cfg->soc_base == BCM7712)
+ /* CM and 7712 do not have this (RGR1) timer */
+ if (IS_CM_SOC(pcie->cfg->soc_base) || pcie->cfg->soc_base == BCM7712)
return;
/* Each unit in timeout register is 1/216,000,000 seconds */
@@ -1354,7 +1417,10 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
brcm_config_clkreq(pcie);
- if (pcie->ssc) {
+ if (IS_CM_SOC(pcie->cfg->soc_base)) {
+ /* This driver does configure SSC for CM chips */
+ ssc_str = "";
+ } else if (pcie->ssc) {
ret = brcm_pcie_set_ssc(pcie);
if (ret == 0)
ssc_str = "(SSC)";
@@ -1715,6 +1781,14 @@ static const int pcie_offsets[] = {
[PCIE_INTR2_CPU_BASE] = 0x4300,
};
+static const int pcie_offset_bcm3162[] = {
+ [RGR1_SW_INIT_1] = 0x9210,
+ [EXT_CFG_INDEX] = 0x9000,
+ [EXT_CFG_DATA] = 0x9004,
+ [PCIE_HARD_DEBUG] = 0x4204,
+ [PCIE_INTR2_CPU_BASE] = 0x4300
+};
+
static const int pcie_offsets_bcm7278[] = {
[RGR1_SW_INIT_1] = 0xc010,
[EXT_CFG_INDEX] = 0x9000,
@@ -1739,6 +1813,14 @@ static const int pcie_offsets_bcm7712[] = {
[PCIE_INTR2_CPU_BASE] = 0x4400,
};
+static const int pcie_offset_bcm33940[] = {
+ [RGR1_SW_INIT_1] = 0x9210,
+ [EXT_CFG_INDEX] = 0x9000,
+ [EXT_CFG_DATA] = 0x9004,
+ [PCIE_HARD_DEBUG] = 0x4304,
+ [PCIE_INTR2_CPU_BASE] = 0x4400
+};
+
static const struct pcie_cfg_data generic_cfg = {
.offsets = pcie_offsets,
.soc_base = GENERIC,
@@ -1765,6 +1847,30 @@ static const struct pcie_cfg_data bcm2712_cfg = {
.num_inbound_wins = 10,
};
+static const struct pcie_cfg_data bcm3162_cfg = {
+ .offsets = pcie_offset_bcm3162,
+ .soc_base = BCM3162,
+ .perst_set = brcm_pcie_perst_set_7278,
+ .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
+ .num_inbound_wins = 3,
+};
+
+static const struct pcie_cfg_data bcm3392_cfg = {
+ .offsets = pcie_offset_bcm33940,
+ .soc_base = BCM3392,
+ .perst_set = brcm_pcie_perst_set_7278,
+ .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
+ .num_inbound_wins = 10,
+};
+
+static const struct pcie_cfg_data bcm3390_cfg = {
+ .offsets = pcie_offsets,
+ .soc_base = BCM3390,
+ .perst_set = brcm_pcie_perst_set_generic,
+ .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
+ .num_inbound_wins = 3,
+};
+
static const struct pcie_cfg_data bcm4908_cfg = {
.offsets = pcie_offsets,
.soc_base = BCM4908,
@@ -1814,9 +1920,20 @@ static const struct pcie_cfg_data bcm7712_cfg = {
.num_inbound_wins = 10,
};
+static const struct pcie_cfg_data bcm33940_cfg = {
+ .offsets = pcie_offset_bcm33940,
+ .soc_base = BCM33940,
+ .perst_set = brcm_pcie_perst_set_7278,
+ .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
+ .num_inbound_wins = 10,
+};
+
static const struct of_device_id brcm_pcie_match[] = {
{ .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg },
{ .compatible = "brcm,bcm2712-pcie", .data = &bcm2712_cfg },
+ { .compatible = "brcm,bcm3162-pcie", .data = &bcm3162_cfg },
+ { .compatible = "brcm,bcm3390-pcie", .data = &bcm3390_cfg },
+ { .compatible = "brcm,bcm3392-pcie", .data = &bcm3392_cfg },
{ .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg },
{ .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg },
{ .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg },
@@ -1825,6 +1942,7 @@ static const struct of_device_id brcm_pcie_match[] = {
{ .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg },
{ .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg },
{ .compatible = "brcm,bcm7712-pcie", .data = &bcm7712_cfg },
+ { .compatible = "brcm,bcm33940-pcie", .data = &bcm33940_cfg },
{},
};
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] dt bindings: PCI: brcmstb: Include cable-modem SoCs
2025-06-09 22:17 ` [PATCH 1/3] dt bindings: " Jim Quinlan
@ 2025-06-10 15:23 ` Conor Dooley
2025-06-12 20:33 ` Florian Fainelli
1 sibling, 0 replies; 10+ messages in thread
From: Conor Dooley @ 2025-06-10 15:23 UTC (permalink / raw)
To: Jim Quinlan
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]
On Mon, Jun 09, 2025 at 06:17:04PM -0400, Jim Quinlan wrote:
> Add four Broadcom Cable Modem SoCs to the compatibility list.
In your commit messages, you should mention why these devices are not
capable of using fallbacks.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
> Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
> index c4f9674e8695..5a7b0ed9464d 100644
> --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
> +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
> @@ -15,6 +15,9 @@ properties:
> - enum:
> - brcm,bcm2711-pcie # The Raspberry Pi 4
> - brcm,bcm2712-pcie # Raspberry Pi 5
> + - brcm,bcm3162-pcie # Broadcom DOCSIS 4.0 CMTS w/ 64b ARM
> + - brcm,bcm3390-pcie # Broadcom DOCSIS 3.1 CM w/ 32b ARM
> + - brcm,bcm3392-pcie # Broadcom DOCSIS 3.1 CM w/ 64b ARM
> - brcm,bcm4908-pcie
> - brcm,bcm7211-pcie # Broadcom STB version of RPi4
> - brcm,bcm7216-pcie # Broadcom 7216 Arm
> @@ -23,6 +26,7 @@ properties:
> - brcm,bcm7435-pcie # Broadcom 7435 MIPs
> - brcm,bcm7445-pcie # Broadcom 7445 Arm
> - brcm,bcm7712-pcie # Broadcom STB sibling of Rpi 5
> + - brcm,bcm33940-pcie # Broadcom DOCSIS 4.0 CM w/ 64b ARM
>
> reg:
> maxItems: 1
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] dt bindings: PCI: brcmstb: Include cable-modem SoCs
2025-06-09 22:17 ` [PATCH 1/3] dt bindings: " Jim Quinlan
2025-06-10 15:23 ` Conor Dooley
@ 2025-06-12 20:33 ` Florian Fainelli
1 sibling, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2025-06-12 20:33 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Krzysztof Kozlowski,
Conor Dooley,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On 6/9/25 15:17, Jim Quinlan wrote:
> Add four Broadcom Cable Modem SoCs to the compatibility list.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] PCI: brcmstb: Refactor indication of SSC status
2025-06-09 22:17 ` [PATCH 2/3] PCI: brcmstb: Refactor indication of SSC status Jim Quinlan
@ 2025-06-12 20:33 ` Florian Fainelli
0 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2025-06-12 20:33 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On 6/9/25 15:17, Jim Quinlan wrote:
> Instead of using a bool to track the Spread Spectrum Clocking (SSC), just
> use a string constant since that will be the end result anyway. The
> motivation for this change is underscored by a subsequent commit that adds
> Cable Modem SoCs to the driver.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs
2025-06-09 22:17 ` [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs Jim Quinlan
@ 2025-06-12 20:37 ` Florian Fainelli
2025-07-08 7:38 ` Manivannan Sadhasivam
2025-07-10 17:23 ` Manivannan Sadhasivam
2 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2025-06-12 20:37 UTC (permalink / raw)
To: Jim Quinlan, linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On 6/9/25 15:17, Jim Quinlan wrote:
> Broadcom's Cable Modem (CM) group also uses this PCIe driver
> as it shares the PCIe HW core with the STB group.
>
> Make the modifications to enable the CM SoCs.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
[snip]
> @@ -1354,7 +1417,10 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
>
> brcm_config_clkreq(pcie);
>
> - if (pcie->ssc) {
> + if (IS_CM_SOC(pcie->cfg->soc_base)) {
> + /* This driver does configure SSC for CM chips */
Nit: does not configure SSC for CM chips. With that fixed:
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs
2025-06-09 22:17 ` [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs Jim Quinlan
2025-06-12 20:37 ` Florian Fainelli
@ 2025-07-08 7:38 ` Manivannan Sadhasivam
2025-07-10 17:23 ` Manivannan Sadhasivam
2 siblings, 0 replies; 10+ messages in thread
From: Manivannan Sadhasivam @ 2025-07-08 7:38 UTC (permalink / raw)
To: Jim Quinlan
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On Mon, Jun 09, 2025 at 06:17:06PM GMT, Jim Quinlan wrote:
> Broadcom's Cable Modem (CM) group also uses this PCIe driver
> as it shares the PCIe HW core with the STB group.
>
> Make the modifications to enable the CM SoCs.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
> drivers/pci/controller/pcie-brcmstb.c | 186 +++++++++++++++++++++-----
> 1 file changed, 152 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index db7872cda960..e25dbcdc56a7 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -51,6 +51,9 @@
> #define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8
> #define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8
>
> +#define PCIE_RC_DL_PDL_CONTROL_4 0x1010
> +#define PCIE_RC_DL_PDL_CONTROL_4_NPH_FC_INIT_MASK 0xff000000
> +
> #define PCIE_RC_DL_MDIO_ADDR 0x1100
> #define PCIE_RC_DL_MDIO_WR_DATA 0x1104
> #define PCIE_RC_DL_MDIO_RD_DATA 0x1108
> @@ -60,6 +63,7 @@
> #define PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK 0xff
>
> #define PCIE_MISC_MISC_CTRL 0x4008
> +#define PCIE_MISC_MISC_CTRL_PCIE_IN_CPL_RO_MASK 0x20
> #define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80
> #define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400
> #define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000
> @@ -170,6 +174,7 @@
> /* MSI target addresses */
> #define BRCM_MSI_TARGET_ADDR_LT_4GB 0x0fffffffcULL
> #define BRCM_MSI_TARGET_ADDR_GT_4GB 0xffffffffcULL
> +#define BRCM_MSI_TARGET_ADDR_FOR_CM 0xfffffffffcULL
>
> /* MDIO registers */
> #define MDIO_PORT0 0x0
> @@ -223,13 +228,23 @@ enum {
> enum pcie_soc_base {
> GENERIC,
> BCM2711,
> + BCM3162,
> + BCM3392,
> + BCM3390,
> BCM4908,
> BCM7278,
> BCM7425,
> BCM7435,
> BCM7712,
> + BCM33940,
> };
>
> +/*
> + * BCM3390 CM chip actually conforms to STB design, so it
> + * is not present in the macro below.
> + */
> +#define IS_CM_SOC(t) ((t) == BCM3162 || (t) == BCM33940 || (t) == BCM3392)
> +
> struct inbound_win {
> u64 size;
> u64 pci_offset;
> @@ -757,6 +772,9 @@ static int brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val)
> u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT;
> int ret = 0;
>
> + if (IS_CM_SOC(pcie->cfg->soc_base))
> + return 0;
> +
> if (pcie->bridge_reset) {
> if (val)
> ret = reset_control_assert(pcie->bridge_reset);
> @@ -891,13 +909,13 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
> struct inbound_win *b = b_begin;
>
> /*
> - * STB chips beside 7712 disable the first inbound window default.
> - * Rather being mapped to system memory it is mapped to the
> - * internal registers of the SoC. This feature is deprecated, has
> - * security considerations, and is not implemented in our modern
> - * SoCs.
> + * STB chips beside CM chips and 7712 disable the first inbound
> + * window default. Rather being mapped to system memory it is
> + * mapped to the internal registers of the SoC. This feature is
> + * deprecated, has security considerations, and is not
> + * implemented in our modern SoCs.
May I know what is the purpose of allowing inbound access to these regions? TBH,
I'm not sure what is the usecase of 'inbound memory' for PCIe host.
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs
2025-06-09 22:17 ` [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs Jim Quinlan
2025-06-12 20:37 ` Florian Fainelli
2025-07-08 7:38 ` Manivannan Sadhasivam
@ 2025-07-10 17:23 ` Manivannan Sadhasivam
2 siblings, 0 replies; 10+ messages in thread
From: Manivannan Sadhasivam @ 2025-07-10 17:23 UTC (permalink / raw)
To: Jim Quinlan
Cc: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, bcm-kernel-feedback-list, jim2101024,
Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
On Mon, Jun 09, 2025 at 06:17:06PM GMT, Jim Quinlan wrote:
> Broadcom's Cable Modem (CM) group also uses this PCIe driver
> as it shares the PCIe HW core with the STB group.
>
> Make the modifications to enable the CM SoCs.
>
> Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
> ---
> drivers/pci/controller/pcie-brcmstb.c | 186 +++++++++++++++++++++-----
> 1 file changed, 152 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index db7872cda960..e25dbcdc56a7 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -51,6 +51,9 @@
> #define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8
> #define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8
>
> +#define PCIE_RC_DL_PDL_CONTROL_4 0x1010
> +#define PCIE_RC_DL_PDL_CONTROL_4_NPH_FC_INIT_MASK 0xff000000
Could you please use GENMASK()?
> +
> #define PCIE_RC_DL_MDIO_ADDR 0x1100
> #define PCIE_RC_DL_MDIO_WR_DATA 0x1104
> #define PCIE_RC_DL_MDIO_RD_DATA 0x1108
> @@ -60,6 +63,7 @@
> #define PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK 0xff
>
> #define PCIE_MISC_MISC_CTRL 0x4008
> +#define PCIE_MISC_MISC_CTRL_PCIE_IN_CPL_RO_MASK 0x20
> #define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80
> #define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400
> #define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000
> @@ -170,6 +174,7 @@
> /* MSI target addresses */
> #define BRCM_MSI_TARGET_ADDR_LT_4GB 0x0fffffffcULL
> #define BRCM_MSI_TARGET_ADDR_GT_4GB 0xffffffffcULL
> +#define BRCM_MSI_TARGET_ADDR_FOR_CM 0xfffffffffcULL
>
> /* MDIO registers */
> #define MDIO_PORT0 0x0
> @@ -223,13 +228,23 @@ enum {
> enum pcie_soc_base {
> GENERIC,
> BCM2711,
> + BCM3162,
> + BCM3392,
> + BCM3390,
> BCM4908,
> BCM7278,
> BCM7425,
> BCM7435,
> BCM7712,
> + BCM33940,
> };
>
> +/*
> + * BCM3390 CM chip actually conforms to STB design, so it
> + * is not present in the macro below.
> + */
> +#define IS_CM_SOC(t) ((t) == BCM3162 || (t) == BCM33940 || (t) == BCM3392)
TBH, I don't like these soc_base comparisions sprinkled throghout the driver.
They just make the code messy and it will become a nightmare to maintain if
these comparisions grow in the future (it already is).
I would rather like to have function specific flags that are set for specific
SoCs and those flags be used in the code for conditional check instead of the
soc_base.
It would make it easier to understand what functionalities are supported by each
SoC and where exactly those functionalities are implemented.
- Mani
> +
> struct inbound_win {
> u64 size;
> u64 pci_offset;
> @@ -757,6 +772,9 @@ static int brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val)
> u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT;
> int ret = 0;
>
> + if (IS_CM_SOC(pcie->cfg->soc_base))
> + return 0;
> +
> if (pcie->bridge_reset) {
> if (val)
> ret = reset_control_assert(pcie->bridge_reset);
> @@ -891,13 +909,13 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
> struct inbound_win *b = b_begin;
>
> /*
> - * STB chips beside 7712 disable the first inbound window default.
> - * Rather being mapped to system memory it is mapped to the
> - * internal registers of the SoC. This feature is deprecated, has
> - * security considerations, and is not implemented in our modern
> - * SoCs.
> + * STB chips beside CM chips and 7712 disable the first inbound
> + * window default. Rather being mapped to system memory it is
> + * mapped to the internal registers of the SoC. This feature is
> + * deprecated, has security considerations, and is not
> + * implemented in our modern SoCs.
> */
> - if (pcie->cfg->soc_base != BCM7712)
> + if (pcie->cfg->soc_base != BCM7712 && !IS_CM_SOC(pcie->cfg->soc_base))
> add_inbound_win(b++, &n, 0, 0, 0);
>
> resource_list_for_each_entry(entry, &bridge->dma_ranges) {
> @@ -905,16 +923,32 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
> u64 cpu_start = entry->res->start;
>
> size = resource_size(entry->res);
> +
> + /*
> + * For BCM3390, single dma-range may map to the SoC
> + * register space in [0xf0000000..0xffffffff]. If present,
> + * this has to be assigned to inbound window #1, as this is
> + * the only one that HW allows to map to register space.
> + * So if we see this range, place it in inbound_wins[1]
> + * which is previously disabled (zeroed out).
> + */
> + if (pcie->cfg->soc_base == BCM3390 && cpu_start >= 0xf0000000
> + && cpu_start + size - 1 <= 0xffffffff) {
> + add_inbound_win(b_begin, &n, size, cpu_start, pcie_start);
> + n--;
> + continue;
> + }
> +
> tot_size += size;
> if (pcie_start < lowest_pcie_addr)
> lowest_pcie_addr = pcie_start;
> /*
> - * 7712 and newer chips may have many BARs, with each
> - * offering a non-overlapping viewport to system memory.
> - * That being said, each BARs size must still be a power of
> - * two.
> + * 7712, CM, and newer chips may have many inbound windows,
> + * with each offering a non-overlapping viewport to system
> + * memory. That being said, each window's size must still
> + * be a power of two.
> */
> - if (pcie->cfg->soc_base == BCM7712)
> + if (pcie->cfg->soc_base == BCM7712 || IS_CM_SOC(pcie->cfg->soc_base))
> add_inbound_win(b++, &n, size, cpu_start, pcie_start);
>
> if (n > pcie->cfg->num_inbound_wins)
> @@ -927,11 +961,11 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie,
> }
>
> /*
> - * 7712 and newer chips do not have an internal memory mapping system
> - * that enables multiple memory controllers. As such, it can return
> - * now w/o doing special configuration.
> + * 7712, CM, and newer chips do not have an internal memory
> + * mapping system that enables multiple memory controllers. As
> + * such, it can return now w/o doing special configuration.
> */
> - if (pcie->cfg->soc_base == BCM7712)
> + if (pcie->cfg->soc_base == BCM7712 || IS_CM_SOC(pcie->cfg->soc_base))
> return n;
>
> ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1,
> @@ -1051,10 +1085,10 @@ static void set_inbound_win_registers(struct brcm_pcie *pcie,
> /*
> * Most STB chips:
> * Do nothing.
> - * 7712:
> - * All of their BARs need to be set.
> + * 7712, CM:
> + * All of their inbound windows need to be set.
> */
> - if (pcie->cfg->soc_base == BCM7712) {
> + if (pcie->cfg->soc_base == BCM7712 || IS_CM_SOC(pcie->cfg->soc_base)) {
> /* BUS remap register settings */
> reg_offset = brcm_ubus_reg_offset(i);
> tmp = lower_32_bits(cpu_addr) & ~0xfff;
> @@ -1118,6 +1152,8 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
> burst = 0x0; /* 128 bytes */
> else if (pcie->cfg->soc_base == BCM7278)
> burst = 0x3; /* 512 bytes */
> + else if (pcie->cfg->soc_base == BCM3162 || pcie->cfg->soc_base == BCM33940)
> + burst = 0x1; /* Encoding: 0=64, 1=128, 2=Rsvd, 3=Rsvd */
> else
> burst = 0x2; /* 512 bytes */
>
> @@ -1144,18 +1180,20 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
> return -EINVAL;
> }
>
> - tmp = readl(base + PCIE_MISC_MISC_CTRL);
> - for (memc = 0; memc < pcie->num_memc; memc++) {
> - u32 scb_size_val = ilog2(pcie->memc_size[memc]) - 15;
> -
> - if (memc == 0)
> - u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(0));
> - else if (memc == 1)
> - u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(1));
> - else if (memc == 2)
> - u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(2));
> + if (!IS_CM_SOC(pcie->cfg->soc_base)) {
> + tmp = readl(base + PCIE_MISC_MISC_CTRL);
> + for (memc = 0; memc < pcie->num_memc; memc++) {
> + u32 scb_size_val = ilog2(pcie->memc_size[memc]) - 15;
> +
> + if (memc == 0)
> + u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(0));
> + else if (memc == 1)
> + u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(1));
> + else if (memc == 2)
> + u32p_replace_bits(&tmp, scb_size_val, SCB_SIZE_MASK(2));
> + }
> + writel(tmp, base + PCIE_MISC_MISC_CTRL);
> }
> - writel(tmp, base + PCIE_MISC_MISC_CTRL);
>
> /*
> * We ideally want the MSI target address to be located in the 32bit
> @@ -1164,8 +1202,10 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
> * 4GB or when the inbound area is smaller than 4GB (taking into
> * account the rounding-up we're forced to perform).
> */
> - if (inbound_wins[2].pci_offset >= SZ_4G ||
> - (inbound_wins[2].size + inbound_wins[2].pci_offset) < SZ_4G)
> + if (IS_CM_SOC(pcie->cfg->soc_base))
> + pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_FOR_CM;
> + else if (inbound_wins[2].pci_offset >= SZ_4G ||
> + (inbound_wins[2].size + inbound_wins[2].pci_offset) < SZ_4G)
> pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_LT_4GB;
> else
> pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_GT_4GB;
> @@ -1226,6 +1266,29 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
> PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK);
> writel(tmp, base + PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1);
>
> + /*
> + * Relax read ordering for chip architectures using RBUS/SCB that
> + * use WiFi Runner offload (i.e. BCM3390) to avoid deadlock where
> + * reads are blocked by writes.
> + */
> + if (pcie->cfg->soc_base == BCM3390) {
> + tmp = readl(base + PCIE_MISC_MISC_CTRL);
> + u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_IN_CPL_RO_MASK);
> + writel(tmp, base + PCIE_MISC_MISC_CTRL);
> + }
> +
> + /*
> + * The 3392 has a bug that requires the NP credit advertised by the
> + * MAC to be overwritten with 0x10 in bits 31:24 of the following
> + * register.
> + */
> + if (pcie->cfg->soc_base == BCM3392) {
> + tmp = readl(base + PCIE_RC_DL_PDL_CONTROL_4);
> + u32p_replace_bits(&tmp, 0x10,
> + PCIE_RC_DL_PDL_CONTROL_4_NPH_FC_INIT_MASK);
> + writel(tmp, base + PCIE_RC_DL_PDL_CONTROL_4);
> + }
> +
> if (pcie->cfg->post_setup) {
> ret = pcie->cfg->post_setup(pcie);
> if (ret < 0)
> @@ -1246,8 +1309,8 @@ static void brcm_extend_rbus_timeout(struct brcm_pcie *pcie)
> const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8;
> u32 timeout_us = 4000000; /* 4 seconds, our setting for L1SS */
>
> - /* 7712 does not have this (RGR1) timer */
> - if (pcie->cfg->soc_base == BCM7712)
> + /* CM and 7712 do not have this (RGR1) timer */
> + if (IS_CM_SOC(pcie->cfg->soc_base) || pcie->cfg->soc_base == BCM7712)
> return;
>
> /* Each unit in timeout register is 1/216,000,000 seconds */
> @@ -1354,7 +1417,10 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
>
> brcm_config_clkreq(pcie);
>
> - if (pcie->ssc) {
> + if (IS_CM_SOC(pcie->cfg->soc_base)) {
> + /* This driver does configure SSC for CM chips */
> + ssc_str = "";
> + } else if (pcie->ssc) {
> ret = brcm_pcie_set_ssc(pcie);
> if (ret == 0)
> ssc_str = "(SSC)";
> @@ -1715,6 +1781,14 @@ static const int pcie_offsets[] = {
> [PCIE_INTR2_CPU_BASE] = 0x4300,
> };
>
> +static const int pcie_offset_bcm3162[] = {
> + [RGR1_SW_INIT_1] = 0x9210,
> + [EXT_CFG_INDEX] = 0x9000,
> + [EXT_CFG_DATA] = 0x9004,
> + [PCIE_HARD_DEBUG] = 0x4204,
> + [PCIE_INTR2_CPU_BASE] = 0x4300
> +};
> +
> static const int pcie_offsets_bcm7278[] = {
> [RGR1_SW_INIT_1] = 0xc010,
> [EXT_CFG_INDEX] = 0x9000,
> @@ -1739,6 +1813,14 @@ static const int pcie_offsets_bcm7712[] = {
> [PCIE_INTR2_CPU_BASE] = 0x4400,
> };
>
> +static const int pcie_offset_bcm33940[] = {
> + [RGR1_SW_INIT_1] = 0x9210,
> + [EXT_CFG_INDEX] = 0x9000,
> + [EXT_CFG_DATA] = 0x9004,
> + [PCIE_HARD_DEBUG] = 0x4304,
> + [PCIE_INTR2_CPU_BASE] = 0x4400
> +};
> +
> static const struct pcie_cfg_data generic_cfg = {
> .offsets = pcie_offsets,
> .soc_base = GENERIC,
> @@ -1765,6 +1847,30 @@ static const struct pcie_cfg_data bcm2712_cfg = {
> .num_inbound_wins = 10,
> };
>
> +static const struct pcie_cfg_data bcm3162_cfg = {
> + .offsets = pcie_offset_bcm3162,
> + .soc_base = BCM3162,
> + .perst_set = brcm_pcie_perst_set_7278,
> + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
> + .num_inbound_wins = 3,
> +};
> +
> +static const struct pcie_cfg_data bcm3392_cfg = {
> + .offsets = pcie_offset_bcm33940,
> + .soc_base = BCM3392,
> + .perst_set = brcm_pcie_perst_set_7278,
> + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
> + .num_inbound_wins = 10,
> +};
> +
> +static const struct pcie_cfg_data bcm3390_cfg = {
> + .offsets = pcie_offsets,
> + .soc_base = BCM3390,
> + .perst_set = brcm_pcie_perst_set_generic,
> + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
> + .num_inbound_wins = 3,
> +};
> +
> static const struct pcie_cfg_data bcm4908_cfg = {
> .offsets = pcie_offsets,
> .soc_base = BCM4908,
> @@ -1814,9 +1920,20 @@ static const struct pcie_cfg_data bcm7712_cfg = {
> .num_inbound_wins = 10,
> };
>
> +static const struct pcie_cfg_data bcm33940_cfg = {
> + .offsets = pcie_offset_bcm33940,
> + .soc_base = BCM33940,
> + .perst_set = brcm_pcie_perst_set_7278,
> + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
> + .num_inbound_wins = 10,
> +};
> +
> static const struct of_device_id brcm_pcie_match[] = {
> { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg },
> { .compatible = "brcm,bcm2712-pcie", .data = &bcm2712_cfg },
> + { .compatible = "brcm,bcm3162-pcie", .data = &bcm3162_cfg },
> + { .compatible = "brcm,bcm3390-pcie", .data = &bcm3390_cfg },
> + { .compatible = "brcm,bcm3392-pcie", .data = &bcm3392_cfg },
> { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg },
> { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg },
> { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg },
> @@ -1825,6 +1942,7 @@ static const struct of_device_id brcm_pcie_match[] = {
> { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg },
> { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg },
> { .compatible = "brcm,bcm7712-pcie", .data = &bcm7712_cfg },
> + { .compatible = "brcm,bcm33940-pcie", .data = &bcm33940_cfg },
> {},
> };
>
> --
> 2.43.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-07-10 17:24 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 22:17 [PATCH 0/3] PCI: brcmstb: Include cable-modem SoCs Jim Quinlan
2025-06-09 22:17 ` [PATCH 1/3] dt bindings: " Jim Quinlan
2025-06-10 15:23 ` Conor Dooley
2025-06-12 20:33 ` Florian Fainelli
2025-06-09 22:17 ` [PATCH 2/3] PCI: brcmstb: Refactor indication of SSC status Jim Quinlan
2025-06-12 20:33 ` Florian Fainelli
2025-06-09 22:17 ` [PATCH 3/3] PCI: brcmstb: Enable Broadcom Cable Modem SoCs Jim Quinlan
2025-06-12 20:37 ` Florian Fainelli
2025-07-08 7:38 ` Manivannan Sadhasivam
2025-07-10 17:23 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).