Skip to contentSkip to conversation

ARM: Initial Actions Semi S500 and S900 enablement

PATCH Applied Andreas Färber 12 participants 99 messages Jun 6, 2017 – Sep 5, 2017

Subsystems (9)
lore
Share & tools
lore

Andreas Färber

author maintainer
#0 lore raw

v4 cover ARM: Initial Actions Semi S500 and S900 enablement

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 <[email protected]>
Cc Olof Johansson <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc mp-cs at actions-semi.com
Cc Thomas Liau <[email protected]>
Cc 96boards at ucrobotics.com
Cc support at lemaker.org
Cc linux-serial at vger.kernel.org
Cc Greg Kroah-Hartman <[email protected]>
Cc linux-pm at vger.kernel.org
Cc Rafael J. Wysocki <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc linux-doc at vger.kernel.org
Cc Jonathan Corbet <[email protected]>
Cc devicetree at 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
Signature · 1 line
2.12.3
author maintainer
#1 lore raw

PATCH v4 1/28 dt-bindings: Add vendor prefix for Actions Semi

Actions Semiconductor was listed on NASDAQ as ACTS until Dec 16, 2016.

Cc mp-cs at actions-semi.com

---
v3 -> v4: Unchanged

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
index d808f24af949..3b02d90e2003 100644
@@ -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.12.3
author maintainer
#2 lore raw

Re: [PATCH v4 01/28] dt-bindings: Add vendor prefix for Actions Semi

Am 06.06.2017 um 02:53 schrieb Andreas F?rber:

Quoted 8 lines

Actions Semiconductor was listed on NASDAQ as ACTS until Dec 16, 2016.

Cc mp-cs at actions-semi.com

---
v3 -> v4: Unchanged

Quoted 8 lines

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(+)

With still no Acked-by or other reply from Actions, I have now applied this patch to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#3 lore raw

PATCH v4 2/28 dt-bindings: arm: Document Actions Semi S500

In reply to Andreas Färber

The Actions Semi S500 is a quad-core ARM Cortex-A9 SoC. The LeMaker Guitar is an SODIMM-format module with that SoC.

---
v2 -> v3 -> v4: 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
new file mode 100644
index 000000000000..1d3782e41b00
@@ -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.12.3
author maintainer Applied
#4 lore raw

Re: [PATCH v4 02/28] dt-bindings: arm: Document Actions Semi S500

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 8 lines

The Actions Semi S500 is a quad-core ARM Cortex-A9 SoC. The LeMaker Guitar is an SODIMM-format module with that SoC.

---
v2 -> v3 -> v4: unchanged

Quoted 7 lines

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

Thanks, applied:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#5 lore raw

PATCH v4 3/28 dt-bindings: timer: Document Owl timer

In reply to 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.

---
v3 -> v4:
* Changed interrupt names to lower-case (Mark)

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
new file mode 100644
index 000000000000..e3c28da80cb2
@@ -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.12.3
author maintainer Applied
#6 lore raw

Re: [PATCH v4 03/28] dt-bindings: timer: Document Owl timer

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 14 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.

---
v3 -> v4:
* Changed interrupt names to lower-case (Mark)

v2 -> v3:
* Adopted interrupt-names
* Changed compatible for S500
* Added S900 compatible and interrupt names

Quoted 5 lines

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

Thanks, applied to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#7 lore raw

PATCH v4 4/28 clocksource: Add Owl timer

In reply to 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.html

---
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
drivers/clocksource/Kconfig +7 -0
index 4ba230d8e679..da3f1d926c6b 100644
@@ -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
drivers/clocksource/Makefile +1 -0
index ec559212edf6..90309d4a719e 100644
@@ -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
drivers/clocksource/owl-timer.c new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.12.3
Acked-by on v4 4/28
#8 lore raw

Re: [PATCH v4 04/28] clocksource: Add Owl timer

Quoted 11 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.html

---

author maintainer
#9 lore raw

Re: [PATCH v4 04/28] clocksource: Add Owl timer

Am 06.06.2017 um 18:33 schrieb Daniel Lezcano:

Quoted 7 lines · Andreas F?rber
Quoted 6 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.

Quoted 7 lines
Quoted 5 lines

An S500 datasheet can be found on the LeMaker Guitar pages:
http://www.lemaker.org/product-guitar-download-29.html

---

Thanks. It seems this is not going through a central clocksource tree, so I'm applying it to a new linux-actions.git v4.13/soc branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

Let me know if you intend to take it through some other tree instead.

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)
#10 lore raw

Re: [PATCH v4 04/28] clocksource: Add Owl timer

Quoted 14 lines · Andreas F?rber

Am 06.06.2017 um 18:33 schrieb Daniel Lezcano:

Quoted 13 lines · Andreas F?rber
Quoted 11 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.html

---

Quoted 8 lines
Quoted 1 line

Thanks. It seems this is not going through a central clocksource tree, so I'm applying it to a new linux-actions.git v4.13/soc branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

Let me know if you intend to take it through some other tree instead.

No, it is ok. In the future, submit for the clocksource tree (tip/timers/core).

Thanks!

-- Daniel

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
author maintainer
#11 lore raw

Re: [PATCH v4 04/28] clocksource: Add Owl timer

Am 19.06.2017 um 15:53 schrieb Daniel Lezcano:

Quoted 19 lines · Andreas F?rber
Quoted 18 lines

Am 06.06.2017 um 18:33 schrieb Daniel Lezcano:

Quoted 5 lines · Andreas F?rber
Quoted 4 lines

The Actions Semi S500 SoC provides four timers, 2Hz0/1 and 32-bit TIMER0/1.

Use TIMER0 as clocksource and TIMER1 as clockevents.

Quoted 8 lines
Quoted 6 lines

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

Thanks. It seems this is not going through a central clocksource tree, so I'm applying it to a new linux-actions.git v4.13/soc branch:

Quoted 6 lines
Quoted 3 lines

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

Let me know if you intend to take it through some other tree instead.

No, it is ok. In the future, submit for the clocksource tree (tip/timers/core).

Hm, I did see that tree in MAINTAINERS, but it specifically said "CLOCKSOURCE CORE" and it does not have any
F: drivers/clocksource/
or
F: Documentation/devicetree/bindings/timer/
entries, therefore I added the files to Actions like other SoCs did...

I can easily unqueue the patches - what does submit for the clocksource tree mean? Just CC the two maintainers on resend or anything else? I intend to rename my branch to v4.13/drivers on Olof's feedback anyway.

Sorry,
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)
#12 lore raw

Re: [PATCH v4 04/28] clocksource: Add Owl timer

Quoted 27 lines · Andreas F?rber

Am 19.06.2017 um 15:53 schrieb Daniel Lezcano:

Quoted 19 lines · Andreas F?rber
Quoted 18 lines

Am 06.06.2017 um 18:33 schrieb Daniel Lezcano:

Quoted 5 lines · Andreas F?rber
Quoted 4 lines

The Actions Semi S500 SoC provides four timers, 2Hz0/1 and 32-bit TIMER0/1.

Use TIMER0 as clocksource and TIMER1 as clockevents.

Quoted 8 lines
Quoted 6 lines

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

Thanks. It seems this is not going through a central clocksource tree, so I'm applying it to a new linux-actions.git v4.13/soc branch:

Quoted 6 lines
Quoted 3 lines

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

Let me know if you intend to take it through some other tree instead.

No, it is ok. In the future, submit for the clocksource tree (tip/timers/core).

Quoted 6 lines

Hm, I did see that tree in MAINTAINERS, but it specifically said "CLOCKSOURCE CORE" and it does not have any
F: drivers/clocksource/
or
F: Documentation/devicetree/bindings/timer/
entries, therefore I added the files to Actions like other SoCs did...

You probably missed the entry:

CLOCKSOURCE, CLOCKEVENT DRIVERS

M:      Daniel Lezcano <[email protected]>
M:      Thomas Gleixner <[email protected]>
L:      linux-kernel at vger.kernel.org
T:      git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
S:      Supported
F:      drivers/clocksource
Quoted 3 lines

I can easily unqueue the patches - what does submit for the clocksource tree mean? Just CC the two maintainers on resend or anything else? I intend to rename my branch to v4.13/drivers on Olof's feedback anyway.

I could have directly picked the clocksource/clockevent changes to my tree but I decided to let them go through the ARM's tree. I meant, as the patches are acked (by me), it is ok they are merged through arm's tree. From my POV, it is somewho acceptable when a new SoC support is added.

In the future, when the clockevent/clocksource drivers are merged and if there are more changes, at this time, send the patches to Thomas and me as stated in the maintainer file entry, I will take care of them.

IOW, everything is fine ;)

-- Daniel

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
author maintainer
#13 lore raw

PATCH v4 5/28 clocksource: owl: Add S900 support

In reply to Andreas Färber

The Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz 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 -> v4:
* Dropped S900 DT data

v3: new

 drivers/clocksource/owl-timer.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clocksource/owl-timer.c +1 -0
index 4609363a79a6..d19c53c11094 100644
@@ -169,3 +169,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.12.3
Acked-by on v4 5/28
#14 lore raw

Re: [PATCH v4 05/28] clocksource: owl: Add S900 support

Quoted 8 lines · Andreas F?rber

The Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz timers.

An S900 datasheet can be found in 96Boards documentation:
https://github.com/96boards/documentation/blob/master/ConsumerEdition/Bubblegum-96/HardwareDocs/SoC_bubblegum96.pdf

---

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
author maintainer Applied
#15 lore raw

Re: [PATCH v4 05/28] clocksource: owl: Add S900 support

Am 06.06.2017 um 18:34 schrieb Daniel Lezcano:

Quoted 11 lines · Andreas F?rber
Quoted 8 lines

The Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz timers.

An S900 datasheet can be found in 96Boards documentation:
https://github.com/96boards/documentation/blob/master/ConsumerEdition/Bubblegum-96/HardwareDocs/SoC_bubblegum96.pdf

---

Thanks, applied to linux-actions.git v4.13/soc branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

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)
author maintainer
#16 lore raw

PATCH v4 6/28 ARM: Prepare Actions Semi S500

In reply to Andreas Färber

Add ARCH_ACTIONS and mach-actions/owl.c for "actions,s500".

---
v3 -> v4: Unchanged

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
index 4a5876ff38bf..763700e74030 100644
@@ -712,6 +712,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
index 65f4e2a4eb94..47d3a1ab08d2 100644
@@ -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
new file mode 100644
index 000000000000..717adc1630a1
@@ -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
new file mode 100644
index 000000000000..524c3817bcb3
@@ -0,0 +1 @@
+obj-$(CONFIG_ARCH_ACTIONS) += owl.o
arch/arm/mach-actions/owl.c new file +28 -0
new file mode 100644
index 000000000000..4ac4a860f3d6
@@ -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.12.3
author maintainer Applied
#17 lore raw

Re: [PATCH v4 06/28] ARM: Prepare Actions Semi S500

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 16 lines

Add ARCH_ACTIONS and mach-actions/owl.c for "actions,s500".

---
v3 -> v4: Unchanged

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

Quoted 9 lines
 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

Applied to linux-actions.git v4.13/arm branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/arm

There have been no more comments - I believe we could simplify it with a Makefile hack as seen in mach-uniphier, but since no one asked for dropping owl.c in 4 patch revisions, I'll consider that as follow-up.

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)
author maintainer
#18 lore raw

PATCH 1/1 ARM: owl: Drop custom machine

Rely on the fallback to "Generic DT based system". This change is visible in /proc/cpuinfo.

---
 arch/arm/mach-actions/Makefile |  1 -
 arch/arm/mach-actions/owl.c    | 28 ----------------------------
 2 files changed, 29 deletions(-)
 delete mode 100644 arch/arm/mach-actions/owl.c
arch/arm/mach-actions/Makefile +0 -1
index eeb3896e4952..c0f116241da7 100644
@@ -1,4 +1,3 @@
-obj-y += owl.o
 obj-${CONFIG_SMP} += platsmp.o headsmp.o
 
 AFLAGS_headsmp.o := -Wa,-march=armv7-a
arch/arm/mach-actions/owl.c deleted +0 -28
deleted file mode 100644
index 4ac4a860f3d6..000000000000
@@ -1,28 +0,0 @@
-/*
- * 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.12.3
author maintainer
#19 lore raw

PATCH v4 7/28 ARM64: Prepare Actions Semi S900

In reply to Andreas Färber

Add ARCH_ACTIONS.

---
v3 -> v4: Unchanged

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
index 9a6f50fed239..7b0615161750 100644
@@ -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 ARCH_HAS_RESET_CONTROLLER
Signature · 1 line
2.12.3
author maintainer
#20 lore raw

Re: [PATCH v4 07/28] ARM64: Prepare Actions Semi S900

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 6 lines

Add ARCH_ACTIONS.

---
v3 -> v4: Unchanged

Quoted 8 lines

v2 -> v3:
* Selected clocksource driver

v1 -> v2:
* Renamed ARCH_OWL to ARCH_ACTION (Arnd)

 arch/arm64/Kconfig.platforms | 6 ++++++
 1 file changed, 6 insertions(+)

To make a start somewhere, given Daniel's ack for OWL_TIMER, I'm applying this to my new linux-actions.git v4.13/arm64 branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/arm64

For arm I'm still giving Actions Semi a final chance to comment on the vendor prefix and DT bindings (none on v3 and none for a week for v4).

Regards,
Andreas

Quoted 17 lines
arch/arm64/Kconfig.platforms +6 -0
index 9a6f50fed239..7b0615161750 100644
@@ -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 ARCH_HAS_RESET_CONTROLLER
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)
author maintainer
#21 lore raw

PATCH v4 8/28 dt-bindings: serial: Document Actions Semi Owl UARTs

In reply to Andreas Färber

This UART is found on S500 and S900 SoCs.

---
v3 -> v4: Unchanged

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
new file mode 100644
index 000000000000..aa873eada02d
@@ -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.12.3
author maintainer
#22 lore raw

PATCH v4 9/28 tty: serial: Add Actions Semi Owl UART earlycon

In reply to Andreas Färber

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

---
v3 -> v4: Unchanged

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
index 5c8850f7a2a0..38f90ea45cf7 100644
@@ -1688,6 +1688,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
index 53c03e005132..fe88a75d9a59 100644
@@ -92,6 +92,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.12.3
author maintainer
#23 lore raw

Re: [PATCH v4 09/28] tty: serial: Add Actions Semi Owl UART earlycon

Greg,

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 16 lines

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

---
v3 -> v4: Unchanged

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

Quoted 5 lines
 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

The DT vendor prefix is applied to my linux-actions.git tree now, and the serial binding has been ack'ed by Rob.

Is there anything keeping you from adding this patch, the preceding DT binding (08/28) and the following documentation patch (10/28) to your tree for 4.13?

The full serial driver (16/28) needs another spin and may miss 4.13, but earlycon would prove the rest is working.

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)
#24 lore raw

Re: [PATCH v4 09/28] tty: serial: Add Actions Semi Owl UART earlycon

Quoted 25 lines · Andreas F?rber

Greg,

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 16 lines

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

---
v3 -> v4: Unchanged

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

Quoted 5 lines
 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
Quoted 6 lines

The DT vendor prefix is applied to my linux-actions.git tree now, and the serial binding has been ack'ed by Rob.

Is there anything keeping you from adding this patch, the preceding DT binding (08/28) and the following documentation patch (10/28) to your tree for 4.13?

Yeah, I don't have it in my queue anymore :)

Can you resend it just as a single patch?

thanks,

greg k-h

author maintainer
#25 lore raw

Re: [PATCH v4 09/28] tty: serial: Add Actions Semi Owl UART earlycon

Am 19.06.2017 um 03:16 schrieb Greg Kroah-Hartman:

Quoted 13 lines · Andreas F?rber
Quoted 12 lines

Greg,

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 5 lines

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

The DT vendor prefix is applied to my linux-actions.git tree now, and the serial binding has been ack'ed by Rob.

Quoted 7 lines
Quoted 3 lines

Is there anything keeping you from adding this patch, the preceding DT binding (08/28) and the following documentation patch (10/28) to your tree for 4.13?

Yeah, I don't have it in my queue anymore :)

Can you resend it just as a single patch?

Do you mean squash the documentation into this tty patch? As you wish. But the DT binding is supposed to be a separate patch - I can queue it in my tree if you prefer.

Cheers,
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)
author maintainer
#26 lore raw

PATCH v5 7/26 dt-bindings: serial: Document Actions Semi Owl UARTs

This UART is found on S500 and S900 SoCs.

---
v2 -> v3 -> v4 -> v5: 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
new file mode 100644
index 000000000000..aa873eada02d
@@ -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.12.3
author maintainer
#27 lore raw

PATCH v5 8/26 tty: serial: Add Actions Semi Owl UART earlycon

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

---
v4 -> v5:
* Squashed documentation (Greg)

v3 -> v4: Unchanged

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

 Documentation/admin-guide/kernel-parameters.txt |   6 ++
 drivers/tty/serial/Kconfig                      |  19 ++++
 drivers/tty/serial/Makefile                     |   1 +
 drivers/tty/serial/owl-uart.c                   | 135 ++++++++++++++++++++++++
 4 files changed, 161 insertions(+)
 create mode 100644 drivers/tty/serial/owl-uart.c
Documentation/admin-guide/kernel-parameters.txt +6 -0
index fb311bdccb7b..cc8a6bfcb299 100644
@@ -961,6 +961,12 @@
 			must already be setup and configured. Options are not
 			yet supported.
 
+		owl,<addr>
+			Start an early, polled-mode console on a serial port
+			of an Actions Semi SoC, such as S500 or S900, 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>
drivers/tty/serial/Kconfig +19 -0
index 07812a7ea2a4..1f096e2bb398 100644
@@ -1688,6 +1688,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
index 53c03e005132..fe88a75d9a59 100644
@@ -92,6 +92,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.12.3
#28 lore raw

Re: [PATCH v4 09/28] tty: serial: Add Actions Semi Owl UART earlycon

In reply to Andreas Färber
Quoted 18 lines · Andreas F?rber

Am 19.06.2017 um 03:16 schrieb Greg Kroah-Hartman:

Quoted 17 lines · Andreas F?rber
Quoted 15 lines

Greg,

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 5 lines

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

The DT vendor prefix is applied to my linux-actions.git tree now, and the serial binding has been ack'ed by Rob.

Is there anything keeping you from adding this patch, the preceding DT binding (08/28) and the following documentation patch (10/28) to your tree for 4.13?

Quoted 7 lines
Quoted 3 lines

Yeah, I don't have it in my queue anymore :)

Can you resend it just as a single patch?

Do you mean squash the documentation into this tty patch? As you wish. But the DT binding is supposed to be a separate patch - I can queue it in my tree if you prefer.

No, just send me what ever you want me to apply to my tree. If you want me to pick some random patch out of the middle of a series, um, that's a bit hard for me to know what to do, right?

Make it very very obvious please :)

thanks,

greg k-h

author maintainer
#29 lore raw

Re: [PATCH v4 09/28] tty: serial: Add Actions Semi Owl UART earlycon

Am 19.06.2017 um 04:12 schrieb Greg Kroah-Hartman:

Quoted 21 lines · Andreas F?rber
Quoted 20 lines

Am 19.06.2017 um 03:16 schrieb Greg Kroah-Hartman:

Quoted 18 lines · Andreas F?rber
Quoted 5 lines

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 4 lines

This implements an earlycon for Actions Semi S500/S900 SoCs.

Based on LeMaker linux-actions tree.

Quoted 8 lines
Quoted 1 line

The DT vendor prefix is applied to my linux-actions.git tree now, and the serial binding has been ack'ed by Rob.

Is there anything keeping you from adding this patch, the preceding DT binding (08/28) and the following documentation patch (10/28) to your tree for 4.13?

Yeah, I don't have it in my queue anymore :)

Can you resend it just as a single patch?

Quoted 7 lines
Quoted 3 lines

Do you mean squash the documentation into this tty patch? As you wish. But the DT binding is supposed to be a separate patch - I can queue it in my tree if you prefer.

No, just send me what ever you want me to apply to my tree. If you want me to pick some random patch out of the middle of a series, um, that's a bit hard for me to know what to do, right?

Well, I thought that would be obvious from subject, diff stat and CC... Only dependencies were ARCH_ACTIONS and actions vendor prefix, which should be in linux-next by tomorrow.

Quoted 2 lines

Make it very very obvious please :)

I already resent the now two patches as v5 with you as only To.

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)
author maintainer
#30 lore raw

PATCH v4 10/28 Documentation: kernel-parameters: Document owl earlycon

In reply to Andreas Färber

Add the "owl" earlycon option to kernel-parameters.txt.

---
v3 -> v4:
* Extended help text and commit message (Jonathan)

v1 -> v2 -> v3: unchanged

 Documentation/admin-guide/kernel-parameters.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +6 -0
index 042aa5e9c47d..e2fb7a87bc84 100644
@@ -961,6 +961,12 @@
 			must already be setup and configured. Options are not
 			yet supported.
 
+		owl,<addr>
+			Start an early, polled-mode console on a serial port
+			of an Actions Semi SoC, such as S500 or S900, 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.12.3
author maintainer
#31 lore raw

PATCH v4 11/28 ARM: dts: Add Actions Semi S500 and LeMaker Guitar

In reply to Andreas Färber

---
v3 -> v4:
* Adopted lower-case timer interrupt-names (Mark)

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         |  22 ++++
 arch/arm/boot/dts/s500.dtsi                | 176 +++++++++++++++++++++++++++++
 4 files changed, 226 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
index 3d6e288a49f7..e1ce692f9190 100644
@@ -668,6 +668,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
new file mode 100644
index 000000000000..834b71df31bd
@@ -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 +22 -0
new file mode 100644
index 000000000000..063ada966c94
@@ -0,0 +1,22 @@
+/*
+ * 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";
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x40000000>;
+	};
+};
+
+&timer {
+	clocks = <&hosc>;
+};
arch/arm/boot/dts/s500.dtsi new file +176 -0

176 lines not on this page · raw message

Signature · 1 line
2.12.3
author maintainer
#32 lore raw

Re: [PATCH v4 11/28] ARM: dts: Add Actions Semi S500 and LeMaker Guitar

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 26 lines

---
v3 -> v4:
* Adopted lower-case timer interrupt-names (Mark)

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

Quoted 8 lines
 arch/arm/boot/dts/Makefile                 |   2 +
 arch/arm/boot/dts/s500-guitar-bb-rev-b.dts |  26 +++++
 arch/arm/boot/dts/s500-guitar.dtsi         |  22 ++++
 arch/arm/boot/dts/s500.dtsi                | 176 +++++++++++++++++++++++++++++
 4 files changed, 226 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

Following a previous discussion with Thomas (that Actions unfortunately didn't follow-up to with replies here...), I am planning to respin with s500*.dts[i] renamed to owl-s500*. That will avoid name clashes and will future-proof the file pattern in MAINTAINERS.

For S900 I don't think we need owl-, as we have actions/* there.

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)
author maintainer
#33 lore raw

PATCH v5 10/27 ARM: dts: Add Actions Semi S500 and LeMaker Guitar

Add Device Trees for Actions Semiconductor S500 SoC and LeMaker Guitar SoM and base board.

---
v4 -> v5:
* Renamed files from s500* to owl-s500*

v3 -> v4:
* Adopted lower-case timer interrupt-names (Mark)

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/owl-s500-guitar-bb-rev-b.dts |  26 ++++
 arch/arm/boot/dts/owl-s500-guitar.dtsi         |  22 ++++
 arch/arm/boot/dts/owl-s500.dtsi                | 176 +++++++++++++++++++++++++
 4 files changed, 226 insertions(+)
 create mode 100644 arch/arm/boot/dts/owl-s500-guitar-bb-rev-b.dts
 create mode 100644 arch/arm/boot/dts/owl-s500-guitar.dtsi
 create mode 100644 arch/arm/boot/dts/owl-s500.dtsi
arch/arm/boot/dts/Makefile +2 -0
index e81d87db22cc..ff9671c27fc8 100644
@@ -669,6 +669,8 @@ dtb-$(CONFIG_ARCH_ORION5X) += \
 	orion5x-maxtor-shared-storage-2.dtb \
 	orion5x-netgear-wnr854t.dtb \
 	orion5x-rd88f5182-nas.dtb
+dtb-$(CONFIG_ARCH_ACTIONS) += \
+	owl-s500-guitar-bb-rev-b.dtb
 dtb-$(CONFIG_ARCH_PRIMA2) += \
 	prima2-evb.dtb
 dtb-$(CONFIG_ARCH_OXNAS) += \
arch/arm/boot/dts/owl-s500-guitar-bb-rev-b.dts new file +26 -0
new file mode 100644
index 000000000000..521463d4cac6
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016-2017 Andreas F?rber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+
+#include "owl-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/owl-s500-guitar.dtsi new file +22 -0
new file mode 100644
index 000000000000..079b2c02cc13
@@ -0,0 +1,22 @@
+/*
+ * LeMaker Guitar SoM
+ *
+ * Copyright (c) 2016-2017 Andreas F?rber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+#include "owl-s500.dtsi"
+
+/ {
+	compatible = "lemaker,guitar", "actions,s500";
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x40000000>;
+	};
+};
+
+&timer {
+	clocks = <&hosc>;
+};
arch/arm/boot/dts/owl-s500.dtsi new file +176 -0

176 lines not on this page · raw message

Signature · 1 line
2.12.3
author maintainer
#34 lore raw

Re: [PATCH v5 10/27] ARM: dts: Add Actions Semi S500 and LeMaker Guitar

Am 19.06.2017 um 03:08 schrieb Andreas F?rber:

Quoted 32 lines

Add Device Trees for Actions Semiconductor S500 SoC and LeMaker Guitar SoM and base board.

---
v4 -> v5:
* Renamed files from s500* to owl-s500*

v3 -> v4:
* Adopted lower-case timer interrupt-names (Mark)

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

Quoted 8 lines
 arch/arm/boot/dts/Makefile                     |   2 +
 arch/arm/boot/dts/owl-s500-guitar-bb-rev-b.dts |  26 ++++
 arch/arm/boot/dts/owl-s500-guitar.dtsi         |  22 ++++
 arch/arm/boot/dts/owl-s500.dtsi                | 176 +++++++++++++++++++++++++
 4 files changed, 226 insertions(+)
 create mode 100644 arch/arm/boot/dts/owl-s500-guitar-bb-rev-b.dts
 create mode 100644 arch/arm/boot/dts/owl-s500-guitar.dtsi
 create mode 100644 arch/arm/boot/dts/owl-s500.dtsi

Applying to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#35 lore raw

PATCH v4 12/28 dt-bindings: Add vendor prefix for uCRobotics

In reply to Andreas Färber
Cc 96boards at ucrobotics.com

---
v1 -> v2 -> v3 -> v4: unchanged

 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 3b02d90e2003..6e514b3174ab 100644
@@ -336,6 +336,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.12.3
author maintainer
#36 lore raw

Re: [PATCH v4 12/28] dt-bindings: Add vendor prefix for uCRobotics

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 8 lines
Cc 96boards at ucrobotics.com

---
v1 -> v2 -> v3 -> v4: unchanged

 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

Still no response from uCRobotics on how exactly to write their company name here, so applying as is to linux-actions.git v4.13/dt64 branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt64

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)
author maintainer
#37 lore raw

PATCH v4 13/28 dt-bindings: arm: Document Actions Semi S900

In reply to Andreas Färber

The Actions Semi S900 is a quad-core ARM Cortex-A53 SoC.
The Bubblegum-96 is a 96Boards Consumer Edition compliant board (4/96).

Cc 96boards at ucrobotics.com

---
v2 -> v3 -> v4: 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
index 1d3782e41b00..3bc7ea575564 100644
@@ -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.12.3
author maintainer
#38 lore raw

Re: [PATCH v4 13/28] dt-bindings: arm: Document Actions Semi S900

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 9 lines

The Actions Semi S900 is a quad-core ARM Cortex-A53 SoC.
The Bubblegum-96 is a 96Boards Consumer Edition compliant board (4/96).

Cc 96boards at ucrobotics.com

---
v2 -> v3 -> v4: unchanged

Quoted 6 lines

v1 -> v2:
* Adopted "actions" vendor prefix
* Extended text

 Documentation/devicetree/bindings/arm/actions.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Still no comments from uCRobotics received...

Due to S500 dependency applying to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

Let me know if we need a topic branch for dt+dt64 instead.

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)
author maintainer
#39 lore raw

PATCH v4 14/28 ARM64: dts: Add Actions Semi S900 and Bubblegum-96

In reply to Andreas Färber

UART0/1/4/6 interrupts are guesses.

Cc 96boards at ucrobotics.com

---
v3 -> v4:
* Adopted lower-case timer interrupt-names (Mark)

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
index 78f7991a5906..8e1951273fd7 100644
@@ -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
new file mode 100644
index 000000000000..62922d688ce3
@@ -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
new file mode 100644
index 000000000000..a0c3484dbd12
@@ -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.12.3
author maintainer
#40 lore raw

Re: [PATCH v4 14/28] ARM64: dts: Add Actions Semi S900 and Bubblegum-96

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 24 lines

UART0/1/4/6 interrupts are guesses.

Cc 96boards at ucrobotics.com

---
v3 -> v4:
* Adopted lower-case timer interrupt-names (Mark)

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)

Quoted 8 lines
 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

Applying (with extended commit message) to linux-actions.git v4.13/dt64:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt64

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)
author maintainer
#41 lore raw

PATCH v4 15/28 MAINTAINERS: Add Actions Semi Owl section

In reply to Andreas Färber

---
v2 -> v3 -> v4: unchanged

v2: new

 MAINTAINERS | 10 ++++++++++
 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
index f17ffa17abef..a9faa30def9c 100644
@@ -1036,6 +1036,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.12.3
author maintainer
#42 lore raw

Re: [PATCH v4 15/28] MAINTAINERS: Add Actions Semi Owl section

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 14 lines

---
v2 -> v3 -> v4: unchanged

v2: new

 MAINTAINERS | 10 ++++++++++
 1 file changed, 10 insertions(+)
MAINTAINERS +0 -0
index f17ffa17abef..a9faa30def9c 100644

MAINTAINERS S: Maintained · line 1044

Quoted 9 lines
MAINTAINERS +6 -0
@@ -1036,6 +1036,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*

This will need to be updated for owl-s500*

MAINTAINERS S: Maintained · line 1047

Quoted 2 lines
MAINTAINERS +2 -0
+F:	arch/arm64/boot/dts/actions/
+F:	Documentation/devicetree/bindings/arm/actions.txt

This is lacking the two clocksource files.

MAINTAINERS S: Maintained · line 1051

Quoted 4 lines
MAINTAINERS +1 -0
+
 ARM/ADS SPHERE MACHINE SUPPORT
 M:	Lennert Buytenhek <[email protected]>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)

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)
author maintainer
#43 lore raw

PATCH v5 13/26 MAINTAINERS: Add Actions Semi Owl section

---
v4 -> v5:
* Updated arm dts file pattern
* Added clocksource file patterns

v2 -> v3 -> v4: unchanged

v2: new

 MAINTAINERS | 12 ++++++++++++
 1 file changed, 12 insertions(+)
MAINTAINERS +12 -0
index d56524402f36..831bfd5cc68b 100644
@@ -1036,6 +1036,18 @@ 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/owl-*
+F:	arch/arm64/boot/dts/actions/
+F:	drivers/clocksource/owl-*
+F:	Documentation/devicetree/bindings/arm/actions.txt
+F:	Documentation/devicetree/bindings/timer/actions,owl-timer.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.12.3
#44 lore raw

答复: [PATCH v5 13/26] MAINTAINERS: Add Actions Semi Owl section

+c

-----????-----
???: Andreas F?rber [mailto:afaerber at suse.de]
????: 2017?6?19? 10:45
???: linux-arm-kernel at lists.infradead.org
??: mp-cs; Thomas Liau; ???; ??; ???; 96boards at ucrobotics.com; support at lemaker.org; linux-kernel at vger.kernel.org; Andreas F?rber ??: [PATCH v5 13/26] MAINTAINERS: Add Actions Semi Owl section

---
v4 -> v5:
* Updated arm dts file pattern
* Added clocksource file patterns

v2 -> v3 -> v4: unchanged

v2: new

 MAINTAINERS | 12 ++++++++++++
 1 file changed, 12 insertions(+)
MAINTAINERS +12 -0
index d56524402f36..831bfd5cc68b 100644
@@ -1036,6 +1036,18 @@ 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/owl-*
+F:	arch/arm64/boot/dts/actions/
+F:	drivers/clocksource/owl-*
+F:	Documentation/devicetree/bindings/arm/actions.txt
+F:	Documentation/devicetree/bindings/timer/actions,owl-timer.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.12.3
author maintainer
#45 lore raw

PATCH v4 16/28 tty: serial: owl: Implement console driver

In reply to Andreas Färber

Implement serial console driver to complement earlycon.

Based on LeMaker linux-actions tree.

---
v3 -> v4: Unchanged

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
index 38f90ea45cf7..b0cddfbd8d74 100644
@@ -1689,7 +1689,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
@@ -1705,7 +1705,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
index 9ec741b133fe..5e850e68930d 100644
@@ -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.12.3
#46 lore raw

Re: [PATCH v4 16/28] tty: serial: owl: Implement console driver

Quoted 5 lines
drivers/tty/serial/owl-uart.c +5 -0
+
+static void owl_uart_set_termios(struct uart_port *port,
+				 struct ktermios *termios,
+				 struct ktermios *old)
+{

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 325

Quoted 10 lines
drivers/tty/serial/owl-uart.c +10 -0
+	struct owl_uart_port *owl_port = to_owl_uart_port(port);
+	unsigned int baud;
+	u32 ctl;
+	unsigned long flags;
+
+	spin_lock_irqsave(&port->lock, flags);
+
+	/* We don't support modem control lines. */
+	termios->c_cflag &= ~(HUPCL | CMSPAR);
+	termios->c_cflag |= CLOCAL;

CLOCAL and HUPCL are software not hardware properties so are probably best not forced (it'll confuse some apps if you do)

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 328

Quoted 3 lines
drivers/tty/serial/owl-uart.c +3 -0
+
+	/* We don't support BREAK character recognition. */
+	termios->c_iflag &= ~(IGNBRK | BRKINT);

Ditto these

You do clear CMSPAR which is right if not supported but then later on we have:

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 366

Quoted 12 lines
drivers/tty/serial/owl-uart.c +12 -0
+	if (termios->c_cflag & PARENB) {
+		if (termios->c_cflag & CMSPAR) {
+			if (termios->c_cflag & PARODD)
+				ctl |= OWL_UART_CTL_PRS_MARK;
+			else
+				ctl |= OWL_UART_CTL_PRS_SPACE;
+		} else if (termios->c_cflag & PARODD)
+			ctl |= OWL_UART_CTL_PRS_ODD;
+		else
+			ctl |= OWL_UART_CTL_PRS_EVEN;
+	} else
+		ctl |= OWL_UART_CTL_PRS_NONE;

Which seems to indicate you do support CMSPAR so shouldn't be clearing it.

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 376

Quoted 10 lines
drivers/tty/serial/owl-uart.c +10 -0
+
+	if (termios->c_cflag & CRTSCTS)
+		ctl |= OWL_UART_CTL_AFE;
+	else
+		ctl &= ~OWL_UART_CTL_AFE;
+
+	owl_uart_write(port, ctl, OWL_UART_CTL);
+
+	baud = uart_get_baud_rate(port, termios, old, 9600, 3200000);
+	owl_uart_change_baudrate(owl_port, baud);

You should re-encode the resulting baud rate into the termios

        /* Don't rewrite B0 */
        if (tty_termios_baud_rate(termios))
                tty_termios_encode_baud_rate(termios, baud, baud);
author maintainer
#47 lore raw

Re: [PATCH v4 16/28] tty: serial: owl: Implement console driver

Am 06.06.2017 um 15:34 schrieb Alan Cox:

Quoted 17 lines
Quoted 4 lines
drivers/tty/serial/owl-uart.c +4 -0
+static void owl_uart_set_termios(struct uart_port *port,
+				 struct ktermios *termios,
+				 struct ktermios *old)
+{

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 325

Quoted 10 lines
drivers/tty/serial/owl-uart.c +10 -0
+	struct owl_uart_port *owl_port = to_owl_uart_port(port);
+	unsigned int baud;
+	u32 ctl;
+	unsigned long flags;
+
+	spin_lock_irqsave(&port->lock, flags);
+
+	/* We don't support modem control lines. */
+	termios->c_cflag &= ~(HUPCL | CMSPAR);
+	termios->c_cflag |= CLOCAL;

CLOCAL and HUPCL are software not hardware properties so are probably best not forced (it'll confuse some apps if you do)

Quoted 5 lines

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 328

Quoted 3 lines
drivers/tty/serial/owl-uart.c +3 -0
+
+	/* We don't support BREAK character recognition. */
+	termios->c_iflag &= ~(IGNBRK | BRKINT);

Ditto these

Fixed. These were obviously forward-ported from the vendor tree.

https://github.com/LeMaker/linux-actions/blob/linux-3.10.y/arch/arm/mach-owl/serial-owl.c

Quoted 18 lines

You do clear CMSPAR which is right if not supported but then later on we have:

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 366

Quoted 12 lines
drivers/tty/serial/owl-uart.c +12 -0
+	if (termios->c_cflag & PARENB) {
+		if (termios->c_cflag & CMSPAR) {
+			if (termios->c_cflag & PARODD)
+				ctl |= OWL_UART_CTL_PRS_MARK;
+			else
+				ctl |= OWL_UART_CTL_PRS_SPACE;
+		} else if (termios->c_cflag & PARODD)
+			ctl |= OWL_UART_CTL_PRS_ODD;
+		else
+			ctl |= OWL_UART_CTL_PRS_EVEN;
+	} else
+		ctl |= OWL_UART_CTL_PRS_NONE;

Which seems to indicate you do support CMSPAR so shouldn't be clearing it.

Again that's what the original code was like.

Since these register values do exist, I would rather not rip the code out, unless it's wrong. In my testing, not clearing CMSPAR works so far.

Quoted 8 lines

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 376

Quoted 2 lines
drivers/tty/serial/owl-uart.c +2 -0
+	baud = uart_get_baud_rate(port, termios, old, 9600, 3200000);
+	owl_uart_change_baudrate(owl_port, baud);

You should re-encode the resulting baud rate into the termios

        /* Don't rewrite B0 */
        if (tty_termios_baud_rate(termios))
                tty_termios_encode_baud_rate(termios, baud, baud);

Added, thanks.

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)
#48 lore raw

Re: [PATCH v4 16/28] tty: serial: owl: Implement console driver

In reply to Andreas Färber
Quoted 5 lines · Andreas F?rber

Implement serial console driver to complement earlycon.

Based on LeMaker linux-actions tree.

+#define OWL_UART_CTL_DWLS_MASK (0x3 << 0)

GENMASK() ?

Quoted 1 line

+#define OWL_UART_CTL_PRS_MASK (0x7 << 4)

Ditto.

Quoted 1 line

#define OWL_UART_STAT_TRFL_MASK (0x1f << 11)

Ditto.

Quoted 1 line

+static struct owl_uart_port *owl_uart_ports[OWL_UART_PORT_NUM];

And this is needed for...?

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 97

Quoted 3 lines
drivers/tty/serial/owl-uart.c +3 -0
+static void owl_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
+{
+}

Do we need an empty stub?

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 186

Quoted 4 lines
drivers/tty/serial/owl-uart.c +3 -0
+static void owl_uart_send_chars(struct uart_port *port)
+{
 
+               xmit->tail = (xmit->tail + 1) & (SERIAL_XMIT_SIZE - 1);

% SERIAL_XMIT_SIZE shorter (I hope it's a power of 2), but it's up to you.

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 239

Quoted 5 lines
drivers/tty/serial/owl-uart.c +4 -0
+}
 
+static irqreturn_t owl_uart_irq(int irq, void *dev_id)
+{
+       struct uart_port *port = (struct uart_port *)dev_id;

Useless casting.

Quoted 1 line

+ spin_lock(&port->lock);

spin_lock_irqsave() ?

Consider the kernel command option that switches all IRQ handlers to be threaded.

Quoted 14 lines
drivers/tty/serial/owl-uart.c +11 -0
+}
 
+static void owl_uart_change_baudrate(struct owl_uart_port *owl_port,
+                                    unsigned long baud)
+{
+       clk_set_rate(owl_port->clk, baud * 8);
+}
 
+static void owl_uart_release_port(struct uart_port *port)
+{
+       struct platform_device *pdev = to_platform_device(port->dev);
+       struct resource *res;
+
 

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 401

Quoted 10 lines
drivers/tty/serial/owl-uart.c +10 -0
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return;
+
+       if (port->flags & UPF_IOREMAP) {
+               devm_release_mem_region(port->dev, port->mapbase,
+                       resource_size(res));
+               devm_iounmap(port->dev, port->membase);
+               port->membase = NULL;
+       }

Above is entirely redundant.

Quoted 19 lines
drivers/tty/serial/owl-uart.c +19 -0
+}
+
+static int owl_uart_request_port(struct uart_port *port)
+{
+       struct platform_device *pdev = to_platform_device(port->dev);
+       struct resource *res;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -ENXIO;
+
+       if (!devm_request_mem_region(port->dev, port->mapbase,
+                       resource_size(res), dev_name(port->dev)))
+               return -EBUSY;
+
+       if (port->flags & UPF_IOREMAP) {
+               port->membase = devm_ioremap_nocache(port->dev, port->mapbase,
+                               resource_size(res));
+               if (!port->membase)

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off)

Quoted 10 lines
drivers/tty/serial/owl-uart.c +8 -0
+                       return -EBUSY;
+       }
+
+       return 0;
+}
 
+static void owl_uart_config_port(struct uart_port *port, int flags)
+{
 
+       if (flags & UART_CONFIG_TYPE) {

if (!(...))
return;

?

Quoted 17 lines
drivers/tty/serial/owl-uart.c +15 -0
+               port->type = PORT_OWL;
+               owl_uart_request_port(port);
+       }
+}
 
 
+static int owl_uart_probe(struct platform_device *pdev)
+{
+       struct resource *res_mem, *res_irq;
+       struct owl_uart_port *owl_port;
+       int ret;
+
+       if (pdev->dev.of_node)
+               pdev->id = of_alias_get_id(pdev->dev.of_node, "serial");
+
+       if (pdev->id < 0 || pdev->id >= OWL_UART_PORT_NUM) {
+               dev_err(&pdev->dev, "id %d out of range\n", pdev->id);

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 629

Quoted 10 lines
drivers/tty/serial/owl-uart.c +8 -0
+               return -EINVAL;
+       }
+
 
 
+       res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res_mem) {
+               dev_err(&pdev->dev, "could not get mem\n");
+               return -ENODEV;
+       }

You can use

struct resource *mem;

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); x = devm_ioremap_resource();
if (IS_ERR(x))
return PTR_ERR(x);

and remote IOREMAP flag below.

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 635

Quoted 5 lines
drivers/tty/serial/owl-uart.c +5 -0
+       res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (!res_irq) {
+               dev_err(&pdev->dev, "could not get irq\n");
+               return -ENODEV;
+       }

platform_get_irq()

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 640

Quoted 4 lines
drivers/tty/serial/owl-uart.c +4 -0
+       if (owl_uart_ports[pdev->id]) {
+               dev_err(&pdev->dev, "port %d already allocated\n", pdev->id);
+               return -EBUSY;
+       }

I guess it's redundant. It should be conflicting by resource (for example, IRQ).

Quoted 1 line

+ owl_port->clk = clk_get(&pdev->dev, NULL);

devm_ ?

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 658

Quoted 6 lines
drivers/tty/serial/owl-uart.c +4 -0
+       owl_port->port.iotype = UPIO_MEM;
+       owl_port->port.mapbase = res_mem->start;
+       owl_port->port.irq = res_irq->start;
 
 
+       owl_port->port.uartclk = clk_get_rate(owl_port->clk);

You need to check if it's 0 and use device property instead or bail out.

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 665

Quoted 8 lines
drivers/tty/serial/owl-uart.c +7 -0
+       owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY;
+       owl_port->port.x_char = 0;
+       owl_port->port.fifosize = 16;
+       owl_port->port.ops = &owl_uart_ops;
+
+       owl_uart_ports[pdev->id] = owl_port;
 
+       platform_set_drvdata(pdev, owl_port);

It should be just before return 0, right?..

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 669

Quoted 4 lines
drivers/tty/serial/owl-uart.c +4 -0
+
+       ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
+       if (ret)
+               owl_uart_ports[pdev->id] = NULL;

...and thus, taking into consideration redundancy of that global var:

      ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
      if (ret)
          retrun ret;

      platform_set_drvdata(pdev, owl_port);
      return 0;

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 678

Quoted 10 lines
drivers/tty/serial/owl-uart.c +8 -0
+       return ret;
+}
 
+
+static int owl_uart_remove(struct platform_device *pdev)
+{
 
+       struct owl_uart_port *owl_port;
+
+       owl_port = platform_get_drvdata(pdev);

Do above in one line.

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 680

Quoted 3 lines
drivers/tty/serial/owl-uart.c +2 -0
+       uart_remove_one_port(&owl_uart_driver, &owl_port->port);
 
+       owl_uart_ports[pdev->id] = NULL;

Redundant.

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off)

Quoted 6 lines
drivers/tty/serial/owl-uart.c +5 -0
+
+       return 0;
+}
 
+/* Actions Semi Owl UART */
+#define PORT_OWL       117

We can use holes for now IIUC.

See 36 or alike

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#49 lore raw

Re: [PATCH v4 16/28] tty: serial: owl: Implement console driver

Am 07.06.2017 um 16:37 schrieb Andy Shevchenko:

Quoted 9 lines · Andreas F?rber
Quoted 5 lines

Implement serial console driver to complement earlycon.

Based on LeMaker linux-actions tree.

+#define OWL_UART_CTL_DWLS_MASK (0x3 << 0)

GENMASK() ?

Quoted 7 lines
Quoted 1 line

+#define OWL_UART_CTL_PRS_MASK (0x7 << 4)

Ditto.

Quoted 1 line

#define OWL_UART_STAT_TRFL_MASK (0x1f << 11)

Ditto.

Changed.

Quoted 3 lines
Quoted 1 line

+static struct owl_uart_port *owl_uart_ports[OWL_UART_PORT_NUM];

And this is needed for...?

That's what both the downstream driver and several in-tree drivers are doing. See git grep '_ports\[' -- drivers/tty/serial/.

If you feel this is wrong, --verbose explanation please.

Quoted 5 lines

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 97

Quoted 3 lines
drivers/tty/serial/owl-uart.c +3 -0
+static void owl_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
+{
+}

Do we need an empty stub?

The only flag I have found in the CTL register is AFE for automatic RTS/CTS flow-control - RTS and CTS can only be read in STAT, not set.

And yes, if I drop this empty callback function, I get no serial output.

Quoted 6 lines

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 186

Quoted 4 lines
drivers/tty/serial/owl-uart.c +3 -0
+static void owl_uart_send_chars(struct uart_port *port)
+{
 
+               xmit->tail = (xmit->tail + 1) & (SERIAL_XMIT_SIZE - 1);

% SERIAL_XMIT_SIZE shorter (I hope it's a power of 2), but it's up to you.

crisv10 and meson_uart have it this way, modulo normalized whitespace. No serial driver uses % for it.

Quoted 7 lines

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 239

Quoted 5 lines
drivers/tty/serial/owl-uart.c +4 -0
+}
 
+static irqreturn_t owl_uart_irq(int irq, void *dev_id)
+{
+       struct uart_port *port = (struct uart_port *)dev_id;

Useless casting.

Fixed.

Quoted 3 lines
Quoted 1 line

+ spin_lock(&port->lock);

spin_lock_irqsave() ?

Fixed, with matching _irqrestore().

Quoted 28 lines

Consider the kernel command option that switches all IRQ handlers to be threaded.

Quoted 14 lines
drivers/tty/serial/owl-uart.c +11 -0
+}
 
+static void owl_uart_change_baudrate(struct owl_uart_port *owl_port,
+                                    unsigned long baud)
+{
+       clk_set_rate(owl_port->clk, baud * 8);
+}
 
+static void owl_uart_release_port(struct uart_port *port)
+{
+       struct platform_device *pdev = to_platform_device(port->dev);
+       struct resource *res;
+
 

drivers/tty/serial/owl-uart.c static inline u32 owl_uart_read(struct uart_port *port, unsigned int off) · line 401

Quoted 10 lines
drivers/tty/serial/owl-uart.c +10 -0
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return;
+
+       if (port->flags & UPF_IOREMAP) {
+               devm_release_mem_region(port->dev, port->mapbase,
+                       resource_size(res));
+               devm_iounmap(port->dev, port->membase);
+               port->membase = NULL;
+       }
Quoted 1 line

Above is entirely redundant.

Can you explain what this flag is used for and why some other drivers implement it? That word alone is not helping.

Quoted 28 lines
Quoted 27 lines
drivers/tty/serial/owl-uart.c +26 -0
+}
+
+static int owl_uart_request_port(struct uart_port *port)
+{
+       struct platform_device *pdev = to_platform_device(port->dev);
+       struct resource *res;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -ENXIO;
+
+       if (!devm_request_mem_region(port->dev, port->mapbase,
+                       resource_size(res), dev_name(port->dev)))
+               return -EBUSY;
+
+       if (port->flags & UPF_IOREMAP) {
+               port->membase = devm_ioremap_nocache(port->dev, port->mapbase,
+                               resource_size(res));
+               if (!port->membase)
+                       return -EBUSY;
+       }
+
+       return 0;
+}
 
+static void owl_uart_config_port(struct uart_port *port, int flags)
+{
Quoted 6 lines
Quoted 1 line

+ if (flags & UART_CONFIG_TYPE) {

if (!(...))
return;

?

Not a single serial driver does it that way.
I guess it prepares for handling other flags.

Quoted 39 lines
Quoted 17 lines
drivers/tty/serial/owl-uart.c +15 -0
+               port->type = PORT_OWL;
+               owl_uart_request_port(port);
+       }
+}
 
 
+static int owl_uart_probe(struct platform_device *pdev)
+{
+       struct resource *res_mem, *res_irq;
+       struct owl_uart_port *owl_port;
+       int ret;
+
+       if (pdev->dev.of_node)
+               pdev->id = of_alias_get_id(pdev->dev.of_node, "serial");
+
+       if (pdev->id < 0 || pdev->id >= OWL_UART_PORT_NUM) {
+               dev_err(&pdev->dev, "id %d out of range\n", pdev->id);

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 629

Quoted 10 lines
drivers/tty/serial/owl-uart.c +8 -0
+               return -EINVAL;
+       }
+
 
 
+       res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res_mem) {
+               dev_err(&pdev->dev, "could not get mem\n");
+               return -ENODEV;
+       }

You can use

struct resource *mem;

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); x = devm_ioremap_resource();
if (IS_ERR(x))
return PTR_ERR(x);

and remote IOREMAP flag below.

Quoted 7 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 635

Quoted 5 lines
drivers/tty/serial/owl-uart.c +5 -0
+       res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (!res_irq) {
+               dev_err(&pdev->dev, "could not get irq\n");
+               return -ENODEV;
+       }

platform_get_irq()

Adopted.

Quoted 6 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 640

Quoted 4 lines
drivers/tty/serial/owl-uart.c +4 -0
+       if (owl_uart_ports[pdev->id]) {
+               dev_err(&pdev->dev, "port %d already allocated\n", pdev->id);
+               return -EBUSY;
+       }

I guess it's redundant. It should be conflicting by resource (for example, IRQ).

No, currently not. Memory resources are allocated on request_port, IRQ is requested on startup.

Quoted 3 lines
Quoted 1 line

+ owl_port->clk = clk_get(&pdev->dev, NULL);

devm_ ?

Changed.

Quoted 8 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 658

Quoted 6 lines
drivers/tty/serial/owl-uart.c +4 -0
+       owl_port->port.iotype = UPIO_MEM;
+       owl_port->port.mapbase = res_mem->start;
+       owl_port->port.irq = res_irq->start;
 
 
+       owl_port->port.uartclk = clk_get_rate(owl_port->clk);

You need to check if it's 0 and use device property instead or bail out.

Fixed. Since this is a new driver, I'd rather not fall back to clock-frequency property here. The binding has clocks property as required.

Quoted 10 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 665

Quoted 8 lines
drivers/tty/serial/owl-uart.c +7 -0
+       owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY;
+       owl_port->port.x_char = 0;
+       owl_port->port.fifosize = 16;
+       owl_port->port.ops = &owl_uart_ops;
+
+       owl_uart_ports[pdev->id] = owl_port;
 
+       platform_set_drvdata(pdev, owl_port);

It should be just before return 0, right?..

Does it matter?

Quoted 21 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 669

Quoted 4 lines
drivers/tty/serial/owl-uart.c +4 -0
+
+       ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
+       if (ret)
+               owl_uart_ports[pdev->id] = NULL;

...and thus, taking into consideration redundancy of that global var:

      ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
      if (ret)
          retrun ret;

      platform_set_drvdata(pdev, owl_port);
      return 0;
Quoted 6 lines
drivers/tty/serial/owl-uart.c +5 -0
+       return ret;
+}
 
+
+static int owl_uart_remove(struct platform_device *pdev)
+{
Quoted 5 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 678

Quoted 3 lines
drivers/tty/serial/owl-uart.c +3 -0
+       struct owl_uart_port *owl_port;
+
+       owl_port = platform_get_drvdata(pdev);

Do above in one line.

Done.

Quoted 10 lines

drivers/tty/serial/owl-uart.c owl_uart_early_console_setup(struct earlycon_device *device, const char *opt) · line 680

Quoted 3 lines
drivers/tty/serial/owl-uart.c +2 -0
+       uart_remove_one_port(&owl_uart_driver, &owl_port->port);
 
+       owl_uart_ports[pdev->id] = NULL;

Redundant.

Quoted 3 lines
drivers/tty/serial/owl-uart.c +3 -0
+
+       return 0;
+}
Quoted 6 lines

include/uapi/linux/serial_core.h line 275

Quoted 2 lines
include/uapi/linux/serial_core.h +2 -0
+/* Actions Semi Owl UART */
+#define PORT_OWL       117

We can use holes for now IIUC.

See 36 or alike

Okay. 36 works, too.

Please point to a good example of a serial driver that is not "redundant" in your view. That will help also with other pending serial drivers of mine. Thanks.

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)
author maintainer
#50 lore raw

PATCH v4 17/28 ARM64: dts: actions: s900-bubblegum-96: Add fake uart5 clock

In reply to Andreas Färber

Give the serial driver a fixed-clock as input for baudrate 115200.

---
v2 -> v3 -> v4: 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
index a0c3484dbd12..21ca80f9941c 100644
@@ -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.12.3
author maintainer Applied
#51 lore raw

Re: [PATCH v4 17/28] ARM64: dts: actions: s900-bubblegum-96: Add fake uart5 clock

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 10 lines

Give the serial driver a fixed-clock as input for baudrate 115200.

---
v2 -> v3 -> v4: unchanged

v2: new

 arch/arm64/boot/dts/actions/s900-bubblegum-96.dts | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to v4.14/dt64:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.14/dt64

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)
author maintainer
#52 lore raw

PATCH v4 18/28 ARM: dts: s500-guitar-bb-rev-b: Add fake uart3 clock

In reply to Andreas Färber

Add a fixed-clock for baudrate 115200.

---
v2 -> v3 -> v4: 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
index 834b71df31bd..f6fd10a9cd34 100644
@@ -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.12.3
author maintainer Applied
#53 lore raw

Re: [PATCH v4 18/28] ARM: dts: s500-guitar-bb-rev-b: Add fake uart3 clock

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 10 lines

Add a fixed-clock for baudrate 115200.

---
v2 -> v3 -> v4: unchanged

v2: new

 arch/arm/boot/dts/s500-guitar-bb-rev-b.dts | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to v4.14/dt:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.14/dt

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)
author maintainer
#54 lore raw

PATCH v4 19/28 dt-bindings: arm: cpus: Add S500 enable-method

In reply to Andreas Färber

The Actions Semi S500 SoC requires a special secondary CPU boot procedure.

---
v3 -> v4: Unchanged

v3: new

 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/cpus.txt +1 -0
index 2713aadb7411..ad1913bea8d7 100644
@@ -193,6 +193,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.12.3
author maintainer Applied
#55 lore raw

Re: [PATCH v4 19/28] dt-bindings: arm: cpus: Add S500 enable-method

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 11 lines

The Actions Semi S500 SoC requires a special secondary CPU boot procedure.

---
v3 -> v4: Unchanged

v3: new

 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

Thanks, applied to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#56 lore raw

PATCH v4 20/28 ARM: owl: Implement CPU enable-method for S500

In reply to Andreas Färber

Allow to bring up CPU1.

Based on LeMaker linux-actions tree.

---
v3 -> v4: Unchanged

v3: new

 arch/arm/mach-actions/Makefile  |   3 +
 arch/arm/mach-actions/headsmp.S |  68 ++++++++++++++++
 arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
 create mode 100644 arch/arm/mach-actions/headsmp.S
 create mode 100644 arch/arm/mach-actions/platsmp.c
arch/arm/mach-actions/Makefile +3 -0
index 524c3817bcb3..217e95d04b43 100644
@@ -1 +1,4 @@
 obj-$(CONFIG_ARCH_ACTIONS) += owl.o
+obj-${CONFIG_ARCH_ACTIONS} += platsmp.o headsmp.o
+
+AFLAGS_headsmp.o := -Wa,-march=armv7-a
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.12.3
author maintainer Applied
#57 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 8 lines

Allow to bring up CPU1.

Based on LeMaker linux-actions tree.

---
v3 -> v4: Unchanged

Quoted 8 lines

v3: new

 arch/arm/mach-actions/Makefile  |   3 +
 arch/arm/mach-actions/headsmp.S |  68 ++++++++++++++++
 arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
 create mode 100644 arch/arm/mach-actions/headsmp.S
 create mode 100644 arch/arm/mach-actions/platsmp.c

Applied to linux-actions.git v4.13/arm branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/arm

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)
maintainer
#58 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

In reply to Andreas Färber
Quoted 5 lines · Andreas F?rber

Allow to bring up CPU1.

Based on LeMaker linux-actions tree.

Quoted 8 lines

---
v3 -> v4: Unchanged

v3: new

 arch/arm/mach-actions/Makefile  |   3 +
 arch/arm/mach-actions/headsmp.S |  68 ++++++++++++++++
 arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++

I now see build errors in linux-next:

/git/arm-soc/arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
/git/arm-soc/arch/arm/mach-actions/platsmp.c:39:2: error:
'pen_release' undeclared (first use in this function); did you mean 'seq_release'?
pen_release = val;
^~~~~~~~~~~
seq_release
/git/arm-soc/arch/arm/mach-actions/platsmp.c:39:2: note: each undeclared identifier is reported only once for each function it appears in
/git/arm-soc/arch/arm/mach-actions/platsmp.c: In function 's500_wakeup_secondary':
/git/arm-soc/arch/arm/mach-actions/platsmp.c:79:2: error: implicit declaration of function 'dsb_sev' [-Werror=implicit-function-declaration]
dsb_sev();
^~~~~~~
/git/arm-soc/arch/arm/mach-actions/platsmp.c: In function 's500_smp_boot_secondary':
/git/arm-soc/arch/arm/mach-actions/platsmp.c:108:7: error:
'pen_release' undeclared (first use in this function); did you mean 'seq_release'?

Quoted 74 lines
arch/arm/mach-actions/platsmp.c new file +74 -0
+static DEFINE_SPINLOCK(boot_lock);
+
+static void write_pen_release(int val)
+{
+       pen_release = val;
+       smp_wmb();
+       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
+       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+}
+
+static void s500_smp_secondary_init(unsigned int cpu)
+{
+       /*
+        * let the primary processor know we're out of the
+        * pen, then head off into the C entry point
+        */
+       write_pen_release(-1);
+
+       spin_lock(&boot_lock);
+       spin_unlock(&boot_lock);
+}
+
+void owl_secondary_startup(void);
+
+static int s500_wakeup_secondary(unsigned int cpu)
+{
+       if (cpu > 3)
+               return -EINVAL;
+
+       switch (cpu) {
+       case 2:
+       case 3:
+               /* CPU2/3 are power-gated */
+               return -EINVAL;
+       }
+
+       /* wait for CPUx to run to WFE instruction */
+       udelay(200);
+
+       writel(virt_to_phys(owl_secondary_startup),
+              timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);
+       writel(OWL_CPUx_FLAG_BOOT,
+              timer_base_addr + OWL_CPU1_FLAG + (cpu - 1) * 4);
+
+       dsb_sev();
+       mb();
+
+       return 0;
+}
+
+static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+       unsigned long timeout;
+       int ret;
+
+       ret = s500_wakeup_secondary(cpu);
+       if (ret)
+               return ret;
+
+       udelay(10);
+
+       spin_lock(&boot_lock);
+
+       /*
+        * The secondary processor is waiting to be released from
+        * the holding pen - release it, then wait for it to flag
+        * that it has been released by resetting pen_release.
+        */
+       write_pen_release(cpu_logical_map(cpu));
+       smp_send_reschedule(cpu);
+
+       timeout = jiffies + (1 * HZ);
+       while (time_before(jiffies, timeout)) {
+               if (pen_release == -1)

arch/arm/mach-actions/platsmp.c line 118

Quoted 10 lines
arch/arm/mach-actions/platsmp.c new file +10 -0
+                       break;
+       }
+
+       writel(0, timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);
+       writel(0, timer_base_addr + OWL_CPU1_FLAG + (cpu - 1) * 4);
+
+       spin_unlock(&boot_lock);
+
+       return pen_release != -1 ? -ENOSYS : 0;
+}

This looks more complicated than necessary. Why do you need the holding pen when you have a register to start up the CPU?

Arnd

maintainer
#59 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Quoted 15 lines · Arnd Bergmann
Quoted 5 lines · Andreas F?rber

Allow to bring up CPU1.

Based on LeMaker linux-actions tree.

Quoted 8 lines

---
v3 -> v4: Unchanged

v3: new

 arch/arm/mach-actions/Makefile  |   3 +
 arch/arm/mach-actions/headsmp.S |  68 ++++++++++++++++
 arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines

I now see build errors in linux-next:

/git/arm-soc/arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
/git/arm-soc/arch/arm/mach-actions/platsmp.c:39:2: error:
'pen_release' undeclared (first use in this function); did you mean

I have a fix and tested it now. Please fold this into your patch:

Arnd

Subject: [PATCH] ARM: owl: fix non-SMP build

arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
arch/arm/mach-actions/platsmp.c:39:2: error: 'pen_release' undeclared (first use in this function); did you mean 'seq_release'?

arch/arm/mach-actions/Makefile +2 -2
index 217e95d04b43..94f8dbafba21 100644
@@ -1,4 +1,4 @@
-obj-$(CONFIG_ARCH_ACTIONS) += owl.o
-obj-${CONFIG_ARCH_ACTIONS} += platsmp.o headsmp.o
+obj-y += owl.o
+obj-$(CONFIG_SMP) += platsmp.o headsmp.o
 
 AFLAGS_headsmp.o := -Wa,-march=armv7-a
author maintainer
#60 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Am 21.06.2017 um 12:25 schrieb Arnd Bergmann:

Quoted 39 lines · Arnd Bergmann
Quoted 15 lines · Andreas F?rber
Quoted 5 lines

Allow to bring up CPU1.

Based on LeMaker linux-actions tree.

Quoted 8 lines

---
v3 -> v4: Unchanged

v3: new

 arch/arm/mach-actions/Makefile  |   3 +
 arch/arm/mach-actions/headsmp.S |  68 ++++++++++++++++
 arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines

I now see build errors in linux-next:

/git/arm-soc/arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
/git/arm-soc/arch/arm/mach-actions/platsmp.c:39:2: error:
'pen_release' undeclared (first use in this function); did you mean

I have a fix and tested it now. Please fold this into your patch:

Arnd

Subject: [PATCH] ARM: owl: fix non-SMP build

arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
arch/arm/mach-actions/platsmp.c:39:2: error: 'pen_release' undeclared (first use in this function); did you mean 'seq_release'?

arch/arm/mach-actions/Makefile +0 -0
index 217e95d04b43..94f8dbafba21 100644

arch/arm/mach-actions/Makefile line 2

Quoted 4 lines
arch/arm/mach-actions/Makefile +2 -2
@@ -1,4 +1,4 @@
-obj-$(CONFIG_ARCH_ACTIONS) += owl.o
-obj-${CONFIG_ARCH_ACTIONS} += platsmp.o headsmp.o
+obj-y += owl.o
+obj-$(CONFIG_SMP) += platsmp.o headsmp.o

Sorry. Fixed up the two patches, thanks!

Interestingly the below issue had been found by automatic patch testing, but the above wasn't. Maybe you can contribute your non-SMP config for the bots, to help catch this earlier?

arch/arm/mach-actions/Makefile line 4

Quoted 3 lines
arch/arm/mach-actions/Makefile +0 -0
 AFLAGS_headsmp.o := -Wa,-march=armv7-a
 

Cheers,
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)
maintainer
#61 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Quoted 47 lines · Andreas F?rber

Am 21.06.2017 um 12:25 schrieb Arnd Bergmann:

Quoted 39 lines · Arnd Bergmann
Quoted 15 lines · Andreas F?rber
Quoted 5 lines

Allow to bring up CPU1.

Based on LeMaker linux-actions tree.

Quoted 8 lines

---
v3 -> v4: Unchanged

v3: new

 arch/arm/mach-actions/Makefile  |   3 +
 arch/arm/mach-actions/headsmp.S |  68 ++++++++++++++++
 arch/arm/mach-actions/platsmp.c | 166 ++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines

I now see build errors in linux-next:

/git/arm-soc/arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
/git/arm-soc/arch/arm/mach-actions/platsmp.c:39:2: error:
'pen_release' undeclared (first use in this function); did you mean

I have a fix and tested it now. Please fold this into your patch:

Arnd

Subject: [PATCH] ARM: owl: fix non-SMP build

arch/arm/mach-actions/platsmp.c: In function 'write_pen_release':
arch/arm/mach-actions/platsmp.c:39:2: error: 'pen_release' undeclared (first use in this function); did you mean 'seq_release'?

arch/arm/mach-actions/Makefile +0 -0
index 217e95d04b43..94f8dbafba21 100644

arch/arm/mach-actions/Makefile line 2

Quoted 4 lines
arch/arm/mach-actions/Makefile +2 -2
@@ -1,4 +1,4 @@
-obj-$(CONFIG_ARCH_ACTIONS) += owl.o
-obj-${CONFIG_ARCH_ACTIONS} += platsmp.o headsmp.o
+obj-y += owl.o
+obj-$(CONFIG_SMP) += platsmp.o headsmp.o

Sorry. Fixed up the two patches, thanks!

Quoted 3 lines

Interestingly the below issue had been found by automatic patch testing, but the above wasn't. Maybe you can contribute your non-SMP config for the bots, to help catch this earlier?

This was just a randconfig build. On ARM32, we do test "multi_v7_defconfig+CONFIG_SMP=n"
in kernelci, but that only tests mach-actions after that gets added to multi_v7_defconfig. Not sure if it's worth adding an allmodconfig+CONFIG_SMP=n" build, the allmodconfig builds are rather expensive.

Arnd

maintainer
#62 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

In reply to Arnd Bergmann
Quoted 29 lines
Quoted 29 lines
arch/arm/mach-actions/platsmp.c new file +29 -0
+static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+       unsigned long timeout;
+       int ret;
+
+       ret = s500_wakeup_secondary(cpu);
+       if (ret)
+               return ret;
+
+       udelay(10);
+
+       spin_lock(&boot_lock);
+
+       /*
+        * The secondary processor is waiting to be released from
+        * the holding pen - release it, then wait for it to flag
+        * that it has been released by resetting pen_release.
+        */
+       write_pen_release(cpu_logical_map(cpu));
+       smp_send_reschedule(cpu);
+
+       timeout = jiffies + (1 * HZ);
+       while (time_before(jiffies, timeout)) {
+               if (pen_release == -1)
+                       break;
+       }
+
+       writel(0, timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);
+       writel(0, timer_base_addr + OWL_CPU1_FLAG + (cpu - 1) * 4);
Quoted 9 lines

arch/arm/mach-actions/platsmp.c line 118

Quoted 5 lines
arch/arm/mach-actions/platsmp.c new file +5 -0
+
+       spin_unlock(&boot_lock);
+
+       return pen_release != -1 ? -ENOSYS : 0;
+}

This looks more complicated than necessary. Why do you need the holding pen when you have a register to start up the CPU?

It seems you missed my question here. Can you please follow up, and if possible send a patch to remove the pen_release logic that appears to be unnecessary here?

Arnd

author maintainer
#63 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Am 29.06.2017 um 17:07 schrieb Arnd Bergmann:

Quoted 39 lines
Quoted 29 lines
Quoted 29 lines
arch/arm/mach-actions/platsmp.c new file +29 -0
+static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+       unsigned long timeout;
+       int ret;
+
+       ret = s500_wakeup_secondary(cpu);
+       if (ret)
+               return ret;
+
+       udelay(10);
+
+       spin_lock(&boot_lock);
+
+       /*
+        * The secondary processor is waiting to be released from
+        * the holding pen - release it, then wait for it to flag
+        * that it has been released by resetting pen_release.
+        */
+       write_pen_release(cpu_logical_map(cpu));
+       smp_send_reschedule(cpu);
+
+       timeout = jiffies + (1 * HZ);
+       while (time_before(jiffies, timeout)) {
+               if (pen_release == -1)
+                       break;
+       }
+
+       writel(0, timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);
+       writel(0, timer_base_addr + OWL_CPU1_FLAG + (cpu - 1) * 4);
Quoted 9 lines

arch/arm/mach-actions/platsmp.c line 118

Quoted 5 lines
arch/arm/mach-actions/platsmp.c new file +5 -0
+
+       spin_unlock(&boot_lock);
+
+       return pen_release != -1 ? -ENOSYS : 0;
+}

This looks more complicated than necessary. Why do you need the holding pen when you have a register to start up the CPU?

Quoted 3 lines

It seems you missed my question here. Can you please follow up, and if possible send a patch to remove the pen_release logic that appears to be unnecessary here?

I do not have any documentation on these registers, only the downstream code that I forward-ported here. If you tell me what you mean exactly, I can do some testing and if it still works submit a patch to simplify it.

Comments from the so far quiet Actions Semi side would help, too.

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)
maintainer
#64 lore raw

Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Quoted 11 lines · Andreas F?rber

Am 29.06.2017 um 17:07 schrieb Arnd Bergmann:

Quoted 4 lines

It seems you missed my question here. Can you please follow up, and if possible send a patch to remove the pen_release logic that appears to be unnecessary here?

I do not have any documentation on these registers, only the downstream code that I forward-ported here. If you tell me what you mean exactly, I can do some testing and if it still works submit a patch to simplify it.

Comments from the so far quiet Actions Semi side would help, too.

IIRC, there are two ways to implement SMP bootup: either you have registers to tell the secondary CPU how to start up out of reset or they get put into a holding pen during early boot where they spin waiting for a variable to get written.

However, doing both is not necessary. See for example mach-sunxi for an example without the holding pen. I think you can just delete half of your file to do the same.

Arnd

author maintainer
#65 lore raw

PATCH 1/1 ARM: owl: smp: Drop bogus holding pen

The S500 SoC can start secondary CPUs without busy-looping for pen_release, so simplify the SMP code compared to the LeMaker kernel tree.

Fixes 172067e0bc87 ("ARM: owl: Implement CPU enable-method for S500")
Cc David Liu <[email protected]>
---
 arch/arm/mach-actions/headsmp.S | 20 ++------------------
 arch/arm/mach-actions/platsmp.c | 29 +----------------------------
 2 files changed, 3 insertions(+), 46 deletions(-)
arch/arm/mach-actions/headsmp.S +2 -18
index dc4832fc101a..65f53bdb69e7 100644
@@ -2,6 +2,8 @@
  * Copyright 2012 Actions Semi Inc.
  * Author: Actions Semi, Inc.
  *
+ * 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
@@ -46,23 +48,5 @@ ENTRY(owl_v7_invalidate_l1)
 ENDPROC(owl_v7_invalidate_l1)
 
 ENTRY(owl_secondary_startup)
-	mrc	p15, 0, r0, c0, c0, 5
-	and	r0, r0, #0xf
-	adr	r4, 1f
-	ldmia	r4, {r5, r6}
-	sub	r4, r4, r5
-	add	r6, r6, r4
-pen:
-	ldr	r7, [r6]
-	cmp	r7, r0
-	bne	pen
-
-	/*
-	 * we've been released from the holding pen: secondary_stack
-	 * should now contain the SVC stack for this core
-	 */
 	bl	owl_v7_invalidate_l1
 	b	secondary_startup
-
-1:	.long	.
-	.long	pen_release
arch/arm/mach-actions/platsmp.c +1 -28
index b4806ce0e9bb..12a9e331b432 100644
@@ -41,26 +41,6 @@ static int ncores;
 
 static DEFINE_SPINLOCK(boot_lock);
 
-static void write_pen_release(int val)
-{
-	pen_release = val;
-	smp_wmb();
-	__cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-	outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
-}
-
-static void s500_smp_secondary_init(unsigned int cpu)
-{
-	/*
-	 * let the primary processor know we're out of the
-	 * pen, then head off into the C entry point
-	 */
-	write_pen_release(-1);
-
-	spin_lock(&boot_lock);
-	spin_unlock(&boot_lock);
-}
-
 void owl_secondary_startup(void);
 
 static int s500_wakeup_secondary(unsigned int cpu)
@@ -115,12 +95,6 @@ static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 	spin_lock(&boot_lock);
 
-	/*
-	 * The secondary processor is waiting to be released from
-	 * the holding pen - release it, then wait for it to flag
-	 * that it has been released by resetting pen_release.
-	 */
-	write_pen_release(cpu_logical_map(cpu));
 	smp_send_reschedule(cpu);
 
 	timeout = jiffies + (1 * HZ);
@@ -134,7 +108,7 @@ static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 	spin_unlock(&boot_lock);
 
-	return pen_release != -1 ? -ENOSYS : 0;
+	return 0;
 }
 
 static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
@@ -192,7 +166,6 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 
 static const struct smp_operations s500_smp_ops __initconst = {
 	.smp_prepare_cpus = s500_smp_prepare_cpus,
-	.smp_secondary_init = s500_smp_secondary_init,
 	.smp_boot_secondary = s500_smp_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(s500_smp, "actions,s500-smp", &s500_smp_ops);
Signature · 1 line
2.12.3
maintainer
#66 lore raw

Re: [PATCH] ARM: owl: smp: Drop bogus holding pen

Quoted 7 lines · Andreas F?rber

The S500 SoC can start secondary CPUs without busy-looping for pen_release, so simplify the SMP code compared to the LeMaker kernel tree.

Fixes 172067e0bc87 ("ARM: owl: Implement CPU enable-method for S500")
Cc David Liu <[email protected]>

Looks good to me. I applied both on top of next/soc before tagging the branch for 4.13,
so this version is going to be what we merge.

I saw that David had another suggestion for simplifying it further. That also looks
good, but it's less urgent, so please implement that as an add-on patch and send it for 4.14, unless you decide there is a reason it needs to be included in 4.13 as
well.

Thanks!

Arnd

#67 lore raw

答复: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

In reply to Andreas Färber

Hi, Andrea

OWL_CPUx_ADDR is the physical address of CPUx wakeup function. OWL_CPUx_FLAG is a valid flag of OWL_CPUx_ADDR.

After CPUxs are wakeuped by SEV instruction, they will check their own OWL_CPUx_FLAG register. If the register vlaue is 0x55aa, CPUx will jump to OWL_CPUx_ADDR to boot up, otherwize go to sleep by WFE.

So the pen release staff is not necessary, you can remove these code safely.

BTW: CPU2/3 must exit the power gate state before wakeup, and CPU1 is always power on and has no power gate control.

Best Regards,
David Liu

-----????-----
???: Andreas F?rber [mailto:afaerber at suse.de]
????: 2017?6?29? 23:22
???: Arnd Bergmann; Thomas Liau
??: Linux ARM; mp-cs; ???; ??; ???; 96boards at ucrobotics.com; support at lemaker.org; Linux Kernel Mailing List; Russell King ??: Re: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Am 29.06.2017 um 17:07 schrieb Arnd Bergmann:

Quoted 38 lines
Quoted 28 lines
Quoted 28 lines
arch/arm/mach-actions/platsmp.c new file +28 -0
+static int s500_smp_boot_secondary(unsigned int cpu, struct 
+task_struct *idle) {
+       unsigned long timeout;
+       int ret;
+
+       ret = s500_wakeup_secondary(cpu);
+       if (ret)
+               return ret;
+
+       udelay(10);
+
+       spin_lock(&boot_lock);
+
+       /*
+        * The secondary processor is waiting to be released from
+        * the holding pen - release it, then wait for it to flag
+        * that it has been released by resetting pen_release.
+        */
+       write_pen_release(cpu_logical_map(cpu));
+       smp_send_reschedule(cpu);
+
+       timeout = jiffies + (1 * HZ);
+       while (time_before(jiffies, timeout)) {
+               if (pen_release == -1)
+                       break;
+       }
+
+       writel(0, timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);
Quoted 9 lines

arch/arm/mach-actions/platsmp.c

Quoted 5 lines
arch/arm/mach-actions/platsmp.c new file +5 -0
+       writel(0, timer_base_addr + OWL_CPU1_FLAG + (cpu - 1) * 4);
+
+       spin_unlock(&boot_lock);
+
+       return pen_release != -1 ? -ENOSYS : 0; }

This looks more complicated than necessary. Why do you need the holding pen when you have a register to start up the CPU?

Quoted 3 lines

It seems you missed my question here. Can you please follow up, and if possible send a patch to remove the pen_release logic that appears to be unnecessary here?

I do not have any documentation on these registers, only the downstream code that I forward-ported here. If you tell me what you mean exactly, I can do some testing and if it still works submit a patch to simplify it.

Comments from the so far quiet Actions Semi side would help, too.

Regards,
Andreas

--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)

author maintainer
#68 lore raw

Re: 答复: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Hi David,

Am 01.07.2017 um 06:42 schrieb ??:

Quoted 6 lines

OWL_CPUx_ADDR is the physical address of CPUx wakeup function. OWL_CPUx_FLAG is a valid flag of OWL_CPUx_ADDR.

After CPUxs are wakeuped by SEV instruction, they will check their own OWL_CPUx_FLAG register. If the register vlaue is 0x55aa, CPUx will jump to OWL_CPUx_ADDR to boot up, otherwize go to sleep by WFE.

So the pen release staff is not necessary, you can remove these code safely.

Thank you for the quick confirmation!

I have just tested a patch, and it appears to work.

Is owl_v7_invalidate_l1 necessary? mach-sunxi (that Arnd pointed to as example) uses secondary_startup directly, without custom assembler code.

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/mach-actions/headsmp.S

Quoted 1 line

BTW: CPU2/3 must exit the power gate state before wakeup, and CPU1 is always power on and has no power gate control.

Yes, the S500 SPS was luckily documented in the manual. The power-gating for CPU2/3 is already implemented:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/mach-actions/platsmp.c

For S900 however SPS is sadly not documented... If you know who at Actions Semi could help there, please also take a look at:
https://github.com/96boards/documentation/issues/59

Best 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)
#69 lore raw

RE: RE: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Hi, Andreas

Actually the owl_v7_invalidate_l1 is not needed, and the headsmp-owl.S file can be removed if pen release staff is not used. The CPUx can jump to secondary_startup directly by setting OWL_CPUx_ADDR register.

Because S900 is aarch64 architecture, it cannot boot CPUx simply by setting SPS register. It depends on the low-level arm-trusted-firmware. Linux kernel can boot up CPUx by PSCI interface, and the arm-trusted-firmware will power on CPUx, initialize EL3 register and jump to EL2 entry in Linux kernel.

Best Regards,
David Liu

-----Original Message-----
From: Andreas F?rber [mailto:afaerber at suse.de]
Sent: Sunday, July 02, 2017 3:57 AM
To: ??
Cc: Arnd Bergmann; Thomas Liau; Linux ARM; mp-cs; ???; ???; 96boards at ucrobotics.com; support at lemaker.org; Linux Kernel Mailing List; Russell King
Subject: Re: ??: [PATCH v4 20/28] ARM: owl: Implement CPU enable-method for S500

Hi David,

Am 01.07.2017 um 06:42 schrieb ??:

Quoted 6 lines

OWL_CPUx_ADDR is the physical address of CPUx wakeup function. OWL_CPUx_FLAG is a valid flag of OWL_CPUx_ADDR.

After CPUxs are wakeuped by SEV instruction, they will check their own OWL_CPUx_FLAG register. If the register vlaue is 0x55aa, CPUx will jump to OWL_CPUx_ADDR to boot up, otherwize go to sleep by WFE.

So the pen release staff is not necessary, you can remove these code safely.

Thank you for the quick confirmation!

I have just tested a patch, and it appears to work.

Is owl_v7_invalidate_l1 necessary? mach-sunxi (that Arnd pointed to as example) uses secondary_startup directly, without custom assembler code.

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/mach-actions/headsmp.S

Quoted 1 line

BTW: CPU2/3 must exit the power gate state before wakeup, and CPU1 is always power on and has no power gate control.

Yes, the S500 SPS was luckily documented in the manual. The power-gating for CPU2/3 is already implemented:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/mach-actions/platsmp.c

For S900 however SPS is sadly not documented... If you know who at Actions Semi could help there, please also take a look at:
https://github.com/96boards/documentation/issues/59

Best 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)
author maintainer
#70 lore raw

PATCH 1/1 ARM: owl: smp: Drop owl_secondary_boot()

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---
 arch/arm/mach-actions/Makefile  |  4 +---
 arch/arm/mach-actions/headsmp.S | 52 -----------------------------------------
 arch/arm/mach-actions/platsmp.c |  2 +-
 3 files changed, 2 insertions(+), 56 deletions(-)
 delete mode 100644 arch/arm/mach-actions/headsmp.S
arch/arm/mach-actions/Makefile +1 -3
index c0f116241da7..13831037d8cd 100644
@@ -1,3 +1 @@
-obj-${CONFIG_SMP} += platsmp.o headsmp.o
-
-AFLAGS_headsmp.o := -Wa,-march=armv7-a
+obj-${CONFIG_SMP} += platsmp.o
arch/arm/mach-actions/headsmp.S deleted +0 -52

52 lines not on this page · raw message

arch/arm/mach-actions/platsmp.c +1 -1
index 12a9e331b432..506ba32f235d 100644
@@ -71,7 +71,7 @@ static int s500_wakeup_secondary(unsigned int cpu)
 	/* wait for CPUx to run to WFE instruction */
 	udelay(200);
 
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
 	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);
 	writel(OWL_CPUx_FLAG_BOOT,
 	       timer_base_addr + OWL_CPU1_FLAG + (cpu - 1) * 4);
Signature · 1 line
2.12.3
#71 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Quoted 14 lines · Andreas F?rber

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
Quoted 1 line
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Signature · 1 line
Florian
author maintainer
#72 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 5 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);

What exactly is the difference between the two macros that makes it wrong despite apparently working? In particular I am wondering whether the SoC/board vendors in CC need to fix it in their 3.10 trees, too.

In any case if this is a bug, I would rather fix it in a separate patch for 4.13 and leave the name swap (this patch) for 4.14.

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)
#73 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Quoted 29 lines · Andreas F?rber

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 5 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

Quoted 8 lines

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);

They can probably use __pa_symbol() (I must admit I didn't know about it before this email)

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#74 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Quoted 33 lines · Alexandre Belloni
Quoted 32 lines · Andreas F?rber

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 5 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

Quoted 8 lines
Quoted 5 lines

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);

They can probably use __pa_symbol() (I must admit I didn't know about it before this email)

This is fine, do you mind sending fixes for the at91 parts? Gregory, can you also fix the mv98dx3236 platform SMP code?

Thanks!

Signature · 1 line
Florian
#75 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Hi Florian,

Quoted 43 lines · Florian Fainelli
Quoted 42 lines · Alexandre Belloni
Quoted 40 lines · Andreas F?rber

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 8 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);
Quoted 5 lines
Quoted 2 lines

They can probably use __pa_symbol() (I must admit I didn't know about it before this email)

This is fine, do you mind sending fixes for the at91 parts? Gregory, can you also fix the mv98dx3236 platform SMP code?

Yes sure, actually, for Armada XP we already use __pa_symbol() but from an other file that why I didn't pay attention on it.

Gregory

Quoted 4 lines

Thanks!

Signature · 1 line
Florian
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#76 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Quoted 47 lines · Gregory CLEMENT

Hi Florian,

Quoted 43 lines · Florian Fainelli
Quoted 42 lines · Alexandre Belloni
Quoted 40 lines · Andreas F?rber

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 8 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

They can probably use __pa_symbol() (I must admit I didn't know about it before this email)

This is fine, do you mind sending fixes for the at91 parts? Gregory, can you also fix the mv98dx3236 platform SMP code?

Yes sure, actually, for Armada XP we already use __pa_symbol() but from an other file that why I didn't pay attention on it.

No worries, the conversion sort of happened in one go, so it's always a game of catching up patches merged after that one went in.

Signature · 1 line
Florian
reviewer
#77 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

In reply to Andreas Färber
Quoted 32 lines · Andreas F?rber

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 5 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

Quoted 7 lines

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);

What exactly is the difference between the two macros that makes it wrong despite apparently working?

virt_to_phys() is intended to operate on the linear/direct mapping of RAM.

__pa_symbol() is intended to operate on the kernel mapping, which may not be in the linear/direct mapping on all architectures. e.g. arm64 and x86_64 map the kernel image and RAM separately.

On 32-bit ARM the kernel image mapping is tied to the linear/direct mapping, so that works, but as it's semantically wrong (and broken for generic code), the DEBUG_VIRTUAL checks complain.

Quoted 5 lines

In particular I am wondering whether
the SoC/board vendors in CC need to fix it in their 3.10 trees, too.

In any case if this is a bug, I would rather fix it in a separate patch for 4.13 and leave the name swap (this patch) for 4.14.

To the best of my knowledge there's no functional problem in this particular case, though it should be cleaned up so as to keep DEBUG_VRITUAL useful.

Thanks,
Mark.

#78 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Quoted 55 lines · Mark Rutland
Quoted 32 lines · Andreas F?rber

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 13 lines · Andreas F?rber
Quoted 11 lines

Commit 18cfd9429d8a82c49add8f3ca9d366599bfcac45 ("ARM: owl: smp: Drop bogus holding pen") simplified the S500 SMP code by removing a loop for pen_release in owl_secondary_boot(). Since then it is only calling owl_v7_invalidate_l1() before branching to secondary_startup().

The owl_v7_invalidate_l1() assembler function is superfluous, too. Therefore drop owl_secondary_boot() and use secondary_boot() directly.

---

Quoted 5 lines
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Thanks for the report. There are no other such uses in mach-actions, but git-grep'ing for virt_to_phys in arch/arm/mach-* I spot at least one other such usage in mach-oxnas:

arch/arm/mach-oxnas/platsmp.c:
writel(virt_to_phys(ox820_secondary_startup),

as well as this in mach-mvebu:

arch/arm/mach-mvebu/platsmp.c: writel(virt_to_phys(boot_addr), base + MV98DX3236_CPU_RESUME_ADDR_REG);

Quoted 7 lines

and these in mach-at91:

arch/arm/mach-at91/pm.c:        pm_bu->canary = virt_to_phys(&canary);
arch/arm/mach-at91/pm.c:        pm_bu->resume = virt_to_phys(cpu_resume);

What exactly is the difference between the two macros that makes it wrong despite apparently working?

virt_to_phys() is intended to operate on the linear/direct mapping of RAM.

__pa_symbol() is intended to operate on the kernel mapping, which may not be in the linear/direct mapping on all architectures. e.g. arm64 and x86_64 map the kernel image and RAM separately.

On 32-bit ARM the kernel image mapping is tied to the linear/direct mapping, so that works, but as it's semantically wrong (and broken for generic code), the DEBUG_VIRTUAL checks complain.

Quoted 3 lines

In particular I am wondering whether
the SoC/board vendors in CC need to fix it in their 3.10 trees, too.

Quoted 6 lines
Quoted 2 lines

In any case if this is a bug, I would rather fix it in a separate patch for 4.13 and leave the name swap (this patch) for 4.14.

To the best of my knowledge there's no functional problem in this particular case, though it should be cleaned up so as to keep DEBUG_VRITUAL useful.

Exactly, it just happened to catch my eye while looking at this patch series. I am wondering if there is a way we could check whether it makes sense to use virt_to_phys() vs. __pa_symbol() at compile time and produce an appropriate warning would that be the case. checkpatch.pl would not be able to do this unless there is a prior build of the kernel image, and a GCC plugin would not necessarily have global visibility about other translation units either... hmmm.

Signature · 1 line
Florian
author maintainer
#79 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

In reply to Andreas Färber

Am 06.07.2017 um 19:17 schrieb Andreas F?rber:

Quoted 7 lines

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 6 lines · Andreas F?rber
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Florian, I don't spot any build or runtime warning for this virt_to_phys() with CONFIG_DEBUG_VIRTUAL=y on Guitar/S500:

[    0.062765] CPU: Testing write buffer coherency: ok
[    0.063468] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.100856] Setting up static identity map for 0x100000 - 0x100060
[    0.120864] Hierarchical SRCU implementation.
[    0.161092] smp: Bringing up secondary CPUs ...
[    0.291654] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.422226] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.552798] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.553074] smp: Brought up 1 node, 4 CPUs
[    0.553388] SMP: Total of 4 processors activated (1629.38 BogoMIPS).
[    0.553477] CPU: All CPU(s) started in SVC mode.

I've tested that __pa_symbol() works as well, but I'd like to understand this for commit message and future testing. Am I missing other options?

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)
#80 lore raw

Re: [PATCH] ARM: owl: smp: Drop owl_secondary_boot()

Quoted 11 lines · Andreas F?rber

Am 06.07.2017 um 19:17 schrieb Andreas F?rber:

Quoted 7 lines

Am 05.07.2017 um 04:36 schrieb Florian Fainelli:

Quoted 6 lines · Andreas F?rber
Quoted 3 lines
arch/arm/mach-actions/platsmp.c +1 -1
-	writel(virt_to_phys(owl_secondary_startup),
+	writel(virt_to_phys(secondary_startup),
	       timer_base_addr + OWL_CPU1_ADDR + (cpu - 1) * 4);

This is a kernel symbol so please use __pa_symbol() here, also you might want to build with CONFIG_DEBUG_VIRTUAL and see if you get other warnings about using virt_to_phys() in the owl platform code (I did not check if there are other uses)

Florian, I don't spot any build or runtime warning for this virt_to_phys() with CONFIG_DEBUG_VIRTUAL=y on Guitar/S500:

You would only see run time warnings, not build time warnings for this, but in fact, no, see below.

Quoted 13 lines
[    0.062765] CPU: Testing write buffer coherency: ok
[    0.063468] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.100856] Setting up static identity map for 0x100000 - 0x100060
[    0.120864] Hierarchical SRCU implementation.
[    0.161092] smp: Bringing up secondary CPUs ...
[    0.291654] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.422226] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.552798] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.553074] smp: Brought up 1 node, 4 CPUs
[    0.553388] SMP: Total of 4 processors activated (1629.38 BogoMIPS).
[    0.553477] CPU: All CPU(s) started in SVC mode.
Quoted 2 lines

I've tested that __pa_symbol() works as well, but I'd like to understand this for commit message and future testing. Am I missing other options?

After re-checking the implementation you would get a warning only if you were using virt_to_phys() against a part of the kernel that is not in the linear map, similarly you would get a warning if __pa_symbol() was used against symbols outside of the kernel image, this is obviously not the case here. You should use __pa_symbol() just for correctness, no warning would be produced, sorry for misleading you with that.

Signature · 1 line
Florian
author maintainer
#81 lore raw

PATCH v4 21/28 ARM: dts: s500: Set CPU enable-method

In reply to Andreas Färber

Use a custom S500 enable-method for all CPUs.

---
v3 -> v4: Unchanged

v3: new

 arch/arm/boot/dts/s500.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/s500.dtsi +4 -0
index fc9f71a4106a..6d6024027ee2 100644
@@ -28,24 +28,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.12.3
author maintainer Applied
#82 lore raw

Re: [PATCH v4 21/28] ARM: dts: s500: Set CPU enable-method

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 10 lines

Use a custom S500 enable-method for all CPUs.

---
v3 -> v4: Unchanged

v3: new

 arch/arm/boot/dts/s500.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

Applied to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#83 lore raw

PATCH v4 22/28 dt-bindings: power: Add Owl SPS power domains

In reply to Andreas Färber

Define power domains for all non-reserved S500 power gates.

---
v3 -> v4: Unchanged

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
new file mode 100644
index 000000000000..c5eed06c771e
@@ -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
new file mode 100644
index 000000000000..ccc4ac37bc42
@@ -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.12.3
author maintainer
#84 lore raw

PATCH v5 20/26 dt-bindings: power: Add Owl SPS power domains

Define power domains for all non-reserved S500 power gates.

---
v4 -> v5:
* Renamed header file with owl- prefix for uniqueness

v3 -> v4: Unchanged

v3: new

 .../devicetree/bindings/power/actions,owl-sps.txt     | 17 +++++++++++++++++
 include/dt-bindings/power/owl-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/owl-s500-powergate.h
Documentation/devicetree/bindings/power/actions,owl-sps.txt new file +17 -0
new file mode 100644
index 000000000000..007b9a7ae723
@@ -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/owl-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/owl-s500-powergate.h new file +19 -0
new file mode 100644
index 000000000000..0a1c451865ea
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017 Andreas F?rber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+#ifndef DT_BINDINGS_POWER_OWL_S500_POWERGATE_H
+#define DT_BINDINGS_POWER_OWL_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.12.3
author maintainer
#85 lore raw

Re: [PATCH v5 20/26] dt-bindings: power: Add Owl SPS power domains

Am 19.06.2017 um 05:36 schrieb Andreas F?rber:

Quoted 10 lines

Define power domains for all non-reserved S500 power gates.

---
v4 -> v5:
* Renamed header file with owl- prefix for uniqueness

v3 -> v4: Unchanged

Quoted 7 lines

v3: new

 .../devicetree/bindings/power/actions,owl-sps.txt     | 17 +++++++++++++++++
 include/dt-bindings/power/owl-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/owl-s500-powergate.h

Due to include dependency applying to linux-actions.git v4.13/soc:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

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)
author maintainer
#86 lore raw

PATCH v4 23/28 soc: actions: Add Owl SPS

In reply to Andreas Färber

Implement S500 Smart Power System power-gating.
For now flag PD_CPU2 and PD_CPU3 as always-on.

Based on LeMaker linux-actions tree.

---
v3 -> v4:
* Added genpd_flags field and set GENPD_FLAG_ALWAYS_ON for CPU2/CPU3
* Added debug output

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 | 252 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 267 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
index 309643fe35f9..a63eb0ffba98 100644
@@ -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
index 824b44281efa..a3b27a33c309 100644
@@ -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
new file mode 100644
index 000000000000..bdf827d5ce78
@@ -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
new file mode 100644
index 000000000000..720c34ed16e4
@@ -0,0 +1 @@
+obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
drivers/soc/actions/owl-sps.c new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
2.12.3
author maintainer
#87 lore raw

PATCH v5 21/26 soc: actions: Add Owl SPS

Implement S500 Smart Power System power-gating.
For now flag PD_CPU2 and PD_CPU3 as always-on.

Based on LeMaker linux-actions tree.

---
v4 -> v5:
* Updated for header file rename

v3 -> v4:
* Added genpd_flags field and set GENPD_FLAG_ALWAYS_ON for CPU2/CPU3
* Added debug output

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 | 252 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 267 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
index f8c0286f8a65..07fc0ac51c52 100644
@@ -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
index c0b2a610efcd..9241125416ba 100644
@@ -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
new file mode 100644
index 000000000000..bdf827d5ce78
@@ -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
new file mode 100644
index 000000000000..720c34ed16e4
@@ -0,0 +1 @@
+obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
drivers/soc/actions/owl-sps.c new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
2.12.3
author maintainer Applied
#88 lore raw

Re: [PATCH v5 21/26] soc: actions: Add Owl SPS

Am 19.06.2017 um 05:40 schrieb Andreas F?rber:

Quoted 16 lines

Implement S500 Smart Power System power-gating.
For now flag PD_CPU2 and PD_CPU3 as always-on.

Based on LeMaker linux-actions tree.

---
v4 -> v5:
* Updated for header file rename

v3 -> v4:
* Added genpd_flags field and set GENPD_FLAG_ALWAYS_ON for CPU2/CPU3
* Added debug output

v3: new

Quoted 9 lines
 drivers/soc/Kconfig           |   1 +
 drivers/soc/Makefile          |   1 +
 drivers/soc/actions/Kconfig   |  12 ++
 drivers/soc/actions/Makefile  |   1 +
 drivers/soc/actions/owl-sps.c | 252 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 267 insertions(+)
 create mode 100644 drivers/soc/actions/Kconfig
 create mode 100644 drivers/soc/actions/Makefile
 create mode 100644 drivers/soc/actions/owl-sps.c

Applied to linux-actions.git v4.13/soc branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

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)
author maintainer
#89 lore raw

PATCH v4 24/28 MAINTAINERS: Update Actions Semi section with SPS

In reply to Andreas Färber

Add file patterns to cover the SPS power domain driver and DT binding.

---
v4: new

 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
index a9faa30def9c..1bfd357f5279 100644
@@ -1044,7 +1044,10 @@ N:	owl
 F:	arch/arm/mach-actions/
 F:	arch/arm/boot/dts/s500*
 F:	arch/arm64/boot/dts/actions/
+F:	drivers/soc/actions/
+F:	include/linux/soc/actions/
 F:	Documentation/devicetree/bindings/arm/actions.txt
+F:	Documentation/devicetree/bindings/power/actions,owl-sps.txt
 
 ARM/ADS SPHERE MACHINE SUPPORT
 M:	Lennert Buytenhek <[email protected]>
Signature · 1 line
2.12.3
author maintainer
#90 lore raw

PATCH v5 22/26 MAINTAINERS: Update Actions Semi section with SPS

Add file patterns to cover the SPS power domain driver and DT binding.

---
v4 -> v5:
* Rebased onto timer additions
* Added dt-bindings header file pattern

v4: new

 MAINTAINERS | 4 ++++
 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
index 831bfd5cc68b..eb62d294095e 100644
@@ -1045,7 +1045,11 @@ F:	arch/arm/mach-actions/
 F:	arch/arm/boot/dts/owl-*
 F:	arch/arm64/boot/dts/actions/
 F:	drivers/clocksource/owl-*
+F:	drivers/soc/actions/
+F:	include/dt-bindings/power/owl-*
+F:	include/linux/soc/actions/
 F:	Documentation/devicetree/bindings/arm/actions.txt
+F:	Documentation/devicetree/bindings/power/actions,owl-sps.txt
 F:	Documentation/devicetree/bindings/timer/actions,owl-timer.txt
 
 ARM/ADS SPHERE MACHINE SUPPORT
Signature · 1 line
2.12.3
author maintainer Applied
#91 lore raw

Re: [PATCH v5 22/26] MAINTAINERS: Update Actions Semi section with SPS

Am 19.06.2017 um 05:44 schrieb Andreas F?rber:

Quoted 8 lines

Add file patterns to cover the SPS power domain driver and DT binding.

---
v4 -> v5:
* Rebased onto timer additions
* Added dt-bindings header file pattern

Quoted 4 lines

v4: new

 MAINTAINERS | 4 ++++
 1 file changed, 4 insertions(+)

Applied to linux-actions.git v4.13/soc branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

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)
author maintainer
#92 lore raw

PATCH v4 25/28 ARM: dts: s500: Add SPS node

In reply to Andreas Färber

Add Smart Power System node for PM domains.

---
v3 -> v4:
* Extended commit message
* Split off association of power-domains (avoids include/dt-bindings/ dependency)

v3: new

 arch/arm/boot/dts/s500.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/s500.dtsi +6 -0
index 6d6024027ee2..51a48741d4c0 100644
@@ -176,5 +176,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.12.3
author maintainer Applied
#93 lore raw

Re: [PATCH v4 25/28] ARM: dts: s500: Add SPS node

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 8 lines

Add Smart Power System node for PM domains.

---
v3 -> v4:
* Extended commit message
* Split off association of power-domains (avoids include/dt-bindings/ dependency)

Quoted 4 lines

v3: new

 arch/arm/boot/dts/s500.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

Applied to linux-actions.git v4.13/dt branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/dt

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)
author maintainer
#94 lore raw

PATCH v4 26/28 ARM: dts: s500: Set power domains for CPU2 and CPU3

In reply to Andreas Färber

CPU2 has its own power domain PD_CPU2, and CPU3 has PD_CPU3.

---
v4: new (split off due to dt-bindings dependency)

 arch/arm/boot/dts/s500.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/boot/dts/s500.dtsi +3 -0
index 51a48741d4c0..4e4478a3ec08 100644
@@ -7,6 +7,7 @@
  */
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/power/s500-powergate.h>
 
 / {
 	compatible = "actions,s500";
@@ -43,6 +44,7 @@
 			compatible = "arm,cortex-a9";
 			reg = <0x2>;
 			enable-method = "actions,s500-smp";
+			power-domains = <&sps S500_PD_CPU2>;
 		};
 
 		cpu3: cpu at 3 {
@@ -50,6 +52,7 @@
 			compatible = "arm,cortex-a9";
 			reg = <0x3>;
 			enable-method = "actions,s500-smp";
+			power-domains = <&sps S500_PD_CPU3>;
 		};
 	};
 
Signature · 1 line
2.12.3
author maintainer Applied
#95 lore raw

Re: [PATCH v4 26/28] ARM: dts: s500: Set power domains for CPU2 and CPU3

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 8 lines

CPU2 has its own power domain PD_CPU2, and CPU3 has PD_CPU3.

---
v4: new (split off due to dt-bindings dependency)

 arch/arm/boot/dts/s500.dtsi | 3 +++
 1 file changed, 3 insertions(+)

Applied to v4.14/dt:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.14/dt

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)
author maintainer
#96 lore raw

PATCH v4 27/28 soc: actions: owl-sps: Factor out owl_sps_set_pg() for power-gating

In reply to Andreas Färber

Allow the SMP code to reuse PM domain code for CPU2/CPU3 wakeup.

---
v4: new

 drivers/soc/actions/Kconfig          |  4 +++
 drivers/soc/actions/Makefile         |  1 +
 drivers/soc/actions/owl-sps-helper.c | 51 ++++++++++++++++++++++++++++++++++++
 drivers/soc/actions/owl-sps.c        | 34 +++---------------------
 include/linux/soc/actions/owl-sps.h  | 11 ++++++++
 5 files changed, 70 insertions(+), 31 deletions(-)
 create mode 100644 drivers/soc/actions/owl-sps-helper.c
 create mode 100644 include/linux/soc/actions/owl-sps.h
drivers/soc/actions/Kconfig +4 -0
index bdf827d5ce78..9d68b5a771c3 100644
@@ -1,8 +1,12 @@
 if ARCH_ACTIONS || COMPILE_TEST
 
+config OWL_PM_DOMAINS_HELPER
+	bool
+
 config OWL_PM_DOMAINS
 	bool "Actions Semi SPS power domains"
 	depends on PM
+	select OWL_PM_DOMAINS_HELPER
 	select PM_GENERIC_DOMAINS
 	help
 	  Say 'y' here to enable support for Smart Power System (SPS)
drivers/soc/actions/Makefile +1 -0
index 720c34ed16e4..1e101b06bab1 100644
@@ -1 +1,2 @@
+obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
 obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
drivers/soc/actions/owl-sps-helper.c new file +51 -0

51 lines not on this page · raw message

drivers/soc/actions/owl-sps.c +3 -31
index d9160579b542..41991c5217a0 100644
@@ -12,15 +12,12 @@
  * option) any later version.
  */
 
-#include <linux/delay.h>
-#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_domain.h>
+#include <linux/soc/actions/owl-sps.h>
 #include <dt-bindings/power/s500-powergate.h>
 
-#define OWL_SPS_PG_CTL	0x0
-
 struct owl_sps_domain_info {
 	const char *name;
 	int pwr_bit;
@@ -51,37 +48,12 @@ struct owl_sps_domain {
 
 static int owl_sps_set_power(struct owl_sps_domain *pd, bool enable)
 {
-	u32 val, pwr_mask, ack_mask;
-	int timeout;
-	bool ack;
+	u32 pwr_mask, ack_mask;
 
 	ack_mask = BIT(pd->info->ack_bit);
 	pwr_mask = BIT(pd->info->pwr_bit);
-	val = readl(pd->sps->base + OWL_SPS_PG_CTL);
-	ack = val & ack_mask;
-
-	if (ack == enable)
-		return 0;
-
-	if (enable)
-		val |= pwr_mask;
-	else
-		val &= ~pwr_mask;
-
-	writel(val, pd->sps->base + OWL_SPS_PG_CTL);
 
-	for (timeout = 5000; timeout > 0; timeout -= 50) {
-		val = readl(pd->sps->base + OWL_SPS_PG_CTL);
-		if ((val & ack_mask) == (enable ? ack_mask : 0))
-			break;
-		udelay(50);
-	}
-	if (timeout <= 0)
-		return -ETIMEDOUT;
-
-	udelay(10);
-
-	return 0;
+	return owl_sps_set_pg(pd->sps->base, pwr_mask, ack_mask, enable);
 }
 
 static int owl_sps_power_on(struct generic_pm_domain *domain)
include/linux/soc/actions/owl-sps.h new file +11 -0
new file mode 100644
index 000000000000..33d0dbeceb55
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2017 Andreas F?rber
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#ifndef SOC_ACTIONS_OWL_SPS_H
+#define SOC_ACTIONS_OWL_SPS_H
+
+int owl_sps_set_pg(void __iomem *base, u32 pwr_mask, u32 ack_mask, bool enable);
+
+#endif
Signature · 1 line
2.12.3
author maintainer Applied
#97 lore raw

Re: [PATCH v4 27/28] soc: actions: owl-sps: Factor out owl_sps_set_pg() for power-gating

Am 06.06.2017 um 02:54 schrieb Andreas F?rber:

Quoted 6 lines

Allow the SMP code to reuse PM domain code for CPU2/CPU3 wakeup.

---
v4: new

Quoted 8 lines
 drivers/soc/actions/Kconfig          |  4 +++
 drivers/soc/actions/Makefile         |  1 +
 drivers/soc/actions/owl-sps-helper.c | 51 ++++++++++++++++++++++++++++++++++++
 drivers/soc/actions/owl-sps.c        | 34 +++---------------------
 include/linux/soc/actions/owl-sps.h  | 11 ++++++++
 5 files changed, 70 insertions(+), 31 deletions(-)
 create mode 100644 drivers/soc/actions/owl-sps-helper.c
 create mode 100644 include/linux/soc/actions/owl-sps.h

Applied to linux-actions.git v4.13/soc branch:

https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.13/soc

Needs to get merged first so that arm branch can start using it.

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)
author maintainer
#98 lore raw

PATCH v4 28/28 ARM: owl: smp: Implement SPS power-gating for CPU2 and CPU3

In reply to Andreas Färber

Bring up the two remaining CPUs by calling into PM domain code.

---
v3 -> v4:
* Reused PM domain helper code to avoid code duplication

v3: new

 arch/arm/mach-actions/Kconfig   |  1 +
 arch/arm/mach-actions/platsmp.c | 36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
arch/arm/mach-actions/Kconfig +1 -0
index 717adc1630a1..ad9c5c89c683 100644
@@ -10,6 +10,7 @@ menuconfig ARCH_ACTIONS
 	select GENERIC_IRQ_CHIP
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
+	select OWL_PM_DOMAINS_HELPER
 	select OWL_TIMER
 	help
 	  This enables support for the Actions Semiconductor S500 SoC family.
arch/arm/mach-actions/platsmp.c +34 -2
index 9d3601ebe535..b4806ce0e9bb 100644
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/smp.h>
+#include <linux/soc/actions/owl-sps.h>
 #include <asm/cacheflush.h>
 #include <asm/smp_plat.h>
 #include <asm/smp_scu.h>
@@ -28,7 +29,13 @@
 
 #define OWL_CPUx_FLAG_BOOT	0x55aa
 
+#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;
 
@@ -58,14 +65,27 @@ void owl_secondary_startup(void);
 
 static int s500_wakeup_secondary(unsigned int cpu)
 {
+	int ret;
+
 	if (cpu > 3)
 		return -EINVAL;
 
+	/* The generic PM domain driver is not available this early. */
 	switch (cpu) {
 	case 2:
+		ret = owl_sps_set_pg(sps_base_addr,
+		                     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(sps_base_addr,
+		                     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 +153,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.12.3