usb: dwc3: Support option to disable USB2 LPM
PATCH 3/3 usb: dwc3: Support option to disable USB2 LPM
Hi,
Quoted 15 lines · Thinh Nguyen
Support the option to disable USB2 LPM. Set xhci "usb2-lpm-disable" property via "snps,usb2-lpm-disable" property.
Signed-off-by Thinh Nguyen <[email protected]>--- drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-)drivers/usb/dwc3/core.c +0
-0
drivers/usb/dwc3/core.c static void dwc3_get_properties(struct dwc3 *dwc) · line 1252
Quoted 5 lines
drivers/usb/dwc3/core.c +2
-0@@ -1248,6 +1248,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) &hird_threshold); dwc->usb3_lpm_capable =device_property_read_bool (dev,"snps,usb3_lpm_capable" ); + dwc->usb2_lpm_disable =device_property_read_bool (dev, +"snps,usb2-lpm-disable" );
Can we use the same logic as usb3_lpm instead?
i.e. enable USB2 LPM only if "snps,usb2_lpm_capable" is present in DT. This is because older platforms that are not tested for usb2 lpm might break if you enable it by default.
Also can we have some consistency in usage of '-' vs '_'?
Quoted 38 lines
drivers/usb/dwc3/core.c +0
-0device_property_read_u8 (dev,"snps,rx-thr-num-pkt-prd" , &rx_thr_num_pkt_prd); device_property_read_u8(dev, "snps,rx-max-burst-prd",drivers/usb/dwc3/core.h +2
-0@@ -971,6 +971,7 @@ struct dwc3_scratchpad_array {* @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround * @three_stage_setup: set if we perform a three phase setup * @usb3_lpm_capable: set if hadrware supports Link Power Management +* @usb2_lpm_disable: set to disable usb2 lpm * @disable_scramble_quirk: set if we enable the disable scramble quirk * @u2exit_lfps_quirk: set if we enable u2exit lfps quirk * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk @@ -1146,6 +1147,7 @@ struct dwc3 { unsigned setup_packet_pending:1; unsigned three_stage_setup:1; unsigned usb3_lpm_capable:1; + unsigned usb2_lpm_disable:1; unsigned disable_scramble_quirk:1; unsigned u2exit_lfps_quirk:1;drivers/usb/dwc3/host.c +1
-1@@ -46,7 +46,7 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)int dwc3_host_init (struct dwc3 *dwc) { -struct property_entry props[3 ]; +struct property_entry props[4 ];struct platform_device *xhci;int ret, irq;struct resource *res;
drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 101
Quoted 9 lines
drivers/usb/dwc3/host.c +3
-0@@ -93,6 +93,9 @@ int dwc3_host_init(struct dwc3 *dwc)if (dwc->usb3_lpm_capable) props[prop_idx++].name ="usb3-lpm-capable" ; +if (dwc->usb2_lpm_disable) + props[prop_idx++].name ="usb2-lpm-disable" ; +/** * WORKAROUND: dwc3 revisions <=3.00a have a limitation * where Port Disable command doesn't work.
cheers,
-roger