From: t-kristo@ti.com (Tero Kristo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/17] ARM: OMAP2+: use system reset info from device tree data
Date: Thu, 24 Sep 2015 17:26:52 +0300 [thread overview]
Message-ID: <1443104818-993-12-git-send-email-t-kristo@ti.com> (raw)
In-Reply-To: <1443104818-993-1-git-send-email-t-kristo@ti.com>
System reset mapping used by reboot is now provided through DT data and
a reset controller. Use this instead of the hardcoded PRM API.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
arch/arm/mach-omap2/Makefile | 6 ------
arch/arm/mach-omap2/am33xx-restart.c | 27 ---------------------------
arch/arm/mach-omap2/board-generic.c | 16 ++++++++--------
arch/arm/mach-omap2/common.c | 29 +++++++++++++++++++++++++++++
arch/arm/mach-omap2/common.h | 2 ++
arch/arm/mach-omap2/omap2-restart.c | 2 +-
arch/arm/mach-omap2/omap3-restart.c | 2 +-
arch/arm/mach-omap2/omap4-restart.c | 27 ---------------------------
arch/arm/mach-omap2/ti81xx-restart.c | 34 ----------------------------------
9 files changed, 41 insertions(+), 104 deletions(-)
delete mode 100644 arch/arm/mach-omap2/am33xx-restart.c
delete mode 100644 arch/arm/mach-omap2/omap4-restart.c
delete mode 100644 arch/arm/mach-omap2/ti81xx-restart.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 9358696..491dc6e 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -57,13 +57,7 @@ AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
# Restart code (OMAP4/5 currently in omap4-common.c)
obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o
obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o
-obj-$(CONFIG_SOC_TI81XX) += ti81xx-restart.o
-obj-$(CONFIG_SOC_AM33XX) += am33xx-restart.o
-obj-$(CONFIG_SOC_AM43XX) += omap4-restart.o
obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o
-obj-$(CONFIG_ARCH_OMAP4) += omap4-restart.o
-obj-$(CONFIG_SOC_OMAP5) += omap4-restart.o
-obj-$(CONFIG_SOC_DRA7XX) += omap4-restart.o
# Pin multiplexing
obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o
diff --git a/arch/arm/mach-omap2/am33xx-restart.c b/arch/arm/mach-omap2/am33xx-restart.c
deleted file mode 100644
index 5bace6a..0000000
--- a/arch/arm/mach-omap2/am33xx-restart.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * am33xx-restart.c - Code common to all AM33xx machines.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/kernel.h>
-#include <linux/reboot.h>
-
-#include "common.h"
-#include "prm.h"
-
-/**
- * am3xx_restart - trigger a software restart of the SoC
- * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
- * @cmd: passed from the userspace program rebooting the system (if provided)
- *
- * Resets the SoC. For @cmd, see the 'reboot' syscall in
- * kernel/sys.c. No return value.
- */
-void am33xx_restart(enum reboot_mode mode, const char *cmd)
-{
- /* TODO: Handle mode and cmd if necessary */
-
- omap_prm_reset_system();
-}
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 24c9afc..6a82a9c 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -177,7 +177,7 @@ DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
.init_late = ti81xx_init_late,
.init_time = omap3_gptimer_timer_init,
.dt_compat = ti814x_boards_compat,
- .restart = ti81xx_restart,
+ .restart = omap_restart,
MACHINE_END
static const char *const ti816x_boards_compat[] __initconst = {
@@ -194,7 +194,7 @@ DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
.init_late = ti81xx_init_late,
.init_time = omap3_gptimer_timer_init,
.dt_compat = ti816x_boards_compat,
- .restart = ti81xx_restart,
+ .restart = omap_restart,
MACHINE_END
#endif
@@ -212,7 +212,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
.init_late = am33xx_init_late,
.init_time = omap3_gptimer_timer_init,
.dt_compat = am33xx_boards_compat,
- .restart = am33xx_restart,
+ .restart = omap_restart,
MACHINE_END
#endif
@@ -237,7 +237,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
.init_late = omap4430_init_late,
.init_time = omap4_local_timer_init,
.dt_compat = omap4_boards_compat,
- .restart = omap44xx_restart,
+ .restart = omap_restart,
MACHINE_END
#endif
@@ -259,7 +259,7 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
.init_late = omap5_init_late,
.init_time = omap5_realtime_timer_init,
.dt_compat = omap5_boards_compat,
- .restart = omap44xx_restart,
+ .restart = omap_restart,
MACHINE_END
#endif
@@ -281,7 +281,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
.init_machine = omap_generic_init,
.init_time = omap3_gptimer_timer_init,
.dt_compat = am43_boards_compat,
- .restart = omap44xx_restart,
+ .restart = omap_restart,
MACHINE_END
#endif
@@ -304,7 +304,7 @@ DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
.init_machine = omap_generic_init,
.init_time = omap5_realtime_timer_init,
.dt_compat = dra74x_boards_compat,
- .restart = omap44xx_restart,
+ .restart = omap_restart,
MACHINE_END
static const char *const dra72x_boards_compat[] __initconst = {
@@ -323,6 +323,6 @@ DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
.init_machine = omap_generic_init,
.init_time = omap5_realtime_timer_init,
.dt_compat = dra72x_boards_compat,
- .restart = omap44xx_restart,
+ .restart = omap_restart,
MACHINE_END
#endif
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 484cdad..8afb4ac 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -14,9 +14,13 @@
*/
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/reset.h>
#include "common.h"
#include "omap-secure.h"
+#include "soc.h"
+
+static struct reset_control *omap_reset_control;
/*
* Stub function for OMAP2 so that common files
@@ -32,3 +36,28 @@ void __init omap_reserve(void)
omap_secure_ram_reserve_memblock();
omap_barrier_reserve_memblock();
}
+
+void omap_restart(enum reboot_mode mode, const char *cmd)
+{
+ if (omap_reset_control)
+ reset_control_assert(omap_reset_control);
+
+ while (1)
+ ;
+}
+
+static int __init omap_init_restart(void)
+{
+ struct device_node *np;
+
+ np = of_find_node_by_name(NULL, "system_reset");
+ omap_reset_control = of_reset_control_get(np, "system");
+ if (IS_ERR(omap_reset_control)) {
+ pr_err("%s: no reset controller, reboot not functional.\n",
+ __func__);
+ omap_reset_control = NULL;
+ }
+
+ return 0;
+}
+omap_late_initcall(omap_init_restart);
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 92e92cf..51d6068 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -148,6 +148,8 @@ static inline void omap_soc_device_init(void)
}
#endif
+void omap_restart(enum reboot_mode mode, const char *cmd);
+
#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
void omap2xxx_restart(enum reboot_mode mode, const char *cmd);
#else
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
index d937b2e..f6dd4fc 100644
--- a/arch/arm/mach-omap2/omap2-restart.c
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -40,7 +40,7 @@ void omap2xxx_restart(enum reboot_mode mode, const char *cmd)
/* XXX Should save the cmd argument for use after the reboot */
- omap_prm_reset_system();
+ omap_restart(mode, cmd);
}
/**
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
index 4bdd22e..5669137 100644
--- a/arch/arm/mach-omap2/omap3-restart.c
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -31,5 +31,5 @@
void omap3xxx_restart(enum reboot_mode mode, const char *cmd)
{
omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
- omap_prm_reset_system();
+ omap_restart(mode, cmd);
}
diff --git a/arch/arm/mach-omap2/omap4-restart.c b/arch/arm/mach-omap2/omap4-restart.c
deleted file mode 100644
index e17136a..0000000
--- a/arch/arm/mach-omap2/omap4-restart.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * omap4-restart.c - Common to OMAP4 and OMAP5
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/types.h>
-#include <linux/reboot.h>
-#include "common.h"
-#include "prm.h"
-
-/**
- * omap44xx_restart - trigger a software restart of the SoC
- * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
- * @cmd: passed from the userspace program rebooting the system (if provided)
- *
- * Resets the SoC. For @cmd, see the 'reboot' syscall in
- * kernel/sys.c. No return value.
- */
-void omap44xx_restart(enum reboot_mode mode, const char *cmd)
-{
- /* XXX Should save 'cmd' into scratchpad for use after reboot */
- omap_prm_reset_system();
-}
diff --git a/arch/arm/mach-omap2/ti81xx-restart.c b/arch/arm/mach-omap2/ti81xx-restart.c
deleted file mode 100644
index 6c3ce7c..0000000
--- a/arch/arm/mach-omap2/ti81xx-restart.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/reboot.h>
-
-#include "iomap.h"
-#include "common.h"
-#include "control.h"
-#include "prm3xxx.h"
-
-#define TI81XX_PRM_DEVICE_RSTCTRL 0x00a0
-#define TI81XX_GLOBAL_RST_COLD BIT(1)
-
-/**
- * ti81xx_restart - trigger a software restart of the SoC
- * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
- * @cmd: passed from the userspace program rebooting the system (if provided)
- *
- * Resets the SoC. For @cmd, see the 'reboot' syscall in
- * kernel/sys.c. No return value.
- *
- * NOTE: Warm reset does not seem to work, may require resetting
- * clocks to bypass mode.
- */
-void ti81xx_restart(enum reboot_mode mode, const char *cmd)
-{
- omap2_prm_set_mod_reg_bits(TI81XX_GLOBAL_RST_COLD, 0,
- TI81XX_PRM_DEVICE_RSTCTRL);
- while (1);
-}
--
1.7.9.5
next prev parent reply other threads:[~2015-09-24 14:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 14:26 [PATCH 00/17] ARM: OMAP2+: reset controller support Tero Kristo
2015-09-24 14:26 ` [PATCH 01/17] ARM: OMAP2+: PRM: add support for reset controller Tero Kristo
2015-10-06 12:06 ` Tony Lindgren
2015-11-30 17:09 ` Tony Lindgren
2015-09-24 14:26 ` [PATCH 02/17] ARM: OMAP2+: hwmod: parse also soc hierarchy for hwmod compatible nodes Tero Kristo
2015-09-24 14:26 ` [PATCH 03/17] ARM: dts: omap3: add reset data Tero Kristo
2015-09-24 14:26 ` [PATCH 04/17] ARM: dts: omap4: " Tero Kristo
2015-09-24 14:26 ` [PATCH 05/17] ARM: dts: omap5: " Tero Kristo
2015-09-24 14:26 ` [PATCH 06/17] ARM: dts: dra7: " Tero Kristo
2015-09-24 14:26 ` [PATCH 07/17] ARM: dts: am4372: " Tero Kristo
2015-09-25 12:57 ` Lokesh Vutla
2015-09-28 8:11 ` Tero Kristo
2015-09-24 14:26 ` [PATCH 08/17] ARM: dts: am33xx: " Tero Kristo
2015-09-24 14:26 ` [PATCH 09/17] ARM: dts: OMAP24xx: " Tero Kristo
2015-09-24 14:26 ` [PATCH 10/17] ARM: OMAP2+: hwmod: parse reset information from DT Tero Kristo
2015-09-24 14:26 ` Tero Kristo [this message]
2015-09-24 14:26 ` [PATCH 12/17] ARM: OMAP4: hwmod_data: remove reset data Tero Kristo
2015-09-24 14:26 ` [PATCH 13/17] ARM: OMAP5: " Tero Kristo
2015-09-24 14:26 ` [PATCH 14/17] ARM: OMAP2: hwmod: AMx3xx: remove redundant reset info Tero Kristo
2015-09-24 14:26 ` [PATCH 15/17] ARM: OMAP24xx: hwmod: remove reset data from hwmod database Tero Kristo
2015-09-24 14:26 ` [PATCH 16/17] ARM: OMAP2+: hwmod: remove obsolete support for some hardreset logic Tero Kristo
2015-09-24 14:26 ` [PATCH 17/17] ARM: OMAP2+: PRM: remove redundant system reset code Tero Kristo
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=1443104818-993-12-git-send-email-t-kristo@ti.com \
--to=t-kristo@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).