All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] ARM: vf610: add auxiliary core boot support
Date: Wed, 29 Mar 2017 12:58:27 -0700	[thread overview]
Message-ID: <20170329195827.6217-4-stefan@agner.ch> (raw)
In-Reply-To: <20170329195827.6217-1-stefan@agner.ch>

From: Stefan Agner <stefan.agner@toradex.com>

Use i.MX bootaux support introduced for i.MX 6SoloX/i.MX 7 for
Vybrid too. Starting the Cortex-M4 core on Vybrid works a bit
differently, naemly it uses a GPR register to define the initial
PC. There is no way to define the initial stack (the stack is
set up in a boot ROM). This is not a problem for most firmwares
since the firmwares startup code reinitialize the stack as part
of the firmware startup code anyway.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
---

 arch/arm/cpu/armv7/vf610/generic.c          | 42 +++++++++++++++++++++++++++++
 arch/arm/imx-common/Kconfig                 |  2 +-
 arch/arm/imx-common/Makefile                |  4 ++-
 arch/arm/include/asm/arch-vf610/sys_proto.h |  8 ++++++
 configs/colibri_vf_defconfig                |  1 +
 5 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-vf610/sys_proto.h

diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 0328096afd..59c5b1adca 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -376,3 +376,45 @@ void enable_caches(void)
 	mmu_set_region_dcache_behaviour(IRAM_BASE_ADDR, IRAM_SIZE, option);
 }
 #endif
+
+#ifdef CONFIG_IMX_BOOTAUX
+#define CCM_CCOWR_START 0x00015a5a
+
+const struct memorymap hostmap[] = {
+	{ .auxcore = 0x00000000, .host = 0x00000000, .size = 0x18000 },
+	{ .auxcore = 0x1f000000, .host = 0x3f000000, .size = 0x80000 },
+	{ .auxcore = 0x1f800000, .host = 0x1f800000, .size = 0x8000 },
+	{ .auxcore = 0x3f000000, .host = 0x3f000000, .size = 0x80000 },
+	{ .auxcore = 0x3f800000, .host = 0x3f800000, .size = 0x8000 },
+	{ .auxcore = 0x00800000, .host = 0x80800000, .size = 0x0f800000 },
+	{ .auxcore = 0x80000000, .host = 0x80000000, .size = 0xe0000000 },
+	{ /* sentinel */ }
+};
+
+/* The Cortex-M4 starts from the address present in SRC_GPR2 */
+int arch_auxiliary_core_up(u32 core_id, u32 stack, u32 pc)
+{
+	struct src *src = (struct src *)SRC_BASE_ADDR;
+	struct ccm_reg *ccm = (struct ccm_reg *)CCM_BASE_ADDR;
+
+	/* Set the PC for the Cortex-M4 */
+	writel(pc, &src->gpr2);
+
+	/* Enable M4 */
+	writel(CCM_CCOWR_START, &ccm->ccowr);
+
+	return 0;
+}
+
+int arch_auxiliary_core_check_up(u32 core_id)
+{
+	uint32_t val;
+	struct ccm_reg *ccm = (struct ccm_reg *)CCM_BASE_ADDR;
+
+	val = readl(&ccm->ccowr);
+	if (val & 0x00010000)
+		return 1;
+
+	return 0;
+}
+#endif
diff --git a/arch/arm/imx-common/Kconfig b/arch/arm/imx-common/Kconfig
index 7ee74d59a8..0b68202b46 100644
--- a/arch/arm/imx-common/Kconfig
+++ b/arch/arm/imx-common/Kconfig
@@ -14,7 +14,7 @@ config IMX_RDC
 
 config IMX_BOOTAUX
 	bool "Support boot auxiliary core"
-	depends on ARCH_MX7 || ARCH_MX6
+	depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610
 	help
 	  bootaux [addr] to boot auxiliary core.
 
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index b7cb434bd7..8c21c8a3e8 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -28,13 +28,15 @@ obj-y 	+= cache.o init.o
 obj-$(CONFIG_CMD_SATA) += sata.o
 obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
 obj-$(CONFIG_IMX_RDC) += rdc-sema.o
-obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
 obj-$(CONFIG_SECURE_BOOT)    += hab.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx7ulp))
 obj-y  += cache.o
 obj-$(CONFIG_SECURE_BOOT) += hab.o
 endif
+ifeq ($(SOC),$(filter $(SOC),mx6 mx7 vf610))
+obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
+endif
 ifeq ($(SOC),$(filter $(SOC),vf610))
 obj-y += ddrmc-vf610.o
 endif
diff --git a/arch/arm/include/asm/arch-vf610/sys_proto.h b/arch/arm/include/asm/arch-vf610/sys_proto.h
new file mode 100644
index 0000000000..2a39816c7b
--- /dev/null
+++ b/arch/arm/include/asm/arch-vf610/sys_proto.h
@@ -0,0 +1,8 @@
+/*
+ * (C) Copyright 2017
+ * Stefan Agner, Toradex
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <asm/imx-common/sys_proto.h>
diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig
index 0474abc3c5..08c243923c 100644
--- a/configs/colibri_vf_defconfig
+++ b/configs/colibri_vf_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_VF610=y
 CONFIG_TARGET_COLIBRI_VF=y
+CONFIG_IMX_BOOTAUX=y
 CONFIG_DEFAULT_DEVICE_TREE="vf610-colibri"
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/colibri_vf/imximage.cfg,ENV_IS_IN_NAND,IMX_NAND"
 CONFIG_BOOTDELAY=1
-- 
2.12.1

  parent reply	other threads:[~2017-03-29 19:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 19:58 [U-Boot] [PATCH 0/3] imx: bootaux elf firmware support Stefan Agner
2017-03-29 19:58 ` [U-Boot] [PATCH 1/3] imx: imx-common: move aux core image parsing to common code Stefan Agner
2017-03-29 19:58 ` [U-Boot] [PATCH 2/3] imx: imx-common: add elf firmware support Stefan Agner
2017-03-29 19:58 ` Stefan Agner [this message]
2017-04-03 11:20 ` [U-Boot] [PATCH 0/3] imx: bootaux " Lukasz Majewski
2017-04-03 21:36   ` Stefan Agner
2017-04-03 22:07     ` Marek Vasut
2017-04-03 22:42       ` Stefan Agner
2017-04-03 23:34         ` Marek Vasut
2017-04-04  0:02           ` Stefan Agner
2017-04-04  8:46             ` Lukasz Majewski
2017-04-04  9:22             ` Marek Vasut
2017-04-04 17:57               ` Stefan Agner
2017-04-04 18:38                 ` Marek Vasut
2017-04-04 19:45                   ` Stefan Agner
2017-04-04 20:17                     ` Marek Vasut
2017-04-04 21:39                       ` Stefan Agner
2017-04-04  8:25       ` Lukasz Majewski
2017-04-04  8:23     ` Lukasz Majewski
2017-04-04 18:59       ` Stefan Agner
2017-04-05 15:15         ` Lukasz Majewski
2017-04-05 18:20           ` Stefan Agner
2017-04-05 19:10             ` Tom Rini
2017-04-05 19:54               ` Lukasz Majewski
2017-04-05 19:56               ` Stefan Agner

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=20170329195827.6217-4-stefan@agner.ch \
    --to=stefan@agner.ch \
    --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.