drm/amd/display: support CP2520 pattern 2 for HBR2 compliance

- also some clean up

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Tony Cheng 2017-03-14 16:30:06 -04:00 committed by Alex Deucher
parent e73c1efca8
commit 3f8a944016
3 changed files with 66 additions and 95 deletions

View File

@ -169,9 +169,6 @@ static void disable_prbs_symbols(
static void disable_prbs_mode( static void disable_prbs_mode(
struct dce110_link_encoder *enc110) struct dce110_link_encoder *enc110)
{ {
/* This register resides in DP back end block;
* transmitter is used for the offset */
REG_UPDATE(DP_DPHY_PRBS_CNTL, DPHY_PRBS_EN, 0); REG_UPDATE(DP_DPHY_PRBS_CNTL, DPHY_PRBS_EN, 0);
} }
@ -216,9 +213,7 @@ static void set_dp_phy_pattern_d102(
disable_prbs_symbols(enc110, true); disable_prbs_symbols(enc110, true);
/* Disable PRBS mode, /* Disable PRBS mode */
* make sure DPHY_PRBS_CNTL.DPHY_PRBS_EN=0 */
disable_prbs_mode(enc110); disable_prbs_mode(enc110);
/* Program debug symbols to be output */ /* Program debug symbols to be output */
@ -264,43 +259,54 @@ void dce110_link_encoder_set_dp_phy_pattern_training_pattern(
enable_phy_bypass_mode(enc110, false); enable_phy_bypass_mode(enc110, false);
/* Disable PRBS mode, /* Disable PRBS mode */
* make sure DPHY_PRBS_CNTL.DPHY_PRBS_EN=0 */
disable_prbs_mode(enc110); disable_prbs_mode(enc110);
} }
static void setup_panel_mode(
struct dce110_link_encoder *enc110,
enum dp_panel_mode panel_mode)
{
uint32_t value;
ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
value = REG_READ(DP_DPHY_INTERNAL_CTRL);
switch (panel_mode) {
case DP_PANEL_MODE_EDP:
value = 0x1;
break;
case DP_PANEL_MODE_SPECIAL:
value = 0x11;
break;
default:
value = 0x0;
break;
}
REG_WRITE(DP_DPHY_INTERNAL_CTRL, value);
}
static void set_dp_phy_pattern_symbol_error( static void set_dp_phy_pattern_symbol_error(
struct dce110_link_encoder *enc110) struct dce110_link_encoder *enc110)
{ {
/* Disable PHY Bypass mode to setup the test pattern */ /* Disable PHY Bypass mode to setup the test pattern */
uint32_t value = 0x0;
enable_phy_bypass_mode(enc110, false); enable_phy_bypass_mode(enc110, false);
/* program correct panel mode*/ /* program correct panel mode*/
{ setup_panel_mode(enc110, DP_PANEL_MODE_DEFAULT);
ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
/*DCE 120 does not have this reg*/
REG_WRITE(DP_DPHY_INTERNAL_CTRL, value);
}
/* A PRBS23 pattern is used for most DP electrical measurements. */ /* A PRBS23 pattern is used for most DP electrical measurements. */
/* Enable PRBS symbols on the lanes */ /* Enable PRBS symbols on the lanes */
disable_prbs_symbols(enc110, false); disable_prbs_symbols(enc110, false);
/* For PRBS23 Set bit DPHY_PRBS_SEL=1 and Set bit DPHY_PRBS_EN=1 */ /* For PRBS23 Set bit DPHY_PRBS_SEL=1 and Set bit DPHY_PRBS_EN=1 */
{ REG_UPDATE_2(DP_DPHY_PRBS_CNTL,
REG_UPDATE_2(DP_DPHY_PRBS_CNTL, DPHY_PRBS_SEL, 1,
DPHY_PRBS_SEL, 1, DPHY_PRBS_EN, 1);
DPHY_PRBS_EN, 1);
}
/* Enable phy bypass mode to enable the test pattern */ /* Enable phy bypass mode to enable the test pattern */
enable_phy_bypass_mode(enc110, true); enable_phy_bypass_mode(enc110, true);
} }
@ -308,24 +314,19 @@ static void set_dp_phy_pattern_prbs7(
struct dce110_link_encoder *enc110) struct dce110_link_encoder *enc110)
{ {
/* Disable PHY Bypass mode to setup the test pattern */ /* Disable PHY Bypass mode to setup the test pattern */
enable_phy_bypass_mode(enc110, false); enable_phy_bypass_mode(enc110, false);
/* A PRBS7 pattern is used for most DP electrical measurements. */ /* A PRBS7 pattern is used for most DP electrical measurements. */
/* Enable PRBS symbols on the lanes */ /* Enable PRBS symbols on the lanes */
disable_prbs_symbols(enc110, false); disable_prbs_symbols(enc110, false);
/* For PRBS7 Set bit DPHY_PRBS_SEL=0 and Set bit DPHY_PRBS_EN=1 */ /* For PRBS7 Set bit DPHY_PRBS_SEL=0 and Set bit DPHY_PRBS_EN=1 */
{ REG_UPDATE_2(DP_DPHY_PRBS_CNTL,
REG_UPDATE_2(DP_DPHY_PRBS_CNTL, DPHY_PRBS_SEL, 0,
DPHY_PRBS_SEL, 0, DPHY_PRBS_EN, 1);
DPHY_PRBS_EN, 1);
}
/* Enable phy bypass mode to enable the test pattern */ /* Enable phy bypass mode to enable the test pattern */
enable_phy_bypass_mode(enc110, true); enable_phy_bypass_mode(enc110, true);
} }
@ -374,7 +375,7 @@ static void set_dp_phy_pattern_80bit_custom(
enable_phy_bypass_mode(enc110, true); enable_phy_bypass_mode(enc110, true);
} }
static void set_dp_phy_pattern_hbr2_compliance( static void set_dp_phy_pattern_hbr2_compliance_cp2520_2(
struct dce110_link_encoder *enc110) struct dce110_link_encoder *enc110)
{ {
@ -391,56 +392,34 @@ static void set_dp_phy_pattern_hbr2_compliance(
enable_phy_bypass_mode(enc110, false); enable_phy_bypass_mode(enc110, false);
/* Setup DIG encoder in DP SST mode */ /* Setup DIG encoder in DP SST mode */
enc110->base.funcs->setup(&enc110->base, SIGNAL_TYPE_DISPLAY_PORT); enc110->base.funcs->setup(&enc110->base, SIGNAL_TYPE_DISPLAY_PORT);
/* program correct panel mode*/ /* ensure normal panel mode. */
{ setup_panel_mode(enc110, DP_PANEL_MODE_DEFAULT);
ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
REG_WRITE(DP_DPHY_INTERNAL_CTRL, 0x0);
}
/* no vbid after BS (SR) /* no vbid after BS (SR)
* DP_LINK_FRAMING_CNTL changed history Sandra Liu * DP_LINK_FRAMING_CNTL changed history Sandra Liu
* 11000260 / 11000104 / 110000FC */ * 11000260 / 11000104 / 110000FC */
REG_UPDATE_3(DP_LINK_FRAMING_CNTL,
DP_IDLE_BS_INTERVAL, 0xFC,
DP_VBID_DISABLE, 1,
DP_VID_ENHANCED_FRAME_MODE, 1);
/* TODO DP_LINK_FRAMING_CNTL should always use hardware default value
* output except output hbr2_compliance pattern for physical PHY
* measurement. This is not normal usage case. SW should reset this
* register to hardware default value after end use of HBR2 eye
*/
BREAK_TO_DEBUGGER();
/* TODO: do we still need this, find out at compliance test
addr = mmDP_LINK_FRAMING_CNTL + fe_addr_offset;
value = dal_read_reg(ctx, addr);
set_reg_field_value(value, 0xFC,
DP_LINK_FRAMING_CNTL, DP_IDLE_BS_INTERVAL);
set_reg_field_value(value, 1,
DP_LINK_FRAMING_CNTL, DP_VBID_DISABLE);
set_reg_field_value(value, 1,
DP_LINK_FRAMING_CNTL, DP_VID_ENHANCED_FRAME_MODE);
dal_write_reg(ctx, addr, value);
*/
/* swap every BS with SR */ /* swap every BS with SR */
REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0); REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0);
/*TODO add support for this test pattern /* select cp2520 pattern 2 */
* support_dp_hbr2_eye_pattern if (REG(DP_DPHY_HBR2_PATTERN_CONTROL))
*/ REG_UPDATE(DP_DPHY_HBR2_PATTERN_CONTROL,
DP_DPHY_HBR2_PATTERN_CONTROL, 0x2);
/* set link training complete */ /* set link training complete */
set_link_training_complete(enc110, true); set_link_training_complete(enc110, true);
/* do not enable video stream */
/* disable video stream */
REG_UPDATE(DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, 0); REG_UPDATE(DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, 0);
/* Disable PHY Bypass mode to setup the test pattern */ /* Disable PHY Bypass mode to setup the test pattern */
enable_phy_bypass_mode(enc110, false); enable_phy_bypass_mode(enc110, false);
} }
@ -448,41 +427,26 @@ static void set_dp_phy_pattern_passthrough_mode(
struct dce110_link_encoder *enc110, struct dce110_link_encoder *enc110,
enum dp_panel_mode panel_mode) enum dp_panel_mode panel_mode)
{ {
uint32_t value;
/* program correct panel mode */ /* program correct panel mode */
{ setup_panel_mode(enc110, panel_mode);
ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
value = REG_READ(DP_DPHY_INTERNAL_CTRL);
switch (panel_mode) { /* restore LINK_FRAMING_CNTL and DPHY_SCRAMBLER_BS_COUNT
case DP_PANEL_MODE_EDP: * in case we were doing HBR2 compliance pattern before
value = 0x1; */
break; REG_UPDATE_3(DP_LINK_FRAMING_CNTL,
case DP_PANEL_MODE_SPECIAL: DP_IDLE_BS_INTERVAL, 0x2000,
value = 0x11; DP_VBID_DISABLE, 0,
break; DP_VID_ENHANCED_FRAME_MODE, 1);
default:
value = 0x0;
break;
}
REG_WRITE(DP_DPHY_INTERNAL_CTRL, value);
}
REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0x1FF); REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0x1FF);
/* set link training complete */ /* set link training complete */
set_link_training_complete(enc110, true); set_link_training_complete(enc110, true);
/* Disable PHY Bypass mode to setup the test pattern */ /* Disable PHY Bypass mode to setup the test pattern */
enable_phy_bypass_mode(enc110, false); enable_phy_bypass_mode(enc110, false);
/* Disable PRBS mode, /* Disable PRBS mode */
* make sure DPHY_PRBS_CNTL.DPHY_PRBS_EN=0 */
disable_prbs_mode(enc110); disable_prbs_mode(enc110);
} }
@ -828,8 +792,7 @@ static void link_encoder_disable(struct dce110_link_encoder *enc110)
REG_UPDATE(DP_LINK_CNTL, DP_LINK_TRAINING_COMPLETE, 0); REG_UPDATE(DP_LINK_CNTL, DP_LINK_TRAINING_COMPLETE, 0);
/* reset panel mode */ /* reset panel mode */
ASSERT(REG(DP_DPHY_INTERNAL_CTRL)); setup_panel_mode(enc110, DP_PANEL_MODE_DEFAULT);
REG_WRITE(DP_DPHY_INTERNAL_CTRL, 0);
} }
static void hpd_initialize( static void hpd_initialize(
@ -1433,7 +1396,7 @@ void dce110_link_encoder_dp_set_phy_pattern(
enc110, param->custom_pattern); enc110, param->custom_pattern);
break; break;
case DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE: case DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE:
set_dp_phy_pattern_hbr2_compliance(enc110); set_dp_phy_pattern_hbr2_compliance_cp2520_2(enc110);
break; break;
case DP_TEST_PATTERN_VIDEO_MODE: { case DP_TEST_PATTERN_VIDEO_MODE: {
set_dp_phy_pattern_passthrough_mode( set_dp_phy_pattern_passthrough_mode(

View File

@ -78,22 +78,29 @@
SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \ SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
SR(DCI_MEM_PWR_STATUS) SR(DCI_MEM_PWR_STATUS)
#define LE_DCE100_REG_LIST(id)\
LE_COMMON_REG_LIST_BASE(id), \
SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
SR(DCI_MEM_PWR_STATUS)
#define LE_DCE110_REG_LIST(id)\ #define LE_DCE110_REG_LIST(id)\
LE_COMMON_REG_LIST_BASE(id), \ LE_COMMON_REG_LIST_BASE(id), \
SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \ SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \ SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
SR(DCI_MEM_PWR_STATUS) SR(DCI_MEM_PWR_STATUS)
#define LE_DCE120_REG_LIST(id)\ #define LE_DCE120_REG_LIST(id)\
LE_COMMON_REG_LIST_BASE(id), \ LE_COMMON_REG_LIST_BASE(id), \
SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \ SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
SR(DCI_MEM_PWR_STATUS) SR(DCI_MEM_PWR_STATUS)
#define LE_DCE80_REG_LIST(id)\ #define LE_DCE80_REG_LIST(id)\
SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \ SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
LE_COMMON_REG_LIST_BASE(id) LE_COMMON_REG_LIST_BASE(id)
struct dce110_link_enc_aux_registers { struct dce110_link_enc_aux_registers {
uint32_t AUX_CONTROL; uint32_t AUX_CONTROL;
uint32_t AUX_DPHY_RX_CONTROL0; uint32_t AUX_DPHY_RX_CONTROL0;
@ -144,6 +151,7 @@ struct dce110_link_enc_registers {
uint32_t DP_VID_STREAM_CNTL; uint32_t DP_VID_STREAM_CNTL;
uint32_t DP_DPHY_FAST_TRAINING; uint32_t DP_DPHY_FAST_TRAINING;
uint32_t DP_DPHY_BS_SR_SWAP_CNTL; uint32_t DP_DPHY_BS_SR_SWAP_CNTL;
uint32_t DP_DPHY_HBR2_PATTERN_CONTROL;
uint32_t DP_SEC_CNTL1; uint32_t DP_SEC_CNTL1;
}; };

View File

@ -265,7 +265,7 @@ static const struct dce110_link_enc_hpd_registers link_enc_hpd_regs[] = {
#define link_regs(id)\ #define link_regs(id)\
[id] = {\ [id] = {\
LE_DCE110_REG_LIST(id)\ LE_DCE100_REG_LIST(id)\
} }
static const struct dce110_link_enc_registers link_enc_regs[] = { static const struct dce110_link_enc_registers link_enc_regs[] = {