mips: gpio: mscc_sgpio: Add DT bindings documentation
PATCH 1/1 mips: gpio: mscc_sgpio: Add DT bindings documentation
Hello device tree!
I am submitting this device tree driver binding documentation for review comments.
The driver is currently implemented on u-boot, but will also eventually be upstreamed to Linux.
By using a serial interface, the MSCC SIO controller significantly extends the number of available GPIOs with a minimum number of additional pins on the device. The primary purpose of the SIO controller is to connect control signals from SFP modules and to act as an LED controller.
This add device tree binding documentation for the MSCC serial GPIO driver.
--- doc/device-tree-bindings/gpio/mscc_sgpio.txt | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 doc/device-tree-bindings/gpio/mscc_sgpio.txt
doc/device-tree-bindings/gpio/mscc_sgpio.txt new file +39 -0
@@ -0,0 +1,39 @@ +MSCC Serial GPIO driver + +Required properties: +- compatible : "mscc,luton-sgpio" or "mscc,ocelot-sgpio" +- clock: Reference clock used to generate clock divider setting. See + mscc,sgpio-frequency property. +- reg : Physical base address and length of the controller's registers. +- #gpio-cells : Should be two. The first cell is the pin number and the + second cell is used to specify optional parameters: + - bit 0 specifies polarity (0 for normal, 1 for inverted) +- gpio-controller : Marks the device node as a GPIO controller. +- gpio-ranges: The 4th cell will typically be 32*<sgpio-bitcount> + +Optional properties: +- mscc,sgpio-frequency: The frequency at which the serial bitstream is + generated and sampled. Default: 12500000 (Hz). +- mscc,sgpio-bitcount: The number of bits enabled per + port. (1-4). Default: 2. +- mscc,sgpio-ports: A bitmask (32 bits) of which ports are enabled in + the serialized gpio stream. Default: 0xFFFFFFFF. + +Typically the pinctrl-0 and pinctrl-names properties will also be +present to enable the use of the SIO CLK, LD, DI and DO for some +regular GPIO pins. + +Example: + +sgpio: gpio@10700f8 { + compatible = "mscc,ocelot-sgpio"; + pinctrl-0 = <&sgpio_pins>; + pinctrl-names = "default"; + reg = <0x10700f8 0x100>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&sgpio 0 0 64>; // 32*<sgpio-bitcount> + mscc,sgpio-frequency = <12500>; + mscc,sgpio-bitcount = <2>; + mscc,sgpio-ports = <0x000FFFFF>; +};
Signature · 1 line
2.19.1
Hi Lars,
thanks for your patch!
Quoted 1 line · Lars Povlsen
+MSCC Serial GPIO driver
Expand the acronym please, if IIUC this is
"Microsemi Corporation (MSCC) Serial GPIO driver"
Quoted 2 lines
+- mscc,sgpio-frequency: The frequency at which the serial bitstream is + generated and sampled. Default: 12500000 (Hz).
Uhm what is a serial bitstream in this context, I am lost. Please elaborate.
Quoted 2 lines
+- mscc,sgpio-bitcount: The number of bits enabled per + port. (1-4). Default: 2.
Can't you just use the standard "ngpios" property for this? See Documentation/devicetree/bindings/gpio/gpio.txt
Why is this a global setting for all ports and not per-port?
Quoted 2 lines
+- mscc,sgpio-ports: A bitmask (32 bits) of which ports are enabled in + the serialized gpio stream. Default: 0xFFFFFFFF.
I don't understand this either. Are there up to 32 ports? (Also referred to as "banks") with 1-4 GPIOs each?
Yours,
Linus Walleij
Quoted 9 lines · Linus Walleij
Hi Lars,
thanks for your patch!
Quoted 1 line · Lars Povlsen
+MSCC Serial GPIO driver
Quoted 8 lines
Expand the acronym please, if IIUC this is
"Microsemi Corporation (MSCC) Serial GPIO driver"Quoted 2 lines
+- mscc,sgpio-frequency: The frequency at which the serial bitstream is + generated and sampled. Default: 12500000 (Hz).Uhm what is a serial bitstream in this context, I am lost. Please elaborate.
Is this SGPIO as in this[1]? If so, then I don't think using the GPIO binding is appropriate here. SGPIO is pretty fixed use. There is a bitbanged SGPIO implementation in the Calxeda SATA driver BTW.
Rob
Hi Rob!
Sorry about the delay in response, the mail got lost in the sheer volume of the devicetree list.
I appreciate your response, see below.
---Lars
Quoted 27 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Friday, December 7, 2018 14:54
To: Linus Walleij <[email protected]>; Lars Povlsen - M31675 <[email protected]>
Cc: [email protected]; Gregory CLEMENT <[email protected]>
Subject: Re: [PATCH] mips: gpio:mscc_sgpio: Add DT bindings documentationQuoted 6 lines · Linus Walleij
Hi Lars,
thanks for your patch!
On Mon, Nov 26, 2018 at 1:22 PM Lars Povlsen
Quoted 7 lines · <[email protected]> wrote:
Quoted 2 lines
+MSCC Serial GPIO driver
Expand the acronym please, if IIUC this is
"Microsemi Corporation (MSCC) Serial GPIO driver"Quoted 1 line
+- mscc,sgpio-frequency: The frequency at which the serial bitstream
is
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
+ generated and sampled. Default: 12500000 (Hz).
Uhm what is a serial bitstream in this context, I am lost. Please elaborate.
Is this SGPIO as in this[1]? If so, then I don't think using the GPIO binding is appropriate here. SGPIO is pretty fixed use. There is a bitbanged SGPIO implementation in the Calxeda SATA driver BTW.
I was not aware of this [1] interface for HDD attachment. There is some similarity in the electrical interface, but this device is specifically for extending GPIO capacity on a SOC which is pin-limited. So I insist that the GPIO binding is highly appropriate here.
Quoted 3 lines
Rob
PATCH v2 1/1 mips: gpio: mscc_sgpio: Add DT bindings documentation
In reply to Lars Povlsen mips: mscc_sgpio: Add DT bindings documentation
This add device tree binding documentation for the MSCC serial GPIO driver.
v2 changes:
- Added more device background info
- Dropped "mscc,sgpio-bitcount" in favour of "ngpios" and "gpio-ranges".
- Elaborated "mscc,sgpio-ports" explanation
doc/device-tree-bindings/gpio/mscc_sgpio.txt new file +45 -0
@@ -0,0 +1,45 @@ +Microsemi Corporation (MSCC) Serial GPIO driver + +The MSCC serial GPIO extends the number or GPIO's on the system by +means of 4 dedicated pins: one input, one output, one clock and one +strobe pin. By attaching a number of (external) shift registers, the +effective GPIO count can be extended by up to 128 GPIO's per +controller. + +Required properties: +- compatible : "mscc,luton-sgpio" or "mscc,ocelot-sgpio" +- clock: Reference clock used to generate clock divider setting. See + mscc,sgpio-frequency property. +- reg : Physical base address and length of the controller's registers. +- #gpio-cells : Should be two. The first cell is the pin number and the + second cell is used to specify optional parameters: + - bit 0 specifies polarity (0 for normal, 1 for inverted) +- gpio-controller : Marks the device node as a GPIO controller. +- gpio-ranges: Standard gpio range(s): phandle, gpio base, pinctrl base + and count. + +Optional properties: +- ngpios: Set the number of GPIO's actually used. +- mscc,sgpio-frequency: The frequency at which the serial bitstream is + generated and sampled. Default: 12500000 (Hz). +- mscc,sgpio-ports: A bitmask (32 bits) of which ports are enabled in + the serialized gpio stream. One 'port' will transport from 1 to 4 + gpio bits. Default: 0xFFFFFFFF. + +Typically the pinctrl-0 and pinctrl-names properties will also be +present to enable the use of the SIO CLK, LD, DI and DO for some +regular GPIO pins. + +Example: + +sgpio: gpio@10700f8 { + compatible = "mscc,ocelot-sgpio"; + pinctrl-0 = <&sgpio_pins>; + pinctrl-names = "default"; + reg = <0x10700f8 0x100>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&sgpio 0 0 64>; + mscc,sgpio-frequency = <12500>; + mscc,sgpio-ports = <0x000FFFFF>; +};
Quoted 5 lines · Lars Povlsen
mips:
mscc_sgpio: Add DT bindings documentationThis add device tree binding documentation for the MSCC serial GPIO driver.
Quoted 7 lines
v2 changes:
- Added more device background info
- Dropped "mscc,sgpio-bitcount" in favour of "ngpios" and "gpio-ranges".
- Elaborated "mscc,sgpio-ports" explanationSigned-off-by Lars Povlsen <[email protected]>
Overall looks good to me!
Quoted 2 lines
+Optional properties:
+- ngpios: Set the number of GPIO's actually used.
Just say see: gpio.txt
Yours,
Linus Walleij
Hi Linus!
Thank you for your input, I will refer to gpio.txt in the next version.
Cheers,
---Lars
Quoted 37 lines
-----Original Message-----
From: Linus Walleij <[email protected]>
Sent: Sunday, December 30, 2018 21:00
To: Lars Povlsen - M31675 <[email protected]>
Cc: Device Tree <[email protected]>; Gregory Clement <[email protected]>; Rob Herring <[email protected]>
Subject: Re: [PATCH v2] mips: gpio:mscc_sgpio: Add DT bindings documentationQuoted 3 lines · Lars Povlsen
mips:
mscc_sgpio: Add DT bindings documentationThis add device tree binding documentation for the MSCC serial
GPIO
Quoted 5 lines
driver.
v2 changes:
- Added more device background info
- Dropped "mscc,sgpio-bitcount" in favour of "ngpios" and "gpio-ranges".
Quoted 4 lines
- Elaborated "mscc,sgpio-ports" explanation
Signed-off-by Lars Povlsen <[email protected]>Overall looks good to me!
Acked-by Linus Walleij <[email protected]>Quoted 2 lines
+Optional properties:
+- ngpios: Set the number of GPIO's actually used.Just say see: gpio.txt
Yours,
Linus Walleij