ARM: Initial Actions Semi S500 and S900 enablement
Subsystems (9)
Andreas Färber
maintainerv3 cover ARM: Initial Actions Semi S500 and S900 enablement
Hello,
This series adds initial support for Actions Semiconductor S500 (ARMv7) and S900 (ARMv8) SoCs.
v3 has the serial driver working almost equally for both, still glitch on S900. SMP support and power-gating for S500 are implemented, so both get 4 CPUs up.
https://github.com/afaerber/linux/commits/bg96-next
Booting from U-Boot 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
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
Andreas F?rber (25):
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
ARM: dts: s500: Add SPS node
ARM: owl: smp: Reimplement 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 | 10 + 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 | 24 + arch/arm/boot/dts/s500.dtsi | 183 ++++++ arch/arm/mach-actions/Kconfig | 15 + arch/arm/mach-actions/Makefile | 2 + arch/arm/mach-actions/headsmp.S | 68 ++ arch/arm/mach-actions/owl.c | 28 + arch/arm/mach-actions/platsmp.c | 229 +++++++ 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 | 205 ++++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/actions/Kconfig | 12 + drivers/soc/actions/Makefile | 1 + drivers/soc/actions/owl-sps.c | 245 +++++++ 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/uapi/linux/serial_core.h | 3 + 37 files changed, 2155 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.c create mode 100644 drivers/tty/serial/owl-uart.c create mode 100644 include/dt-bindings/power/s500-powergate.h
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 1/25 dt-bindings: Add vendor prefix for Actions Semi
Actions Semiconductor was listed on NASDAQ as ACTS until Dec 16, 2016.
---
v2 -> v3:
* Fixed sort order after rename
v1 -> v2:
* Reverted from "acts" to "actions" (cf. IAP140 "mrvl" vs. "marvell")
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -5,6 +5,7 @@ using them to avoid name-space collisions. abcn Abracon Corporation abilis Abilis Systems +actions Actions Semiconductor Co., Ltd. active-semi Active-Semi International Inc ad Avionic Design GmbH adapteva Adapteva, Inc.
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 2/25 dt-bindings: arm: Document Actions Semi S500
In reply to Andreas FärberThe Actions Semi S500 is a quad-core ARM Cortex-A9 SoC. The LeMaker Guitar is an SODIMM-format module with that SoC.
---
v2 -> v3: unchanged
v1 -> v2:
* Adopted "actions" vendor prefix
* Extended text
Documentation/devicetree/bindings/arm/actions.txt | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/actions.txt
Documentation/devicetree/bindings/arm/actions.txt new file +24 -0
@@ -0,0 +1,24 @@ +Actions Semi platforms device tree bindings +------------------------------------------- + + +S500 SoC +======== + +Required root node properties: + + - compatible : must contain "actions,s500" + + +Modules: + +Root node property compatible must contain, depending on module: + + - LeMaker Guitar: "lemaker,guitar" + + +Boards: + +Root node property compatible must contain, depending on board: + + - LeMaker Guitar Base Board rev. B: "lemaker,guitar-bb-rev-b", "lemaker,guitar"
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 3/25 dt-bindings: timer: Document Owl timer
In reply to Andreas FärberThe Actions Semi S500 SoC contains a timer block with two 2 Hz and two 32-bit timers. The S900 SoC timer block has four 32-bit timers.
---
v2 -> v3:
* Adopted interrupt-names
* Changed compatible for S500
* Added S900 compatible and interrupt names
v2: new
.../devicetree/bindings/timer/actions,owl-timer.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/actions,owl-timer.txt
Documentation/devicetree/bindings/timer/actions,owl-timer.txt new file +20 -0
@@ -0,0 +1,20 @@ +Actions Semi Owl Timer + +Required properties: +- compatible : "actions,s500-timer" for S500 + "actions,s900-timer" for S900 +- reg : Offset and length of the register set for the device. +- interrupts : Should contain the interrupts. +- interrupt-names : Valid names are: "2Hz0", "2Hz1", + "Timer0", "Timer1", "Timer2", "Timer3" + See ../resource-names.txt + +Example: + + timer at b0168000 { + compatible = "actions,s500-timer"; + reg = <0xb0168000 0x100>; + interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "Timer0", "Timer1"; + };
Signature · 1 line
2.10.2
Mark Rutland
reviewerRe: [PATCH v3 03/25] dt-bindings: timer: Document Owl timer
Quoted 22 lines · Andreas F?rber
The Actions Semi S500 SoC contains a timer block with two 2 Hz and two 32-bit timers. The S900 SoC timer block has four 32-bit timers.
Signed-off-by Andreas F?rber <[email protected]>---
v2 -> v3:
* Adopted interrupt-names
* Changed compatible for S500
* Added S900 compatible and interrupt namesv2: new
.../devicetree/bindings/timer/actions,owl-timer.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/actions,owl-timer.txtDocumentation/devicetree/bindings/timer/actions,owl-timer.txt new file +0
-0
Documentation/devicetree/bindings/timer/actions,owl-timer.txt line 9
Quoted 9 lines
Documentation/devicetree/bindings/timer/actions,owl-timer.txt new file +9
-0@@ -0,0 +1,20 @@ +Actions Semi Owl Timer + +Required properties: +- compatible : "actions,s500-timer" for S500 + "actions,s900-timer" for S900 +- reg : Offset and length of the register set for the device. +- interrupts : Should contain the interrupts. +- interrupt-names : Valid names are: "2Hz0", "2Hz1", + "Timer0", "Timer1", "Timer2", "Timer3"
Sticking to lower case for the names would be preferable.
Otherwise, this looks fine.
Mark,.
Re: [PATCH v3 03/25] dt-bindings: timer: Document Owl timer
Quoted 26 lines · Mark Rutland
Quoted 25 lines · Andreas F?rber
The Actions Semi S500 SoC contains a timer block with two 2 Hz and two 32-bit timers. The S900 SoC timer block has four 32-bit timers.
Signed-off-by Andreas F?rber <[email protected]>---
v2 -> v3:
* Adopted interrupt-names
* Changed compatible for S500
* Added S900 compatible and interrupt namesv2: new
.../devicetree/bindings/timer/actions,owl-timer.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/actions,owl-timer.txtDocumentation/devicetree/bindings/timer/actions,owl-timer.txt new file +3
-0@@ -0,0 +1,20 @@ +Actions Semi Owl Timer + +Required properties:
Quoted 8 lines
Documentation/devicetree/bindings/timer/actions,owl-timer.txt line 9
Quoted 6 lines
Documentation/devicetree/bindings/timer/actions,owl-timer.txt new file +6
-0+- compatible : "actions,s500-timer" for S500 + "actions,s900-timer" for S900 +- reg : Offset and length of the register set for the device. +- interrupts : Should contain the interrupts. +- interrupt-names : Valid names are: "2Hz0", "2Hz1", + "Timer0", "Timer1", "Timer2", "Timer3"Sticking to lower case for the names would be preferable.
With that,
Andreas Färber
maintainerRe: [PATCH v3 03/25] dt-bindings: timer: Document Owl timer
Am 03.03.2017 um 07:20 schrieb Rob Herring:
Quoted 27 lines · Mark Rutland
Quoted 26 lines · Andreas F?rber
Quoted 25 lines
The Actions Semi S500 SoC contains a timer block with two 2 Hz and two 32-bit timers. The S900 SoC timer block has four 32-bit timers.
Signed-off-by Andreas F?rber <[email protected]>---
v2 -> v3:
* Adopted interrupt-names
* Changed compatible for S500
* Added S900 compatible and interrupt namesv2: new
.../devicetree/bindings/timer/actions,owl-timer.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/actions,owl-timer.txtDocumentation/devicetree/bindings/timer/actions,owl-timer.txt new file +3
-0@@ -0,0 +1,20 @@ +Actions Semi Owl Timer + +Required properties:
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/timer/actions,owl-timer.txt line 9
Quoted 6 lines
Documentation/devicetree/bindings/timer/actions,owl-timer.txt new file +6
-0+- compatible : "actions,s500-timer" for S500 + "actions,s900-timer" for S900 +- reg : Offset and length of the register set for the device. +- interrupts : Should contain the interrupts. +- interrupt-names : Valid names are: "2Hz0", "2Hz1", + "Timer0", "Timer1", "Timer2", "Timer3"Sticking to lower case for the names would be preferable.
Done.
Quoted 3 lines
With that,
Acked-by Rob Herring <[email protected]>
Thanks,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Andreas Färber
maintainerPATCH v3 4/25 clocksource: Add Owl timer
In reply to Andreas FärberThe 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
---
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 | 193 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 drivers/clocksource/owl-timer.c
drivers/clocksource/Kconfig +7 -0
@@ -107,6 +107,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
drivers/clocksource/Makefile +1 -0
@@ -53,6 +53,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
drivers/clocksource/owl-timer.c new file +193 -0
193 lines not on this page · raw message
Signature · 1 line
2.10.2
Re: [PATCH v3 04/25] clocksource: Add Owl timer
Quoted 104 lines · Andreas F?rber
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.htmlSigned-off-by Andreas F?rber <[email protected]>---
v2 -> v3:
* Cleared interrupt pending flag for Timer1
* Adopted named interrupts for Timer1
* Extended commit message (Daniel)
* AdoptedBIT()macros (Daniel)
* AdoptedPTR_ERR()(Daniel)
* Adoptedrequest_irq()(Daniel)
* Factored timer reset out (Daniel)
* AdoptedCLOCK_EVT_FEAT_DYNIRQ(Daniel)
* Adopted clk input for rate (Daniel)
* Prepared for S900, adopting S500 DT compatiblev2: new
drivers/clocksource/Kconfig | 7 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/owl-timer.c | 193 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 drivers/clocksource/owl-timer.cdrivers/clocksource/Kconfig +7
-0@@ -107,6 +107,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_CLOCKEVENTSdrivers/clocksource/Makefile +1
-0@@ -53,6 +53,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.odrivers/clocksource/owl-timer.c new file +37
-0@@ -0,0 +1,193 @@ +/* +* 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) + +#define OWL_MAX_Tx 2 + +struct owl_timer_info { +int timer_offset[OWL_MAX_Tx];
drivers/clocksource/owl-timer.c line 47
Quoted 10 lines
drivers/clocksource/owl-timer.c new file +10
-0+}; + +static const struct owl_timer_info *owl_timer_info; + +static void __iomem *owl_timer_base; + +static inline void __iomem *owl_timer_get_base (unsigned timer_nr) +{ +if (timer_nr >= OWL_MAX_Tx) +return NULL ;
The driver is supposed to know what is doing. owl_timer_get_base won't be called with an invalid index. This test will have a cost as it is called from owl_timer_sched_read.
drivers/clocksource/owl-timer.c line 49
Quoted 2 lines
drivers/clocksource/owl-timer.c new file +2
-0+ +return owl_timer_base + owl_timer_info->timer_offset[timer_nr];
Actually, you just need a clkevt base @ and a clocksource base @.
Instead of computing again and again the base, why not just precompute:
owl_clksrc_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER0] owl_clkevt_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER1]
at init time.
And use these variables directly in the functions.
drivers/clocksource/owl-timer.c line 58
Quoted 9 lines
drivers/clocksource/owl-timer.c new file +9
-0+} + +static inline void owl_timer_reset (unsigned index) +{ +void __iomem *base; + + base =owl_timer_get_base (index); +if (!base) +return ;
Same here, this test is pointless.
drivers/clocksource/owl-timer.c line 63
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+writel (0 , base + OWL_Tx_CTL); +writel (0 , base + OWL_Tx_VAL); +writel (0 , base + OWL_Tx_CMP); +}
I suggest:
static inline void owl_timer_reset(void __iomem *addr)
{
writel(0, addr + OWL_Tx_CTL);
writel(0, addr + OWL_Tx_VAL);
writel(0, addr + OWL_Tx_CMP);
}drivers/clocksource/owl-timer.c line 67
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+ +static u64 notrace owl_timer_sched_read(void) +{ +return (u64 )readl (owl_timer_get_base (0 ) + OWL_Tx_VAL);
return (u64)readl(owl_clksrc_base + OWL_Tx_VAL);
drivers/clocksource/owl-timer.c line 68
Quoted 2 lines
drivers/clocksource/owl-timer.c new file +2
-0+} +
static inline int owl_timer_set_state_disable(struct clock_event_device *evt)
{
return writel(0, owl_clkevt_base + OWL_Tx_CTL);
}drivers/clocksource/owl-timer.c line 72
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+static int owl_timer_set_state_shutdown (struct clock_event_device *evt) +{ +writel (0 ,owl_timer_get_base (0 ) + OWL_Tx_CTL);
return owl_timer_set_state_disable(evt);
drivers/clocksource/owl-timer.c line 79
Quoted 7 lines
drivers/clocksource/owl-timer.c new file +7
-0+ +return 0 ; +} + +static int owl_timer_set_state_oneshot (struct clock_event_device *evt) +{ +owl_timer_reset (1 );
Do you really need to do reset here ? Why not just owl_timer_set_state_disable(evt) ?
Quoted 117 lines
drivers/clocksource/owl-timer.c new file +113
-0+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_timer_get_base (1 ); + +writel (0 , base + OWL_Tx_CTL); + +writel (0 , base + OWL_Tx_VAL); +writel (evt, base + OWL_Tx_CMP); + +writel (OWL_Tx_CTL_EN | OWL_Tx_CTL_INTEN, base + OWL_Tx_CTL); + +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_timer_get_base (1 ) + OWL_Tx_CTL); + + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static const struct owl_timer_info s500_timer_info = { + .timer_offset[0 ] =0x08 , + .timer_offset[1 ] =0x14 , +}; + +static const struct of_device_id owl_timer_of_matches[] = { + { .compatible ="actions,s500-timer" , .data = &s500_timer_info }, + { } +}; + +static int __init owl_timer_init (struct device_node *node) +{ +const struct of_device_id *match; +struct clk *clk; +unsigned long rate; +int timer1_irq, i, ret; + + match =of_match_node (owl_timer_of_matches, node); +if (!match || !match->data) { +pr_err ("Unknown compatible" ); +return -EINVAL ; + } + + owl_timer_info = match->data; + + 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); + } + + 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); + +for (i =0 ; i < OWL_MAX_Tx; i++) +owl_timer_reset (i); + +writel (OWL_Tx_CTL_EN,owl_timer_get_base (0 ) + OWL_Tx_CTL); + +sched_clock_register (owl_timer_sched_read,32 , rate); +clocksource_mmio_init (owl_timer_get_base (0 ) + OWL_Tx_VAL, node->name, + rate,200 ,32 , clocksource_mmio_readl_up); + + 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);Signature · 1 line
2.10.2
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Andreas Färber
maintainerRe: [PATCH v3 04/25] clocksource: Add Owl timer
Am 28.02.2017 um 17:47 schrieb Daniel Lezcano:
Quoted 111 lines · Andreas F?rber
Quoted 110 lines
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.htmlSigned-off-by Andreas F?rber <[email protected]>---
v2 -> v3:
* Cleared interrupt pending flag for Timer1
* Adopted named interrupts for Timer1
* Extended commit message (Daniel)
* AdoptedBIT()macros (Daniel)
* AdoptedPTR_ERR()(Daniel)
* Adoptedrequest_irq()(Daniel)
* Factored timer reset out (Daniel)
* AdoptedCLOCK_EVT_FEAT_DYNIRQ(Daniel)
* Adopted clk input for rate (Daniel)
* Prepared for S900, adopting S500 DT compatiblev2: new
drivers/clocksource/Kconfig | 7 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/owl-timer.c | 193 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 drivers/clocksource/owl-timer.cdrivers/clocksource/Kconfig +7
-0@@ -107,6 +107,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_CLOCKEVENTSdrivers/clocksource/Makefile +1
-0@@ -53,6 +53,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.odrivers/clocksource/owl-timer.c new file +43
-0@@ -0,0 +1,193 @@ +/* +* 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) + +#define OWL_MAX_Tx 2 + +struct owl_timer_info { +int timer_offset[OWL_MAX_Tx]; +}; + +static const struct owl_timer_info *owl_timer_info; + +static void __iomem *owl_timer_base; +
Quoted 8 lines
drivers/clocksource/owl-timer.c line 47
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+static inline void __iomem *owl_timer_get_base (unsigned timer_nr) +{ +if (timer_nr >= OWL_MAX_Tx) +return NULL ;The driver is supposed to know what is doing.
owl_timer_get_basewon't be called with an invalid index. This test will have a cost as it is called fromowl_timer_sched_read.
OK
Quoted 5 lines
drivers/clocksource/owl-timer.c line 49
Quoted 2 lines
drivers/clocksource/owl-timer.c new file +2
-0+ +return owl_timer_base + owl_timer_info->timer_offset[timer_nr];Actually, you just need a clkevt base @ and a clocksource base @.
Quoted 8 lines
Instead of computing again and again the base, why not just precompute:
owl_clksrc_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER0] owl_clkevt_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER1]at init time.
And use these variables directly in the functions.
Either that, or revert to previous simpler behavior...
Quoted 11 lines
drivers/clocksource/owl-timer.c line 58
Quoted 9 lines
drivers/clocksource/owl-timer.c new file +9
-0+} + +static inline void owl_timer_reset (unsigned index) +{ +void __iomem *base; + + base =owl_timer_get_base (index); +if (!base) +return ;Same here, this test is pointless.
Seems like you didn't look at the following patch yet. It sets two S500 offsets as -1, i.e. non-existant, which then results in NULL here.
Quoted 7 lines
drivers/clocksource/owl-timer.c line 63
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+writel (0 , base + OWL_Tx_CTL); +writel (0 , base + OWL_Tx_VAL); +writel (0 , base + OWL_Tx_CMP); +}I suggest:
Quoted 6 lines
static inline void
owl_timer_reset(void __iomem *addr){ writel(0, addr + OWL_Tx_CTL); writel(0, addr + OWL_Tx_VAL); writel(0, addr + OWL_Tx_CMP); }
OK
Quoted 7 lines
drivers/clocksource/owl-timer.c line 67
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+ +static u64 notrace owl_timer_sched_read(void) +{ +return (u64 )readl (owl_timer_get_base (0 ) + OWL_Tx_VAL);return (u64)readl(owl_clksrc_base + OWL_Tx_VAL);
Quoted 7 lines
drivers/clocksource/owl-timer.c line 68
Quoted 2 lines
drivers/clocksource/owl-timer.c new file +2
-0+} +static inline int
owl_timer_set_state_disable(struct clock_event_device *evt){ return writel(0, owl_clkevt_base + OWL_Tx_CTL); }
That I don't like. Disabling is just setting a bit. We save a readl by just writing where we know it's safe. An API like this is not safe.
Quoted 6 lines
drivers/clocksource/owl-timer.c line 72
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+static int owl_timer_set_state_shutdown (struct clock_event_device *evt) +{ +writel (0 ,owl_timer_get_base (0 ) + OWL_Tx_CTL);return owl_timer_set_state_disable(evt);
Quoted 9 lines
drivers/clocksource/owl-timer.c line 79
Quoted 7 lines
drivers/clocksource/owl-timer.c new file +7
-0+ +return 0 ; +} + +static int owl_timer_set_state_oneshot (struct clock_event_device *evt) +{ +owl_timer_reset (1 );Do you really need to do reset here ? Why not just
owl_timer_set_state_disable(evt)?
Matches downstream, will consider changing.
Quoted 8 lines
Quoted 8 lines
drivers/clocksource/owl-timer.c new file +8
-0+return 0 ; +} + +static int owl_timer_tick_resume (struct clock_event_device *evt) +{ +return 0 ; +} +
Quoted 9 lines
drivers/clocksource/owl-timer.c line 96
Quoted 8 lines
drivers/clocksource/owl-timer.c new file +8
-0+static int owl_timer_set_next_event (unsigned long evt, +struct clock_event_device *ev) +{ +void __iomem *base =owl_timer_get_base (1 ); + +writel (0 , base + OWL_Tx_CTL); + +writel (0 , base + OWL_Tx_VAL);
Are you suggesting a while line here? The point was disable first, then initialize (2x), then activate. Maybe add comments instead?
Quoted 17 lines
Quoted 17 lines
drivers/clocksource/owl-timer.c new file +17
-0+writel (evt, base + OWL_Tx_CMP); + +writel (OWL_Tx_CTL_EN | OWL_Tx_CTL_INTEN, base + OWL_Tx_CTL); + +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, +};
Quoted 8 lines
drivers/clocksource/owl-timer.c line 121
Quoted 8 lines
drivers/clocksource/owl-timer.c new file +8
-0+ +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_timer_get_base (1 ) + OWL_Tx_CTL); + + evt->event_handler (evt);
Is there any guideline as to whether to clear such flag before or after?
Quoted 3 lines
drivers/clocksource/owl-timer.c line 124
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+ +return IRQ_HANDLED ; +}
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Re: [PATCH v3 04/25] clocksource: Add Owl timer
On Tue, Feb 28, 2017 at 06:08:06PM +0100, Andreas F?rber wrote:
[ ... ]
Quoted 10 lines
Quoted 8 lines
Instead of computing again and again the base, why not just precompute:
owl_clksrc_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER0] owl_clkevt_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER1]at init time.
And use these variables directly in the functions.
Either that, or revert to previous simpler behavior...
Not sure to get what the 'previous simpler behavior' is, but until it does not recompute the offset each time, I'm fine with that.
Quoted 12 lines
Quoted 11 lines
drivers/clocksource/owl-timer.c line 58
Quoted 9 lines
drivers/clocksource/owl-timer.c new file +9
-0+} + +static inline void owl_timer_reset (unsigned index) +{ +void __iomem *base; + + base =owl_timer_get_base (index); +if (!base) +return ;Same here, this test is pointless.
Quoted 2 lines
Seems like you didn't look at the following patch yet. It sets two S500 offsets as -1, i.e. non-existant, which then results in NULL here.
May be I missed something, but so far, the base addresses must be setup before reset is called, no?
Quoted 31 lines
Quoted 7 lines
drivers/clocksource/owl-timer.c line 63
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+writel (0 , base + OWL_Tx_CTL); +writel (0 , base + OWL_Tx_VAL); +writel (0 , base + OWL_Tx_CMP); +}I suggest:
Quoted 6 lines
static inline void
owl_timer_reset(void __iomem *addr){ writel(0, addr + OWL_Tx_CTL); writel(0, addr + OWL_Tx_VAL); writel(0, addr + OWL_Tx_CMP); }OK
Quoted 7 lines
drivers/clocksource/owl-timer.c line 67
Quoted 4 lines
drivers/clocksource/owl-timer.c new file +4
-0+ +static u64 notrace owl_timer_sched_read(void) +{ +return (u64 )readl (owl_timer_get_base (0 ) + OWL_Tx_VAL);return (u64)readl(owl_clksrc_base + OWL_Tx_VAL);Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+} +static inline int
owl_timer_set_state_disable(struct clock_event_device *evt){ return writel(0, owl_clkevt_base + OWL_Tx_CTL); }
Quoted 2 lines
That I don't like. Disabling is just setting a bit. We save a readl by just writing where we know it's safe. An API like this is not safe.
I don't get the point. Writing this simple function has the benefit to give the reader the information about the disabling register. Even if it does make sense for you, for me it has its purpose when I try to factor out different drivers code.
Quoted 36 lines
Quoted 6 lines
drivers/clocksource/owl-timer.c line 72
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+static int owl_timer_set_state_shutdown (struct clock_event_device *evt) +{ +writel (0 ,owl_timer_get_base (0 ) + OWL_Tx_CTL);return owl_timer_set_state_disable(evt);Quoted 9 lines
drivers/clocksource/owl-timer.c line 79
Quoted 7 lines
drivers/clocksource/owl-timer.c new file +7
-0+ +return 0 ; +} + +static int owl_timer_set_state_oneshot (struct clock_event_device *evt) +{ +owl_timer_reset (1 );Do you really need to do reset here ? Why not just
owl_timer_set_state_disable(evt)?Matches downstream, will consider changing.
Quoted 8 lines
Quoted 8 lines
drivers/clocksource/owl-timer.c new file +8
-0+return 0 ; +} + +static int owl_timer_tick_resume (struct clock_event_device *evt) +{ +return 0 ; +} +Quoted 9 lines
drivers/clocksource/owl-timer.c line 96
Quoted 8 lines
drivers/clocksource/owl-timer.c new file +8
-0+static int owl_timer_set_next_event (unsigned long evt, +struct clock_event_device *ev) +{ +void __iomem *base =owl_timer_get_base (1 ); + +writel (0 , base + OWL_Tx_CTL); + +writel (0 , base + OWL_Tx_VAL);
Quoted 2 lines
Are you suggesting a while line here? The point was disable first, then initialize (2x), then activate. Maybe add comments instead?
I meant, base + OWL_Tx_CTL and base + OWL_Tx_VAL are set to zero since the beginning. If their values do not change, it is not necessary to set their values to zero again.
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/clocksource/owl-timer.c new file +19
-0+writel (evt, base + OWL_Tx_CMP); + +writel (OWL_Tx_CTL_EN | OWL_Tx_CTL_INTEN, base + OWL_Tx_CTL); + +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)
Quoted 8 lines
Quoted 6 lines
drivers/clocksource/owl-timer.c line 121
Quoted 6 lines
drivers/clocksource/owl-timer.c new file +6
-0+{ +struct clock_event_device *evt = (struct clock_event_device *)dev_id; + +writel (OWL_Tx_CTL_PD,owl_timer_get_base (1 ) + OWL_Tx_CTL); + + evt->event_handler (evt);Is there any guideline as to whether to clear such flag before or after?
Mmh, good question. I'm not sure it makes a different.
Quoted 11 lines
Quoted 3 lines
drivers/clocksource/owl-timer.c line 124
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+ +return IRQ_HANDLED ; +}Regards,
AndreasSignature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Andreas Färber
maintainerRe: [PATCH v3 04/25] clocksource: Add Owl timer
Am 28.02.2017 um 18:39 schrieb Daniel Lezcano:
Quoted 6 lines · Andreas F?rber
Quoted 5 lines
Quoted 5 lines
Instead of computing again and again the base, why not just precompute:
owl_clksrc_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER0] owl_clkevt_base = owl_timer_base + owl_timer_info->timer_offset[OWL_TIMER1]
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
at init time.
And use these variables directly in the functions.
Either that, or revert to previous simpler behavior...
Not sure to get what the 'previous simpler behavior' is,
v2. :)
Quoted 15 lines
but until it does not
recompute the offset each time, I'm fine with that.Quoted 12 lines
Quoted 11 lines
drivers/clocksource/owl-timer.c line 58
Quoted 9 lines
drivers/clocksource/owl-timer.c new file +9
-0+} + +static inline void owl_timer_reset (unsigned index) +{ +void __iomem *base; + + base =owl_timer_get_base (index); +if (!base) +return ;Same here, this test is pointless.
Quoted 5 lines
Quoted 2 lines
Seems like you didn't look at the following patch yet. It sets two S500 offsets as -1, i.e. non-existant, which then results in NULL here.
May be I missed something, but so far, the base addresses must be setup before reset is called, no?
They are known in advance, yes. Where/how we set them up is the culprit.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
static inline int
owl_timer_set_state_disable(struct clock_event_device *evt){ return writel(0, owl_clkevt_base + OWL_Tx_CTL); }
Quoted 7 lines
Quoted 2 lines
That I don't like. Disabling is just setting a bit. We save a readl by just writing where we know it's safe. An API like this is not safe.
I don't get the point. Writing this simple function has the benefit to give the reader the information about the disabling register. Even if it does make sense for you, for me it has its purpose when I try to factor out different drivers code.
I mean a proper _disable() function would need to do:
val = readl()
val &= ~bit;
writel(val)
Not just writel(0), overwriting any other bits. Therefore an inline write would be faster - your concern elsewhere. I'll happily implement the proper API if you prefer.
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
drivers/clocksource/owl-timer.c line 72
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+static int owl_timer_set_state_shutdown (struct clock_event_device *evt) +{ +writel (0 ,owl_timer_get_base (0 ) + OWL_Tx_CTL);return owl_timer_set_state_disable(evt);Quoted 12 lines
drivers/clocksource/owl-timer.c new file +11
-0+ +return 0 ; +} +static int owl_timer_set_next_event (unsigned long evt, +struct clock_event_device *ev) +{ +void __iomem *base =owl_timer_get_base (1 ); + +writel (0 , base + OWL_Tx_CTL); + +writel (0 , base + OWL_Tx_VAL);
Quoted 6 lines
Quoted 2 lines
Are you suggesting a while line here? The point was disable first, then initialize (2x), then activate. Maybe add comments instead?
I meant, base +
OWL_Tx_CTLand base +OWL_Tx_VALare set to zero since the beginning. If their values do not change, it is not necessary to set their values to zero again.
This is a callback, which I thought is re-entrant. VAL changes when the timer is running, and CTL changes every time we enable the timer. We could call _reset() here, but then we would be initializing CMP twice, which again would be less performant then just setting the registers to their final values directly.
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/clocksource/owl-timer.c new file +19
-0+writel (evt, base + OWL_Tx_CMP); + +writel (OWL_Tx_CTL_EN | OWL_Tx_CTL_INTEN, base + OWL_Tx_CTL); + +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)Quoted 8 lines
Quoted 6 lines
drivers/clocksource/owl-timer.c line 121
Quoted 6 lines
drivers/clocksource/owl-timer.c new file +6
-0+{ +struct clock_event_device *evt = (struct clock_event_device *)dev_id; + +writel (OWL_Tx_CTL_PD,owl_timer_get_base (1 ) + OWL_Tx_CTL); + + evt->event_handler (evt);Is there any guideline as to whether to clear such flag before or after?
Quoted 5 lines
Mmh, good question. I'm not sure it makes a different.
Quoted 3 lines
Quoted 3 lines
drivers/clocksource/owl-timer.c line 124
Quoted 3 lines
drivers/clocksource/owl-timer.c new file +3
-0+ +return IRQ_HANDLED ; +}
Thanks,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Re: [PATCH v3 04/25] clocksource: Add Owl timer
Quoted 1 line · Andreas F?rber
This is a callback, which I thought is re-entrant.
It's not reentrant at least not on the same CPU. On a SMP machine this function might be called concurrently on several cores (assumed that the whole thing is replicated across cores).
Quoted 4 lines
VAL changes when the timer is running, and CTL changes every time we enable the timer. We could call
_reset()here, but then we would be initializing CMP twice, which again would be less performant then just setting the registers to their final values directly.
Makes sense.
Thanks,
tglx
Re: [PATCH v3 04/25] clocksource: Add Owl timer
In reply to Daniel LezcanoQuoted 11 lines · Daniel Lezcano
Quoted 9 lines · Andreas F?rber
Quoted 7 lines
drivers/clocksource/owl-timer.c line 121
Quoted 7 lines
drivers/clocksource/owl-timer.c new file +7
-0+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_timer_get_base (1 ) + OWL_Tx_CTL); + + evt->event_handler (evt);Is there any guideline as to whether to clear such flag before or after?
Quoted 1 line
Mmh, good question. I'm not sure it makes a different.
It makes a difference depending on what this flag does. If it clears the current pending interrupt, then you _must_ do it before rearming the timer. Otherwise you might clear the pending interrupt of the rearmed timer (when the timeout is very small) which makes the machine wait forever for the next timer interrupt.
Thanks,
tglx
Andreas Färber
maintainerPATCH v3 5/25 clocksource: owl: Add S900 support
In reply to Andreas FärberThe Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz timers.
Deal with the S500 having less timers.
An S900 datasheet can be found in 96Boards documentation:
https://github.com/96boards/documentation/blob/master/ConsumerEdition/Bubblegum-96/HardwareDocs/SoC_bubblegum96.pdf
---
v3: new
drivers/clocksource/owl-timer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/clocksource/owl-timer.c +14 -2
@@ -31,7 +31,7 @@#define OWL_Tx_CTL_INTEN BIT(1)#define OWL_Tx_CTL_EN BIT(2) -#define OWL_MAX_Tx 2 +#define OWL_MAX_Tx 4struct owl_timer_info {int timer_offset[OWL_MAX_Tx];
@@ -43,7 +43,8 @@ static void __iomem *owl_timer_base;static inline void __iomem *owl_timer_get_base (unsigned timer_nr) { -if (timer_nr >= OWL_MAX_Tx) +if (timer_nr >= OWL_MAX_Tx || + owl_timer_info->timer_offset[timer_nr] ==-1 )return NULL ;return owl_timer_base + owl_timer_info->timer_offset[timer_nr];
@@ -126,10 +127,20 @@ static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id)static const struct owl_timer_info s500_timer_info = { .timer_offset[0 ] =0x08 , .timer_offset[1 ] =0x14 , + .timer_offset[2 ] =-1 , + .timer_offset[3 ] =-1 , +}; + +static const struct owl_timer_info s900_timer_info = { + .timer_offset[0 ] =0x08 , + .timer_offset[1 ] =0x14 , + .timer_offset[2 ] =0x30 , + .timer_offset[3 ] =0x3c , };static const struct of_device_id owl_timer_of_matches[] = { { .compatible ="actions,s500-timer" , .data = &s500_timer_info }, + { .compatible ="actions,s900-timer" , .data = &s900_timer_info }, { } };
@@ -191,3 +202,4 @@ static int __init owl_timer_init(struct device_node *node)return 0 ; }CLOCKSOURCE_OF_DECLARE (owl_s500,"actions,s500-timer" , owl_timer_init); +CLOCKSOURCE_OF_DECLARE (owl_s900,"actions,s900-timer" , owl_timer_init);
Signature · 1 line
2.10.2
Andreas Färber
maintainerRe: [PATCH v3 05/25] clocksource: owl: Add S900 support
Daniel,
Am 28.02.2017 um 07:35 schrieb Andreas F?rber:
Quoted 9 lines
The Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz timers.
Deal with the S500 having less timers.
An S900 datasheet can be found in 96Boards documentation:
https://github.com/96boards/documentation/blob/master/ConsumerEdition/Bubblegum-96/HardwareDocs/SoC_bubblegum96.pdfSigned-off-by Andreas F?rber <[email protected]>
[...]
Quoted 4 lines
drivers/clocksource/owl-timer.c +0
-0@@ -126,10 +127,20 @@ static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id)static const struct owl_timer_info s500_timer_info = { .timer_offset[0 ] =0x08 , .timer_offset[1 ] =0x14 ,
drivers/clocksource/owl-timer.c static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id) · line 139
Quoted 10 lines
drivers/clocksource/owl-timer.c +9
-0+ .timer_offset[2] = -1, + .timer_offset[3] = -1, +}; + +static const struct owl_timer_info s900_timer_info = { + .timer_offset[0 ] =0x08 , + .timer_offset[1 ] =0x14 , + .timer_offset[2 ] =0x30 , + .timer_offset[3 ] =0x3c , };
I noticed later that the S900 manual describes TIMER2/3 as "used only in Secure mode". My driver code resetting them seems to work though.
Should we just drop these extra timer initializations then to make the driver simpler and more performant again? I'd still like to keep the two compatible strings in the DT though, and we may want to disable the 2Hz timers on S500 just in case.
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Re: [PATCH v3 05/25] clocksource: owl: Add S900 support
Quoted 31 lines · Andreas F?rber
Daniel,
Am 28.02.2017 um 07:35 schrieb Andreas F?rber:
Quoted 9 lines
The Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz timers.
Deal with the S500 having less timers.
An S900 datasheet can be found in 96Boards documentation:
https://github.com/96boards/documentation/blob/master/ConsumerEdition/Bubblegum-96/HardwareDocs/SoC_bubblegum96.pdfSigned-off-by Andreas F?rber <[email protected]>[...]
Quoted 4 lines
drivers/clocksource/owl-timer.c +0
-0@@ -126,10 +127,20 @@ static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id)static const struct owl_timer_info s500_timer_info = { .timer_offset[0 ] =0x08 , .timer_offset[1 ] =0x14 ,drivers/clocksource/owl-timer.c static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id) · line 139
Quoted 10 lines
drivers/clocksource/owl-timer.c +9
-0+ .timer_offset[2] = -1, + .timer_offset[3] = -1, +}; + +static const struct owl_timer_info s900_timer_info = { + .timer_offset[0 ] =0x08 , + .timer_offset[1 ] =0x14 , + .timer_offset[2 ] =0x30 , + .timer_offset[3 ] =0x3c , };I noticed later that the S900 manual describes TIMER2/3 as "used only in Secure mode". My driver code resetting them seems to work though.
Quoted 4 lines
Should we just drop these extra timer initializations then to make the driver simpler and more performant again? I'd still like to keep the two compatible strings in the DT though, and we may want to disable the 2Hz timers on S500 just in case.
Yes, makes sense.
Quoted 4 lines
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Andreas Färber
maintainerPATCH v3 6/25 ARM: Prepare Actions Semi S500
In reply to Andreas FärberAdd ARCH_ACTIONS and mach-actions/owl.c for "actions,s500".
---
v2 -> v3:
* Selected AMBA, global timer, TWD drivers
* Fixed copy&paste in machine definition (Alberto)
v1 -> v2:
* Renamed ARCH_OWL to ARCH_ACTION (Arnd)
* Renamed mach-owl to mach-actions, leaving owl.c
* Adopted "actions" vendor prefix
* Selected new clocksource driver
arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 1 + arch/arm/mach-actions/Kconfig | 15 +++++++++++++++ arch/arm/mach-actions/Makefile | 1 + arch/arm/mach-actions/owl.c | 28 ++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+) create mode 100644 arch/arm/mach-actions/Kconfig create mode 100644 arch/arm/mach-actions/Makefile create mode 100644 arch/arm/mach-actions/owl.c
arch/arm/Kconfig +2 -0
@@ -720,6 +720,8 @@ config ARCH_VIRT # source "arch/arm/mach-mvebu/Kconfig" +source "arch/arm/mach-actions/Kconfig" + source "arch/arm/mach-alpine/Kconfig" source "arch/arm/mach-artpec/Kconfig"
arch/arm/Makefile +1 -0
@@ -151,6 +151,7 @@ textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 # Machine directory name. This list is sorted alphanumerically # by CONFIG_* macro name. +machine-$(CONFIG_ARCH_ACTIONS) += actions machine-$(CONFIG_ARCH_ALPINE) += alpine machine-$(CONFIG_ARCH_ARTPEC) += artpec machine-$(CONFIG_ARCH_AT91) += at91
arch/arm/mach-actions/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +menuconfig ARCH_ACTIONS + bool "Actions Semi SoCs" + depends on ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GIC + select ARM_GLOBAL_TIMER + select CACHE_L2X0 + select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK + select COMMON_CLK + select GENERIC_IRQ_CHIP + select HAVE_ARM_SCU if SMP + select HAVE_ARM_TWD if SMP + select OWL_TIMER + help + This enables support for the Actions Semiconductor S500 SoC family.
arch/arm/mach-actions/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_ACTIONS) += owl.o
arch/arm/mach-actions/owl.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright (C) 2017 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. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +*/ + +#include <linux/of_platform.h> +#include <asm/mach/arch.h> + +static const char *const owl_dt_compat[] = { +"actions,s500" , +NULL +}; + +DT_MACHINE_START (OWL ,"Actions Semi Owl platform" ) + .dt_compat = owl_dt_compat, + .l2c_aux_val = 0, + .l2c_aux_mask = ~0 , +MACHINE_END
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 7/25 ARM64: Prepare Actions Semi S900
In reply to Andreas FärberAdd ARCH_ACTIONS.
---
v2 -> v3:
* Selected clocksource driver
v1 -> v2:
* Renamed ARCH_OWL to ARCH_ACTION (Arnd)
arch/arm64/Kconfig.platforms | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/Kconfig.platforms +6 -0
@@ -1,5 +1,11 @@ menu "Platform selection" +config ARCH_ACTIONS + bool "Actions Semi Platforms" + select OWL_TIMER + help + This enables support for the Actions Semiconductor S900 SoC family. + config ARCH_SUNXI bool "Allwinner sunxi 64-bit SoC Family" select GENERIC_IRQ_CHIP
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 8/25 dt-bindings: serial: Document Actions Semi Owl UARTs
In reply to Andreas FärberThis UART is found on S500 and S900 SoCs.
---
v2 -> v3: unchanged
v1 -> v2:
* Adopted "actions" vendor prefix
.../devicetree/bindings/serial/actions,owl-uart.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/actions,owl-uart.txt
Documentation/devicetree/bindings/serial/actions,owl-uart.txt new file +16 -0
@@ -0,0 +1,16 @@ +Actions Semi Owl UART + +Required properties: +- compatible : "actions,s500-uart", "actions,owl-uart" for S500 + "actions,s900-uart", "actions,owl-uart" for S900 +- reg : Offset and length of the register set for the device. +- interrupts : Should contain UART interrupt. + + +Example: + + uart3: serial at b0126000 { + compatible = "actions,s500-uart", "actions,owl-uart"; + reg = <0xb0126000 0x1000>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 9/25 tty: serial: Add Actions Semi Owl UART earlycon
In reply to Andreas FärberThis implements an earlycon for Actions Semi S500/S900 SoCs.
Based on LeMaker linux-actions tree.
---
v2 -> v3:
* Adopted BIT() macro
v1 -> v2:
* Extended Kconfig help to mention earlycon (Arnd)
* Spelled out Actions Semiconductor in Kconfig help
* Adopted "actions" vendor prefix
drivers/tty/serial/Kconfig | 19 ++++++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/owl-uart.c | 135 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 drivers/tty/serial/owl-uart.c
drivers/tty/serial/Kconfig +19 -0
@@ -1677,6 +1677,25 @@ config SERIAL_MVEBU_CONSOLE and warnings and which allows logins in single user mode) Otherwise, say 'N'. +config SERIAL_OWL + bool "Actions Semi Owl serial port support" + depends on ARCH_ACTIONS || COMPILE_TEST + select SERIAL_CORE + help + This driver is for Actions Semiconductor S500/S900 SoC's UART. + Say 'Y' here if you wish to use the on-board serial port. + Otherwise, say 'N'. + +config SERIAL_OWL_CONSOLE + bool "Console on Actions Semi Owl serial port" + depends on SERIAL_OWL=y + select SERIAL_CORE_CONSOLE + select SERIAL_EARLYCON + default y + help + Say 'Y' here if you wish to use Actions Semiconductor S500/S900 UART + as the system console. Only earlycon is implemented currently. + endmenu config SERIAL_MCTRL_GPIO
drivers/tty/serial/Makefile +1 -0
@@ -91,6 +91,7 @@ obj-$(CONFIG_SERIAL_STM32) += stm32-usart.o obj-$(CONFIG_SERIAL_MVEBU_UART) += mvebu-uart.o obj-$(CONFIG_SERIAL_PIC32) += pic32_uart.o obj-$(CONFIG_SERIAL_MPS2_UART) += mps2-uart.o +obj-$(CONFIG_SERIAL_OWL) += owl-uart.o # GPIOLIB helpers for modem control lines obj-$(CONFIG_SERIAL_MCTRL_GPIO) += serial_mctrl_gpio.o
drivers/tty/serial/owl-uart.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 10/25 Documentation: kernel-parameters: Document owl earlycon
In reply to Andreas Färber---
v1 -> v2 -> v3: unchanged
Documentation/admin-guide/kernel-parameters.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +6 -0
@@ -943,6 +943,12 @@ must already be setup and configured. Options are not yet supported. + owl,<addr> + Start an early, polled-mode console on an Owl serial + port at the specified address. The serial port must + already be setup and configured. Options are not yet + supported. + smh Use ARM semihosting calls for early console. s3c2410,<addr>
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 11/25 ARM: dts: Add Actions Semi S500 and LeMaker Guitar
In reply to Andreas Färber---
v2 -> v3:
* Fixed uart2 reg offset
* Enlarged timer reg size
* Added 2 Hz timer interrupts, interrupt-names
* Disabled CPUs 1-3 for now (cf. later patches)
* Added Cortex-A9 SCU, global timer, TWD timer/wdt nodes
* Added HOSC clock for timer
v1 -> v2:
* Reworded subject
* Updated ARCH_OWL to ARCH_ACTIONS (Arnd)
* Adopted "actions" vendor prefix
* Dropped irq.h include
* Added memory at 0 node for Guitar SoM
* Dropped bogus uart3 clock-frequency
* Added device_type for CPU nodes
* Fixed UART reg size
* Adopted SPDX-License-Identifier (Rob)
* Added remaining UART nodes
* Added timer node
arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/s500-guitar-bb-rev-b.dts | 26 +++++ arch/arm/boot/dts/s500-guitar.dtsi | 24 ++++ arch/arm/boot/dts/s500.dtsi | 170 +++++++++++++++++++++++++++++ 4 files changed, 222 insertions(+) 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
arch/arm/boot/dts/Makefile +2 -0
@@ -638,6 +638,8 @@ dtb-$(CONFIG_ARCH_ORION5X) += \ orion5x-maxtor-shared-storage-2.dtb \ orion5x-netgear-wnr854t.dtb \ orion5x-rd88f5182-nas.dtb +dtb-$(CONFIG_ARCH_ACTIONS) += \ + s500-guitar-bb-rev-b.dtb dtb-$(CONFIG_ARCH_PRIMA2) += \ prima2-evb.dtb dtb-$(CONFIG_ARCH_OXNAS) += \
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts new file +26 -0
@@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016-2017 Andreas F?rber + * + * SPDX-License-Identifier: (GPL-2.0+ OR MIT) + */ + +/dts-v1/; + +#include "s500-guitar.dtsi" + +/ { + compatible = "lemaker,guitar-bb-rev-b", "lemaker,guitar", "actions,s500"; + model = "LeMaker Guitar Base Board rev. B"; + + aliases { + serial3 = &uart3; + }; + + chosen { + stdout-path = "serial3:115200n8"; + }; +}; + +&uart3 { + status = "okay"; +};
arch/arm/boot/dts/s500-guitar.dtsi new file +24 -0
@@ -0,0 +1,24 @@ +/* + * LeMaker Guitar SoM + * + * Copyright (c) 2016-2017 Andreas F?rber + * + * SPDX-License-Identifier: (GPL-2.0+ OR MIT) + */ + +#include "s500.dtsi" + +/ { + compatible = "lemaker,guitar", "actions,s500"; + + /delete-node/ memory; + + memory at 0 { + device_type = "memory"; + reg = <0x0 0x40000000>; + }; +}; + +&timer { + clocks = <&hosc>; +};
arch/arm/boot/dts/s500.dtsi new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
2.10.2
Mark Rutland
reviewerRe: [PATCH v3 11/25] ARM: dts: Add Actions Semi S500 and LeMaker Guitar
Hi,
Quoted 17 lines · Andreas F?rber
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts new file +17
-0+/dts-v1/; + +#include "s500-guitar.dtsi" + +/ { + compatible = "lemaker,guitar-bb-rev-b", "lemaker,guitar", "actions,s500"; + model = "LeMaker Guitar Base Board rev. B"; + + aliases { + serial3 = &uart3; + }; + + chosen { + stdout-path = "serial3:115200n8"; + }; +}; +
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts
Quoted 10 lines
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts new file +9
-0+&uart3 { + status = "okay"; +}; +#include "s500.dtsi" + +/ { + compatible = "lemaker,guitar", "actions,s500"; + + /delete-node/ memory;
Eww. Is this just bodging around skeleton.dtsi?
arch/arm/boot/dts/s500-guitar.dtsi
Quoted 8 lines
arch/arm/boot/dts/s500-guitar.dtsi new file +7
-0+ + memory at 0 { + device_type = "memory"; + reg = <0x0 0x40000000>; + }; +}; +#include "skeleton.dtsi"
Please don't include skeleton.dtsi. Please add the relevant nodes and properties explciitly to your dts{i,} files.
arch/arm/boot/dts/s500.dtsi line 13
Quoted 4 lines
arch/arm/boot/dts/s500.dtsi new file +4
-0+ +#include <dt-bindings/interrupt-controller/arm-gic.h> + +/ {
Please define your #address-cells and #size-cells here.
If you want, add an empty /chosen node (not strictly necessary since your dts file has a non-empty one anyhow).
Thanks,
Mark.
Andreas Färber
maintainerRe: [PATCH v3 11/25] ARM: dts: Add Actions Semi S500 and LeMaker Guitar
Hi Mark,
Am 28.02.2017 um 13:32 schrieb Mark Rutland:
Quoted 22 lines · Andreas F?rber
Quoted 20 lines
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts new file +20
-0+/dts-v1/; + +#include "s500-guitar.dtsi" + +/ { + compatible = "lemaker,guitar-bb-rev-b", "lemaker,guitar", "actions,s500"; + model = "LeMaker Guitar Base Board rev. B"; + + aliases { + serial3 = &uart3; + }; + + chosen { + stdout-path = "serial3:115200n8"; + }; +}; + +&uart3 { + status = "okay"; +};
Quoted 8 lines
arch/arm/boot/dts/s500-guitar.dtsi line 14
Quoted 6 lines
arch/arm/boot/dts/s500-guitar.dtsi new file +6
-0+#include "s500.dtsi" + +/ { + compatible = "lemaker,guitar", "actions,s500"; + + /delete-node/ memory;Eww. Is this just bodging around
skeleton.dtsi?
I guess so: Working around its hardcoded name without unit address, not finding a /rename-node/ to that effect.
Quoted 10 lines
arch/arm/boot/dts/s500-guitar.dtsi
Quoted 8 lines
arch/arm/boot/dts/s500-guitar.dtsi new file +7
-0+ + memory at 0 { + device_type = "memory"; + reg = <0x0 0x40000000>; + }; +}; +#include "skeleton.dtsi"Please don't include
skeleton.dtsi.
Wasn't aware that was permissible. I now see it has been updated with a textual comment, which predates my past uses of skeleton.dtsi - for other pending work such as FM4 and XMC4500 I only noticed it was moved out of armv7m.dtsi so that dtc started spewing scary messages. ;)
A #warning might be a more effective way to make people aware of its deprecation - but sadly we have users that predate #include:
$ git grep /include/ -- arch/arm/boot/dts/ | grep skeleton.dtsi | wc --lines 32 $ git grep /include/ -- arch/arm/boot/dts/ | grep skeleton64.dtsi | wc --lines 0 $ git grep skeleton -- arch/arm/boot/dts/ | wc --lines 117
Might updating those 32 users be a suitable Outreachy project (CC'ed), to then get the remaining 85 occurrences to be eliminated by their maintainers, so that it doesn't get copied for new SoCs any more? :)
Quoted 2 lines
Please add the relevant nodes and
properties explciitly to your dts{i,} files.
Great, will do.
But this series has grown too large to resend just for such nits. Is there a chance we can get initial patches queued on some arm-soc for-next branch soonish? It seems -rc1 pulls were merged 5 days ago?
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Mark Rutland
reviewerRe: [PATCH v3 11/25] ARM: dts: Add Actions Semi S500 and LeMaker Guitar
Quoted 15 lines · Andreas F?rber
Am 28.02.2017 um 13:32 schrieb Mark Rutland:
Quoted 5 lines · Andreas F?rber
Quoted 2 lines
+#include "
skeleton.dtsi"Please don't include
skeleton.dtsi.Wasn't aware that was permissible. I now see it has been updated with a textual comment, which predates my past uses of
skeleton.dtsi- for other pending work such as FM4 and XMC4500 I only noticed it was moved out ofarmv7m.dtsiso that dtc started spewing scary messages. ;)A #warning might be a more effective way to make people aware of its deprecation - but sadly we have users that predate #include:
Quoted 7 lines
$ git grep /include/ -- arch/arm/boot/dts/ | grep skeleton.dtsi | wc --lines 32 $ git grep /include/ -- arch/arm/boot/dts/ | grep skeleton64.dtsi | wc --lines 0 $ git grep skeleton -- arch/arm/boot/dts/ | wc --lines 117
I deliberately didn't go that route, since people would blindly fix up the warning and mess it up (e.g. forgetting to add the required nodes).
While it should be avoided for new dts, it's largely not problematic for old dts, and we can fix those up at our leisure.
Quoted 8 lines
Quoted 2 lines
Please add the relevant nodes and
properties explciitly to your dts{i,} files.Great, will do.
But this series has grown too large to resend just for such nits. Is there a chance we can get initial patches queued on some arm-soc for-next branch soonish? It seems -rc1 pulls were merged 5 days ago?
There seem to be other comments on this series, and I was under the impression that arm-soc generally pulled branches.
Even if you're not going to repost, surely you can fold in the fixup before sending the pull request?
Thanks,
Mark.
Andreas Färber
maintainerPATCH v3 12/25 dt-bindings: Add vendor prefix for uCRobotics
In reply to Andreas Färber---
v1 -> v2 -> v3: unchanged
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -320,6 +320,7 @@ tronfy Tronfy tronsmart Tronsmart truly Truly Semiconductors Limited tyan Tyan Computer Corporation +ucrobotics uCRobotics udoo Udoo uniwest United Western Technologies Corp (UniWest) upisemi uPI Semiconductor Corp.
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 13/25 dt-bindings: arm: Document Actions Semi S900
In reply to Andreas FärberThe Actions Semi S900 is a quad-core ARM Cortex-A53 SoC.
The Bubblegum-96 is a 96Boards Consumer Edition compliant board (4/96).
---
v2 -> v3: unchanged
v1 -> v2:
* Adopted "actions" vendor prefix
* Extended text
Documentation/devicetree/bindings/arm/actions.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Documentation/devicetree/bindings/arm/actions.txt +15 -0
@@ -22,3 +22,18 @@ Boards: Root node property compatible must contain, depending on board: - LeMaker Guitar Base Board rev. B: "lemaker,guitar-bb-rev-b", "lemaker,guitar" + + +S900 SoC +======== + +Required root node properties: + +- compatible : must contain "actions,s900" + + +Boards: + +Root node property compatible must contain, depending on board: + + - uCRobotics Bubblegum-96: "ucrobotics,bubblegum-96"
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 14/25 ARM64: dts: Add Actions Semi S900 and Bubblegum-96
In reply to Andreas FärberUART0/1/4/6 interrupts are guesses.
---
v2 -> v3:
* Added remaining UART nodes -- some interrupts are guesses
* Added timer node -- only TIMER1 interrupt known
v1 -> v2:
* Reworded subject
* Added memory at 0 node for Bubblegum-96 (Mark)
* Filled in reserved-memory sub-node for Bubblegum-96 (Mark)
* Added arm-pmu interrupt-affinity property (Mark)
* Changed second GIC reg size 0x1000 -> 0x2000 for Bubblegum-96 (Mark)
* Updated ARCH_OWL to ARCH_ACTIONS (Arnd)
* Renamed s900-bubblegum96.dts to s900-bubblegum-96.dts
* Adopted "actions" vendor prefix
* Dropped irq.h include
* Adopted SPDX-License-Identifier (Rob)
arch/arm64/boot/dts/Makefile | 1 + arch/arm64/boot/dts/actions/Makefile | 5 + arch/arm64/boot/dts/actions/s900-bubblegum-96.dts | 35 +++++ arch/arm64/boot/dts/actions/s900.dtsi | 164 ++++++++++++++++++++++ 4 files changed, 205 insertions(+) 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
arch/arm64/boot/dts/Makefile +1 -0
@@ -1,3 +1,4 @@ +dts-dirs += actions dts-dirs += al dts-dirs += allwinner dts-dirs += altera
arch/arm64/boot/dts/actions/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +dtb-$(CONFIG_ARCH_ACTIONS) += s900-bubblegum-96.dtb + +always := $(dtb-y) +subdir-y := $(dts-dirs) +clean-files := *.dtb
arch/arm64/boot/dts/actions/s900-bubblegum-96.dts new file +35 -0
@@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017 Andreas F?rber + * + * SPDX-License-Identifier: (GPL-2.0+ OR MIT) + */ + +/dts-v1/; + +#include "s900.dtsi" + +/ { + compatible = "ucrobotics,bubblegum-96", "actions,s900"; + model = "Bubblegum-96"; + + aliases { + serial5 = &uart5; + }; + + chosen { + stdout-path = "serial5:115200n8"; + }; + + memory at 0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x80000000>; + }; +}; + +&timer { + clocks = <&hosc>; +}; + +&uart5 { + status = "okay"; +};
arch/arm64/boot/dts/actions/s900.dtsi new file +164 -0
164 lines not on this page · raw message
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 15/25 MAINTAINERS: Add Actions Semi Owl section
In reply to Andreas Färber---
v2 -> v3: unchanged
v2: new
MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
@@ -1026,6 +1026,16 @@ S: Maintained F: drivers/amba/ F: include/linux/amba/bus.h +ARM/ACTIONS SEMI ARCHITECTURE +M: Andreas F?rber <[email protected]> +L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) +S: Maintained +N: owl +F: arch/arm/mach-actions/ +F: arch/arm/boot/dts/s500* +F: arch/arm64/boot/dts/actions/ +F: Documentation/devicetree/bindings/arm/actions.txt + ARM/ADS SPHERE MACHINE SUPPORT M: Lennert Buytenhek <[email protected]> L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 16/25 tty: serial: owl: Implement console driver
In reply to Andreas FärberImplement serial console driver to complement earlycon.
Based on LeMaker linux-actions tree.
---
v2 -> v3:
* Adopted BIT() macro
* Implemented baudrate setting
v2: new
drivers/tty/serial/Kconfig | 4 +- drivers/tty/serial/owl-uart.c | 591 ++++++++++++++++++++++++++++++++++++++- include/uapi/linux/serial_core.h | 3 + 3 files changed, 595 insertions(+), 3 deletions(-)
drivers/tty/serial/Kconfig +2 -2
@@ -1678,7 +1678,7 @@ config SERIAL_MVEBU_CONSOLE Otherwise, say 'N'. config SERIAL_OWL - bool "Actions Semi Owl serial port support" + tristate "Actions Semi Owl serial port support" depends on ARCH_ACTIONS || COMPILE_TEST select SERIAL_CORE help
@@ -1694,7 +1694,7 @@ config SERIAL_OWL_CONSOLE default y help Say 'Y' here if you wish to use Actions Semiconductor S500/S900 UART - as the system console. Only earlycon is implemented currently. + as the system console. endmenu
drivers/tty/serial/owl-uart.c +590 -1
634 lines not on this page · raw message
include/uapi/linux/serial_core.h +3 -0
@@ -271,4 +271,7 @@/* MPS2 UART */ #define PORT_MPS2UART 116 +/* Actions Semi Owl UART */ +#define PORT_OWL 117 +#endif /* _UAPILINUX_SERIAL_CORE_H */
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 17/25 ARM64: dts: actions: s900-bubblegum-96: Add fake uart5 clock
In reply to Andreas FärberGive the serial driver a fixed-clock as input for baudrate 115200.
---
v2 -> v3: unchanged
v2: new
arch/arm64/boot/dts/actions/s900-bubblegum-96.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/actions/s900-bubblegum-96.dts +7 -0
@@ -24,6 +24,12 @@ device_type = "memory"; reg = <0x0 0x0 0x0 0x80000000>; }; + + uart5_clk: uart5-clk { + compatible = "fixed-clock"; + clock-frequency = <921600>; + #clock-cells = <0>; + }; }; &timer {
@@ -32,4 +38,5 @@ &uart5 { status = "okay"; + clocks = <&uart5_clk>; };
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 18/25 ARM: dts: s500-guitar-bb-rev-b: Add fake uart3 clock
In reply to Andreas FärberAdd a fixed-clock for baudrate 115200.
---
v2 -> v3: unchanged
v2: new
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/s500-guitar-bb-rev-b.dts +7 -0
@@ -19,8 +19,15 @@ chosen { stdout-path = "serial3:115200n8"; }; + + uart3_clk: uart3-clk { + compatible = "fixed-clock"; + clock-frequency = <921600>; + #clock-cells = <0>; + }; }; &uart3 { status = "okay"; + clocks = <&uart3_clk>; };
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 19/25 dt-bindings: arm: cpus: Add S500 enable-method
In reply to Andreas FärberThe Actions Semi S500 SoC requires a special secondary CPU boot procedure.
---
v3: new
Documentation/devicetree/bindings/arm/cpus.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/cpus.txt +1 -0
@@ -192,6 +192,7 @@ nodes to be present and contain the properties described below. "spin-table" # On ARM 32-bit systems this property is optional and can be one of: + "actions,s500-smp" "allwinner,sun6i-a31" "allwinner,sun8i-a23" "arm,realview-smp"
Signature · 1 line
2.10.2
Re: [PATCH v3 19/25] dt-bindings: arm: cpus: Add S500 enable-method
Quoted 8 lines · Andreas F?rber
The Actions Semi S500 SoC requires a special secondary CPU boot procedure.
Signed-off-by Andreas F?rber <[email protected]>---
v3: newDocumentation/devicetree/bindings/arm/cpus.txt | 1 + 1 file changed, 1 insertion(+)
Andreas Färber
maintainerPATCH v3 20/25 ARM: owl: Implement CPU enable-method for S500
In reply to Andreas FärberAllow to bring up CPU1.
Based on LeMaker linux-actions tree.
---
v3: new
arch/arm/mach-actions/Makefile | 1 + arch/arm/mach-actions/headsmp.S | 68 ++++++++++++++++ arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 arch/arm/mach-actions/headsmp.S create mode 100644 arch/arm/mach-actions/platsmp.c
arch/arm/mach-actions/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_ARCH_ACTIONS) += owl.o +obj-${CONFIG_ARCH_ACTIONS} += platsmp.o headsmp.o
arch/arm/mach-actions/headsmp.S new file +68 -0
68 lines not on this page · raw message
arch/arm/mach-actions/platsmp.c new file +166 -0
166 lines not on this page · raw message
Signature · 1 line
2.10.2
kbuild test robot
build botRe: [PATCH v3 20/25] ARM: owl: Implement CPU enable-method for S500
url: https://github.com/0day-ci/linux/commits/Andreas-F-rber/ARM-Initial-Actions-Semi-S500-and-S900-enablement/20170301-110028 config: arm-allmodconfig (attached as .config) compiler…
Hi Andreas,
[auto build test ERROR on next-20170228]
[also build test ERROR on v4.10]
[cannot apply to robh/for-next linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Andreas-F-rber/ARM-Initial-Actions-Semi-S500-and-S900-enablement/20170301-110028
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All errors (new ones prefixed by >>):
arch/arm/mach-actions/headsmp.S: Assembler messages:
>> arch/arm/mach-actions/headsmp.S:43: Error: selected processor does not support `dsb' in ARM mode >> arch/arm/mach-actions/headsmp.S:44: Error: selected processor does not support `isb' in ARM mode
vim +43 arch/arm/mach-actions/headsmp.S
37 mov r6, r2, lsl r0
38 orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift)
39 mcr p15, 0, r5, c7, c6, 2
40 bgt 2b
41 cmp r2, #0
42 bgt 1b
> 43 dsb
> 44 isb
45 mov pc, lr
46 ENDPROC(owl_v7_invalidate_l1)
47 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 61367 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170301/5ab32304/attachment-0001.gz>
Andreas Färber
maintainerRe: [PATCH v3 20/25] ARM: owl: Implement CPU enable-method for S500
Am 01.03.2017 um 08:19 schrieb kbuild test robot:
Quoted 22 lines
Hi Andreas,
[auto build test ERROR on next-20170228]
[also build test ERROR on v4.10]
[cannot apply to robh/for-next linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Andreas-F-rber/ARM-Initial-Actions-Semi-S500-and-S900-enablement/20170301-110028
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=armAll errors (new ones prefixed by >>):
arch/arm/mach-actions/headsmp.S: Assembler messages:Quoted 2 lines
Quoted 2 lines
arch/arm/mach-actions/headsmp.S:43: Error: selected processor does not supportdsb' in ARM mode arch/arm/mach-actions/headsmp.S:44: Error: selected processor does not supportisb' in ARM mode
Quoted 10 lines
vim +43
arch/arm/mach-actions/headsmp.S37 mov r6, r2, lsl r0 38 orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift) 39 mcr p15, 0, r5, c7, c6, 2 40 bgt 2b 41 cmp r2, #0 42 bgt 1bQuoted 2 lines
43 dsb
44 isb
Any suggestion what to do about this error? Obviously it built fine for me, and the only thing I spotted in the attached config was that it's apparently a BE8 build...
Do we need a Kconfig "depends on" or some #ifdef here? This assembler part of the code was merely indentation-fixed by me.
Regards,
Andreas
Quoted 7 lines
45 mov pc, lr 46 ENDPROC(owl_v7_invalidate_l1) 47---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Andreas Färber
maintainerRe: [PATCH v3 20/25] ARM: owl: Implement CPU enable-method for S500
Am 01.03.2017 um 11:40 schrieb Andreas F?rber:
Quoted 34 lines
Am 01.03.2017 um 08:19 schrieb kbuild test robot:
Quoted 22 lines
Hi Andreas,
[auto build test ERROR on next-20170228]
[also build test ERROR on v4.10]
[cannot apply to robh/for-next linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Andreas-F-rber/ARM-Initial-Actions-Semi-S500-and-S900-enablement/20170301-110028
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=armAll errors (new ones prefixed by >>):
arch/arm/mach-actions/headsmp.S: Assembler messages:Quoted 2 lines
Quoted 2 lines
arch/arm/mach-actions/headsmp.S:43: Error: selected processor does not supportdsb' in ARM mode arch/arm/mach-actions/headsmp.S:44: Error: selected processor does not supportisb' in ARM modeQuoted 10 lines
vim +43
arch/arm/mach-actions/headsmp.S37 mov r6, r2, lsl r0 38 orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift) 39 mcr p15, 0, r5, c7, c6, 2 40 bgt 2b 41 cmp r2, #0 42 bgt 1bQuoted 2 lines
43 dsb
44 isb
Quoted 3 lines
Any suggestion what to do about this error? Obviously it built fine for me, and the only thing I spotted in the attached config was that it's apparently a BE8 build...
And it has V6 enabled. If I set
AFLAGS_headsmp.o := -Wa,-march=armv7-a
then the error seems resolved.
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
Andreas Färber
maintainerPATCH v3 21/25 ARM: dts: s500: Set CPU enable-method
In reply to Andreas FärberUse a custom S500 enable-method for all CPUs.
---
v3: new
arch/arm/boot/dts/s500.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/s500.dtsi +4 -0
@@ -22,24 +22,28 @@ device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x0>; + enable-method = "actions,s500-smp"; }; cpu1: cpu at 1 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x1>; + enable-method = "actions,s500-smp"; }; cpu2: cpu at 2 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x2>; + enable-method = "actions,s500-smp"; }; cpu3: cpu at 3 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x3>; + enable-method = "actions,s500-smp"; }; };
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 22/25 dt-bindings: power: Add Owl SPS power domains
In reply to Andreas FärberDefine power domains for all non-reserved S500 power gates.
---
v3: new
.../devicetree/bindings/power/actions,owl-sps.txt | 17 +++++++++++++++++ include/dt-bindings/power/s500-powergate.h | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/actions,owl-sps.txt create mode 100644 include/dt-bindings/power/s500-powergate.h
Documentation/devicetree/bindings/power/actions,owl-sps.txt new file +17 -0
@@ -0,0 +1,17 @@ +Actions Semi Owl Smart Power System (SPS) + +Required properties: +- compatible : "actions,s500-sps" for S500 +- reg : Offset and length of the register set for the device. +- #power-domain-cells : Must be 1. + See macros in: + include/dt-bindings/power/s500-powergate.h for S500 + + +Example: + + sps: power-controller at b01b0100 { + compatible = "actions,s500-sps"; + reg = <0xb01b0100 0x100>; + #power-domain-cells = <1>; + };
include/dt-bindings/power/s500-powergate.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (c) 2017 Andreas F?rber +* +* SPDX-License-Identifier: (GPL-2.0+ OR MIT) +*/ +#ifndef DT_BINDINGS_POWER_S500_POWERGATE_H +#define DT_BINDINGS_POWER_S500_POWERGATE_H + +#define S500_PD_VDE 0 +#define S500_PD_VCE_SI 1 +#define S500_PD_USB2_1 2 +#define S500_PD_CPU2 3 +#define S500_PD_CPU3 4 +#define S500_PD_DMA 5 +#define S500_PD_DS 6 +#define S500_PD_USB3 7 +#define S500_PD_USB2_0 8 + +#endif
Signature · 1 line
2.10.2
Re: [PATCH v3 22/25] dt-bindings: power: Add Owl SPS power domains
Quoted 11 lines · Andreas F?rber
Define power domains for all non-reserved S500 power gates.
Signed-off-by Andreas F?rber <[email protected]>---
v3: new.../devicetree/bindings/power/actions,owl-sps.txt | 17 +++++++++++++++++ include/dt-bindings/power/s500-powergate.h | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/actions,owl-sps.txt create mode 100644 include/dt-bindings/power/s500-powergate.h
Andreas Färber
maintainerPATCH v3 23/25 soc: actions: Add Owl SPS
In reply to Andreas FärberImplement S500 Smart Power System power-gating.
Based on LeMaker linux-actions tree.
---
v3: new
drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/actions/Kconfig | 12 +++ drivers/soc/actions/Makefile | 1 + drivers/soc/actions/owl-sps.c | 245 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 260 insertions(+) create mode 100644 drivers/soc/actions/Kconfig create mode 100644 drivers/soc/actions/Makefile create mode 100644 drivers/soc/actions/owl-sps.c
drivers/soc/Kconfig +1 -0
@@ -1,5 +1,6 @@ menu "SOC (System On Chip) specific Drivers" +source "drivers/soc/actions/Kconfig" source "drivers/soc/atmel/Kconfig" source "drivers/soc/bcm/Kconfig" source "drivers/soc/fsl/Kconfig"
drivers/soc/Makefile +1 -0
@@ -2,6 +2,7 @@ # Makefile for the Linux Kernel SOC specific device drivers. # +obj-$(CONFIG_ARCH_ACTIONS) += actions/ obj-$(CONFIG_ARCH_AT91) += atmel/ obj-y += bcm/ obj-$(CONFIG_ARCH_DOVE) += dove/
drivers/soc/actions/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if ARCH_ACTIONS || COMPILE_TEST + +config OWL_PM_DOMAINS + bool "Actions Semi SPS power domains" + depends on PM + select PM_GENERIC_DOMAINS + help + Say 'y' here to enable support for Smart Power System (SPS) + power-gating on Actions Semiconductor S500 SoC. + If unsure, say 'n'. + +endif
drivers/soc/actions/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
drivers/soc/actions/owl-sps.c new file +245 -0
245 lines not on this page · raw message
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 24/25 ARM: dts: s500: Add SPS node
In reply to Andreas Färber---
v3: new
arch/arm/boot/dts/s500.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/s500.dtsi +9 -0
@@ -9,6 +9,7 @@ #include "skeleton.dtsi" #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/power/s500-powergate.h> / { compatible = "actions,s500";
@@ -37,6 +38,7 @@ compatible = "arm,cortex-a9"; reg = <0x2>; enable-method = "actions,s500-smp"; + power-domains = <&sps S500_PD_CPU2>; }; cpu3: cpu at 3 {
@@ -44,6 +46,7 @@ compatible = "arm,cortex-a9"; reg = <0x3>; enable-method = "actions,s500-smp"; + power-domains = <&sps S500_PD_CPU3>; }; };
@@ -170,5 +173,11 @@ <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "2Hz0", "2Hz1", "Timer0", "Timer1"; }; + + sps: power-controller at b01b0100 { + compatible = "actions,s500-sps"; + reg = <0xb01b0100 0x100>; + #power-domain-cells = <1>; + }; }; };
Signature · 1 line
2.10.2
Andreas Färber
maintainerPATCH v3 25/25 ARM: owl: smp: Reimplement SPS power-gating for CPU2 and CPU3
In reply to Andreas FärberBring up the two remaining CPUs.
Based on LeMaker linux-actions tree.
---
v3: new
arch/arm/mach-actions/platsmp.c | 67 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-)
arch/arm/mach-actions/platsmp.c +65 -2
@@ -28,7 +28,15 @@#define OWL_CPUx_FLAG_BOOT 0x55aa +#define OWL_SPS_PG_CTL 0x0 + +#define OWL_SPS_PG_CTL_PWR_CPU2 BIT(5) +#define OWL_SPS_PG_CTL_PWR_CPU3 BIT(6) +#define OWL_SPS_PG_CTL_ACK_CPU2 BIT(21) +#define OWL_SPS_PG_CTL_ACK_CPU3 BIT(22) +static void __iomem *scu_base_addr; +static void __iomem *sps_base_addr;static void __iomem *timer_base_addr;static int ncores;
@@ -42,6 +50,39 @@ static void write_pen_release(int val)outer_clean_range (__pa (&pen_release),__pa (&pen_release +1 )); } +/* The generic PM domain driver is not available this early. */ +static int owl_sps_set_pg (u32 pwr_mask,u32 ack_mask,bool enable) +{ +u32 val; +bool ack; +int timeout; + + val =readl (sps_base_addr +OWL_SPS_PG_CTL ); + ack = val & ack_mask; +if (ack == enable) +return 0 ; + +if (enable) + val |= pwr_mask; +else + val &= ~pwr_mask; + +writel (val, sps_base_addr +OWL_SPS_PG_CTL ); + +for (timeout =5000 ; timeout >0 ; timeout -=50 ) { + val =readl (sps_base_addr +OWL_SPS_PG_CTL ); +if ((val & ack_mask) == (enable ? ack_mask :0 )) +break ; +udelay (50 ); + } +if (timeout <=0 ) +return -ETIMEDOUT ; + +udelay (10 ); + +return 0 ; +} +static void s500_smp_secondary_init (unsigned int cpu) {/*
@@ -58,14 +99,24 @@ void owl_secondary_startup(void);static int s500_wakeup_secondary (unsigned int cpu) { +int ret; +if (cpu >3 )return -EINVAL ;switch (cpu) {case 2 : + ret =owl_sps_set_pg (OWL_SPS_PG_CTL_PWR_CPU2 , +OWL_SPS_PG_CTL_ACK_CPU2 , true); +if (ret) +return ret; +break ;case 3 : -/* CPU2/3 are power-gated */ -return -EINVAL ; + ret =owl_sps_set_pg (OWL_SPS_PG_CTL_PWR_CPU3 , +OWL_SPS_PG_CTL_ACK_CPU3 , true); +if (ret) +return ret; +break ; }/* wait for CPUx to run to WFE instruction */
@@ -133,6 +184,18 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)return ; } + node =of_find_compatible_node (NULL ,NULL ,"actions,s500-sps" ); +if (!node) { +pr_err ("%s: missing sps\n" , __func__); +return ; + } + + sps_base_addr =of_iomap (node,0 ); +if (!sps_base_addr) { +pr_err ("%s: could not map sps registers\n" , __func__); +return ; + } +if (read_cpuid_part () ==ARM_CPU_PART_CORTEX_A9 ) { node =of_find_compatible_node (NULL ,NULL ,"arm,cortex-a9-scu" );if (!node) {
Signature · 1 line
2.10.2