It is used to let the PHY enters low power mode at controller suspend routine. Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx> --- drivers/usb/chipidea/bits.h | 1 + drivers/usb/chipidea/core.c | 14 ++++++++++++++ include/linux/usb/chipidea.h | 1 + 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index dd0cf9e..9f936a3 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -48,6 +48,7 @@ #define PORTSC_SUSP BIT(7) #define PORTSC_HSP BIT(9) #define PORTSC_PTC (0x0FUL << 16) +#define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) /* PTS and PTW for non lpm version only */ #define PORTSC_PTS(d) \ ((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index c47a6b4..a68e281 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -451,6 +451,20 @@ void ci_hdrc_remove_device(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(ci_hdrc_remove_device); +void ci_hdrc_enter_lpm(struct platform_device *pdev, bool enable) +{ + struct ci_hdrc *ci = platform_get_drvdata(pdev); + enum ci_hw_regs reg = ci->hw_bank.lpm ? OP_DEVLC : OP_PORTSC; + + if (enable) + hw_write(ci, reg, PORTSC_PHCD(ci->hw_bank.lpm), + PORTSC_PHCD(ci->hw_bank.lpm)); + else + hw_write(ci, reg, PORTSC_PHCD(ci->hw_bank.lpm), + 0); +} +EXPORT_SYMBOL_GPL(ci_hdrc_enter_lpm); + static inline void ci_role_destroy(struct ci_hdrc *ci) { ci_hdrc_gadget_destroy(ci); diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 7d39967..0263730 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -41,4 +41,5 @@ struct platform_device *ci_hdrc_add_device(struct device *dev, /* Remove ci hdrc device */ void ci_hdrc_remove_device(struct platform_device *pdev); +void ci_hdrc_enter_lpm(struct platform_device *pdev, bool enable); #endif -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html