[PATCH 2/3] imx: imx8mm-beacon: Enable USB booting via SDP

sbabic at denx.de sbabic at denx.de
Tue Nov 8 17:39:34 CET 2022


> In order to boot over USB, the device tree needs to enable
> a few extra nodes in SPL.  Since the USB driver has the
> ability to detect host/device, the dr_mode can be removed
> from the device tree since it needs to act as a device when
> booting and OTG is the default mode.  Add USB boot support
> to spl_board_boot_device and enable the corresponding config
> options.
> Signed-off-by: Adam Ford <aford173 at gmail.com>
> Reviewed-by: Fabio Estevam <festevam at denx.de>
> diff --git a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
> index c94b4ffa4c..00ac413f36 100644
> --- a/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
> +++ b/arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi
> @@ -13,6 +13,10 @@
>  	};
>  };
>  
> +&aips4 {
> +	u-boot,dm-spl;
> +};
> +
>  &reg_usdhc2_vmmc {
>  	u-boot,off-on-delay-us = <20000>;
>  };
> @@ -77,12 +81,24 @@
>  	u-boot,dm-spl;
>  };
>  
> +&reg_usbotg1 {
> +
> +};
> +
>  &uart2 {
>  	u-boot,dm-spl;
>  };
>  
> +&usbmisc1 {
> +	u-boot,dm-spl;
> +};
> +
>  &usbotg1 {
> -	dr_mode="host";
> +	u-boot,dm-spl;
> +};
> +
> +&usbphynop1 {
> +	u-boot,dm-spl;
>  };
>  
>  &usdhc2 {
> diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
> index b0e9d918da..a5f337aa17 100644
> --- a/board/beacon/imx8mm/spl.c
> +++ b/board/beacon/imx8mm/spl.c
> @@ -34,6 +34,8 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
>  	case SD3_BOOT:
>  	case MMC3_BOOT:
>  		return BOOT_DEVICE_MMC2;
> +	case USB_BOOT:
> +		return BOOT_DEVICE_BOARD;
>  	default:
>  		return BOOT_DEVICE_NONE;
>  	}
> diff --git a/configs/imx8mm_beacon_defconfig b/configs/imx8mm_beacon_defconfig
> index f6a1012d8a..90a623515e 100644
> --- a/configs/imx8mm_beacon_defconfig
> +++ b/configs/imx8mm_beacon_defconfig
> @@ -39,6 +39,9 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300
>  CONFIG_SPL_I2C=y
>  CONFIG_SPL_POWER=y
> +CONFIG_SPL_USB_HOST=y
> +CONFIG_SPL_USB_GADGET=y
> +CONFIG_SPL_USB_SDP_SUPPORT=y
>  CONFIG_SPL_WATCHDOG=y
>  CONFIG_HUSH_PARSER=y
>  CONFIG_SYS_MAXARGS=64
> @@ -56,6 +59,7 @@ CONFIG_CMD_MMC=y
>  CONFIG_CMD_PART=y
>  CONFIG_CMD_SPI=y
>  CONFIG_CMD_USB=y
> +CONFIG_CMD_USB_SDP=y
>  CONFIG_CMD_USB_MASS_STORAGE=y
>  CONFIG_CMD_DHCP=y
>  CONFIG_CMD_MII=y
> @@ -103,6 +107,8 @@ CONFIG_PHY_ATHEROS=y
>  CONFIG_PHY_GIGE=y
>  CONFIG_FEC_MXC=y
>  CONFIG_MII=y
> +CONFIG_SPL_PHY=y
> +CONFIG_SPL_NOP_PHY=y
>  CONFIG_PINCTRL=y
>  CONFIG_SPL_PINCTRL=y
>  CONFIG_PINCTRL_IMX8M=y
> @@ -127,12 +133,13 @@ CONFIG_SYSRESET_PSCI=y
>  CONFIG_SYSRESET_WATCHDOG=y
>  CONFIG_DM_THERMAL=y
>  CONFIG_USB=y
> -# CONFIG_SPL_DM_USB is not set
>  CONFIG_USB_EHCI_HCD=y
> +CONFIG_MXC_USB_OTG_HACTIVE=y
>  CONFIG_USB_STORAGE=y
>  CONFIG_USB_GADGET=y
>  CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>  CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>  CONFIG_CI_UDC=y
> +CONFIG_SDP_LOADADDR=0x40400000
>  CONFIG_USB_GADGET_DOWNLOAD=y
>  CONFIG_IMX_WATCHDOG=y
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list