Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 7828/1: ARMv7-M: implement restart routine common to all v7-M machines

The newly introduced function is to be used as .restart callback for
ARMv7-M machines. The used register is architecturally defined, so it
should work for all M-class machines.

Acked-by: Jonathan Austin <jonathan.austin@arm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Uwe Kleine-König and committed by
Russell King
6a7d2c62 84b6504f

+32 -1
+12
arch/arm/include/asm/v7m.h
··· 15 15 16 16 #define V7M_SCB_VTOR 0x08 17 17 18 + #define V7M_SCB_AIRCR 0x0c 19 + #define V7M_SCB_AIRCR_VECTKEY (0x05fa << 16) 20 + #define V7M_SCB_AIRCR_SYSRESETREQ (1 << 2) 21 + 18 22 #define V7M_SCB_SCR 0x10 19 23 #define V7M_SCB_SCR_SLEEPDEEP (1 << 2) 20 24 ··· 46 42 */ 47 43 #define EXC_RET_STACK_MASK 0x00000004 48 44 #define EXC_RET_THREADMODE_PROCESSSTACK 0xfffffffd 45 + 46 + #ifndef __ASSEMBLY__ 47 + 48 + enum reboot_mode; 49 + 50 + void armv7m_restart(enum reboot_mode mode, const char *cmd); 51 + 52 + #endif /* __ASSEMBLY__ */
+1 -1
arch/arm/kernel/Makefile
··· 24 24 obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o 25 25 26 26 ifeq ($(CONFIG_CPU_V7M),y) 27 - obj-y += entry-v7m.o 27 + obj-y += entry-v7m.o v7m.o 28 28 else 29 29 obj-y += entry-armv.o 30 30 endif
+19
arch/arm/kernel/v7m.c
··· 1 + /* 2 + * Copyright (C) 2013 Uwe Kleine-Koenig for Pengutronix 3 + * 4 + * This program is free software; you can redistribute it and/or modify it under 5 + * the terms of the GNU General Public License version 2 as published by the 6 + * Free Software Foundation. 7 + */ 8 + #include <linux/io.h> 9 + #include <linux/reboot.h> 10 + #include <asm/barrier.h> 11 + #include <asm/v7m.h> 12 + 13 + void armv7m_restart(enum reboot_mode mode, const char *cmd) 14 + { 15 + dsb(); 16 + __raw_writel(V7M_SCB_AIRCR_VECTKEY | V7M_SCB_AIRCR_SYSRESETREQ, 17 + BASEADDR_V7M_SCB + V7M_SCB_AIRCR); 18 + dsb(); 19 + }