* [PATCH v3 0/9] Atmel System Timer cleanups
@ 2015-03-04 14:21 Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 1/9] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon Alexandre Belloni
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
This patch set cleans up the system timer driver.
The main goal is to get rid of the mach/ headers dependency. At the same time,
it introduces proper probing and locking (using a regmap) for the watchdog
driver.
This is based on 4.0-rc1 and will have two merge conflicts with my cleanup #1 in
mach-at91/at91rm9200.c
Changes in v3:
- stop using an mfd and get the syscon directly from the watchdog driver
- introduce a proper reset driver to handle reset
Changes in v2:
- cleaned up more includes in the watchdog driver
- stop using if OF when selecting CLKSRC_OF
- stop initializing .owner
Alexandre Belloni (9):
ARM: at91/dt: declare atmel,at91rm9200-st as a syscon
mfd: syscon: Add atmel system timer registers definition
watchdog: at91rm9200: use the system timer syscon
power: reset: Add AT91RM9200 reset driver
ARM: at91: at91rm9200: remove deprecated arm_pm_restart
ARM: at91: time: move the system timer driver to drivers/clocksource
clocksource: atmel-st: properly initialize driver
clocksource: atmel-st: use syscon/regmap
ARM: at91: remove useless include
.../devicetree/bindings/arm/atmel-at91.txt | 2 +-
arch/arm/boot/dts/at91rm9200.dtsi | 2 +-
arch/arm/mach-at91/Makefile | 2 +-
arch/arm/mach-at91/at91rm9200.c | 19 ----
arch/arm/mach-at91/generic.h | 3 -
arch/arm/mach-at91/include/mach/at91_st.h | 61 ------------
drivers/clocksource/Kconfig | 4 +
drivers/clocksource/Makefile | 1 +
.../clocksource/timer-atmel-st.c | 103 ++++++++-------------
drivers/power/reset/Kconfig | 7 ++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/at91rm9200-reset.c | 70 ++++++++++++++
drivers/watchdog/Kconfig | 2 +-
drivers/watchdog/at91rm9200_wdt.c | 21 +++--
include/linux/mfd/syscon/atmel-st.h | 47 ++++++++++
15 files changed, 189 insertions(+), 156 deletions(-)
delete mode 100644 arch/arm/mach-at91/include/mach/at91_st.h
rename arch/arm/mach-at91/at91rm9200_time.c => drivers/clocksource/timer-atmel-st.c (77%)
create mode 100644 drivers/power/reset/at91rm9200-reset.c
create mode 100644 include/linux/mfd/syscon/atmel-st.h
--
2.1.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 1/9] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 2/9] mfd: syscon: Add atmel system timer registers definition Alexandre Belloni
` (7 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
The system timer register range is also used for the watchdog. Declare it as a
syscon to be able to get a regmap early enough in the boot process
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
Documentation/devicetree/bindings/arm/atmel-at91.txt | 2 +-
arch/arm/boot/dts/at91rm9200.dtsi | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index ad319f84f560..0fbb3582ec9d 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -46,7 +46,7 @@ PIT Timer required properties:
shared across all System Controller members.
System Timer (ST) required properties:
-- compatible: Should be "atmel,at91rm9200-st"
+- compatible: Should be "atmel,at91rm9200-st", "syscon"
- reg: Should contain registers location and length
- interrupts: Should contain interrupt for the ST which is the IRQ line
shared across all System Controller members.
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index 21c2b504f977..1b1c1ac2c4f6 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -356,7 +356,7 @@
};
st: timer@fffffd00 {
- compatible = "atmel,at91rm9200-st";
+ compatible = "atmel,at91rm9200-st", "syscon";
reg = <0xfffffd00 0x100>;
interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
};
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 2/9] mfd: syscon: Add atmel system timer registers definition
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 1/9] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 15:44 ` Lee Jones
2015-03-04 14:21 ` [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon Alexandre Belloni
` (6 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
AT91RM920 has a memory range reserved for timer and watchdog configuration.
Expose those registers so that drivers can make use of the system timer syscon
declared in at91 DTs.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
include/linux/mfd/syscon/atmel-st.h | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 include/linux/mfd/syscon/atmel-st.h
diff --git a/include/linux/mfd/syscon/atmel-st.h b/include/linux/mfd/syscon/atmel-st.h
new file mode 100644
index 000000000000..8e29a1028807
--- /dev/null
+++ b/include/linux/mfd/syscon/atmel-st.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2005 Ivan Kokshaysky
+ * Copyright (C) SAN People
+ *
+ * System Timer (ST) - System peripherals registers.
+ * Based on AT91RM9200 datasheet revision E.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _LINUX_MFD_SYSCON_ATMEL_ST_H
+#define _LINUX_MFD_SYSCON_ATMEL_ST_H
+
+#define AT91_ST_CR 0x00 /* Control Register */
+#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
+
+#define AT91_ST_PIMR 0x04 /* Period Interval Mode Register */
+#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
+
+#define AT91_ST_WDMR 0x08 /* Watchdog Mode Register */
+#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
+#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
+#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
+
+#define AT91_ST_RTMR 0x0c /* Real-time Mode Register */
+#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
+
+#define AT91_ST_SR 0x10 /* Status Register */
+#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
+#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
+#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
+#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
+
+#define AT91_ST_IER 0x14 /* Interrupt Enable Register */
+#define AT91_ST_IDR 0x18 /* Interrupt Disable Register */
+#define AT91_ST_IMR 0x1c /* Interrupt Mask Register */
+
+#define AT91_ST_RTAR 0x20 /* Real-time Alarm Register */
+#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
+
+#define AT91_ST_CRTR 0x24 /* Current Real-time Register */
+#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
+
+#endif /* _LINUX_MFD_SYSCON_ATMEL_ST_H */
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 1/9] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 2/9] mfd: syscon: Add atmel system timer registers definition Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 14:51 ` Guenter Roeck
2015-03-04 14:21 ` [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver Alexandre Belloni
` (5 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
Use a syscon regmap to access the systemr timer registers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/watchdog/Kconfig | 2 +-
drivers/watchdog/at91rm9200_wdt.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 16f202350997..ce4f3a7f95fd 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -154,7 +154,7 @@ config ARM_SP805_WATCHDOG
config AT91RM9200_WATCHDOG
tristate "AT91RM9200 watchdog"
- depends on SOC_AT91RM9200
+ depends on SOC_AT91RM9200 && MFD_SYSCON
help
Watchdog timer embedded into AT91RM9200 chips. This will reboot your
system when the timeout is reached.
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
index d244112d5b6f..34dd5eec79d8 100644
--- a/drivers/watchdog/at91rm9200_wdt.c
+++ b/drivers/watchdog/at91rm9200_wdt.c
@@ -17,22 +17,25 @@
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/atmel-st.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include <linux/types.h>
#include <linux/watchdog.h>
#include <linux/uaccess.h>
#include <linux/of.h>
#include <linux/of_device.h>
-#include <mach/at91_st.h>
#define WDT_DEFAULT_TIME 5 /* seconds */
#define WDT_MAX_TIME 256 /* seconds */
static int wdt_time = WDT_DEFAULT_TIME;
static bool nowayout = WATCHDOG_NOWAYOUT;
+static struct regmap *regmap_st;
module_param(wdt_time, int, 0);
MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
@@ -55,7 +58,7 @@ static unsigned long at91wdt_busy;
*/
static inline void at91_wdt_stop(void)
{
- at91_st_write(AT91_ST_WDMR, AT91_ST_EXTEN);
+ regmap_write(regmap_st, AT91_ST_WDMR, AT91_ST_EXTEN);
}
/*
@@ -63,9 +66,9 @@ static inline void at91_wdt_stop(void)
*/
static inline void at91_wdt_start(void)
{
- at91_st_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN |
+ regmap_write(regmap_st, AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN |
(((65536 * wdt_time) >> 8) & AT91_ST_WDV));
- at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
+ regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST);
}
/*
@@ -73,7 +76,7 @@ static inline void at91_wdt_start(void)
*/
static inline void at91_wdt_reload(void)
{
- at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
+ regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST);
}
/* ......................................................................... */
@@ -203,12 +206,17 @@ static struct miscdevice at91wdt_miscdev = {
static int at91wdt_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
int res;
if (at91wdt_miscdev.parent)
return -EBUSY;
at91wdt_miscdev.parent = &pdev->dev;
+ regmap_st = syscon_node_to_regmap(np);
+ if (!regmap_st)
+ return -ENODEV;
+
res = misc_register(&at91wdt_miscdev);
if (res)
return res;
@@ -255,6 +263,7 @@ static int at91wdt_resume(struct platform_device *pdev)
#endif
static const struct of_device_id at91_wdt_dt_ids[] = {
+ { .compatible = "atmel,at91rm9200-st" },
{ .compatible = "atmel,at91rm9200-wdt" },
{ /* sentinel */ }
};
@@ -267,7 +276,7 @@ static struct platform_driver at91wdt_driver = {
.suspend = at91wdt_suspend,
.resume = at91wdt_resume,
.driver = {
- .name = "at91_wdt",
+ .name = "atmel_st_watchdog",
.of_match_table = at91_wdt_dt_ids,
},
};
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
` (2 preceding siblings ...)
2015-03-04 14:21 ` [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 17:17 ` Sebastian Reichel
2015-03-04 14:21 ` [PATCH v3 5/9] ARM: at91: at91rm9200: remove deprecated arm_pm_restart Alexandre Belloni
` (4 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
AT91RM9200 uses the watchdog from the system timer to reset.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/power/reset/Kconfig | 7 ++++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/at91rm9200-reset.c | 70 ++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+)
create mode 100644 drivers/power/reset/at91rm9200-reset.c
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 27f6646731b0..8d79e45ae754 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -30,6 +30,13 @@ config POWER_RESET_AT91_RESET
This driver supports restart for Atmel AT91SAM9 and SAMA5
SoCs
+config POWER_RESET_AT91RM9200_RESET
+ bool "Atmel AT91RM9200 reset driver"
+ depends on ARCH_AT91 && MFD_SYSCON
+ default SOC_AT91RM9200
+ help
+ This driver supports restart for Atmel AT91RM9200.
+
config POWER_RESET_AXXIA
bool "LSI Axxia reset driver"
depends on ARCH_AXXIA
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 11de15bae52e..96e972bbb922 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -1,6 +1,7 @@
obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
+obj-$(CONFIG_POWER_RESET_AT91RM9200_RESET) += at91rm9200-reset.o
obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
diff --git a/drivers/power/reset/at91rm9200-reset.c b/drivers/power/reset/at91rm9200-reset.c
new file mode 100644
index 000000000000..b4c542e39512
--- /dev/null
+++ b/drivers/power/reset/at91rm9200-reset.c
@@ -0,0 +1,70 @@
+/*
+ * Atmel AT91 SAM9 SoCs reset code
+ *
+ * Copyright (C) 2007 Atmel Corporation.
+ * Copyright (C) BitBox Ltd 2010
+ * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcosoft.com>
+ * Copyright (C) 2014 Free Electrons
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/atmel-st.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+
+static struct regmap *regmap_st;
+
+static int at91rm9200_restart(struct notifier_block *this,
+ unsigned long mode, void *cmd)
+{
+ /*
+ * Perform a hardware reset with the use of the Watchdog timer.
+ */
+ regmap_write(regmap_st, AT91_ST_WDMR,
+ AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
+ regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST);
+
+ mdelay(2000);
+
+ pr_emerg("Unable to restart system\n");
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block at91rm9200_restart_nb = {
+ .notifier_call = at91rm9200_restart,
+ .priority = 192,
+};
+
+static int at91rm9200_reset_probe(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+
+ regmap_st = syscon_node_to_regmap(np);
+ if (!regmap_st)
+ return -ENODEV;
+
+ return register_restart_handler(&at91rm9200_restart_nb);
+}
+
+static const struct of_device_id at91rm9200_reset_of_match[] = {
+ { .compatible = "atmel,at91rm9200-st" },
+ { /* sentinel */ }
+};
+
+static struct platform_driver at91rm9200_reset_driver = {
+ .probe = at91rm9200_reset_probe,
+ .driver = {
+ .name = "at91rm9200-reset",
+ .of_match_table = at91rm9200_reset_of_match,
+ },
+};
+module_platform_driver(at91rm9200_reset_driver);
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 5/9] ARM: at91: at91rm9200: remove deprecated arm_pm_restart
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
` (3 preceding siblings ...)
2015-03-04 14:21 ` [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 6/9] ARM: at91: time: move the system timer driver to drivers/clocksource Alexandre Belloni
` (3 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
Now that a proper driver is available, remove at91rm9200_restart.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91rm9200.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 8fcfb70f7124..2386d08d65e8 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -24,19 +24,8 @@
#include <asm/mach/irq.h>
#include <asm/system_misc.h>
-#include <mach/at91_st.h>
-
#include "generic.h"
-static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd)
-{
- /*
- * Perform a hardware reset with the use of the Watchdog timer.
- */
- at91_st_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
- at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
-}
-
static void __init at91rm9200_dt_timer_init(void)
{
of_clk_init(NULL);
@@ -48,7 +37,6 @@ static void __init at91rm9200_dt_device_init(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
arm_pm_idle = at91rm9200_idle;
- arm_pm_restart = at91rm9200_restart;
at91rm9200_pm_init();
}
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 6/9] ARM: at91: time: move the system timer driver to drivers/clocksource
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
` (4 preceding siblings ...)
2015-03-04 14:21 ` [PATCH v3 5/9] ARM: at91: at91rm9200: remove deprecated arm_pm_restart Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 7/9] clocksource: atmel-st: properly initialize driver Alexandre Belloni
` (2 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
Import at91rm9200_time.c from mach-at91 as timer-atmel-st.c. Further cleanup is
required to get rid of the mach-at91 headers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
arch/arm/mach-at91/Makefile | 2 +-
drivers/clocksource/Kconfig | 4 ++++
drivers/clocksource/Makefile | 1 +
.../at91rm9200_time.c => drivers/clocksource/timer-atmel-st.c | 0
4 files changed, 6 insertions(+), 1 deletion(-)
rename arch/arm/mach-at91/at91rm9200_time.c => drivers/clocksource/timer-atmel-st.c (100%)
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 827fdbcce1c7..963c29169242 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -7,7 +7,7 @@ obj-y := setup.o
obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o
# CPU-specific support
-obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o
+obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o
obj-$(CONFIG_SOC_AT91SAM9) += at91sam9.o
obj-$(CONFIG_SOC_SAMA5) += sama5.o
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f68122..d1d15985a4ec 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -138,6 +138,10 @@ config ATMEL_PIT
select CLKSRC_OF if OF
def_bool SOC_AT91SAM9 || SOC_SAMA5
+config ATMEL_ST
+ select CLKSRC_OF if OF
+ def_bool SOC_AT91RM9200
+
config CLKSRC_METAG_GENERIC
def_bool y if METAG
help
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 752d5c70b0ef..5b85f6adb258 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -1,5 +1,6 @@
obj-$(CONFIG_CLKSRC_OF) += clksrc-of.o
obj-$(CONFIG_ATMEL_PIT) += timer-atmel-pit.o
+obj-$(CONFIG_ATMEL_ST) += timer-atmel-st.o
obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o
obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o
obj-$(CONFIG_SCx200HR_TIMER) += scx200_hrt.o
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/drivers/clocksource/timer-atmel-st.c
similarity index 100%
rename from arch/arm/mach-at91/at91rm9200_time.c
rename to drivers/clocksource/timer-atmel-st.c
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 7/9] clocksource: atmel-st: properly initialize driver
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
` (5 preceding siblings ...)
2015-03-04 14:21 ` [PATCH v3 6/9] ARM: at91: time: move the system timer driver to drivers/clocksource Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 8/9] clocksource: atmel-st: use syscon/regmap Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 9/9] ARM: at91: remove useless include Alexandre Belloni
8 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
Use clocksource_of_init to initialize the system timer instead of relying on a
custom function.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
arch/arm/mach-at91/at91rm9200.c | 7 -------
arch/arm/mach-at91/generic.h | 3 ---
drivers/clocksource/timer-atmel-st.c | 4 +++-
3 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 2386d08d65e8..5efb075294e5 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -26,12 +26,6 @@
#include "generic.h"
-static void __init at91rm9200_dt_timer_init(void)
-{
- of_clk_init(NULL);
- at91rm9200_timer_init();
-}
-
static void __init at91rm9200_dt_device_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -48,7 +42,6 @@ static const char *at91rm9200_dt_board_compat[] __initconst = {
};
DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
- .init_time = at91rm9200_dt_timer_init,
.map_io = at91_map_io,
.init_machine = at91rm9200_dt_device_init,
.dt_compat = at91rm9200_dt_board_compat,
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 583369ffc284..6c953bff13d6 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -18,9 +18,6 @@
extern void __init at91_map_io(void);
extern void __init at91_alt_map_io(void);
- /* Timer */
-extern void at91rm9200_timer_init(void);
-
/* idle */
extern void at91rm9200_idle(void);
extern void at91sam9_idle(void);
diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c
index b00d09555f2b..7d062ab32674 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -222,7 +222,7 @@ err:
/*
* ST (system timer) module supports both clockevents and clocksource.
*/
-void __init at91rm9200_timer_init(void)
+static void __init atmel_st_timer_init(struct device_node *node)
{
/* For device tree enabled device: initialize here */
of_at91rm9200_st_init();
@@ -249,3 +249,5 @@ void __init at91rm9200_timer_init(void)
/* register clocksource */
clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
}
+CLOCKSOURCE_OF_DECLARE(atmel_st_timer, "atmel,at91rm9200-st",
+ atmel_st_timer_init);
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 8/9] clocksource: atmel-st: use syscon/regmap
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
` (6 preceding siblings ...)
2015-03-04 14:21 ` [PATCH v3 7/9] clocksource: atmel-st: properly initialize driver Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 9/9] ARM: at91: remove useless include Alexandre Belloni
8 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
The register range from the system timer is also used by the watchdog driver.
Use a regmap to handle concurrent accesses.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/clocksource/timer-atmel-st.c | 99 ++++++++++++++----------------------
1 file changed, 37 insertions(+), 62 deletions(-)
diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c
index 7d062ab32674..c4a52e32675e 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -24,19 +24,19 @@
#include <linux/irq.h>
#include <linux/clockchips.h>
#include <linux/export.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/atmel-st.h>
#include <linux/of_irq.h>
+#include <linux/regmap.h>
#include <asm/mach/time.h>
-#include <mach/at91_st.h>
-#include <mach/hardware.h>
-
static unsigned long last_crtr;
static u32 irqmask;
static struct clock_event_device clkevt;
+static struct regmap *regmap_st;
+#define AT91_SLOW_CLOCK 32768
#define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ)
/*
@@ -46,11 +46,11 @@ static struct clock_event_device clkevt;
*/
static inline unsigned long read_CRTR(void)
{
- unsigned long x1, x2;
+ unsigned int x1, x2;
- x1 = at91_st_read(AT91_ST_CRTR);
+ regmap_read(regmap_st, AT91_ST_CRTR, &x1);
do {
- x2 = at91_st_read(AT91_ST_CRTR);
+ regmap_read(regmap_st, AT91_ST_CRTR, &x2);
if (x1 == x2)
break;
x1 = x2;
@@ -63,7 +63,10 @@ static inline unsigned long read_CRTR(void)
*/
static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
{
- u32 sr = at91_st_read(AT91_ST_SR) & irqmask;
+ u32 sr;
+
+ regmap_read(regmap_st, AT91_ST_SR, &sr);
+ sr &= irqmask;
/*
* irqs should be disabled here, but as the irq is shared they are only
@@ -96,7 +99,7 @@ static struct irqaction at91rm9200_timer_irq = {
.name = "at91_tick",
.flags = IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = at91rm9200_timer_interrupt,
- .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
+ .irq = 0,
};
static cycle_t read_clk32k(struct clocksource *cs)
@@ -115,23 +118,25 @@ static struct clocksource clk32k = {
static void
clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
{
+ unsigned int val;
+
/* Disable and flush pending timer interrupts */
- at91_st_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS);
- at91_st_read(AT91_ST_SR);
+ regmap_write(regmap_st, AT91_ST_IDR, AT91_ST_PITS | AT91_ST_ALMS);
+ regmap_read(regmap_st, AT91_ST_SR, &val);
last_crtr = read_CRTR();
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
/* PIT for periodic irqs; fixed rate of 1/HZ */
irqmask = AT91_ST_PITS;
- at91_st_write(AT91_ST_PIMR, RM9200_TIMER_LATCH);
+ regmap_write(regmap_st, AT91_ST_PIMR, RM9200_TIMER_LATCH);
break;
case CLOCK_EVT_MODE_ONESHOT:
/* ALM for oneshot irqs, set by next_event()
* before 32 seconds have passed
*/
irqmask = AT91_ST_ALMS;
- at91_st_write(AT91_ST_RTAR, last_crtr);
+ regmap_write(regmap_st, AT91_ST_RTAR, last_crtr);
break;
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_UNUSED:
@@ -139,7 +144,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
irqmask = 0;
break;
}
- at91_st_write(AT91_ST_IER, irqmask);
+ regmap_write(regmap_st, AT91_ST_IER, irqmask);
}
static int
@@ -147,6 +152,7 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
{
u32 alm;
int status = 0;
+ unsigned int val;
BUG_ON(delta < 2);
@@ -162,12 +168,12 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
alm = read_CRTR();
/* Cancel any pending alarm; flush any pending IRQ */
- at91_st_write(AT91_ST_RTAR, alm);
- at91_st_read(AT91_ST_SR);
+ regmap_write(regmap_st, AT91_ST_RTAR, alm);
+ regmap_read(regmap_st, AT91_ST_SR, &val);
/* Schedule alarm by writing RTAR. */
alm += delta;
- at91_st_write(AT91_ST_RTAR, alm);
+ regmap_write(regmap_st, AT91_ST_RTAR, alm);
return status;
}
@@ -180,57 +186,26 @@ static struct clock_event_device clkevt = {
.set_mode = clkevt32k_mode,
};
-void __iomem *at91_st_base;
-EXPORT_SYMBOL_GPL(at91_st_base);
-
-static const struct of_device_id at91rm9200_st_timer_ids[] = {
- { .compatible = "atmel,at91rm9200-st" },
- { /* sentinel */ }
-};
-
-static int __init of_at91rm9200_st_init(void)
-{
- struct device_node *np;
- int ret;
-
- np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
- if (!np)
- goto err;
-
- at91_st_base = of_iomap(np, 0);
- if (!at91_st_base)
- goto node_err;
-
- /* Get the interrupts property */
- ret = irq_of_parse_and_map(np, 0);
- if (!ret)
- goto ioremap_err;
- at91rm9200_timer_irq.irq = ret;
-
- of_node_put(np);
-
- return 0;
-
-ioremap_err:
- iounmap(at91_st_base);
-node_err:
- of_node_put(np);
-err:
- return -EINVAL;
-}
-
/*
* ST (system timer) module supports both clockevents and clocksource.
*/
static void __init atmel_st_timer_init(struct device_node *node)
{
- /* For device tree enabled device: initialize here */
- of_at91rm9200_st_init();
+ unsigned int val;
+
+ regmap_st = syscon_node_to_regmap(node);
+ if (IS_ERR(regmap_st))
+ panic(pr_fmt("Unable to get regmap\n"));
/* Disable all timer interrupts, and clear any pending ones */
- at91_st_write(AT91_ST_IDR,
+ regmap_write(regmap_st, AT91_ST_IDR,
AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
- at91_st_read(AT91_ST_SR);
+ regmap_read(regmap_st, AT91_ST_SR, &val);
+
+ /* Get the interrupts property */
+ at91rm9200_timer_irq.irq = irq_of_parse_and_map(node, 0);
+ if (!at91rm9200_timer_irq.irq)
+ panic(pr_fmt("Unable to get IRQ from DT\n"));
/* Make IRQs happen for the system timer */
setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq);
@@ -239,7 +214,7 @@ static void __init atmel_st_timer_init(struct device_node *node)
* directly for the clocksource and all clockevents, after adjusting
* its prescaler from the 1 Hz default.
*/
- at91_st_write(AT91_ST_RTMR, 1);
+ regmap_write(regmap_st, AT91_ST_RTMR, 1);
/* Setup timer clockevent, with minimum of two ticks (important!!) */
clkevt.cpumask = cpumask_of(0);
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 9/9] ARM: at91: remove useless include
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
` (7 preceding siblings ...)
2015-03-04 14:21 ` [PATCH v3 8/9] clocksource: atmel-st: use syscon/regmap Alexandre Belloni
@ 2015-03-04 14:21 ` Alexandre Belloni
8 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 14:21 UTC (permalink / raw)
To: Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
Sebastian Reichel, Dmitry Eremin-Solenikov, linux-kernel,
linux-arm-kernel, linux-watchdog, linux-pm, Alexandre Belloni
Both drivers using the system timer are now converted to an MFD. mach/at91_st.h
is now useless.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
arch/arm/mach-at91/include/mach/at91_st.h | 61 -------------------------------
1 file changed, 61 deletions(-)
delete mode 100644 arch/arm/mach-at91/include/mach/at91_st.h
diff --git a/arch/arm/mach-at91/include/mach/at91_st.h b/arch/arm/mach-at91/include/mach/at91_st.h
deleted file mode 100644
index 67fdbd13c3ed..000000000000
--- a/arch/arm/mach-at91/include/mach/at91_st.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91_st.h
- *
- * Copyright (C) 2005 Ivan Kokshaysky
- * Copyright (C) SAN People
- *
- * System Timer (ST) - System peripherals registers.
- * Based on AT91RM9200 datasheet revision E.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef AT91_ST_H
-#define AT91_ST_H
-
-#ifndef __ASSEMBLY__
-extern void __iomem *at91_st_base;
-
-#define at91_st_read(field) \
- __raw_readl(at91_st_base + field)
-
-#define at91_st_write(field, value) \
- __raw_writel(value, at91_st_base + field)
-#else
-.extern at91_st_base
-#endif
-
-#define AT91_ST_CR 0x00 /* Control Register */
-#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
-
-#define AT91_ST_PIMR 0x04 /* Period Interval Mode Register */
-#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
-
-#define AT91_ST_WDMR 0x08 /* Watchdog Mode Register */
-#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
-#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
-#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
-
-#define AT91_ST_RTMR 0x0c /* Real-time Mode Register */
-#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
-
-#define AT91_ST_SR 0x10 /* Status Register */
-#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
-#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
-#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
-#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
-
-#define AT91_ST_IER 0x14 /* Interrupt Enable Register */
-#define AT91_ST_IDR 0x18 /* Interrupt Disable Register */
-#define AT91_ST_IMR 0x1c /* Interrupt Mask Register */
-
-#define AT91_ST_RTAR 0x20 /* Real-time Alarm Register */
-#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
-
-#define AT91_ST_CRTR 0x24 /* Current Real-time Register */
-#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
-
-#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon
2015-03-04 14:21 ` [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon Alexandre Belloni
@ 2015-03-04 14:51 ` Guenter Roeck
2015-03-04 15:08 ` Alexandre Belloni
0 siblings, 1 reply; 16+ messages in thread
From: Guenter Roeck @ 2015-03-04 14:51 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Daniel Lezcano
Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
Thomas Gleixner, Lee Jones, Wim Van Sebroeck, Sebastian Reichel,
Dmitry Eremin-Solenikov, linux-kernel, linux-arm-kernel,
linux-watchdog, linux-pm
On 03/04/2015 06:21 AM, Alexandre Belloni wrote:
> Use a syscon regmap to access the systemr timer registers.
>
s/systemr/system/
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
...
>
> static const struct of_device_id at91_wdt_dt_ids[] = {
> + { .compatible = "atmel,at91rm9200-st" },
> { .compatible = "atmel,at91rm9200-wdt" },
> { /* sentinel */ }
> };
> @@ -267,7 +276,7 @@ static struct platform_driver at91wdt_driver = {
> .suspend = at91wdt_suspend,
> .resume = at91wdt_resume,
> .driver = {
> - .name = "at91_wdt",
> + .name = "atmel_st_watchdog",
If you change the driver name you also need to change the MODULE_ALIAS
a few lines down.
But why change it in the first place ? Maybe that was discussed somewhere,
but not here where it belongs, and not in patch 0/9 either.
Guenter
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon
2015-03-04 14:51 ` Guenter Roeck
@ 2015-03-04 15:08 ` Alexandre Belloni
2015-03-04 17:48 ` Guenter Roeck
0 siblings, 1 reply; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-04 15:08 UTC (permalink / raw)
To: Guenter Roeck
Cc: Nicolas Ferre, Daniel Lezcano, Boris Brezillon,
Jean-Christophe Plagniol-Villard, Thomas Gleixner, Lee Jones,
Wim Van Sebroeck, Sebastian Reichel, Dmitry Eremin-Solenikov,
linux-kernel, linux-arm-kernel, linux-watchdog, linux-pm
On 04/03/2015 at 06:51:51 -0800, Guenter Roeck wrote :
> >@@ -267,7 +276,7 @@ static struct platform_driver at91wdt_driver = {
> > .suspend = at91wdt_suspend,
> > .resume = at91wdt_resume,
> > .driver = {
> >- .name = "at91_wdt",
> >+ .name = "atmel_st_watchdog",
>
> If you change the driver name you also need to change the MODULE_ALIAS
> a few lines down.
>
> But why change it in the first place ? Maybe that was discussed somewhere,
> but not here where it belongs, and not in patch 0/9 either.
>
That's because it conflicts with drivers/watchdog/at91sam9_wdt.c
I'm not sure that is relevant anymore as they will only be probed using
DT now.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 2/9] mfd: syscon: Add atmel system timer registers definition
2015-03-04 14:21 ` [PATCH v3 2/9] mfd: syscon: Add atmel system timer registers definition Alexandre Belloni
@ 2015-03-04 15:44 ` Lee Jones
0 siblings, 0 replies; 16+ messages in thread
From: Lee Jones @ 2015-03-04 15:44 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Nicolas Ferre, Daniel Lezcano, Boris Brezillon,
Jean-Christophe Plagniol-Villard, Thomas Gleixner,
Wim Van Sebroeck, Guenter Roeck, Sebastian Reichel,
Dmitry Eremin-Solenikov, linux-kernel, linux-arm-kernel,
linux-watchdog, linux-pm
On Wed, 04 Mar 2015, Alexandre Belloni wrote:
> AT91RM920 has a memory range reserved for timer and watchdog configuration.
> Expose those registers so that drivers can make use of the system timer syscon
> declared in at91 DTs.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> include/linux/mfd/syscon/atmel-st.h | 47 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
> create mode 100644 include/linux/mfd/syscon/atmel-st.h
>
> diff --git a/include/linux/mfd/syscon/atmel-st.h b/include/linux/mfd/syscon/atmel-st.h
> new file mode 100644
> index 000000000000..8e29a1028807
> --- /dev/null
> +++ b/include/linux/mfd/syscon/atmel-st.h
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright (C) 2005 Ivan Kokshaysky
> + * Copyright (C) SAN People
> + *
> + * System Timer (ST) - System peripherals registers.
> + * Based on AT91RM9200 datasheet revision E.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef _LINUX_MFD_SYSCON_ATMEL_ST_H
> +#define _LINUX_MFD_SYSCON_ATMEL_ST_H
> +
> +#define AT91_ST_CR 0x00 /* Control Register */
> +#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
Please use BIT() for "1 <<".
> +#define AT91_ST_PIMR 0x04 /* Period Interval Mode Register */
> +#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
> +
> +#define AT91_ST_WDMR 0x08 /* Watchdog Mode Register */
> +#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
> +#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
> +#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
> +
> +#define AT91_ST_RTMR 0x0c /* Real-time Mode Register */
> +#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
> +
> +#define AT91_ST_SR 0x10 /* Status Register */
> +#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
> +#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
> +#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
> +#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
> +
> +#define AT91_ST_IER 0x14 /* Interrupt Enable Register */
> +#define AT91_ST_IDR 0x18 /* Interrupt Disable Register */
> +#define AT91_ST_IMR 0x1c /* Interrupt Mask Register */
> +
> +#define AT91_ST_RTAR 0x20 /* Real-time Alarm Register */
> +#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
> +
> +#define AT91_ST_CRTR 0x24 /* Current Real-time Register */
> +#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
> +
> +#endif /* _LINUX_MFD_SYSCON_ATMEL_ST_H */
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver
2015-03-04 14:21 ` [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver Alexandre Belloni
@ 2015-03-04 17:17 ` Sebastian Reichel
2015-03-05 15:09 ` Alexandre Belloni
0 siblings, 1 reply; 16+ messages in thread
From: Sebastian Reichel @ 2015-03-04 17:17 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Nicolas Ferre, Daniel Lezcano, Boris Brezillon,
Jean-Christophe Plagniol-Villard, Thomas Gleixner, Lee Jones,
Wim Van Sebroeck, Guenter Roeck, Dmitry Eremin-Solenikov,
linux-kernel, linux-arm-kernel, linux-watchdog, linux-pm
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
Hi,
On Wed, Mar 04, 2015 at 03:21:32PM +0100, Alexandre Belloni wrote:
> AT91RM9200 uses the watchdog from the system timer to reset.
> [...]
> + regmap_write(regmap_st, AT91_ST_WDMR,
> + AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
> + regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST);
> +
> + mdelay(2000);
At pity that you have to write into two registers, otherwise you
could have used the syscon-reboot driver.
> [...]
> +module_platform_driver(at91rm9200_reset_driver);
Apart from missing module metadata (MODULE_AUTHOR(),
MODULE_LICENSE(), ...) the driver looks fine to me.
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon
2015-03-04 15:08 ` Alexandre Belloni
@ 2015-03-04 17:48 ` Guenter Roeck
0 siblings, 0 replies; 16+ messages in thread
From: Guenter Roeck @ 2015-03-04 17:48 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Nicolas Ferre, Daniel Lezcano, Boris Brezillon,
Jean-Christophe Plagniol-Villard, Thomas Gleixner, Lee Jones,
Wim Van Sebroeck, Sebastian Reichel, Dmitry Eremin-Solenikov,
linux-kernel, linux-arm-kernel, linux-watchdog, linux-pm
On Wed, Mar 04, 2015 at 04:08:15PM +0100, Alexandre Belloni wrote:
> On 04/03/2015 at 06:51:51 -0800, Guenter Roeck wrote :
> > >@@ -267,7 +276,7 @@ static struct platform_driver at91wdt_driver = {
> > > .suspend = at91wdt_suspend,
> > > .resume = at91wdt_resume,
> > > .driver = {
> > >- .name = "at91_wdt",
> > >+ .name = "atmel_st_watchdog",
> >
> > If you change the driver name you also need to change the MODULE_ALIAS
> > a few lines down.
> >
> > But why change it in the first place ? Maybe that was discussed somewhere,
> > but not here where it belongs, and not in patch 0/9 either.
> >
>
> That's because it conflicts with drivers/watchdog/at91sam9_wdt.c
>
You still have to update MODULE_ALIAS (or drop it if it is not needed anymore).
Guenter
> I'm not sure that is relevant anymore as they will only be probed using
> DT now.
>
>
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver
2015-03-04 17:17 ` Sebastian Reichel
@ 2015-03-05 15:09 ` Alexandre Belloni
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2015-03-05 15:09 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Nicolas Ferre, Daniel Lezcano, Boris Brezillon,
Jean-Christophe Plagniol-Villard, Thomas Gleixner, Lee Jones,
Wim Van Sebroeck, Guenter Roeck, Dmitry Eremin-Solenikov,
linux-kernel, linux-arm-kernel, linux-watchdog, linux-pm
On 04/03/2015 at 18:17:58 +0100, Sebastian Reichel wrote :
> Hi,
>
> On Wed, Mar 04, 2015 at 03:21:32PM +0100, Alexandre Belloni wrote:
> > AT91RM9200 uses the watchdog from the system timer to reset.
> > [...]
> > + regmap_write(regmap_st, AT91_ST_WDMR,
> > + AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
> > + regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST);
> > +
> > + mdelay(2000);
>
> At pity that you have to write into two registers, otherwise you
> could have used the syscon-reboot driver.
>
Exactly what I was thinking :)
> > [...]
> > +module_platform_driver(at91rm9200_reset_driver);
>
> Apart from missing module metadata (MODULE_AUTHOR(),
> MODULE_LICENSE(), ...) the driver looks fine to me.
>
I'll add those.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2015-03-05 15:10 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 14:21 [PATCH v3 0/9] Atmel System Timer cleanups Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 1/9] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 2/9] mfd: syscon: Add atmel system timer registers definition Alexandre Belloni
2015-03-04 15:44 ` Lee Jones
2015-03-04 14:21 ` [PATCH v3 3/9] watchdog: at91rm9200: use the system timer syscon Alexandre Belloni
2015-03-04 14:51 ` Guenter Roeck
2015-03-04 15:08 ` Alexandre Belloni
2015-03-04 17:48 ` Guenter Roeck
2015-03-04 14:21 ` [PATCH v3 4/9] power: reset: Add AT91RM9200 reset driver Alexandre Belloni
2015-03-04 17:17 ` Sebastian Reichel
2015-03-05 15:09 ` Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 5/9] ARM: at91: at91rm9200: remove deprecated arm_pm_restart Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 6/9] ARM: at91: time: move the system timer driver to drivers/clocksource Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 7/9] clocksource: atmel-st: properly initialize driver Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 8/9] clocksource: atmel-st: use syscon/regmap Alexandre Belloni
2015-03-04 14:21 ` [PATCH v3 9/9] ARM: at91: remove useless include Alexandre Belloni
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).