2013-09-05 09:46:41

by wwang

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Wei WANG <[email protected]>
---
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


2013-09-05 10:48:37

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy

On Thu, Sep 05, 2013 at 05:45:38PM +0800, [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.
>
> Signed-off-by: Wei WANG <[email protected]>
> ---
> 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

2013-09-05 11:17:09

by wwang

[permalink] [raw]
Subject: Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy

于 2013年09月05日 18:48, Dan Carpenter 写道:
> On Thu, Sep 05, 2013 at 05:45:38PM +0800, [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.
>>
>> Signed-off-by: Wei WANG <[email protected]>
>> ---
>> 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

2013-09-05 11:47:27

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] mfd: rtsx: Modify rts5249_optimize_phy

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, [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.
> >>
> >>Signed-off-by: Wei WANG <[email protected]>
> >>---
> >> 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