Skip to content

Commit

Permalink
imx: Add gpc power control function
Browse files Browse the repository at this point in the history
This adds a generic controller function to handle the various
GPC power regions.  For the HB Pulse we use this to power off
both PCIE regions on boot to help return the devices to a sane
state on reboot and sudden power off.

Signed-off-by: Jon Nettleton <jon@solid-run.com>
  • Loading branch information
jnettlet committed Dec 16, 2018
1 parent c3f941c commit 0dd5174
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/arm/include/asm/arch-imx8m/sys_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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);
int imx8m_gpc_power(int id, bool on);
extern unsigned long rom_pointer[];
enum boot_device get_boot_device(void);
bool is_usb_boot(void);
Expand Down
16 changes: 15 additions & 1 deletion arch/arm/mach-imx/imx8m/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ void reset_cpu(ulong addr)
}
}

#ifdef CONFIG_USB_XHCI_IMX8M
#define FSL_SIP_GPC 0xC2000000
#define FSL_SIP_CONFIG_GPC_PM_DOMAIN 0x03

#ifdef CONFIG_USB_XHCI_IMX8M
int imx8m_usb_power(int usb_id, bool on)
{
unsigned long ret;
Expand All @@ -254,3 +255,16 @@ int imx8m_usb_power(int usb_id, bool on)
return 0;
}
#endif

int imx8m_gpc_power(int id, bool on)
{
unsigned long ret;

ret = call_imx_sip(FSL_SIP_GPC,
FSL_SIP_CONFIG_GPC_PM_DOMAIN, id, on, 0);
if (ret)
return -EPERM;

return 0;
}

3 changes: 3 additions & 0 deletions board/solidrun/imx8mq_hb/imx8mq_hb.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,5 +306,8 @@ int board_late_init(void)
init_usb_clk(0);
init_usb_clk(1);

imx8m_gpc_power(10, false);
imx8m_gpc_power(1, false);

return 0;
}

0 comments on commit 0dd5174

Please sign in to comment.