imx8m_som/spl.c : enable the USB SPL SDP

parent 038b786a
......@@ -141,6 +141,8 @@ void enable_tzc380(void)
writel(val, IOMUXC_GPR10);
val |= GPR_TZASC_EN_LOCK;
writel(val, IOMUXC_GPR10);
writel(0xf0000000, TZASC_BASE_ADDR + 0x108);
}
void set_wdog_reset(struct wdog_regs *wdog)
......@@ -612,6 +614,44 @@ int arch_misc_init(void)
}
#endif
#ifdef CONFIG_SPL_BUILD
static uint32_t gpc_pu_m_core_offset[11] = {
0xc00, 0xc40, 0xc80, 0xcc0,
0xdc0, 0xe00, 0xe40, 0xe80,
0xec0, 0xf00, 0xf40,
};
#define PGC_PCR 0
void imx_gpc_set_m_core_pgc(unsigned int offset, bool pdn)
{
uint32_t val;
uintptr_t reg = GPC_BASE_ADDR + offset;
val = readl(reg);
val &= ~(0x1 << PGC_PCR);
if(pdn)
val |= 0x1 << PGC_PCR;
writel(val, reg);
}
void imx8m_usb_power_domain(uint32_t domain_id, bool on)
{
uint32_t val;
uintptr_t reg;
imx_gpc_set_m_core_pgc(gpc_pu_m_core_offset[domain_id], true);
reg = GPC_BASE_ADDR + (on ? 0xf8 : 0x104);
val = 1 << (domain_id > 3 ? (domain_id + 3) : domain_id);
writel(val, reg);
while (readl(reg) & val)
;
imx_gpc_set_m_core_pgc(gpc_pu_m_core_offset[domain_id], false);
}
#endif
#define FSL_SIP_GPC 0xC2000000
#define FSL_SIP_CONFIG_GPC_PM_DOMAIN 0x03
int imx8m_usb_power(int usb_id, bool on)
......@@ -621,8 +661,14 @@ int imx8m_usb_power(int usb_id, bool on)
if (usb_id > 1)
return -EINVAL;
#ifdef CONFIG_SPL_BUILD
printf( "imx8m_usb_power_domain\n" );
imx8m_usb_power_domain(2 + usb_id, on);
#else
ret = call_imx_sip(FSL_SIP_GPC,
FSL_SIP_CONFIG_GPC_PM_DOMAIN, 2 + usb_id, on, 0);
#endif
if (ret)
return -EPERM;
......
......@@ -490,21 +490,6 @@ void board_init_f(ulong dummy)
/* DDR initialization */
spl_dram_init();
#ifdef CONFIG_SYS_SPL_MALLOC_START
printf( "Initializing malloc region\n" );
mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
CONFIG_SYS_SPL_MALLOC_SIZE);
gd->flags |= GD_FLG_FULL_MALLOC_INIT;
#endif
printf( "Initializing USB\n" );
/* malloc region must be initialized before this */
if(board_usb_init(0, USB_INIT_DEVICE))
printf( "board_usb_init - failed\n" );
else
printf( "board_usb_init - passed\n" );
printf( "Board init\n" );
board_init_r(NULL, 0);
......
......@@ -287,7 +287,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
debug(">>spl:board_init_r()\n");
#if defined(CONFIG_SYS_SPL_MALLOC_START) && !defined(CONFIG_SPL_USB_SDP_SUPPORT)
#if defined(CONFIG_SYS_SPL_MALLOC_START)
/* for SDP in the SPL malloc need to be initialized before this */
mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
CONFIG_SYS_SPL_MALLOC_SIZE);
......
......@@ -19,6 +19,9 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
int ret;
const int controller_index = 0;
printf( "board_usb_init\n" );
board_usb_init(0, USB_INIT_DEVICE);
g_dnl_clear_detach();
g_dnl_register("usb_dnl_sdp");
......
......@@ -59,7 +59,6 @@ CONFIG_USB_TCPC=y
CONFIG_USB=y
CONFIG_USB_GADGET=y
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_SPL_USB_HOST_SUPPORT=y
CONFIG_SPL_USB_GADGET_SUPPORT=y
......@@ -70,8 +69,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_G_DNL_MANUFACTURER="Emcraft"
CONFIG_G_DNL_VENDOR_NUM=0x0525
CONFIG_G_DNL_PRODUCT_NUM=0xa4a5
CONFIG_DW_UDC=y
CONFIG_USB_DEVICE=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_XHCI_DWC3=y
......
......@@ -40,6 +40,9 @@
#define CONFIG_SPL_MMC_SUPPORT
#define CONFIG_SPL_BSS_START_ADDR 0x00180000
#define CONFIG_SPL_BSS_MAX_SIZE 0x2000 /* 8 KB */
#define CONFIG_SPL_STACK_R_ADDR 0x42300000
#define CONFIG_SPL_STACK_R
#define CONFIG_SPL_SEPARATE_BSS
#define CONFIG_SYS_SPL_MALLOC_START 0x42200000
#define CONFIG_SYS_SPL_MALLOC_SIZE 0x80000 /* 512 KB */
#define CONFIG_SYS_ICACHE_OFF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment