arm: npcm: add basic support for Nuvoton BMCs
Subsystems (5)
v3 cover arm: npcm: add basic support for Nuvoton BMCs
Addressed comments from:
- Florian: https://www.spinics.net/lists/arm-kernel/msg604948.html
Changes since previous update:
- Substanitally simplified the SMP code for NPCM750.
- No changes to device tree or MAINTAINERS since v2
Changes have been tested on the NPCM750 evaluation board.
PATCH v3 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 | 34 +++++++++++++++++ arch/arm/mach-npcm/platsmp.c | 89 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 194 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
@@ -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
@@ -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
@@ -0,0 +1,3 @@ +AFLAGS_headsmp.o += -march=armv7-a + +obj-$(CONFIG_CPU_NPCM750) += npcm7xx.o platsmp.o headsmp.o
arch/arm/mach-npcm/headsmp.S new file +17 -0
@@ -0,0 +1,17 @@ +/* + * Copyright 2017 Google, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/linkage.h> +#include <linux/init.h> +#include <asm/assembler.h> + +ENTRY(npcm7xx_secondary_startup) + safe_svcmode_maskall r0 + + b secondary_startup +ENDPROC(npcm7xx_secondary_startup)
arch/arm/mach-npcm/npcm7xx.c new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright (c) 2017 Nuvoton Technology corporation. +* Copyright 2017 Google, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#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> + +#define NPCM7XX_AUX_VAL (L310_AUX_CTRL_INSTR_PREFETCH | \ + L310_AUX_CTRL_DATA_PREFETCH | \ + L310_AUX_CTRL_NS_LOCKDOWN | \ + L310_AUX_CTRL_CACHE_REPLACE_RR | \ + L2C_AUX_CTRL_SHARED_OVERRIDE | \ + L310_AUX_CTRL_FULL_LINE_ZERO) + +static const char *const npcm7xx_dt_match[] = { +"nuvoton,npcm750" , +NULL +}; + +DT_MACHINE_START (NPCM7XX_DT ,"NPCMX50 Chip family" ) + .atag_offset = 0x100, + .dt_compat = npcm7xx_dt_match, + .l2c_aux_val = NPCM7XX_AUX_VAL, + .l2c_aux_mask = ~NPCM7XX_AUX_VAL , +MACHINE_END
arch/arm/mach-npcm/platsmp.c new file +89 -0
89 lines not on this page · raw message
Signature · 1 line
2.14.1.581.gf28d330327-goog
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Brendan-Higgins/arm-npcm-add-basic-support-for-Nuvoton-BMCs/20170907-214055 config: arm-allmodconfig (attached as .config) compiler…
Hi Brendan,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.13 next-20170907]
[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/Brendan-Higgins/arm-npcm-add-basic-support-for-Nuvoton-BMCs/20170907-214055
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
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
make.cross ARCH=arm
All warnings (new ones prefixed by >>):
warning: (CPU_NPCM750) selects ARM_ERRATA_458693 which has unmet direct dependencies (CPU_V7 && !ARCH_MULTIPLATFORM)
warning: (CPU_NPCM750) selects ARM_ERRATA_742231 which has unmet direct dependencies (CPU_V7 && SMP && !ARCH_MULTIPLATFORM)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 63097 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170907/e26a8a1f/attachment-0001.gz>
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Brendan-Higgins/arm-npcm-add-basic-support-for-Nuvoton-BMCs/20170907-214055 config: arm-allmodconfig (attached as .config) compiler…
Hi Brendan,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.13 next-20170907]
[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/Brendan-Higgins/arm-npcm-add-basic-support-for-Nuvoton-BMCs/20170907-214055
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
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
make.cross ARCH=arm
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:13,
from include/linux/delay.h:21,
from arch/arm/mach-npcm/platsmp.c:11:
arch/arm/mach-npcm/platsmp.c: In function 'npcm7xx_smp_boot_secondary':
>> include/linux/kern_levels.h:4:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'void *' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
>> arch/arm/mach-npcm/platsmp.c:43:3: note: in expansion of macro 'pr_err'
pr_err("could not iomap gcr at: 0x%llx\n", gcr_base);
^~~~~~
arch/arm/mach-npcm/platsmp.c: In function 'npcm7xx_smp_prepare_cpus':
>> include/linux/kern_levels.h:4:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'void *' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
arch/arm/mach-npcm/platsmp.c:74:3: note: in expansion of macro 'pr_err'
pr_err("could not iomap scu at: 0x%llx\n", scu_base);
^~~~~~
arch/arm/mach-npcm/platsmp.c:80:1: warning: label 'out' defined but not used [-Wunused-label]
out:
^~~
In file included from include/linux/io.h:25:0,
from arch/arm/mach-npcm/platsmp.c:14:
arch/arm/mach-npcm/platsmp.c: In function 'npcm7xx_smp_boot_secondary':
>> arch/arm/include/asm/io.h:421:17: warning: 'gcr_base' may be used uninitialized in this function [-Wmaybe-uninitialized]
#define iounmap iounmap
^~~~~~~
arch/arm/mach-npcm/platsmp.c:32:16: note: 'gcr_base' was declared here
void __iomem *gcr_base;
^~~~~~~~vim +/pr_err +43 arch/arm/mach-npcm/platsmp.c
27
28 static int npcm7xx_smp_boot_secondary(unsigned int cpu,
29 struct task_struct *idle)
30 {
31 struct device_node *gcr_np;
32 void __iomem *gcr_base;
33 int ret = 0;
34
35 gcr_np = of_find_compatible_node(NULL, NULL, "nuvoton,npcm750-gcr");
36 if (!gcr_np) {
37 pr_err("no gcr device node\n");
38 ret = -EFAULT;
39 goto out;
40 }
41 gcr_base = of_iomap(gcr_np, 0);
42 if (!gcr_base) {
> 43 pr_err("could not iomap gcr at: 0x%llx\n", gcr_base);
44 ret = -EFAULT;
45 goto out;
46 }
47
48 /* give boot ROM kernel start address. */
49 iowrite32(__pa_symbol(npcm7xx_secondary_startup), gcr_base +
50 NPCM7XX_SCRPAD_REG);
51 /* make sure npcm7xx_secondary_startup is seen by all observers. */
52 smp_wmb();
53 dsb_sev();
54 /* make sure write buffer is drained */
55 mb();
56
57 out:
58 iounmap(gcr_base);
59 return ret;
60 }
61 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 63097 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170908/5e718398/attachment-0001.gz>
PATCH v3 2/3 arm: dts: add Nuvoton NPCM750 device tree
In reply to Brendan HigginsAdd 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/nuvoton-npcm750-evb.dts | 59 +++++++ arch/arm/boot/dts/nuvoton-npcm750.dtsi | 177 +++++++++++++++++++++ include/dt-bindings/clock/nuvoton,npcm7xx-clks.h | 39 +++++ 5 files changed, 323 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
@@ -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
@@ -0,0 +1,6 @@ +NPCM Platforms Device Tree Bindings +----------------------------------- +NPCM750 SoC +Required root node properties: + - compatible = "nuvoton,npcm750"; +
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +59 -0
59 lines not on this page · raw message
arch/arm/boot/dts/nuvoton-npcm750.dtsi new file +177 -0
177 lines not on this page · raw message
include/dt-bindings/clock/nuvoton,npcm7xx-clks.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright (C) 2016 Nuvoton Technologies, tali.perry at nuvoton.com +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +*/ + +#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.14.1.581.gf28d330327-goog
Re: [PATCH v3 2/3] arm: dts: add Nuvoton NPCM750 device tree
Documentation/devicetree/bindings/arm/npcm/npcm.txt line 6
Quoted 8 lines · Brendan Higgins
+++
b/Documentation/devicetree/bindings/arm/npcm/npcm.txtDocumentation/devicetree/bindings/arm/npcm/npcm.txt new file +6
-0@@ -0,0 +1,6 @@ +NPCM Platforms Device Tree Bindings +----------------------------------- +NPCM750 SoC +Required root node properties: + - compatible = "nuvoton,npcm750"; +
This is minimal. I assume there will be more content added as more support is added?
Does it need it's own directory?
Quoted 25 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +19
-0+ +/dts-v1/; +#include "nuvoton-npcm750.dtsi" + +/ { + model = "Nuvoton npcm750 Development Board (Device Tree)"; + compatible = "nuvoton,npcm750"; + + chosen { + stdout-path = &serial3; + bootargs = "earlyprintk=serial,serial3,115200"; + }; + + memory { + reg = <0 0x40000000>; + }; + + cpus { + enable-method = "nuvoton,npcm7xx-smp";
arch/arm/boot/dts/nuvoton-npcm750-evb.dts line 41
Quoted 10 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +10
-0+ }; + + clk: clock-controller at f0801000 { + status = "okay"; + }; + + apb { + watchdog1: watchdog at f0009000 { + status = "okay"; + };
You've already got the label for the node, is there are reason you don't use a phandle to set the status?
&watchdog1 {
status = "okay";
};
Same with the serial nodes below.
Quoted 17 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +17
-0+ + serial0: serial0 at f0001000 { + status = "okay"; + }; + + serial1: serial1 at f0002000 { + status = "okay"; + }; + + serial2: serial2 at f0003000 { + status = "okay"; + }; + + serial3: serial3 at f0004000 { + status = "okay"; + }; + };
Re: [PATCH v3 2/3] arm: dts: add Nuvoton NPCM750 device tree
Quoted 13 lines · Joel Stanley
Documentation/devicetree/bindings/arm/npcm/npcm.txt line 6
Quoted 8 lines · Brendan Higgins
+++
b/Documentation/devicetree/bindings/arm/npcm/npcm.txtDocumentation/devicetree/bindings/arm/npcm/npcm.txt new file +6
-0@@ -0,0 +1,6 @@ +NPCM Platforms Device Tree Bindings +----------------------------------- +NPCM750 SoC +Required root node properties: + - compatible = "nuvoton,npcm750"; +This is minimal. I assume there will be more content added as more support is added?
Yep, that's the plan. They have a number of similar BMCs, both those based on different ARM cores and some with different peripheral sets, so we will probably want to have different compat strings for those.
Quoted 2 lines
Does it need it's own directory?
Not sure, I saw that some of the other architectures did it, some did not. I don't feel strongly about it.
Quoted 32 lines
Quoted 32 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +24
-0+ +/dts-v1/; +#include "nuvoton-npcm750.dtsi" + +/ { + model = "Nuvoton npcm750 Development Board (Device Tree)"; + compatible = "nuvoton,npcm750"; + + chosen { + stdout-path = &serial3; + bootargs = "earlyprintk=serial,serial3,115200"; + }; + + memory { + reg = <0 0x40000000>; + }; + + cpus { + enable-method = "nuvoton,npcm7xx-smp"; + }; + + clk: clock-controller at f0801000 { + status = "okay"; + };
Quoted 8 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts line 41
Quoted 5 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +5
-0+ + apb { + watchdog1: watchdog at f0009000 { + status = "okay"; + };You've already got the label for the node, is there are reason you don't use a phandle to set the status?
Addressed in v4.
Quoted 24 lines
&watchdog1 { status = "okay"; };Same with the serial nodes below.
Quoted 17 lines
arch/arm/boot/dts/nuvoton-npcm750-evb.dts new file +17
-0+ + serial0: serial0 at f0001000 { + status = "okay"; + }; + + serial1: serial1 at f0002000 { + status = "okay"; + }; + + serial2: serial2 at f0003000 { + status = "okay"; + }; + + serial3: serial3 at f0004000 { + status = "okay"; + }; + };
PATCH v3 3/3 MAINTAINERS: Add entry for the Nuvoton NPCM architecture
In reply to Brendan HigginsAdd maintainers and reviewers for the Nuvoton NPCM architecture.
--- MAINTAINERS | 13 +++++++++++++ 1 file changed, 13 insertions(+)
MAINTAINERS +13 -0
@@ -1598,6 +1598,19 @@ 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: Brendan Higgins <[email protected]> +R: Rick Altherr <[email protected]> +L: openbmc at lists.ozlabs.org (moderated for non-subscribers) +S: Maintained +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.14.1.581.gf28d330327-goog