From patchwork Thu Jan 9 10:07:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 239303 List-Id: U-Boot discussion From: marex at denx.de (Marek Vasut) Date: Thu, 9 Jan 2020 11:07:54 +0100 Subject: [PATCH 3/3] mtd: rawnand: denali: Do not reset the block on SoCFPGA In-Reply-To: <20200109100754.1007705-1-marex@denx.de> References: <20200109100754.1007705-1-marex@denx.de> Message-ID: <20200109100754.1007705-3-marex@denx.de> Legacy kernel versions for SoCFPGA may not implement proper reset handling. Apply the same approach as SoCFPGA reset driver, check environment variable "socfpga_legacy_reset_compat", and if it is set, do not reset the IP before booting Linux. This way, even the older kernel versions can be booted by up to date U-Boot. Signed-off-by: Marek Vasut Cc: Masahiro Yamada --- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 2c9e249ab6..d35f2a3543 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -148,6 +148,18 @@ static int denali_dt_remove(struct udevice *dev) { struct denali_nand_info *denali = dev_get_priv(dev); +#if CONFIG_IS_ENABLED(ARCH_SOCFPGA) + /* + * Legacy kernel versions do not implement proper reset handling on + * SoCFPGA. To let those older kernel versions work, reuse the same + * approach as the SoCFPGA reset driver does -- check environment + * variable socfpga_legacy_reset_compat and avoid resetting the IP + * before booting the kernel if it is set to 1. + */ + if (env_get_ulong("socfpga_legacy_reset_compat", 10, 0)) + return 0; +#endif + return reset_release_bulk(&denali->resets); }