diff options
author | Philippe Schenker <philippe.schenker@toradex.com> | 2020-04-10 01:40:16 +0200 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2020-04-14 10:27:21 +0200 |
commit | d626574ba1730aa25abe86d081c66d2616abfc75 (patch) | |
tree | 44bb3bb8c1fe06ab68373918cd83bacc8eb19505 /board | |
parent | d7643e40aa0fb5fefa92aa1603f0207628f0c62f (diff) |
apalis-imx8x: usb3 bringupVerdin-iMX8MM_Console-Image_3.0b4.254-20200421Colibri-iMX8X_Console-Image_3.0b4.254-20200421Apalis-iMX8_Console-Image_3.0b4.254-20200421Apalis-iMX8X_Console-Image_3.0b4.254-20200421
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/toradex/apalis-imx8x/apalis-imx8x.c | 115 |
1 files changed, 100 insertions, 15 deletions
diff --git a/board/toradex/apalis-imx8x/apalis-imx8x.c b/board/toradex/apalis-imx8x/apalis-imx8x.c index aff6b6466c8..0f4ac351055 100644 --- a/board/toradex/apalis-imx8x/apalis-imx8x.c +++ b/board/toradex/apalis-imx8x/apalis-imx8x.c @@ -27,6 +27,7 @@ #include <asm/mach-imx/video.h> #include <asm/arch/video_common.h> #include <power-domain.h> +#include <cdns3-uboot.h> #include <asm/arch/lpcg.h> #include "../common/tdx-cfg-block.h" @@ -294,29 +295,113 @@ int checkboard(void) return 0; } -/* Only Enable USB3 resources currently */ +#ifdef CONFIG_USB +#ifdef CONFIG_USB_CDNS3 +static struct cdns3_device cdns3_device_data = { + .none_core_base = 0x5B110000, + .xhci_base = 0x5B130000, + .dev_base = 0x5B140000, + .phy_base = 0x5B160000, + .otg_base = 0x5B120000, + .dr_mode = USB_DR_MODE_HOST, + .index = 1, +}; +#endif + int board_usb_init(int index, enum usb_init_type init) { -#ifndef CONFIG_DM_USB - struct power_domain pd; - int ret; + int ret = 0; - /* Power on usb */ - if (!power_domain_lookup_name("conn_usb2", &pd)) { - ret = power_domain_on(&pd); - if (ret) - printf("conn_usb2 Power up failed! (error = %d)\n", ret); - } + if (index == 1) { + if (init == USB_INIT_HOST) { +#ifdef CONFIG_USB_CDNS3 + } else { +#ifdef CONFIG_SPL_BUILD + sc_ipc_t ipcHndl = 0; + + ipcHndl = gd->arch.ipc_channel_handle; + + ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2, SC_PM_PW_MODE_ON); + if (ret != SC_ERR_NONE) + printf("conn_usb2 Power up failed! (error = %d)\n", ret); + + ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2_PHY, SC_PM_PW_MODE_ON); + if (ret != SC_ERR_NONE) + printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); +#else + struct power_domain pd; + int ret; + + /* Power on usb */ + if (!power_domain_lookup_name("conn_usb2", &pd)) { + ret = power_domain_on(&pd); + if (ret) + printf("conn_usb2 Power up failed! (error = %d)\n", ret); + } + + if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { + ret = power_domain_on(&pd); + if (ret) + printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); + } +#endif - if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { - ret = power_domain_on(&pd); - if (ret) - printf("conn_usb2_phy Power up failed! (error = %d)\n", ret); + ret = cdns3_uboot_init(&cdns3_device_data); + printf("%d cdns3_uboot_initmode %d\n", index, ret); +#endif + } } + + return ret; + +} + +int board_usb_cleanup(int index, enum usb_init_type init) +{ + int ret = 0; + + if (index == 1) { + if (init == USB_INIT_HOST) { +#ifdef CONFIG_USB_CDNS3_GADGET + } else { + cdns3_uboot_exit(1); + +#ifdef CONFIG_SPL_BUILD + sc_ipc_t ipcHndl = 0; + + ipcHndl = gd->arch.ipc_channel_handle; + + ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2, SC_PM_PW_MODE_OFF); + if (ret != SC_ERR_NONE) + printf("conn_usb2 Power down failed! (error = %d)\n", ret); + + ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2_PHY, SC_PM_PW_MODE_OFF); + if (ret != SC_ERR_NONE) + printf("conn_usb2_phy Power down failed! (error = %d)\n", ret); +#else + struct power_domain pd; + int ret; + + /* Power off usb */ + if (!power_domain_lookup_name("conn_usb2", &pd)) { + ret = power_domain_off(&pd); + if (ret) + printf("conn_usb2 Power down failed! (error = %d)\n", ret); + } + + if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { + ret = power_domain_off(&pd); + if (ret) + printf("conn_usb2_phy Power down failed! (error = %d)\n", ret); + } #endif +#endif + } + } - return 0; + return ret; } +#endif int board_init(void) { |