Loading Documentation/devicetree/bindings/usb/dwc3.txt +5 −5 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ Optional properties: - snps,nominal-elastic-buffer: When set, the nominal elastic buffer setting is used. By default, the half-full setting is used. - snps,usb3-u1u2-disable: If present, disable u1u2 low power modes for DWC3 core controller in SS mode. - snps,hird_thresh: If present, will determine the value of DCTL[HIRD_Thresh] which, in turn, controls the UTMI sleep mechanism vs. the PHY. Default value is 12. - snps,bus-suspend-enable: If present then controller supports low power mode during bus suspend. - snps,lpm-nyet-thresh: If present, will determine the value of DCTL[LPM_NYET_Thres]. If BESL value received from the host in the LPM token is less than this value we send LPM ACK to the host. Otherwise the device returns LPM NYET. - snps,disable-clk-gating: If present, disable controller's internal clock gating. Default it is enabled. - snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled - snps,lpm-nyet-threshold: LPM NYET threshold - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal utmi_l1_suspend_n, false when asserts utmi_sleep_n - snps,hird-threshold: HIRD threshold This is usually a subnode to DWC3 glue to which it is connected. Loading arch/arm/boot/dts/qcom/mdm9640.dtsi +3 −2 Original line number Diff line number Diff line Loading @@ -653,8 +653,9 @@ snps,nominal-elastic-buffer; snps,hsphy-auto-suspend-disable; snps,ssphy-auto-suspend-disable; snps,hird_thresh = <0x7>; snps,lpm-nyet-thresh = <0x8>; snps,has-lpm-erratum; snps,lpm-nyet-threshold = /bits/ 8 <0x8>; snps,hird-threshold = /bits/ 8 <0x7>; snps,bus-suspend-enable; snps,usb3-u1u2-disable; }; Loading arch/arm/boot/dts/qcom/msm8996.dtsi +4 −2 Original line number Diff line number Diff line Loading @@ -2086,7 +2086,8 @@ tx-fifo-resize; snps,usb3-u1u2-disable; snps,nominal-elastic-buffer; snps,hird_thresh = <0x10>; snps,is-utmi-l1-suspend; snps,hird-threshold = /bits/ 8 <0x0>; }; qcom,usbbam@6b04000 { Loading Loading @@ -2187,7 +2188,8 @@ usb-phy = <&qusb_phy1>, <&usb_nop_phy>; maximum-speed = "high-speed"; snps,nominal-elastic-buffer; snps,hird_thresh = <0x10>; snps,is-utmi-l1-suspend; snps,hird-threshold = /bits/ 8 <0x0>; }; }; Loading drivers/usb/dwc3/core.c +33 −17 Original line number Diff line number Diff line Loading @@ -45,8 +45,6 @@ #include "debug.h" #define DWC3_DCTL_HIRD_THRES_DEFAULT 12 /* -------------------------------------------------------------------------- */ void dwc3_set_mode(struct dwc3 *dwc, u32 mode) Loading Loading @@ -785,15 +783,14 @@ static int dwc3_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; struct resource *res; struct dwc3 *dwc; u8 lpm_nyet_threshold; u8 hird_threshold; int ret; void __iomem *regs; void *mem; u32 hird_thresh; u32 lpm_nyet_thresh; mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL); if (!mem) return -ENOMEM; Loading Loading @@ -844,10 +841,28 @@ static int dwc3_probe(struct platform_device *pdev) */ res->start -= DWC3_GLOBALS_REGS_START; /* default to highest possible threshold */ lpm_nyet_threshold = 0xff; /* * default to assert utmi_sleep_n and use maximum allowed HIRD * threshold value of 0b1100 */ hird_threshold = 12; if (node) { dwc->maximum_speed = of_usb_get_maximum_speed(node); dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); dwc->has_lpm_erratum = of_property_read_bool(node, "snps,has-lpm-erratum"); of_property_read_u8(node, "snps,lpm-nyet-threshold", &lpm_nyet_threshold); dwc->is_utmi_l1_suspend = of_property_read_bool(node, "snps,is-utmi-l1-suspend"); of_property_read_u8(node, "snps,hird-threshold", &hird_threshold); dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); dwc->dr_mode = of_usb_get_dr_mode(node); dwc->nominal_elastic_buffer = of_property_read_bool(node, "snps,nominal-elastic-buffer"); Loading @@ -855,16 +870,6 @@ static int dwc3_probe(struct platform_device *pdev) "snps,usb3-u1u2-disable"); dwc->enable_bus_suspend = of_property_read_bool(node, "snps,bus-suspend-enable"); ret = of_property_read_u32(node, "snps,hird_thresh", &hird_thresh); if (!ret) dwc->hird_thresh = (u8) hird_thresh; else dwc->hird_thresh = DWC3_DCTL_HIRD_THRES_DEFAULT; ret = of_property_read_u32(node, "snps,lpm-nyet-thresh", &lpm_nyet_thresh); if (!ret) dwc->lpm_nyet_thresh = (u8)lpm_nyet_thresh; dwc->disable_clk_gating = of_property_read_bool(node, "snps,disable-clk-gating"); Loading @@ -874,6 +879,12 @@ static int dwc3_probe(struct platform_device *pdev) } } else if (pdata) { dwc->maximum_speed = pdata->maximum_speed; dwc->has_lpm_erratum = pdata->has_lpm_erratum; if (pdata->lpm_nyet_threshold) lpm_nyet_threshold = pdata->lpm_nyet_threshold; dwc->is_utmi_l1_suspend = pdata->is_utmi_l1_suspend; if (pdata->hird_threshold) hird_threshold = pdata->hird_threshold; dwc->needs_fifo_resize = pdata->tx_fifo_resize; dwc->dr_mode = pdata->dr_mode; Loading @@ -883,6 +894,11 @@ static int dwc3_probe(struct platform_device *pdev) if (dwc->maximum_speed == USB_SPEED_UNKNOWN) dwc->maximum_speed = USB_SPEED_SUPER; dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->hird_threshold = hird_threshold | (dwc->is_utmi_l1_suspend << 4); ret = dwc3_core_get_phy(dwc); if (ret) return ret; Loading drivers/usb/dwc3/core.h +23 −16 Original line number Diff line number Diff line Loading @@ -267,9 +267,6 @@ #define DWC3_DCTL_APPL1RES (1 << 23) #define DWC3_DCTL_LPM_NYET_THRES_MASK (0x0f << 20) #define DWC3_DCTL_LPM_NYET_THRES(n) ((n) << 20) /* These apply for core versions 1.87a and earlier */ #define DWC3_DCTL_TRGTULST_MASK (0x0f << 17) #define DWC3_DCTL_TRGTULST(n) ((n) << 17) Loading @@ -280,6 +277,9 @@ #define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6)) /* These apply for core versions 1.94a and later */ #define DWC3_DCTL_LPM_ERRATA_MASK DWC3_DCTL_LPM_ERRATA(0xf) #define DWC3_DCTL_LPM_ERRATA(n) ((n) << 20) #define DWC3_DCTL_KEEP_CONNECT (1 << 19) #define DWC3_DCTL_L1_HIBER_EN (1 << 18) #define DWC3_DCTL_CRS (1 << 17) Loading Loading @@ -781,10 +781,17 @@ struct dwc3_scratchpad_array { * @regset: debugfs pointer to regdump file * @test_mode: true when we're entering a USB test mode * @test_mode_nr: test feature selector * @lpm_nyet_threshold: LPM NYET response threshold * @hird_threshold: HIRD threshold * @delayed_status: true when gadget driver asks for delayed status * @ep0_bounced: true when we used bounce buffer * @ep0_expect_in: true when we expect a DATA IN transfer * @has_hibernation: true when dwc3 was configured with Hibernation * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that * there's now way for software to detect this in runtime. * @is_utmi_l1_suspend: the core asserts output signal * 0 - utmi_sleep_n * 1 - utmi_l1_suspend_n * @is_selfpowered: true when we are selfpowered * @needs_fifo_resize: not all users might want fifo resizing, flag it * @pullups_connected: true when Run/Stop bit is set Loading @@ -795,8 +802,6 @@ struct dwc3_scratchpad_array { * @is_drd: device supports dual-role or not * @err_evt_seen: previous event in queue was erratic error * @usb3_u1u2_disable: if true, disable U1U2 low power modes in Superspeed mode. * @hird_thresh: value to configure in DCTL[HIRD_Thresh] * @lpm_nyet_thresh: value to configure in DCTL[LPM_NYET_Thresh] * @in_lpm: if 1, indicates that the controller is in low power mode (no clocks) * @tx_fifo_size: Available RAM size for TX fifo allocation * @irq: irq number Loading Loading @@ -899,6 +904,8 @@ struct dwc3 { u8 test_mode; u8 test_mode_nr; u8 lpm_nyet_threshold; u8 hird_threshold; void (*notify_event) (struct dwc3 *, unsigned); struct work_struct wakeup_work; Loading @@ -907,6 +914,8 @@ struct dwc3 { unsigned ep0_bounced:1; unsigned ep0_expect_in:1; unsigned has_hibernation:1; unsigned has_lpm_erratum:1; unsigned is_utmi_l1_suspend:1; unsigned is_selfpowered:1; unsigned needs_fifo_resize:1; unsigned pullups_connected:1; Loading @@ -931,8 +940,6 @@ struct dwc3 { struct dwc3_gadget_events dbg_gadget_events; u8 hird_thresh; u8 lpm_nyet_thresh; atomic_t in_lpm; int tx_fifo_size; bool b_suspend; Loading Loading
Documentation/devicetree/bindings/usb/dwc3.txt +5 −5 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ Optional properties: - snps,nominal-elastic-buffer: When set, the nominal elastic buffer setting is used. By default, the half-full setting is used. - snps,usb3-u1u2-disable: If present, disable u1u2 low power modes for DWC3 core controller in SS mode. - snps,hird_thresh: If present, will determine the value of DCTL[HIRD_Thresh] which, in turn, controls the UTMI sleep mechanism vs. the PHY. Default value is 12. - snps,bus-suspend-enable: If present then controller supports low power mode during bus suspend. - snps,lpm-nyet-thresh: If present, will determine the value of DCTL[LPM_NYET_Thres]. If BESL value received from the host in the LPM token is less than this value we send LPM ACK to the host. Otherwise the device returns LPM NYET. - snps,disable-clk-gating: If present, disable controller's internal clock gating. Default it is enabled. - snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled - snps,lpm-nyet-threshold: LPM NYET threshold - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal utmi_l1_suspend_n, false when asserts utmi_sleep_n - snps,hird-threshold: HIRD threshold This is usually a subnode to DWC3 glue to which it is connected. Loading
arch/arm/boot/dts/qcom/mdm9640.dtsi +3 −2 Original line number Diff line number Diff line Loading @@ -653,8 +653,9 @@ snps,nominal-elastic-buffer; snps,hsphy-auto-suspend-disable; snps,ssphy-auto-suspend-disable; snps,hird_thresh = <0x7>; snps,lpm-nyet-thresh = <0x8>; snps,has-lpm-erratum; snps,lpm-nyet-threshold = /bits/ 8 <0x8>; snps,hird-threshold = /bits/ 8 <0x7>; snps,bus-suspend-enable; snps,usb3-u1u2-disable; }; Loading
arch/arm/boot/dts/qcom/msm8996.dtsi +4 −2 Original line number Diff line number Diff line Loading @@ -2086,7 +2086,8 @@ tx-fifo-resize; snps,usb3-u1u2-disable; snps,nominal-elastic-buffer; snps,hird_thresh = <0x10>; snps,is-utmi-l1-suspend; snps,hird-threshold = /bits/ 8 <0x0>; }; qcom,usbbam@6b04000 { Loading Loading @@ -2187,7 +2188,8 @@ usb-phy = <&qusb_phy1>, <&usb_nop_phy>; maximum-speed = "high-speed"; snps,nominal-elastic-buffer; snps,hird_thresh = <0x10>; snps,is-utmi-l1-suspend; snps,hird-threshold = /bits/ 8 <0x0>; }; }; Loading
drivers/usb/dwc3/core.c +33 −17 Original line number Diff line number Diff line Loading @@ -45,8 +45,6 @@ #include "debug.h" #define DWC3_DCTL_HIRD_THRES_DEFAULT 12 /* -------------------------------------------------------------------------- */ void dwc3_set_mode(struct dwc3 *dwc, u32 mode) Loading Loading @@ -785,15 +783,14 @@ static int dwc3_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; struct resource *res; struct dwc3 *dwc; u8 lpm_nyet_threshold; u8 hird_threshold; int ret; void __iomem *regs; void *mem; u32 hird_thresh; u32 lpm_nyet_thresh; mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL); if (!mem) return -ENOMEM; Loading Loading @@ -844,10 +841,28 @@ static int dwc3_probe(struct platform_device *pdev) */ res->start -= DWC3_GLOBALS_REGS_START; /* default to highest possible threshold */ lpm_nyet_threshold = 0xff; /* * default to assert utmi_sleep_n and use maximum allowed HIRD * threshold value of 0b1100 */ hird_threshold = 12; if (node) { dwc->maximum_speed = of_usb_get_maximum_speed(node); dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); dwc->has_lpm_erratum = of_property_read_bool(node, "snps,has-lpm-erratum"); of_property_read_u8(node, "snps,lpm-nyet-threshold", &lpm_nyet_threshold); dwc->is_utmi_l1_suspend = of_property_read_bool(node, "snps,is-utmi-l1-suspend"); of_property_read_u8(node, "snps,hird-threshold", &hird_threshold); dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); dwc->dr_mode = of_usb_get_dr_mode(node); dwc->nominal_elastic_buffer = of_property_read_bool(node, "snps,nominal-elastic-buffer"); Loading @@ -855,16 +870,6 @@ static int dwc3_probe(struct platform_device *pdev) "snps,usb3-u1u2-disable"); dwc->enable_bus_suspend = of_property_read_bool(node, "snps,bus-suspend-enable"); ret = of_property_read_u32(node, "snps,hird_thresh", &hird_thresh); if (!ret) dwc->hird_thresh = (u8) hird_thresh; else dwc->hird_thresh = DWC3_DCTL_HIRD_THRES_DEFAULT; ret = of_property_read_u32(node, "snps,lpm-nyet-thresh", &lpm_nyet_thresh); if (!ret) dwc->lpm_nyet_thresh = (u8)lpm_nyet_thresh; dwc->disable_clk_gating = of_property_read_bool(node, "snps,disable-clk-gating"); Loading @@ -874,6 +879,12 @@ static int dwc3_probe(struct platform_device *pdev) } } else if (pdata) { dwc->maximum_speed = pdata->maximum_speed; dwc->has_lpm_erratum = pdata->has_lpm_erratum; if (pdata->lpm_nyet_threshold) lpm_nyet_threshold = pdata->lpm_nyet_threshold; dwc->is_utmi_l1_suspend = pdata->is_utmi_l1_suspend; if (pdata->hird_threshold) hird_threshold = pdata->hird_threshold; dwc->needs_fifo_resize = pdata->tx_fifo_resize; dwc->dr_mode = pdata->dr_mode; Loading @@ -883,6 +894,11 @@ static int dwc3_probe(struct platform_device *pdev) if (dwc->maximum_speed == USB_SPEED_UNKNOWN) dwc->maximum_speed = USB_SPEED_SUPER; dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->hird_threshold = hird_threshold | (dwc->is_utmi_l1_suspend << 4); ret = dwc3_core_get_phy(dwc); if (ret) return ret; Loading
drivers/usb/dwc3/core.h +23 −16 Original line number Diff line number Diff line Loading @@ -267,9 +267,6 @@ #define DWC3_DCTL_APPL1RES (1 << 23) #define DWC3_DCTL_LPM_NYET_THRES_MASK (0x0f << 20) #define DWC3_DCTL_LPM_NYET_THRES(n) ((n) << 20) /* These apply for core versions 1.87a and earlier */ #define DWC3_DCTL_TRGTULST_MASK (0x0f << 17) #define DWC3_DCTL_TRGTULST(n) ((n) << 17) Loading @@ -280,6 +277,9 @@ #define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6)) /* These apply for core versions 1.94a and later */ #define DWC3_DCTL_LPM_ERRATA_MASK DWC3_DCTL_LPM_ERRATA(0xf) #define DWC3_DCTL_LPM_ERRATA(n) ((n) << 20) #define DWC3_DCTL_KEEP_CONNECT (1 << 19) #define DWC3_DCTL_L1_HIBER_EN (1 << 18) #define DWC3_DCTL_CRS (1 << 17) Loading Loading @@ -781,10 +781,17 @@ struct dwc3_scratchpad_array { * @regset: debugfs pointer to regdump file * @test_mode: true when we're entering a USB test mode * @test_mode_nr: test feature selector * @lpm_nyet_threshold: LPM NYET response threshold * @hird_threshold: HIRD threshold * @delayed_status: true when gadget driver asks for delayed status * @ep0_bounced: true when we used bounce buffer * @ep0_expect_in: true when we expect a DATA IN transfer * @has_hibernation: true when dwc3 was configured with Hibernation * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that * there's now way for software to detect this in runtime. * @is_utmi_l1_suspend: the core asserts output signal * 0 - utmi_sleep_n * 1 - utmi_l1_suspend_n * @is_selfpowered: true when we are selfpowered * @needs_fifo_resize: not all users might want fifo resizing, flag it * @pullups_connected: true when Run/Stop bit is set Loading @@ -795,8 +802,6 @@ struct dwc3_scratchpad_array { * @is_drd: device supports dual-role or not * @err_evt_seen: previous event in queue was erratic error * @usb3_u1u2_disable: if true, disable U1U2 low power modes in Superspeed mode. * @hird_thresh: value to configure in DCTL[HIRD_Thresh] * @lpm_nyet_thresh: value to configure in DCTL[LPM_NYET_Thresh] * @in_lpm: if 1, indicates that the controller is in low power mode (no clocks) * @tx_fifo_size: Available RAM size for TX fifo allocation * @irq: irq number Loading Loading @@ -899,6 +904,8 @@ struct dwc3 { u8 test_mode; u8 test_mode_nr; u8 lpm_nyet_threshold; u8 hird_threshold; void (*notify_event) (struct dwc3 *, unsigned); struct work_struct wakeup_work; Loading @@ -907,6 +914,8 @@ struct dwc3 { unsigned ep0_bounced:1; unsigned ep0_expect_in:1; unsigned has_hibernation:1; unsigned has_lpm_erratum:1; unsigned is_utmi_l1_suspend:1; unsigned is_selfpowered:1; unsigned needs_fifo_resize:1; unsigned pullups_connected:1; Loading @@ -931,8 +940,6 @@ struct dwc3 { struct dwc3_gadget_events dbg_gadget_events; u8 hird_thresh; u8 lpm_nyet_thresh; atomic_t in_lpm; int tx_fifo_size; bool b_suspend; Loading