Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1658300 > unrolled thread
| Started by | Andreas Färber <afaerber@suse.de> |
|---|---|
| First post | 2017-06-06 03:10 +0200 |
| Last post | 2017-06-06 18:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v4 00/28] ARM: Initial Actions Semi S500 and S900 enablement Andreas Färber <afaerber@suse.de> - 2017-06-06 03:10 +0200
[PATCH v4 04/28] clocksource: Add Owl timer Andreas Färber <afaerber@suse.de> - 2017-06-06 03:10 +0200
Re: [PATCH v4 04/28] clocksource: Add Owl timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-06-06 18:40 +0200
| From | Andreas Färber <afaerber@suse.de> |
|---|---|
| Date | 2017-06-06 03:10 +0200 |
| Subject | [PATCH v4 00/28] ARM: Initial Actions Semi S500 and S900 enablement |
| Message-ID | <tPb0J-1BU-7@gated-at.bofh.it> |
Hello, This patch series adds initial support for Actions Semiconductor S500 (ARMv7) and S900 (ARMv8) SoCs. v4 refactors the clocksource driver again and fixes power-gating for CPU2/CPU3. With this v4 I would like to start applying initial patches to my tree for 4.13. @Actions: Last call for comments on vendor prefix and SoC bindings! @uCRobotics: Last call for comments on vendor prefix and board bindings! @LeMaker: Last call for comments on module and board bindings! Work branch for testing: https://github.com/afaerber/linux/commits/bg96-next Booting from U-Boot to initrd is straightforward on both boards: https://en.opensuse.org/HCL:Guitar https://en.opensuse.org/HCL:Bubblegum-96 Have a lot of fun! Cheers, Andreas v3 -> v4: * Revert to hardcoded TIMER0/1 in clocksource (Daniel) * Make power domains CPU2 and CPU3 always-on * Clean up SMP vs. PM domains code duplication * Extend earlycon documentation (Jonathan) * Update MAINTAINERS with SPS files v2 -> v3: * Clocksource fix * Clocksource cleanups (Daniel) * Serial cleanups * Add S500 CPU enable-method * Add power domain driver * Rework clocksource for S900 compatibility v1 -> v2: * S900 DT fixes (Mark) * Kconfig name changes (Arnd) * Bubblegum-96 .dts rename * Vendor prefix rename * Minor cleanups * Add serial driver * Add MAINTAINERS section * Use SPDX-License-Identifier in DT (Rob) * Add clocksource driver Cc: Arnd Bergmann <arnd@arndb.de> Cc: Olof Johansson <olof@lixom.net> Cc: Rob Herring <robh@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: mp-cs@actions-semi.com Cc: Thomas Liau <thomas.liau@actions-semi.com> Cc: 96boards@ucrobotics.com Cc: support@lemaker.org Cc: linux-serial@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-pm@vger.kernel.org Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Kevin Hilman <khilman@kernel.org> Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: linux-doc@vger.kernel.org Cc: Jonathan Corbet <corbet@lwn.net> Cc: devicetree@vger.kernel.org Andreas Färber (28): dt-bindings: Add vendor prefix for Actions Semi dt-bindings: arm: Document Actions Semi S500 dt-bindings: timer: Document Owl timer clocksource: Add Owl timer clocksource: owl: Add S900 support ARM: Prepare Actions Semi S500 ARM64: Prepare Actions Semi S900 dt-bindings: serial: Document Actions Semi Owl UARTs tty: serial: Add Actions Semi Owl UART earlycon Documentation: kernel-parameters: Document owl earlycon ARM: dts: Add Actions Semi S500 and LeMaker Guitar dt-bindings: Add vendor prefix for uCRobotics dt-bindings: arm: Document Actions Semi S900 ARM64: dts: Add Actions Semi S900 and Bubblegum-96 MAINTAINERS: Add Actions Semi Owl section tty: serial: owl: Implement console driver ARM64: dts: actions: s900-bubblegum-96: Add fake uart5 clock ARM: dts: s500-guitar-bb-rev-b: Add fake uart3 clock dt-bindings: arm: cpus: Add S500 enable-method ARM: owl: Implement CPU enable-method for S500 ARM: dts: s500: Set CPU enable-method dt-bindings: power: Add Owl SPS power domains soc: actions: Add Owl SPS MAINTAINERS: Update Actions Semi section with SPS ARM: dts: s500: Add SPS node ARM: dts: s500: Set power domains for CPU2 and CPU3 soc: actions: owl-sps: Factor out owl_sps_set_pg() for power-gating ARM: owl: smp: Implement SPS power-gating for CPU2 and CPU3 Documentation/admin-guide/kernel-parameters.txt | 6 + Documentation/devicetree/bindings/arm/actions.txt | 39 ++ Documentation/devicetree/bindings/arm/cpus.txt | 1 + .../devicetree/bindings/power/actions,owl-sps.txt | 17 + .../bindings/serial/actions,owl-uart.txt | 16 + .../bindings/timer/actions,owl-timer.txt | 20 + .../devicetree/bindings/vendor-prefixes.txt | 2 + MAINTAINERS | 13 + arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/s500-guitar-bb-rev-b.dts | 33 + arch/arm/boot/dts/s500-guitar.dtsi | 22 + arch/arm/boot/dts/s500.dtsi | 189 ++++++ arch/arm/mach-actions/Kconfig | 16 + arch/arm/mach-actions/Makefile | 4 + arch/arm/mach-actions/headsmp.S | 68 ++ arch/arm/mach-actions/owl.c | 28 + arch/arm/mach-actions/platsmp.c | 198 ++++++ arch/arm64/Kconfig.platforms | 6 + arch/arm64/boot/dts/Makefile | 1 + arch/arm64/boot/dts/actions/Makefile | 5 + arch/arm64/boot/dts/actions/s900-bubblegum-96.dts | 42 ++ arch/arm64/boot/dts/actions/s900.dtsi | 164 +++++ drivers/clocksource/Kconfig | 7 + drivers/clocksource/Makefile | 1 + drivers/clocksource/owl-timer.c | 172 +++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/actions/Kconfig | 16 + drivers/soc/actions/Makefile | 2 + drivers/soc/actions/owl-sps-helper.c | 51 ++ drivers/soc/actions/owl-sps.c | 224 +++++++ drivers/tty/serial/Kconfig | 19 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/owl-uart.c | 724 +++++++++++++++++++++ include/dt-bindings/power/s500-powergate.h | 19 + include/linux/soc/actions/owl-sps.h | 11 + include/uapi/linux/serial_core.h | 3 + 39 files changed, 2147 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/actions.txt create mode 100644 Documentation/devicetree/bindings/power/actions,owl-sps.txt create mode 100644 Documentation/devicetree/bindings/serial/actions,owl-uart.txt create mode 100644 Documentation/devicetree/bindings/timer/actions,owl-timer.txt create mode 100644 arch/arm/boot/dts/s500-guitar-bb-rev-b.dts create mode 100644 arch/arm/boot/dts/s500-guitar.dtsi create mode 100644 arch/arm/boot/dts/s500.dtsi create mode 100644 arch/arm/mach-actions/Kconfig create mode 100644 arch/arm/mach-actions/Makefile create mode 100644 arch/arm/mach-actions/headsmp.S create mode 100644 arch/arm/mach-actions/owl.c create mode 100644 arch/arm/mach-actions/platsmp.c create mode 100644 arch/arm64/boot/dts/actions/Makefile create mode 100644 arch/arm64/boot/dts/actions/s900-bubblegum-96.dts create mode 100644 arch/arm64/boot/dts/actions/s900.dtsi create mode 100644 drivers/clocksource/owl-timer.c create mode 100644 drivers/soc/actions/Kconfig create mode 100644 drivers/soc/actions/Makefile create mode 100644 drivers/soc/actions/owl-sps-helper.c create mode 100644 drivers/soc/actions/owl-sps.c create mode 100644 drivers/tty/serial/owl-uart.c create mode 100644 include/dt-bindings/power/s500-powergate.h create mode 100644 include/linux/soc/actions/owl-sps.h -- 2.12.3
[toc] | [next] | [standalone]
| From | Andreas Färber <afaerber@suse.de> |
|---|---|
| Date | 2017-06-06 03:10 +0200 |
| Subject | [PATCH v4 04/28] clocksource: Add Owl timer |
| Message-ID | <tPbar-1V1-37@gated-at.bofh.it> |
| In reply to | #1658300 |
The Actions Semi S500 SoC provides four timers, 2Hz0/1 and 32-bit TIMER0/1.
Use TIMER0 as clocksource and TIMER1 as clockevents.
Based on LeMaker linux-actions tree.
An S500 datasheet can be found on the LeMaker Guitar pages:
http://www.lemaker.org/product-guitar-download-29.html
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
v3 -> v4:
* Dropped DT-dependent node iteration (Daniel)
* Introduced owl_timer_set_enabled() (Daniel)
* Fixed one timer reset
v2 -> v3:
* Cleared interrupt pending flag for Timer1
* Adopted named interrupts for Timer1
* Extended commit message (Daniel)
* Adopted BIT() macros (Daniel)
* Adopted PTR_ERR() (Daniel)
* Adopted request_irq() (Daniel)
* Factored timer reset out (Daniel)
* Adopted CLOCK_EVT_FEAT_DYNIRQ (Daniel)
* Adopted clk input for rate (Daniel)
* Prepared for S900, adopting S500 DT compatible
v2: new
drivers/clocksource/Kconfig | 7 ++
drivers/clocksource/Makefile | 1 +
drivers/clocksource/owl-timer.c | 171 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 179 insertions(+)
create mode 100644 drivers/clocksource/owl-timer.c
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 4ba230d8e679..da3f1d926c6b 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -102,6 +102,13 @@ config ORION_TIMER
help
Enables the support for the Orion timer driver
+config OWL_TIMER
+ bool "Owl timer driver" if COMPILE_TEST
+ depends on GENERIC_CLOCKEVENTS
+ select CLKSRC_MMIO
+ help
+ Enables the support for the Actions Semi Owl timer driver.
+
config SUN4I_TIMER
bool "Sun4i timer driver" if COMPILE_TEST
depends on GENERIC_CLOCKEVENTS
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index ec559212edf6..90309d4a719e 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_CLKSRC_PISTACHIO) += time-pistachio.o
obj-$(CONFIG_CLKSRC_TI_32K) += timer-ti-32k.o
obj-$(CONFIG_CLKSRC_NPS) += timer-nps.o
obj-$(CONFIG_OXNAS_RPS_TIMER) += timer-oxnas-rps.o
+obj-$(CONFIG_OWL_TIMER) += owl-timer.o
obj-$(CONFIG_ARC_TIMERS) += arc_timer.o
obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o
diff --git a/drivers/clocksource/owl-timer.c b/drivers/clocksource/owl-timer.c
new file mode 100644
index 000000000000..4609363a79a6
--- /dev/null
+++ b/drivers/clocksource/owl-timer.c
@@ -0,0 +1,171 @@
+/*
+ * Actions Semi Owl timer
+ *
+ * Copyright 2012 Actions Semi Inc.
+ * Author: Actions Semi, Inc.
+ *
+ * Copyright (c) 2017 SUSE Linux GmbH
+ * Author: Andreas Färber
+ *
+ * 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.
+ */
+
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqreturn.h>
+#include <linux/sched_clock.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define OWL_Tx_CTL 0x0
+#define OWL_Tx_CMP 0x4
+#define OWL_Tx_VAL 0x8
+
+#define OWL_Tx_CTL_PD BIT(0)
+#define OWL_Tx_CTL_INTEN BIT(1)
+#define OWL_Tx_CTL_EN BIT(2)
+
+static void __iomem *owl_timer_base;
+static void __iomem *owl_clksrc_base;
+static void __iomem *owl_clkevt_base;
+
+static inline void owl_timer_reset(void __iomem *base)
+{
+ writel(0, base + OWL_Tx_CTL);
+ writel(0, base + OWL_Tx_VAL);
+ writel(0, base + OWL_Tx_CMP);
+}
+
+static inline void owl_timer_set_enabled(void __iomem *base, bool enabled)
+{
+ u32 ctl = readl(base + OWL_Tx_CTL);
+
+ /* PD bit is cleared when set */
+ ctl &= ~OWL_Tx_CTL_PD;
+
+ if (enabled)
+ ctl |= OWL_Tx_CTL_EN;
+ else
+ ctl &= ~OWL_Tx_CTL_EN;
+
+ writel(ctl, base + OWL_Tx_CTL);
+}
+
+static u64 notrace owl_timer_sched_read(void)
+{
+ return (u64)readl(owl_clksrc_base + OWL_Tx_VAL);
+}
+
+static int owl_timer_set_state_shutdown(struct clock_event_device *evt)
+{
+ owl_timer_set_enabled(owl_clkevt_base, false);
+
+ return 0;
+}
+
+static int owl_timer_set_state_oneshot(struct clock_event_device *evt)
+{
+ owl_timer_reset(owl_clkevt_base);
+
+ return 0;
+}
+
+static int owl_timer_tick_resume(struct clock_event_device *evt)
+{
+ return 0;
+}
+
+static int owl_timer_set_next_event(unsigned long evt,
+ struct clock_event_device *ev)
+{
+ void __iomem *base = owl_clkevt_base;
+
+ owl_timer_set_enabled(base, false);
+ writel(OWL_Tx_CTL_INTEN, base + OWL_Tx_CTL);
+ writel(0, base + OWL_Tx_VAL);
+ writel(evt, base + OWL_Tx_CMP);
+ owl_timer_set_enabled(base, true);
+
+ return 0;
+}
+
+static struct clock_event_device owl_clockevent = {
+ .name = "owl_tick",
+ .rating = 200,
+ .features = CLOCK_EVT_FEAT_ONESHOT |
+ CLOCK_EVT_FEAT_DYNIRQ,
+ .set_state_shutdown = owl_timer_set_state_shutdown,
+ .set_state_oneshot = owl_timer_set_state_oneshot,
+ .tick_resume = owl_timer_tick_resume,
+ .set_next_event = owl_timer_set_next_event,
+};
+
+static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id)
+{
+ struct clock_event_device *evt = (struct clock_event_device *)dev_id;
+
+ writel(OWL_Tx_CTL_PD, owl_clkevt_base + OWL_Tx_CTL);
+
+ evt->event_handler(evt);
+
+ return IRQ_HANDLED;
+}
+
+static int __init owl_timer_init(struct device_node *node)
+{
+ struct clk *clk;
+ unsigned long rate;
+ int timer1_irq, ret;
+
+ owl_timer_base = of_io_request_and_map(node, 0, "owl-timer");
+ if (IS_ERR(owl_timer_base)) {
+ pr_err("Can't map timer registers");
+ return PTR_ERR(owl_timer_base);
+ }
+
+ owl_clksrc_base = owl_timer_base + 0x08;
+ owl_clkevt_base = owl_timer_base + 0x14;
+
+ timer1_irq = of_irq_get_byname(node, "timer1");
+ if (timer1_irq <= 0) {
+ pr_err("Can't parse timer1 IRQ");
+ return -EINVAL;
+ }
+
+ clk = of_clk_get(node, 0);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ rate = clk_get_rate(clk);
+
+ owl_timer_reset(owl_clksrc_base);
+ owl_timer_set_enabled(owl_clksrc_base, true);
+
+ sched_clock_register(owl_timer_sched_read, 32, rate);
+ clocksource_mmio_init(owl_clksrc_base + OWL_Tx_VAL, node->name,
+ rate, 200, 32, clocksource_mmio_readl_up);
+
+ owl_timer_reset(owl_clkevt_base);
+
+ ret = request_irq(timer1_irq, owl_timer1_interrupt, IRQF_TIMER,
+ "owl-timer", &owl_clockevent);
+ if (ret) {
+ pr_err("failed to request irq %d\n", timer1_irq);
+ return ret;
+ }
+
+ owl_clockevent.cpumask = cpumask_of(0);
+ owl_clockevent.irq = timer1_irq;
+
+ clockevents_config_and_register(&owl_clockevent, rate,
+ 0xf, 0xffffffff);
+
+ return 0;
+}
+CLOCKSOURCE_OF_DECLARE(owl_s500, "actions,s500-timer", owl_timer_init);
--
2.12.3
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2017-06-06 18:40 +0200 |
| Subject | Re: [PATCH v4 04/28] clocksource: Add Owl timer |
| Message-ID | <tPpGp-2N6-3@gated-at.bofh.it> |
| In reply to | #1658305 |
On Tue, Jun 06, 2017 at 02:54:02AM +0200, Andreas Färber wrote: > The Actions Semi S500 SoC provides four timers, 2Hz0/1 and 32-bit TIMER0/1. > > Use TIMER0 as clocksource and TIMER1 as clockevents. > > Based on LeMaker linux-actions tree. > > An S500 datasheet can be found on the LeMaker Guitar pages: > http://www.lemaker.org/product-guitar-download-29.html > > Signed-off-by: Andreas Färber <afaerber@suse.de> > --- Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web