Skip to contentSkip to conversation

gpio: bcm281xx: GPIO driver

PATCH New Markus Mayer 4 participants 11 messages Sep 10, 2013 – Sep 20, 2013

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v9 cover gpio: bcm281xx: GPIO driver

This patch series adds the GPIO driver, and its device tree bindings, for the Broadcom bcm281xx family of mobile SoCs.

Changes since v8:
- rebased SHA 26b0332e30c7f93e780aaa054bd84e3437f84354 (so it'll apply against 3.12-rc1)
As a result:
- patch context in patch 2/3 changed by automatic merge
- patch context in patch 3/3 changed by manual merge

Markus Mayer (3):
gpio: bcm281xx: Add GPIO driver
ARM: bcm281xx: Enable GPIO driver
ARM: bcm281xx: Add device node for the GPIO controller

 .../devicetree/bindings/gpio/gpio-bcm-kona.txt     |   52 ++
 arch/arm/boot/dts/bcm11351.dtsi                    |   16 +
 arch/arm/mach-bcm/Kconfig                          |    2 +-
 drivers/gpio/Kconfig                               |    5 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-bcm-kona.c                       |  632 ++++++++++++++++++++
 6 files changed, 707 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt
 create mode 100644 drivers/gpio/gpio-bcm-kona.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v9 1/3 gpio: bcm281xx: Add GPIO driver

From: Markus Mayer <[email protected]>

Add the GPIO driver for the Broadcom bcm281xx family of mobile SoCs. These GPIO controllers may contain up to 8 banks where each bank includes 32 pins that can be driven high or low and act as an edge sensitive interrupt.

---
 .../devicetree/bindings/gpio/gpio-bcm-kona.txt     |   52 ++
 drivers/gpio/Kconfig                               |    5 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-bcm-kona.c                       |  632 ++++++++++++++++++++
 4 files changed, 690 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt
 create mode 100644 drivers/gpio/gpio-bcm-kona.c
Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt new file +52 -0
new file mode 100644
index 0000000..4a63bc9
@@ -0,0 +1,52 @@
+Broadcom Kona Family GPIO
+=========================
+
+This GPIO driver is used in the following Broadcom SoCs:
+  BCM11130, BCM11140, BCM11351, BCM28145, BCM28155
+
+The Broadcom GPIO Controller IP can be configured prior to synthesis to
+support up to 8 banks of 32 GPIOs where each bank has its own IRQ. The
+GPIO controller only supports edge, not level, triggering of interrupts.
+
+Required properties
+-------------------
+
+- compatible: "brcm,bcm11351-gpio", "brcm,kona-gpio"
+- reg: Physical base address and length of the controller's registers.
+- interrupts: The interrupt outputs from the controller. There is one GPIO
+  interrupt per GPIO bank. The number of interrupts listed depends on the
+  number of GPIO banks on the SoC. The interrupts must be ordered by bank,
+  starting with bank 0. There is always a 1:1 mapping between banks and
+  IRQs.
+- #gpio-cells: Should be <2>. The first cell is the pin number, the second
+  cell is used to specify optional parameters:
+  - bit 0 specifies polarity (0 for normal, 1 for inverted)
+  See also "gpio-specifier" in .../devicetree/bindings/gpio/gpio.txt.
+- #interrupt-cells: Should be <2>. The first cell is the GPIO number. The
+  second cell is used to specify flags. The following subset of flags is
+  supported:
+  - trigger type (bits[1:0]):
+      1 = low-to-high edge triggered.
+      2 = high-to-low edge triggered.
+      3 = low-to-high or high-to-low edge triggered
+      Valid values are 1, 2, 3
+  See also .../devicetree/bindings/interrupt-controller/interrupts.txt.
+- gpio-controller: Marks the device node as a GPIO controller.
+- interrupt-controller: Marks the device node as an interrupt controller.
+
+Example:
+	gpio: gpio at 35003000 {
+		compatible = "brcm,bcm11351-gpio", "brcm,kona-gpio";
+		reg = <0x35003000 0x800>;
+		interrupts =
+		       <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+		#gpio-cells = <2>;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		interrupt-controller;
+	};
drivers/gpio/Kconfig +5 -0
index 349b161..3a44253 100644
@@ -751,6 +751,11 @@ config GPIO_MSIC
 	  Enable support for GPIO on intel MSIC controllers found in
 	  intel MID devices
 
+config GPIO_BCM_KONA
+	bool "Broadcom Kona GPIO"
+	help
+	  Turn on GPIO support for Broadcom "Kona" chips.
+
 comment "USB GPIO expanders:"
 
 config GPIO_VIPERBOARD
drivers/gpio/Makefile +1 -0
index 97438bf..1b1aecc 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_GPIO_ADP5520)	+= gpio-adp5520.o
 obj-$(CONFIG_GPIO_ADP5588)	+= gpio-adp5588.o
 obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
 obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
+obj-$(CONFIG_GPIO_BCM_KONA)	+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CLPS711X)	+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_CS5535)	+= gpio-cs5535.o
drivers/gpio/gpio-bcm-kona.c new file +632 -0

632 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v9 1/3 gpio: bcm281xx: Add GPIO driver

Quoted 6 lines · Markus Mayer

From: Markus Mayer <[email protected]>

Add the GPIO driver for the Broadcom bcm281xx family of mobile SoCs. These GPIO controllers may contain up to 8 banks where each bank includes 32 pins that can be driven high or low and act as an edge sensitive interrupt.

The binding,

although ...

Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt line 5

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt +2 -0
 
+This GPIO driver is used in the following Broadcom SoCs:
+  BCM11130, BCM11140, BCM11351, BCM28145, BCM28155

Given that, I would expect the documentation of the compatible property to enumerate the compatible values for all of those different chips, although the driver could choose to only bind to e.g. brcm,bcm11351-gpio or brcm,kona-gpio, since they're all compatible with it.

#3 lore raw

PATCH v9 1/3 gpio: bcm281xx: Add GPIO driver

Hi Stephen,

Quoted 12 lines · Stephen Warren
Quoted 6 lines · Markus Mayer

From: Markus Mayer <[email protected]>

Add the GPIO driver for the Broadcom bcm281xx family of mobile SoCs. These GPIO controllers may contain up to 8 banks where each bank includes 32 pins that can be driven high or low and act as an edge sensitive interrupt.

The binding,

although ...

Quoted 8 lines

Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt line 5

Quoted 3 lines
Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt +2 -0
+This GPIO driver is used in the following Broadcom SoCs:
+  BCM11130, BCM11140, BCM11351, BCM28145, BCM28155

Given that, I would expect the documentation of the compatible property to enumerate the compatible values for all of those different chips, although the driver could choose to only bind to e.g. brcm,bcm11351-gpio or brcm,kona-gpio, since they're all compatible with it.

How would this help ? All of these chips are part of the same family and thus quite similar (the primary difference being on the memory controller and packaging), and we can't know a priori on which variations bugs will happen, if any. So listing out a number of theoretical compatible properties in the documentation that most likely will never get used anyone doesn't seem to serve a purpose. If we were to need a workaround triggered on compatible, it would more likely be over a specific rev of the chip instead of the model within this family (as we have already done for rev a2 in cache-l2x0.c)

Thanks,
csd

#4 lore raw

PATCH v9 1/3 gpio: bcm281xx: Add GPIO driver

Quoted 23 lines · Christian Daudt

Hi Stephen,

Quoted 12 lines · Stephen Warren
Quoted 6 lines · Markus Mayer

From: Markus Mayer <[email protected]>

Add the GPIO driver for the Broadcom bcm281xx family of mobile SoCs. These GPIO controllers may contain up to 8 banks where each bank includes 32 pins that can be driven high or low and act as an edge sensitive interrupt.

The binding,

although ...

Quoted 9 lines

Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt line 5

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-bcm-kona.txt +2 -0
+This GPIO driver is used in the following Broadcom SoCs:
+  BCM11130, BCM11140, BCM11351, BCM28145, BCM28155

Given that, I would expect the documentation of the compatible property to enumerate the compatible values for all of those different chips, although the driver could choose to only bind to e.g. brcm,bcm11351-gpio or brcm,kona-gpio, since they're all compatible with it.

Quoted 4 lines

How would this help ? All of these chips are part of the same family and thus quite similar (the primary difference being on the memory controller and packaging), and we can't know a priori on which variations bugs will happen, if any.

That's exactly why the DT should include a compatible value that precisely describes the chip; so that information is there if it's needed in the future.

#5 lore raw

PATCH v9 1/3 gpio: bcm281xx: Add GPIO driver

In reply to Markus Mayer
Quoted 11 lines · Markus Mayer

From: Markus Mayer <[email protected]>

Add the GPIO driver for the Broadcom bcm281xx family of mobile SoCs. These GPIO controllers may contain up to 8 banks where each bank includes 32 pins that can be driven high or low and act as an edge sensitive interrupt.

It's a fine driver and I applied it. Any remaining issues to be fixed with follow-up patches.

I changed one thing:

drivers/gpio/Kconfig config GPIO_MSIC · line 755

Quoted 2 lines
drivers/gpio/Kconfig +2 -0
+config GPIO_BCM_KONA
+       bool "Broadcom Kona GPIO"

I added
depends on OF_GPIO

here.

Otherwise I don't think it will compile on randconfigs.

Yours,
Linus Walleij

#6 lore raw

PATCH v9 2/3 ARM: bcm281xx: Enable GPIO driver

In reply to Markus Mayer

Turn on the bcm281xx GPIO driver in the kernel configuration.

---
 arch/arm/mach-bcm/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-bcm/Kconfig +1 -1
index 69d67f7..7f6fca8 100644
@@ -9,7 +9,7 @@ config ARCH_BCM
 	select CLKSRC_OF
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_TIME
-	select GPIO_BCM
+	select GPIO_BCM_KONA
 	select SPARSE_IRQ
 	select TICK_ONESHOT
 	select CACHE_L2X0
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v9 2/3 ARM: bcm281xx: Enable GPIO driver

Quoted 13 lines · Markus Mayer

Turn on the bcm281xx GPIO driver in the kernel configuration.

---
  arch/arm/mach-bcm/Kconfig |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-bcm/Kconfig +0 -0
index 69d67f7..7f6fca8 100644

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 15

Quoted 8 lines
arch/arm/mach-bcm/Kconfig +1 -1
@@ -9,7 +9,7 @@ config ARCH_BCM
  	select CLKSRC_OF
  	select GENERIC_CLOCKEVENTS
  	select GENERIC_TIME
-	select GPIO_BCM
+	select GPIO_BCM_KONA
  	select SPARSE_IRQ
  	select TICK_ONESHOT
  	select CACHE_L2X0

Applied to armsoc/for-3.13/soc

thanks,
csd

#8 lore raw

PATCH v9 2/3 ARM: bcm281xx: Enable GPIO driver

In reply to Markus Mayer
Quoted 13 lines · Markus Mayer

Turn on the bcm281xx GPIO driver in the kernel configuration.

---
 arch/arm/mach-bcm/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-bcm/Kconfig +0 -0
index 69d67f7..7f6fca8 100644

arch/arm/mach-bcm/Kconfig config ARCH_BCM · line 12

Quoted 5 lines
arch/arm/mach-bcm/Kconfig +1 -1
@@ -9,7 +9,7 @@ config ARCH_BCM
        select CLKSRC_OF
        select GENERIC_CLOCKEVENTS
        select GENERIC_TIME
-       select GPIO_BCM
+       select GPIO_BCM_KONA

I don't know if you have to select OF_GPIO here to get it working now that I added that dependency?

Or maybe I should let the Kconfig for the driver select OF_GPIO?

Yours,
Linus Walleij

#9 lore raw

PATCH v9 3/3 ARM: bcm281xx: Add device node for the GPIO controller

In reply to Markus Mayer

Add the GPIO controller device node for the Broadcom bcm281xx family of mobile SoCs.

---
 arch/arm/boot/dts/bcm11351.dtsi |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/bcm11351.dtsi +16 -0
index 05a5aab..77af396 100644
@@ -68,6 +68,22 @@
 		clock-frequency = <32768>;
 	};
 
+	gpio: gpio at 35003000 {
+		compatible = "brcm,bcm11351-gpio", "brcm,kona-gpio";
+		reg = <0x35003000 0x800>;
+		interrupts =
+		       <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+		#gpio-cells = <2>;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		interrupt-controller;
+	};
+
 	sdio1: sdio at 3f180000 {
 		compatible = "brcm,kona-sdhci";
 		reg = <0x3f180000 0x10000>;
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v9 3/3 ARM: bcm281xx: Add device node for the GPIO controller

Quoted 29 lines · Markus Mayer

Add the GPIO controller device node for the Broadcom bcm281xx family of mobile SoCs.

---
  arch/arm/boot/dts/bcm11351.dtsi |   16 ++++++++++++++++
  1 file changed, 16 insertions(+)
arch/arm/boot/dts/bcm11351.dtsi +9 -0
index 05a5aab..77af396 100644
@@ -68,6 +68,22 @@
  		clock-frequency = <32768>;
  	};
 
+	gpio: gpio at 35003000 {
+		compatible = "brcm,bcm11351-gpio", "brcm,kona-gpio";
+		reg = <0x35003000 0x800>;
+		interrupts =
+		       <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH
+			GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH

arch/arm/boot/dts/bcm11351.dtsi line 89

Quoted 10 lines
arch/arm/boot/dts/bcm11351.dtsi +7 -0
+			GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+		#gpio-cells = <2>;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		interrupt-controller;
+	};
+
  	sdio1: sdio at 3f180000 {
  		compatible = "brcm,kona-sdhci";
  		reg = <0x3f180000 0x10000>;

Applied to bcm armsoc/for-3.13/dt

thanks,
csd