* [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
@ 2013-09-05 9:45 wei_wang
2013-09-05 10:48 ` Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: wei_wang @ 2013-09-05 9:45 UTC (permalink / raw)
To: sameo; +Cc: devel, linux-kernel, gregkh, rogerable, micky_ching, Wei WANG
From: Wei WANG <wei_wang@realsil.com.cn>
In some platforms, specially Thinkpad series, rts5249 won't be
initialized properly. So we need adjust some phy parameters to
improve the compatibility issue.
Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
---
drivers/mfd/rts5249.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 3b835f5..e3c6dc1 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -130,13 +130,34 @@ 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, 0xFC6C);
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, 0x05C0);
+ if (err < 0)
+ return err;
+ err = rtsx_pci_write_phy_register(pcr, PHY_PCR, 0xBA42);
+ if (err < 0)
+ return err;
+ err = rtsx_pci_write_phy_register(pcr, PHY_RCR2, 0xC56A);
+ if (err < 0)
+ return err;
+ err = rtsx_pci_write_phy_register(pcr, PHY_FLD4, 0x78EB);
+ if (err < 0)
+ return err;
+ err = rtsx_pci_write_phy_register(pcr, PHY_RDR, 0x4000);
+ if (err < 0)
+ return err;
+ err = rtsx_pci_write_phy_register(pcr, PHY_RCR1, 0x011F);
+ if (err < 0)
+ return err;
+ err = rtsx_pci_write_phy_register(pcr, PHY_FLD3, 0x78E4);
+ if (err < 0)
+ return err;
+ return rtsx_pci_write_phy_register(pcr, PHY_TUNE, 0x4FE4);
}
static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
2013-09-05 9:45 [PATCH] mfd: rtsx: Modify rts5249_optimize_phy wei_wang
@ 2013-09-05 10:48 ` Dan Carpenter
2013-09-05 11:16 ` wwang
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-09-05 10:48 UTC (permalink / raw)
To: wei_wang; +Cc: sameo, gregkh, linux-kernel, rogerable, devel
On Thu, Sep 05, 2013 at 05:45:38PM +0800, wei_wang@realsil.com.cn wrote:
> From: Wei WANG <wei_wang@realsil.com.cn>
>
> In some platforms, specially Thinkpad series, rts5249 won't be
> initialized properly. So we need adjust some phy parameters to
> improve the compatibility issue.
>
> Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
> ---
> drivers/mfd/rts5249.c | 25 +++++++++++++++++++++++--
> 1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
> index 3b835f5..e3c6dc1 100644
> --- a/drivers/mfd/rts5249.c
> +++ b/drivers/mfd/rts5249.c
> @@ -130,13 +130,34 @@ 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, 0xFC6C);
How are we supposed to review this change? What happened to 0xFE46?
What are all these magic numbers? I understand that this fixes an issue
for think pads but does it break something else?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
2013-09-05 10:48 ` Dan Carpenter
@ 2013-09-05 11:16 ` wwang
2013-09-05 11:47 ` Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: wwang @ 2013-09-05 11:16 UTC (permalink / raw)
To: Dan Carpenter; +Cc: sameo, gregkh, linux-kernel, rogerable, devel
于 2013年09月05日 18:48, Dan Carpenter 写道:
> On Thu, Sep 05, 2013 at 05:45:38PM +0800, wei_wang@realsil.com.cn wrote:
>> From: Wei WANG <wei_wang@realsil.com.cn>
>>
>> In some platforms, specially Thinkpad series, rts5249 won't be
>> initialized properly. So we need adjust some phy parameters to
>> improve the compatibility issue.
>>
>> Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
>> ---
>> drivers/mfd/rts5249.c | 25 +++++++++++++++++++++++--
>> 1 file changed, 23 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
>> index 3b835f5..e3c6dc1 100644
>> --- a/drivers/mfd/rts5249.c
>> +++ b/drivers/mfd/rts5249.c
>> @@ -130,13 +130,34 @@ 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, 0xFC6C);
>
> How are we supposed to review this change? What happened to 0xFE46?
> What are all these magic numbers? I understand that this fixes an issue
> for think pads but does it break something else?
>
> regards,
> dan carpenter
>
> .
>
Hi Dan:
These numbers are used to configure the parameters of our internal
analog circuit. Those new values have been tested for quite a long time
with our Windows driver. So it's guaranteed and won't break other platforms.
BR,
Wei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
2013-09-05 11:16 ` wwang
@ 2013-09-05 11:47 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2013-09-05 11:47 UTC (permalink / raw)
To: wwang; +Cc: devel, gregkh, sameo, rogerable, linux-kernel
On Thu, Sep 05, 2013 at 07:16:50PM +0800, wwang wrote:
> 于 2013年09月05日 18:48, Dan Carpenter 写道:
> >On Thu, Sep 05, 2013 at 05:45:38PM +0800, wei_wang@realsil.com.cn wrote:
> >>From: Wei WANG <wei_wang@realsil.com.cn>
> >>
> >>In some platforms, specially Thinkpad series, rts5249 won't be
> >>initialized properly. So we need adjust some phy parameters to
> >>improve the compatibility issue.
> >>
> >>Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
> >>---
> >> drivers/mfd/rts5249.c | 25 +++++++++++++++++++++++--
> >> 1 file changed, 23 insertions(+), 2 deletions(-)
> >>
> >>diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
> >>index 3b835f5..e3c6dc1 100644
> >>--- a/drivers/mfd/rts5249.c
> >>+++ b/drivers/mfd/rts5249.c
> >>@@ -130,13 +130,34 @@ 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, 0xFC6C);
> >
> >How are we supposed to review this change? What happened to 0xFE46?
> >What are all these magic numbers? I understand that this fixes an issue
> >for think pads but does it break something else?
> >
> >regards,
> >dan carpenter
> >
> >.
> >
> Hi Dan:
>
> These numbers are used to configure the parameters of our internal
> analog circuit. Those new values have been tested for quite a long
> time with our Windows driver. So it's guaranteed and won't break
> other platforms.
>
Give them human readable names so we at least have some idea about what
they are trying to do.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
2013-09-10 9:11 ` wwang
@ 2013-09-10 9:45 ` Lee Jones
0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2013-09-10 9:45 UTC (permalink / raw)
To: wwang; +Cc: sameo, devel, linux-kernel, gregkh, rogerable, micky_ching
On Tue, 10 Sep 2013, wwang wrote:
> 于 2013年09月10日 17:09, wei_wang@realsil.com.cn 写道:
> > From: Wei WANG <wei_wang@realsil.com.cn>
> >
> > In some platforms, specially Thinkpad series, rts5249 won't be
> > initialized properly. So we need adjust some phy parameters to
> > improve the compatibility issue.
>
> Hi all:
>
> Sorry, forget to modify the subject prefix. Please ignore this patch. I
> will resend another one.
Although it's important to put the version in the subject line of
resubmissions, it's probably not important enough to send twice. :)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
2013-09-10 9:09 wei_wang
@ 2013-09-10 9:11 ` wwang
2013-09-10 9:45 ` Lee Jones
0 siblings, 1 reply; 7+ messages in thread
From: wwang @ 2013-09-10 9:11 UTC (permalink / raw)
To: wei_wang; +Cc: sameo, devel, linux-kernel, gregkh, rogerable, micky_ching
于 2013年09月10日 17:09, wei_wang@realsil.com.cn 写道:
> From: Wei WANG <wei_wang@realsil.com.cn>
>
> In some platforms, specially Thinkpad series, rts5249 won't be
> initialized properly. So we need adjust some phy parameters to
> improve the compatibility issue.
Hi all:
Sorry, forget to modify the subject prefix. Please ignore this patch. I
will resend another one.
BR,
Wei
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mfd: rtsx: Modify rts5249_optimize_phy
@ 2013-09-10 9:09 wei_wang
2013-09-10 9:11 ` wwang
0 siblings, 1 reply; 7+ messages in thread
From: wei_wang @ 2013-09-10 9:09 UTC (permalink / raw)
To: sameo; +Cc: devel, linux-kernel, gregkh, rogerable, micky_ching, Wei WANG
From: Wei WANG <wei_wang@realsil.com.cn>
In some platforms, specially Thinkpad series, rts5249 won't be
initialized properly. So we need adjust some phy parameters to
improve the compatibility issue.
Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
---
drivers/mfd/rts5249.c | 48 ++++++++++++++++++++++++++++++++++++--
include/linux/mfd/rtsx_pci.h | 53 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 99 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 3b835f5..573de7b 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -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)
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index d1382df..0ce7721 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -756,6 +756,59 @@
#define PCR_SETTING_REG2 0x814
#define PCR_SETTING_REG3 0x747
+/* Phy bits */
+#define PHY_PCR_FORCE_CODE 0xB000
+#define PHY_PCR_OOBS_CALI_50 0x0800
+#define PHY_PCR_OOBS_VCM_08 0x0200
+#define PHY_PCR_OOBS_SEN_90 0x0040
+#define PHY_PCR_RSSI_EN 0x0002
+
+#define PHY_RCR1_ADP_TIME 0x0100
+#define PHY_RCR1_VCO_COARSE 0x001F
+
+#define PHY_RCR2_EMPHASE_EN 0x8000
+#define PHY_RCR2_NADJR 0x4000
+#define PHY_RCR2_CDR_CP_10 0x0400
+#define PHY_RCR2_CDR_SR_2 0x0100
+#define PHY_RCR2_FREQSEL_12 0x0040
+#define PHY_RCR2_CPADJEN 0x0020
+#define PHY_RCR2_CDR_SC_8 0x0008
+#define PHY_RCR2_CALIB_LATE 0x0002
+
+#define PHY_RDR_RXDSEL_1_9 0x4000
+
+#define PHY_TUNE_TUNEREF_1_0 0x4000
+#define PHY_TUNE_VBGSEL_1252 0x0C00
+#define PHY_TUNE_SDBUS_33 0x0200
+#define PHY_TUNE_TUNED18 0x01C0
+#define PHY_TUNE_TUNED12 0X0020
+
+#define PHY_BPCR_IBRXSEL 0x0400
+#define PHY_BPCR_IBTXSEL 0x0100
+#define PHY_BPCR_IB_FILTER 0x0080
+#define PHY_BPCR_CMIRROR_EN 0x0040
+
+#define PHY_REG_REV_RESV 0xE000
+#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
+#define PHY_REG_REV_P1_EN 0x0800
+#define PHY_REG_REV_RXIDLE_EN 0x0400
+#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
+#define PHY_REG_REV_STOP_CLKRD 0x0020
+#define PHY_REG_REV_RX_PWST 0x0008
+#define PHY_REG_REV_STOP_CLKWR 0x0004
+
+#define PHY_FLD3_TIMER_4 0x7800
+#define PHY_FLD3_TIMER_6 0x00E0
+#define PHY_FLD3_RXDELINK 0x0004
+
+#define PHY_FLD4_FLDEN_SEL 0x4000
+#define PHY_FLD4_REQ_REF 0x2000
+#define PHY_FLD4_RXAMP_OFF 0x1000
+#define PHY_FLD4_REQ_ADDA 0x0800
+#define PHY_FLD4_BER_COUNT 0x00E0
+#define PHY_FLD4_BER_TIMER 0x000A
+#define PHY_FLD4_BER_CHK_EN 0x0001
+
#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
struct rtsx_pcr;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-10 9:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-05 9:45 [PATCH] mfd: rtsx: Modify rts5249_optimize_phy wei_wang
2013-09-05 10:48 ` Dan Carpenter
2013-09-05 11:16 ` wwang
2013-09-05 11:47 ` Dan Carpenter
2013-09-10 9:09 wei_wang
2013-09-10 9:11 ` wwang
2013-09-10 9:45 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).