From: Juergen Beisert <jbe@pengutronix.de>
To: linuxppc-dev@ozlabs.org
Subject: How to add platform specific data to a of_device
Date: Sat, 14 Jul 2007 18:31:03 +0200 [thread overview]
Message-ID: <200707141831.04107.jbe@pengutronix.de> (raw)
Hi,
I'm trying to use the drivers/spi/mpc52xx_psc_spi.c as an open firmware device
(ARCH=powerpc). This device needs some platform specific data (the devices
connected to the SPI bus and how to drive the chipselects to these devices).
The driver itself get a "struct of_device *op" in his probe function and
does something like this:
struct fsl_spi_platform_data *pdata = op->dev.platform_data;
My question is: How is the correct way to bring the platform specific data
into this device structure? Is there a way to do it in the OFTree (dts file)?
Or in a way like this?
static struct fsl_spi_platform_data my_spi_master_info = {
[....]
}
static int __init my_platform_register_spi(void)
{
struct device_node *np = NULL;
struct of_device *of_dev;
if ((np = of_find_compatible_node(np, "spi", "mpc5200-psc-spi")) == NULL) {
printk("couldn't find of tree node\n");
return -1;
}
if ((of_dev = of_find_device_by_node(np)) == NULL) {
printk("couldn't find device by node\n");
return -1;
}
of_dev->dev.platform_data = &my_spi_master_info;
return 0;
}
Or is there any other way?
Regards
Juergen
next reply other threads:[~2007-07-14 16:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-14 16:31 Juergen Beisert [this message]
2007-07-14 20:48 ` How to add platform specific data to a of_device Benjamin Herrenschmidt
2007-07-15 8:33 ` Juergen Beisert
2007-07-15 8:57 ` Benjamin Herrenschmidt
2007-07-16 16:13 ` Segher Boessenkool
2007-07-16 6:51 ` Robert Schwebel
2007-07-16 7:09 ` Benjamin Herrenschmidt
2007-07-16 7:19 ` Robert Schwebel
2007-07-16 7:29 ` Benjamin Herrenschmidt
2007-07-16 16:47 ` Segher Boessenkool
2007-07-16 16:28 ` Segher Boessenkool
2007-07-16 7:40 ` Michael Ellerman
2007-07-16 16:16 ` Segher Boessenkool
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=200707141831.04107.jbe@pengutronix.de \
--to=jbe@pengutronix.de \
--cc=linuxppc-dev@ozlabs.org \
/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).