From patchwork Tue Jun 11 11:43:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Farouk Bouabid X-Patchwork-Id: 13693563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 466CDC27C5E for ; Tue, 11 Jun 2024 11:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eBnrWhoQ0kUSVOkHSSYpa2HZYREm+5jJH82FywpE+jM=; b=Mlc8ki/JrSaXsT iKFOPe27r1xwbi6IEOMy5x85DqH/FxVSILXrMqJiHvLf8We63qPIfuQbvqoRV4w5w2ky4roWcdAPA MxFQM5HvVulNbMJ7WF7h2oNIqdNQilefB+tbLWWkt5n7zWEH26Z88mTHVYfgiUx8VbGXBrrdovtzK DoRxfiT0kzCyvSxNpbvmTypzIPLvjfUgQRaGSgLrq6veWf5dvXQ985UFlLYw7FbdMxU1eWXpQfSVJ AZRqzi3dI2PErpDJa6NmwNSLzFr0hS9Iak41bWov2hcloVEwRskYUdRKHo5IZuazjYPEvGfdzEcgE Msv0nCDmmLlC6gXRDtyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGzvu-00000008hpX-1VYR; Tue, 11 Jun 2024 11:44:58 +0000 Received: from mail-vi1eur04on2070a.outbound.protection.outlook.com ([2a01:111:f403:2611::70a] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGzvf-00000008hdo-2Xws; Tue, 11 Jun 2024 11:44:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FIwzp1xBaoLIX9UlPFqcux5zxUdACOrcOLrXKgnoTIr+qV7PpxVFPDSE3sFQHbP3JySePYD0JispBbnVKrpBRuhfr8zkXs9lxHGRAOgV3HEZHYkM132jnPsGLR7xuITjAMgo3WLzpFX/x2rd0axHRfXaj5DwN1DE9e7nDe9x9qM2ReHsnKQvdtSd8CMZ74ZhpJ05AOE85k5AAicXy1MdVSJJ5OUckkTQNdrKnDN7MIgeToNlUYWeld3Ad3dtkFQnujJQXxy2VW2qDy+B/yt7ak565cWSf7lYoOEUZDkD2er55dj9MQXkytGYzvjYIpDc/IfmLLftBDdIWb00q1jk5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C3l5J7jsz7J2az0lxLN9NeimRvs7dviCrrCG2dI7VC4=; b=ENOIc0VqOC1ewc2B6YNCEWWsAgqAH6+2EK8FmGYYcT2JUBw4LOer7Unh8wOTgXG5stDgpFdgWRr6phw+UPWobNyOX4wXSww/vBUCvOjlkvfV/l5HySpKhhHTmRxyXxnp4iihYdrLXSN5rwQWkskyb3VoPzylU/KRnpRjIlu54gHunjwgXCiFu5vpLPOD6KfUxHSdyjmoOgTwlgRjP8BdhnQOmHdyraeD7kUJFRVxiVR+J8CXNofZxZ71lxs1BdHQ6v+8v78DxPrbU63iVSyYtJrNhWoBE4vlWMCyh7LxjEgDsIRICLHBkqC/4O6JdSS6ueqB5BGc9ZBf/FzJjJ08ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cherry.de; dmarc=pass action=none header.from=cherry.de; dkim=pass header.d=cherry.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cherry.de; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C3l5J7jsz7J2az0lxLN9NeimRvs7dviCrrCG2dI7VC4=; b=aNHQmHki0p4SoSH/lkz0ZnG+0hD2WK4VeisYhDYHWQ6aqmgW31oZsJYWChUBn/cHb65hnTbeUH9cKN9sjKFHcKPdP0Yrv74pkYpgFnb14ffaH5U6jaNhdnE1qpH8fbtlqU+gk8i1tF989AnR8Bf21q6O5e05RZldsIe5+lEbBkM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cherry.de; Received: from VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) by GVXPR04MB10301.eurprd04.prod.outlook.com (2603:10a6:150:1dd::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Tue, 11 Jun 2024 11:44:27 +0000 Received: from VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::2a24:328:711:5cd6]) by VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::2a24:328:711:5cd6%5]) with mapi id 15.20.7633.036; Tue, 11 Jun 2024 11:44:26 +0000 From: Farouk Bouabid Subject: [PATCH v3 0/7] Add Mule I2C multiplexer support Date: Tue, 11 Jun 2024 13:43:51 +0200 Message-Id: <20240611-dev-mule-i2c-mux-v3-0-08d26a28e001@cherry.de> X-B4-Tracking: v=1; b=H4sIAHc4aGYC/23NQQ6DIBAF0KsY1sUAitauvEfjAmEoJKU0YInGe PeiadJFm9nM/8m8WVGEYCGiS7GiAMlG6x85VKcCSSMeN8BW5YwYYTXJgxUk7F733DOZlxl3lFR SAWkJoyifPQNoOx/kdcjZ2Dj5sBwfEt3bD8aaXyxRTDCpuajPTDdaj/1kwI/BO4HjEidwsZTeo R1O7Itx8g9jGRMdlR2vdcNV20sDISylAjRs2/YG8iWuIv0AAAA= To: Wolfram Sang , Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Farouk Bouabid , Quentin Schulz , Heiko Stuebner Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.13.0 X-ClientProxiedBy: VI1PR0902CA0050.eurprd09.prod.outlook.com (2603:10a6:802:1::39) To VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6382:EE_|GVXPR04MB10301:EE_ X-MS-Office365-Filtering-Correlation-Id: d76bb88e-df4c-44d6-d9ca-08dc8a0bd800 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|52116005|1800799015|376005|7416005|366007|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?C14yF9J7KCYRn+pzETGAdTCBLLi5rLZ?= =?utf-8?q?LqWuKy3Us8KbOAh+7e2DOncF2/lWU5Uuz0tbYgodJ7cA3huJqZrJsdzfjoP8O4Mq2?= =?utf-8?q?35+uxGwZFwLdAi496MvCIOWw63FwmCZ1yEv7mCPWZJD7ujaMhuQE/XVItkf2WvO1h?= =?utf-8?q?w9cRJGrE/6LkoqSmFLYEhIpUN8+0vA6zAa9+55SGgWWr88SXHBzJ8Kcfxe9ZmVAOX?= =?utf-8?q?4/v0eBrl5FdRWpD1prM09WkpTMRco3AiYhp9I68zWjeHrr4iWchwWb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S0kmD9m5R?= =?utf-8?q?XsZeLSSDA6n7YFv8G9W9Y9OVxXKYfF15UGjhfMpfolQMlO+vVgnnW9853DIXG+7pI?= =?utf-8?q?jhnhAU/n2aATX871TniTE1uYNEtWCpvlRUF0CJlP8qjdLkKWegurA7PIt0gD1Vxke?= =?utf-8?q?fyMFiNjysPUjCbCqAly90GYf7OLy+mI63LhbyosHh0GVwZeKk/9P7kIc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6382.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(52116005)(1800799015)(376005)(7416005)(366007)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4Y82Eed06+po5KUETPMp+0sH78cZ?= =?utf-8?q?iurqKgUA9q3DzgNcBsW42eCG8N/A6S4B0j3JkhVn2yYjuyakweUFbgYm6+KL/Y14J?= =?utf-8?q?nGPjDLCTVN+tqLefR3EXwROF0W8HRdKkp1VccHPFwlgK+ZLt/LFaF1zjPmgENy+D6?= =?utf-8?q?OvCTTos1wlGABqdoTkrQH/ABcoORyzlQHM5ub+fi+KnOG6qm64IWQNVSBJDlSNhHq?= =?utf-8?q?zPaJf3UTAWFqIqNNzPnxjRwgIvY3QlIGVk1B8yr+7UlaDwI6llrZJMT63JR5MsmoL?= =?utf-8?q?XTm+hFJoIqHO9jDkFMHFSsXH4YwjVZdmF2kw0gOLI3EramWZqyf8zRyUoSSR1tbgw?= =?utf-8?q?0UEKQu7fe1n+0SSJSi/kCNuWaRr9J8nYvqng2ZipfP8DilpLlmj2XjwixDyb8ynvg?= =?utf-8?q?c60+q8wazuCdYAW+4bCxqCMrlxfGmazpTSdofznZPE1FD0qmKOurZHR0LhY/Zx6V/?= =?utf-8?q?e9MmuM+cA+HS3MktppNFlxHdvq9l924IaVvhS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oZwrM0gA3MWRTCziIZT70tMsIqBrn?= =?utf-8?q?UdAIqaTGFsMesLgdwBwiggXsE5T+mMZdnhrXNlI7e2SrQTteBowOlyO3BbZzQWMyQ?= =?utf-8?q?w55rqx4uKycCfv0I7XhJb1paRrdHyzhcTHB0tVyQ4h9sVLD0ZKczG9FoAIndIFo+F?= =?utf-8?q?jWGX8Q2iRj8Hn0guQbdueX3yAFyjJRTNtA=3D=3D?= X-OriginatorOrg: cherry.de X-MS-Exchange-CrossTenant-Network-Message-Id: d76bb88e-df4c-44d6-d9ca-08dc8a0bd800 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6382.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2024 11:44:26.4214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5e0e1b52-21b5-4e7b-83bb-514ec460677e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QTBXPe6yDMJhYdd54Z8KrWpa/1lG6pQGFYWPyHcf1a9colxdfryYU8J20jhlLJD4SiD+jsPE2ynCUeMg0fVZ5WVUAI8o9Hh7p5G+JCBnenY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10301 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_044443_787661_711D0F3B X-CRM114-Status: GOOD ( 14.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Mule is an mcu that emulates a set of I2C devices which are reachable through an I2C-mux. The emulated devices share a single I2C address with the mux itself where the requested register is what determines which logic is executed (muxing logic or device logic): 1- The devices on the mux can be selected (muxing functionality) by writing the appropriate device number to an I2C config register (0xff) that is not used by any device logic. 2- Any access to a register other than the config register will be handled by the previously selected device. +-------------------------------------------------------+ | Mule | | +---------------+ | ----+-(1)->|Config register|-----+ | | | +---------------+ | | | | V_ | | | | \ +--------+ | | | | \-------->| dev #0 | | | | | | +--------+ | | | | M |-------->| dev #1 | | | +-----------(2)------------->| U | +--------+ | | | X |-------->| dev #2 | | | | | +--------+ | | | /-------->| dev #3 | | | |__/ +--------+ | +-------------------------------------------------------+ The current I2C-mux implementation does not allow the mux to use the I2C address of a child device. As a workaround, A new I2C-adapter quirk is introduced to skip the check for conflict between a child device and the mux core I2C address when adding the child device. This patch-series adds support for this multiplexer. Mule is integrated as part of rk3399-puma, px30-ringneck, rk3588-tiger and rk3588-jaguar boards. Signed-off-by: Farouk Bouabid Changes in v3: - Change "i2c" in comments/commit-logs to "I2C" - Fix long line-length - Warn when "share_addr_with_children" is set and the Mux is not an I2C device - Fix/stop propagating "I2C_AQ_SKIP_ADDR_CHECK" flag if "share_addr_with_children" is not set. - Fix "old_fw" variable is used to indicate the reversed meaning. - Link to v2: https://lore.kernel.org/r/20240506-dev-mule-i2c-mux-v2-0-a91c954f65d7@cherry.de Changes in v2: - Add i2c-adapter quirks to skip checking for conflict between the mux core and a child device address. - Rename dt-binding to "tsd,mule-i2c-mux.yaml" - Add Mule description to kconfig - Fix indentation - Move device table after probe - Link to v1: https://lore.kernel.org/r/20240426-dev-mule-i2c-mux-v1-0-045a482f6ffb@theobroma-systems.com --- Farouk Bouabid (7): i2c: mux: add the ability to share mux address with child nodes dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer i2c: muxes: add support for mule i2c multiplexer arm64: dts: rockchip: add mule i2c mux (0x18) on rk3399-puma arm64: dts: rockchip: add mule i2c mux (0x18) on rk3588-tiger arm64: dts: rockchip: add mule i2c mux (0x18) on px30-ringneck arm64: dts: rockchip: add mule i2c mux (0x18) on rk3588-jaguar .../devicetree/bindings/i2c/tsd,mule-i2c-mux.yaml | 80 +++++++++++ arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi | 20 ++- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 20 ++- arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts | 19 ++- arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 19 ++- drivers/i2c/i2c-core-base.c | 6 +- drivers/i2c/i2c-mux.c | 48 ++++++- drivers/i2c/muxes/Kconfig | 18 +++ drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-mux-mule.c | 157 +++++++++++++++++++++ include/linux/i2c-mux.h | 1 + include/linux/i2c.h | 7 + 12 files changed, 384 insertions(+), 12 deletions(-) --- base-commit: 79c1f584335af42ce359ee3ff0f4e9cc324296ed change-id: 20240404-dev-mule-i2c-mux-9103cde07021 Best regards,