mtd: rawnand: denali-spl: Add missing hardware init on SoCFPGA
authorMarek Vasut <marex@denx.de>
Tue, 21 Jan 2020 19:03:09 +0000 (20:03 +0100)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 31 Jan 2020 16:14:32 +0000 (01:14 +0900)
commit33672c970b0854586b3c533f3bf17056e96d7cf6
treea56a36e19a4032b4f4d48f0993266b2e6c51cd6e
parentb00c3c995bf2293e32cd2be3cb4be7eb39c4ac26
mtd: rawnand: denali-spl: Add missing hardware init on SoCFPGA

On Altera SoCFPGA, upon either cold-boot or power-on reset, the
Denali NAND IP is initialized by the BootROM ; upon warm-reset,
the Denali NAND IP is NOT initialized by BootROM. In fact, upon
warm-reset, the SoCFPGA BootROM checks whether the SPL image in
on-chip RAM is valid and if so, completely skips re-loading the
SPL from the boot media.

This does sometimes lead to problems where the software left
the boot media in inconsistent state before warm-reset, and
because the BootROM does not reset the boot media, the boot
media is left in this inconsistent state, often until another
component attempts to access the boot media and fails with an
difficult to debug failure. To mitigate this problem, the SPL
on Altera SoCFPGA always resets all the IPs on the SoC early
on boot.

This results in a couple of register values, pre-programmed by
the BootROM, to be lost during this reset. To restore correct
operation of the IP on SoCFPGA, these values must be programmed
back into the controller by the driver. Note that on other SoCs
which do not use the HW-controlled bootstrap, more registers
may have to be programmed.

This also aligns the SPL behavior with the full Denali NAND
driver, which sets these values in denali_hw_init().

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/mtd/nand/raw/denali_spl.c