Commit 6e8c9ae136bee8ec0121c1db4b935510caad09db
1 parent
e93235cbcf
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
5 other branches
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)
Showing 12 changed files with 154 additions and 9 deletions Side-by-side Diff
arch/arm/mach-imx/mx6/bee.c
... | ... | @@ -267,7 +267,7 @@ |
267 | 267 | static int do_bee_init(cmd_tbl_t *cmdtp, int flag, int argc, |
268 | 268 | char * const argv[]) |
269 | 269 | { |
270 | - u32 start, size, val; | |
270 | + u32 start, size; | |
271 | 271 | int ret; |
272 | 272 | struct bee_parameters *p = ¶ |
273 | 273 | |
274 | 274 | |
... | ... | @@ -280,14 +280,12 @@ |
280 | 280 | if (argc > 5) |
281 | 281 | return CMD_RET_USAGE; |
282 | 282 | |
283 | - if (fuse_read(0, 4, &val)) { | |
284 | - puts("Can not get fuse bank 0, word 4\n"); | |
285 | - } else { | |
286 | - if (val & (1 << 25)) { | |
287 | - puts("BEE disabed in fuse!\n"); | |
288 | - return CMD_RET_FAILURE; | |
289 | - } | |
283 | +#ifdef CONFIG_MX6 | |
284 | + if (check_module_fused(MX6_MODULE_BEE)) { | |
285 | + printf("BEE is fused, disable it!\n"); | |
286 | + return CMD_RET_FAILURE; | |
290 | 287 | } |
288 | +#endif | |
291 | 289 | |
292 | 290 | /* Cache enabled? */ |
293 | 291 | if ((get_cr() & (CR_I | CR_C)) != (CR_I | CR_C)) { |
drivers/dma/apbh_dma.c
... | ... | @@ -574,6 +574,14 @@ |
574 | 574 | struct mxs_apbh_regs *apbh_regs = |
575 | 575 | (struct mxs_apbh_regs *)MXS_APBH_BASE; |
576 | 576 | |
577 | +#ifdef CONFIG_MX6 | |
578 | + if (check_module_fused(MX6_MODULE_APBHDMA)) { | |
579 | + printf("NAND APBH-DMA@0x%x is fused, disable it\n", | |
580 | + MXS_APBH_BASE); | |
581 | + return; | |
582 | + } | |
583 | +#endif | |
584 | + | |
577 | 585 | mxs_reset_block(&apbh_regs->hw_apbh_ctrl0_reg); |
578 | 586 | |
579 | 587 | #ifdef CONFIG_APBH_DMA_BURST8 |
drivers/i2c/mxc_i2c.c
... | ... | @@ -4,6 +4,8 @@ |
4 | 4 | * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> |
5 | 5 | * (c) 2011 Marek Vasut <marek.vasut@gmail.com> |
6 | 6 | * |
7 | + * Copyright (C) 2016 Freescale Semiconductor, Inc. | |
8 | + * | |
7 | 9 | * Based on i2c-imx.c from linux kernel: |
8 | 10 | * Copyright (C) 2005 Torsten Koschorrek <koschorrek at synertronixx.de> |
9 | 11 | * Copyright (C) 2005 Matthias Blaschke <blaschke at synertronixx.de> |
... | ... | @@ -25,6 +27,7 @@ |
25 | 27 | #include <dm.h> |
26 | 28 | #include <dm/pinctrl.h> |
27 | 29 | #include <fdtdec.h> |
30 | +#include <asm/arch/sys_proto.h> | |
28 | 31 | |
29 | 32 | DECLARE_GLOBAL_DATA_PTR; |
30 | 33 | |
... | ... | @@ -648,6 +651,14 @@ |
648 | 651 | return; |
649 | 652 | } |
650 | 653 | |
654 | +#ifdef CONFIG_MX6 | |
655 | + if (mx6_i2c_fused((u32)mxc_i2c_buses[index].base)) { | |
656 | + printf("I2C@0x%x is fused, disable it\n", | |
657 | + (u32)mxc_i2c_buses[index].base); | |
658 | + return; | |
659 | + } | |
660 | +#endif | |
661 | + | |
651 | 662 | /* |
652 | 663 | * Warning: Be careful to allow the assignment to a static |
653 | 664 | * variable here. This function could be called while U-Boot is |
... | ... | @@ -760,6 +771,13 @@ |
760 | 771 | addr = devfdt_get_addr(bus); |
761 | 772 | if (addr == FDT_ADDR_T_NONE) |
762 | 773 | return -EINVAL; |
774 | + | |
775 | +#ifdef CONFIG_MX6 | |
776 | + if (mx6_i2c_fused(addr)) { | |
777 | + printf("I2C@0x%lx is fused, disable it\n", addr); | |
778 | + return -ENODEV; | |
779 | + } | |
780 | +#endif | |
763 | 781 | |
764 | 782 | i2c_bus->base = addr; |
765 | 783 | i2c_bus->index = bus->seq; |
drivers/mmc/fsl_esdhc.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #include <dm.h> |
25 | 25 | #include <asm-generic/gpio.h> |
26 | 26 | #include <dm/pinctrl.h> |
27 | +#include <asm/arch/sys_proto.h> | |
27 | 28 | |
28 | 29 | DECLARE_GLOBAL_DATA_PTR; |
29 | 30 | |
... | ... | @@ -1285,6 +1286,14 @@ |
1285 | 1286 | return ret; |
1286 | 1287 | } |
1287 | 1288 | |
1289 | +#ifdef CONFIG_MX6 | |
1290 | + if (mx6_esdhc_fused(cfg->esdhc_base)) { | |
1291 | + printf("ESDHC@0x%lx is fused, disable it\n", cfg->esdhc_base); | |
1292 | + free(priv); | |
1293 | + return -ENODEV; | |
1294 | + } | |
1295 | +#endif | |
1296 | + | |
1288 | 1297 | ret = fsl_esdhc_init(priv, plat); |
1289 | 1298 | if (ret) { |
1290 | 1299 | debug("%s init failure\n", __func__); |
... | ... | @@ -1412,6 +1421,13 @@ |
1412 | 1421 | addr = dev_read_addr(dev); |
1413 | 1422 | if (addr == FDT_ADDR_T_NONE) |
1414 | 1423 | return -EINVAL; |
1424 | + | |
1425 | +#ifdef CONFIG_MX6 | |
1426 | + if (mx6_esdhc_fused(addr)) { | |
1427 | + printf("ESDHC@0x%lx is fused, disable it\n", addr); | |
1428 | + return -ENODEV; | |
1429 | + } | |
1430 | +#endif | |
1415 | 1431 | |
1416 | 1432 | priv->esdhc_regs = (struct fsl_esdhc *)addr; |
1417 | 1433 | priv->dev = dev; |
drivers/mtd/nand/mxs_nand.c
... | ... | @@ -1244,6 +1244,13 @@ |
1244 | 1244 | (struct mxs_bch_regs *)MXS_BCH_BASE; |
1245 | 1245 | int i = 0, j, ret = 0; |
1246 | 1246 | |
1247 | +#ifdef CONFIG_MX6 | |
1248 | + if (check_module_fused(MX6_MODULE_GPMI)) { | |
1249 | + printf("NAND GPMI@0x%x is fused, disable it\n", MXS_GPMI_BASE); | |
1250 | + return -EPERM; | |
1251 | + } | |
1252 | +#endif | |
1253 | + | |
1247 | 1254 | info->desc = malloc(sizeof(struct mxs_dma_desc *) * |
1248 | 1255 | MXS_NAND_DMA_DESCRIPTOR_COUNT); |
1249 | 1256 | if (!info->desc) { |
drivers/net/fec_mxc.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #include <asm/arch/clock.h> |
25 | 25 | #include <asm/arch/imx-regs.h> |
26 | 26 | #include <asm/mach-imx/sys_proto.h> |
27 | +#include <asm/arch/sys_proto.h> | |
27 | 28 | |
28 | 29 | DECLARE_GLOBAL_DATA_PTR; |
29 | 30 | |
... | ... | @@ -1145,6 +1146,13 @@ |
1145 | 1146 | #endif |
1146 | 1147 | int ret; |
1147 | 1148 | |
1149 | +#ifdef CONFIG_MX6 | |
1150 | + if (mx6_enet_fused(addr)) { | |
1151 | + printf("Ethernet@0x%x is fused, disable it\n", addr); | |
1152 | + return -2; | |
1153 | + } | |
1154 | +#endif | |
1155 | + | |
1148 | 1156 | #ifdef CONFIG_FEC_MXC_MDIO_BASE |
1149 | 1157 | /* |
1150 | 1158 | * The i.MX28 has two ethernet interfaces, but they are not equal. |
... | ... | @@ -1253,6 +1261,12 @@ |
1253 | 1261 | uint32_t start; |
1254 | 1262 | int ret; |
1255 | 1263 | |
1264 | +#ifdef CONFIG_MX6 | |
1265 | + if (mx6_enet_fused((uint32_t)priv->eth)) { | |
1266 | + printf("Ethernet@0x%x is fused, disable it\n", (uint32_t)priv->eth); | |
1267 | + return -ENODEV; | |
1268 | + } | |
1269 | +#endif | |
1256 | 1270 | ret = fec_alloc_descs(priv); |
1257 | 1271 | if (ret) |
1258 | 1272 | return ret; |
drivers/spi/fsl_qspi.c
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <watchdog.h> |
17 | 17 | #include <wait_bit.h> |
18 | 18 | #include "fsl_qspi.h" |
19 | +#include <asm/arch/sys_proto.h> | |
19 | 20 | |
20 | 21 | DECLARE_GLOBAL_DATA_PTR; |
21 | 22 | |
... | ... | @@ -944,6 +945,13 @@ |
944 | 945 | if (bus >= ARRAY_SIZE(spi_bases)) |
945 | 946 | return NULL; |
946 | 947 | |
948 | +#ifdef CONFIG_MX6 | |
949 | + if (mx6_qspi_fused(spi_bases[bus])) { | |
950 | + printf("QSPI@0x%lx is fused, disable it\n", spi_bases[bus]); | |
951 | + return NULL; | |
952 | + } | |
953 | +#endif | |
954 | + | |
947 | 955 | if (cs >= FSL_QSPI_FLASH_NUM) |
948 | 956 | return NULL; |
949 | 957 | |
... | ... | @@ -1073,6 +1081,13 @@ |
1073 | 1081 | struct fsl_qspi_priv *priv = dev_get_priv(bus); |
1074 | 1082 | struct dm_spi_bus *dm_spi_bus; |
1075 | 1083 | int i, ret; |
1084 | + | |
1085 | +#ifdef CONFIG_MX6 | |
1086 | + if (mx6_qspi_fused(plat->reg_base)) { | |
1087 | + printf("QSPI@0x%lx is fused, disable it\n", plat->reg_base); | |
1088 | + return -ENODEV; | |
1089 | + } | |
1090 | +#endif | |
1076 | 1091 | |
1077 | 1092 | dm_spi_bus = bus->uclass_priv; |
1078 | 1093 |
drivers/spi/mxc_spi.c
1 | 1 | /* |
2 | 2 | * Copyright (C) 2008, Guennadi Liakhovetski <lg@denx.de> |
3 | 3 | * |
4 | + * Copyright (C) 2016 Freescale Semiconductor, Inc. | |
5 | + * | |
4 | 6 | * SPDX-License-Identifier: GPL-2.0+ |
5 | 7 | */ |
6 | 8 | |
... | ... | @@ -14,6 +16,7 @@ |
14 | 16 | #include <asm/arch/imx-regs.h> |
15 | 17 | #include <asm/arch/clock.h> |
16 | 18 | #include <asm/mach-imx/spi.h> |
19 | +#include <asm/arch/sys_proto.h> | |
17 | 20 | |
18 | 21 | DECLARE_GLOBAL_DATA_PTR; |
19 | 22 | |
... | ... | @@ -449,6 +452,13 @@ |
449 | 452 | printf("Error: desired clock is 0\n"); |
450 | 453 | return NULL; |
451 | 454 | } |
455 | + | |
456 | +#ifdef CONFIG_MX6 | |
457 | + if (mx6_ecspi_fused(spi_bases[bus])) { | |
458 | + printf("ECSPI@0x%lx is fused, disable it\n", spi_bases[bus]); | |
459 | + return NULL; | |
460 | + } | |
461 | +#endif | |
452 | 462 | |
453 | 463 | mxcs = spi_alloc_slave(struct mxc_spi_slave, bus, cs); |
454 | 464 | if (!mxcs) { |
drivers/usb/host/ehci-mx6.c
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | #include <dm.h> |
20 | 20 | #include <asm/mach-types.h> |
21 | 21 | #include <power/regulator.h> |
22 | +#include <asm/arch/sys_proto.h> | |
22 | 23 | |
23 | 24 | #include "ehci.h" |
24 | 25 | |
... | ... | @@ -403,6 +404,13 @@ |
403 | 404 | if (index > 3) |
404 | 405 | return -EINVAL; |
405 | 406 | |
407 | +#if defined(CONFIG_MX6) | |
408 | + if (mx6_usb_fused((u32)ehci)) { | |
409 | + printf("USB@0x%x is fused, disable it\n", (u32)ehci); | |
410 | + return -ENODEV; | |
411 | + } | |
412 | +#endif | |
413 | + | |
406 | 414 | ret = ehci_mx6_common_init(ehci, index); |
407 | 415 | if (ret) |
408 | 416 | return ret; |
... | ... | @@ -590,6 +598,13 @@ |
590 | 598 | struct ehci_hccr *hccr; |
591 | 599 | struct ehci_hcor *hcor; |
592 | 600 | int ret; |
601 | + | |
602 | +#if defined(CONFIG_MX6) | |
603 | + if (mx6_usb_fused((u32)ehci)) { | |
604 | + printf("USB@0x%x is fused, disable it\n", (u32)ehci); | |
605 | + return -ENODEV; | |
606 | + } | |
607 | +#endif | |
593 | 608 | |
594 | 609 | priv->ehci = ehci; |
595 | 610 | priv->portnr = dev->seq; |
drivers/video/mxc_epdc_fb.c
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <malloc.h> |
17 | 17 | |
18 | 18 | #include <mxc_epdc_fb.h> |
19 | +#include <asm/arch/sys_proto.h> | |
19 | 20 | |
20 | 21 | DECLARE_GLOBAL_DATA_PTR; |
21 | 22 | |
... | ... | @@ -350,6 +351,12 @@ |
350 | 351 | |
351 | 352 | void lcd_enable(void) |
352 | 353 | { |
354 | +#ifdef CONFIG_MX6 | |
355 | + if (check_module_fused(MX6_MODULE_EPDC)) { | |
356 | + return; | |
357 | + } | |
358 | +#endif | |
359 | + | |
353 | 360 | if (board_setup_logo_file(lcd_base)) { |
354 | 361 | debug("Load logo failed!\n"); |
355 | 362 | return; |
... | ... | @@ -367,6 +374,12 @@ |
367 | 374 | |
368 | 375 | void lcd_disable(void) |
369 | 376 | { |
377 | +#ifdef CONFIG_MX6 | |
378 | + if (check_module_fused(MX6_MODULE_EPDC)) { | |
379 | + return; | |
380 | + } | |
381 | +#endif | |
382 | + | |
370 | 383 | debug("lcd_disable\n"); |
371 | 384 | |
372 | 385 | /* Disable clocks to EPDC */ |
... | ... | @@ -381,6 +394,13 @@ |
381 | 394 | void lcd_ctrl_init(void *lcdbase) |
382 | 395 | { |
383 | 396 | unsigned int val; |
397 | + | |
398 | +#ifdef CONFIG_MX6 | |
399 | + if (check_module_fused(MX6_MODULE_EPDC)) { | |
400 | + printf("EPDC@0x%x is fused, disable it\n", EPDC_BASE_ADDR); | |
401 | + return; | |
402 | + } | |
403 | +#endif | |
384 | 404 | |
385 | 405 | /* |
386 | 406 | * We rely on lcdbase being a physical address, i.e., either MMU off, |
drivers/video/mxc_gis.c
1 | 1 | /* |
2 | - * Copyright (C) 2014 Freescale Semiconductor, Inc. All Rights Reserved. | |
2 | + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. All Rights Reserved. | |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: GPL-2.0+ |
5 | 5 | */ |
... | ... | @@ -300,6 +300,20 @@ |
300 | 300 | struct display_panel panel; |
301 | 301 | u32 csimemsize, pxpmemsize; |
302 | 302 | char const *gis_input = env_get("gis"); |
303 | + | |
304 | +#ifdef CONFIG_MX6 | |
305 | + if (check_module_fused(MX6_MODULE_CSI)) { | |
306 | + printf("CSI@0x%x is fused, disable it\n", CSI1_BASE_ADDR); | |
307 | + return; | |
308 | + } | |
309 | +#endif | |
310 | + | |
311 | +#ifdef CONFIG_MX6 | |
312 | + if (check_module_fused(MX6_MODULE_PXP)) { | |
313 | + printf("PXP@0x%x is fused, disable it\n", PXP_BASE_ADDR); | |
314 | + return; | |
315 | + } | |
316 | +#endif | |
303 | 317 | |
304 | 318 | gis_regs = (struct mxs_gis_regs *)GIS_BASE_ADDR; |
305 | 319 | pxp_regs = (struct mxs_pxp_regs *)PXP_BASE_ADDR; |
drivers/video/mxsfb.c
... | ... | @@ -171,6 +171,10 @@ |
171 | 171 | struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)(panel.isaBase); |
172 | 172 | int timeout = 1000000; |
173 | 173 | |
174 | +#ifdef CONFIG_MX6 | |
175 | + if (check_module_fused(MX6_MODULE_LCDIF)) | |
176 | + return; | |
177 | +#endif | |
174 | 178 | if (!panel.frameAdrs) |
175 | 179 | return; |
176 | 180 | |
... | ... | @@ -221,6 +225,12 @@ |
221 | 225 | bpp = depth; |
222 | 226 | } |
223 | 227 | |
228 | +#ifdef CONFIG_MX6 | |
229 | + if (check_module_fused(MX6_MODULE_LCDIF)) { | |
230 | + printf("LCDIF@0x%x is fused, disable it\n", MXS_LCDIF_BASE); | |
231 | + return NULL; | |
232 | + } | |
233 | +#endif | |
224 | 234 | /* fill in Graphic device struct */ |
225 | 235 | sprintf(panel.modeIdent, "%dx%dx%d", |
226 | 236 | mode.xres, mode.yres, bpp); |
-
mentioned in commit 99b54a
-
mentioned in commit 99b54a
-
mentioned in commit 078634
-
mentioned in commit 078634
-
mentioned in commit 078634
-
mentioned in commit 078634
-
mentioned in commit 0633c4
-
mentioned in commit 0633c4
-
mentioned in commit 078634
-
mentioned in commit 0633c4
-
mentioned in commit 0633c4
-
mentioned in commit 0633c4
-
mentioned in commit 0633c4
-
mentioned in commit a6b82d