Skip to contentSkip to conversation

ARM: Add support for Cortina Systems CS75xx and Securifi Almond+

PATCH Superseded Fil Dunsky 2 participants 14 messages Nov 21

Subsystems (5)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Fil Dunsky

author
#0 lore raw

v8 cover ARM: Add support for Cortina Systems CS75xx and Securifi Almond+

This series adds initial support for the Cortina Systems CS75xx ("Goldengate G2") network processors and the first board using one, the Securifi Almond+ touchscreen Wi-Fi router (CS7542, 2x Cortex-A9 r2p1, PL310 r3p1, 512 MiB DDR3, 512 MiB NAND).

There is no public documentation for the SoC. The register information comes from the GPL vendor kernels (Linux 2.6.36 for the Almond+, Linux 4.9 for the Verizon FiOS G1100 which uses the same SoC) and from disassembly of the stock U-Boot 2009.11. A full out-of-tree port (clock, irqchip, GPIO, I2C, RTC, NAND, PCIe, MDIO and the packet engine) runs on Linux 6.18 in OpenWrt; this series is the first, minimal step to get the platform into mainline:

- bindings: vendor prefix, SoC/board compatibles, an SMP enable method and the UART,
- the platform Kconfig and SMP bring-up (the generic DT machine is used, there is no DT_MACHINE_START),
- DEBUG_LL for UART0,
- a UART driver with console and earlycon support,
- SoC dtsi and board dts describing the CPUs, GIC, SCU, timers, L2, UARTs and memory,
- multi_v7_defconfig and MAINTAINERS updates.

The serial binding and driver (patches 6-7) are meant to go through the soc tree together with the rest of the series rather than through the tty tree, with an Ack from the tty maintainers.

Testing: component builds from multi_v7_defconfig with GCC 14 and Clang 21, W=1 (UART built-in and module, SMP code, plus DEBUG_LL and the board DTB with GCC), and dt_binding_check/dtbs_check. On a Securifi Almond+ this series boots v7.4-rc1 to an initramfs shell with both CPUs online ("smp: Brought up 1 node, 2 CPUs"; IPIs and the TWD timer tick on both cores); the L2C-310, the global and TWD timers and the UART driver (ttyCS0) come up. The kernel was started from a running OpenWrt system with a small kexec-style loader rather than from the stock U-Boot, because U-Boot enters the kernel with the MMU on (see 1 below). The same patches on Linux 6.18 in OpenWrt, with the head.S workaround from 1, also boot from NAND through the stock U-Boot; that is how the secondary CPU wake-up fix in v4 was found.

The boot watchdog and restart support are handled by the separate ARM
TWD watchdog driver, using CPU0 as the system watchdog. Guenter Roeck
has applied v9 to his watchdog-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=52d91ea73e05c349669fe5c87a09df9476bbbf55
That driver is not included here and has not yet reached the current linux-next or mainline snapshot. The stock bootloader leaves the watchdog armed, so without that driver enabled
this minimal platform series still resets after roughly five minutes
and has no restart handler. For normal operation it should be integrated with that driver and CONFIG_ARM_TWD_WATCHDOG enabled.

The UART source in this version is identical to the one used in the latest RAM tests on 21 November, in a combined platform/peripheral test tree on v7.4-rc1. Those tests brought up two CPUs and ttyCS0 with PROVE_LOCKING and returned to OpenWrt after watchdog expiry and restart. They are additional evidence for the platform and UART path, not tests of direct stock U-Boot entry or of system suspend.

AI assistance: coding assistants were used to develop and revise this series. Codex performed the current preflight checks and cover update.

Open questions:

1. The same U-Boot enters the kernel with the MMU and data cache enabled (identity map with XN set, dirty lines left in the D-cache), which breaks the decompressor. The OpenWrt port carries a small workaround at the start of arch/arm/boot/compressed/head.S that cleans the cache and turns the MMU off. It is not part of this series. Replacing the bootloader is possible but risky for users of this (discontinued) device. Would a quirk of that kind be acceptable in head.S at all, or should this be solved outside the kernel (e.g. a chain-loaded bootloader)? For the tests below the kernel was started from a running Linux with the MMU off, so this was not an issue.

2. The APB clock is 100, 150 or 170 MHz depending on the boot strap pins. It is modelled as a fixed-clock with the rate set in the board dts. A clock driver for the global control block, which also contains the strap, pinmux and reset registers, will follow and replace it.

3. The Cortex-A9 r2p1 is also affected by errata 742230, 742231, 743622 and 751472, whose workarounds are not available on multiplatform kernels because they are expected to be applied by the bootloader. The stock U-Boot does not apply them. Is there a preferred way to deal with this?

4. The UART ports are named ttyCS to avoid clashing with the 8250 driver in multi_v7_defconfig, and PORT_GENERIC is used instead of a new port type. The FIFO depth is not documented; the driver assumes 16.

5. The top 64 MiB of RAM are reserved: the vendor firmware gives them to the packet engine queue manager and the stock kernel is booted with mem=448M. The reservation will be referenced by the network driver later; I kept it now so that the memory is not handed out and later claimed.

Planned follow-ups, as separate series: the peripheral interrupt controller, GPIO and I2C drivers (posted separately, one series per subsystem, with their device tree nodes to follow once this series is merged), the global control block/clock, RTC, NAND,
PCIe (DesignWare glue), MDIO, the Ethernet/packet engine and a fix for the SX8650 touchscreen.

---
Changes in v8:
- collect Linus Walleij's Reviewed-by for the platform/SMP patch
- update watchdog status: v9 is applied in Guenter's watchdog-next;
the driver uses CPU0 and remains a separate runtime prerequisite
- serial: drop SysRq, which needs uart_handle_break() while the UART does not report a break; only run the RX and TX paths for the
enabled causes that are pending and return IRQ_NONE otherwise; drop a stale TX empty event before enabling it (sashiko-bot)
- Link to v7: https://patch.msgid.link/[email protected]

Changes in v7:
- rebase on v7.4-rc1
- cpus binding: the boot loader parks the secondary core in a WFI loop that polls the release register, not in a WFE loop
- goldengate: drop Linus' Reviewed-by, the patch changed in v4 and v5 (wakeup IPI for the secondary core, PL310 erratum 769419); Linus, could you have another look?
- board dts: drop the ramoops region, it is only useful for development
- cover: the serial patches go with the rest of the series, not through the tty tree on their own (Krzysztof)
- move Signed-off-by after the other trailers
- collect Reviewed-by tags
- Link to v6: https://patch.msgid.link/[email protected]

Changes in v6:
- serial: also ignore overruns when CREAD is cleared, everything received is dropped then (sashiko-bot)
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- goldengate: select PL310_ERRATA_769419, the PL310 is r3p1-50rel0 (CACHE_ID 0x410000c7), not r3p2 as v4 said; fix the revision in the commit message and here
- serial: scale the TX FIFO wait in putchar with the frame time, 10 ms is shorter than one character below 1200 baud (sashiko-bot)
- serial: no change for the other two sashiko-bot points on v4:
uart_port_tx() checks tx_ready before it sends x_char, and SysRq is reachable through MAGIC_SYSRQ_SERIAL_SEQUENCE; the UART has no break indication that the driver could use
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- serial: use guard()/scoped_guard() for the port lock and the port table mutex (Jiri Slaby)
- serial: honour INPCK/IGNPAR: report parity and framing errors with TTY_PARITY/TTY_FRAME and insert the overrun marker after the characters still in the FIFO (sashiko-bot)
- goldengate: also send a wakeup IPI to the secondary core: the stock U-Boot parks it in WFI, SEV alone only worked when it was parked by another kernel (found booting from NAND instead of from RAM); the change is small, I kept Linus' Reviewed-by
- drop the RFC prefix
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- serial: do not put the console setup callback in .init.text, it is called from a probe that may be deferred past boot (sashiko-bot)
- collect Reviewed-by tags
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- serial: drop the empty break_ctl, request_port and release_port callbacks, comment why set_mctrl stays, add a copyright line (Greg)
- serial: take the port lock around all IE accesses in startup, flush stale RX data on startup and disable the receiver on shutdown
- serial: bound the RX loop per interrupt, check RXDAT_VALID in poll_get_char, scale the console TX drain timeout with the frame time
- serial: serialise port index allocation, reject too low clock rates
- serial: name the driver after the vendor (cortina-uart.c, SERIAL_CORTINA), as the same block is used in the Cortina Access SoCs (Linus Walleij, Arnd Bergmann); the binding and the help text name the Cortina Systems CS75xx and Cortina Access parts (Jason Li)
- serial binding: describe the CS7542 only; other SoCs get their own compatible with "cortina,cs7542-uart" as fallback (Conor Dooley)
- debug: keep the character register intact on BE8 in senduart
- platform: move arch/arm/mach-cortina to arch/arm/mach-goldengate, as mach-gemini is a Cortina SoC too, and use one ARCH_CORTINA_ACCESS symbol for the whole family, as for the 64-bit Cortina Access parts, with the rationale in the commit message (Linus Walleij, Krzysztof Kozlowski, Arnd Bergmann); mach-goldengate vs. mach-cortina is still open, I am happy to rename the directory if mach-cortina is preferred
- collect Reviewed-by and Acked-by tags
- Link to v1: https://patch.msgid.link/[email protected]

---
Fil Dunsky (10):
dt-bindings: vendor-prefixes: Add Securifi
dt-bindings: arm: Add Cortina Systems CS7542 and Securifi Almond+
dt-bindings: arm: cpus: Add Cortina Systems CS7542 enable method
ARM: goldengate: Add support for the CS75xx SoC family
ARM: debug: Add Cortina Systems CS75xx UART0 support
dt-bindings: serial: Add Cortina Systems CS7542 UART
tty: serial: Add Cortina UART driver
ARM: dts: cortina: Add CS7542 SoC and Securifi Almond+ board
ARM: multi_v7_defconfig: Enable Cortina Systems CS75xx support
MAINTAINERS: Add entry for Cortina Systems CS75xx

 Documentation/devicetree/bindings/arm/cortina.yaml |  31 ++
 Documentation/devicetree/bindings/arm/cpus.yaml    |   2 +
 .../bindings/serial/cortina,cs7542-uart.yaml       |  52 ++
 .../devicetree/bindings/vendor-prefixes.yaml       |   2 +
 MAINTAINERS                                        |  11 +
 arch/arm/Kconfig                                   |   2 +
 arch/arm/Kconfig.debug                             |  16 +-
 arch/arm/Makefile                                  |   1 +
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/cortina/Makefile                 |   3 +
 .../dts/cortina/cs7542-securifi-almondplus.dts     |  46 ++
 arch/arm/boot/dts/cortina/cs7542.dtsi              | 127 +++++
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/include/debug/cs75xx.S                    |  37 ++
 arch/arm/mach-goldengate/Kconfig                   |  19 +
 arch/arm/mach-goldengate/Makefile                  |   2 +
 arch/arm/mach-goldengate/platsmp.c                 |  72 +++
 drivers/tty/serial/Kconfig                         |  24 +
 drivers/tty/serial/Makefile                        |   1 +
 drivers/tty/serial/cortina-uart.c                  | 612 +++++++++++++++++++++
 20 files changed, 1062 insertions(+), 2 deletions(-)

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260930-b4-cs75xx-033a2c047508

Best regards,

Signature · 1 line
Fil Dunsky <[email protected]>
author
#1 lore raw

PATCH v8 1/10 dt-bindings: vendor-prefixes: Add Securifi

Securifi Ltd. makes the Almond series of touchscreen Wi-Fi routers. Add a vendor prefix for it.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 5471a06f9..f1f764ddb 100644
@@ -1499,6 +1499,8 @@ patternProperties:
     description: SDMC Technology Co., Ltd
   "^seagate,.*":
     description: Seagate Technology PLC
+  "^securifi,.*":
+    description: Securifi Ltd.
   "^seeed,.*":
     description: Seeed Technology Co., Ltd
   "^seirobotics,.*":
Signature · 1 line
2.53.0
author
#2 lore raw

PATCH v8 2/10 dt-bindings: arm: Add Cortina Systems CS7542 and Securifi Almond+

In reply to Fil Dunsky

Add the top-level binding for boards built around the Cortina Systems CS7542 ("Goldengate G2") network processor, a dual Cortex-A9 SoC, and the first such board, the Securifi Almond+ touchscreen router.

---
 Documentation/devicetree/bindings/arm/cortina.yaml | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
Documentation/devicetree/bindings/arm/cortina.yaml new file +31 -0
new file mode 100644
index 000000000..1c04b1781
@@ -0,0 +1,31 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/cortina.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cortina Systems CS75xx platforms
+
+maintainers:
+  - Fil Dunsky <[email protected]>
+
+description:
+  The CS75xx ("Goldengate G2") family are network processors from Cortina
+  Systems. The CS7542 has two Cortex-A9 cores with an SCU, GIC, private
+  timers and a PL310 L2 cache controller, a packet processing engine, three
+  PCIe root ports, a NAND flash controller and low speed peripherals.
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: CS7542 based boards
+        items:
+          - enum:
+              - securifi,almondplus
+          - const: cortina,cs7542
+
+additionalProperties: true
+
+...
Signature · 1 line
2.53.0
author
#3 lore raw

PATCH v8 3/10 dt-bindings: arm: cpus: Add Cortina Systems CS7542 enable method

In reply to Fil Dunsky

On the CS7542 the bootloader parks the secondary Cortex-A9 core in a WFI loop that polls a global software register and jumps to the address found there. Add the "cortina,cs7542-smp" enable method for it and, as with the other release-address based methods, require cpu-release-addr to point at that register.

---
 Documentation/devicetree/bindings/arm/cpus.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/arm/cpus.yaml +2 -0
index 96136b70d..7a394c500 100644
@@ -269,6 +269,7 @@ properties:
           - brcm,bcm63138
           - brcm,bcm-nsp-smp
           - brcm,brahma-b15
+          - cortina,cs7542-smp
           - marvell,armada-375-smp
           - marvell,armada-380-smp
           - marvell,armada-390-smp
@@ -484,6 +485,7 @@ allOf:
         enable-method:
           enum:
             - spin-table
+            - cortina,cs7542-smp
             - renesas,r9a06g032-smp
       required:
         - enable-method
Signature · 1 line
2.53.0
author
#4 lore raw

PATCH v8 4/10 ARM: goldengate: Add support for the CS75xx SoC family

In reply to Fil Dunsky

The Cortina Systems CS75xx ("Goldengate G2") are network processors with two Cortex-A9 cores, an SCU, GIC, the Cortex-A9 global and private timers and a PL310 L2 cache controller. The family includes at least the CS7522 and the CS7542; the CS7542 is used, among others, in the Securifi Almond+ router.

Apart from the vendor this has little in common with the Cortina Systems Gemini (SL3516/CS3516) supported by mach-gemini: Gemini is a single ARMv4 FA526 with Faraday peripherals (FTINTC010, FTTMR010, FTGPIO010, a 16550 UART) built for ARCH_MULTI_V4, while the CS75xx is an ARMv7 MPCore whose UART, GPIO, interrupt controller and NAND controller are different blocks. It therefore gets its own directory, named after the Goldengate codename like in the vendor kernel. The Kconfig symbol, ARCH_CORTINA_ACCESS, covers the whole family and is named after Cortina Access, which last sold these chips and also makes the newer 64-bit parts.

The generic DT machine is sufficient for the platform, so only the SMP bring-up needs code: the bootloader parks the secondary core in a WFI loop that polls a global software register, so boot it by writing the physical address of secondary_startup to the register named by the cpu-release-addr property and sending it a wakeup IPI.

The CPU is a Cortex-A9 r2p1, so select the errata workarounds that apply to that revision and can be enabled on a multiplatform kernel. The PL310 is r3p1-50rel0 (CACHE_ID 0x410000c7), select the workaround for its erratum 769419 as well.

---
 arch/arm/Kconfig                   |  2 ++
 arch/arm/Makefile                  |  1 +
 arch/arm/mach-goldengate/Kconfig   | 19 ++++++++++
 arch/arm/mach-goldengate/Makefile  |  2 ++
 arch/arm/mach-goldengate/platsmp.c | 72 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 96 insertions(+)
arch/arm/Kconfig +2 -0
index 0cc289a71..87ff65256 100644
@@ -391,6 +391,8 @@ source "arch/arm/mach-footbridge/Kconfig"
 
 source "arch/arm/mach-gemini/Kconfig"
 
+source "arch/arm/mach-goldengate/Kconfig"
+
 source "arch/arm/mach-highbank/Kconfig"
 
 source "arch/arm/mach-hisi/Kconfig"
arch/arm/Makefile +1 -0
index 573813ef5..21d7a443c 100644
@@ -187,6 +187,7 @@ machine-$(CONFIG_ARCH_DOVE)		+= dove
 machine-$(CONFIG_ARCH_EXYNOS)		+= exynos
 machine-$(CONFIG_ARCH_FOOTBRIDGE)	+= footbridge
 machine-$(CONFIG_ARCH_GEMINI)		+= gemini
+machine-$(CONFIG_ARCH_CORTINA_ACCESS)	+= goldengate
 machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
 machine-$(CONFIG_ARCH_HISI)		+= hisi
 machine-$(CONFIG_ARCH_IXP4XX)		+= ixp4xx
arch/arm/mach-goldengate/Kconfig new file +19 -0
new file mode 100644
index 000000000..302e24841
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config ARCH_CORTINA_ACCESS
+	bool "Cortina Systems CS75xx (Goldengate G2)"
+	depends on ARCH_MULTI_V7
+	select ARM_ERRATA_754322
+	select ARM_ERRATA_764369 if SMP
+	select ARM_GIC
+	select ARM_GLOBAL_TIMER
+	select CACHE_L2X0
+	select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
+	select HAVE_ARM_SCU if SMP
+	select HAVE_ARM_TWD if SMP
+	select PL310_ERRATA_769419
+	help
+	  Support for the Cortina Systems CS75xx (Goldengate G2) family of
+	  network processors, such as the CS7542 used in the Securifi
+	  Almond+ router. These SoCs have two Cortex-A9 cores with a PL310
+	  L2 cache controller, a packet processing engine, PCIe, NAND and
+	  the usual low speed peripherals.
arch/arm/mach-goldengate/Makefile new file +2 -0
new file mode 100644
index 000000000..b839201c9
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_SMP)	+= platsmp.o
arch/arm/mach-goldengate/platsmp.c new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.53.0
author
#5 lore raw

PATCH v8 5/10 ARM: debug: Add Cortina Systems CS75xx UART0 support

In reply to Fil Dunsky

Add low-level debug output through UART0 of the Cortina Systems CS75xx SoCs. The UART is mapped at a fixed virtual address by the generic debug_ll_io_init(), so no platform map_io is needed.

---
 arch/arm/Kconfig.debug          | 16 ++++++++++++++--
 arch/arm/include/debug/cs75xx.S | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)
arch/arm/Kconfig.debug +14 -2
index abcf14f10..c43fe288b 100644
@@ -308,6 +308,15 @@ choice
 		  Say Y here if you want the debug print routines to direct
 		  their output to the second serial port on these devices.
 
+	config DEBUG_CS75XX_UART0
+		bool "Kernel low-level debugging messages via CS75xx UART0"
+		depends on ARCH_CORTINA_ACCESS
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to UART0 of Cortina Systems CS75xx SoCs. This
+		  is the console port on the Securifi Almond+. The UART is
+		  expected to be set up by the bootloader.
+
 	config DEBUG_DAVINCI_DA8XX_UART1
 		bool "Kernel low-level debugging on DaVinci DA8XX using UART1"
 		depends on ARCH_DAVINCI_DA8XX
@@ -1531,6 +1540,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/vt8500.S" if DEBUG_VT8500_UART0
 	default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
 	default "debug/bcm63xx.S" if DEBUG_BCM63XX_UART || DEBUG_BCMBCA
+	default "debug/cs75xx.S" if DEBUG_CS75XX_UART0
 	default "debug/digicolor.S" if DEBUG_DIGICOLOR_UA0
 	default "debug/brcmstb.S" if DEBUG_BRCMSTB_UART
 	default "mach/debug-macro.S"
@@ -1632,6 +1642,7 @@ config DEBUG_UART_PHYS
 	default 0xe8008000 if DEBUG_R7S72100_SCIF2 || DEBUG_R7S9210_SCIF2
 	default 0xe8009000 if DEBUG_R7S9210_SCIF4
 	default 0xf0000000 if DEBUG_DIGICOLOR_UA0
+	default 0xf0070110 if DEBUG_CS75XX_UART0
 	default 0xf1012000 if DEBUG_MVEBU_UART0_ALTERNATE
 	default 0xf1012100 if DEBUG_MVEBU_UART1_ALTERNATE
 	default 0xf7fc9000 if DEBUG_BERLIN_UART
@@ -1670,7 +1681,7 @@ config DEBUG_UART_PHYS
 		DEBUG_RMOBILE_SCIFA4 || \
 		DEBUG_S3C64XX_UART || \
 		DEBUG_BCM63XX_UART || DEBUG_BCMBCA || DEBUG_ASM9260_UART || \
-		DEBUG_DIGICOLOR_UA0 || \
+		DEBUG_CS75XX_UART0 || DEBUG_DIGICOLOR_UA0 || \
 		DEBUG_AT91_UART || DEBUG_STM32_UART || \
 		DEBUG_STIH41X_ASC2 || DEBUG_STIH41X_SBC_ASC1 || \
 		DEBUG_STIH418_SBC_ASC0
@@ -1708,6 +1719,7 @@ config DEBUG_UART_VIRT
 	default 0xf7000800 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART2
 	default 0xf7000c00 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART3
 	default 0xf7020000 if DEBUG_AT91_SAMA5D2_UART1
+	default 0xf7070110 if DEBUG_CS75XX_UART0
 	default 0xf7fc9000 if DEBUG_BERLIN_UART
 	default 0xf8007000 if DEBUG_HIP04_UART
 	default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
@@ -1772,7 +1784,7 @@ config DEBUG_UART_VIRT
 		DEBUG_QCOM_UARTDM || \
 		DEBUG_S3C64XX_UART || \
 		DEBUG_BCM63XX_UART || DEBUG_BCMBCA || DEBUG_ASM9260_UART || \
-		DEBUG_DIGICOLOR_UA0 || \
+		DEBUG_CS75XX_UART0 || DEBUG_DIGICOLOR_UA0 || \
 		DEBUG_AT91_UART || DEBUG_STM32_UART || \
 		DEBUG_STIH41X_ASC2 || DEBUG_STIH41X_SBC_ASC1 || \
 		DEBUG_STIH418_SBC_ASC0
arch/arm/include/debug/cs75xx.S new file +37 -0
new file mode 100644
index 000000000..967821add
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Debugging macro include header for the Cortina Systems CS75xx UART
+ */
+
+#define CS75XX_UART_TXDAT		0x10
+#define CS75XX_UART_INFO		0x18
+#define CS75XX_UART_INFO_TX_FULL	(1 << 2)
+#define CS75XX_UART_INFO_TX_EMPTY	(1 << 3)
+
+		.macro	addruart, rp, rv, tmp
+		ldr	\rp, =CONFIG_DEBUG_UART_PHYS
+		ldr	\rv, =CONFIG_DEBUG_UART_VIRT
+		.endm
+
+		.macro	senduart, rd, rx
+		ARM_BE8(rev \rd, \rd)
+		str	\rd, [\rx, #CS75XX_UART_TXDAT]
+		ARM_BE8(rev \rd, \rd)
+		.endm
+
+		.macro	waituartcts, rd, rx
+		.endm
+
+		.macro	waituarttxrdy, rd, rx
+1001:		ldr	\rd, [\rx, #CS75XX_UART_INFO]
+		ARM_BE8(rev \rd, \rd)
+		tst	\rd, #CS75XX_UART_INFO_TX_FULL
+		bne	1001b
+		.endm
+
+		.macro	busyuart, rd, rx
+1002:		ldr	\rd, [\rx, #CS75XX_UART_INFO]
+		ARM_BE8(rev \rd, \rd)
+		tst	\rd, #CS75XX_UART_INFO_TX_EMPTY
+		beq	1002b
+		.endm
Signature · 1 line
2.53.0
author
#6 lore raw

PATCH v8 6/10 dt-bindings: serial: Add Cortina Systems CS7542 UART

In reply to Fil Dunsky

Add the binding for the UART found in the Cortina Systems CS75xx (Goldengate G2) SoCs such as the CS7542.

---
 .../bindings/serial/cortina,cs7542-uart.yaml       | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
Documentation/devicetree/bindings/serial/cortina,cs7542-uart.yaml new file +52 -0
new file mode 100644
index 000000000..2879a7188
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/cortina,cs7542-uart.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cortina UART
+
+maintainers:
+  - Fil Dunsky <[email protected]>
+
+description:
+  The UART found in the Cortina Systems CS7542 (Goldengate G2) SoC. It has
+  transmit and receive FIFOs and a 24-bit baud rate divider running from the
+  peripheral (APB) clock. Other SoCs with the same block, the rest of the
+  CS75xx family and the Cortina Access parts, are to be added with their own
+  compatible string and "cortina,cs7542-uart" as the fallback.
+
+allOf:
+  - $ref: serial.yaml#
+
+properties:
+  compatible:
+    const: cortina,cs7542-uart
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    serial@f0070110 {
+        compatible = "cortina,cs7542-uart";
+        reg = <0xf0070110 0x30>;
+        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&apb_clk>;
+    };
Signature · 1 line
2.53.0
#7 lore raw

Re: [PATCH v8 06/10] dt-bindings: serial: Add Cortina Systems CS7542 UART

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: serial: cortina,cs7542-uart: interrupts listed before clocks --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: serial: cortina,cs7542-uart: interrupts listed before clocks
--

commit 9cf5cd80f03458b63f383ce2437badbe51f15cfd
Author: Fil Dunsky <[email protected]>

dt-bindings: serial: Add Cortina Systems CS7542 UART

This commit adds the Device Tree binding schema for the UART found in the Cortina Systems CS75xx (Goldengate G2) SoCs.

Quoted 6 lines
Documentation/devicetree/bindings/serial/cortina,cs7542-uart.yaml new file +0 -0
new file mode 100644
index 0000000000000..2879a71880239
@@ -0,0 +1,52 @@

[ ... ]

Quoted 21 lines
Documentation/devicetree/bindings/serial/cortina,cs7542-uart.yaml new file +21 -0
+properties:
+  compatible:
+    const: cortina,cs7542-uart
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+
+unevaluatedProperties: false
+

Documentation/devicetree/bindings/serial/cortina,cs7542-uart.yaml line 52

Quoted 10 lines
Documentation/devicetree/bindings/serial/cortina,cs7542-uart.yaml new file +10 -0
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    serial@f0070110 {
+        compatible = "cortina,cs7542-uart";
+        reg = <0xf0070110 0x30>;
+        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&apb_clk>;
+    };

[Severity: Low]
This isn't a bug, but clocks is normally listed before interrupts in properties, required, and example nodes (compatible, reg, clocks, interrupts).

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
author
#8 lore raw

PATCH v8 7/10 tty: serial: Add Cortina UART driver

In reply to Fil Dunsky

Add a driver for the UART found in Cortina SoCs, starting with the Cortina Systems CS75xx (Goldengate G2) family such as the CS7542. The block has transmit and receive FIFOs with full/empty status, a 24-bit baud rate divider clocked from the peripheral (APB) clock, a receive sampling point register and one interrupt line per port with per-cause enable and write-one-to-clear status registers.

The same block, with an additional flow control register and a few more interrupt causes, is used in the Cortina Access CAxxxx SoCs, which were briefly supported by commit b61c8bf4694b ("tty: serial: Add UART driver for Cortina-Access platform") before it was removed again. The driver is therefore named after the vendor rather than one SoC, so that those parts can be added with their own compatible strings.

The driver is a rewrite of the vendor driver shipped with the Linux 2.6.36 and 4.9 based vendor kernels, using the current serial core API (uart_port_tx(), port lock helpers) and devm resource management. It supports the system console and earlycon. Hardware flow control is not supported, and neither is SysRq: the UART does not report a break condition.

The ports are named ttyCS so that the driver can coexist with the 8250 driver in multiplatform kernels, where the 8250 core registers ttyS0 and up even without any 8250 hardware, and PORT_GENERIC is used rather than allocating a new port type.

---
 drivers/tty/serial/Kconfig        |  24 ++
 drivers/tty/serial/Makefile       |   1 +
 drivers/tty/serial/cortina-uart.c | 612 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 637 insertions(+)
drivers/tty/serial/Kconfig +24 -0
index 3864cef71..4ad28ce07 100644
@@ -1359,6 +1359,30 @@ config SERIAL_CONEXANT_DIGICOLOR_CONSOLE
 	  If you have enabled the USART serial port on Conexant Digicolor
 	  SoCs, you can make it the console by answering Y to this option.
 
+config SERIAL_CORTINA
+	tristate "Cortina UART support"
+	depends on ARCH_CORTINA_ACCESS || COMPILE_TEST
+	depends on OF
+	select SERIAL_CORE
+	help
+	  Support for the on-chip UART of Cortina Systems CS75xx
+	  (Goldengate G2) SoCs such as the CS7542. Cortina Access SoCs use
+	  the same UART. The ports are named ttyCS0 to ttyCS3.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called cortina-uart.
+
+config SERIAL_CORTINA_CONSOLE
+	bool "Console on Cortina UART"
+	depends on SERIAL_CORTINA=y
+	select SERIAL_CORE_CONSOLE
+	select SERIAL_EARLYCON
+	help
+	  Say Y here to use a Cortina UART as the system
+	  console. This also enables the early console, which can be
+	  selected with "earlycon" on the kernel command line when the
+	  device tree chosen node has a stdout-path pointing at the UART.
+
 config SERIAL_ST_ASC
 	tristate "ST ASC serial port support"
 	select SERIAL_CORE
drivers/tty/serial/Makefile +1 -0
index d63b126f4..9a354ad8f 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_SERIAL_BCM63XX)		+= bcm63xx_uart.o
 obj-$(CONFIG_SERIAL_CLPS711X)		+= clps711x.o
 obj-$(CONFIG_SERIAL_CPM)		+= cpm_uart.o
 obj-$(CONFIG_SERIAL_CONEXANT_DIGICOLOR)	+= digicolor-usart.o
+obj-$(CONFIG_SERIAL_CORTINA)		+= cortina-uart.o
 obj-$(CONFIG_SERIAL_DZ)			+= dz.o
 obj-$(CONFIG_SERIAL_FSL_LINFLEXUART)	+= fsl_linflexuart.o
 obj-$(CONFIG_SERIAL_FSL_LPUART)		+= fsl_lpuart.o
drivers/tty/serial/cortina-uart.c new file +612 -0

612 lines not on this page · raw message

Signature · 1 line
2.53.0
#9 lore raw

Re: [PATCH v8 07/10] tty: serial: Add Cortina UART driver

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] tty: serial: cortina-uart: unsigned port->irq check in cortina_uart_probe() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] tty: serial: cortina-uart: unsigned port->irq check in cortina_uart_probe()
--

commit a305c8b2604a8b9812e1e52e3a3c6ade80f87136
Author: Fil Dunsky <[email protected]>

tty: serial: Add Cortina UART driver

This commit adds a serial driver for the UART found in Cortina Systems CS75xx (Goldengate G2) SoCs, including system console and earlycon support.

Quoted 6 lines
drivers/tty/serial/cortina-uart.c new file +0 -0
new file mode 100644
index 0000000000000..eb63848f09257
@@ -0,0 +1,612 @@

[ ... ]

Quoted 11 lines
drivers/tty/serial/cortina-uart.c new file +11 -0
+static int cortina_uart_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct cortina_uart_port *up;
+	struct uart_port *port;
+	struct resource *res;
+	int id, ret;
+
+	up = devm_kzalloc(dev, sizeof(*up), GFP_KERNEL);
+	if (!up)
+		return -ENOMEM;

drivers/tty/serial/cortina-uart.c line 519

Quoted 10 lines
drivers/tty/serial/cortina-uart.c new file +10 -0
+
+	port = &up->port;
+
+	port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(port->membase))
+		return PTR_ERR(port->membase);
+
+	port->irq = platform_get_irq(pdev, 0);
+	if (port->irq < 0)
+		return port->irq;

[Severity: Medium]
Does assigning the return value of platform_get_irq() directly to port->irq prevent error detection here? struct uart_port defines irq as unsigned int, so port->irq < 0 is always false and negative error codes such as -EPROBE_DEFER allow probe to succeed with a bogus IRQ number.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
author
#10 lore raw

PATCH v8 8/10 ARM: dts: cortina: Add CS7542 SoC and Securifi Almond+ board

In reply to Fil Dunsky

Add a minimal description of the Cortina Systems CS7542 SoC: the two Cortex-A9 cores, SCU, GIC, global timer, private timer and watchdog, PL310 L2 cache controller and the four on-chip UARTs.

The peripheral clock (APB) runs at 100, 150 or 170 MHz depending on the boot strap pins. Until there is a driver for the global control block that reads the straps, model it as a fixed clock whose rate is provided by the board.

The Securifi Almond+ is a touchscreen Wi-Fi router with 512 MiB of DDR3, 512 MiB of NAND flash, a QCA8337 switch, QCA9880 and AR9580 Wi-Fi and an ASM1042 USB 3.0 controller behind the SoC PCIe root ports. For now, describe the memory and the console UART, and reserve the top 64 MiB of RAM which the vendor firmware hands to the packet engine queue manager.

---
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/cortina/Makefile                 |   3 +
 .../dts/cortina/cs7542-securifi-almondplus.dts     |  46 ++++++++
 arch/arm/boot/dts/cortina/cs7542.dtsi              | 127 +++++++++++++++++++++
 4 files changed, 177 insertions(+)
arch/arm/boot/dts/Makefile +1 -0
index 28fba538d..cf4433001 100644
@@ -12,6 +12,7 @@ subdir-y += broadcom
 subdir-y += calxeda
 subdir-y += cirrus
 subdir-y += cnxt
+subdir-y += cortina
 subdir-y += gemini
 subdir-y += hisilicon
 subdir-y += hpe
arch/arm/boot/dts/cortina/Makefile new file +3 -0
new file mode 100644
index 000000000..93be6c9ae
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_CORTINA_ACCESS) += \
+	cs7542-securifi-almondplus.dtb
arch/arm/boot/dts/cortina/cs7542-securifi-almondplus.dts new file +46 -0

46 lines not on this page · raw message

arch/arm/boot/dts/cortina/cs7542.dtsi new file +127 -0

127 lines not on this page · raw message

Signature · 1 line
2.53.0
author
#11 lore raw

PATCH v8 9/10 ARM: multi_v7_defconfig: Enable Cortina Systems CS75xx support

In reply to Fil Dunsky

Enable the Cortina Systems CS75xx platform and its UART driver with console support, as used on the Securifi Almond+ router.

---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/configs/multi_v7_defconfig +3 -0
index 069d5a49f..23f144359 100644
@@ -45,6 +45,7 @@ CONFIG_MACH_BERLIN_BG2CD=y
 CONFIG_MACH_BERLIN_BG2Q=y
 CONFIG_ARCH_DIGICOLOR=y
 CONFIG_ARCH_EXYNOS=y
+CONFIG_ARCH_CORTINA_ACCESS=y
 CONFIG_ARCH_HIGHBANK=y
 CONFIG_ARCH_HISI=y
 CONFIG_ARCH_HI3xxx=y
@@ -396,6 +397,8 @@ CONFIG_SERIAL_FSL_LPUART=y
 CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
 CONFIG_SERIAL_CONEXANT_DIGICOLOR=y
 CONFIG_SERIAL_CONEXANT_DIGICOLOR_CONSOLE=y
+CONFIG_SERIAL_CORTINA=y
+CONFIG_SERIAL_CORTINA_CONSOLE=y
 CONFIG_SERIAL_ST_ASC=y
 CONFIG_SERIAL_ST_ASC_CONSOLE=y
 CONFIG_SERIAL_STM32=y
Signature · 1 line
2.53.0
author
#12 lore raw

PATCH v8 10/10 MAINTAINERS: Add entry for Cortina Systems CS75xx

In reply to Fil Dunsky

Add an entry covering the Cortina Systems CS75xx platform code, device trees, bindings and UART driver.

---
 MAINTAINERS | 11 +++++++++++
 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
index 93abbb315..deb2ca570 100644
@@ -2950,6 +2950,17 @@ F:	tools/perf/tests/shell/coresight/*
 F:	tools/perf/util/cs-etm-decoder/*
 F:	tools/perf/util/cs-etm.*
 
+ARM/CORTINA SYSTEMS CS75XX ARM ARCHITECTURE
+M:	Fil Dunsky <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	Documentation/devicetree/bindings/arm/cortina.yaml
+F:	Documentation/devicetree/bindings/serial/cortina,cs7542-uart.yaml
+F:	arch/arm/boot/dts/cortina/
+F:	arch/arm/include/debug/cs75xx.S
+F:	arch/arm/mach-goldengate/
+F:	drivers/tty/serial/cortina-uart.c
+
 ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE
 M:	Hans Ulli Kroll <[email protected]>
 M:	Linus Walleij <[email protected]>
Signature · 1 line
2.53.0
#13 lore raw
In reply to Fil Dunsky
Sashiko has finished reviewing this 10-patch series:

Sashiko has finished reviewing this 10-patch series:

- Patches 1-5, 8, and 9: no issues found.
- Patch 6 ("dt-bindings: serial: Add Cortina Systems CS7542 UART"): 1 potential issue (1 Low)
- Patch 7 ("tty: serial: Add Cortina UART driver"): 1 potential issue (1 Medium)
- Patch 10: skipped (not reviewed).

Detailed reviews have been sent as separate replies to patches 6 and 7.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]