How to add platform specific data to a of_device

Benjamin Herrenschmidt benh at kernel.crashing.org
Sun Jul 15 06:48:53 EST 2007


On Sat, 2007-07-14 at 18:31 +0200, Juergen Beisert wrote:
> 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)?

Your approach would work I suppose.... though it's a bit ugly. I've long
considered removing platform_data from struct device, and make it part
strictly of platform device...

I'm not sure what you actually need here... if it's to know what your
child devices are, you can always walk the device-tree, though for most
things, it would be the child devices themslves who would call into your
SPI driver with whatever identification they retreived from there.

Ben.





More information about the Linuxppc-dev mailing list