From: Paul Osmialowski <pawelo@king.net.pl>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Jiri Slaby <jslaby@suse.cz>, Kumar Gala <galak@codeaurora.org>,
Linus Walleij <linus.walleij@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
Michael Turquette <mturquette@baylibre.com>,
Pawel Moll <pawel.moll@arm.com>, Rob Herring <robh+dt@kernel.org>,
Russell King <linux@arm.linux.org.uk>,
Stephen Boyd <sboyd@codeaurora.org>,
Vinod Koul <vinod.koul@intel.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org, dmaengine@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
Paul Bolle <pebolle@tiscali.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>,
Paul Osmialowski <pawelo@king.net.pl>,
Anson Huang <b20788@freescale.com>,
Frank Li <Frank.Li@freescale.com>,
Jingchang Lu <jingchang.lu@freescale.com>,
Rob Herring <r.herring@freescale.com>,
Yuri Tikhonov <yur@emcraft.com>,
Sergei Poselenov <sposelenov@emcraft.com>,
Alexander Potashev <aspotashev@emcraft.com>
Subject: [PATCH v2 1/9] arm: allow copying of vector table to internal SRAM memory
Date: Tue, 30 Jun 2015 14:27:22 +0200 [thread overview]
Message-ID: <1435667250-28299-2-git-send-email-pawelo@king.net.pl> (raw)
In-Reply-To: <1435667250-28299-1-git-send-email-pawelo@king.net.pl>
Based on part of the commit published on Emcraft git repo:
https://github.com/EmcraftSystems/linux-emcraft.git
2ce1841b590d014d8738215fb1ffe05f53c8d9f0 "some commit"
by: Dmitry Cherkassov <d_cherkasov@emcraft.com>
The ARM v7M allows setting the vector table either in
the boot memory or in the internal SRAM memory, controlled
by Bit 29 in the Vector Table Base register. This implies
that the OS vector table needs to be copied to the internal RAM.
New option CONFIG_COPY_VECTOR_TABLE_TO_SRAM_ADDR allows specification
of the desired destination for the OS vector table.
Signed-off-by: Paul Osmialowski <pawelo@king.net.pl>
---
arch/arm/Kconfig-nommu | 11 +++++++++++
arch/arm/kernel/entry-v7m.S | 3 +++
arch/arm/mm/proc-v7m.S | 11 +++++++++++
3 files changed, 25 insertions(+)
diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
index aed66d5..d081fcb 100644
--- a/arch/arm/Kconfig-nommu
+++ b/arch/arm/Kconfig-nommu
@@ -62,3 +62,14 @@ config ARM_MPU
If your CPU has an MPU then you should choose 'y' here unless you
know that you do not want to use the MPU.
+
+config COPY_VECTOR_TABLE_TO_SRAM_ADDR
+ hex 'If non-zero, copy Vector Table to this SRAM Address' if CPU_V7M
+ default 0x00000000
+ depends on CPU_V7M
+ help
+ The ARM v7M allows setting the vector table either in
+ the boot memory or in the internal SRAM memory, controlled
+ by Bit 29 in the Vector Table Base register.
+ This implies that the OS vector table needs to be copied to
+ the internal RAM.
diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S
index b6c8bb9..114096e 100644
--- a/arch/arm/kernel/entry-v7m.S
+++ b/arch/arm/kernel/entry-v7m.S
@@ -146,3 +146,6 @@ ENTRY(vector_table)
.rept CONFIG_CPU_V7M_NUM_IRQ
.long __irq_entry @ External Interrupts
.endr
+#if CONFIG_COPY_VECTOR_TABLE_TO_SRAM_ADDR > 0x00000000
+ENTRY(vector_table_end)
+#endif
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
index 67d9209..ded9504 100644
--- a/arch/arm/mm/proc-v7m.S
+++ b/arch/arm/mm/proc-v7m.S
@@ -83,7 +83,18 @@ ENDPROC(cpu_v7m_do_resume)
__v7m_setup:
@ Configure the vector table base address
ldr r0, =BASEADDR_V7M_SCB
+#if CONFIG_COPY_VECTOR_TABLE_TO_SRAM_ADDR > 0x00000000
+ ldr r12, =CONFIG_COPY_VECTOR_TABLE_TO_SRAM_ADDR
+ mov r5, r12 @ Copy the kernel vector_table to
+ ldr r6, =vector_table @ the in-SRAM vector table
+ ldr r4, =vector_table_end
+1: ldr r3, [r6], #4
+ str r3, [r5], #4
+ cmp r6, r4
+ bne 1b @ End of the copy code
+#else
ldr r12, =vector_table
+#endif
str r12, [r0, V7M_SCB_VTOR]
@ enable UsageFault, BusFault and MemManage fault.
--
2.3.6
next prev parent reply other threads:[~2015-06-30 12:32 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 12:27 [PATCH v2 0/9] [New BSP] Add initial support for Freescale Kinetis TWR-K70F120M development kit Paul Osmialowski
2015-06-30 12:27 ` Paul Osmialowski [this message]
2015-06-30 12:27 ` [PATCH v2 2/9] arm: twr-k70f120m: basic support for Kinetis TWR-K70F120M Paul Osmialowski
2015-06-30 12:27 ` [PATCH v2 3/9] arm: twr-k70f120m: clock driver for Kinetis SoC Paul Osmialowski
2015-06-30 20:36 ` Arnd Bergmann
2015-07-01 15:57 ` Paul Osmialowski
2015-07-02 10:08 ` Paul Osmialowski
2015-07-02 12:40 ` Arnd Bergmann
2015-07-02 21:42 ` Paul Osmialowski
2015-07-02 22:08 ` Thomas Gleixner
2015-07-03 17:40 ` Paul Osmialowski
2015-07-04 19:54 ` Arnd Bergmann
[not found] ` <alpine.LNX.2.00.1507042327490.1296@localhost.localdomain>
2015-07-06 20:57 ` Paul Osmialowski
2015-07-24 3:42 ` Michael Turquette
2015-07-26 20:24 ` Paul Osmialowski
[not found] ` <20150728160347.642.31950@quantum>
2015-07-28 20:30 ` Paul Osmialowski
[not found] ` <20150729230517.642.66061@quantum>
2015-07-30 21:40 ` Paul Osmialowski
[not found] ` <20150801005810.23791.8199@quantum>
2015-08-01 15:27 ` Paul Osmialowski
2015-07-14 9:03 ` Linus Walleij
2015-07-15 7:31 ` Paul Osmialowski
2015-07-15 17:34 ` Paul Osmialowski
2015-06-30 12:27 ` [PATCH v2 4/9] arm: twr-k70f120m: timer " Paul Osmialowski
2015-06-30 20:43 ` Arnd Bergmann
2015-07-01 11:44 ` Paul Osmialowski
2015-07-05 14:39 ` Rob Herring
2015-07-01 7:51 ` Thomas Gleixner
2015-07-01 8:42 ` Paul Osmialowski
2015-07-01 13:28 ` Thomas Gleixner
2015-07-01 14:20 ` Paul Osmialowski
2015-07-14 8:59 ` Linus Walleij
2015-06-30 12:27 ` [PATCH v2 5/9] arm: twr-k70f120m: IOMUX " Paul Osmialowski
2015-07-14 8:55 ` Linus Walleij
2015-06-30 12:27 ` [PATCH v2 6/9] arm: twr-k70f120m: extend Freescale eDMA driver with the ability to support " Paul Osmialowski
2015-07-05 6:45 ` Vinod Koul
2015-07-05 9:45 ` Paul Osmialowski
2015-06-30 12:27 ` [PATCH v2 7/9] arm: twr-k70f120m: use Freescale eDMA driver with " Paul Osmialowski
2015-06-30 20:49 ` Arnd Bergmann
2015-07-01 6:54 ` Paul Osmialowski
2015-06-30 12:27 ` [PATCH v2 8/9] arm: twr-k70f120m: extend Freescale lpuart driver with ability to support " Paul Osmialowski
2015-06-30 12:27 ` [PATCH v2 9/9] arm: twr-k70f120m: use Freescale lpuart driver with " Paul Osmialowski
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=1435667250-28299-2-git-send-email-pawelo@king.net.pl \
--to=pawelo@king.net.pl \
--cc=Frank.Li@freescale.com \
--cc=arnd@arndb.de \
--cc=aspotashev@emcraft.com \
--cc=b20788@freescale.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jingchang.lu@freescale.com \
--cc=jslaby@suse.cz \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=nicolas.pitre@linaro.org \
--cc=pawel.moll@arm.com \
--cc=pebolle@tiscali.nl \
--cc=r.herring@freescale.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
--cc=sposelenov@emcraft.com \
--cc=tglx@linutronix.de \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vinod.koul@intel.com \
--cc=yur@emcraft.com \
/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
all inboxes | Powered by JetHome®