SPI devices and OF

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 6 05:11:45 EST 2007


On Thu, Apr 05, 2007 at 09:44:13AM -0500, Milton Miller wrote:
> 
> 
> ok, so what is the problem with the platform data?

Not a problem of programming technique but a problem of where to
actually get the information in the platform from. device tree or
board setup code?

> You kzalloc the
> data structure that the device needs, fill it in, and fill out
> the pointer in the auto _info variable that gets copied by
> register_new_device.

My point is that we have two possibilities to handle spi devices. a) We
put the information about all devices connected to a spi bus into the
device tree in which case we must also put the data described in the
platform_data (e.g. the mentioned page_size for at25 eeproms) into the
tree. b) would be to put only the spi masters into the tree (well they
already are).

It seems b) is the prefered way. If I understand Ben correctly I can
then put some proprietary tag into the tree to differentiate between
different spi controllers so that the board code knows which spi
controller is which. So my tree could look like:

spi at f00 {
	device_type = "spi";
	compatible = "mpc5200b-spi\0mpc5200-spi";
	reg = <f00 20>;
	interrupts = <2 d 0 2 e 0>;
	interrupt-parent = <500>;
	identifier = <0>;
}

spi at xxx {
	device_type = "spi";
	...
	identifier = <1>;
}

I can then use the board code to populate the spi devices depending on
the identifier. Perhaps there is a better name instead of 'identifier'?

Sascha




More information about the Linuxppc-dev mailing list