Skip to content

Commit 3584f63

Browse files
superna9999vinodkoul
authored andcommitted
phy: qcom: phy-qcom-snps-eusb2: Add support for eUSB2 repeater
For USB 2.0 compliance, eUSB2 needs a repeater. The PHY needs to initialize and reset it. So add repeater support Co-developed-by: Abel Vesa <[email protected]> Signed-off-by: Abel Vesa <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 56d77c9 commit 3584f63

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/phy/qualcomm/phy-qcom-snps-eusb2.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ struct qcom_snps_eusb2_hsphy {
130130
struct regulator_bulk_data vregs[EUSB2_NUM_VREGS];
131131

132132
enum phy_mode mode;
133+
134+
struct phy *repeater;
133135
};
134136

135137
static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int submode)
@@ -138,7 +140,7 @@ static int qcom_snps_eusb2_hsphy_set_mode(struct phy *p, enum phy_mode mode, int
138140

139141
phy->mode = mode;
140142

141-
return 0;
143+
return phy_set_mode_ext(phy->repeater, mode, submode);
142144
}
143145

144146
static void qcom_snps_eusb2_hsphy_write_mask(void __iomem *base, u32 offset,
@@ -236,6 +238,12 @@ static int qcom_snps_eusb2_hsphy_init(struct phy *p)
236238
if (ret)
237239
return ret;
238240

241+
ret = phy_init(phy->repeater);
242+
if (ret) {
243+
dev_err(&p->dev, "repeater init failed. %d\n", ret);
244+
goto disable_vreg;
245+
}
246+
239247
ret = clk_prepare_enable(phy->ref_clk);
240248
if (ret) {
241249
dev_err(&p->dev, "failed to enable ref clock, %d\n", ret);
@@ -343,6 +351,8 @@ static int qcom_snps_eusb2_hsphy_exit(struct phy *p)
343351

344352
regulator_bulk_disable(ARRAY_SIZE(phy->vregs), phy->vregs);
345353

354+
phy_exit(phy->repeater);
355+
346356
return 0;
347357
}
348358

@@ -356,6 +366,7 @@ static const struct phy_ops qcom_snps_eusb2_hsphy_ops = {
356366
static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev)
357367
{
358368
struct device *dev = &pdev->dev;
369+
struct device_node *np = dev->of_node;
359370
struct qcom_snps_eusb2_hsphy *phy;
360371
struct phy_provider *phy_provider;
361372
struct phy *generic_phy;
@@ -387,6 +398,12 @@ static int qcom_snps_eusb2_hsphy_probe(struct platform_device *pdev)
387398
if (ret)
388399
return dev_err_probe(dev, ret,
389400
"failed to get regulator supplies\n");
401+
402+
phy->repeater = devm_of_phy_get_by_index(dev, np, 0);
403+
if (IS_ERR(phy->repeater))
404+
return dev_err_probe(dev, PTR_ERR(phy->repeater),
405+
"failed to get repeater\n");
406+
390407
generic_phy = devm_phy_create(dev, NULL, &qcom_snps_eusb2_hsphy_ops);
391408
if (IS_ERR(generic_phy)) {
392409
dev_err(dev, "failed to create phy %d\n", ret);

0 commit comments

Comments
 (0)