Skip to contentSkip to conversation

MIPS: intel: add initial support for Intel MIPS SoCs

PATCH Superseded Songjun Wu 8 participants 30 messages Jun 12, 2018 – Jun 19, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Songjun Wu

author
#0 lore raw

cover MIPS: intel: add initial support for Intel MIPS SoCs

This patch series is for adding the support for Intel MIPS interAptiv SoC GRX500 family. It includes CCF support, serial driver optimization and DTS modification.

This patch series is applied on top of v4.17.1. Basic verification is performed on GRX500 board. Any comments on this would be appreciated.

We propose merging this patch series into MIPS Linux tree.

Hua Ma (1):
MIPS: intel: Add initial support for Intel MIPS SoCs

Songjun Wu (5):
MIPS: dts: Add aliases node for lantiq danube serial
tty: serial: lantiq: Always use readl()/writel()
tty: serial: lantiq: Convert global lock to per device lock
tty: serial: lantiq: Remove unneeded header includes and macros
tty: serial: lantiq: Add CCF support

Yixin Zhu (1):
clk: intel: Add clock driver for GRX500 SoC

 .../devicetree/bindings/clock/intel,grx500-clk.txt |  46 ++
 .../devicetree/bindings/serial/lantiq_asc.txt      |  15 +
 arch/mips/Kbuild.platforms                         |   1 +
 arch/mips/Kconfig                                  |  37 +-
 arch/mips/boot/dts/Makefile                        |   1 +
 arch/mips/boot/dts/intel-mips/Makefile             |   3 +
 arch/mips/boot/dts/intel-mips/easy350_anywan.dts   |  20 +
 arch/mips/boot/dts/intel-mips/xrx500.dtsi          | 196 ++++++
 arch/mips/boot/dts/lantiq/danube.dtsi              |   6 +-
 arch/mips/configs/grx500_defconfig                 | 165 +++++
 .../asm/mach-intel-mips/cpu-feature-overrides.h    |  61 ++
 arch/mips/include/asm/mach-intel-mips/ioremap.h    |  39 ++
 arch/mips/include/asm/mach-intel-mips/irq.h        |  17 +
 .../asm/mach-intel-mips/kernel-entry-init.h        |  76 +++
 arch/mips/include/asm/mach-intel-mips/spaces.h     |  29 +
 arch/mips/include/asm/mach-intel-mips/war.h        |  18 +
 arch/mips/intel-mips/Kconfig                       |  22 +
 arch/mips/intel-mips/Makefile                      |   3 +
 arch/mips/intel-mips/Platform                      |  11 +
 arch/mips/intel-mips/irq.c                         |  36 ++
 arch/mips/intel-mips/prom.c                        | 184 ++++++
 arch/mips/intel-mips/time.c                        |  56 ++
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/intel/Kconfig                          |  21 +
 drivers/clk/intel/Makefile                         |   7 +
 drivers/clk/intel/clk-cgu-api.c                    | 676 +++++++++++++++++++++
 drivers/clk/intel/clk-cgu-api.h                    | 120 ++++
 drivers/clk/intel/clk-grx500.c                     | 236 +++++++
 drivers/tty/serial/Kconfig                         |   2 +-
 drivers/tty/serial/lantiq.c                        | 415 ++++++++-----
 include/dt-bindings/clock/intel,grx500-clk.h       |  61 ++
 32 files changed, 2418 insertions(+), 164 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/intel,grx500-clk.txt
 create mode 100644 arch/mips/boot/dts/intel-mips/Makefile
 create mode 100644 arch/mips/boot/dts/intel-mips/easy350_anywan.dts
 create mode 100644 arch/mips/boot/dts/intel-mips/xrx500.dtsi
 create mode 100644 arch/mips/configs/grx500_defconfig
 create mode 100644 arch/mips/include/asm/mach-intel-mips/cpu-feature-overrides.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/ioremap.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/irq.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/spaces.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/war.h
 create mode 100644 arch/mips/intel-mips/Kconfig
 create mode 100644 arch/mips/intel-mips/Makefile
 create mode 100644 arch/mips/intel-mips/Platform
 create mode 100644 arch/mips/intel-mips/irq.c
 create mode 100644 arch/mips/intel-mips/prom.c
 create mode 100644 arch/mips/intel-mips/time.c
 create mode 100644 drivers/clk/intel/Kconfig
 create mode 100644 drivers/clk/intel/Makefile
 create mode 100644 drivers/clk/intel/clk-cgu-api.c
 create mode 100644 drivers/clk/intel/clk-cgu-api.h
 create mode 100644 drivers/clk/intel/clk-grx500.c
 create mode 100644 include/dt-bindings/clock/intel,grx500-clk.h
Signature · 1 line
2.11.0
author
#1 lore raw

PATCH 1/7 MIPS: dts: Add aliases node for lantiq danube serial

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

 arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +5 -1
index 2dd950181f8a..7a9e15da6bd0 100644
@@ -4,6 +4,10 @@
 	#size-cells = <1>;
 	compatible = "lantiq,xway", "lantiq,danube";
 
+	aliases {
+		serial0 = &asc1;
+	};
+
 	cpus {
 		cpu@0 {
 			compatible = "mips,mips24Kc";
@@ -74,7 +78,7 @@
 			reg = <0xE100A00 0x100>;
 		};
 
-		serial@E100C00 {
+		asc1: serial@E100C00 {
 			compatible = "lantiq,asc";
 			reg = <0xE100C00 0x400>;
 			interrupt-parent = <&icu0>;
Signature · 1 line
2.11.0
author
#8 lore raw

PATCH 2/7 clk: intel: Add clock driver for GRX500 SoC

In reply to Songjun Wu

From: Yixin Zhu <[email protected]>

PLL of GRX500 provide clock to DDR, CPU, and peripherals as show below

                 +---------+
	    |--->| LCPLL3 0|--PCIe clk-->
   XO       |    +---------+
+-----------|
            |    +---------+
            |    |        3|--PAE clk-->
            |--->| PLL0B  2|--GSWIP clk-->
            |    |        1|--DDR clk-->DDR PHY clk-->
            |    |        0|--CPU1 clk--+   +-----+
            |    +---------+            |--->0    |
            |                               | MUX |--CPU clk-->
            |    +---------+            |--->1    |
            |    |        0|--CPU0 clk--+   +-----+
            |--->| PLLOA  1|--SSX4 clk-->
                 |        2|--NGI clk-->
                 |        3|--CBM clk-->
                 +---------+

VCO of all PLLs of GRX500 is not supposed to be reprogrammed. DDR PHY clock is created to show correct clock rate in software point of view.
CPU clock of 1Ghz from PLL0B otherwise from PLL0A.

---

 .../devicetree/bindings/clock/intel,grx500-clk.txt |  46 ++
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/intel/Kconfig                          |  21 +
 drivers/clk/intel/Makefile                         |   7 +
 drivers/clk/intel/clk-cgu-api.c                    | 676 +++++++++++++++++++++
 drivers/clk/intel/clk-cgu-api.h                    | 120 ++++
 drivers/clk/intel/clk-grx500.c                     | 236 +++++++
 include/dt-bindings/clock/intel,grx500-clk.h       |  61 ++
 9 files changed, 1169 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/intel,grx500-clk.txt
 create mode 100644 drivers/clk/intel/Kconfig
 create mode 100644 drivers/clk/intel/Makefile
 create mode 100644 drivers/clk/intel/clk-cgu-api.c
 create mode 100644 drivers/clk/intel/clk-cgu-api.h
 create mode 100644 drivers/clk/intel/clk-grx500.c
 create mode 100644 include/dt-bindings/clock/intel,grx500-clk.h
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +46 -0
new file mode 100644
index 000000000000..dd761d900dc9
@@ -0,0 +1,46 @@
+Device Tree Clock bindings for GRX500 PLL controller.
+
+This binding uses the common clock binding:
+	Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+This GRX500 PLL controller provides the 5 main clock domain of the SoC: CPU/DDR, XBAR,
+Voice, WLAN, PCIe and gate clocks for HW modules.
+
+Required properties for osc clock node
+- compatible: Should be intel,grx500-xxx-clk
+- reg: offset address of the controller memory area.
+- clocks: phandle of the external reference clock
+- #clock-cells: can be one or zero.
+- clock-output-names: Names of the output clocks.
+
+Example:
+	pll0aclk: pll0aclk {
+		#clock-cells = <1>;
+		compatible = "intel,grx500-pll0a-clk";
+		clocks = <&pll0a>;
+		reg = <0x8>;
+		clock-output-names = "cbmclk", "ngiclk", "ssx4clk", "cpu0clk";
+	};
+
+	cpuclk: cpuclk {
+		#clock-cells = <0>;
+		compatible = "intel,grx500-cpu-clk";
+		clocks = <&pll0aclk CPU0_CLK>, <&pll0bclk CPU1_CLK>;
+		reg = <0x8>;
+		clock-output-names = "cpu";
+	};
+
+Required properties for gate node:
+- compatible: Should be intel,grx500-gatex-clk
+- reg: offset address of the controller memory area.
+- #clock-cells: Should be <1>
+- clock-output-names: Names of the output clocks.
+
+Example:
+	clkgate0: clkgate0 {
+		#clock-cells = <1>;
+		compatible = "intel,grx500-gate0-clk";
+		reg = <0x114>;
+		clock-output-names = "gate_xbar0", "gate_xbar1", "gate_xbar2",
+		"gate_xbar3", "gate_xbar6", "gate_xbar7";
+	};
drivers/clk/Kconfig +1 -0
index 34968a381d0f..9e2e19a1170a 100644
@@ -280,6 +280,7 @@ config COMMON_CLK_STM32H7
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
 source "drivers/clk/imgtec/Kconfig"
+source "drivers/clk/intel/Kconfig"
 source "drivers/clk/keystone/Kconfig"
 source "drivers/clk/mediatek/Kconfig"
 source "drivers/clk/meson/Kconfig"
drivers/clk/Makefile +1 -0
index de6d06ac790b..ef3e270005a1 100644
@@ -105,3 +105,4 @@ obj-$(CONFIG_X86)			+= x86/
 endif
 obj-$(CONFIG_ARCH_ZX)			+= zte/
 obj-$(CONFIG_ARCH_ZYNQ)			+= zynq/
+obj-$(CONFIG_COMMON_CLK_INTEL)		+= intel/
drivers/clk/intel/Kconfig new file +21 -0
new file mode 100644
index 000000000000..d40a92ae7462
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0
+config COMMON_CLK_INTEL
+	depends on COMMON_CLK
+	depends on INTEL_MIPS || COMPILE_TEST
+	select MFD_SYSCON
+	bool "Intel clock controller support"
+	help
+	  This driver support Intel GRX500 crystal oscillator clock
+	  using common clock framework.
+
+choice
+	prompt "SoC platform selection"
+	depends on COMMON_CLK_INTEL
+	default INTEL_GRX500_CLK
+
+config INTEL_GRX500_CLK
+	bool "GRX500 CLK"
+	help
+	  Clock driver of GRX500 platform.
+
+endchoice
drivers/clk/intel/Makefile new file +7 -0
new file mode 100644
index 000000000000..1eaa37f797ea
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for intel specific clk
+
+obj-y += clk-cgu-api.o
+ifneq ($(CONFIG_INTEL_GRX500_CLK),)
+	obj-y += clk-grx500.o
+endif
drivers/clk/intel/clk-cgu-api.c new file +676 -0

676 lines not on this page · raw message

drivers/clk/intel/clk-cgu-api.h new file +120 -0

120 lines not on this page · raw message

drivers/clk/intel/clk-grx500.c new file +236 -0

236 lines not on this page · raw message

include/dt-bindings/clock/intel,grx500-clk.h new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
2.11.0
author
#13 lore raw

PATCH 3/7 MIPS: intel: Add initial support for Intel MIPS SoCs

In reply to Songjun Wu

From: Hua Ma <[email protected]>

Add initial support for Intel MIPS interAptiv SoCs made by Intel. This series will add support for the GRX500 family.

The series allows booting a minimal system using a initramfs.

---

 arch/mips/Kbuild.platforms                         |   1 +
 arch/mips/Kconfig                                  |  36 ++++
 arch/mips/boot/dts/Makefile                        |   1 +
 arch/mips/boot/dts/intel-mips/Makefile             |   3 +
 arch/mips/boot/dts/intel-mips/easy350_anywan.dts   |  20 +++
 arch/mips/boot/dts/intel-mips/xrx500.dtsi          | 196 +++++++++++++++++++++
 arch/mips/configs/grx500_defconfig                 | 165 +++++++++++++++++
 .../asm/mach-intel-mips/cpu-feature-overrides.h    |  61 +++++++
 arch/mips/include/asm/mach-intel-mips/ioremap.h    |  39 ++++
 arch/mips/include/asm/mach-intel-mips/irq.h        |  17 ++
 .../asm/mach-intel-mips/kernel-entry-init.h        |  76 ++++++++
 arch/mips/include/asm/mach-intel-mips/spaces.h     |  29 +++
 arch/mips/include/asm/mach-intel-mips/war.h        |  18 ++
 arch/mips/intel-mips/Kconfig                       |  22 +++
 arch/mips/intel-mips/Makefile                      |   3 +
 arch/mips/intel-mips/Platform                      |  11 ++
 arch/mips/intel-mips/irq.c                         |  36 ++++
 arch/mips/intel-mips/prom.c                        | 184 +++++++++++++++++++
 arch/mips/intel-mips/time.c                        |  56 ++++++
 19 files changed, 974 insertions(+)
 create mode 100644 arch/mips/boot/dts/intel-mips/Makefile
 create mode 100644 arch/mips/boot/dts/intel-mips/easy350_anywan.dts
 create mode 100644 arch/mips/boot/dts/intel-mips/xrx500.dtsi
 create mode 100644 arch/mips/configs/grx500_defconfig
 create mode 100644 arch/mips/include/asm/mach-intel-mips/cpu-feature-overrides.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/ioremap.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/irq.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/spaces.h
 create mode 100644 arch/mips/include/asm/mach-intel-mips/war.h
 create mode 100644 arch/mips/intel-mips/Kconfig
 create mode 100644 arch/mips/intel-mips/Makefile
 create mode 100644 arch/mips/intel-mips/Platform
 create mode 100644 arch/mips/intel-mips/irq.c
 create mode 100644 arch/mips/intel-mips/prom.c
 create mode 100644 arch/mips/intel-mips/time.c
arch/mips/Kbuild.platforms +1 -0
index ac7ad54f984f..bcd647060f3e 100644
@@ -12,6 +12,7 @@ platforms += cobalt
 platforms += dec
 platforms += emma
 platforms += generic
+platforms += intel-mips
 platforms += jazz
 platforms += jz4740
 platforms += lantiq
arch/mips/Kconfig +36 -0
index 225c95da23ce..c82cebeb6192 100644
@@ -404,6 +404,41 @@ config LANTIQ
 	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 
+config INTEL_MIPS
+	bool "Intel MIPS interAptiv SoC based platforms"
+	select ARCH_HAS_RESET_CONTROLLER
+	select ARCH_SUPPORTS_MSI
+	select BOOT_RAW
+	select CEVT_R4K
+	select COMMON_CLK
+	select CPU_MIPS32_3_5_EVA
+	select CPU_MIPS32_3_5_FEATURES
+	select CPU_MIPSR2_IRQ_EI
+	select CPU_MIPSR2_IRQ_VI
+	select CSRC_R4K
+	select DMA_NONCOHERENT
+	select GENERIC_ISA_DMA
+	select GPIOLIB
+	select HW_HAS_PCI
+	select IRQ_MIPS_CPU
+	select MFD_CORE
+	select MFD_SYSCON
+	select MIPS_CPU_SCACHE
+	select MIPS_GIC
+	select PCI_DRIVERS_GENERIC
+	select RESET_CONTROLLER
+	select SYS_HAS_CPU_MIPS32_R1
+	select SYS_HAS_CPU_MIPS32_R2
+	select SYS_HAS_CPU_MIPS32_R3_5
+	select SYS_HAS_EARLY_PRINTK
+	select SYS_SUPPORTS_BIG_ENDIAN
+	select SYS_SUPPORTS_32BIT_KERNEL
+	select SYS_SUPPORTS_MIPS_CPS
+	select SYS_SUPPORTS_MULTITHREADING
+	select SYS_SUPPORTS_ZBOOT
+	select TIMER_OF
+	select USE_OF
+
 config LASAT
 	bool "LASAT Networks platforms"
 	select CEVT_R4K
@@ -1010,6 +1045,7 @@ source "arch/mips/bcm47xx/Kconfig"
 source "arch/mips/bcm63xx/Kconfig"
 source "arch/mips/bmips/Kconfig"
 source "arch/mips/generic/Kconfig"
+source "arch/mips/intel-mips/Kconfig"
 source "arch/mips/jazz/Kconfig"
 source "arch/mips/jz4740/Kconfig"
 source "arch/mips/lantiq/Kconfig"
arch/mips/boot/dts/Makefile +1 -0
index 1e79cab8e269..05f52f279047 100644
@@ -3,6 +3,7 @@ subdir-y	+= brcm
 subdir-y	+= cavium-octeon
 subdir-y	+= img
 subdir-y	+= ingenic
+subdir-y	+= intel-mips
 subdir-y	+= lantiq
 subdir-y	+= mscc
 subdir-y	+= mti
arch/mips/boot/dts/intel-mips/Makefile new file +3 -0
new file mode 100644
index 000000000000..b16c0081639c
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_DTB_INTEL_MIPS_GRX500)	+= easy350_anywan.dtb
+obj-y	+= $(patsubst %.dtb, %.dtb.o, $(dtb-y))
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +20 -0
new file mode 100644
index 000000000000..40177f6cee1e
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/interrupt-controller/mips-gic.h>
+#include <dt-bindings/clock/intel,grx500-clk.h>
+
+#include "xrx500.dtsi"
+
+/ {
+	model = "EASY350 ANYWAN (GRX350) Main model";
+	chosen {
+		bootargs = "earlycon=lantiq,0x16600000 clk_ignore_unused";
+		stdout-path = "serial0";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x20000000 0x0e000000>;
+	};
+};
arch/mips/boot/dts/intel-mips/xrx500.dtsi new file +196 -0

196 lines not on this page · raw message

arch/mips/configs/grx500_defconfig new file +165 -0

165 lines not on this page · raw message

arch/mips/include/asm/mach-intel-mips/cpu-feature-overrides.h new file +61 -0

61 lines not on this page · raw message

arch/mips/include/asm/mach-intel-mips/ioremap.h new file +39 -0
new file mode 100644
index 000000000000..99b20ed0b457
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Copyright (C) 2014 Lei Chuanhua <[email protected]>
+ *  Copyright (C) 2018 Intel Corporation.
+ */
+#ifndef __ASM_MACH_INTEL_MIPS_IOREMAP_H
+#define __ASM_MACH_INTEL_MIPS_IOREMAP_H
+
+#include <linux/types.h>
+
+static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr,
+					     phys_addr_t size)
+{
+	return phys_addr;
+}
+
+/*
+ * TOP IO Space definition for SSX7 components /PCIe/ToE/Memcpy
+ * physical 0xa0000000 --> virtual 0xe0000000
+ */
+#define GRX500_TOP_IOREMAP_BASE			0xA0000000
+#define GRX500_TOP_IOREMAP_SIZE			0x20000000
+#define GRX500_TOP_IOREMAP_PHYS_VIRT_OFFSET	0x40000000
+
+static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
+					 unsigned long flags)
+{
+	if (offset >= GRX500_TOP_IOREMAP_BASE &&
+	    offset < (GRX500_TOP_IOREMAP_BASE + GRX500_TOP_IOREMAP_SIZE))
+		return (void __iomem *)(unsigned long)
+			(offset + GRX500_TOP_IOREMAP_PHYS_VIRT_OFFSET);
+	return NULL;
+}
+
+static inline int plat_iounmap(const volatile void __iomem *addr)
+{
+	return (unsigned long)addr >= (unsigned long)GRX500_TOP_IOREMAP_BASE;
+}
+#endif /* __ASM_MACH_INTEL_MIPS_IOREMAP_H */
arch/mips/include/asm/mach-intel-mips/irq.h new file +17 -0
new file mode 100644
index 000000000000..12a949084856
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Copyright (C) 2014 Lei Chuanhua <[email protected]>
+ *  Copyright (C) 2018 Intel Corporation.
+ */
+
+#ifndef __INTEL_MIPS_IRQ_H
+#define __INTEL_MIPS_IRQ_H
+
+#define MIPS_CPU_IRQ_BASE	0
+#define MIPS_GIC_IRQ_BASE	(MIPS_CPU_IRQ_BASE + 8)
+
+#define NR_IRQS 256
+
+#include_next <irq.h>
+
+#endif /* __INTEL_MIPS_IRQ_H */
arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h new file +76 -0

76 lines not on this page · raw message

arch/mips/include/asm/mach-intel-mips/spaces.h new file +29 -0
new file mode 100644
index 000000000000..abce53a65157
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Author: Leonid Yegoshin ([email protected])
+ * Copyright (C) 2012 MIPS Technologies, Inc.
+ * Copyright (C) 2014 Lei Chuanhua <[email protected]>
+ * Copyright (C) 2018 Intel Corporation.
+ */
+
+#ifndef _ASM_INTEL_MIPS_SPACES_H
+#define _ASM_INTEL_MIPS_SPACES_H
+
+#include <linux/sizes.h>
+
+#define PAGE_OFFSET		_AC(0x60000000, UL)
+#define PHYS_OFFSET		_AC(0x20000000, UL)
+
+/* No Highmem Support */
+#define HIGHMEM_START		_AC(0xffff0000, UL)
+
+#define FIXADDR_TOP		((unsigned long)(long)(int)0xcffe0000)
+
+#define IO_SIZE			_AC(0x10000000, UL)
+#define IO_SHIFT		_AC(0x10000000, UL)
+
+/* IO space one */
+#define __pa_symbol(x)		__pa(x)
+
+#include <asm/mach-generic/spaces.h>
+#endif /* __ASM_INTEL_MIPS_SPACES_H */
arch/mips/include/asm/mach-intel-mips/war.h new file +18 -0
new file mode 100644
index 000000000000..1c95553151e1
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_MIPS_MACH_INTEL_MIPS_WAR_H
+#define __ASM_MIPS_MACH_INTEL_MIPS_WAR_H
+
+#define R4600_V1_INDEX_ICACHEOP_WAR	0
+#define R4600_V1_HIT_CACHEOP_WAR	0
+#define R4600_V2_HIT_CACHEOP_WAR	0
+#define R5432_CP0_INTERRUPT_WAR		0
+#define BCM1250_M3_WAR			0
+#define SIBYTE_1956_WAR			0
+#define MIPS4K_ICACHE_REFILL_WAR	0
+#define MIPS_CACHE_SYNC_WAR		0
+#define TX49XX_ICACHE_INDEX_INV_WAR	0
+#define ICACHE_REFILLS_WORKAROUND_WAR	0
+#define R10000_LLSC_WAR			0
+#define MIPS34K_MISSED_ITLB_WAR		0
+
+#endif /* __ASM_MIPS_MACH_INTEL_MIPS_WAR_H */
arch/mips/intel-mips/Kconfig new file +22 -0
new file mode 100644
index 000000000000..35d2ae2b5408
@@ -0,0 +1,22 @@
+if INTEL_MIPS
+
+choice
+	prompt "Built-in device tree"
+	help
+	  Legacy bootloaders do not pass a DTB pointer to the kernel, so
+	  if a "wrapper" is not being used, the kernel will need to include
+	  a device tree that matches the target board.
+
+	  The builtin DTB will only be used if the firmware does not supply
+	  a valid DTB.
+
+config DTB_INTEL_MIPS_NONE
+	bool "None"
+
+config DTB_INTEL_MIPS_GRX500
+	bool "Intel MIPS GRX500 Board"
+	select BUILTIN_DTB
+
+endchoice
+
+endif
arch/mips/intel-mips/Makefile new file +3 -0
new file mode 100644
index 000000000000..9f272d06eecd
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_INTEL_MIPS)	+= prom.o irq.o time.o
arch/mips/intel-mips/Platform new file +11 -0
new file mode 100644
index 000000000000..b34750eeaeb0
@@ -0,0 +1,11 @@
+#
+# MIPs SoC platform
+#
+
+platform-$(CONFIG_INTEL_MIPS)			+= intel-mips/
+cflags-$(CONFIG_INTEL_MIPS)			+= -I$(srctree)/arch/mips/include/asm/mach-intel-mips
+ifdef CONFIG_EVA
+	load-$(CONFIG_INTEL_MIPS)		= 0xffffffff60020000
+else
+	load-$(CONFIG_INTEL_MIPS)		= 0xffffffff80020000
+endif
arch/mips/intel-mips/irq.c new file +36 -0
new file mode 100644
index 000000000000..00637a5cdd20
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 Intel Corporation.
+ */
+#include <linux/init.h>
+#include <linux/irqchip.h>
+#include <linux/of_irq.h>
+#include <asm/irq.h>
+
+#include <asm/irq_cpu.h>
+
+void __init arch_init_irq(void)
+{
+	struct device_node *intc_node;
+
+	pr_info("EIC is %s\n", cpu_has_veic ? "on" : "off");
+	pr_info("VINT is %s\n", cpu_has_vint ? "on" : "off");
+
+	intc_node = of_find_compatible_node(NULL, NULL,
+					    "mti,cpu-interrupt-controller");
+	if (!cpu_has_veic && !intc_node)
+		mips_cpu_irq_init();
+
+	irqchip_init();
+}
+
+int get_c0_perfcount_int(void)
+{
+	return gic_get_c0_perfcount_int();
+}
+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
+
+unsigned int get_c0_compare_int(void)
+{
+	return gic_get_c0_compare_int();
+}
arch/mips/intel-mips/prom.c new file +184 -0

184 lines not on this page · raw message

arch/mips/intel-mips/time.c new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.11.0
author
#18 lore raw

PATCH 4/7 tty: serial: lantiq: Always use readl()/writel()

In reply to Songjun Wu

Previous implementation uses platform-dependent functions ltq_w32()/ltq_r32() to access registers. Those functions are not available for other SoC which uses the same IP.
Change to OS provided readl()/writel() and readb()/writeb(), so that different SoCs can use the same driver.

---

 arch/mips/Kconfig           |   1 -
 drivers/tty/serial/lantiq.c | 236 ++++++++++++++++++++++++--------------------
 2 files changed, 128 insertions(+), 109 deletions(-)
arch/mips/Kconfig +0 -1
index c82cebeb6192..7bae259edd0b 100644
@@ -395,7 +395,6 @@ config LANTIQ
 	select SYS_SUPPORTS_VPE_LOADER
 	select SYS_HAS_EARLY_PRINTK
 	select GPIOLIB
-	select SWAP_IO_SPACE
 	select BOOT_RAW
 	select CLKDEV_LOOKUP
 	select USE_OF
drivers/tty/serial/lantiq.c +128 -108

558 lines not on this page · raw message

Signature · 1 line
2.11.0
author
#24 lore raw

PATCH 5/7 tty: serial: lantiq: Convert global lock to per device lock

In reply to Songjun Wu

Previous implementation uses one global lock to protect the resource. If the serial driver have multiple entries, this kind of lock will slow down the performance.
Add the lock at device level. This will lock only when the function calling only to the same device.
So that it can avoid useless lock protection.

---

 drivers/tty/serial/lantiq.c | 51 ++++++++++++++++++++++++++++++---------------
 1 file changed, 34 insertions(+), 17 deletions(-)
drivers/tty/serial/lantiq.c +34 -17
index 1127586dbc94..72aab1b05265 100644
@@ -107,7 +107,6 @@
 static void lqasc_tx_chars(struct uart_port *port);
 static struct ltq_uart_port *lqasc_port[MAXPORTS];
 static struct uart_driver lqasc_reg;
-static DEFINE_SPINLOCK(ltq_asc_lock);
 
 struct ltq_uart_port {
 	struct uart_port	port;
@@ -118,6 +117,7 @@ struct ltq_uart_port {
 	unsigned int		tx_irq;
 	unsigned int		rx_irq;
 	unsigned int		err_irq;
+	spinlock_t		lock;  /* exclusive access for multi core */
 };
 
 static inline struct ltq_uart_port *to_ltq_uart_port(struct uart_port *port)
@@ -133,10 +133,11 @@ static void lqasc_stop_tx(struct uart_port *port)
 static void lqasc_start_tx(struct uart_port *port)
 {
 	unsigned long flags;
-	spin_lock_irqsave(&ltq_asc_lock, flags);
+	struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
+
+	spin_lock_irqsave(&ltq_port->lock, flags);
 	lqasc_tx_chars(port);
-	spin_unlock_irqrestore(&ltq_asc_lock, flags);
-	return;
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
 }
 
 static void lqasc_stop_rx(struct uart_port *port)
@@ -238,10 +239,14 @@ static irqreturn_t lqasc_tx_int(int irq, void *_port)
 {
 	unsigned long flags;
 	struct uart_port *port = (struct uart_port *)_port;
-	spin_lock_irqsave(&ltq_asc_lock, flags);
+	struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
+
+	spin_lock_irqsave(&ltq_port->lock, flags);
 	writel(ASC_IRNCR_TIR, port->membase + LTQ_ASC_IRNCR);
-	spin_unlock_irqrestore(&ltq_asc_lock, flags);
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
+
 	lqasc_start_tx(port);
+
 	return IRQ_HANDLED;
 }
 
@@ -250,8 +255,9 @@ static irqreturn_t lqasc_err_int(int irq, void *_port)
 	unsigned long flags;
 	u32 stat;
 	struct uart_port *port = (struct uart_port *)_port;
+	struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
 
-	spin_lock_irqsave(&ltq_asc_lock, flags);
+	spin_lock_irqsave(&ltq_port->lock, flags);
 	/* clear any pending interrupts */
 	writel(ASC_IRNCR_EIR, port->membase + LTQ_ASC_IRNCR);
 	stat = readl(port->membase + LTQ_ASC_STATE);
@@ -266,7 +272,7 @@ static irqreturn_t lqasc_err_int(int irq, void *_port)
 		port->icount.overrun++;
 	}
 	asc_w32_mask(0, ASCWHBSTATE_CLRALL, port->membase + LTQ_ASC_WHBSTATE);
-	spin_unlock_irqrestore(&ltq_asc_lock, flags);
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
 
 	return IRQ_HANDLED;
 }
@@ -275,10 +281,13 @@ static irqreturn_t lqasc_rx_int(int irq, void *_port)
 {
 	unsigned long flags;
 	struct uart_port *port = (struct uart_port *)_port;
-	spin_lock_irqsave(&ltq_asc_lock, flags);
+	struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
+
+	spin_lock_irqsave(&ltq_port->lock, flags);
 	writel(ASC_IRNCR_RIR, port->membase + LTQ_ASC_IRNCR);
 	lqasc_rx_chars(port);
-	spin_unlock_irqrestore(&ltq_asc_lock, flags);
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
+
 	return IRQ_HANDLED;
 }
 
@@ -309,11 +318,13 @@ lqasc_startup(struct uart_port *port)
 {
 	struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
 	int retval;
+	unsigned long flags;
 
 	if (!IS_ERR(ltq_port->clk))
 		clk_enable(ltq_port->clk);
 	port->uartclk = clk_get_rate(ltq_port->fpiclk);
 
+	spin_lock_irqsave(&ltq_port->lock, flags);
 	asc_w32_mask(ASCCLC_DISS | ASCCLC_RMCMASK, (1 << ASCCLC_RMCOFFSET),
 		port->membase + LTQ_ASC_CLC);
 
@@ -330,6 +341,7 @@ lqasc_startup(struct uart_port *port)
 	wmb();
 	asc_w32_mask(0, ASCCON_M_8ASYNC | ASCCON_FEN | ASCCON_TOEN |
 		     ASCCON_ROEN, port->membase + LTQ_ASC_CON);
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
 
 	retval = request_irq(ltq_port->tx_irq, lqasc_tx_int,
 			     0, "asc_tx", port);
@@ -410,6 +422,7 @@ static void lqasc_set_termios(struct uart_port *port,
 	unsigned long flags;
 	u32 fdv = 0;
 	u32 reload = 0;
+	struct ltq_uart_port *ltq_port = to_ltq_uart_port(port);
 
 	cflag = new->c_cflag;
 	iflag = new->c_iflag;
@@ -463,7 +476,7 @@ static void lqasc_set_termios(struct uart_port *port,
 	/* set error signals  - framing, parity  and overrun, enable receiver */
 	con |= ASCCON_FEN | ASCCON_TOEN | ASCCON_ROEN;
 
-	spin_lock_irqsave(&ltq_asc_lock, flags);
+	spin_lock_irqsave(&ltq_port->lock, flags);
 
 	/* set up CON */
 	asc_w32_mask(0, con, port->membase + LTQ_ASC_CON);
@@ -490,7 +503,7 @@ static void lqasc_set_termios(struct uart_port *port,
 	/* enable rx */
 	writel(ASCWHBSTATE_SETREN, port->membase + LTQ_ASC_WHBSTATE);
 
-	spin_unlock_irqrestore(&ltq_asc_lock, flags);
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
 
 	/* Don't rewrite B0 */
 	if (tty_termios_baud_rate(new))
@@ -604,16 +617,14 @@ static void lqasc_console_putchar(struct uart_port *port, int ch)
 static void lqasc_serial_port_write(struct uart_port *port, const char *s,
 				    u_int count)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&ltq_asc_lock, flags);
 	uart_console_write(port, s, count, lqasc_console_putchar);
-	spin_unlock_irqrestore(&ltq_asc_lock, flags);
 }
 
 static void lqasc_console_write(struct console *co, const char *s, u_int count)
 {
+	unsigned long flags;
 	struct ltq_uart_port *ltq_port;
+	struct uart_port *port;
 
 	if (co->index >= MAXPORTS)
 		return;
@@ -622,7 +633,11 @@ static void lqasc_console_write(struct console *co, const char *s, u_int count)
 	if (!ltq_port)
 		return;
 
-	lqasc_serial_port_write(&ltq_port->port, s, count);
+	port = &ltq_port->port;
+
+	spin_lock_irqsave(&ltq_port->lock, flags);
+	lqasc_serial_port_write(port, s, count);
+	spin_unlock_irqrestore(&ltq_port->lock, flags);
 }
 
 static int __init lqasc_console_setup(struct console *co, char *options)
@@ -760,6 +775,8 @@ static int __init lqasc_probe(struct platform_device *pdev)
 	ltq_port->rx_irq = irqres[1].start;
 	ltq_port->err_irq = irqres[2].start;
 
+	spin_lock_init(&ltq_port->lock);
+
 	lqasc_port[line] = ltq_port;
 	platform_set_drvdata(pdev, ltq_port);
 
Signature · 1 line
2.11.0
author
#25 lore raw

PATCH 6/7 tty: serial: lantiq: Remove unneeded header includes and macros

In reply to Songjun Wu

Update the author list with Intel Corporation.
Sort the header includes in alphabetical orders.
Remove unneeded header includes and macros.

---

 drivers/tty/serial/lantiq.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)
drivers/tty/serial/lantiq.c +11 -18
index 72aab1b05265..cc33208c93ac 100644
@@ -6,24 +6,23 @@
  * Copyright (C) 2007 Felix Fietkau <[email protected]>
  * Copyright (C) 2007 John Crispin <[email protected]>
  * Copyright (C) 2010 Thomas Langer, <[email protected]>
+ * Copyright (C) 2017 Intel Corporation.
  */
 
-#include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
+#include <linux/clk.h>
 #include <linux/console.h>
-#include <linux/sysrq.h>
 #include <linux/device.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial_core.h>
-#include <linux/serial.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/io.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-#include <linux/gpio.h>
+#include <linux/serial_core.h>
+#include <linux/serial.h>
+#include <linux/sysrq.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
 
 #include <lantiq_soc.h>
 
@@ -43,7 +42,6 @@
 #define LTQ_ASC_STATE		0x0014
 #define LTQ_ASC_IRNCR		0x00F8
 #define LTQ_ASC_CLC		0x0000
-#define LTQ_ASC_ID		0x0008
 #define LTQ_ASC_PISEL		0x0004
 #define LTQ_ASC_TXFCON		0x0044
 #define LTQ_ASC_RXFCON		0x0040
@@ -51,16 +49,12 @@
 #define LTQ_ASC_BG		0x0050
 #define LTQ_ASC_FDV		0x0058
 #define LTQ_ASC_IRNEN		0x00F4
-
 #define ASC_IRNREN_TX		0x1
 #define ASC_IRNREN_RX		0x2
 #define ASC_IRNREN_ERR		0x4
-#define ASC_IRNREN_TX_BUF	0x8
 #define ASC_IRNCR_TIR		0x1
 #define ASC_IRNCR_RIR		0x2
 #define ASC_IRNCR_EIR		0x4
-
-#define ASCOPT_CSIZE		0x3
 #define TXFIFO_FL		1
 #define RXFIFO_FL		1
 #define ASCCLC_DISR		0x1
@@ -71,7 +65,6 @@
 #define ASCCON_M_7ASYNC		0x2
 #define ASCCON_ODD		0x00000020
 #define ASCCON_STP		0x00000080
-#define ASCCON_BRS		0x00000100
 #define ASCCON_FDE		0x00000200
 #define ASCCON_R		0x00008000
 #define ASCCON_FEN		0x00020000
@@ -80,7 +73,7 @@
 #define ASCSTATE_PE		0x00010000
 #define ASCSTATE_FE		0x00020000
 #define ASCSTATE_ROE		0x00080000
-#define ASCSTATE_ANY		(ASCSTATE_ROE|ASCSTATE_PE|ASCSTATE_FE)
+#define ASCSTATE_ANY		(ASCSTATE_ROE | ASCSTATE_PE | ASCSTATE_FE)
 #define ASCWHBSTATE_CLRREN	0x00000001
 #define ASCWHBSTATE_SETREN	0x00000002
 #define ASCWHBSTATE_CLRPE	0x00000004
Signature · 1 line
2.11.0
author
#26 lore raw

PATCH 7/7 tty: serial: lantiq: Add CCF support

In reply to Songjun Wu

Previous implementation uses platform-dependent API to get the clock. Those functions are not available for other SoC which uses the same IP. The CCF (Common Clock Framework) have an abstraction based APIs for clock.
Change to use CCF APIs to get clock and rate.
So that different SoCs can use the same driver.
Clocks and clock-names are updated in device tree binding.

---

 .../devicetree/bindings/serial/lantiq_asc.txt      |  15 +++
 drivers/tty/serial/Kconfig                         |   2 +-
 drivers/tty/serial/lantiq.c                        | 101 +++++++++++++++++----
 3 files changed, 98 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/serial/lantiq_asc.txt +15 -0
index 3acbd309ab9d..608f0c87a4af 100644
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: the 3 (tx rx err) interrupt numbers. The interrupt specifier
   depends on the interrupt-parent interrupt controller.
 
+Optional properties:
+- clocks: Should contain frequency clock and gate clock
+- clock-names: Should be "freq" and "asc"
+
 Example:
 
 asc1: serial@e100c00 {
@@ -14,3 +18,14 @@ asc1: serial@e100c00 {
 	interrupt-parent = <&icu0>;
 	interrupts = <112 113 114>;
 };
+
+asc0: serial@600000 {
+	compatible = "lantiq,asc";
+	reg = <0x600000 0x100000>;
+	interrupt-parent = <&gic>;
+	interrupts = <GIC_SHARED 103 IRQ_TYPE_LEVEL_HIGH>,
+	<GIC_SHARED 105 IRQ_TYPE_LEVEL_HIGH>,
+	<GIC_SHARED 106 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&pll0aclk SSX4_CLK>, <&clkgate1 GATE_URT_CLK>;
+	clock-names = "freq", "asc";
+};
drivers/tty/serial/Kconfig +1 -1
index 0f058df0b070..0f8ac5872a54 100644
@@ -1062,7 +1062,7 @@ config SERIAL_OMAP_CONSOLE
 
 config SERIAL_LANTIQ
 	bool "Lantiq serial driver"
-	depends on LANTIQ
+	depends on LANTIQ || INTEL_MIPS || COMPILE_TEST
 	select SERIAL_CORE
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON
drivers/tty/serial/lantiq.c +82 -19

205 lines not on this page · raw message

Signature · 1 line
2.11.0
#27 lore raw

Re: [PATCH 7/7] tty: serial: lantiq: Add CCF support

I love your patch! Yet something to improve:

Hi Songjun,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17 next-20180612]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Songjun-Wu/MIPS-intel-add-initial-support-for-Intel-MIPS-SoCs/20180612-134457
config: s390-allmodconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=s390

All errors (new ones prefixed by >>):

>> drivers/tty/serial/lantiq.c:28:10: fatal error: lantiq_soc.h: No such file or directory
    #include <lantiq_soc.h>
             ^~~~~~~~~~~~~~

compilation terminated.

vim +28 drivers/tty/serial/lantiq.c

2f0fc415 John Crispin 2011-04-05 26

c17405a9 Songjun Wu   2018-06-12  27  #ifndef CONFIG_COMMON_CLK
2f0fc415 John Crispin 2011-04-05 @28  #include <lantiq_soc.h>
c17405a9 Songjun Wu   2018-06-12  29  #endif

2f0fc415 John Crispin 2011-04-05 30

:::::: The code at line 28 was first introduced by commit
:::::: 2f0fc4159a6abc20b13569522c545150b99485cf SERIAL: Lantiq: Add driver for MIPS Lantiq SOCs.

:::::: TO: John Crispin <[email protected]> :::::: CC: Ralf Baechle <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#19 lore raw

Re: [PATCH 4/7] tty: serial: lantiq: Always use readl()/writel()

In reply to Songjun Wu
Quoted 5 lines · Songjun Wu

Previous implementation uses platform-dependent functions ltq_w32()/ltq_r32() to access registers. Those functions are not available for other SoC which uses the same IP.
Change to OS provided readl()/writel() and readb()/writeb(), so that different SoCs can use the same driver.

This patch consists 2 or even 3 ones:
- whitespace shuffling (indentation fixes, blank lines), I dunno if it's needed at all
- some new registers / bits
- actual switch to readl() / writel()

Please, split.

drivers/tty/serial/lantiq.c line 105

Quoted 3 lines
drivers/tty/serial/lantiq.c +3 -0
+#define asc_w32_mask(clear, set, reg)  \
+       ({ typeof(reg) reg_ = (reg);    \
+       writel((readl(reg_) & ~(clear)) | (set), reg_); })

This would be better as a static inline helper, and name is completely misleading, it doesn't mask the register bits, it _updates_ them.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#14 lore raw

Re: [PATCH 3/7] MIPS: intel: Add initial support for Intel MIPS SoCs

In reply to Songjun Wu

Hi,

Good to see this patch!

arch/mips/Kbuild.platforms platforms += cobalt · line 15

Quoted 9 lines · Songjun Wu
arch/mips/Kbuild.platforms +1 -0
index ac7ad54f984f..bcd647060f3e 100644
@@ -12,6 +12,7 @@ platforms += cobalt
 platforms += dec
 platforms += emma
 platforms += generic
+platforms += intel-mips

What are the main things preventing this from moving to the generic platform? Is it mainly the use of EVA (which generic doesn't yet support)?

Quoted 5 lines
arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h new file +0 -0
new file mode 100644
index 000000000000..3893855b60c6

...

arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h line 17

Quoted 3 lines
arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h new file +3 -0
+	/*
+	 * Get Config.K0 value and use it to program
+	 * the segmentation registers

Please can you describe (maybe with a table) the segment layout in human readable terms so the reader doesn't need to decode the SegCtl registers to understand where everything is in the virtual address space?

arch/mips/boot/dts/intel-mips/Makefile line 3

Quoted 9 lines
arch/mips/boot/dts/intel-mips/Makefile new file +3 -0
new file mode 100644
index 000000000000..b16c0081639c
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_DTB_INTEL_MIPS_GRX500)	+= easy350_anywan.dtb
+obj-y	+= $(patsubst %.dtb, %.dtb.o, $(dtb-y))

This needs updating to obj-$(CONFIG_BUILTIN_DTB) as per commit fca3aa166422 ("MIPS: dts: Avoid unneeded built-in.a in DTS dirs") in linux-next.

arch/mips/intel-mips/Makefile line 3

Quoted 9 lines
arch/mips/intel-mips/Makefile new file +3 -0
new file mode 100644
index 000000000000..9f272d06eecd
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_INTEL_MIPS)	+= prom.o irq.o time.o

You can use obj-y, since this Makefile is only included if CONFIG_INTEL_MIPS=y (i.e. via the platform-$(CONFIG_INTEL_MIPS) below).

Also please split each file onto separate "obj-y += whatever.o" lines.

arch/mips/intel-mips/Platform line 5

Quoted 11 lines
arch/mips/intel-mips/Platform new file +5 -0
new file mode 100644
index 000000000000..b34750eeaeb0
@@ -0,0 +1,11 @@
+#
+# MIPs SoC platform
+#
+
+platform-$(CONFIG_INTEL_MIPS)			+= intel-mips/

^^^ (this is what ensures the Makefile is only included for this platform)

Quoted 32 lines
arch/mips/intel-mips/irq.c new file +26 -0
new file mode 100644
index 000000000000..00637a5cdd20
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 Intel Corporation.
+ */
+#include <linux/init.h>
+#include <linux/irqchip.h>
+#include <linux/of_irq.h>
+#include <asm/irq.h>
+
+#include <asm/irq_cpu.h>
+
+void __init arch_init_irq(void)
+{
+	struct device_node *intc_node;
+
+	pr_info("EIC is %s\n", cpu_has_veic ? "on" : "off");
+	pr_info("VINT is %s\n", cpu_has_vint ? "on" : "off");
+
+	intc_node = of_find_compatible_node(NULL, NULL,
+					    "mti,cpu-interrupt-controller");
+	if (!cpu_has_veic && !intc_node)
+		mips_cpu_irq_init();
+
+	irqchip_init();
+}
+

arch/mips/intel-mips/irq.c line 36

Quoted 10 lines
arch/mips/intel-mips/irq.c new file +10 -0
+int get_c0_perfcount_int(void)
+{
+	return gic_get_c0_perfcount_int();
+}
+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
+
+unsigned int get_c0_compare_int(void)
+{
+	return gic_get_c0_compare_int();
+}

Worth having get_c0_fdc_int() too for the "Fast Debug Channel"?

Quoted 16 lines
arch/mips/intel-mips/prom.c new file +10 -0
new file mode 100644
index 000000000000..9407858ddc94
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2014 Lei Chuanhua <[email protected]>
+ * Copyright (C) 2016 Intel Corporation.
+ */
+#include <linux/init.h>
+#include <linux/export.h>
+#include <linux/of_platform.h>
+#include <linux/of_fdt.h>
+#include <linux/regmap.h>

arch/mips/intel-mips/prom.c line 20

Quoted 10 lines
arch/mips/intel-mips/prom.c new file +10 -0
+#include <linux/mfd/syscon.h>
+#include <asm/mips-cps.h>
+#include <asm/smp-ops.h>
+#include <asm/dma-coherence.h>
+#include <asm/prom.h>
+
+#define IOPORT_RESOURCE_START   0x10000000
+#define IOPORT_RESOURCE_END     0xffffffff
+#define IOMEM_RESOURCE_START    0x10000000
+#define IOMEM_RESOURCE_END      0xffffffff

The _END ones seem to be unused?

Quoted 17 lines
arch/mips/intel-mips/prom.c new file +17 -0
+static void __init prom_init_cmdline(void)
+{
+	int i;
+	int argc;
+	char **argv;
+
+	/*
+	 * If u-boot pass parameters, it is ok, however, if without u-boot
+	 * JTAG or other tool has to reset all register value before it goes
+	 * emulation most likely belongs to this category
+	 */
+	if (fw_arg0 == 0 || fw_arg1 == 0)
+		return;
+
+	argc = fw_arg0;
+	argv = (char **)KSEG1ADDR(fw_arg1);
+

arch/mips/intel-mips/prom.c line 57

Quoted 10 lines
arch/mips/intel-mips/prom.c new file +10 -0
+	arcs_cmdline[0] = '\0';
+
+	for (i = 0; i < argc; i++) {
+		char *p = (char *)KSEG1ADDR(argv[i]);
+
+		if (argv[i] && *p) {
+			strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
+			strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
+		}
+	}

Please describe the boot register protocol in the commit message and/or a comment in this function.

Is it compatible with the UHI boot protocol, such that this could potentially be converted to use the generic platform in future?

Quoted 17 lines
arch/mips/intel-mips/prom.c new file +17 -0
+}
+
+static int __init plat_enable_iocoherency(void)
+{
+	int supported = 0;
+
+	if (mips_cps_numiocu(0) != 0) {
+		/* Nothing special needs to be done to enable coherency */
+		pr_info("Coherence Manager IOCU detected\n");
+		/* Second IOCU for MPE or other master access register */
+		write_gcr_reg0_base(0xa0000000);
+		write_gcr_reg0_mask(0xf8000000 | CM_GCR_REGn_MASK_CMTGT_IOCU1);
+		supported = 1;
+	}
+
+	/* hw_coherentio = supported; */
+

arch/mips/intel-mips/prom.c line 84

Quoted 10 lines
arch/mips/intel-mips/prom.c new file +10 -0
+	return supported;
+}
+
+static void __init plat_setup_iocoherency(void)
+{
+#ifdef CONFIG_DMA_NONCOHERENT
+	/*
+	 * Kernel has been configured with software coherency
+	 * but we might choose to turn it off and use hardware
+	 * coherency instead.

That sounds a big risky. Software coherency will I think perform cache line invalidation when syncing buffers from device to CPU (see __dma_sync_virtual), so that the underlying RAM written by the supposedly incoherent DMA is visible. If its coherent afterall then it may be sat in a dirty line in the cache, and not have been written back to RAM yet before it gets invalidated?

Quoted 13 lines
arch/mips/intel-mips/prom.c new file +13 -0
+	 */
+	if (plat_enable_iocoherency()) {
+		if (coherentio == IO_COHERENCE_DISABLED)
+			pr_info("Hardware DMA cache coherency disabled\n");
+		else
+			pr_info("Hardware DMA cache coherency enabled\n");
+	} else {
+		if (coherentio == IO_COHERENCE_ENABLED)
+			pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n");
+		else
+			pr_info("Software DMA cache coherency enabled\n");
+	}
+#else

arch/mips/intel-mips/prom.c line 149

Quoted 10 lines
arch/mips/intel-mips/prom.c new file +8 -0
+	if (!plat_enable_iocoherency())
+		panic("Hardware DMA cache coherency not supported!");
+#endif
+}
 
 
+void __init device_tree_init(void)
+{
+	if (!initial_boot_params)
+		return;

Redundant check. unflatten_and_copy_device_tree() now handles that and emits a message.

arch/mips/intel-mips/prom.c line 154

Quoted 5 lines
arch/mips/intel-mips/prom.c new file +5 -0
+
+	unflatten_and_copy_device_tree();
+}
+
+#define CPC_BASE_ADDR		0x12310000

Please put this at the top of the file with other #defines.

Quoted 19 lines
arch/mips/intel-mips/prom.c new file +5 -0
+
+phys_addr_t mips_cpc_default_phys_base(void)
+{
+	return CPC_BASE_ADDR;
+}
arch/mips/intel-mips/time.c new file +7 -0
new file mode 100644
index 000000000000..77ad4014fe9d
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 Intel Corporation.
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>

arch/mips/intel-mips/time.c line 17

Quoted 10 lines
arch/mips/intel-mips/time.c new file +10 -0
+#include <linux/clocksource.h>
+#include <linux/of.h>
+
+#include <asm/time.h>
+
+static inline u32 get_counter_resolution(void)
+{
+	u32 res;
+
+	__asm__ __volatile__(".set	push\n"

Preferably each line of asm should end \n\t and the final line doesn't need \n or \t. Look at the .s compiler output to see the difference.

arch/mips/intel-mips/time.c line 19

Quoted 2 lines
arch/mips/intel-mips/time.c new file +2 -0
+			     ".set	mips32r2\n"
+			     "rdhwr	%0, $3\n"

Hmm, it'd be nice to abstract this in mipsregs.h, but that can always wait. You could use MIPS_HWR_CCRES though (i.e. off top of my head something like "%0, $%1\n" and have a "i" (MIPS_HWR_CCRES) input.

arch/mips/intel-mips/time.c line 21

Quoted 2 lines
arch/mips/intel-mips/time.c new file +2 -0
+			     ".set pop\n"
+			     : "=&r" (res)

I don't think you strictly need an early clobber there since there are no register inputs, "=r" should do fine.

arch/mips/intel-mips/time.c line 23

Quoted 2 lines
arch/mips/intel-mips/time.c new file +2 -0
+			     : /* no input */
+			     : "memory");

I don't think that operation clobbers any memory?

Thanks
James

maintainer
#2 lore raw

Re: [PATCH 1/7] MIPS: dts: Add aliases node for lantiq danube serial

In reply to Songjun Wu
Quoted 28 lines · Songjun Wu

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

 arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +4 -0
index 2dd950181f8a..7a9e15da6bd0 100644
@@ -4,6 +4,10 @@
 	#size-cells = <1>;
 	compatible = "lantiq,xway", "lantiq,danube";
 
+	aliases {
+		serial0 = &asc1;
+	};
+
 	cpus {
 		cpu@0 {
 			compatible = "mips,mips24Kc";

arch/mips/boot/dts/lantiq/danube.dtsi line 81

Quoted 5 lines
arch/mips/boot/dts/lantiq/danube.dtsi +1 -1
@@ -74,7 +78,7 @@
 			reg = <0xE100A00 0x100>;
 		};
 
-		serial@E100C00 {
+		asc1: serial@E100C00 {

Fix this to be lower case hex while you are at it.

Quoted 6 lines
arch/mips/boot/dts/lantiq/danube.dtsi +0 -0
 			compatible = "lantiq,asc";
 			reg = <0xE100C00 0x400>;
 			interrupt-parent = <&icu0>;
Signature · 1 line
2.11.0
maintainer
#16 lore raw

Re: [PATCH 3/7] MIPS: intel: Add initial support for Intel MIPS SoCs

In reply to Songjun Wu
Quoted 9 lines · Songjun Wu

From: Hua Ma <[email protected]>

Add initial support for Intel MIPS interAptiv SoCs made by Intel. This series will add support for the GRX500 family.

The series allows booting a minimal system using a initramfs.

Quoted 8 lines

---

 arch/mips/Kbuild.platforms                         |   1 +
 arch/mips/Kconfig                                  |  36 ++++
 arch/mips/boot/dts/Makefile                        |   1 +
 arch/mips/boot/dts/intel-mips/Makefile             |   3 +
 arch/mips/boot/dts/intel-mips/easy350_anywan.dts   |  20 +++
 arch/mips/boot/dts/intel-mips/xrx500.dtsi          | 196 +++++++++++++++++++++

Please split dts files to separate patch.

Quoted 6 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +0 -0
new file mode 100644
index 000000000000..40177f6cee1e

arch/mips/boot/dts/intel-mips/easy350_anywan.dts line 10

Quoted 10 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +10 -0
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/interrupt-controller/mips-gic.h>
+#include <dt-bindings/clock/intel,grx500-clk.h>
+
+#include "xrx500.dtsi"
+
+/ {
+	model = "EASY350 ANYWAN (GRX350) Main model";

A board should have a board specific compatible, too.

arch/mips/boot/dts/intel-mips/easy350_anywan.dts line 16

Quoted 6 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +6 -0
+	chosen {
+		bootargs = "earlycon=lantiq,0x16600000 clk_ignore_unused";
+		stdout-path = "serial0";
+	};
+
+	memory@0 {

memory@20000000

Quoted 10 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +4 -0
+		device_type = "memory";
+		reg = <0x20000000 0x0e000000>;
+	};
+};
arch/mips/boot/dts/intel-mips/xrx500.dtsi new file +0 -0
new file mode 100644
index 000000000000..04a068d6d96b

arch/mips/boot/dts/intel-mips/xrx500.dtsi line 6

Quoted 6 lines
arch/mips/boot/dts/intel-mips/xrx500.dtsi new file +6 -0
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "intel,xrx500";

This needs to be documented.

Quoted 190 lines
arch/mips/boot/dts/intel-mips/xrx500.dtsi new file +190 -0
+
+	aliases {
+		serial0 = &asc0;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "mti,interaptiv";
+			clocks = <&cpuclk>;
+			reg = <0>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "mti,interaptiv";
+			reg = <1>;
+		};
+	};
+
+	cpu_intc: interrupt-controller {
+		compatible = "mti,cpu-interrupt-controller";
+
+		interrupt-controller;
+		#interrupt-cells = <1>;
+	};
+
+	gic: gic@12320000 {
+		compatible = "mti,gic";
+		reg = <0x12320000 0x20000>;
+
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		/*
+		 * Declare the interrupt-parent even though the mti,gic
+		 * binding doesn't require it, such that the kernel can
+		 * figure out that cpu_intc is the root interrupt
+		 * controller & should be probed first.
+		 */
+		interrupt-parent = <&cpu_intc>;
+		mti,reserved-ipi-vectors = <56 8>;
+	};
+
+	cgu0: cgu@16200000 {
+		compatible = "syscon";
+		reg = <0x16200000 0x100000>;
+
+		clock {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			osc0: osc0 {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <40000000>;
+				clock-output-names = "osc40M";
+			};
+
+			pll0a: pll0a {
+				#clock-cells = <0>;
+				compatible = "fixed-factor-clock";
+				clock-mult = <0x3C>;
+				clock-div = <1>;
+				clocks = <&osc0>;
+				clock-output-names = "pll0a";
+			};
+
+			pll0b: pll0b {
+				#clock-cells = <0>;
+				compatible = "fixed-factor-clock";
+				clock-mult = <0x32>;
+				clock-div = <1>;
+				clocks = <&osc0>;
+				clock-output-names = "pll0b";
+			};
+
+			pll3: pll3 {
+				#clock-cells = <0>;
+				compatible = "fixed-factor-clock";
+				clock-mult = <0x64>;
+				clock-div = <1>;
+				clocks = <&osc0>;
+				clock-output-names = "lcpll3";
+			};
+
+			pll0aclk: pll0aclk {
+				#clock-cells = <1>;
+				compatible = "intel,grx500-pll0a-clk";
+				clocks = <&pll0a>;
+				reg = <0x8>;
+				clock-output-names = "cbm", "ngi",
+				"ssx4", "cpu0";
+			};
+
+			pll0bclk: pll0bclk {
+				#clock-cells = <1>;
+				compatible = "intel,grx500-pll0b-clk";
+				clocks = <&pll0b>;
+				reg = <0x38>;
+				clock-output-names = "pae", "gswip", "ddr",
+				"cpu1";
+			};
+
+			ddrphyclk: ddrphyclk {
+				#clock-cells = <0>;
+				compatible = "fixed-factor-clock";
+				clock-mult = <2>;
+				clock-div = <1>;
+				clocks = <&pll0bclk DDR_CLK>;
+				clock-output-names = "ddrphy";
+			};
+
+			pcieclk: pcieclk {
+				#clock-cells = <0>;
+				compatible = "intel,grx500-pcie-clk";
+				clocks = <&pll3>;
+				reg = <0x98>;
+				clock-output-names = "pcie";
+			};
+
+			cpuclk: cpuclk {
+				#clock-cells = <0>;
+				compatible = "intel,grx500-cpu-clk";
+				clocks = <&pll0aclk CPU0_CLK>,
+				<&pll0bclk CPU1_CLK>;
+				reg = <0x8>;
+				clock-output-names = "cpu";
+			};
+
+			clkgate0: clkgate0 {
+				#clock-cells = <1>;
+				compatible = "intel,grx500-gate0-clk";
+				reg = <0x114>;
+				clock-output-names = "gate_xbar0", "gate_xbar1",
+				"gate_xbar2", "gate_xbar3", "gate_xbar6",
+				"gate_xbar7";
+			};
+
+			clkgate1: clkgate1 {
+				#clock-cells = <1>;
+				compatible = "intel,grx500-gate1-clk";
+				reg = <0x120>;
+				clock-output-names = "gate_vcodec", "gate_dma0",
+				"gate_usb0", "gate_spi1", "gate_spi0",
+				"gate_cbm", "gate_ebu", "gate_sso",
+				"gate_gptc0", "gate_gptc1", "gate_gptc2",
+				"gate_urt", "gate_eip97", "gate_eip123",
+				"gate_toe", "gate_mpe", "gate_tdm", "gate_pae",
+				"gate_usb1", "gate_gswip";
+			};
+
+			clkgate2: clkgate2 {
+				#clock-cells = <1>;
+				compatible = "intel,grx500-gate2-clk";
+				reg = <0x130>;
+				clock-output-names = "gate_pcie0", "gate_pcie1",
+				"gate_pcie2";
+			};
+
+			voiceclk: voiceclk {
+				#clock-cells = <0>;
+				compatible = "intel,grx500-voice-clk";
+				clock-frequency = <8192000>;
+				reg = <0xc4>;
+				clock-output-names = "voice";
+			};
+
+			i2cclk: i2cclk {
+				#clock-cells = <0>;
+				compatible = "intel,grx500-gate-dummy-clk";
+				clock-output-names = "gate_i2c";
+			};
+		};
+	};
+
+	asc0: serial@16600000 {
+		compatible = "lantiq,asc";
+		reg = <0x16600000 0x100000>;
+
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_SHARED 103 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SHARED 105 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SHARED 106 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&pll0aclk SSX4_CLK>, <&clkgate1 GATE_URT_CLK>;
+		clock-names = "freq", "asc";
+	};
+};
maintainer
#9 lore raw

Re: [PATCH 2/7] clk: intel: Add clock driver for GRX500 SoC

In reply to Songjun Wu
Quoted 22 lines · Songjun Wu

From: Yixin Zhu <[email protected]>

PLL of GRX500 provide clock to DDR, CPU, and peripherals as show below

                 +---------+
	    |--->| LCPLL3 0|--PCIe clk-->
   XO       |    +---------+
+-----------|
            |    +---------+
            |    |        3|--PAE clk-->
            |--->| PLL0B  2|--GSWIP clk-->
            |    |        1|--DDR clk-->DDR PHY clk-->
            |    |        0|--CPU1 clk--+   +-----+
            |    +---------+            |--->0    |
            |                               | MUX |--CPU clk-->
            |    +---------+            |--->1    |
            |    |        0|--CPU0 clk--+   +-----+
            |--->| PLLOA  1|--SSX4 clk-->
                 |        2|--NGI clk-->
                 |        3|--CBM clk-->
                 +---------+
Quoted 7 lines

VCO of all PLLs of GRX500 is not supposed to be reprogrammed. DDR PHY clock is created to show correct clock rate in software point of view.
CPU clock of 1Ghz from PLL0B otherwise from PLL0A.

Need a blank line before the SoB's and not one in the middle.

Quoted 3 lines

---

 .../devicetree/bindings/clock/intel,grx500-clk.txt |  46 ++

Please split bindings to separate patch.

Quoted 23 lines
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/intel/Kconfig                          |  21 +
 drivers/clk/intel/Makefile                         |   7 +
 drivers/clk/intel/clk-cgu-api.c                    | 676 +++++++++++++++++++++
 drivers/clk/intel/clk-cgu-api.h                    | 120 ++++
 drivers/clk/intel/clk-grx500.c                     | 236 +++++++
 include/dt-bindings/clock/intel,grx500-clk.h       |  61 ++
 9 files changed, 1169 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/intel,grx500-clk.txt
 create mode 100644 drivers/clk/intel/Kconfig
 create mode 100644 drivers/clk/intel/Makefile
 create mode 100644 drivers/clk/intel/clk-cgu-api.c
 create mode 100644 drivers/clk/intel/clk-cgu-api.h
 create mode 100644 drivers/clk/intel/clk-grx500.c
 create mode 100644 include/dt-bindings/clock/intel,grx500-clk.h
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +0 -0
new file mode 100644
index 000000000000..dd761d900dc9

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +10 -0
@@ -0,0 +1,46 @@
+Device Tree Clock bindings for GRX500 PLL controller.
+
+This binding uses the common clock binding:
+	Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+This GRX500 PLL controller provides the 5 main clock domain of the SoC: CPU/DDR, XBAR,
+Voice, WLAN, PCIe and gate clocks for HW modules.
+
+Required properties for osc clock node
+- compatible: Should be intel,grx500-xxx-clk

These would need to be enumerated with all possible values. However, see below.

Quoted 26 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +26 -0
+- reg: offset address of the controller memory area.
+- clocks: phandle of the external reference clock
+- #clock-cells: can be one or zero.
+- clock-output-names: Names of the output clocks.
+
+Example:
+	pll0aclk: pll0aclk {
+		#clock-cells = <1>;
+		compatible = "intel,grx500-pll0a-clk";
+		clocks = <&pll0a>;
+		reg = <0x8>;
+		clock-output-names = "cbmclk", "ngiclk", "ssx4clk", "cpu0clk";
+	};
+
+	cpuclk: cpuclk {
+		#clock-cells = <0>;
+		compatible = "intel,grx500-cpu-clk";
+		clocks = <&pll0aclk CPU0_CLK>, <&pll0bclk CPU1_CLK>;
+		reg = <0x8>;
+		clock-output-names = "cpu";
+	};
+
+Required properties for gate node:
+- compatible: Should be intel,grx500-gatex-clk
+- reg: offset address of the controller memory area.
+- #clock-cells: Should be <1>

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt line 46

Quoted 10 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +10 -0
+- clock-output-names: Names of the output clocks.
+
+Example:
+	clkgate0: clkgate0 {
+		#clock-cells = <1>;
+		compatible = "intel,grx500-gate0-clk";
+		reg = <0x114>;
+		clock-output-names = "gate_xbar0", "gate_xbar1", "gate_xbar2",
+		"gate_xbar3", "gate_xbar6", "gate_xbar7";
+	};

We generally don't do a clock node per clock or few clocks but rather 1 clock node per clock controller block. See any recent clock bindings.

Rob

maintainer
#28 lore raw

Re: [PATCH 7/7] tty: serial: lantiq: Add CCF support

In reply to Songjun Wu
Quoted 8 lines · Songjun Wu

Previous implementation uses platform-dependent API to get the clock. Those functions are not available for other SoC which uses the same IP. The CCF (Common Clock Framework) have an abstraction based APIs for clock.
Change to use CCF APIs to get clock and rate.
So that different SoCs can use the same driver.
Clocks and clock-names are updated in device tree binding.

Quoted 5 lines

---

 .../devicetree/bindings/serial/lantiq_asc.txt      |  15 +++

Please split bindings to separate patch.

Quoted 20 lines
 drivers/tty/serial/Kconfig                         |   2 +-
 drivers/tty/serial/lantiq.c                        | 101 +++++++++++++++++----
 3 files changed, 98 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/serial/lantiq_asc.txt +4 -0
index 3acbd309ab9d..608f0c87a4af 100644
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: the 3 (tx rx err) interrupt numbers. The interrupt specifier
   depends on the interrupt-parent interrupt controller.
 
+Optional properties:
+- clocks: Should contain frequency clock and gate clock
+- clock-names: Should be "freq" and "asc"
+
 Example:
 
 asc1: serial@e100c00 {

Documentation/devicetree/bindings/serial/lantiq_asc.txt asc1: serial@e100c00 { · line 24

Quoted 7 lines
Documentation/devicetree/bindings/serial/lantiq_asc.txt +4 -0
@@ -14,3 +18,14 @@ asc1: serial@e100c00 {
 	interrupt-parent = <&icu0>;
 	interrupts = <112 113 114>;
 };
+
+asc0: serial@600000 {
+	compatible = "lantiq,asc";
+	reg = <0x600000 0x100000>;

1MB of address space? That wastes a lot of virtual space on 32-bit systems. Just make the size the actual used range.

Quoted 7 lines
Documentation/devicetree/bindings/serial/lantiq_asc.txt +7 -0
+	interrupt-parent = <&gic>;
+	interrupts = <GIC_SHARED 103 IRQ_TYPE_LEVEL_HIGH>,
+	<GIC_SHARED 105 IRQ_TYPE_LEVEL_HIGH>,
+	<GIC_SHARED 106 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&pll0aclk SSX4_CLK>, <&clkgate1 GATE_URT_CLK>;
+	clock-names = "freq", "asc";
+};
#3 lore raw

Re: [PATCH 1/7] MIPS: dts: Add aliases node for lantiq danube serial

In reply to Rob Herring
Quoted 32 lines · Rob Herring
Quoted 31 lines · Songjun Wu

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

  arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +4 -0
index 2dd950181f8a..7a9e15da6bd0 100644
@@ -4,6 +4,10 @@
  	#size-cells = <1>;
  	compatible = "lantiq,xway", "lantiq,danube";
 
+	aliases {
+		serial0 = &asc1;
+	};
+
  	cpus {
  		cpu@0 {
  			compatible = "mips,mips24Kc";
@@ -74,7 +78,7 @@
  			reg = <0xE100A00 0x100>;
  		};
 
Quoted 3 lines

arch/mips/boot/dts/lantiq/danube.dtsi line 81

Quoted 2 lines
arch/mips/boot/dts/lantiq/danube.dtsi +1 -1
-		serial@E100C00 {
+		asc1: serial@E100C00 {

Fix this to be lower case hex while you are at it.

Thanks.
All the upper case in unit-address and hex constants will be changed to lower case according to the Linux conventions.

Quoted 7 lines
Quoted 7 lines
arch/mips/boot/dts/lantiq/danube.dtsi +0 -0
  			compatible = "lantiq,asc";
  			reg = <0xE100C00 0x400>;
  			interrupt-parent = <&icu0>;
Signature · 1 line
2.11.0
#29 lore raw

Re: [PATCH 7/7] tty: serial: lantiq: Add CCF support

In reply to Rob Herring
Quoted 9 lines · Rob Herring
Quoted 8 lines · Songjun Wu

Previous implementation uses platform-dependent API to get the clock. Those functions are not available for other SoC which uses the same IP. The CCF (Common Clock Framework) have an abstraction based APIs for clock.
Change to use CCF APIs to get clock and rate.
So that different SoCs can use the same driver.
Clocks and clock-names are updated in device tree binding.

Quoted 6 lines
Quoted 5 lines

---

  .../devicetree/bindings/serial/lantiq_asc.txt      |  15 +++

Please split bindings to separate patch.

Thanks.
It will be split to two separate patches, one for bindings, the other for code.

Quoted 18 lines
Quoted 18 lines
  drivers/tty/serial/Kconfig                         |   2 +-
  drivers/tty/serial/lantiq.c                        | 101 +++++++++++++++++----
  3 files changed, 98 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/serial/lantiq_asc.txt +4 -0
index 3acbd309ab9d..608f0c87a4af 100644
@@ -6,6 +6,10 @@ Required properties:
  - interrupts: the 3 (tx rx err) interrupt numbers. The interrupt specifier
    depends on the interrupt-parent interrupt controller.
 
+Optional properties:
+- clocks: Should contain frequency clock and gate clock
+- clock-names: Should be "freq" and "asc"
+
  Example:
 
Quoted 11 lines

Documentation/devicetree/bindings/serial/lantiq_asc.txt asc1: serial@e100c00 { · line 24

Quoted 9 lines
Documentation/devicetree/bindings/serial/lantiq_asc.txt +4 -0
  asc1: serial@e100c00 {
@@ -14,3 +18,14 @@ asc1: serial@e100c00 {
  	interrupt-parent = <&icu0>;
  	interrupts = <112 113 114>;
  };
+
+asc0: serial@600000 {
+	compatible = "lantiq,asc";
+	reg = <0x600000 0x100000>;

1MB of address space? That wastes a lot of virtual space on 32-bit systems. Just make the size the actual used range.

The size of address space will be updated to the actual used range.

Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/serial/lantiq_asc.txt +7 -0
+	interrupt-parent = <&gic>;
+	interrupts = <GIC_SHARED 103 IRQ_TYPE_LEVEL_HIGH>,
+	<GIC_SHARED 105 IRQ_TYPE_LEVEL_HIGH>,
+	<GIC_SHARED 106 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&pll0aclk SSX4_CLK>, <&clkgate1 GATE_URT_CLK>;
+	clock-names = "freq", "asc";
+};
#20 lore raw

Re: [PATCH 4/7] tty: serial: lantiq: Always use readl()/writel()

In reply to Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Songjun Wu

Previous implementation uses platform-dependent functions ltq_w32()/ltq_r32() to access registers. Those functions are not available for other SoC which uses the same IP.
Change to OS provided readl()/writel() and readb()/writeb(), so that different SoCs can use the same driver.

Quoted 7 lines

This patch consists 2 or even 3 ones:
- whitespace shuffling (indentation fixes, blank lines), I dunno if it's needed at all
- some new registers / bits
- actual switch to readl() / writel()

Please, split.

It will be split to four patches, coding style, new registers, readl()/writel() and asc_update_bits.

Quoted 5 lines

drivers/tty/serial/lantiq.c line 105

Quoted 3 lines
drivers/tty/serial/lantiq.c +3 -0
+#define asc_w32_mask(clear, set, reg)  \
+       ({ typeof(reg) reg_ = (reg);    \
+       writel((readl(reg_) & ~(clear)) | (set), reg_); })

This would be better as a static inline helper, and name is completely misleading, it doesn't mask the register bits, it _updates_ them.

It will be changed to asc_update_bits.

#17 lore raw

Re: [PATCH 3/7] MIPS: intel: Add initial support for Intel MIPS SoCs

In reply to Rob Herring
Quoted 12 lines · Rob Herring
Quoted 11 lines · Songjun Wu

From: Hua Ma <[email protected]>

Add initial support for Intel MIPS interAptiv SoCs made by Intel. This series will add support for the GRX500 family.

The series allows booting a minimal system using a initramfs.

---

Quoted 7 lines
Quoted 6 lines
  arch/mips/Kbuild.platforms                         |   1 +
  arch/mips/Kconfig                                  |  36 ++++
  arch/mips/boot/dts/Makefile                        |   1 +
  arch/mips/boot/dts/intel-mips/Makefile             |   3 +
  arch/mips/boot/dts/intel-mips/easy350_anywan.dts   |  20 +++
  arch/mips/boot/dts/intel-mips/xrx500.dtsi          | 196 +++++++++++++++++++++

Please split dts files to separate patch.

Thanks,
it will be split into separate patches: one for dts, one for mips codes and one for the document.

Quoted 9 lines
Quoted 9 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +3 -0
new file mode 100644
index 000000000000..40177f6cee1e
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
Quoted 8 lines

arch/mips/boot/dts/intel-mips/easy350_anywan.dts line 10

Quoted 7 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +7 -0
+#include <dt-bindings/interrupt-controller/mips-gic.h>
+#include <dt-bindings/clock/intel,grx500-clk.h>
+
+#include "xrx500.dtsi"
+
+/ {
+	model = "EASY350 ANYWAN (GRX350) Main model";

A board should have a board specific compatible, too.

The board compatible will be added.

Quoted 8 lines

arch/mips/boot/dts/intel-mips/easy350_anywan.dts line 16

Quoted 7 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +6 -0
+	chosen {
+		bootargs = "earlycon=lantiq,0x16600000 clk_ignore_unused";
+		stdout-path = "serial0";
+	};
+
+	memory@0 {

memory@20000000

The memory address will be changed to @20000000.

Quoted 10 lines
Quoted 10 lines
arch/mips/boot/dts/intel-mips/easy350_anywan.dts new file +4 -0
+		device_type = "memory";
+		reg = <0x20000000 0x0e000000>;
+	};
+};
arch/mips/boot/dts/intel-mips/xrx500.dtsi new file +0 -0
new file mode 100644
index 000000000000..04a068d6d96b
Quoted 8 lines

arch/mips/boot/dts/intel-mips/xrx500.dtsi line 6

Quoted 7 lines
arch/mips/boot/dts/intel-mips/xrx500.dtsi new file +6 -0
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "intel,xrx500";

This needs to be documented.

The compatible will be updated in the document.

#10 lore raw

Re: [PATCH 2/7] clk: intel: Add clock driver for GRX500 SoC

In reply to Rob Herring
Quoted 29 lines · Rob Herring
Quoted 28 lines · Songjun Wu

From: Yixin Zhu <[email protected]>

PLL of GRX500 provide clock to DDR, CPU, and peripherals as show below

                  +---------+
	    |--->| LCPLL3 0|--PCIe clk-->
    XO       |    +---------+
+-----------|
             |    +---------+
             |    |        3|--PAE clk-->
             |--->| PLL0B  2|--GSWIP clk-->
             |    |        1|--DDR clk-->DDR PHY clk-->
             |    |        0|--CPU1 clk--+   +-----+
             |    +---------+            |--->0    |
             |                               | MUX |--CPU clk-->
             |    +---------+            |--->1    |
             |    |        0|--CPU0 clk--+   +-----+
             |--->| PLLOA  1|--SSX4 clk-->
                  |        2|--NGI clk-->
                  |        3|--CBM clk-->
                  +---------+

VCO of all PLLs of GRX500 is not supposed to be reprogrammed. DDR PHY clock is created to show correct clock rate in software point of view.
CPU clock of 1Ghz from PLL0B otherwise from PLL0A.

Quoted 3 lines
Quoted 1 line

Need a blank line before the SoB's and not one in the middle.

Thanks.
Blank line in the middle of sign-off will be removed. A new blank line will be added before SoB's.

Quoted 35 lines
Quoted 4 lines

---

  .../devicetree/bindings/clock/intel,grx500-clk.txt |  46 ++

Please split bindings to separate patch.

Quoted 28 lines
  drivers/clk/Kconfig                                |   1 +
  drivers/clk/Makefile                               |   1 +
  drivers/clk/intel/Kconfig                          |  21 +
  drivers/clk/intel/Makefile                         |   7 +
  drivers/clk/intel/clk-cgu-api.c                    | 676 +++++++++++++++++++++
  drivers/clk/intel/clk-cgu-api.h                    | 120 ++++
  drivers/clk/intel/clk-grx500.c                     | 236 +++++++
  include/dt-bindings/clock/intel,grx500-clk.h       |  61 ++
  9 files changed, 1169 insertions(+)

create mode 100644 Documentation/devicetree/bindings/clock/intel,grx500-clk.txt create mode 100644 drivers/clk/intel/Kconfig
create mode 100644 drivers/clk/intel/Makefile
create mode 100644 drivers/clk/intel/clk-cgu-api.c
create mode 100644 drivers/clk/intel/clk-cgu-api.h
create mode 100644 drivers/clk/intel/clk-grx500.c
create mode 100644 include/dt-bindings/clock/intel,grx500-clk.h

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +5 -0
new file mode 100644
index 000000000000..dd761d900dc9
@@ -0,0 +1,46 @@
+Device Tree Clock bindings for GRX500 PLL controller.
+
+This binding uses the common clock binding:
+	Documentation/devicetree/bindings/clock/clock-bindings.txt
+
Quoted 8 lines

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt line 10

Quoted 5 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +5 -0
+This GRX500 PLL controller provides the 5 main clock domain of the SoC: CPU/DDR, XBAR,
+Voice, WLAN, PCIe and gate clocks for HW modules.
+
+Required properties for osc clock node
+- compatible: Should be intel,grx500-xxx-clk

These would need to be enumerated with all possible values. However, see below.

All possible values will be listed.

Quoted 41 lines
Quoted 27 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +26 -0
+- reg: offset address of the controller memory area.
+- clocks: phandle of the external reference clock
+- #clock-cells: can be one or zero.
+- clock-output-names: Names of the output clocks.
+
+Example:
+	pll0aclk: pll0aclk {
+		#clock-cells = <1>;
+		compatible = "intel,grx500-pll0a-clk";
+		clocks = <&pll0a>;
+		reg = <0x8>;
+		clock-output-names = "cbmclk", "ngiclk", "ssx4clk", "cpu0clk";
+	};
+
+	cpuclk: cpuclk {
+		#clock-cells = <0>;
+		compatible = "intel,grx500-cpu-clk";
+		clocks = <&pll0aclk CPU0_CLK>, <&pll0bclk CPU1_CLK>;
+		reg = <0x8>;
+		clock-output-names = "cpu";
+	};
+
+Required properties for gate node:
+- compatible: Should be intel,grx500-gatex-clk
+- reg: offset address of the controller memory area.
+- #clock-cells: Should be <1>

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt line 46

Quoted 10 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +10 -0
+- clock-output-names: Names of the output clocks.
+
+Example:
+	clkgate0: clkgate0 {
+		#clock-cells = <1>;
+		compatible = "intel,grx500-gate0-clk";
+		reg = <0x114>;
+		clock-output-names = "gate_xbar0", "gate_xbar1", "gate_xbar2",
+		"gate_xbar3", "gate_xbar6", "gate_xbar7";
+	};

We generally don't do a clock node per clock or few clocks but rather 1 clock node per clock controller block. See any recent clock bindings.

Quoted 1 line

Rob

Do you mean only one example is needed per clock controller block? cpuclk is not needed in the document?

#15 lore raw

Re: [PATCH 3/7] MIPS: intel: Add initial support for Intel MIPS SoCs

In reply to James Hogan
Quoted 5 lines · James Hogan

Hi,

Good to see this patch!

On Tue, Jun 12, 2018 at 01:40:30PM +0800, Songjun Wu wrote:

Quoted 14 lines

arch/mips/Kbuild.platforms platforms += cobalt · line 15

Quoted 9 lines
arch/mips/Kbuild.platforms +1 -0
index ac7ad54f984f..bcd647060f3e 100644
@@ -12,6 +12,7 @@ platforms += cobalt
  platforms += dec
  platforms += emma
  platforms += generic
+platforms += intel-mips

What are the main things preventing this from moving to the generic platform? Is it mainly the use of EVA (which generic doesn't yet support)?

Yes. It's mainly because of EVA.

Quoted 6 lines
Quoted 5 lines
arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h new file +0 -0
new file mode 100644
index 000000000000..3893855b60c6

...

Quoted 8 lines

arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h line 17

Quoted 3 lines
arch/mips/include/asm/mach-intel-mips/kernel-entry-init.h new file +3 -0
+	/*
+	 * Get Config.K0 value and use it to program
+	 * the segmentation registers

Please can you describe (maybe with a table) the segment layout in human readable terms so the reader doesn't need to decode the SegCtl registers to understand where everything is in the virtual address space?

Will add detailed EVA mapping description in code comments.

Quoted 27 lines

arch/mips/boot/dts/intel-mips/Makefile line 3

Quoted 9 lines
arch/mips/boot/dts/intel-mips/Makefile new file +3 -0
new file mode 100644
index 000000000000..b16c0081639c
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_DTB_INTEL_MIPS_GRX500)	+= easy350_anywan.dtb
+obj-y	+= $(patsubst %.dtb, %.dtb.o, $(dtb-y))

This needs updating to obj-$(CONFIG_BUILTIN_DTB) as per commit fca3aa166422 ("MIPS: dts: Avoid unneeded built-in.a in DTS dirs") in linux-next.

arch/mips/intel-mips/Makefile line 3

Quoted 9 lines
arch/mips/intel-mips/Makefile new file +3 -0
new file mode 100644
index 000000000000..9f272d06eecd
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_INTEL_MIPS)	+= prom.o irq.o time.o

You can use obj-y, since this Makefile is only included if CONFIG_INTEL_MIPS=y (i.e. via the platform-$(CONFIG_INTEL_MIPS) below).

Quoted 2 lines

Also please split each file onto separate "obj-y += whatever.o" lines.

Will use obj-y.
Will split it into per line per .o.

Quoted 51 lines

arch/mips/intel-mips/Platform line 5

Quoted 11 lines
arch/mips/intel-mips/Platform new file +5 -0
new file mode 100644
index 000000000000..b34750eeaeb0
@@ -0,0 +1,11 @@
+#
+# MIPs SoC platform
+#
+
+platform-$(CONFIG_INTEL_MIPS)			+= intel-mips/

^^^ (this is what ensures the Makefile is only included for this platform)

Quoted 36 lines
arch/mips/intel-mips/irq.c new file +30 -0
new file mode 100644
index 000000000000..00637a5cdd20
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 Intel Corporation.
+ */
+#include <linux/init.h>
+#include <linux/irqchip.h>
+#include <linux/of_irq.h>
+#include <asm/irq.h>
+
+#include <asm/irq_cpu.h>
+
+void __init arch_init_irq(void)
+{
+	struct device_node *intc_node;
+
+	pr_info("EIC is %s\n", cpu_has_veic ? "on" : "off");
+	pr_info("VINT is %s\n", cpu_has_vint ? "on" : "off");
+
+	intc_node = of_find_compatible_node(NULL, NULL,
+					    "mti,cpu-interrupt-controller");
+	if (!cpu_has_veic && !intc_node)
+		mips_cpu_irq_init();
+
+	irqchip_init();
+}
+
+int get_c0_perfcount_int(void)
+{
+	return gic_get_c0_perfcount_int();
+}
Quoted 9 lines

arch/mips/intel-mips/irq.c line 36

Quoted 6 lines
arch/mips/intel-mips/irq.c new file +6 -0
+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
+
+unsigned int get_c0_compare_int(void)
+{
+	return gic_get_c0_compare_int();
+}

Worth having get_c0_fdc_int() too for the "Fast Debug Channel"?

FDC not used in our product.

Quoted 20 lines
Quoted 20 lines
arch/mips/intel-mips/prom.c new file +14 -0
new file mode 100644
index 000000000000..9407858ddc94
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2014 Lei Chuanhua <[email protected]>
+ * Copyright (C) 2016 Intel Corporation.
+ */
+#include <linux/init.h>
+#include <linux/export.h>
+#include <linux/of_platform.h>
+#include <linux/of_fdt.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <asm/mips-cps.h>
+#include <asm/smp-ops.h>
+#include <asm/dma-coherence.h>
Quoted 9 lines

arch/mips/intel-mips/prom.c line 20

Quoted 6 lines
arch/mips/intel-mips/prom.c new file +6 -0
+#include <asm/prom.h>
+
+#define IOPORT_RESOURCE_START   0x10000000
+#define IOPORT_RESOURCE_END     0xffffffff
+#define IOMEM_RESOURCE_START    0x10000000
+#define IOMEM_RESOURCE_END      0xffffffff

The _END ones seem to be unused?

Will remove unused _END macros.

Quoted 32 lines
Quoted 17 lines
arch/mips/intel-mips/prom.c new file +17 -0
+static void __init prom_init_cmdline(void)
+{
+	int i;
+	int argc;
+	char **argv;
+
+	/*
+	 * If u-boot pass parameters, it is ok, however, if without u-boot
+	 * JTAG or other tool has to reset all register value before it goes
+	 * emulation most likely belongs to this category
+	 */
+	if (fw_arg0 == 0 || fw_arg1 == 0)
+		return;
+
+	argc = fw_arg0;
+	argv = (char **)KSEG1ADDR(fw_arg1);
+

arch/mips/intel-mips/prom.c line 57

Quoted 10 lines
arch/mips/intel-mips/prom.c new file +10 -0
+	arcs_cmdline[0] = '\0';
+
+	for (i = 0; i < argc; i++) {
+		char *p = (char *)KSEG1ADDR(argv[i]);
+
+		if (argv[i] && *p) {
+			strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
+			strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
+		}
+	}

Please describe the boot register protocol in the commit message and/or a comment in this function.
Will add boot register protocol description in code comment.

Quoted 3 lines

Is it compatible with the UHI boot protocol, such that this could potentially be converted to use the generic platform in future?

It is compatible with the UHI boot protocol.

Quoted 26 lines
Quoted 26 lines
arch/mips/intel-mips/prom.c new file +26 -0
+}
+
+static int __init plat_enable_iocoherency(void)
+{
+	int supported = 0;
+
+	if (mips_cps_numiocu(0) != 0) {
+		/* Nothing special needs to be done to enable coherency */
+		pr_info("Coherence Manager IOCU detected\n");
+		/* Second IOCU for MPE or other master access register */
+		write_gcr_reg0_base(0xa0000000);
+		write_gcr_reg0_mask(0xf8000000 | CM_GCR_REGn_MASK_CMTGT_IOCU1);
+		supported = 1;
+	}
+
+	/* hw_coherentio = supported; */
+
+	return supported;
+}
+
+static void __init plat_setup_iocoherency(void)
+{
+#ifdef CONFIG_DMA_NONCOHERENT
+	/*
+	 * Kernel has been configured with software coherency
+	 * but we might choose to turn it off and use hardware
Quoted 9 lines

arch/mips/intel-mips/prom.c line 84

Quoted 1 line
arch/mips/intel-mips/prom.c new file +1 -0
+	 * coherency instead.

That sounds a big risky. Software coherency will I think perform cache line invalidation when syncing buffers from device to CPU (see __dma_sync_virtual), so that the underlying RAM written by the supposedly incoherent DMA is visible. If its coherent afterall then it may be sat in a dirty line in the cache, and not have been written back to RAM yet before it gets invalidated?

The comment in code is not accurate.
HW coherence is not supported and software coherence is always enabled. Will correct the comments and clean the code.

Quoted 19 lines
Quoted 17 lines
arch/mips/intel-mips/prom.c new file +17 -0
+	 */
+	if (plat_enable_iocoherency()) {
+		if (coherentio == IO_COHERENCE_DISABLED)
+			pr_info("Hardware DMA cache coherency disabled\n");
+		else
+			pr_info("Hardware DMA cache coherency enabled\n");
+	} else {
+		if (coherentio == IO_COHERENCE_ENABLED)
+			pr_info("Hardware DMA cache coherency unsupported, but enabled from command line!\n");
+		else
+			pr_info("Software DMA cache coherency enabled\n");
+	}
+#else
+	if (!plat_enable_iocoherency())
+		panic("Hardware DMA cache coherency not supported!");
+#endif
+}
Quoted 8 lines

arch/mips/intel-mips/prom.c line 149

Quoted 4 lines
arch/mips/intel-mips/prom.c new file +4 -0
+void __init device_tree_init(void)
+{
+	if (!initial_boot_params)
+		return;

Redundant check. unflatten_and_copy_device_tree() now handles that and emits a message.

Will remove the redundant check.

Quoted 8 lines

arch/mips/intel-mips/prom.c line 154

Quoted 5 lines
arch/mips/intel-mips/prom.c new file +5 -0
+
+	unflatten_and_copy_device_tree();
+}
+
+#define CPC_BASE_ADDR		0x12310000

Please put this at the top of the file with other #defines.

Will move this to the top with other #defines.

Quoted 46 lines
Quoted 19 lines
arch/mips/intel-mips/prom.c new file +5 -0
+
+phys_addr_t mips_cpc_default_phys_base(void)
+{
+	return CPC_BASE_ADDR;
+}
arch/mips/intel-mips/time.c new file +7 -0
new file mode 100644
index 000000000000..77ad4014fe9d
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 Intel Corporation.
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>

arch/mips/intel-mips/time.c line 17

Quoted 10 lines
arch/mips/intel-mips/time.c new file +10 -0
+#include <linux/clocksource.h>
+#include <linux/of.h>
+
+#include <asm/time.h>
+
+static inline u32 get_counter_resolution(void)
+{
+	u32 res;
+
+	__asm__ __volatile__(".set	push\n"

Preferably each line of asm should end \n\t and the final line doesn't need \n or \t. Look at the .s compiler output to see the difference.

arch/mips/intel-mips/time.c line 19

Quoted 2 lines
arch/mips/intel-mips/time.c new file +2 -0
+			     ".set	mips32r2\n"
+			     "rdhwr	%0, $3\n"

Hmm, it'd be nice to abstract this in mipsregs.h, but that can always wait. You could use MIPS_HWR_CCRES though (i.e. off top of my head something like "%0, $%1\n" and have a "i" (MIPS_HWR_CCRES) input.

arch/mips/intel-mips/time.c line 21

Quoted 2 lines
arch/mips/intel-mips/time.c new file +2 -0
+			     ".set pop\n"
+			     : "=&r" (res)

I don't think you strictly need an early clobber there since there are no register inputs, "=r" should do fine.

Quoted 5 lines

arch/mips/intel-mips/time.c line 23

Quoted 2 lines
arch/mips/intel-mips/time.c new file +2 -0
+			     : /* no input */
+			     : "memory");

I don't think that operation clobbers any memory?

Will replace the assembly code with fixed value 2 as the chip resolution is the half of the clock.

Quoted 3 lines

Thanks
James

Thanks
Yixin

#4 lore raw

Re: [PATCH 1/7] MIPS: dts: Add aliases node for lantiq danube serial

In reply to Songjun Wu
Quoted 17 lines · Songjun Wu

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

 arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +0 -0
index 2dd950181f8a..7a9e15da6bd0 100644

arch/mips/boot/dts/lantiq/danube.dtsi line 10

Quoted 7 lines
arch/mips/boot/dts/lantiq/danube.dtsi +4 -0
@@ -4,6 +4,10 @@
        #size-cells = <1>;
        compatible = "lantiq,xway", "lantiq,danube";
 
+       aliases {
+               serial0 = &asc1;
+       };
+

You generally want the aliases to be part of the board specific file, not every board numbers their serial ports in the same way.

Arnd

#21 lore raw

Re: [PATCH 4/7] tty: serial: lantiq: Always use readl()/writel()

In reply to Songjun Wu
Quoted 7 lines · Songjun Wu

Previous implementation uses platform-dependent functions ltq_w32()/ltq_r32() to access registers. Those functions are not available for other SoC which uses the same IP.
Change to OS provided readl()/writel() and readb()/writeb(), so that different SoCs can use the same driver.

Are there any big-endian machines using this driver? The original definition of ltq_r32() uses non-byteswapping __raw_readl() etc, which suggests that the registers might be wired up in a way that matches the CPU endianess (this is usally a bad idea in hardware design, but nothing we can influence in the OS).

When you change it to readl(), that will breaks all machines that rely on the old behavior on big-endian kernels.

Arnd

maintainer
#11 lore raw

Re: [PATCH 2/7] clk: intel: Add clock driver for GRX500 SoC

In reply to yixin zhu
Quoted 9 lines · yixin zhu
Quoted 6 lines · Rob Herring
Quoted 4 lines · Songjun Wu

From: Yixin Zhu <[email protected]>

PLL of GRX500 provide clock to DDR, CPU, and peripherals as show below

[...]

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +6 -0
+Example:
+       clkgate0: clkgate0 {
+               #clock-cells = <1>;
+               compatible = "intel,grx500-gate0-clk";
+               reg = <0x114>;
+               clock-output-names = "gate_xbar0", "gate_xbar1",

"gate_xbar2",

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +2 -0
+               "gate_xbar3", "gate_xbar6", "gate_xbar7";
+       };
Quoted 7 lines
Quoted 4 lines

We generally don't do a clock node per clock or few clocks but rather 1 clock node per clock controller block. See any recent clock bindings.

Rob

Do you mean only one example is needed per clock controller block? cpuclk is not needed in the document?

No, I mean generally we have 1 DT node for the h/w block with all the clock control registers rather than nodes with a single register and 1 or a couple of clocks. Sometimes the clock registers are mixed with other functions which complicates things a bit. But I can't tell that here because you haven't documented what's in the rest of the register space.

Rob

#22 lore raw

Re: [PATCH 4/7] tty: serial: lantiq: Always use readl()/writel()

In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann
Quoted 7 lines · Songjun Wu

Previous implementation uses platform-dependent functions ltq_w32()/ltq_r32() to access registers. Those functions are not available for other SoC which uses the same IP.
Change to OS provided readl()/writel() and readb()/writeb(), so that different SoCs can use the same driver.

Are there any big-endian machines using this driver? The original definition of ltq_r32() uses non-byteswapping __raw_readl() etc, which suggests that the registers might be wired up in a way that matches the CPU endianess (this is usally a bad idea in hardware design, but nothing we can influence in the OS).

Quoted 4 lines

When you change it to readl(), that will breaks all machines that rely on the old behavior on big-endian kernels.

Arnd

It will not break existing big-endian SoC as SWAP_IO_SPACE is disabled.

Disable SWAP_IO_SPACE will not impact ltq_r32 as it uses non-byte swapping __raw_readl() and it makes readl work in big-endian kernel too.

The old Lantiq platform enable SWAP_IO_SPACE to support PCI as it's a little-endian bus plus PCI TX/RX swap enable impacted both data and control path. Alternatively PCI device driver has to do endian swap, It is better to let PCI device driver to do endian swap instead because SWAP_IO_SPACE is global wide macro. Once we set it, other peripheral such as USB has to change its register access as well

#5 lore raw

Re: [PATCH 1/7] MIPS: dts: Add aliases node for lantiq danube serial

In reply to Arnd Bergmann
Quoted 21 lines · Arnd Bergmann
Quoted 20 lines · Songjun Wu

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

  arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +0 -0
index 2dd950181f8a..7a9e15da6bd0 100644
@@ -4,6 +4,10 @@
         #size-cells = <1>;
         compatible = "lantiq,xway", "lantiq,danube";
 
Quoted 8 lines

arch/mips/boot/dts/lantiq/danube.dtsi line 10

Quoted 4 lines
arch/mips/boot/dts/lantiq/danube.dtsi +4 -0
+       aliases {
+               serial0 = &asc1;
+       };
+

You generally want the aliases to be part of the board specific file, not every board numbers their serial ports in the same way.

Arnd

In this chip only asc1 can be used as console,  so serial0 is defined in chip specific file.

#12 lore raw

Re: [PATCH 2/7] clk: intel: Add clock driver for GRX500 SoC

In reply to Rob Herring
Quoted 32 lines · Rob Herring
Quoted 9 lines · yixin zhu
Quoted 6 lines · Rob Herring
Quoted 4 lines · Songjun Wu

From: Yixin Zhu <[email protected]>

PLL of GRX500 provide clock to DDR, CPU, and peripherals as show below

[...]

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +6 -0
+Example:
+       clkgate0: clkgate0 {
+               #clock-cells = <1>;
+               compatible = "intel,grx500-gate0-clk";
+               reg = <0x114>;
+               clock-output-names = "gate_xbar0", "gate_xbar1",

"gate_xbar2",

Documentation/devicetree/bindings/clock/intel,grx500-clk.txt new file +2 -0
+               "gate_xbar3", "gate_xbar6", "gate_xbar7";
+       };
Quoted 7 lines
Quoted 4 lines

We generally don't do a clock node per clock or few clocks but rather 1 clock node per clock controller block. See any recent clock bindings.

Rob

Do you mean only one example is needed per clock controller block? cpuclk is not needed in the document?

Quoted 9 lines

No, I mean generally we have 1 DT node for the h/w block with all the clock control registers rather than nodes with a single register and 1 or a couple of clocks. Sometimes the clock registers are mixed with other functions which complicates things a bit. But I can't tell that here because you haven't documented what's in the rest of the register space.

Rob

Thanks
Will update to use one DT node for the whole clock controller.

#6 lore raw

Re: [PATCH 1/7] MIPS: dts: Add aliases node for lantiq danube serial

In reply to Wu, Songjun
Quoted 35 lines · Songjun
Quoted 25 lines · Arnd Bergmann
Quoted 22 lines · Songjun Wu

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

  arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +0 -0
index 2dd950181f8a..7a9e15da6bd0 100644
@@ -4,6 +4,10 @@
         #size-cells = <1>;
         compatible = "lantiq,xway", "lantiq,danube";
 
Quoted 8 lines

arch/mips/boot/dts/lantiq/danube.dtsi line 10

Quoted 4 lines
arch/mips/boot/dts/lantiq/danube.dtsi +4 -0
+       aliases {
+               serial0 = &asc1;
+       };
+

You generally want the aliases to be part of the board specific file, not every board numbers their serial ports in the same way.

Quoted 2 lines

In this chip only asc1 can be used as console, so serial0 is defined in chip specific file.

This was a more general comment about 'aliases' being board specific in principle (though we've had exceptions in the past). Even if there is only one uart on the chip, I'd recommend following the same conventions as the other chips that have more than one uart.

Arnd

#23 lore raw

Re: [PATCH 4/7] tty: serial: lantiq: Always use readl()/writel()

In reply to Wu, Songjun
Quoted 25 lines · Songjun
Quoted 19 lines · Arnd Bergmann
Quoted 8 lines · Songjun Wu

Previous implementation uses platform-dependent functions ltq_w32()/ltq_r32() to access registers. Those functions are not available for other SoC which uses the same IP.
Change to OS provided readl()/writel() and readb()/writeb(), so that different SoCs can use the same driver.

Are there any big-endian machines using this driver? The original definition
of ltq_r32() uses non-byteswapping __raw_readl() etc, which suggests that the registers might be wired up in a way that matches the CPU endianess (this is usally a bad idea in hardware design, but nothing we can influence in the OS).

Quoted 2 lines

When you change it to readl(), that will breaks all machines that rely on the old behavior on big-endian kernels.

Quoted 8 lines

It will not break existing big-endian SoC as SWAP_IO_SPACE is disabled.

Disable SWAP_IO_SPACE will not impact ltq_r32 as it uses non-byte swapping __raw_readl() and it makes readl work in big-endian kernel too.

The old Lantiq platform enable SWAP_IO_SPACE to support PCI as it's a little-endian bus plus PCI TX/RX swap enable impacted both data and control path.

Right, I see now what you mean. I was getting confused by how MIPS defines the __raw_* accessors differently from other big-endian architectures when CONFIG_SWAP_IO_SPACE is disabled.

I suppose this just means you can't use any PCI drivers using __raw_ accessors or memcpy_fromio(), but your patch to the serial driver is fine.

Quoted 5 lines

Alternatively PCI device driver has to do endian swap, It is better to let PCI device driver to do endian swap instead because SWAP_IO_SPACE is global wide macro.
Once we set it, other peripheral such as USB has to change its register access as well

I'm not entirely sure what you mean here, I would assume that aiming for maximum compatibility with existing drivers would be the main goal here. The USB platform drivers can already deal with being compiled for either (or both) endianess.

Arnd

#7 lore raw

Re: [PATCH 1/7] MIPS: dts: Add aliases node for lantiq danube serial

In reply to Arnd Bergmann
Quoted 33 lines · Arnd Bergmann
Quoted 31 lines · Songjun
Quoted 30 lines · Arnd Bergmann
Quoted 18 lines · Songjun Wu

Previous implementation uses a hard-coded register value to check if the current serial entity is the console entity.
Now the lantiq serial driver uses the aliases for the index of the serial port.
The lantiq danube serial dts are updated with aliases to support this.

---

   arch/mips/boot/dts/lantiq/danube.dtsi | 6 +++++-
   1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/dts/lantiq/danube.dtsi +0 -0
index 2dd950181f8a..7a9e15da6bd0 100644

arch/mips/boot/dts/lantiq/danube.dtsi line 10

Quoted 7 lines
arch/mips/boot/dts/lantiq/danube.dtsi +4 -0
@@ -4,6 +4,10 @@
          #size-cells = <1>;
          compatible = "lantiq,xway", "lantiq,danube";
 
+       aliases {
+               serial0 = &asc1;
+       };
+

You generally want the aliases to be part of the board specific file, not every board numbers their serial ports in the same way.

Quoted 8 lines
Quoted 2 lines

In this chip only asc1 can be used as console, so serial0 is defined in chip specific file.

This was a more general comment about 'aliases' being board specific in principle (though we've had exceptions in the past). Even if there is only one uart on the chip, I'd recommend following the same conventions as the other chips that have more than one uart.

Arnd

Accept, 'aliases' will be move to the board specific file.