diff mbox series

[V2,resend,3/4] usb: mx6: add fuse check

Message ID 20200501140837.10326-4-peng.fan@nxp.com
State Accepted
Commit 0bd3d911df12816ab8e32d9245449aeca484b539
Headers show
Series support i.MX module fuse | expand

Commit Message

Peng Fan May 1, 2020, 2:08 p.m. UTC
Add fuse check for USB. If the fuse indicates the module
will not work in the SoC, let's fail the initialization.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/usb/host/ehci-mx6.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Stefano Babic May 11, 2020, 10:16 a.m. UTC | #1
> Add fuse check for USB. If the fuse indicates the module
> will not work in the SoC, let's fail the initialization.
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index f2ceb51310..04eb3c006d 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -380,6 +380,14 @@  int ehci_hcd_init(int index, enum usb_init_type init,
 	if (index > 3)
 		return -EINVAL;
 
+	if (CONFIG_IS_ENABLED(IMX_MODULE_FUSE)) {
+		if (usb_fused((ulong)ehci)) {
+			printf("SoC fuse indicates USB at 0x%lx is unavailable.\n",
+			       (ulong)ehci);
+			return	-ENODEV;
+		}
+	}
+
 	ret = ehci_mx6_common_init(ehci, index);
 	if (ret)
 		return ret;
@@ -577,6 +585,14 @@  static int ehci_usb_probe(struct udevice *dev)
 	struct ehci_hcor *hcor;
 	int ret;
 
+	if (CONFIG_IS_ENABLED(IMX_MODULE_FUSE)) {
+		if (usb_fused((ulong)ehci)) {
+			printf("SoC fuse indicates USB at 0x%lx is unavailable.\n",
+			       (ulong)ehci);
+			return -ENODEV;
+		}
+	}
+
 	priv->ehci = ehci;
 	priv->portnr = dev->seq;
 	priv->init_type = type;