How to define an I2C-to-SPI bridge device ?

Grant Likely grant.likely at
Fri Sep 10 04:23:14 EST 2010

"Andre Schwarz" < at> wrote:

>  Anton,
>> we're about to get new MPC8377 based hardware with various peripherals.
>>> There are two I2C-to-SPI bridge devices (NXP SC18IS602) and I'm not sure
>>> how to define a proper dts...
>>> Of course it's an easy thing creating 2 child nodes on the CPU's I2C
>>> device - but how can I represent the created SPI bus ?
>> Um.. the same as the other SPI buses? I.e.
>> i2c-controller {  /* SOC I2C controller */
>> 	spi-controller {  /* The I2C-to-SPI bridge */
>> 		spi-device at 0 {
>> 		};
>> 		spi-device at 1 {
>> 		};
>> 	};
>> };
>ok , thanks - looks straight forward.
>Is this any more than plain definition, i.e. will this trigger any I2C 
>or SPI device registration/linking ?
>>> Is the (possibly) required driver (of_sc18is60x_spi ?) supposed to be an
>>> I2C slave or an SPI host driver ?
>> It should be an I2C driver that registers an SPI master (i.e.
>> calls spi_alloc_master() and spi_register_master()).
>hmm - ok. Will have to do it manually then ...

Yes, but this is the case for non-of drivers too.  The i2c to spi device driver must always create (and trigger population of) the spi bus instance.

>I still wonder how to make the driver arch-generic *and* of-capable.
>Do we need a generic I2C slave driver that can be probed along with an 
>"of glue driver" or should the of-binding be part of a single device 
>driver ?

There is no longer any need for separate of and non-of drivers for the same hardware.  Any device may have the of_node pointer in struct device set, and drivers can use the pointer as an alternative to platform_data to get information about the hardware configuration.

Just read the data out of the node in the driver's probe hook.

For i2c and (soon) spi, the core code will even register child devices for you.


>Sorry for the dumb questions - looks like I expected a little too much 
>functionality already existing.
>MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
>Registergericht: Amtsgericht Stuttgart, HRB 271090
>Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Hans-Joachim Reich
>Linuxppc-dev mailing list
>Linuxppc-dev at
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

More information about the Linuxppc-dev mailing list