linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support
       [not found] <sprd-1017-v2>
@ 2014-10-17  9:54 ` Chunyan Zhang
  2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
                     ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Chunyan Zhang @ 2014-10-17  9:54 UTC (permalink / raw)
  To: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang
  Cc: devicetree, linux-arm-kernel, linux-kernel, sprdlinux

Spreadtrum is a rapid growing chip vendor providing smart phone total solutions.

Sharkl Platform is nominated as a SoC infrastructure that supports 4G/3G/2G
standards based on ARMv8 multiple core architecture.Now we have only one
SoC(Sharkl3) based on this Platform in developing.

This patchset adds Sharkl support in arm64 device tree and implements the
basic earlycon serial driver.

This patchset also has patches which address "sprd" prefix and DT compatible
strings for nodes which appear un-documented.

This version code was tesed on Fast Mode successfully.

Changes from v1:
* Addressed review comments:
	- Added "sprd" prefix to vendor-prefixes.txt
	- Created serial/sprd-serial.txt and remove the properties for serial-sprd
	  from of-serial.txt to it.
	- Renamed of-serial.txt to 8250.txt according to Arnd's review comments
	- Splited and revised .dts for Sharkl Platform
	- Changed to PSCI method for cpu power management
	- Revised Kconfig Makefile to match the alphabetical ordering
	- Renamed serial-sprd-earlycon.c to serial-sprd.c

Chunyan Zhang (3):
  Documentation: DT: Renamed of-serial.txt to 8250.txt
  Documentation: DT: Add bindings for Spreadtrum Sharkl Platform
  tty/serial: Add earlycon support for Spreadtrum serial driver

Zhizhou Zhang (2):
  arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile.
  arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig

 Documentation/devicetree/bindings/arm/sprd.txt     |   11 ++++
 Documentation/devicetree/bindings/serial/8250.txt  |   50 ++++++++++++++
 .../devicetree/bindings/serial/of-serial.txt       |   50 --------------
 .../devicetree/bindings/serial/sprd-serial.txt     |    6 ++
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 arch/arm64/Kconfig                                 |    6 ++
 arch/arm64/boot/dts/Makefile                       |    1 +
 arch/arm64/boot/dts/sprd-sharkl.dtsi               |   33 ++++++++++
 arch/arm64/boot/dts/sprd-sharkl3-fpga.dts          |   41 ++++++++++++
 arch/arm64/boot/dts/sprd-sharkl3.dtsi              |   69 ++++++++++++++++++++
 arch/arm64/configs/defconfig                       |    1 +
 drivers/tty/serial/Kconfig                         |   24 +++++++
 drivers/tty/serial/Makefile                        |    1 +
 drivers/tty/serial/sprd-serial.c                   |   64 ++++++++++++++++++
 14 files changed, 308 insertions(+), 50 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/sprd.txt
 create mode 100644 Documentation/devicetree/bindings/serial/8250.txt
 delete mode 100644 Documentation/devicetree/bindings/serial/of-serial.txt
 create mode 100644 Documentation/devicetree/bindings/serial/sprd-serial.txt
 create mode 100644 arch/arm64/boot/dts/sprd-sharkl.dtsi
 create mode 100644 arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
 create mode 100644 arch/arm64/boot/dts/sprd-sharkl3.dtsi
 create mode 100644 drivers/tty/serial/sprd-serial.c

-- 
1.7.9.5


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

* [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt
  2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
@ 2014-10-17  9:54   ` Chunyan Zhang
  2014-10-17 13:12     ` Mark Rutland
  2014-10-20 13:47     ` Arnd Bergmann
  2014-10-17  9:54   ` [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform Chunyan Zhang
                     ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Chunyan Zhang @ 2014-10-17  9:54 UTC (permalink / raw)
  To: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang
  Cc: devicetree, linux-arm-kernel, linux-kernel, sprdlinux

The file of-serial.txt was only for 8250 compatible UART implementations,
so renamed it to 8250.txt to avoid confusing other persons.

Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 Documentation/devicetree/bindings/serial/8250.txt  |   50 ++++++++++++++++++++
 .../devicetree/bindings/serial/of-serial.txt       |   50 --------------------
 2 files changed, 50 insertions(+), 50 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/8250.txt
 delete mode 100644 Documentation/devicetree/bindings/serial/of-serial.txt

diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
new file mode 100644
index 0000000..7705477
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/8250.txt
@@ -0,0 +1,50 @@
+* UART (Universal Asynchronous Receiver/Transmitter)
+
+Required properties:
+- compatible : one of:
+	- "ns8250"
+	- "ns16450"
+	- "ns16550a"
+	- "ns16550"
+	- "ns16750"
+	- "ns16850"
+	- "nvidia,tegra20-uart"
+	- "nxp,lpc3220-uart"
+	- "ibm,qpace-nwp-serial"
+	- "altr,16550-FIFO32"
+	- "altr,16550-FIFO64"
+	- "altr,16550-FIFO128"
+	- "serial" if the port type is unknown.
+- reg : offset and length of the register set for the device.
+- interrupts : should contain uart interrupt.
+- clock-frequency : the input clock frequency for the UART
+	 or
+  clocks phandle to refer to the clk used as per Documentation/devicetree
+  /bindings/clock/clock-bindings.txt
+
+Optional properties:
+- current-speed : the current active speed of the UART.
+- reg-offset : offset to apply to the mapbase from the start of the registers.
+- reg-shift : quantity to shift the register offsets by.
+- reg-io-width : the size (in bytes) of the IO accesses that should be
+  performed on the device.  There are some systems that require 32-bit
+  accesses to the UART (e.g. TI davinci).
+- used-by-rtas : set to indicate that the port is in use by the OpenFirmware
+  RTAS and should not be registered.
+- no-loopback-test: set to indicate that the port does not implements loopback
+  test mode
+- fifo-size: the fifo size of the UART.
+- auto-flow-control: one way to enable automatic flow control support. The
+  driver is allowed to detect support for the capability even without this
+  property.
+- has-hw-flow-control: the hardware has flow control capability.
+
+Example:
+
+	uart@80230000 {
+		compatible = "ns8250";
+		reg = <0x80230000 0x100>;
+		clock-frequency = <3686400>;
+		interrupts = <10>;
+		reg-shift = <2>;
+	};
diff --git a/Documentation/devicetree/bindings/serial/of-serial.txt b/Documentation/devicetree/bindings/serial/of-serial.txt
deleted file mode 100644
index 7705477..0000000
--- a/Documentation/devicetree/bindings/serial/of-serial.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-* UART (Universal Asynchronous Receiver/Transmitter)
-
-Required properties:
-- compatible : one of:
-	- "ns8250"
-	- "ns16450"
-	- "ns16550a"
-	- "ns16550"
-	- "ns16750"
-	- "ns16850"
-	- "nvidia,tegra20-uart"
-	- "nxp,lpc3220-uart"
-	- "ibm,qpace-nwp-serial"
-	- "altr,16550-FIFO32"
-	- "altr,16550-FIFO64"
-	- "altr,16550-FIFO128"
-	- "serial" if the port type is unknown.
-- reg : offset and length of the register set for the device.
-- interrupts : should contain uart interrupt.
-- clock-frequency : the input clock frequency for the UART
-	 or
-  clocks phandle to refer to the clk used as per Documentation/devicetree
-  /bindings/clock/clock-bindings.txt
-
-Optional properties:
-- current-speed : the current active speed of the UART.
-- reg-offset : offset to apply to the mapbase from the start of the registers.
-- reg-shift : quantity to shift the register offsets by.
-- reg-io-width : the size (in bytes) of the IO accesses that should be
-  performed on the device.  There are some systems that require 32-bit
-  accesses to the UART (e.g. TI davinci).
-- used-by-rtas : set to indicate that the port is in use by the OpenFirmware
-  RTAS and should not be registered.
-- no-loopback-test: set to indicate that the port does not implements loopback
-  test mode
-- fifo-size: the fifo size of the UART.
-- auto-flow-control: one way to enable automatic flow control support. The
-  driver is allowed to detect support for the capability even without this
-  property.
-- has-hw-flow-control: the hardware has flow control capability.
-
-Example:
-
-	uart@80230000 {
-		compatible = "ns8250";
-		reg = <0x80230000 0x100>;
-		clock-frequency = <3686400>;
-		interrupts = <10>;
-		reg-shift = <2>;
-	};
-- 
1.7.9.5


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

* [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform
  2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
  2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
@ 2014-10-17  9:54   ` Chunyan Zhang
  2014-10-17 12:50     ` Mark Rutland
  2014-10-20 13:48     ` Arnd Bergmann
  2014-10-17  9:54   ` [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile Chunyan Zhang
                     ` (3 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Chunyan Zhang @ 2014-10-17  9:54 UTC (permalink / raw)
  To: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang
  Cc: devicetree, linux-arm-kernel, linux-kernel, sprdlinux

Adds Spreadtrum's prefix "sprd" to vendor-prefixes file.
Adds the devicetree binding documentation for Spreadtrum's serial
and Sharkl3 SoC based on the Sharkl Platform which is the 64-bit
SoC Platform of Spreadtrum.

Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 Documentation/devicetree/bindings/arm/sprd.txt     |   11 +++++++++++
 .../devicetree/bindings/serial/sprd-serial.txt     |    6 ++++++
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 3 files changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/sprd.txt
 create mode 100644 Documentation/devicetree/bindings/serial/sprd-serial.txt

diff --git a/Documentation/devicetree/bindings/arm/sprd.txt b/Documentation/devicetree/bindings/arm/sprd.txt
new file mode 100644
index 0000000..40b40d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/sprd.txt
@@ -0,0 +1,11 @@
+Spreadtrum Sharkl Platforms Device Tree Bindings
+----------------------------------------------------
+
+Sharkl is a Spreadtrum's SoC Platform which is based
+on ARM 64-bit processor.
+
+Sharkl3 FPGA board with Sharkl3 SoC based on the
+Sharkl Platform shall have the following properties.
+
+Required root node properties:
+        - compatible = "sprd,sharkl3-fpga", "sprd,sharkl3";
diff --git a/Documentation/devicetree/bindings/serial/sprd-serial.txt b/Documentation/devicetree/bindings/serial/sprd-serial.txt
new file mode 100644
index 0000000..c97b0a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/sprd-serial.txt
@@ -0,0 +1,6 @@
+* Spreadtrum serial UART
+
+Required properties:
+- compatible: must be "sprd,serial"
+- reg: offset and length of the register set for the device
+- interrupts: exactly one interrupt specifier
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ac7269f..5dbf7db 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -129,6 +129,7 @@ smsc	Standard Microsystems Corporation
 snps 	Synopsys, Inc.
 solidrun	SolidRun
 spansion	Spansion Inc.
+sprd	Spreadtrum Communications Inc.
 st	STMicroelectronics
 ste	ST-Ericsson
 stericsson	ST-Ericsson
-- 
1.7.9.5


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

* [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile.
  2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
  2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
  2014-10-17  9:54   ` [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform Chunyan Zhang
@ 2014-10-17  9:54   ` Chunyan Zhang
  2014-10-17 13:00     ` Mark Rutland
  2014-10-17  9:54   ` [PATCH v2 4/5] arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig Chunyan Zhang
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Chunyan Zhang @ 2014-10-17  9:54 UTC (permalink / raw)
  To: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang
  Cc: devicetree, linux-arm-kernel, linux-kernel, sprdlinux

From: Zhizhou Zhang <zhizhou.zhang@spreadtrum.com>

Adds the device tree support for Spreadtrum Sharkl3 SoC which is based on
Sharkl platform.

Sharkl platform contains the common nodes of Spreadtrum's arm64-based SoCs.

Signed-off-by: Zhizhou Zhang <zhizhou.zhang@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 arch/arm64/boot/dts/Makefile              |    1 +
 arch/arm64/boot/dts/sprd-sharkl.dtsi      |   33 ++++++++++++++
 arch/arm64/boot/dts/sprd-sharkl3-fpga.dts |   41 +++++++++++++++++
 arch/arm64/boot/dts/sprd-sharkl3.dtsi     |   69 +++++++++++++++++++++++++++++
 4 files changed, 144 insertions(+)
 create mode 100644 arch/arm64/boot/dts/sprd-sharkl.dtsi
 create mode 100644 arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
 create mode 100644 arch/arm64/boot/dts/sprd-sharkl3.dtsi

diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index c52bdb0..0030e44 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,3 +1,4 @@
+dtb-$(CONFIG_ARCH_SHARKL) += sprd-sharkl3-fpga.dtb
 dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb
 dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
 
diff --git a/arch/arm64/boot/dts/sprd-sharkl.dtsi b/arch/arm64/boot/dts/sprd-sharkl.dtsi
new file mode 100644
index 0000000..26a28c3
--- /dev/null
+++ b/arch/arm64/boot/dts/sprd-sharkl.dtsi
@@ -0,0 +1,33 @@
+/*
+ * dtsi file for Spreadtrum(sprd) Sharkl Platform based on AArch64.
+ *
+ * Copyright (C) 2014,  Spreadtrum Communications Inc.
+ *
+ * Sharkl Platform is the base of Spreadtrum arm64 SoCs whose common
+ * nodes are listed in this file.
+ *
+ * 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.
+ */
+
+/ {
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	uart0: serial@70000000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70000000 0 0x100>;
+		interrupts = <0 2 0xf04>;
+		status = "disabled";
+	};
+
+	uart1: serial@70100000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70100000 0 0x100>;
+		interrupts = <0 3 0xf04>;
+		status = "disabled";
+	};
+};
diff --git a/arch/arm64/boot/dts/sprd-sharkl3-fpga.dts b/arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
new file mode 100644
index 0000000..faa0a2e
--- /dev/null
+++ b/arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
@@ -0,0 +1,41 @@
+/*
+ * DTS file for Spreadtrum(sprd) Sharkl3 FPGA board based on
+ * the Sharkl Platform.
+ *
+ * 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/;
+
+#include "sprd-sharkl3.dtsi"
+
+/ {
+        model = "Spreadtrum Sharkl3 FPGA board";
+
+	compatible = "sprd,sharkl3-fpga", "sprd,sharkl3";
+
+	aliases {
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0 0x80000000 0 0x20000000>;
+	};
+
+	chosen {
+		stdout-path = &uart0;
+	};
+
+	uart0: serial@70000000 {
+		status = "okay";
+	};
+
+	uart1: serial@70100000 {
+		status = "okay";
+	};
+};
diff --git a/arch/arm64/boot/dts/sprd-sharkl3.dtsi b/arch/arm64/boot/dts/sprd-sharkl3.dtsi
new file mode 100644
index 0000000..0ab4a94
--- /dev/null
+++ b/arch/arm64/boot/dts/sprd-sharkl3.dtsi
@@ -0,0 +1,69 @@
+/*
+ * dtsi file for Spreadtrum(sprd) Sharkl3 SoC based on the Sharkl Platform.
+ *
+ * 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.
+ */
+
+#include "sprd-sharkl.dtsi"
+
+/ {
+	compatible = "sprd,sharkl3";
+
+	gic: interrupt-controller@12001000 {
+		compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		interrupt-controller;
+		reg = <0 0x12001000 0 0x1000>,
+		      <0 0x12002000 0 0x1000>,
+		      <0 0x12004000 0 0x2000>,
+		      <0 0x12006000 0 0x2000>;
+	};
+
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+		cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+		};
+		cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+		};
+		cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x3>;
+			enable-method = "psci";
+		};
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <1 13 0xff01>,
+			     <1 14 0xff01>,
+			     <1 11 0xff01>,
+			     <1 10 0xff01>;
+	};
+};
-- 
1.7.9.5


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

* [PATCH v2 4/5] arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig
  2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
                     ` (2 preceding siblings ...)
  2014-10-17  9:54   ` [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile Chunyan Zhang
@ 2014-10-17  9:54   ` Chunyan Zhang
  2014-10-17  9:54   ` [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver Chunyan Zhang
  2014-10-21 11:15   ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Pavel Machek
  5 siblings, 0 replies; 20+ messages in thread
From: Chunyan Zhang @ 2014-10-17  9:54 UTC (permalink / raw)
  To: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang
  Cc: devicetree, linux-arm-kernel, linux-kernel, sprdlinux

From: Zhizhou Zhang <zhizhou.zhang@spreadtrum.com>

Adds support for Spreadtrum's Sharkl Platform in the arm64 Kconfig
and defconfig files.

Signed-off-by: Zhizhou Zhang <zhizhou.zhang@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 arch/arm64/Kconfig           |    6 ++++++
 arch/arm64/configs/defconfig |    1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index fd4e81a..eac2e2c 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -134,6 +134,12 @@ source "kernel/Kconfig.freezer"
 
 menu "Platform selection"
 
+config ARCH_SHARKL
+	bool "Spreadtrum 64-bit SoC Platform"
+	help
+	  Sharkl is a Spreadtrum's SoC Platform which is based
+	  on ARM 64-bit processor.
+
 config ARCH_VEXPRESS
 	bool "ARMv8 software model (Versatile Express)"
 	select ARCH_REQUIRE_GPIOLIB
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index d92ef3c..c62ff98 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -32,6 +32,7 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
+CONFIG_ARCH_SHARKL=y
 CONFIG_ARCH_VEXPRESS=y
 CONFIG_ARCH_XGENE=y
 CONFIG_SMP=y
-- 
1.7.9.5


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

* [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
                     ` (3 preceding siblings ...)
  2014-10-17  9:54   ` [PATCH v2 4/5] arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig Chunyan Zhang
@ 2014-10-17  9:54   ` Chunyan Zhang
  2014-10-17 13:03     ` Mark Rutland
  2014-10-18 21:06     ` One Thousand Gnomes
  2014-10-21 11:15   ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Pavel Machek
  5 siblings, 2 replies; 20+ messages in thread
From: Chunyan Zhang @ 2014-10-17  9:54 UTC (permalink / raw)
  To: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang
  Cc: devicetree, linux-arm-kernel, linux-kernel, sprdlinux

Add serial driver for spreadtrum sharkl platform with earlycon
support at first.

Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 drivers/tty/serial/Kconfig       |   24 ++++++++++++++
 drivers/tty/serial/Makefile      |    1 +
 drivers/tty/serial/sprd-serial.c |   64 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+)
 create mode 100644 drivers/tty/serial/sprd-serial.c

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 26cec64..33b8f90 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
 
 	  If unsure, say Y.
 
+config SERIAL_SPRD
+	tristate "Support for SPRD serial"
+	depends on ARM || ARM64
+	select SERIAL_CORE
+	help
+          This enables the driver for the Spreadtrum's serial.
+
+config SERIAL_SPRD_NR
+        int "Maximum number of sprd serial ports"
+        depends on SERIAL_SPRD
+        default "4"
+
+config SERIAL_SPRD_CONSOLE
+        bool "SPRD UART console support"
+        depends on SERIAL_SPRD=y
+        select SERIAL_CORE_CONSOLE
+	select SERIAL_EARLYCON
+        help
+	  Support for early debug console using Spreadtrum's 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_ATMEL
 	bool "AT91 / AT32 on-chip serial port support"
 	depends on ARCH_AT91 || AVR32
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 0080cc3..b16e0d4 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -92,6 +92,7 @@ obj-$(CONFIG_SERIAL_ARC)	+= arc_uart.o
 obj-$(CONFIG_SERIAL_RP2)	+= rp2.o
 obj-$(CONFIG_SERIAL_FSL_LPUART)	+= fsl_lpuart.o
 obj-$(CONFIG_SERIAL_MEN_Z135)	+= men_z135_uart.o
+obj-$(CONFIG_SERIAL_SPRD) += sprd-serial.o
 
 # GPIOLIB helpers for modem control lines
 obj-$(CONFIG_SERIAL_MCTRL_GPIO)	+= serial_mctrl_gpio.o
diff --git a/drivers/tty/serial/sprd-serial.c b/drivers/tty/serial/sprd-serial.c
new file mode 100644
index 0000000..9ae594f
--- /dev/null
+++ b/drivers/tty/serial/sprd-serial.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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/kernel.h>
+#include <linux/console.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/of.h>
+
+/*offset*/
+#define UART_TXD	0x0000
+#define UART_RXD	0x0004
+#define UART_STS0	0x0008
+#define UART_STS1	0x000C
+#define UART_IEN	0x0010
+#define UART_ICLR	0x0014
+#define UART_CTL0	0x0018
+#define UART_CTL1	0x001C
+#define UART_CTL2	0x0020
+#define UART_CLKD0	0x0024
+#define UART_CLKD1	0x0028
+#define UART_STS2	0x002C
+
+/*line status */
+#define UART_LSR_TX_OVER	(0x1<<15)
+
+static void serial_sprd_putc(struct uart_port *port, int c)
+{
+	while (!(readl(port->membase + UART_STS0) & UART_LSR_TX_OVER))
+		;
+	writeb(c, port->membase + UART_TXD);
+}
+
+static void serial_sprd_early_write(struct console *con, const char *s,
+				    unsigned n)
+{
+	struct earlycon_device *dev = con->data;
+
+	uart_console_write(&dev->port, s, n, serial_sprd_putc);
+}
+
+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;
+}
+EARLYCON_DECLARE(serial_sprd, serial_sprd_early_console_setup);
+OF_EARLYCON_DECLARE(serial_sprd, "sprd,serial",
+		    serial_sprd_early_console_setup);
-- 
1.7.9.5


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

* Re: [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform
  2014-10-17  9:54   ` [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform Chunyan Zhang
@ 2014-10-17 12:50     ` Mark Rutland
  2014-10-20 13:48     ` Arnd Bergmann
  1 sibling, 0 replies; 20+ messages in thread
From: Mark Rutland @ 2014-10-17 12:50 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Catalin Marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	m-karicheri2, Pawel Moll, artagnon, rrichter, robh+dt,
	Will Deacon, orsonzhai, geng.ren, zhizhou.zhang, devicetree,
	linux-arm-kernel, linux-kernel, sprdlinux

On Fri, Oct 17, 2014 at 10:54:22AM +0100, Chunyan Zhang wrote:
> Adds Spreadtrum's prefix "sprd" to vendor-prefixes file.
> Adds the devicetree binding documentation for Spreadtrum's serial
> and Sharkl3 SoC based on the Sharkl Platform which is the 64-bit
> SoC Platform of Spreadtrum.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> ---
>  Documentation/devicetree/bindings/arm/sprd.txt     |   11 +++++++++++
>  .../devicetree/bindings/serial/sprd-serial.txt     |    6 ++++++
>  .../devicetree/bindings/vendor-prefixes.txt        |    1 +
>  3 files changed, 18 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/arm/sprd.txt
>  create mode 100644 Documentation/devicetree/bindings/serial/sprd-serial.txt
> 
> diff --git a/Documentation/devicetree/bindings/arm/sprd.txt b/Documentation/devicetree/bindings/arm/sprd.txt
> new file mode 100644
> index 0000000..40b40d6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/sprd.txt
> @@ -0,0 +1,11 @@
> +Spreadtrum Sharkl Platforms Device Tree Bindings
> +----------------------------------------------------
> +
> +Sharkl is a Spreadtrum's SoC Platform which is based
> +on ARM 64-bit processor.
> +
> +Sharkl3 FPGA board with Sharkl3 SoC based on the
> +Sharkl Platform shall have the following properties.
> +
> +Required root node properties:
> +        - compatible = "sprd,sharkl3-fpga", "sprd,sharkl3";
> diff --git a/Documentation/devicetree/bindings/serial/sprd-serial.txt b/Documentation/devicetree/bindings/serial/sprd-serial.txt
> new file mode 100644
> index 0000000..c97b0a6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/sprd-serial.txt
> @@ -0,0 +1,6 @@
> +* Spreadtrum serial UART
> +
> +Required properties:
> +- compatible: must be "sprd,serial"
> +- reg: offset and length of the register set for the device
> +- interrupts: exactly one interrupt specifier

I'm still a little wary of then name "sprd,serial". What was the first
device to feature this UART, if it doesn't have a specific name of its
own?

> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index ac7269f..5dbf7db 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -129,6 +129,7 @@ smsc	Standard Microsystems Corporation
>  snps 	Synopsys, Inc.
>  solidrun	SolidRun
>  spansion	Spansion Inc.
> +sprd	Spreadtrum Communications Inc.
>  st	STMicroelectronics
>  ste	ST-Ericsson
>  stericsson	ST-Ericsson

The vendor prefix addition looks fine to me.

Thanks,
Mark.

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

* Re: [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile.
  2014-10-17  9:54   ` [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile Chunyan Zhang
@ 2014-10-17 13:00     ` Mark Rutland
  0 siblings, 0 replies; 20+ messages in thread
From: Mark Rutland @ 2014-10-17 13:00 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Catalin Marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	m-karicheri2, Pawel Moll, artagnon, rrichter, robh+dt,
	Will Deacon, orsonzhai, geng.ren, zhizhou.zhang, devicetree,
	linux-arm-kernel, linux-kernel, sprdlinux

On Fri, Oct 17, 2014 at 10:54:23AM +0100, Chunyan Zhang wrote:
> From: Zhizhou Zhang <zhizhou.zhang@spreadtrum.com>
> 
> Adds the device tree support for Spreadtrum Sharkl3 SoC which is based on
> Sharkl platform.
> 
> Sharkl platform contains the common nodes of Spreadtrum's arm64-based SoCs.
> 
> Signed-off-by: Zhizhou Zhang <zhizhou.zhang@spreadtrum.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> ---
>  arch/arm64/boot/dts/Makefile              |    1 +
>  arch/arm64/boot/dts/sprd-sharkl.dtsi      |   33 ++++++++++++++
>  arch/arm64/boot/dts/sprd-sharkl3-fpga.dts |   41 +++++++++++++++++
>  arch/arm64/boot/dts/sprd-sharkl3.dtsi     |   69 +++++++++++++++++++++++++++++
>  4 files changed, 144 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/sprd-sharkl.dtsi
>  create mode 100644 arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
>  create mode 100644 arch/arm64/boot/dts/sprd-sharkl3.dtsi
> 
> diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
> index c52bdb0..0030e44 100644
> --- a/arch/arm64/boot/dts/Makefile
> +++ b/arch/arm64/boot/dts/Makefile
> @@ -1,3 +1,4 @@
> +dtb-$(CONFIG_ARCH_SHARKL) += sprd-sharkl3-fpga.dtb
>  dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb
>  dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
>  
> diff --git a/arch/arm64/boot/dts/sprd-sharkl.dtsi b/arch/arm64/boot/dts/sprd-sharkl.dtsi
> new file mode 100644
> index 0000000..26a28c3
> --- /dev/null
> +++ b/arch/arm64/boot/dts/sprd-sharkl.dtsi
> @@ -0,0 +1,33 @@
> +/*
> + * dtsi file for Spreadtrum(sprd) Sharkl Platform based on AArch64.
> + *
> + * Copyright (C) 2014,  Spreadtrum Communications Inc.
> + *
> + * Sharkl Platform is the base of Spreadtrum arm64 SoCs whose common
> + * nodes are listed in this file.
> + *
> + * 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.
> + */
> +
> +/ {
> +	interrupt-parent = <&gic>;
> +	#address-cells = <2>;
> +	#size-cells = <2>;
> +
> +	uart0: serial@70000000 {
> +		compatible = "sprd,serial";
> +		reg = <0 0x70000000 0 0x100>;
> +		interrupts = <0 2 0xf04>;
> +		status = "disabled";
> +	};
> +
> +	uart1: serial@70100000 {
> +		compatible = "sprd,serial";
> +		reg = <0 0x70100000 0 0x100>;
> +		interrupts = <0 3 0xf04>;
> +		status = "disabled";
> +	};
> +};
> diff --git a/arch/arm64/boot/dts/sprd-sharkl3-fpga.dts b/arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
> new file mode 100644
> index 0000000..faa0a2e
> --- /dev/null
> +++ b/arch/arm64/boot/dts/sprd-sharkl3-fpga.dts
> @@ -0,0 +1,41 @@
> +/*
> + * DTS file for Spreadtrum(sprd) Sharkl3 FPGA board based on
> + * the Sharkl Platform.
> + *
> + * 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/;
> +
> +#include "sprd-sharkl3.dtsi"
> +
> +/ {
> +        model = "Spreadtrum Sharkl3 FPGA board";

For some reason this line begins with spaces rather than a tab, which
breaks the alignment and is a little annoying. Could you please fix the
spaces here to a tab?

> +
> +	compatible = "sprd,sharkl3-fpga", "sprd,sharkl3";
> +
> +	aliases {
> +	};
> +
> +	memory@80000000 {
> +		device_type = "memory";
> +		reg = <0 0x80000000 0 0x20000000>;
> +	};
> +
> +	chosen {
> +		stdout-path = &uart0;
> +	};
> +
> +	uart0: serial@70000000 {
> +		status = "okay";
> +	};
> +
> +	uart1: serial@70100000 {
> +		status = "okay";
> +	};
> +};
> diff --git a/arch/arm64/boot/dts/sprd-sharkl3.dtsi b/arch/arm64/boot/dts/sprd-sharkl3.dtsi
> new file mode 100644
> index 0000000..0ab4a94
> --- /dev/null
> +++ b/arch/arm64/boot/dts/sprd-sharkl3.dtsi
> @@ -0,0 +1,69 @@
> +/*
> + * dtsi file for Spreadtrum(sprd) Sharkl3 SoC based on the Sharkl Platform.
> + *
> + * 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.
> + */
> +
> +#include "sprd-sharkl.dtsi"
> +
> +/ {
> +	compatible = "sprd,sharkl3";
> +
> +	gic: interrupt-controller@12001000 {
> +		compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
> +		#interrupt-cells = <3>;
> +		interrupt-controller;
> +		reg = <0 0x12001000 0 0x1000>,
> +		      <0 0x12002000 0 0x1000>,
> +		      <0 0x12004000 0 0x2000>,
> +		      <0 0x12006000 0 0x2000>;
> +	};

Could we move this after the cpus node please?

> +
> +	cpus {
> +		#address-cells = <2>;
> +		#size-cells = <0>;
> +
> +		cpu@0 {
> +			device_type = "cpu";
> +			compatible = "arm,armv8";

Could we have the compatible string for the actual CPU rather than just
"arm,armv8"?

> +			reg = <0x0 0x0>;
> +			enable-method = "psci";
> +		};
> +		cpu@1 {
> +			device_type = "cpu";
> +			compatible = "arm,armv8";
> +			reg = <0x0 0x1>;
> +			enable-method = "psci";
> +		};
> +		cpu@2 {
> +			device_type = "cpu";
> +			compatible = "arm,armv8";
> +			reg = <0x0 0x2>;
> +			enable-method = "psci";
> +		};
> +		cpu@3 {
> +			device_type = "cpu";
> +			compatible = "arm,armv8";
> +			reg = <0x0 0x3>;
> +			enable-method = "psci";
> +		};
> +	};
> +
> +	psci {
> +		compatible = "arm,psci-0.2";
> +		method = "smc";
> +	};

What are you using as your PSCI implementation?

> +	timer {
> +		compatible = "arm,armv8-timer";
> +		interrupts = <1 13 0xff01>,
> +			     <1 14 0xff01>,
> +			     <1 11 0xff01>,
> +			     <1 10 0xff01>;
> +	};

I take it that CNTFRQ is programmed correctly on all CPUs?

Thanks,
Mark.

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-17  9:54   ` [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver Chunyan Zhang
@ 2014-10-17 13:03     ` Mark Rutland
  2014-10-20  7:27       ` Lyra Zhang
  2014-10-18 21:06     ` One Thousand Gnomes
  1 sibling, 1 reply; 20+ messages in thread
From: Mark Rutland @ 2014-10-17 13:03 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Catalin Marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	m-karicheri2, Pawel Moll, artagnon, rrichter, robh+dt,
	Will Deacon, orsonzhai, geng.ren, zhizhou.zhang, devicetree,
	linux-arm-kernel, linux-kernel, sprdlinux

On Fri, Oct 17, 2014 at 10:54:25AM +0100, Chunyan Zhang wrote:
> Add serial driver for spreadtrum sharkl platform with earlycon
> support at first.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> ---
>  drivers/tty/serial/Kconfig       |   24 ++++++++++++++
>  drivers/tty/serial/Makefile      |    1 +
>  drivers/tty/serial/sprd-serial.c |   64 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 89 insertions(+)
>  create mode 100644 drivers/tty/serial/sprd-serial.c
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 26cec64..33b8f90 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
>  
>  	  If unsure, say Y.
>  
> +config SERIAL_SPRD
> +	tristate "Support for SPRD serial"
> +	depends on ARM || ARM64
> +	select SERIAL_CORE
> +	help
> +          This enables the driver for the Spreadtrum's serial.
> +
> +config SERIAL_SPRD_NR
> +        int "Maximum number of sprd serial ports"
> +        depends on SERIAL_SPRD
> +        default "4"

This is not used below.

> +
> +config SERIAL_SPRD_CONSOLE
> +        bool "SPRD UART console support"
> +        depends on SERIAL_SPRD=y
> +        select SERIAL_CORE_CONSOLE
> +	select SERIAL_EARLYCON
> +        help
> +	  Support for early debug console using Spreadtrum's 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.

There only appears to be an earlycon driver, and not "standard serial
driver".

What happens after earlycon?

Surely there should be a real driver to take ownership of the UART?

As far as I can see it won't be possible to boot your platform to a
prompt, because earlycon will have gone before that.

Thanks,
Mark.

> +
> +
>  config SERIAL_ATMEL
>  	bool "AT91 / AT32 on-chip serial port support"
>  	depends on ARCH_AT91 || AVR32
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index 0080cc3..b16e0d4 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -92,6 +92,7 @@ obj-$(CONFIG_SERIAL_ARC)	+= arc_uart.o
>  obj-$(CONFIG_SERIAL_RP2)	+= rp2.o
>  obj-$(CONFIG_SERIAL_FSL_LPUART)	+= fsl_lpuart.o
>  obj-$(CONFIG_SERIAL_MEN_Z135)	+= men_z135_uart.o
> +obj-$(CONFIG_SERIAL_SPRD) += sprd-serial.o
>  
>  # GPIOLIB helpers for modem control lines
>  obj-$(CONFIG_SERIAL_MCTRL_GPIO)	+= serial_mctrl_gpio.o
> diff --git a/drivers/tty/serial/sprd-serial.c b/drivers/tty/serial/sprd-serial.c
> new file mode 100644
> index 0000000..9ae594f
> --- /dev/null
> +++ b/drivers/tty/serial/sprd-serial.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (C) 2012 Spreadtrum Communications Inc.
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * 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/kernel.h>
> +#include <linux/console.h>
> +#include <linux/init.h>
> +#include <linux/serial_core.h>
> +#include <linux/of.h>
> +
> +/*offset*/
> +#define UART_TXD	0x0000
> +#define UART_RXD	0x0004
> +#define UART_STS0	0x0008
> +#define UART_STS1	0x000C
> +#define UART_IEN	0x0010
> +#define UART_ICLR	0x0014
> +#define UART_CTL0	0x0018
> +#define UART_CTL1	0x001C
> +#define UART_CTL2	0x0020
> +#define UART_CLKD0	0x0024
> +#define UART_CLKD1	0x0028
> +#define UART_STS2	0x002C
> +
> +/*line status */
> +#define UART_LSR_TX_OVER	(0x1<<15)
> +
> +static void serial_sprd_putc(struct uart_port *port, int c)
> +{
> +	while (!(readl(port->membase + UART_STS0) & UART_LSR_TX_OVER))
> +		;
> +	writeb(c, port->membase + UART_TXD);
> +}
> +
> +static void serial_sprd_early_write(struct console *con, const char *s,
> +				    unsigned n)
> +{
> +	struct earlycon_device *dev = con->data;
> +
> +	uart_console_write(&dev->port, s, n, serial_sprd_putc);
> +}
> +
> +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;
> +}
> +EARLYCON_DECLARE(serial_sprd, serial_sprd_early_console_setup);
> +OF_EARLYCON_DECLARE(serial_sprd, "sprd,serial",
> +		    serial_sprd_early_console_setup);
> -- 
> 1.7.9.5
> 
> 

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

* Re: [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt
  2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
@ 2014-10-17 13:12     ` Mark Rutland
  2014-10-20 13:47     ` Arnd Bergmann
  1 sibling, 0 replies; 20+ messages in thread
From: Mark Rutland @ 2014-10-17 13:12 UTC (permalink / raw)
  To: Chunyan Zhang, Arnd Bergmann
  Cc: Catalin Marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	m-karicheri2, Pawel Moll, artagnon, rrichter, robh+dt,
	Will Deacon, orsonzhai, geng.ren, zhizhou.zhang, devicetree,
	linux-arm-kernel, linux-kernel, sprdlinux

[adding Arnd to Cc, as this was his suggestion]

On Fri, Oct 17, 2014 at 10:54:21AM +0100, Chunyan Zhang wrote:
> The file of-serial.txt was only for 8250 compatible UART implementations,
> so renamed it to 8250.txt to avoid confusing other persons.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>

This makes sense to me, so:

Acked-by: Mark Rutland <mark.rutland@arm.com>

In future please use git format-patch -C -M when moving things around.
It should detect that this is a rename and generate a trivial diff,
rather than featuring every line of the file twice.

Thanks,
Mark.

> ---
>  Documentation/devicetree/bindings/serial/8250.txt  |   50 ++++++++++++++++++++
>  .../devicetree/bindings/serial/of-serial.txt       |   50 --------------------
>  2 files changed, 50 insertions(+), 50 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/serial/8250.txt
>  delete mode 100644 Documentation/devicetree/bindings/serial/of-serial.txt
> 
> diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
> new file mode 100644
> index 0000000..7705477
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/8250.txt
> @@ -0,0 +1,50 @@
> +* UART (Universal Asynchronous Receiver/Transmitter)
> +
> +Required properties:
> +- compatible : one of:
> +	- "ns8250"
> +	- "ns16450"
> +	- "ns16550a"
> +	- "ns16550"
> +	- "ns16750"
> +	- "ns16850"
> +	- "nvidia,tegra20-uart"
> +	- "nxp,lpc3220-uart"
> +	- "ibm,qpace-nwp-serial"
> +	- "altr,16550-FIFO32"
> +	- "altr,16550-FIFO64"
> +	- "altr,16550-FIFO128"
> +	- "serial" if the port type is unknown.
> +- reg : offset and length of the register set for the device.
> +- interrupts : should contain uart interrupt.
> +- clock-frequency : the input clock frequency for the UART
> +	 or
> +  clocks phandle to refer to the clk used as per Documentation/devicetree
> +  /bindings/clock/clock-bindings.txt
> +
> +Optional properties:
> +- current-speed : the current active speed of the UART.
> +- reg-offset : offset to apply to the mapbase from the start of the registers.
> +- reg-shift : quantity to shift the register offsets by.
> +- reg-io-width : the size (in bytes) of the IO accesses that should be
> +  performed on the device.  There are some systems that require 32-bit
> +  accesses to the UART (e.g. TI davinci).
> +- used-by-rtas : set to indicate that the port is in use by the OpenFirmware
> +  RTAS and should not be registered.
> +- no-loopback-test: set to indicate that the port does not implements loopback
> +  test mode
> +- fifo-size: the fifo size of the UART.
> +- auto-flow-control: one way to enable automatic flow control support. The
> +  driver is allowed to detect support for the capability even without this
> +  property.
> +- has-hw-flow-control: the hardware has flow control capability.
> +
> +Example:
> +
> +	uart@80230000 {
> +		compatible = "ns8250";
> +		reg = <0x80230000 0x100>;
> +		clock-frequency = <3686400>;
> +		interrupts = <10>;
> +		reg-shift = <2>;
> +	};
> diff --git a/Documentation/devicetree/bindings/serial/of-serial.txt b/Documentation/devicetree/bindings/serial/of-serial.txt
> deleted file mode 100644
> index 7705477..0000000
> --- a/Documentation/devicetree/bindings/serial/of-serial.txt
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -* UART (Universal Asynchronous Receiver/Transmitter)
> -
> -Required properties:
> -- compatible : one of:
> -	- "ns8250"
> -	- "ns16450"
> -	- "ns16550a"
> -	- "ns16550"
> -	- "ns16750"
> -	- "ns16850"
> -	- "nvidia,tegra20-uart"
> -	- "nxp,lpc3220-uart"
> -	- "ibm,qpace-nwp-serial"
> -	- "altr,16550-FIFO32"
> -	- "altr,16550-FIFO64"
> -	- "altr,16550-FIFO128"
> -	- "serial" if the port type is unknown.
> -- reg : offset and length of the register set for the device.
> -- interrupts : should contain uart interrupt.
> -- clock-frequency : the input clock frequency for the UART
> -	 or
> -  clocks phandle to refer to the clk used as per Documentation/devicetree
> -  /bindings/clock/clock-bindings.txt
> -
> -Optional properties:
> -- current-speed : the current active speed of the UART.
> -- reg-offset : offset to apply to the mapbase from the start of the registers.
> -- reg-shift : quantity to shift the register offsets by.
> -- reg-io-width : the size (in bytes) of the IO accesses that should be
> -  performed on the device.  There are some systems that require 32-bit
> -  accesses to the UART (e.g. TI davinci).
> -- used-by-rtas : set to indicate that the port is in use by the OpenFirmware
> -  RTAS and should not be registered.
> -- no-loopback-test: set to indicate that the port does not implements loopback
> -  test mode
> -- fifo-size: the fifo size of the UART.
> -- auto-flow-control: one way to enable automatic flow control support. The
> -  driver is allowed to detect support for the capability even without this
> -  property.
> -- has-hw-flow-control: the hardware has flow control capability.
> -
> -Example:
> -
> -	uart@80230000 {
> -		compatible = "ns8250";
> -		reg = <0x80230000 0x100>;
> -		clock-frequency = <3686400>;
> -		interrupts = <10>;
> -		reg-shift = <2>;
> -	};
> -- 
> 1.7.9.5
> 
> 

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-17  9:54   ` [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver Chunyan Zhang
  2014-10-17 13:03     ` Mark Rutland
@ 2014-10-18 21:06     ` One Thousand Gnomes
  2014-10-20 10:23       ` Orson Zhai
  1 sibling, 1 reply; 20+ messages in thread
From: One Thousand Gnomes @ 2014-10-18 21:06 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang,
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

On Fri, 17 Oct 2014 17:54:25 +0800
Chunyan Zhang <chunyan.zhang@spreadtrum.com> wrote:

> Add serial driver for spreadtrum sharkl platform with earlycon
> support at first.

> +#define UART_TXD	0x0000
> +#define UART_RXD	0x0004
> +#define UART_STS0	0x0008
> +#define UART_STS1	0x000C
> +#define UART_IEN	0x0010
> +#define UART_ICLR	0x0014
> +#define UART_CTL0	0x0018
> +#define UART_CTL1	0x001C
> +#define UART_CTL2	0x0020
> +#define UART_CLKD0	0x0024
> +#define UART_CLKD1	0x0028
> +#define UART_STS2	0x002C
> +
> +/*line status */
> +#define UART_LSR_TX_OVER	(0x1<<15)

Given we use UART_ for all the 8250 defines it might be better to use
something else - SHARK_LSR_TX_OVER etc to avoid future confusion

> +static void serial_sprd_putc(struct uart_port *port, int c)
> +{
> +	while (!(readl(port->membase + UART_STS0) & UART_LSR_TX_OVER))
> +		;
> +	writeb(c, port->membase + UART_TXD);
> +}
> +
> +static void serial_sprd_early_write(struct console *con, const char *s,
> +				    unsigned n)
> +{
> +	struct earlycon_device *dev = con->data;
> +
> +	uart_console_write(&dev->port, s, n, serial_sprd_putc);
> +}
> +
> +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;
> +}

This seems fine but it would be useful to see both the earlycon and the
main uart/console driver and how they fit together.

Alan

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-17 13:03     ` Mark Rutland
@ 2014-10-20  7:27       ` Lyra Zhang
  2014-10-20 10:32         ` Mark Rutland
  0 siblings, 1 reply; 20+ messages in thread
From: Lyra Zhang @ 2014-10-20  7:27 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Chunyan Zhang, Catalin Marinas, gregkh, ijc+devicetree, jslaby,
	galak, broonie, m-karicheri2, Pawel Moll, artagnon, rrichter,
	robh+dt, Will Deacon, orsonzhai, geng.ren, zhizhou.zhang,
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

2014-10-17 21:03 GMT+08:00 Mark Rutland <mark.rutland@arm.com>:
> On Fri, Oct 17, 2014 at 10:54:25AM +0100, Chunyan Zhang wrote:
>> Add serial driver for spreadtrum sharkl platform with earlycon
>> support at first.
>>
>> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
>> ---
>>  drivers/tty/serial/Kconfig       |   24 ++++++++++++++
>>  drivers/tty/serial/Makefile      |    1 +
>>  drivers/tty/serial/sprd-serial.c |   64 ++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 89 insertions(+)
>>  create mode 100644 drivers/tty/serial/sprd-serial.c
>>
>> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
>> index 26cec64..33b8f90 100644
>> --- a/drivers/tty/serial/Kconfig
>> +++ b/drivers/tty/serial/Kconfig
>> @@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
>>
>>         If unsure, say Y.
>>
>> +config SERIAL_SPRD
>> +     tristate "Support for SPRD serial"
>> +     depends on ARM || ARM64
>> +     select SERIAL_CORE
>> +     help
>> +          This enables the driver for the Spreadtrum's serial.
>> +
>> +config SERIAL_SPRD_NR
>> +        int "Maximum number of sprd serial ports"
>> +        depends on SERIAL_SPRD
>> +        default "4"
>
> This is not used below.
>
Ok, I'll remove it in v3.

>> +
>> +config SERIAL_SPRD_CONSOLE
>> +        bool "SPRD UART console support"
>> +        depends on SERIAL_SPRD=y
>> +        select SERIAL_CORE_CONSOLE
>> +     select SERIAL_EARLYCON
>> +        help
>> +       Support for early debug console using Spreadtrum's 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.
>
> There only appears to be an earlycon driver, and not "standard serial
> driver".
>
> What happens after earlycon?
>
> Surely there should be a real driver to take ownership of the UART?
>
> As far as I can see it won't be possible to boot your platform to a
> prompt, because earlycon will have gone before that.
>
> Thanks,
> Mark.
>

We are planed to add standard serial driver after this patch-set is approved.
In the first patch we contribute to the upstream, I'd like to add
architecture related code of
Spreadtrum's Sharkl, and then we will add more functions about Sharkl3
SoC step by step.

I'm very glad to read your comments, if you have any suggestions, feel
free to tell us.

Thanks,
Chunyan

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-18 21:06     ` One Thousand Gnomes
@ 2014-10-20 10:23       ` Orson Zhai
  2014-10-21 12:26         ` One Thousand Gnomes
  0 siblings, 1 reply; 20+ messages in thread
From: Orson Zhai @ 2014-10-20 10:23 UTC (permalink / raw)
  To: One Thousand Gnomes
  Cc: Chunyan Zhang, Catalin Marinas, gregkh, ijc+devicetree, jslaby,
	Kumar Gala, Mark Brown, Mark Rutland, m-karicheri2, Pawel Moll,
	Ramkumar Ramachandra, rrichter, robh+dt, Will Deacon,
	Geng Ren (任赓),
	Zhizhou Zhang (张治洲),
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

On Sun, Oct 19, 2014 at 5:06 AM, One Thousand Gnomes
<gnomes@lxorguk.ukuu.org.uk> wrote:
> On Fri, 17 Oct 2014 17:54:25 +0800
> Chunyan Zhang <chunyan.zhang@spreadtrum.com> wrote:
>
>> Add serial driver for spreadtrum sharkl platform with earlycon
>> support at first.
>
>> +#define UART_TXD     0x0000
>> +#define UART_RXD     0x0004
>> +#define UART_STS0    0x0008
>> +#define UART_STS1    0x000C
>> +#define UART_IEN     0x0010
>> +#define UART_ICLR    0x0014
>> +#define UART_CTL0    0x0018
>> +#define UART_CTL1    0x001C
>> +#define UART_CTL2    0x0020
>> +#define UART_CLKD0   0x0024
>> +#define UART_CLKD1   0x0028
>> +#define UART_STS2    0x002C
>> +
>> +/*line status */
>> +#define UART_LSR_TX_OVER     (0x1<<15)
>
> Given we use UART_ for all the 8250 defines it might be better to use
> something else - SHARK_LSR_TX_OVER etc to avoid future confusion
>

Does it matter if those macro are only used in the specific c file?
>From my point of  view, private register macro could be treated as
static definitions like static variable or functions in C file.
I also noted that many people use a prefix for the other
manufacturers' macro definition in source file .
I have no intention to break the habit of kernel but just for discussion.


>> +static void serial_sprd_putc(struct uart_port *port, int c)
>> +{
>> +     while (!(readl(port->membase + UART_STS0) & UART_LSR_TX_OVER))
>> +             ;
>> +     writeb(c, port->membase + UART_TXD);
>> +}
>> +
>> +static void serial_sprd_early_write(struct console *con, const char *s,
>> +                                 unsigned n)
>> +{
>> +     struct earlycon_device *dev = con->data;
>> +
>> +     uart_console_write(&dev->port, s, n, serial_sprd_putc);
>> +}
>> +
>> +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;
>> +}
>
> This seems fine but it would be useful to see both the earlycon and the
> main uart/console driver and how they fit together.
>
> Alan

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-20  7:27       ` Lyra Zhang
@ 2014-10-20 10:32         ` Mark Rutland
  2014-10-20 11:15           ` Lyra Zhang
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Rutland @ 2014-10-20 10:32 UTC (permalink / raw)
  To: Lyra Zhang
  Cc: Chunyan Zhang, Catalin Marinas, gregkh, ijc+devicetree, jslaby,
	galak, broonie, m-karicheri2, Pawel Moll, artagnon, rrichter,
	robh+dt, Will Deacon, orsonzhai, geng.ren, zhizhou.zhang,
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

On Mon, Oct 20, 2014 at 08:27:24AM +0100, Lyra Zhang wrote:
> 2014-10-17 21:03 GMT+08:00 Mark Rutland <mark.rutland@arm.com>:
> > On Fri, Oct 17, 2014 at 10:54:25AM +0100, Chunyan Zhang wrote:
> >> Add serial driver for spreadtrum sharkl platform with earlycon
> >> support at first.
> >>
> >> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> >> ---
> >>  drivers/tty/serial/Kconfig       |   24 ++++++++++++++
> >>  drivers/tty/serial/Makefile      |    1 +
> >>  drivers/tty/serial/sprd-serial.c |   64 ++++++++++++++++++++++++++++++++++++++
> >>  3 files changed, 89 insertions(+)
> >>  create mode 100644 drivers/tty/serial/sprd-serial.c
> >>
> >> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> >> index 26cec64..33b8f90 100644
> >> --- a/drivers/tty/serial/Kconfig
> >> +++ b/drivers/tty/serial/Kconfig
> >> @@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
> >>
> >>         If unsure, say Y.
> >>
> >> +config SERIAL_SPRD
> >> +     tristate "Support for SPRD serial"
> >> +     depends on ARM || ARM64
> >> +     select SERIAL_CORE
> >> +     help
> >> +          This enables the driver for the Spreadtrum's serial.
> >> +
> >> +config SERIAL_SPRD_NR
> >> +        int "Maximum number of sprd serial ports"
> >> +        depends on SERIAL_SPRD
> >> +        default "4"
> >
> > This is not used below.
> >
> Ok, I'll remove it in v3.
> 
> >> +
> >> +config SERIAL_SPRD_CONSOLE
> >> +        bool "SPRD UART console support"
> >> +        depends on SERIAL_SPRD=y
> >> +        select SERIAL_CORE_CONSOLE
> >> +     select SERIAL_EARLYCON
> >> +        help
> >> +       Support for early debug console using Spreadtrum's 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.
> >
> > There only appears to be an earlycon driver, and not "standard serial
> > driver".
> >
> > What happens after earlycon?
> >
> > Surely there should be a real driver to take ownership of the UART?
> >
> > As far as I can see it won't be possible to boot your platform to a
> > prompt, because earlycon will have gone before that.
> >
> > Thanks,
> > Mark.
> >
> 
> We are planed to add standard serial driver after this patch-set is approved.
> In the first patch we contribute to the upstream, I'd like to add
> architecture related code of
> Spreadtrum's Sharkl, and then we will add more functions about Sharkl3
> SoC step by step.

The series is simple enough that the only issues I've noticed are minor.
I'm happy with that.

However, the absence of a real UART driver means that this series alone
is not sufficient to boot your platform to a usable state. Given that
the rest of the series is simply plumbing, I think it would make sense
for that to accompany a full UART driver (or perhaps some other I/O like
ethernet) such that it's possible to interact with the platform.

Thanks,
Mark.

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-20 10:32         ` Mark Rutland
@ 2014-10-20 11:15           ` Lyra Zhang
  0 siblings, 0 replies; 20+ messages in thread
From: Lyra Zhang @ 2014-10-20 11:15 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Chunyan Zhang, Catalin Marinas, gregkh, ijc+devicetree, jslaby,
	galak, broonie, m-karicheri2, Pawel Moll, artagnon, rrichter,
	robh+dt, Will Deacon, orsonzhai, geng.ren, zhizhou.zhang,
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

2014-10-20 18:32 GMT+08:00 Mark Rutland <mark.rutland@arm.com>:
> On Mon, Oct 20, 2014 at 08:27:24AM +0100, Lyra Zhang wrote:
>> 2014-10-17 21:03 GMT+08:00 Mark Rutland <mark.rutland@arm.com>:
>> > On Fri, Oct 17, 2014 at 10:54:25AM +0100, Chunyan Zhang wrote:
>> >> Add serial driver for spreadtrum sharkl platform with earlycon
>> >> support at first.
>> >>
>> >> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
>> >> ---
>> >>  drivers/tty/serial/Kconfig       |   24 ++++++++++++++
>> >>  drivers/tty/serial/Makefile      |    1 +
>> >>  drivers/tty/serial/sprd-serial.c |   64 ++++++++++++++++++++++++++++++++++++++
>> >>  3 files changed, 89 insertions(+)
>> >>  create mode 100644 drivers/tty/serial/sprd-serial.c
>> >>
>> >> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
>> >> index 26cec64..33b8f90 100644
>> >> --- a/drivers/tty/serial/Kconfig
>> >> +++ b/drivers/tty/serial/Kconfig
>> >> @@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
>> >>
>> >>         If unsure, say Y.
>> >>
>> >> +config SERIAL_SPRD
>> >> +     tristate "Support for SPRD serial"
>> >> +     depends on ARM || ARM64
>> >> +     select SERIAL_CORE
>> >> +     help
>> >> +          This enables the driver for the Spreadtrum's serial.
>> >> +
>> >> +config SERIAL_SPRD_NR
>> >> +        int "Maximum number of sprd serial ports"
>> >> +        depends on SERIAL_SPRD
>> >> +        default "4"
>> >
>> > This is not used below.
>> >
>> Ok, I'll remove it in v3.
>>
>> >> +
>> >> +config SERIAL_SPRD_CONSOLE
>> >> +        bool "SPRD UART console support"
>> >> +        depends on SERIAL_SPRD=y
>> >> +        select SERIAL_CORE_CONSOLE
>> >> +     select SERIAL_EARLYCON
>> >> +        help
>> >> +       Support for early debug console using Spreadtrum's 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.
>> >
>> > There only appears to be an earlycon driver, and not "standard serial
>> > driver".
>> >
>> > What happens after earlycon?
>> >
>> > Surely there should be a real driver to take ownership of the UART?
>> >
>> > As far as I can see it won't be possible to boot your platform to a
>> > prompt, because earlycon will have gone before that.
>> >
>> > Thanks,
>> > Mark.
>> >
>>
>> We are planed to add standard serial driver after this patch-set is approved.
>> In the first patch we contribute to the upstream, I'd like to add
>> architecture related code of
>> Spreadtrum's Sharkl, and then we will add more functions about Sharkl3
>> SoC step by step.
>
> The series is simple enough that the only issues I've noticed are minor.
> I'm happy with that.
>
> However, the absence of a real UART driver means that this series alone
> is not sufficient to boot your platform to a usable state. Given that
> the rest of the series is simply plumbing, I think it would make sense
> for that to accompany a full UART driver (or perhaps some other I/O like
> ethernet) such that it's possible to interact with the platform.
>
Ok, I see. I'll add a full UART driver in v3.
Thanks for your suggestion.

Best regards,
Chunyan

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

* Re: [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt
  2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
  2014-10-17 13:12     ` Mark Rutland
@ 2014-10-20 13:47     ` Arnd Bergmann
  1 sibling, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2014-10-20 13:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Chunyan Zhang, catalin.marinas, gregkh, ijc+devicetree, jslaby,
	galak, broonie, mark.rutland, m-karicheri2, pawel.moll, artagnon,
	rrichter, robh+dt, will.deacon, orsonzhai, geng.ren,
	zhizhou.zhang, devicetree, linux-kernel, sprdlinux

On Friday 17 October 2014 17:54:21 Chunyan Zhang wrote:
> The file of-serial.txt was only for 8250 compatible UART implementations,
> so renamed it to 8250.txt to avoid confusing other persons.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> ---
>  Documentation/devicetree/bindings/serial/8250.txt  |   50 ++++++++++++++++++++
>  .../devicetree/bindings/serial/of-serial.txt       |   50 --------------------
>  2 files changed, 50 insertions(+), 50 deletions(-)
> 

Patch looks good, but please use 'git format-patch -M' when generating it,
to avoid having the whole add/remove in the patch, for easier review.

	Arnd

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

* Re: [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform
  2014-10-17  9:54   ` [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform Chunyan Zhang
  2014-10-17 12:50     ` Mark Rutland
@ 2014-10-20 13:48     ` Arnd Bergmann
  1 sibling, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2014-10-20 13:48 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Chunyan Zhang, catalin.marinas, gregkh, ijc+devicetree, jslaby,
	galak, broonie, mark.rutland, m-karicheri2, pawel.moll, artagnon,
	rrichter, robh+dt, will.deacon, orsonzhai, geng.ren,
	zhizhou.zhang, devicetree, linux-kernel, sprdlinux

On Friday 17 October 2014 17:54:22 Chunyan Zhang wrote:
> Adds Spreadtrum's prefix "sprd" to vendor-prefixes file.
> Adds the devicetree binding documentation for Spreadtrum's serial
> and Sharkl3 SoC based on the Sharkl Platform which is the 64-bit
> SoC Platform of Spreadtrum.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> 

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support
  2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
                     ` (4 preceding siblings ...)
  2014-10-17  9:54   ` [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver Chunyan Zhang
@ 2014-10-21 11:15   ` Pavel Machek
  5 siblings, 0 replies; 20+ messages in thread
From: Pavel Machek @ 2014-10-21 11:15 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: catalin.marinas, gregkh, ijc+devicetree, jslaby, galak, broonie,
	mark.rutland, m-karicheri2, pawel.moll, artagnon, rrichter,
	robh+dt, will.deacon, orsonzhai, geng.ren, zhizhou.zhang,
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

Hi!

> Sharkl Platform is nominated as a SoC infrastructure that supports 4G/3G/2G
> standards based on ARMv8 multiple core architecture.Now we have only one
> SoC(Sharkl3) based on this Platform in developing.

Does this mean that UMTS/GSM is going to be handled on main CPU on
your platform? Or do you still rely on DSP with specialized OS to
provide UMTS/GSM?

Thanks,
									Pavel

>   Documentation: DT: Renamed of-serial.txt to 8250.txt

Acked-by: Pavel Machek <pavel@ucw.cz>


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-20 10:23       ` Orson Zhai
@ 2014-10-21 12:26         ` One Thousand Gnomes
  2014-10-21 13:34           ` Orson Zhai
  0 siblings, 1 reply; 20+ messages in thread
From: One Thousand Gnomes @ 2014-10-21 12:26 UTC (permalink / raw)
  To: Orson Zhai
  Cc: Chunyan Zhang, Catalin Marinas, gregkh, ijc+devicetree, jslaby,
	Kumar Gala, Mark Brown, Mark Rutland, m-karicheri2, Pawel Moll,
	Ramkumar Ramachandra, rrichter, robh+dt, Will Deacon,
	Geng Ren ( 任赓),
	Zhizhou Zhang ( 张治洲),
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

On Mon, 20 Oct 2014 18:23:38 +0800
Orson Zhai <orsonzhai@gmail.com> wrote:

> On Sun, Oct 19, 2014 at 5:06 AM, One Thousand Gnomes
> <gnomes@lxorguk.ukuu.org.uk> wrote:
> > On Fri, 17 Oct 2014 17:54:25 +0800
> > Chunyan Zhang <chunyan.zhang@spreadtrum.com> wrote:
> >
> >> Add serial driver for spreadtrum sharkl platform with earlycon
> >> support at first.
> >
> >> +#define UART_TXD     0x0000
> >> +#define UART_RXD     0x0004
> >> +#define UART_STS0    0x0008
> >> +#define UART_STS1    0x000C
> >> +#define UART_IEN     0x0010
> >> +#define UART_ICLR    0x0014
> >> +#define UART_CTL0    0x0018
> >> +#define UART_CTL1    0x001C
> >> +#define UART_CTL2    0x0020
> >> +#define UART_CLKD0   0x0024
> >> +#define UART_CLKD1   0x0028
> >> +#define UART_STS2    0x002C
> >> +
> >> +/*line status */
> >> +#define UART_LSR_TX_OVER     (0x1<<15)
> >
> > Given we use UART_ for all the 8250 defines it might be better to use
> > something else - SHARK_LSR_TX_OVER etc to avoid future confusion
> >
> 
> Does it matter if those macro are only used in the specific c file?
> >From my point of  view, private register macro could be treated as
> static definitions like static variable or functions in C file.
> I also noted that many people use a prefix for the other
> manufacturers' macro definition in source file .
> I have no intention to break the habit of kernel but just for discussion.

Your problem is this. In the kernel headers are definitions like

include/uapi/linux/serial_reg.h:#define UART_TX 0	/* Out: Transmit
buffer */

you are adding identical (but conflicting in places) defines. If some
random change in the include files causes serial_reg.h to be included by
a header you include then it will break.

In addition people habitually use tools like LXR to figure out where
defines and functions are. Having these conflicting definitions will
cause confusion. Better they have prefixes.

Alan


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

* Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
  2014-10-21 12:26         ` One Thousand Gnomes
@ 2014-10-21 13:34           ` Orson Zhai
  0 siblings, 0 replies; 20+ messages in thread
From: Orson Zhai @ 2014-10-21 13:34 UTC (permalink / raw)
  To: One Thousand Gnomes
  Cc: Chunyan Zhang, Catalin Marinas, gregkh, ijc+devicetree, jslaby,
	Kumar Gala, Mark Brown, Mark Rutland, m-karicheri2, Pawel Moll,
	Ramkumar Ramachandra, rrichter, robh+dt, Will Deacon,
	Geng Ren ( 任赓),
	Zhizhou Zhang ( 张治洲),
	devicetree, linux-arm-kernel, linux-kernel, sprdlinux

On Tue, Oct 21, 2014 at 8:26 PM, One Thousand Gnomes
<gnomes@lxorguk.ukuu.org.uk> wrote:
> On Mon, 20 Oct 2014 18:23:38 +0800
> Orson Zhai <orsonzhai@gmail.com> wrote:
>
>> On Sun, Oct 19, 2014 at 5:06 AM, One Thousand Gnomes
>> <gnomes@lxorguk.ukuu.org.uk> wrote:
>> > On Fri, 17 Oct 2014 17:54:25 +0800
>> > Chunyan Zhang <chunyan.zhang@spreadtrum.com> wrote:
>> >
>> >> Add serial driver for spreadtrum sharkl platform with earlycon
>> >> support at first.
>> >
>> >> +#define UART_TXD     0x0000
>> >> +#define UART_RXD     0x0004
>> >> +#define UART_STS0    0x0008
>> >> +#define UART_STS1    0x000C
>> >> +#define UART_IEN     0x0010
>> >> +#define UART_ICLR    0x0014
>> >> +#define UART_CTL0    0x0018
>> >> +#define UART_CTL1    0x001C
>> >> +#define UART_CTL2    0x0020
>> >> +#define UART_CLKD0   0x0024
>> >> +#define UART_CLKD1   0x0028
>> >> +#define UART_STS2    0x002C
>> >> +
>> >> +/*line status */
>> >> +#define UART_LSR_TX_OVER     (0x1<<15)
>> >
>> > Given we use UART_ for all the 8250 defines it might be better to use
>> > something else - SHARK_LSR_TX_OVER etc to avoid future confusion
>> >
>>
>> Does it matter if those macro are only used in the specific c file?
>> >From my point of  view, private register macro could be treated as
>> static definitions like static variable or functions in C file.
>> I also noted that many people use a prefix for the other
>> manufacturers' macro definition in source file .
>> I have no intention to break the habit of kernel but just for discussion.
>
> Your problem is this. In the kernel headers are definitions like
>
> include/uapi/linux/serial_reg.h:#define UART_TX 0       /* Out: Transmit
> buffer */
>
> you are adding identical (but conflicting in places) defines. If some
> random change in the include files causes serial_reg.h to be included by
> a header you include then it will break.
>
> In addition people habitually use tools like LXR to figure out where
> defines and functions are.

This make much more sense, thanks for you explanation.

> Having these conflicting definitions will
> cause confusion. Better they have prefixes.
>
> Alan
>

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

end of thread, other threads:[~2014-10-21 13:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <sprd-1017-v2>
2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
2014-10-17 13:12     ` Mark Rutland
2014-10-20 13:47     ` Arnd Bergmann
2014-10-17  9:54   ` [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform Chunyan Zhang
2014-10-17 12:50     ` Mark Rutland
2014-10-20 13:48     ` Arnd Bergmann
2014-10-17  9:54   ` [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile Chunyan Zhang
2014-10-17 13:00     ` Mark Rutland
2014-10-17  9:54   ` [PATCH v2 4/5] arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig Chunyan Zhang
2014-10-17  9:54   ` [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver Chunyan Zhang
2014-10-17 13:03     ` Mark Rutland
2014-10-20  7:27       ` Lyra Zhang
2014-10-20 10:32         ` Mark Rutland
2014-10-20 11:15           ` Lyra Zhang
2014-10-18 21:06     ` One Thousand Gnomes
2014-10-20 10:23       ` Orson Zhai
2014-10-21 12:26         ` One Thousand Gnomes
2014-10-21 13:34           ` Orson Zhai
2014-10-21 11:15   ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Pavel Machek

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).