linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP
@ 2020-12-01 13:43 Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl Daniel Palmer
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

Sorry for spamming this. I wanted to fix the DT parts
before anyone spent time looking at the DT related commits
in v1.

This series adds basic support for the infinity2m series
of chips. For now the SigmaStar SSD202D which is a dual
Cortex A7 in a QFN128 package.

These chips share most of the same hardware with the
currently supported infinity, infinity3 and mercury5
chips.

Changes since v1:

- Based on Arnd's feedback[0] there is now "mstar,smpctrl" as the 
  most generic compatible string for the smp control registers 
  and a more specific "sstar,ssd201" (yes sstar is right, this is
  a SigmaStar chip) string that is good for the SSD201 and SSD202D
  chips.

- Small code clean ups: remove initialiser for smpctrl, remove unneeded
  #ifdef CONFIG_SMP, make the smp_operations struct static and const.

0 - https://lore.kernel.org/linux-arm-kernel/CAK8P3a2MC5m4PdmXnwjGw_oZinKU93LP+eYQ8qaCmH4EesH0Bw@mail.gmail.com/

Daniel Palmer (10):
  dt-bindings: mstar: Add binding details for mstar,smpctrl
  dt-bindings: vendor-prefixes: Add honestar vendor prefix
  dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards
  ARM: mstar: Add infinity2m support
  ARM: mstar: Add common dtsi for SSD201/SSD202D
  ARM: mstar: Add chip level dtsi for SSD202D
  ARM: mstar: Add dts for Honestar ssd201htv2
  ARM: mstar: Add smp ctrl registers to infinity2m dtsi
  ARM: mstar: Wire up smpctrl for SSD201/SSD202D
  ARM: mstar: SMP support

 .../bindings/arm/mstar/mstar,smpctrl.yaml     | 40 +++++++++++++++
 .../devicetree/bindings/arm/mstar/mstar.yaml  |  6 +++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 arch/arm/boot/dts/Makefile                    |  1 +
 .../mstar-infinity2m-ssd202d-ssd201htv2.dts   | 25 ++++++++++
 .../boot/dts/mstar-infinity2m-ssd202d.dtsi    | 14 ++++++
 .../boot/dts/mstar-infinity2m-ssd20xd.dtsi    | 12 +++++
 arch/arm/boot/dts/mstar-infinity2m.dtsi       | 22 +++++++++
 arch/arm/boot/dts/mstar-v7.dtsi               |  2 +-
 arch/arm/mach-mstar/mstarv7.c                 | 49 +++++++++++++++++++
 10 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m-ssd202d-ssd201htv2.dts
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m-ssd202d.dtsi
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m.dtsi

-- 
2.29.2


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-09 16:35   ` Rob Herring
  2020-12-01 13:43 ` [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix Daniel Palmer
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

This adds a YAML description of the smpctrl node needed by the
platform code for the MStar/SigmaStar Armv7 SoCs to boot secondary cpus.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 .../bindings/arm/mstar/mstar,smpctrl.yaml     | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml

diff --git a/Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml b/Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml
new file mode 100644
index 000000000000..599c65980f5d
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2020 thingy.jp.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/arm/mstar/mstar,smpctrl.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MStar/SigmaStar Armv7 SoC SMP control registers
+
+maintainers:
+  - Daniel Palmer <daniel@thingy.jp>
+
+description: |
+  MStar/SigmaStar's Armv7 SoCs that have more than one processor
+  have a region of registers that allow setting the boot address
+  and a magic number that allows secondary processors to leave
+  the loop they are parked in by the boot ROM.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - sstar,ssd201-smpctrl # SSD201/SSD202D
+      - const: mstar,smpctrl
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    smpctrl@204000 {
+        compatible = "sstar,ssd201-smpctrl", "mstar,smpctrl";
+        reg = <0x204000 0x200>;
+    };
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-09 16:34   ` Rob Herring
  2020-12-01 13:43 ` [PATCH v2 03/10] dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards Daniel Palmer
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

Add prefix for Honestar Technologies Co., Ltd.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 2735be1a8470..a6cf2cef6f89 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -451,6 +451,8 @@ patternProperties:
     description: Holt Integrated Circuits, Inc.
   "^honeywell,.*":
     description: Honeywell
+  "^honestar,.*":
+    description: Honestar Technologies Co., Ltd.
   "^hoperun,.*":
     description: Jiangsu HopeRun Software Co., Ltd.
   "^hp,.*":
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 03/10] dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-09 16:36   ` Rob Herring
  2020-12-01 13:43 ` [PATCH v2 04/10] ARM: mstar: Add infinity2m support Daniel Palmer
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

The Honestar SSD201_HT_V2 is a full size devkit for the SigmaStar
SSD201 or SSD202D (they are pin compatible).

Currently only the SSD202D version is supported as that's the one
I have.

Link: https://linux-chenxing.org/infinity2/ssd201_ht_v2/
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 Documentation/devicetree/bindings/arm/mstar/mstar.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/mstar/mstar.yaml b/Documentation/devicetree/bindings/arm/mstar/mstar.yaml
index 7c787405bb2f..61d08c473eb8 100644
--- a/Documentation/devicetree/bindings/arm/mstar/mstar.yaml
+++ b/Documentation/devicetree/bindings/arm/mstar/mstar.yaml
@@ -20,6 +20,12 @@ properties:
               - thingyjp,breadbee-crust # thingy.jp BreadBee Crust
           - const: mstar,infinity
 
+      - description: infinity2m boards
+        items:
+          - enum:
+              - honestar,ssd201htv2 # Honestar SSD201_HT_V2 devkit
+          - const: mstar,infinity2m
+
       - description: infinity3 boards
         items:
           - enum:
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 04/10] ARM: mstar: Add infinity2m support
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (2 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 03/10] dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 05/10] ARM: mstar: Add common dtsi for SSD201/SSD202D Daniel Palmer
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

The infinity2m series of chips are like the other Mstar/Sigmastar
chips in that they have a Cortex A7 system with DDR memory integrated
in a single package.

The infinity2m chips are intended for recording the incoming streams
from IP cameras. So instead of video encoders they have video decoders,
instead of a camera interface they have display hardware and so on.

Aside from the above points the big difference about these chips is that
they include a second Cortex A7 core.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/boot/dts/mstar-infinity2m.dtsi | 15 +++++++++++++++
 arch/arm/boot/dts/mstar-v7.dtsi         |  2 +-
 arch/arm/mach-mstar/mstarv7.c           |  1 +
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m.dtsi

diff --git a/arch/arm/boot/dts/mstar-infinity2m.dtsi b/arch/arm/boot/dts/mstar-infinity2m.dtsi
new file mode 100644
index 000000000000..02adb9fe9d3c
--- /dev/null
+++ b/arch/arm/boot/dts/mstar-infinity2m.dtsi
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 thingy.jp.
+ * Author: Daniel Palmer <daniel@thingy.jp>
+ */
+
+#include "mstar-infinity.dtsi"
+
+&cpus {
+	cpu1: cpu@1 {
+		device_type = "cpu";
+		compatible = "arm,cortex-a7";
+		reg = <0x1>;
+	};
+};
diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi
index 07fc46c7b4d4..2862b32c7f63 100644
--- a/arch/arm/boot/dts/mstar-v7.dtsi
+++ b/arch/arm/boot/dts/mstar-v7.dtsi
@@ -13,7 +13,7 @@ / {
 	#size-cells = <1>;
 	interrupt-parent = <&gic>;
 
-	cpus {
+	cpus: cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
diff --git a/arch/arm/mach-mstar/mstarv7.c b/arch/arm/mach-mstar/mstarv7.c
index 81a4cbcab206..1aa748fa006e 100644
--- a/arch/arm/mach-mstar/mstarv7.c
+++ b/arch/arm/mach-mstar/mstarv7.c
@@ -35,6 +35,7 @@ static void __iomem *l3bridge;
 
 static const char * const mstarv7_board_dt_compat[] __initconst = {
 	"mstar,infinity",
+	"mstar,infinity2m",
 	"mstar,infinity3",
 	"mstar,mercury5",
 	NULL,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 05/10] ARM: mstar: Add common dtsi for SSD201/SSD202D
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (3 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 04/10] ARM: mstar: Add infinity2m support Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 06/10] ARM: mstar: Add chip level dtsi for SSD202D Daniel Palmer
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

The SSD201 and SSD202D are basically the same chip with a different DDR die
packaged (64MB DDR2 or 128MB DDR3).

This patch adds a shared dtsi for the common parts of these chips like
gpio, pinctrl etc.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi

diff --git a/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi b/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi
new file mode 100644
index 000000000000..0811220f0a79
--- /dev/null
+++ b/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 thingy.jp.
+ * Author: Daniel Palmer <daniel@thingy.jp>
+ */
+
+#include "mstar-infinity2m.dtsi"
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 06/10] ARM: mstar: Add chip level dtsi for SSD202D
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (4 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 05/10] ARM: mstar: Add common dtsi for SSD201/SSD202D Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 07/10] ARM: mstar: Add dts for Honestar ssd201htv2 Daniel Palmer
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

Add a chip level dtsi for the SigmaStar SSD202D

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/boot/dts/mstar-infinity2m-ssd202d.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m-ssd202d.dtsi

diff --git a/arch/arm/boot/dts/mstar-infinity2m-ssd202d.dtsi b/arch/arm/boot/dts/mstar-infinity2m-ssd202d.dtsi
new file mode 100644
index 000000000000..176e10a29896
--- /dev/null
+++ b/arch/arm/boot/dts/mstar-infinity2m-ssd202d.dtsi
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 thingy.jp.
+ * Author: Daniel Palmer <daniel@thingy.jp>
+ */
+
+#include "mstar-infinity2m-ssd20xd.dtsi"
+
+/ {
+	memory {
+		device_type = "memory";
+		reg = <0x20000000 0x8000000>;
+	};
+};
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 07/10] ARM: mstar: Add dts for Honestar ssd201htv2
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (5 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 06/10] ARM: mstar: Add chip level dtsi for SSD202D Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 08/10] ARM: mstar: Add smp ctrl registers to infinity2m dtsi Daniel Palmer
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

Add a dts for the Honestar ssd201htv2 devkit.
This is for the board populated with a SSD202D.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/boot/dts/Makefile                    |  1 +
 .../mstar-infinity2m-ssd202d-ssd201htv2.dts   | 25 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 arch/arm/boot/dts/mstar-infinity2m-ssd202d-ssd201htv2.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ce66ffd5a1bb..ccbf44b6f32a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1372,6 +1372,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 dtb-$(CONFIG_ARCH_MILBEAUT) += milbeaut-m10v-evb.dtb
 dtb-$(CONFIG_ARCH_MSTARV7) += \
 	mstar-infinity-msc313-breadbee_crust.dtb \
+	mstar-infinity2m-ssd202d-ssd201htv2.dtb \
 	mstar-infinity3-msc313e-breadbee.dtb \
 	mstar-mercury5-ssc8336n-midrived08.dtb
 dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb
diff --git a/arch/arm/boot/dts/mstar-infinity2m-ssd202d-ssd201htv2.dts b/arch/arm/boot/dts/mstar-infinity2m-ssd202d-ssd201htv2.dts
new file mode 100644
index 000000000000..5d81641414a2
--- /dev/null
+++ b/arch/arm/boot/dts/mstar-infinity2m-ssd202d-ssd201htv2.dts
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 thingy.jp.
+ * Author: Daniel Palmer <daniel@thingy.jp>
+ */
+
+/dts-v1/;
+#include "mstar-infinity2m-ssd202d.dtsi"
+
+/ {
+	model = "SSD201_HT_V2";
+	compatible = "honestar,ssd201htv2", "mstar,infinity2m";
+
+	aliases {
+		serial0 = &pm_uart;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&pm_uart {
+	status = "okay";
+};
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 08/10] ARM: mstar: Add smp ctrl registers to infinity2m dtsi
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (6 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 07/10] ARM: mstar: Add dts for Honestar ssd201htv2 Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 09/10] ARM: mstar: Wire up smpctrl for SSD201/SSD202D Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 10/10] ARM: mstar: SMP support Daniel Palmer
  9 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

Add the smpctrl registers to the infinity2m dtsi so that the
second CPU can be enabled on chips in this family.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/boot/dts/mstar-infinity2m.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/mstar-infinity2m.dtsi b/arch/arm/boot/dts/mstar-infinity2m.dtsi
index 02adb9fe9d3c..6d4d1d224e96 100644
--- a/arch/arm/boot/dts/mstar-infinity2m.dtsi
+++ b/arch/arm/boot/dts/mstar-infinity2m.dtsi
@@ -13,3 +13,10 @@ cpu1: cpu@1 {
 		reg = <0x1>;
 	};
 };
+
+&riu {
+	smpctrl: smpctrl@204000 {
+		reg = <0x204000 0x200>;
+		status = "disabled";
+	};
+};
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 09/10] ARM: mstar: Wire up smpctrl for SSD201/SSD202D
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (7 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 08/10] ARM: mstar: Add smp ctrl registers to infinity2m dtsi Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 13:43 ` [PATCH v2 10/10] ARM: mstar: SMP support Daniel Palmer
  9 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

Add the specific compat string for the smpctrl registers to the
SSD201/SSD202D common dtsi.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi b/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi
index 0811220f0a79..7a5e28b33f96 100644
--- a/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi
+++ b/arch/arm/boot/dts/mstar-infinity2m-ssd20xd.dtsi
@@ -5,3 +5,8 @@
  */
 
 #include "mstar-infinity2m.dtsi"
+
+&smpctrl {
+	compatible = "sstar,ssd201-smpctrl", "mstar,smpctrl";
+	status = "okay";
+};
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 10/10] ARM: mstar: SMP support
  2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
                   ` (8 preceding siblings ...)
  2020-12-01 13:43 ` [PATCH v2 09/10] ARM: mstar: Wire up smpctrl for SSD201/SSD202D Daniel Palmer
@ 2020-12-01 13:43 ` Daniel Palmer
  2020-12-01 15:04   ` Russell King - ARM Linux admin
  9 siblings, 1 reply; 19+ messages in thread
From: Daniel Palmer @ 2020-12-01 13:43 UTC (permalink / raw)
  To: devicetree, soc, linux-arm-kernel
  Cc: linux-kernel, olof, arnd, robh, w, daniel

This patch adds SMP support for MStar/Sigmastar chips that have a second core
like those in the infinity2m family.

So far only single and dual core chips have been found so this does
the bare minimum to boot the second core. From what I can tell not having
the "holding pen" code to handle multiple cores is fine if there is only
one core the will get booted. This might need to be reconsidered if chips
with more cores turn up.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/mach-mstar/mstarv7.c | 48 +++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm/mach-mstar/mstarv7.c b/arch/arm/mach-mstar/mstarv7.c
index 1aa748fa006e..274c4f0df270 100644
--- a/arch/arm/mach-mstar/mstarv7.c
+++ b/arch/arm/mach-mstar/mstarv7.c
@@ -31,6 +31,13 @@
 #define MSTARV7_L3BRIDGE_FLUSH_TRIGGER	BIT(0)
 #define MSTARV7_L3BRIDGE_STATUS_DONE	BIT(12)
 
+#ifdef CONFIG_SMP
+#define MSTARV7_CPU1_BOOT_ADDR_HIGH	0x4c
+#define MSTARV7_CPU1_BOOT_ADDR_LOW	0x50
+#define MSTARV7_CPU1_UNLOCK		0x58
+#define MSTARV7_CPU1_UNLOCK_MAGIC	0xbabe
+#endif
+
 static void __iomem *l3bridge;
 
 static const char * const mstarv7_board_dt_compat[] __initconst = {
@@ -63,6 +70,46 @@ static void mstarv7_mb(void)
 	}
 }
 
+#ifdef CONFIG_SMP
+static int mstarv7_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	struct device_node *np;
+	u32 bootaddr = (u32) __pa_symbol(secondary_startup_arm);
+	void __iomem *smpctrl;
+
+	/*
+	 * right now we don't know how to boot anything except
+	 * cpu 1.
+	 */
+	if (cpu != 1)
+		return -EINVAL;
+
+	np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl");
+	smpctrl = of_iomap(np, 0);
+
+	if (!smpctrl)
+		return -ENODEV;
+
+	/* set the boot address for the second cpu */
+	writew(bootaddr & 0xffff, smpctrl + MSTARV7_CPU1_BOOT_ADDR_LOW);
+	writew((bootaddr >> 16) & 0xffff, smpctrl + MSTARV7_CPU1_BOOT_ADDR_HIGH);
+
+	/* unlock the second cpu */
+	writew(MSTARV7_CPU1_UNLOCK_MAGIC, smpctrl + MSTARV7_CPU1_UNLOCK);
+
+	/* and away we go...*/
+	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+	iounmap(smpctrl);
+
+	return 0;
+}
+
+static const struct smp_operations __initdata mstarv7_smp_ops = {
+	.smp_boot_secondary = mstarv7_boot_secondary,
+};
+#endif
+
 static void __init mstarv7_init(void)
 {
 	struct device_node *np;
@@ -78,4 +125,5 @@ static void __init mstarv7_init(void)
 DT_MACHINE_START(MSTARV7_DT, "MStar/Sigmastar Armv7 (Device Tree)")
 	.dt_compat	= mstarv7_board_dt_compat,
 	.init_machine	= mstarv7_init,
+	.smp		= smp_ops(mstarv7_smp_ops),
 MACHINE_END
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 10/10] ARM: mstar: SMP support
  2020-12-01 13:43 ` [PATCH v2 10/10] ARM: mstar: SMP support Daniel Palmer
@ 2020-12-01 15:04   ` Russell King - ARM Linux admin
  2020-12-02  9:10     ` Daniel Palmer
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux admin @ 2020-12-01 15:04 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: devicetree, soc, linux-arm-kernel, linux-kernel, olof, arnd, robh, w

On Tue, Dec 01, 2020 at 10:43:30PM +0900, Daniel Palmer wrote:
> +	np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl");
> +	smpctrl = of_iomap(np, 0);
> +
> +	if (!smpctrl)
> +		return -ENODEV;

Wouldn't -ENOMEM be more appropriate here?
-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 10/10] ARM: mstar: SMP support
  2020-12-01 15:04   ` Russell King - ARM Linux admin
@ 2020-12-02  9:10     ` Daniel Palmer
  0 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-02  9:10 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: DTML, SoC Team, linux-arm-kernel, Linux Kernel Mailing List,
	olof, Arnd Bergmann, Rob Herring, Willy Tarreau

Hi Russell,

On Wed, 2 Dec 2020 at 00:04, Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
>
> On Tue, Dec 01, 2020 at 10:43:30PM +0900, Daniel Palmer wrote:
> > +     np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl");
> > +     smpctrl = of_iomap(np, 0);
> > +
> > +     if (!smpctrl)
> > +             return -ENODEV;
>
> Wouldn't -ENOMEM be more appropriate here?

There seems to be examples of both -ENOMEM and -ENODEV in other ARM platforms.
arch/arm/mach-aspeed/platsmp.c uses -ENODEV for example.

I went with -ENODEV there as the source of the error is most likely
the node not being in the device tree.
I didn't check the result of of_find_compatible_node() because for the
memory barrier code in the same file I was told it wasn't necessary.

Thanks,

Daniel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix
  2020-12-01 13:43 ` [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix Daniel Palmer
@ 2020-12-09 16:34   ` Rob Herring
  2020-12-10 10:39     ` Daniel Palmer
  0 siblings, 1 reply; 19+ messages in thread
From: Rob Herring @ 2020-12-09 16:34 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: devicetree, soc, linux-arm-kernel, linux-kernel, olof, arnd, w

On Tue, Dec 01, 2020 at 10:43:22PM +0900, Daniel Palmer wrote:
> Add prefix for Honestar Technologies Co., Ltd.
> 
> Signed-off-by: Daniel Palmer <daniel@0x0f.com>
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 2735be1a8470..a6cf2cef6f89 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -451,6 +451,8 @@ patternProperties:
>      description: Holt Integrated Circuits, Inc.
>    "^honeywell,.*":
>      description: Honeywell
> +  "^honestar,.*":
> +    description: Honestar Technologies Co., Ltd.

Alphabetical order please.

>    "^hoperun,.*":
>      description: Jiangsu HopeRun Software Co., Ltd.
>    "^hp,.*":
> -- 
> 2.29.2
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl
  2020-12-01 13:43 ` [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl Daniel Palmer
@ 2020-12-09 16:35   ` Rob Herring
  2020-12-10 10:33     ` Daniel Palmer
       [not found]     ` <CAK8P3a0D+XQREm7Gw5-7-byiz7eufYGT_r-XC3H6_whdOB0a1w@mail.gmail.com>
  0 siblings, 2 replies; 19+ messages in thread
From: Rob Herring @ 2020-12-09 16:35 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: devicetree, soc, linux-arm-kernel, linux-kernel, olof, arnd, w

On Tue, Dec 01, 2020 at 10:43:21PM +0900, Daniel Palmer wrote:
> This adds a YAML description of the smpctrl node needed by the
> platform code for the MStar/SigmaStar Armv7 SoCs to boot secondary cpus.

You need an 'enable-method' string defined too.

> 
> Signed-off-by: Daniel Palmer <daniel@0x0f.com>
> ---
>  .../bindings/arm/mstar/mstar,smpctrl.yaml     | 40 +++++++++++++++++++
>  1 file changed, 40 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml
> 
> diff --git a/Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml b/Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml
> new file mode 100644
> index 000000000000..599c65980f5d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/mstar/mstar,smpctrl.yaml
> @@ -0,0 +1,40 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +# Copyright 2020 thingy.jp.
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/arm/mstar/mstar,smpctrl.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: MStar/SigmaStar Armv7 SoC SMP control registers
> +
> +maintainers:
> +  - Daniel Palmer <daniel@thingy.jp>
> +
> +description: |
> +  MStar/SigmaStar's Armv7 SoCs that have more than one processor
> +  have a region of registers that allow setting the boot address
> +  and a magic number that allows secondary processors to leave
> +  the loop they are parked in by the boot ROM.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - sstar,ssd201-smpctrl # SSD201/SSD202D
> +      - const: mstar,smpctrl
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    smpctrl@204000 {
> +        compatible = "sstar,ssd201-smpctrl", "mstar,smpctrl";
> +        reg = <0x204000 0x200>;
> +    };
> -- 
> 2.29.2
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 03/10] dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards
  2020-12-01 13:43 ` [PATCH v2 03/10] dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards Daniel Palmer
@ 2020-12-09 16:36   ` Rob Herring
  0 siblings, 0 replies; 19+ messages in thread
From: Rob Herring @ 2020-12-09 16:36 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: linux-kernel, w, olof, devicetree, soc, linux-arm-kernel, arnd

On Tue, 01 Dec 2020 22:43:23 +0900, Daniel Palmer wrote:
> The Honestar SSD201_HT_V2 is a full size devkit for the SigmaStar
> SSD201 or SSD202D (they are pin compatible).
> 
> Currently only the SSD202D version is supported as that's the one
> I have.
> 
> Link: https://linux-chenxing.org/infinity2/ssd201_ht_v2/
> Signed-off-by: Daniel Palmer <daniel@0x0f.com>
> ---
>  Documentation/devicetree/bindings/arm/mstar/mstar.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl
  2020-12-09 16:35   ` Rob Herring
@ 2020-12-10 10:33     ` Daniel Palmer
       [not found]     ` <CAK8P3a0D+XQREm7Gw5-7-byiz7eufYGT_r-XC3H6_whdOB0a1w@mail.gmail.com>
  1 sibling, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-10 10:33 UTC (permalink / raw)
  To: Rob Herring
  Cc: DTML, SoC Team, linux-arm-kernel, Linux Kernel Mailing List,
	olof, Arnd Bergmann, Willy Tarreau

Hi Rob,

On Thu, 10 Dec 2020 at 01:35, Rob Herring <robh@kernel.org> wrote:
> On Tue, Dec 01, 2020 at 10:43:21PM +0900, Daniel Palmer wrote:
> > This adds a YAML description of the smpctrl node needed by the
> > platform code for the MStar/SigmaStar Armv7 SoCs to boot secondary cpus.
>
> You need an 'enable-method' string defined too.

The machine has smp ops set so I didn't think this was needed?
I was going to convert it to using enable-method in the cpu node but
the same code is used to enable the secondary cpu in all of the chips
with a second cpu so I didn't think I was really needed.

Thanks,

Daniel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix
  2020-12-09 16:34   ` Rob Herring
@ 2020-12-10 10:39     ` Daniel Palmer
  0 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-10 10:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: DTML, SoC Team, linux-arm-kernel, Linux Kernel Mailing List,
	olof, Arnd Bergmann, Willy Tarreau

Hi Rob,

On Thu, 10 Dec 2020 at 01:34, Rob Herring <robh@kernel.org> wrote:
> > +  "^honestar,.*":
> > +    description: Honestar Technologies Co., Ltd.
>
> Alphabetical order please.

Sorry about that. I intended to do that but apparently don't know the
alphabet anymore..

Thanks,

Daniel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl
       [not found]     ` <CAK8P3a0D+XQREm7Gw5-7-byiz7eufYGT_r-XC3H6_whdOB0a1w@mail.gmail.com>
@ 2020-12-10 10:43       ` Daniel Palmer
  0 siblings, 0 replies; 19+ messages in thread
From: Daniel Palmer @ 2020-12-10 10:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Rob Herring, DTML, SoC Team, Linux ARM, linux-kernel,
	Olof Johansson, Arnd Bergmann, Willy Tarreau

Hi Arnd,

On Thu, 10 Dec 2020 at 02:45, Arnd Bergmann <arnd@kernel.org> wrote:
> Daniel, please send patches on top of this series to address Rob's
> comments.

Will do. On the enabled method one I had a question for Rob so I'll
wait for a reply to that and then send the fixes.
Sorry about the trouble caused.

Thanks,

Daniel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-12-10 10:44 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 13:43 [PATCH v2 00/10] ARM: mstar: Add basic support for i2m and SMP Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 01/10] dt-bindings: mstar: Add binding details for mstar,smpctrl Daniel Palmer
2020-12-09 16:35   ` Rob Herring
2020-12-10 10:33     ` Daniel Palmer
     [not found]     ` <CAK8P3a0D+XQREm7Gw5-7-byiz7eufYGT_r-XC3H6_whdOB0a1w@mail.gmail.com>
2020-12-10 10:43       ` Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 02/10] dt-bindings: vendor-prefixes: Add honestar vendor prefix Daniel Palmer
2020-12-09 16:34   ` Rob Herring
2020-12-10 10:39     ` Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 03/10] dt-bindings: mstar: Add Honestar SSD201_HT_V2 to mstar boards Daniel Palmer
2020-12-09 16:36   ` Rob Herring
2020-12-01 13:43 ` [PATCH v2 04/10] ARM: mstar: Add infinity2m support Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 05/10] ARM: mstar: Add common dtsi for SSD201/SSD202D Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 06/10] ARM: mstar: Add chip level dtsi for SSD202D Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 07/10] ARM: mstar: Add dts for Honestar ssd201htv2 Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 08/10] ARM: mstar: Add smp ctrl registers to infinity2m dtsi Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 09/10] ARM: mstar: Wire up smpctrl for SSD201/SSD202D Daniel Palmer
2020-12-01 13:43 ` [PATCH v2 10/10] ARM: mstar: SMP support Daniel Palmer
2020-12-01 15:04   ` Russell King - ARM Linux admin
2020-12-02  9:10     ` Daniel Palmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).