@@ -2528,13 +2528,23 @@ static u32 intel_cx0_get_pclk_refclk_ack(u8 lane_mask)
2528
2528
return val ;
2529
2529
}
2530
2530
2531
- /* FIXME: Some Type-C cases need not reset both the lanes. Handle those cases. */
2532
- static void intel_cx0_phy_lane_reset ( struct drm_i915_private * i915 , enum port port ,
2531
+ static void intel_cx0_phy_lane_reset ( struct drm_i915_private * i915 ,
2532
+ struct intel_encoder * encoder ,
2533
2533
bool lane_reversal )
2534
2534
{
2535
+ enum port port = encoder -> port ;
2535
2536
enum phy phy = intel_port_to_phy (i915 , port );
2537
+ bool both_lanes = intel_tc_port_fia_max_lane_count (enc_to_dig_port (encoder )) > 2 ;
2536
2538
u8 lane_mask = lane_reversal ? INTEL_CX0_LANE1 :
2537
2539
INTEL_CX0_LANE0 ;
2540
+ u32 lane_pipe_reset = both_lanes ?
2541
+ XELPDP_LANE_PIPE_RESET (0 ) |
2542
+ XELPDP_LANE_PIPE_RESET (1 ) :
2543
+ XELPDP_LANE_PIPE_RESET (0 );
2544
+ u32 lane_phy_current_status = both_lanes ?
2545
+ XELPDP_LANE_PHY_CURRENT_STATUS (0 ) |
2546
+ XELPDP_LANE_PHY_CURRENT_STATUS (1 ) :
2547
+ XELPDP_LANE_PHY_CURRENT_STATUS (0 );
2538
2548
2539
2549
if (__intel_de_wait_for_register (i915 , XELPDP_PORT_BUF_CTL1 (port ),
2540
2550
XELPDP_PORT_BUF_SOC_PHY_READY ,
@@ -2545,23 +2555,24 @@ static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port po
2545
2555
2546
2556
intel_de_rmw (i915 , XELPDP_PORT_BUF_CTL2 (port ),
2547
2557
XELPDP_LANE_PIPE_RESET (0 ) | XELPDP_LANE_PIPE_RESET (1 ),
2548
- XELPDP_LANE_PIPE_RESET ( 0 ) | XELPDP_LANE_PIPE_RESET ( 1 ) );
2558
+ lane_pipe_reset );
2549
2559
2550
2560
if (__intel_de_wait_for_register (i915 , XELPDP_PORT_BUF_CTL2 (port ),
2551
- XELPDP_LANE_PHY_CURRENT_STATUS (0 ) |
2552
- XELPDP_LANE_PHY_CURRENT_STATUS (1 ),
2553
- XELPDP_LANE_PHY_CURRENT_STATUS (0 ) |
2554
- XELPDP_LANE_PHY_CURRENT_STATUS (1 ),
2561
+ lane_phy_current_status , lane_phy_current_status ,
2555
2562
XELPDP_PORT_RESET_START_TIMEOUT_US , 0 , NULL ))
2556
2563
drm_warn (& i915 -> drm , "PHY %c failed to bring out of Lane reset after %dus.\n" ,
2557
2564
phy_name (phy ), XELPDP_PORT_RESET_START_TIMEOUT_US );
2558
2565
2559
2566
intel_de_rmw (i915 , XELPDP_PORT_CLOCK_CTL (port ),
2560
- intel_cx0_get_pclk_refclk_request (INTEL_CX0_BOTH_LANES ),
2567
+ intel_cx0_get_pclk_refclk_request (both_lanes ?
2568
+ INTEL_CX0_BOTH_LANES :
2569
+ INTEL_CX0_LANE0 ),
2561
2570
intel_cx0_get_pclk_refclk_request (lane_mask ));
2562
2571
2563
2572
if (__intel_de_wait_for_register (i915 , XELPDP_PORT_CLOCK_CTL (port ),
2564
- intel_cx0_get_pclk_refclk_ack (INTEL_CX0_BOTH_LANES ),
2573
+ intel_cx0_get_pclk_refclk_ack (both_lanes ?
2574
+ INTEL_CX0_BOTH_LANES :
2575
+ INTEL_CX0_LANE0 ),
2565
2576
intel_cx0_get_pclk_refclk_ack (lane_mask ),
2566
2577
XELPDP_REFCLK_ENABLE_TIMEOUT_US , 0 , NULL ))
2567
2578
drm_warn (& i915 -> drm , "PHY %c failed to request refclk after %dus.\n" ,
@@ -2571,13 +2582,9 @@ static void intel_cx0_phy_lane_reset(struct drm_i915_private *i915, enum port po
2571
2582
CX0_P2_STATE_RESET );
2572
2583
intel_cx0_setup_powerdown (i915 , port );
2573
2584
2574
- intel_de_rmw (i915 , XELPDP_PORT_BUF_CTL2 (port ),
2575
- XELPDP_LANE_PIPE_RESET (0 ) | XELPDP_LANE_PIPE_RESET (1 ),
2576
- 0 );
2585
+ intel_de_rmw (i915 , XELPDP_PORT_BUF_CTL2 (port ), lane_pipe_reset , 0 );
2577
2586
2578
- if (intel_de_wait_for_clear (i915 , XELPDP_PORT_BUF_CTL2 (port ),
2579
- XELPDP_LANE_PHY_CURRENT_STATUS (0 ) |
2580
- XELPDP_LANE_PHY_CURRENT_STATUS (1 ),
2587
+ if (intel_de_wait_for_clear (i915 , XELPDP_PORT_BUF_CTL2 (port ), lane_phy_current_status ,
2581
2588
XELPDP_PORT_RESET_END_TIMEOUT ))
2582
2589
drm_warn (& i915 -> drm , "PHY %c failed to bring out of Lane reset after %dms.\n" ,
2583
2590
phy_name (phy ), XELPDP_PORT_RESET_END_TIMEOUT );
@@ -2705,7 +2712,7 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
2705
2712
intel_program_port_clock_ctl (encoder , crtc_state , lane_reversal );
2706
2713
2707
2714
/* 2. Bring PHY out of reset. */
2708
- intel_cx0_phy_lane_reset (i915 , encoder -> port , lane_reversal );
2715
+ intel_cx0_phy_lane_reset (i915 , encoder , lane_reversal );
2709
2716
2710
2717
/*
2711
2718
* 3. Change Phy power state to Ready.
0 commit comments