Re: [PATCH v2 1/5] dt-bindings: Add compatible string opencores,gpio to gpio-mmio
Stafford Horne <[email protected]>
| Newsgroups | org.kernel.vger.linux-openrisc,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aV9o1LL0Ahip0O3-@antec> |
On Wed, Jan 07, 2026 at 03:35:45PM +0100, Geert Uytterhoeven wrote: > Hi Stafford, > > On Wed, 17 Dec 2025 at 09:15, Stafford Horne <[email protected]> wrote: > > In FPGA Development boards with GPIOs we use the opencores gpio verilog > > rtl. This is compatible with the gpio-mmio. Add the compatible string > > to allow as below. > > > > Example: > > > > gpio0: gpio@91000000 { > > compatible = "opencores,gpio", "brcm,bcm6345-gpio"; > > reg = <0x91000000 0x1>, <0x91000001 0x1>; > > reg-names = "dat", "dirout"; > > gpio-controller; > > #gpio-cells = <2>; > > status = "okay"; > > }; > > > > Link: https://opencores.org/projects/gpio > > Signed-off-by: Stafford Horne <[email protected]> > > Thanks for your patch, which is now commit f48b5e8bc2e1344f > ("dt-bindings: gpio-mmio: Add compatible string for opencores,gpio") > in gpio/gpio/for-next. > > > --- a/Documentation/devicetree/bindings/gpio/gpio-mmio.yaml > > +++ b/Documentation/devicetree/bindings/gpio/gpio-mmio.yaml > > @@ -18,11 +18,16 @@ description: > > > > properties: > > compatible: > > - enum: > > - - brcm,bcm6345-gpio > > - - ni,169445-nand-gpio > > - - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller > > - - intel,ixp4xx-expansion-bus-mmio-gpio > > + oneOf: > > + - enum: > > + - brcm,bcm6345-gpio > > + - ni,169445-nand-gpio > > + - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller > > + - intel,ixp4xx-expansion-bus-mmio-gpio > > + - items: > > + - enum: > > + - opencores,gpio > > + - const: brcm,bcm6345-gpio > > What is the rationale behind using brcm,bcm6345-gpio? > Given brcm,bcm6345-gpio has 32-bit registers, while opencores,gpio > has 8-bit registers, I doubt the latter is compatible with the former... Hello, I was following what we did for uart, where we have "opencores,uart16550-rtlsvn105", "ns16550a". I am using brcm,bcm6345-gpio to match the drivers/gpio/gpio-mmio.c driver. The opencores,gpio is compatible with the same driver as brcm,bcm6345-gpio but not 100% the same as the brcm,bcm6345-gpio. Since the device tree allows configuring the gpio-mmio driver to make it compatible with opencore,gpio I thought this would be OK. I switch the size from 32-bit to 8-bit using the reg = <* 0x1>, <* 0x1> setting. Also the reg addresses of "dat" and "dirout" are different for the real brcm,bcm6345-gpio. brcm,bcm6345-gpio. Example: /* GPIOs 192 .. 223 */ gpio6: gpio@518 { compatible = "brcm,bcm6345-gpio"; reg = <0x518 0x04>, <0x538 0x04>; reg-names = "dirout", "dat"; gpio-controller; #gpio-cells = <2>; }; vs opencores,gpio Example: gpio0: gpio@91000000 { compatible = "opencores,gpio", "brcm,bcm6345-gpio"; reg = <0x91000000 0x1>, <0x91000001 0x1>; reg-names = "dat", "dirout"; gpio-controller; #gpio-cells = <2>; }; The opencores,gpio setup does work. Now that I think about it, would it have been better to just add opencores,gpio to gpio-mmio.c compatible list? If so I will can revise this patch and add patch to gpio-mmio.c. -Stafford