Skip to contentSkip to conversation

arm: npcm: add basic support for Nuvoton BMCs

PATCH Superseded Brendan Higgins 4 participants 7 messages Feb 13, 2018 – Feb 15, 2018

Subsystems (6)

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#1 lore raw

PATCH v10 1/3 arm: npcm: add basic support for Nuvoton BMCs

Adds basic support for the Nuvoton NPCM750 BMC.

---
 arch/arm/Kconfig             |  2 ++
 arch/arm/Makefile            |  1 +
 arch/arm/mach-npcm/Kconfig   | 48 ++++++++++++++++++++++++++
 arch/arm/mach-npcm/Makefile  |  3 ++
 arch/arm/mach-npcm/headsmp.S | 17 ++++++++++
 arch/arm/mach-npcm/npcm7xx.c | 20 +++++++++++
 arch/arm/mach-npcm/platsmp.c | 81 ++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 172 insertions(+)
 create mode 100644 arch/arm/mach-npcm/Kconfig
 create mode 100644 arch/arm/mach-npcm/Makefile
 create mode 100644 arch/arm/mach-npcm/headsmp.S
 create mode 100644 arch/arm/mach-npcm/npcm7xx.c
 create mode 100644 arch/arm/mach-npcm/platsmp.c
arch/arm/Kconfig +2 -0
index 61a0cb15067e..05543f1cfbde 100644
@@ -782,6 +782,8 @@ source "arch/arm/mach-netx/Kconfig"
 
 source "arch/arm/mach-nomadik/Kconfig"
 
+source "arch/arm/mach-npcm/Kconfig"
+
 source "arch/arm/mach-nspire/Kconfig"
 
 source "arch/arm/plat-omap/Kconfig"
arch/arm/Makefile +1 -0
index 47d3a1ab08d2..60ca50c7d762 100644
@@ -191,6 +191,7 @@ machine-$(CONFIG_ARCH_MEDIATEK)		+= mediatek
 machine-$(CONFIG_ARCH_MXS)		+= mxs
 machine-$(CONFIG_ARCH_NETX)		+= netx
 machine-$(CONFIG_ARCH_NOMADIK)		+= nomadik
+machine-$(CONFIG_ARCH_NPCM)		+= npcm
 machine-$(CONFIG_ARCH_NSPIRE)		+= nspire
 machine-$(CONFIG_ARCH_OXNAS)		+= oxnas
 machine-$(CONFIG_ARCH_OMAP1)		+= omap1
arch/arm/mach-npcm/Kconfig new file +48 -0

48 lines not on this page · raw message

arch/arm/mach-npcm/Makefile new file +3 -0
new file mode 100644
index 000000000000..c7a1316d27c1
@@ -0,0 +1,3 @@
+AFLAGS_headsmp.o		+= -march=armv7-a
+
+obj-$(CONFIG_ARCH_NPCM750)	+= npcm7xx.o platsmp.o headsmp.o
arch/arm/mach-npcm/headsmp.S new file +17 -0
new file mode 100644
index 000000000000..c083fe09a07b
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+// Copyright 2018 Google, Inc.
+
+#include <linux/linkage.h>
+#include <linux/init.h>
+#include <asm/assembler.h>
+
+/*
+ * The boot ROM does not start secondary CPUs in SVC mode, so we need to do that
+ * here.
+ */
+ENTRY(npcm7xx_secondary_startup)
+	safe_svcmode_maskall r0
+
+	b	secondary_startup
+ENDPROC(npcm7xx_secondary_startup)
arch/arm/mach-npcm/npcm7xx.c new file +20 -0
new file mode 100644
index 000000000000..5f7cd88103ef
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+// Copyright 2018 Google, Inc.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach-types.h>
+#include <asm/mach/map.h>
+#include <asm/hardware/cache-l2x0.h>
+
+static const char *const npcm7xx_dt_match[] = {
+	"nuvoton,npcm750",
+	NULL
+};
+
+DT_MACHINE_START(NPCM7XX_DT, "NPCM7XX Chip family")
+	.atag_offset	= 0x100,
+	.dt_compat	= npcm7xx_dt_match,
+MACHINE_END
arch/arm/mach-npcm/platsmp.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
#2 lore raw

PATCH v10 2/3 arm: dts: add Nuvoton NPCM750 device tree

In reply to Brendan Higgins

Add a common device tree for all Nuvoton NPCM750 BMCs and a board specific device tree for the NPCM750 (Poleg) evaluation board.

---
 .../arm/cpu-enable-method/nuvoton,npcm7xx-smp      |  42 ++++++
 .../devicetree/bindings/arm/npcm/npcm.txt          |   6 +
 arch/arm/boot/dts/Makefile                         |   2 +
 arch/arm/boot/dts/nuvoton-npcm750-evb.dts          |  35 +++++
 arch/arm/boot/dts/nuvoton-npcm750.dtsi             | 162 +++++++++++++++++++++
 include/dt-bindings/clock/nuvoton,npcm7xx-clks.h   |  35 +++++
 6 files changed, 282 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/cpu-enable-method/nuvoton,npcm7xx-smp
 create mode 100644 Documentation/devicetree/bindings/arm/npcm/npcm.txt
 create mode 100644 arch/arm/boot/dts/nuvoton-npcm750-evb.dts
 create mode 100644 arch/arm/boot/dts/nuvoton-npcm750.dtsi
 create mode 100644 include/dt-bindings/clock/nuvoton,npcm7xx-clks.h
Documentation/devicetree/bindings/arm/cpu-enable-method/nuvoton,npcm7xx-smp new file +42 -0
new file mode 100644
index 000000000000..e81f85b400cf
@@ -0,0 +1,42 @@
+=========================================================
+Secondary CPU enable-method "nuvoton,npcm7xx-smp" binding
+=========================================================
+
+To apply to all CPUs, a single "nuvoton,npcm7xx-smp" enable method should be
+defined in the "cpus" node.
+
+Enable method name:	"nuvoton,npcm7xx-smp"
+Compatible machines:	"nuvoton,npcm750"
+Compatible CPUs:	"arm,cortex-a9"
+Related properties:	(none)
+
+Note:
+This enable method needs valid nodes compatible with "arm,cortex-a9-scu" and
+"nuvoton,npcm750-gcr".
+
+Example:
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "nuvoton,npcm7xx-smp";
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			clocks = <&clk NPCM7XX_CLK_CPU>;
+			clock-names = "clk_cpu";
+			reg = <0>;
+			next-level-cache = <&L2>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			clocks = <&clk NPCM7XX_CLK_CPU>;
+			clock-names = "clk_cpu";
+			reg = <1>;
+			next-level-cache = <&L2>;
+		};
+	};
+
Documentation/devicetree/bindings/arm/npcm/npcm.txt new file +6 -0
new file mode 100644
index 000000000000..2d87d9ecea85
@@ -0,0 +1,6 @@
+NPCM Platforms Device Tree Bindings
+-----------------------------------
+NPCM750 SoC
+Required root node properties:
+	- compatible = "nuvoton,npcm750";
+
arch/arm/boot/dts/Makefile +2 -0
index 4b17f35dc9a7..087bcd7401c9 100644
@@ -291,6 +291,8 @@ dtb-$(CONFIG_ARCH_LPC18XX) += \
 dtb-$(CONFIG_ARCH_LPC32XX) += \
 	lpc3250-ea3250.dtb \
 	lpc3250-phy3250.dtb
+dtb-$(CONFIG_ARCH_NPCM750) += \
+	nuvoton-npcm750-evb.dtb
 dtb-$(CONFIG_MACH_MESON6) += \
 	meson6-atv1200.dtb
 dtb-$(CONFIG_MACH_MESON8) += \
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +35 -0
new file mode 100644
index 000000000000..cabde3d5be8a
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+// Copyright 2018 Google, Inc.
+
+/dts-v1/;
+#include "nuvoton-npcm750.dtsi"
+
+/ {
+	model = "Nuvoton npcm750 Development Board (Device Tree)";
+	compatible = "nuvoton,npcm750";
+
+	chosen {
+		stdout-path = &serial3;
+	};
+
+	memory {
+		reg = <0 0x40000000>;
+	};
+};
+
+&serial0 {
+	status = "okay";
+};
+
+&serial1 {
+	status = "okay";
+};
+
+&serial2 {
+	status = "okay";
+};
+
+&serial3 {
+	status = "okay";
+};
arch/arm/boot/dts/nuvoton-npcm750.dtsi new file +162 -0

162 lines not on this page · raw message

include/dt-bindings/clock/nuvoton,npcm7xx-clks.h new file +35 -0
new file mode 100644
index 000000000000..93918714f16c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+// Copyright 2018 Google, Inc.
+
+#ifndef _DT_BINDINGS_CLK_NPCM7XX_H
+#define _DT_BINDINGS_CLK_NPCM7XX_H
+
+#define NPCM7XX_CLK_PLL0	0
+#define NPCM7XX_CLK_PLL1	1
+#define NPCM7XX_CLK_PLL2	2
+#define NPCM7XX_CLK_GFX		3
+#define NPCM7XX_CLK_APB1	4
+#define NPCM7XX_CLK_APB2	5
+#define NPCM7XX_CLK_APB3	6
+#define NPCM7XX_CLK_APB4	7
+#define NPCM7XX_CLK_APB5	8
+#define NPCM7XX_CLK_MC		9
+#define NPCM7XX_CLK_CPU		10
+#define NPCM7XX_CLK_SPI0	11
+#define NPCM7XX_CLK_SPI3	12
+#define NPCM7XX_CLK_SPIX	13
+#define NPCM7XX_CLK_UART_CORE	14
+#define NPCM7XX_CLK_TIMER	15
+#define NPCM7XX_CLK_HOST_UART	16
+#define NPCM7XX_CLK_MMC		17
+#define NPCM7XX_CLK_SDHC	18
+#define NPCM7XX_CLK_ADC		19
+#define NPCM7XX_CLK_GFX_MEM	20
+#define NPCM7XX_CLK_USB_BRIDGE	21
+#define NPCM7XX_CLK_AXI		22
+#define NPCM7XX_CLK_AHB		23
+#define NPCM7XX_CLK_EMC		24
+#define NPCM7XX_CLK_GMAC	25
+
+#endif
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
maintainer
#3 lore raw

Re: [PATCH v10 2/3] arm: dts: add Nuvoton NPCM750 device tree

Quoted 6 lines · Brendan Higgins
Documentation/devicetree/bindings/arm/cpu-enable-method/nuvoton,npcm7xx-smp new file +6 -0
+
+Enable method name:    "nuvoton,npcm7xx-smp"
+Compatible machines:   "nuvoton,npcm750"
+Compatible CPUs:       "arm,cortex-a9"
+Related properties:    (none)
+

Documentation/devicetree/bindings/arm/cpu-enable-method/nuvoton,npcm7xx-smp line 22

Quoted 10 lines
Documentation/devicetree/bindings/arm/cpu-enable-method/nuvoton,npcm7xx-smp new file +10 -0
+Note:
+This enable method needs valid nodes compatible with "arm,cortex-a9-scu" and
+"nuvoton,npcm750-gcr".
+
+Example:
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               enable-method = "nuvoton,npcm7xx-smp";

It seems you changed the DT files, but forgot to update the binding to match.

Otherwise it looks al good to me.

Arnd

#4 lore raw

Re: [PATCH v10 2/3] arm: dts: add Nuvoton NPCM750 device tree

In reply to Brendan Higgins

arch/arm/boot/dts/nuvoton-npcm750.dtsi line 112

Quoted 12 lines · Brendan Higgins
arch/arm/boot/dts/nuvoton-npcm750.dtsi new file +12 -0
+       ahb {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&gic>;
+               ranges;
+
+               clk: clock-controller at f0801000 {
+                       compatible = "nuvoton,npcm750-clk";
+                       #clock-cells = <1>;
+                       reg = <0xf0801000 0x1000>;
+                       status = "okay";

Nit: The ok is redundant.

Quoted 10 lines
arch/arm/boot/dts/nuvoton-npcm750.dtsi new file +10 -0
+               };
+
+               apb {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       compatible = "simple-bus";
+                       interrupt-parent = <&gic>;
+                       ranges = <0x0 0xf0000000 0x00300000>;
+
+                       timer0: timer at 8000 {

arch/arm/boot/dts/nuvoton-npcm750.dtsi line 132

Quoted 10 lines
arch/arm/boot/dts/nuvoton-npcm750.dtsi new file +10 -0
+                               compatible = "nuvoton,npcm750-timer";
+                               interrupts = <0 32 4>;
+                               reg = <0x8000 0x1000>;
+                               clocks = <&clk NPCM7XX_CLK_TIMER>;
+                       };
+
+                       serial0: serial at 1000 {
+                               compatible = "nuvoton,npcm750-uart";
+                               reg = <0x1000 0x1000>;
+                               clocks = <&clk NPCM7XX_CLK_UART_CORE>;

I really would like to see this merged, but lets get the last of these things sorted out first.

The clocks.h that I have in the openbmc tree uses NPCM7XX_CLK_UART. Is what you have here line up with the latest version of the clk driver that Tomer posted?

https://patchwork.kernel.org/patch/10200029/

His driver calls for a header called dt-bindings/clock/nuvoton,npcm7xx-clock.h.

An alternative would be to defer this by using the numbers instead of #defines here, and omitting the header until the clock patch is reviewed and merged. I had a similar chicken-egg problem with the aspeed clk driver.

Quoted 1 line

+ interrupts = <0 2 4>;

The irq header provides defines for the first and third cell. These could instead be:

interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;

Quoted 1 line

+ status = "disabled";

Add reg-shift = <2> to all of the uart nodes. This is required now that we're using the generic 8250 driver.

Quoted 49 lines
(quoted diff) +2 -0
+                       };
+
include/dt-bindings/clock/nuvoton,npcm7xx-clks.h new file +35 -1
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2018 Nuvoton Technology corporation.
+// Copyright 2018 Google, Inc.
+
+#ifndef _DT_BINDINGS_CLK_NPCM7XX_H
+#define _DT_BINDINGS_CLK_NPCM7XX_H
+
+#define NPCM7XX_CLK_PLL0       0
+#define NPCM7XX_CLK_PLL1       1
+#define NPCM7XX_CLK_PLL2       2
+#define NPCM7XX_CLK_GFX                3
+#define NPCM7XX_CLK_APB1       4
+#define NPCM7XX_CLK_APB2       5
+#define NPCM7XX_CLK_APB3       6
+#define NPCM7XX_CLK_APB4       7
+#define NPCM7XX_CLK_APB5       8
+#define NPCM7XX_CLK_MC         9
+#define NPCM7XX_CLK_CPU                10
+#define NPCM7XX_CLK_SPI0       11
+#define NPCM7XX_CLK_SPI3       12
+#define NPCM7XX_CLK_SPIX       13
+#define NPCM7XX_CLK_UART_CORE  14
+#define NPCM7XX_CLK_TIMER      15
+#define NPCM7XX_CLK_HOST_UART  16
+#define NPCM7XX_CLK_MMC                17
+#define NPCM7XX_CLK_SDHC       18
+#define NPCM7XX_CLK_ADC                19
+#define NPCM7XX_CLK_GFX_MEM    20
+#define NPCM7XX_CLK_USB_BRIDGE 21
+#define NPCM7XX_CLK_AXI                22
+#define NPCM7XX_CLK_AHB                23
+#define NPCM7XX_CLK_EMC                24
+#define NPCM7XX_CLK_GMAC       25
+
+#endif
--

2.16.0.rc1.238.g530d649a79-goog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

PATCH v10 3/3 MAINTAINERS: Add entry for the Nuvoton NPCM architecture

In reply to Brendan Higgins

Add maintainers and reviewers for the Nuvoton NPCM architecture.

---
 MAINTAINERS | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
MAINTAINERS +14 -0
index 44cb004c765d..2fa95aba0f7f 100644
@@ -1598,6 +1598,20 @@ F:	drivers/pinctrl/nomadik/
 F:	drivers/i2c/busses/i2c-nomadik.c
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
 
+ARM/NUVOTON NPCM ARCHITECTURE
+M:	Avi Fishman <[email protected]>
+M:	Tomer Maimon <[email protected]>
+R:	Patrick Venture <[email protected]>
+R:	Nancy Yuen <[email protected]>
+R:	Brendan Higgins <[email protected]>
+L:	openbmc at lists.ozlabs.org (moderated for non-subscribers)
+S:	Supported
+F:	arch/arm/mach-npcm/
+F:	arch/arm/boot/dts/nuvoton-npcm*
+F:	include/dt-bindings/clock/nuvoton,npcm7xx-clks.h
+F:	drivers/*/*npcm*
+F:	Documentation/*/*npcm*
+
 ARM/NUVOTON W90X900 ARM ARCHITECTURE
 M:	Wan ZongShun <[email protected]>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog
#6 lore raw
In reply to Brendan Higgins
Quoted 4 lines · Brendan Higgins

Addressed comments from:
- Joel: https://www.spinics.net/lists/arm-kernel/msg634074.html
- Arnd: https://www.spinics.net/lists/arm-kernel/msg634091.html

Quoted 8 lines

Summary of changes since previous update:
- Replaced "nuvoton,npcm7xx-smp" compatibility string with "nuvoton,npcm750-smp".
- Fixed some whitespace issues.
- Added EVB DTS to Makefile.

All changes tested on Nuvoton NPCM750 EVB.

Thanks for keeping me CC, FWIW: Reviewed-by: Florian Fainelli <[email protected]>

FWIW, I don't have a vested interest in BMCs in general, just happened to do a drive by review of your SMP code, no need to CC me on future submissions (e.g: boards, drivers etc.). Cheers

Signature · 1 line
Florian