Skip to contentSkip to conversation

gpio driver for NXP LPC18xx family

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

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover gpio driver for NXP LPC18xx family

This patch set adds a gpio driver for NXP LPC18xx/43xx devices. Patchset is based on Linus master 4.1-rc1.

changes in v2:
- use PBYTE register for gpio set/get
- refactor direction setup
- add lock for direction set RMW cycle
- expand doc example

Base support for the family can be found here:
http://marc.info/?l=linux-arm-kernel&m=143016894704253&w=2

DTS changes will come once base support and clk patches goes upstream.

Joachim Eastwood (2):
gpio: add lpc18xx gpio driver
doc: dt: add documentation for lpc1850-gpio driver

 .../devicetree/bindings/gpio/nxp,lpc1850-gpio.txt  |  39 +++++
 drivers/gpio/Kconfig                               |   8 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-lpc18xx.c                        | 180 +++++++++++++++++++++
 4 files changed, 228 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/nxp,lpc1850-gpio.txt
 create mode 100644 drivers/gpio/gpio-lpc18xx.c
Signature · 1 line
1.8.0
#1 lore raw

PATCH v2 1/2 gpio: add lpc18xx gpio driver

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

---
 drivers/gpio/Kconfig        |   8 ++
 drivers/gpio/Makefile       |   1 +
 drivers/gpio/gpio-lpc18xx.c | 180 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+)
 create mode 100644 drivers/gpio/gpio-lpc18xx.c
drivers/gpio/Kconfig +8 -0
index caefe806db5e..c2211258231b 100644
@@ -230,6 +230,14 @@ config GPIO_LOONGSON
 	help
 	  driver for GPIO functionality on Loongson-2F/3A/3B processors.
 
+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_LYNXPOINT
 	tristate "Intel Lynxpoint GPIO support"
 	depends on ACPI && X86
drivers/gpio/Makefile +1 -0
index f71bb971329c..7b7f5d2e8ad4 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_ARCH_KS8695)	+= gpio-ks8695.o
 obj-$(CONFIG_GPIO_INTEL_MID)	+= gpio-intel-mid.o
 obj-$(CONFIG_GPIO_LOONGSON)	+= gpio-loongson.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 +180 -0

180 lines not on this page · raw message

Signature · 1 line
1.8.0
#2 lore raw

PATCH v2 2/2 doc: dt: add documentation for lpc1850-gpio driver

In reply to Joachim Eastwood
---
 .../devicetree/bindings/gpio/nxp,lpc1850-gpio.txt  | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/nxp,lpc1850-gpio.txt
Documentation/devicetree/bindings/gpio/nxp,lpc1850-gpio.txt new file +39 -0
new file mode 100644
index 000000000000..eb7cdd69e10b
@@ -0,0 +1,39 @@
+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 pinctrl
+
+Example:
+#define LPC_GPIO(port, pin)	(port * 32 + pin)
+#define LPC_PIN(port, pin)	(0x##port * 32 + pin)
+
+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(7,19) LPC_PIN(f,5)  7>;
+};
+
+gpio_joystick {
+	compatible = "gpio-keys-polled";
+	...
+
+	button at 0 {
+		...
+		gpios = <&gpio LPC_GPIO(4,8) GPIO_ACTIVE_LOW>;
+	};
+};
Signature · 1 line
1.8.0
#3 lore raw

v2 cover gpio driver for NXP LPC18xx family

In reply to Joachim Eastwood
Quoted 8 lines · Joachim Eastwood

This patch set adds a gpio driver for NXP LPC18xx/43xx devices. Patchset is based on Linus master 4.1-rc1.

changes in v2:
- use PBYTE register for gpio set/get
- refactor direction setup
- add lock for direction set RMW cycle
- expand doc example

This v2 version applied.

Yours,
Linus Walleij

#4 lore raw

v2 cover gpio driver for NXP LPC18xx family

Hi Linus,

Quoted 5 lines · Linus Walleij
Quoted 3 lines · Joachim Eastwood

This patch set adds a gpio driver for NXP LPC18xx/43xx devices. Patchset is based on Linus master 4.1-rc1.

Quoted 7 lines
Quoted 5 lines

changes in v2:
- use PBYTE register for gpio set/get
- refactor direction setup
- add lock for direction set RMW cycle
- expand doc example

This v2 version applied.

Excellent.

Thanks Linus.

regards,
Joachim Eastwood