Skip to contentSkip to conversation

Add Spreadtrum Sharkl Platform support

PATCH Superseded Chunyan Zhang 7 participants 20 messages Oct 17, 2014 – Oct 21, 2014 1 message not in the archive

Subsystems (5)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): sprd-1017-v2

#1 lore raw

v2 cover Add Spreadtrum Sharkl Platform support

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
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/5 Documentation: DT: Renamed of-serial.txt to 8250.txt

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

---
 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
Documentation/devicetree/bindings/serial/8250.txt new file +50 -0
new file mode 100644
index 0000000..7705477
@@ -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 at 80230000 {
+		compatible = "ns8250";
+		reg = <0x80230000 0x100>;
+		clock-frequency = <3686400>;
+		interrupts = <10>;
+		reg-shift = <2>;
+	};
Documentation/devicetree/bindings/serial/of-serial.txt deleted +0 -50

50 lines not on this page · raw message

Signature · 1 line
1.7.9.5
reviewer Acked-by on v2 1/5
#3 lore raw

Re: [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt

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

Quoted 4 lines · Chunyan Zhang

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

This makes sense to me, so:

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.

Quoted 123 lines
---
 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
Documentation/devicetree/bindings/serial/8250.txt new file +50 -0
new file mode 100644
index 0000000..7705477
@@ -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 at 80230000 {
+		compatible = "ns8250";
+		reg = <0x80230000 0x100>;
+		clock-frequency = <3686400>;
+		interrupts = <10>;
+		reg-shift = <2>;
+	};
Documentation/devicetree/bindings/serial/of-serial.txt deleted +0 -50
deleted file mode 100644
index 7705477..0000000
@@ -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 at 80230000 {
-		compatible = "ns8250";
-		reg = <0x80230000 0x100>;
-		clock-frequency = <3686400>;
-		interrupts = <10>;
-		reg-shift = <2>;
-	};
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

Re: [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt

In reply to Chunyan Zhang
Quoted 9 lines · 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.

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

#5 lore raw

PATCH v2 2/5 Documentation: DT: Add bindings for Spreadtrum Sharkl Platform

In reply to Chunyan Zhang

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.

---
 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
Documentation/devicetree/bindings/arm/sprd.txt new file +11 -0
new file mode 100644
index 0000000..40b40d6
@@ -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";
Documentation/devicetree/bindings/serial/sprd-serial.txt new file +6 -0
new file mode 100644
index 0000000..c97b0a6
@@ -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
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index ac7269f..5dbf7db 100644
@@ -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
Signature · 1 line
1.7.9.5
reviewer
#6 lore raw

Re: [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform

Quoted 37 lines · Chunyan Zhang

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.

---
 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
Documentation/devicetree/bindings/arm/sprd.txt new file +11 -0
new file mode 100644
index 0000000..40b40d6
@@ -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";
Documentation/devicetree/bindings/serial/sprd-serial.txt new file +0 -0
new file mode 100644
index 0000000..c97b0a6

Documentation/devicetree/bindings/serial/sprd-serial.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/serial/sprd-serial.txt new file +6 -0
@@ -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?

Documentation/devicetree/bindings/vendor-prefixes.txt smsc Standard Microsystems Corporation · line 135

Quoted 12 lines
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index ac7269f..5dbf7db 100644
@@ -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.

maintainer Acked-by on v2 2/5
#7 lore raw

Re: [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform

In reply to Chunyan Zhang
Quoted 7 lines · 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.

#8 lore raw

PATCH v2 3/5 arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile.

In reply to Chunyan Zhang

From: Zhizhou Zhang <[email protected]>

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.

---
 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
arch/arm64/boot/dts/Makefile +1 -0
index c52bdb0..0030e44 100644
@@ -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
 
arch/arm64/boot/dts/sprd-sharkl.dtsi new file +33 -0
new file mode 100644
index 0000000..26a28c3
@@ -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 at 70000000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70000000 0 0x100>;
+		interrupts = <0 2 0xf04>;
+		status = "disabled";
+	};
+
+	uart1: serial at 70100000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70100000 0 0x100>;
+		interrupts = <0 3 0xf04>;
+		status = "disabled";
+	};
+};
arch/arm64/boot/dts/sprd-sharkl3-fpga.dts new file +41 -0

41 lines not on this page · raw message

arch/arm64/boot/dts/sprd-sharkl3.dtsi new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
1.7.9.5
reviewer
#9 lore raw

Re: [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile.

Quoted 81 lines · Chunyan Zhang

From: Zhizhou Zhang <[email protected]>

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.

---
 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
arch/arm64/boot/dts/Makefile +1 -0
index c52bdb0..0030e44 100644
@@ -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
 
arch/arm64/boot/dts/sprd-sharkl.dtsi new file +33 -0
new file mode 100644
index 0000000..26a28c3
@@ -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 at 70000000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70000000 0 0x100>;
+		interrupts = <0 2 0xf04>;
+		status = "disabled";
+	};
+
+	uart1: serial at 70100000 {
+		compatible = "sprd,serial";
+		reg = <0 0x70100000 0 0x100>;
+		interrupts = <0 3 0xf04>;
+		status = "disabled";
+	};
+};
arch/arm64/boot/dts/sprd-sharkl3-fpga.dts new file +8 -0
new file mode 100644
index 0000000..faa0a2e
@@ -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

arch/arm64/boot/dts/sprd-sharkl3-fpga.dts line 18

Quoted 10 lines
arch/arm64/boot/dts/sprd-sharkl3-fpga.dts new file +10 -0
+ * 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?

Quoted 44 lines
arch/arm64/boot/dts/sprd-sharkl3-fpga.dts new file +23 -0
+
+	compatible = "sprd,sharkl3-fpga", "sprd,sharkl3";
+
+	aliases {
+	};
+
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0 0x80000000 0 0x20000000>;
+	};
+
+	chosen {
+		stdout-path = &uart0;
+	};
+
+	uart0: serial at 70000000 {
+		status = "okay";
+	};
+
+	uart1: serial at 70100000 {
+		status = "okay";
+	};
+};
arch/arm64/boot/dts/sprd-sharkl3.dtsi new file +15 -0
new file mode 100644
index 0000000..0ab4a94
@@ -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";

arch/arm64/boot/dts/sprd-sharkl3.dtsi line 25

Quoted 10 lines
arch/arm64/boot/dts/sprd-sharkl3.dtsi new file +10 -0
+
+	gic: interrupt-controller at 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?

arch/arm64/boot/dts/sprd-sharkl3.dtsi line 33

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

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

Quoted 17 lines
arch/arm64/boot/dts/sprd-sharkl3.dtsi new file +17 -0
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+		};
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+		};
+		cpu at 3 {
+			device_type = "cpu";

arch/arm64/boot/dts/sprd-sharkl3.dtsi line 60

Quoted 10 lines
arch/arm64/boot/dts/sprd-sharkl3.dtsi new file +10 -0
+			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?

arch/arm64/boot/dts/sprd-sharkl3.dtsi line 68

Quoted 7 lines
arch/arm64/boot/dts/sprd-sharkl3.dtsi new file +7 -0
+	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.

#10 lore raw

PATCH v2 4/5 arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig

In reply to Chunyan Zhang

From: Zhizhou Zhang <[email protected]>

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

---
 arch/arm64/Kconfig           |    6 ++++++
 arch/arm64/configs/defconfig |    1 +
 2 files changed, 7 insertions(+)
arch/arm64/Kconfig +6 -0
index fd4e81a..eac2e2c 100644
@@ -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
arch/arm64/configs/defconfig +1 -0
index d92ef3c..c62ff98 100644
@@ -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
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH v2 5/5 tty/serial: Add earlycon support for Spreadtrum serial driver

In reply to Chunyan Zhang

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

---
 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
drivers/tty/serial/Kconfig +24 -0
index 26cec64..33b8f90 100644
@@ -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
drivers/tty/serial/Makefile +1 -0
index 0080cc3..b16e0d4 100644
@@ -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
drivers/tty/serial/sprd-serial.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.7.9.5
reviewer
#12 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

Quoted 20 lines · Chunyan Zhang

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

---
 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
drivers/tty/serial/Kconfig +1 -0
index 26cec64..33b8f90 100644
@@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
 
 	  If unsure, say Y.
 
+config SERIAL_SPRD

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 126

Quoted 10 lines
drivers/tty/serial/Kconfig +10 -0
+	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.

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 137

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+
+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.

Quoted 91 lines
drivers/tty/serial/Kconfig +2 -0
+
+
 config SERIAL_ATMEL
 	bool "AT91 / AT32 on-chip serial port support"
 	depends on ARCH_AT91 || AVR32
drivers/tty/serial/Makefile +1 -0
index 0080cc3..b16e0d4 100644
@@ -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
drivers/tty/serial/sprd-serial.c new file +64 -0
new file mode 100644
index 0000000..9ae594f
@@ -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);
Signature · 1 line
1.7.9.5
reviewer
#13 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

2014-10-17 21:03 GMT+08:00 Mark Rutland <[email protected]>:

Quoted 20 lines · Chunyan Zhang
Quoted 19 lines

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

---
 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
drivers/tty/serial/Kconfig +0 -0
index 26cec64..33b8f90 100644
@@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
 
        If unsure, say Y.
 
Quoted 14 lines

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 126

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+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.

Quoted 17 lines

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 137

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+
+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?

Quoted 8 lines

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

reviewer
#14 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

Quoted 63 lines · Lyra Zhang

2014-10-17 21:03 GMT+08:00 Mark Rutland <[email protected]>:

Quoted 20 lines · Chunyan Zhang
Quoted 19 lines

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

---
 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
drivers/tty/serial/Kconfig +0 -0
index 26cec64..33b8f90 100644
@@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
 
        If unsure, say Y.
 
Quoted 14 lines

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 126

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+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.

Quoted 17 lines

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 137

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+
+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?

Quoted 8 lines

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.

Quoted 5 lines

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.

reviewer
#15 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

2014-10-20 18:32 GMT+08:00 Mark Rutland <[email protected]>:

Quoted 70 lines · Lyra Zhang
Quoted 63 lines

2014-10-17 21:03 GMT+08:00 Mark Rutland <[email protected]>:

Quoted 20 lines · Chunyan Zhang
Quoted 19 lines

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

---
 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
drivers/tty/serial/Kconfig +0 -0
index 26cec64..33b8f90 100644
@@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
 
        If unsure, say Y.
 
Quoted 14 lines

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 126

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+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.

Quoted 17 lines

drivers/tty/serial/Kconfig config SERIAL_SB1250_DUART_CONSOLE · line 137

Quoted 11 lines
drivers/tty/serial/Kconfig +11 -0
+
+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?

Quoted 8 lines

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.

Quoted 5 lines

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.

Quoted 9 lines

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

#16 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

In reply to Chunyan Zhang
Quoted 8 lines · On Fri, 17 Oct 2014 17:54:25 +0800 Chunyan Zhang…

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

drivers/tty/serial/sprd-serial.c new file +5 -0
+#define UART_TXD	0x0000
+#define UART_RXD	0x0004
+#define UART_STS0	0x0008
+#define UART_STS1	0x000C
+#define UART_IEN	0x0010

drivers/tty/serial/sprd-serial.c line 35

Quoted 10 lines
drivers/tty/serial/sprd-serial.c new file +10 -0
+#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

Quoted 15 lines
drivers/tty/serial/sprd-serial.c new file +15 -0
+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);
+}
+

drivers/tty/serial/sprd-serial.c line 61

Quoted 10 lines
drivers/tty/serial/sprd-serial.c new file +10 -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;
+}

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

maintainer
#17 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

Quoted 16 lines · One Thousand Gnomes
Quoted 13 lines · On Fri, 17 Oct 2014 17:54:25 +0800 Chunyan Zhang…

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

drivers/tty/serial/sprd-serial.c new file +10 -0
+#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
Quoted 9 lines

drivers/tty/serial/sprd-serial.c line 35

Quoted 5 lines
drivers/tty/serial/sprd-serial.c new file +5 -0
+#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?

Quoted 1 line

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.

Quoted 30 lines
Quoted 15 lines
drivers/tty/serial/sprd-serial.c new file +15 -0
+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);
+}
+

drivers/tty/serial/sprd-serial.c line 61

Quoted 10 lines
drivers/tty/serial/sprd-serial.c new file +10 -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;
+}

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

#18 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

Quoted 28 lines · On Mon, 20 Oct 2014 18:23:38 +0800 Orson Zhai <[email protected]> wrote:
Quoted 16 lines · One Thousand Gnomes
Quoted 13 lines · On Fri, 17 Oct 2014 17:54:25 +0800 Chunyan Zhang…

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

drivers/tty/serial/sprd-serial.c new file +10 -0
+#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
Quoted 9 lines

drivers/tty/serial/sprd-serial.c line 35

Quoted 5 lines
drivers/tty/serial/sprd-serial.c new file +5 -0
+#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

Quoted 6 lines

Does it matter if those macro are only used in the specific c file?

Quoted 1 line

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

maintainer
#19 lore raw

Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver

Quoted 43 lines · One Thousand Gnomes
Quoted 28 lines · On Mon, 20 Oct 2014 18:23:38 +0800 Orson Zhai <[email protected]> wrote:
Quoted 16 lines · One Thousand Gnomes
Quoted 13 lines · On Fri, 17 Oct 2014 17:54:25 +0800 Chunyan Zhang…

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

drivers/tty/serial/sprd-serial.c new file +10 -0
+#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
Quoted 9 lines

drivers/tty/serial/sprd-serial.c line 35

Quoted 5 lines
drivers/tty/serial/sprd-serial.c new file +5 -0
+#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

Quoted 6 lines

Does it matter if those macro are only used in the specific c file?

Quoted 1 line

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 */

Quoted 6 lines

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.

Quoted 5 lines

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

Alan

Acked-by on the v2 series
#20 lore raw
In reply to Chunyan Zhang

Hi!

Quoted 3 lines

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

Quoted 1 line

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

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