linux/drivers/of
Stephen Boyd bd6f2fd5a1 of: Support parsing phandle argument lists through a nexus node
Platforms like 96boards have a standardized connector/expansion
slot that exposes signals like GPIOs to expansion boards in an
SoC agnostic way. We'd like the DT overlays for the expansion
boards to be written once without knowledge of the SoC on the
other side of the connector. This avoids the unscalable
combinatorial explosion of a different DT overlay for each
expansion board and SoC pair.

We need a way to describe the GPIOs routed through the connector
in an SoC agnostic way. Let's introduce nexus property parsing
into the OF core to do this. This is largely based on the
interrupt nexus support we already have. This allows us to remap
a phandle list in a consumer node (e.g. reset-gpios) through a
connector in a generic way (e.g. via gpio-map). Do this in a
generic routine so that we can remap any sort of variable length
phandle list.

Taking GPIOs as an example, the connector would be a GPIO nexus,
supporting the remapping of a GPIO specifier space to multiple
GPIO providers on the SoC. DT would look as shown below, where
'soc_gpio1' and 'soc_gpio2' are inside the SoC, 'connector' is an
expansion port where boards can be plugged in, and
'expansion_device' is a device on the expansion board.

	soc {
		soc_gpio1: gpio-controller1 {
			#gpio-cells = <2>;
		};

		soc_gpio2: gpio-controller2 {
			#gpio-cells = <2>;
		};
	};

	connector: connector {
		#gpio-cells = <2>;
		gpio-map = <0 0 &soc_gpio1 1 0>,
			   <1 0 &soc_gpio2 4 0>,
			   <2 0 &soc_gpio1 3 0>,
			   <3 0 &soc_gpio2 2 0>;
		gpio-map-mask = <0xf 0x0>;
		gpio-map-pass-thru = <0x0 0x1>
	};

	expansion_device {
		reset-gpios = <&connector 2 GPIO_ACTIVE_LOW>;
	};

The GPIO core would use of_parse_phandle_with_args_map() instead
of of_parse_phandle_with_args() and arrive at the same type of
result, a phandle and argument list. The difference is that the
phandle and arguments will be remapped through the nexus node to
the underlying SoC GPIO controller node. In the example above,
we would remap 'reset-gpios' from <&connector 2 GPIO_ACTIVE_LOW>
to <&soc_gpio1 3 GPIO_ACTIVE_LOW>.

Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
2018-02-12 08:37:58 -06:00
..
unittest-data of: unittest: refactor Makefile 2018-01-08 22:08:46 -06:00
address.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
base.c of: Support parsing phandle argument lists through a nexus node 2018-02-12 08:37:58 -06:00
device.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
dynamic.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
fdt.c of/fdt: use memblock_virt_alloc for early alloc 2018-01-08 08:24:34 -06:00
irq.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
Kconfig pci-v4.16-changes 2018-02-06 09:59:40 -08:00
kobj.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
Makefile PCI: Move OF-related PCI functions into PCI core 2018-01-17 17:36:39 -06:00
of_mdio.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-11 22:13:42 -05:00
of_net.c of_net: factor out repetitive code from of_get_mac_address() 2015-03-29 08:56:17 +01:00
of_numa.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
of_private.h of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
of_reserved_mem.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
overlay.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
pdt.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
platform.c ARM: SoC driver updates for 4.16 2018-02-01 16:35:31 -08:00
property.c DeviceTree updates for 4.16: 2018-02-01 10:57:45 -08:00
resolver.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
unittest.c of/fdt: use memblock_virt_alloc for early alloc 2018-01-08 08:24:34 -06:00