Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: Document common property for daisy-chained devices

Many serially-attached GPIO and IIO devices are daisy-chainable.

Examples for GPIO devices are Maxim MAX3191x and TI SN65HVS88x:
https://datasheets.maximintegrated.com/en/ds/MAX31913.pdf
http://www.ti.com/lit/ds/symlink/sn65hvs880.pdf

Examples for IIO devices are TI DAC128S085 and TI DAC161S055:
http://www.ti.com/lit/ds/symlink/dac128s085.pdf
http://www.ti.com/lit/ds/symlink/dac161s055.pdf

We already have drivers for daisy-chainable devices in the tree but
their devicetree bindings are somewhat inconsistent and ill-named:

The gpio-74x164.c driver uses "registers-number" to convey the
number of devices in the daisy-chain. (Sans vendor prefix,
multiple vendors sell compatible versions of this chip.)

The gpio-pisosr.c driver takes a different approach and calculates
the number of devices in the daisy-chain by dividing the common
"ngpios" property (Documentation/devicetree/bindings/gpio/gpio.txt)
by 8 (which assumes that each chip has 8 inputs).

Let's standardize on a common "#daisy-chained-devices" property.
That name was chosen because it's the term most frequently used in
datasheets. (A less frequently used synonym is "cascaded devices".)

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Lukas Wunner and committed by
Linus Walleij
1f63fab9 5048f0ae

+26
+26
Documentation/devicetree/bindings/common-properties.txt
··· 1 1 Common properties 2 + ================= 3 + 4 + Endianness 5 + ---------- 2 6 3 7 The Devicetree Specification does not define any properties related to hardware 4 8 byteswapping, but endianness issues show up frequently in porting Linux to ··· 61 57 reg = <0x40031000 0x1000>; 62 58 ... 63 59 little-endian; 60 + }; 61 + 62 + Daisy-chained devices 63 + --------------------- 64 + 65 + Many serially-attached GPIO and IIO devices are daisy-chainable. To the 66 + host controller, a daisy-chain appears as a single device, but the number 67 + of inputs and outputs it provides is the sum of inputs and outputs provided 68 + by all of its devices. The driver needs to know how many devices the 69 + daisy-chain comprises to determine the amount of data exchanged, how many 70 + inputs and outputs to register and so on. 71 + 72 + Optional properties: 73 + - #daisy-chained-devices: Number of devices in the daisy-chain (default is 1). 74 + 75 + Example: 76 + gpio@0 { 77 + compatible = "name"; 78 + reg = <0>; 79 + gpio-controller; 80 + #gpio-cells = <2>; 81 + #daisy-chained-devices = <3>; 64 82 };