From patchwork Fri Oct 18 10:03:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wojciech Siudy \(Nokia\)" X-Patchwork-Id: 836877 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17381201021; Fri, 18 Oct 2024 10:03:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729245831; cv=fail; b=J891GzGC+8hHmCKPc3pe3ruuPduwWovGvOVR6zDQAqXgct0tAMnSz0TJ3qyvg9/h/a7HCtYYJenyAN9KOg9l/cc/YRXhCJeDPPrnbmo6vm/tTflImKy7nJYDJ8LbM9FijhVT7zZ+f2E7iOz/nqmqCagKI/Fq4I+Td3fXMnniyNg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729245831; c=relaxed/simple; bh=TmnMzh5c92yUSze13ZCLbShm5qzaX6KO8OFnYi1pCiE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XrMu+ZYsFdC//L1fcPHUXI34KYNckBGIpwuOt3xzAfWHP3NHSfw+NmKXWb4DQqYB23jyUrpNe8vw2h/MM+rALDhWemRaIgdMOidMhu78jHrcwVg59IDX8zSV8AT2sjCrixX9dsc0yg2vdVH/f1tniTvSDBLVjF1EXMKe2uPOkhA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia.com; spf=fail smtp.mailfrom=nokia.com; dkim=pass (2048-bit key) header.d=nokia.com header.i=@nokia.com header.b=ODXLg/EP; arc=fail smtp.client-ip=40.107.105.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nokia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nokia.com header.i=@nokia.com header.b="ODXLg/EP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H6JIGUmMU2mZ4jiSNyV7wTfJZ9cewFQOnn5gKZMWcb8cA8RE9wW9QZkB/3iaAWsSPOi7vuoBKx3qrDlaQRULMm52FQzydsHnvJS9HTXVkdE4KGPop7nOzeXb9duz2L6jdQ5rMvIREvAvcVhUwOHpBX0IP2191HNVpFvUFaf/Ooj+KWHq0iZlfp9/CUB8JeoUasSRWvo6b4LM9/EEsnJO+CmhN0DccKb0dRKOI9c8goTLLEAWvp/nujRcNK5FF+PsyH3bKl4c0YrUeOo+W90yhWaFtyuj1z731JYOS2/5FvBavIcexCxyxeG1UE0ovyWB3u4Yey3r9n3k6PNTgwjYXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jjQMURV4gQr9pJT+tqUBIwCq/AgQXF2fe5c2d0d+RMA=; b=RmBm1XRb4+ppZpBZ8rcUmuRVWbF1eLauEzNRiaVNXiT2yYerKRVVnRKPE0bgDgD2Rm9G0aMkLCupCxG0OkJFO3kjmcuusFEdDRntV/sdeV8teTu4/ZpiatAriOgJ5uLP5Ge8hFlB0i/NddZ8YwDchWtKcccaxx4u7fkhbYqE6S5PfFcEBjHxpLs20v8iaF2eAROnCU9q2w9+yWQS14ZhEjxtWECopco+naD6qgt6ZMnlpNjnoETtk7RsvcPppoz2ZGGuXYz6DvyGtJEz1MElQNVblRa68/UBtdP4MjsWIpAeKxG10WDilDNqiuu+1XAXdnT75+tzrQfiJ5eNU0HPmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jjQMURV4gQr9pJT+tqUBIwCq/AgQXF2fe5c2d0d+RMA=; b=ODXLg/EPEyz+JF3BwU1t80iCOLDY0q3AZo9kR39x/jK5El1w23Cne0NHXF3DdB/9eTyin6d/yrbxeRCGDWtufgmfbigKdVjpJScLopHDsj5SuqCoCvC766leFby91DF7kVDEFZE4spQMunY34f9Tv/CiW7mWviROVC8B/0zxsSGDYvx8V7n+OWPMKi/y1nt74sSwwbpTgAjmJPeT18dLymA26v4z0r5D5BT4KMCwCi3BOd62OaTzglVbn9ntS/0EoPX9KQWW90uNWTY+QnwNq2MgMj3ClBFMLm/HD4rcbm96ilD2+R5rlfbx0MC4xsNpxaIpNpYoXXd2pLDphQIM1A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from DB6PR07MB3509.eurprd07.prod.outlook.com (2603:10a6:6:21::16) by AM9PR07MB7139.eurprd07.prod.outlook.com (2603:10a6:20b:2d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Fri, 18 Oct 2024 10:03:46 +0000 Received: from DB6PR07MB3509.eurprd07.prod.outlook.com ([fe80::5484:a966:1322:f78b]) by DB6PR07MB3509.eurprd07.prod.outlook.com ([fe80::5484:a966:1322:f78b%4]) with mapi id 15.20.8069.016; Fri, 18 Oct 2024 10:03:46 +0000 From: Wojciech Siudy To: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org Cc: andi.shyti@kernel.org, peda@axentia.se, Wojciech Siudy Subject: [PATCH v5 1/2] dt-bindings: i2c: pca954x: Add timeout reset property Date: Fri, 18 Oct 2024 12:03:37 +0200 Message-Id: <20241018100338.19420-2-wojciech.siudy@nokia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241018100338.19420-1-wojciech.siudy@nokia.com> References: <20241018100338.19420-1-wojciech.siudy@nokia.com> X-ClientProxiedBy: FR5P281CA0059.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f0::13) To DB6PR07MB3509.eurprd07.prod.outlook.com (2603:10a6:6:21::16) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB6PR07MB3509:EE_|AM9PR07MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 006aea6c-8a39-4b8f-c9fa-08dcef5c27b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|10070799003|376014|1800799024; X-Microsoft-Antispam-Message-Info: y1Xs3Y2IOZDFXbMVscJKOWY+/SsiPLS3MMcckjILeTo4XolYymv8JrLmRvLd7HTFxSwR1MY2JWv5VXhczCtISBZqogfAtGDOCfzifOPN/IhbMfWMFL6kCXeP6eAFv1ovbBpuMvJHOqWbVvr1bgzqdqoD5af6XmXGoNB5vbD1JTh/rI2FgfvHbAxbg7qerJZyCzoPl2iBJHL9NnniXQLYnl3d/89WgCZcBtW1N/sjCGVNRDmor568ak5NHG/5Rjas63TQqqQmaEbXRQkg1rk/65YhtnCip3cVKGbTh5lW5RXnI/V1Q9jQwntFNjoRNDEqcghCaUmjNYPdXShXldgWBp5c4A3AhAPcn8+94uqMtuq/ubf73nA39YXgpzSpx+MynFuGZnTAP/2GudNxfTBeld4+Mf5EwpMGBeT2yWTxYWgKR7EY14IAZt/OmiwT3OEAszw40XDEIjZdBJS8eeG6SEghR0enLiYSm9ewVPaKWdbxx1SnBStGKWAcJyjFEvUrPN9FnnYtRj+5z6bq/tGGwtaHCGzXo8G0RYB3cFJ9PHiR9AJees8nwkh6Sy3tptzObZfVvG+RhTo6r0chXQVeza1zYGzpB9GBiwc2AAZs4AGHMI9bg+OpZDBjxZUtt5xpj5kXRXlV0WLjjlaW7r3fH9+tZEEn9jl0adyc8wTdC+ETQ3Sdhv91oGOoxeBCvNG4uauhrG/4p3PbFM+DAinCTqP70MWe2DV08FmUBOmnuopqf9z61564vgm4CE8DR/2i++UbJ5OPgkr/EFnv0LnOM3kNVtYZ3zAe4gItrd2zYaBH/qaPUfQnkur2peNlzbgVIUBQoOdzy86iD8HScqdeqhlX8LtokL/gwm2Ot0Qbi0TB6Ge3xqxSYylMwOQyV0KWVvI+gG7bUEX8Tkb6+scsNHg7ZkoM3St5kyfTyMLCwnEiU4upa3bUKVS8t/3aA+HCK5Xa4eL8CruR0QNp3i2mYjgmIlbIu9qTERIu1cvUlHykocqd/UniUPYwoN0eafkCzEuAHwB55rcItCE1nBRYl6RQq4fSdnQ6BTn6A8643TwMrYwHsRFGrCPY+2XFKMtI2HX1DHh8U3Ow+O6qgD4vTWTQbMEnKoXRGFlp36P6BAEkKN0uOWsmDAF5AFwB1n3vYkEHsx21WXYhd0lUUpFc+w5XXoG8CovLCmPFqvzIIzFqD2E+/eeBN0qAw4LULvS+qLs6q1pHFVwCY3qcjTROXupSRC7/cZTqgayr1BFRXXGVDOM2sGutxHB2Dh5H3mGWKhRxcMz5T8UytMvRnv1WClC3Pff+kisqFBSW2+kBuF4mnsj25DOwIjtMzjbN3Isv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR07MB3509.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(10070799003)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-A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sXOBViwjPhGl4Zn1pix5bkmtDKhwOH+N7nTIX6/41Xklgfah7eEf4DRSk2E7sSwa6EspGlrCv74GJGqobmSMoTHuXxuapC70gBr2EqIpd1x35K/F31tWUacGFz3Wga6dvMEBtUTJEuEl1eIoGfSwimjykiH6ozaPpput79JtAsZ2p6beojw8lTRcEnQPxFGryC/HAkjIIAzpumq2gqNrKlmOfdqNLwUe0gAZmmwMCLCW1wKA/ctWXF+AG9sgebNYNZFFxXdTyq7JT4W3KHy8xFUxBBzH35sV7xFhYtR726dvtKsDRA+Ur56zQjOTvm2213gudyNdK+X5VNnEJkzI2ykn4NSyTa6d9SQOpkulFYWot7ce8e+9wpYQdevN3BCS1MCcpNMRXNBQeLCB/eSGCPmqY2V30Znmv3+6mgrL7Hp1LLEg1uTsdyz6UR5EiFXZkwj2Tsi9G886xS7hq1b+UAaEwCdD3u6VhEny43enLCJRQxacJRtHy+/b3TQNA26MNxP8y8EP5tGP2ZEq5Sssq8K4DYkW195t2i7V7aV8oPi8RwfRlD9xZo1bTQ1LAG2256EmbWZr8zI60bz+nG4OL6n0ZiDV4IFGlLU3G7LAjCfCk1MiDMtQ2E+j0aX8npUtcTzPcVh4sdbkyfmO29DtLqBQ== X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 006aea6c-8a39-4b8f-c9fa-08dcef5c27b7 X-MS-Exchange-CrossTenant-AuthSource: DB6PR07MB3509.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 10:03:46.3068 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VQa/mNbZH4+mPpalAGijuw/V5pHMufmSPy6SstFkx1smGY8h1aqx9os0KLZBfkZsJ6kvOVi2hjSdE4z8pcDEJ6bOWXkdXhK/wf4A639GXlk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR07MB7139 For cases when the mux shares reset line with other chips we cannot use it always when channel selection or deselection times out, because it could break them without proper init/probe. The property is necessary, because reset lines are board-specific. Signed-off-by: Wojciech Siudy --- Changelog: v5: * Declare dependency of a new property --- .../devicetree/bindings/i2c/i2c-mux-pca954x.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml index 9aa0585200c9..37882a5a8c87 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml @@ -63,6 +63,11 @@ properties: necessary for example, if there are several multiplexers on the bus and the devices behind them use same I2C addresses. + i2c-mux-timeout-reset: + type: boolean + description: Sends reset pulse if channel selection or deselection times + out. Do not use if other chips share the same reset line. + idle-state: description: if present, overrides i2c-mux-idle-disconnect $ref: /schemas/mux/mux-controller.yaml#/properties/idle-state @@ -88,6 +93,9 @@ properties: register activates a channel to detect a stuck high fault. On fault the channel is isolated from the upstream bus. +dependencies: + i2c-mux-timeout-reset: [ reset-gpios ] + required: - compatible - reg @@ -146,6 +154,9 @@ examples: interrupt-parent = <&ipic>; interrupts = <17 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; + reset-gpios = <&gpio1 27 1>; + i2c-mux-idle-disconnect; + i2c-mux-timeout-reset; #interrupt-cells = <2>; i2c@2 { From patchwork Fri Oct 18 10:03:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wojciech Siudy \(Nokia\)" X-Patchwork-Id: 837247 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E8E32010FD; Fri, 18 Oct 2024 10:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729245834; cv=fail; b=MmZNc2YPEz08RpFUFIPlAw18+gXeD8kb2rH5tTfYzOYdiM1ZpF/KJQoewV3LZej+8LP8mazFGFgZOFwrYBMF/SfU96uU6NdefISd3fGvLyDKDt3jTTy3PSFBebTRVm0pT4G7bDvVqrLeQSFOuEdhqxSA8Q0NdaRZbOSwcIm39yE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729245834; c=relaxed/simple; bh=LNhmIES5S0z8k2yTMe5Po9x384W4HWq8sNnc9AzDlbk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BYxgtNRR5S30xtTzrrZYkuMHnDQWwYUtf+c+w7YbsewOkM1oNcCz9K/ZTPuCuRTLk1I+7mO6Btf3FDvc1wdQPCnAjs58Qrzt7Dl+GJgg0d0OeLf+3l8jvB65rspiJr68ENW+JX98OUd9fa31JxOK7N934OV4f5KlAOrgQ4cnhx0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia.com; spf=fail smtp.mailfrom=nokia.com; dkim=pass (2048-bit key) header.d=nokia.com header.i=@nokia.com header.b=XXL8QSdq; arc=fail smtp.client-ip=40.107.105.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nokia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nokia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nokia.com header.i=@nokia.com header.b="XXL8QSdq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KhlIdSG5ucik1Blx5SOvPAns3HjRDgpVwOQ7s56jTyPZAbzYT/ZYhUZBBTyR1eRgbtGiK/lPfYxX48mhyzrPFJOa4Im2TAnnDgNcHgUGNiEK4bYL2csRyWYmd7eS22nZXhgXOmI5E/iLrMvOa2mWHwSR8VD0/csNvmUrs0EeXj5SWqJLPN9sbzlI50QcFp50cbVjPx1iHUw3rDqMjVfzNrSwfTGKKDb0NoboBo9dNgXuqY9FZgn4AI4ihhwdx6R3Zygvd7ar10lhrsDgkCWBQd1iMOpU6ZR+X3ylQCIWYqKDG7/gTOhX1UljfjVd3xZAF0ygz6v3Mph5loW0UYe7pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=qJ/L/Xxv0zbLlh7qcdUzzIiIcMeTlJFTkJm4WqaPxYA=; b=E8PSZWd6xGL7G6ucfQuojgESv6pU32Pa6VQJMoWxQZ5KLB0n1OK+6wFtgaBW0Q0PY9vATsc0zKcLac88od9/lk05CbX48rTBLTakMTP4ACM24dboU/SnZg1XOw4uW9OKWvCs/G3Y8nU/u8f+RqpLRKhMLyudkEE6JBNochwcF3L6COn00+VKZmgdhDVZJocYtWg1Vg9lc2DA+xnw6zo53dgGDHSMn4lNBW3ZjjoRTLX8PvcfbZ0oJ4H3DzE2wukEKoOBq02vxflarX71gyX2VQNX91TYSdGYWq+2RKdFxU9hrVvmxhiZAgeZwUTc7aAER8ayxmbvoyHumyk4yRGKjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qJ/L/Xxv0zbLlh7qcdUzzIiIcMeTlJFTkJm4WqaPxYA=; b=XXL8QSdqMOi3v2wS+lm38VXuOzaysXe+MGJpwS2WFQr+ruCteWmuFfHEy/p3BWtvtHSjdfzw4ojCztjbughSGTJr85RRD7pJ+tUiv1bxOzlEoc3IRInfp9iPLtRsxOeGPHmQr3V+Mq6L/DyTKboZMJtDrlXnjVnVOZAUa4CuiQzasTmjeYvd+c8PLGddGEnw+mj4tK/34TfopJJXgRjOf8dbebtIB/IhnqR4Ww0CaWV6pomh/p6u0wK9dyy53rsD5Ytmhjace/UIuWUZ1NYZZOOPcc7LEgTiiK2illXV0RUX1v/x1Z6c50BsjcF65q9IvCTqhnnWeVAXHaZns1tqWQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from DB6PR07MB3509.eurprd07.prod.outlook.com (2603:10a6:6:21::16) by AM9PR07MB7139.eurprd07.prod.outlook.com (2603:10a6:20b:2d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Fri, 18 Oct 2024 10:03:48 +0000 Received: from DB6PR07MB3509.eurprd07.prod.outlook.com ([fe80::5484:a966:1322:f78b]) by DB6PR07MB3509.eurprd07.prod.outlook.com ([fe80::5484:a966:1322:f78b%4]) with mapi id 15.20.8069.016; Fri, 18 Oct 2024 10:03:48 +0000 From: Wojciech Siudy To: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org Cc: andi.shyti@kernel.org, peda@axentia.se, Wojciech Siudy Subject: [PATCH v5 2/2] pca954x: Reset if channel select fails Date: Fri, 18 Oct 2024 12:03:38 +0200 Message-Id: <20241018100338.19420-3-wojciech.siudy@nokia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241018100338.19420-1-wojciech.siudy@nokia.com> References: <20241018100338.19420-1-wojciech.siudy@nokia.com> X-ClientProxiedBy: FR5P281CA0047.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f0::10) To DB6PR07MB3509.eurprd07.prod.outlook.com (2603:10a6:6:21::16) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB6PR07MB3509:EE_|AM9PR07MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 38690609-c82a-457d-3105-08dcef5c2915 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|10070799003|376014|1800799024; X-Microsoft-Antispam-Message-Info: dnEQBE8OQG+ZUl0FNaU4A8m4buKH22Nm7dOkUIZnEMVu/qu6/jLDPjwJXH+xdpnlAQrEFfRsDqO9jrCjGfjyyDRpB6jN9rXRnjy3ghwd2rD0oi2cQsmWr6NypxFMZuFUrUxkUxj7YTqW+3uyd38SOCZOAGi3uuLzDJimAwnzpAKCDoKbSqs/bXWTK0OSxqi1ZkrkfPVBeliBiW2/OyZf8rpeIuxSPsODr3FAjS01oQnEAFd95jL9gtCkjeTgY1du8BtwDQ3J1XvWkQAufufTgzLd8oXX9UvNGyLbCshemfIYruwC2rQE3b2v6oU8TEtT5QcGKP3fMAaSPin8SwgThBjFx6F3Qkyj8fdv4GkW4gsW+CLKk+R17D4Rii8A4HxnInu3kuK8zmm6CgAJvo9PoYZWA+i3yae7eMILc6EnCp9wcKSj1j1dGRHaMjCpEA7z0kopVUmL2Yexpg+RiXt2u3KcDurM9LXt2V3Vb6Ic4CsrZNyp7g7gvS9tSX0mOynBvYwZljG2erXAA50WpjHtOu1JtxOXTAprbZv3+qhCUmWea39N37BUyAP5UIpkjXJnfNvufz7Jc2tSIsaB+sg1L/sVX7EyFeTIXodYLdtGQiqzUjlqnWmKi79kIlLla/3uHtbL88gQ9npraIsM8inv3sHKB0tfps6X7GaaBROsWDPjgZkGmtpjDVR2Qy7r+tidVTMWpyF4luJ2UxJObLgu9+C3Vd7Pze8ZI64D/qYl1CrErYC/slHYCPGD6TF/wVZzkwGv+sOBSlt7+k0IojFqNgDOp0nD37eio/BR22C2+yCReqdeAPYBThNgsla9TyUW6JaPjhqVwdY/cZrxWmfGz4bQb5BmcPEddOa8A4bb14OwzocQaHB12ErgAJtR2JgNpSLybre9IHnWp4Na3X4k0HYF73jhdophUsOOPi6q+FIInG9Qfo1CabKnUlmcrqZRdNY4LVwh0kdLBP9dfhpitutg4D/LX+UEBFBuB4qFnMSGjLXz71Mg49EdfoxdzgnlEfqzj6saY/0pr28NHYHen47eObk7NhRG8zpMaWde+X0FWZaHFZFCy5HYlSkBIM/yRMmdodLYLhdS0rTcyxRNvRU48F1WIAJjkbksNnrQuaTX11+K0ij//oDOVvlmWEkr9x+oA/pLJ+QbIMVftvckCJcCPjxWZZjFhhKKLR94sdAIXHjVZi76h7/ZHvlRedLqi20V2/NMgO7QbpHM7+5Hb/OvjuqCgauGONk9MuuATwYY9wDrFzjXutlpN/YvrrtwnWAVOKkHjOfEJfYKOqAfTWmA99FggDP9m2UpVEijij1pQm0xBr5/lmW6WP8YCZbM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR07MB3509.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(10070799003)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Qly92Jo6USSip/nipXp5lmsd1wogtiz3cbT6rkjIu7cwyK4hZ8yqLlumBcC9AFYMjMGHOXCMxQEVXzON2mUCA88kubMWXNGRGVLp5af9/8OdGd/5O3+PK4cyUtKwwl5RCVoJ8CKCRA8NtQhO0uUQEyjbaa2xUOyehdVQFGnmPuhEh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8KFELgBmXS1L5P5LMm1W7vVHor0P4ifpIl/DPNevv/Te7BYG5hFTF5C5mrPcRfoXjuALEphVUa9i1wm5QNgS60apY9UYolbpdC0Jfv4b0Oc9iRb5dV6xLO74x4PXZSJdwLUJm3PJpQGhuMg7/fNIXf8bzOi9obWY88ZZoFywZ5ZgUTGsjSW33qNsQPJLHEWl0PZ2CkJ3D/ISKR9MsINYJ5lhVGgn/eSXBSln1pzM/UcmGvLZnFRNtZw3BvaY8IFop04vJTycTObVQlEHAcr07FpIR3baU90z+RlHrLBlO7RnhTYja+SXOx4oTh3TjcGL4sYQCunNUOJ+ffv4T0fkMoRo/rObfBmjvivSWt7n1ZwSHlFAReqx1zgKE9lYY2BEr7IBqrlgVr0XlOcvr+zfcgjhbhAmoMuff2KbXiIR2QYS+/5g== X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38690609-c82a-457d-3105-08dcef5c2915 X-MS-Exchange-CrossTenant-AuthSource: DB6PR07MB3509.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 10:03:48.6262 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5Ued5fu8YH/ND+PTrJh34s1SsLqceR5SNDICJJj0wI3vZwCocOacPaHL8HPRz+zxru5oVRTOpswQPqdaaneiWf05YLa0RFqAbaPBnHc44MY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR07MB7139 If the channel selection or deselection times out, it indicates a failure in the mux's I2C subsystem. Without sending a reset pulse, a power-on-reset of the entire device would be required to restore communication. The datasheet specifies a minimum hold time of 4 ns for the reset pulse, but due to the path's capacitance and themux having its own clock, it is recommended to extend this to approximately 1 us. This option can be enabled using the i2c-mux-timeout-reset property in the device tree and should only be used if the reset line is not shared with other devices. Signed-off-by: Wojciech Siudy --- Changelog: v2: * Removed mail header from the commit log * Decreased reset pulse hold time from 10 to 1 ms v3: * Make this functionality enabled by appropriate property in devicetree v4: * Fix missing condition check from devicetree --- drivers/i2c/muxes/i2c-mux-pca954x.c | 51 ++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 6f84018258c4..316048b0011d 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -110,6 +110,7 @@ struct pca954x { u8 last_chan; /* last register value */ /* MUX_IDLE_AS_IS, MUX_IDLE_DISCONNECT or >= 0 for channel */ s32 idle_state; + u8 timeout_reset; struct i2c_client *client; @@ -316,6 +317,30 @@ static u8 pca954x_regval(struct pca954x *data, u8 chan) return 1 << chan; } +static void pca954x_reset_deassert(struct pca954x *data) +{ + if (data->reset_cont) + reset_control_deassert(data->reset_cont); + else + gpiod_set_value_cansleep(data->reset_gpio, 0); +} + +static void pca954x_reset_assert(struct pca954x *data) +{ + if (data->reset_cont) + reset_control_assert(data->reset_cont); + else + gpiod_set_value_cansleep(data->reset_gpio, 1); +} + +static void pca954x_reset_mux(struct pca954x *data) +{ + dev_warn(&data->client->dev, "resetting the device\n"); + pca954x_reset_assert(data); + udelay(1); + pca954x_reset_deassert(data); +} + static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) { struct pca954x *data = i2c_mux_priv(muxc); @@ -329,6 +354,9 @@ static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) ret = pca954x_reg_write(muxc->parent, client, regval); data->last_chan = ret < 0 ? 0 : regval; } + if (ret == -ETIMEDOUT && (data->reset_cont || data->reset_gpio) && + data->timeout_reset) + pca954x_reset_mux(data); return ret; } @@ -338,6 +366,7 @@ static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) struct pca954x *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; s32 idle_state; + int ret = 0; idle_state = READ_ONCE(data->idle_state); if (idle_state >= 0) @@ -347,13 +376,16 @@ static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) if (idle_state == MUX_IDLE_DISCONNECT) { /* Deselect active channel */ data->last_chan = 0; - return pca954x_reg_write(muxc->parent, client, - data->last_chan); + ret = pca954x_reg_write(muxc->parent, client, data->last_chan); + if (ret == -ETIMEDOUT && + (data->reset_cont || data->reset_gpio) && + data->timeout_reset) + pca954x_reset_mux(data); } /* otherwise leave as-is */ - return 0; + return ret; } static ssize_t idle_state_show(struct device *dev, @@ -543,14 +575,6 @@ static int pca954x_get_reset(struct device *dev, struct pca954x *data) return 0; } -static void pca954x_reset_deassert(struct pca954x *data) -{ - if (data->reset_cont) - reset_control_deassert(data->reset_cont); - else - gpiod_set_value_cansleep(data->reset_gpio, 0); -} - /* * I2C init/probing/exit functions */ @@ -625,6 +649,11 @@ static int pca954x_probe(struct i2c_client *client) data->idle_state = MUX_IDLE_DISCONNECT; } + if (device_property_read_bool(dev, "i2c-mux-timeout-reset")) + data->timeout_reset = 1; + else + data->timeout_reset = 0; + /* * Write the mux register at addr to verify * that the mux is in fact present. This also