phy: qcom-qmp-usb: populate offsets configuration
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 24 Aug 2023 21:19:42 +0000 (00:19 +0300)
committerVinod Koul <vkoul@kernel.org>
Thu, 21 Sep 2023 13:53:58 +0000 (15:53 +0200)
Populate offsets configuration for the rest of USB PHYs to make it
possible to switch them to the new (single-node) bindings style.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230824211952.1397699-7-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/qualcomm/phy-qcom-qmp-usb.c

index 42a1a3f007596066e1550d8a76931306e50dfa57..2a094f2345f0f5fdca1acf25ac8c7432159f454b 100644 (file)
@@ -1280,6 +1280,13 @@ static const struct qmp_usb_offsets qmp_usb_offsets_ipq9574 = {
 
 static const struct qmp_usb_offsets qmp_usb_offsets_v3 = {
        .serdes         = 0,
+       .pcs            = 0x600,
+       .tx             = 0x200,
+       .rx             = 0x400,
+};
+
+static const struct qmp_usb_offsets qmp_usb_offsets_v3_qcm2290 = {
+       .serdes         = 0x0,
        .pcs            = 0xc00,
        .pcs_misc       = 0xa00,
        .tx             = 0x200,
@@ -1288,6 +1295,14 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v3 = {
        .rx2            = 0x800,
 };
 
+static const struct qmp_usb_offsets qmp_usb_offsets_v4 = {
+       .serdes         = 0,
+       .pcs            = 0x0800,
+       .pcs_usb        = 0x0e00,
+       .tx             = 0x0200,
+       .rx             = 0x0400,
+};
+
 static const struct qmp_usb_offsets qmp_usb_offsets_v5 = {
        .serdes         = 0,
        .pcs            = 0x0200,
@@ -1299,6 +1314,8 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v5 = {
 static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v3,
+
        .serdes_tbl             = ipq8074_usb3_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(ipq8074_usb3_serdes_tbl),
        .tx_tbl                 = msm8996_usb3_tx_tbl,
@@ -1333,6 +1350,8 @@ static const struct qmp_phy_cfg ipq9574_usb3phy_cfg = {
 static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v3,
+
        .serdes_tbl             = msm8996_usb3_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(msm8996_usb3_serdes_tbl),
        .tx_tbl                 = msm8996_usb3_tx_tbl,
@@ -1385,6 +1404,8 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v3,
+
        .serdes_tbl             = qmp_v3_usb3_uniphy_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(qmp_v3_usb3_uniphy_serdes_tbl),
        .tx_tbl                 = qmp_v3_usb3_uniphy_tx_tbl,
@@ -1403,6 +1424,8 @@ static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg msm8998_usb3phy_cfg = {
        .lanes                  = 2,
 
+       .offsets                = &qmp_usb_offsets_v3_qcm2290,
+
        .serdes_tbl             = msm8998_usb3_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(msm8998_usb3_serdes_tbl),
        .tx_tbl                 = msm8998_usb3_tx_tbl,
@@ -1419,6 +1442,8 @@ static const struct qmp_phy_cfg msm8998_usb3phy_cfg = {
 static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v4,
+
        .serdes_tbl             = sm8150_usb3_uniphy_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
        .tx_tbl                 = sm8150_usb3_uniphy_tx_tbl,
@@ -1440,6 +1465,8 @@ static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v4,
+
        .serdes_tbl             = sm8150_usb3_uniphy_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
        .tx_tbl                 = sm8250_usb3_uniphy_tx_tbl,
@@ -1461,6 +1488,8 @@ static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v4,
+
        .serdes_tbl             = sm8150_usb3_uniphy_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
        .tx_tbl                 = sdx55_usb3_uniphy_tx_tbl,
@@ -1482,6 +1511,8 @@ static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v5,
+
        .serdes_tbl             = sm8150_usb3_uniphy_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
        .tx_tbl                 = sdx65_usb3_uniphy_tx_tbl,
@@ -1503,6 +1534,8 @@ static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = {
        .lanes                  = 1,
 
+       .offsets                = &qmp_usb_offsets_v5,
+
        .serdes_tbl             = sm8150_usb3_uniphy_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
        .tx_tbl                 = sm8350_usb3_uniphy_tx_tbl,
@@ -1524,7 +1557,7 @@ static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = {
 static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = {
        .lanes                  = 2,
 
-       .offsets                = &qmp_usb_offsets_v3,
+       .offsets                = &qmp_usb_offsets_v3_qcm2290,
 
        .serdes_tbl             = qcm2290_usb3_serdes_tbl,
        .serdes_tbl_num         = ARRAY_SIZE(qcm2290_usb3_serdes_tbl),
@@ -2078,8 +2111,10 @@ static int qmp_usb_parse_dt(struct qmp_usb *qmp)
 
        qmp->serdes = base + offs->serdes;
        qmp->pcs = base + offs->pcs;
-       qmp->pcs_misc = base + offs->pcs_misc;
-       qmp->pcs_usb = base + offs->pcs_usb;
+       if (offs->pcs_usb)
+               qmp->pcs_usb = base + offs->pcs_usb;
+       if (offs->pcs_misc)
+               qmp->pcs_misc = base + offs->pcs_misc;
        qmp->tx = base + offs->tx;
        qmp->rx = base + offs->rx;