summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2016-03-16 13:50:54 +0800
committerYe Li <ye.li@nxp.com>2018-04-27 02:30:47 -0700
commit6e8c9ae136bee8ec0121c1db4b935510caad09db (patch)
treedce1ab3cbcf02f970c9265b36ff3e5875173106f
parente93235cbcf624a476c95f4e9e8fd51e667ab4aa2 (diff)
MLK-12483-4 mx6: Modify drivers to disable fused modules
Add the fuse checking in drivers, when the module is disabled in fuse, the driver will not work. Changed drivers: BEE, GPMI, APBH-DMA, ESDHC, FEC, QSPI, ECSPI, I2C, USB-EHCI, GIS, LCDIF and EPDC. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit 1704e116f9b39aeb99201919a18bc2b1e19a980e) (cherry picked from commit 2d3b5df8530cd5ef883750378838dea7c40259af)
-rw-r--r--arch/arm/mach-imx/mx6/bee.c14
-rw-r--r--drivers/dma/apbh_dma.c8
-rw-r--r--drivers/i2c/mxc_i2c.c18
-rw-r--r--drivers/mmc/fsl_esdhc.c16
-rw-r--r--drivers/mtd/nand/mxs_nand.c7
-rw-r--r--drivers/net/fec_mxc.c14
-rw-r--r--drivers/spi/fsl_qspi.c15
-rw-r--r--drivers/spi/mxc_spi.c10
-rw-r--r--drivers/usb/host/ehci-mx6.c15
-rw-r--r--drivers/video/mxc_epdc_fb.c20
-rw-r--r--drivers/video/mxc_gis.c16
-rw-r--r--drivers/video/mxsfb.c10
12 files changed, 154 insertions, 9 deletions
diff --git a/arch/arm/mach-imx/mx6/bee.c b/arch/arm/mach-imx/mx6/bee.c
index ae08089c3e2..84f6a5e22ad 100644
--- a/arch/arm/mach-imx/mx6/bee.c
+++ b/arch/arm/mach-imx/mx6/bee.c
@@ -267,7 +267,7 @@ static int region_valid(u32 start, u32 size)
static int do_bee_init(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
- u32 start, size, val;
+ u32 start, size;
int ret;
struct bee_parameters *p = &para;
@@ -280,14 +280,12 @@ static int do_bee_init(cmd_tbl_t *cmdtp, int flag, int argc,
if (argc > 5)
return CMD_RET_USAGE;
- if (fuse_read(0, 4, &val)) {
- puts("Can not get fuse bank 0, word 4\n");
- } else {
- if (val & (1 << 25)) {
- puts("BEE disabed in fuse!\n");
- return CMD_RET_FAILURE;
- }
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_BEE)) {
+ printf("BEE is fused, disable it!\n");
+ return CMD_RET_FAILURE;
}
+#endif
/* Cache enabled? */
if ((get_cr() & (CR_I | CR_C)) != (CR_I | CR_C)) {
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index a17b15a359e..59ef393184d 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -574,6 +574,14 @@ void mxs_dma_init(void)
struct mxs_apbh_regs *apbh_regs =
(struct mxs_apbh_regs *)MXS_APBH_BASE;
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_APBHDMA)) {
+ printf("NAND APBH-DMA@0x%x is fused, disable it\n",
+ MXS_APBH_BASE);
+ return;
+ }
+#endif
+
mxs_reset_block(&apbh_regs->hw_apbh_ctrl0_reg);
#ifdef CONFIG_APBH_DMA_BURST8
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 79228c2757b..4ef8f6c802b 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -4,6 +4,8 @@
* (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
* (c) 2011 Marek Vasut <marek.vasut@gmail.com>
*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
* Based on i2c-imx.c from linux kernel:
* Copyright (C) 2005 Torsten Koschorrek <koschorrek at synertronixx.de>
* Copyright (C) 2005 Matthias Blaschke <blaschke at synertronixx.de>
@@ -25,6 +27,7 @@
#include <dm.h>
#include <dm/pinctrl.h>
#include <fdtdec.h>
+#include <asm/arch/sys_proto.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -648,6 +651,14 @@ void bus_i2c_init(int index, int speed, int unused,
return;
}
+#ifdef CONFIG_MX6
+ if (mx6_i2c_fused((u32)mxc_i2c_buses[index].base)) {
+ printf("I2C@0x%x is fused, disable it\n",
+ (u32)mxc_i2c_buses[index].base);
+ return;
+ }
+#endif
+
/*
* Warning: Be careful to allow the assignment to a static
* variable here. This function could be called while U-Boot is
@@ -761,6 +772,13 @@ static int mxc_i2c_probe(struct udevice *bus)
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
+#ifdef CONFIG_MX6
+ if (mx6_i2c_fused(addr)) {
+ printf("I2C@0x%lx is fused, disable it\n", addr);
+ return -ENODEV;
+ }
+#endif
+
i2c_bus->base = addr;
i2c_bus->index = bus->seq;
i2c_bus->bus = bus;
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 39734b78a9d..34fc978936f 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -24,6 +24,7 @@
#include <dm.h>
#include <asm-generic/gpio.h>
#include <dm/pinctrl.h>
+#include <asm/arch/sys_proto.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -1285,6 +1286,14 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
return ret;
}
+#ifdef CONFIG_MX6
+ if (mx6_esdhc_fused(cfg->esdhc_base)) {
+ printf("ESDHC@0x%lx is fused, disable it\n", cfg->esdhc_base);
+ free(priv);
+ return -ENODEV;
+ }
+#endif
+
ret = fsl_esdhc_init(priv, plat);
if (ret) {
debug("%s init failure\n", __func__);
@@ -1413,6 +1422,13 @@ static int fsl_esdhc_probe(struct udevice *dev)
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
+#ifdef CONFIG_MX6
+ if (mx6_esdhc_fused(addr)) {
+ printf("ESDHC@0x%lx is fused, disable it\n", addr);
+ return -ENODEV;
+ }
+#endif
+
priv->esdhc_regs = (struct fsl_esdhc *)addr;
priv->dev = dev;
priv->mode = -1;
diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 4cfe79937ef..50f3b70bd5f 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -1244,6 +1244,13 @@ int mxs_nand_init(struct mxs_nand_info *info)
(struct mxs_bch_regs *)MXS_BCH_BASE;
int i = 0, j, ret = 0;
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_GPMI)) {
+ printf("NAND GPMI@0x%x is fused, disable it\n", MXS_GPMI_BASE);
+ return -EPERM;
+ }
+#endif
+
info->desc = malloc(sizeof(struct mxs_dma_desc *) *
MXS_NAND_DMA_DESCRIPTOR_COUNT);
if (!info->desc) {
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 350928d1254..7971bd4ad69 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -24,6 +24,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
#include <asm/mach-imx/sys_proto.h>
+#include <asm/arch/sys_proto.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -1145,6 +1146,13 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
#endif
int ret;
+#ifdef CONFIG_MX6
+ if (mx6_enet_fused(addr)) {
+ printf("Ethernet@0x%x is fused, disable it\n", addr);
+ return -2;
+ }
+#endif
+
#ifdef CONFIG_FEC_MXC_MDIO_BASE
/*
* The i.MX28 has two ethernet interfaces, but they are not equal.
@@ -1253,6 +1261,12 @@ static int fecmxc_probe(struct udevice *dev)
uint32_t start;
int ret;
+#ifdef CONFIG_MX6
+ if (mx6_enet_fused((uint32_t)priv->eth)) {
+ printf("Ethernet@0x%x is fused, disable it\n", (uint32_t)priv->eth);
+ return -ENODEV;
+ }
+#endif
ret = fec_alloc_descs(priv);
if (ret)
return ret;
diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 662cd1ae051..7359cb6cdc0 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -16,6 +16,7 @@
#include <watchdog.h>
#include <wait_bit.h>
#include "fsl_qspi.h"
+#include <asm/arch/sys_proto.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -944,6 +945,13 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
if (bus >= ARRAY_SIZE(spi_bases))
return NULL;
+#ifdef CONFIG_MX6
+ if (mx6_qspi_fused(spi_bases[bus])) {
+ printf("QSPI@0x%lx is fused, disable it\n", spi_bases[bus]);
+ return NULL;
+ }
+#endif
+
if (cs >= FSL_QSPI_FLASH_NUM)
return NULL;
@@ -1074,6 +1082,13 @@ static int fsl_qspi_probe(struct udevice *bus)
struct dm_spi_bus *dm_spi_bus;
int i, ret;
+#ifdef CONFIG_MX6
+ if (mx6_qspi_fused(plat->reg_base)) {
+ printf("QSPI@0x%lx is fused, disable it\n", plat->reg_base);
+ return -ENODEV;
+ }
+#endif
+
dm_spi_bus = bus->uclass_priv;
dm_spi_bus->max_hz = plat->speed_hz;
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 41f0cfcd6b7..a1147a033e5 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -1,6 +1,8 @@
/*
* Copyright (C) 2008, Guennadi Liakhovetski <lg@denx.de>
*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -14,6 +16,7 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
#include <asm/mach-imx/spi.h>
+#include <asm/arch/sys_proto.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -450,6 +453,13 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
return NULL;
}
+#ifdef CONFIG_MX6
+ if (mx6_ecspi_fused(spi_bases[bus])) {
+ printf("ECSPI@0x%lx is fused, disable it\n", spi_bases[bus]);
+ return NULL;
+ }
+#endif
+
mxcs = spi_alloc_slave(struct mxc_spi_slave, bus, cs);
if (!mxcs) {
puts("mxc_spi: SPI Slave not allocated !\n");
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index f81a15b50a3..8bb6adcf8e8 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -19,6 +19,7 @@
#include <dm.h>
#include <asm/mach-types.h>
#include <power/regulator.h>
+#include <asm/arch/sys_proto.h>
#include "ehci.h"
@@ -403,6 +404,13 @@ int ehci_hcd_init(int index, enum usb_init_type init,
if (index > 3)
return -EINVAL;
+#if defined(CONFIG_MX6)
+ if (mx6_usb_fused((u32)ehci)) {
+ printf("USB@0x%x is fused, disable it\n", (u32)ehci);
+ return -ENODEV;
+ }
+#endif
+
ret = ehci_mx6_common_init(ehci, index);
if (ret)
return ret;
@@ -591,6 +599,13 @@ static int ehci_usb_probe(struct udevice *dev)
struct ehci_hcor *hcor;
int ret;
+#if defined(CONFIG_MX6)
+ if (mx6_usb_fused((u32)ehci)) {
+ printf("USB@0x%x is fused, disable it\n", (u32)ehci);
+ return -ENODEV;
+ }
+#endif
+
priv->ehci = ehci;
priv->portnr = dev->seq;
priv->init_type = type;
diff --git a/drivers/video/mxc_epdc_fb.c b/drivers/video/mxc_epdc_fb.c
index 421c90e29ca..d569c0ed4e3 100644
--- a/drivers/video/mxc_epdc_fb.c
+++ b/drivers/video/mxc_epdc_fb.c
@@ -16,6 +16,7 @@
#include <malloc.h>
#include <mxc_epdc_fb.h>
+#include <asm/arch/sys_proto.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -350,6 +351,12 @@ static void draw_splash_screen(void)
void lcd_enable(void)
{
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_EPDC)) {
+ return;
+ }
+#endif
+
if (board_setup_logo_file(lcd_base)) {
debug("Load logo failed!\n");
return;
@@ -367,6 +374,12 @@ void lcd_enable(void)
void lcd_disable(void)
{
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_EPDC)) {
+ return;
+ }
+#endif
+
debug("lcd_disable\n");
/* Disable clocks to EPDC */
@@ -382,6 +395,13 @@ void lcd_ctrl_init(void *lcdbase)
{
unsigned int val;
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_EPDC)) {
+ printf("EPDC@0x%x is fused, disable it\n", EPDC_BASE_ADDR);
+ return;
+ }
+#endif
+
/*
* We rely on lcdbase being a physical address, i.e., either MMU off,
* or 1-to-1 mapping. Might want to add some virt2phys here.
diff --git a/drivers/video/mxc_gis.c b/drivers/video/mxc_gis.c
index 6c20a190182..5ee35ab2a9d 100644
--- a/drivers/video/mxc_gis.c
+++ b/drivers/video/mxc_gis.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. All Rights Reserved.
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -301,6 +301,20 @@ void mxc_enable_gis(void)
u32 csimemsize, pxpmemsize;
char const *gis_input = env_get("gis");
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_CSI)) {
+ printf("CSI@0x%x is fused, disable it\n", CSI1_BASE_ADDR);
+ return;
+ }
+#endif
+
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_PXP)) {
+ printf("PXP@0x%x is fused, disable it\n", PXP_BASE_ADDR);
+ return;
+ }
+#endif
+
gis_regs = (struct mxs_gis_regs *)GIS_BASE_ADDR;
pxp_regs = (struct mxs_pxp_regs *)PXP_BASE_ADDR;
csi_regs = (struct mxs_csi_regs *)CSI1_BASE_ADDR;
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 472e8e9084c..86c835d2e01 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -171,6 +171,10 @@ void lcdif_power_down(void)
struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)(panel.isaBase);
int timeout = 1000000;
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_LCDIF))
+ return;
+#endif
if (!panel.frameAdrs)
return;
@@ -221,6 +225,12 @@ void *video_hw_init(void)
bpp = depth;
}
+#ifdef CONFIG_MX6
+ if (check_module_fused(MX6_MODULE_LCDIF)) {
+ printf("LCDIF@0x%x is fused, disable it\n", MXS_LCDIF_BASE);
+ return NULL;
+ }
+#endif
/* fill in Graphic device struct */
sprintf(panel.modeIdent, "%dx%dx%d",
mode.xres, mode.yres, bpp);