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

Commit 6aa2f944 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v4.15 kernel cycle:

  Core:

   - Fix the semantics of raw GPIO to actually be raw. No inversion
     semantics as before, but also no open draining, and allow the raw
     operations to affect lines used for interrupts as the caller
     supposedly knows what they are doing if they are getting the big
     hammer.

   - Rewrote the __inner_function() notation calls to names that make
     more sense. I just find this kind of code disturbing.

   - Drop the .irq_base() field from the gpiochip since now all IRQs are
     mapped dynamically. This is nice.

   - Support for .get_multiple() in the core driver API. This allows us
     to read several GPIO lines with a single register read. This has
     high value for some usecases: it can be used to create
     oscilloscopes and signal analyzers and other things that rely on
     reading several lines at exactly the same instant. Also a generally
     nice optimization. This uses the new assign_bit() macro from the
     bitops lib that was ACKed by Andrew Morton and is implemented for
     two drivers, one of them being the generic MMIO driver so everyone
     using that will be able to benefit from this.

   - Do not allow requests of Open Drain and Open Source setting of a
     GPIO line simultaneously. If the hardware actually supports
     enabling both at the same time the electrical result would be
     disastrous.

   - A new interrupt chip core helper. This will be helpful to deal with
     "banked" GPIOs, which means GPIO controllers with several logical
     blocks of GPIO inside them. This is several gpiochips per device in
     the device model, in contrast to the case when there is a 1-to-1
     relationship between a device and a gpiochip.

  New drivers:

   - Maxim MAX3191x industrial serializer, a very interesting piece of
     professional I/O hardware.

   - Uniphier GPIO driver. This is the GPIO block from the recent
     Socionext (ex Fujitsu and Panasonic) platform.

   - Tegra 186 driver. This is based on the new banked GPIO
     infrastructure.

  Other improvements:

   - Some documentation improvements.

   - Wakeup support for the DesignWare DWAPB GPIO controller.

   - Reset line support on the DesignWare DWAPB GPIO controller.

   - Several non-critical bug fixes and improvements for the Broadcom
     BRCMSTB driver.

   - Misc non-critical bug fixes like exotic errorpaths, removal of dead
     code etc.

   - Explicit comments on fall-through switch() statements"

* tag 'gpio-v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (65 commits)
  gpio: tegra186: Remove tegra186_gpio_lock_class
  gpio: rcar: Add r8a77995 (R-Car D3) support
  pinctrl: bcm2835: Fix some merge fallout
  gpio: Fix undefined lock_dep_class
  gpio: Automatically add lockdep keys
  gpio: Introduce struct gpio_irq_chip.first
  gpio: Disambiguate struct gpio_irq_chip.nested
  gpio: Add Tegra186 support
  gpio: Export gpiochip_irq_{map,unmap}()
  gpio: Implement tighter IRQ chip integration
  gpio: Move lock_key into struct gpio_irq_chip
  gpio: Move irq_valid_mask into struct gpio_irq_chip
  gpio: Move irq_nested into struct gpio_irq_chip
  gpio: Move irq_chained_parent to struct gpio_irq_chip
  gpio: Move irq_default_type to struct gpio_irq_chip
  gpio: Move irq_handler to struct gpio_irq_chip
  gpio: Move irqdomain into struct gpio_irq_chip
  gpio: Move irqchip into struct gpio_irq_chip
  gpio: Introduce struct gpio_irq_chip
  pinctrl: armada-37xx: remove unused variable
  ...
parents e37e0ee0 24f0966c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ Description:
  Kernel code may export it for complete or partial access.

  GPIOs are identified as they are inside the kernel, using integers in
  the range 0..INT_MAX.  See Documentation/gpio.txt for more information.
  the range 0..INT_MAX.  See Documentation/gpio/gpio.txt for more information.

    /sys/class/gpio
	/export ... asks the kernel to export a GPIO to userspace
+26 −0
Original line number Diff line number Diff line
Common properties
=================

Endianness
----------

The Devicetree Specification does not define any properties related to hardware
byteswapping, but endianness issues show up frequently in porting Linux to
@@ -58,3 +62,25 @@ dev: dev@40031000 {
	      ...
	      little-endian;
};

Daisy-chained devices
---------------------

Many serially-attached GPIO and IIO devices are daisy-chainable.  To the
host controller, a daisy-chain appears as a single device, but the number
of inputs and outputs it provides is the sum of inputs and outputs provided
by all of its devices.  The driver needs to know how many devices the
daisy-chain comprises to determine the amount of data exchanged, how many
inputs and outputs to register and so on.

Optional properties:
 - #daisy-chained-devices: Number of devices in the daisy-chain (default is 1).

Example:
gpio@0 {
	      compatible = "name";
	      reg = <0>;
	      gpio-controller;
	      #gpio-cells = <2>;
	      #daisy-chained-devices = <3>;
};
+59 −0
Original line number Diff line number Diff line
GPIO driver for Maxim MAX3191x industrial serializer

Required properties:
 - compatible:		Must be one of:
			"maxim,max31910"
			"maxim,max31911"
			"maxim,max31912"
			"maxim,max31913"
			"maxim,max31953"
			"maxim,max31963"
 - reg: 		Chip select number.
 - gpio-controller:	Marks the device node as a GPIO controller.
 - #gpio-cells: 	Should be two. For consumer use see gpio.txt.

Optional properties:
 - #daisy-chained-devices:
			Number of chips in the daisy-chain (default is 1).
 - maxim,modesel-gpios: GPIO pins to configure modesel of each chip.
			The number of GPIOs must equal "#daisy-chained-devices"
			(if each chip is driven by a separate pin) or 1
			(if all chips are wired to the same pin).
 - maxim,fault-gpios: 	GPIO pins to read fault of each chip.
			The number of GPIOs must equal "#daisy-chained-devices"
			or 1.
 - maxim,db0-gpios:	GPIO pins to configure debounce of each chip.
			The number of GPIOs must equal "#daisy-chained-devices"
			or 1.
 - maxim,db1-gpios:	GPIO pins to configure debounce of each chip.
			The number of GPIOs must equal "maxim,db0-gpios".
 - maxim,modesel-8bit:	Boolean whether the modesel pin of the chips is
			pulled high (8-bit mode).  Use this if the modesel pin
			is hardwired and consequently "maxim,modesel-gpios"
			cannot be specified.  By default if neither this nor
			"maxim,modesel-gpios" is given, the driver assumes
			that modesel is pulled low (16-bit mode).
 - maxim,ignore-undervoltage:
			Boolean whether to ignore undervoltage alarms signaled
			by the "maxim,fault-gpios" or by the status byte
			(in 16-bit mode).  Use this if the chips are powered
			through 5VOUT instead of VCC24V, in which case they
			will constantly signal undervoltage.

For other required and optional properties of SPI slave nodes please refer to
../spi/spi-bus.txt.

Example:
	gpio@0 {
		compatible = "maxim,max31913";
		reg = <0>;
		gpio-controller;
		#gpio-cells = <2>;

		maxim,modesel-gpios = <&gpio2 23>;
		maxim,fault-gpios   = <&gpio2 24 GPIO_ACTIVE_LOW>;
		maxim,db0-gpios     = <&gpio2 25>;
		maxim,db1-gpios     = <&gpio2 26>;

		spi-max-frequency = <25000000>;
	};
+52 −0
Original line number Diff line number Diff line
UniPhier GPIO controller

Required properties:
- compatible: Should be "socionext,uniphier-gpio".
- reg: Specifies offset and length of the register set for the device.
- gpio-controller: Marks the device node as a GPIO controller.
- #gpio-cells: Should be 2.  The first cell is the pin number and the second
  cell is used to specify optional parameters.
- interrupt-parent: Specifies the parent interrupt controller.
- interrupt-controller: Marks the device node as an interrupt controller.
- #interrupt-cells: Should be 2.  The first cell defines the interrupt number.
  The second cell bits[3:0] is used to specify trigger type as follows:
    1 = low-to-high edge triggered
    2 = high-to-low edge triggered
    4 = active high level-sensitive
    8 = active low level-sensitive
  Valid combinations are 1, 2, 3, 4, 8.
- ngpios: Specifies the number of GPIO lines.
- gpio-ranges: Mapping to pin controller pins (as described in gpio.txt)
- socionext,interrupt-ranges: Specifies an interrupt number mapping between
  this GPIO controller and its interrupt parent, in the form of arbitrary
  number of <child-interrupt-base parent-interrupt-base length> triplets.

Optional properties:
- gpio-ranges-group-names: Used for named gpio ranges (as described in gpio.txt)

Example:
	gpio: gpio@55000000 {
		compatible = "socionext,uniphier-gpio";
		reg = <0x55000000 0x200>;
		interrupt-parent = <&aidet>;
		interrupt-controller;
		#interrupt-cells = <2>;
		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&pinctrl 0 0 0>;
		gpio-ranges-group-names = "gpio_range";
		ngpios = <248>;
		socionext,interrupt-ranges = <0 48 16>, <16 154 5>, <21 217 3>;
	};

Consumer Example:

	sdhci0_pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio UNIPHIER_GPIO_PORT(29, 4) GPIO_ACTIVE_LOW>;
	};

Please note UNIPHIER_GPIO_PORT(29, 4) represents PORT294 in the SoC document.
Unfortunately, only the one's place is octal in the port numbering.  (That is,
PORT 8, 9, 18, 19, 28, 29, ... are missing.)  UNIPHIER_GPIO_PORT() is a helper
macro to calculate 29 * 8 + 4.
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ Required Properties:
    - "renesas,gpio-r8a7794": for R8A7794 (R-Car E2) compatible GPIO controller.
    - "renesas,gpio-r8a7795": for R8A7795 (R-Car H3) compatible GPIO controller.
    - "renesas,gpio-r8a7796": for R8A7796 (R-Car M3-W) compatible GPIO controller.
    - "renesas,gpio-r8a77970": for R8A77970 (R-Car V3M) compatible GPIO controller.
    - "renesas,gpio-r8a77995": for R8A77995 (R-Car D3) compatible GPIO controller.
    - "renesas,rcar-gen1-gpio": for a generic R-Car Gen1 GPIO controller.
    - "renesas,rcar-gen2-gpio": for a generic R-Car Gen2 or RZ/G1 GPIO controller.
    - "renesas,rcar-gen3-gpio": for a generic R-Car Gen3 GPIO controller.
Loading