summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/raw/zynq_nand.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-04-07 11:58:44 -0400
committerTom Rini <trini@konsulko.com>2020-04-07 17:13:35 -0400
commit1f47e2aca42c2e51ff3a7754c717ee13f568c721 (patch)
treeeca6cb5e551dbb75c2328b1dba3e7a2b8a77d327 /drivers/mtd/nand/raw/zynq_nand.c
parent2b18b89156335bf1f0d84f81d3597762bc48c61d (diff)
parent895a7866c20cf6c01779b5a60fbf2770b88930a4 (diff)
Merge tag 'xilinx-for-v2020.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next
Xilinx changes for v2020.07 common: - Align ENV_FAT_INTERFACE - Fix MAC address source print log - Improve based autodetection code xilinx: - Enable netconsole Microblaze: - Setup default ENV_OFFSET/ENV_SECT_SIZE Zynq: - Multiple DT updates/fixes - Use DEVICE_TREE environment variable for DTB selection - Switch to single zynq configuration - Enable NOR flash via DM - Minor SPL print removal - Enable i2c mux driver ZynqMP: - Print multiboot register - Enable cache commands in mini mtest - Multiple DT updates/fixes - Fix firmware probing when driver is not enabled - Specify 3rd backup RAM boot mode in SPL - Add SPL support for zcu102 v1.1 and zcu111 revA - Redesign debug uart enabling and psu_init delay - Enable full u-boot run from EL3 - Enable u-boot.itb generation without ATF with U-Boot in EL3 Versal: - Enable distro default - Enable others SPI flashes - Enable systems without DDR Drivers: - Gem: - Flush memory after freeing - Handle mdio bus separately - Watchdog: - Get rid of unused global data pointer - Enable window watchdog timer - Serial: - Change reinitialization logic in zynq serial driver Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/mtd/nand/raw/zynq_nand.c')
-rw-r--r--drivers/mtd/nand/raw/zynq_nand.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 28db4153f5..0aea83dac0 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -1081,18 +1081,23 @@ static int zynq_nand_probe(struct udevice *dev)
u8 set_feature[4] = {ONDIE_ECC_FEATURE_ENABLE, 0x00, 0x00, 0x00};
unsigned long ecc_cfg;
int ondie_ecc_enabled = 0;
- int err = -1;
int is_16bit_bw;
smc->reg = (struct zynq_nand_smc_regs *)dev_read_addr(dev);
of_nand = dev_read_subnode(dev, "flash@e1000000");
if (!ofnode_valid(of_nand)) {
printf("Failed to find nand node in dt\n");
- goto fail;
+ return -ENODEV;
}
+
+ if (!ofnode_is_available(of_nand)) {
+ debug("Nand node in dt disabled\n");
+ return dm_scan_fdt_dev(dev);
+ }
+
if (ofnode_read_resource(of_nand, 0, &res)) {
printf("Failed to get nand resource\n");
- goto fail;
+ return -ENODEV;
}
xnand->nand_base = (void __iomem *)res.start;
@@ -1119,7 +1124,7 @@ static int zynq_nand_probe(struct udevice *dev)
if (is_16bit_bw == NAND_BW_UNKNOWN) {
printf("%s: Unable detect NAND based on MIO settings\n",
__func__);
- goto fail;
+ return -EINVAL;
}
if (is_16bit_bw == NAND_BW_16BIT)
@@ -1130,13 +1135,13 @@ static int zynq_nand_probe(struct udevice *dev)
/* Initialize the NAND flash interface on NAND controller */
if (zynq_nand_init_nand_flash(mtd, nand_chip->options) < 0) {
printf("%s: nand flash init failed\n", __func__);
- goto fail;
+ return -EINVAL;
}
/* first scan to find the device and get the page size */
if (nand_scan_ident(mtd, 1, NULL)) {
printf("%s: nand_scan_ident failed\n", __func__);
- goto fail;
+ return -EINVAL;
}
/* Send the command for reading device ID */
nand_chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
@@ -1261,14 +1266,12 @@ static int zynq_nand_probe(struct udevice *dev)
/* Second phase scan */
if (nand_scan_tail(mtd)) {
printf("%s: nand_scan_tail failed\n", __func__);
- goto fail;
+ return -EINVAL;
}
if (nand_register(0, mtd))
- goto fail;
+ return -EINVAL;
+
return 0;
-fail:
- free(xnand);
- return err;
}
static const struct udevice_id zynq_nand_dt_ids[] = {