<div dir="ltr">Hi James,<div><br></div><div>Yes, we have multiple devices sitting behind the mux, and they're onboard devices instead of standalone FRUs. The parent bus is described as the FRU for each PCIe card.</div><div><br></div><div>After naming the mux channels, can these names be used somehow to config I2C devices? For example, {"Bus": "$bus", "ChannelNames": ["C0", "C1", "C2", "C3"]} for the mux, and {"Bus": "$bus.C1"} for devices behind the mux on channel 1.</div><div><br></div><div>Thanks!</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">- Alex Qiu</div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 8, 2020 at 9:47 AM James Feist <<a href="mailto:james.feist@linux.intel.com">james.feist@linux.intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/8/20 9:25 AM, Alex Qiu wrote:<br>
> Hi Milton,<br>
> <br>
> Yes, the child buses are traceable in the sysfs, but actually my <br>
> question is, does entity-manager supports tracing child buses through <br>
> the sysfs? If it does, how shall I write the JSON config to take <br>
> advantage of this feature?<br>
> <br>
> For example, we have a I2C device sitting at the same level as the mux, <br>
> configured as {"Address": "0x40", "Bus": "$bus"}, and now I don't find <br>
> the way to add or subtract a certain number to $bus to find a child bus. <br>
> Do we have a feature with syntax like {"Address": "0x50", "Bus": <br>
> "$bus.mux.0x70.channel.1"} to configure devices on child buses, with mux <br>
> sitting on 0x70 of the parent bus?<br>
<br>
Do you have a device sitting behind the mux? Generally in most our <br>
situations we have another FRU behind the mux, and we can use "$bus" to <br>
describe this.<br>
<br>
Second option is you can name the mux channels, like this: <br>
<a href="https://github.com/openbmc/entity-manager/blob/01542d2af1b1f45335cc8813fffcd3ed07f22989/configurations/WFT%20Baseboard.json#L1023" rel="noreferrer" target="_blank">https://github.com/openbmc/entity-manager/blob/01542d2af1b1f45335cc8813fffcd3ed07f22989/configurations/WFT%20Baseboard.json#L1023</a><br>
<br>
And then in /dev/ you'll get symlinks like this:<br>
<br>
root@intel-obmc:~# ls -al /dev/i2c-mux/M2_Mux/<br>
drwxr-xr-x    2 root     root            80 Jan  1 00:01 .<br>
drwxr-xr-x    9 root     root           180 Jan  1 00:01 ..<br>
lrwxrwxrwx    1 root     root            11 Jan  1 00:01 M2Slot1 -> <br>
/dev/i2c-14<br>
lrwxrwxrwx    1 root     root            11 Jan  1 00:01 M2Slot2 -> <br>
/dev/i2c-15<br>
<br>
-James<br>
<br>
<br>
> <br>
> Thank you!<br>
> <br>
> - Alex Qiu<br>
> <br>
> <br>
> On Wed, Jan 8, 2020 at 6:43 AM Milton Miller II <<a href="mailto:miltonm@us.ibm.com" target="_blank">miltonm@us.ibm.com</a> <br>
> <mailto:<a href="mailto:miltonm@us.ibm.com" target="_blank">miltonm@us.ibm.com</a>>> wrote:<br>
> <br>
>     About 01/07/2020 07:14PM in some timezone, Alex Qiu wrote:<br>
>      >Hi folks,<br>
>      ><br>
>      >We have a JSON file configuring I2C devices of a PCIe card which has<br>
>      >an 8-channel I2C mux for entity-manager. After we properly configure<br>
>      >the mux of the card, we get 8 new I2C buses in sysfs; however, we<br>
>      >don't find an arithmetic way to describe the relationship between the<br>
>      >new buses and their parent buses.<br>
>      ><br>
>      >For example, we have a mux on physical BMC I2C bus i2c-8 spawning a<br>
>      >couple of child buses including i2c-24 and i2c-26, which are the<br>
>      >buses for each PCIe card. The mux on i2c-24 PCIe card spawned 8 buses<br>
>      >from i2c-70 to i2c-77, and the mux on i2c-26 PCIe card spawned ones<br>
>      >from i2c-62 to i2c-69. We have I2C devices on i2c-76 and i2c-68 needs<br>
>      >to be configured together with the PCIe card on i2c-24 and i2c-26<br>
>      >separately.<br>
>      ><br>
>      >How do we implement this in the JSON file? If that's not possible to<br>
>      >do it in JSON merely, what's the suggested approach to implement this<br>
>      >feature? Device tree? Implement code in entity-manager to walk<br>
>      >through the I2C sysfs?<br>
> <br>
> <br>
>     I would expect the i2c buses provied by the mux to appear in sysfs<br>
>     under the hierarchy of the parent bus.  Explore the sysfs directory<br>
>     structure, I'm making this up, but I've now peeked at i2c-mux.c and<br>
>     have a better chance getting reality.<br>
> <br>
> <br>
>     /sys/bus/i2c/devices/i2c-8 -> /sys/devices/platform/ahb-432000/i2c-8<br>
> <br>
>     /sys/bus/i2c/devices/i2c-24 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24<br>
>     /sys/bus/i2c/devices/i2c-24 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-25<br>
>     /sys/bus/i2c/devices/i2c-24 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26<br>
> <br>
>     /sys/bus/i2c/devices/i2c-62 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-62<br>
>     /sys/bus/i2c/devices/i2c-63 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-63<br>
>     /sys/bus/i2c/devices/i2c-64 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-64<br>
>     /sys/bus/i2c/devices/i2c-65 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-65<br>
>     /sys/bus/i2c/devices/i2c-66 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-66<br>
>     /sys/bus/i2c/devices/i2c-67 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-67<br>
>     /sys/bus/i2c/devices/i2c-68 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-68<br>
>     /sys/bus/i2c/devices/i2c-69 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-69<br>
>     /sys/bus/i2c/devices/i2c-70 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-70<br>
>     /sys/bus/i2c/devices/i2c-71 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-71<br>
>     /sys/bus/i2c/devices/i2c-72 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-72<br>
>     /sys/bus/i2c/devices/i2c-73 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-73<br>
>     /sys/bus/i2c/devices/i2c-74 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-74<br>
>     /sys/bus/i2c/devices/i2c-75 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-75<br>
>     /sys/bus/i2c/devices/i2c-76 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-76<br>
>     /sys/bus/i2c/devices/i2c-77 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-77<br>
> <br>
>     /sys/bus/i2c/devices/i2c-24/mux_device -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/8-52<br>
>     /sys/bus/i2c/devices/i2c-25/mux_device -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/8-52<br>
>     /sys/bus/i2c/devices/i2c-26/mux_device -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/8-52<br>
> <br>
>     /sys/bus/i2c/devices/8-52/channel-0 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24<br>
>     /sys/bus/i2c/devices/8-52/channel-1 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-25<br>
>     /sys/bus/i2c/devices/8-52/channel-2 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26<br>
> <br>
>     /sys/bus/i2c/devices/24-52/channel-0 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-62<br>
>     /sys/bus/i2c/devices/24-52/channel-1 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-63<br>
>     /sys/bus/i2c/devices/24-52/channel-2 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-64<br>
>     /sys/bus/i2c/devices/24-52/channel-3 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-65<br>
>     /sys/bus/i2c/devices/24-52/channel-4 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-66<br>
>     /sys/bus/i2c/devices/24-52/channel-5 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-67<br>
>     /sys/bus/i2c/devices/24-52/channel-6 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-68<br>
>     /sys/bus/i2c/devices/24-52/channel-7 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-24/i2c-69<br>
>     /sys/bus/i2c/devices/26-52/channel-0 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-70<br>
>     /sys/bus/i2c/devices/26-52/channel-1 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-71<br>
>     /sys/bus/i2c/devices/26-52/channel-2 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-72<br>
>     /sys/bus/i2c/devices/26-52/channel-3 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-73<br>
>     /sys/bus/i2c/devices/26-52/channel-4 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-74<br>
>     /sys/bus/i2c/devices/26-52/channel-5 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-75<br>
>     /sys/bus/i2c/devices/26-52/channel-6 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-76<br>
>     /sys/bus/i2c/devices/26-52/channel-7 -><br>
>     /sys/devices/platform/ahb-432000/i2c-8/i2c-26/i2c-77<br>
> <br>
>     The child bus will have a symlink "mux_device" pointing to the mux.<br>
>     The mux device node will have n symlinks "channel-1" where 1 is<br>
>     the channel id.<br>
> <br>
>     Hmm, there is no apparent code to put a "mux_channel" attribute in<br>
>     the adapter node.  The adapter name attribute does include the channel<br>
>     id, but its long descriptive text.  Regardless, you should be able to<br>
>     find the buses from the mux channel-3 symlinks.<br>
> <br>
>     Note: I haven't looked at the JSON to see how much it will change once<br>
>     your find the bus.  I'm guessing you will have to generate it by taking<br>
>     a template and substituting the bus numbers you find to make the slots<br>
>     common, alhtough you could just go from the 8-52/channel-3 symlink to<br>
>     the adapter bus (the device name will still have the bus number in it).<br>
> <br>
>     I hope this helps you,<br>
> <br>
>     milton<br>
> <br>
</blockquote></div>