Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'nuvoton/newsoc' into arm/newsoc

Merge the new SoC support from Tomer Maimon:
"This patchset adds initial support for the Nuvoton
Arbel NPCM8XX Board Management controller (BMC) SoC family.

The Nuvoton Arbel NPCM8XX SoC is a fourth-generation BMC.
The NPCM8XX computing subsystem comprises a quadcore ARM
Cortex A35 ARM-V8 architecture.

This patchset adds minimal architecture and drivers such as:
Clocksource, Clock, Reset, and WD.

Some of the Arbel NPCM8XX peripherals are based on Poleg NPCM7XX.

This patchset was tested on the Arbel NPCM8XX evaluation board."

I'm leaving out the clk controller driver, which is still under
review.

* nuvoton/newsoc:
arm64: defconfig: Add Nuvoton NPCM family support
arm64: dts: nuvoton: Add initial NPCM845 EVB device tree
arm64: dts: nuvoton: Add initial NPCM8XX device tree
arm64: npcm: Add support for Nuvoton NPCM8XX BMC SoC
dt-bindings: arm: npcm: Add nuvoton,npcm845 GCR compatible string
dt-bindings: arm: npcm: Add nuvoton,npcm845 compatible string
dt-bindings: arm: npcm: Add maintainer
reset: npcm: Add NPCM8XX support
dt-bindings: reset: npcm: Add support for NPCM8XX
reset: npcm: using syscon instead of device data
ARM: dts: nuvoton: add reset syscon property
dt-bindings: reset: npcm: add GCR syscon property
dt-binding: clk: npcm845: Add binding for Nuvoton NPCM8XX Clock
dt-bindings: watchdog: npcm: Add npcm845 compatible string
dt-bindings: timer: npcm: Add npcm845 compatible string

+589 -36
+7
Documentation/devicetree/bindings/arm/npcm/npcm.yaml
··· 8 8 9 9 maintainers: 10 10 - Jonathan Neuschäfer <j.neuschaefer@gmx.net> 11 + - Tomer Maimon <tmaimon77@gmail.com> 11 12 12 13 properties: 13 14 $nodename: ··· 26 25 - enum: 27 26 - nuvoton,npcm750-evb # NPCM750 evaluation board 28 27 - const: nuvoton,npcm750 28 + 29 + - description: NPCM845 based boards 30 + items: 31 + - enum: 32 + - nuvoton,npcm845-evb # NPCM845 evaluation board 33 + - const: nuvoton,npcm845 29 34 30 35 additionalProperties: true
+2
Documentation/devicetree/bindings/arm/npcm/nuvoton,gcr.yaml
··· 8 8 9 9 maintainers: 10 10 - Jonathan Neuschäfer <j.neuschaefer@gmx.net> 11 + - Tomer Maimon <tmaimon77@gmail.com> 11 12 12 13 description: 13 14 The Global Control Registers (GCR) are a block of registers in Nuvoton SoCs ··· 21 20 - enum: 22 21 - nuvoton,wpcm450-gcr 23 22 - nuvoton,npcm750-gcr 23 + - nuvoton,npcm845-gcr 24 24 - const: syscon 25 25 - const: simple-mfd 26 26
+49
Documentation/devicetree/bindings/clock/nuvoton,npcm845-clk.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/nuvoton,npcm845-clk.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Nuvoton NPCM8XX Clock Controller Binding 8 + 9 + maintainers: 10 + - Tomer Maimon <tmaimon77@gmail.com> 11 + 12 + description: | 13 + Nuvoton Arbel BMC NPCM8XX contains an integrated clock controller, which 14 + generates and supplies clocks to all modules within the BMC. 15 + 16 + properties: 17 + compatible: 18 + enum: 19 + - nuvoton,npcm845-clk 20 + 21 + reg: 22 + maxItems: 1 23 + 24 + '#clock-cells': 25 + const: 1 26 + description: 27 + See include/dt-bindings/clock/nuvoton,npcm8xx-clock.h for the full 28 + list of NPCM8XX clock IDs. 29 + 30 + required: 31 + - compatible 32 + - reg 33 + - '#clock-cells' 34 + 35 + additionalProperties: false 36 + 37 + examples: 38 + - | 39 + ahb { 40 + #address-cells = <2>; 41 + #size-cells = <2>; 42 + 43 + clock-controller@f0801000 { 44 + compatible = "nuvoton,npcm845-clk"; 45 + reg = <0x0 0xf0801000 0x0 0x1000>; 46 + #clock-cells = <1>; 47 + }; 48 + }; 49 + ...
+9 -1
Documentation/devicetree/bindings/reset/nuvoton,npcm750-reset.yaml
··· 11 11 12 12 properties: 13 13 compatible: 14 - const: nuvoton,npcm750-reset 14 + enum: 15 + - nuvoton,npcm750-reset # Poleg NPCM7XX SoC 16 + - nuvoton,npcm845-reset # Arbel NPCM8XX SoC 15 17 16 18 reg: 17 19 maxItems: 1 18 20 19 21 '#reset-cells': 20 22 const: 2 23 + 24 + nuvoton,sysgcr: 25 + $ref: /schemas/types.yaml#/definitions/phandle 26 + description: a phandle to access GCR registers. 21 27 22 28 nuvoton,sw-reset-number: 23 29 $ref: /schemas/types.yaml#/definitions/uint32 ··· 37 31 - compatible 38 32 - reg 39 33 - '#reset-cells' 34 + - nuvoton,sysgcr 40 35 41 36 additionalProperties: false 42 37 ··· 48 41 compatible = "nuvoton,npcm750-reset"; 49 42 reg = <0xf0801000 0x70>; 50 43 #reset-cells = <2>; 44 + nuvoton,sysgcr = <&gcr>; 51 45 nuvoton,sw-reset-number = <2>; 52 46 }; 53 47
+2
Documentation/devicetree/bindings/timer/nuvoton,npcm7xx-timer.yaml
··· 8 8 9 9 maintainers: 10 10 - Jonathan Neuschäfer <j.neuschaefer@gmx.net> 11 + - Tomer Maimon <tmaimon77@gmail.com> 11 12 12 13 properties: 13 14 compatible: 14 15 enum: 15 16 - nuvoton,wpcm450-timer # for Hermon WPCM450 16 17 - nuvoton,npcm750-timer # for Poleg NPCM750 18 + - nuvoton,npcm845-timer # for Arbel NPCM845 17 19 18 20 reg: 19 21 maxItems: 1
+2 -1
Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
··· 6 6 7 7 Required properties: 8 8 - compatible : "nuvoton,npcm750-wdt" for NPCM750 (Poleg), or 9 - "nuvoton,wpcm450-wdt" for WPCM450 (Hermon). 9 + "nuvoton,wpcm450-wdt" for WPCM450 (Hermon), or 10 + "nuvoton,npcm845-wdt" for NPCM845 (Arbel). 10 11 - reg : Offset and length of the register set for the device. 11 12 - interrupts : Contain the timer interrupt with flags for 12 13 falling edge.
+2
MAINTAINERS
··· 2450 2450 F: Documentation/devicetree/bindings/arm/npcm/* 2451 2451 F: arch/arm/boot/dts/nuvoton-npcm* 2452 2452 F: arch/arm/mach-npcm/ 2453 + F: arch/arm64/boot/dts/nuvoton/ 2453 2454 F: drivers/*/*npcm* 2454 2455 F: drivers/*/*/*npcm* 2455 2456 F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h 2457 + F: include/dt-bindings/clock/nuvoton,npcm8xx-clock.h 2456 2458 2457 2459 ARM/NUVOTON WPCM450 ARCHITECTURE 2458 2460 M: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
+1
arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi
··· 110 110 compatible = "nuvoton,npcm750-reset"; 111 111 reg = <0xf0801000 0x70>; 112 112 #reset-cells = <2>; 113 + nuvoton,sysgcr = <&gcr>; 113 114 }; 114 115 115 116 clk: clock-controller@f0801000 {
+11
arch/arm64/Kconfig.platforms
··· 202 202 This enables support for the ARMv8 based SoCs in the 203 203 NXP i.MX family. 204 204 205 + config ARCH_NPCM 206 + bool "Nuvoton NPCM Architecture" 207 + select PINCTRL 208 + select GPIOLIB 209 + select NPCM7XX_TIMER 210 + select RESET_CONTROLLER 211 + select MFD_SYSCON 212 + help 213 + General support for NPCM8xx BMC (Arbel). 214 + Nuvoton NPCM8xx BMC based on the Cortex A35. 215 + 205 216 config ARCH_QCOM 206 217 bool "Qualcomm Platforms" 207 218 select GPIOLIB
+1
arch/arm64/boot/dts/Makefile
··· 19 19 subdir-y += marvell 20 20 subdir-y += mediatek 21 21 subdir-y += microchip 22 + subdir-y += nuvoton 22 23 subdir-y += nvidia 23 24 subdir-y += qcom 24 25 subdir-y += realtek
+2
arch/arm64/boot/dts/nuvoton/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + dtb-$(CONFIG_ARCH_NPCM) += nuvoton-npcm845-evb.dtb
+170
arch/arm64/boot/dts/nuvoton/nuvoton-common-npcm8xx.dtsi
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Copyright (c) 2021 Nuvoton Technology tomer.maimon@nuvoton.com 3 + 4 + #include <dt-bindings/clock/nuvoton,npcm845-clk.h> 5 + #include <dt-bindings/interrupt-controller/arm-gic.h> 6 + #include <dt-bindings/interrupt-controller/irq.h> 7 + 8 + / { 9 + #address-cells = <2>; 10 + #size-cells = <2>; 11 + interrupt-parent = <&gic>; 12 + 13 + soc { 14 + #address-cells = <2>; 15 + #size-cells = <2>; 16 + compatible = "simple-bus"; 17 + interrupt-parent = <&gic>; 18 + ranges; 19 + 20 + gcr: system-controller@f0800000 { 21 + compatible = "nuvoton,npcm845-gcr", "syscon"; 22 + reg = <0x0 0xf0800000 0x0 0x1000>; 23 + }; 24 + 25 + gic: interrupt-controller@dfff9000 { 26 + compatible = "arm,gic-400"; 27 + reg = <0x0 0xdfff9000 0x0 0x1000>, 28 + <0x0 0xdfffa000 0x0 0x2000>, 29 + <0x0 0xdfffc000 0x0 0x2000>, 30 + <0x0 0xdfffe000 0x0 0x2000>; 31 + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 32 + #interrupt-cells = <3>; 33 + interrupt-controller; 34 + #address-cells = <0>; 35 + ppi-partitions { 36 + ppi_cluster0: interrupt-partition-0 { 37 + affinity = <&cpu0 &cpu1 &cpu2 &cpu3>; 38 + }; 39 + }; 40 + }; 41 + }; 42 + 43 + ahb { 44 + #address-cells = <2>; 45 + #size-cells = <2>; 46 + compatible = "simple-bus"; 47 + interrupt-parent = <&gic>; 48 + ranges; 49 + 50 + rstc: reset-controller@f0801000 { 51 + compatible = "nuvoton,npcm845-reset"; 52 + reg = <0x0 0xf0801000 0x0 0x78>; 53 + #reset-cells = <2>; 54 + nuvoton,sysgcr = <&gcr>; 55 + }; 56 + 57 + clk: clock-controller@f0801000 { 58 + compatible = "nuvoton,npcm845-clk"; 59 + #clock-cells = <1>; 60 + reg = <0x0 0xf0801000 0x0 0x1000>; 61 + }; 62 + 63 + apb { 64 + #address-cells = <1>; 65 + #size-cells = <1>; 66 + compatible = "simple-bus"; 67 + interrupt-parent = <&gic>; 68 + ranges = <0x0 0x0 0xf0000000 0x00300000>, 69 + <0xfff00000 0x0 0xfff00000 0x00016000>; 70 + 71 + timer0: timer@8000 { 72 + compatible = "nuvoton,npcm845-timer"; 73 + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; 74 + reg = <0x8000 0x1C>; 75 + clocks = <&clk NPCM8XX_CLK_REFCLK>; 76 + clock-names = "refclk"; 77 + }; 78 + 79 + serial0: serial@0 { 80 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 81 + reg = <0x0 0x1000>; 82 + clocks = <&clk NPCM8XX_CLK_UART>; 83 + interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>; 84 + reg-shift = <2>; 85 + status = "disabled"; 86 + }; 87 + 88 + serial1: serial@1000 { 89 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 90 + reg = <0x1000 0x1000>; 91 + clocks = <&clk NPCM8XX_CLK_UART>; 92 + interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>; 93 + reg-shift = <2>; 94 + status = "disabled"; 95 + }; 96 + 97 + serial2: serial@2000 { 98 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 99 + reg = <0x2000 0x1000>; 100 + clocks = <&clk NPCM8XX_CLK_UART>; 101 + interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>; 102 + reg-shift = <2>; 103 + status = "disabled"; 104 + }; 105 + 106 + serial3: serial@3000 { 107 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 108 + reg = <0x3000 0x1000>; 109 + clocks = <&clk NPCM8XX_CLK_UART>; 110 + interrupts = <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH>; 111 + reg-shift = <2>; 112 + status = "disabled"; 113 + }; 114 + 115 + serial4: serial@4000 { 116 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 117 + reg = <0x4000 0x1000>; 118 + clocks = <&clk NPCM8XX_CLK_UART>; 119 + interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>; 120 + reg-shift = <2>; 121 + status = "disabled"; 122 + }; 123 + 124 + serial5: serial@5000 { 125 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 126 + reg = <0x5000 0x1000>; 127 + clocks = <&clk NPCM8XX_CLK_UART>; 128 + interrupts = <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>; 129 + reg-shift = <2>; 130 + status = "disabled"; 131 + }; 132 + 133 + serial6: serial@6000 { 134 + compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; 135 + reg = <0x6000 0x1000>; 136 + clocks = <&clk NPCM8XX_CLK_UART>; 137 + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>; 138 + reg-shift = <2>; 139 + status = "disabled"; 140 + }; 141 + 142 + watchdog0: watchdog@801c { 143 + compatible = "nuvoton,npcm845-wdt", "nuvoton,npcm750-wdt"; 144 + interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; 145 + reg = <0x801c 0x4>; 146 + status = "disabled"; 147 + clocks = <&clk NPCM8XX_CLK_REFCLK>; 148 + syscon = <&gcr>; 149 + }; 150 + 151 + watchdog1: watchdog@901c { 152 + compatible = "nuvoton,npcm845-wdt", "nuvoton,npcm750-wdt"; 153 + interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; 154 + reg = <0x901c 0x4>; 155 + status = "disabled"; 156 + clocks = <&clk NPCM8XX_CLK_REFCLK>; 157 + syscon = <&gcr>; 158 + }; 159 + 160 + watchdog2: watchdog@a01c { 161 + compatible = "nuvoton,npcm845-wdt", "nuvoton,npcm750-wdt"; 162 + interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; 163 + reg = <0xa01c 0x4>; 164 + status = "disabled"; 165 + clocks = <&clk NPCM8XX_CLK_REFCLK>; 166 + syscon = <&gcr>; 167 + }; 168 + }; 169 + }; 170 + };
+30
arch/arm64/boot/dts/nuvoton/nuvoton-npcm845-evb.dts
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Copyright (c) 2021 Nuvoton Technology tomer.maimon@nuvoton.com 3 + 4 + /dts-v1/; 5 + #include "nuvoton-npcm845.dtsi" 6 + 7 + / { 8 + model = "Nuvoton npcm845 Development Board (Device Tree)"; 9 + compatible = "nuvoton,npcm845-evb", "nuvoton,npcm845"; 10 + 11 + aliases { 12 + serial0 = &serial0; 13 + }; 14 + 15 + chosen { 16 + stdout-path = &serial0; 17 + }; 18 + 19 + memory { 20 + reg = <0x0 0x0 0x0 0x40000000>; 21 + }; 22 + }; 23 + 24 + &serial0 { 25 + status = "okay"; 26 + }; 27 + 28 + &watchdog1 { 29 + status = "okay"; 30 + };
+76
arch/arm64/boot/dts/nuvoton/nuvoton-npcm845.dtsi
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Copyright (c) 2021 Nuvoton Technology tomer.maimon@nuvoton.com 3 + 4 + #include "nuvoton-common-npcm8xx.dtsi" 5 + 6 + / { 7 + #address-cells = <2>; 8 + #size-cells = <2>; 9 + 10 + cpus { 11 + #address-cells = <2>; 12 + #size-cells = <0>; 13 + 14 + cpu0: cpu@0 { 15 + device_type = "cpu"; 16 + compatible = "arm,cortex-a35"; 17 + clocks = <&clk NPCM8XX_CLK_CPU>; 18 + reg = <0x0 0x0>; 19 + next-level-cache = <&l2>; 20 + enable-method = "psci"; 21 + }; 22 + 23 + cpu1: cpu@1 { 24 + device_type = "cpu"; 25 + compatible = "arm,cortex-a35"; 26 + clocks = <&clk NPCM8XX_CLK_CPU>; 27 + reg = <0x0 0x1>; 28 + next-level-cache = <&l2>; 29 + enable-method = "psci"; 30 + }; 31 + 32 + cpu2: cpu@2 { 33 + device_type = "cpu"; 34 + compatible = "arm,cortex-a35"; 35 + clocks = <&clk NPCM8XX_CLK_CPU>; 36 + reg = <0x0 0x2>; 37 + next-level-cache = <&l2>; 38 + enable-method = "psci"; 39 + }; 40 + 41 + cpu3: cpu@3 { 42 + device_type = "cpu"; 43 + compatible = "arm,cortex-a35"; 44 + clocks = <&clk NPCM8XX_CLK_CPU>; 45 + reg = <0x0 0x3>; 46 + next-level-cache = <&l2>; 47 + enable-method = "psci"; 48 + }; 49 + 50 + l2: l2-cache { 51 + compatible = "cache"; 52 + }; 53 + }; 54 + 55 + arm-pmu { 56 + compatible = "arm,cortex-a35-pmu"; 57 + interrupts = <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>, 58 + <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>, 59 + <GIC_SPI 244 IRQ_TYPE_LEVEL_HIGH>, 60 + <GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>; 61 + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; 62 + }; 63 + 64 + psci { 65 + compatible = "arm,psci-1.0"; 66 + method = "smc"; 67 + }; 68 + 69 + timer { 70 + compatible = "arm,armv8-timer"; 71 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 72 + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 73 + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 74 + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 75 + }; 76 + };
+3
arch/arm64/configs/defconfig
··· 49 49 CONFIG_ARCH_MESON=y 50 50 CONFIG_ARCH_MVEBU=y 51 51 CONFIG_ARCH_MXC=y 52 + CONFIG_ARCH_NPCM=y 52 53 CONFIG_ARCH_QCOM=y 53 54 CONFIG_ARCH_RENESAS=y 54 55 CONFIG_ARCH_ROCKCHIP=y ··· 628 627 CONFIG_UNIPHIER_WATCHDOG=y 629 628 CONFIG_PM8916_WATCHDOG=m 630 629 CONFIG_BCM2835_WDT=y 630 + CONFIG_NPCM7XX_WATCHDOG=y 631 631 CONFIG_MFD_ALTERA_SYSMGR=y 632 632 CONFIG_MFD_BD9571MWV=y 633 633 CONFIG_MFD_AXP20X_I2C=y ··· 1023 1021 CONFIG_COMMON_CLK_S2MPS11=y 1024 1022 CONFIG_COMMON_CLK_PWM=y 1025 1023 CONFIG_COMMON_CLK_VC5=y 1024 + CONFIG_COMMON_CLK_NPCM8XX=y 1026 1025 CONFIG_COMMON_CLK_BD718XX=m 1027 1026 CONFIG_CLK_RASPBERRYPI=m 1028 1027 CONFIG_CLK_IMX8MM=y
+173 -34
drivers/reset/reset-npcm.c
··· 17 17 18 18 /* NPCM7xx GCR registers */ 19 19 #define NPCM_MDLR_OFFSET 0x7C 20 - #define NPCM_MDLR_USBD0 BIT(9) 21 - #define NPCM_MDLR_USBD1 BIT(8) 22 - #define NPCM_MDLR_USBD2_4 BIT(21) 23 - #define NPCM_MDLR_USBD5_9 BIT(22) 20 + #define NPCM7XX_MDLR_USBD0 BIT(9) 21 + #define NPCM7XX_MDLR_USBD1 BIT(8) 22 + #define NPCM7XX_MDLR_USBD2_4 BIT(21) 23 + #define NPCM7XX_MDLR_USBD5_9 BIT(22) 24 + 25 + /* NPCM8xx MDLR bits */ 26 + #define NPCM8XX_MDLR_USBD0_3 BIT(9) 27 + #define NPCM8XX_MDLR_USBD4_7 BIT(22) 28 + #define NPCM8XX_MDLR_USBD8 BIT(24) 29 + #define NPCM8XX_MDLR_USBD9 BIT(21) 24 30 25 31 #define NPCM_USB1PHYCTL_OFFSET 0x140 26 32 #define NPCM_USB2PHYCTL_OFFSET 0x144 33 + #define NPCM_USB3PHYCTL_OFFSET 0x148 27 34 #define NPCM_USBXPHYCTL_RS BIT(28) 28 35 29 36 /* NPCM7xx Reset registers */ ··· 56 49 #define NPCM_IPSRST3_USBPHY1 BIT(24) 57 50 #define NPCM_IPSRST3_USBPHY2 BIT(25) 58 51 52 + #define NPCM_IPSRST4 0x74 53 + #define NPCM_IPSRST4_USBPHY3 BIT(25) 54 + #define NPCM_IPSRST4_USB_HOST2 BIT(31) 55 + 59 56 #define NPCM_RC_RESETS_PER_REG 32 60 57 #define NPCM_MASK_RESETS GENMASK(4, 0) 58 + 59 + enum { 60 + BMC_NPCM7XX = 0, 61 + BMC_NPCM8XX, 62 + }; 63 + 64 + static const u32 npxm7xx_ipsrst[] = {NPCM_IPSRST1, NPCM_IPSRST2, NPCM_IPSRST3}; 65 + static const u32 npxm8xx_ipsrst[] = {NPCM_IPSRST1, NPCM_IPSRST2, NPCM_IPSRST3, 66 + NPCM_IPSRST4}; 67 + 68 + struct npcm_reset_info { 69 + u32 bmc_id; 70 + u32 num_ipsrst; 71 + const u32 *ipsrst; 72 + }; 73 + 74 + static const struct npcm_reset_info npxm7xx_reset_info[] = { 75 + {.bmc_id = BMC_NPCM7XX, .num_ipsrst = 3, .ipsrst = npxm7xx_ipsrst}}; 76 + static const struct npcm_reset_info npxm8xx_reset_info[] = { 77 + {.bmc_id = BMC_NPCM8XX, .num_ipsrst = 4, .ipsrst = npxm8xx_ipsrst}}; 61 78 62 79 struct npcm_rc_data { 63 80 struct reset_controller_dev rcdev; 64 81 struct notifier_block restart_nb; 82 + const struct npcm_reset_info *info; 83 + struct regmap *gcr_regmap; 65 84 u32 sw_reset_number; 66 85 void __iomem *base; 67 86 spinlock_t lock; ··· 153 120 static int npcm_reset_xlate(struct reset_controller_dev *rcdev, 154 121 const struct of_phandle_args *reset_spec) 155 122 { 123 + struct npcm_rc_data *rc = to_rc_data(rcdev); 156 124 unsigned int offset, bit; 125 + bool offset_found = false; 126 + int off_num; 157 127 158 128 offset = reset_spec->args[0]; 159 - if (offset != NPCM_IPSRST1 && offset != NPCM_IPSRST2 && 160 - offset != NPCM_IPSRST3) { 129 + for (off_num = 0 ; off_num < rc->info->num_ipsrst ; off_num++) { 130 + if (offset == rc->info->ipsrst[off_num]) { 131 + offset_found = true; 132 + break; 133 + } 134 + } 135 + 136 + if (!offset_found) { 161 137 dev_err(rcdev->dev, "Error reset register (0x%x)\n", offset); 162 138 return -EINVAL; 163 139 } 140 + 164 141 bit = reset_spec->args[1]; 165 142 if (bit >= NPCM_RC_RESETS_PER_REG) { 166 143 dev_err(rcdev->dev, "Error reset number (%d)\n", bit); ··· 181 138 } 182 139 183 140 static const struct of_device_id npcm_rc_match[] = { 184 - { .compatible = "nuvoton,npcm750-reset", 185 - .data = (void *)"nuvoton,npcm750-gcr" }, 141 + { .compatible = "nuvoton,npcm750-reset", .data = &npxm7xx_reset_info}, 142 + { .compatible = "nuvoton,npcm845-reset", .data = &npxm8xx_reset_info}, 186 143 { } 187 144 }; 188 145 189 - /* 190 - * The following procedure should be observed in USB PHY, USB device and 191 - * USB host initialization at BMC boot 192 - */ 193 - static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc) 146 + static void npcm_usb_reset_npcm7xx(struct npcm_rc_data *rc) 194 147 { 195 148 u32 mdlr, iprst1, iprst2, iprst3; 196 - struct device *dev = &pdev->dev; 197 - struct regmap *gcr_regmap; 198 149 u32 ipsrst1_bits = 0; 199 150 u32 ipsrst2_bits = NPCM_IPSRST2_USB_HOST; 200 151 u32 ipsrst3_bits = 0; 201 - const char *gcr_dt; 202 - 203 - gcr_dt = (const char *) 204 - of_match_device(dev->driver->of_match_table, dev)->data; 205 - 206 - gcr_regmap = syscon_regmap_lookup_by_compatible(gcr_dt); 207 - if (IS_ERR(gcr_regmap)) { 208 - dev_err(&pdev->dev, "Failed to find %s\n", gcr_dt); 209 - return PTR_ERR(gcr_regmap); 210 - } 211 152 212 153 /* checking which USB device is enabled */ 213 - regmap_read(gcr_regmap, NPCM_MDLR_OFFSET, &mdlr); 214 - if (!(mdlr & NPCM_MDLR_USBD0)) 154 + regmap_read(rc->gcr_regmap, NPCM_MDLR_OFFSET, &mdlr); 155 + if (!(mdlr & NPCM7XX_MDLR_USBD0)) 215 156 ipsrst3_bits |= NPCM_IPSRST3_USBD0; 216 - if (!(mdlr & NPCM_MDLR_USBD1)) 157 + if (!(mdlr & NPCM7XX_MDLR_USBD1)) 217 158 ipsrst1_bits |= NPCM_IPSRST1_USBD1; 218 - if (!(mdlr & NPCM_MDLR_USBD2_4)) 159 + if (!(mdlr & NPCM7XX_MDLR_USBD2_4)) 219 160 ipsrst1_bits |= (NPCM_IPSRST1_USBD2 | 220 161 NPCM_IPSRST1_USBD3 | 221 162 NPCM_IPSRST1_USBD4); 222 - if (!(mdlr & NPCM_MDLR_USBD0)) { 163 + if (!(mdlr & NPCM7XX_MDLR_USBD0)) { 223 164 ipsrst1_bits |= (NPCM_IPSRST1_USBD5 | 224 165 NPCM_IPSRST1_USBD6); 225 166 ipsrst3_bits |= (NPCM_IPSRST3_USBD7 | ··· 226 199 writel(iprst3, rc->base + NPCM_IPSRST3); 227 200 228 201 /* clear USB PHY RS bit */ 229 - regmap_update_bits(gcr_regmap, NPCM_USB1PHYCTL_OFFSET, 202 + regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, 230 203 NPCM_USBXPHYCTL_RS, 0); 231 - regmap_update_bits(gcr_regmap, NPCM_USB2PHYCTL_OFFSET, 204 + regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, 232 205 NPCM_USBXPHYCTL_RS, 0); 233 206 234 207 /* deassert reset USB PHY */ ··· 238 211 udelay(50); 239 212 240 213 /* set USB PHY RS bit */ 241 - regmap_update_bits(gcr_regmap, NPCM_USB1PHYCTL_OFFSET, 214 + regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, 242 215 NPCM_USBXPHYCTL_RS, NPCM_USBXPHYCTL_RS); 243 - regmap_update_bits(gcr_regmap, NPCM_USB2PHYCTL_OFFSET, 216 + regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, 244 217 NPCM_USBXPHYCTL_RS, NPCM_USBXPHYCTL_RS); 245 218 246 219 /* deassert reset USB devices*/ ··· 251 224 writel(iprst1, rc->base + NPCM_IPSRST1); 252 225 writel(iprst2, rc->base + NPCM_IPSRST2); 253 226 writel(iprst3, rc->base + NPCM_IPSRST3); 227 + } 228 + 229 + static void npcm_usb_reset_npcm8xx(struct npcm_rc_data *rc) 230 + { 231 + u32 mdlr, iprst1, iprst2, iprst3, iprst4; 232 + u32 ipsrst1_bits = 0; 233 + u32 ipsrst2_bits = NPCM_IPSRST2_USB_HOST; 234 + u32 ipsrst3_bits = 0; 235 + u32 ipsrst4_bits = NPCM_IPSRST4_USB_HOST2 | NPCM_IPSRST4_USBPHY3; 236 + 237 + /* checking which USB device is enabled */ 238 + regmap_read(rc->gcr_regmap, NPCM_MDLR_OFFSET, &mdlr); 239 + if (!(mdlr & NPCM8XX_MDLR_USBD0_3)) { 240 + ipsrst3_bits |= NPCM_IPSRST3_USBD0; 241 + ipsrst1_bits |= (NPCM_IPSRST1_USBD1 | 242 + NPCM_IPSRST1_USBD2 | 243 + NPCM_IPSRST1_USBD3); 244 + } 245 + if (!(mdlr & NPCM8XX_MDLR_USBD4_7)) { 246 + ipsrst1_bits |= (NPCM_IPSRST1_USBD4 | 247 + NPCM_IPSRST1_USBD5 | 248 + NPCM_IPSRST1_USBD6); 249 + ipsrst3_bits |= NPCM_IPSRST3_USBD7; 250 + } 251 + 252 + if (!(mdlr & NPCM8XX_MDLR_USBD8)) 253 + ipsrst3_bits |= NPCM_IPSRST3_USBD8; 254 + if (!(mdlr & NPCM8XX_MDLR_USBD9)) 255 + ipsrst3_bits |= NPCM_IPSRST3_USBD9; 256 + 257 + /* assert reset USB PHY and USB devices */ 258 + iprst1 = readl(rc->base + NPCM_IPSRST1); 259 + iprst2 = readl(rc->base + NPCM_IPSRST2); 260 + iprst3 = readl(rc->base + NPCM_IPSRST3); 261 + iprst4 = readl(rc->base + NPCM_IPSRST4); 262 + 263 + iprst1 |= ipsrst1_bits; 264 + iprst2 |= ipsrst2_bits; 265 + iprst3 |= (ipsrst3_bits | NPCM_IPSRST3_USBPHY1 | 266 + NPCM_IPSRST3_USBPHY2); 267 + iprst2 |= ipsrst4_bits; 268 + 269 + writel(iprst1, rc->base + NPCM_IPSRST1); 270 + writel(iprst2, rc->base + NPCM_IPSRST2); 271 + writel(iprst3, rc->base + NPCM_IPSRST3); 272 + writel(iprst4, rc->base + NPCM_IPSRST4); 273 + 274 + /* clear USB PHY RS bit */ 275 + regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, 276 + NPCM_USBXPHYCTL_RS, 0); 277 + regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, 278 + NPCM_USBXPHYCTL_RS, 0); 279 + regmap_update_bits(rc->gcr_regmap, NPCM_USB3PHYCTL_OFFSET, 280 + NPCM_USBXPHYCTL_RS, 0); 281 + 282 + /* deassert reset USB PHY */ 283 + iprst3 &= ~(NPCM_IPSRST3_USBPHY1 | NPCM_IPSRST3_USBPHY2); 284 + writel(iprst3, rc->base + NPCM_IPSRST3); 285 + iprst4 &= ~NPCM_IPSRST4_USBPHY3; 286 + writel(iprst4, rc->base + NPCM_IPSRST4); 287 + 288 + /* set USB PHY RS bit */ 289 + regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, 290 + NPCM_USBXPHYCTL_RS, NPCM_USBXPHYCTL_RS); 291 + regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, 292 + NPCM_USBXPHYCTL_RS, NPCM_USBXPHYCTL_RS); 293 + regmap_update_bits(rc->gcr_regmap, NPCM_USB3PHYCTL_OFFSET, 294 + NPCM_USBXPHYCTL_RS, NPCM_USBXPHYCTL_RS); 295 + 296 + /* deassert reset USB devices*/ 297 + iprst1 &= ~ipsrst1_bits; 298 + iprst2 &= ~ipsrst2_bits; 299 + iprst3 &= ~ipsrst3_bits; 300 + iprst4 &= ~ipsrst4_bits; 301 + 302 + writel(iprst1, rc->base + NPCM_IPSRST1); 303 + writel(iprst2, rc->base + NPCM_IPSRST2); 304 + writel(iprst3, rc->base + NPCM_IPSRST3); 305 + writel(iprst4, rc->base + NPCM_IPSRST4); 306 + } 307 + 308 + /* 309 + * The following procedure should be observed in USB PHY, USB device and 310 + * USB host initialization at BMC boot 311 + */ 312 + static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc) 313 + { 314 + struct device *dev = &pdev->dev; 315 + 316 + rc->gcr_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "nuvoton,sysgcr"); 317 + if (IS_ERR(rc->gcr_regmap)) { 318 + dev_warn(&pdev->dev, "Failed to find nuvoton,sysgcr property, please update the device tree\n"); 319 + dev_info(&pdev->dev, "Using nuvoton,npcm750-gcr for Poleg backward compatibility\n"); 320 + rc->gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr"); 321 + if (IS_ERR(rc->gcr_regmap)) { 322 + dev_err(&pdev->dev, "Failed to find nuvoton,npcm750-gcr"); 323 + return PTR_ERR(rc->gcr_regmap); 324 + } 325 + } 326 + 327 + rc->info = (const struct npcm_reset_info *) 328 + of_match_device(dev->driver->of_match_table, dev)->data; 329 + switch (rc->info->bmc_id) { 330 + case BMC_NPCM7XX: 331 + npcm_usb_reset_npcm7xx(rc); 332 + break; 333 + case BMC_NPCM8XX: 334 + npcm_usb_reset_npcm8xx(rc); 335 + break; 336 + default: 337 + return -ENODEV; 338 + } 254 339 255 340 return 0; 256 341 }
+49
include/dt-bindings/clock/nuvoton,npcm845-clk.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ 2 + /* 3 + * Copyright (C) 2021 Nuvoton Technologies. 4 + * Author: Tomer Maimon <tomer.maimon@nuvoton.com> 5 + * 6 + * Device Tree binding constants for NPCM8XX clock controller. 7 + */ 8 + 9 + #ifndef __DT_BINDINGS_CLOCK_NPCM8XX_H 10 + #define __DT_BINDINGS_CLOCK_NPCM8XX_H 11 + 12 + #define NPCM8XX_CLK_CPU 0 13 + #define NPCM8XX_CLK_GFX_PIXEL 1 14 + #define NPCM8XX_CLK_MC 2 15 + #define NPCM8XX_CLK_ADC 3 16 + #define NPCM8XX_CLK_AHB 4 17 + #define NPCM8XX_CLK_TIMER 5 18 + #define NPCM8XX_CLK_UART 6 19 + #define NPCM8XX_CLK_UART2 7 20 + #define NPCM8XX_CLK_MMC 8 21 + #define NPCM8XX_CLK_SPI3 9 22 + #define NPCM8XX_CLK_PCI 10 23 + #define NPCM8XX_CLK_AXI 11 24 + #define NPCM8XX_CLK_APB4 12 25 + #define NPCM8XX_CLK_APB3 13 26 + #define NPCM8XX_CLK_APB2 14 27 + #define NPCM8XX_CLK_APB1 15 28 + #define NPCM8XX_CLK_APB5 16 29 + #define NPCM8XX_CLK_CLKOUT 17 30 + #define NPCM8XX_CLK_GFX 18 31 + #define NPCM8XX_CLK_SU 19 32 + #define NPCM8XX_CLK_SU48 20 33 + #define NPCM8XX_CLK_SDHC 21 34 + #define NPCM8XX_CLK_SPI0 22 35 + #define NPCM8XX_CLK_SPI1 23 36 + #define NPCM8XX_CLK_SPIX 24 37 + #define NPCM8XX_CLK_RG 25 38 + #define NPCM8XX_CLK_RCP 26 39 + #define NPCM8XX_CLK_PRE_ADC 27 40 + #define NPCM8XX_CLK_ATB 28 41 + #define NPCM8XX_CLK_PRE_CLK 29 42 + #define NPCM8XX_CLK_TH 30 43 + #define NPCM8XX_CLK_REFCLK 31 44 + #define NPCM8XX_CLK_SYSBYPCK 32 45 + #define NPCM8XX_CLK_MCBYPCK 33 46 + 47 + #define NPCM8XX_NUM_CLOCKS (NPCM8XX_CLK_MCBYPCK + 1) 48 + 49 + #endif