linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [RFC] GPIO-Watchdog in devicetree
Date: Tue, 23 Sep 2008 09:02:56 -0600	[thread overview]
Message-ID: <20080923150256.GC13593@secretlab.ca> (raw)
In-Reply-To: <20080922194357.GA32041@pengutronix.de>

On Mon, Sep 22, 2008 at 09:43:57PM +0200, Wolfram Sang wrote:
> Hello all,
> 
> I understood that the device-tree is for describing hardware and should
> not contain driver specific information. I have problems drawing this
> line right now. I made a driver for watchdogs which are pinged by
> toggling a gpio. Currently the device-tree entry looks like this:
> 
> 	watchdog@gpio {
> 		compatible = "gpio-watchdog";
> 		gpios =	<&gpio_simple 19 0>;
> 	};
> 
> Then, there are two module parameters. One to define the initial state of
> the gpio (0 or 1), one to define the length of the pulse when serving
> the watchdog (default 1 us). Now my question is:
> 
> Is it plausible to say that the module parameters would also fit to the
> device-tree as properties? Recently, I tend to say so as otherwise the
> description of the watchdog is incomplete. Then again, one might argue
> to develop a specific watchdog driver instead of a generic one, and use
> something like compatible = "<myvendor>, <mywatchdog>" which would
> result in lots of duplicated code per watchdog. So, which way to go? I
> am really undecided and would be happy to hear opinions.

Since this is *very* board specific and there are a lot of parameters
that come into play that affect how the GPIO should be twiddled, I'd
consider leaving it out of the device tree entirely and coding it in the
platform code for your board (arch/powerpc/platforms/*/*).  Or, if you
still want to describe the gpio pin used the device tree, then add a
property to the base of the device tree that only your board platform
code looks at.

For example:
/ {
	model = "pengutronix,super-sexy-board";
	#address-cells = <1>;
	#size-cells = <1>;
	super-sexy-board,watchdog-gpio = <&gpio_simple 19 0>;
	...
}

Decoding a GPIO from the tree is quite simple so this should not result
in great swaths of duplicated code.

g.

  reply	other threads:[~2008-09-23 15:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22 19:43 [RFC] GPIO-Watchdog in devicetree Wolfram Sang
2008-09-23 15:02 ` Grant Likely [this message]
2008-09-25 17:59   ` Scott Wood
2008-09-25 18:10     ` Grant Likely
2008-09-25 18:21       ` Scott Wood
2008-09-26  1:15         ` David Gibson
2008-09-26  1:15 ` David Gibson

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=20080923150256.GC13593@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=w.sang@pengutronix.de \
    /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).