@@ -155,8 +155,10 @@ static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
155
155
[QPHY_START_CTRL ] = 0x44 ,
156
156
[QPHY_PCS_STATUS ] = 0x14 ,
157
157
[QPHY_PCS_POWER_DOWN_CONTROL ] = 0x40 ,
158
- [QPHY_PCS_AUTONOMOUS_MODE_CTRL ] = 0x308 ,
159
- [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ] = 0x314 ,
158
+
159
+ /* In PCS_USB */
160
+ [QPHY_PCS_AUTONOMOUS_MODE_CTRL ] = 0x008 ,
161
+ [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ] = 0x014 ,
160
162
};
161
163
162
164
static const struct qmp_phy_init_tbl qmp_v3_usb3_serdes_tbl [] = {
@@ -451,6 +453,9 @@ static const struct qmp_phy_init_tbl sm8150_usb3_pcs_tbl[] = {
451
453
QMP_PHY_INIT_CFG (QPHY_V4_PCS_PCS_TX_RX_CONFIG , 0x0c ),
452
454
QMP_PHY_INIT_CFG (QPHY_V4_PCS_EQ_CONFIG1 , 0x4b ),
453
455
QMP_PHY_INIT_CFG (QPHY_V4_PCS_EQ_CONFIG5 , 0x10 ),
456
+ };
457
+
458
+ static const struct qmp_phy_init_tbl sm8150_usb3_pcs_usb_tbl [] = {
454
459
QMP_PHY_INIT_CFG (QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL , 0xf8 ),
455
460
QMP_PHY_INIT_CFG (QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 , 0x07 ),
456
461
};
@@ -520,6 +525,9 @@ static const struct qmp_phy_init_tbl sm8250_usb3_pcs_tbl[] = {
520
525
QMP_PHY_INIT_CFG (QPHY_V4_PCS_PCS_TX_RX_CONFIG , 0x0c ),
521
526
QMP_PHY_INIT_CFG (QPHY_V4_PCS_EQ_CONFIG1 , 0x4b ),
522
527
QMP_PHY_INIT_CFG (QPHY_V4_PCS_EQ_CONFIG5 , 0x10 ),
528
+ };
529
+
530
+ static const struct qmp_phy_init_tbl sm8250_usb3_pcs_usb_tbl [] = {
523
531
QMP_PHY_INIT_CFG (QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL , 0xf8 ),
524
532
QMP_PHY_INIT_CFG (QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 , 0x07 ),
525
533
};
@@ -634,6 +642,8 @@ struct qmp_phy_cfg {
634
642
int rx_tbl_num ;
635
643
const struct qmp_phy_init_tbl * pcs_tbl ;
636
644
int pcs_tbl_num ;
645
+ const struct qmp_phy_init_tbl * pcs_usb_tbl ;
646
+ int pcs_usb_tbl_num ;
637
647
638
648
/* Init sequence for DP PHY block link rates */
639
649
const struct qmp_phy_init_tbl * serdes_tbl_rbr ;
@@ -679,6 +689,10 @@ struct qmp_phy_cfg {
679
689
bool has_phy_dp_com_ctrl ;
680
690
/* true, if PHY has secondary tx/rx lanes to be configured */
681
691
bool is_dual_lane_phy ;
692
+
693
+ /* Offset from PCS to PCS_USB region */
694
+ unsigned int pcs_usb_offset ;
695
+
682
696
};
683
697
684
698
struct qmp_phy_combo_cfg {
@@ -698,6 +712,7 @@ struct qmp_phy_combo_cfg {
698
712
* @tx2: iomapped memory space for second lane's tx (in dual lane PHYs)
699
713
* @rx2: iomapped memory space for second lane's rx (in dual lane PHYs)
700
714
* @pcs_misc: iomapped memory space for lane's pcs_misc
715
+ * @pcs_usb: iomapped memory space for lane's pcs_usb
701
716
* @pipe_clk: pipe clock
702
717
* @index: lane index
703
718
* @qmp: QMP phy to which this lane belongs
@@ -717,6 +732,7 @@ struct qmp_phy {
717
732
void __iomem * tx2 ;
718
733
void __iomem * rx2 ;
719
734
void __iomem * pcs_misc ;
735
+ void __iomem * pcs_usb ;
720
736
struct clk * pipe_clk ;
721
737
unsigned int index ;
722
738
struct qcom_qmp * qmp ;
@@ -905,13 +921,16 @@ static const struct qmp_phy_cfg sm8150_usb3phy_cfg = {
905
921
.rx_tbl_num = ARRAY_SIZE (sm8150_usb3_rx_tbl ),
906
922
.pcs_tbl = sm8150_usb3_pcs_tbl ,
907
923
.pcs_tbl_num = ARRAY_SIZE (sm8150_usb3_pcs_tbl ),
924
+ .pcs_usb_tbl = sm8150_usb3_pcs_usb_tbl ,
925
+ .pcs_usb_tbl_num = ARRAY_SIZE (sm8150_usb3_pcs_usb_tbl ),
908
926
.clk_list = qmp_v4_phy_clk_l ,
909
927
.num_clks = ARRAY_SIZE (qmp_v4_phy_clk_l ),
910
928
.reset_list = msm8996_usb3phy_reset_l ,
911
929
.num_resets = ARRAY_SIZE (msm8996_usb3phy_reset_l ),
912
930
.vreg_list = qmp_phy_vreg_l ,
913
931
.num_vregs = ARRAY_SIZE (qmp_phy_vreg_l ),
914
932
.regs = qmp_v4_usb3phy_regs_layout ,
933
+ .pcs_usb_offset = 0x300 ,
915
934
916
935
.start_ctrl = SERDES_START | PCS_START ,
917
936
.pwrdn_ctrl = SW_PWRDN ,
@@ -978,13 +997,16 @@ static const struct qmp_phy_cfg sm8250_usb3phy_cfg = {
978
997
.rx_tbl_num = ARRAY_SIZE (sm8250_usb3_rx_tbl ),
979
998
.pcs_tbl = sm8250_usb3_pcs_tbl ,
980
999
.pcs_tbl_num = ARRAY_SIZE (sm8250_usb3_pcs_tbl ),
1000
+ .pcs_usb_tbl = sm8250_usb3_pcs_usb_tbl ,
1001
+ .pcs_usb_tbl_num = ARRAY_SIZE (sm8250_usb3_pcs_usb_tbl ),
981
1002
.clk_list = qmp_v4_sm8250_usbphy_clk_l ,
982
1003
.num_clks = ARRAY_SIZE (qmp_v4_sm8250_usbphy_clk_l ),
983
1004
.reset_list = msm8996_usb3phy_reset_l ,
984
1005
.num_resets = ARRAY_SIZE (msm8996_usb3phy_reset_l ),
985
1006
.vreg_list = qmp_phy_vreg_l ,
986
1007
.num_vregs = ARRAY_SIZE (qmp_phy_vreg_l ),
987
1008
.regs = qmp_v4_usb3phy_regs_layout ,
1009
+ .pcs_usb_offset = 0x300 ,
988
1010
989
1011
.start_ctrl = SERDES_START | PCS_START ,
990
1012
.pwrdn_ctrl = SW_PWRDN ,
@@ -1869,7 +1891,7 @@ static int qcom_qmp_phy_combo_set_mode(struct phy *phy,
1869
1891
static void qcom_qmp_phy_combo_enable_autonomous_mode (struct qmp_phy * qphy )
1870
1892
{
1871
1893
const struct qmp_phy_cfg * cfg = qphy -> cfg ;
1872
- void __iomem * pcs = qphy -> pcs ;
1894
+ void __iomem * pcs_usb = qphy -> pcs_usb ?: qphy -> pcs ;
1873
1895
void __iomem * pcs_misc = qphy -> pcs_misc ;
1874
1896
u32 intr_mask ;
1875
1897
@@ -1880,15 +1902,15 @@ static void qcom_qmp_phy_combo_enable_autonomous_mode(struct qmp_phy *qphy)
1880
1902
intr_mask = ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL ;
1881
1903
1882
1904
/* Clear any pending interrupts status */
1883
- qphy_setbits (pcs , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1905
+ qphy_setbits (pcs_usb , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1884
1906
/* Writing 1 followed by 0 clears the interrupt */
1885
- qphy_clrbits (pcs , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1907
+ qphy_clrbits (pcs_usb , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1886
1908
1887
- qphy_clrbits (pcs , cfg -> regs [QPHY_PCS_AUTONOMOUS_MODE_CTRL ],
1909
+ qphy_clrbits (pcs_usb , cfg -> regs [QPHY_PCS_AUTONOMOUS_MODE_CTRL ],
1888
1910
ARCVR_DTCT_EN | ALFPS_DTCT_EN | ARCVR_DTCT_EVENT_SEL );
1889
1911
1890
1912
/* Enable required PHY autonomous mode interrupts */
1891
- qphy_setbits (pcs , cfg -> regs [QPHY_PCS_AUTONOMOUS_MODE_CTRL ], intr_mask );
1913
+ qphy_setbits (pcs_usb , cfg -> regs [QPHY_PCS_AUTONOMOUS_MODE_CTRL ], intr_mask );
1892
1914
1893
1915
/* Enable i/o clamp_n for autonomous mode */
1894
1916
if (pcs_misc )
@@ -1898,19 +1920,19 @@ static void qcom_qmp_phy_combo_enable_autonomous_mode(struct qmp_phy *qphy)
1898
1920
static void qcom_qmp_phy_combo_disable_autonomous_mode (struct qmp_phy * qphy )
1899
1921
{
1900
1922
const struct qmp_phy_cfg * cfg = qphy -> cfg ;
1901
- void __iomem * pcs = qphy -> pcs ;
1923
+ void __iomem * pcs_usb = qphy -> pcs_usb ?: qphy -> pcs_usb ;
1902
1924
void __iomem * pcs_misc = qphy -> pcs_misc ;
1903
1925
1904
1926
/* Disable i/o clamp_n on resume for normal mode */
1905
1927
if (pcs_misc )
1906
1928
qphy_setbits (pcs_misc , QPHY_V3_PCS_MISC_CLAMP_ENABLE , CLAMP_EN );
1907
1929
1908
- qphy_clrbits (pcs , cfg -> regs [QPHY_PCS_AUTONOMOUS_MODE_CTRL ],
1930
+ qphy_clrbits (pcs_usb , cfg -> regs [QPHY_PCS_AUTONOMOUS_MODE_CTRL ],
1909
1931
ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL | ALFPS_DTCT_EN );
1910
1932
1911
- qphy_setbits (pcs , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1933
+ qphy_setbits (pcs_usb , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1912
1934
/* Writing 1 followed by 0 clears the interrupt */
1913
- qphy_clrbits (pcs , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1935
+ qphy_clrbits (pcs_usb , cfg -> regs [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR ], IRQ_CLEAR );
1914
1936
}
1915
1937
1916
1938
static int __maybe_unused qcom_qmp_phy_combo_runtime_suspend (struct device * dev )
@@ -2346,6 +2368,9 @@ int qcom_qmp_phy_combo_create(struct device *dev, struct device_node *np, int id
2346
2368
if (!qphy -> pcs )
2347
2369
return - ENOMEM ;
2348
2370
2371
+ if (cfg -> pcs_usb_offset )
2372
+ qphy -> pcs_usb = qphy -> pcs + cfg -> pcs_usb_offset ;
2373
+
2349
2374
/*
2350
2375
* If this is a dual-lane PHY, then there should be registers for the
2351
2376
* second lane. Some old device trees did not specify this, so fall
0 commit comments