Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A39EBC433F5 for ; Fri, 8 Apr 2022 10:28:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1BF2083DE7; Fri, 8 Apr 2022 12:28:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ziswiler.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2139E83DB4; Fri, 8 Apr 2022 12:28:03 +0200 (CEST) Received: from mout.perfora.net (mout.perfora.net [74.208.4.196]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AB71D83A97 for ; Fri, 8 Apr 2022 12:27:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ziswiler.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marcel@ziswiler.com Received: from toolbox.int.toradex.com ([81.221.85.15]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0Lg24j-1oJZZY2xvH-00pfjV; Fri, 08 Apr 2022 12:27:56 +0200 From: Marcel Ziswiler To: u-boot@lists.denx.de Cc: Marcel Ziswiler Subject: [PATCH v1 20/24] board: colibri_imx7: fix usb start on solo Date: Fri, 8 Apr 2022 12:27:53 +0200 Message-Id: <20220408102753.351442-1-marcel@ziswiler.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220408080719.342072-1-marcel@ziswiler.com> References: <20220408080719.342072-1-marcel@ziswiler.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:AEos4mjlmFKN1E4yAFrNCC58QX91E+b5xH5bNELM4MNWskBHyem NdV4Rnr0fNb565PyBQBZWB+StXIZvA5dmCsgwmFfD9+N5iERPbDN1g5UfminXydhZH0z/T7 aqyVXKTEHR7Amz2rbcnFQ2xfA2ulZHLgYqwAQ8kagi8MgEHmHShtrYhs97KPh6mPmYpji0s 7o3MThg3O1JIzggWZ8U9w== X-UI-Out-Filterresults: notjunk:1;V03:K0:122yDfInK+8=:pjAKd3YXBKGoiW4dOiIP7z cZlM7U9ab/PrpB61GCKyzlGnsFKoNKDiq3Txqxz/qasF7Y0MM/1Pxzfh+DFIOAPIlZnm4iC8l fXVSLOgAFChijMroDs1PLz1rkEu9Li9tX/I3+OagY4J58CHPy6Q0NklCKkDqS9miiKChoM0Nd IrVSAELObU79Cdtp+tH+ypujzfnqtv0lPvdFLw/ZIJKmn+CNeSB/IFcDI73SHvtIQLADO6R4B vKuypvtIY35OijVeP2tBk7s1ICbsXyDc+SxlR/Q581anoX2LMy7d2r2PEn4vegUjWpoMbzKvG LKjKFz22d7SnQV264rRAXJE44O2DFz5baYhO1M3EaARSiViDrHIjUDLGuP67x5xLr3pf/HR6b fFdiqo7UjJSQcF7iObh/aQjz/CQk97ayRhQFHkcEGzniZjDHzjaHXoSg6yt30SRklc4CBMLq1 IRgWHGVaHrLqfggJw4EADjuc3pPfSQh5E8ljvkuGXaXJRppLk8aUJNRKSb13EJ723OkcFCvRW R87oeqYKZMi9EQOErSCfUtriida2Ixa3eq0BRKrZLoqChDXA0b7zFEMPPXb8XK6VsNqzJIKiY z/oXAcNLkLranqRct5lORN66m8FcIEIJyJP9iOz/0RtTSmyxKlt2xxUp68DkXM4mBao9bS6UI INGxh8dY/XtrQfkhuonTlwRKUH9ne5gp6NvbKH/JJGkf8tAzPUyMEfzg827Ut23aW7Qo= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Marcel Ziswiler This fixes the following crash when run on a Colibri iMX7S aka solo: Colibri iMX7 # usb start starting USB... Bus usb@30b10000: USB EHCI 1.00 Bus usb@30b20000: The i.MX 7Solo has only one single USB OTG1 but no USB host port. Trying to initialize the nonexisting port just crashes. While at it also drop board_usb_phy_mode() which is also no longer used in the driver model age. Signed-off-by: Marcel Ziswiler --- board/toradex/colibri_imx7/colibri_imx7.c | 40 +++++------------------ configs/colibri_imx7_defconfig | 1 + 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c index 6822102d2c3..486299b5e93 100644 --- a/board/toradex/colibri_imx7/colibri_imx7.c +++ b/board/toradex/colibri_imx7/colibri_imx7.c @@ -319,40 +319,16 @@ int ft_board_setup(void *blob, struct bd_info *bd) #endif #ifdef CONFIG_USB_EHCI_MX7 -static iomux_v3_cfg_t const usb_otg2_pads[] = { - MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL), -}; - -int board_ehci_hcd_init(int port) +int board_fix_fdt(void *rw_fdt_blob) { - switch (port) { - case 0: - break; - case 1: - if (is_cpu_type(MXC_CPU_MX7S)) - return -ENODEV; - - imx_iomux_v3_setup_multiple_pads(usb_otg2_pads, - ARRAY_SIZE(usb_otg2_pads)); - break; - default: - return -EINVAL; - } - return 0; -} + /* i.MX 7Solo has only one single USB OTG1 but no USB host port */ + if (is_cpu_type(MXC_CPU_MX7S)) { + int offset = fdt_path_offset(rw_fdt_blob, "/soc/bus@30800000/usb@30b20000"); -int board_usb_phy_mode(int port) -{ - switch (port) { - case 0: - if (gpio_get_value(USB_CDET_GPIO)) - return USB_INIT_DEVICE; - else - return USB_INIT_HOST; - case 1: - default: - return USB_INIT_HOST; + return fdt_status_disabled(rw_fdt_blob, offset); } + + return 0; } #if defined(CONFIG_BOARD_LATE_INIT) @@ -373,4 +349,4 @@ int board_late_init(void) } #endif /* CONFIG_BOARD_LATE_INIT */ -#endif +#endif /* CONFIG_USB_EHCI_MX7 */ diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig index c00d1938eec..202fd05394d 100644 --- a/configs/colibri_imx7_defconfig +++ b/configs/colibri_imx7_defconfig @@ -12,6 +12,7 @@ CONFIG_TARGET_COLIBRI_IMX7=y CONFIG_IMX_RDC=y CONFIG_IMX_BOOTAUX=y CONFIG_IMX_HAB=y +CONFIG_OF_BOARD_FIXUP=y CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y -- 2.34.1