All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel@ziswiler.com>
To: u-boot@lists.denx.de
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Subject: [PATCH v2 09/11] board: colibri_imx7: fix usb start on solo
Date: Wed, 13 Apr 2022 11:33:33 +0200	[thread overview]
Message-ID: <20220413093335.1372656-10-marcel@ziswiler.com> (raw)
In-Reply-To: <20220413093335.1372656-1-marcel@ziswiler.com>

From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

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 <marcel.ziswiler@toradex.com>
---

(no changes since v1)

 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 2f61223c9eb..0e254fd7d15 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -10,6 +10,7 @@ CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_IMX_HAB=y
+CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0x8c000000
 CONFIG_DISTRO_DEFAULTS=y
-- 
2.34.1


  parent reply	other threads:[~2022-04-13  9:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  9:33 [PATCH v2 00/11] toradex updates: assortment of fixes and improvements Marcel Ziswiler
2022-04-13  9:33 ` [PATCH v2 01/11] toradex: apalis-imx8x: drop support for apalis imx8x Marcel Ziswiler
2022-04-21 12:25   ` sbabic
2022-04-13  9:33 ` [PATCH v2 02/11] toradex: globally disable video support Marcel Ziswiler
2022-04-21 12:26   ` sbabic
2022-04-13  9:33 ` [PATCH v2 03/11] toradex: set default dhcp distroboot scriptname Marcel Ziswiler
2022-04-21 12:26   ` sbabic
2022-04-13  9:33 ` [PATCH v2 04/11] toradex: drop legacy nfsboot script Marcel Ziswiler
2022-04-21 12:26   ` sbabic
2022-04-13  9:33 ` [PATCH v2 05/11] configs: toradex: enable missing fit options Marcel Ziswiler
2022-04-21 12:26   ` sbabic
2022-04-13  9:33 ` [PATCH v2 06/11] configs: colibri-imx7/-emmc: enable booting from usb sdp Marcel Ziswiler
2022-04-21 12:26   ` sbabic
2022-04-13  9:33 ` [PATCH v2 07/11] configs: tdx: Do not overwrite fdtfile if it got set manually Marcel Ziswiler
2022-04-21 12:27   ` sbabic
2022-04-13  9:33 ` [PATCH v2 08/11] board: toradex: drop colibri pxa270 support Marcel Ziswiler
2022-04-21 12:27   ` sbabic
2022-04-13  9:33 ` Marcel Ziswiler [this message]
2022-04-21 12:26   ` [PATCH v2 09/11] board: colibri_imx7: fix usb start on solo sbabic
2022-04-13  9:33 ` [PATCH v2 10/11] configs: tdx: apalis_imx6: drop hw v1.0 support Marcel Ziswiler
2022-04-21 12:25   ` sbabic
2022-04-13  9:33 ` [PATCH v2 11/11] configs: tdx: apalis/colibri_imx6: use preboot as well Marcel Ziswiler
2022-04-21 12:27   ` sbabic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220413093335.1372656-10-marcel@ziswiler.com \
    --to=marcel@ziswiler.com \
    --cc=marcel.ziswiler@toradex.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.