Skip to contentSkip to conversation

Nuvoton WPCM450 pinctrl and GPIO driver

PATCH In review Jonathan Neuschäfer 5 participants 25 messages Jan 29, 2022 – Mar 15, 2022

Subsystems (4)
lore
Share & tools
lore

Jonathan Neuschäfer

author maintainer
#0 lore raw

v5 cover Nuvoton WPCM450 pinctrl and GPIO driver

This is version 5 of the WPCM450 pinctrl/GPIO driver patchset.

I was originally just going to rebase the patchset on top of v5.17-rc1, but while testing, I found that the IRQ handling code violated locking rules, specifically that it used spin locks (which can sleep on RT kernels) in IRQ contexts. So I made a few changes to fix that, mainly switching to raw spin locks.

Best regards,
Jonathan Neuschäfer

v4: https://lore.kernel.org/lkml/[email protected]/
v3: https://lore.kernel.org/lkml/[email protected]/
v2: https://lore.kernel.org/lkml/[email protected]/

v1:
- https://lore.kernel.org/lkml/[email protected]/

Quoted 13 lines

This series adds support for pinctrl and GPIO in the Nuvoton WPCM450 SoC. Both my DT bindings and my driver are based on the work done by others for the newer Nuvoton NPCM7xx SoC, and I've tried to keep both similar.

Instead of extending the pinctrl-npcm7xx driver to add WPCM450 support, I copied/forked it. The pinmux mechanism is very similar (using MFSEL1 and MFSEL2 registers), but the GPIO register interface has been redesigned for NPCM7xx; adding support for the older GPIO controller would make the driver harder to understand, while only enabling a small amount of code sharing.

The DT binding in YAML format might make a good template for also converting the nuvoton,npcm7xx-pinctrl binding to YAML.

Quoted 6 lines

Both in the DT binding and in the driver I kept the name "pinctrl". For the driver, I find it accurate enough because it handles pinctrl and GPIO. For the DT node, it's a bit less accurate because the register block at 0xb8003000 is about GPIOs, and pin control happens in the global control registers (GCR) block, except for input debouncing. So, "GPIO" might be the more appropriate name component there.

Jonathan Neuschäfer (9):
dt-bindings: arm/npcm: Add binding for global control registers (GCR)
MAINTAINERS: Match all of bindings/arm/npcm/ as part of NPCM
architecture
ARM: dts: wpcm450: Add global control registers (GCR) node
dt-bindings: pinctrl: Add Nuvoton WPCM450
pinctrl: nuvoton: Add driver for WPCM450
ARM: dts: wpcm450: Add pinctrl and GPIO nodes
ARM: dts: wpcm450: Add pin functions
ARM: dts: wpcm450-supermicro-x9sci-ln4f: Add GPIO LEDs and buttons
ARM: dts: wpcm450: Add pinmux information to UART0

 .../bindings/arm/npcm/nuvoton,gcr.yaml        |   48 +
 .../pinctrl/nuvoton,wpcm450-pinctrl.yaml      |  160 +++
 MAINTAINERS                                   |    2 +
 .../nuvoton-wpcm450-supermicro-x9sci-ln4f.dts |   43 +
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi        |  384 ++++++
 drivers/pinctrl/Makefile                      |    2 +-
 drivers/pinctrl/nuvoton/Kconfig               |   18 +
 drivers/pinctrl/nuvoton/Makefile              |    1 +
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c     | 1150 +++++++++++++++++
 9 files changed, 1807 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/npcm/nuvoton,gcr.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nuvoton,wpcm450-pinctrl.yaml
 create mode 100644 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c

--
2.34.1

author maintainer
#1 lore raw

PATCH v5 1/9 dt-bindings: arm/npcm: Add binding for global control registers (GCR)

A nuvoton,*-gcr node is present in nuvoton-common-npcm7xx.dtsi and will be added to nuvoton-wpcm450.dtsi. It is necessary for the NPCM7xx and WPCM450 pinctrl drivers, and may later be used to retrieve SoC model and version information.

This patch adds a binding to describe this node.

---
v5:
- no changes

v4:
- Add Rob's R-b

v3:
- Make a few changes suggested by Rob Herring
- Change name of mux-controller node to appease the linter

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Rename node in example to syscon@800000
- Add subnode to example

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 .../bindings/arm/npcm/nuvoton,gcr.yaml        | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/npcm/nuvoton,gcr.yaml
Documentation/devicetree/bindings/arm/npcm/nuvoton,gcr.yaml new file +48 -0
new file mode 100644
index 0000000000000..fcb211add7d37
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/npcm/nuvoton,gcr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Global Control Registers block in Nuvoton SoCs
+
+maintainers:
+  - Jonathan Neuschäfer <[email protected]>
+
+description:
+  The Global Control Registers (GCR) are a block of registers in Nuvoton SoCs
+  that expose misc functionality such as chip model and version information or
+  pinmux settings.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nuvoton,wpcm450-gcr
+          - nuvoton,npcm750-gcr
+      - const: syscon
+      - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties:
+  type: object
+
+examples:
+  - |
+    gcr: syscon@800000 {
+      compatible = "nuvoton,npcm750-gcr", "syscon", "simple-mfd";
+      reg = <0x800000 0x1000>;
+
+      mux-controller {
+        compatible = "mmio-mux";
+        #mux-control-cells = <1>;
+        mux-reg-masks = <0x38 0x07>;
+        idle-states = <2>;
+      };
+    };

--
2.34.1

author maintainer
#2 lore raw

PATCH v5 2/9 MAINTAINERS: Match all of bindings/arm/npcm/ as part of NPCM architecture

In reply to Jonathan Neuschäfer

All files in Documentation/devicetree/bindings/arm/npcm/ belong to the Nuvoton NPCM architecture, even when their names might not spell it out explicitly.

---

v2-v5:
- no changes

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index ea3e6c9143848..d84dde42e33d3 100644
@@ -2363,6 +2363,7 @@ L:	[email protected] (moderated for non-subscribers)
 S:	Supported
 F:	Documentation/devicetree/bindings/*/*/*npcm*
 F:	Documentation/devicetree/bindings/*/*npcm*
+F:	Documentation/devicetree/bindings/arm/npcm/*
 F:	arch/arm/boot/dts/nuvoton-npcm*
 F:	arch/arm/mach-npcm/
 F:	drivers/*/*npcm*

--
2.34.1

author maintainer
#3 lore raw

PATCH v5 3/9 ARM: dts: wpcm450: Add global control registers (GCR) node

In reply to Jonathan Neuschäfer

The Global Control Registers (GCR) are a block of registers in Nuvoton SoCs that expose misc functionality such as chip model and version information or pinmux settings.

This patch adds a GCR node to nuvoton-wpcm450.dtsi in preparation for enabling pinctrl on this SoC.

---
v3-v5:
- no changes

v2:
- Rename node to syscon@b0000000

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/nuvoton-wpcm450.dtsi +5 -0
index d7cbeb1874840..a17ee70085dd0 100644
@@ -33,6 +33,11 @@ soc {
 		interrupt-parent = <&aic>;
 		ranges;
 
+		gcr: syscon@b0000000 {
+			compatible = "nuvoton,wpcm450-gcr", "syscon", "simple-mfd";
+			reg = <0xb0000000 0x200>;
+		};
+
 		serial0: serial@b8000000 {
 			compatible = "nuvoton,wpcm450-uart";
 			reg = <0xb8000000 0x20>;

--
2.34.1

author maintainer
#4 lore raw

PATCH v5 4/9 dt-bindings: pinctrl: Add Nuvoton WPCM450

In reply to Jonathan Neuschäfer

This binding is heavily based on the one for NPCM7xx, because the hardware is similar. There are some notable differences, however:

- The addresses of GPIO banks are not physical addresses but simple indices (0 to 7), because the GPIO registers are not laid out in convenient blocks.
- Pinmux settings can explicitly specify that the GPIO mode is used.

Certain pins support blink patterns in hardware. This is currently not modelled in the DT binding.

---
v5:
- Add Rob's R-b

v4:
- Small improvements around gpio node addresses, suggested by Rob Herring

v3:
- https://lore.kernel.org/lkml/[email protected]/
- Make changes suggested by Rob Herring
- Fix lint errors
- Simplify child node patterns
- Remove if/type=object/then trick
- Reduce interrupts.maxItems to 3: 4 aren't necessary
- Replace list of gpio0/1/2/etc. with pattern
- Remove nuvoton,interrupt-map again, to simplify the binding
- Make tuples clearer

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Move GPIO into subnodes
- Improve use of quotes
- Remove unnecessary minItems/maxItems lines
- Remove "phandle: true"
- Use separate prefixes for pinmux and pincfg nodes
- Add nuvoton,interrupt-map property
- Make it possible to set pinmux to GPIO explicitly

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 .../pinctrl/nuvoton,wpcm450-pinctrl.yaml      | 160 ++++++++++++++++++
 1 file changed, 160 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nuvoton,wpcm450-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/nuvoton,wpcm450-pinctrl.yaml new file +160 -0
new file mode 100644
index 0000000000000..47a56b83a610d
@@ -0,0 +1,160 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/nuvoton,wpcm450-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton WPCM450 pin control and GPIO
+
+maintainers:
+  - Jonathan Neuschäfer <[email protected]>
+
+properties:
+  compatible:
+    const: nuvoton,wpcm450-pinctrl
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  # There are three kinds of subnodes:
+  # 1. a GPIO controller node for each GPIO bank
+  # 2. a pinmux node configures pin muxing for a group of pins (e.g. rmii2)
+  # 3. a pinconf node configures properties of a single pin
+
+  "^gpio@[0-7]$":
+    type: object
+
+    description:
+      Eight GPIO banks (gpio@0 to gpio@7), that each contain between 14 and 18
+      GPIOs. Some GPIOs support interrupts.
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 7
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      interrupt-controller: true
+
+      "#interrupt-cells":
+        const: 2
+
+      interrupts:
+        maxItems: 3
+        description:
+          The interrupts associated with this GPIO bank
+
+    required:
+      - reg
+      - gpio-controller
+      - '#gpio-cells'
+
+  "^mux-":
+    $ref: pinmux-node.yaml#
+
+    properties:
+      groups:
+        description:
+          One or more groups of pins to mux to a certain function
+        items:
+          enum: [ smb3, smb4, smb5, scs1, scs2, scs3, smb0, smb1, smb2, bsp,
+                  hsp1, hsp2, r1err, r1md, rmii2, r2err, r2md, kbcc, dvo,
+                  clko, smi, uinc, gspi, mben, xcs2, xcs1, sdio, sspi, fi0,
+                  fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8, fi9, fi10, fi11,
+                  fi12, fi13, fi14, fi15, pwm0, pwm1, pwm2, pwm3, pwm4, pwm5,
+                  pwm6, pwm7, hg0, hg1, hg2, hg3, hg4, hg5, hg6, hg7 ]
+      function:
+        description:
+          The function that a group of pins is muxed to
+        enum: [ smb3, smb4, smb5, scs1, scs2, scs3, smb0, smb1, smb2, bsp,
+                hsp1, hsp2, r1err, r1md, rmii2, r2err, r2md, kbcc, dvo0,
+                dvo1, dvo2, dvo3, dvo4, dvo5, dvo6, dvo7, clko, smi, uinc,
+                gspi, mben, xcs2, xcs1, sdio, sspi, fi0, fi1, fi2, fi3, fi4,
+                fi5, fi6, fi7, fi8, fi9, fi10, fi11, fi12, fi13, fi14, fi15,
+                pwm0, pwm1, pwm2, pwm3, pwm4, pwm5, pwm6, pwm7, hg0, hg1,
+                hg2, hg3, hg4, hg5, hg6, hg7, gpio ]
+
+    dependencies:
+      groups: [ function ]
+      function: [ groups ]
+
+    additionalProperties: false
+
+  "^cfg-":
+    $ref: pincfg-node.yaml#
+
+    properties:
+      pins:
+        description:
+          A list of pins to configure in certain ways, such as enabling
+          debouncing
+        items:
+          pattern: "^gpio1?[0-9]{1,2}$"
+
+      input-debounce: true
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    pinctrl: pinctrl@b8003000 {
+      compatible = "nuvoton,wpcm450-pinctrl";
+      reg = <0xb8003000 0x1000>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      gpio0: gpio@0 {
+        reg = <0>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        interrupts = <2 IRQ_TYPE_LEVEL_HIGH>,
+                     <3 IRQ_TYPE_LEVEL_HIGH>,
+                     <4 IRQ_TYPE_LEVEL_HIGH>;
+      };
+
+      mux-rmii2 {
+        groups = "rmii2";
+        function = "rmii2";
+      };
+
+      pinmux_uid: mux-uid {
+        groups = "gspi", "sspi";
+        function = "gpio";
+      };
+
+      pinctrl_uid: cfg-uid {
+        pins = "gpio14";
+        input-debounce = <1>;
+      };
+    };
+
+    gpio-keys {
+      compatible = "gpio-keys";
+      pinctrl-names = "default";
+      pinctrl-0 = <&pinctrl_uid>, <&pinmux_uid>;
+
+      uid {
+        label = "UID";
+        linux,code = <102>;
+        gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+      };
+    };

--
2.34.1

author maintainer
#5 lore raw

PATCH v5 5/9 pinctrl: nuvoton: Add driver for WPCM450

In reply to Jonathan Neuschäfer

This driver is based on the one for NPCM7xx, because the WPCM450 is a predecessor of those SoCs. Notable differences:

- On WPCM450, the GPIO registers are not organized in multiple banks, but rather placed continually into the same register block. This affects how register offsets are computed.
- Pinmux nodes can explicitly select GPIO mode, whereas in the npcm7xx driver, this happens automatically when a GPIO is requested.

Some functionality implemented in the hardware was (for now) left unused in the driver, specifically blinking and pull-up/down.

---

This patch has a few checkpatch warnings, which are inherited from the pinctrl-npcm7xx driver. I decided to ignore those. Specifically:
(1) WPCM450_GRPS is an unwrapped list; (2) use of -ENOTSUPP is discouraged.

v5:
- Switch to raw_spinlock for serializing register accesses

v4:
- https://lore.kernel.org/lkml/[email protected]/
- A few more cleanups, as suggested by Andy Shevchenko
- Change fwnode_property_read_u32 argument to u32

v3:
- https://lore.kernel.org/lkml/[email protected]/
- make gc the first member of struct wpcm450_gpio, to simplify pointer arithmetic
- Add empty line between <linux> includes and <linux/pinctrl> includes
- Add a comment explaining wpcm450_gpio_fix_evpol
- Use generic_handle_domain_irq
- Rename struct fwnode_handle *np to child
- Convert instances of dev_err() to dev_err_probe() and simplify return
- Use device_for_each_child_node loop
- Remove gpio->gc.parent assignment (already done in bgpio_init)
- Move gpiochip_add_pin_range() to .add_pin_ranges callback
- Use GENMASK in calculation of IRQ bitmask
- I decided to keep using __assign_bit throughout the driver, because it keeps the code short
- Remove nuvoton,interrupt-map again, to simplify the binding
- Use gpio_chip->fwnode
- I decided against using the bitmap_* API in(place of) wpcm450_gpio_irq_bitnum, etc., because I find the current solution clear enough, even though the mapping functions are somewhat verbose.

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Adjust to binding change which put each GPIO bank into its own node
- Use generic GPIO support
- Make it possible to set pinmux to GPIO explicitly
- Allow building the driver as a module
- Fix spelling of "spin lock" in text
- Include <linux/mod_devicetable.h>
- Move linux/pinctrl/* headers to the end of the #include block
- Remove/rework comments and printk messages
- Switch to fwnode API
- Remove comma after sentinel {}
- Use dev_err_probe
- Improve Kconfig help message
- Declare for_each_set_bit iterator as unsigned int
- Use __assign_bit
- Set parent irq handler in set_irq_type callback
- Use struct group_desc
- Don't hide sysfs bind attributes
- Remove unnecessary check for gpio-controller property
- Use module_platform_driver()

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
Everything following the line with "---" will be ignored

rawspin---------------------------------------------------------------

---
 MAINTAINERS                               |    1 +
 drivers/pinctrl/Makefile                  |    2 +-
 drivers/pinctrl/nuvoton/Kconfig           |   18 +
 drivers/pinctrl/nuvoton/Makefile          |    1 +
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 1150 +++++++++++++++++++++
 5 files changed, 1171 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
MAINTAINERS +1 -0
index d84dde42e33d3..2e40213eda1c5 100644
@@ -2377,6 +2377,7 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/*/*wpcm*
 F:	arch/arm/boot/dts/nuvoton-wpcm450*
 F:	arch/arm/mach-npcm/wpcm450.c
+F:	drivers/*/*/*wpcm*
 F:	drivers/*/*wpcm*
 
 ARM/NXP S32G ARCHITECTURE
drivers/pinctrl/Makefile +1 -1
index 08c364d611f5a..fa2a3616a6615 100644
@@ -62,7 +62,7 @@ obj-y				+= mediatek/
 obj-$(CONFIG_PINCTRL_MESON)	+= meson/
 obj-y				+= mvebu/
 obj-y				+= nomadik/
-obj-$(CONFIG_ARCH_NPCM7XX)	+= nuvoton/
+obj-y				+= nuvoton/
 obj-$(CONFIG_PINCTRL_PXA)	+= pxa/
 obj-$(CONFIG_ARCH_QCOM)		+= qcom/
 obj-$(CONFIG_PINCTRL_RALINK)	+= ralink/
drivers/pinctrl/nuvoton/Kconfig +18 -0
index 48ba0469edda6..6a3c6f2a73f2d 100644
@@ -1,4 +1,22 @@
 # SPDX-License-Identifier: GPL-2.0-only
+
+config PINCTRL_WPCM450
+	tristate "Pinctrl and GPIO driver for Nuvoton WPCM450"
+	depends on ARCH_WPCM450 || COMPILE_TEST
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select GPIOLIB
+	select GPIO_GENERIC
+	select GPIOLIB_IRQCHIP
+	help
+	  Say Y or M here to enable pin controller and GPIO support for
+	  the Nuvoton WPCM450 SoC. This is strongly recommended when
+	  building a kernel that will run on this chip.
+
+	  If this driver is compiled as a module, it will be named
+	  pinctrl-wpcm450.
+
 config PINCTRL_NPCM7XX
 	bool "Pinctrl and GPIO driver for Nuvoton NPCM7XX"
 	depends on (ARCH_NPCM7XX || COMPILE_TEST) && OF
drivers/pinctrl/nuvoton/Makefile +1 -0
index 886d00784cef5..9e66f5dc74bfc 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 # Nuvoton pinctrl support
 
+obj-$(CONFIG_PINCTRL_WPCM450)	+= pinctrl-wpcm450.o
 obj-$(CONFIG_PINCTRL_NPCM7XX)	+= pinctrl-npcm7xx.o
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c new file +1150 -0

1,150 lines not on this page · raw message

--
2.34.1

#6 lore raw

Re: [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

I love your patch! Perhaps something to improve:

Hi "Jonathan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on robh/for-next linus/master v5.17-rc1 next-20220128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20220129/202201292134.kcXZbWy4-lkp(a)intel.com/config)
compiler: s390-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3fd91ea1bad905592e89c8f987f6bd3740329b80
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955 git checkout 3fd91ea1bad905592e89c8f987f6bd3740329b80
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash drivers/pinctrl/nuvoton/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:555,

                    from include/asm-generic/bug.h:22,
                    from arch/s390/include/asm/bug.h:68,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from arch/s390/include/asm/cmpxchg.h:11,
                    from arch/s390/include/asm/atomic.h:16,
                    from include/linux/atomic.h:7,
                    from include/linux/rcupdate.h:25,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:5:
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c: In function 'npcm7xx_get_groups_count':
>> drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:28: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
    1564 |         dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
         |                            ^~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
     134 |                 func(&id, ##__VA_ARGS__);               \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
     166 |         _dynamic_func_call(fmt,__dynamic_dev_dbg,               \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                              ^~~~~~~
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:9: note: in expansion of macro 'dev_dbg'
    1564 |         dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
         |         ^~~~~~~
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:42: note: format string is defined here
    1564 |         dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
         |                                         ~^
         |                                          |
         |                                          int
         |                                         %ld

vim +1564 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c

3b588e43ee5c7a Tomer Maimon 2018-08-08  1559  
3b588e43ee5c7a Tomer Maimon 2018-08-08  1560  static int npcm7xx_get_groups_count(struct pinctrl_dev *pctldev)
3b588e43ee5c7a Tomer Maimon 2018-08-08  1561  {
3b588e43ee5c7a Tomer Maimon 2018-08-08  1562  	struct npcm7xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev);
3b588e43ee5c7a Tomer Maimon 2018-08-08  1563  
3b588e43ee5c7a Tomer Maimon 2018-08-08 @1564  	dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
3b588e43ee5c7a Tomer Maimon 2018-08-08  1565  	return ARRAY_SIZE(npcm7xx_groups);
3b588e43ee5c7a Tomer Maimon 2018-08-08  1566  }

3b588e43ee5c7a Tomer Maimon 2018-08-08 1567

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#7 lore raw

Re: [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

In reply to Jonathan Neuschäfer
I love your patch! Perhaps something to improve:

Hi "Jonathan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on robh/for-next linus/master v5.17-rc1 next-20220128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20220129/202201292234.NpSNe4TD-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/3fd91ea1bad905592e89c8f987f6bd3740329b80
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955 git checkout 3fd91ea1bad905592e89c8f987f6bd3740329b80
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SHELL=/bin/bash drivers/pinctrl/nuvoton/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:908: warning: "DS" redefined
     908 | #define DS(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
         | 
   In file included from arch/x86/um/shared/sysdep/ptrace.h:44,
                    from arch/um/include/asm/ptrace-generic.h:11,
                    from arch/x86/um/asm/ptrace.h:9,
                    from arch/um/include/asm/processor-generic.h:13,
                    from arch/x86/um/asm/processor.h:41,
                    from include/linux/rcupdate.h:30,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:5:
   arch/x86/um/shared/sysdep/ptrace_64.h:38: note: this is the location of the previous definition
      38 | #define DS (HOST_DS * sizeof(long))
         | 
   In file included from include/linux/printk.h:555,
                    from include/asm-generic/bug.h:22,
                    from ./arch/um/include/generated/asm/bug.h:1,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/current.h:5,
                    from ./arch/um/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:5:
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c: In function 'npcm7xx_get_groups_count':
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
    1564 |  dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
         |                     ^~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
     134 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:166:2: note: in expansion of macro '_dynamic_func_call'
     166 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:2: note: in expansion of macro 'dynamic_dev_dbg'
     155 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:23: note: in expansion of macro 'dev_fmt'
     155 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                       ^~~~~~~
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:2: note: in expansion of macro 'dev_dbg'
    1564 |  dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
         |  ^~~~~~~
   drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:35: note: format string is defined here
    1564 |  dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
         |                                  ~^
         |                                   |
         |                                   int
         |                                  %ld

vim +/DS +908 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c

3b588e43ee5c7ad Tomer Maimon 2018-08-08 907

3b588e43ee5c7ad Tomer Maimon 2018-08-08 @908  #define DS(lo, hi)	(((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
3b588e43ee5c7ad Tomer Maimon 2018-08-08  909  			 ((hi) << DRIVE_STRENGTH_HI_SHIFT))
3b588e43ee5c7ad Tomer Maimon 2018-08-08  910  #define DSLO(x)		(((x) >> DRIVE_STRENGTH_LO_SHIFT) & 0xF)
3b588e43ee5c7ad Tomer Maimon 2018-08-08  911  #define DSHI(x)		(((x) >> DRIVE_STRENGTH_HI_SHIFT) & 0xF)

3b588e43ee5c7ad Tomer Maimon 2018-08-08 912

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#8 lore raw

Re: [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

Quoted 28 lines · kernel test robot

Hi "Jonathan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on robh/for-next linus/master v5.17-rc1 next-20220128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20220129/202201292234.NpSNe4TD-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/3fd91ea1bad905592e89c8f987f6bd3740329b80
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955 git checkout 3fd91ea1bad905592e89c8f987f6bd3740329b80
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SHELL=/bin/bash drivers/pinctrl/nuvoton/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

...

Quoted 6 lines
Quoted 1 line
Quoted 1 line

drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:908: warning: "DS" redefined

     908 | #define DS(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
         |

arch/x86/um/shared/sysdep/ptrace_64.h:38: note: this is the location of the previous definition
38 | #define DS (HOST_DS * sizeof(long))

This is a good example why short and namespace-less definitions are not always good even in standalone module.

...

Quoted 2 lines

drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c: In function 'npcm7xx_get_groups_count':
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

Should be %zu

If it's already in for-next, there should be two patches to fix these issues.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#9 lore raw

Re: [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

Quoted 42 lines · Andy Shevchenko
Quoted 28 lines · kernel test robot

Hi "Jonathan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on robh/for-next linus/master v5.17-rc1 next-20220128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20220129/202201292234.NpSNe4TD-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/3fd91ea1bad905592e89c8f987f6bd3740329b80
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/Nuvoton-WPCM450-pinctrl-and-GPIO-driver/20220129-195955 git checkout 3fd91ea1bad905592e89c8f987f6bd3740329b80
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SHELL=/bin/bash drivers/pinctrl/nuvoton/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

...

Quoted 6 lines
Quoted 1 line
Quoted 1 line

drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:908: warning: "DS" redefined

     908 | #define DS(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
         |

arch/x86/um/shared/sysdep/ptrace_64.h:38: note: this is the location of the previous definition
38 | #define DS (HOST_DS * sizeof(long))

This is a good example why short and namespace-less definitions are not always good even in standalone module.

Quoted 8 lines

...

Quoted 2 lines

drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c: In function 'npcm7xx_get_groups_count':
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c:1564:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

Should be %zu

If it's already in for-next, there should be two patches to fix these issues.

These warnings are about the pinctrl-npcm7xx driver, which was merged many releases ago, but started to be built due to the Kconfig change in my patchset.

I'll fix them anyway.

Jonathan

author maintainer
#10 lore raw

PATCH v5 6/9 ARM: dts: wpcm450: Add pinctrl and GPIO nodes

In reply to Jonathan Neuschäfer

This patch adds the pin controller and GPIO banks to the devicetree for the WPCM450 SoC.

---
v4-v5:
- no changes

v3:
- Add Linus' R-b tag
- Remove nuvoton,interrupt-map again, to simplify the binding
- Make tuples clearer

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Move GPIO banks into subnodes
- Add /alias/gpio*

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi | 72 ++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
arch/arm/boot/dts/nuvoton-wpcm450.dtsi +72 -0
index a17ee70085dd0..66c35626c80a6 100644
@@ -8,6 +8,17 @@ / {
 	#address-cells = <1>;
 	#size-cells = <1>;
 
+	aliases {
+		gpio0 = &gpio0;
+		gpio1 = &gpio1;
+		gpio2 = &gpio2;
+		gpio3 = &gpio3;
+		gpio4 = &gpio4;
+		gpio5 = &gpio5;
+		gpio6 = &gpio6;
+		gpio7 = &gpio7;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -77,5 +88,66 @@ aic: interrupt-controller@b8002000 {
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pinctrl: pinctrl@b8003000 {
+			compatible = "nuvoton,wpcm450-pinctrl";
+			reg = <0xb8003000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			gpio0: gpio@0 {
+				reg = <0>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				interrupts = <2 IRQ_TYPE_LEVEL_HIGH>,
+					     <3 IRQ_TYPE_LEVEL_HIGH>,
+					     <4 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-controller;
+			};
+
+			gpio1: gpio@1 {
+				reg = <1>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-controller;
+			};
+
+			gpio2: gpio@2 {
+				reg = <2>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			gpio3: gpio@3 {
+				reg = <3>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			gpio4: gpio@4 {
+				reg = <4>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			gpio5: gpio@5 {
+				reg = <5>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			gpio6: gpio@6 {
+				reg = <6>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+
+			gpio7: gpio@7 {
+				reg = <7>;
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
+		};
 	};
 };

--
2.34.1

author maintainer
#11 lore raw

PATCH v5 7/9 ARM: dts: wpcm450: Add pin functions

In reply to Jonathan Neuschäfer

As done in nuvoton-common-npcm7xx.dtsi, this patch adds pinmux nodes for all pin functions to nuvoton-wpcm450.dtsi.

---

v4-v5:
- no changes

v3:
- Adjust to schema changes

v2:
- no changes

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi | 305 +++++++++++++++++++++++++
 1 file changed, 305 insertions(+)
arch/arm/boot/dts/nuvoton-wpcm450.dtsi +305 -0
index 66c35626c80a6..0c547bd88bdbd 100644
@@ -148,6 +148,311 @@ gpio7: gpio@7 {
 				gpio-controller;
 				#gpio-cells = <2>;
 			};
+
+			smb3_pins: mux-smb3 {
+				groups = "smb3";
+				function = "smb3";
+			};
+
+			smb4_pins: mux-smb4 {
+				groups = "smb4";
+				function = "smb4";
+			};
+
+			smb5_pins: mux-smb5 {
+				groups = "smb5";
+				function = "smb5";
+			};
+
+			scs1_pins: mux-scs1 {
+				groups = "scs1";
+				function = "scs1";
+			};
+
+			scs2_pins: mux-scs2 {
+				groups = "scs2";
+				function = "scs2";
+			};
+
+			scs3_pins: mux-scs3 {
+				groups = "scs3";
+				function = "scs3";
+			};
+
+			smb0_pins: mux-smb0 {
+				groups = "smb0";
+				function = "smb0";
+			};
+
+			smb1_pins: mux-smb1 {
+				groups = "smb1";
+				function = "smb1";
+			};
+
+			smb2_pins: mux-smb2 {
+				groups = "smb2";
+				function = "smb2";
+			};
+
+			bsp_pins: mux-bsp {
+				groups = "bsp";
+				function = "bsp";
+			};
+
+			hsp1_pins: mux-hsp1 {
+				groups = "hsp1";
+				function = "hsp1";
+			};
+
+			hsp2_pins: mux-hsp2 {
+				groups = "hsp2";
+				function = "hsp2";
+			};
+
+			r1err_pins: mux-r1err {
+				groups = "r1err";
+				function = "r1err";
+			};
+
+			r1md_pins: mux-r1md {
+				groups = "r1md";
+				function = "r1md";
+			};
+
+			rmii2_pins: mux-rmii2 {
+				groups = "rmii2";
+				function = "rmii2";
+			};
+
+			r2err_pins: mux-r2err {
+				groups = "r2err";
+				function = "r2err";
+			};
+
+			r2md_pins: mux-r2md {
+				groups = "r2md";
+				function = "r2md";
+			};
+
+			kbcc_pins: mux-kbcc {
+				groups = "kbcc";
+				function = "kbcc";
+			};
+
+			dvo0_pins: mux-dvo0 {
+				groups = "dvo";
+				function = "dvo0";
+			};
+
+			dvo3_pins: mux-dvo3 {
+				groups = "dvo";
+				function = "dvo3";
+			};
+
+			clko_pins: mux-clko {
+				groups = "clko";
+				function = "clko";
+			};
+
+			smi_pins: mux-smi {
+				groups = "smi";
+				function = "smi";
+			};
+
+			uinc_pins: mux-uinc {
+				groups = "uinc";
+				function = "uinc";
+			};
+
+			gspi_pins: mux-gspi {
+				groups = "gspi";
+				function = "gspi";
+			};
+
+			mben_pins: mux-mben {
+				groups = "mben";
+				function = "mben";
+			};
+
+			xcs2_pins: mux-xcs2 {
+				groups = "xcs2";
+				function = "xcs2";
+			};
+
+			xcs1_pins: mux-xcs1 {
+				groups = "xcs1";
+				function = "xcs1";
+			};
+
+			sdio_pins: mux-sdio {
+				groups = "sdio";
+				function = "sdio";
+			};
+
+			sspi_pins: mux-sspi {
+				groups = "sspi";
+				function = "sspi";
+			};
+
+			fi0_pins: mux-fi0 {
+				groups = "fi0";
+				function = "fi0";
+			};
+
+			fi1_pins: mux-fi1 {
+				groups = "fi1";
+				function = "fi1";
+			};
+
+			fi2_pins: mux-fi2 {
+				groups = "fi2";
+				function = "fi2";
+			};
+
+			fi3_pins: mux-fi3 {
+				groups = "fi3";
+				function = "fi3";
+			};
+
+			fi4_pins: mux-fi4 {
+				groups = "fi4";
+				function = "fi4";
+			};
+
+			fi5_pins: mux-fi5 {
+				groups = "fi5";
+				function = "fi5";
+			};
+
+			fi6_pins: mux-fi6 {
+				groups = "fi6";
+				function = "fi6";
+			};
+
+			fi7_pins: mux-fi7 {
+				groups = "fi7";
+				function = "fi7";
+			};
+
+			fi8_pins: mux-fi8 {
+				groups = "fi8";
+				function = "fi8";
+			};
+
+			fi9_pins: mux-fi9 {
+				groups = "fi9";
+				function = "fi9";
+			};
+
+			fi10_pins: mux-fi10 {
+				groups = "fi10";
+				function = "fi10";
+			};
+
+			fi11_pins: mux-fi11 {
+				groups = "fi11";
+				function = "fi11";
+			};
+
+			fi12_pins: mux-fi12 {
+				groups = "fi12";
+				function = "fi12";
+			};
+
+			fi13_pins: mux-fi13 {
+				groups = "fi13";
+				function = "fi13";
+			};
+
+			fi14_pins: mux-fi14 {
+				groups = "fi14";
+				function = "fi14";
+			};
+
+			fi15_pins: mux-fi15 {
+				groups = "fi15";
+				function = "fi15";
+			};
+
+			pwm0_pins: mux-pwm0 {
+				groups = "pwm0";
+				function = "pwm0";
+			};
+
+			pwm1_pins: mux-pwm1 {
+				groups = "pwm1";
+				function = "pwm1";
+			};
+
+			pwm2_pins: mux-pwm2 {
+				groups = "pwm2";
+				function = "pwm2";
+			};
+
+			pwm3_pins: mux-pwm3 {
+				groups = "pwm3";
+				function = "pwm3";
+			};
+
+			pwm4_pins: mux-pwm4 {
+				groups = "pwm4";
+				function = "pwm4";
+			};
+
+			pwm5_pins: mux-pwm5 {
+				groups = "pwm5";
+				function = "pwm5";
+			};
+
+			pwm6_pins: mux-pwm6 {
+				groups = "pwm6";
+				function = "pwm6";
+			};
+
+			pwm7_pins: mux-pwm7 {
+				groups = "pwm7";
+				function = "pwm7";
+			};
+
+			hg0_pins: mux-hg0 {
+				groups = "hg0";
+				function = "hg0";
+			};
+
+			hg1_pins: mux-hg1 {
+				groups = "hg1";
+				function = "hg1";
+			};
+
+			hg2_pins: mux-hg2 {
+				groups = "hg2";
+				function = "hg2";
+			};
+
+			hg3_pins: mux-hg3 {
+				groups = "hg3";
+				function = "hg3";
+			};
+
+			hg4_pins: mux-hg4 {
+				groups = "hg4";
+				function = "hg4";
+			};
+
+			hg5_pins: mux-hg5 {
+				groups = "hg5";
+				function = "hg5";
+			};
+
+			hg6_pins: mux-hg6 {
+				groups = "hg6";
+				function = "hg6";
+			};
+
+			hg7_pins: mux-hg7 {
+				groups = "hg7";
+				function = "hg7";
+			};
 		};
 	};
 };

--
2.34.1

author maintainer
#12 lore raw

PATCH v5 8/9 ARM: dts: wpcm450-supermicro-x9sci-ln4f: Add GPIO LEDs and buttons

In reply to Jonathan Neuschäfer

The Supermicro X9SCi-LN4F server mainboard has a two LEDs and a button under the control of the BMC. This patch makes them accessible under Linux running on the BMC.

---
v4-v5:
- no changes

v3:
- Adjust to schema changes

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Adjust to new GPIO controller names
- Explicitly set pinmux to GPIO for GPIO keys and LEDs

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 .../nuvoton-wpcm450-supermicro-x9sci-ln4f.dts | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm/boot/dts/nuvoton-wpcm450-supermicro-x9sci-ln4f.dts +43 -0
index 83f27fbf4e939..3ee61251a16d0 100644
@@ -8,6 +8,9 @@
 
 #include "nuvoton-wpcm450.dtsi"
 
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/gpio/gpio.h>
+
 / {
 	model = "Supermicro X9SCi-LN4F BMC";
 	compatible = "supermicro,x9sci-ln4f-bmc", "nuvoton,wpcm450";
@@ -20,6 +23,46 @@ memory@0 {
 		device_type = "memory";
 		reg = <0 0x08000000>; /* 128 MiB */
 	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&key_pins>;
+
+		uid {
+			label = "UID button";
+			linux,code = <KEY_HOME>;
+			gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_pins>;
+
+		uid {
+			label = "UID";
+			gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+		};
+
+		heartbeat {
+			label = "heartbeat";
+			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&pinctrl {
+	key_pins: mux-keys {
+		groups = "gspi", "sspi";
+		function = "gpio";
+	};
+
+	led_pins: mux-leds {
+		groups = "hg3", "hg0", "pwm4";
+		function = "gpio";
+	};
 };
 
 &serial0 {

--
2.34.1

author maintainer
#13 lore raw

PATCH v5 9/9 ARM: dts: wpcm450: Add pinmux information to UART0

In reply to Jonathan Neuschäfer

UART0 always uses the same pins, so lets add the pinctrl information to the common devicetree for WPCM450.

UART1 has different connection options, so I'm not adding the pinctrl properties there.

---

v4-v5:
- no changes

v3:
- New patch

---
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/nuvoton-wpcm450.dtsi +2 -0
index 0c547bd88bdbd..93595850a4c3c 100644
@@ -55,6 +55,8 @@ serial0: serial@b8000000 {
 			reg-shift = <2>;
 			interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk24m>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&bsp_pins>;
 			status = "disabled";
 		};
 

--
2.34.1

#14 lore raw
In reply to Jonathan Neuschäfer
Quoted 1 line · Jonathan Neuschäfer

This is version 5 of the WPCM450 pinctrl/GPIO driver patchset.

I haven't had time to look in detail but the kernel robot is complaining about patch 5...

Quoted 5 lines

I was originally just going to rebase the patchset on top of v5.17-rc1, but while testing, I found that the IRQ handling code violated locking rules, specifically that it used spin locks (which can sleep on RT kernels) in IRQ contexts. So I made a few changes to fix that, mainly switching to raw spin locks.

Which patches do you expect to be applied to the pin control tree?

Yours,
Linus Walleij

author maintainer
#15 lore raw
Quoted 7 lines · Linus Walleij
Quoted 1 line · Jonathan Neuschäfer

This is version 5 of the WPCM450 pinctrl/GPIO driver patchset.

I haven't had time to look in detail but the kernel robot is complaining about patch 5...

These are warnings about the pinctrl-npcm7xx driver that became (more easily) visible under CONFIG_COMPILE_TEST through my patch.

Quoted 8 lines
Quoted 6 lines

I was originally just going to rebase the patchset on top of v5.17-rc1, but while testing, I found that the IRQ handling code violated locking rules, specifically that it used spin locks (which can sleep on RT kernels) in IRQ contexts. So I made a few changes to fix that, mainly switching to raw spin locks.

Which patches do you expect to be applied to the pin control tree?

These two:

[PATCH v5 4/9] dt-bindings: pinctrl: Add Nuvoton WPCM450 [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

and the rest can go through Joel Stanley's BMC tree, I think.

Thanks,
Jonathan

#16 lore raw
Quoted 7 lines · Jonathan Neuschäfer
Quoted 4 lines · Linus Walleij
Quoted 1 line · Jonathan Neuschäfer

This is version 5 of the WPCM450 pinctrl/GPIO driver patchset.

Quoted 8 lines
Quoted 1 line

Which patches do you expect to be applied to the pin control tree?

These two:

[PATCH v5 4/9] dt-bindings: pinctrl: Add Nuvoton WPCM450 [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

and the rest can go through Joel Stanley's BMC tree, I think.

Seems reasonable. I assume you're sending a v6 to fix some of the warnings?

Cheers,

Joel

author maintainer
#17 lore raw
Quoted 10 lines · Joel Stanley
Quoted 9 lines · Jonathan Neuschäfer
Quoted 6 lines · Linus Walleij
Quoted 1 line · Jonathan Neuschäfer

This is version 5 of the WPCM450 pinctrl/GPIO driver patchset.

Which patches do you expect to be applied to the pin control tree?

Quoted 8 lines
Quoted 6 lines

These two:

[PATCH v5 4/9] dt-bindings: pinctrl: Add Nuvoton WPCM450 [PATCH v5 5/9] pinctrl: nuvoton: Add driver for WPCM450

and the rest can go through Joel Stanley's BMC tree, I think.

Seems reasonable. I assume you're sending a v6 to fix some of the warnings?

No, the warnings are fairly independent of this patchset, it's just that the adjacent pinctrl-npcm7xx driver started to be built by the bot, due to my Kconfig change. I'll fix them in a separate patchset.

Jonathan

#18 lore raw
Quoted 2 lines · Jonathan Neuschäfer
Quoted 1 line · Joel Stanley

On Tue, 1 Feb 2022 at 13:05, Jonathan Neuschäfer <[email protected]> wrote:

...

Quoted 5 lines
Quoted 1 line

I assume you're sending a v6 to fix some of the warnings?

No, the warnings are fairly independent of this patchset, it's just that the adjacent pinctrl-npcm7xx driver started to be built by the bot, due to my Kconfig change. I'll fix them in a separate patchset.

I guess you need to fix that first.

Because now and then all CIs will complain to your patch and confuse people.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#19 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Jonathan Neuschäfer
Quoted 1 line · Joel Stanley

On Tue, 1 Feb 2022 at 13:05, Jonathan Neuschäfer <[email protected]> wrote:

...

Quoted 2 lines
Quoted 1 line

I assume you're sending a v6 to fix some of the warnings?

Quoted 7 lines
Quoted 3 lines

No, the warnings are fairly independent of this patchset, it's just that the adjacent pinctrl-npcm7xx driver started to be built by the bot, due to my Kconfig change. I'll fix them in a separate patchset.

I guess you need to fix that first.

Because now and then all CIs will complain to your patch and confuse people.

Hm, right.

I'll send the pinctrl-npcm7xx fixes, and then a version 6 of this patchset if necessary.

Jonathan

author maintainer
#20 lore raw
In reply to Andy Shevchenko
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Jonathan Neuschäfer
Quoted 1 line · Joel Stanley

On Tue, 1 Feb 2022 at 13:05, Jonathan Neuschäfer <[email protected]> wrote:

...

Quoted 2 lines
Quoted 1 line

I assume you're sending a v6 to fix some of the warnings?

Quoted 7 lines
Quoted 3 lines

No, the warnings are fairly independent of this patchset, it's just that the adjacent pinctrl-npcm7xx driver started to be built by the bot, due to my Kconfig change. I'll fix them in a separate patchset.

I guess you need to fix that first.

Because now and then all CIs will complain to your patch and confuse people.

FWIW, Linus has applied the npcm7xx fixes to for-next in the pinctrl tree, which means that they are not blocking this patchset anymore, AFAICS.

Jonathan

#21 lore raw
Quoted 15 lines · Jonathan Neuschäfer
Quoted 13 lines · Andy Shevchenko
Quoted 2 lines · Jonathan Neuschäfer
Quoted 1 line · Joel Stanley

On Tue, 1 Feb 2022 at 13:05, Jonathan Neuschäfer <[email protected]> wrote:

...

Quoted 5 lines
Quoted 1 line

I assume you're sending a v6 to fix some of the warnings?

No, the warnings are fairly independent of this patchset, it's just that the adjacent pinctrl-npcm7xx driver started to be built by the bot, due to my Kconfig change. I'll fix them in a separate patchset.

Quoted 6 lines
Quoted 3 lines

I guess you need to fix that first.

Because now and then all CIs will complain to your patch and confuse people.

FWIW, Linus has applied the npcm7xx fixes to for-next in the pinctrl tree, which means that they are not blocking this patchset anymore, AFAICS.

I've applied the device tree changes, and I will send a pull request for v5.18 with those.

I assume you want Linus to merge the pinctrl bindings and driver through his tree.

Cheers,

Joel

author maintainer
#22 lore raw
Quoted 18 lines · Joel Stanley
Quoted 17 lines · Jonathan Neuschäfer
Quoted 15 lines · Andy Shevchenko
Quoted 2 lines · Jonathan Neuschäfer
Quoted 1 line · Joel Stanley

On Tue, 1 Feb 2022 at 13:05, Jonathan Neuschäfer <[email protected]> wrote:

...

Quoted 5 lines
Quoted 1 line

I assume you're sending a v6 to fix some of the warnings?

No, the warnings are fairly independent of this patchset, it's just that the adjacent pinctrl-npcm7xx driver started to be built by the bot, due to my Kconfig change. I'll fix them in a separate patchset.

I guess you need to fix that first.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Because now and then all CIs will complain to your patch and confuse people.

FWIW, Linus has applied the npcm7xx fixes to for-next in the pinctrl tree, which means that they are not blocking this patchset anymore, AFAICS.

I've applied the device tree changes, and I will send a pull request for v5.18 with those.

Thanks!

Quoted 2 lines

I assume you want Linus to merge the pinctrl bindings and driver through his tree.

Yes, that sounds alright.

Jonathan

#23 lore raw
In reply to Jonathan Neuschäfer
Quoted 2 lines · Jonathan Neuschäfer

dt-bindings: pinctrl: Add Nuvoton WPCM450
pinctrl: nuvoton: Add driver for WPCM450

I applied these two to the pinctrl tree. Sorry for taking forever to figure out that I needed to do this :/

Yours,
Linus Walleij

#24 lore raw
Quoted 9 lines · Linus Walleij
Quoted 2 lines · Jonathan Neuschäfer

dt-bindings: pinctrl: Add Nuvoton WPCM450
pinctrl: nuvoton: Add driver for WPCM450

I applied these two to the pinctrl tree. Sorry for taking forever to figure out that I needed to do this :/

Thanks Linus. The device tree changes are queued for v5.18 too, so they will all go in at the same time.

Cheers,

Joel