Skip to content

Commit 4490f55

Browse files
mranostaykwilczynski
authored andcommitted
PCI: j721e: Add PCIe 4x lane selection support
Add support for setting of two-bit field that allows selection of 4x lane PCIe which was previously limited to only 2x lanes. Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Matt Ranostay <[email protected]> Signed-off-by: Achal Verma <[email protected]> Signed-off-by: Siddharth Vadapalli <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Vignesh Raghavendra <[email protected]> Reviewed-by: Roger Quadros <[email protected]>
1 parent 3ac7f14 commit 4490f55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/pci/controller/cadence/pci-j721e.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ enum link_status {
4242
};
4343

4444
#define J721E_MODE_RC BIT(7)
45-
#define LANE_COUNT_MASK BIT(8)
4645
#define LANE_COUNT(n) ((n) << 8)
4746

4847
#define GENERATION_SEL_MASK GENMASK(1, 0)
@@ -52,6 +51,7 @@ struct j721e_pcie {
5251
struct clk *refclk;
5352
u32 mode;
5453
u32 num_lanes;
54+
u32 max_lanes;
5555
void __iomem *user_cfg_base;
5656
void __iomem *intd_cfg_base;
5757
u32 linkdown_irq_regfield;
@@ -205,11 +205,15 @@ static int j721e_pcie_set_lane_count(struct j721e_pcie *pcie,
205205
{
206206
struct device *dev = pcie->cdns_pcie->dev;
207207
u32 lanes = pcie->num_lanes;
208+
u32 mask = BIT(8);
208209
u32 val = 0;
209210
int ret;
210211

212+
if (pcie->max_lanes == 4)
213+
mask = GENMASK(9, 8);
214+
211215
val = LANE_COUNT(lanes - 1);
212-
ret = regmap_update_bits(syscon, offset, LANE_COUNT_MASK, val);
216+
ret = regmap_update_bits(syscon, offset, mask, val);
213217
if (ret)
214218
dev_err(dev, "failed to set link count\n");
215219

@@ -441,7 +445,9 @@ static int j721e_pcie_probe(struct platform_device *pdev)
441445
dev_warn(dev, "num-lanes property not provided or invalid, setting num-lanes to 1\n");
442446
num_lanes = 1;
443447
}
448+
444449
pcie->num_lanes = num_lanes;
450+
pcie->max_lanes = data->max_lanes;
445451

446452
if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)))
447453
return -EINVAL;

0 commit comments

Comments
 (0)