aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei WANG <wei_wang@realsil.com.cn>2013-09-13 05:45:43 -0400
committerLee Jones <lee.jones@linaro.org>2013-10-23 11:20:59 -0400
commit26b818511c6562ce372566c219a2ef1afea35fe6 (patch)
treec6fc61d336ddea8d72dd8b6deb6cd1ec435bc5b8
parent7902fe8cbc58ae2bd3dad1a8ecf28ce83b1ba3a8 (diff)
mfd: rtsx: Modify rts5249_optimize_phy
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_pwst PHY_BPCR: No change, just turn the magic number to macro definitions PHY_PCR: Change OOBS sensitivity, from 60mV to 90mV PHY_RCR2: Control charge-pump current automatically PHY_FLD4: Use TX cmu reference clock PHY_RDR: Change RXDSEL from 30nF to 1.9nF PHY_RCR1: Change the duration between adp_st and asserting cp_en from 0.32 us to 0.64us PHY_FLD3: Adjust internal timers PHY_TUNE: Fine tune the regulator12 output voltage Signed-off-by: Wei WANG <wei_wang@realsil.com.cn> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/rts5249.c48
-rw-r--r--include/linux/mfd/rtsx_pci.h53
2 files changed, 99 insertions, 2 deletions
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 3b835f593e35..573de7bfcced 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -130,13 +130,57 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
130{ 130{
131 int err; 131 int err;
132 132
133 err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, 0xFE46); 133 err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV,
134 PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED |
135 PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN |
136 PHY_REG_REV_RX_PWST | PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 |
137 PHY_REG_REV_STOP_CLKRD | PHY_REG_REV_STOP_CLKWR);
134 if (err < 0) 138 if (err < 0)
135 return err; 139 return err;
136 140
137 msleep(1); 141 msleep(1);
138 142
139 return rtsx_pci_write_phy_register(pcr, PHY_BPCR, 0x05C0); 143 err = rtsx_pci_write_phy_register(pcr, PHY_BPCR,
144 PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL |
145 PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN);
146 if (err < 0)
147 return err;
148 err = rtsx_pci_write_phy_register(pcr, PHY_PCR,
149 PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 |
150 PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 |
151 PHY_PCR_RSSI_EN);
152 if (err < 0)
153 return err;
154 err = rtsx_pci_write_phy_register(pcr, PHY_RCR2,
155 PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR |
156 PHY_RCR2_CDR_CP_10 | PHY_RCR2_CDR_SR_2 |
157 PHY_RCR2_FREQSEL_12 | PHY_RCR2_CPADJEN |
158 PHY_RCR2_CDR_SC_8 | PHY_RCR2_CALIB_LATE);
159 if (err < 0)
160 return err;
161 err = rtsx_pci_write_phy_register(pcr, PHY_FLD4,
162 PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF |
163 PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA |
164 PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER |
165 PHY_FLD4_BER_CHK_EN);
166 if (err < 0)
167 return err;
168 err = rtsx_pci_write_phy_register(pcr, PHY_RDR, PHY_RDR_RXDSEL_1_9);
169 if (err < 0)
170 return err;
171 err = rtsx_pci_write_phy_register(pcr, PHY_RCR1,
172 PHY_RCR1_ADP_TIME | PHY_RCR1_VCO_COARSE);
173 if (err < 0)
174 return err;
175 err = rtsx_pci_write_phy_register(pcr, PHY_FLD3,
176 PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 |
177 PHY_FLD3_RXDELINK);
178 if (err < 0)
179 return err;
180 return rtsx_pci_write_phy_register(pcr, PHY_TUNE,
181 PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 |
182 PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 |
183 PHY_TUNE_TUNED12);
140} 184}
141 185
142static int rts5249_turn_on_led(struct rtsx_pcr *pcr) 186static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index d1382dfbeff0..0ce772105508 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -756,6 +756,59 @@
756#define PCR_SETTING_REG2 0x814 756#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747 757#define PCR_SETTING_REG3 0x747
758 758
759/* Phy bits */
760#define PHY_PCR_FORCE_CODE 0xB000
761#define PHY_PCR_OOBS_CALI_50 0x0800
762#define PHY_PCR_OOBS_VCM_08 0x0200
763#define PHY_PCR_OOBS_SEN_90 0x0040
764#define PHY_PCR_RSSI_EN 0x0002
765
766#define PHY_RCR1_ADP_TIME 0x0100
767#define PHY_RCR1_VCO_COARSE 0x001F
768
769#define PHY_RCR2_EMPHASE_EN 0x8000
770#define PHY_RCR2_NADJR 0x4000
771#define PHY_RCR2_CDR_CP_10 0x0400
772#define PHY_RCR2_CDR_SR_2 0x0100
773#define PHY_RCR2_FREQSEL_12 0x0040
774#define PHY_RCR2_CPADJEN 0x0020
775#define PHY_RCR2_CDR_SC_8 0x0008
776#define PHY_RCR2_CALIB_LATE 0x0002
777
778#define PHY_RDR_RXDSEL_1_9 0x4000
779
780#define PHY_TUNE_TUNEREF_1_0 0x4000
781#define PHY_TUNE_VBGSEL_1252 0x0C00
782#define PHY_TUNE_SDBUS_33 0x0200
783#define PHY_TUNE_TUNED18 0x01C0
784#define PHY_TUNE_TUNED12 0X0020
785
786#define PHY_BPCR_IBRXSEL 0x0400
787#define PHY_BPCR_IBTXSEL 0x0100
788#define PHY_BPCR_IB_FILTER 0x0080
789#define PHY_BPCR_CMIRROR_EN 0x0040
790
791#define PHY_REG_REV_RESV 0xE000
792#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
793#define PHY_REG_REV_P1_EN 0x0800
794#define PHY_REG_REV_RXIDLE_EN 0x0400
795#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
796#define PHY_REG_REV_STOP_CLKRD 0x0020
797#define PHY_REG_REV_RX_PWST 0x0008
798#define PHY_REG_REV_STOP_CLKWR 0x0004
799
800#define PHY_FLD3_TIMER_4 0x7800
801#define PHY_FLD3_TIMER_6 0x00E0
802#define PHY_FLD3_RXDELINK 0x0004
803
804#define PHY_FLD4_FLDEN_SEL 0x4000
805#define PHY_FLD4_REQ_REF 0x2000
806#define PHY_FLD4_RXAMP_OFF 0x1000
807#define PHY_FLD4_REQ_ADDA 0x0800
808#define PHY_FLD4_BER_COUNT 0x00E0
809#define PHY_FLD4_BER_TIMER 0x000A
810#define PHY_FLD4_BER_CHK_EN 0x0001
811
759#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 812#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
760 813
761struct rtsx_pcr; 814struct rtsx_pcr;