linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* How to add platform specific data to a of_device
@ 2007-07-14 16:31 Juergen Beisert
  2007-07-14 20:48 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 13+ messages in thread
From: Juergen Beisert @ 2007-07-14 16:31 UTC (permalink / raw)
  To: linuxppc-dev

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-07-16 16:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 16:31 How to add platform specific data to a of_device Juergen Beisert
2007-07-14 20:48 ` 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

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).