Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30c67e93 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux

Pull GPIO changes from Grant Likely:
 "The usual selection of bug fixes and driver updates for GPIO.  Nothing
  really stands out except the addition of the GRGPIO driver and some
  enhacements to ACPI support"

I'm pulling this despite the earlier mess.  Let's hope it compiles these
days.

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux: (46 commits)
  gpio: grgpio: Add irq support
  gpio: grgpio: Add device driver for GRGPIO cores
  gpiolib-acpi: introduce acpi_get_gpio_by_index() helper
  GPIO: gpio-generic: remove kfree() from bgpio_remove call
  gpio / ACPI: Handle ACPI events in accordance with the spec
  gpio: lpc32xx: Fix off-by-one valid range checking for bank
  gpio: mcp23s08: convert driver to DT
  gpio/omap: force restore if context loss is not detectable
  gpio/omap: optimise interrupt service routine
  gpio/omap: remove extra context restores in *_runtime_resume()
  gpio/omap: free irq domain in probe() failure paths
  gpio: gpio-generic: Add 16 and 32 bit big endian byte order support
  gpio: samsung: Add terminating entry for exynos_pinctrl_ids
  gpio: mvebu: add dbg_show function
  MAX7301 GPIO: Do not force SPI speed when using OF Platform
  gpio: gpio-tps65910.c: fix checkpatch error
  gpio: gpio-timberdale.c: fix checkpatch error
  gpio: gpio-tc3589x.c: fix checkpatch errors
  gpio: gpio-stp-xway.c: fix checkpatch error
  gpio: gpio-sch.c: fix checkpatch error
  ...
parents f87bb9ee 08ffb222
Loading
Loading
Loading
Loading
+31 −1
Original line number Diff line number Diff line
@@ -199,6 +199,8 @@ the device to the driver. For example:
	{
		Name (SBUF, ResourceTemplate()
		{
			...
			// Used to power on/off the device
			GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
				IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
				0x00, ResourceConsumer,,)
@@ -206,10 +208,20 @@ the device to the driver. For example:
				// Pin List
				0x0055
			}

			// Interrupt for the device
			GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
				 0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
			{
				// Pin list
				0x0058
			}

			...

			Return (SBUF)
		}

		Return (SBUF)
	}

These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
@@ -220,6 +232,24 @@ The driver can do this by including <linux/acpi_gpio.h> and then calling
acpi_get_gpio(path, gpio). This will return the Linux GPIO number or
negative errno if there was no translation found.

In a simple case of just getting the Linux GPIO number from device
resources one can use acpi_get_gpio_by_index() helper function. It takes
pointer to the device and index of the GpioIo/GpioInt descriptor in the
device resources list. For example:

	int gpio_irq, gpio_power;
	int ret;

	gpio_irq = acpi_get_gpio_by_index(dev, 1, NULL);
	if (gpio_irq < 0)
		/* handle error */

	gpio_power = acpi_get_gpio_by_index(dev, 0, NULL);
	if (gpio_power < 0)
		/* handle error */

	/* Now we can use the GPIO numbers */

Other GpioIo parameters must be converted first by the driver to be
suitable to the gpiolib before passing them.

+26 −0
Original line number Diff line number Diff line
Aeroflex Gaisler GRGPIO General Purpose I/O cores.

The GRGPIO GPIO core is available in the GRLIB VHDL IP core library.

Note: In the ordinary environment for the GRGPIO core, a Leon SPARC system,
these properties are built from information in the AMBA plug&play.

Required properties:

- name : Should be "GAISLER_GPIO" or "01_01a"

- reg : Address and length of the register set for the device

- interrupts : Interrupt numbers for this device

Optional properties:

- nbits : The number of gpio lines. If not present driver assumes 32 lines.

- irqmap : An array with an index for each gpio line. An index is either a valid
	index into the interrupts property array, or 0xffffffff that indicates
	no irq for that line. Driver provides no interrupt support if not
	present.

For further information look in the documentation for the GLIB IP core library:
http://www.gaisler.com/products/grlib/grip.pdf
+47 −0
Original line number Diff line number Diff line
Microchip MCP2308/MCP23S08/MCP23017/MCP23S17 driver for
8-/16-bit I/O expander with serial interface (I2C/SPI)

Required properties:
- compatible : Should be
    - "mcp,mcp23s08" for  8 GPIO SPI version
    - "mcp,mcp23s17" for 16 GPIO SPI version
    - "mcp,mcp23008" for  8 GPIO I2C version or
    - "mcp,mcp23017" for 16 GPIO I2C version of the chip
- #gpio-cells : Should be two.
  - first cell is the pin number
  - second cell is used to specify flags. Flags are currently unused.
- gpio-controller : Marks the device node as a GPIO controller.
- reg : For an address on its bus. I2C uses this a the I2C address of the chip.
        SPI uses this to specify the chipselect line which the chip is
        connected to. The driver and the SPI variant of the chip support
        multiple chips on the same chipselect. Have a look at
        mcp,spi-present-mask below.

Required device specific properties (only for SPI chips):
- mcp,spi-present-mask : This is a present flag, that makes only sense for SPI
        chips - as the name suggests. Multiple SPI chips can share the same
        SPI chipselect. Set a bit in bit0-7 in this mask to 1 if there is a
        chip connected with the corresponding spi address set. For example if
        you have a chip with address 3 connected, you have to set bit3 to 1,
        which is 0x08. mcp23s08 chip variant only supports bits 0-3. It is not
        possible to mix mcp23s08 and mcp23s17 on the same chipselect. Set at
        least one bit to 1 for SPI chips.
- spi-max-frequency = The maximum frequency this chip is able to handle

Example I2C:
gpiom1: gpio@20 {
        compatible = "mcp,mcp23017";
        gpio-controller;
        #gpio-cells = <2>;
        reg = <0x20>;
};

Example SPI:
gpiom1: gpio@0 {
        compatible = "mcp,mcp23s17";
        gpio-controller;
        #gpio-cells = <2>;
        spi-present-mask = <0x01>;
        reg = <0>;
        spi-max-frequency = <1000000>;
};
+5 −2
Original line number Diff line number Diff line
@@ -21,7 +21,10 @@ Required properties:

OMAP specific properties:
- ti,hwmods:		Name of the hwmod associated to the GPIO:
  "gpio<X>", <X> being the 1-based instance number from the HW spec
			"gpio<X>", <X> being the 1-based instance number
			from the HW spec.
- ti,gpio-always-on: 	Indicates if a GPIO bank is always powered and
			so will never lose its logic state.


Example:
+10 −1
Original line number Diff line number Diff line
@@ -297,12 +297,21 @@ config GPIO_GE_FPGA

config GPIO_LYNXPOINT
	bool "Intel Lynxpoint GPIO support"
	depends on ACPI
	depends on ACPI && X86
	select IRQ_DOMAIN
	help
	  driver for GPIO functionality on Intel Lynxpoint PCH chipset
	  Requires ACPI device enumeration code to set up a platform device.

config GPIO_GRGPIO
	tristate "Aeroflex Gaisler GRGPIO support"
	depends on OF
	select GPIO_GENERIC
	select IRQ_DOMAIN
	help
	  Select this to support Aeroflex Gaisler GRGPIO cores from the GRLIB
	  VHDL IP core library.

comment "I2C GPIO expanders:"

config GPIO_ARIZONA
Loading