From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C092B43F4A7 for ; Wed, 8 Jul 2026 12:16:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783513018; cv=none; b=Upj//N1N/KQqWxQ7QuwaXSJhI1emh6m9u/1aKqMHXaQPVzrNSAZCQtSCKQ4EjwFCNxhFE75Awd4jy98NJe05BeQHnGnL7i4UETIDSfm1cIM5LLCvG9L/g2FD5xIY0h6SWa64fQHqiDpEJLa0OPrNJO6eWWGRlp5JigbX2p7XUjU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783513018; c=relaxed/simple; bh=B2YqMrgTja5ulsdupqJSWKQwHmegjD8Hbyvf0CUQZgg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SK8BhCe57upqg48bTafYAdqMohVGt36Jo0MQ4hWm0Zudzaq5zzVRxdzlUrs+icippsbjPc/X+IVeFeKdybK6a4mI7Y1K2UDlvtUtyDgsYQWI/SUr203ViR/xIef9SSu+cKgkJ9j0w7VHfMq0/p8IdkZn5kNajMiQVpf4DOac954= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C+a7bQfo; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C+a7bQfo" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5aec139da7eso854308e87.1 for ; Wed, 08 Jul 2026 05:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783513015; x=1784117815; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3nOkF62GGkmnVWUbbVUdf1e4ZunQyMCemxV0335qyJ0=; b=C+a7bQfotVEOX2jDrmF2Wyht1iKjMACnw0Pqe/iWtp6WmPM7XmG08/9PWjzd8gXBkJ Fcfqww3CvqRvN16JQWC7LLOdSt4cGNPMPBVaCHV5bcHWecwF3uOc99GvBes//qoJyl3h b2BTZZ/vZaw0C3yNPzvk1jvtoWI2UyTfjwSjvUxTeF0awjkiWUy2ZM+YRrQy9Icm9UGI qtn8N4/Qw7DH24fcjfrFYfGBD71ZrHz+bh/pUr6i/3M8ObARfpmSDMk0yVB+uP/wBw1G s5A7oBq+JDmRC/pBaoPPsC6k2Xa5jyxwhvKelL/yeiZzRGS/wqVpcveAxn5ddXLRTc2F KJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783513015; x=1784117815; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=3nOkF62GGkmnVWUbbVUdf1e4ZunQyMCemxV0335qyJ0=; b=hOhxLsv0wcifwLfXOrQxNZa7Y/CLzOvhWP2XjyidWFx3wD2xWB54G76eZFOMsf3FbI wUxn4SoucQcfGuMNt6w7sOh86ndNpONtEjZbXtSQhsy900vMG38dm6/PknIV+HciHlTP wpBTZ+he8W7w2GOQ0LzjpT41c7x4Q9Hr8/c2T/SQddFFBfRaRldgYH5LVtMNkyLRF6eH zLY4Vco2a1G+V1o68Jcy9stm74EoGWZAVGqasQGWR8G/Nad9wgds1w5BfBMK4Lv2nYs/ rxVgNo5dQjwm/+EQyjcuR8lggkLl7uSxu+CCmhEl4n3sNp2/ChT5Ma6R+/xReHJ1klY7 Ipdg== X-Forwarded-Encrypted: i=1; AHgh+RptcDU1yONsn20g/GWfEDLLFJ3tjGqDOFB0/ZcfBqGq8JTiwDIX8rZfyr7XimSECnvlBdUOZ0NKhANJ9pU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4DjbKOX8sMpGhYiuUED3zxB31aEtDnMtSRZlsaywJ6/HqAhx7 fxLQTg58kyNMrvbGfGVkeY+b+fpUr70+7Q5/5PfLPMXLGLcuhM9R8hTvI1F9UcCdFbQ= X-Gm-Gg: AfdE7cmDJyd+7kzEDto3xzTIZzAyiQ84elXt+d9byy08T5pqpkMivsljpZO0pTa7CQy 1dJOVbWJYLNC4EAY5Xj5lSxOr318XbsPqEz2konzVO1DaO31fe2y+44G3Q+8z3q+eJON1lMnPZO CWKYON/ZhV3hhnUMGTIvfGXT3QmoxLP3hqD0qeD0dlpBDYkomoMgef1oGASq7eemAjyCwxjjuLq HiZf7P0QD1UhOR/1l2uRFKgk+lsnEhpDsSvLuj8B2JTqQImHyQ5uZ3PCKFA8Cwu4ne8AzfO+LB9 VZmIdICB4RkOMe5JBl6l3GYSLhv6LJNobveTk8zj0b9essIGIOFSS4oIyYz+agcj4Q3uxtNpEYP aYKkJy7nqlFBI+AoxZVmJN/psWJPDTkbCIiN6RZYaC9YJEfFn+lEvYM+7vTJvJfMqns7K8128aZ RlrqLY1KwbAKrwlzr2PU3KZ+1xCJtrsGWf+iQV58Y9cVcNXhnAENj7duyIEA== X-Received: by 2002:ac2:5683:0:b0:5b0:1186:fdf with SMTP id 2adb3069b0e04-5b0118611f4mr492063e87.11.1783513014814; Wed, 08 Jul 2026 05:16:54 -0700 (PDT) Received: from [192.168.1.135] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aed13bbbc6sm4471459e87.41.2026.07.08.05.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2026 05:16:54 -0700 (PDT) From: Marcus Folkesson Date: Wed, 08 Jul 2026 14:16:19 +0200 Subject: [PATCH v10 7/7] docs: i2c: i2c-topology: add section about bus speed Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260708-i2c-mux-v10-7-09dca03c8a15@gmail.com> References: <20260708-i2c-mux-v10-0-09dca03c8a15@gmail.com> In-Reply-To: <20260708-i2c-mux-v10-0-09dca03c8a15@gmail.com> To: Wolfram Sang , Michael Hennerich , Bartosz Golaszewski , Andi Shyti , Andy Shevchenko , Bartosz Golaszewski , Peter Rosin , Peter Rosin Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marcus Folkesson X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=8176; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=B2YqMrgTja5ulsdupqJSWKQwHmegjD8Hbyvf0CUQZgg=; b=owEBbQKS/ZANAwAKAYiATm9ZXVIyAcsmYgBqTj+yr2pwt5lVtroAp8VDBRH+NqX49PDfsesyg 0Wh/Blhy2yJAjMEAAEKAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCak4/sgAKCRCIgE5vWV1S Mg8wD/9ABbtsHUAOFktSFiaBdhhQAAVcESIYxsb+v6Njqy8dAHR+ruwntlOOlqtYh9++TrZB/RV NmWUf/GklA80YVa38NVOrIVMnj2G1GMPVRWxtCgiJ4l1JyGlsdc/0o2xhBn0rLbEawQGkNNv9Us k3D+creFYhcDe+CDC/cBlzI5oRKM5mEEJd7vc0joRHqvHl/PWSKl+3oXmDS4zieAD+jOmsm9kcT 7/EpO8UQ+zNkyNesCQg542zfUdbmCZhi01Rz190WtTBo9W8p9uJxxJ5YSpoJvybwXVu71z9O03x tG/EGUnk2BfMq91n6leisUR0lvS7SQHiDv9ndVyYgBiwoH0QQ+5KFeIEwJslweUlZHrqS+ddOtR DUVjdsM01EVErte9AyYIaon/N1Kr9JezkcVV2Nieu7h/TMvClKRMcmTEx8ubinNiYy8rOulYDFg eEKY8pGfNFCJgqCsiskGusai+sW4xJDgFhhcjREbHkCzEITUDDhS9Pogs/g6x2/zlN5wNPkN1ih pjqDFW4qdeS2Putl61+amGIqjmqSOZgRJxlZ2LPJ/nZB63Le2U3b4SB0TI/n6CXkptjfiwltd5h pJeNF4EYMR8AWZJZ/ehc231EOvBwp2e/eT9K3TXTdS2O5+C0dvdDNSyrUR0hCynv2BmxryxUGjb zHcAfC2GKvOucOQ== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 Describe what needs to be consideraed and taken into account when using different bus speeds for different mux channels. Signed-off-by: Marcus Folkesson --- Documentation/i2c/i2c-topology.rst | 178 +++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/Documentation/i2c/i2c-topology.rst b/Documentation/i2c/i2c-topology.rst index 48fce0f7491b..1ee0de6dbcb4 100644 --- a/Documentation/i2c/i2c-topology.rst +++ b/Documentation/i2c/i2c-topology.rst @@ -367,6 +367,184 @@ 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. +Bus Speed and I2C Multiplexers +================================ + +I2C bus multiplexers allow multiple downstream channels to be exposed +as separate I2C adapters which also could set their own bus speed. + +The multiplexer itself cannot change the bus speed as it uses the upstream +clock and data lines to communicate with the downstream devices. The speed +is therefore changed in the root adapter resulting in that the whole bus is +affected. + +This increases the complexity of the topology and some considerations must +be taken into account. + +Bus speed +---------- + +Downstream channels of an I2C multiplexer can only operate at the same or +lower bus speed as the upstream bus. This is because the upstream bus may +have devices that cannot operate at higher speeds and those will be affected +by the speed change. + +The example below illustrates the problem. +The root adapter is operating at 100kHz. D2 can only operate with 100kHz, +but D1 can operate at 400kHz. When D1 is selected, the bus speed of the +root adapter would have to be set to 400kHz, a speed that D2 may not support. + +This topology is therefore not allowed: :: + + .----------. 400kHz .--------. + .--------. 100kHz | mux- |--------| dev D1 | + | root |--+-----| locked | '--------' + '--------' | | mux M1 | + | '----------' + | .--------. + '--| dev D2 | + '--------' + + +This topology is allowed: :: + + .----------. 100kHz .--------. + .--------. 400kHz | mux- |--------| dev D2 | + | root |--+-----| locked | '--------' + '--------' | mux M1 |--. 400kHz .--------. + '----------' '--------| dev D1 | + '--------' + +Preferred topology +------------------- + +The preferred topology when using different bus speeds is to have the multiplexer +connected directly to the root adapter without any devices as siblings. +By this arrangement, the bus speed can be changed without affecting any other devices +and many of the caveats are avoided. + +Other multiplexers in parallel are still okay as those are locked out during transfers. + +This is the preferred topology: :: + + .----------. 100kHz .--------. + .--------. 400kHz | mux- |--------| dev D2 | + | root |--+-----| locked | '--------' + '--------' | mux M1 |--. 400kHz .--------. + '----------' '--------| dev D1 | + '--------' + +Locking +-------- + +If the multiplexer is mux-locked, transfers to D3 may interleave between the +select-transfer-deselect to D1 or D2. +This results in a situation where the bus speed to D3 may be lower than it +is supposed to be. This is usually not a problem. + +This topology is allowed but some transfers to D3 may be at 100kHz: :: + + .----------. 100kHz .--------. + .--------. 400kHz | mux- |--------| dev D1 | + | root |--+-----| locked | '--------' + '--------' | | mux M1 |--. 400kHz .--------. + | '----------' '--------| dev D2 | + | .--------. '--------' + '--| dev D3 | + '--------' + +Multiple muxes in series +-------------------------- + +When multiple muxes are used in series the same rules apply. + +Transfers to D3 may interleave between select-transfer-deselect to D1, which +results in that the bus speed to D2 or D3 will be at 100KHz. + +Transfers to D2 may interleave between select-transfer-deselect to D1, which +results in that the bus speed to D1 may be at 400kHz as the transfer to D2 +will set the bus speed to before the transfer to D1 starts. + +This is probably a bad topology :: + + .----------. 400kHz .----------. 100kHz .--------. + .--------.400kHz | mux- |--------| mux- |--------| dev D1 | + | root |--+----| locked | 400kHz | locked | '--------' + '--------' | | mux M1 |--. | mux M2 | + | '----------' | '----------' + | .--------. | .--------. + '--| dev D3 | '--| dev D2 | + '--------' '--------' + +Multiple muxes in parallel +---------------------------- + +When multiple muxes are used in parallel all access to other muxes are locked out +so this is not a problem. + +If the muxes are mux-locked, access to D3 may still interleave though. + +In the example below, D3 may not interleave between select-transfer-deselect for D1 +or D2 as both muxes are parent-locked: :: + + + .----------. 100kHz .--------. + | parent- |----------| dev D1 | + .--| locked | '--------' + | | mux M1 | + | '----------' + | .----------. 400KHz .--------. + .--------. 400kHz | parent- |---------| dev D2 | + | root |--+------| locked | '--------' + '--------' | | mux M2 | + | '----------' + | .--------. + '--| dev D3 | + '--------' + +Idle state +----------- + +Muxes have an idle state, which is the state the channels are put into when no channel +is active. The state is typically one of the following: + +- All channels are disconnected +- The last selected channel is left as-is +- A predefined channel is selected + +Muxes that support an idle state where all channels are disconnected are preferred when using +different bus speeds. Otherwise high bus speeds may "leak" through to devices that +may not support that higher speed. + +Consider the following example: :: + + .----------. 100kHz .--------. + .--------. 400kHz | mux- |--------| dev D1 | + | root |--+-----| locked | '--------' + '--------' | | mux M1 |--. 400kHz .--------. + | '----------' '--------| dev D2 | + | .--------. '--------' + '--| dev D3 | + '--------' + +If the idle state of M1 is: + +- All channels disconnected: No problem, D1 and D2 are not affected by communication + to D3. +- Last selected channel: Problem if D1 was the last selected channel. High speed + communication to D3 will be "leaked" to D1. +- Predefined channel: Problem if the predefined channel is D1. Set predefined channel + to D2 as D2 may handle 400kHz. + +Supported controllers +----------------------- + +Not all I2C controllers support setting the bus speed dynamically. +At the time of writing, the following controllers have support: + +============================ ============================================= +i2c-davinci Supports dynamic bus speed +============================ ============================================= Mux type of existing device drivers =================================== -- 2.54.0