All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Regarding to force bus id for channels of pca954x
       [not found] ` <CAG+qjJ8qEjzNkjxmUh8yng-Fcxm=_PjteoGqw38QMbP6Xe6wbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-05-06 16:35   ` os user
       [not found]     ` <CAG+qjJ9qWGYe0m9oFDYU-J=ZM2izS=bZeF5=MhDHmzaBPvb3ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: os user @ 2015-05-06 16:35 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: guenter.roeck-IzeFyvvaP7pWk0Htik3J/w,
	giometti-AVVDYK/kqiJWk0Htik3J/w, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ

Hi there,

For some reasons, we need to assign bus id for the channels of I2c mux pca9548.

>From the code, it seems we can use "adap_id" of

struct pca954x_platform_mode {
  int             adap_id;
  unsigned int    deselect_on_exit:1;
  unsigned int    class;
};

But my questions is, can we assign bus id through device tree and modprobe?

Thanks.

On Thu, May 7, 2015 at 12:33 AM, os user <gnusercn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi there,
>
> For some reasons, we need to assign bus id for the channels of I2c mux
> pca9548.
>
> From the code, it seems we can use "adap_id" of
>
> struct pca954x_platform_mode {
>   int             adap_id;
>   unsigned int    deselect_on_exit:1;
>   unsigned int    class;
> };
>
> But my questions is, can we assign bus id through device tree and modprobe?
>
> Thanks.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Regarding to force bus id for channels of pca954x
       [not found]     ` <CAG+qjJ9qWGYe0m9oFDYU-J=ZM2izS=bZeF5=MhDHmzaBPvb3ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-05-06 17:24       ` Bob Feretich
       [not found]         ` <554A4E47.5070505-8wbKi1faPaosQv5ZqcSHkQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Feretich @ 2015-05-06 17:24 UTC (permalink / raw)
  To: os user, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: guenter.roeck-IzeFyvvaP7pWk0Htik3J/w,
	giometti-AVVDYK/kqiJWk0Htik3J/w, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

On 5/6/2015 9:35 AM, os user wrote:
> Hi there,
>
> For some reasons, we need to assign bus id for the channels of I2c mux pca9548.
>
>>From the code, it seems we can use "adap_id" of
>
> struct pca954x_platform_mode {
>    int             adap_id;
>    unsigned int    deselect_on_exit:1;
>    unsigned int    class;
> };
>
> But my questions is, can we assign bus id through device tree and modprobe?
I have been meaning to submit a patch for this to the documentation. 
I'll get to it soon. See attachment on how to assign i2c bus numbers 
from the DT.
-Bob
>
> Thanks.
>
> On Thu, May 7, 2015 at 12:33 AM, os user <gnusercn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Hi there,
>>
>> For some reasons, we need to assign bus id for the channels of I2c mux
>> pca9548.
>>
>>  From the code, it seems we can use "adap_id" of
>>
>> struct pca954x_platform_mode {
>>    int             adap_id;
>>    unsigned int    deselect_on_exit:1;
>>    unsigned int    class;
>> };
>>
>> But my questions is, can we assign bus id through device tree and modprobe?
>>
>> Thanks.
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[-- Attachment #2: i2c-mux.txt --]
[-- Type: text/plain, Size: 2769 bytes --]

Common i2c bus multiplexer/switch properties.

An i2c bus multiplexer/switch will have several child busses that are
numbered uniquely in a device dependent manner.  The nodes for an i2c bus
multiplexer/switch will have one child node for each child
bus.

Required properties:
- #address-cells = <1>;
- #size-cells = <0>;

Required properties for child nodes:
- #address-cells = <1>;
- #size-cells = <0>;
- reg : The sub-bus number.

Optional properties for child nodes:
- Other properties specific to the multiplexer/switch hardware.
- Child nodes conforming to i2c bus binding


Example :

	/*
	   An NXP pca9548 8 channel I2C multiplexer at address 0x70
	   with two NXP pca8574 GPIO expanders attached, one each to
	   ports 3 and 4.
	 */

	mux@70 {
		compatible = "nxp,pca9548";
		reg = <0x70>;
		#address-cells = <1>;
		#size-cells = <0>;

		i2c@3 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <3>;

			gpio1: gpio@38 {
				compatible = "nxp,pca8574";
				reg = <0x38>;
				#gpio-cells = <2>;
				gpio-controller;
			};
		};
		i2c@4 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <4>;

			gpio2: gpio@38 {
				compatible = "nxp,pca8574";
				reg = <0x38>;
				#gpio-cells = <2>;
				gpio-controller;
			};
		};
	};
	
The I2C subsystem will assign names to the child busses dynamically in
the form i2c-n; where 'n' is an incrementing number starting with the 
number following the previously highest allocated bus number.

Alliases may be used to assign static child bus names. The alias name 
must be of the form i2cnn where nn is numeric. The numeric part (nn) is
used to set the bus number.

Example :

/ {
	aliases {
		i2c10 = &im0;
		i2c11 = &im1;
		i2c12 = &im2;
		i2c13 = &im3;
		i2c14 = &im4;
		i2c15 = &im5;
		i2c16 = &im6;
		i2c17 = &im7;
	};
};
...
	i2cmux@70 {
	 	compatible = "nxp,pca9548";
	 	#address-cells = <1>;
	 	#size-cells = <0>;
	 	reg = <0x70>;

 im0:	i2cm@0 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <0>;
		};
 im1:	i2cm@1 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <1>;
		};
 im2:	i2cm@2 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <2>;
		};
 im3:	i2cm@3 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <3>;
		};
 im4:	i2cm@4 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <4>;
		};
 im5:	i2cm@5 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <5>;
		};
 im6:	i2cm@6 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <6>;
		};
 im7:	i2cm@7 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <7>;
		};
	 };

The above file segment causes the child i2c busses to be named
i2c-10 through i2c-17.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Regarding to force bus id for channels of pca954x
       [not found]         ` <554A4E47.5070505-8wbKi1faPaosQv5ZqcSHkQ@public.gmane.org>
@ 2015-05-07  2:47           ` os user
  0 siblings, 0 replies; 3+ messages in thread
From: os user @ 2015-05-07  2:47 UTC (permalink / raw)
  To: Bob Feretich; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Thanks Bob for the quick help.

So at this moment, we do not have a way to explicitly specify the i2c
bus number for pca9548 from modprobe command line, correct?

BR,
Eric

On Thu, May 7, 2015 at 1:24 AM, Bob Feretich
<bob.feretich-8wbKi1faPaosQv5ZqcSHkQ@public.gmane.org> wrote:
> On 5/6/2015 9:35 AM, os user wrote:
>>
>> Hi there,
>>
>> For some reasons, we need to assign bus id for the channels of I2c mux
>> pca9548.
>>
>>> From the code, it seems we can use "adap_id" of
>>
>>
>> struct pca954x_platform_mode {
>>    int             adap_id;
>>    unsigned int    deselect_on_exit:1;
>>    unsigned int    class;
>> };
>>
>> But my questions is, can we assign bus id through device tree and
>> modprobe?
>
> I have been meaning to submit a patch for this to the documentation. I'll
> get to it soon. See attachment on how to assign i2c bus numbers from the DT.
> -Bob
>>
>>
>> Thanks.
>>
>> On Thu, May 7, 2015 at 12:33 AM, os user <gnusercn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>
>>> Hi there,
>>>
>>> For some reasons, we need to assign bus id for the channels of I2c mux
>>> pca9548.
>>>
>>>  From the code, it seems we can use "adap_id" of
>>>
>>> struct pca954x_platform_mode {
>>>    int             adap_id;
>>>    unsigned int    deselect_on_exit:1;
>>>    unsigned int    class;
>>> };
>>>
>>> But my questions is, can we assign bus id through device tree and
>>> modprobe?
>>>
>>> Thanks.
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-07  2:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAG+qjJ8qEjzNkjxmUh8yng-Fcxm=_PjteoGqw38QMbP6Xe6wbw@mail.gmail.com>
     [not found] ` <CAG+qjJ8qEjzNkjxmUh8yng-Fcxm=_PjteoGqw38QMbP6Xe6wbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-06 16:35   ` Regarding to force bus id for channels of pca954x os user
     [not found]     ` <CAG+qjJ9qWGYe0m9oFDYU-J=ZM2izS=bZeF5=MhDHmzaBPvb3ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-06 17:24       ` Bob Feretich
     [not found]         ` <554A4E47.5070505-8wbKi1faPaosQv5ZqcSHkQ@public.gmane.org>
2015-05-07  2:47           ` os user

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.