Skip to contentSkip to conversation

pinctrl and gpio drivers for NXP LPC18xx family

PATCH Superseded Joachim Eastwood 2 participants 12 messages Apr 3, 2015 – May 5, 2015

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover pinctrl and gpio drivers for NXP LPC18xx family

This patch set adds drivers for pinctrl and gpio on NXP LPC18xx/43xx devices. Patchset is based on Linus master 4.0-rc6.

The pinctrl driver uses the generic muxing and properties DT bindings as described in pinctrl-bindings.txt. There is still two TODOs left in the pinctrl driver regarding property control of special usb1 pins but I would like it merged regardless of this. Support will be added once I get USB up and running on the MCU.

There is no gpio irq support in this patch set, this will come at a later time.

The two last patches depend on two other patch sets and are only included to show the DT bindings in actual use.

Other LPC18xx patches:
Base support: http://marc.info/?l=linux-arm-kernel&m=142792344110733&w=2
Clk support: http://marc.info/?l=linux-arm-kernel&m=142800699801335&w=2

Joachim Eastwood (6):
pinctrl: add lpc18xx pinctrl driver
doc: dt: add documentation for lpc1850-scu pinctrl driver
gpio: add lpc18xx gpio driver
doc: dt: add documentation for lpc1850-gpio driver
ARM: dts: lpc18xx: add pinctrl and gpio nodes
ARM: dts: lpc4357-ea4357: add pinctrl and uart0 muxing

 .../devicetree/bindings/gpio/nxp,lpc1850-gpio.txt  |   23 +
 .../bindings/pinctrl/nxp,lpc1850-scu.txt           |   57 +
 arch/arm/boot/dts/lpc18xx.dtsi                     |   57 +
 arch/arm/boot/dts/lpc4357-ea4357.dts               |   19 +
 drivers/gpio/Kconfig                               |    8 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-lpc18xx.c                        |  191 ++++
 drivers/pinctrl/Kconfig                            |    8 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinctrl-lpc18xx.c                  | 1145 ++++++++++++++++++++
 10 files changed, 1510 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/nxp,lpc1850-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt
 create mode 100644 drivers/gpio/gpio-lpc18xx.c
 create mode 100644 drivers/pinctrl/pinctrl-lpc18xx.c
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/6 pinctrl: add lpc18xx pinctrl driver

Pinctrl driver for the System Control Unit (SCU) found on NXP LPC18xx/43xx devices.

Driver uses the generic pinctrl DT bindings for multiplexing and property settings.

---
 drivers/pinctrl/Kconfig           |    8 +
 drivers/pinctrl/Makefile          |    1 +
 drivers/pinctrl/pinctrl-lpc18xx.c | 1145 +++++++++++++++++++++++++++++++++++++
 3 files changed, 1154 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-lpc18xx.c
drivers/pinctrl/Kconfig +8 -0
index ee9f44ad7f02..e67fe0fdd058 100644
@@ -91,6 +91,14 @@ config PINCTRL_LANTIQ
 	select PINMUX
 	select PINCONF
 
+config PINCTRL_LPC18XX
+	bool "NXP LPC18XX/43XX SCU pinctrl driver"
+	depends on OF && (ARCH_LPC18XX || COMPILE_TEST)
+	select PINMUX
+	select GENERIC_PINCONF
+	help
+	  Pinctrl driver for NXP LPC18xx/43xx System Control Unit (SCU).
+
 config PINCTRL_FALCON
 	bool
 	depends on SOC_FALCON
drivers/pinctrl/Makefile +1 -0
index 0475206dd600..5c3609023eec 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_PINCTRL_U300)	+= pinctrl-u300.o
 obj-$(CONFIG_PINCTRL_COH901)	+= pinctrl-coh901.o
 obj-$(CONFIG_PINCTRL_XWAY)	+= pinctrl-xway.o
 obj-$(CONFIG_PINCTRL_LANTIQ)	+= pinctrl-lantiq.o
+obj-$(CONFIG_PINCTRL_LPC18XX)	+= pinctrl-lpc18xx.o
 obj-$(CONFIG_PINCTRL_TB10X)	+= pinctrl-tb10x.o
 obj-$(CONFIG_PINCTRL_ST) 	+= pinctrl-st.o
 obj-$(CONFIG_PINCTRL_ZYNQ)	+= pinctrl-zynq.o
drivers/pinctrl/pinctrl-lpc18xx.c new file +1145 -0

1,145 lines not on this page · raw message

Signature · 1 line
1.8.0
#3 lore raw

PATCH 2/6 doc: dt: add documentation for lpc1850-scu pinctrl driver

In reply to Joachim Eastwood
---
 .../bindings/pinctrl/nxp,lpc1850-scu.txt           | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt
Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt new file +57 -0
new file mode 100644
index 000000000000..b75eaa2517eb
@@ -0,0 +1,57 @@
+NXP LPC18xx/43xx SCU pin controller Device Tree Bindings
+--------------------------------------------------------
+
+Required properties:
+- compatible		: Should be "nxp,lpc1850-scu"
+- reg			: Address and length of the register set for the device
+- clocks		: Clock specifier (see clock bindings for details)
+
+The lpc1850-scu driver uses the generic pin multiplexing and generic pin
+configuration documented in pinctrl-bindings.txt.
+
+The following generic nodes are supported:
+ - function
+ - pins
+ - bias-disable
+ - bias-pull-up
+ - bias-pull-down
+ - drive-strength
+ - input-enable
+ - input-disable
+ - input-schmitt-enable
+ - input-schmitt-disable
+ - slew-rate
+
+Not all pins support all properties so either refer to the NXP 1850/4350
+user manual or the pin table in the pinctrl-lpc18xx driver for supported
+pin properties.
+
+Example:
+pinctrl: scu at 40086000 {
+	compatible = "nxp,lpc1850-scu";
+	reg = <0x40086000 0x1000>;
+	clocks = <&ccu1 CLK_CPU_SCU>;
+
+	i2c0_pins: i2c0-pins {
+		i2c0_pins_cfg {
+			pins = "i2c0_scl", "i2c0_sda";
+			function = "i2c0";
+			input-enable;
+		};
+	};
+
+	uart0_pins: uart0-pins {
+		uart0_rx_cfg {
+			pins = "pf_11";
+			function = "uart0";
+			bias-disable;
+			input-enable;
+		};
+
+		uart0_tx_cfg {
+			pins = "pf_10";
+			function = "uart0";
+			bias-disable;
+		};
+	};
+};
Signature · 1 line
1.8.0
#5 lore raw

PATCH 3/6 gpio: add lpc18xx gpio driver

In reply to Joachim Eastwood

Driver for the GPIO block found on NXP LPC18xx/43xx devices.

The GPIO block is divided into 8 ports which each support up to 32 gpios. The which gpios that are available depends on the specific device and it's package.

---
 drivers/gpio/Kconfig        |   8 ++
 drivers/gpio/Makefile       |   1 +
 drivers/gpio/gpio-lpc18xx.c | 191 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 200 insertions(+)
 create mode 100644 drivers/gpio/gpio-lpc18xx.c
drivers/gpio/Kconfig +8 -0
index c1e2ca3d9a51..94f5c6ba1681 100644
@@ -211,6 +211,14 @@ config GPIO_MOXART
 	  Select this option to enable GPIO driver for
 	  MOXA ART SoC devices.
 
+config GPIO_LPC18XX
+	bool "NXP LPC18XX/43XX GPIO support"
+	default y if ARCH_LPC18XX
+	depends on OF_GPIO && (ARCH_LPC18XX || COMPILE_TEST)
+	help
+	  Select this option to enable GPIO driver for
+	  NXP LPC18XX/43XX devices.
+
 config GPIO_MPC5200
 	def_bool y
 	depends on PPC_MPC52xx
drivers/gpio/Makefile +1 -0
index bdda6a94d2cd..a520ff7e28de 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_GPIO_KEMPLD)	+= gpio-kempld.o
 obj-$(CONFIG_ARCH_KS8695)	+= gpio-ks8695.o
 obj-$(CONFIG_GPIO_INTEL_MID)	+= gpio-intel-mid.o
 obj-$(CONFIG_GPIO_LP3943)	+= gpio-lp3943.o
+obj-$(CONFIG_GPIO_LPC18XX)	+= gpio-lpc18xx.o
 obj-$(CONFIG_ARCH_LPC32XX)	+= gpio-lpc32xx.o
 obj-$(CONFIG_GPIO_LYNXPOINT)	+= gpio-lynxpoint.o
 obj-$(CONFIG_GPIO_MAX730X)	+= gpio-max730x.o
drivers/gpio/gpio-lpc18xx.c new file +191 -0

191 lines not on this page · raw message

Signature · 1 line
1.8.0
#7 lore raw

PATCH 4/6 doc: dt: add documentation for lpc1850-gpio driver

In reply to Joachim Eastwood
---
 .../devicetree/bindings/gpio/nxp,lpc1850-gpio.txt  | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/nxp,lpc1850-gpio.txt
Documentation/devicetree/bindings/gpio/nxp,lpc1850-gpio.txt new file +23 -0
new file mode 100644
index 000000000000..9326873c887f
@@ -0,0 +1,23 @@
+NXP LPC18xx/43xx GPIO controller Device Tree Bindings
+-----------------------------------------------------
+
+Required properties:
+- compatible		: Should be "nxp,lpc1850-gpio"
+- reg			: Address and length of the register set for the device
+- clocks		: Clock specifier (see clock bindings for details)
+- gpio-controller	: Marks the device node as a GPIO controller.
+- #gpio-cells 		: Should be two
+			  - First cell is the GPIO line number
+			  - Second cell is used to specify polarity
+
+Optional properties:
+- gpio-ranges		: Mapping between GPIO and logic pin for pinctrl
+
+Examples:
+gpio: gpio at 400f4000 {
+	compatible = "nxp,lpc1850-gpio";
+	reg = <0x400f4000 0x4000>;
+	clocks = <&ccu1 CLK_CPU_GPIO>;
+	gpio-controller;
+	#gpio-cells = <2>;
+}
Signature · 1 line
1.8.0
#8 lore raw

PATCH 5/6 ARM: dts: lpc18xx: add pinctrl and gpio nodes

In reply to Joachim Eastwood
---
 arch/arm/boot/dts/lpc18xx.dtsi | 57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm/boot/dts/lpc18xx.dtsi +57 -0
index 8e9f51c88fad..e0099a7793b9 100644
@@ -16,6 +16,9 @@
 #include "dt-bindings/clock/lpc18xx-cgu.h"
 #include "dt-bindings/clock/lpc18xx-ccu.h"
 
+#define LPC_PIN(port, pin)	(0x##port * 32 + pin)
+#define LPC_GPIO(port, pin)	(port * 32 + pin)
+
 / {
 	aliases {
 		serial0 = &uart0;
@@ -148,6 +151,12 @@
 			clocks = <&ccu1 CLK_CPU_TIMER1>;
 		};
 
+		pinctrl: scu at 40086000 {
+			compatible = "nxp,lpc1850-scu";
+			reg = <0x40086000 0x1000>;
+			clocks = <&ccu1 CLK_CPU_SCU>;
+		};
+
 		uart2: serial at 400c1000 {
 			compatible = "ns16550a";
 			reg = <0x400c1000 0x1000>;
@@ -181,5 +190,53 @@
 			interrupts = <15>;
 			clocks = <&ccu1 CLK_CPU_TIMER3>;
 		};
+
+		gpio: gpio at 400f4000 {
+			compatible = "nxp,lpc1850-gpio";
+			reg = <0x400f4000 0x4000>;
+			clocks = <&ccu1 CLK_CPU_GPIO>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			gpio-ranges =	<&pinctrl LPC_GPIO(0,0)  LPC_PIN(0,0)  2>,
+					<&pinctrl LPC_GPIO(0,4)  LPC_PIN(1,0)  1>,
+					<&pinctrl LPC_GPIO(0,8)  LPC_PIN(1,1)  4>,
+					<&pinctrl LPC_GPIO(1,8)  LPC_PIN(1,5)  2>,
+					<&pinctrl LPC_GPIO(1,0)  LPC_PIN(1,7)  8>,
+					<&pinctrl LPC_GPIO(0,2)  LPC_PIN(1,15) 2>,
+					<&pinctrl LPC_GPIO(0,12) LPC_PIN(1,17) 2>,
+					<&pinctrl LPC_GPIO(0,15) LPC_PIN(1,20) 1>,
+					<&pinctrl LPC_GPIO(5,0)  LPC_PIN(2,0)  7>,
+					<&pinctrl LPC_GPIO(0,7)  LPC_PIN(2,7)  1>,
+					<&pinctrl LPC_GPIO(5,7)  LPC_PIN(2,8)  1>,
+					<&pinctrl LPC_GPIO(1,10) LPC_PIN(2,9)  1>,
+					<&pinctrl LPC_GPIO(0,14) LPC_PIN(2,10) 1>,
+					<&pinctrl LPC_GPIO(1,11) LPC_PIN(2,11) 3>,
+					<&pinctrl LPC_GPIO(5,8)  LPC_PIN(3,1)  2>,
+					<&pinctrl LPC_GPIO(1,14) LPC_PIN(3,4)  2>,
+					<&pinctrl LPC_GPIO(0,6)  LPC_PIN(3,6)  1>,
+					<&pinctrl LPC_GPIO(5,10) LPC_PIN(3,7)  2>,
+					<&pinctrl LPC_GPIO(2,0)  LPC_PIN(4,0)  7>,
+					<&pinctrl LPC_GPIO(5,12) LPC_PIN(4,8)  3>,
+					<&pinctrl LPC_GPIO(2,9)  LPC_PIN(5,0)  7>,
+					<&pinctrl LPC_GPIO(2,7)  LPC_PIN(5,7)  1>,
+					<&pinctrl LPC_GPIO(3,0)  LPC_PIN(6,1)  5>,
+					<&pinctrl LPC_GPIO(0,5)  LPC_PIN(6,6)  1>,
+					<&pinctrl LPC_GPIO(5,15) LPC_PIN(6,7)  2>,
+					<&pinctrl LPC_GPIO(3,5)  LPC_PIN(6,9)  3>,
+					<&pinctrl LPC_GPIO(2,8)  LPC_PIN(6,12) 1>,
+					<&pinctrl LPC_GPIO(3,8)  LPC_PIN(7,0)  8>,
+					<&pinctrl LPC_GPIO(4,0)  LPC_PIN(8,0)  8>,
+					<&pinctrl LPC_GPIO(4,12) LPC_PIN(9,0)  4>,
+					<&pinctrl LPC_GPIO(5,17) LPC_PIN(9,4)  2>,
+					<&pinctrl LPC_GPIO(4,11) LPC_PIN(9,6)  1>,
+					<&pinctrl LPC_GPIO(4,8)  LPC_PIN(a,1)  3>,
+					<&pinctrl LPC_GPIO(5,19) LPC_PIN(a,4)  1>,
+					<&pinctrl LPC_GPIO(5,20) LPC_PIN(b,0)  7>,
+					<&pinctrl LPC_GPIO(6,0)  LPC_PIN(c,1) 14>,
+					<&pinctrl LPC_GPIO(6,14) LPC_PIN(d,0) 17>,
+					<&pinctrl LPC_GPIO(7,0)  LPC_PIN(e,0) 16>,
+					<&pinctrl LPC_GPIO(7,16) LPC_PIN(f,1)  3>,
+					<&pinctrl LPC_GPIO(7,19) LPC_PIN(f,5)  7>;
+		};
 	};
 };
Signature · 1 line
1.8.0
#10 lore raw

PATCH 6/6 ARM: dts: lpc4357-ea4357: add pinctrl and uart0 muxing

In reply to Joachim Eastwood
---
 arch/arm/boot/dts/lpc4357-ea4357.dts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm/boot/dts/lpc4357-ea4357.dts +19 -0
index 39340e355b0a..c2b85f8e6e31 100644
@@ -29,6 +29,25 @@
 	};
 };
 
+&pinctrl {
+	uart0_pins: uart0-pins {
+		uart0_rx_cfg {
+			pins = "pf_11";
+			function = "uart0";
+			bias-disable;
+			input-enable;
+		};
+
+		uart0_tx_cfg {
+			pins = "pf_10";
+			function = "uart0";
+			bias-disable;
+		};
+	};
+};
+
 &uart0 {
 	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins>;
 };
Signature · 1 line
1.8.0
#2 lore raw

PATCH 1/6 pinctrl: add lpc18xx pinctrl driver

In reply to Joachim Eastwood
Quoted 7 lines · Joachim Eastwood

Pinctrl driver for the System Control Unit (SCU) found on NXP LPC18xx/43xx devices.

Driver uses the generic pinctrl DT bindings for multiplexing and property settings.

Looks nice. Patch applied. Sorry for the delay.

Yours,
Linus Walleij

#6 lore raw

PATCH 3/6 gpio: add lpc18xx gpio driver

In reply to Joachim Eastwood
Quoted 7 lines · Joachim Eastwood

Driver for the GPIO block found on NXP LPC18xx/43xx devices.

The GPIO block is divided into 8 ports which each support up to 32 gpios. The which gpios that are available depends on the specific device and it's package.

Patch applied. Needed some rebasing but whatever.

Yours,
Linus Walleij