ARM: OMAP2+: Fix onenand rate detection to avoid filesystem corruption
authorTony Lindgren <tony@atomide.com>
Tue, 5 Jan 2016 20:04:20 +0000 (12:04 -0800)
committerTony Lindgren <tony@atomide.com>
Wed, 6 Jan 2016 17:21:09 +0000 (09:21 -0800)
commite7b11dc7b77bfce0a351230a5feeadc1d0bba997
tree9b2ea4987f2fa77da67d0edfe3165bf9b351cf7b
parent0b4d6972d7b052b23d33ff9bdbb52958664fbb26
ARM: OMAP2+: Fix onenand rate detection to avoid filesystem corruption

Commit 63aa945b1013 ("memory: omap-gpmc: Add Kconfig option for debug")
unified the GPMC debug for the SoCs with GPMC. The commit also left out
the option for HWMOD_INIT_NO_RESET as we now require proper timings for
GPMC to be able to remap GPMC devices out of address 0.

Unfortunately on Nokia N900, onenand now only partially works with the
device tree provided timings. It works enough to get detected but the
clock rate supported by the onenand chip gets misdetected. This in turn
causes the GPMC timings to be miscalculated and this leads into file
system corruption on N900.

Looks like onenand needs CS_CONFIG1 bit 27 WRITETYPE set for for sync
write. This is needed also for async timings when we write to onenand
with omap2_onenand_set_async_mode(). Without sync write bit set, the
async read for the onenand ONENAND_REG_VERSION_ID will return 0xfff.

Let's exit with an error if onenand rate is not detected. And let's
remove the extra call to omap2_onenand_set_async_mode() as we only need
to do this once at the end of omap2_onenand_setup_async().

Fixes: 63aa945b1013 ("memory: omap-gpmc: Add Kconfig option for debug")
Cc: stable@vger.kernel.org # v4.2+
Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/gpmc-onenand.c