arm: mvebu: Fix moving internal registers
authorPali Rohár <pali@kernel.org>
Thu, 8 Sep 2022 14:06:54 +0000 (16:06 +0200)
committerStefan Roese <sr@denx.de>
Tue, 13 Sep 2022 07:04:22 +0000 (09:04 +0200)
commit5818198e6a184963c6afc82178b23a64435ace6a
tree76f6bbb101ade2f91c63fd70d9a87e5a60945308
parent4f2333ba886aa8df655016091cafc695c750775a
arm: mvebu: Fix moving internal registers

Commit 5bb2c550b11e ("arm: mvebu: Move internal registers in
arch_very_early_init() function") moved code from file cpu.c to lowlevel.c,
which moves Marvell internal registers from address INTREG_BASE_ADDR_REG to
SOC_REGS_PHY_BASE.

But the steps describing how to do it correctly were documented only in
older U-Boot versions and commit cefd764222ee ("arm: mvebu: Fix internal
register config on A38x") probably unintentionally removed important
details about MMU from code comments around.

Commit 5bb2c550b11e ("arm: mvebu: Move internal registers in
arch_very_early_init() function") implemented code movement according to
(now incomplete) comments which resulted in semi-broken code.

The result is that I-cache is currently disabled for all Armada 38x boards
and maybe there are some other (unreported / undetected) issues.

Reimplement it correctly. First flush all caches, then disable MMU and L2
cache and then move Marvell internal registers. There is no need to
explicitly disable I-cache.

After this change lzmadec command with lzma image of 0x7000000 bytes is
doing decompression just 5 seconds. Before this change it was 30 seconds.

To make lowlevel.S code more readable, extend asm/pl310.h header file to be
compatible with assembler and use macros from this file.

Fixes: 5bb2c550b11e ("arm: mvebu: Move internal registers in arch_very_early_init() function")
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/include/asm/pl310.h
arch/arm/mach-mvebu/cpu.c
arch/arm/mach-mvebu/lowlevel.S