plat: imx8mq: add 100us delay after USB OTG SRC bit 0 clear

After the SRC bit clear, we must wait for a while to make sure
the operation is finished.

for USB OTG, the limitations are:
1. before system clock configuration. ipg clock runs at 12.5MHz.
   delay time should longer than 82us.

2. after system clock configuration. ipg clock runs at 66.5MHz.
   delay time should longer than 15.3us.

so add udelay 100 to safely clear the SRC bit 0.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit 7a50e0e390349738b8987b49cc05edeadaeaddbc)
diff --git a/plat/imx/imx8mq/gpc.c b/plat/imx/imx8mq/gpc.c
index a2da58a..832de0f 100644
--- a/plat/imx/imx8mq/gpc.c
+++ b/plat/imx/imx8mq/gpc.c
@@ -13,6 +13,7 @@
  */
 
 #include <debug.h>
+#include <delay_timer.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -651,6 +652,15 @@
 	val = mmio_read_32(0x30390024);
 	val &= ~0x1;
 	mmio_write_32(0x30390024, val);
+
+	/* for USB OTG, the limitation are:
+	 * 1. before system clock config, the IPG clock run at 12.5MHz, delay time
+	 *    should be longer than 82us.
+	 * 2. after system clock config, ipg clock run at 66.5MHz, delay time
+	 *    be longer that 15.3 us.
+	 *    Add 100us to make sure the USB OTG SRC is clear safely.
+	 */
+	udelay(100);
 }
 
 int imx_gpc_handler(uint32_t smc_fid,
diff --git a/plat/imx/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8mq/imx8mq_bl31_setup.c
index cd82bb0..8be2ce2 100644
--- a/plat/imx/imx8mq/imx8mq_bl31_setup.c
+++ b/plat/imx/imx8mq/imx8mq_bl31_setup.c
@@ -36,6 +36,7 @@
 #include <context.h>
 #include <context_mgmt.h>
 #include <debug.h>
+#include <generic_delay_timer.h>
 #include <stdbool.h>
 #include <mmio.h>
 #include <platform.h>
@@ -305,6 +306,8 @@
 
 void bl31_platform_setup(void)
 {
+	generic_delay_timer_init();
+
 	/* init the GICv3 cpu and distributor interface */
 	plat_gic_driver_init();
 	plat_gic_init();
diff --git a/plat/imx/imx8mq/platform.mk b/plat/imx/imx8mq/platform.mk
index 2fdff40..c613863 100644
--- a/plat/imx/imx8mq/platform.mk
+++ b/plat/imx/imx8mq/platform.mk
@@ -30,6 +30,8 @@
 				lib/xlat_tables/xlat_tables_common.c	\
 				lib/cpus/aarch64/cortex_a53.S		\
 				drivers/console/aarch64/console.S	\
+				drivers/delay_timer/delay_timer.c		\
+				drivers/delay_timer/generic_delay_timer.c	\
 				${PLAT_GIC_SOURCES}			\
 				${PLAT_DDR_SOURCES}			\
 				drivers/arm/tzc/tzc380.c