diff options
author | Peter Chen <peter.chen@freescale.com> | 2014-11-26 00:44:28 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-26 12:28:12 -0500 |
commit | b82613cf09455d9a50fbb144ef07b68225f2b452 (patch) | |
tree | 2b6a1d400d3bbf93244bf85d503fd66c303ae4da /drivers/usb | |
parent | 6d037db6409c33738c7153e87ae1cf682ca2851b (diff) |
usb: chipidea: add hw_wait_phy_stable for getting stable status
The phy needs some delay to output the stable status from low
power mode. And for OTGSC, the status inputs are debounced
using a 1 ms time constant, so, delay 2ms for controller to get
the stable status(like vbus and id) when the phy leaves low power.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/chipidea/core.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index d87caea261d9..fe3880541efd 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -190,6 +190,17 @@ u8 hw_port_test_get(struct ci_hdrc *ci) | |||
190 | return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC); | 190 | return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC); |
191 | } | 191 | } |
192 | 192 | ||
193 | static void hw_wait_phy_stable(void) | ||
194 | { | ||
195 | /* | ||
196 | * The phy needs some delay to output the stable status from low | ||
197 | * power mode. And for OTGSC, the status inputs are debounced | ||
198 | * using a 1 ms time constant, so, delay 2ms for controller to get | ||
199 | * the stable status, like vbus and id when the phy leaves low power. | ||
200 | */ | ||
201 | usleep_range(2000, 2500); | ||
202 | } | ||
203 | |||
193 | /* The PHY enters/leaves low power mode */ | 204 | /* The PHY enters/leaves low power mode */ |
194 | static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool enable) | 205 | static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool enable) |
195 | { | 206 | { |
@@ -351,7 +362,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) | |||
351 | case USBPHY_INTERFACE_MODE_UTMIW: | 362 | case USBPHY_INTERFACE_MODE_UTMIW: |
352 | case USBPHY_INTERFACE_MODE_HSIC: | 363 | case USBPHY_INTERFACE_MODE_HSIC: |
353 | ret = _ci_usb_phy_init(ci); | 364 | ret = _ci_usb_phy_init(ci); |
354 | if (ret) | 365 | if (!ret) |
366 | hw_wait_phy_stable(); | ||
367 | else | ||
355 | return ret; | 368 | return ret; |
356 | hw_phymode_configure(ci); | 369 | hw_phymode_configure(ci); |
357 | break; | 370 | break; |
@@ -364,6 +377,8 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) | |||
364 | break; | 377 | break; |
365 | default: | 378 | default: |
366 | ret = _ci_usb_phy_init(ci); | 379 | ret = _ci_usb_phy_init(ci); |
380 | if (!ret) | ||
381 | hw_wait_phy_stable(); | ||
367 | } | 382 | } |
368 | 383 | ||
369 | return ret; | 384 | return ret; |
@@ -667,13 +682,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
667 | if (ret) { | 682 | if (ret) { |
668 | dev_err(dev, "unable to init phy: %d\n", ret); | 683 | dev_err(dev, "unable to init phy: %d\n", ret); |
669 | return ret; | 684 | return ret; |
670 | } else { | ||
671 | /* | ||
672 | * The delay to sync PHY's status, the maximum delay is | ||
673 | * 2ms since the otgsc uses 1ms timer to debounce the | ||
674 | * PHY's input | ||
675 | */ | ||
676 | usleep_range(2000, 2500); | ||
677 | } | 685 | } |
678 | 686 | ||
679 | ci->hw_bank.phys = res->start; | 687 | ci->hw_bank.phys = res->start; |