Skip to contentSkip to conversation

mfd: rtsx: Modify rts5249_optimize_phy

PATCH Superseded [email protected] 2 participants 6 messages Sep 6, 2013 – Sep 10, 2013 Multifunction devices (MFD)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mfd: rtsx: Modify rts5249_optimize_phy

From: Wei WANG <[email protected]>

v2:
Name those new-added register values

Wei WANG (1):
mfd: rtsx: Modify rts5249_optimize_phy

 drivers/mfd/rts5249.c        |   35 ++++++++++++++++++++++++++++++++--
 include/linux/mfd/rtsx_pci.h |   43 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 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.

---
 drivers/mfd/rts5249.c        |   35 ++++++++++++++++++++++++++++++++--
 include/linux/mfd/rtsx_pci.h |   43 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)
drivers/mfd/rts5249.c +33 -2
index 3b835f5..7653638 100644
@@ -130,13 +130,44 @@ 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, REG_REV_RESV |
+			RXIDLE_LATCHED | P1_EN | RXIDLE_EN | RX_PWST |
+			CLKREQ_DLY_TIMER_1_0 | STOP_CLKRD | 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, IBRXSEL | IBTXSEL |
+			IB_FILTER | CMIRROR_EN);
+	if (err < 0)
+		return err;
+	err = rtsx_pci_write_phy_register(pcr, PHY_PCR, FORCE_CODE |
+			OOBS_CALI_50 | OOBS_VCM_08 | OOBS_SEN_90 | RSSI_EN);
+	if (err < 0)
+		return err;
+	err = rtsx_pci_write_phy_register(pcr, PHY_RCR2, EMPHASE_EN | NADJR |
+			CDR_CP_10 | CDR_SR_2 | FREQSEL_12 | CPADJEN |
+			CDR_SC_8 | CALIB_LATE);
+	if (err < 0)
+		return err;
+	err = rtsx_pci_write_phy_register(pcr, PHY_FLD4, FLDEN_SEL | REQ_REF |
+			RXAMP_OFF | REQ_ADDA | BER_COUNT |
+			BER_TIMER | BER_CHK_EN);
+	if (err < 0)
+		return err;
+	err = rtsx_pci_write_phy_register(pcr, PHY_RDR, RXDSEL_1_9);
+	if (err < 0)
+		return err;
+	err = rtsx_pci_write_phy_register(pcr, PHY_RCR1, ADP_TIME | VCO_COARSE);
+	if (err < 0)
+		return err;
+	err = rtsx_pci_write_phy_register(pcr, PHY_FLD3, TIMER_4 | TIMER_6 |
+			RXDELINK);
+	if (err < 0)
+		return err;
+	return rtsx_pci_write_phy_register(pcr, PHY_TUNE, TUNEREF_1_0 |
+			VBGSEL_1252 | SDBUS_33 | TUNED18 | TUNED12);
 }
 
 static int rts5249_turn_on_led(struct rtsx_pcr *pcr)
include/linux/mfd/rtsx_pci.h +43 -0

70 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

drivers/mfd/rts5249.c

Quoted 16 lines · On Fri, 06 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.

---
 drivers/mfd/rts5249.c        |   35 ++++++++++++++++++++++++++++++++--
 include/linux/mfd/rtsx_pci.h |   43 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)
drivers/mfd/rts5249.c +0 -0
index 3b835f5..7653638 100644

Ignoring the driver code for now.

Quoted 67 lines

static int rts5249_turn_on_led(struct rtsx_pcr *pcr)

include/linux/mfd/rtsx_pci.h +36 -0
index d1382df..de20538 100644
@@ -719,16 +719,41 @@
 
 /* Phy register */
 #define PHY_PCR				0x00
+#define  FORCE_CODE			0xB000
+#define  OOBS_CALI_50			0x0800
+#define  OOBS_VCM_08			0x0200
+#define  OOBS_SEN_90			0x0040
+#define  RSSI_EN			0x0002
 #define PHY_RCR0			0x01
 #define PHY_RCR1			0x02
+#define  ADP_TIME			0x0100
+#define  VCO_COARSE			0x001F
 #define PHY_RCR2			0x03
+#define  EMPHASE_EN			0x8000
+#define  NADJR				0x4000
+#define  CDR_CP_10			0x0400
+#define  CDR_SR_2			0x0100
+#define  FREQSEL_12			0x0040
+#define  CPADJEN			0x0020
+#define  CDR_SC_8			0x0008
+#define  CALIB_LATE			0x0002
 #define PHY_RTCR			0x04
 #define PHY_RDR				0x05
+#define  RXDSEL_1_9			0x4000
 #define PHY_TCR0			0x06
 #define PHY_TCR1			0x07
 #define PHY_TUNE			0x08
+#define  TUNEREF_1_0			0x4000
+#define  VBGSEL_1252			0x0C00
+#define  SDBUS_33			0x0200
+#define  TUNED18			0x01C0
+#define  TUNED12			0X0020
 #define PHY_IMR				0x09
 #define PHY_BPCR			0x0A
+#define  IBRXSEL			0x0400
+#define  IBTXSEL			0x0100
+#define  IB_FILTER			0x0080
+#define  CMIRROR_EN			0x0040
 #define PHY_BIST			0x0B
 #define PHY_RAW_L			0x0C
 #define PHY_RAW_H			0x0D
@@ -744,11 +769,29 @@
 #define PHY_BRNR2			0x17
 #define PHY_BENR			0x18
 #define PHY_REG_REV			0x19
+#define  REG_REV_RESV			0xE000
+#define  RXIDLE_LATCHED			0x1000
+#define  P1_EN				0x0800
+#define  RXIDLE_EN			0x0400
+#define  CLKREQ_DLY_TIMER_1_0		0x0040
+#define  STOP_CLKRD			0x0020
+#define  RX_PWST			0x0008
+#define  STOP_CLKWR			0x0004
 #define PHY_FLD0			0x1A
 #define PHY_FLD1			0x1B
 #define PHY_FLD2			0x1C
 #define PHY_FLD3			0x1D
+#define  TIMER_4			0x7800
+#define  TIMER_6			0x00E0
+#define  RXDELINK			0x0004
 #define PHY_FLD4			0x1E

include/linux/mfd/rtsx_pci.h line 797

Quoted 10 lines
include/linux/mfd/rtsx_pci.h +7 -0
+#define  FLDEN_SEL			0x4000
+#define  REQ_REF			0x2000
+#define  RXAMP_OFF			0x1000
+#define  REQ_ADDA			0x0800
+#define  BER_COUNT			0x00E0
+#define  BER_TIMER			0x000A
+#define  BER_CHK_EN			0x0001
 #define PHY_DUM_REG			0x1F
 
 #define LCTLR				0x80

This doesn't look right.

We had a nicely structured, ordered list and now you've seemingly randomly shoved a truck load of un-prefixed defines between them.

Am I missing something? Is there method to the madness?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#3 lore raw
Quoted 10 lines · Lee Jones
Quoted 10 lines

#define PHY_FLD4 0x1E

Quoted 9 lines
include/linux/mfd/rtsx_pci.h +7 -0
+#define  FLDEN_SEL			0x4000
+#define  REQ_REF			0x2000
+#define  RXAMP_OFF			0x1000
+#define  REQ_ADDA			0x0800
+#define  BER_COUNT			0x00E0
+#define  BER_TIMER			0x000A
+#define  BER_CHK_EN			0x0001
 #define PHY_DUM_REG			0x1F
Quoted 7 lines
Quoted 1 line
Quoted 1 line

#define LCTLR 0x80

This doesn't look right.

We had a nicely structured, ordered list and now you've seemingly randomly shoved a truck load of un-prefixed defines between them.

Am I missing something? Is there method to the madness?

Hi Lee:

Are you suggesting that I should define the macros using the same prefix like below?

#define PHY_FLD4 0x1E

#define   FLD4_FLDEN_SEL          0x4000
#define   FLD4_REQ_REF              0x2000
#define   FLD4_RXAMP_OFF        0x1000

BR,
Wei

#4 lore raw
Quoted 18 lines · wwang
Quoted 12 lines · Lee Jones
Quoted 10 lines

#define PHY_FLD4 0x1E

include/linux/mfd/rtsx_pci.h

Quoted 9 lines
include/linux/mfd/rtsx_pci.h +7 -0
+#define  FLDEN_SEL			0x4000
+#define  REQ_REF			0x2000
+#define  RXAMP_OFF			0x1000
+#define  REQ_ADDA			0x0800
+#define  BER_COUNT			0x00E0
+#define  BER_TIMER			0x000A
+#define  BER_CHK_EN			0x0001
 #define PHY_DUM_REG			0x1F
 >  #define LCTLR				0x80

This doesn't look right.

Quoted 4 lines

We had a nicely structured, ordered list and now you've seemingly randomly shoved a truck load of un-prefixed defines between them.

Am I missing something? Is there method to the madness?

Quoted 7 lines

Are you suggesting that I should define the macros using the same prefix like below?

#define PHY_FLD4 0x1E

#define   FLD4_FLDEN_SEL          0x4000
#define   FLD4_REQ_REF              0x2000
#define   FLD4_RXAMP_OFF        0x1000

Ah good, so there was at least some kind of method there. :)

Yes I am, but make them seperate, so perhaps:

/* Phy registers */

 #define PHY_PCR                        0x00
 #define PHY_RCR0                       0x01
 #define PHY_RCR1                       0x02
 #define PHY_RCR2                       0x03

<snip>

+/* 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
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw
In reply to [email protected]
Quoted 11 lines · On Fri, 06 Sep 2013, [email protected] wrote:

From: Wei WANG <[email protected]>

v2:
Name those new-added register values

Wei WANG (1):
mfd: rtsx: Modify rts5249_optimize_phy

 drivers/mfd/rts5249.c        |   35 ++++++++++++++++++++++++++++++++--
 include/linux/mfd/rtsx_pci.h |   43 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)

You don't need to add a cover letter to a single patch submission.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog