From: Bob Feretich <bob.feretich-8wbKi1faPaosQv5ZqcSHkQ@public.gmane.org>
To: os user <gnusercn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org,
giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Subject: Re: Regarding to force bus id for channels of pca954x
Date: Wed, 06 May 2015 10:24:23 -0700 [thread overview]
Message-ID: <554A4E47.5070505@rafresearch.com> (raw)
In-Reply-To: <CAG+qjJ9qWGYe0m9oFDYU-J=ZM2izS=bZeF5=MhDHmzaBPvb3ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- 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.
next prev parent reply other threads:[~2015-05-06 17:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
[not found] ` <554A4E47.5070505-8wbKi1faPaosQv5ZqcSHkQ@public.gmane.org>
2015-05-07 2:47 ` os user
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=554A4E47.5070505@rafresearch.com \
--to=bob.feretich-8wbki1fapaosqv5zqcshkq@public.gmane.org \
--cc=giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org \
--cc=gnusercn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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.