From: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/6] aspeed: ast2500: Add lowlevel_init assembly
Date: Mon, 3 Aug 2020 17:36:06 +0800 [thread overview]
Message-ID: <20200803093610.3222-3-chiawei_wang@aspeedtech.com> (raw)
In-Reply-To: <20200803093610.3222-1-chiawei_wang@aspeedtech.com>
The original lowlevel_init function of AST2500 is written
in C. However, the C runtime environment is not ready until
_main execution.
This patch adds the assembly version of the lowlevel_init
function. Additional initialization to DRAM configuration
and LPC reset source are also added.
Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
---
arch/arm/mach-aspeed/ast2500-board.c | 25 ------------
arch/arm/mach-aspeed/ast2500/Makefile | 1 +
arch/arm/mach-aspeed/ast2500/lowlevel_init.S | 41 ++++++++++++++++++++
3 files changed, 42 insertions(+), 25 deletions(-)
create mode 100644 arch/arm/mach-aspeed/ast2500/lowlevel_init.S
diff --git a/arch/arm/mach-aspeed/ast2500-board.c b/arch/arm/mach-aspeed/ast2500-board.c
index f74dcbbb62..3482ee91ef 100644
--- a/arch/arm/mach-aspeed/ast2500-board.c
+++ b/arch/arm/mach-aspeed/ast2500-board.c
@@ -28,31 +28,6 @@
DECLARE_GLOBAL_DATA_PTR;
-void lowlevel_init(void)
-{
- /*
- * These two watchdogs need to be stopped as soon as possible,
- * otherwise the board might hang. By default they are set to
- * a very short timeout and even simple debug write to serial
- * console early in the init process might cause them to fire.
- */
- struct ast_wdt *flash_addr_wdt =
- (struct ast_wdt *)(WDT_BASE +
- sizeof(struct ast_wdt) *
- AST_FLASH_ADDR_DETECT_WDT);
-
- clrbits_le32(&flash_addr_wdt->ctrl, WDT_CTRL_EN);
-
-#ifndef CONFIG_FIRMWARE_2ND_BOOT
- struct ast_wdt *sec_boot_wdt =
- (struct ast_wdt *)(WDT_BASE +
- sizeof(struct ast_wdt) *
- AST_2ND_BOOT_WDT);
-
- clrbits_le32(&sec_boot_wdt->ctrl, WDT_CTRL_EN);
-#endif
-}
-
int board_init(void)
{
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
diff --git a/arch/arm/mach-aspeed/ast2500/Makefile b/arch/arm/mach-aspeed/ast2500/Makefile
index a35b239ef3..2e9e15d831 100644
--- a/arch/arm/mach-aspeed/ast2500/Makefile
+++ b/arch/arm/mach-aspeed/ast2500/Makefile
@@ -1 +1,2 @@
+obj-y += lowlevel_init.o
obj-y += clk_ast2500.o sdram_ast2500.o
diff --git a/arch/arm/mach-aspeed/ast2500/lowlevel_init.S b/arch/arm/mach-aspeed/ast2500/lowlevel_init.S
new file mode 100644
index 0000000000..9ec3dd46b7
--- /dev/null
+++ b/arch/arm/mach-aspeed/ast2500/lowlevel_init.S
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) ASPEED Technology Inc.
+ */
+#include <asm/arch/scu_ast2500.h>
+
+/* registers for low level init */
+#define SCU_PROT_KEY 0x1e6e2000
+#define SCU_VGA_HANDSHAKE 0x1e6e2040
+#define SCU_HW_STRAP 0x1e6e2070
+#define SCU_HW_STRAP_CLR 0x1e6e207c
+#define WDT3_CTRL 0x1e78504c
+
+.global lowlevel_init
+lowlevel_init:
+
+ /* unlock SCU */
+ ldr r0, =SCU_PROT_KEY
+ ldr r1, =SCU_UNLOCK_VALUE
+ str r1, [r0]
+
+ /* set BMC FW as DRAM initializer */
+ ldr r0, =SCU_VGA_HANDSHAKE
+ ldr r1, [r0]
+ orr r1, #0x80
+ str r1, [r0]
+
+ /* set PERST# as LPC reset source if eSPI mode is enabled*/
+ ldr r0, =SCU_HW_STRAP
+ ldr r1, [r0]
+ tst r1, #(0x1 << 25)
+ ldrne r0, =SCU_HW_STRAP_CLR
+ movne r1, #(0x1 << 14)
+ strne r1, [r0]
+
+ /* disable WDT3 for SPI 3/4 bytes auto-detection */
+ ldr r0, =WDT3_CTRL
+ mov r1, #0x0
+ str r1, [r0]
+
+ mov pc, lr
--
2.17.1
next prev parent reply other threads:[~2020-08-03 9:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 9:36 [PATCH 0/6] Refactor Aspeed SoCs support Chia-Wei, Wang
2020-08-03 9:36 ` [PATCH 1/6] MAINTAINERS: Add maintainers for Aspeed SoCs Chia-Wei, Wang
2020-08-14 19:51 ` Tom Rini
2020-08-03 9:36 ` Chia-Wei, Wang [this message]
2020-08-14 19:51 ` [PATCH 2/6] aspeed: ast2500: Add lowlevel_init assembly Tom Rini
2020-08-03 9:36 ` [PATCH 3/6] cosmetic: aspeed: ast2500: Rename board file Chia-Wei, Wang
2020-08-14 19:52 ` Tom Rini
2020-08-03 9:36 ` [PATCH 4/6] include/configs: aspeed: Remove hardcoded variables Chia-Wei, Wang
2020-08-14 19:52 ` Tom Rini
2020-08-03 9:36 ` [PATCH 5/6] configs: evb-ast2500: Move BOOTCOMMAND from header to defconfig Chia-Wei, Wang
2020-08-14 19:52 ` Tom Rini
2020-08-03 9:36 ` [PATCH 6/6] configs: evb-ast2500: Convert to OF_SEPARATE Chia-Wei, Wang
2020-08-14 19:52 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200803093610.3222-3-chiawei_wang@aspeedtech.com \
--to=chiawei_wang@aspeedtech.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox