phy: General struct and field cleanup
authorCan Guo <cang@codeaurora.org>
Fri, 21 Sep 2018 04:27:55 +0000 (21:27 -0700)
committerKishon Vijay Abraham I <kishon@ti.com>
Tue, 25 Sep 2018 10:40:14 +0000 (16:10 +0530)
Move MSM8996 specific PHY vreg list struct name to a genernal one as it is
used by all PHYs. Add a specific field to handle dual lane situation.

Signed-off-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Manu Gautam <mgautam@codeaurora.org>
Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/qualcomm/phy-qcom-qmp.c

index a55cfa4554a00b7b41142a843630bc6a3c66e945..1603d9c615c53e0846a1a75d18255719027483e3 100644 (file)
@@ -649,6 +649,8 @@ struct qmp_phy_cfg {
 
        /* true, if PHY has a separate DP_COM control block */
        bool has_phy_dp_com_ctrl;
+       /* true, if PHY has secondary tx/rx lanes to be configured */
+       bool is_dual_lane_phy;
        /* Register offset of secondary tx/rx lanes for USB DP combo PHY */
        unsigned int tx_b_lane_offset;
        unsigned int rx_b_lane_offset;
@@ -758,7 +760,7 @@ static const char * const msm8996_usb3phy_reset_l[] = {
 };
 
 /* list of regulators */
-static const char * const msm8996_phy_vreg_l[] = {
+static const char * const qmp_phy_vreg_l[] = {
        "vdda-phy", "vdda-pll",
 };
 
@@ -778,8 +780,8 @@ static const struct qmp_phy_cfg msm8996_pciephy_cfg = {
        .num_clks               = ARRAY_SIZE(msm8996_phy_clk_l),
        .reset_list             = msm8996_pciephy_reset_l,
        .num_resets             = ARRAY_SIZE(msm8996_pciephy_reset_l),
-       .vreg_list              = msm8996_phy_vreg_l,
-       .num_vregs              = ARRAY_SIZE(msm8996_phy_vreg_l),
+       .vreg_list              = qmp_phy_vreg_l,
+       .num_vregs              = ARRAY_SIZE(qmp_phy_vreg_l),
        .regs                   = pciephy_regs_layout,
 
        .start_ctrl             = PCS_START | PLL_READY_GATE_EN,
@@ -809,8 +811,8 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
        .num_clks               = ARRAY_SIZE(msm8996_phy_clk_l),
        .reset_list             = msm8996_usb3phy_reset_l,
        .num_resets             = ARRAY_SIZE(msm8996_usb3phy_reset_l),
-       .vreg_list              = msm8996_phy_vreg_l,
-       .num_vregs              = ARRAY_SIZE(msm8996_phy_vreg_l),
+       .vreg_list              = qmp_phy_vreg_l,
+       .num_vregs              = ARRAY_SIZE(qmp_phy_vreg_l),
        .regs                   = usb3phy_regs_layout,
 
        .start_ctrl             = SERDES_START | PCS_START,
@@ -870,8 +872,8 @@ static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg = {
        .num_clks               = ARRAY_SIZE(qmp_v3_phy_clk_l),
        .reset_list             = msm8996_usb3phy_reset_l,
        .num_resets             = ARRAY_SIZE(msm8996_usb3phy_reset_l),
-       .vreg_list              = msm8996_phy_vreg_l,
-       .num_vregs              = ARRAY_SIZE(msm8996_phy_vreg_l),
+       .vreg_list              = qmp_phy_vreg_l,
+       .num_vregs              = ARRAY_SIZE(qmp_phy_vreg_l),
        .regs                   = qmp_v3_usb3phy_regs_layout,
 
        .start_ctrl             = SERDES_START | PCS_START,
@@ -883,6 +885,7 @@ static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg = {
        .pwrdn_delay_max        = POWER_DOWN_DELAY_US_MAX,
 
        .has_phy_dp_com_ctrl    = true,
+       .is_dual_lane_phy       = true,
        .tx_b_lane_offset       = 0x400,
        .rx_b_lane_offset       = 0x400,
 };
@@ -903,8 +906,8 @@ static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
        .num_clks               = ARRAY_SIZE(qmp_v3_phy_clk_l),
        .reset_list             = msm8996_usb3phy_reset_l,
        .num_resets             = ARRAY_SIZE(msm8996_usb3phy_reset_l),
-       .vreg_list              = msm8996_phy_vreg_l,
-       .num_vregs              = ARRAY_SIZE(msm8996_phy_vreg_l),
+       .vreg_list              = qmp_phy_vreg_l,
+       .num_vregs              = ARRAY_SIZE(qmp_phy_vreg_l),
        .regs                   = qmp_v3_usb3phy_regs_layout,
 
        .start_ctrl             = SERDES_START | PCS_START,
@@ -1116,12 +1119,12 @@ static int qcom_qmp_phy_init(struct phy *phy)
        /* Tx, Rx, and PCS configurations */
        qcom_qmp_phy_configure(tx, cfg->regs, cfg->tx_tbl, cfg->tx_tbl_num);
        /* Configuration for other LANE for USB-DP combo PHY */
-       if (cfg->has_phy_dp_com_ctrl)
+       if (cfg->is_dual_lane_phy)
                qcom_qmp_phy_configure(tx + cfg->tx_b_lane_offset, cfg->regs,
                                       cfg->tx_tbl, cfg->tx_tbl_num);
 
        qcom_qmp_phy_configure(rx, cfg->regs, cfg->rx_tbl, cfg->rx_tbl_num);
-       if (cfg->has_phy_dp_com_ctrl)
+       if (cfg->is_dual_lane_phy)
                qcom_qmp_phy_configure(rx + cfg->rx_b_lane_offset, cfg->regs,
                                       cfg->rx_tbl, cfg->rx_tbl_num);