Skip to contentSkip to conversation

Add pinctrl support to Broadcom Cygnus SoC

PATCH Applied Ray Jui 3 participants 20 messages Mar 9, 2015 – Mar 18, 2015

Subsystems (6)

v6 of 9 Applied Latest is v9 →

lore
Share & tools
lore

Ray Jui

author maintainer
#0 lore raw

v6 cover Add pinctrl support to Broadcom Cygnus SoC

This patchset contains the pinmux (IOMUX) and GPIO/PINCONF support for Broadcom Cygnus SoC.

The Cygnus IOMUX controller supports group based mux configuration and allows certain pins to be muxed to GPIO function individually. The IOMUX controller is supported by the pinctrl-cygnus-mux.c driver.

Cygnus has 3 GPIO controllers: 1) the ASIU GPIO; 2) the chipCommonG GPIO; and 3) the ALWAYS-ON GPIO. All 3 Cygnus GPIO controllers support basic PINCONF functions such as bias pull up, pull down, and drive strength configuration, when pins are muxed to GPIO. GPIO/PINCONF support is in the pinctrl-cygnus-gpio.c driver.

Note pins from the ASIU GPIO can be individually muxed to GPIO function, through interaction with the Cygnus IOMUX controller.

Changes from v5:
- Remove ngpios device tree property. Instead, determine the number of GPIO based on compaitble string in the driver
- Remove all MODULE_* related macros in the driver since the driver will never be compiled as a kernel loadable module

Changes from v4:
- Rebased to Linux 4.0-rc2
- Switched to use the newly available pinconf_generic_dt_node_to_map_group function for mapping DT mux properties in the IOMUX driver. This helps to get rid of customized device tree parsing code in the driver
- Consolidated the other Cygnus GPIO/PINCONF patchset into one single patchset
- Tuned up the GPIO/PINCONF driver a bit more, based on code review comments from Linus Walleij

Changes from v3:
- Fix the driver to have more proper use of "const" in various places
- Other minor improvements

Changes from v2:
- Consolidate all Broadcom pinctrl drivers into drivers/pinctrl/bcm/*
- Change the Cygnus IOMUX driver to use standard Linux pinctrl subnode
properties such as "function" and "groups" for pinmux configuration, instead of non-standard properties such as "brcm,function" and "brcm,group"
- Use real function names like "spi0", "lcd", "key", and etc. instead of HW
specific mux names like "alt1", "alt2", "alt3", and etc.
- Add suffix "grp" to all group names
- Add support to allow individual pins to be muxed to GPIO function through
subsystem callbacks "gpio_request_enable" and "gpio_disable_free", and get rid of all GPIO groups
- Other minor improvements in the driver

Changes from v1:
- Fix a typo in device tree binding document

Ray Jui (8):
pinctrl: bcm: consolidate Broadcom pinctrl drivers
pinctrl: Broadcom Cygnus pinctrl device tree binding
pinctrl: cygnus: add initial IOMUX driver support
ARM: dts: enable IOMUX for Broadcom Cygnus
pinctrl: Cygnus: define Broadcom Cygnus GPIO/PINCONF binding
pinctrl: cygnus: add gpio/pinconf driver
ARM: dts: enable GPIO for Broadcom Cygnus
ARM: dts: cygnus: enable GPIO based hook detection

 .../bindings/pinctrl/brcm,cygnus-gpio.txt          |   98 ++
 .../bindings/pinctrl/brcm,cygnus-pinmux.txt        |  132 +++
 arch/arm/boot/dts/bcm-cygnus.dtsi                  |   36 +
 arch/arm/boot/dts/bcm911360_entphn.dts             |   13 +
 drivers/pinctrl/Kconfig                            |   19 +-
 drivers/pinctrl/Makefile                           |    3 +-
 drivers/pinctrl/bcm/Kconfig                        |   56 ++
 drivers/pinctrl/bcm/Makefile                       |    6 +
 drivers/pinctrl/{ => bcm}/pinctrl-bcm281xx.c       |    4 +-
 drivers/pinctrl/{ => bcm}/pinctrl-bcm2835.c        |    0
 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c          |  907 +++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-cygnus-mux.c           | 1017 ++++++++++++++++++++
 12 files changed, 2269 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,cygnus-pinmux.txt
 create mode 100644 drivers/pinctrl/bcm/Kconfig
 create mode 100644 drivers/pinctrl/bcm/Makefile
 rename drivers/pinctrl/{ => bcm}/pinctrl-bcm281xx.c (99%)
 rename drivers/pinctrl/{ => bcm}/pinctrl-bcm2835.c (100%)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-cygnus-mux.c
Signature · 1 line
1.7.9.5
author maintainer
#1 lore raw

PATCH v6 1/8 pinctrl: bcm: consolidate Broadcom pinctrl drivers

Consolidate Broadcom pinctrl drivers into drivers/pinctrl/bcm/*

---
 drivers/pinctrl/Kconfig                      |   19 +------------------
 drivers/pinctrl/Makefile                     |    3 +--
 drivers/pinctrl/bcm/Kconfig                  |   21 +++++++++++++++++++++
 drivers/pinctrl/bcm/Makefile                 |    4 ++++
 drivers/pinctrl/{ => bcm}/pinctrl-bcm281xx.c |    4 ++--
 drivers/pinctrl/{ => bcm}/pinctrl-bcm2835.c  |    0
 6 files changed, 29 insertions(+), 22 deletions(-)
 create mode 100644 drivers/pinctrl/bcm/Kconfig
 create mode 100644 drivers/pinctrl/bcm/Makefile
 rename drivers/pinctrl/{ => bcm}/pinctrl-bcm281xx.c (99%)
 rename drivers/pinctrl/{ => bcm}/pinctrl-bcm2835.c (100%)
drivers/pinctrl/Kconfig +1 -18
index ee9f44a..1a9143d 100644
@@ -67,24 +67,6 @@ config PINCTRL_AT91
 	help
 	  Say Y here to enable the at91 pinctrl driver
 
-config PINCTRL_BCM2835
-	bool
-	select PINMUX
-	select PINCONF
-
-config PINCTRL_BCM281XX
-	bool "Broadcom BCM281xx pinctrl driver"
-	depends on OF && (ARCH_BCM_MOBILE || COMPILE_TEST)
-	select PINMUX
-	select PINCONF
-	select GENERIC_PINCONF
-	select REGMAP_MMIO
-	help
-	  Say Y here to support Broadcom BCM281xx pinctrl driver, which is used
-	  for the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
-	  BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
-	  framework.  GPIO is provided by a separate GPIO driver.
-
 config PINCTRL_LANTIQ
 	bool
 	depends on LANTIQ
@@ -207,6 +189,7 @@ config PINCTRL_ZYNQ
 	help
 	  This selectes the pinctrl driver for Xilinx Zynq.
 
+source "drivers/pinctrl/bcm/Kconfig"
 source "drivers/pinctrl/berlin/Kconfig"
 source "drivers/pinctrl/freescale/Kconfig"
 source "drivers/pinctrl/intel/Kconfig"
drivers/pinctrl/Makefile +1 -2
index 0475206..c14ce05 100644
@@ -14,8 +14,6 @@ obj-$(CONFIG_PINCTRL_AS3722)	+= pinctrl-as3722.o
 obj-$(CONFIG_PINCTRL_BF54x)	+= pinctrl-adi2-bf54x.o
 obj-$(CONFIG_PINCTRL_BF60x)	+= pinctrl-adi2-bf60x.o
 obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
-obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
-obj-$(CONFIG_PINCTRL_BCM281XX)	+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_FALCON)	+= pinctrl-falcon.o
 obj-$(CONFIG_PINCTRL_MESON)	+= meson/
 obj-$(CONFIG_PINCTRL_PALMAS)	+= pinctrl-palmas.o
@@ -38,6 +36,7 @@ obj-$(CONFIG_PINCTRL_TB10X)	+= pinctrl-tb10x.o
 obj-$(CONFIG_PINCTRL_ST) 	+= pinctrl-st.o
 obj-$(CONFIG_PINCTRL_ZYNQ)	+= pinctrl-zynq.o
 
+obj-$(CONFIG_ARCH_BCM)		+= bcm/
 obj-$(CONFIG_ARCH_BERLIN)	+= berlin/
 obj-y				+= freescale/
 obj-$(CONFIG_X86)		+= intel/
drivers/pinctrl/bcm/Kconfig new file +21 -0
new file mode 100644
index 0000000..bc6d048
@@ -0,0 +1,21 @@
+#
+# Broadcom pinctrl drivers
+#
+
+config PINCTRL_BCM281XX
+	bool "Broadcom BCM281xx pinctrl driver"
+	depends on OF && (ARCH_BCM_MOBILE || COMPILE_TEST)
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select REGMAP_MMIO
+	help
+	  Say Y here to support Broadcom BCM281xx pinctrl driver, which is used
+	  for the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351,
+	  BCM28145, and BCM28155 SoCs.  This driver requires the pinctrl
+	  framework.  GPIO is provided by a separate GPIO driver.
+
+config PINCTRL_BCM2835
+	bool
+	select PINMUX
+	select PINCONF
drivers/pinctrl/bcm/Makefile new file +4 -0
new file mode 100644
index 0000000..7ba80a3
@@ -0,0 +1,4 @@
+# Broadcom pinctrl support
+
+obj-$(CONFIG_PINCTRL_BCM281XX)	+= pinctrl-bcm281xx.o
+obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
drivers/pinctrl/bcm/pinctrl-bcm281xx.c renamed from drivers/pinctrl/pinctrl-bcm281xx.c +2 -2
similarity index 99%
rename from drivers/pinctrl/pinctrl-bcm281xx.c
rename to drivers/pinctrl/bcm/pinctrl-bcm281xx.c
index b88cfe5..9641f1c 100644
@@ -21,8 +21,8 @@
 #include <linux/pinctrl/pinconf-generic.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
-#include "core.h"
-#include "pinctrl-utils.h"
+#include "../core.h"
+#include "../pinctrl-utils.h"
 
 /* BCM281XX Pin Control Registers Definitions */
 
drivers/pinctrl/bcm/pinctrl-bcm2835.c renamed from drivers/pinctrl/pinctrl-bcm2835.c +0 -0
similarity index 100%
rename from drivers/pinctrl/pinctrl-bcm2835.c
rename to drivers/pinctrl/bcm/pinctrl-bcm2835.c
Signature · 1 line
1.7.9.5
author maintainer
#2 lore raw

PATCH v6 2/8 pinctrl: Broadcom Cygnus pinctrl device tree binding

In reply to Ray Jui

Device tree binding documentation for Broadcom Cygnus IOMUX driver

---
 .../bindings/pinctrl/brcm,cygnus-pinmux.txt        |  132 ++++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,cygnus-pinmux.txt
Documentation/devicetree/bindings/pinctrl/brcm,cygnus-pinmux.txt new file +132 -0
new file mode 100644
index 0000000..3600d5c
@@ -0,0 +1,132 @@
+Broadcom Cygnus IOMUX Controller
+
+The Cygnus IOMUX controller supports group based mux configuration. In
+addition, certain pins can be muxed to GPIO function individually.
+
+Required properties:
+
+- compatible:
+    Must be "brcm,cygnus-pinmux"
+
+- reg:
+    Define the base and range of the I/O address space that contains the Cygnus
+IOMUX registers
+
+Properties in subnodes:
+
+- function:
+    The mux function to select
+
+- groups:
+    The list of groups to select with a given function
+
+For more details, refer to
+Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+
+For example:
+
+	pinmux: pinmux@0x0301d0c8 {
+		compatible = "brcm,cygnus-pinmux";
+		reg = <0x0301d0c8 0x1b0>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2s0_default>;
+
+		i2s0_default: i2s0_default {
+			mux {
+				function = "i2s0";
+				groups = "i2s0_0_grp", "i2s0_1_grp";
+			};
+		};
+	};
+
+List of supported functions and groups in Cygnus:
+
+"i2s0": "i2s0_0_grp", "i2s0_1_grp"
+
+"i2s1": "i2s1_0_grp", "i2s1_1_grp"
+
+"i2s2": "i2s2_0_grp", "i2s2_1_grp", "i2s2_2_grp", "i2s2_3_grp", "i2s2_4_grp"
+
+"spdif": "spdif_grp"
+
+"pwm0": "pwm0_grp"
+
+"pwm1": "pwm1_grp"
+
+"pwm2": "pwm2_grp"
+
+"pwm3": "pwm3_grp"
+
+"pwm4": "pwm4_grp"
+
+"pwm5": "pwm5_grp"
+
+"key": "key0_grp", "key1_grp", "key2_grp", "key3_grp", "key4_grp", "key5_grp",
+"key6_grp", "key7_grp", "key8_grp", "key9_grp", "key10_grp", "key11_grp",
+"key12_grp", "key13_grp", "key14_grp", "key15_grp"
+
+"audio_dte": "audio_dte0_grp", "audio_dte1_grp", "audio_dte2_grp", "audio_dte3_grp"
+
+"smart_card0": "smart_card0_grp", "smart_card0_fcb_grp"
+
+"smart_card1": "smart_card1_grp", "smart_card1_fcb_grp"
+
+"spi0": "spi0_grp"
+
+"spi1": "spi1_grp"
+
+"spi2": "spi2_grp"
+
+"spi3": "spi3_grp"
+
+"spi4": "spi4_0_grp", "spi4_1_grp"
+
+"spi5": "spi5_grp"
+
+"sw_led0": "sw_led0_0_grp", "sw_led0_1_grp"
+
+"sw_led1": "sw_led1_grp"
+
+"sw_led2": "sw_led2_0_grp", "sw_led2_1_grp"
+
+"d1w": "d1w_grp"
+
+"lcd": "lcd_grp"
+
+"sram": "sram_0_grp", "sram_1_grp"
+
+"uart0": "uart0_grp"
+
+"uart1": "uart1_grp", "uart1_dte_grp"
+
+"uart2": "uart2_grp"
+
+"uart3": "uart3_grp"
+
+"uart4": "uart4_grp"
+
+"qspi": "qspi_0_grp", "qspi_1_grp"
+
+"nand": "nand_grp"
+
+"sdio0": "sdio0_grp", "sdio0_cd_grp", "sdio0_mmc_grp"
+
+"sdio1": "sdio1_data_0_grp", "sdio1_data_1_grp", "sdio1_cd_grp",
+"sdio1_led_grp", "sdio1_mmc_grp"
+
+"can0": "can0_grp"
+
+"can1": "can1_grp"
+
+"cam": "cam_led_grp", "cam_0_grp", "cam_1_grp"
+
+"bsc1": "bsc1_grp"
+
+"pcie_clkreq": "pcie_clkreq_grp"
+
+"usb0_oc": "usb0_oc_grp"
+
+"usb1_oc": "usb1_oc_grp"
+
+"usb2_oc": "usb2_oc_grp"
Signature · 1 line
1.7.9.5
author maintainer
#3 lore raw

PATCH v6 3/8 pinctrl: cygnus: add initial IOMUX driver support

In reply to Ray Jui

This adds the initial driver support for the Broadcom Cygnus IOMUX controller. The Cygnus IOMUX controller supports group based mux configuration but allows certain pins to be muxed to GPIO individually

---
 drivers/pinctrl/bcm/Kconfig              |   13 +
 drivers/pinctrl/bcm/Makefile             |    5 +-
 drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 1017 ++++++++++++++++++++++++++++++
 3 files changed, 1033 insertions(+), 2 deletions(-)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-cygnus-mux.c
drivers/pinctrl/bcm/Kconfig +13 -0
index bc6d048..eb13201 100644
@@ -19,3 +19,16 @@ config PINCTRL_BCM2835
 	bool
 	select PINMUX
 	select PINCONF
+
+config PINCTRL_CYGNUS_MUX
+	bool "Broadcom Cygnus IOMUX driver"
+	depends on (ARCH_BCM_CYGNUS || COMPILE_TEST)
+	select PINMUX
+	select GENERIC_PINCONF
+	default ARCH_BCM_CYGNUS
+	help
+	  Say yes here to enable the Broadcom Cygnus IOMUX driver.
+
+	  The Broadcom Cygnus IOMUX driver supports group based IOMUX
+	  configuration, with the exception that certain individual pins
+	  can be overrided to GPIO function
drivers/pinctrl/bcm/Makefile +3 -2
index 7ba80a3..bb6beb6 100644
@@ -1,4 +1,5 @@
 # Broadcom pinctrl support
 
-obj-$(CONFIG_PINCTRL_BCM281XX)	+= pinctrl-bcm281xx.o
-obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
+obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c new file +1017 -0

1,017 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author maintainer
#4 lore raw

PATCH v6 4/8 ARM: dts: enable IOMUX for Broadcom Cygnus

In reply to Ray Jui

This enables the IOMUX support for Broadcom Cygnus SoC

---
 arch/arm/boot/dts/bcm-cygnus.dtsi |    6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm-cygnus.dtsi +6 -0
index ff5fb6a..1cbae6a 100644
@@ -54,6 +54,12 @@
 
 	/include/ "bcm-cygnus-clock.dtsi"
 
+	pinctrl: pinctrl@0x0301d0c8 {
+		compatible = "brcm,cygnus-pinmux";
+		reg = <0x0301d0c8 0x30>,
+		      <0x0301d24c 0x2c>;
+	};
+
 	amba {
 		#address-cells = <1>;
 		#size-cells = <1>;
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH v6 4/8] ARM: dts: enable IOMUX for Broadcom Cygnus

2015-03-10 3:14 GMT-07:00 Linus Walleij <[email protected]>:

Quoted 10 lines · Ray Jui
Quoted 5 lines

This enables the IOMUX support for Broadcom Cygnus SoC

Pls take this through some BRCM ARM SoC tree.

Applied to devicetree/next.

Signature · 1 line
Florian
author maintainer
#7 lore raw

PATCH v6 5/8 pinctrl: Cygnus: define Broadcom Cygnus GPIO/PINCONF binding

In reply to Ray Jui

Document the GPIO/PINCONF device tree binding for Broadcom Cygnus SoC

---
 .../bindings/pinctrl/brcm,cygnus-gpio.txt          |   98 ++++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt
Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt new file +98 -0
new file mode 100644
index 0000000..6540ca5
@@ -0,0 +1,98 @@
+Broadcom Cygnus GPIO/PINCONF Controller
+
+Required properties:
+
+- compatible:
+    Must be "brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio", or
+    "brcm,cygnus-crmu-gpio"
+
+- reg:
+    Define the base and range of the I/O address space that contains the Cygnus
+GPIO/PINCONF controller registers
+
+- #gpio-cells:
+    Must be two. The first cell is the GPIO pin number (within the
+controller's pin space) and the second cell is used for the following:
+    bit[0]: polarity (0 for active high and 1 for active low)
+
+- gpio-controller:
+    Specifies that the node is a GPIO controller
+
+Optional properties:
+
+- interrupts:
+    Interrupt ID
+
+- interrupt-controller:
+    Specifies that the node is an interrupt controller
+
+- pinmux:
+    Specifies the phandle to the IOMUX device, where pins can be individually
+muxed to GPIO
+
+Supported generic PINCONF properties in child nodes:
+
+- pins:
+    The list of pins (within the controller's own pin space) that properties
+in the node apply to. Pin names are "gpio-<pin>"
+
+- bias-disable:
+    Disable pin bias
+
+- bias-pull-up:
+    Enable internal pull up resistor
+
+- bias-pull-down:
+    Enable internal pull down resistor
+
+- drive-strength:
+    Valid drive strength values include 2, 4, 6, 8, 10, 12, 14, 16 (mA)
+
+Example:
+	gpio_ccm: gpio@1800a000 {
+		compatible = "brcm,cygnus-ccm-gpio";
+		reg = <0x1800a000 0x50>,
+		      <0x0301d164 0x20>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-controller;
+
+		touch_pins: touch_pins {
+			pwr: pwr {
+				pins = "gpio-0";
+				drive-strength = <16>;
+			};
+
+			event: event {
+				pins = "gpio-1";
+				bias-pull-up;
+			};
+		};
+	};
+
+	gpio_asiu: gpio@180a5000 {
+		compatible = "brcm,cygnus-asiu-gpio";
+		reg = <0x180a5000 0x668>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-controller;
+	};
+
+	/*
+	 * Touchscreen that uses the CCM GPIO 0 and 1
+	 */
+	tsc {
+		...
+		...
+		gpio-pwr = <&gpio_ccm 0 0>;
+		gpio-event = <&gpio_ccm 1 0>;
+	};
+
+	/* Bluetooth that uses the ASIU GPIO 5, with polarity inverted */
+	bluetooth {
+		...
+		...
+		bcm,rfkill-bank-sel = <&gpio_asiu 5 1>
+	}
Signature · 1 line
1.7.9.5
#8 lore raw

Re: [PATCH v6 5/8] pinctrl: Cygnus: define Broadcom Cygnus GPIO/PINCONF binding

Quoted 4 lines · Ray Jui

Document the GPIO/PINCONF device tree binding for Broadcom Cygnus SoC

Patch applied!

Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt line 7

Quoted 3 lines

+- compatible:

Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt new file +2 -0
+    Must be "brcm,cygnus-ccm-gpio", "brcm,cygnus-asiu-gpio", or
+    "brcm,cygnus-crmu-gpio"

Thanks for making this change. It is very useful because it can now handle any other variant-specific quirks you may run into.

Yours,
Linus Walleij

author maintainer
#9 lore raw

PATCH v6 6/8 pinctrl: cygnus: add gpio/pinconf driver

In reply to Ray Jui

This adds the initial support of the Broadcom Cygnus GPIO/PINCONF driver that supports all 3 GPIO controllers on Cygnus including the ASIU GPIO controller, the chipCommonG GPIO controller, and the always-on GPIO controller. Basic PINCONF configurations such as bias pull up/down, and drive strength are also supported in this driver.

Pins from the ASIU GPIO controller can be individually muxed to GPIO function, through interaction with the Cygnus IOMUX controller

---
 drivers/pinctrl/bcm/Kconfig               |   22 +
 drivers/pinctrl/bcm/Makefile              |    1 +
 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c |  907 +++++++++++++++++++++++++++++
 3 files changed, 930 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
drivers/pinctrl/bcm/Kconfig +22 -0
index eb13201..cd11d4d 100644
@@ -20,6 +20,28 @@ config PINCTRL_BCM2835
 	select PINMUX
 	select PINCONF
 
+config PINCTRL_CYGNUS_GPIO
+	bool "Broadcom Cygnus GPIO (with PINCONF) driver"
+	depends on OF_GPIO && ARCH_BCM_CYGNUS
+	select GPIOLIB_IRQCHIP
+	select PINCONF
+	select GENERIC_PINCONF
+	default ARCH_BCM_CYGNUS
+	help
+	  Say yes here to enable the Broadcom Cygnus GPIO driver.
+
+	  The Broadcom Cygnus SoC has 3 GPIO controllers including the ASIU
+	  GPIO controller (ASIU), the chipCommonG GPIO controller (CCM), and
+	  the always-ON GPIO controller (CRMU/AON). All 3 GPIO controllers are
+	  supported by this driver.
+
+	  All 3 Cygnus GPIO controllers support basic PINCONF functions such
+	  as bias pull up, pull down, and drive strength configurations, when
+	  these pins are muxed to GPIO.
+
+	  Pins from the ASIU GPIO can be individually muxed to GPIO function,
+	  through interaction with the Cygnus IOMUX controller.
+
 config PINCTRL_CYGNUS_MUX
 	bool "Broadcom Cygnus IOMUX driver"
 	depends on (ARCH_BCM_CYGNUS || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index bb6beb6..2b2f70e 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_CYGNUS_GPIO)	+= pinctrl-cygnus-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c new file +907 -0

907 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#10 lore raw

Re: [PATCH v6 6/8] pinctrl: cygnus: add gpio/pinconf driver

Quoted 6 lines · Ray Jui

This adds the initial support of the Broadcom Cygnus GPIO/PINCONF driver that supports all 3 GPIO controllers on Cygnus including the ASIU GPIO controller, the chipCommonG GPIO controller, and the always-on GPIO controller. Basic PINCONF configurations such as bias pull up/down, and drive strength are also supported in this driver.

Quoted 6 lines

Pins from the ASIU GPIO controller can be individually muxed to GPIO function, through interaction with the Cygnus IOMUX controller

Patch applied! But please look at this:

Quoted 1 line

+#include <linux/gpio.h>

Doesn't just #include <linux/gpio/driver.h> work?

drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c line 907

Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c new file +5 -0
+static int __init cygnus_gpio_init(void)
+{
+       return platform_driver_probe(&cygnus_gpio_driver, cygnus_gpio_probe);
+}
+arch_initcall_sync(cygnus_gpio_init);

arch_initcall_sync() is a bit brutal.

Can you please investigate if you can have this as a normal device_initcall() utilizing deferred probe if necessary?

Follow-up patches accepted!

Yours,
Linus Walleij

author maintainer
#11 lore raw

Re: [PATCH v6 6/8] pinctrl: cygnus: add gpio/pinconf driver

Hi Linus,

Quoted 15 lines · Linus Walleij
Quoted 6 lines · Ray Jui

This adds the initial support of the Broadcom Cygnus GPIO/PINCONF driver that supports all 3 GPIO controllers on Cygnus including the ASIU GPIO controller, the chipCommonG GPIO controller, and the always-on GPIO controller. Basic PINCONF configurations such as bias pull up/down, and drive strength are also supported in this driver.

Quoted 6 lines

Pins from the ASIU GPIO controller can be individually muxed to GPIO function, through interaction with the Cygnus IOMUX controller

Quoted 6 lines

Patch applied! But please look at this:

Quoted 1 line

+#include <linux/gpio.h>

Doesn't just #include <linux/gpio/driver.h> work?

I think I need linux/gpio.h for gpiochip_add_pin_range and some related APIs.

Quoted 8 lines

drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c line 907

Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c new file +5 -0
+static int __init cygnus_gpio_init(void)
+{
+       return platform_driver_probe(&cygnus_gpio_driver, cygnus_gpio_probe);
+}
+arch_initcall_sync(cygnus_gpio_init);

arch_initcall_sync() is a bit brutal.

Quoted 5 lines

Can you please investigate if you can have this as a normal device_initcall() utilizing deferred probe if necessary?

Follow-up patches accepted!

I understand. Further investigation is needed and this may take a while, since a lot of our Cygnus drivers depend on GPIO and regulators (and all need to be converted to check against deferred probe errors). If possible, I'll definitely fix this.

Quoted 3 lines

Yours,
Linus Walleij

#12 lore raw

Re: [PATCH v6 6/8] pinctrl: cygnus: add gpio/pinconf driver

Quoted 18 lines · Ray Jui
Quoted 17 lines · Linus Walleij
Quoted 6 lines · Ray Jui

This adds the initial support of the Broadcom Cygnus GPIO/PINCONF driver that supports all 3 GPIO controllers on Cygnus including the ASIU GPIO controller, the chipCommonG GPIO controller, and the always-on GPIO controller. Basic PINCONF configurations such as bias pull up/down, and drive strength are also supported in this driver.

Quoted 6 lines

Pins from the ASIU GPIO controller can be individually muxed to GPIO function, through interaction with the Cygnus IOMUX controller

Patch applied! But please look at this:

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

+#include <linux/gpio.h>

Doesn't just #include <linux/gpio/driver.h> work?

I think I need linux/gpio.h for gpiochip_add_pin_range and some related APIs.

OK you're right ... I need to fix this.

Yours,
Linus Walleij

#13 lore raw

Re: [PATCH v6 6/8] pinctrl: cygnus: add gpio/pinconf driver

Quoted 21 lines · Linus Walleij
Quoted 20 lines · Ray Jui
Quoted 19 lines · Linus Walleij
Quoted 6 lines · Ray Jui

This adds the initial support of the Broadcom Cygnus GPIO/PINCONF driver that supports all 3 GPIO controllers on Cygnus including the ASIU GPIO controller, the chipCommonG GPIO controller, and the always-on GPIO controller. Basic PINCONF configurations such as bias pull up/down, and drive strength are also supported in this driver.

Quoted 6 lines

Pins from the ASIU GPIO controller can be individually muxed to GPIO function, through interaction with the Cygnus IOMUX controller

Patch applied! But please look at this:

Quoted 1 line

+#include <linux/gpio.h>

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Doesn't just #include <linux/gpio/driver.h> work?

I think I need linux/gpio.h for gpiochip_add_pin_range and some related APIs.

OK you're right ... I need to fix this.

I sent a patch fixing this now... hope it will work.

Yours,
Linus Walleij

author maintainer
#14 lore raw

PATCH v6 7/8 ARM: dts: enable GPIO for Broadcom Cygnus

In reply to Ray Jui

This enables all 3 GPIO controllers including the ASIU GPIO, the chipcommonG GPIO, and the ALWAYS-ON GPIO, for Broadcom Cygnus SoC

---
 arch/arm/boot/dts/bcm-cygnus.dtsi |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/boot/dts/bcm-cygnus.dtsi +30 -0
index 1cbae6a..63b7fed 100644
@@ -60,6 +60,36 @@
 		      <0x0301d24c 0x2c>;
 	};
 
+	gpio_crmu: gpio@03024800 {
+		compatible = "brcm,cygnus-crmu-gpio";
+		reg = <0x03024800 0x50>,
+		      <0x03024008 0x18>;
+		#gpio-cells = <2>;
+		gpio-controller;
+	};
+
+	gpio_ccm: gpio@1800a000 {
+		compatible = "brcm,cygnus-ccm-gpio";
+		reg = <0x1800a000 0x50>,
+		      <0x0301d164 0x20>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-controller;
+	};
+
+	gpio_asiu: gpio@180a5000 {
+		compatible = "brcm,cygnus-asiu-gpio";
+		reg = <0x180a5000 0x668>;
+		#gpio-cells = <2>;
+		gpio-controller;
+
+		pinmux = <&pinctrl>;
+
+		interrupt-controller;
+		interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
 	amba {
 		#address-cells = <1>;
 		#size-cells = <1>;
Signature · 1 line
1.7.9.5
Acked-by on v6 7/8
#15 lore raw

Re: [PATCH v6 7/8] ARM: dts: enable GPIO for Broadcom Cygnus

Quoted 6 lines · Ray Jui

This enables all 3 GPIO controllers including the ASIU GPIO, the chipcommonG GPIO, and the ALWAYS-ON GPIO, for Broadcom Cygnus SoC

Pls take this through ARM SoC.

Yours,
Linus Walleij

#16 lore raw

Re: [PATCH v6 7/8] ARM: dts: enable GPIO for Broadcom Cygnus

2015-03-10 3:21 GMT-07:00 Linus Walleij <[email protected]>:

Quoted 5 lines · Ray Jui
Quoted 4 lines

This enables all 3 GPIO controllers including the ASIU GPIO, the chipcommonG GPIO, and the ALWAYS-ON GPIO, for Broadcom Cygnus SoC

Quoted 7 lines
Quoted 3 lines

Pls take this through ARM SoC.

Applied to devicetree/next.
--
Florian

author maintainer
#17 lore raw

PATCH v6 8/8 ARM: dts: cygnus: enable GPIO based hook detection

In reply to Ray Jui

This enables GPIO based phone hook detection for Broadcom BCM911360 phone factor board (bcm911360_entphn)

---
 arch/arm/boot/dts/bcm911360_entphn.dts |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/bcm911360_entphn.dts +13 -0
index d2ee952..7db4843 100644
@@ -33,6 +33,7 @@
 /dts-v1/;
 
 #include "bcm-cygnus.dtsi"
+#include "dt-bindings/input/input.h"
 
 / {
 	model = "Cygnus Enterprise Phone (BCM911360_ENTPHN)";
@@ -50,4 +51,16 @@
 	uart3: serial@18023000 {
 		status = "okay";
 	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		hook {
+			label = "HOOK";
+			linux,code = <KEY_O>;
+			gpios = <&gpio_asiu 48 0>;
+		};
+	};
 };
Signature · 1 line
1.7.9.5