diff mbox series

[U-Boot,3/4] usb: mx6: add fuse check

Message ID 20190719033721.5730-3-peng.fan@nxp.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series [U-Boot,1/4] imx: add module fuse support | expand

Commit Message

Peng Fan July 19, 2019, 3:22 a.m. UTC
Add fuse check for USB. If the fuse indicate the module
not work in the SoC, let's fail the initialization.

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

Patch

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index e9e6ed596d..3d67f04041 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -353,6 +353,13 @@  int ehci_hcd_init(int index, enum usb_init_type init,
 	if (index > 3)
 		return -EINVAL;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (usb_fused((u32)ehci)) {
+			printf("USB@0x%x is fused, disable it\n", (u32)ehci);
+			return	-ENODEV;
+		}
+	}
+
 	ret = ehci_mx6_common_init(ehci, index);
 	if (ret)
 		return ret;
@@ -549,6 +556,13 @@  static int ehci_usb_probe(struct udevice *dev)
 	struct ehci_hcor *hcor;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (usb_fused((u32)ehci)) {
+			printf("USB@0x%x is fused, disable it\n", (u32)ehci);
+			return -ENODEV;
+		}
+	}
+
 	priv->ehci = ehci;
 	priv->portnr = dev->seq;
 	priv->init_type = type;