xref: /OK3568_Linux_fs/kernel/Documentation/i2c/i2c-topology.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun================================
2*4882a593SmuzhiyunI2C muxes and complex topologies
3*4882a593Smuzhiyun================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThere are a couple of reasons for building more complex I2C topologies
6*4882a593Smuzhiyunthan a straight-forward I2C bus with one adapter and one or more devices.
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun1. A mux may be needed on the bus to prevent address collisions.
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun2. The bus may be accessible from some external bus master, and arbitration
11*4882a593Smuzhiyun   may be needed to determine if it is ok to access the bus.
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun3. A device (particularly RF tuners) may want to avoid the digital noise
14*4882a593Smuzhiyun   from the I2C bus, at least most of the time, and sits behind a gate
15*4882a593Smuzhiyun   that has to be operated before the device can be accessed.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunEtc
18*4882a593Smuzhiyun===
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunThese constructs are represented as I2C adapter trees by Linux, where
21*4882a593Smuzhiyuneach adapter has a parent adapter (except the root adapter) and zero or
22*4882a593Smuzhiyunmore child adapters. The root adapter is the actual adapter that issues
23*4882a593SmuzhiyunI2C transfers, and all adapters with a parent are part of an "i2c-mux"
24*4882a593Smuzhiyunobject (quoted, since it can also be an arbitrator or a gate).
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunDepending of the particular mux driver, something happens when there is
27*4882a593Smuzhiyunan I2C transfer on one of its child adapters. The mux driver can
28*4882a593Smuzhiyunobviously operate a mux, but it can also do arbitration with an external
29*4882a593Smuzhiyunbus master or open a gate. The mux driver has two operations for this,
30*4882a593Smuzhiyunselect and deselect. select is called before the transfer and (the
31*4882a593Smuzhiyunoptional) deselect is called after the transfer.
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunLocking
35*4882a593Smuzhiyun=======
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunThere are two variants of locking available to I2C muxes, they can be
38*4882a593Smuzhiyunmux-locked or parent-locked muxes. As is evident from below, it can be
39*4882a593Smuzhiyunuseful to know if a mux is mux-locked or if it is parent-locked. The
40*4882a593Smuzhiyunfollowing list was correct at the time of writing:
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunIn drivers/i2c/muxes/:
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun======================    =============================================
45*4882a593Smuzhiyuni2c-arb-gpio-challenge    Parent-locked
46*4882a593Smuzhiyuni2c-mux-gpio              Normally parent-locked, mux-locked iff
47*4882a593Smuzhiyun                          all involved gpio pins are controlled by the
48*4882a593Smuzhiyun                          same I2C root adapter that they mux.
49*4882a593Smuzhiyuni2c-mux-gpmux             Normally parent-locked, mux-locked iff
50*4882a593Smuzhiyun                          specified in device-tree.
51*4882a593Smuzhiyuni2c-mux-ltc4306           Mux-locked
52*4882a593Smuzhiyuni2c-mux-mlxcpld           Parent-locked
53*4882a593Smuzhiyuni2c-mux-pca9541           Parent-locked
54*4882a593Smuzhiyuni2c-mux-pca954x           Parent-locked
55*4882a593Smuzhiyuni2c-mux-pinctrl           Normally parent-locked, mux-locked iff
56*4882a593Smuzhiyun                          all involved pinctrl devices are controlled
57*4882a593Smuzhiyun                          by the same I2C root adapter that they mux.
58*4882a593Smuzhiyuni2c-mux-reg               Parent-locked
59*4882a593Smuzhiyun======================    =============================================
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunIn drivers/iio/:
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun======================    =============================================
64*4882a593Smuzhiyungyro/mpu3050              Mux-locked
65*4882a593Smuzhiyunimu/inv_mpu6050/          Mux-locked
66*4882a593Smuzhiyun======================    =============================================
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunIn drivers/media/:
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun=======================   =============================================
71*4882a593Smuzhiyundvb-frontends/lgdt3306a   Mux-locked
72*4882a593Smuzhiyundvb-frontends/m88ds3103   Parent-locked
73*4882a593Smuzhiyundvb-frontends/rtl2830     Parent-locked
74*4882a593Smuzhiyundvb-frontends/rtl2832     Mux-locked
75*4882a593Smuzhiyundvb-frontends/si2168      Mux-locked
76*4882a593Smuzhiyunusb/cx231xx/              Parent-locked
77*4882a593Smuzhiyun=======================   =============================================
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunMux-locked muxes
81*4882a593Smuzhiyun----------------
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunMux-locked muxes does not lock the entire parent adapter during the
84*4882a593Smuzhiyunfull select-transfer-deselect transaction, only the muxes on the parent
85*4882a593Smuzhiyunadapter are locked. Mux-locked muxes are mostly interesting if the
86*4882a593Smuzhiyunselect and/or deselect operations must use I2C transfers to complete
87*4882a593Smuzhiyuntheir tasks. Since the parent adapter is not fully locked during the
88*4882a593Smuzhiyunfull transaction, unrelated I2C transfers may interleave the different
89*4882a593Smuzhiyunstages of the transaction. This has the benefit that the mux driver
90*4882a593Smuzhiyunmay be easier and cleaner to implement, but it has some caveats.
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun==== =====================================================================
93*4882a593SmuzhiyunML1. If you build a topology with a mux-locked mux being the parent
94*4882a593Smuzhiyun     of a parent-locked mux, this might break the expectation from the
95*4882a593Smuzhiyun     parent-locked mux that the root adapter is locked during the
96*4882a593Smuzhiyun     transaction.
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunML2. It is not safe to build arbitrary topologies with two (or more)
99*4882a593Smuzhiyun     mux-locked muxes that are not siblings, when there are address
100*4882a593Smuzhiyun     collisions between the devices on the child adapters of these
101*4882a593Smuzhiyun     non-sibling muxes.
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun     I.e. the select-transfer-deselect transaction targeting e.g. device
104*4882a593Smuzhiyun     address 0x42 behind mux-one may be interleaved with a similar
105*4882a593Smuzhiyun     operation targeting device address 0x42 behind mux-two. The
106*4882a593Smuzhiyun     intension with such a topology would in this hypothetical example
107*4882a593Smuzhiyun     be that mux-one and mux-two should not be selected simultaneously,
108*4882a593Smuzhiyun     but mux-locked muxes do not guarantee that in all topologies.
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunML3. A mux-locked mux cannot be used by a driver for auto-closing
111*4882a593Smuzhiyun     gates/muxes, i.e. something that closes automatically after a given
112*4882a593Smuzhiyun     number (one, in most cases) of I2C transfers. Unrelated I2C transfers
113*4882a593Smuzhiyun     may creep in and close prematurely.
114*4882a593Smuzhiyun
115*4882a593SmuzhiyunML4. If any non-I2C operation in the mux driver changes the I2C mux state,
116*4882a593Smuzhiyun     the driver has to lock the root adapter during that operation.
117*4882a593Smuzhiyun     Otherwise garbage may appear on the bus as seen from devices
118*4882a593Smuzhiyun     behind the mux, when an unrelated I2C transfer is in flight during
119*4882a593Smuzhiyun     the non-I2C mux-changing operation.
120*4882a593Smuzhiyun==== =====================================================================
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun
123*4882a593SmuzhiyunMux-locked Example
124*4882a593Smuzhiyun------------------
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun::
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun                   .----------.     .--------.
130*4882a593Smuzhiyun    .--------.     |   mux-   |-----| dev D1 |
131*4882a593Smuzhiyun    |  root  |--+--|  locked  |     '--------'
132*4882a593Smuzhiyun    '--------'  |  |  mux M1  |--.  .--------.
133*4882a593Smuzhiyun                |  '----------'  '--| dev D2 |
134*4882a593Smuzhiyun                |  .--------.       '--------'
135*4882a593Smuzhiyun                '--| dev D3 |
136*4882a593Smuzhiyun                   '--------'
137*4882a593Smuzhiyun
138*4882a593SmuzhiyunWhen there is an access to D1, this happens:
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun 1. Someone issues an I2C transfer to D1.
141*4882a593Smuzhiyun 2. M1 locks muxes on its parent (the root adapter in this case).
142*4882a593Smuzhiyun 3. M1 calls ->select to ready the mux.
143*4882a593Smuzhiyun 4. M1 (presumably) does some I2C transfers as part of its select.
144*4882a593Smuzhiyun    These transfers are normal I2C transfers that locks the parent
145*4882a593Smuzhiyun    adapter.
146*4882a593Smuzhiyun 5. M1 feeds the I2C transfer from step 1 to its parent adapter as a
147*4882a593Smuzhiyun    normal I2C transfer that locks the parent adapter.
148*4882a593Smuzhiyun 6. M1 calls ->deselect, if it has one.
149*4882a593Smuzhiyun 7. Same rules as in step 4, but for ->deselect.
150*4882a593Smuzhiyun 8. M1 unlocks muxes on its parent.
151*4882a593Smuzhiyun
152*4882a593SmuzhiyunThis means that accesses to D2 are lockout out for the full duration
153*4882a593Smuzhiyunof the entire operation. But accesses to D3 are possibly interleaved
154*4882a593Smuzhiyunat any point.
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun
157*4882a593SmuzhiyunParent-locked muxes
158*4882a593Smuzhiyun-------------------
159*4882a593Smuzhiyun
160*4882a593SmuzhiyunParent-locked muxes lock the parent adapter during the full select-
161*4882a593Smuzhiyuntransfer-deselect transaction. The implication is that the mux driver
162*4882a593Smuzhiyunhas to ensure that any and all I2C transfers through that parent
163*4882a593Smuzhiyunadapter during the transaction are unlocked I2C transfers (using e.g.
164*4882a593Smuzhiyun__i2c_transfer), or a deadlock will follow. There are a couple of
165*4882a593Smuzhiyuncaveats.
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun==== ====================================================================
168*4882a593SmuzhiyunPL1. If you build a topology with a parent-locked mux being the child
169*4882a593Smuzhiyun     of another mux, this might break a possible assumption from the
170*4882a593Smuzhiyun     child mux that the root adapter is unused between its select op
171*4882a593Smuzhiyun     and the actual transfer (e.g. if the child mux is auto-closing
172*4882a593Smuzhiyun     and the parent mux issues I2C transfers as part of its select).
173*4882a593Smuzhiyun     This is especially the case if the parent mux is mux-locked, but
174*4882a593Smuzhiyun     it may also happen if the parent mux is parent-locked.
175*4882a593Smuzhiyun
176*4882a593SmuzhiyunPL2. If select/deselect calls out to other subsystems such as gpio,
177*4882a593Smuzhiyun     pinctrl, regmap or iio, it is essential that any I2C transfers
178*4882a593Smuzhiyun     caused by these subsystems are unlocked. This can be convoluted to
179*4882a593Smuzhiyun     accomplish, maybe even impossible if an acceptably clean solution
180*4882a593Smuzhiyun     is sought.
181*4882a593Smuzhiyun==== ====================================================================
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun
184*4882a593SmuzhiyunParent-locked Example
185*4882a593Smuzhiyun---------------------
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun::
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun                   .----------.     .--------.
190*4882a593Smuzhiyun    .--------.     |  parent- |-----| dev D1 |
191*4882a593Smuzhiyun    |  root  |--+--|  locked  |     '--------'
192*4882a593Smuzhiyun    '--------'  |  |  mux M1  |--.  .--------.
193*4882a593Smuzhiyun                |  '----------'  '--| dev D2 |
194*4882a593Smuzhiyun                |  .--------.       '--------'
195*4882a593Smuzhiyun                '--| dev D3 |
196*4882a593Smuzhiyun                   '--------'
197*4882a593Smuzhiyun
198*4882a593SmuzhiyunWhen there is an access to D1, this happens:
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun 1.  Someone issues an I2C transfer to D1.
201*4882a593Smuzhiyun 2.  M1 locks muxes on its parent (the root adapter in this case).
202*4882a593Smuzhiyun 3.  M1 locks its parent adapter.
203*4882a593Smuzhiyun 4.  M1 calls ->select to ready the mux.
204*4882a593Smuzhiyun 5.  If M1 does any I2C transfers (on this root adapter) as part of
205*4882a593Smuzhiyun     its select, those transfers must be unlocked I2C transfers so
206*4882a593Smuzhiyun     that they do not deadlock the root adapter.
207*4882a593Smuzhiyun 6.  M1 feeds the I2C transfer from step 1 to the root adapter as an
208*4882a593Smuzhiyun     unlocked I2C transfer, so that it does not deadlock the parent
209*4882a593Smuzhiyun     adapter.
210*4882a593Smuzhiyun 7.  M1 calls ->deselect, if it has one.
211*4882a593Smuzhiyun 8.  Same rules as in step 5, but for ->deselect.
212*4882a593Smuzhiyun 9.  M1 unlocks its parent adapter.
213*4882a593Smuzhiyun 10. M1 unlocks muxes on its parent.
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun
216*4882a593SmuzhiyunThis means that accesses to both D2 and D3 are locked out for the full
217*4882a593Smuzhiyunduration of the entire operation.
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun
220*4882a593SmuzhiyunComplex Examples
221*4882a593Smuzhiyun================
222*4882a593Smuzhiyun
223*4882a593SmuzhiyunParent-locked mux as parent of parent-locked mux
224*4882a593Smuzhiyun------------------------------------------------
225*4882a593Smuzhiyun
226*4882a593SmuzhiyunThis is a useful topology, but it can be bad::
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun                   .----------.     .----------.     .--------.
229*4882a593Smuzhiyun    .--------.     |  parent- |-----|  parent- |-----| dev D1 |
230*4882a593Smuzhiyun    |  root  |--+--|  locked  |     |  locked  |     '--------'
231*4882a593Smuzhiyun    '--------'  |  |  mux M1  |--.  |  mux M2  |--.  .--------.
232*4882a593Smuzhiyun                |  '----------'  |  '----------'  '--| dev D2 |
233*4882a593Smuzhiyun                |  .--------.    |  .--------.       '--------'
234*4882a593Smuzhiyun                '--| dev D4 |    '--| dev D3 |
235*4882a593Smuzhiyun                   '--------'       '--------'
236*4882a593Smuzhiyun
237*4882a593SmuzhiyunWhen any device is accessed, all other devices are locked out for
238*4882a593Smuzhiyunthe full duration of the operation (both muxes lock their parent,
239*4882a593Smuzhiyunand specifically when M2 requests its parent to lock, M1 passes
240*4882a593Smuzhiyunthe buck to the root adapter).
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunThis topology is bad if M2 is an auto-closing mux and M1->select
243*4882a593Smuzhiyunissues any unlocked I2C transfers on the root adapter that may leak
244*4882a593Smuzhiyunthrough and be seen by the M2 adapter, thus closing M2 prematurely.
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun
247*4882a593SmuzhiyunMux-locked mux as parent of mux-locked mux
248*4882a593Smuzhiyun------------------------------------------
249*4882a593Smuzhiyun
250*4882a593SmuzhiyunThis is a good topology::
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun                   .----------.     .----------.     .--------.
253*4882a593Smuzhiyun    .--------.     |   mux-   |-----|   mux-   |-----| dev D1 |
254*4882a593Smuzhiyun    |  root  |--+--|  locked  |     |  locked  |     '--------'
255*4882a593Smuzhiyun    '--------'  |  |  mux M1  |--.  |  mux M2  |--.  .--------.
256*4882a593Smuzhiyun                |  '----------'  |  '----------'  '--| dev D2 |
257*4882a593Smuzhiyun                |  .--------.    |  .--------.       '--------'
258*4882a593Smuzhiyun                '--| dev D4 |    '--| dev D3 |
259*4882a593Smuzhiyun                   '--------'       '--------'
260*4882a593Smuzhiyun
261*4882a593SmuzhiyunWhen device D1 is accessed, accesses to D2 are locked out for the
262*4882a593Smuzhiyunfull duration of the operation (muxes on the top child adapter of M1
263*4882a593Smuzhiyunare locked). But accesses to D3 and D4 are possibly interleaved at
264*4882a593Smuzhiyunany point. Accesses to D3 locks out D1 and D2, but accesses to D4
265*4882a593Smuzhiyunare still possibly interleaved.
266*4882a593Smuzhiyun
267*4882a593Smuzhiyun
268*4882a593SmuzhiyunMux-locked mux as parent of parent-locked mux
269*4882a593Smuzhiyun---------------------------------------------
270*4882a593Smuzhiyun
271*4882a593SmuzhiyunThis is probably a bad topology::
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun                   .----------.     .----------.     .--------.
274*4882a593Smuzhiyun    .--------.     |   mux-   |-----|  parent- |-----| dev D1 |
275*4882a593Smuzhiyun    |  root  |--+--|  locked  |     |  locked  |     '--------'
276*4882a593Smuzhiyun    '--------'  |  |  mux M1  |--.  |  mux M2  |--.  .--------.
277*4882a593Smuzhiyun                |  '----------'  |  '----------'  '--| dev D2 |
278*4882a593Smuzhiyun                |  .--------.    |  .--------.       '--------'
279*4882a593Smuzhiyun                '--| dev D4 |    '--| dev D3 |
280*4882a593Smuzhiyun                   '--------'       '--------'
281*4882a593Smuzhiyun
282*4882a593SmuzhiyunWhen device D1 is accessed, accesses to D2 and D3 are locked out
283*4882a593Smuzhiyunfor the full duration of the operation (M1 locks child muxes on the
284*4882a593Smuzhiyunroot adapter). But accesses to D4 are possibly interleaved at any
285*4882a593Smuzhiyunpoint.
286*4882a593Smuzhiyun
287*4882a593SmuzhiyunThis kind of topology is generally not suitable and should probably
288*4882a593Smuzhiyunbe avoided. The reason is that M2 probably assumes that there will
289*4882a593Smuzhiyunbe no I2C transfers during its calls to ->select and ->deselect, and
290*4882a593Smuzhiyunif there are, any such transfers might appear on the slave side of M2
291*4882a593Smuzhiyunas partial I2C transfers, i.e. garbage or worse. This might cause
292*4882a593Smuzhiyundevice lockups and/or other problems.
293*4882a593Smuzhiyun
294*4882a593SmuzhiyunThe topology is especially troublesome if M2 is an auto-closing
295*4882a593Smuzhiyunmux. In that case, any interleaved accesses to D4 might close M2
296*4882a593Smuzhiyunprematurely, as might any I2C transfers part of M1->select.
297*4882a593Smuzhiyun
298*4882a593SmuzhiyunBut if M2 is not making the above stated assumption, and if M2 is not
299*4882a593Smuzhiyunauto-closing, the topology is fine.
300*4882a593Smuzhiyun
301*4882a593Smuzhiyun
302*4882a593SmuzhiyunParent-locked mux as parent of mux-locked mux
303*4882a593Smuzhiyun---------------------------------------------
304*4882a593Smuzhiyun
305*4882a593SmuzhiyunThis is a good topology::
306*4882a593Smuzhiyun
307*4882a593Smuzhiyun                   .----------.     .----------.     .--------.
308*4882a593Smuzhiyun    .--------.     |  parent- |-----|   mux-   |-----| dev D1 |
309*4882a593Smuzhiyun    |  root  |--+--|  locked  |     |  locked  |     '--------'
310*4882a593Smuzhiyun    '--------'  |  |  mux M1  |--.  |  mux M2  |--.  .--------.
311*4882a593Smuzhiyun                |  '----------'  |  '----------'  '--| dev D2 |
312*4882a593Smuzhiyun                |  .--------.    |  .--------.       '--------'
313*4882a593Smuzhiyun                '--| dev D4 |    '--| dev D3 |
314*4882a593Smuzhiyun                   '--------'       '--------'
315*4882a593Smuzhiyun
316*4882a593SmuzhiyunWhen D1 is accessed, accesses to D2 are locked out for the full
317*4882a593Smuzhiyunduration of the operation (muxes on the top child adapter of M1
318*4882a593Smuzhiyunare locked). Accesses to D3 and D4 are possibly interleaved at
319*4882a593Smuzhiyunany point, just as is expected for mux-locked muxes.
320*4882a593Smuzhiyun
321*4882a593SmuzhiyunWhen D3 or D4 are accessed, everything else is locked out. For D3
322*4882a593Smuzhiyunaccesses, M1 locks the root adapter. For D4 accesses, the root
323*4882a593Smuzhiyunadapter is locked directly.
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun
326*4882a593SmuzhiyunTwo mux-locked sibling muxes
327*4882a593Smuzhiyun----------------------------
328*4882a593Smuzhiyun
329*4882a593SmuzhiyunThis is a good topology::
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun                                    .--------.
332*4882a593Smuzhiyun                   .----------.  .--| dev D1 |
333*4882a593Smuzhiyun                   |   mux-   |--'  '--------'
334*4882a593Smuzhiyun                .--|  locked  |     .--------.
335*4882a593Smuzhiyun                |  |  mux M1  |-----| dev D2 |
336*4882a593Smuzhiyun                |  '----------'     '--------'
337*4882a593Smuzhiyun                |  .----------.     .--------.
338*4882a593Smuzhiyun    .--------.  |  |   mux-   |-----| dev D3 |
339*4882a593Smuzhiyun    |  root  |--+--|  locked  |     '--------'
340*4882a593Smuzhiyun    '--------'  |  |  mux M2  |--.  .--------.
341*4882a593Smuzhiyun                |  '----------'  '--| dev D4 |
342*4882a593Smuzhiyun                |  .--------.       '--------'
343*4882a593Smuzhiyun                '--| dev D5 |
344*4882a593Smuzhiyun                   '--------'
345*4882a593Smuzhiyun
346*4882a593SmuzhiyunWhen D1 is accessed, accesses to D2, D3 and D4 are locked out. But
347*4882a593Smuzhiyunaccesses to D5 may be interleaved at any time.
348*4882a593Smuzhiyun
349*4882a593Smuzhiyun
350*4882a593SmuzhiyunTwo parent-locked sibling muxes
351*4882a593Smuzhiyun-------------------------------
352*4882a593Smuzhiyun
353*4882a593SmuzhiyunThis is a good topology::
354*4882a593Smuzhiyun
355*4882a593Smuzhiyun                                    .--------.
356*4882a593Smuzhiyun                   .----------.  .--| dev D1 |
357*4882a593Smuzhiyun                   |  parent- |--'  '--------'
358*4882a593Smuzhiyun                .--|  locked  |     .--------.
359*4882a593Smuzhiyun                |  |  mux M1  |-----| dev D2 |
360*4882a593Smuzhiyun                |  '----------'     '--------'
361*4882a593Smuzhiyun                |  .----------.     .--------.
362*4882a593Smuzhiyun    .--------.  |  |  parent- |-----| dev D3 |
363*4882a593Smuzhiyun    |  root  |--+--|  locked  |     '--------'
364*4882a593Smuzhiyun    '--------'  |  |  mux M2  |--.  .--------.
365*4882a593Smuzhiyun                |  '----------'  '--| dev D4 |
366*4882a593Smuzhiyun                |  .--------.       '--------'
367*4882a593Smuzhiyun                '--| dev D5 |
368*4882a593Smuzhiyun                   '--------'
369*4882a593Smuzhiyun
370*4882a593SmuzhiyunWhen any device is accessed, accesses to all other devices are locked
371*4882a593Smuzhiyunout.
372*4882a593Smuzhiyun
373*4882a593Smuzhiyun
374*4882a593SmuzhiyunMux-locked and parent-locked sibling muxes
375*4882a593Smuzhiyun------------------------------------------
376*4882a593Smuzhiyun
377*4882a593SmuzhiyunThis is a good topology::
378*4882a593Smuzhiyun
379*4882a593Smuzhiyun                                    .--------.
380*4882a593Smuzhiyun                   .----------.  .--| dev D1 |
381*4882a593Smuzhiyun                   |   mux-   |--'  '--------'
382*4882a593Smuzhiyun                .--|  locked  |     .--------.
383*4882a593Smuzhiyun                |  |  mux M1  |-----| dev D2 |
384*4882a593Smuzhiyun                |  '----------'     '--------'
385*4882a593Smuzhiyun                |  .----------.     .--------.
386*4882a593Smuzhiyun    .--------.  |  |  parent- |-----| dev D3 |
387*4882a593Smuzhiyun    |  root  |--+--|  locked  |     '--------'
388*4882a593Smuzhiyun    '--------'  |  |  mux M2  |--.  .--------.
389*4882a593Smuzhiyun                |  '----------'  '--| dev D4 |
390*4882a593Smuzhiyun                |  .--------.       '--------'
391*4882a593Smuzhiyun                '--| dev D5 |
392*4882a593Smuzhiyun                   '--------'
393*4882a593Smuzhiyun
394*4882a593SmuzhiyunWhen D1 or D2 are accessed, accesses to D3 and D4 are locked out while
395*4882a593Smuzhiyunaccesses to D5 may interleave. When D3 or D4 are accessed, accesses to
396*4882a593Smuzhiyunall other devices are locked out.
397