Skip to content

Commit 3271b25

Browse files
committed
Merge tag 'phy-fixes-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy
Pull phy fixes from Vinod Koul: "A bunch of driver fixes: - Freescale typec orientation switch fix, clearing register fix, assertion of phy reset during power on - Qualcomm pcs register clear before using - stm one off fix - TI runtimepm error handling, regmap leak fixes - Rockchip gadget mode disconnection and disruption fixes - Tegra register level fix - Broadcom pointer cast warning fix" * tag 'phy-fixes-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: phy: freescale: imx8m-pcie: assert phy reset during power on phy: rockchip: inno-usb2: Fix a double free bug in rockchip_usb2phy_probe() phy: broadcom: ns-usb3: Fix Wvoid-pointer-to-enum-cast warning (again) phy: tegra: xusb: Explicitly configure HS_DISCON_LEVEL to 0x7 phy: rockchip: inno-usb2: fix communication disruption in gadget mode phy: rockchip: inno-usb2: fix disconnection in gadget mode phy: ti: gmii-sel: fix regmap leak on probe failure phy: sparx5-serdes: make it selectable for ARCH_LAN969X phy: ti: da8xx-usb: Handle devm_pm_runtime_enable() errors phy: stm32-usphyc: Fix off by one in probe() phy: qcom-qusb2: Fix NULL pointer dereference on early suspend phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it dt-bindings: phy: qcom,sc8280xp-qmp-pcie-phy: Update pcie phy bindings for qcs8300 phy: fsl-imx8mq-usb: fix typec orientation switch when built as module
2 parents 56bc8a1 + f2ec472 commit 3271b25

11 files changed

Lines changed: 33 additions & 50 deletions

File tree

Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ properties:
5656

5757
clocks:
5858
minItems: 5
59-
maxItems: 7
59+
maxItems: 6
6060

6161
clock-names:
6262
minItems: 5
@@ -67,7 +67,6 @@ properties:
6767
- enum: [rchng, refgen]
6868
- const: pipe
6969
- const: pipediv2
70-
- const: phy_aux
7170

7271
power-domains:
7372
maxItems: 1
@@ -180,6 +179,7 @@ allOf:
180179
contains:
181180
enum:
182181
- qcom,glymur-qmp-gen5x4-pcie-phy
182+
- qcom,qcs8300-qmp-gen4x2-pcie-phy
183183
- qcom,sa8775p-qmp-gen4x2-pcie-phy
184184
- qcom,sa8775p-qmp-gen4x4-pcie-phy
185185
- qcom,sc8280xp-qmp-gen3x1-pcie-phy
@@ -197,19 +197,6 @@ allOf:
197197
clock-names:
198198
minItems: 6
199199

200-
- if:
201-
properties:
202-
compatible:
203-
contains:
204-
enum:
205-
- qcom,qcs8300-qmp-gen4x2-pcie-phy
206-
then:
207-
properties:
208-
clocks:
209-
minItems: 7
210-
clock-names:
211-
minItems: 7
212-
213200
- if:
214201
properties:
215202
compatible:

drivers/phy/broadcom/phy-bcm-ns-usb3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev)
203203
usb3->dev = dev;
204204
usb3->mdiodev = mdiodev;
205205

206-
usb3->family = (enum bcm_ns_family)device_get_match_data(dev);
206+
usb3->family = (unsigned long)device_get_match_data(dev);
207207

208208
syscon_np = of_parse_phandle(dev->of_node, "usb3-dmp-syscon", 0);
209209
err = of_address_to_resource(syscon_np, 0, &res);

drivers/phy/freescale/phy-fsl-imx8m-pcie.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ static int imx8_pcie_phy_power_on(struct phy *phy)
8989
writel(imx8_phy->tx_deemph_gen2,
9090
imx8_phy->base + PCIE_PHY_TRSV_REG6);
9191
break;
92-
case IMX8MP: /* Do nothing. */
92+
case IMX8MP:
93+
reset_control_assert(imx8_phy->reset);
9394
break;
9495
}
9596

drivers/phy/freescale/phy-fsl-imx8mq-usb.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ struct imx8mq_usb_phy {
126126
static void tca_blk_orientation_set(struct tca_blk *tca,
127127
enum typec_orientation orientation);
128128

129-
#ifdef CONFIG_TYPEC
130-
131129
static int tca_blk_typec_switch_set(struct typec_switch_dev *sw,
132130
enum typec_orientation orientation)
133131
{
@@ -175,18 +173,6 @@ static void tca_blk_put_typec_switch(struct typec_switch_dev *sw)
175173
typec_switch_unregister(sw);
176174
}
177175

178-
#else
179-
180-
static struct typec_switch_dev *tca_blk_get_typec_switch(struct platform_device *pdev,
181-
struct imx8mq_usb_phy *imx_phy)
182-
{
183-
return NULL;
184-
}
185-
186-
static void tca_blk_put_typec_switch(struct typec_switch_dev *sw) {}
187-
188-
#endif /* CONFIG_TYPEC */
189-
190176
static void tca_blk_orientation_set(struct tca_blk *tca,
191177
enum typec_orientation orientation)
192178
{
@@ -504,6 +490,7 @@ static void imx8m_phy_tune(struct imx8mq_usb_phy *imx_phy)
504490

505491
if (imx_phy->pcs_tx_swing_full != PHY_TUNE_DEFAULT) {
506492
value = readl(imx_phy->base + PHY_CTRL5);
493+
value &= ~PHY_CTRL5_PCS_TX_SWING_FULL_MASK;
507494
value |= FIELD_PREP(PHY_CTRL5_PCS_TX_SWING_FULL_MASK,
508495
imx_phy->pcs_tx_swing_full);
509496
writel(value, imx_phy->base + PHY_CTRL5);

drivers/phy/microchip/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
config PHY_SPARX5_SERDES
77
tristate "Microchip Sparx5 SerDes PHY driver"
88
select GENERIC_PHY
9-
depends on ARCH_SPARX5 || COMPILE_TEST
9+
depends on ARCH_SPARX5 || ARCH_LAN969X || COMPILE_TEST
1010
depends on OF
1111
depends on HAS_IOMEM
1212
help

drivers/phy/qualcomm/phy-qcom-qusb2.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,29 +1093,29 @@ static int qusb2_phy_probe(struct platform_device *pdev)
10931093
or->hsdisc_trim.override = true;
10941094
}
10951095

1096-
pm_runtime_set_active(dev);
1097-
pm_runtime_enable(dev);
1096+
dev_set_drvdata(dev, qphy);
1097+
10981098
/*
1099-
* Prevent runtime pm from being ON by default. Users can enable
1100-
* it using power/control in sysfs.
1099+
* Enable runtime PM support, but forbid it by default.
1100+
* Users can allow it again via the power/control attribute in sysfs.
11011101
*/
1102+
pm_runtime_set_active(dev);
11021103
pm_runtime_forbid(dev);
1104+
ret = devm_pm_runtime_enable(dev);
1105+
if (ret)
1106+
return ret;
11031107

11041108
generic_phy = devm_phy_create(dev, NULL, &qusb2_phy_gen_ops);
11051109
if (IS_ERR(generic_phy)) {
11061110
ret = PTR_ERR(generic_phy);
11071111
dev_err(dev, "failed to create phy, %d\n", ret);
1108-
pm_runtime_disable(dev);
11091112
return ret;
11101113
}
11111114
qphy->phy = generic_phy;
11121115

1113-
dev_set_drvdata(dev, qphy);
11141116
phy_set_drvdata(generic_phy, qphy);
11151117

11161118
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
1117-
if (IS_ERR(phy_provider))
1118-
pm_runtime_disable(dev);
11191119

11201120
return PTR_ERR_OR_ZERO(phy_provider);
11211121
}

drivers/phy/rockchip/phy-rockchip-inno-usb2.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -821,17 +821,20 @@ static void rockchip_chg_detect_work(struct work_struct *work)
821821
container_of(work, struct rockchip_usb2phy_port, chg_work.work);
822822
struct rockchip_usb2phy *rphy = dev_get_drvdata(rport->phy->dev.parent);
823823
struct regmap *base = get_reg_base(rphy);
824-
bool is_dcd, tmout, vout;
824+
bool is_dcd, tmout, vout, vbus_attach;
825825
unsigned long delay;
826826

827+
vbus_attach = property_enabled(rphy->grf, &rport->port_cfg->utmi_bvalid);
828+
827829
dev_dbg(&rport->phy->dev, "chg detection work state = %d\n",
828830
rphy->chg_state);
829831
switch (rphy->chg_state) {
830832
case USB_CHG_STATE_UNDEFINED:
831-
if (!rport->suspended)
833+
if (!rport->suspended && !vbus_attach)
832834
rockchip_usb2phy_power_off(rport->phy);
833835
/* put the controller in non-driving mode */
834-
property_enable(base, &rphy->phy_cfg->chg_det.opmode, false);
836+
if (!vbus_attach)
837+
property_enable(base, &rphy->phy_cfg->chg_det.opmode, false);
835838
/* Start DCD processing stage 1 */
836839
rockchip_chg_enable_dcd(rphy, true);
837840
rphy->chg_state = USB_CHG_STATE_WAIT_FOR_DCD;
@@ -894,7 +897,8 @@ static void rockchip_chg_detect_work(struct work_struct *work)
894897
fallthrough;
895898
case USB_CHG_STATE_DETECTED:
896899
/* put the controller in normal mode */
897-
property_enable(base, &rphy->phy_cfg->chg_det.opmode, true);
900+
if (!vbus_attach)
901+
property_enable(base, &rphy->phy_cfg->chg_det.opmode, true);
898902
rockchip_usb2phy_otg_sm_work(&rport->otg_sm_work.work);
899903
dev_dbg(&rport->phy->dev, "charger = %s\n",
900904
chg_to_string(rphy->chg_type));
@@ -1491,7 +1495,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
14911495
rphy);
14921496
if (ret) {
14931497
dev_err_probe(rphy->dev, ret, "failed to request usb2phy irq handle\n");
1494-
goto put_child;
1498+
return ret;
14951499
}
14961500
}
14971501

drivers/phy/st/phy-stm32-usbphyc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
712712
}
713713

714714
ret = of_property_read_u32(child, "reg", &index);
715-
if (ret || index > usbphyc->nphys) {
715+
if (ret || index >= usbphyc->nphys) {
716716
dev_err(&phy->dev, "invalid reg property: %d\n", ret);
717717
if (!ret)
718718
ret = -EINVAL;

drivers/phy/tegra/xusb-tegra186.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
#define XUSB_PADCTL_USB2_BIAS_PAD_CTL0 0x284
8585
#define BIAS_PAD_PD BIT(11)
8686
#define HS_SQUELCH_LEVEL(x) (((x) & 0x7) << 0)
87+
#define HS_DISCON_LEVEL(x) (((x) & 0x7) << 3)
8788

8889
#define XUSB_PADCTL_USB2_BIAS_PAD_CTL1 0x288
8990
#define USB2_TRK_START_TIMER(x) (((x) & 0x7f) << 12)
@@ -623,6 +624,8 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl)
623624
value &= ~BIAS_PAD_PD;
624625
value &= ~HS_SQUELCH_LEVEL(~0);
625626
value |= HS_SQUELCH_LEVEL(priv->calib.hs_squelch);
627+
value &= ~HS_DISCON_LEVEL(~0);
628+
value |= HS_DISCON_LEVEL(0x7);
626629
padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL0);
627630

628631
udelay(1);

drivers/phy/ti/phy-da8xx-usb.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev)
180180
struct da8xx_usb_phy_platform_data *pdata = dev->platform_data;
181181
struct device_node *node = dev->of_node;
182182
struct da8xx_usb_phy *d_phy;
183+
int ret;
183184

184185
d_phy = devm_kzalloc(dev, sizeof(*d_phy), GFP_KERNEL);
185186
if (!d_phy)
@@ -233,8 +234,6 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev)
233234
return PTR_ERR(d_phy->phy_provider);
234235
}
235236
} else {
236-
int ret;
237-
238237
ret = phy_create_lookup(d_phy->usb11_phy, "usb-phy",
239238
"ohci-da8xx");
240239
if (ret)
@@ -249,7 +248,9 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev)
249248
PHY_INIT_BITS, PHY_INIT_BITS);
250249

251250
pm_runtime_set_active(dev);
252-
devm_pm_runtime_enable(dev);
251+
ret = devm_pm_runtime_enable(dev);
252+
if (ret)
253+
return ret;
253254
/*
254255
* Prevent runtime pm from being ON by default. Users can enable
255256
* it using power/control in sysfs.

0 commit comments

Comments
 (0)