All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: "André Schwarz" <andre.schwarz@matrix-vision.de>
Cc: LinuxPPC List <linuxppc-dev@ozlabs.org>,
	DevTreeDiscuss <devicetree-discuss@lists.ozlabs.org>
Subject: Re: How to define an I2C-to-SPI bridge device ?
Date: Thu, 9 Sep 2010 11:06:46 -0600	[thread overview]
Message-ID: <20100909170646.GD6273@angua.secretlab.ca> (raw)
In-Reply-To: <1283502979.17812.22.camel@swa-m460>

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: andre.schwarz@matrix-vision.de
> 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
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

WARNING: multiple messages have this Message-ID (diff)
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: "André Schwarz" <andre.schwarz-P0pTl12WyEgpBod+wgzj8A@public.gmane.org>
Cc: LinuxPPC List
	<linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>,
	DevTreeDiscuss
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: How to define an I2C-to-SPI bridge device ?
Date: Thu, 9 Sep 2010 11:06:46 -0600	[thread overview]
Message-ID: <20100909170646.GD6273@angua.secretlab.ca> (raw)
In-Reply-To: <1283502979.17812.22.camel@swa-m460>

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: andre.schwarz-P0pTl12WyEgpBod+wgzj8A@public.gmane.org
> 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
> Linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

  parent reply	other threads:[~2010-09-09 17:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  8:36 How to define an I2C-to-SPI bridge device ? André Schwarz
2010-09-03 12:08 ` Anton Vorontsov
2010-09-03 12:08   ` Anton Vorontsov
2010-09-06 11:40   ` Andre Schwarz
2010-09-06 11:40     ` Andre Schwarz
2010-09-06 14:37     ` André Schwarz
2010-09-06 14:37       ` André Schwarz
2010-09-09 18:23     ` Grant Likely
2010-09-09 18:23       ` Grant Likely
2010-09-10  8:11       ` André Schwarz
2010-09-10 17:37         ` Grant Likely
2010-09-10 17:37           ` Grant Likely
2010-09-10 18:14           ` André Schwarz
2010-09-10 18:14             ` André Schwarz
2010-09-10 18:27             ` Anton Vorontsov
2010-09-10 18:27               ` Anton Vorontsov
2010-09-10 18:28             ` Grant Likely
2010-09-10 18:28               ` Grant Likely
2010-09-12 15:10               ` André Schwarz
2010-09-12 15:10                 ` André Schwarz
2010-09-13  4:39                 ` Grant Likely
2010-09-13  4:39                   ` Grant Likely
2011-03-25  9:28       ` Andre Schwarz
2011-03-29 16:21         ` Andre Schwarz
2011-03-31  3:43           ` Grant Likely
2010-09-09 17:06 ` Grant Likely [this message]
2010-09-09 17:06   ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100909170646.GD6273@angua.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=andre.schwarz@matrix-vision.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.