mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-22 11:13:07 +00:00
534b82a1f2
Currently we do some magic "SRAM setup" MMIO writes in s_init(), copied from the original BSP U-Boot. The comment speaks of this being required before DRAM access gets enabled, but there is no indication that this would actually be required that early. Move this out of s_init(), into board_init_f(). Since this actually only affects a very few older SoCs, the actual code goes into the cpu/armv7 directory, to move it out of the way for all other SoCs. This also uses the opportunity to convert some #ifdefs over to the fancy IS_ENABLED() macros used in actual C code. We keep the s_init() stub around for now, since armv8's lowlevel_init still relies on it. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
|
|
*
|
|
* (C) Copyright 2007-2011
|
|
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
|
|
* Tom Cubie <tangliang@allwinnertech.com>
|
|
*
|
|
* SRAM init for older sunxi SoCs.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <init.h>
|
|
#include <asm/io.h>
|
|
|
|
void sunxi_sram_init(void)
|
|
{
|
|
/*
|
|
* Undocumented magic taken from boot0, without this DRAM
|
|
* access gets messed up (seems cache related).
|
|
* The boot0 sources describe this as: "config ema for cache sram"
|
|
* Newer SoCs (A83T, H3 and anything beyond) don't need this anymore.
|
|
*/
|
|
if (IS_ENABLED(CONFIG_MACH_SUN6I))
|
|
setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
|
|
|
|
if (IS_ENABLED(CONFIG_MACH_SUN8I)) {
|
|
uint version = sunxi_get_sram_id();
|
|
|
|
if (IS_ENABLED(CONFIG_MACH_SUN8I_A23)) {
|
|
if (version == 0x1650)
|
|
setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
|
|
else /* 0x1661 ? */
|
|
setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0xc0);
|
|
} else if (IS_ENABLED(CONFIG_MACH_SUN8I_A33)) {
|
|
if (version != 0x1667)
|
|
setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0xc0);
|
|
}
|
|
}
|
|
}
|