From 9eb9b42c0acc42f46deba696da63582a4a32a9fb Mon Sep 17 00:00:00 2001 From: Ye Li Date: Tue, 10 Apr 2018 19:33:53 -0700 Subject: [PATCH] MLK-17210 usb: imx8m: Add PU power on/off to USB ATF will power off all PUs at default, so for USB, we enable its PU power for both host and device modes in board_usb_init and disable the power when usb is stop in board_usb_cleanup. Signed-off-by: Ye Li Reviewed-by: Li Jun (cherry picked from commit 20e8f5ab5e18fa578283ad232e500a47e71fdd28) --- arch/arm/include/asm/arch-imx8m/sys_proto.h | 1 + arch/arm/mach-imx/imx8m/soc.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/arm/include/asm/arch-imx8m/sys_proto.h b/arch/arm/include/asm/arch-imx8m/sys_proto.h index d328542ece..3e54f9b676 100644 --- a/arch/arm/include/asm/arch-imx8m/sys_proto.h +++ b/arch/arm/include/asm/arch-imx8m/sys_proto.h @@ -11,6 +11,7 @@ void set_wdog_reset(struct wdog_regs *wdog); void enable_tzc380(void); void restore_boot_params(void); +int imx8m_usb_power(int usb_id, bool on); extern unsigned long rom_pointer[]; enum boot_device get_boot_device(void); bool is_usb_boot(void); diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index fb32475039..4e4dfb5c13 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -328,3 +328,22 @@ int arch_misc_init(void) return 0; } #endif + +#ifdef CONFIG_USB_XHCI_IMX8M +#define FSL_SIP_GPC 0xC2000000 +#define FSL_SIP_CONFIG_GPC_PM_DOMAIN 0x03 +int imx8m_usb_power(int usb_id, bool on) +{ + unsigned long ret; + + if (usb_id > 1) + return -EINVAL; + + ret = call_imx_sip(FSL_SIP_GPC, + FSL_SIP_CONFIG_GPC_PM_DOMAIN, 2 + usb_id, on, 0); + if (ret) + return -EPERM; + + return 0; +} +#endif -- 2.17.1