diff options
author | Huang Rui <ray.huang@amd.com> | 2014-10-30 23:11:18 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-11-03 11:03:41 -0500 |
commit | 460d098cb6728134e0e4ba3d58e10bb43032daa5 (patch) | |
tree | fbdd6c3e61e7b5000c8574b9927c614004829574 /drivers/usb/dwc3 | |
parent | 9755449d568b3c2745fc9c7075a7d7833c4528bd (diff) |
usb: dwc3: make HIRD threshold configurable
HIRD threshold should be configurable by different platforms.
From DesignWare databook:
When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or
equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals
utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1.
When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than
HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1.
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/core.c | 17 | ||||
-rw-r--r-- | drivers/usb/dwc3/core.h | 6 | ||||
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 6 | ||||
-rw-r--r-- | drivers/usb/dwc3/platform_data.h | 3 |
4 files changed, 27 insertions, 5 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3ea55f214439..8ae42b8db02b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -730,6 +730,7 @@ static int dwc3_probe(struct platform_device *pdev) | |||
730 | struct dwc3 *dwc; | 730 | struct dwc3 *dwc; |
731 | u8 lpm_nyet_threshold; | 731 | u8 lpm_nyet_threshold; |
732 | u8 tx_de_emphasis; | 732 | u8 tx_de_emphasis; |
733 | u8 hird_threshold; | ||
733 | 734 | ||
734 | int ret; | 735 | int ret; |
735 | 736 | ||
@@ -791,12 +792,22 @@ static int dwc3_probe(struct platform_device *pdev) | |||
791 | /* default to -3.5dB de-emphasis */ | 792 | /* default to -3.5dB de-emphasis */ |
792 | tx_de_emphasis = 1; | 793 | tx_de_emphasis = 1; |
793 | 794 | ||
795 | /* | ||
796 | * default to assert utmi_sleep_n and use maximum allowed HIRD | ||
797 | * threshold value of 0b1100 | ||
798 | */ | ||
799 | hird_threshold = 12; | ||
800 | |||
794 | if (node) { | 801 | if (node) { |
795 | dwc->maximum_speed = of_usb_get_maximum_speed(node); | 802 | dwc->maximum_speed = of_usb_get_maximum_speed(node); |
796 | dwc->has_lpm_erratum = of_property_read_bool(node, | 803 | dwc->has_lpm_erratum = of_property_read_bool(node, |
797 | "snps,has-lpm-erratum"); | 804 | "snps,has-lpm-erratum"); |
798 | of_property_read_u8(node, "snps,lpm-nyet-threshold", | 805 | of_property_read_u8(node, "snps,lpm-nyet-threshold", |
799 | &lpm_nyet_threshold); | 806 | &lpm_nyet_threshold); |
807 | dwc->is_utmi_l1_suspend = of_property_read_bool(node, | ||
808 | "snps,is-utmi-l1-suspend"); | ||
809 | of_property_read_u8(node, "snps,hird-threshold", | ||
810 | &hird_threshold); | ||
800 | 811 | ||
801 | dwc->needs_fifo_resize = of_property_read_bool(node, | 812 | dwc->needs_fifo_resize = of_property_read_bool(node, |
802 | "tx-fifo-resize"); | 813 | "tx-fifo-resize"); |
@@ -832,6 +843,9 @@ static int dwc3_probe(struct platform_device *pdev) | |||
832 | dwc->has_lpm_erratum = pdata->has_lpm_erratum; | 843 | dwc->has_lpm_erratum = pdata->has_lpm_erratum; |
833 | if (pdata->lpm_nyet_threshold) | 844 | if (pdata->lpm_nyet_threshold) |
834 | lpm_nyet_threshold = pdata->lpm_nyet_threshold; | 845 | lpm_nyet_threshold = pdata->lpm_nyet_threshold; |
846 | dwc->is_utmi_l1_suspend = pdata->is_utmi_l1_suspend; | ||
847 | if (pdata->hird_threshold) | ||
848 | hird_threshold = pdata->hird_threshold; | ||
835 | 849 | ||
836 | dwc->needs_fifo_resize = pdata->tx_fifo_resize; | 850 | dwc->needs_fifo_resize = pdata->tx_fifo_resize; |
837 | dwc->dr_mode = pdata->dr_mode; | 851 | dwc->dr_mode = pdata->dr_mode; |
@@ -859,6 +873,9 @@ static int dwc3_probe(struct platform_device *pdev) | |||
859 | dwc->lpm_nyet_threshold = lpm_nyet_threshold; | 873 | dwc->lpm_nyet_threshold = lpm_nyet_threshold; |
860 | dwc->tx_de_emphasis = tx_de_emphasis; | 874 | dwc->tx_de_emphasis = tx_de_emphasis; |
861 | 875 | ||
876 | dwc->hird_threshold = hird_threshold | ||
877 | | (dwc->is_utmi_l1_suspend << 4); | ||
878 | |||
862 | ret = dwc3_core_get_phy(dwc); | 879 | ret = dwc3_core_get_phy(dwc); |
863 | if (ret) | 880 | if (ret) |
864 | return ret; | 881 | return ret; |
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index cf86d3022b52..4bb9aa696ede 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
@@ -675,12 +675,16 @@ struct dwc3_scratchpad_array { | |||
675 | * @test_mode: true when we're entering a USB test mode | 675 | * @test_mode: true when we're entering a USB test mode |
676 | * @test_mode_nr: test feature selector | 676 | * @test_mode_nr: test feature selector |
677 | * @lpm_nyet_threshold: LPM NYET response threshold | 677 | * @lpm_nyet_threshold: LPM NYET response threshold |
678 | * @hird_threshold: HIRD threshold | ||
678 | * @delayed_status: true when gadget driver asks for delayed status | 679 | * @delayed_status: true when gadget driver asks for delayed status |
679 | * @ep0_bounced: true when we used bounce buffer | 680 | * @ep0_bounced: true when we used bounce buffer |
680 | * @ep0_expect_in: true when we expect a DATA IN transfer | 681 | * @ep0_expect_in: true when we expect a DATA IN transfer |
681 | * @has_hibernation: true when dwc3 was configured with Hibernation | 682 | * @has_hibernation: true when dwc3 was configured with Hibernation |
682 | * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that | 683 | * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that |
683 | * there's now way for software to detect this in runtime. | 684 | * there's now way for software to detect this in runtime. |
685 | * @is_utmi_l1_suspend: the core asserts output signal | ||
686 | * 0 - utmi_sleep_n | ||
687 | * 1 - utmi_l1_suspend_n | ||
684 | * @is_selfpowered: true when we are selfpowered | 688 | * @is_selfpowered: true when we are selfpowered |
685 | * @is_fpga: true when we are using the FPGA board | 689 | * @is_fpga: true when we are using the FPGA board |
686 | * @needs_fifo_resize: not all users might want fifo resizing, flag it | 690 | * @needs_fifo_resize: not all users might want fifo resizing, flag it |
@@ -797,12 +801,14 @@ struct dwc3 { | |||
797 | u8 test_mode; | 801 | u8 test_mode; |
798 | u8 test_mode_nr; | 802 | u8 test_mode_nr; |
799 | u8 lpm_nyet_threshold; | 803 | u8 lpm_nyet_threshold; |
804 | u8 hird_threshold; | ||
800 | 805 | ||
801 | unsigned delayed_status:1; | 806 | unsigned delayed_status:1; |
802 | unsigned ep0_bounced:1; | 807 | unsigned ep0_bounced:1; |
803 | unsigned ep0_expect_in:1; | 808 | unsigned ep0_expect_in:1; |
804 | unsigned has_hibernation:1; | 809 | unsigned has_hibernation:1; |
805 | unsigned has_lpm_erratum:1; | 810 | unsigned has_lpm_erratum:1; |
811 | unsigned is_utmi_l1_suspend:1; | ||
806 | unsigned is_selfpowered:1; | 812 | unsigned is_selfpowered:1; |
807 | unsigned is_fpga:1; | 813 | unsigned is_fpga:1; |
808 | unsigned needs_fifo_resize:1; | 814 | unsigned needs_fifo_resize:1; |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 88a065f61150..398c12f5efe3 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -2295,11 +2295,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) | |||
2295 | reg = dwc3_readl(dwc->regs, DWC3_DCTL); | 2295 | reg = dwc3_readl(dwc->regs, DWC3_DCTL); |
2296 | reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN); | 2296 | reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN); |
2297 | 2297 | ||
2298 | /* | 2298 | reg |= DWC3_DCTL_HIRD_THRES(dwc->hird_threshold); |
2299 | * TODO: This should be configurable. For now using | ||
2300 | * maximum allowed HIRD threshold value of 0b1100 | ||
2301 | */ | ||
2302 | reg |= DWC3_DCTL_HIRD_THRES(12); | ||
2303 | 2299 | ||
2304 | /* | 2300 | /* |
2305 | * When dwc3 revisions >= 2.40a, LPM Erratum is enabled and | 2301 | * When dwc3 revisions >= 2.40a, LPM Erratum is enabled and |
diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index 245300be057a..a3a3b6d5668c 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h | |||
@@ -25,6 +25,9 @@ struct dwc3_platform_data { | |||
25 | enum usb_dr_mode dr_mode; | 25 | enum usb_dr_mode dr_mode; |
26 | bool tx_fifo_resize; | 26 | bool tx_fifo_resize; |
27 | 27 | ||
28 | unsigned is_utmi_l1_suspend:1; | ||
29 | u8 hird_threshold; | ||
30 | |||
28 | u8 lpm_nyet_threshold; | 31 | u8 lpm_nyet_threshold; |
29 | 32 | ||
30 | unsigned disable_scramble_quirk:1; | 33 | unsigned disable_scramble_quirk:1; |