[PATCH 8/8] imx8mm_evk: add fastboot support

Peng Fan
2020-10-12T06:23:54Z

Add fastboot support for U-Boot proper

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 17 +++++++++++++++++
configs/imx8mm_evk_defconfig | 13 ++++++++++++-
include/configs/imx8mm_evk.h | 14 ++++++++++++++
3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/imx8mm-evk-u-boot.dtsi b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
index 241dfd656f..d85fe7e17a 100644
--- a/arch/arm/dts/imx8mm-evk-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-evk-u-boot.dtsi
@@ -6,6 +6,8 @@
/ {

aliases {
+ usbgadget0 = &usbg1;
+ usbgadget1 = &usbg2;
usb0 = &usbotg1;
usb1 = &usbotg2;
};
@@ -15,6 +17,21 @@
wdt = <&wdog1>;
u-boot,dm-spl;
};
+
+ usbg1: usbg1 {
+ compatible = "fsl,imx27-usb-gadget";
+ dr_mode = "peripheral";
+ chipidea,usb = <&usbotg1>;
+ status = "okay";
+ };
+
+ usbg2: usbg2 {
+ compatible = "fsl,imx27-usb-gadget";
+ dr_mode = "peripheral";
+ chipidea,usb = <&usbotg2>;
+ status = "okay";
+ };
+
};

&{/soc at 0} {
diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
index 10e95d8d5c..19560bdb7e 100644
--- a/configs/imx8mm_evk_defconfig
+++ b/configs/imx8mm_evk_defconfig
@@ -19,7 +19,6 @@ CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
CONFIG_SPL=y
CONFIG_DEFAULT_DEVICE_TREE="imx8mm-evk"
-CONFIG_ANDROID_BOOT_IMAGE=y
CONFIG_FIT=y
CONFIG_FIT_EXTERNAL_OFFSET=0x3000
CONFIG_SPL_LOAD_FIT=y
@@ -64,6 +63,11 @@ CONFIG_SPL_CLK_COMPOSITE_CCF=y
CONFIG_CLK_COMPOSITE_CCF=y
CONFIG_SPL_CLK_IMX8MM=y
CONFIG_CLK_IMX8MM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x42800000
+CONFIG_FASTBOOT_BUF_SIZE=0x40000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_MXC_GPIO=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_MXC=y
@@ -95,8 +99,15 @@ CONFIG_DM_THERMAL=y
CONFIG_USB=y
CONFIG_DM_USB=y
# CONFIG_SPL_DM_USB is not set
+CONFIG_DM_USB_GADGET=y
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_MX7 is not set
CONFIG_USB_EHCI_IMX=y
CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_SDP_LOADADDR=0x40400000
CONFIG_IMX_WATCHDOG=y
diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index 5e865f0bef..f6dccaaa15 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -148,4 +148,18 @@
#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
#define CONFIG_USB_MAX_CONTROLLER_COUNT 2

+#define CONFIG_FASTBOOT_USB_DEV 0
+
+/* USB configs */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_USBD_HS
+
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+
+#endif
+
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
+
#endif
--
2.28.0