mfd: rtsx: Modify rts5249_optimize_phy
PATCH v4 1/1 mfd: rtsx: Modify rts5249_optimize_phy
From: Wei WANG <[email protected]>
In some platforms, specially Thinkpad series, rts5249 won't be initialized properly. So we need adjust some phy parameters to improve the compatibility issue.
It is a little different between simulation and real chip. We have no idea about which configuration is better before tape-out. We set default settings according to simulation, but need to tune these parameters after getting the real chip.
I can't explain every change in detail here. The below information is just a rough description:
PHY_REG_REV: Disable internal clkreq_tx, enable rx_pwstPHY_BPCR: No change, just turn the magic number to macro definitionsPHY_PCR: Change OOBS sensitivity, from 60mV to 90mVPHY_RCR2: Control charge-pump current automaticallyPHY_FLD4: Use TX cmu reference clockPHY_RDR: Change RXDSEL from 30nF to 1.9nFPHY_RCR1: Change the duration between adp_st and asserting cp_en from 0.32 us to 0.64usPHY_FLD3: Adjust internal timersPHY_TUNE: Fine tune the regulator12 output voltage
--- drivers/mfd/rts5249.c | 48 ++++++++++++++++++++++++++++++++++++-- include/linux/mfd/rtsx_pci.h | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-)
drivers/mfd/rts5249.c +46 -2
@@ -130,13 +130,57 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) {int err; - err =rtsx_pci_write_phy_register (pcr,PHY_REG_REV ,0xFE46 ); + err =rtsx_pci_write_phy_register (pcr,PHY_REG_REV , +PHY_REG_REV_RESV |PHY_REG_REV_RXIDLE_LATCHED | +PHY_REG_REV_P1_EN |PHY_REG_REV_RXIDLE_EN | +PHY_REG_REV_RX_PWST |PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 | +PHY_REG_REV_STOP_CLKRD |PHY_REG_REV_STOP_CLKWR );if (err <0 )return err;msleep (1 ); -return rtsx_pci_write_phy_register (pcr,PHY_BPCR ,0x05C0 ); + err =rtsx_pci_write_phy_register (pcr,PHY_BPCR , +PHY_BPCR_IBRXSEL |PHY_BPCR_IBTXSEL | +PHY_BPCR_IB_FILTER |PHY_BPCR_CMIRROR_EN ); +if (err <0 ) +return err; + err =rtsx_pci_write_phy_register (pcr,PHY_PCR , +PHY_PCR_FORCE_CODE |PHY_PCR_OOBS_CALI_50 | +PHY_PCR_OOBS_VCM_08 |PHY_PCR_OOBS_SEN_90 | +PHY_PCR_RSSI_EN ); +if (err <0 ) +return err; + err =rtsx_pci_write_phy_register (pcr,PHY_RCR2 , +PHY_RCR2_EMPHASE_EN |PHY_RCR2_NADJR | +PHY_RCR2_CDR_CP_10 |PHY_RCR2_CDR_SR_2 | +PHY_RCR2_FREQSEL_12 |PHY_RCR2_CPADJEN | +PHY_RCR2_CDR_SC_8 |PHY_RCR2_CALIB_LATE ); +if (err <0 ) +return err; + err =rtsx_pci_write_phy_register (pcr,PHY_FLD4 , +PHY_FLD4_FLDEN_SEL |PHY_FLD4_REQ_REF | +PHY_FLD4_RXAMP_OFF |PHY_FLD4_REQ_ADDA | +PHY_FLD4_BER_COUNT |PHY_FLD4_BER_TIMER | +PHY_FLD4_BER_CHK_EN ); +if (err <0 ) +return err; + err =rtsx_pci_write_phy_register (pcr,PHY_RDR ,PHY_RDR_RXDSEL_1_9 ); +if (err <0 ) +return err; + err =rtsx_pci_write_phy_register (pcr,PHY_RCR1 , +PHY_RCR1_ADP_TIME |PHY_RCR1_VCO_COARSE ); +if (err <0 ) +return err; + err =rtsx_pci_write_phy_register (pcr,PHY_FLD3 , +PHY_FLD3_TIMER_4 |PHY_FLD3_TIMER_6 | +PHY_FLD3_RXDELINK ); +if (err <0 ) +return err; +return rtsx_pci_write_phy_register (pcr,PHY_TUNE , +PHY_TUNE_TUNEREF_1_0 |PHY_TUNE_VBGSEL_1252 | +PHY_TUNE_SDBUS_33 |PHY_TUNE_TUNED18 | +PHY_TUNE_TUNED12 ); }static int rts5249_turn_on_led (struct rtsx_pcr *pcr)
include/linux/mfd/rtsx_pci.h +53 -0
59 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Lee Jones
AppliedQuoted 25 lines · On Fri, 13 Sep 2013, [email protected] wrote:
From: Wei WANG <[email protected]>
In some platforms, specially Thinkpad series, rts5249 won't be initialized properly. So we need adjust some phy parameters to improve the compatibility issue.
It is a little different between simulation and real chip. We have no idea about which configuration is better before tape-out. We set default settings according to simulation, but need to tune these parameters after getting the real chip.
I can't explain every change in detail here. The below information is just a rough description:
PHY_REG_REV: Disable internalclkreq_tx, enablerx_pwstPHY_BPCR: No change, just turn the magic number to macro definitionsPHY_PCR: Change OOBS sensitivity, from 60mV to 90mVPHY_RCR2: Control charge-pump current automaticallyPHY_FLD4: Use TX cmu reference clockPHY_RDR: Change RXDSEL from 30nF to 1.9nFPHY_RCR1: Change the duration betweenadp_stand assertingcp_enfrom 0.32 us to 0.64usPHY_FLD3: Adjust internal timersPHY_TUNE: Fine tune the regulator12 output voltage
Quoted 5 lines
Signed-off-by Wei WANG <[email protected]>--- drivers/mfd/rts5249.c | 48 ++++++++++++++++++++++++++++++++++++-- include/linux/mfd/rtsx_pci.h | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-)
Much better.
Applied, thanks.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog