Skip to contentSkip to conversation

imx: add module fuse support

PATCH Superseded Peng Fan 4 participants 12 messages Jul 19, 2019 – Jul 24, 2019

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/4 imx: add module fuse support

There are different parts from one SoC. Take i.MX6ULL for example, some part might not have ENET, some might have; some might not have USB, some might have. The information could be got from OCOTP, to make one image support the different parts, we need runtime disable linux kernel dts node and uboot driver probe if the corresponding module not exists in the part.

---
 arch/arm/include/asm/mach-imx/module_fuse.h | 127 +++++++++++
 arch/arm/include/asm/mach-imx/sys_proto.h   |   1 +
 arch/arm/mach-imx/Kconfig                   |   7 +
 arch/arm/mach-imx/mx6/Makefile              |   1 +
 arch/arm/mach-imx/mx6/module_fuse.c         | 322 ++++++++++++++++++++++++++++
 5 files changed, 458 insertions(+)
 create mode 100644 arch/arm/include/asm/mach-imx/module_fuse.h
 create mode 100644 arch/arm/mach-imx/mx6/module_fuse.c
arch/arm/include/asm/mach-imx/module_fuse.h new file +127 -0
new file mode 100644
index 0000000000..6b93f0402e
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __MODULE_FUSE_H__
+#define __MODULE_FUSE_H__
+
+enum fuse_module_type {
+	MODULE_TSC,
+	MODULE_ADC1,
+	MODULE_ADC2,
+	MODULE_SIM1,
+	MODULE_SIM2,
+	MODULE_FLEXCAN1,
+	MODULE_FLEXCAN2,
+	MODULE_SPDIF,
+	MODULE_EIM,
+	MODULE_SD1,
+	MODULE_SD2,
+	MODULE_SD3,
+	MODULE_SD4,
+	MODULE_QSPI1,
+	MODULE_QSPI2,
+	MODULE_GPMI,
+	MODULE_APBHDMA,
+	MODULE_LCDIF,
+	MODULE_PXP,
+	MODULE_CSI,
+	MODULE_ENET1,
+	MODULE_ENET2,
+	MODULE_CAAM,
+	MODULE_USB_OTG1,
+	MODULE_USB_OTG2,
+	MODULE_SAI2,
+	MODULE_SAI3,
+	MODULE_BEE,
+	MODULE_UART1,
+	MODULE_UART2,
+	MODULE_UART3,
+	MODULE_UART4,
+	MODULE_UART5,
+	MODULE_UART6,
+	MODULE_UART7,
+	MODULE_UART8,
+	MODULE_PWM5,
+	MODULE_PWM6,
+	MODULE_PWM7,
+	MODULE_PWM8,
+	MODULE_ECSPI1,
+	MODULE_ECSPI2,
+	MODULE_ECSPI3,
+	MODULE_ECSPI4,
+	MODULE_ECSPI5,
+	MODULE_I2C1,
+	MODULE_I2C2,
+	MODULE_I2C3,
+	MODULE_I2C4,
+	MODULE_GPT1,
+	MODULE_GPT2,
+	MODULE_EPIT1,
+	MODULE_EPIT2,
+	MODULE_EPDC,
+	MODULE_ESAI,
+	MODULE_DCP,
+	MODULE_DCP_CRYPTO,
+};
+
+struct fuse_entry_desc {
+	enum fuse_module_type module;
+	const char *node_path;
+	u32 fuse_word_offset;
+	u32 fuse_bit_offset;
+	u32 status;
+};
+
+#if !IS_ENABLED(CONFIG_IMX_MODULE_FUSE)
+static inline u32 check_module_fused(enum fuse_module_type module)
+{
+	return 0;
+};
+
+static inline u32 esdhc_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 ecspi_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 uart_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 usb_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 qspi_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 i2c_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 enet_fused(u32 base_addr)
+{
+	return 0;
+};
+#else
+u32 check_module_fused(enum fuse_module_type module);
+u32 esdhc_fused(u32 base_addr);
+u32 ecspi_fused(u32 base_addr);
+u32 uart_fused(u32 base_addr);
+u32 usb_fused(u32 base_addr);
+u32 qspi_fused(u32 base_addr);
+u32 i2c_fused(u32 base_addr);
+u32 enet_fused(u32 base_addr);
+#endif
+#endif /* __MODULE_FUSE_H__ */
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
index 79cb4e6dc9..14b016ee99 100644
@@ -9,6 +9,7 @@
 
 #include <asm/io.h>
 #include <asm/mach-imx/regs-common.h>
+#include <asm/mach-imx/module_fuse.h>
 #include <common.h>
 #include "../arch-imx/cpu.h"
 
arch/arm/mach-imx/Kconfig +7 -0
index d3942f6b3f..b8625962a6 100644
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
 	help
 	  bootaux [addr] to boot auxiliary core.
 
+config IMX_MODULE_FUSE
+	bool "i.MX Module Fuse"
+	depends on ARCH_MX6
+	help
+	  i.MX module fuse to runtime disable some driver, including
+	  Linux OS device node.
+
 config USE_IMXIMG_PLUGIN
 	bool "Use imximage plugin code"
 	depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP
arch/arm/mach-imx/mx6/Makefile +1 -0
index 81e2913d14..7ea8f91e4f 100644
@@ -6,6 +6,7 @@
 # (C) Copyright 2011 Freescale Semiconductor, Inc.
 
 obj-y	:= soc.o clock.o
+obj-$(CONFIG_IMX_MODULE_FUSE) += module_fuse.o
 obj-$(CONFIG_SPL_BUILD)	     += ddr.o
 obj-$(CONFIG_MP)             += mp.o
 obj-$(CONFIG_MX6UL_LITESOM)  += litesom.o
arch/arm/mach-imx/mx6/module_fuse.c new file +322 -0

322 lines not on this page · raw message

Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 2/4 i2c: mxc: add fuse check

Add fuse check for I2C. If the fuse indicate the module not work in the SoC, let's fail the initialization.

---
 drivers/i2c/mxc_i2c.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/i2c/mxc_i2c.c +16 -0
index 2e157bca58..fd2d858854 100644
@@ -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;
Signature · 1 line
2.16.4
author
#2 lore raw

PATCH 3/4 usb: mx6: add fuse check

In reply to Peng Fan

Add fuse check for USB. If the fuse indicate the module not work in the SoC, let's fail the initialization.

---
 drivers/usb/host/ehci-mx6.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/host/ehci-mx6.c +14 -0
index e9e6ed596d..3d67f04041 100644
@@ -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 at 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 at 0x%x is fused, disable it\n", (u32)ehci);
+			return -ENODEV;
+		}
+	}
+
 	priv->ehci = ehci;
 	priv->portnr = dev->seq;
 	priv->init_type = type;
Signature · 1 line
2.16.4
author
#3 lore raw

PATCH 4/4 net: fec: add fuse check

In reply to Peng Fan

Add fuse check for fec. If the fuse indicate the module not work in the SoC, let's fail the initialization.

---
 drivers/net/fec_mxc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/fec_mxc.c +15 -0
index d7c080943a..602b655455 100644
@@ -1185,6 +1185,13 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 #endif
 	int ret;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (enet_fused(addr)) {
+			printf("Ethernet at 0x%x is fused, disable it\n", addr);
+			return -ENODEV;
+		}
+	}
+
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
 	/*
 	 * The i.MX28 has two ethernet interfaces, but they are not equal.
@@ -1323,6 +1330,14 @@ static int fecmxc_probe(struct udevice *dev)
 	uint32_t start;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (enet_fused((u32)priv->eth)) {
+			printf("Ethernet at 0x%x is fused, disable it\n",
+			       (u32)priv->eth);
+			return -ENODEV;
+		}
+	}
+
 	if (IS_ENABLED(CONFIG_IMX8)) {
 		ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
 		if (ret < 0) {
Signature · 1 line
2.16.4
#4 lore raw

PATCH 4/4 net: fec: add fuse check

Quoted 3 lines · Peng Fan

Add fuse check for fec. If the fuse indicate the module not work in the SoC, let's fail the initialization.

"indicates the module will not work"

Quoted 11 lines
---
 drivers/net/fec_mxc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/fec_mxc.c +0 -0
index d7c080943a..602b655455 100644

drivers/net/fec_mxc.c int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr) · line 1190

Quoted 6 lines
drivers/net/fec_mxc.c +3 -0
@@ -1185,6 +1185,13 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 #endif
        int ret;
 
+       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+               if (enet_fused(addr)) {
+                       printf("Ethernet at 0x%x is fused, disable it\n", addr);

Please reword this. Something like "SoC fuse indicates Ethernet at 0x%x is unavailable."

Quoted 8 lines
drivers/net/fec_mxc.c +4 -0
+                       return -ENODEV;
+               }
+       }
+
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
        /*
         * The i.MX28 has two ethernet interfaces, but they are not equal.

drivers/net/fec_mxc.c static int fecmxc_probe(struct udevice *dev) · line 1335

Quoted 6 lines
drivers/net/fec_mxc.c +3 -0
@@ -1323,6 +1330,14 @@ static int fecmxc_probe(struct udevice *dev)
        uint32_t start;
        int ret;
 
+       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+               if (enet_fused((u32)priv->eth)) {
+                       printf("Ethernet at 0x%x is fused, disable it\n",

Same.

Quoted 15 lines
drivers/net/fec_mxc.c +5 -1
+                              (u32)priv->eth);
+                       return -ENODEV;
+               }
+       }
+
        if (IS_ENABLED(CONFIG_IMX8)) {
                ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
                if (ret < 0) {
--

2.16.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#5 lore raw

PATCH 4/4 net: fec: add fuse check

Quoted 9 lines

Subject: Re: [U-Boot] [PATCH 4/4] net: fec: add fuse check

Quoted 3 lines · Peng Fan

Add fuse check for fec. If the fuse indicate the module not work in the SoC, let's fail the initialization.

"indicates the module will not work"

Fix in V2.

Quoted 15 lines
Quoted 15 lines
---
 drivers/net/fec_mxc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/fec_mxc.c index renamed from drivers/net/fec_mxc.c +0 -0

d7c080943a..602b655455 100644

drivers/net/fec_mxc.c +0 -0
@@ -1185,6 +1185,13 @@ int fecmxc_initialize_multi(bd_t *bd, int

dev_id, int phy_id, uint32_t addr) #endif

        int ret;
Quoted 7 lines

drivers/net/fec_mxc.c int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)

Quoted 4 lines
drivers/net/fec_mxc.c +4 -0
+       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+               if (enet_fused(addr)) {
+                       printf("Ethernet at 0x%x is fused, disable it\n",
+ addr);

Please reword this. Something like "SoC fuse indicates Ethernet at 0x%x is unavailable."

Fix in v2.

Quoted 13 lines

drivers/net/fec_mxc.c int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)

Quoted 8 lines
drivers/net/fec_mxc.c +4 -0
+                       return -ENODEV;
+               }
+       }
+
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
        /*
         * The i.MX28 has two ethernet interfaces, but they are not

equal.

Quoted 4 lines
drivers/net/fec_mxc.c +0 -0
@@ -1323,6 +1330,14 @@ static int fecmxc_probe(struct udevice *dev)
        uint32_t start;
        int ret;
 
Quoted 5 lines

drivers/net/fec_mxc.c static int fecmxc_probe(struct udevice *dev) · line 1335

Quoted 3 lines
drivers/net/fec_mxc.c +3 -0
+       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+               if (enet_fused((u32)priv->eth)) {
+                       printf("Ethernet at 0x%x is fused, disable it\n",

Same.

Fix in V2.

Thanks,
Peng.

Quoted 26 lines
Quoted 12 lines
drivers/net/fec_mxc.c +5 -1
+                              (u32)priv->eth);
+                       return -ENODEV;
+               }
+       }
+
        if (IS_ENABLED(CONFIG_IMX8)) {
                ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
                if (ret < 0) {
--

2.16.4

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist

s.denx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7Cpeng.fan%40nxp.co m%7C

Quoted 1 line

e6ff4f39e3c4498965d308d70f1dabd6%7C686ea1d3bc2b4c6fa92cd99c5c301 635%7C

Quoted 1 line

0%7C0%7C636994492429835169&amp;sdata=IM0QAmsTXC%2BnpZOqtGW XGslK2VD5n7n

Quoted 1 line

pehzJ6i1XqIo%3D&amp;reserved=0

#6 lore raw

PATCH 1/4 imx: add module fuse support

In reply to Peng Fan

Hi Peng,

Quoted 6 lines

There are different parts from one SoC. Take i.MX6ULL for example, some part might not have ENET, some might have; some might not have USB, some might have. The information could be got from OCOTP, to make one image support the different parts, we need runtime disable linux kernel dts node and uboot driver probe if the corresponding module not exists in the part.

If I understand correctly the concept is interesting to make the final binary smaller.

Quoted 497 lines
---
 arch/arm/include/asm/mach-imx/module_fuse.h | 127 +++++++++++
 arch/arm/include/asm/mach-imx/sys_proto.h   |   1 +
 arch/arm/mach-imx/Kconfig                   |   7 +
 arch/arm/mach-imx/mx6/Makefile              |   1 +
 arch/arm/mach-imx/mx6/module_fuse.c         | 322
++++++++++++++++++++++++++++ 5 files changed, 458 insertions(+)
 create mode 100644 arch/arm/include/asm/mach-imx/module_fuse.h
 create mode 100644 arch/arm/mach-imx/mx6/module_fuse.c
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/module_fuse.h new file mode 100644 index 0000000000..6b93f0402e

arch/arm/include/asm/mach-imx/module_fuse.h new file +127 -0
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __MODULE_FUSE_H__
+#define __MODULE_FUSE_H__
+
+enum fuse_module_type {
+	MODULE_TSC,
+	MODULE_ADC1,
+	MODULE_ADC2,
+	MODULE_SIM1,
+	MODULE_SIM2,
+	MODULE_FLEXCAN1,
+	MODULE_FLEXCAN2,
+	MODULE_SPDIF,
+	MODULE_EIM,
+	MODULE_SD1,
+	MODULE_SD2,
+	MODULE_SD3,
+	MODULE_SD4,
+	MODULE_QSPI1,
+	MODULE_QSPI2,
+	MODULE_GPMI,
+	MODULE_APBHDMA,
+	MODULE_LCDIF,
+	MODULE_PXP,
+	MODULE_CSI,
+	MODULE_ENET1,
+	MODULE_ENET2,
+	MODULE_CAAM,
+	MODULE_USB_OTG1,
+	MODULE_USB_OTG2,
+	MODULE_SAI2,
+	MODULE_SAI3,
+	MODULE_BEE,
+	MODULE_UART1,
+	MODULE_UART2,
+	MODULE_UART3,
+	MODULE_UART4,
+	MODULE_UART5,
+	MODULE_UART6,
+	MODULE_UART7,
+	MODULE_UART8,
+	MODULE_PWM5,
+	MODULE_PWM6,
+	MODULE_PWM7,
+	MODULE_PWM8,
+	MODULE_ECSPI1,
+	MODULE_ECSPI2,
+	MODULE_ECSPI3,
+	MODULE_ECSPI4,
+	MODULE_ECSPI5,
+	MODULE_I2C1,
+	MODULE_I2C2,
+	MODULE_I2C3,
+	MODULE_I2C4,
+	MODULE_GPT1,
+	MODULE_GPT2,
+	MODULE_EPIT1,
+	MODULE_EPIT2,
+	MODULE_EPDC,
+	MODULE_ESAI,
+	MODULE_DCP,
+	MODULE_DCP_CRYPTO,
+};
+
+struct fuse_entry_desc {
+	enum fuse_module_type module;
+	const char *node_path;
+	u32 fuse_word_offset;
+	u32 fuse_bit_offset;
+	u32 status;
+};
+
+#if !IS_ENABLED(CONFIG_IMX_MODULE_FUSE)
+static inline u32 check_module_fused(enum fuse_module_type module)
+{
+	return 0;
+};
+
+static inline u32 esdhc_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 ecspi_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 uart_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 usb_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 qspi_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 i2c_fused(u32 base_addr)
+{
+	return 0;
+};
+
+static inline u32 enet_fused(u32 base_addr)
+{
+	return 0;
+};
+#else
+u32 check_module_fused(enum fuse_module_type module);
+u32 esdhc_fused(u32 base_addr);
+u32 ecspi_fused(u32 base_addr);
+u32 uart_fused(u32 base_addr);
+u32 usb_fused(u32 base_addr);
+u32 qspi_fused(u32 base_addr);
+u32 i2c_fused(u32 base_addr);
+u32 enet_fused(u32 base_addr);
+#endif
+#endif /* __MODULE_FUSE_H__ */
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/sys_proto.h index 79cb4e6dc9..14b016ee99 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -9,6 +9,7 @@

#include <asm/io.h>
#include <asm/mach-imx/regs-common.h>

arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+#include <asm/mach-imx/module_fuse.h>
 #include <common.h>
 #include "../arch-imx/cpu.h"
arch/arm/mach-imx/Kconfig +7 -0
index d3942f6b3f..b8625962a6 100644
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
 	help
 	  bootaux [addr] to boot auxiliary core.
 
+config IMX_MODULE_FUSE
+	bool "i.MX Module Fuse"
+	depends on ARCH_MX6
+	help
+	  i.MX module fuse to runtime disable some driver, including
+	  Linux OS device node.
+
 config USE_IMXIMG_PLUGIN
 	bool "Use imximage plugin code"
 	depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP
(quoted diff) +0 -0

b/arch/arm/mach-imx/mx6/Makefile index 81e2913d14..7ea8f91e4f 100644

arch/arm/mach-imx/mx6/Makefile +1 -0
@@ -6,6 +6,7 @@
 # (C) Copyright 2011 Freescale Semiconductor, Inc.
 
 obj-y	:= soc.o clock.o
+obj-$(CONFIG_IMX_MODULE_FUSE) += module_fuse.o
 obj-$(CONFIG_SPL_BUILD)	     += ddr.o
 obj-$(CONFIG_MP)             += mp.o
 obj-$(CONFIG_MX6UL_LITESOM)  += litesom.o
(quoted diff) +0 -0

b/arch/arm/mach-imx/mx6/module_fuse.c new file mode 100644 index 0000000000..417264b15c

arch/arm/mach-imx/mx6/module_fuse.c new file +17 -0
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/mach-imx/module_fuse.h>
+#include <linux/errno.h>
+
+static struct fuse_entry_desc mx6_fuse_descs[] = {
+#if defined(CONFIG_MX6ULL)
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430, 22},
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 2200000/epdc at 228c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 2000000/spba-bus at 2000000/esai at 2024000", 0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000", 0x440, 3},
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000", 0x440,

6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000", 0x440,

8},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440, 9},
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440, 10},
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_DCP, "/soc/aips-bus at 2200000/dcp at 2280000", 0x440, 14},
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO, "/soc/aips-bus at 2200000/dcp at 2280000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000", 0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 2200000/serial at 2288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000", 0x440,

31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 02200000/epdc at 0228c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 02000000/spba-bus at 02000000/esai at 02024000", 0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000", 0x440,

3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 02100000/ethernet at 02188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 02000000/ethernet at 020b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 02200000/dcp at 02280000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 02100000/usb at 02184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO, "/soc/aips-bus at 02200000/dcp at 02280000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000", 0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 02200000/serial at 02288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

0x440, 31}, +#elif defined(CONFIG_MX6UL)

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430, 22},
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 2100000/sim at 218c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 2100000/sim at 21b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000", 0x440, 3},
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000", 0x440,

6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000", 0x440,

8},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440, 9},
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440, 10},
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 2100000/caam at 2140000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_BEE, "/soc/aips-bus at 2000000/bee at 2044000", 0x440, 25},
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000", 0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2024000", 0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000", 0x440,

31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 02100000/sim at 0218c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 02100000/sim at 021b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000", 0x440,

3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 02100000/ethernet at 02188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 02000000/ethernet at 020b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 02100000/caam at 2140000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 02100000/usb at 02184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 02000000/bee at 02044000", 0x440,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000", 0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02024000", 0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440, 28},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 1 line
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

I'm wondering if there would be a way to avoid the hardcoded DTS patch ("/soc/aips-bus at 02000000/epit at 020d4000") ?

Maybe, after reading the the OCOTP values this could be found dynamically (by using the e.g. i2c at 021f8000 string) on the DTS already stored in RAM (which is thereafter passed to Linux kernel at bootm execution) ?

Quoted 149 lines

0x440, 31}, +#endif

arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+};
+
+u32 check_module_fused(enum fuse_module_type module)
+{
+	u32 i, reg;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		if (mx6_fuse_descs[i].module == module) {
+			reg = readl(OCOTP_BASE_ADDR +
+

mx6_fuse_descs[i].fuse_word_offset);

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset))

arch/arm/mach-imx/mx6/module_fuse.c new file +22 -0
+				return 1; /* disabled */
+			else
+				return 0; /* enabled */
+		}
+	}
+
+	return  0; /* Not has a fuse, always enabled */
+}
+
+#ifdef CONFIG_OF_SYSTEM_SETUP
+int ft_system_setup(void *blob, bd_t *bd)
+{
+	const char *status = "disabled";
+	u32 i, reg;
+	int rc, off;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		reg = readl(OCOTP_BASE_ADDR +
+			    mx6_fuse_descs[i].fuse_word_offset);
+		if (reg & BIT(mx6_fuse_descs[i].fuse_bit_offset)) {
+			off = fdt_path_offset(blob,
+

mx6_fuse_descs[i].node_path); +

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+			if (off < 0)
+				continue; /* Not found, skip it */
+add_status:
+			rc = fdt_setprop(blob, nodeoff, "status",

status,

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					 strlen(status) + 1);
+			if (rc) {
+				if (rc == -FDT_ERR_NOSPACE) {
+					rc = fdt_increase_size(blob,

512);

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					if (!rc)
+						goto add_status;
+				}
+				printf("Unable to update property

%s:%s, err=%s\n", mx6_fuse_descs[i].node_path, "status", fdt_strerror(rc));

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			} else {
+				printf("Modify %s disabled\n",

mx6_fuse_descs[i].node_path);

arch/arm/mach-imx/mx6/module_fuse.c new file +93 -0
+			}
+		}
+	}
+
+	return 0;
+}
+#endif
+
+u32 esdhc_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case USDHC1_BASE_ADDR:
+		return check_module_fused(MODULE_SD1);
+	case USDHC2_BASE_ADDR:
+		return check_module_fused(MODULE_SD2);
+#ifdef USDHC3_BASE_ADDR
+	case USDHC3_BASE_ADDR:
+		return check_module_fused(MODULE_SD3);
+#endif
+#ifdef USDHC4_BASE_ADDR
+	case USDHC4_BASE_ADDR:
+		return check_module_fused(MODULE_SD4);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 ecspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ECSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI1);
+	case ECSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI2);
+	case ECSPI3_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI3);
+	case ECSPI4_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI4);
+#ifdef ECSPI5_BASE_ADDR
+	case ECSPI5_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI5);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 usb_fused(u32 base_addr)
+{
+	int i = (base_addr - USB_BASE_ADDR) / 0x200;
+
+	return check_module_fused(MODULE_USB_OTG1 + i);
+}
+
+u32 qspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+#ifdef QSPI1_BASE_ADDR
+	case QSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI1);
+#endif
+
+#ifdef QSPI2_BASE_ADDR
+	case QSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI2);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 i2c_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case I2C1_BASE_ADDR:
+		return check_module_fused(MODULE_I2C1);
+	case I2C2_BASE_ADDR:
+		return check_module_fused(MODULE_I2C2);
+	case I2C3_BASE_ADDR:
+		return check_module_fused(MODULE_I2C3);
+#ifdef I2C4_BASE_ADDR
+	case I2C4_BASE_ADDR:
+		return check_module_fused(MODULE_I2C4);
+#endif
+	}
+
+	return 0;
+}
+
+u32 enet_fused(u32 base_addr)
+{
+	switch (base_addr) {

arch/arm/mach-imx/mx6/module_fuse.c line 322

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+	case ENET_BASE_ADDR:
+		return check_module_fused(MODULE_ENET1);
+#ifdef ENET2_BASE_ADDR
+	case ENET2_BASE_ADDR:
+		return check_module_fused(MODULE_ENET2);
+#endif
+	default:
+		return 0;
+	}
+}

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190724/cc6d4474/attachment.sig>

author
#7 lore raw

PATCH 1/4 imx: add module fuse support

Hi Lukasz,

Quoted 11 lines

Subject: Re: [U-Boot] [PATCH 1/4] imx: add module fuse support

Hi Peng,

Quoted 6 lines

There are different parts from one SoC. Take i.MX6ULL for example, some part might not have ENET, some might have; some might not have USB, some might have. The information could be got from OCOTP, to make one image support the different parts, we need runtime disable linux kernel dts node and uboot driver probe if the corresponding module not exists in the part.

Quoted 2 lines

If I understand correctly the concept is interesting to make the final binary smaller.

No. This is to use one image to support multiple parts of a same kind SoC. So this patch will make the uboot image size larger.

As described in commit log, some i.MX6UL parts not have enet, some have Enet, so we need find a method to make the same image could work on the two parts, that is what this patch does.

Thanks,
Peng.

Quoted 683 lines
Quoted 246 lines
---
 arch/arm/include/asm/mach-imx/module_fuse.h | 127 +++++++++++
 arch/arm/include/asm/mach-imx/sys_proto.h   |   1 +
 arch/arm/mach-imx/Kconfig                   |   7 +
 arch/arm/mach-imx/mx6/Makefile              |   1 +
 arch/arm/mach-imx/mx6/module_fuse.c         | 322
++++++++++++++++++++++++++++ 5 files changed, 458 insertions(+)
 create mode 100644 arch/arm/include/asm/mach-imx/module_fuse.h
 create mode 100644 arch/arm/mach-imx/mx6/module_fuse.c
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/module_fuse.h new file mode 100644 index 0000000000..6b93f0402e

arch/arm/include/asm/mach-imx/module_fuse.h new file +119 -0
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __MODULE_FUSE_H__
+#define __MODULE_FUSE_H__
+
+enum fuse_module_type {
+	MODULE_TSC,
+	MODULE_ADC1,
+	MODULE_ADC2,
+	MODULE_SIM1,
+	MODULE_SIM2,
+	MODULE_FLEXCAN1,
+	MODULE_FLEXCAN2,
+	MODULE_SPDIF,
+	MODULE_EIM,
+	MODULE_SD1,
+	MODULE_SD2,
+	MODULE_SD3,
+	MODULE_SD4,
+	MODULE_QSPI1,
+	MODULE_QSPI2,
+	MODULE_GPMI,
+	MODULE_APBHDMA,
+	MODULE_LCDIF,
+	MODULE_PXP,
+	MODULE_CSI,
+	MODULE_ENET1,
+	MODULE_ENET2,
+	MODULE_CAAM,
+	MODULE_USB_OTG1,
+	MODULE_USB_OTG2,
+	MODULE_SAI2,
+	MODULE_SAI3,
+	MODULE_BEE,
+	MODULE_UART1,
+	MODULE_UART2,
+	MODULE_UART3,
+	MODULE_UART4,
+	MODULE_UART5,
+	MODULE_UART6,
+	MODULE_UART7,
+	MODULE_UART8,
+	MODULE_PWM5,
+	MODULE_PWM6,
+	MODULE_PWM7,
+	MODULE_PWM8,
+	MODULE_ECSPI1,
+	MODULE_ECSPI2,
+	MODULE_ECSPI3,
+	MODULE_ECSPI4,
+	MODULE_ECSPI5,
+	MODULE_I2C1,
+	MODULE_I2C2,
+	MODULE_I2C3,
+	MODULE_I2C4,
+	MODULE_GPT1,
+	MODULE_GPT2,
+	MODULE_EPIT1,
+	MODULE_EPIT2,
+	MODULE_EPDC,
+	MODULE_ESAI,
+	MODULE_DCP,
+	MODULE_DCP_CRYPTO,
+};
+
+struct fuse_entry_desc {
+	enum fuse_module_type module;
+	const char *node_path;
+	u32 fuse_word_offset;
+	u32 fuse_bit_offset;
+	u32 status;
+};
+
+#if !IS_ENABLED(CONFIG_IMX_MODULE_FUSE)
+static inline u32 check_module_fused(enum fuse_module_type module) {
+	return 0;
+};
+
+static inline u32 esdhc_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 ecspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 uart_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 usb_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 qspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 i2c_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 enet_fused(u32 base_addr) {
+	return 0;
+};
+#else
+u32 check_module_fused(enum fuse_module_type module);
+u32 esdhc_fused(u32 base_addr);
+u32 ecspi_fused(u32 base_addr);
+u32 uart_fused(u32 base_addr);
+u32 usb_fused(u32 base_addr);
+u32 qspi_fused(u32 base_addr);
+u32 i2c_fused(u32 base_addr);
+u32 enet_fused(u32 base_addr);
+#endif
+#endif /* __MODULE_FUSE_H__ */
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/sys_proto.h index 79cb4e6dc9..14b016ee99 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -9,6 +9,7 @@

#include <asm/io.h>
#include <asm/mach-imx/regs-common.h>

arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+#include <asm/mach-imx/module_fuse.h>
 #include <common.h>
 #include "../arch-imx/cpu.h"
arch/arm/mach-imx/Kconfig +7 -0
index d3942f6b3f..b8625962a6 100644
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
 	help
 	  bootaux [addr] to boot auxiliary core.
 
+config IMX_MODULE_FUSE
+	bool "i.MX Module Fuse"
+	depends on ARCH_MX6
+	help
+	  i.MX module fuse to runtime disable some driver, including
+	  Linux OS device node.
+
 config USE_IMXIMG_PLUGIN
 	bool "Use imximage plugin code"
 	depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP diff --git

a/arch/arm/mach-imx/mx6/Makefile b/arch/arm/mach-imx/mx6/Makefile index 81e2913d14..7ea8f91e4f 100644

arch/arm/mach-imx/mx6/Makefile +1 -0
@@ -6,6 +6,7 @@
 # (C) Copyright 2011 Freescale Semiconductor, Inc.
 
 obj-y	:= soc.o clock.o
+obj-$(CONFIG_IMX_MODULE_FUSE) += module_fuse.o
 obj-$(CONFIG_SPL_BUILD)	     += ddr.o
 obj-$(CONFIG_MP)             += mp.o
 obj-$(CONFIG_MX6UL_LITESOM)  += litesom.o diff --git

a/arch/arm/mach-imx/mx6/module_fuse.c b/arch/arm/mach-imx/mx6/module_fuse.c new file mode 100644 index 0000000000..417264b15c

arch/arm/mach-imx/mx6/module_fuse.c new file +16 -0
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/mach-imx/module_fuse.h> #include <linux/errno.h>
+
+static struct fuse_entry_desc mx6_fuse_descs[] = { #if
+defined(CONFIG_MX6ULL)
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430, 22},
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 2200000/epdc at 228c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 2000000/spba-bus at 2000000/esai at 2024000", 0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000", 0x440, 3},
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000", 0x440,

6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000", 0x440,

8},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440, 9},
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440, 10},
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_DCP, "/soc/aips-bus at 2200000/dcp at 2280000", 0x440, 14},
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO, "/soc/aips-bus at 2200000/dcp at 2280000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,
Quoted 1 line

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000", 0x440,

26},

Quoted 11 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 2200000/serial at 2288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 1 line

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 16 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000", 0x440,

31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 02200000/epdc at 0228c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/esai at 02024000", 0x430,

25},

Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 27 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000", 0x440,

3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 02100000/ethernet at 02188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 02000000/ethernet at 020b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 02200000/dcp at 02280000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 02100000/usb at 02184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000", 0x440,

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000", 0x440,

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO, "/soc/aips-bus at 02200000/dcp at 02280000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 12 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 02200000/serial at 02288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

Quoted 54 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

0x440, 31}, +#elif defined(CONFIG_MX6UL)

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430, 22},
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 2100000/sim at 218c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 2100000/sim at 21b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000", 0x440, 3},
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000", 0x440,

6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000", 0x440,

8},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440, 9},
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440, 10},
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 2100000/caam at 2140000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	{MODULE_BEE, "/soc/aips-bus at 2000000/bee at 2044000", 0x440, 25},
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,
Quoted 1 line

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000", 0x440,

26},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2024000", 0x440,

26},

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 22 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000", 0x440,

31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 02100000/sim at 0218c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 02100000/sim at 021b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 27 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000", 0x440,

3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000", 0x440,

4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000", 0x440,

5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 02100000/ethernet at 02188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 02000000/ethernet at 020b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 02100000/caam at 2140000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 02100000/usb at 02184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000", 0x440,

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000", 0x440,

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 02000000/bee at 02044000", 0x440,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 3 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02024000",

0x440,

Quoted 11 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

I'm wondering if there would be a way to avoid the hardcoded DTS patch ("/soc/aips-bus at 02000000/epit at 020d4000") ?

Maybe, after reading the the OCOTP values this could be found dynamically (by using the e.g. i2c at 021f8000 string) on the DTS already stored in RAM (which is thereafter passed to Linux kernel at bootm
execution) ?

Quoted 58 lines

0x440, 31}, +#endif

arch/arm/mach-imx/mx6/module_fuse.c new file +9 -0
+};
+
+u32 check_module_fused(enum fuse_module_type module) {
+	u32 i, reg;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		if (mx6_fuse_descs[i].module == module) {
+			reg = readl(OCOTP_BASE_ADDR +
+

mx6_fuse_descs[i].fuse_word_offset);

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset))

arch/arm/mach-imx/mx6/module_fuse.c new file +20 -0
+				return 1; /* disabled */
+			else
+				return 0; /* enabled */
+		}
+	}
+
+	return  0; /* Not has a fuse, always enabled */ }
+
+#ifdef CONFIG_OF_SYSTEM_SETUP
+int ft_system_setup(void *blob, bd_t *bd) {
+	const char *status = "disabled";
+	u32 i, reg;
+	int rc, off;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		reg = readl(OCOTP_BASE_ADDR +
+			    mx6_fuse_descs[i].fuse_word_offset);
+		if (reg & BIT(mx6_fuse_descs[i].fuse_bit_offset)) {
+			off = fdt_path_offset(blob,
+

mx6_fuse_descs[i].node_path); +

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+			if (off < 0)
+				continue; /* Not found, skip it */
+add_status:
+			rc = fdt_setprop(blob, nodeoff, "status",

status,

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					 strlen(status) + 1);
+			if (rc) {
+				if (rc == -FDT_ERR_NOSPACE) {
+					rc = fdt_increase_size(blob,

512);

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					if (!rc)
+						goto add_status;
+				}
+				printf("Unable to update property

%s:%s, err=%s\n", mx6_fuse_descs[i].node_path, "status", fdt_strerror(rc));

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			} else {
+				printf("Modify %s disabled\n",

mx6_fuse_descs[i].node_path);

arch/arm/mach-imx/mx6/module_fuse.c new file +5 -0
+			}
+		}
+	}
+
+	return 0;

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+}
+#endif
+
+u32 esdhc_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case USDHC1_BASE_ADDR:
+		return check_module_fused(MODULE_SD1);
+	case USDHC2_BASE_ADDR:
+		return check_module_fused(MODULE_SD2); #ifdef

USDHC3_BASE_ADDR

Quoted 50 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +50 -0
+	case USDHC3_BASE_ADDR:
+		return check_module_fused(MODULE_SD3); #endif #ifdef
+USDHC4_BASE_ADDR
+	case USDHC4_BASE_ADDR:
+		return check_module_fused(MODULE_SD4); #endif
+	default:
+		return 0;
+	}
+}
+
+u32 ecspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ECSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI1);
+	case ECSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI2);
+	case ECSPI3_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI3);
+	case ECSPI4_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI4);
+#ifdef ECSPI5_BASE_ADDR
+	case ECSPI5_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI5);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 usb_fused(u32 base_addr)
+{
+	int i = (base_addr - USB_BASE_ADDR) / 0x200;
+
+	return check_module_fused(MODULE_USB_OTG1 + i); }
+
+u32 qspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+#ifdef QSPI1_BASE_ADDR
+	case QSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI1); #endif
+
+#ifdef QSPI2_BASE_ADDR
+	case QSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI2); #endif
+	default:
+		return 0;
+	}
+}

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+
+u32 i2c_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case I2C1_BASE_ADDR:
+		return check_module_fused(MODULE_I2C1);
+	case I2C2_BASE_ADDR:
+		return check_module_fused(MODULE_I2C2);
+	case I2C3_BASE_ADDR:
+		return check_module_fused(MODULE_I2C3); #ifdef

I2C4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 12 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +12 -0
+	case I2C4_BASE_ADDR:
+		return check_module_fused(MODULE_I2C4); #endif
+	}
+
+	return 0;
+}
+
+u32 enet_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ENET_BASE_ADDR:
+		return check_module_fused(MODULE_ENET1); #ifdef

ENET2_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c line 322

Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +6 -0
+	case ENET2_BASE_ADDR:
+		return check_module_fused(MODULE_ENET2); #endif
+	default:
+		return 0;
+	}
+}

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#8 lore raw

PATCH 1/4 imx: add module fuse support

Hi Peng,

Quoted 13 lines

Hi Lukasz,

Quoted 11 lines

Subject: Re: [U-Boot] [PATCH 1/4] imx: add module fuse support

Hi Peng,

Quoted 6 lines

There are different parts from one SoC. Take i.MX6ULL for example, some part might not have ENET, some might have; some might not have USB, some might have. The information could be got from OCOTP, to make one image support the different parts, we need runtime disable linux kernel dts node and uboot driver probe if the corresponding module not exists in the part.

Quoted 8 lines
Quoted 2 lines

If I understand correctly the concept is interesting to make the final binary smaller.

No. This is to use one image to support multiple parts of a same kind SoC. So this patch will make the uboot image size larger.

As described in commit log, some i.MX6UL parts not have enet, some have Enet,

Is there any markings on the SoC? (like MX6ULXXXXXX) which indicates which SoC has enet and which doesn't have one?

Quoted 2 lines

so we need find a method to make the same image could work on the two parts, that is what this patch does.

Ok. Thanks for explanation.

Quoted 706 lines

Thanks,
Peng.

Quoted 702 lines
Quoted 253 lines
---
 arch/arm/include/asm/mach-imx/module_fuse.h | 127 +++++++++++
 arch/arm/include/asm/mach-imx/sys_proto.h   |   1 +
 arch/arm/mach-imx/Kconfig                   |   7 +
 arch/arm/mach-imx/mx6/Makefile              |   1 +
 arch/arm/mach-imx/mx6/module_fuse.c         | 322
++++++++++++++++++++++++++++ 5 files changed, 458 insertions(+)
 create mode 100644 arch/arm/include/asm/mach-imx/module_fuse.h
 create mode 100644 arch/arm/mach-imx/mx6/module_fuse.c
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/module_fuse.h new file mode 100644 index 0000000000..6b93f0402e

arch/arm/include/asm/mach-imx/module_fuse.h new file +78 -0
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __MODULE_FUSE_H__
+#define __MODULE_FUSE_H__
+
+enum fuse_module_type {
+	MODULE_TSC,
+	MODULE_ADC1,
+	MODULE_ADC2,
+	MODULE_SIM1,
+	MODULE_SIM2,
+	MODULE_FLEXCAN1,
+	MODULE_FLEXCAN2,
+	MODULE_SPDIF,
+	MODULE_EIM,
+	MODULE_SD1,
+	MODULE_SD2,
+	MODULE_SD3,
+	MODULE_SD4,
+	MODULE_QSPI1,
+	MODULE_QSPI2,
+	MODULE_GPMI,
+	MODULE_APBHDMA,
+	MODULE_LCDIF,
+	MODULE_PXP,
+	MODULE_CSI,
+	MODULE_ENET1,
+	MODULE_ENET2,
+	MODULE_CAAM,
+	MODULE_USB_OTG1,
+	MODULE_USB_OTG2,
+	MODULE_SAI2,
+	MODULE_SAI3,
+	MODULE_BEE,
+	MODULE_UART1,
+	MODULE_UART2,
+	MODULE_UART3,
+	MODULE_UART4,
+	MODULE_UART5,
+	MODULE_UART6,
+	MODULE_UART7,
+	MODULE_UART8,
+	MODULE_PWM5,
+	MODULE_PWM6,
+	MODULE_PWM7,
+	MODULE_PWM8,
+	MODULE_ECSPI1,
+	MODULE_ECSPI2,
+	MODULE_ECSPI3,
+	MODULE_ECSPI4,
+	MODULE_ECSPI5,
+	MODULE_I2C1,
+	MODULE_I2C2,
+	MODULE_I2C3,
+	MODULE_I2C4,
+	MODULE_GPT1,
+	MODULE_GPT2,
+	MODULE_EPIT1,
+	MODULE_EPIT2,
+	MODULE_EPDC,
+	MODULE_ESAI,
+	MODULE_DCP,
+	MODULE_DCP_CRYPTO,
+};
+
+struct fuse_entry_desc {
+	enum fuse_module_type module;
+	const char *node_path;
+	u32 fuse_word_offset;
+	u32 fuse_bit_offset;
+	u32 status;
+};
+
+#if !IS_ENABLED(CONFIG_IMX_MODULE_FUSE)
+static inline u32 check_module_fused(enum fuse_module_type

module) {

arch/arm/include/asm/mach-imx/module_fuse.h new file +41 -0
+	return 0;
+};
+
+static inline u32 esdhc_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 ecspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 uart_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 usb_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 qspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 i2c_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 enet_fused(u32 base_addr) {
+	return 0;
+};
+#else
+u32 check_module_fused(enum fuse_module_type module);
+u32 esdhc_fused(u32 base_addr);
+u32 ecspi_fused(u32 base_addr);
+u32 uart_fused(u32 base_addr);
+u32 usb_fused(u32 base_addr);
+u32 qspi_fused(u32 base_addr);
+u32 i2c_fused(u32 base_addr);
+u32 enet_fused(u32 base_addr);
+#endif
+#endif /* __MODULE_FUSE_H__ */
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/sys_proto.h index 79cb4e6dc9..14b016ee99 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -9,6 +9,7 @@

#include <asm/io.h>
#include <asm/mach-imx/regs-common.h>

arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+#include <asm/mach-imx/module_fuse.h>
 #include <common.h>
 #include "../arch-imx/cpu.h"
arch/arm/mach-imx/Kconfig +5 -0
index d3942f6b3f..b8625962a6 100644
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
 	help
 	  bootaux [addr] to boot auxiliary core.
 
+config IMX_MODULE_FUSE
+	bool "i.MX Module Fuse"
+	depends on ARCH_MX6
+	help
+	  i.MX module fuse to runtime disable some driver,

including

arch/arm/mach-imx/Kconfig +2 -0
+	  Linux OS device node.
+
 config USE_IMXIMG_PLUGIN
 	bool "Use imximage plugin code"
 	depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP diff --git

a/arch/arm/mach-imx/mx6/Makefile b/arch/arm/mach-imx/mx6/Makefile index 81e2913d14..7ea8f91e4f 100644

arch/arm/mach-imx/mx6/Makefile +1 -0
@@ -6,6 +6,7 @@
 # (C) Copyright 2011 Freescale Semiconductor, Inc.
 
 obj-y	:= soc.o clock.o
+obj-$(CONFIG_IMX_MODULE_FUSE) += module_fuse.o
 obj-$(CONFIG_SPL_BUILD)	     += ddr.o
 obj-$(CONFIG_MP)             += mp.o
 obj-$(CONFIG_MX6UL_LITESOM)  += litesom.o diff --git

a/arch/arm/mach-imx/mx6/module_fuse.c b/arch/arm/mach-imx/mx6/module_fuse.c new file mode 100644 index 0000000000..417264b15c

arch/arm/mach-imx/mx6/module_fuse.c new file +15 -0
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/mach-imx/module_fuse.h> #include <linux/errno.h>
+
+static struct fuse_entry_desc mx6_fuse_descs[] = { #if
+defined(CONFIG_MX6ULL)
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 2200000/epdc at 228c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 2000000/spba-bus at 2000000/esai at 2024000", 0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 2200000/dcp at 2280000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO, "/soc/aips-bus at 2200000/dcp at 2280000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,
Quoted 1 line

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000", 0x440,

26},

Quoted 11 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 2200000/serial at 2288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 1 line

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 16 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000",

0x440, 31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000",

0x430, 22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000",

0x430, 23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 02200000/epdc at 0228c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/esai at 02024000", 0x430,

25},

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 27 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000",

0x440, 9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000",

0x440, 10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000",

0x440, 11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1,

"/soc/aips-bus at 02100000/ethernet at 02188000", 0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2,

"/soc/aips-bus at 02000000/ethernet at 020b4000", 0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 02200000/dcp at 02280000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 02100000/usb at 02184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000", 0x440,

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000", 0x440,

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO,

"/soc/aips-bus at 02200000/dcp at 02280000", 0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 12 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 02200000/serial at 02288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

Quoted 59 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000",

0x440, 30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

0x440, 31}, +#elif defined(CONFIG_MX6UL)

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 2100000/sim at 218c000", 0x430,

24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 2100000/sim at 21b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440, 2},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 2100000/caam at 2140000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 2000000/bee at 2044000", 0x440,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,
Quoted 1 line

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000", 0x440,

26},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2024000", 0x440,

26},

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000", 0x440,

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 22 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000",

0x440, 31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000",

0x430, 22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000",

0x430, 23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 02100000/sim at 0218c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 02100000/sim at 021b4000",

0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 27 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000",

0x440, 9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000",

0x440, 10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000",

0x440, 11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1,

"/soc/aips-bus at 02100000/ethernet at 02188000", 0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2,

"/soc/aips-bus at 02000000/ethernet at 020b4000", 0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 02100000/caam at 2140000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 02100000/usb at 02184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,
Quoted 1 line

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000", 0x440,

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000", 0x440,

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 02000000/bee at 02044000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 3 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02024000",

0x440,

Quoted 10 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000",

0x440, 30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",  

I'm wondering if there would be a way to avoid the hardcoded DTS patch ("/soc/aips-bus at 02000000/epit at 020d4000") ?

Maybe, after reading the the OCOTP values this could be found dynamically (by using the e.g. i2c at 021f8000 string) on the DTS already stored in RAM (which is thereafter passed to Linux kernel at bootm execution) ?

Quoted 59 lines

0x440, 31}, +#endif

arch/arm/mach-imx/mx6/module_fuse.c new file +9 -0
+};
+
+u32 check_module_fused(enum fuse_module_type module) {
+	u32 i, reg;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		if (mx6_fuse_descs[i].module == module) {
+			reg = readl(OCOTP_BASE_ADDR +
+

mx6_fuse_descs[i].fuse_word_offset);

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset))

arch/arm/mach-imx/mx6/module_fuse.c new file +18 -0
+				return 1; /* disabled */
+			else
+				return 0; /* enabled */
+		}
+	}
+
+	return  0; /* Not has a fuse, always enabled */ }
+
+#ifdef CONFIG_OF_SYSTEM_SETUP
+int ft_system_setup(void *blob, bd_t *bd) {
+	const char *status = "disabled";
+	u32 i, reg;
+	int rc, off;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		reg = readl(OCOTP_BASE_ADDR +
+			    mx6_fuse_descs[i].fuse_word_offset);
+		if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset)) {

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			off = fdt_path_offset(blob,
+

mx6_fuse_descs[i].node_path); +

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			if (off < 0)
+				continue; /* Not found, skip it

*/ +add_status:

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			rc = fdt_setprop(blob, nodeoff, "status",

status,

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					 strlen(status) + 1);
+			if (rc) {
+				if (rc == -FDT_ERR_NOSPACE) {
+					rc =

fdt_increase_size(blob, 512);

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					if (!rc)
+						goto add_status;
+				}
+				printf("Unable to update property

%s:%s, err=%s\n", mx6_fuse_descs[i].node_path, "status", fdt_strerror(rc));

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			} else {
+				printf("Modify %s disabled\n",

mx6_fuse_descs[i].node_path);

arch/arm/mach-imx/mx6/module_fuse.c new file +5 -0
+			}
+		}
+	}
+
+	return 0;

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+}
+#endif
+
+u32 esdhc_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case USDHC1_BASE_ADDR:
+		return check_module_fused(MODULE_SD1);
+	case USDHC2_BASE_ADDR:
+		return check_module_fused(MODULE_SD2); #ifdef  

USDHC3_BASE_ADDR

Quoted 50 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	case USDHC3_BASE_ADDR:
+		return check_module_fused(MODULE_SD3); #endif

#ifdef +USDHC4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c new file +47 -0
+	case USDHC4_BASE_ADDR:
+		return check_module_fused(MODULE_SD4); #endif
+	default:
+		return 0;
+	}
+}
+
+u32 ecspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ECSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI1);
+	case ECSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI2);
+	case ECSPI3_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI3);
+	case ECSPI4_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI4);
+#ifdef ECSPI5_BASE_ADDR
+	case ECSPI5_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI5);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 usb_fused(u32 base_addr)
+{
+	int i = (base_addr - USB_BASE_ADDR) / 0x200;
+
+	return check_module_fused(MODULE_USB_OTG1 + i); }
+
+u32 qspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+#ifdef QSPI1_BASE_ADDR
+	case QSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI1); #endif
+
+#ifdef QSPI2_BASE_ADDR
+	case QSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI2); #endif
+	default:
+		return 0;
+	}
+}

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+
+u32 i2c_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case I2C1_BASE_ADDR:
+		return check_module_fused(MODULE_I2C1);
+	case I2C2_BASE_ADDR:
+		return check_module_fused(MODULE_I2C2);
+	case I2C3_BASE_ADDR:
+		return check_module_fused(MODULE_I2C3); #ifdef  

I2C4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 12 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +12 -0
+	case I2C4_BASE_ADDR:
+		return check_module_fused(MODULE_I2C4); #endif
+	}
+
+	return 0;
+}
+
+u32 enet_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ENET_BASE_ADDR:
+		return check_module_fused(MODULE_ENET1); #ifdef  

ENET2_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c line 322

Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +6 -0
+	case ENET2_BASE_ADDR:
+		return check_module_fused(MODULE_ENET2); #endif
+	default:
+		return 0;
+	}
+}  

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190724/94f926b7/attachment.sig>

author
#9 lore raw

PATCH 1/4 imx: add module fuse support

Hi Lukasz,

Quoted 20 lines

Subject: Re: [U-Boot] [PATCH 1/4] imx: add module fuse support

Hi Peng,

Quoted 16 lines

Hi Lukasz,

Quoted 13 lines

Subject: Re: [U-Boot] [PATCH 1/4] imx: add module fuse support

Hi Peng,

Quoted 6 lines

There are different parts from one SoC. Take i.MX6ULL for example, some part might not have ENET, some might have; some might not have USB, some might have. The information could be got from OCOTP, to make one image support the different parts, we need runtime disable linux kernel dts node and uboot driver probe if the corresponding module not exists in the part.

If I understand correctly the concept is interesting to make the final binary smaller.

Quoted 8 lines
Quoted 5 lines

No. This is to use one image to support multiple parts of a same kind SoC. So this patch will make the uboot image size larger.

As described in commit log, some i.MX6UL parts not have enet, some have Enet,

Is there any markings on the SoC? (like MX6ULXXXXXX) which indicates which SoC has enet and which doesn't have one?

I do not have that marketing information. We just have the information that to use fuse to indicate whether the module is there.

Regards,
Peng.

Quoted 755 lines
Quoted 3 lines

so we need find a method to make the same image could work on the two parts, that is what this patch does.

Ok. Thanks for explanation.

Quoted 15 lines

Thanks,
Peng.

Quoted 11 lines
Quoted 11 lines
---
 arch/arm/include/asm/mach-imx/module_fuse.h | 127 +++++++++++
 arch/arm/include/asm/mach-imx/sys_proto.h   |   1 +
 arch/arm/mach-imx/Kconfig                   |   7 +
 arch/arm/mach-imx/mx6/Makefile              |   1 +
 arch/arm/mach-imx/mx6/module_fuse.c         | 322
++++++++++++++++++++++++++++ 5 files changed, 458 insertions(+)
 create mode 100644

arch/arm/include/asm/mach-imx/module_fuse.h

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
 create mode 100644 arch/arm/mach-imx/mx6/module_fuse.c
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/module_fuse.h new file mode

100644

Quoted 144 lines
Quoted 144 lines
Quoted 144 lines

index 0000000000..6b93f0402e

arch/arm/include/asm/mach-imx/module_fuse.h new file +78 -0
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __MODULE_FUSE_H__
+#define __MODULE_FUSE_H__
+
+enum fuse_module_type {
+	MODULE_TSC,
+	MODULE_ADC1,
+	MODULE_ADC2,
+	MODULE_SIM1,
+	MODULE_SIM2,
+	MODULE_FLEXCAN1,
+	MODULE_FLEXCAN2,
+	MODULE_SPDIF,
+	MODULE_EIM,
+	MODULE_SD1,
+	MODULE_SD2,
+	MODULE_SD3,
+	MODULE_SD4,
+	MODULE_QSPI1,
+	MODULE_QSPI2,
+	MODULE_GPMI,
+	MODULE_APBHDMA,
+	MODULE_LCDIF,
+	MODULE_PXP,
+	MODULE_CSI,
+	MODULE_ENET1,
+	MODULE_ENET2,
+	MODULE_CAAM,
+	MODULE_USB_OTG1,
+	MODULE_USB_OTG2,
+	MODULE_SAI2,
+	MODULE_SAI3,
+	MODULE_BEE,
+	MODULE_UART1,
+	MODULE_UART2,
+	MODULE_UART3,
+	MODULE_UART4,
+	MODULE_UART5,
+	MODULE_UART6,
+	MODULE_UART7,
+	MODULE_UART8,
+	MODULE_PWM5,
+	MODULE_PWM6,
+	MODULE_PWM7,
+	MODULE_PWM8,
+	MODULE_ECSPI1,
+	MODULE_ECSPI2,
+	MODULE_ECSPI3,
+	MODULE_ECSPI4,
+	MODULE_ECSPI5,
+	MODULE_I2C1,
+	MODULE_I2C2,
+	MODULE_I2C3,
+	MODULE_I2C4,
+	MODULE_GPT1,
+	MODULE_GPT2,
+	MODULE_EPIT1,
+	MODULE_EPIT2,
+	MODULE_EPDC,
+	MODULE_ESAI,
+	MODULE_DCP,
+	MODULE_DCP_CRYPTO,
+};
+
+struct fuse_entry_desc {
+	enum fuse_module_type module;
+	const char *node_path;
+	u32 fuse_word_offset;
+	u32 fuse_bit_offset;
+	u32 status;
+};
+
+#if !IS_ENABLED(CONFIG_IMX_MODULE_FUSE)
+static inline u32 check_module_fused(enum fuse_module_type

module) {

arch/arm/include/asm/mach-imx/module_fuse.h new file +41 -0
+	return 0;
+};
+
+static inline u32 esdhc_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 ecspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 uart_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 usb_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 qspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 i2c_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 enet_fused(u32 base_addr) {
+	return 0;
+};
+#else
+u32 check_module_fused(enum fuse_module_type module);
+u32 esdhc_fused(u32 base_addr);
+u32 ecspi_fused(u32 base_addr);
+u32 uart_fused(u32 base_addr);
+u32 usb_fused(u32 base_addr);
+u32 qspi_fused(u32 base_addr);
+u32 i2c_fused(u32 base_addr);
+u32 enet_fused(u32 base_addr);
+#endif
+#endif /* __MODULE_FUSE_H__ */
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/sys_proto.h index 79cb4e6dc9..14b016ee99 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -9,6 +9,7 @@

#include <asm/io.h>
#include <asm/mach-imx/regs-common.h>

arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+#include <asm/mach-imx/module_fuse.h>
 #include <common.h>
 #include "../arch-imx/cpu.h"
arch/arm/mach-imx/Kconfig +0 -0
index d3942f6b3f..b8625962a6 100644
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
 	help
 	  bootaux [addr] to boot auxiliary core.
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-imx/Kconfig +4 -0
+config IMX_MODULE_FUSE
+	bool "i.MX Module Fuse"
+	depends on ARCH_MX6
+	help
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/Kconfig +1 -0
+	  i.MX module fuse to runtime disable some driver,

including

arch/arm/mach-imx/Kconfig +2 -0
+	  Linux OS device node.
+
 config USE_IMXIMG_PLUGIN
 	bool "Use imximage plugin code"
 	depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP diff --git

a/arch/arm/mach-imx/mx6/Makefile

b/arch/arm/mach-imx/mx6/Makefile

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

index 81e2913d14..7ea8f91e4f 100644

arch/arm/mach-imx/mx6/Makefile +1 -0
@@ -6,6 +6,7 @@
 # (C) Copyright 2011 Freescale Semiconductor, Inc.
 
 obj-y	:= soc.o clock.o
+obj-$(CONFIG_IMX_MODULE_FUSE) += module_fuse.o
 obj-$(CONFIG_SPL_BUILD)	     += ddr.o
 obj-$(CONFIG_MP)             += mp.o
 obj-$(CONFIG_MX6UL_LITESOM)  += litesom.o diff --git

a/arch/arm/mach-imx/mx6/module_fuse.c b/arch/arm/mach-imx/mx6/module_fuse.c new file mode 100644 index 0000000000..417264b15c

arch/arm/mach-imx/mx6/module_fuse.c new file +14 -0
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/mach-imx/module_fuse.h> #include <linux/errno.h>
+
+static struct fuse_entry_desc mx6_fuse_descs[] = { #if
+defined(CONFIG_MX6ULL)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 2200000/epdc at 228c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 2000000/spba-bus at 2000000/esai at 2024000", 0x430,

25},

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440,

2},

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 2200000/dcp at 2280000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440,

24},

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440,

24},

Quoted 1 line
Quoted 1 line

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 1 line
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO,

"/soc/aips-bus at 2200000/dcp at 2280000",

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000",

0x440,

Quoted 4 lines
Quoted 4 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 2200000/serial at 2288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000",

0x440,

Quoted 16 lines
Quoted 16 lines
Quoted 3 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 9 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000",

0x440, 31},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	/* Paths for older imx tree: */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000",

0x430, 22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000",

0x430, 23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 02200000/epdc at 0228c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 02000000/spba-bus at 02000000/esai at 02024000",

0x430,

Quoted 26 lines
Quoted 26 lines

25},

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 17 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000",

0x440, 9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000",

0x440, 10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000",
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 8 lines

0x440, 11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1,

"/soc/aips-bus at 02100000/ethernet at 02188000", 0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2,

"/soc/aips-bus at 02000000/ethernet at 020b4000", 0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 02200000/dcp at 02280000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2,

"/soc/aips-bus at 02100000/usb at 02184200",

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000",

0x440,

Quoted 3 lines
Quoted 3 lines

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000",

0x440,

Quoted 43 lines
Quoted 43 lines

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO,

"/soc/aips-bus at 02200000/dcp at 02280000", 0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 12 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 02200000/serial at 02288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

Quoted 14 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000",

0x440, 30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

0x440, 31}, +#elif defined(CONFIG_MX6UL)

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 2100000/sim at 218c000", 0x430,

24},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 2100000/sim at 21b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440,

2},

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 2100000/caam at 2140000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440,

24},

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440,

24},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 2000000/bee at 2044000", 0x440,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000",

0x440,

Quoted 3 lines
Quoted 3 lines

26},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2024000",

0x440,

Quoted 2 lines
Quoted 2 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 1 line
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000",

0x440,

Quoted 49 lines
Quoted 49 lines
Quoted 3 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 22 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000",

0x440, 31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000",

0x430, 22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000",

0x430, 23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 02100000/sim at 0218c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 02100000/sim at 021b4000",

0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 17 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000",

0x440, 9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000",

0x440, 10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000",
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 8 lines

0x440, 11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1,

"/soc/aips-bus at 02100000/ethernet at 02188000", 0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2,

"/soc/aips-bus at 02000000/ethernet at 020b4000", 0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 02100000/caam at 2140000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2,

"/soc/aips-bus at 02100000/usb at 02184200",

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000",

0x440,

Quoted 3 lines
Quoted 3 lines

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000",

0x440,

Quoted 203 lines
Quoted 203 lines

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 02000000/bee at 02044000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 3 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02024000",

0x440,

Quoted 10 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000",

0x440, 30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

I'm wondering if there would be a way to avoid the hardcoded DTS patch ("/soc/aips-bus at 02000000/epit at 020d4000") ?

Maybe, after reading the the OCOTP values this could be found dynamically (by using the e.g. i2c at 021f8000 string) on the DTS already stored in RAM (which is thereafter passed to Linux kernel at bootm execution) ?

Quoted 59 lines

0x440, 31}, +#endif

arch/arm/mach-imx/mx6/module_fuse.c new file +9 -0
+};
+
+u32 check_module_fused(enum fuse_module_type module) {
+	u32 i, reg;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		if (mx6_fuse_descs[i].module == module) {
+			reg = readl(OCOTP_BASE_ADDR +
+

mx6_fuse_descs[i].fuse_word_offset);

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset))

arch/arm/mach-imx/mx6/module_fuse.c new file +18 -0
+				return 1; /* disabled */
+			else
+				return 0; /* enabled */
+		}
+	}
+
+	return  0; /* Not has a fuse, always enabled */ }
+
+#ifdef CONFIG_OF_SYSTEM_SETUP
+int ft_system_setup(void *blob, bd_t *bd) {
+	const char *status = "disabled";
+	u32 i, reg;
+	int rc, off;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		reg = readl(OCOTP_BASE_ADDR +
+			    mx6_fuse_descs[i].fuse_word_offset);
+		if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset)) {

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			off = fdt_path_offset(blob,
+

mx6_fuse_descs[i].node_path); +

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			if (off < 0)
+				continue; /* Not found, skip it

*/ +add_status:

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			rc = fdt_setprop(blob, nodeoff, "status",

status,

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					 strlen(status) + 1);
+			if (rc) {
+				if (rc == -FDT_ERR_NOSPACE) {
+					rc =

fdt_increase_size(blob, 512);

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					if (!rc)
+						goto add_status;
+				}
+				printf("Unable to update property

%s:%s, err=%s\n", mx6_fuse_descs[i].node_path, "status", fdt_strerror(rc));

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			} else {
+				printf("Modify %s disabled\n",

mx6_fuse_descs[i].node_path);

arch/arm/mach-imx/mx6/module_fuse.c new file +5 -0
+			}
+		}
+	}
+
+	return 0;

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+}
+#endif
+
+u32 esdhc_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case USDHC1_BASE_ADDR:
+		return check_module_fused(MODULE_SD1);
+	case USDHC2_BASE_ADDR:
+		return check_module_fused(MODULE_SD2); #ifdef

USDHC3_BASE_ADDR

Quoted 50 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	case USDHC3_BASE_ADDR:
+		return check_module_fused(MODULE_SD3); #endif

#ifdef +USDHC4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c new file +47 -0
+	case USDHC4_BASE_ADDR:
+		return check_module_fused(MODULE_SD4); #endif
+	default:
+		return 0;
+	}
+}
+
+u32 ecspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ECSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI1);
+	case ECSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI2);
+	case ECSPI3_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI3);
+	case ECSPI4_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI4);
+#ifdef ECSPI5_BASE_ADDR
+	case ECSPI5_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI5);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 usb_fused(u32 base_addr)
+{
+	int i = (base_addr - USB_BASE_ADDR) / 0x200;
+
+	return check_module_fused(MODULE_USB_OTG1 + i); }
+
+u32 qspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+#ifdef QSPI1_BASE_ADDR
+	case QSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI1); #endif
+
+#ifdef QSPI2_BASE_ADDR
+	case QSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI2); #endif
+	default:
+		return 0;
+	}
+}

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+
+u32 i2c_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case I2C1_BASE_ADDR:
+		return check_module_fused(MODULE_I2C1);
+	case I2C2_BASE_ADDR:
+		return check_module_fused(MODULE_I2C2);
+	case I2C3_BASE_ADDR:
+		return check_module_fused(MODULE_I2C3); #ifdef

I2C4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 12 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +12 -0
+	case I2C4_BASE_ADDR:
+		return check_module_fused(MODULE_I2C4); #endif
+	}
+
+	return 0;
+}
+
+u32 enet_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ENET_BASE_ADDR:
+		return check_module_fused(MODULE_ENET1); #ifdef

ENET2_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c line 322

Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +6 -0
+	case ENET2_BASE_ADDR:
+		return check_module_fused(MODULE_ENET2); #endif
+	default:
+		return 0;
+	}
+}

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#10 lore raw

PATCH 1/4 imx: add module fuse support

Hi Lukasz,

Quoted 30 lines · Peng Fan

Hi Lukasz,

Quoted 28 lines

Subject: Re: [U-Boot] [PATCH 1/4] imx: add module fuse support

Hi Peng,

Quoted 13 lines

Hi Lukasz,

Quoted 11 lines

Subject: Re: [U-Boot] [PATCH 1/4] imx: add module fuse support

Hi Peng,

Quoted 6 lines

There are different parts from one SoC. Take i.MX6ULL for example, some part might not have ENET, some might have; some might not have USB, some might have. The information could be got from OCOTP, to make one image support the different parts, we need runtime disable linux kernel dts node and uboot driver probe if the corresponding module not exists in the part.

Quoted 8 lines
Quoted 2 lines

If I understand correctly the concept is interesting to make the final binary smaller.

No. This is to use one image to support multiple parts of a same kind SoC. So this patch will make the uboot image size larger.

As described in commit log, some i.MX6UL parts not have enet, some have Enet,

Is there any markings on the SoC? (like MX6ULXXXXXX) which indicates which SoC has enet and which doesn't have one?

Yes, you can look in the datasheets. For i.MX6ULL ([1], [2]) for example, there is a table in chapter 1.1, which describes the features for the different types and the corresponding part numbers. And the part numbers are printed on the chips.

Regards,
Frieder

[1] https://www.nxp.com/docs/en/data-sheet/IMX6ULLCEC.pdf
[2] https://www.nxp.com/docs/en/data-sheet/IMX6ULLIEC.pdf

Quoted 767 lines

I do not have that marketing information. We just have the information that to use fuse to indicate whether the module is there.

Regards,
Peng.

Quoted 747 lines
Quoted 3 lines

so we need find a method to make the same image could work on the two parts, that is what this patch does.

Ok. Thanks for explanation.

Quoted 15 lines

Thanks,
Peng.

Quoted 11 lines
Quoted 11 lines
---
  arch/arm/include/asm/mach-imx/module_fuse.h | 127 +++++++++++
  arch/arm/include/asm/mach-imx/sys_proto.h   |   1 +
  arch/arm/mach-imx/Kconfig                   |   7 +
  arch/arm/mach-imx/mx6/Makefile              |   1 +
  arch/arm/mach-imx/mx6/module_fuse.c         | 322

++++++++++++++++++++++++++++ 5 files changed, 458 insertions(+)
create mode 100644

arch/arm/include/asm/mach-imx/module_fuse.h

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

create mode 100644 arch/arm/mach-imx/mx6/module_fuse.c

(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/module_fuse.h new file mode

100644

Quoted 144 lines
Quoted 144 lines
Quoted 144 lines

index 0000000000..6b93f0402e

arch/arm/include/asm/mach-imx/module_fuse.h new file +78 -0
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __MODULE_FUSE_H__
+#define __MODULE_FUSE_H__
+
+enum fuse_module_type {
+	MODULE_TSC,
+	MODULE_ADC1,
+	MODULE_ADC2,
+	MODULE_SIM1,
+	MODULE_SIM2,
+	MODULE_FLEXCAN1,
+	MODULE_FLEXCAN2,
+	MODULE_SPDIF,
+	MODULE_EIM,
+	MODULE_SD1,
+	MODULE_SD2,
+	MODULE_SD3,
+	MODULE_SD4,
+	MODULE_QSPI1,
+	MODULE_QSPI2,
+	MODULE_GPMI,
+	MODULE_APBHDMA,
+	MODULE_LCDIF,
+	MODULE_PXP,
+	MODULE_CSI,
+	MODULE_ENET1,
+	MODULE_ENET2,
+	MODULE_CAAM,
+	MODULE_USB_OTG1,
+	MODULE_USB_OTG2,
+	MODULE_SAI2,
+	MODULE_SAI3,
+	MODULE_BEE,
+	MODULE_UART1,
+	MODULE_UART2,
+	MODULE_UART3,
+	MODULE_UART4,
+	MODULE_UART5,
+	MODULE_UART6,
+	MODULE_UART7,
+	MODULE_UART8,
+	MODULE_PWM5,
+	MODULE_PWM6,
+	MODULE_PWM7,
+	MODULE_PWM8,
+	MODULE_ECSPI1,
+	MODULE_ECSPI2,
+	MODULE_ECSPI3,
+	MODULE_ECSPI4,
+	MODULE_ECSPI5,
+	MODULE_I2C1,
+	MODULE_I2C2,
+	MODULE_I2C3,
+	MODULE_I2C4,
+	MODULE_GPT1,
+	MODULE_GPT2,
+	MODULE_EPIT1,
+	MODULE_EPIT2,
+	MODULE_EPDC,
+	MODULE_ESAI,
+	MODULE_DCP,
+	MODULE_DCP_CRYPTO,
+};
+
+struct fuse_entry_desc {
+	enum fuse_module_type module;
+	const char *node_path;
+	u32 fuse_word_offset;
+	u32 fuse_bit_offset;
+	u32 status;
+};
+
+#if !IS_ENABLED(CONFIG_IMX_MODULE_FUSE)
+static inline u32 check_module_fused(enum fuse_module_type

module) {

arch/arm/include/asm/mach-imx/module_fuse.h new file +41 -0
+	return 0;
+};
+
+static inline u32 esdhc_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 ecspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 uart_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 usb_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 qspi_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 i2c_fused(u32 base_addr) {
+	return 0;
+};
+
+static inline u32 enet_fused(u32 base_addr) {
+	return 0;
+};
+#else
+u32 check_module_fused(enum fuse_module_type module);
+u32 esdhc_fused(u32 base_addr);
+u32 ecspi_fused(u32 base_addr);
+u32 uart_fused(u32 base_addr);
+u32 usb_fused(u32 base_addr);
+u32 qspi_fused(u32 base_addr);
+u32 i2c_fused(u32 base_addr);
+u32 enet_fused(u32 base_addr);
+#endif
+#endif /* __MODULE_FUSE_H__ */
(quoted diff) +0 -0

b/arch/arm/include/asm/mach-imx/sys_proto.h index 79cb4e6dc9..14b016ee99 100644 --- a/arch/arm/include/asm/mach-imx/sys_proto.h +++ b/arch/arm/include/asm/mach-imx/sys_proto.h @@ -9,6 +9,7 @@

  #include <asm/io.h>
  #include <asm/mach-imx/regs-common.h>
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
+#include <asm/mach-imx/module_fuse.h>
  #include <common.h>
  #include "../arch-imx/cpu.h"
arch/arm/mach-imx/Kconfig +0 -0
index d3942f6b3f..b8625962a6 100644
@@ -27,6 +27,13 @@ config IMX_BOOTAUX
  	help
  	  bootaux [addr] to boot auxiliary core.
 
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-imx/Kconfig +4 -0
+config IMX_MODULE_FUSE
+	bool "i.MX Module Fuse"
+	depends on ARCH_MX6
+	help
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/Kconfig +1 -0
+	  i.MX module fuse to runtime disable some driver,

including

arch/arm/mach-imx/Kconfig +2 -0
+	  Linux OS device node.
+
  config USE_IMXIMG_PLUGIN
  	bool "Use imximage plugin code"
  	depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX7ULP diff --git

a/arch/arm/mach-imx/mx6/Makefile

b/arch/arm/mach-imx/mx6/Makefile

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

index 81e2913d14..7ea8f91e4f 100644

arch/arm/mach-imx/mx6/Makefile +1 -0
@@ -6,6 +6,7 @@
  # (C) Copyright 2011 Freescale Semiconductor, Inc.
 
  obj-y	:= soc.o clock.o
+obj-$(CONFIG_IMX_MODULE_FUSE) += module_fuse.o
  obj-$(CONFIG_SPL_BUILD)	     += ddr.o
  obj-$(CONFIG_MP)             += mp.o
  obj-$(CONFIG_MX6UL_LITESOM)  += litesom.o diff --git

a/arch/arm/mach-imx/mx6/module_fuse.c b/arch/arm/mach-imx/mx6/module_fuse.c new file mode 100644 index 0000000000..417264b15c

arch/arm/mach-imx/mx6/module_fuse.c new file +14 -0
@@ -0,0 +1,322 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/mach-imx/module_fuse.h> #include <linux/errno.h>
+
+static struct fuse_entry_desc mx6_fuse_descs[] = { #if
+defined(CONFIG_MX6ULL)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 2200000/epdc at 228c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 2000000/spba-bus at 2000000/esai at 2024000", 0x430,

25},

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440,

2},

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 2200000/dcp at 2280000", 0x440,

14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440,

24},

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440,

24},

Quoted 1 line
Quoted 1 line

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 1 line
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO,

"/soc/aips-bus at 2200000/dcp at 2280000",

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000",

0x440,

Quoted 4 lines
Quoted 4 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 2200000/serial at 2288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000",

0x440,

Quoted 16 lines
Quoted 16 lines
Quoted 3 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 9 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000",

0x440, 31},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	/* Paths for older imx tree: */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000",

0x430, 22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000",

0x430, 23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPDC, "/soc/aips-bus at 02200000/epdc at 0228c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ESAI,

"/soc/aips-bus at 02000000/spba-bus at 02000000/esai at 02024000",

0x430,

Quoted 26 lines
Quoted 26 lines

25},

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 17 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000",

0x440, 9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000",

0x440, 10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000",
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 8 lines

0x440, 11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1,

"/soc/aips-bus at 02100000/ethernet at 02188000", 0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2,

"/soc/aips-bus at 02000000/ethernet at 020b4000", 0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP, "/soc/aips-bus at 02200000/dcp at 02280000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2,

"/soc/aips-bus at 02100000/usb at 02184200",

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000",

0x440,

Quoted 3 lines
Quoted 3 lines

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000",

0x440,

Quoted 43 lines
Quoted 43 lines

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_DCP_CRYPTO,

"/soc/aips-bus at 02200000/dcp at 02280000", 0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 12 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8, "/soc/aips-bus at 02200000/serial at 02288000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

Quoted 14 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000",

0x440, 30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

0x440, 31}, +#elif defined(CONFIG_MX6UL)

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_TSC, "/soc/aips-bus at 2000000/tsc at 2040000", 0x430,

22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 2100000/adc at 219c000", 0x430,

23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 2100000/sim at 218c000", 0x430,

24},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 2100000/sim at 21b4000", 0x430,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 2000000/can at 2090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 2000000/can at 2094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,

"/soc/aips-bus at 2000000/spba-bus at 2000000/spdif at 2004000", 0x440,

2},

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 2100000/weim at 21b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 2100000/usdhc at 2190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 2100000/usdhc at 2194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 2100000/qspi at 21e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 1806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 1804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 2100000/lcdif at 21c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 2100000/pxp at 21cc000", 0x440,

9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 2100000/csi at 21c4000", 0x440,

10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 2100000/adc at 2198000", 0x440,

11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1, "/soc/aips-bus at 2100000/ethernet at 2188000",

0x440, 12},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2, "/soc/aips-bus at 2000000/ethernet at 20b4000",

0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 2100000/caam at 2140000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2, "/soc/aips-bus at 2100000/usb at 2184200",

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 202c000", 0x440,

24},

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/sai at 2030000", 0x440,

24},

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 2000000/bee at 2044000", 0x440,

25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 2100000/serial at 21f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 2100000/serial at 21fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2018000",

0x440,

Quoted 3 lines
Quoted 3 lines

26},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2024000",

0x440,

Quoted 2 lines
Quoted 2 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 1 line
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 2000000/pwm at 20f0000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 2000000/pwm at 20f4000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 2000000/pwm at 20f8000",

0x440,

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 2 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 2000000/pwm at 20fc000",

0x440,

Quoted 49 lines
Quoted 49 lines
Quoted 3 lines

27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2010000", 0x440,

28},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 2000000/spba-bus at 2000000/ecspi at 2014000", 0x440,

28},

Quoted 22 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 2100000/i2c at 21a8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 2100000/i2c at 21f8000", 0x440,

29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 2000000/gpt at 20e8000", 0x440,

30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 2000000/epit at 20d4000",

0x440, 31},

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	/* Paths for older imx tree: */
+	{MODULE_TSC, "/soc/aips-bus at 02000000/tsc at 02040000",

0x430, 22},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC2, "/soc/aips-bus at 02100000/adc at 0219c000",

0x430, 23},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM1, "/soc/aips-bus at 02100000/sim at 0218c000",

0x430, 24},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SIM2, "/soc/aips-bus at 02100000/sim at 021b4000",

0x430, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN1, "/soc/aips-bus at 02000000/can at 02090000",

0x430, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_FLEXCAN2, "/soc/aips-bus at 02000000/can at 02094000",

0x430, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SPDIF,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/spdif at 02004000", 0x440,

2},

Quoted 17 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EIM, "/soc/aips-bus at 02100000/weim at 021b8000",

0x440, 3},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD1, "/soc/aips-bus at 02100000/usdhc at 02190000",

0x440, 4},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SD2, "/soc/aips-bus at 02100000/usdhc at 02194000",

0x440, 5},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_QSPI1, "/soc/aips-bus at 02100000/qspi at 021e0000",

0x440, 6},

arch/arm/mach-imx/mx6/module_fuse.c new file +3 -0
+	{MODULE_GPMI, "/soc/gpmi-nand at 01806000", 0x440, 7},
+	{MODULE_APBHDMA, "/soc/dma-apbh at 01804000", 0x440, 7},
+	{MODULE_LCDIF, "/soc/aips-bus at 02100000/lcdif at 021c8000",

0x440, 8},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PXP, "/soc/aips-bus at 02100000/pxp at 021cc000",

0x440, 9},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CSI, "/soc/aips-bus at 02100000/csi at 021c4000",

0x440, 10},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ADC1, "/soc/aips-bus at 02100000/adc at 02198000",
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 8 lines

0x440, 11},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET1,

"/soc/aips-bus at 02100000/ethernet at 02188000", 0x440, 12},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ENET2,

"/soc/aips-bus at 02000000/ethernet at 020b4000", 0x440, 13},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_CAAM, "/soc/aips-bus at 02100000/caam at 2140000",

0x440, 14},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_USB_OTG2,

"/soc/aips-bus at 02100000/usb at 02184200",

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

0x440, 15},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI2,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 0202c000",

0x440,

Quoted 3 lines
Quoted 3 lines

24},

Quoted 2 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_SAI3,

"/soc/aips-bus at 02000000/spba-bus at 02000000/sai at 02030000",

0x440,

Quoted 203 lines
Quoted 203 lines

24},

Quoted 8 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_BEE, "/soc/aips-bus at 02000000/bee at 02044000",

0x440, 25},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART5, "/soc/aips-bus at 02100000/serial at 021f4000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART6, "/soc/aips-bus at 02100000/serial at 021fc000",

0x440, 26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART7,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02018000",

0x440,

Quoted 3 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_UART8,

"/soc/aips-bus at 02000000/spba-bus at 02000000/serial at 02024000",

0x440,

Quoted 10 lines

26},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM5, "/soc/aips-bus at 02000000/pwm at 020f0000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM6, "/soc/aips-bus at 02000000/pwm at 020f4000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM7, "/soc/aips-bus at 02000000/pwm at 020f8000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_PWM8, "/soc/aips-bus at 02000000/pwm at 020fc000",

0x440, 27},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI3,
Quoted 2 lines

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02010000", 0x440,

28},

Quoted 3 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_ECSPI4,

"/soc/aips-bus at 02000000/spba-bus at 02000000/ecspi at 02014000", 0x440,

28},

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 7 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C3, "/soc/aips-bus at 02100000/i2c at 021a8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_I2C4, "/soc/aips-bus at 02100000/i2c at 021f8000",

0x440, 29},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_GPT2, "/soc/aips-bus at 02000000/gpt at 020e8000",

0x440, 30},

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+	{MODULE_EPIT2, "/soc/aips-bus at 02000000/epit at 020d4000",

I'm wondering if there would be a way to avoid the hardcoded DTS patch ("/soc/aips-bus at 02000000/epit at 020d4000") ?

Maybe, after reading the the OCOTP values this could be found dynamically (by using the e.g. i2c at 021f8000 string) on the DTS already stored in RAM (which is thereafter passed to Linux kernel at bootm execution) ?

Quoted 59 lines

0x440, 31}, +#endif

arch/arm/mach-imx/mx6/module_fuse.c new file +9 -0
+};
+
+u32 check_module_fused(enum fuse_module_type module) {
+	u32 i, reg;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		if (mx6_fuse_descs[i].module == module) {
+			reg = readl(OCOTP_BASE_ADDR +
+

mx6_fuse_descs[i].fuse_word_offset);

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset))

arch/arm/mach-imx/mx6/module_fuse.c new file +18 -0
+				return 1; /* disabled */
+			else
+				return 0; /* enabled */
+		}
+	}
+
+	return  0; /* Not has a fuse, always enabled */ }
+
+#ifdef CONFIG_OF_SYSTEM_SETUP
+int ft_system_setup(void *blob, bd_t *bd) {
+	const char *status = "disabled";
+	u32 i, reg;
+	int rc, off;
+
+	for (i = 0; i < ARRAY_SIZE(mx6_fuse_descs); i++) {
+		reg = readl(OCOTP_BASE_ADDR +
+			    mx6_fuse_descs[i].fuse_word_offset);
+		if (reg &

BIT(mx6_fuse_descs[i].fuse_bit_offset)) {

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			off = fdt_path_offset(blob,
+

mx6_fuse_descs[i].node_path); +

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			if (off < 0)
+				continue; /* Not found, skip it

*/ +add_status:

arch/arm/mach-imx/mx6/module_fuse.c new file +1 -0
+			rc = fdt_setprop(blob, nodeoff, "status",

status,

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					 strlen(status) + 1);
+			if (rc) {
+				if (rc == -FDT_ERR_NOSPACE) {
+					rc =

fdt_increase_size(blob, 512);

arch/arm/mach-imx/mx6/module_fuse.c new file +4 -0
+					if (!rc)
+						goto add_status;
+				}
+				printf("Unable to update property

%s:%s, err=%s\n", mx6_fuse_descs[i].node_path, "status", fdt_strerror(rc));

arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+			} else {
+				printf("Modify %s disabled\n",

mx6_fuse_descs[i].node_path);

arch/arm/mach-imx/mx6/module_fuse.c new file +5 -0
+			}
+		}
+	}
+
+	return 0;

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+}
+#endif
+
+u32 esdhc_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case USDHC1_BASE_ADDR:
+		return check_module_fused(MODULE_SD1);
+	case USDHC2_BASE_ADDR:
+		return check_module_fused(MODULE_SD2); #ifdef

USDHC3_BASE_ADDR

Quoted 50 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +2 -0
+	case USDHC3_BASE_ADDR:
+		return check_module_fused(MODULE_SD3); #endif

#ifdef +USDHC4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c new file +47 -0
+	case USDHC4_BASE_ADDR:
+		return check_module_fused(MODULE_SD4); #endif
+	default:
+		return 0;
+	}
+}
+
+u32 ecspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ECSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI1);
+	case ECSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI2);
+	case ECSPI3_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI3);
+	case ECSPI4_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI4);
+#ifdef ECSPI5_BASE_ADDR
+	case ECSPI5_BASE_ADDR:
+		return check_module_fused(MODULE_ECSPI5);
+#endif
+	default:
+		return 0;
+	}
+}
+
+u32 usb_fused(u32 base_addr)
+{
+	int i = (base_addr - USB_BASE_ADDR) / 0x200;
+
+	return check_module_fused(MODULE_USB_OTG1 + i); }
+
+u32 qspi_fused(u32 base_addr)
+{
+	switch (base_addr) {
+#ifdef QSPI1_BASE_ADDR
+	case QSPI1_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI1); #endif
+
+#ifdef QSPI2_BASE_ADDR
+	case QSPI2_BASE_ADDR:
+		return check_module_fused(MODULE_QSPI2); #endif
+	default:
+		return 0;
+	}
+}

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 10 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +10 -0
+
+u32 i2c_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case I2C1_BASE_ADDR:
+		return check_module_fused(MODULE_I2C1);
+	case I2C2_BASE_ADDR:
+		return check_module_fused(MODULE_I2C2);
+	case I2C3_BASE_ADDR:
+		return check_module_fused(MODULE_I2C3); #ifdef

I2C4_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c

Quoted 12 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +12 -0
+	case I2C4_BASE_ADDR:
+		return check_module_fused(MODULE_I2C4); #endif
+	}
+
+	return 0;
+}
+
+u32 enet_fused(u32 base_addr)
+{
+	switch (base_addr) {
+	case ENET_BASE_ADDR:
+		return check_module_fused(MODULE_ENET1); #ifdef

ENET2_BASE_ADDR

arch/arm/mach-imx/mx6/module_fuse.c line 322

Quoted 6 lines
arch/arm/mach-imx/mx6/module_fuse.c new file +6 -0
+	case ENET2_BASE_ADDR:
+		return check_module_fused(MODULE_ENET2); #endif
+	default:
+		return 0;
+	}
+}

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#11 lore raw

PATCH 1/4 imx: add module fuse support

Hi Frieder,

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Is there any markings on the SoC? (like MX6ULXXXXXX) which indicates which SoC has enet and which doesn't have one?

Yes, you can look in the datasheets. For i.MX6ULL ([1], [2]) for example, there is a table in chapter 1.1, which describes the features for the different types and the corresponding part numbers. And the part numbers are printed on the chips.

Thanks for the info.

Quoted 6 lines

Regards,
Frieder

[1] https://www.nxp.com/docs/en/data-sheet/IMX6ULLCEC.pdf
[2] https://www.nxp.com/docs/en/data-sheet/IMX6ULLIEC.pdf

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190724/baa786c3/attachment.sig>