Skip to contentSkip to conversation

pinctrl: add BCM63XX pincontrol support

PATCH Superseded Álvaro Fernández Rojas 3 participants 29 messages Feb 25, 2021 – Mar 2, 2021

Subsystems (3)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover pinctrl: add BCM63XX pincontrol support

First of all, I've based this on the patches sent by Jonas Gorski back in 2016:
https://www.spinics.net/lists/linux-gpio/msg15983.html
http://patchwork.ozlabs.org/project/linux-gpio/patch/[email protected]/

I've tried to address all coments from Linus Walleij, but I know that this may still need some other modifications

This patchset adds appropriate binding documentation and drivers for pin controller cores found in the BCM63XX MIPS SoCs currently supported.

While the GPIO part is always the same, the pinmux part varies quite a lot between different SoCs. Sometimes they have defined groups which can be muxed into different functions, sometimes each function has a different group. Sometimes you can mux individual pins. Often it is a combination of single pins and groups.

Some core versions require the GPIO direction to be set according to the function, most do not. Sometimes the mux register(s) contain bits for unrelated other functions.

Álvaro Fernández Rojas (12):
Documentation: add BCM6328 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6328
Documentation: add BCM6358 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6358
Documentation: add BCM6362 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6362
Documentation: add BCM6368 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6368
Documentation: add BCM63268 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM63268
Documentation: add BCM6318 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6318

 .../pinctrl/brcm,bcm6318-pinctrl.yaml         | 173 ++++
 .../pinctrl/brcm,bcm63268-pinctrl.yaml        | 198 +++++
 .../pinctrl/brcm,bcm6328-pinctrl.yaml         | 161 ++++
 .../pinctrl/brcm,bcm6358-pinctrl.yaml         | 131 +++
 .../pinctrl/brcm,bcm6362-pinctrl.yaml         | 240 +++++
 .../pinctrl/brcm,bcm6368-pinctrl.yaml         | 255 ++++++
 drivers/pinctrl/bcm/Kconfig                   |  66 ++
 drivers/pinctrl/bcm/Makefile                  |   6 +
 drivers/pinctrl/bcm/pinctrl-bcm6318.c         | 674 ++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm63268.c        | 821 ++++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6328.c         | 581 +++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6358.c         | 526 +++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6362.c         | 794 +++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6368.c         | 679 +++++++++++++++
 14 files changed, 5305 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6318.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63268.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6328.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6358.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6362.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6368.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/12 Documentation: add BCM6328 pincontroller binding documentation

Add binding documentation for the pincontrol core found in BCM6328 SoCs.

---
 .../pinctrl/brcm,bcm6328-pinctrl.yaml         | 161 ++++++++++++++++++
 1 file changed, 161 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml new file +161 -0
new file mode 100644
index 000000000000..2012cb1dbf5c
@@ -0,0 +1,161 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6328-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6328 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6328-pinctrl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      Specifies the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4
+
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ serial_led_data, serial_led_clk, inet_act_led, pcie_clkreq,
+                  led, ephy0_act_led, ephy1_act_led, ephy2_act_led,
+                  ephy3_act_led, hsspi_cs1, usb_device_port, usb_host_port ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio6, gpio7, gpio11, gpio16, gpio17, gpio18, gpio19,
+                  gpio20, gpio25, gpio26, gpio27, gpio28, hsspi_cs1,
+                  usb_port1 ]
+
+required:
+  - compatible
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6328-pinctrl";
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        interrupts-extended = <&ext_intc 3 0>,
+                              <&ext_intc 2 0>,
+                              <&ext_intc 1 0>,
+                              <&ext_intc 0 0>;
+        interrupt-names = "gpio12",
+                          "gpio15",
+                          "gpio23",
+                          "gpio24";
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio6";
+          };
+
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio7";
+          };
+        };
+
+        pinctrl_inet_act_led: inet_act_led {
+          function = "inet_act_led";
+          pins = "gpio11";
+        };
+
+        pinctrl_pcie_clkreq: pcie_clkreq {
+          function = "pcie_clkreq";
+          pins = "gpio16";
+        };
+
+        pinctrl_ephy0_spd_led: ephy0_spd_led {
+          function = "led";
+          pins = "gpio17";
+        };
+
+        pinctrl_ephy1_spd_led: ephy1_spd_led {
+          function = "led";
+          pins = "gpio18";
+        };
+
+        pinctrl_ephy2_spd_led: ephy2_spd_led {
+          function = "led";
+          pins = "gpio19";
+        };
+
+        pinctrl_ephy3_spd_led: ephy3_spd_led {
+          function = "led";
+          pins = "gpio20";
+        };
+
+        pinctrl_ephy0_act_led: ephy0_act_led {
+          function = "ephy0_act_led";
+          pins = "gpio25";
+        };
+
+        pinctrl_ephy1_act_led: ephy1_act_led {
+          function = "ephy1_act_led";
+          pins = "gpio26";
+        };
+
+        pinctrl_ephy2_act_led: ephy2_act_led {
+          function = "ephy2_act_led";
+          pins = "gpio27";
+        };
+
+        pinctrl_ephy3_act_led: ephy3_act_led {
+          function = "ephy3_act_led";
+          pins = "gpio28";
+        };
+
+        pinctrl_hsspi_cs1: hsspi_cs1 {
+          function = "hsspi_cs1";
+          pins = "hsspi_cs1";
+        };
+
+        pinctrl_usb_port1_device: usb_port1_device {
+          function = "usb_device_port";
+          pins = "usb_port1";
+        };
+
+        pinctrl_usb_port1_host: usb_port1_host {
+          function = "usb_host_port";
+          pins = "usb_port1";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH 01/12] Documentation: add BCM6328 pincontroller binding documentation

Quoted 4 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6328 SoCs.

(...)

Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4

I don't know if this is advisable, there are different ways of specifying interrupts so this may become ambiguous, I think Rob will know how/if to do this though.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH 01/12] Documentation: add BCM6328 pincontroller binding documentation

Quoted 15 lines · Linus Walleij
Quoted 4 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6328 SoCs.

(...)

Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4
Quoted 3 lines

I don't know if this is advisable, there are different ways of specifying interrupts so this may become ambiguous, I think Rob will know how/if to do this though.

After reading the code I conclude this gpiochip is hierarchical so this should just be dropped, and we only need interrupt-parent assigned. The driver will know the hardware offsets between the interrupt parent and the GPIO block, this is generally the case for
hierarchical interrupt controllers.

Yours,
Linus Walleij

#4 lore raw

Re: [PATCH 01/12] Documentation: add BCM6328 pincontroller binding documentation

Hi Linus,

I think it's better if we leave the interrupts out for now. It's not critical and it can be added later.

Best regards,
Álvaro.

Quoted 29 lines · Linus Walleij
Quoted 15 lines · Linus Walleij
Quoted 4 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6328 SoCs.

(...)

Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4
Quoted 3 lines

I don't know if this is advisable, there are different ways of specifying interrupts so this may become ambiguous, I think Rob will know how/if to do this though.

After reading the code I conclude this gpiochip is hierarchical so this should just be dropped, and we only need interrupt-parent assigned. The driver will know the hardware offsets between the interrupt parent and the GPIO block, this is generally the case for
hierarchical interrupt controllers.

Yours,
Linus Walleij

#5 lore raw

PATCH 2/12 pinctrl: add a pincontrol driver for BCM6328

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode.

---
 drivers/pinctrl/bcm/Kconfig           |  11 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6328.c | 581 ++++++++++++++++++++++++++
 3 files changed, 593 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6328.c
drivers/pinctrl/bcm/Kconfig +11 -0
index 0ed14de0134c..4c6e41cf7a32 100644
@@ -29,6 +29,17 @@ config PINCTRL_BCM2835
 	help
 	   Say Y here to enable the Broadcom BCM2835 GPIO driver.
 
+config PINCTRL_BCM6328
+	bool "Broadcom BCM6328 GPIO driver"
+	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select MFD_SYSCON
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6328 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 79d5e49fdd9a..7e7c6e25b26d 100644
@@ -3,6 +3,7 @@
 
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_IPROC_GPIO)	+= pinctrl-iproc-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
 obj-$(CONFIG_PINCTRL_NS)		+= pinctrl-ns.o
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +581 -0

581 lines not on this page · raw message

Signature · 1 line
2.20.1
#6 lore raw

Re: [PATCH 02/12] pinctrl: add a pincontrol driver for BCM6328

Hi Álvaro,

thanks for your patch!

Quoted 7 lines · Álvaro Fernández Rojas

Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode.

Thanks for working on this. This SoC definitely need to come upstream.

I think this driver can be simplified a bit and reuse some core infrastructure to make it more maintainable. It might be a bit of challenge but definitely worth it!

drivers/pinctrl/bcm/Kconfig config PINCTRL_BCM2835 · line 41

Quoted 10 lines
drivers/pinctrl/bcm/Kconfig +10 -0
+config PINCTRL_BCM6328
+       bool "Broadcom BCM6328 GPIO driver"
+       depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+       select PINMUX
+       select PINCONF
+       select GENERIC_PINCONF
+       select MFD_SYSCON
+       default BMIPS_GENERIC
+       help
+          Say Y here to enable the Broadcom BCM6328 GPIO driver.

I suggest

select GPIO_REGMAP
select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY

see below.

(...)

Quoted 1 line

+#include <linux/bitops.h>

Just <linux/bits.h> maybe, if you only use BIT() and GENMASK().

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 14

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +2 -0
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>

Do not include these, just:
#include <linux/gpio/driver.h>

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 35

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+#define BCM6328_DIROUT_REG     0x04
+#define BCM6328_DATA_REG       0x0c
+#define BCM6328_MODE_REG       0x18

This looks very much like it could use GPIO_REGMAP. Can you look at:
drivers/gpio/gpio-regmap.c drivers/gpio/gpio-sl28cpld.c

And see if you can do what that driver is doing and reuse this core infrastructure?

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 295

Quoted 4 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +4 -0
+static inline unsigned int bcm6328_bank_pin(unsigned int pin)
+{
+       return pin % PINS_PER_BANK;
+}

I am generally reluctant about registering several banks/instances of the GPIO if it is possible to just use more devices in the device tree, like one for each instance.

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 311

Quoted 4 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +4 -0
+static inline unsigned int bcm6328_reg_off(unsigned int reg, unsigned int pin)
+{
+       return reg - (pin / PINS_PER_BANK) * BANK_SIZE;
+}

Because it leads to this kind of weirdness to split out the devices from the main device in practice.

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+static int bcm6328_gpio_direction_input(struct gpio_chip *chip,
+                                       unsigned int pin)
+{

(...)

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 327

Quoted 7 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +7 -0
+       /*
+        * Check with the pinctrl driver whether this pin is usable as
+        * an input GPIO
+        */
+       ret = pinctrl_gpio_direction_input(chip->base + pin);
+       if (ret)
+               return ret;

This is very nice.

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 403

Quoted 8 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +8 -0
+static int bcm6328_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
+{
+       char irq_name[7];
+
+       sprintf(irq_name, "gpio%d", gpio);
+
+       return of_irq_get_byname(chip->of_node, irq_name);
+}

This is a clear indication that we are dealing with a hierarchical irqchip.

My assumption is that you have one IRQ per GPIO line, so each GPIO has a dedicated IRQ on the interrupt controller. Correct?

This means:

- Do not add all the interrupts into the device tree by name.

- In Kconfig select GPIOLIB_IRQCHIP, select IRQ_DOMAIN_HIERARCHY

- Populate a simple struct gpio_irq_chip, if no local registers need updating on interrupts, just pass interrupts through
.irq_mask = irq_chip_mask_parent,
.irq_unmask = irq_chip_unmask_parent,
etc.

- Implement bcm6328_gpio_child_to_parent_hwirq() for this chip with hardcoded mappings between the hardware GPIO and interrupt lines, using the parent interrupt controller hierarchically. This mapping is determined from the compatible-string, and part of the property of how the GPIO block is integrated with the SoC. If need be to tell different chips apart, more precise compatible strings are needed.

- Examples:
drivers/gpio/gpio-ixp4xx.c
drivers/gpio/gpio-sifive.c

If you do this you will notice the core is more helpful to cut down on the code.

Yours,
Linus Walleij

#7 lore raw

Re: [PATCH 02/12] pinctrl: add a pincontrol driver for BCM6328

Hi Linus,

Quoted 12 lines · Linus Walleij

Hi Álvaro,

thanks for your patch!

Quoted 5 lines · Álvaro Fernández Rojas

Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode.

Quoted 4 lines
Quoted 2 lines

Thanks for working on this. This SoC definitely need to come upstream.

I will try my best :).

Quoted 44 lines

I think this driver can be simplified a bit and reuse some core infrastructure to make it more maintainable. It might be a bit of challenge but definitely worth it!

drivers/pinctrl/bcm/Kconfig config PINCTRL_BCM2835 · line 41

Quoted 10 lines
drivers/pinctrl/bcm/Kconfig +10 -0
+config PINCTRL_BCM6328
+       bool "Broadcom BCM6328 GPIO driver"
+       depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+       select PINMUX
+       select PINCONF
+       select GENERIC_PINCONF
+       select MFD_SYSCON
+       default BMIPS_GENERIC
+       help
+          Say Y here to enable the Broadcom BCM6328 GPIO driver.

I suggest

select GPIO_REGMAP
select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY

see below.

(...)

Quoted 1 line

+#include <linux/bitops.h>

Just <linux/bits.h> maybe, if you only use BIT() and GENMASK().

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 14

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +2 -0
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>

Do not include these, just:
#include <linux/gpio/driver.h>

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 35

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+#define BCM6328_DIROUT_REG     0x04
+#define BCM6328_DATA_REG       0x0c
+#define BCM6328_MODE_REG       0x18

This looks very much like it could use GPIO_REGMAP. Can you look at:
drivers/gpio/gpio-regmap.c drivers/gpio/gpio-sl28cpld.c

Quoted 2 lines

And see if you can do what that driver is doing and reuse this core infrastructure?

I've just checked drivers/gpio/gpio-regmap.c and it seems that "struct gpio_regmap" should be declared in include/linux/gpio/regmap.h. Right now devm_gpio_regmap_register() is returning a pointer to a structure which none except gpio-regmap knows. Does that make any sense? I need to access gpio_regmap->gpio_chip in order to gather gpio_chip.base and pass it to pinctrl_add_gpio_range().

Quoted 69 lines

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 295

Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +4 -0
+static inline unsigned int bcm6328_bank_pin(unsigned int pin)
+{
+       return pin % PINS_PER_BANK;
+}

I am generally reluctant about registering several banks/instances of the GPIO if it is possible to just use more devices in the device tree, like one for each instance.

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 311

Quoted 4 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +4 -0
+static inline unsigned int bcm6328_reg_off(unsigned int reg, unsigned int pin)
+{
+       return reg - (pin / PINS_PER_BANK) * BANK_SIZE;
+}

Because it leads to this kind of weirdness to split out the devices from the main device in practice.

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+static int bcm6328_gpio_direction_input(struct gpio_chip *chip,
+                                       unsigned int pin)
+{

(...)

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 327

Quoted 7 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +7 -0
+       /*
+        * Check with the pinctrl driver whether this pin is usable as
+        * an input GPIO
+        */
+       ret = pinctrl_gpio_direction_input(chip->base + pin);
+       if (ret)
+               return ret;

This is very nice.

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 403

Quoted 8 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +8 -0
+static int bcm6328_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
+{
+       char irq_name[7];
+
+       sprintf(irq_name, "gpio%d", gpio);
+
+       return of_irq_get_byname(chip->of_node, irq_name);
+}

This is a clear indication that we are dealing with a hierarchical irqchip.

My assumption is that you have one IRQ per GPIO line, so each GPIO has a dedicated IRQ on the interrupt controller. Correct?

This means:

- Do not add all the interrupts into the device tree by name.

- In Kconfig select GPIOLIB_IRQCHIP, select IRQ_DOMAIN_HIERARCHY

- Populate a simple struct gpio_irq_chip, if no local registers need updating on interrupts, just pass interrupts through
.irq_mask = irq_chip_mask_parent,
.irq_unmask = irq_chip_unmask_parent,
etc.

- Implement bcm6328_gpio_child_to_parent_hwirq() for this chip with hardcoded mappings between the hardware GPIO and interrupt lines, using the parent interrupt controller hierarchically. This mapping is determined from the compatible-string, and part of the property of how the GPIO block is integrated with the SoC. If need be to tell different chips apart, more precise compatible strings are needed.

- Examples:
drivers/gpio/gpio-ixp4xx.c
drivers/gpio/gpio-sifive.c

Quoted 6 lines

If you do this you will notice the core is more helpful to cut down on the code.

Yours,
Linus Walleij

Best regards,
Álvaro.

#8 lore raw

PATCH 3/12 Documentation: add BCM6358 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6358 SoCs.

---
 .../pinctrl/brcm,bcm6358-pinctrl.yaml         | 131 ++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml new file +131 -0
new file mode 100644
index 000000000000..d86608173498
@@ -0,0 +1,131 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6358-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6358 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6358-pinctrl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      Specifies the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 6
+    maxItems: 6
+
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ ebi_cs, uart1, serial_led, legacy_led, led, spi_cs, utopia,
+                  pwm_syn_clk, sys_irq ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ ebi_cs_grp, uart1_grp, serial_led_grp, legacy_led_grp,
+                  led_grp, spi_cs_grp, utopia_grp, pwm_syn_clk, sys_irq_grp ]
+
+required:
+  - compatible
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@fffe0080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0xfffe0080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6358-pinctrl";
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        interrupts-extended = <&ext_intc1 0 0>,
+                              <&ext_intc1 1 0>,
+                              <&ext_intc0 0 0>,
+                              <&ext_intc0 1 0>,
+                              <&ext_intc0 2 0>,
+                              <&ext_intc0 3 0>;
+        interrupt-names = "gpio32",
+                          "gpio33",
+                          "gpio34",
+                          "gpio35",
+                          "gpio36",
+                          "gpio37";
+
+        pinctrl_ebi_cs: ebi_cs {
+          function = "ebi_cs";
+          groups = "ebi_cs_grp";
+        };
+
+        pinctrl_uart1: uart1 {
+          function = "uart1";
+          groups = "uart1_grp";
+        };
+
+        pinctrl_serial_led: serial_led {
+          function = "serial_led";
+          groups = "serial_led_grp";
+        };
+
+        pinctrl_legacy_led: legacy_led {
+          function = "legacy_led";
+          groups = "legacy_led_grp";
+        };
+
+        pinctrl_led: led {
+          function = "led";
+          groups = "led_grp";
+        };
+
+        pinctrl_spi_cs_23: spi_cs {
+          function = "spi_cs";
+          groups = "spi_cs_grp";
+        };
+
+        pinctrl_utopia: utopia {
+          function = "utopia";
+          groups = "utopia_grp";
+        };
+
+        pinctrl_pwm_syn_clk: pwm_syn_clk {
+          function = "pwm_syn_clk";
+          groups = "pwm_syn_clk_grp";
+        };
+
+        pinctrl_sys_irq: sys_irq {
+          function = "sys_irq";
+          groups = "sys_irq_grp";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#9 lore raw

Re: [PATCH 03/12] Documentation: add BCM6358 pincontroller binding documentation

Quoted 4 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6358 SoCs.

(...)

Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml line 33

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml new file +3 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,

4? Below says 6.

Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml line 36

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml new file +3 -0
+      sorted by port number ascending order.
+    minItems: 6
+    maxItems: 6

As noted in the review I think this interrupt controller is hierarchical and this is not needed. All that is needed is for the chip to know its interrupt-parent.

Yours,
Linus Walleij

#10 lore raw

PATCH 4/12 pinctrl: add a pincontrol driver for BCM6358

In reply to Álvaro Fernández Rojas

Add a pincotrol driver for BCM6358. BCM6358 allow overlaying different functions onto the GPIO pins. It does not support configuring individual pins but only whole groups. These groups may overlap, and still require the directions to be set correctly in the GPIO register. In addition the functions register controls other, not directly mux related functions.

---
 drivers/pinctrl/bcm/Kconfig           |  11 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6358.c | 526 ++++++++++++++++++++++++++
 3 files changed, 538 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6358.c
drivers/pinctrl/bcm/Kconfig +11 -0
index 4c6e41cf7a32..dd82a34125ed 100644
@@ -40,6 +40,17 @@ config PINCTRL_BCM6328
 	help
 	   Say Y here to enable the Broadcom BCM6328 GPIO driver.
 
+config PINCTRL_BCM6358
+	bool "Broadcom BCM6358 GPIO driver"
+	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select MFD_SYSCON
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6358 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 7e7c6e25b26d..794d07d97754 100644
@@ -4,6 +4,7 @@
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
+obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_IPROC_GPIO)	+= pinctrl-iproc-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
 obj-$(CONFIG_PINCTRL_NS)		+= pinctrl-ns.o
drivers/pinctrl/bcm/pinctrl-bcm6358.c new file +526 -0

526 lines not on this page · raw message

Signature · 1 line
2.20.1
#11 lore raw

Re: [PATCH 04/12] pinctrl: add a pincontrol driver for BCM6358

Quoted 8 lines · Álvaro Fernández Rojas

Add a pincotrol driver for BCM6358. BCM6358 allow overlaying different functions onto the GPIO pins. It does not support configuring individual pins but only whole groups. These groups may overlap, and still require the directions to be set correctly in the GPIO register. In addition the functions register controls other, not directly mux related functions.

All of my review comments on the first driver in the series goes for this one as well, so copy/paste all my comments from there :D

The good thing is once you get it right in one driver you will get it right in all of them.

Consider bringing all common code together in a main driver shared by all these pin controllers as per the pattern of other pin controllers (se qcom for example).

Yours,
Linus Walleij

#12 lore raw

PATCH 5/12 Documentation: add BCM6362 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6362 SoCs.

---
 .../pinctrl/brcm,bcm6362-pinctrl.yaml         | 240 ++++++++++++++++++
 1 file changed, 240 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml new file +240 -0
new file mode 100644
index 000000000000..57a1718b179a
@@ -0,0 +1,240 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6362-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6362 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6362-pinctrl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      Specifies the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4
+
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ usb_device_led, sys_irq, serial_led_clk, serial_led_data,
+                  robosw_led_data, robosw_led_clk, robosw_led0, robosw_led1,
+                  inet_led, spi_cs2, spi_cs3, ntr_pulse, uart1_scts,
+                  uart1_srts, uart1_sdin, uart1_sdout, adsl_spi_miso,
+                  adsl_spi_mosi, adsl_spi_clk, adsl_spi_cs, ephy0_led,
+                  ephy1_led, ephy2_led, ephy3_led, ext_irq0, ext_irq1,
+                  ext_irq2, ext_irq3, nand ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7,
+                  gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14,
+                  gpio15, gpio16, gpio17, gpio18, gpio19, gpio20, gpio21,
+                  gpio22, gpio23, gpio24, gpio25, gpio26, gpio27, nand_grp ]
+
+required:
+  - compatible
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6362-pinctrl";
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        interrupts-extended = <&ext_intc 0 0>,
+                              <&ext_intc 1 0>,
+                              <&ext_intc 2 0>,
+                              <&ext_intc 3 0>;
+        interrupt-names = "gpio24",
+                          "gpio25",
+                          "gpio26",
+                          "gpio27";
+
+        pinctrl_usb_device_led: usb_device_led {
+          function = "usb_device_led";
+          pins = "gpio0";
+        };
+
+        pinctrl_sys_irq: sys_irq {
+          function = "sys_irq";
+          pins = "gpio1";
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio2";
+          };
+
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio3";
+          };
+        };
+
+        pinctrl_robosw_led_data: robosw_led_data {
+          function = "robosw_led_data";
+          pins = "gpio4";
+        };
+
+        pinctrl_robosw_led_clk: robosw_led_clk {
+          function = "robosw_led_clk";
+          pins = "gpio5";
+        };
+
+        pinctrl_robosw_led0: robosw_led0 {
+          function = "robosw_led0";
+          pins = "gpio6";
+        };
+
+        pinctrl_robosw_led1: robosw_led1 {
+          function = "robosw_led1";
+          pins = "gpio7";
+        };
+
+        pinctrl_inet_led: inet_led {
+          function = "inet_led";
+          pins = "gpio8";
+        };
+
+        pinctrl_spi_cs2: spi_cs2 {
+          function = "spi_cs2";
+          pins = "gpio9";
+        };
+
+        pinctrl_spi_cs3: spi_cs3 {
+          function = "spi_cs3";
+          pins = "gpio10";
+        };
+
+        pinctrl_ntr_pulse: ntr_pulse {
+          function = "ntr_pulse";
+          pins = "gpio11";
+        };
+
+        pinctrl_uart1_scts: uart1_scts {
+          function = "uart1_scts";
+          pins = "gpio12";
+        };
+
+        pinctrl_uart1_srts: uart1_srts {
+          function = "uart1_srts";
+          pins = "gpio13";
+        };
+
+        pinctrl_uart1: uart1 {
+          pinctrl_uart1_sdin: uart1_sdin {
+            function = "uart1_sdin";
+            pins = "gpio14";
+          };
+
+          pinctrl_uart1_sdout: uart1_sdout {
+            function = "uart1_sdout";
+            pins = "gpio15";
+          };
+        };
+
+        pinctrl_adsl_spi: adsl_spi {
+          pinctrl_adsl_spi_miso: adsl_spi_miso {
+            function = "adsl_spi_miso";
+            pins = "gpio16";
+          };
+
+          pinctrl_adsl_spi_mosi: adsl_spi_mosi {
+            function = "adsl_spi_mosi";
+            pins = "gpio17";
+          };
+
+          pinctrl_adsl_spi_clk: adsl_spi_clk {
+            function = "adsl_spi_clk";
+            pins = "gpio18";
+          };
+
+          pinctrl_adsl_spi_cs: adsl_spi_cs {
+            function = "adsl_spi_cs";
+            pins = "gpio19";
+          };
+        };
+
+        pinctrl_ephy0_led: ephy0_led {
+          function = "ephy0_led";
+          pins = "gpio20";
+        };
+
+        pinctrl_ephy1_led: ephy1_led {
+          function = "ephy1_led";
+          pins = "gpio21";
+        };
+
+        pinctrl_ephy2_led: ephy2_led {
+          function = "ephy2_led";
+          pins = "gpio22";
+        };
+
+        pinctrl_ephy3_led: ephy3_led {
+          function = "ephy3_led";
+          pins = "gpio23";
+        };
+
+        pinctrl_ext_irq0: ext_irq0 {
+          function = "ext_irq0";
+          pins = "gpio24";
+        };
+
+        pinctrl_ext_irq1: ext_irq1 {
+          function = "ext_irq1";
+          pins = "gpio25";
+        };
+
+        pinctrl_ext_irq2: ext_irq2 {
+          function = "ext_irq2";
+          pins = "gpio26";
+        };
+
+        pinctrl_ext_irq3: ext_irq3 {
+          function = "ext_irq3";
+          pins = "gpio27";
+        };
+
+        pinctrl_nand: nand {
+          function = "nand";
+          group = "nand_grp";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#13 lore raw

Re: [PATCH 05/12] Documentation: add BCM6362 pincontroller binding documentation

Quoted 4 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6362 SoCs.

(...)

Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4

Same comment here. This is hierarchical.

Yours,
Linus Walleij

#14 lore raw

PATCH 6/12 pinctrl: add a pincontrol driver for BCM6362

In reply to Álvaro Fernández Rojas

Add a pincotrol driver for BCM6362. BCM6362 allows muxing individual GPIO pins to the LED controller, to be available by the integrated wifi, or other functions. It also supports overlay groups, of which only NAND is documented.

---
 drivers/pinctrl/bcm/Kconfig           |  11 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6362.c | 794 ++++++++++++++++++++++++++
 3 files changed, 806 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6362.c
drivers/pinctrl/bcm/Kconfig +11 -0
index dd82a34125ed..44517f6407cf 100644
@@ -51,6 +51,17 @@ config PINCTRL_BCM6358
 	help
 	   Say Y here to enable the Broadcom BCM6358 GPIO driver.
 
+config PINCTRL_BCM6362
+	bool "Broadcom BCM6362 GPIO driver"
+	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select MFD_SYSCON
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6362 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 794d07d97754..0ade52a390cb 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
+obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
 obj-$(CONFIG_PINCTRL_IPROC_GPIO)	+= pinctrl-iproc-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
 obj-$(CONFIG_PINCTRL_NS)		+= pinctrl-ns.o
drivers/pinctrl/bcm/pinctrl-bcm6362.c new file +794 -0

794 lines not on this page · raw message

Signature · 1 line
2.20.1
#15 lore raw

Re: [PATCH 06/12] pinctrl: add a pincontrol driver for BCM6362

Thank you for the patch! Perhaps something to improve:

Hi "Álvaro,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pinctrl/devel]
[also build test WARNING on v5.11 next-20210225]
[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/lvaro-Fern-ndez-Rojas/pinctrl-add-BCM63XX-pincontrol-support/20210226-004852
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.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/94439d611efa703b016c515bd904f5a2f266e221
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review lvaro-Fern-ndez-Rojas/pinctrl-add-BCM63XX-pincontrol-support/20210226-004852 git checkout 94439d611efa703b016c515bd904f5a2f266e221
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64

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

All warnings (new ones prefixed by >>):

drivers/pinctrl/bcm/pinctrl-bcm6362.c: In function 'bcm6362_set_gpio':

>> drivers/pinctrl/bcm/pinctrl-bcm6362.c:626:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     626 |        (unsigned int) desc->drv_data, 0);
         |        ^

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS
Selected by
- FAULT_INJECTION_STACKTRACE_FILTER && FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT && !X86_64 && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86

vim +626 drivers/pinctrl/bcm/pinctrl-bcm6362.c

618
619 static void bcm6362_set_gpio(struct bcm6362_pinctrl *pc, unsigned pin)
620 {
621 const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin];
622 unsigned int mask = bcm6362_bank_pin(pin);
623
624 if (desc->drv_data)
625 regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG,

 > 626					   (unsigned int) desc->drv_data, 0);

627
628 if (pin < PINS_PER_BANK) {
629 /* base mode 0 => gpio 1 => mux function */
630 regmap_update_bits(pc->regs, BCM6362_MODE_REG, mask, 0);
631
632 /* pins 0-23 might be muxed to led */
633 if (pin < BCM6362_NUM_LEDS)
634 regmap_update_bits(pc->regs, BCM6362_LED_REG, mask, 0);
635 } else {
636 /* ctrl reg 0 => wifi function 1 => gpio */
637 regmap_update_bits(pc->regs, BCM6362_CTRL_REG, mask, mask);
638 }
639 }
640

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

#16 lore raw

Re: [PATCH 06/12] pinctrl: add a pincontrol driver for BCM6362

In reply to Álvaro Fernández Rojas
Quoted 7 lines · Álvaro Fernández Rojas

Add a pincotrol driver for BCM6362. BCM6362 allows muxing individual GPIO pins to the LED controller, to be available by the integrated wifi, or other functions. It also supports overlay groups, of which only NAND is documented.

Same comments as the other drivers!

Yours,
Linus Walleij

#17 lore raw

PATCH 7/12 Documentation: add BCM6368 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6368 SoCs.

---
 .../pinctrl/brcm,bcm6368-pinctrl.yaml         | 255 ++++++++++++++++++
 1 file changed, 255 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml new file +255 -0
new file mode 100644
index 000000000000..1f69baef6e40
@@ -0,0 +1,255 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6368-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6368 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6368-pinctrl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      Specifies the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  interrupts-extended:
+    description:
+      One interrupt per each of the 6 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 6
+    maxItems: 6
+
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ analog_afe_0, analog_afe_1, sys_irq, serial_led_data,
+                  serial_led_clk, inet_led, ephy0_led, ephy1_led, ephy2_led,
+                  ephy3_led, robosw_led_data, robosw_led_clk, robosw_led0,
+                  robosw_led1, usb_device_led, pci_req1, pci_gnt1, pci_intb,
+                  pci_req0, pci_gnt0, pcmcia_cd1, pcmcia_cd2, pcmcia_vs1,
+                  pcmcia_vs2, ebi_cs2, ebi_cs3, spi_cs2, spi_cs3, spi_cs4,
+                  spi_cs5, uart1 ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7,
+                  gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14,
+                  gpio16, gpio17, gpio18, gpio19, gpio20, gpio22, gpio23,
+                  gpio24, gpio25, gpio26, gpio27, gpio28, gpio29, gpio30,
+                  gpio31, uart1_grp ]
+
+required:
+  - compatible
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6368-pinctrl";
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        interrupts-extended = <&ext_intc1 0 0>,
+                              <&ext_intc1 1 0>,
+                              <&ext_intc0 0 0>,
+                              <&ext_intc0 1 0>,
+                              <&ext_intc0 2 0>,
+                              <&ext_intc0 3 0>;
+        interrupt-names = "gpio32",
+                          "gpio33",
+                          "gpio34",
+                          "gpio35",
+                          "gpio36",
+                          "gpio37";
+
+        pinctrl_analog_afe_0: analog_afe_0 {
+          function = "analog_afe_0";
+          pins = "gpio0";
+        };
+
+        pinctrl_analog_afe_1: analog_afe_1 {
+          function = "analog_afe_1";
+          pins = "gpio1";
+        };
+
+        pinctrl_sys_irq: sys_irq {
+          function = "sys_irq";
+          pins = "gpio2";
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio3";
+          };
+
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio4";
+          };
+        };
+
+        pinctrl_inet_led: inet_led {
+          function = "inet_led";
+          pins = "gpio5";
+        };
+
+        pinctrl_ephy0_led: ephy0_led {
+          function = "ephy0_led";
+          pins = "gpio6";
+        };
+
+        pinctrl_ephy1_led: ephy1_led {
+          function = "ephy1_led";
+          pins = "gpio7";
+        };
+
+        pinctrl_ephy2_led: ephy2_led {
+          function = "ephy2_led";
+          pins = "gpio8";
+        };
+
+        pinctrl_ephy3_led: ephy3_led {
+          function = "ephy3_led";
+          pins = "gpio9";
+        };
+
+        pinctrl_robosw_led_data: robosw_led_data {
+          function = "robosw_led_data";
+          pins = "gpio10";
+        };
+
+        pinctrl_robosw_led_clk: robosw_led_clk {
+          function = "robosw_led_clk";
+          pins = "gpio11";
+        };
+
+        pinctrl_robosw_led0: robosw_led0 {
+          function = "robosw_led0";
+          pins = "gpio12";
+        };
+
+        pinctrl_robosw_led1: robosw_led1 {
+          function = "robosw_led1";
+          pins = "gpio13";
+        };
+
+        pinctrl_usb_device_led: usb_device_led {
+          function = "usb_device_led";
+          pins = "gpio14";
+        };
+
+        pinctrl_pci: pci {
+          pinctrl_pci_req1: pci_req1 {
+            function = "pci_req1";
+            pins = "gpio16";
+          };
+
+          pinctrl_pci_gnt1: pci_gnt1 {
+            function = "pci_gnt1";
+            pins = "gpio17";
+          };
+
+          pinctrl_pci_intb: pci_intb {
+            function = "pci_intb";
+            pins = "gpio18";
+          };
+
+          pinctrl_pci_req0: pci_req0 {
+            function = "pci_req0";
+            pins = "gpio19";
+          };
+
+          pinctrl_pci_gnt0: pci_gnt0 {
+            function = "pci_gnt0";
+            pins = "gpio20";
+          };
+        };
+
+        pinctrl_pcmcia: pcmcia {
+          pinctrl_pcmcia_cd1: pcmcia_cd1 {
+            function = "pcmcia_cd1";
+            pins = "gpio22";
+          };
+
+          pinctrl_pcmcia_cd2: pcmcia_cd2 {
+            function = "pcmcia_cd2";
+            pins = "gpio23";
+          };
+
+          pinctrl_pcmcia_vs1: pcmcia_vs1 {
+            function = "pcmcia_vs1";
+            pins = "gpio24";
+          };
+
+          pinctrl_pcmcia_vs2: pcmcia_vs2 {
+            function = "pcmcia_vs2";
+            pins = "gpio25";
+          };
+        };
+
+        pinctrl_ebi_cs2: ebi_cs2 {
+          function = "ebi_cs2";
+          pins = "gpio26";
+        };
+
+        pinctrl_ebi_cs3: ebi_cs3 {
+          function = "ebi_cs3";
+          pins = "gpio27";
+        };
+
+        pinctrl_spi_cs2: spi_cs2 {
+          function = "spi_cs2";
+          pins = "gpio28";
+        };
+
+        pinctrl_spi_cs3: spi_cs3 {
+          function = "spi_cs3";
+          pins = "gpio29";
+        };
+
+        pinctrl_spi_cs4: spi_cs4 {
+          function = "spi_cs4";
+          pins = "gpio30";
+        };
+
+        pinctrl_spi_cs5: spi_cs5 {
+          function = "spi_cs5";
+          pins = "gpio31";
+        };
+
+        pinctrl_uart1: uart1 {
+          function = "uart1";
+          group = "uart1_grp";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#18 lore raw

Re: [PATCH 07/12] Documentation: add BCM6368 pincontroller binding documentation

Quoted 4 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6368 SoCs.

(...)

Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 6 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 6
+    maxItems: 6

Same comment here, this is hierarchical.

Yours,
Linus Walleij

#19 lore raw

PATCH 8/12 pinctrl: add a pincontrol driver for BCM6368

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM6368. BCM6368 allows muxing the first 32 GPIOs onto alternative functions. Not all are documented.

---
 drivers/pinctrl/bcm/Kconfig           |  11 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6368.c | 679 ++++++++++++++++++++++++++
 3 files changed, 691 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6368.c
drivers/pinctrl/bcm/Kconfig +11 -0
index 44517f6407cf..b8109f0a692c 100644
@@ -62,6 +62,17 @@ config PINCTRL_BCM6362
 	help
 	   Say Y here to enable the Broadcom BCM6362 GPIO driver.
 
+config PINCTRL_BCM6368
+	bool "Broadcom BCM6368 GPIO driver"
+	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select MFD_SYSCON
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6368 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 0ade52a390cb..2d9c99a41c51 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
+obj-$(CONFIG_PINCTRL_BCM6368)		+= pinctrl-bcm6368.o
 obj-$(CONFIG_PINCTRL_IPROC_GPIO)	+= pinctrl-iproc-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
 obj-$(CONFIG_PINCTRL_NS)		+= pinctrl-ns.o
drivers/pinctrl/bcm/pinctrl-bcm6368.c new file +679 -0

679 lines not on this page · raw message

Signature · 1 line
2.20.1
#21 lore raw

PATCH 9/12 Documentation: add BCM63268 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in the BCM63268 family SoCs.

---
 .../pinctrl/brcm,bcm63268-pinctrl.yaml        | 198 ++++++++++++++++++
 1 file changed, 198 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml new file +198 -0
new file mode 100644
index 000000000000..00a681772319
@@ -0,0 +1,198 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm63268-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM63268 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm63268-pinctrl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      Specifies the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4
+
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ serial_led_clk, serial_led_data, hsspi_cs4, hsspi_cs5,
+                  hsspi_cs6, hsspi_cs7, adsl_spi_miso, adsl_spi_mosi,
+                  vreq_clk, pcie_clkreq_b, robosw_led_clk, robosw_led_data,
+                  nand, gpio35_alt, dectpd, vdsl_phy_override_0,
+                  vdsl_phy_override_1, vdsl_phy_override_2,
+                  vdsl_phy_override_3, dsl_gpio8, dsl_gpio9 ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio16, gpio17, gpio8, gpio9, gpio18, gpio19,
+                  gpio22, gpio23, gpio30, gpio31, nand_grp, gpio35
+                  dectpd_grp, vdsl_phy_override_0_grp,
+                  vdsl_phy_override_1_grp, vdsl_phy_override_2_grp,
+                  vdsl_phy_override_3_grp, dsl_gpio8, dsl_gpio9 ]
+
+required:
+  - compatible
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@100000c0 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x100000c0 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm63268-pinctrl";
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        interrupts-extended = <&ext_intc 0 0>,
+                              <&ext_intc 1 0>,
+                              <&ext_intc 2 0>,
+                              <&ext_intc 3 0>;
+        interrupt-names = "gpio32",
+                          "gpio33",
+                          "gpio34",
+                          "gpio35";
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio0";
+          };
+
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio1";
+          };
+        };
+
+        pinctrl_hsspi_cs4: hsspi_cs4 {
+          function = "hsspi_cs4";
+          pins = "gpio16";
+        };
+
+        pinctrl_hsspi_cs5: hsspi_cs5 {
+          function = "hsspi_cs5";
+          pins = "gpio17";
+        };
+
+        pinctrl_hsspi_cs6: hsspi_cs6 {
+          function = "hsspi_cs6";
+          pins = "gpio8";
+        };
+
+        pinctrl_hsspi_cs7: hsspi_cs7 {
+          function = "hsspi_cs7";
+          pins = "gpio9";
+        };
+
+        pinctrl_adsl_spi: adsl_spi {
+          pinctrl_adsl_spi_miso: adsl_spi_miso {
+            function = "adsl_spi_miso";
+            pins = "gpio18";
+          };
+
+          pinctrl_adsl_spi_mosi: adsl_spi_mosi {
+            function = "adsl_spi_mosi";
+            pins = "gpio19";
+          };
+        };
+
+        pinctrl_vreq_clk: vreq_clk {
+          function = "vreq_clk";
+          pins = "gpio22";
+        };
+
+        pinctrl_pcie_clkreq_b: pcie_clkreq_b {
+          function = "pcie_clkreq_b";
+          pins = "gpio23";
+        };
+
+        pinctrl_robosw_led_clk: robosw_led_clk {
+          function = "robosw_led_clk";
+          pins = "gpio30";
+        };
+
+        pinctrl_robosw_led_data: robosw_led_data {
+          function = "robosw_led_data";
+          pins = "gpio31";
+        };
+
+        pinctrl_nand: nand {
+          function = "nand";
+          group = "nand_grp";
+        };
+
+        pinctrl_gpio35_alt: gpio35_alt {
+          function = "gpio35_alt";
+          pin = "gpio35";
+        };
+
+        pinctrl_dectpd: dectpd {
+          function = "dectpd";
+          group = "dectpd_grp";
+        };
+
+        pinctrl_vdsl_phy_override_0: vdsl_phy_override_0 {
+          function = "vdsl_phy_override_0";
+          group = "vdsl_phy_override_0_grp";
+        };
+
+        pinctrl_vdsl_phy_override_1: vdsl_phy_override_1 {
+          function = "vdsl_phy_override_1";
+          group = "vdsl_phy_override_1_grp";
+        };
+
+        pinctrl_vdsl_phy_override_2: vdsl_phy_override_2 {
+          function = "vdsl_phy_override_2";
+          group = "vdsl_phy_override_2_grp";
+        };
+
+        pinctrl_vdsl_phy_override_3: vdsl_phy_override_3 {
+          function = "vdsl_phy_override_3";
+          group = "vdsl_phy_override_3_grp";
+        };
+
+        pinctrl_dsl_gpio8: dsl_gpio8 {
+          function = "dsl_gpio8";
+          group = "dsl_gpio8";
+        };
+
+        pinctrl_dsl_gpio9: dsl_gpio9 {
+          function = "dsl_gpio9";
+          group = "dsl_gpio9";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#22 lore raw

Re: [PATCH 09/12] Documentation: add BCM63268 pincontroller binding documentation

Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml line 36

Quoted 12 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in the BCM63268 family SoCs.

Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 4 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 4
+    maxItems: 4

Same comment, this is hierarchical.

Yours,
Linus Walleij

#23 lore raw

PATCH 10/12 pinctrl: add a pincontrol driver for BCM63268

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM63268. BCM63268 allows muxing GPIOs to different functions. Depending on the mux, these are either single pin configurations or whole pin groups.

---
 drivers/pinctrl/bcm/Kconfig            |  11 +
 drivers/pinctrl/bcm/Makefile           |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm63268.c | 821 +++++++++++++++++++++++++
 3 files changed, 833 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63268.c
drivers/pinctrl/bcm/Kconfig +11 -0
index b8109f0a692c..8918600466b4 100644
@@ -73,6 +73,17 @@ config PINCTRL_BCM6368
 	help
 	   Say Y here to enable the Broadcom BCM6368 GPIO driver.
 
+config PINCTRL_BCM63268
+	bool "Broadcom BCM63268 GPIO driver"
+	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select MFD_SYSCON
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM63268 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 2d9c99a41c51..d5a8ee914fc6 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
 obj-$(CONFIG_PINCTRL_BCM6368)		+= pinctrl-bcm6368.o
+obj-$(CONFIG_PINCTRL_BCM63268)		+= pinctrl-bcm63268.o
 obj-$(CONFIG_PINCTRL_IPROC_GPIO)	+= pinctrl-iproc-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
 obj-$(CONFIG_PINCTRL_NS)		+= pinctrl-ns.o
drivers/pinctrl/bcm/pinctrl-bcm63268.c new file +821 -0

821 lines not on this page · raw message

Signature · 1 line
2.20.1
#25 lore raw

PATCH 11/12 Documentation: add BCM6318 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6318 SoCs.

---
 .../pinctrl/brcm,bcm6318-pinctrl.yaml         | 173 ++++++++++++++++++
 1 file changed, 173 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml new file +173 -0
new file mode 100644
index 000000000000..e2e6c06fa200
@@ -0,0 +1,173 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6318-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6318 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6318-pinctrl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      Specifies the pin number and flags, as defined in
+      include/dt-bindings/gpio/gpio.h
+    const: 2
+
+  interrupts-extended:
+    description:
+      One interrupt per each of the 2 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 2
+    maxItems: 2
+
+patternProperties:
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ ephy0_spd_led, ephy1_spd_led, ephy2_spd_led, ephy3_spd_led,
+                  ephy0_act_led, ephy1_act_led, ephy2_act_led, ephy3_act_led,
+                  serial_led_data, serial_led_clk, inet_act_led, inet_fail_led,
+                  dsl_led, post_fail_led, wlan_wps_led, usb_pwron,
+                  usb_device_led, usb_active ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7,
+                  gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio40 ]
+
+required:
+  - compatible
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6318-pinctrl";
+
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        interrupts-extended = <&ext_intc 0 0>,
+                              <&ext_intc 1 0>;
+        interrupt-names = "gpio33",
+                          "gpio34";
+
+        pinctrl_ephy0_spd_led: ephy0_spd_led {
+          function = "ephy0_spd_led";
+          pins = "gpio0";
+        };
+
+        pinctrl_ephy1_spd_led: ephy1_spd_led {
+          function = "ephy1_spd_led";
+          pins = "gpio1";
+        };
+
+        pinctrl_ephy2_spd_led: ephy2_spd_led {
+          function = "ephy2_spd_led";
+          pins = "gpio2";
+        };
+
+        pinctrl_ephy3_spd_led: ephy3_spd_led {
+          function = "ephy3_spd_led";
+          pins = "gpio3";
+        };
+
+        pinctrl_ephy0_act_led: ephy0_act_led {
+          function = "ephy0_act_led";
+          pins = "gpio4";
+        };
+
+        pinctrl_ephy1_act_led: ephy1_act_led {
+          function = "ephy1_act_led";
+          pins = "gpio5";
+        };
+
+        pinctrl_ephy2_act_led: ephy2_act_led {
+          function = "ephy2_act_led";
+          pins = "gpio6";
+        };
+
+        pinctrl_ephy3_act_led: ephy3_act_led {
+          function = "ephy3_act_led";
+          pins = "gpio7";
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio6";
+          };
+
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio7";
+          };
+        };
+
+        pinctrl_inet_act_led: inet_act_led {
+          function = "inet_act_led";
+          pins = "gpio8";
+        };
+
+        pinctrl_inet_fail_led: inet_fail_led {
+          function = "inet_fail_led";
+          pins = "gpio9";
+        };
+
+        pinctrl_dsl_led: dsl_led {
+          function = "dsl_led";
+          pins = "gpio10";
+        };
+
+        pinctrl_post_fail_led: post_fail_led {
+          function = "post_fail_led";
+          pins = "gpio11";
+        };
+
+        pinctrl_wlan_wps_led: wlan_wps_led {
+          function = "wlan_wps_led";
+          pins = "gpio12";
+        };
+
+        pinctrl_usb_pwron: usb_pwron {
+          function = "usb_pwron";
+          pins = "gpio13";
+        };
+
+        pinctrl_usb_device_led: usb_device_led {
+          function = "usb_device_led";
+          pins = "gpio13";
+        };
+
+        pinctrl_usb_active: usb_active {
+          function = "usb_active";
+          pins = "gpio40";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#26 lore raw

Re: [PATCH 11/12] Documentation: add BCM6318 pincontroller binding documentation

Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml line 36

Quoted 11 lines · Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6318 SoCs.

Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml new file +6 -0
+  interrupts-extended:
+    description:
+      One interrupt per each of the 2 GPIO ports supported by the controller,
+      sorted by port number ascending order.
+    minItems: 2
+    maxItems: 2

Same comment, hierarchical.

Yours,
Linus Walleij

#27 lore raw

PATCH 12/12 pinctrl: add a pincontrol driver for BCM6318

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM6318. BCM6318 allows muxing most GPIOs to different functions. BCM6318 is similar to BCM6328 with the addition of a pad register, and the GPIO meaning of the mux register changes based on the GPIO number.

---
 drivers/pinctrl/bcm/Kconfig           |  11 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6318.c | 674 ++++++++++++++++++++++++++
 3 files changed, 686 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6318.c
drivers/pinctrl/bcm/Kconfig +11 -0
index 8918600466b4..1003a209a2cd 100644
@@ -29,6 +29,17 @@ config PINCTRL_BCM2835
 	help
 	   Say Y here to enable the Broadcom BCM2835 GPIO driver.
 
+config PINCTRL_BCM6318
+	bool "Broadcom BCM6318 GPIO driver"
+	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select MFD_SYSCON
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6318 GPIO driver.
+
 config PINCTRL_BCM6328
 	bool "Broadcom BCM6328 GPIO driver"
 	depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index d5a8ee914fc6..50faf6b2a018 100644
@@ -3,6 +3,7 @@
 
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_BCM6318)		+= pinctrl-bcm6318.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
drivers/pinctrl/bcm/pinctrl-bcm6318.c new file +674 -0

674 lines not on this page · raw message

Signature · 1 line
2.20.1
#28 lore raw

Re: [PATCH 12/12] pinctrl: add a pincontrol driver for BCM6318

Quoted 7 lines · Álvaro Fernández Rojas

Add a pincontrol driver for BCM6318. BCM6318 allows muxing most GPIOs to different functions. BCM6318 is similar to BCM6328 with the addition of a pad register, and the GPIO meaning of the mux register changes based on the GPIO number.

Same comments as the other drivers.

Looking forward to the next iteration of these drivers!

Yours,
Linus Walleij