Skip to content

Commit b8f0c6b

Browse files
authored
Fix usb crash in qualcomm platforms (#1211)
Fix usb crash in qualcomm platforms
2 parents 2664f7c + 32fc1bd commit b8f0c6b

5 files changed

Lines changed: 11 additions & 16 deletions

File tree

‎drivers/usb/dwc3/core.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,9 @@ static void dwc3_get_software_properties(struct dwc3 *dwc,
16941694
if (properties->needs_full_reinit)
16951695
dwc->needs_full_reinit = true;
16961696

1697+
if (properties->skip_phy_init)
1698+
dwc->skip_phy_init = true;
1699+
16971700
dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED;
16981701

16991702
if (properties->gsbuscfg0_reqinfo !=

‎drivers/usb/dwc3/core.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,7 @@ struct dwc3 {
14151415
unsigned wakeup_configured:1;
14161416
unsigned suspended:1;
14171417
unsigned susphy_state:1;
1418+
unsigned skip_phy_init:1;
14181419

14191420
u16 imod_interval;
14201421

‎drivers/usb/dwc3/dwc3-qcom.c‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/usb/hcd.h>
2222
#include <linux/pm_domain.h>
2323
#include <linux/usb.h>
24-
#include <linux/property.h>
2524
#include <linux/usb/qcom_eud.h>
2625
#include "core.h"
2726
#include "glue.h"
@@ -448,16 +447,6 @@ static irqreturn_t qcom_dwc3_resume_irq(int irq, void *data)
448447
return IRQ_HANDLED;
449448
}
450449

451-
static int dwc3_qcom_set_swnode(struct device *dev)
452-
{
453-
const struct property_entry props[] = {
454-
PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk"),
455-
{}
456-
};
457-
458-
return device_create_managed_software_node(dev, props, NULL);
459-
}
460-
461450
static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom)
462451
{
463452
/* Configure dwc3 to use UTMI clock as PIPE clock not present */
@@ -735,10 +724,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
735724
if (ignore_pipe_clk)
736725
dwc3_qcom_select_utmi_clk(qcom);
737726

738-
ret = dwc3_qcom_set_swnode(dev);
739-
if (ret)
740-
goto clk_disable;
741-
742727
qcom->mode = usb_get_dr_mode(dev);
743728

744729
if (qcom->mode == USB_DR_MODE_HOST) {
@@ -761,6 +746,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
761746
probe_data.res = &res;
762747
probe_data.ignore_clocks_and_resets = true;
763748
probe_data.properties = DWC3_DEFAULT_PROPERTIES;
749+
probe_data.properties.skip_phy_init = true;
764750
ret = dwc3_core_probe(&probe_data);
765751
if (ret) {
766752
ret = dev_err_probe(dev, ret, "failed to register DWC3 Core\n");

‎drivers/usb/dwc3/glue.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
* @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field
1515
* @needs_full_reinit: indicate the controller may not remain power during system
1616
* pm and need full initialization
17+
* @skip_phy_init: skip xHCI PHY initialization on host init
1718
*/
1819
struct dwc3_properties {
1920
u32 gsbuscfg0_reqinfo;
2021
unsigned needs_full_reinit:1;
22+
unsigned skip_phy_init:1;
2123
};
2224

2325
#define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){ \

‎drivers/usb/dwc3/host.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)
129129

130130
int dwc3_host_init(struct dwc3 *dwc)
131131
{
132-
struct property_entry props[6];
132+
struct property_entry props[7];
133133
struct platform_device *xhci;
134134
int ret, irq;
135135
int prop_idx = 0;
@@ -173,6 +173,9 @@ int dwc3_host_init(struct dwc3 *dwc)
173173
if (dwc->usb2_lpm_disable)
174174
props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable");
175175

176+
if (dwc->skip_phy_init)
177+
props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk");
178+
176179
/**
177180
* WORKAROUND: dwc3 revisions <=3.00a have a limitation
178181
* where Port Disable command doesn't work.

0 commit comments

Comments
 (0)