From: Sascha Hauer <s.hauer@pengutronix.de>
To: Javier Martinez Canillas <martinez.javier@gmail.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devicetree-discuss@lists.ozlabs.org,
Enric Balletbo i Serra <eballetbo@gmail.com>,
linux-omap@vger.kernel.org,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFC 1/7] platform: add a device node
Date: Mon, 11 Feb 2013 12:24:59 +0100 [thread overview]
Message-ID: <20130211112459.GA1906@pengutronix.de> (raw)
In-Reply-To: <CAAwP0s0_HivRRDuBAEi4TJMB6DnbicDy1FiT7G3NcNs996V7qA@mail.gmail.com>
On Mon, Feb 11, 2013 at 11:33:19AM +0100, Javier Martinez Canillas wrote:
> On Mon, Feb 11, 2013 at 9:16 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Sun, Feb 10, 2013 at 12:35:43PM +0100, Javier Martinez Canillas wrote:
> >> On Sun, Feb 10, 2013 at 10:37 AM, Russell King - ARM Linux
> >> <linux@arm.linux.org.uk> wrote:
> >> > On Sun, Feb 10, 2013 at 02:49:21AM +0100, Javier Martinez Canillas wrote:
> >> >> I knew this would be controversial and that's why I didn't mean it to be a patch
> >> >> but a RFC :)
> >> >>
> >> >> The problem basically is that you have to associate the platform device with its
> >> >> corresponding DT device node because it can be used in the driver probe function.
> >> >
> >> > When DT is being used, doesn't DT create the platform devices for you,
> >> > with the device node already set correctly?
> >> >
> >>
> >> Well they usually do but not always just like usually you have a
> >> platform_device in your board code and call platform_device_register().
> >>
> >> But in some configurations you can't just define the platform_device
> >> required resources (I/O memory, IRQ, etc) as static platform data.
> >> In some cases you need a level of indirection.
> >>
> >> In this particular case a SMSC ethernet chip is connected to an
> >> OMAP3 processor through its General-Purpose Memory Controller.
> >>
> >> You can't just define the I/O memory used by the device since you first
> >> need to request that address to the GPMC. The same happens with the
> >> IRQ line since a OMAP GPIO pin is used so you have to first configure
> >> the GPIO line as input.
> >
> > For the gpio interrupt you can use, example taken from omap4-var-som.dts:
> >
> > interrupt-parent = <&gpio6>;
> > interrupts = <11>; /* gpio line 171 */
> >
> > Other architectures allow to specify the edge/level hi/low active
> > parameters from the devicetree aswell. The gpio direction should be
> > handled by the gpio driver as necessary, at least that's what done on
> > other architectures.
> >
> > If the SMSC hangs on the GPMC then the SMSC should be a child node of
> > the GPMC. The GPMC would then act as a bus driver and configure the
> > chipselects and timings for its children automatically, maybe based
> > on timing information from the devicetree. I've never tried this before,
> > but I think that's the way things should be.
> >
>
> Hi Sasha,
>
> The SMSC is already a child node of the GPMC in the device tree but instead
> using the generic SMSC binding I added a GPMC-specific SMSC binding.
>
> Since the SMSC binding doesn't have a chip select property and it expects
> the I/O memory address to be explicitly defined in the reg property while
> the GPMC needs to request this memory according to the chip select used.
So you probably have this:
gpmc {
compatible = "ti,gpmc", "simple-bus";
ranges;
smsc911x {
compatible = "smsc,91x";
}
}
If you remove the simple-bus property the gpmc devices would not be
probed. If then you add a driver which matches "ti,gpmc" you can
configure the chip selects in its probe callback. After this you
can call of_platform_populate() starting from the gpmc device node
to instantiate the gpmc child devices.
Please somebody interrupt me if I'm talking total rubbish here. I never
tried this and only assume it should work like this.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-02-11 11:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-09 20:44 [PATCH RFC 0/7] ARM: OMAP: add DT binding for gpmc-smsc911x Javier Martinez Canillas
2013-02-09 20:44 ` [PATCH RFC 1/7] platform: add a device node Javier Martinez Canillas
2013-02-10 1:02 ` Greg Kroah-Hartman
2013-02-10 1:49 ` Javier Martinez Canillas
2013-02-10 9:37 ` Russell King - ARM Linux
2013-02-10 11:35 ` Javier Martinez Canillas
2013-02-11 8:16 ` Sascha Hauer
2013-02-11 10:33 ` Javier Martinez Canillas
2013-02-11 11:24 ` Sascha Hauer [this message]
2013-02-11 11:38 ` Javier Martinez Canillas
2013-02-18 13:51 ` Grant Likely
2013-02-18 13:56 ` Javier Martinez Canillas
2013-02-18 13:33 ` Grant Likely
2013-02-09 20:44 ` [PATCH RFC 2/7] net: smsc911x: add pinctrl support Javier Martinez Canillas
2013-02-11 14:23 ` Linus Walleij
2013-02-11 14:29 ` Javier Martinez Canillas
2013-02-09 20:44 ` [PATCH RFC 3/7] ARM: OMAP: gpmc-smsc911x: add DT dev node init function Javier Martinez Canillas
2013-02-11 10:30 ` Mark Rutland
2013-02-11 10:40 ` Javier Martinez Canillas
2013-02-09 20:44 ` [PATCH RFC 4/7] ARM: OMAP: gpmc-smsc911x: pass a dev node to platform registration Javier Martinez Canillas
2013-02-09 20:44 ` [PATCH RFC 5/7] ARM: OMAP: gpmc: add support for gpmc-smsc911x child nodes Javier Martinez Canillas
2013-02-09 20:44 ` [PATCH RFC 6/7] ARM: dts: OMAP: Add an GPMC node for OMAP3 Javier Martinez Canillas
2013-02-09 20:44 ` [PATCH RFC 7/7] ARM: dts: omap3-igep0020: Add SMSC911x LAN chip support Javier Martinez Canillas
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=20130211112459.GA1906@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=eballetbo@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=javier.martinez@collabora.co.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=martinez.javier@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).