diff mbox series

[8/8] imx8mm_evk: add fastboot support

Message ID 20201012062354.3743-9-peng.fan@nxp.com
State New
Headers show
Series i.MX8MM: add host/gadget support | expand

Commit Message

Peng Fan Oct. 12, 2020, 6:23 a.m. UTC
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(-)

-- 
2.28.0

Comments

Wolfgang Denk Oct. 27, 2020, 7:45 a.m. UTC | #1
Dear Peng Fan,

In message <20201012062354.3743-9-peng.fan@nxp.com> you wrote:
> Add fastboot support for U-Boot proper


...

> +	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";

> +	};


What is imx27-usb-gadget ?



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"The algorithm to do that is extremely nasty. You might want  to  mug
someone with it."                   - M. Devine, Computer Science 340
Peng Fan Oct. 27, 2020, 8:08 a.m. UTC | #2
> Subject: Re: [PATCH 8/8] imx8mm_evk: add fastboot support

> 

> Dear Peng Fan,

> 

> In message <20201012062354.3743-9-peng.fan@nxp.com> you wrote:

> > Add fastboot support for U-Boot proper

> 

> ...

> 

> > +	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";

> > +	};

> 

> What is imx27-usb-gadget ?


This is U-Boot specific compatible to let the
ci_udc driver could match the node.

Thanks,
Peng.

> 

> 

> 

> Best regards,

> 

> Wolfgang Denk

> 

> --

> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk

> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de

> "The algorithm to do that is extremely nasty. You might want  to  mug

> someone with it."                   - M. Devine, Computer Science 340
diff mbox series

Patch

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@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