Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2307710pxp; Mon, 21 Mar 2022 16:30:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW6t6Q/20jy8UQqOBIsRNbjQfJ3Qi2k+EJApXJb2BevHO4uuvqF+iq+M0r71YnkbLWoJWU X-Received: by 2002:a17:90b:2486:b0:1bc:9d6a:f22 with SMTP id nt6-20020a17090b248600b001bc9d6a0f22mr1606095pjb.211.1647905433336; Mon, 21 Mar 2022 16:30:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647905433; cv=pass; d=google.com; s=arc-20160816; b=cFzOdl8E8k26XrA8lvPZiduUjIkHG6nwCO02kfH6j5eK7uP7/NxlKmNTT2AXRWfl+n 32KdLCBpWieOf94nCLyt+8Nr/rrKMRt8mVq6C6IrAh70seiuMWO2U45h+nSMlWT+DZS0 CcJeV1PrTl1ppdef6xMgNs9rfECZ28qDw/NMXvpm59iKRrGXaYZBDYKwC4JxYwzHUi51 ql6Ni+aFcrzy/DvEOyw+QtZFYF7kagGSUEMps2Ad5zL8X7gQ7Ldr+OG0/quHnREMCi1p XZK2Kg0cSPCxTAeBXF7Iwt0b24t9ozbKvEYd5lVd0eDx55P4/6Gbtt4VKT49vnofHXuW fuPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:envelope-to:dkim-signature; bh=mLUbdUpnDeOElD7GlXamCZsg/mvNxKFSF0rXj2zS0Ec=; b=VFBYcR2qGMSxIqrm0Rm1PXBcaTJ7CEhM7AKFFJESyDClLdJpnEtNfkmRu7eNNYIOix BLkKCcMnwe6Xvx0eM7Sd2yWtghKHgrDWGehM8ZHF7xeqWxcn0WHh31tx4Sxjv7mtu/xL YmTA66HAqgEr6x7UJXmXuv/hgljSKlYkB2PadZD8uYsVkn3UT44PHAqjgrgt/RA072SZ 6YC+1kZ3orfX4I9J7gtMG1VamB1+FSJWFN6xW36/bG6to8E8ZYnn9teZWSF9BiI6v4DW nZ2zSO6HSKPF6upuuyeqz1L5DVR/gtR+1swHTvsvMWa0E8bLRqAUfQigtfNzWbMpPS8a EJxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=cyy0QXxu; arc=pass (i=1 spf=pass spfdomain=xilinx.com dmarc=pass fromdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 11-20020a630c4b000000b003816043f0f8si14181253pgm.749.2022.03.21.16.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:30:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=cyy0QXxu; arc=pass (i=1 spf=pass spfdomain=xilinx.com dmarc=pass fromdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 747DC38A169; Mon, 21 Mar 2022 15:21:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238322AbiCUP6y (ORCPT + 99 others); Mon, 21 Mar 2022 11:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236298AbiCUP6v (ORCPT ); Mon, 21 Mar 2022 11:58:51 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A8F1817A9; Mon, 21 Mar 2022 08:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=heGBAiss2gGUjffD2xOOg4C+Km9CELn9ZzoM8pKlVquKP1J0dZ4gntYNsl6sgQmElmeaTi3z0wBQKao5SKgVPmMz4tSw7W+wMQr7tULxYJal8iFoEeYm1sGi6aIXm0Te7fVdbAGaLKLsuJp1OqlL+3LF7M2xRgamGKsWJ1tdp0puK3cngwlls8Tg1oHfMIoR6T8a6PIeFSDfZ7lUASOBxArtHIzQTBui/8ynjhf1pPw9f43I1tZ99sUImMYJqJa52vY/ZYBqhfhNYto2g055x//FtF14Cyw77eIYBT46UImcUzD5lrYx9zQLEC2d+nacc7iSIdxpH2HJz/UkHjo0bg== 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=mLUbdUpnDeOElD7GlXamCZsg/mvNxKFSF0rXj2zS0Ec=; b=mkyc8xzvMSCFwnIN6JeIRlITFjjvMPUvwmhGKKYGFtUCam319plDqih0DqbRgZAVB+3C3B1b3yUbxo06XNzSlEL1TOhRcwlfM1iB0V+4OVtlNhkJ/uFQXxyGy5FdhPS1hT/aCAQXHPWj6H3sDhwnlUKBSTGoiZx3Dl576ImV75dWISK34vSPAglTVLheKaEkb4h10t9vmO+stpq6q84dSMD+jXYxZPKyDbExcr/OaHtOYM7IUTILqYkq3q72KeI/ThmpxUA99APoRsoLQ5nGcJ8waRUOwWB0w+AA8NEbzxIgeCBMgsqgG+owGHFZuO29SxmJC7IpRquhltwj7V7exQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=opensource.cirrus.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mLUbdUpnDeOElD7GlXamCZsg/mvNxKFSF0rXj2zS0Ec=; b=cyy0QXxumfI3+TXQvoDpc9Seh3svqT977cgZ+cMxAO3o58cHFz7NaYaQxobiKd5DSQlLY4BoPOuGes4hwClxdM5CncX82DiKQ3f4JptRTywag98kZQIaVqWSzs06MHlnju3qlg4fzP/5W1vvq/Fymrms23RceSPsKX4QHnCN15g= Received: from SN4PR0201CA0037.namprd02.prod.outlook.com (2603:10b6:803:2e::23) by MWHPR0201MB3419.namprd02.prod.outlook.com (2603:10b6:301:77::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.15; Mon, 21 Mar 2022 15:57:24 +0000 Received: from SN1NAM02FT0022.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2e:cafe::fe) by SN4PR0201CA0037.outlook.office365.com (2603:10b6:803:2e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.22 via Frontend Transport; Mon, 21 Mar 2022 15:57:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0022.mail.protection.outlook.com (10.97.5.0) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5081.14 via Frontend Transport; Mon, 21 Mar 2022 15:57:23 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 21 Mar 2022 08:57:15 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 21 Mar 2022 08:57:15 -0700 Envelope-to: tanureal@opensource.cirrus.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Received: from [10.254.241.50] (port=49066) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nWKPD-000C07-IC; Mon, 21 Mar 2022 08:57:15 -0700 Message-ID: Date: Mon, 21 Mar 2022 16:57:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] i2c: cadence: Increase timeout per message if necessary Content-Language: en-US To: Lucas Tanure , Michal Simek , Shubhrajyoti Datta CC: , , , References: <20220309093147.102385-1-tanureal@opensource.cirrus.com> From: Michal Simek In-Reply-To: <20220309093147.102385-1-tanureal@opensource.cirrus.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c3b160e-5024-420e-8af2-08da0b537d30 X-MS-TrafficTypeDiagnostic: MWHPR0201MB3419:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qrHPYdIa8okcdXQFllfsPfBLY9QTZRC+n0BC/b53ML9tOEpsDIA9FXb5wHvqPXeojNfu1qZYaQRqH+OLyLR8Epaxr86p7V/3RdzmxqUiH4y7RQpwQ6spyr9xafjLOpRnBKkaQZq7+uD0hphxOR96Awj8fDTWaE1xcNsiK3kZJ3U0d2pdqLktmOEJaoidasDQMzFqWCrQzh786vrZiahh4AN0H6YXk10dNOTPrTrvpM7L0K9iEdWlWc+Gl1VRKbzqKifVcGDq6E0aNJgxN9w5ok35IoewLSL+3AKvLSFkMCMfh1hs4mnxvqujXPFJ7HF27VjATuPEbRDIypADsoh//uA5OnWPOiiIqPUIQCbmSt5rZ919Io7H9EyLVeWeWbk+dAm94QdjsZ68JGQpKwFhVhKvRq6r6XK+C9SGPc5qZ47BryP+FpyMAnc0lpyCh6l3cUtQTLKORTZMs5LFptmNv1TY+7Hs05h78tTRzmjymmcBxkXZnK5pCEfJIjupcAYVkMI1anreTMX0IZsO3WhfglkETlj62xi+1zilnPcqAi3+5CSfIZhjYghJI7ZshCOfMDZdVvQagUau1uGrz1PtLT7hHUH1a2w5raJP5goMrjDvUArcS1OAPs+Ewk6ZyWaPLVeluJ4YlwazNkR4Tp1bKJ9BvO9Fl9PLfTQz7I9GEfGE2TqNP5N+r6kTRZDYO2H44hobiN8zi3dSyIzrMF0CqnIMYl/36gmESWML8dgF/Fg= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(31686004)(336012)(47076005)(356005)(70586007)(36756003)(5660300002)(70206006)(40460700003)(7636003)(186003)(26005)(8676002)(53546011)(426003)(36860700001)(110136005)(2906002)(4326008)(15650500001)(2616005)(44832011)(31696002)(6636002)(508600001)(9786002)(8936002)(54906003)(82310400004)(83380400001)(316002)(50156003)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2022 15:57:23.5933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c3b160e-5024-420e-8af2-08da0b537d30 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0022.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0201MB3419 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Shubhrajyoti On 3/9/22 10:31, Lucas Tanure wrote: > Timeout as 1 second sets a upper limit on the length of > the transfer executed, but there is no maximum length of > a write or read message set in i2c_adapter_quirks for this > controller. nit: I would expect that you have run any test and you reached an issue. Would be good to describe what exactly you have tried on which configuration to make it super clear. > > To remove that limitation calculate the minimal time > necessary, plus some wiggle room, for every message > and use it instead of the default one second, if > more than one second. > > Signed-off-by: Lucas Tanure > --- > drivers/i2c/busses/i2c-cadence.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c > index 805c77143a0f..b4c1ad19cdae 100644 > --- a/drivers/i2c/busses/i2c-cadence.c > +++ b/drivers/i2c/busses/i2c-cadence.c > @@ -760,7 +760,7 @@ static void cdns_i2c_master_reset(struct i2c_adapter *adap) > static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, > struct i2c_adapter *adap) > { > - unsigned long time_left; > + unsigned long time_left, msg_timeout; > u32 reg; > > id->p_msg = msg; > @@ -785,8 +785,16 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, > else > cdns_i2c_msend(id); > > + /* Minimal time to execute this message */ > + msg_timeout = msecs_to_jiffies((1000 * msg->len * BITS_PER_BYTE) / id->i2c_clk); > + /* Plus some wiggle room */ > + msg_timeout += msecs_to_jiffies(500); > + > + if (msg_timeout < adap->timeout) > + msg_timeout = adap->timeout; > + > /* Wait for the signal of completion */ > - time_left = wait_for_completion_timeout(&id->xfer_done, adap->timeout); > + time_left = wait_for_completion_timeout(&id->xfer_done, msg_timeout); > if (time_left == 0) { > cdns_i2c_master_reset(adap); > dev_err(id->adap.dev.parent, If my assumption is right and there is any actual issue you had please send v2 and feel free to add there my: Acked-by: Michal Simek Thanks, Michal