Skip to contentSkip to conversation

dt-bindings: gpio: altera-fpga-mgr: Add Altera FPGA manager GPIO bindings

PATCH In review Marek Vasut 3 participants 8 messages Oct 11, 2018 – Oct 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: gpio: altera-fpga-mgr: Add Altera FPGA manager GPIO bindings

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>
---
 .../bindings/gpio/gpio-altera-fpga-mgr.txt    | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt
Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +24 -0
new file mode 100644
index 000000000000..74a996a6b72f
@@ -0,0 +1,24 @@
+Altera SoCFPGA FPGA manager GPIO controller.
+
+The Altera SoCFPGA fpgamgr block has a GPIO controller as a part of it.
+The controller has two sets of pins, 32 GPIs and 32 GPOs.
+
+Required properties:
+- compatible: Should contain "altr,fpga-mgr-gpio".
+- 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 the gpio polarity:
+    0 = Active high,
+    1 = Active low.
+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.
+
+Example:
+
+	fpgamgr_gpio: gpio@ff706010 {
+		compatible = "altr,fpga-mgr-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+		gpio,syscon-dev = <&fpgamgr0 0x10>;
+	};
Signature · 1 line
2.18.0
#1 lore raw

Hi Marek,

thanks for the patch!

Quoted 8 lines · Marek Vasut

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Yours,
Linus Walleij

#2 lore raw
Quoted 1 line · Linus Walleij

Hi Marek,

Hi!

Quoted 1 line

thanks for the patch!

thanks for the feedback!

Quoted 27 lines · Marek Vasut
Quoted 9 lines

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

Quoted 7 lines

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Isn't it better to just have one compatible string for all SoCFPGAs and handle the possible difference in offset where the registers are in DT? It's the same as "reg" property which we use to describe where a certain block is in the address space.

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Linus Walleij
Quoted 8 lines · Marek Vasut

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

Quoted 8 lines
Quoted 3 lines

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Isn't it better to just have one compatible string for all SoCFPGAs and handle the possible difference in offset where the registers are in DT? It's the same as "reg" property which we use to describe where a certain block is in the address space.

You have a point.

What about:

syscon = <&fpgamgr0>;
reg = <0x10>;
?

You can just parse out "reg" in the driver.

I mean reg is intuitively for that, so...

Yours,
Linus Walleij

#4 lore raw
Quoted 46 lines · Linus Walleij
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Linus Walleij
Quoted 8 lines · Marek Vasut

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

Quoted 8 lines
Quoted 3 lines

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Isn't it better to just have one compatible string for all SoCFPGAs and handle the possible difference in offset where the registers are in DT? It's the same as "reg" property which we use to describe where a certain block is in the address space.

You have a point.

What about:

Quoted 7 lines

syscon = <&fpgamgr0>;
reg = <0x10>;
?

You can just parse out "reg" in the driver.

I mean reg is intuitively for that, so...

But drivers/gpio/gpio-syscon.c already parses the gpio,syscon-dev binding, including the register offset. Why reinvent a new one if there already is one which fits perfectly ? :)

Signature · 2 lines
Best regards,
Marek Vasut
maintainer
#5 lore raw
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Linus Walleij
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Linus Walleij
Quoted 8 lines · Marek Vasut

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

Quoted 8 lines
Quoted 3 lines

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Isn't it better to just have one compatible string for all SoCFPGAs and handle the possible difference in offset where the registers are in DT? It's the same as "reg" property which we use to describe where a certain block is in the address space.

You have a point.

What about:

syscon = <&fpgamgr0>;
reg = <0x10>;
?

Quoted 7 lines
Quoted 3 lines

You can just parse out "reg" in the driver.

I mean reg is intuitively for that, so...

But drivers/gpio/gpio-syscon.c already parses the gpio,syscon-dev binding, including the register offset. Why reinvent a new one if there already is one which fits perfectly ? :)

Maybe so, but it is undocumented. And if you look at the Rockchip addition to the driver, it was done a different way.

Can't this be a child of the fpgamgr?

Rob

maintainer
#7 lore raw
In reply to Marek Vasut
Quoted 62 lines · Marek Vasut
Quoted 60 lines · Rob Herring
Quoted 58 lines · Marek Vasut
Quoted 46 lines · Linus Walleij
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Linus Walleij
Quoted 8 lines · Marek Vasut

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

(quoted diff) +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

Quoted 8 lines
Quoted 3 lines

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Isn't it better to just have one compatible string for all SoCFPGAs and handle the possible difference in offset where the registers are in DT? It's the same as "reg" property which we use to describe where a certain block is in the address space.

You have a point.

What about:

Quoted 7 lines

syscon = <&fpgamgr0>;
reg = <0x10>;
?

You can just parse out "reg" in the driver.

I mean reg is intuitively for that, so...

But drivers/gpio/gpio-syscon.c already parses the gpio,syscon-dev binding, including the register offset. Why reinvent a new one if there already is one which fits perfectly ? :)

Quoted 7 lines
Quoted 4 lines

Maybe so, but it is undocumented. And if you look at the Rockchip addition to the driver, it was done a different way.

Can't this be a child of the fpgamgr?

We can, but won't it be easier to just reuse a binding which is already used by multiple compatibles ?

The gpio-syscon driver will lookup by compatible (of the syscon), phandle (gpio,syscon-dev) or parent device. So I don't see any difference in reuse. Unless there is some compelling reason to put this node elsewhere, the most logical spot for a sub-function is under its parent.

Rob

#6 lore raw
In reply to Rob Herring
Quoted 56 lines · Rob Herring
Quoted 55 lines · Marek Vasut
Quoted 53 lines · Linus Walleij
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Linus Walleij
Quoted 8 lines · Marek Vasut

Add DT bindings for the GPI / GPO block in the Altera SoCFPGA FPGA manager. The GPIO block in the FPGA manager has two 32bit registers, one for setting 32 GPOs and another one for reading 32 GPIs, both of which can be mapped to separate physical pads.

Cc Rob Herring <[email protected]>
Cc Linus Walleij <[email protected]>

(...)

Quoted 3 lines

+- gpio,syscon-dev: phandle/offset pair. The phandle to syscon used to

Documentation/devicetree/bindings/gpio/gpio-altera-fpga-mgr.txt new file +2 -0
+  access device state control registers and the offset of device's specific
+  registers within device state control registers range.

(...)

Quoted 1 line

+ gpio,syscon-dev = <&fpgamgr0 0x10>;

I didn't see that before.

It is usually not a good idea to encode register offsets into the device tree.

I think the register offset should be in the driver and determined from the compatible-string. If that is not possible, the compatible strings do not really indicate compatibility, if you see what I mean.

As for the name of the variable, why not just use:

syscon = <&fpgamgr0>;

Quoted 8 lines
Quoted 3 lines

It seems simple enough without any gpio,* prefix or explicitly suffixing it with a "-dev" - every node in the device tree is a device by definition so skip that.

Isn't it better to just have one compatible string for all SoCFPGAs and handle the possible difference in offset where the registers are in DT? It's the same as "reg" property which we use to describe where a certain block is in the address space.

You have a point.

What about:

syscon = <&fpgamgr0>;
reg = <0x10>;
?

You can just parse out "reg" in the driver.

I mean reg is intuitively for that, so...

Quoted 8 lines
Quoted 3 lines

But drivers/gpio/gpio-syscon.c already parses the gpio,syscon-dev binding, including the register offset. Why reinvent a new one if there already is one which fits perfectly ? :)

Maybe so, but it is undocumented. And if you look at the Rockchip addition to the driver, it was done a different way.

Can't this be a child of the fpgamgr?

We can, but won't it be easier to just reuse a binding which is already used by multiple compatibles ?

Signature · 2 lines
Best regards,
Marek Vasut