History

phy: qcom-qmp-combo: merge USB and DP configurations

It does not really make any sense to keep separate configuration structures for the USB and DP parts of the same PHY so merge them.

Johan Hovold committed 3 years ago

Commit 9e628771 parent ba0af7b1 file · +57 −125Browse files

Unified · Split

drivers/phy/qualcomm/phy-qcom-qmp-combo.c+57−125
@@ -798,11 +798,7 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { · 797 unmodified lines
798798
799799 struct qmp_phy;
800800
801−/* struct qmp_phy_cfg - per-PHY initialization config */
802801 struct qmp_phy_cfg {
803− /* phy-type - PCIE/UFS/USB */
804− unsigned int type;
805−
806802 /* Init sequence for PHY blocks - serdes, tx, rx, pcs */
807803 const struct qmp_phy_init_tbl *serdes_tbl;
808804 int serdes_tbl_num;
@@ -863,11 +859,6 @@ struct qmp_phy_cfg { · 54 unmodified lines
863859
864860 };
865861
866−struct qmp_phy_combo_cfg {
867− const struct qmp_phy_cfg *usb_cfg;
868− const struct qmp_phy_cfg *dp_cfg;
869−};
870−
871862 /**
872863 * struct qmp_phy - per-lane phy descriptor
873864 *
@@ -1007,9 +998,7 @@ static const char * const sc7180_usb3phy_reset_l[] = { · 133 unmodified lines
1007998 "phy",
1008999 };
10091000
1010−static const struct qmp_phy_cfg sc7180_usb3phy_cfg = {
1011− .type = PHY_TYPE_USB3,
1012−
1001+static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = {
10131002 .serdes_tbl = qmp_v3_usb3_serdes_tbl,
10141003 .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl),
10151004 .tx_tbl = qmp_v3_usb3_tx_tbl,
@@ -1018,19 +1007,6 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { · 2 unmodified lines
10181007 .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl),
10191008 .pcs_tbl = qmp_v3_usb3_pcs_tbl,
10201009 .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl),
1021− .clk_list = qmp_v3_phy_clk_l,
1022− .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
1023− .reset_list = sc7180_usb3phy_reset_l,
1024− .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l),
1025− .vreg_list = qmp_phy_vreg_l,
1026− .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1027− .regs = qmp_v3_usb3phy_regs_layout,
1028−
1029− .has_pwrdn_delay = true,
1030−};
1031−
1032−static const struct qmp_phy_cfg sc7180_dpphy_cfg = {
1033− .type = PHY_TYPE_DP,
10341010
10351011 .dp_serdes_tbl = qmp_v3_dp_serdes_tbl,
10361012 .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl),
@@ -1055,16 +1031,19 @@ static const struct qmp_phy_cfg sc7180_dpphy_cfg = { · 18 unmodified lines
10551031 .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx,
10561032 .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy,
10571033 .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate,
1058−};
10591034
1060−static const struct qmp_phy_combo_cfg sc7180_usb3dpphy_cfg = {
1061− .usb_cfg = &sc7180_usb3phy_cfg,
1062− .dp_cfg = &sc7180_dpphy_cfg,
1063−};
1035+ .clk_list = qmp_v3_phy_clk_l,
1036+ .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
1037+ .reset_list = sc7180_usb3phy_reset_l,
1038+ .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l),
1039+ .vreg_list = qmp_phy_vreg_l,
1040+ .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1041+ .regs = qmp_v3_usb3phy_regs_layout,
10641042
1065−static const struct qmp_phy_cfg sdm845_usb3phy_cfg = {
1066− .type = PHY_TYPE_USB3,
1043+ .has_pwrdn_delay = true,
1044+};
10671045
1046+static const struct qmp_phy_cfg sdm845_usb3dpphy_cfg = {
10681047 .serdes_tbl = qmp_v3_usb3_serdes_tbl,
10691048 .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl),
10701049 .tx_tbl = qmp_v3_usb3_tx_tbl,
@@ -1073,24 +1052,11 @@ static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { · 2 unmodified lines
10731052 .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl),
10741053 .pcs_tbl = qmp_v3_usb3_pcs_tbl,
10751054 .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl),
1076− .clk_list = qmp_v3_phy_clk_l,
1077− .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
1078− .reset_list = msm8996_usb3phy_reset_l,
1079− .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
1080− .vreg_list = qmp_phy_vreg_l,
1081− .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1082− .regs = qmp_v3_usb3phy_regs_layout,
1083−
1084− .has_pwrdn_delay = true,
1085−};
10861055
1087−static const struct qmp_phy_cfg sdm845_dpphy_cfg = {
1088− .type = PHY_TYPE_DP,
1089−
1090− .serdes_tbl = qmp_v3_dp_serdes_tbl,
1091− .serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl),
1092− .tx_tbl = qmp_v3_dp_tx_tbl,
1093− .tx_tbl_num = ARRAY_SIZE(qmp_v3_dp_tx_tbl),
1056+ .dp_serdes_tbl = qmp_v3_dp_serdes_tbl,
1057+ .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl),
1058+ .dp_tx_tbl = qmp_v3_dp_tx_tbl,
1059+ .dp_tx_tbl_num = ARRAY_SIZE(qmp_v3_dp_tx_tbl),
10941060
10951061 .serdes_tbl_rbr = qmp_v3_dp_serdes_tbl_rbr,
10961062 .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_rbr),
@@ -1110,16 +1076,19 @@ static const struct qmp_phy_cfg sdm845_dpphy_cfg = { · 13 unmodified lines
11101076 .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx,
11111077 .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy,
11121078 .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate,
1113−};
11141079
1115−static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = {
1116− .usb_cfg = &sdm845_usb3phy_cfg,
1117− .dp_cfg = &sdm845_dpphy_cfg,
1118−};
1080+ .clk_list = qmp_v3_phy_clk_l,
1081+ .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
1082+ .reset_list = msm8996_usb3phy_reset_l,
1083+ .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
1084+ .vreg_list = qmp_phy_vreg_l,
1085+ .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1086+ .regs = qmp_v3_usb3phy_regs_layout,
11191087
1120−static const struct qmp_phy_cfg sm8150_usb3phy_cfg = {
1121− .type = PHY_TYPE_USB3,
1088+ .has_pwrdn_delay = true,
1089+};
11221090
1091+static const struct qmp_phy_cfg sc8180x_usb3dpphy_cfg = {
11231092 .serdes_tbl = sm8150_usb3_serdes_tbl,
11241093 .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl),
11251094 .tx_tbl = sm8150_usb3_tx_tbl,
@@ -1130,20 +1099,6 @@ static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { · 4 unmodified lines
11301099 .pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_tbl),
11311100 .pcs_usb_tbl = sm8150_usb3_pcs_usb_tbl,
11321101 .pcs_usb_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_usb_tbl),
1133− .clk_list = qmp_v4_phy_clk_l,
1134− .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
1135− .reset_list = msm8996_usb3phy_reset_l,
1136− .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
1137− .vreg_list = qmp_phy_vreg_l,
1138− .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1139− .regs = qmp_v4_usb3phy_regs_layout,
1140− .pcs_usb_offset = 0x300,
1141−
1142− .has_pwrdn_delay = true,
1143−};
1144−
1145−static const struct qmp_phy_cfg sc8180x_dpphy_cfg = {
1146− .type = PHY_TYPE_DP,
11471102
11481103 .dp_serdes_tbl = qmp_v4_dp_serdes_tbl,
11491104 .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1168,24 +1123,7 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { · 18 unmodified lines
11681123 .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx,
11691124 .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy,
11701125 .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate,
1171−};
1172−
1173−static const struct qmp_phy_combo_cfg sc8180x_usb3dpphy_cfg = {
1174− .usb_cfg = &sm8150_usb3phy_cfg,
1175− .dp_cfg = &sc8180x_dpphy_cfg,
1176−};
1177−
1178−static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = {
1179− .type = PHY_TYPE_USB3,
11801126
1181− .serdes_tbl = sc8280xp_usb43dp_serdes_tbl,
1182− .serdes_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_serdes_tbl),
1183− .tx_tbl = sc8280xp_usb43dp_tx_tbl,
1184− .tx_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_tx_tbl),
1185− .rx_tbl = sc8280xp_usb43dp_rx_tbl,
1186− .rx_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_rx_tbl),
1187− .pcs_tbl = sc8280xp_usb43dp_pcs_tbl,
1188− .pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_pcs_tbl),
11891127 .clk_list = qmp_v4_phy_clk_l,
11901128 .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
11911129 .reset_list = msm8996_usb3phy_reset_l,
@@ -1194,10 +1132,19 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = { · 2 unmodified lines
11941132 .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
11951133 .regs = qmp_v4_usb3phy_regs_layout,
11961134 .pcs_usb_offset = 0x300,
1135+
1136+ .has_pwrdn_delay = true,
11971137 };
11981138
1199−static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = {
1200− .type = PHY_TYPE_DP,
1139+static const struct qmp_phy_cfg sc8280xp_usb43dpphy_cfg = {
1140+ .serdes_tbl = sc8280xp_usb43dp_serdes_tbl,
1141+ .serdes_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_serdes_tbl),
1142+ .tx_tbl = sc8280xp_usb43dp_tx_tbl,
1143+ .tx_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_tx_tbl),
1144+ .rx_tbl = sc8280xp_usb43dp_rx_tbl,
1145+ .rx_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_rx_tbl),
1146+ .pcs_tbl = sc8280xp_usb43dp_pcs_tbl,
1147+ .pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb43dp_pcs_tbl),
12011148
12021149 .dp_serdes_tbl = qmp_v5_dp_serdes_tbl,
12031150 .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v5_dp_serdes_tbl),
@@ -1222,16 +1169,18 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { · 18 unmodified lines
12221169 .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx,
12231170 .configure_dp_phy = qcom_qmp_v5_phy_configure_dp_phy,
12241171 .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate,
1225−};
12261172
1227−static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_cfg = {
1228− .usb_cfg = &sc8280xp_usb43dp_usb_cfg,
1229− .dp_cfg = &sc8280xp_usb43dp_dp_cfg,
1173+ .clk_list = qmp_v4_phy_clk_l,
1174+ .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
1175+ .reset_list = msm8996_usb3phy_reset_l,
1176+ .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
1177+ .vreg_list = qmp_phy_vreg_l,
1178+ .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1179+ .regs = qmp_v4_usb3phy_regs_layout,
1180+ .pcs_usb_offset = 0x300,
12301181 };
12311182
1232−static const struct qmp_phy_cfg sm8250_usb3phy_cfg = {
1233− .type = PHY_TYPE_USB3,
1234−
1183+static const struct qmp_phy_cfg sm8250_usb3dpphy_cfg = {
12351184 .serdes_tbl = sm8150_usb3_serdes_tbl,
12361185 .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl),
12371186 .tx_tbl = sm8250_usb3_tx_tbl,
@@ -1242,20 +1191,6 @@ static const struct qmp_phy_cfg sm8250_usb3phy_cfg = { · 4 unmodified lines
12421191 .pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_tbl),
12431192 .pcs_usb_tbl = sm8250_usb3_pcs_usb_tbl,
12441193 .pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_usb_tbl),
1245− .clk_list = qmp_v4_sm8250_usbphy_clk_l,
1246− .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l),
1247− .reset_list = msm8996_usb3phy_reset_l,
1248− .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
1249− .vreg_list = qmp_phy_vreg_l,
1250− .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1251− .regs = qmp_v4_usb3phy_regs_layout,
1252− .pcs_usb_offset = 0x300,
1253−
1254− .has_pwrdn_delay = true,
1255−};
1256−
1257−static const struct qmp_phy_cfg sm8250_dpphy_cfg = {
1258− .type = PHY_TYPE_DP,
12591194
12601195 .dp_serdes_tbl = qmp_v4_dp_serdes_tbl,
12611196 .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1280,11 +1215,17 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { · 18 unmodified lines
12801215 .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx,
12811216 .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy,
12821217 .calibrate_dp_phy = qcom_qmp_v4_dp_phy_calibrate,
1283−};
12841218
1285−static const struct qmp_phy_combo_cfg sm8250_usb3dpphy_cfg = {
1286− .usb_cfg = &sm8250_usb3phy_cfg,
1287− .dp_cfg = &sm8250_dpphy_cfg,
1219+ .clk_list = qmp_v4_sm8250_usbphy_clk_l,
1220+ .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l),
1221+ .reset_list = msm8996_usb3phy_reset_l,
1222+ .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
1223+ .vreg_list = qmp_phy_vreg_l,
1224+ .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1225+ .regs = qmp_v4_usb3phy_regs_layout,
1226+ .pcs_usb_offset = 0x300,
1227+
1228+ .has_pwrdn_delay = true,
12881229 };
12891230
12901231 static void qmp_combo_configure_lane(void __iomem *base,
@@ -2697,10 +2638,7 @@ static int qmp_combo_probe(struct platform_device *pdev) · 1406 unmodified lines
26972638 void __iomem *serdes;
26982639 void __iomem *usb_serdes;
26992640 void __iomem *dp_serdes = NULL;
2700− const struct qmp_phy_combo_cfg *combo_cfg = NULL;
27012641 const struct qmp_phy_cfg *cfg = NULL;
2702− const struct qmp_phy_cfg *usb_cfg = NULL;
2703− const struct qmp_phy_cfg *dp_cfg = NULL;
27042642 int num, id, expected_phys;
27052643 int ret;
27062644
@@ -2711,13 +2649,10 @@ static int qmp_combo_probe(struct platform_device *pdev) · 4 unmodified lines
27112649 qmp->dev = dev;
27122650 dev_set_drvdata(dev, qmp);
27132651
2714− combo_cfg = of_device_get_match_data(dev);
2715− if (!combo_cfg)
2652+ cfg = of_device_get_match_data(dev);
2653+ if (!cfg)
27162654 return -EINVAL;
27172655
2718− usb_cfg = combo_cfg->usb_cfg;
2719− cfg = usb_cfg; /* Setup clks and regulators */
2720−
27212656 usb_serdes = serdes = devm_platform_ioremap_resource(pdev, 0);
27222657 if (IS_ERR(serdes))
27232658 return PTR_ERR(serdes);
@@ -2730,7 +2665,6 @@ static int qmp_combo_probe(struct platform_device *pdev) · 6 unmodified lines
27302665 if (IS_ERR(dp_serdes))
27312666 return PTR_ERR(dp_serdes);
27322667
2733− dp_cfg = combo_cfg->dp_cfg;
27342668 expected_phys = 2;
27352669
27362670 mutex_init(&qmp->phy_mutex);
@@ -2769,7 +2703,6 @@ static int qmp_combo_probe(struct platform_device *pdev) · 32 unmodified lines
27692703 id = 0;
27702704 for_each_available_child_of_node(dev->of_node, child) {
27712705 if (of_node_name_eq(child, "dp-phy")) {
2772− cfg = dp_cfg;
27732706 serdes = dp_serdes;
27742707
27752708 /* Create per-lane phy */
@@ -2787,7 +2720,6 @@ static int qmp_combo_probe(struct platform_device *pdev) · 11 unmodified lines
27872720 goto err_node_put;
27882721 }
27892722 } else if (of_node_name_eq(child, "usb3-phy")) {
2790− cfg = usb_cfg;
27912723 serdes = usb_serdes;
27922724
27932725 /* Create per-lane phy */