Subject: Re: How to define an I2C-to-SPI bridge device ?

From: Grant Likely <[email-masked]>
Date: Thu, 9 Sep 2010 11:06:46 -0600

On Fri, Sep 03, 2010 at 10:36:19AM +0200, André Schwarz wrote:
> Hi,
> 
> 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 ?
> 
> Is the (possibly) required driver (of_sc18is60x_spi ?) supposed to be an
> I2C slave or an SPI host driver ?

Both!  The driver would get probed from the i2c bus, and it would
create and register an spi master.  If the spi bus registration
includes a pointer to the device tree node, then the child nodes will
automatically be registered as spi_devices.

The dts is also fairly straight forward:

i2c-bus: i2c@80001000 {
	compatible = <blah>;
	#address-cells = <1>;
	#size-cells = <0>;

	spi-bus: spi@28{
		compatible = "nxp,sc18is602";
		#address-cells = <1>;
		#size-cells = <0x28>;
		reg = <0>;

		spi-device@0 {
			compatible = <blah>;
			reg = <0>;
		};
		spi-device@1 {
			compatible = <blah>;
			reg = <1>;
		};
		spi-device@2 {
			compatible = <blah>;
			reg = <2>;
		};
	};
};

Cheers,
g.

> 
> 
> Any help is welcome.
> 
> 
> -- 
> Mit freundlichen Grüßen / Best regards
> 
> André Schwarz
> 
> ___________________________________________
> 
> MATRIX VISION GmbH
> - Entwicklung / Development -
> Talstraße 16
> D-71570 Oppenweiler
> 
> Fon: ++49-07191-9432-420
> Fax: ++49-07191-9432-288
> eMail: [email-masked]
> web: www.matrix-vision.de
> 
> 
> 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
> [email-masked]
> https://lists.ozlabs.org/listinfo/linuxppc-dev