linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Lamparter <chunkeey@gmail.com>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	"thierry.reding@gmail.com" <thierry.reding@gmail.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] Add a GPIO driver for Altera FPGA Manager Fabric I/O
Date: Sat, 30 Sep 2017 18:02:51 +0200	[thread overview]
Message-ID: <100458277.LJ9hcby5He@debian64> (raw)
In-Reply-To: <8da7f1f2-7934-0b88-6eb1-8cdce8d5a7ea@hotmail.de>

Hello,

On Saturday, September 30, 2017 1:15:38 PM CEST Bernd Edlinger wrote:
> Absolutely it looks and feels like a general-purpose I/O facility.
> It can be used to control arbitrary logic functions.
Hm, Is it possible to differenciate it from a "syscon" device?

"System controller node represents a register region containing a set
of miscellaneous registers. The registers are not cohesive enough to
represent as any specific type of device. The typical use-case is for
some other node's driver, or platform-specific code, to acquire a
reference to the syscon node (e.g. by phandle, node path, or search
using a specific compatible value), interrogate the node (or associated
OS driver) to determine the location of the registers, and access the
registers directly."

<http://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/mfd/syscon.txt>

> >> Instantiate this in the device tree as:
> >>
> >>     gpio3: gpio@ff706010 {
> >>      #address-cells = <1>;
> >>      #size-cells = <0>;
> >>      compatible = "altr,fpgamgr-gpio";
> >>      reg = <0xff706010 0x8>;
> >>      status = "okay";
> >>
> >>      portd: gpio-controller@0 {
> >>       compatible = "altr,fpgamgr-gpio-output";
> >>       gpio-controller;
> >>       #gpio-cells = <2>;
> >>       reg = <0>;
> >>      };
> >>
> >>      porte: gpio-controller@1 {
> >>       compatible = "altr,fpgamgr-gpio-input";
> >>       gpio-controller;
> >>       #gpio-cells = <2>;
> >>       reg = <1>;
> >>      };
> > 
> > So one port is output-only and one is input-only?
> > 
> > Fair enough.

The driver seemd fairly simple. So, You could actually get
away with just adding the "altr,fpgamgr-gpio" compatible string
to gpio-mmio.c's bgpio_of_match struct at [0] and change the dt
to something like this:

	portd: gpio@ff706010 {
		compatible = "altr,fpgamgr-gpio";
		reg = <0xff706010 0x4>;
		reg-names = "dat";
		gpio-controller;
		#gpio-cells = <2>;
   }

   	porte: gpio@ff706014 {
		compatible = "altr,fpgamgr-gpio";
		reg = <0xff706014 0x4>;
		reg-names = "dat";
		gpio-controller;
		#gpio-cells = <2>;
		no-output;
   }

I added "no-output" property to the "porte" gpio definition.
This property will force the direction of all of porte gpios
to "in". (Which based on the "input", is what you want?)

Note: If you need any insperation for the missing Device-tree
binding document, you can look at:

wd,mbl-gpio.txt [1] and ni,169445-nand-gpio.txt [2].

Regards,
Christian

[0] <https://github.com/torvalds/linux/blob/master/drivers/gpio/gpio-mmio.c#L575>
[1] <https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/gpio/wd%2Cmbl-gpio.txt
[2] <https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/gpio/ni%2C169445-nand-gpio.txt>



  reply	other threads:[~2017-09-30 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 18:41 [PATCH] Add a GPIO driver for Altera FPGA Manager Fabric I/O Bernd Edlinger
2017-09-27  0:20 ` Linus Walleij
2017-09-30 13:15   ` Bernd Edlinger
2017-09-30 16:02     ` Christian Lamparter [this message]
2017-10-07 10:39     ` Linus Walleij
2017-10-07 17:39       ` [PATCHv2] " Bernd Edlinger
2017-10-07 23:37         ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=100458277.LJ9hcby5He@debian64 \
    --to=chunkeey@gmail.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).