Skip to contentSkip to conversation

OCTEON GPIO support.

PATCH In review David Daney 5 participants 9 messages Jul 29, 2013 – Aug 16, 2013

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH v2 1/2 MIPS: OCTEON: Select ARCH_REQUIRE_GPIOLIB

In reply to David Daney

From: David Daney <[email protected]>

... and create asm/mach-cavium-octeon/gpio.h so that things continue to build.

This allows us to use the existing I2C connected GPIO expanders.

---
 arch/mips/Kconfig                               |  1 +
 arch/mips/include/asm/mach-cavium-octeon/gpio.h | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 arch/mips/include/asm/mach-cavium-octeon/gpio.h
arch/mips/Kconfig +1 -0
index c3abed3..9c2293a 100644
@@ -731,6 +731,7 @@ config CAVIUM_OCTEON_SOC
 	select USB_ARCH_HAS_OHCI
 	select USB_ARCH_HAS_EHCI
 	select HOLES_IN_ZONE
+	select ARCH_REQUIRE_GPIOLIB
 	help
 	  This option supports all of the Octeon reference boards from Cavium
 	  Networks. It builds a kernel that dynamically determines the Octeon
arch/mips/include/asm/mach-cavium-octeon/gpio.h new file +21 -0
new file mode 100644
index 0000000..34e9f7a
@@ -0,0 +1,21 @@
+#ifndef __ASM_MACH_CAVIUM_OCTEON_GPIO_H
+#define __ASM_MACH_CAVIUM_OCTEON_GPIO_H
+
+#ifdef CONFIG_GPIOLIB
+#define gpio_get_value	__gpio_get_value
+#define gpio_set_value	__gpio_set_value
+#define gpio_cansleep	__gpio_cansleep
+#else
+int gpio_request(unsigned gpio, const char *label);
+void gpio_free(unsigned gpio);
+int gpio_direction_input(unsigned gpio);
+int gpio_direction_output(unsigned gpio, int value);
+int gpio_get_value(unsigned gpio);
+void gpio_set_value(unsigned gpio, int value);
+#endif
+
+#include <asm-generic/gpio.h>
+
+#define gpio_to_irq	__gpio_to_irq
+
+#endif /* __ASM_MACH_GENERIC_GPIO_H */
Signature · 1 line
1.7.11.7
#0 lore raw

v2 cover OCTEON GPIO support.

From: David Daney <[email protected]>

The Cavium, OCTEON is a MIPS based SoC. Here we add support for its on-chip GPIO lines.

Changes from v1: Cleaned up variable names, messages and added some comments as suggested by Linus Walleij.

The second patch depends on the first, but is in code maintained by Ralf. It may be best to mrege both of these together, perhaps from the GPIO tree, with Ralf's Acked-by.

David Daney (2):
MIPS: OCTEON: Select ARCH_REQUIRE_GPIOLIB
gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.

 arch/mips/Kconfig                               |   1 +
 arch/mips/include/asm/mach-cavium-octeon/gpio.h |  21 ++++
 drivers/gpio/Kconfig                            |   8 ++
 drivers/gpio/Makefile                           |   1 +
 drivers/gpio/gpio-octeon.c                      | 157 ++++++++++++++++++++++++
 5 files changed, 188 insertions(+)
 create mode 100644 arch/mips/include/asm/mach-cavium-octeon/gpio.h
 create mode 100644 drivers/gpio/gpio-octeon.c
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH v2 2/2 gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.

From: David Daney <[email protected]>

The SOCs in the OCTEON family have 16 (or in some cases 20) on-chip GPIO pins, this driver handles them all. Configuring the pins as interrupt sources is handled elsewhere (OCTEON's irq handling code).

---

Device tree binding defintions already exist for this device in Documentation/devicetree/bindings/gpio/cavium-octeon-gpio.txt

 drivers/gpio/Kconfig       |   8 +++
 drivers/gpio/Makefile      |   1 +
 drivers/gpio/gpio-octeon.c | 157 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/gpio/gpio-octeon.c
drivers/gpio/Kconfig +8 -0
index b2450ba..b21b7a2 100644
@@ -193,6 +193,14 @@ config GPIO_MXS
 	select GPIO_GENERIC
 	select GENERIC_IRQ_CHIP
 
+config GPIO_OCTEON
+	tristate "Cavium OCTEON GPIO"
+	depends on GPIOLIB && CAVIUM_OCTEON_SOC
+	default y
+	help
+	  Say yes here to support the on-chip GPIO lines on the OCTEON
+	  family of SOCs.
+
 config GPIO_PL061
 	bool "PrimeCell PL061 GPIO support"
 	depends on ARM && ARM_AMBA
drivers/gpio/Makefile +1 -0
index ef3e983..e7fd980 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_GPIO_MSM_V2)	+= gpio-msm-v2.o
 obj-$(CONFIG_GPIO_MVEBU)        += gpio-mvebu.o
 obj-$(CONFIG_GPIO_MXC)		+= gpio-mxc.o
 obj-$(CONFIG_GPIO_MXS)		+= gpio-mxs.o
+obj-$(CONFIG_GPIO_OCTEON)	+= gpio-octeon.o
 obj-$(CONFIG_ARCH_OMAP)		+= gpio-omap.o
 obj-$(CONFIG_GPIO_PCA953X)	+= gpio-pca953x.o
 obj-$(CONFIG_GPIO_PCF857X)	+= gpio-pcf857x.o
drivers/gpio/gpio-octeon.c new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#6 lore raw
In reply to David Daney
Quoted 11 lines · David Daney

From: David Daney <[email protected]>

The Cavium, OCTEON is a MIPS based SoC. Here we add support for its on-chip GPIO lines.

Changes from v1: Cleaned up variable names, messages and added some comments as suggested by Linus Walleij.

The second patch depends on the first, but is in code maintained by Ralf. It may be best to mrege both of these together, perhaps from the GPIO tree, with Ralf's Acked-by.

Really I meant to say that the first patch is in the MIPS tree, and should be Acked-by Ralf, if that wasn't clear.

David Daney

Quoted 14 lines

David Daney (2):
MIPS: OCTEON: Select ARCH_REQUIRE_GPIOLIB
gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.

  arch/mips/Kconfig                               |   1 +
  arch/mips/include/asm/mach-cavium-octeon/gpio.h |  21 ++++
  drivers/gpio/Kconfig                            |   8 ++
  drivers/gpio/Makefile                           |   1 +
  drivers/gpio/gpio-octeon.c                      | 157 ++++++++++++++++++++++++
  5 files changed, 188 insertions(+)

create mode 100644 arch/mips/include/asm/mach-cavium-octeon/gpio.h create mode 100644 drivers/gpio/gpio-octeon.c

Acked-by on the v2 series
#7 lore raw
In reply to David Daney
Quoted 11 lines · David Daney

From: David Daney <[email protected]>

The Cavium, OCTEON is a MIPS based SoC. Here we add support for its on-chip GPIO lines.

Changes from v1: Cleaned up variable names, messages and added some comments as suggested by Linus Walleij.

The second patch depends on the first, but is in code maintained by Ralf. It may be best to mrege both of these together, perhaps from the GPIO tree, with Ralf's Acked-by.

Ralf

#8 lore raw
In reply to David Daney

Ping.

Hi Linus,

I wonder if you have had a chance to look at these...

David Daney

Quoted 25 lines · David Daney

From: David Daney <[email protected]>

The Cavium, OCTEON is a MIPS based SoC. Here we add support for its on-chip GPIO lines.

Changes from v1: Cleaned up variable names, messages and added some comments as suggested by Linus Walleij.

The second patch depends on the first, but is in code maintained by Ralf. It may be best to mrege both of these together, perhaps from the GPIO tree, with Ralf's Acked-by.

David Daney (2):
MIPS: OCTEON: Select ARCH_REQUIRE_GPIOLIB
gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.

  arch/mips/Kconfig                               |   1 +
  arch/mips/include/asm/mach-cavium-octeon/gpio.h |  21 ++++
  drivers/gpio/Kconfig                            |   8 ++
  drivers/gpio/Makefile                           |   1 +
  drivers/gpio/gpio-octeon.c                      | 157 ++++++++++++++++++++++++
  5 files changed, 188 insertions(+)

create mode 100644 arch/mips/include/asm/mach-cavium-octeon/gpio.h create mode 100644 drivers/gpio/gpio-octeon.c

Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.

In reply to David Daney
Quoted 11 lines · David Daney

From: David Daney <[email protected]>

The SOCs in the OCTEON family have 16 (or in some cases 20) on-chip GPIO pins, this driver handles them all. Configuring the pins as interrupt sources is handled elsewhere (OCTEON's irq handling code).

---

Device tree binding defintions already exist for this device in Documentation/devicetree/bindings/gpio/cavium-octeon-gpio.txt

I like this.

I guess you will merge both patches through the MIPS arch tree?

Yours,
Linus Walleij

#5 lore raw

Re: [PATCH v2 2/2] gpio MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.

Quoted 2 lines · Linus Walleij

I guess you will merge both patches through the MIPS arch tree?

Hi Linus,

sure, we can take them via the MIPS tree

John