Xilinx ZynqMP USB fixes
Subsystems (3)
v5 cover Xilinx ZynqMP USB fixes
Some fixes related to the Xilinx ZynqMP DWC3 wrapper driver to allow ZynqMP USB to work properly when the hardware is configured in USB 2.0-only mode.
Changes since v4:
-dropped DWC3 core patches as they are superseded by Sean Anderson's patchset "usb: dwc3: Calculate REFCLKPER et. al. from reference clock", ZynqMP-specific patches unchanged
Changes since v3:
-fixed DT schema dt-doc-validate error
Changes since v2:
-additional kerneldoc fixes
Changes since v1:
-added DT binding documentation for new attribute
-kerneldoc formatting and reworded comments
Robert Hancock (2):
usb: dwc3: xilinx: Fix PIPE clock selection for USB2.0 mode
usb: dwc3: xilinx: Fix error handling when getting USB3 PHY
drivers/usb/dwc3/dwc3-xilinx.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.31.1
PATCH v5 1/2 usb: dwc3: xilinx: Fix PIPE clock selection for USB2.0 mode
It appears that the PIPE clock should not be selected when only USB 2.0 is being used in the design and no USB 3.0 reference clock is used. Fix to set the correct value depending on whether a USB3 PHY is present.
--- drivers/usb/dwc3/dwc3-xilinx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/dwc3/dwc3-xilinx.c +5 -2
@@ -167,8 +167,11 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)/* Set PIPE Power Present signal in FPD Power Present Register*/ writel (FPD_POWER_PRSNT_OPTION , priv_data->regs +XLNX_USB_FPD_POWER_PRSNT ); -/* Set the PIPE Clock Select bit in FPD PIPE Clock register */ -writel (PIPE_CLK_SELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); +/* Set the PIPE Clock Select bit in FPD PIPE Clock register if a USB3 +* PHY is in use, deselect otherwise +*/ +writel (usb3_phy ?PIPE_CLK_SELECT :PIPE_CLK_DESELECT , + priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); ret =reset_control_deassert (crst);if (ret <0 ) {
Signature · 1 line
2.31.1
Re: [PATCH v5 1/2] usb: dwc3: xilinx: Fix PIPE clock selection for USB2.0 mode
Quoted 15 lines · Robert Hancock
It appears that the PIPE clock should not be selected when only USB 2.0 is being used in the design and no USB 3.0 reference clock is used. Fix to set the correct value depending on whether a USB3 PHY is present.
Fixes 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")Signed-off-by Robert Hancock <[email protected]>--- drivers/usb/dwc3/dwc3-xilinx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/usb/dwc3/dwc3-xilinx.c +0
-0
drivers/usb/dwc3/dwc3-xilinx.c static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) · line 170
Quoted 6 lines
drivers/usb/dwc3/dwc3-xilinx.c +1
-2@@ -167,8 +167,11 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)/* Set PIPE Power Present signal in FPD Power Present Register*/ writel (FPD_POWER_PRSNT_OPTION , priv_data->regs +XLNX_USB_FPD_POWER_PRSNT ); -/* Set the PIPE Clock Select bit in FPD PIPE Clock register */ -writel (PIPE_CLK_SELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); +/* Set the PIPE Clock Select bit in FPD PIPE Clock register if a USB3
nit: this is likely comment for net not for the rest. You should use multiline comment in this format. /*
* Set...
M
Re: [PATCH v5 1/2] usb: dwc3: xilinx: Fix PIPE clock selection for USB2.0 mode
Quoted 32 lines · Michal Simek
Quoted 16 lines · Robert Hancock
It appears that the PIPE clock should not be selected when only USB 2.0 is being used in the design and no USB 3.0 reference clock is used. Fix to set the correct value depending on whether a USB3 PHY is present.
Fixes 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")Signed-off-by Robert Hancock <[email protected]>--- drivers/usb/dwc3/dwc3-xilinx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/usb/dwc3/dwc3- renamed from drivers/usb/dwc3/dwc3-xilinx.c +0
-0
xilinx.c
index9cc3ad701a29..3bc035376394100644drivers/usb/dwc3/dwc3-xilinx.c static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx · line 172
Quoted 8 lines
drivers/usb/dwc3/dwc3-xilinx.c +1
-2@@ -167,8 +167,11 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)/* Set PIPE Power Present signal in FPD Power Present Register*/ writel (FPD_POWER_PRSNT_OPTION , priv_data->regs +XLNX_USB_FPD_POWER_PRSNT ); -/* Set the PIPE Clock Select bit in FPD PIPE Clock register */ -writel (PIPE_CLK_SELECT , priv_data->regs +XLNX_USB_FPD_PIPE_CLK ); +/* Set the PIPE Clock Select bit in FPD PIPE Clock register if a USB3 nit: this is likely comment for net not for the rest. You should use multiline comment in this format. /*
* Set...
Quoted 1 line
M
Yup, will change.
Signature · 3 lines
Robert Hancock Senior Hardware Designer, Calian Advanced Technologies www.calian.com
PATCH v5 2/2 usb: dwc3: xilinx: Fix error handling when getting USB3 PHY
In reply to Robert HancockThe code that looked up the USB3 PHY was ignoring all errors other than EPROBE_DEFER in an attempt to handle the PHY not being present. Fix and simplify the code by using devm_phy_optional_get and dev_err_probe so that a missing PHY is not treated as an error and unexpected errors are handled properly.
--- drivers/usb/dwc3/dwc3-xilinx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-xilinx.c +5 -5
@@ -102,12 +102,12 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)int ret;u32 reg; - usb3_phy =devm_phy_get (dev,"usb3-phy" ); -if (PTR_ERR (usb3_phy) == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; + usb3_phy =devm_phy_optional_get (dev,"usb3-phy" ); +if (IS_ERR (usb3_phy)) { + ret =PTR_ERR (usb3_phy); +dev_err_probe (dev, ret, +"failed to get USB3 PHY\n" ); goto err; - }else if (IS_ERR (usb3_phy)) { - usb3_phy =NULL ; } crst =devm_reset_control_get_exclusive (dev,"usb_crst" );
Signature · 1 line
2.31.1
Re: [PATCH v5 2/2] usb: dwc3: xilinx: Fix error handling when getting USB3 PHY
Quoted 18 lines · Robert Hancock
The code that looked up the USB3 PHY was ignoring all errors other than
EPROBE_DEFERin an attempt to handle the PHY not being present. Fix and simplify the code by usingdevm_phy_optional_getanddev_err_probeso that a missing PHY is not treated as an error and unexpected errors are handled properly.Fixes 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")Signed-off-by Robert Hancock <[email protected]>--- drivers/usb/dwc3/dwc3-xilinx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/usb/dwc3/dwc3-xilinx.c +0
-0@@ -102,12 +102,12 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)int ret;
drivers/usb/dwc3/dwc3-xilinx.c static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) · line 109
Quoted 10 lines
drivers/usb/dwc3/dwc3-xilinx.c +5
-3u32 reg; - usb3_phy =devm_phy_get (dev,"usb3-phy" ); -if (PTR_ERR (usb3_phy) == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; + usb3_phy =devm_phy_optional_get (dev,"usb3-phy" ); +if (IS_ERR (usb3_phy)) { + ret =PTR_ERR (usb3_phy); +dev_err_probe (dev, ret, +"failed to get USB3 PHY\n" );
nit: Doesn't it fit to one line?
M
Re: [PATCH v5 2/2] usb: dwc3: xilinx: Fix error handling when getting USB3 PHY
Quoted 35 lines · Michal Simek
Quoted 20 lines · Robert Hancock
The code that looked up the USB3 PHY was ignoring all errors other than
EPROBE_DEFERin an attempt to handle the PHY not being present. Fix and simplify the code by usingdevm_phy_optional_getanddev_err_probeso that a missing PHY is not treated as an error and unexpected errors are handled properly.Fixes 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")Signed-off-by Robert Hancock <[email protected]>--- drivers/usb/dwc3/dwc3-xilinx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/usb/dwc3/dwc3- renamed from drivers/usb/dwc3/dwc3-xilinx.c +0
-0
xilinx.c
index3bc035376394..3b16e7610009100644drivers/usb/dwc3/dwc3-xilinx.c +0
-0@@ -102,12 +102,12 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)int ret;drivers/usb/dwc3/dwc3-xilinx.c static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx · line 110
Quoted 10 lines
drivers/usb/dwc3/dwc3-xilinx.c +5
-3u32 reg; - usb3_phy =devm_phy_get (dev,"usb3-phy" ); -if (PTR_ERR (usb3_phy) == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; + usb3_phy =devm_phy_optional_get (dev,"usb3-phy" ); +if (IS_ERR (usb3_phy)) { + ret =PTR_ERR (usb3_phy); +dev_err_probe (dev, ret, +"failed to get USB3 PHY\n" );nit: Doesn't it fit to one line?
Quoted 1 line
M
Yup, not sure why I wrapped the lines. Will change.
Signature · 3 lines
Robert Hancock Senior Hardware Designer, Calian Advanced Technologies www.calian.com