Message ID | 20231019222725.3598022-4-Frank.Li@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp688195vqb; Thu, 19 Oct 2023 15:28:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBUralON7nzjsr3rsBSMF//500ViMzVuVq3EegnSzr+Ktd1tUubQxCxgscZ6q9w7/U5KxW X-Received: by 2002:a17:90a:31c:b0:27d:68e1:c3d6 with SMTP id 28-20020a17090a031c00b0027d68e1c3d6mr196900pje.28.1697754513772; Thu, 19 Oct 2023 15:28:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697754513; cv=pass; d=google.com; s=arc-20160816; b=C0BswmZ/twiWangGmEBIK4Gn+kJmXZiPoeykII8+bOz3Ks5/sS4a3ZGnNBtQ21JtjK MpLul76ivbuLahIogi0vaJpmH1iAolHyLa72Dd9RvrhBxn5h5VD4mnfla0/UJTdYaBER nWgN6TcVt8sP3cAkXakLWN5M8ddiwaV9bLcUIJh7ZwRKndqdnjTP+d88gFULbvfAuum+ jeFwkxDUxecZH3o6XNMBX+zHzhu4w9NjHK+fk3PAqQ6QIdDA3sMtCQMJnzj4wxpoZHrA ksYL6W3h9ur5xjz1bbU15LpDwY+FZ3KKsoubBKwdqva3ahR7rNF9gaDRp3j/qCrOEWZN xZQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gaaZQlXiW7kkseAwbfTJKJ8ZOrlWG/SQe5iwfmixt5k=; fh=sDe3TG6/b46JEOvF2xh0f1K4oYWCH8cpxTVfh1/w/G8=; b=orpjOVqTGRIeDCLF8vPi7EabELPxqiRxhRr/iF9463Vo7CJsm/KhEXN6hCgope9LQ8 kZr5ekls9ooP1xoqDxOUPmUdPSHw90dcips+TkYcdqxJX9L5Bla6XRNHipGiv9UEbzSe UeIH918nNfWZtOG+VU1Tb+lxPmnj9z+ARpSF71J8DZKEBiBLdbAJgTSsKJsrOsax32Rv Q83buC+9tvGwUZl+1iYKoczIbYgCCN1Zo5W2utyRSz3gnwl9fE37wxwvuMG5sNV449xc ThKuwtqSA2CqNs8mCfV8QolKpYtCTRMAQ/d1q1BmG5SAOe48olG6pZSnHWfHWPLmbCw0 pPiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jmzsJVZw; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 6-20020a17090a030600b00274d3f62044si551428pje.111.2023.10.19.15.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 15:28:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jmzsJVZw; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D23218274AF0; Thu, 19 Oct 2023 15:28:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346658AbjJSW14 (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Thu, 19 Oct 2023 18:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346644AbjJSW1x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 18:27:53 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2071.outbound.protection.outlook.com [40.107.22.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E947CA for <linux-kernel@vger.kernel.org>; Thu, 19 Oct 2023 15:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P4nPIyTpL6vRNo2Y8YKMwXTmAuODuCsK1o9fzmDLscEEZ7/2jReIcZjlSlWy9eOiE0HZwRDLkqeZveH3jwgh0kD8fCM2/4mrlBDWiCE7gizJjEaF41h3A0+CLwUdlJP7216CQlmVc6RMYOffF0mmP1O568NCuSZSJafsGJYlExiLZ/Dqyxn3u6ap1HJ2D3RNAXbPubUKQzgb99lE+HU9Vg1nPXr7pMhlrWTbIQ34W4Vvh5P87DVGpX+cPKVVm9UrpfK3uNYt8weiA96U1cLl7Hkgiui+SgKwGoDtpOCAzDFiBuWK+CYntXdrMkOO5X+gd+adXzBiV9cDinL+ik3ugQ== 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=gaaZQlXiW7kkseAwbfTJKJ8ZOrlWG/SQe5iwfmixt5k=; b=mwg600T4Kj/zxFtOijBoxOv9kNcHd63xsJJDKYm9q5+Igfh05w6ntcjt59WpSZXWtdWOYJPldn67NCR/XbrSZp9wwiDFqC8i/s8AaB82oDQSy/Uq2ZGKNs964fspXoJrXn2dlyIMJqOrzcM92BbTsIQyGEjGWRSwTgX12DZKe1QrRuvTqYIiUcHqEy5xsgbIONEHUCKmESnuw879cnGViO6Wadz6VqW5Tu68De0SChB00Ab81aVqKFDkoalBJvaPa9kLlf8sgfXARV59GBV0E0XQTA6LuzQaabbbdA8PgRHmQXs2iRRMHoicTrrbafUDUTbpYwu8fP2k2s7IMzgntg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gaaZQlXiW7kkseAwbfTJKJ8ZOrlWG/SQe5iwfmixt5k=; b=jmzsJVZwcY0ck00JSHY8yKuue9tROLhTp/8KbuGIwI1xOw0kF/aTMDo4ALVRUFsXVFsZtmRueJPsCJIGCAFkqbdGxn0pmljVb3ae6hl51vzbfBENkuB4wqRENYKivE4u2C34TVS8U4JbZmYNytNachgruIhlB/2gM2SnS4kR9e0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DBBPR04MB7708.eurprd04.prod.outlook.com (2603:10a6:10:20d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.10; Thu, 19 Oct 2023 22:27:48 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 22:27:48 +0000 From: Frank Li <Frank.Li@nxp.com> To: miquel.raynal@bootlin.com Cc: Frank.Li@nxp.com, alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/6] i3c: master: svc: fix ibi may not return mandatory data byte Date: Thu, 19 Oct 2023 18:27:22 -0400 Message-Id: <20231019222725.3598022-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019222725.3598022-1-Frank.Li@nxp.com> References: <20231019222725.3598022-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH7PR17CA0042.namprd17.prod.outlook.com (2603:10b6:510:323::21) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBBPR04MB7708:EE_ X-MS-Office365-Filtering-Correlation-Id: 115c6ed1-1266-4c36-9333-08dbd0f29fee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M2cYcjdrFfsAj4hiBkXqd3HO5ayqP2CdB9/CAbOwZmfdT1R0N7SveyF75QY5Rfedmll6aJArFhjSYyUNBWiuHspUIBsKJSfIht5NhtEU6okbQbsSzAbcud31hRZ9mboK6YU1a815quzYSFu4TW7qzPhrarpMtpoKcOpJsJEAu+PFutJSN/uAg+lNCbDqaJaMHZtbZ9VO45f79lqZaYyXBAMBi6LaWC74erTNX3iEe9IWUyLoJZKiJCPMycUwGBxINN526SsH73w3ZIsidHKAlpKbjQsN9Th9SRBuiqI1se7pLtwaPNN3HmofKmJvPRgdH2slVdGLJD5ZRG2tQZXPILCA2PJiZ37mUc9nxMQVWgGrrePKxsehfYxBeTrXCdIHYZ/WUo9GkWJ++lEhfKy4cBJ/A9v1p6+3yn/0EDBLzSj335nVxz36KxbHVqSghIq039DdLf074spbXulHDEQP0xJxZXrGKnUoBfQqeMQUbZoOQevv2y4H1nL82EcCWYMT65PJVzl0rYRzj4ZforAmEhoQRV5eqnRKBwJ9Mhb9OQeKcSC7IzDvnnThKgLT/46kdgLFObsRNLCosH6+xmDLGAHLSJGeahbSMUnLi7OZIr2BJWC6acUEnciyPWJxsr737WP7OJNvLVe5PW/S6VxSF+T0a/EEG1fk20z0HAk051U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(366004)(346002)(39860400002)(376002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(6506007)(83380400001)(6512007)(38100700002)(478600001)(36756003)(66476007)(66556008)(66946007)(316002)(6916009)(86362001)(6486002)(52116002)(2616005)(1076003)(26005)(6666004)(5660300002)(2906002)(41300700001)(8676002)(8936002)(4326008)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DLR0ZEAy7inq/tfBOC13tKchDd4vxokzqAdbfDuOrVdusaWrNzlWWjyLdaksc7kivxlKDktE7FqlLb1kPUKLnJasi2TeVSmO8/i2IayGKdirL/ZpPRDiR+7vxAWC57mOOPvp5V1//9vEVvTtERhQi0FqFvrBKxvr2Im1XDGtjoa0UcxdxTbLXAWEULsVizRaiH6dFa4d8jCYdDz5EO+3MacTyuJvTmn5eAE+488lDmVaJdlnRIfcmibec5MNPFnRqUTOahkEgOUK2u0CEazjWi1B6pfHChpMTRGWLWlCRLbE2SjCfC1M5L4hkcGVfDuPkQYsEsj/HkoTVudYvF61Z2hGcUigdzoN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qGRC2BAQSzb/XtL+4OGk0qTWaaUrLtBQO7HraYoilElq5+qshBLs4KJkof7SSvhLTLSSAK+guVT3XEMRrg8YW0xTPy6gP3DISxK5F2okJunHQKRlsaVXInEPS7BNMQSXIk9CKZAv8XMvtwN7HdkcOdlZooih75mw= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 115c6ed1-1266-4c36-9333-08dbd0f29fee X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 22:27:48.8230 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7d0qLjDjdqwt1obCtePu8p7W17LBtjxdvZFxvQgo23yrMvC/iGNiJsaT8e+5PMpnhtF32UvIp4n/pyvZBNWUvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7708 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 15:28:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780224637087274750 X-GMAIL-MSGID: 1780224637087274750 |
Series |
i3c: master: svc: collection of bugs fixes
|
|
Commit Message
Frank Li
Oct. 19, 2023, 10:27 p.m. UTC
MSTATUS[RXPEND] is only updated after the data transfer cycle started. This
creates an issue when the I3C clock is slow, and the CPU is running fast
enough that MSTATUS[RXPEND] may not be updated when the code reaches
checking point. As a result, mandatory data can be missed.
Add a wait for MSTATUS[COMPLETE] to ensure that all mandatory data is
already in FIFO. It also works without mandatory data.
Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
Cc: stable@vger.kernel.org
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Notes:
Change from v2 to v3
- update commit message and add no mandatory data in commits message
Change from v1 to v2
- update commit message
it also works without mandatory bytes
Change from v1 to v2
- update commit message
it also works without mandatory bytes
drivers/i3c/master/svc-i3c-master.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
Hi Frank, Frank.Li@nxp.com wrote on Thu, 19 Oct 2023 18:27:22 -0400: > MSTATUS[RXPEND] is only updated after the data transfer cycle started. This > creates an issue when the I3C clock is slow, and the CPU is running fast > enough that MSTATUS[RXPEND] may not be updated when the code reaches > checking point. As a result, mandatory data can be missed. > > Add a wait for MSTATUS[COMPLETE] to ensure that all mandatory data is > already in FIFO. It also works without mandatory data. > > Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") > Cc: stable@vger.kernel.org > Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Thanks, Miquèl
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index abebef666b2bb..dd06b7c9333f1 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -332,6 +332,7 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master, struct i3c_ibi_slot *slot; unsigned int count; u32 mdatactrl; + int ret, val; u8 *buf; slot = i3c_generic_ibi_get_free_slot(data->ibi_pool); @@ -341,6 +342,13 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master, slot->len = 0; buf = slot->data; + ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val, + SVC_I3C_MSTATUS_COMPLETE(val), 0, 1000); + if (ret) { + dev_err(master->dev, "Timeout when polling for COMPLETE\n"); + return ret; + } + while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS)) && slot->len < SVC_I3C_FIFO_SIZE) { mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);