From patchwork Wed Apr 20 15:17:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 8892381 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E5459F39A for ; Wed, 20 Apr 2016 15:38:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2A4120211 for ; Wed, 20 Apr 2016 15:38:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A04942024F for ; Wed, 20 Apr 2016 15:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752312AbcDTPfz (ORCPT ); Wed, 20 Apr 2016 11:35:55 -0400 Received: from mail-db3on0106.outbound.protection.outlook.com ([157.55.234.106]:18976 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752234AbcDTPfv (ORCPT ); Wed, 20 Apr 2016 11:35:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Mu8OUkNokMJXWjctZ/x9uElm1XuWsG0+pJC//5B8U4s=; b=RVdrO1ejo/cq0FlDh4e6oo84n1q3BM11gKM1gzMTR6nr6EkKkhvHC0q2leqlIyGLPHfYm0DkxP66kedwsJQo+BKZ2hMvJVMAVJl3VkmvaPVbo/vQsLwvJB+d+dUk9e4n5lHzdL8Vd972sX+d+K+EZjtNVvP1l5qeopyVFsF89l8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=axentia.se; Received: from localhost.localdomain (217.210.101.82) by VI1PR02MB1312.eurprd02.prod.outlook.com (10.165.231.154) with Microsoft SMTP Server (TLS) id 15.1.466.19; Wed, 20 Apr 2016 15:20:33 +0000 From: Peter Rosin To: CC: Peter Rosin , Wolfram Sang , Jonathan Corbet , Peter Korsgaard , Guenter Roeck , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , Antti Palosaari , Mauro Carvalho Chehab , Rob Herring , Frank Rowand , Grant Likely , Andrew Morton , "David S. Miller" , Greg Kroah-Hartman , Kalle Valo , Jiri Slaby , Daniel Baluta , Lucas De Marchi , Adriana Reus , Matt Ranostay , Krzysztof Kozlowski , Hans Verkuil , Terry Heo , Arnd Bergmann , Tommi Rantala , Crestez Dan Leonard , , , , , , Peter Rosin Subject: [PATCH v7 19/24] i2c-mux: document i2c muxes and elaborate on parent-/mux-locked muxes Date: Wed, 20 Apr 2016 17:17:59 +0200 Message-ID: <1461165484-2314-20-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1461165484-2314-1-git-send-email-peda@axentia.se> References: <1461165484-2314-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB3PR01CA0069.eurprd01.prod.exchangelabs.com (10.242.133.172) To VI1PR02MB1312.eurprd02.prod.outlook.com (10.165.231.154) X-MS-Office365-Filtering-Correlation-Id: 2359b17f-1292-4152-864a-08d3692f54b8 X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 2:xuyuLJHWuyvCBOf6Gqvj817/QfVZ//bBiulWyC6AVCbzFAPH4OEL5CqP+SMA/ao/A/2O+rd3AykRmN7NZHcQmgE//RSjtcgepUS2y+AV3F4HpNJ69GWyyqODBBpOv1T8RrZ2siui0EjNlgDPkP+v4Faqj7CBGkbnqP+yY0nl5A3vgZmWjJirguGf0nCkg1AI; 3:+M3IftjsxxB4q0RO8Ig5u6FMVnEo2jaD8ai/uB1ptj1mFj/p2Zti6z32nPWzuAMzGnuCSMdc1Yy8FbkdLAwGlxUNj5nJgSa9EdK5eK5KitA1II1BnbfBQYgFfYxRhknz; 25:f2zvrJis2Xzr7H8+5/OjpQEohlnFUnnrXmT4ncQGF1uTyyjRUY9KA4JDz+l5pkp9ogYE5N3WTtG+W2cQXcI1zmk3kqiyzRPNFLEF3OMpiJj7C8E0XqhKlYERx9ZMy88RsgWzmIiGMgYBgEMkGT0UUfwxAJcHqy2GglZ/vJoi+dxa/RQHk8YFS/dZ7Xsttnfo13QhDCjnjNdvaFy88sXtUTyR93OTd8p82pL0z1TmGdKwkYY7C5Xqxw1o2m0D5vUa8Y2/Oter7eu6v9mJw+hB/hWIlUdrq5XbWJ+/FIsjUqP139wEgiNPGy73vqkteADaJJeHP0deqso9YWKE1K6tMw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1312; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(6040130)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041046)(6043046); SRVR:VI1PR02MB1312; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB1312; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 4:YPsdkeaW5oebNU+BkZp/8ymKOYQ3Di5rkyCQZcI+b+VmHG7UDTafiqRJE8WQFkIV7QyE+KPMfaMQFZKw7aRKxLDV/DjscKtNj8j5gYhGD/00GrHbSn3IRY5Ty86wFPUkqX5CLdI0QRCvo6EpTByp83Hr72SyZCNcH+2gkXCl++iscgshWfYXAXVsA7r0S8vkNQVbs4OBnMoeO6dy534KD3oHi7KCphPjm0fBxw+QyR9f3TZcs0cTd3PWis6LHoliaHnaErKhh8Xqo+32/dIxoMIOcy4k7w/nrzCHWeOqFbZM8zAqhFmGXE0twbytqgp1z4R3P9qcrjdHFW23vUZXRBMDfVxjm5O/KHuX1Qk6cEuMdq2MQhWVLzSCy8fJ7GVI3O9EFkcVU9WPLELcWse85ylBQiMwd2MO7oLtGTb4PDP/B1LonxfqgQi70fuGN/hQ0QLOkXLvI/UHw4qV5auZ/Q== X-Forefront-PRVS: 0918748D70 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(66066001)(2906002)(19580395003)(19580405001)(110136002)(92566002)(189998001)(5008740100001)(47776003)(42186005)(33646002)(6116002)(3846002)(5003940100001)(586003)(81166005)(48376002)(2950100001)(4326007)(50466002)(76176999)(1096002)(50226001)(77096005)(50986999)(36756003)(86362001)(2351001)(229853001)(74482002)(551934003)(5004730100002)(7059030)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB1312; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR02MB1312; 23:KLolwzZXhz68nJ7Y97AU+tOaKAfDUXLNxtleMNGgy?= =?us-ascii?Q?ZaujdVOtpezEaHzzYyaCbJAa75bBfSH+JHWUEPYuFS06S5sGXIkOmxFT3hCO?= =?us-ascii?Q?473s1A9o01L6vzlEfrxhEtL7HaeY6bKVNWC820d7YPauhQIii4Wjg9NrPHIo?= =?us-ascii?Q?C5ZFL3xC9GDvfpRIXmULXr1xi7Rvk26EZ01Zd/NxGrC/aZWQikS+rHV6gHAr?= =?us-ascii?Q?7wpZN6HCgFmx3vBV5stDfMe/sVgplHa0E5rpgtkhXsOvEE99pXy4KruXgpuC?= =?us-ascii?Q?ir+A9rwg1pP74NLuHKR5uhOgCPFmtvXfSbjE0SkeWOe/w3vhoSXJ3AKIUS/6?= =?us-ascii?Q?rmmbH5y5YBTBZKJYU7tk6gAUGdr1/Bp2Gb+rv8A2GOp9NyMhAo+Y0+6Fc1Hd?= =?us-ascii?Q?wzfCPFE1ykTfidOZHMxzrOAjP+H903xk2zUeqINIg/iPQEMpy27C5odHOAub?= =?us-ascii?Q?DbxRePfBignk57zr8R4IGAZvL/ueH1tHykxAWyQ+GRbhAPQKM3A4NyaO3GzC?= =?us-ascii?Q?Bl1spAJpubZ5D3BBurTqzGDNHgM9iGKVJK7XLqDGK72APXeW92wQTCVJx30y?= =?us-ascii?Q?PN6WdcFVQB3X1Hd1TP11raqx2FN8RAqs8nrjorsu6MTsE8OoE2ifz+U4gYkv?= =?us-ascii?Q?zeWT5CPjmxGbfqiZ242AMLDGv4HY6VEFecw2iE9vhFNgWtlVZxtQ7PAECreJ?= =?us-ascii?Q?nh/WpDGNLF9/IRkPlCdVsJ18LuXMy/FYNGM/QbF9pcWgwjnmVfJ89y5oUNZI?= =?us-ascii?Q?uJc0MSAY7hV0/HEnHFU063thEy2EH6LFBs6/7GzyAVSdXjQ+G7ImN/60iqYk?= =?us-ascii?Q?4ICpjpt8uIv9+JHBttjXsXca8Xp0KcOu1lr80cex4QHmIeqHkHTqt5Er7u1C?= =?us-ascii?Q?Kbxqphbv5qbN+W6DROzuRZrjsx3+M14Xo+WaNg/v/VOzkAnQ7sGC7BOMgCHb?= =?us-ascii?Q?Lyk4Y7z5m26aJ0ghysgUvq507pfarq5gwZqtDzTZY+V3QDBsaGCqY6iK3Qe0?= =?us-ascii?Q?R8=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 5:cXAUXFZYI0n2deeE74SZI/8f4+DtXv6cOgaQ/Ib7PGxLoPtYJT3ZzVRCb3GWlOpOEa9G3DVfLRJRL9fBYA3zPaLwFVrTITJ0l+GGkJTqKSOpWGWxtUu5+arlwP7ML5XKMcjT52VI9y0+X/HfnodpSMi7pyHPd+ZVM6OeJEldql+TkPGiVlPdPzJOXDYp8tXg; 24:k7RB2NHo8VfV4Bh52KhwlnXyzBkwYXHQpKRGjGjyM7LuI9Rf/emggQqpfyY86gmWo8bA7ONj+RZ3XBfNnvGqtX/sRKF3n24q+tTSy2AVwPQ=; 7:VEUieubj+tCzBpxOi4EMoZVehooEOKXHkY2qBwoa4s54v/vqagwtmrilx8bol7d7kZYG2o/hvtCOh6uqZ6/L/NAfUGWN251ifv+/NqSxllKI/+m9nUi/YQDpmkuxF8a17Riz+Y2KbUZl0rNhQ+w9Q/1Tnz7gytVcqurqxmwl3wi0TltqpHgl+7fTeQTJHi/rjdubJ+AyniaAmZAY/UkePTqgkAX/QI+G/SSHp3S2hUo= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2016 15:20:33.8097 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB1312 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Peter Rosin --- Documentation/i2c/i2c-topology | 370 +++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 371 insertions(+) create mode 100644 Documentation/i2c/i2c-topology diff --git a/Documentation/i2c/i2c-topology b/Documentation/i2c/i2c-topology new file mode 100644 index 000000000000..27bfd682808d --- /dev/null +++ b/Documentation/i2c/i2c-topology @@ -0,0 +1,370 @@ +I2C topology +============ + +There are a couple of reasons for building more complex i2c topologies +than a straight-forward i2c bus with one adapter and one or more devices. + +1. A mux may be needed on the bus to prevent address collisions. + +2. The bus may be accessible from some external bus master, and arbitration + may be needed to determine if it is ok to access the bus. + +3. A device (particularly RF tuners) may want to avoid the digital noise + from the i2c bus, at least most of the time, and sits behind a gate + that has to be operated before the device can be accessed. + +Etc + +These constructs are represented as i2c adapter trees by Linux, where +each adapter has a parent adapter (except the root adapter) and zero or +more child adapters. The root adapter is the actual adapter that issues +i2c transfers, and all adapters with a parent are part of an "i2c-mux" +object (quoted, since it can also be an arbitrator or a gate). + +Depending of the particular mux driver, something happens when there is +an i2c transfer on one of its child adapters. The mux driver can +obviously operate a mux, but it can also do arbitration with an external +bus master or open a gate. The mux driver has two operations for this, +select and deselect. select is called before the transfer and (the +optional) deselect is called after the transfer. + + +Locking +======= + +There are two variants of locking available to i2c muxes, they can be +mux-locked or parent-locked muxes. As is evident from below, it can be +useful to know if a mux is mux-locked or if it is parent-locked. The +following list was correct at the time of writing: + +In drivers/i2c/muxes/ +i2c-arb-gpio-challenge Parent-locked +i2c-mux-gpio Normally parent-locked, mux-locked iff + all involved gpio pins are controlled by the + same i2c root adapter that they mux. +i2c-mux-pca9541 Parent-locked +i2c-mux-pca954x Parent-locked +i2c-mux-pinctrl Normally parent-locked, mux-locked iff + all involved pinctrl devices are controlled + by the same i2c root adapter that they mux. +i2c-mux-reg Parent-locked + +In drivers/iio/ +imu/inv_mpu6050/ Parent-locked + +In drivers/media/ +dvb-frontends/m88ds3103 Parent-locked +dvb-frontends/rtl2830 Parent-locked +dvb-frontends/rtl2832 Parent-locked +dvb-frontends/si2168 Parent-locked +usb/cx231xx/ Parent-locked + + +Mux-locked muxes +---------------- + +Mux-locked muxes does not lock the entire parent adapter during the +full select-transfer-deselect transaction, only the muxes on the parent +adapter are locked. Mux-locked muxes are mostly interesting if the +select and/or deselect operations must use i2c transfers to complete +their tasks. Since the parent adapter is not fully locked during the +full transaction, unrelated i2c transfers may interleave the different +stages of the transaction. This has the benefit that the mux driver +may be easier and cleaner to implement, but it has some caveats. + +ML1. If you build a topology with a mux-locked mux being the parent + of a parent-locked mux, this might break the expectation from the + parent-locked mux that the root adapter is locked during the + transaction. + +ML2. It is not safe to build arbitrary topologies with two (or more) + mux-locked muxes that are not siblings, when there are address + collisions between the devices on the child adapters of these + non-sibling muxes. + + I.e. the select-transfer-deselect transaction targeting e.g. device + address 0x42 behind mux-one may be interleaved with a similar + operation targeting device address 0x42 behind mux-two. The + intension with such a topology would in this hypothetical example + be that mux-one and mux-two should not be selected simultaneously, + but mux-locked muxes do not guarantee that in all topologies. + +ML3. A mux-locked mux cannot be used by a driver for auto-closing + gates/muxes, i.e. something that closes automatically after a given + number (one, in most cases) of i2c transfers. Unrelated i2c transfers + may creep in and close prematurely. + +ML4. If any non-i2c operation in the mux driver changes the i2c mux state, + the driver has to lock the root adapter during that operation. + Otherwise garbage may appear on the bus as seen from devices + behind the mux, when an unrelated i2c transfer is in flight during + the non-i2c mux-changing operation. + + +Mux-locked Example +------------------ + + .----------. .--------. + .--------. | mux- |-----| dev D1 | + | root |--+--| locked | '--------' + '--------' | | mux M1 |--. .--------. + | '----------' '--| dev D2 | + | .--------. '--------' + '--| dev D3 | + '--------' + +When there is an access to D1, this happens: + + 1. Someone issues an i2c-transfer to D1. + 2. M1 locks muxes on its parent (the root adapter in this case). + 3. M1 calls ->select to ready the mux. + 4. M1 (presumably) does some i2c-transfers as part of its select. + These transfers are normal i2c-transfers that locks the parent + adapter. + 5. M1 feeds the i2c-transfer from step 1 to its parent adapter as a + normal i2c-transfer that locks the parent adapter. + 6. M1 calls ->deselect, if it has one. + 7. Same rules as in step 4, but for ->deselect. + 8. M1 unlocks muxes on its parent. + +This means that accesses to D2 are lockout out for the full duration +of the entire operation. But accesses to D3 are possibly interleaved +at any point. + + +Parent-locked muxes +------------------- + +Parent-locked muxes lock the parent adapter during the full select- +transfer-deselect transaction. The implication is that the mux driver +has to ensure that any and all i2c transfers through that parent +adapter during the transaction are unlocked i2c transfers (using e.g. +__i2c_transfer), or a deadlock will follow. There are a couple of +caveats. + +PL1. If you build a topology with a parent-locked mux being the child + of another mux, this might break a possible assumption from the + child mux that the root adapter is unused between its select op + and the actual transfer (e.g. if the child mux is auto-closing + and the parent mux issus i2c-transfers as part of its select). + This is especially the case if the parent mux is mux-locked, but + it may also happen if the parent mux is parent-locked. + +PL2. If select/deselect calls out to other subsystems such as gpio, + pinctrl, regmap or iio, it is essential that any i2c transfers + caused by these subsystems are unlocked. This can be convoluted to + accomplish, maybe even impossible if an acceptably clean solution + is sought. + + +Parent-locked Example +--------------------- + + .----------. .--------. + .--------. | parent- |-----| dev D1 | + | root |--+--| locked | '--------' + '--------' | | mux M1 |--. .--------. + | '----------' '--| dev D2 | + | .--------. '--------' + '--| dev D3 | + '--------' + +When there is an access to D1, this happens: + + 1. Someone issues an i2c-transfer to D1. + 2. M1 locks muxes on its parent (the root adapter in this case). + 3. M1 locks its parent adapter. + 4. M1 calls ->select to ready the mux. + 5. If M1 does any i2c-transfers (on this root adapter) as part of + its select, those transfers must be unlocked i2c-transfers so + that they do not deadlock the root adapter. + 6. M1 feeds the i2c-transfer from step 1 to the root adapter as an + unlocked i2c-transfer, so that it does not deadlock the parent + adapter. + 7. M1 calls ->deselect, if it has one. + 8. Same rules as in step 5, but for ->deselect. + 9. M1 unlocks its parent adapter. +10. M1 unlocks muxes on its parent. + + +This means that accesses to both D2 and D3 are locked out for the full +duration of the entire operation. + + +Complex Examples +================ + +Parent-locked mux as parent of parent-locked mux +------------------------------------------------ + +This is a useful topology, but it can be bad. + + .----------. .----------. .--------. + .--------. | parent- |-----| parent- |-----| dev D1 | + | root |--+--| locked | | locked | '--------' + '--------' | | mux M1 |--. | mux M2 |--. .--------. + | '----------' | '----------' '--| dev D2 | + | .--------. | .--------. '--------' + '--| dev D4 | '--| dev D3 | + '--------' '--------' + +When any device is accessed, all other devices are locked out for +the full duration of the operation (both muxes lock their parent, +and specifically when M2 requests its parent to lock, M1 passes +the buck to the root adapter). + +This topology is bad if M2 is an auto-closing mux and M1->select +issues any unlocked i2c transfers on the root adapter that may leak +through and be seen by the M2 adapter, thus closing M2 prematurely. + + +Mux-locked mux as parent of mux-locked mux +------------------------------------------ + +This is a good topology. + + .----------. .----------. .--------. + .--------. | mux- |-----| mux- |-----| dev D1 | + | root |--+--| locked | | locked | '--------' + '--------' | | mux M1 |--. | mux M2 |--. .--------. + | '----------' | '----------' '--| dev D2 | + | .--------. | .--------. '--------' + '--| dev D4 | '--| dev D3 | + '--------' '--------' + +When device D1 is accessed, accesses to D2 are locked out for the +full duration of the operation (muxes on the top child adapter of M1 +are locked). But accesses to D3 and D4 are possibly interleaved at +any point. Accesses to D3 locks out D1 and D2, but accesses to D4 +are still possibly interleaved. + + +Mux-locked mux as parent of parent-locked mux +--------------------------------------------- + +This is probably a bad topology. + + .----------. .----------. .--------. + .--------. | mux- |-----| parent- |-----| dev D1 | + | root |--+--| locked | | locked | '--------' + '--------' | | mux M1 |--. | mux M2 |--. .--------. + | '----------' | '----------' '--| dev D2 | + | .--------. | .--------. '--------' + '--| dev D4 | '--| dev D3 | + '--------' '--------' + +When device D1 is accessed, accesses to D2 and D3 are locked out +for the full duration of the operation (M1 locks child muxes on the +root adapter). But accesses to D4 are possibly interleaved at any +point. + +This kind of topology is generally not suitable and should probably +be avoided. The reason is that M2 probably assumes that there will +be no i2c transfers during its calls to ->select and ->deselect, and +if there are, any such transfers might appear on the slave side of M2 +as partial i2c transfers, i.e. garbage or worse. This might cause +device lockups and/or other problems. + +The topology is especially troublesome if M2 is an auto-closing +mux. In that case, any interleaved accesses to D4 might close M2 +prematurely, as might any i2c-transfers part of M1->select. + +But if M2 is not making the above stated assumption, and if M2 is not +auto-closing, the topology is fine. + + +Parent-locked mux as parent of mux-locked mux +--------------------------------------------- + +This is a good topology. + + .----------. .----------. .--------. + .--------. | parent- |-----| mux- |-----| dev D1 | + | root |--+--| locked | | locked | '--------' + '--------' | | mux M1 |--. | mux M2 |--. .--------. + | '----------' | '----------' '--| dev D2 | + | .--------. | .--------. '--------' + '--| dev D4 | '--| dev D3 | + '--------' '--------' + +When D1 is accessed, accesses to D2 are locked out for the full +duration of the operation (muxes on the top child adapter of M1 +are locked). Accesses to D3 and D4 are possibly interleaved at +any point, just as is expected for mux-locked muxes. + +When D3 or D4 are accessed, everything else is locked out. For D3 +accesses, M1 locks the root adapter. For D4 accesses, the root +adapter is locked directly. + + +Two mux-locked sibling muxes +---------------------------- + +This is a good topology. + + .--------. + .----------. .--| dev D1 | + | mux- |--' '--------' + .--| locked | .--------. + | | mux M1 |-----| dev D2 | + | '----------' '--------' + | .----------. .--------. + .--------. | | mux- |-----| dev D3 | + | root |--+--| locked | '--------' + '--------' | | mux M2 |--. .--------. + | '----------' '--| dev D4 | + | .--------. '--------' + '--| dev D5 | + '--------' + +When D1 is accessed, accesses to D2, D3 and D4 are locked out. But +accesses to D5 may be interleaved at any time. + + +Two parent-locked sibling muxes +------------------------------- + +This is a good topology. + + .--------. + .----------. .--| dev D1 | + | parent- |--' '--------' + .--| locked | .--------. + | | mux M1 |-----| dev D2 | + | '----------' '--------' + | .----------. .--------. + .--------. | | parent- |-----| dev D3 | + | root |--+--| locked | '--------' + '--------' | | mux M2 |--. .--------. + | '----------' '--| dev D4 | + | .--------. '--------' + '--| dev D5 | + '--------' + +When any device is accessed, accesses to all other devices are locked +out. + + +Mux-locked and parent-locked sibling muxes +------------------------------------------ + +This is a good topology. + + .--------. + .----------. .--| dev D1 | + | mux- |--' '--------' + .--| locked | .--------. + | | mux M1 |-----| dev D2 | + | '----------' '--------' + | .----------. .--------. + .--------. | | parent- |-----| dev D3 | + | root |--+--| locked | '--------' + '--------' | | mux M2 |--. .--------. + | '----------' '--| dev D4 | + | .--------. '--------' + '--| dev D5 | + '--------' + +When D1 or D2 are accessed, accesses to D3 and D4 are locked out while +accesses to D5 may interleave. When D3 or D4 are accessed, accesses to +all other devices are locked out. diff --git a/MAINTAINERS b/MAINTAINERS index 03e00c7c88eb..d17afeb81246 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5274,6 +5274,7 @@ I2C MUXES M: Peter Rosin L: linux-i2c@vger.kernel.org S: Maintained +F: Documentation/i2c/i2c-topology F: Documentation/i2c/muxes/ F: Documentation/devicetree/bindings/i2c/i2c-mux* F: drivers/i2c/i2c-mux.c