@@ -42,7 +42,6 @@ enum link_status {
42
42
};
43
43
44
44
#define J721E_MODE_RC BIT(7)
45
- #define LANE_COUNT_MASK BIT(8)
46
45
#define LANE_COUNT (n ) ((n) << 8)
47
46
48
47
#define GENERATION_SEL_MASK GENMASK(1, 0)
@@ -52,6 +51,7 @@ struct j721e_pcie {
52
51
struct clk * refclk ;
53
52
u32 mode ;
54
53
u32 num_lanes ;
54
+ u32 max_lanes ;
55
55
void __iomem * user_cfg_base ;
56
56
void __iomem * intd_cfg_base ;
57
57
u32 linkdown_irq_regfield ;
@@ -205,11 +205,15 @@ static int j721e_pcie_set_lane_count(struct j721e_pcie *pcie,
205
205
{
206
206
struct device * dev = pcie -> cdns_pcie -> dev ;
207
207
u32 lanes = pcie -> num_lanes ;
208
+ u32 mask = BIT (8 );
208
209
u32 val = 0 ;
209
210
int ret ;
210
211
212
+ if (pcie -> max_lanes == 4 )
213
+ mask = GENMASK (9 , 8 );
214
+
211
215
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 );
213
217
if (ret )
214
218
dev_err (dev , "failed to set link count\n" );
215
219
@@ -441,7 +445,9 @@ static int j721e_pcie_probe(struct platform_device *pdev)
441
445
dev_warn (dev , "num-lanes property not provided or invalid, setting num-lanes to 1\n" );
442
446
num_lanes = 1 ;
443
447
}
448
+
444
449
pcie -> num_lanes = num_lanes ;
450
+ pcie -> max_lanes = data -> max_lanes ;
445
451
446
452
if (dma_set_mask_and_coherent (dev , DMA_BIT_MASK (48 )))
447
453
return - EINVAL ;
0 commit comments