All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 3/6] x86: quark: Add Cache-As-RAM initialization
Date: Wed, 28 Jan 2015 23:19:59 +0800	[thread overview]
Message-ID: <1422458402-9187-4-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1422458402-9187-1-git-send-email-bmeng.cn@gmail.com>

Quark SoC contains an embedded 512KiB SRAM (eSRAM) that is
initialized by hardware. eSRAM is the ideal place to be used
for Cache-As-RAM (CAR) before system memory is available.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/cpu/quark/car.S | 105 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 arch/x86/cpu/quark/car.S

diff --git a/arch/x86/cpu/quark/car.S b/arch/x86/cpu/quark/car.S
new file mode 100644
index 0000000..6b7b249
--- /dev/null
+++ b/arch/x86/cpu/quark/car.S
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <config.h>
+#include <asm/post.h>
+#include <asm/arch/quark.h>
+
+.globl car_init
+car_init:
+	post_code(POST_CAR_START)
+
+	/*
+	 * Quark SoC contains an embedded 512KiB SRAM (eSRAM) that is
+	 * initialized by hardware. eSRAM is the ideal place to be used
+	 * for Cache-As-RAM (CAR) before system memory is available.
+	 *
+	 * Relocate this eSRAM to a suitable location in the physical
+	 * memory map and enable it.
+	 */
+
+	/* Host Memory Bound Register P03h:R08h */
+	mov	$0x00030800, %eax
+	mov	$(DRAM_BASE + DRAM_MAX_SIZE + ESRAM_SIZE), %edx
+	lea	1f, %esp
+	jmp	msg_port_write
+1:
+
+	/* eSRAM Block Page Control Register P05h:R82h = 10000080h */
+	mov	$0x00058200, %eax
+	mov	$0x10000080, %edx
+	lea	2f, %esp
+	jmp	msg_port_write
+2:
+
+	post_code(POST_CAR_CPU_CACHE)
+	jmp	car_init_ret
+
+msg_port_read:
+	/*
+	 * Parameter:
+	 *   EAX[23:16] - Message Port ID
+	 *   EAX[15:08] - Register Address
+	 *
+	 * Return Value:
+	 *   EAX - Message Port Register value
+	 *
+	 * Return Address: ESP
+	 */
+
+	/* opcode 0x10, all bytes enable 0xf0 */
+	or	$0x100000f0, %eax
+	mov	%eax, %ebx
+
+	/* Write MCR B0:D0:F0:RD0 */
+	mov	$0x800000d0, %eax
+	mov	$0xcf8, %dx
+	out	%eax, %dx
+	mov	$0xcfc, %dx
+	mov	%ebx, %eax
+	out	%eax, %dx
+
+	/* Read MDR B0:D0:F0:RD4 */
+	mov	$0x800000d4, %eax
+	mov	$0xcf8, %dx
+	out	%eax, %dx
+	mov	$0xcfc, %dx
+	in	%dx, %eax
+
+	jmp	*%esp
+
+msg_port_write:
+	/*
+	 * Parameter:
+	 *   EAX[23:16] - Message Port ID
+	 *   EAX[15:08] - Register Address
+	 *   EDX        - Message Port Register value to write
+	 *
+	 * Return Address: ESP
+	 */
+
+	/* opcode 0x11, all bytes enable 0xf0 */
+	or	$0x110000f0, %eax
+	mov	%eax, %esi
+	mov	%edx, %edi
+
+	/* Write MDR B0:D0:F0:RD4 */
+	mov	$0x800000d4, %eax
+	mov	$0xcf8, %dx
+	out	%eax, %dx
+	mov	$0xcfc, %dx
+	mov	%edi, %eax
+	out	%eax, %dx
+
+	/* Write MCR B0:D0:F0:RD0 */
+	mov	$0x800000d0, %eax
+	mov	$0xcf8, %dx
+	out	%eax, %dx
+	mov	$0xcfc, %dx
+	mov	%esi, %eax
+	out	%eax, %dx
+
+	jmp	*%esp
-- 
1.8.2.1

  parent reply	other threads:[~2015-01-28 15:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28 15:19 [U-Boot] [RFC PATCH 0/6] x86: New Intel Quark SoC support Bin Meng
2015-01-28 15:19 ` [U-Boot] [RFC PATCH 1/6] x86: Add header files for Intel Quark SoC defines Bin Meng
2015-01-28 18:04   ` Simon Glass
2015-01-29  1:58     ` Bin Meng
2015-01-29  2:00       ` Simon Glass
2015-01-28 15:19 ` [U-Boot] [RFC PATCH 2/6] x86: quark: Add routines to access message bus registers Bin Meng
2015-01-28 18:04   ` Simon Glass
2015-01-29  2:10     ` Bin Meng
2015-01-28 15:19 ` Bin Meng [this message]
2015-01-28 18:04   ` [U-Boot] [RFC PATCH 3/6] x86: quark: Add Cache-As-RAM initialization Simon Glass
2015-01-29  2:12     ` Bin Meng
2015-01-28 15:20 ` [U-Boot] [RFC PATCH 4/6] x86: Add basic Intel Quark processor support Bin Meng
2015-01-28 18:05   ` Simon Glass
2015-01-29  2:17     ` Bin Meng
2015-01-29  2:25       ` Simon Glass
2015-01-28 15:20 ` [U-Boot] [RFC PATCH 5/6] x86: Add basic Intel Galileo board support Bin Meng
2015-01-28 18:05   ` Simon Glass
2015-01-28 15:20 ` [U-Boot] [RFC PATCH 6/6] x86: Enable the Intel quark/galileo build Bin Meng
2015-01-28 18:05   ` Simon Glass
2015-01-28 18:05 ` [U-Boot] [RFC PATCH 0/6] x86: New Intel Quark SoC support Simon Glass
2015-01-29  2:27   ` Bin Meng
2015-01-29  2:30     ` Simon Glass

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=1422458402-9187-4-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.