All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] i2c: mxc: add fuse check
Date: Fri, 19 Jul 2019 03:22:16 +0000	[thread overview]
Message-ID: <20190719033721.5730-2-peng.fan@nxp.com> (raw)
In-Reply-To: <20190719033721.5730-1-peng.fan@nxp.com>

Add fuse check for I2C. 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/i2c/mxc_i2c.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 2e157bca58..fd2d858854 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -18,6 +18,7 @@
 #include <asm/arch/imx-regs.h>
 #include <linux/errno.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/mach-imx/sys_proto.h>
 #include <asm/io.h>
 #include <i2c.h>
 #include <watchdog.h>
@@ -740,6 +741,14 @@ void bus_i2c_init(int index, int speed, int unused,
 		return;
 	}
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (i2c_fused((u32)mxc_i2c_buses[index].base)) {
+			printf("I2C at 0x%x is fused, disable it\n",
+			       (u32)mxc_i2c_buses[index].base);
+			return;
+		}
+	}
+
 	/*
 	 * Warning: Be careful to allow the assignment to a static
 	 * variable here. This function could be called while U-Boot is
@@ -885,6 +894,13 @@ static int mxc_i2c_probe(struct udevice *bus)
 	if (addr == FDT_ADDR_T_NONE)
 		return -EINVAL;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (i2c_fused(addr)) {
+			printf("I2C at 0x%lx is fused, disable it\n", addr);
+			return -ENODEV;
+		}
+	}
+
 	i2c_bus->base = addr;
 	i2c_bus->index = bus->seq;
 	i2c_bus->bus = bus;
-- 
2.16.4

  reply	other threads:[~2019-07-19  3:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19  3:22 [U-Boot] [PATCH 1/4] imx: add module fuse support Peng Fan
2019-07-19  3:22 ` Peng Fan [this message]
2019-07-19  3:22 ` [U-Boot] [PATCH 3/4] usb: mx6: add fuse check Peng Fan
2019-07-19  3:22 ` [U-Boot] [PATCH 4/4] net: fec: " Peng Fan
2019-07-23  3:27   ` Joe Hershberger
2019-07-23  5:46     ` Peng Fan
2019-07-24  7:48 ` [U-Boot] [PATCH 1/4] imx: add module fuse support Lukasz Majewski
2019-07-24  7:52   ` Peng Fan
2019-07-24 10:05     ` Lukasz Majewski
2019-07-24 12:12       ` Peng Fan
2019-07-24 18:12         ` Schrempf Frieder
2019-07-24 19:39           ` Lukasz Majewski

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=20190719033721.5730-2-peng.fan@nxp.com \
    --to=peng.fan@nxp.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.