From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Thu, 1 Aug 2019 13:04:10 +0200 Subject: [U-Boot] [PATCH v2 2/4] i2c: mxc: add fuse check In-Reply-To: <20190801090117.24692-2-peng.fan@nxp.com> References: <20190801090117.24692-1-peng.fan@nxp.com> <20190801090117.24692-2-peng.fan@nxp.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Peng, Am 01.08.2019 um 10:45 schrieb Peng Fan: > Add fuse check for I2C. If the fuse indicates the module > will not work in the SoC, let's fail the initialization. > > Signed-off-by: Peng Fan > --- > > V2: > Fix build for aarch64 > > > drivers/i2c/mxc_i2c.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c > index 23119cce65..7a259547bd 100644 > --- a/drivers/i2c/mxc_i2c.c > +++ b/drivers/i2c/mxc_i2c.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -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((ulong)mxc_i2c_buses[index].base)) { > + printf("SoC fuse indicates I2C at 0x%lx is unavailable.\n", > + (ulong)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,14 @@ 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((ulong)addr)) { > + printf("SoC fuse indicates I2C at 0x%lx is unavailable.\n", > + (ulong)addr); > + return -ENODEV; > + } > + } > + > i2c_bus->base = addr; > i2c_bus->index = bus->seq; > i2c_bus->bus = bus; > Reviewed-by: Heiko Schocher bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de