Support for M4

- Remove UART3 snippets from the DTS. This is the UART for the M4, and
not used in u-boot anyways.
- Add TCM (tightly coupled memory) region in the board_lmb_reserve, otherwise we can't load
into the TCM region.
- Add definitions for TCM location and size
- Define commands for loading and running the M4 (called from boot
script)

Change-Id: I3a83fe7503418aeb2867aef10e9eeb5079165b94
diff --git a/arch/arm/dts/fsl-imx8mq-phanbell.dts b/arch/arm/dts/fsl-imx8mq-phanbell.dts
index 3e4b08b..98e1e33 100644
--- a/arch/arm/dts/fsl-imx8mq-phanbell.dts
+++ b/arch/arm/dts/fsl-imx8mq-phanbell.dts
@@ -238,16 +238,6 @@
 			>;
 		};
 
-		pinctrl_uart3: uart3grp {
-			fsl,pins = <
-				MX8MQ_IOMUXC_UART3_TXD_UART3_DCE_TX		0x79
-				MX8MQ_IOMUXC_UART3_RXD_UART3_DCE_RX		0x79
-				MX8MQ_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B	0x79
-				MX8MQ_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B		0x79
-				MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5			0x19
-			>;
-		};
-
 		pinctrl_usdhc1: usdhc1grp {
 			fsl,pins = <
 				MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK			0x83
@@ -633,16 +623,6 @@
 	};
 };
 
-&uart3 { /* BT */
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_uart3>;
-	assigned-clocks = <&clk IMX8MQ_CLK_UART3_SRC>;
-	assigned-clock-parents = <&clk IMX8MQ_SYS1_PLL_80M>;
-	fsl,uart-has-rtscts;
-	resets = <&modem_reset>;
-	status = "okay";
-};
-
 &usdhc1 {
 	pinctrl-names = "default", "state_100mhz", "state_200mhz";
 	pinctrl-0 = <&pinctrl_usdhc1>;
diff --git a/arch/arm/mach-imx/misc.c b/arch/arm/mach-imx/misc.c
index 9c62bba..bf26c6a 100644
--- a/arch/arm/mach-imx/misc.c
+++ b/arch/arm/mach-imx/misc.c
@@ -104,6 +104,10 @@
 		lmb_reserve(lmb, sp, bank_end - sp);
 		break;
 	}
+
+#if defined(SYS_AUXCORE_BOOTDATA_TCM) && defined(SYS_AUXCORE_BOOTDATA_TCM_SIZE)
+	lmb_add(lmb, SYS_AUXCORE_BOOTDATA_TCM, SYS_AUXCORE_BOOTDATA_TCM_SIZE);
+#endif
 }
 
 void imx_sec_init(void)
diff --git a/board/freescale/imx8mq_phanbell/imx8mq_phanbell.c b/board/freescale/imx8mq_phanbell/imx8mq_phanbell.c
index 004e538..4b1cdc5 100644
--- a/board/freescale/imx8mq_phanbell/imx8mq_phanbell.c
+++ b/board/freescale/imx8mq_phanbell/imx8mq_phanbell.c
@@ -349,6 +349,11 @@
 	snprintf(bootcmd, sizeof(bootcmd), "ext2load mmc %d:1 ${loadaddr} boot.scr; source; boota mmc0 boot_a", mmc_dev);
 	env_set("bootcmd", bootcmd);
 
+	// Set up a command that will load and start the M4.
+	env_set("m4boot", "ext2load mmc ${bootdev}:1 ${m4loadaddr} ${m4image}; dcache flush; bootaux ${m4loadaddr}");
+	env_set("m4image", "m4_fw.bin");
+	env_set("m4loadaddr", __stringify(SYS_AUXCORE_BOOTDATA_TCM));
+
 #ifdef CONFIG_ENV_IS_IN_MMC
 	board_late_mmc_env_init();
 #endif
diff --git a/include/configs/imx8mq_phanbell.h b/include/configs/imx8mq_phanbell.h
index 6a18750..3dbc34a 100644
--- a/include/configs/imx8mq_phanbell.h
+++ b/include/configs/imx8mq_phanbell.h
@@ -93,6 +93,10 @@
 #define CONFIG_PHY_ATHEROS
 #endif
 
+/* M4 specific */
+#define SYS_AUXCORE_BOOTDATA_TCM	0x007E0000
+#define SYS_AUXCORE_BOOTDATA_TCM_SIZE	0x20000
+
 /*
  * Another approach is add the clocks for inmates into clks_init_on
  * in clk-imx8mq.c, then clk_ingore_unused could be removed.