Skip to contentSkip to conversation

Add Spreadtrum Shark64 SoC support

PATCH In review [email protected] 7 participants 27 messages Sep 29, 2014 – Oct 21, 2014

Subsystems (5)
lore
Share & tools
lore

[email protected]

author reviewer
#0 lore raw

cover Add Spreadtrum Shark64 SoC support

From: "chunyan.zhang" <[email protected]>

Spreadtrum is a rapid growing chip vendor providing smart phone total solutions.
Shark64 is nominated as a SoC infrastructure that supports 4G/3G/2G standards based on ARMv8 multiple core architecture.

This patchset adds shark64 supports in arm64 device tree and implements the basic earlycon serial driver.

chunyan.zhang (6):
Documentation: DT: Add bindings for Spreadtrum serial
arm64: Add DTS support for Spreadtrum's Shark64 SoC
arm64: dts/Makefile: Add support for Spreadtrum's Shark64 SoC.
arm64: Add support for Spreadtrum's Shark64 SoC in Kconfig and defconfig tty/serial: add Spreadtrum's serial earlycon
Documentation: Add entry for Spreadtrum's Shark64 SoC

 Documentation/devicetree/bindings/arm/sprd.txt     |    6 ++
 .../devicetree/bindings/serial/of-serial.txt       |    1 +
 arch/arm64/Kconfig                                 |    5 +
 arch/arm64/boot/dts/Makefile                       |    1 +
 arch/arm64/boot/dts/sprd_shark64.dts               |  110 ++++++++++++++++++++
 arch/arm64/configs/defconfig                       |    1 +
 drivers/tty/serial/Kconfig                         |   12 +++
 drivers/tty/serial/Makefile                        |    1 +
 drivers/tty/serial/serial_sprd_early.c             |   64 ++++++++++++
 9 files changed, 201 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/sprd.txt
 create mode 100644 arch/arm64/boot/dts/sprd_shark64.dts
 create mode 100644 drivers/tty/serial/serial_sprd_early.c
Signature · 1 line
1.7.9.5
author reviewer
#1 lore raw

PATCH 1/6 Documentation: DT: Add bindings for Spreadtrum serial

From: "chunyan.zhang" <[email protected]>

Adds the device-tree documentation for Spreadtrum's serial.

---
 .../devicetree/bindings/serial/of-serial.txt       |    1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/of-serial.txt +1 -0
index 7705477..a0bb1d1 100644
@@ -14,6 +14,7 @@ Required properties:
 	- "altr,16550-FIFO32"
 	- "altr,16550-FIFO64"
 	- "altr,16550-FIFO128"
+	- "sprd,serial"
 	- "serial" if the port type is unknown.
 - reg : offset and length of the register set for the device.
 - interrupts : should contain uart interrupt.
Signature · 1 line
1.7.9.5
author reviewer
#5 lore raw

PATCH 2/6 arm64: Add DTS support for Spreadtrum's Shark64 SoC

In reply to [email protected]

From: "zhizhou.zhang" <[email protected]>

Adds the device tree support for Spreadtrum Shark64 SoC based on ARMv8 architecture.

---
 arch/arm64/boot/dts/sprd_shark64.dts |  110 ++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 arch/arm64/boot/dts/sprd_shark64.dts
arch/arm64/boot/dts/sprd_shark64.dts new file +110 -0
new file mode 100644
index 0000000..537cd6d
@@ -0,0 +1,110 @@
+/*
+ * dts file for Spreadtrum(sprd) Shark64 SOC
+ *
+ * Copyright (C) 2014,  Spreadtrum Communications Inc.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+/memreserve/ 0x80000000 0x00010000;
+
+/ {
+	model = "shark64 Board";
+	compatible = "sprd,shark64";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	chosen {
+		bootargs = "earlycon=serial_sprd,0x70000000";
+      };
+
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x3>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+	};
+
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0 0x80000000 0 0x20000000>;
+	};
+
+	aliases {
+		serial0 = &uart0;
+		serial1 = &uart1;
+	};
+
+	gic: interrupt-controller at 12001000 {
+		compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0 0x12001000 0 0x1000>,
+		      <0 0x12002000 0 0x1000>;
+	};
+
+	intc:interrupt-controller at 71400000 {
+		compatible = "sprd,intc";
+		#interrupt-cells = <0>;
+		interrupt-controller;
+		reg =	<0 0x71400000 0 0x1000>,
+			<0 0x71500000 0 0x1000>,
+			<0 0x71600000 0 0x1000>,
+			<0 0x71700000 0 0x1000>;
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <1 13 0xff01>,
+			     <1 14 0xff01>,
+			     <1 11 0xff01>,
+			     <1 10 0xff01>;
+		clock-frequency = <26000000>;
+	};
+
+	uart0: uart at 70000000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70000000 0 0x100>;
+		interrupts = <0 2 0xf04>;
+	};
+
+	uart1: uart at 70100000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70100000 0 0x100>;
+		interrupts = <0 3 0xf04>;
+	};
+};
Signature · 1 line
1.7.9.5
author reviewer
#12 lore raw

PATCH 3/6 arm64: dts/Makefile: Add support for Spreadtrum's Shark64 SoC.

In reply to [email protected]

From: "zhizhou.zhang" <[email protected]>

Adds build support for Spreadtrum's Shark64 SoC in arm64 dts Makefile.

---
 arch/arm64/boot/dts/Makefile |    1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/Makefile +1 -0
index c52bdb0..7fdb9df 100644
@@ -1,5 +1,6 @@
 dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb
 dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
+dtb-$(CONFIG_ARCH_SHARK64) += sprd_shark64.dtb
 
 targets += dtbs
 targets += $(dtb-y)
Signature · 1 line
1.7.9.5
author reviewer
#16 lore raw

PATCH 4/6 arm64: Add support for Spreadtrum's Shark64 SoC in Kconfig and defconfig

In reply to [email protected]

From: "zhizhou.zhang" <[email protected]>

Adds support for Spreadtrum's Shark64 SoC in the arm64 Kconfig and defconfig files.

---
 arch/arm64/Kconfig           |    5 +++++
 arch/arm64/configs/defconfig |    1 +
 2 files changed, 6 insertions(+)
arch/arm64/Kconfig +5 -0
index fd4e81a..c8f36ad 100644
@@ -149,6 +149,11 @@ config ARCH_XGENE
 	help
 	  This enables support for AppliedMicro X-Gene SOC Family
 
+config ARCH_SHARK64
+	bool "Spreadtrum 64-bit SOC (ARMv8 platform)"
+	help
+	Support for 64 bits Spreadtrum based systems.
+
 endmenu
 
 menu "Bus support"
arch/arm64/configs/defconfig +1 -0
index d92ef3c..86bb5e9 100644
@@ -34,6 +34,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_IOSCHED_DEADLINE is not set
 CONFIG_ARCH_VEXPRESS=y
 CONFIG_ARCH_XGENE=y
+CONFIG_ARCH_SHARK64=y
 CONFIG_SMP=y
 CONFIG_PREEMPT=y
 CONFIG_KSM=y
Signature · 1 line
1.7.9.5
author reviewer
#17 lore raw

PATCH 5/6 tty/serial: Add Spreadtrum's serial earlycon

In reply to [email protected]

From: "chunyan.zhang" <[email protected]>

Adds earlycon support for the Spreadtrum's serial.

---
 drivers/tty/serial/Kconfig             |   12 ++++++
 drivers/tty/serial/Makefile            |    1 +
 drivers/tty/serial/serial_sprd_early.c |   64 ++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 drivers/tty/serial/serial_sprd_early.c
drivers/tty/serial/Kconfig +12 -0
index 26cec64..ede16e6 100644
@@ -85,6 +85,18 @@ config SERIAL_EARLYCON_ARM_SEMIHOST
 	  with "earlycon=smh" on the kernel command line. The console is
 	  enabled when early_param is processed.
 
+config SERIAL_EARLYCON_SPRD
+	bool "Early console using SPRD serial"
+	depends on ARM64
+	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
+	select SERIAL_EARLYCON
+	help
+	  Support for early debug console using SPRD serial. This enables
+	  the console before standard serial driver is probed. This is enabled
+	  with "earlycon=serial_sprd" on the kernel command line. The console is
+	  enabled when early_param is processed.
+
 config SERIAL_SB1250_DUART
 	tristate "BCM1xxx on-chip DUART serial support"
 	depends on SIBYTE_SB1xxx_SOC=y
drivers/tty/serial/Makefile +1 -0
index 0080cc3..3ea9edc 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_SERIAL_21285) += 21285.o
 
 obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o
 obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o
+obj-$(CONFIG_SERIAL_EARLYCON_SPRD) += serial_sprd_early.o
 
 # These Sparc drivers have to appear before others such as 8250
 # which share ttySx minor node space.  Otherwise console device
drivers/tty/serial/serial_sprd_early.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author reviewer
#21 lore raw

PATCH 6/6 Documentation: Add entry for Spreadtrum's Shark64 SoC

In reply to [email protected]

From: "chunyan.zhang" <[email protected]>

Adds a devicetree binding documentation for Spreadtrum's Shark64 SoC.

---
 Documentation/devicetree/bindings/arm/sprd.txt |    6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/sprd.txt
Documentation/devicetree/bindings/arm/sprd.txt new file +6 -0
new file mode 100644
index 0000000..b6dc143
@@ -0,0 +1,6 @@
+Spreadtrum Platforms Device Tree Bindings
+----------------------------------------------------
+
+Shark64 Board
+Required root node properties:
+        - compatible = "sprd,shark64";
Signature · 1 line
1.7.9.5
maintainer
#22 lore raw

Re: [PATCH 6/6] Documentation: Add entry for Spreadtrum's Shark64 SoC

Documentation/devicetree/bindings/arm/sprd.txt line 6

Quoted 13 lines · On Monday 29 September 2014 20:04:53 zhang.lyra at gmail.com wrote:
Documentation/devicetree/bindings/arm/sprd.txt new file +6 -0
new file mode 100644
index 0000000..b6dc143
@@ -0,0 +1,6 @@
+Spreadtrum Platforms Device Tree Bindings
+----------------------------------------------------
+
+Shark64 Board
+Required root node properties:
+        - compatible = "sprd,shark64";

Is Shark a board or an SOC? The subject line of the patch and the contents seem to disagree here.

It's generally better to have the exact SoC product numbers in here, e.g. "sprd,sc1234", in case we have to apply fixups based on the SoC. You should also have a board specific string in addition to the SoC-specific one.

Arnd

maintainer
#18 lore raw

Re: [PATCH 5/6] tty/serial: Add Spreadtrum's serial earlycon

In reply to [email protected]
Quoted 17 lines · On Monday 29 September 2014 20:04:52 zhang.lyra at gmail.com wrote:

From: "chunyan.zhang" <[email protected]>

Adds earlycon support for the Spreadtrum's serial.

---
 drivers/tty/serial/Kconfig             |   12 ++++++
 drivers/tty/serial/Makefile            |    1 +
 drivers/tty/serial/serial_sprd_early.c |   64 ++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 drivers/tty/serial/serial_sprd_early.c
drivers/tty/serial/Kconfig +0 -0
index 26cec64..ede16e6 100644

drivers/tty/serial/Kconfig config SERIAL_EARLYCON_ARM_SEMIHOST · line 94

Quoted 10 lines
drivers/tty/serial/Kconfig +7 -0
@@ -85,6 +85,18 @@ config SERIAL_EARLYCON_ARM_SEMIHOST
 	  with "earlycon=smh" on the kernel command line. The console is
 	  enabled when early_param is processed.
 
+config SERIAL_EARLYCON_SPRD
+	bool "Early console using SPRD serial"
+	depends on ARM64
+	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
+	select SERIAL_EARLYCON
+	help

I assume you will later want to have a proper device driver for this hardware, so it would be better to make the Kconfig symbol and the file name what you are going to use in the long run, but for now only have the earlycon support included.

Quoted 4 lines
drivers/tty/serial/Kconfig +3 -0
+static int __init serial_sprd_early_console_setup(
+				struct earlycon_device *device,
+				const char *opt)

drivers/tty/serial/Kconfig config SERIAL_EARLYCON_ARM_SEMIHOST

Quoted 10 lines
drivers/tty/serial/Kconfig +10 -0
+{
+	if (!device->port.membase)
+		return -ENODEV;
+
+	device->con->write = serial_sprd_early_write;
+	return 0;
+}
+EARLYCON_DECLARE(serial_sprd, serial_sprd_early_console_setup);
+OF_EARLYCON_DECLARE(serial_sprd, "sprd,serial",
+		    serial_sprd_early_console_setup);

I think you should drop the EARLYCON_DECLARE() line, using OF_EARLYCON_DECLARE should be enough.

Arnd

maintainer
#2 lore raw

Re: [PATCH 1/6] Documentation: DT: Add bindings for Spreadtrum serial

In reply to [email protected]

Documentation/devicetree/bindings/serial/of-serial.txt Required properties: · line 20

Quoted 13 lines · On Monday 29 September 2014 20:04:48 zhang.lyra at gmail.com wrote:
Documentation/devicetree/bindings/serial/of-serial.txt +1 -0
index 7705477..a0bb1d1 100644
@@ -14,6 +14,7 @@ Required properties:
        - "altr,16550-FIFO32"
        - "altr,16550-FIFO64"
        - "altr,16550-FIFO128"
+       - "sprd,serial"
        - "serial" if the port type is unknown.
 - reg : offset and length of the register set for the device.
 - interrupts : should contain uart interrupt.

This file is really only for 8250 compatible UART implementations, please add a new file with a proper binding for your serial port. It would be nice if you could rename this file to 8250.txt to avoid confusing the next person.

Please also add the "sprd" prefix to Documentation/devicetree/bindings/vendor-prefixes.txt

Arnd

maintainer
#6 lore raw

Re: [PATCH 2/6] arm64: Add DTS support for Spreadtrum's Shark64 SoC

In reply to [email protected]

Review

Quoted 2 lines · On Monday 29 September 2014 20:04:49 zhang.lyra at gmail.com wrote:
(quoted diff) +2 -0
+
+/memreserve/ 0x80000000 0x00010000;

Maybe add a comment explaining why it is reserved?

arch/arm64/boot/dts/sprd_shark64.dts line 25

Quoted 3 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +3 -0
+	chosen {
+		bootargs = "earlycon=serial_sprd,0x70000000";
+      };

Just remove this for now, the command line should really be set by the boot loader, not hardcoded in the dts file.

IIRC, the earlycon=... syntax is not recommended on DT based systems, better use the "stdout-path" syntax instead.

arch/arm64/boot/dts/sprd_shark64.dts line 37

Quoted 11 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +11 -0
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};

New platforms should avoid using "spin-table" method. Please change the boot loader to implement PSCI if you can.

arch/arm64/boot/dts/sprd_shark64.dts line 69

Quoted 9 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +9 -0
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0 0x80000000 0 0x20000000>;
+	};
+
+	aliases {
+		serial0 = &uart0;
+		serial1 = &uart1;
+	};

These two belong into a board-specific file. I'd suggest renaming this file to sprd_shark64.dtsi (or whatever the SoC is called) and adding a .dts file that includes this and sets the aliases and memory node according to what the particular board has.

arch/arm64/boot/dts/sprd_shark64.dts line 88

Quoted 9 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +9 -0
+	intc:interrupt-controller at 71400000 {
+		compatible = "sprd,intc";
+		#interrupt-cells = <0>;
+		interrupt-controller;
+		reg =	<0 0x71400000 0 0x1000>,
+			<0 0x71500000 0 0x1000>,
+			<0 0x71600000 0 0x1000>,
+			<0 0x71700000 0 0x1000>;
+	};

This interrupt controller does not have a binding, so please add at least a documentation for the binding as well. The name should probably be more specific that this. Also, explain why you have an interrupt controller that has four memory regions but only one interrupt sink but no interrupt source.

I assume this is a nested interrupt controller to which some internal peripherals are connected?

arch/arm64/boot/dts/sprd_shark64.dts line 109

Quoted 11 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +11 -0
+	uart0: uart at 70000000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70000000 0 0x100>;
+		interrupts = <0 2 0xf04>;
+	};
+
+	uart1: uart at 70100000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70100000 0 0x100>;
+		interrupts = <0 3 0xf04>;
+	};

Please rename these to serial at 70000000. Like the interrupt controller, it would be good to have a more specific compatible string. You may want to add a status="disabled" property in both these nodes, and override them from the board.dts file for the ports that are actually available.

Arnd

maintainer
#23 lore raw

Re: [PATCH 6/6] Documentation: Add entry for Spreadtrum's Shark64 SoC

In reply to [email protected]
Quoted 5 lines · On Monday 29 September 2014 20:04:53 zhang.lyra at gmail.com wrote:

From: "chunyan.zhang" <[email protected]>

Adds a devicetree binding documentation for Spreadtrum's Shark64 SoC.

One more thing: The email addresses look wrong, please use the form in which you normally write the names, such as

You can set the user name that git will add using the 'git config --global user.name ...'.

Also, I notice that the email from which the patch is sent does not match the last 'Signed-off-by' line. If Chunyan and Lyra are both your names, better pick one that you use for both the email and the signoff. If you are Lyra and are posting a patch from Chunyan, please add your own line below hers, like

so that you include everybody who was involved in sending the patch, but have your own list last.

Arnd

maintainer
#26 lore raw
In reply to [email protected]
Quoted 6 lines · On Monday 29 September 2014 20:04:47 zhang.lyra at gmail.com wrote:

From: "chunyan.zhang" <[email protected]>

Spreadtrum is a rapid growing chip vendor providing smart phone total solutions.
Shark64 is nominated as a SoC infrastructure that supports 4G/3G/2G standards based on ARMv8 multiple core architecture.

This patchset adds shark64 supports in arm64 device tree and implements the basic earlycon serial driver.

Hi Lyra and/or Chunyan,

Thanks for your submission, it's great to see another company join the upstream submission process.

Your patches look good overall, but I have replied with a few comments on the details that need to be worked out.

Arnd

#13 lore raw

Re: [PATCH 3/6] arm64: dts/Makefile: Add support for Spreadtrum's Shark64 SoC.

In reply to [email protected]
Quoted 3 lines · zhang.lyra at gmail.com

dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
+dtb-$(CONFIG_ARCH_SHARK64) += sprd_shark64.dtb

It's better to keep lists in Makefiles and Kconfig sorted
alphanumerically, that way there's less chance of conflicts when
applying patches or merging different branches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140929/57e2fa07/attachment.sig>

#20 lore raw

Re: [PATCH 5/6] tty/serial: Add Spreadtrum's serial earlycon

In reply to [email protected]

drivers/tty/serial/Kconfig config SERIAL_EARLYCON_ARM_SEMIHOST · line 90

Quoted 3 lines · zhang.lyra at gmail.com
drivers/tty/serial/Kconfig +3 -0
+config SERIAL_EARLYCON_SPRD
+	bool "Early console using SPRD serial"
+	depends on ARM64

This code doesn't appear to be ARM64 specific so adding an ||
COMPILE_TEST will allow better build time coverage for people doing
generic work on the subsystem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140929/7f95f88e/attachment.sig>

author reviewer
#24 lore raw

Re: [PATCH 6/6] Documentation: Add entry for Spreadtrum's Shark64 SoC

In reply to Arnd Bergmann

Hi, Arnd

Thank you very much for your review in detail so carefully. I'll address these changes which you mentioned in this patch set in V2, but the days from tomorrow to 10.7 are Chinese holidays, I'm going to send PATCHv2 a few days later.

I'm also sorry that make you confused about my name, I'll solve this problem in the next submit.

Thanks,
Chunyan

2014-09-29 21:59 GMT+08:00 Arnd Bergmann <[email protected]>:

Quoted 29 lines · On Monday 29 September 2014 20:04:53 [email protected] wrote:
Quoted 5 lines

From: "chunyan.zhang" <[email protected]>

Adds a devicetree binding documentation for Spreadtrum's Shark64 SoC.

One more thing: The email addresses look wrong, please use the form in which you normally write the names, such as

You can set the user name that git will add using the 'git config --global user.name ...'.

Also, I notice that the email from which the patch is sent does not match the last 'Signed-off-by' line. If Chunyan and Lyra are both your names, better pick one that you use for both the email and the signoff. If you are Lyra and are posting a patch from Chunyan, please add your own line below hers, like

so that you include everybody who was involved in sending the patch, but have your own list last.

Arnd

author reviewer
#14 lore raw

Re: [PATCH 3/6] arm64: dts/Makefile: Add support for Spreadtrum's Shark64 SoC.

In reply to Mark Brown

Hi, Mark

2014-09-29 22:47 GMT+08:00 Mark Brown <[email protected]>:

Quoted 10 lines · On Mon, Sep 29, 2014 at 08:04:50PM +0800, [email protected] wrote:
Quoted 4 lines

dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
+dtb-$(CONFIG_ARCH_SHARK64) += sprd_shark64.dtb

It's better to keep lists in Makefiles and Kconfig sorted alphanumerically, that way there's less chance of conflicts when applying patches or merging different branches.

Thank you very much for your review and explain why this way is better. I'll address this change in V2.

Best regards,
Chunyan

author reviewer
#15 lore raw

Re: [PATCH 3/6] arm64: dts/Makefile: Add support for Spreadtrum's Shark64 SoC.

In reply to Mark Brown

Hi, Mark

[use plain text pattern to send again]

2014-09-29 22:47 GMT+08:00 Mark Brown <[email protected]>:

Quoted 9 lines · zhang.lyra at gmail.com
Quoted 4 lines

dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
+dtb-$(CONFIG_ARCH_SHARK64) += sprd_shark64.dtb

It's better to keep lists in Makefiles and Kconfig sorted alphanumerically, that way there's less chance of conflicts when applying patches or merging different branches.

Thank you very much for your review and explain why this way is better. I'll address this change in V2.

Best regards,
Chunyan

author reviewer
#25 lore raw

Re: [PATCH 6/6] Documentation: Add entry for Spreadtrum's Shark64 SoC

In reply to Arnd Bergmann

Hi, Arnd

[use plain text pattern to send again]

Thank you very much for your review in detail so carefully. I'll address these changes which you mentioned in this patch set in V2, but the days from tomorrow to 10.7 are Chinese holidays, I'm going to send PATCHv2 a few days later.

I'm also sorry that make you confused about my name, I'll solve this problem in the next submit.

Thanks,
Chunyan

2014-09-29 21:59 GMT+08:00 Arnd Bergmann <[email protected]>:

Quoted 28 lines · On Monday 29 September 2014 20:04:53 zhang.lyra at gmail.com wrote:
Quoted 5 lines

From: "chunyan.zhang" <[email protected]>

Adds a devicetree binding documentation for Spreadtrum's Shark64 SoC.

One more thing: The email addresses look wrong, please use the form in which you normally write the names, such as

You can set the user name that git will add using the 'git config --global user.name ...'.

Also, I notice that the email from which the patch is sent does not match the last 'Signed-off-by' line. If Chunyan and Lyra are both your names, better pick one that you use for both the email and the signoff. If you are Lyra and are posting a patch from Chunyan, please add your own line below hers, like

so that you include everybody who was involved in sending the patch, but have your own list last.

Arnd

maintainer
#7 lore raw

Re: [PATCH 2/6] arm64: Add DTS support for Spreadtrum's Shark64 SoC

In reply to Arnd Bergmann
Quoted 15 lines · Arnd Bergmann

arch/arm64/boot/dts/sprd_shark64.dts line 37

Quoted 11 lines · On Monday 29 September 2014 20:04:49 zhang.lyra at gmail.com wrote:
arch/arm64/boot/dts/sprd_shark64.dts new file +11 -0
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};

New platforms should avoid using "spin-table" method. Please change the boot loader to implement PSCI if you can.

As usual, I strongly recommend PSCI here if the CPU supports EL3. It would solve the cpuidle kernel support as well with the generic cpuidle driver and the PSCI back-end.

Signature · 1 line
Catalin
reviewer
#3 lore raw

Re: [PATCH 1/6] Documentation: DT: Add bindings for Spreadtrum serial

In reply to [email protected]
Quoted 14 lines · zhang.lyra at gmail.com

From: "chunyan.zhang" <[email protected]>

Adds the device-tree documentation for Spreadtrum's serial.

---
 .../devicetree/bindings/serial/of-serial.txt       |    1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/of-serial.txt +0 -0
index 7705477..a0bb1d1 100644

Documentation/devicetree/bindings/serial/of-serial.txt Required properties: · line 17

Quoted 4 lines
Documentation/devicetree/bindings/serial/of-serial.txt +1 -0
@@ -14,6 +14,7 @@ Required properties:
 	- "altr,16550-FIFO32"
 	- "altr,16550-FIFO64"
 	- "altr,16550-FIFO128"
+	- "sprd,serial"

Is there not a more specific name? I'd imagine you might build a different uart in future.

I didn't spot "sprd" in vendor-prefixes.txt in mainline. Is there a patch adding that?

Mark.

Quoted 7 lines
Documentation/devicetree/bindings/serial/of-serial.txt +0 -0
 	- "serial" if the port type is unknown.
 - reg : offset and length of the register set for the device.
 - interrupts : should contain uart interrupt.
Signature · 1 line
1.7.9.5
reviewer
#11 lore raw

Re: [PATCH 2/6] arm64: Add DTS support for Spreadtrum's Shark64 SoC

In reply to [email protected]
Quoted 21 lines · zhang.lyra at gmail.com

From: "zhizhou.zhang" <[email protected]>

Adds the device tree support for Spreadtrum Shark64 SoC based on ARMv8 architecture.

---
 arch/arm64/boot/dts/sprd_shark64.dts |  110 ++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 arch/arm64/boot/dts/sprd_shark64.dts
arch/arm64/boot/dts/sprd_shark64.dts new file +4 -0
new file mode 100644
index 0000000..537cd6d
@@ -0,0 +1,110 @@
+/*
+ * dts file for Spreadtrum(sprd) Shark64 SOC
+ *
+ * Copyright (C) 2014,  Spreadtrum Communications Inc.

arch/arm64/boot/dts/sprd_shark64.dts line 14

Quoted 10 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +10 -0
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+/memreserve/ 0x80000000 0x00010000;

What is this protecting?

Please add a comment.

arch/arm64/boot/dts/sprd_shark64.dts line 18

Quoted 4 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +4 -0
+
+/ {
+	model = "shark64 Board";
+	compatible = "sprd,shark64";

This feels like it would make more sense as an SoC dtsi to be included by various boards (which can override the model and compatible).

arch/arm64/boot/dts/sprd_shark64.dts line 24

Quoted 6 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +6 -0
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	chosen {
+		bootargs = "earlycon=serial_sprd,0x70000000";

Can we not use stdout-path for this?

arch/arm64/boot/dts/sprd_shark64.dts line 33

Quoted 9 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +9 -0
+      };
+
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,armv8";

Can we have the particular CPU name, please?

arch/arm64/boot/dts/sprd_shark64.dts line 36

Quoted 3 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +3 -0
+			reg = <0x0 0x0>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;

No PSCI?

What are you using for your bootloader/firmware?

If you must use spin-table, please give each CPU a unique release address.

Quoted 23 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +23 -0
+		};
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x3>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x8000fff8>;
+		};
+	};

arch/arm64/boot/dts/sprd_shark64.dts line 69

Quoted 10 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +10 -0
+
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0 0x80000000 0 0x20000000>;
+	};
+
+	aliases {
+		serial0 = &uart0;
+		serial1 = &uart1;
+	};

Could you move this up above chosen, please?

arch/arm64/boot/dts/sprd_shark64.dts line 77

Quoted 8 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +8 -0
+
+	gic: interrupt-controller at 12001000 {
+		compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0 0x12001000 0 0x1000>,
+		      <0 0x12002000 0 0x1000>;

No GICH or GICV?

Which exception level do your CPUs boot in?

I would strongly recommend booting at EL2. That gives the kernel more flexibility to perform fixups (e.g. zeroing CNTVOFF), and requires less work in your bootloader.

arch/arm64/boot/dts/sprd_shark64.dts line 88

Quoted 11 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +11 -0
+	};
+
+	intc:interrupt-controller at 71400000 {
+		compatible = "sprd,intc";
+		#interrupt-cells = <0>;
+		interrupt-controller;
+		reg =	<0 0x71400000 0 0x1000>,
+			<0 0x71500000 0 0x1000>,
+			<0 0x71600000 0 0x1000>,
+			<0 0x71700000 0 0x1000>;
+	};

This binding doesn't exist in mainline, and isn't added by this series. I'm especially confused by the #interrupt-cells = <0>.

What exactly is this, and how do you intend to use it?

arch/arm64/boot/dts/sprd_shark64.dts line 96

Quoted 8 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +8 -0
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <1 13 0xff01>,
+			     <1 14 0xff01>,
+			     <1 11 0xff01>,
+			     <1 10 0xff01>;
+		clock-frequency = <26000000>;

Please have your FW or bootloader program CNTFRQ_EL1 on each CPU, and get rid of the clock-frequency property here.

arch/arm64/boot/dts/sprd_shark64.dts line 103

Quoted 7 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +7 -0
+	};
+
+	uart0: uart at 70000000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70000000 0 0x100>;
+		interrupts = <0 2 0xf04>;
+	};

No clocks/dmas/etc necessary?

Mark.

Quoted 11 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +7 -0
+
+	uart1: uart at 70100000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70100000 0 0x100>;
+		interrupts = <0 3 0xf04>;
+	};
+};
Signature · 1 line
1.7.9.5
#19 lore raw

Re: [PATCH 5/6] tty/serial: Add Spreadtrum's serial earlycon

In reply to Arnd Bergmann
Quoted 44 lines · Arnd Bergmann
Quoted 17 lines · On Monday 29 September 2014 20:04:52 zhang.lyra at gmail.com wrote:

From: "chunyan.zhang" <[email protected]>

Adds earlycon support for the Spreadtrum's serial.

---
 drivers/tty/serial/Kconfig             |   12 ++++++
 drivers/tty/serial/Makefile            |    1 +
 drivers/tty/serial/serial_sprd_early.c |   64 ++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 drivers/tty/serial/serial_sprd_early.c
drivers/tty/serial/Kconfig +0 -0
index 26cec64..ede16e6 100644

drivers/tty/serial/Kconfig config SERIAL_EARLYCON_ARM_SEMIHOST · line 94

Quoted 10 lines
drivers/tty/serial/Kconfig +7 -0
@@ -85,6 +85,18 @@ config SERIAL_EARLYCON_ARM_SEMIHOST
        with "earlycon=smh" on the kernel command line. The console is
        enabled when early_param is processed.
 
+config SERIAL_EARLYCON_SPRD
+     bool "Early console using SPRD serial"
+     depends on ARM64
+     select SERIAL_CORE
+     select SERIAL_CORE_CONSOLE
+     select SERIAL_EARLYCON
+     help

I assume you will later want to have a proper device driver for this hardware, so it would be better to make the Kconfig symbol and the file name what you are going to use in the long run, but for now only have the earlycon support included.

Quoted 9 lines
drivers/tty/serial/Kconfig +9 -0
+static int __init serial_sprd_early_console_setup(
+                             struct earlycon_device *device,
+                             const char *opt)
+{
+     if (!device->port.membase)
+             return -ENODEV;
+
+     device->con->write = serial_sprd_early_write;
+     return 0;
Quoted 8 lines

drivers/tty/serial/Kconfig

Quoted 5 lines
drivers/tty/serial/Kconfig +4 -0
+}
+EARLYCON_DECLARE(serial_sprd, serial_sprd_early_console_setup);
+OF_EARLYCON_DECLARE(serial_sprd, "sprd,serial",
+                 serial_sprd_early_console_setup);

I think you should drop the EARLYCON_DECLARE() line, using OF_EARLYCON_DECLARE should be enough.

No, I've been telling people to put both in. The reason is you may have a bootloader or boot files (e.g PXELINUX) that only allows changing changing the command line or you want to override/extend the command line in the kernel.

I'm thinking the declaration should be combined into one to do both since I'm getting tired of making this comment.

Rob

maintainer
#4 lore raw

Re: [PATCH 1/6] Documentation: DT: Add bindings for Spreadtrum serial

In reply to Mark Rutland
Quoted 11 lines · Mark Rutland
Quoted 9 lines
Documentation/devicetree/bindings/serial/of-serial.txt +0 -0

Documentation/devicetree/bindings/serial/of-serial.txt Required properties: · line 17

Quoted 8 lines

index 7705477..a0bb1d1 100644

Documentation/devicetree/bindings/serial/of-serial.txt +1 -0
@@ -14,6 +14,7 @@ Required properties:
 	- "altr,16550-FIFO32"
 	- "altr,16550-FIFO64"
 	- "altr,16550-FIFO128"
+	- "sprd,serial"

Is there not a more specific name? I'd imagine you might build a different uart in future.

AFAIK, sprd's uart is re-used the same ip core in ARM 32bit chip. so it is neither 16550 or pl011 compatible.

Quoted 3 lines

I didn't spot "sprd" in vendor-prefixes.txt in mainline. Is there a patch adding that?

sorry for missing it. we'll add it at patch V2.
thanks for reviewing! :)

Quoted 3 lines

Mark.

author reviewer
#8 lore raw

Re: [PATCH 2/6] arm64: Add DTS support for Spreadtrum's Shark64 SoC

In reply to Arnd Bergmann

Hi, Arnd

2014-09-29 21:47 GMT+08:00 Arnd Bergmann <[email protected]>:

Quoted 10 lines · On Monday 29 September 2014 20:04:49 zhang.lyra at gmail.com wrote:

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+/memreserve/ 0x80000000 0x00010000;

Maybe add a comment explaining why it is reserved?

arch/arm64/boot/dts/sprd_shark64.dts line 25

Quoted 3 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +3 -0
+     chosen {
+             bootargs = "earlycon=serial_sprd,0x70000000";
+      };
Quoted 6 lines

Just remove this for now, the command line should really be set by the boot loader, not hardcoded in the dts file.

IIRC, the earlycon=... syntax is not recommended on DT based systems, better use the "stdout-path" syntax instead.

I have tried to use "stdout-path" instead of "bootargs= "earlycon= ..." like below :

/ {
     ...

     chosen {
             stdout-path = "/serial at 70000000";
      };

     uart0: serial at 70000000 {
             status="okay";
     };
      ...
};

But then there is nothing output information on serial console.(I have been testing in Fast Model)

I saw the below code in init/main.c

/* Check for early params. */
static int __init do_early_param(char *param, char *val, const char *unused) {
const struct obs_kernel_param *p;

for (p = __setup_start; p < __setup_end; p++) {
if ((p->early && parameq(param, p->str)) ||
(strcmp(param, "console") == 0 &&

    strcmp(p->str, "earlycon") == 0)

) {
if (p->setup_func(val) != 0)
pr_warn("Malformed early option '%s'\n", param);
}
}
/* We accept everything at this stage. */
return 0;
}

And I saw a patch from Grant Likely, he had a comment in it :
"If the devicetree specifies a serial port as a stdout device, then the kernel can use it as the default console if nothing else was selected on the command line. For any serial port that uses the uart_add_one_port() feature, the uart_add_one_port() has all the information needed to automatically enable the console device, which is what this patch does."

So, I guess that the reason why I can't see any output information on console after using "stdout-path" instead of "earlycon" is that I haven't a driver of Spreadtrum's serial, and dose not use the uart_add_one_port() feature.

I don't know is correct what I guess.

Could you give me some suggestions to solve this problem?

Thanks,
Chunyan

maintainer
#9 lore raw

Re: [PATCH 2/6] arm64: Add DTS support for Spreadtrum's Shark64 SoC

Quoted 1 line · On Wednesday 15 October 2014 11:17:07 Lyra Zhang wrote:

Hi, Arnd

Hi Lyra,

Sorry for the late reply, I've been away travelling and am just now catching up on email. Have you found a solution or do you still need help with this?

Arnd

Quoted 74 lines

2014-09-29 21:47 GMT+08:00 Arnd Bergmann <[email protected]>:

Quoted 10 lines · On Monday 29 September 2014 20:04:49 zhang.lyra at gmail.com wrote:

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+/memreserve/ 0x80000000 0x00010000;

Maybe add a comment explaining why it is reserved?

arch/arm64/boot/dts/sprd_shark64.dts line 25

Quoted 3 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +3 -0
+     chosen {
+             bootargs = "earlycon=serial_sprd,0x70000000";
+      };
Quoted 6 lines

Just remove this for now, the command line should really be set by the boot loader, not hardcoded in the dts file.

IIRC, the earlycon=... syntax is not recommended on DT based systems, better use the "stdout-path" syntax instead.

I have tried to use "stdout-path" instead of "bootargs= "earlycon= ..." like below :

/ {
     ...

     chosen {
             stdout-path = "/serial at 70000000";
      };

     uart0: serial at 70000000 {
             status="okay";
     };
      ...
};

But then there is nothing output information on serial console.(I have been testing in Fast Model)

I saw the below code in init/main.c

/* Check for early params. */
static int __init do_early_param(char *param, char *val, const char *unused) {
const struct obs_kernel_param *p;

for (p = __setup_start; p < __setup_end; p++) {
if ((p->early && parameq(param, p->str)) ||
(strcmp(param, "console") == 0 &&

    strcmp(p->str, "earlycon") == 0)

) {
if (p->setup_func(val) != 0)
pr_warn("Malformed early option '%s'\n", param);
}
}
/* We accept everything at this stage. */
return 0;
}

And I saw a patch from Grant Likely, he had a comment in it :
"If the devicetree specifies a serial port as a stdout device, then the kernel can use it as the default console if nothing else was selected on the command line. For any serial port that uses the uart_add_one_port() feature, the uart_add_one_port() has all the information needed to automatically enable the console device, which is what this patch does."

So, I guess that the reason why I can't see any output information on console after using "stdout-path" instead of "earlycon" is that I haven't a driver of Spreadtrum's serial, and dose not use the uart_add_one_port() feature.

I don't know is correct what I guess.

Could you give me some suggestions to solve this problem?

author reviewer
#10 lore raw

Re: [PATCH 2/6] arm64: Add DTS support for Spreadtrum's Shark64 SoC

Hi, Arnd

This problem have been solved, and was submitted in v2. Thanks for your answer to the question(which Orson asked for me) about this on Freenode.

Best regards,
Lyra

2014-10-21 3:00 GMT+08:00 Arnd Bergmann <[email protected]>:

Quoted 86 lines · On Wednesday 15 October 2014 11:17:07 Lyra Zhang wrote:
Quoted 1 line

Hi, Arnd

Hi Lyra,

Sorry for the late reply, I've been away travelling and am just now catching up on email. Have you found a solution or do you still need help with this?

Arnd

Quoted 74 lines

2014-09-29 21:47 GMT+08:00 Arnd Bergmann <[email protected]>:

Quoted 10 lines · On Monday 29 September 2014 20:04:49 zhang.lyra at gmail.com wrote:

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+/memreserve/ 0x80000000 0x00010000;

Maybe add a comment explaining why it is reserved?

arch/arm64/boot/dts/sprd_shark64.dts line 25

Quoted 3 lines
arch/arm64/boot/dts/sprd_shark64.dts new file +3 -0
+     chosen {
+             bootargs = "earlycon=serial_sprd,0x70000000";
+      };
Quoted 6 lines

Just remove this for now, the command line should really be set by the boot loader, not hardcoded in the dts file.

IIRC, the earlycon=... syntax is not recommended on DT based systems, better use the "stdout-path" syntax instead.

I have tried to use "stdout-path" instead of "bootargs= "earlycon= ..." like below :

/ {
     ...

     chosen {
             stdout-path = "/serial at 70000000";
      };

     uart0: serial at 70000000 {
             status="okay";
     };
      ...
};

But then there is nothing output information on serial console.(I have been testing in Fast Model)

I saw the below code in init/main.c

/* Check for early params. */
static int __init do_early_param(char *param, char *val, const char *unused) {
const struct obs_kernel_param *p;

for (p = __setup_start; p < __setup_end; p++) {
if ((p->early && parameq(param, p->str)) ||
(strcmp(param, "console") == 0 &&

    strcmp(p->str, "earlycon") == 0)

) {
if (p->setup_func(val) != 0)
pr_warn("Malformed early option '%s'\n", param);
}
}
/* We accept everything at this stage. */
return 0;
}

And I saw a patch from Grant Likely, he had a comment in it :
"If the devicetree specifies a serial port as a stdout device, then the kernel can use it as the default console if nothing else was selected on the command line. For any serial port that uses the uart_add_one_port() feature, the uart_add_one_port() has all the information needed to automatically enable the console device, which is what this patch does."

So, I guess that the reason why I can't see any output information on console after using "stdout-path" instead of "earlycon" is that I haven't a driver of Spreadtrum's serial, and dose not use the uart_add_one_port() feature.

I don't know is correct what I guess.

Could you give me some suggestions to solve this problem?