Message ID | 20231018155926.3305476-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:2908:b0:403:3b70:6f57 with SMTP id ib8csp4893590vqb; Wed, 18 Oct 2023 09:00:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOwnR56ErviH8YptceDlRH/YNl/EGUTgY9WCwL1hgpdZON03ibdV/pc1PUoa3zxYcoi1oX X-Received: by 2002:a05:6830:68c9:b0:6c6:473c:9ca0 with SMTP id cw9-20020a05683068c900b006c6473c9ca0mr5433903otb.3.1697644848580; Wed, 18 Oct 2023 09:00:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697644848; cv=pass; d=google.com; s=arc-20160816; b=I9g2VRvVxJB/hdMZZoiRRs1po9QBQDJE/CPyQFGBB0azTyHDvrdK48cGEg1HhCt0bv jP3ejMBwo9b0fFvHLW3gWxIDFVtBkzBMd5STpB5vbs/FB6pGZqIX1JYU0VU3B1ygdvRN yXL1botXoeqdhiyW92Axhv5F1ltBnygfj7fza883UGxDUgXFHw1F3m6xWsl9MDhrWHMa Z9ZyfxdygmodqgvWjFcaJY+QR0qngobQshzfrssO0WORKzgxDmp3V3o39b653EvBVvOS iomDSTXCkrDhmJ4ZC9FJQiQCBzyAl5Ovk7SeNzEcRlfYWBPi7QbOhkXaHY0szilymIk5 WxMA== 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=rmA0TmfYW8MJ+DqQikfItM+khhjIvm5K1uwmiII6AZE=; fh=sDe3TG6/b46JEOvF2xh0f1K4oYWCH8cpxTVfh1/w/G8=; b=ceqcnKLLZz33wv++1YXBgBMhGlfnayRvFjdMM86KcJjsLapsArgYq2eapeQw1cdJnj Cqc5L8obvop6BJfw23gon1KkmZ2dA15xsRDnak9AAtkRvKC6LrnlZt8K+oQvJCgKMvRa xc9EDUVsw/zRIWbGxd9Y+ZPbA5bRf7u48D6QsSvfaEg3VrCi/TDX2Xdd/6rIDub7hZMF ktsN+E5uy97K3o5JBz+4Iv3gAQxqh4lr0iqQkU9NUAKVgW93wcWG6INc3yJbJJl2tXSM W/8F1Conmse/yAoqzk7Emh28uYsLpn/Cx8fyLdwjYY617bAUzHccC09IchYRWQznFiZ/ fCSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bvxSrmUR; 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:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id u204-20020a6279d5000000b00690d695b113si4070344pfc.337.2023.10.18.09.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bvxSrmUR; 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:6 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 pete.vger.email (Postfix) with ESMTP id 78D0B8098B99; Wed, 18 Oct 2023 09:00:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344817AbjJRQAJ (ORCPT <rfc822;zwp10758@gmail.com> + 23 others); Wed, 18 Oct 2023 12:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbjJRP76 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 11:59:58 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2047.outbound.protection.outlook.com [40.107.13.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8D4118 for <linux-kernel@vger.kernel.org>; Wed, 18 Oct 2023 08:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=elL22lKNDIcIEXF6ZPCFLsjYDCLaxpQNppVx2N6a3RBIVF4UeZvhD3ItFYJCvbRw3vgTMhqP0Q6/802otNoYL4ADaAm4ByYxBuihc3HtGvDmqZ/5DILLeYItNsQKcquGMgKV2QTVg5WoNVxGzpXYcdhhNNyvGrM9r9kt1NaEp3tKihmINBlg9qTStR9QeWFBrQwSp5+rZvry467k5WJdjBKm+xpsbUthXZcu5xVuDmGeqDM7ZlW4mQBmZz+YG9of1VAvx+mEqVcPRgtrhEOzBCvdThrE2Pie/B2VJ8wLoQorRY6PkQzO3ZZOaLZB0caSpPRvTVrxKRno+HqrVqs2WQ== 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=rmA0TmfYW8MJ+DqQikfItM+khhjIvm5K1uwmiII6AZE=; b=cz4PARiIIuRDwocngOey09ITBe8xNFBjCZjJBFJ6RDFSGo7D1/kas/gXvZLqceIfmqxJ2dZOPikStNIGKEgkNJcDCsIFoKmJKOJZ61xJJzhEqQ61mD8AeTA6qdt495Yk8JokayY+kQImhyyxTR5/wJy5ty88yBdjeYFW9CaPFLN4a/GLpsez/vIj6oaT4tmVpVbc4fSmeGFuCLQ6IciqoOunfH0bD56gUZiIWVXKYleyZSJxyXllLYB2sgBGc0lWsAo150NID/oY2ZPPzpZm96h344mI7WjMyyroOsOvDlZGXRPHl6edr1gbSBoSHX8flUtvGq+euUWvzCIZxDlqYg== 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=rmA0TmfYW8MJ+DqQikfItM+khhjIvm5K1uwmiII6AZE=; b=bvxSrmUR7J5kYXMhtxyUEPTrZATUG92yijCVso3eeqlY30MErIQHwIzI3/3q2BK58d5A/oUpVCOBcu9qi+VWivL1AyeALYVYgVlwP60MUNeFYgFwSY0yj04GiE1mp2azEYCTkcWkh8RXAfk/di3hcX0aO660khydfgLgLOn7aaA= 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 AM7PR04MB6966.eurprd04.prod.outlook.com (2603:10a6:20b:109::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 15:59:51 +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; Wed, 18 Oct 2023 15:59:50 +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 v2 Resent 3/6] i3c: master: svc: fix ibi may not return mandatory data byte Date: Wed, 18 Oct 2023 11:59:23 -0400 Message-Id: <20231018155926.3305476-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018155926.3305476-1-Frank.Li@nxp.com> References: <20231018155926.3305476-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR05CA0210.namprd05.prod.outlook.com (2603:10b6:a03:330::35) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AM7PR04MB6966:EE_ X-MS-Office365-Filtering-Correlation-Id: eb1691c1-0dc5-4a3e-90dd-08dbcff342c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Om+SKY4e6UluvIO+BjGqxmdqbMDjCT7jVI4jE/w8d2/MmG8xQkZdlqNoap34MJ+8Fwaa9WEISjOGJPkrodzeU6ahV7oQXCYS3bN14f4E5Wa61t44b2/ll4VwNs7ZxwXmRDihQVoTlzuobdAXicxSteJDnuD5C2GItFkDq8eEEHnbhA89Sfr5GhnQYnsz05+eJoDrGyjhZHDN8Mf1bv42ea31T82RB8jcqx3E23Rnssc50rMpzlkuaKvvsAPDVUpAdGDKjFy55f19WDJuLlRzfJteygZHDLRgKKfey08owIgg3T+Pf4u6GUkQjGHsyk0TqyEVLUXn30narP9HMwkK4lKGOP8yIRyCarEuuah7b10ftrBCj0cRo7czA7fzjTVAfWlRT0o7PVuMsx5scVeCY9ibQ+Sg8in/+uBG1isD3bZggYBDCQwotaSyg/h+gaPJ/lHrmwclTGgPJtON5MRilSjRcqaqmk+et28ETzl1KEpGkBoyid0SVbpq+ddbxG0kOkDmmWzZyWFqczogrEgvE2GTnMkgHXYg9G0TItXLC0AecVjzdC9+UN4tiW78C3bRWc+8zHIUHxg5iwvcgp95mCARSqWsKPZaqzu1b8aLruo505mnU/7xtYIUK651/hic 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)(366004)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(2906002)(478600001)(6486002)(6666004)(38100700002)(8936002)(5660300002)(8676002)(66556008)(4326008)(66946007)(316002)(36756003)(66476007)(6916009)(86362001)(41300700001)(6512007)(52116002)(1076003)(6506007)(2616005)(26005)(38350700005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z7xoQ2JldThzWaJKO6+pf7KdqgVsTvKDkjbj+pQjNDgxKvFtbpxHOnoVF0KcsgzlIix/hEW7ScyUtdpd2nArTDTU+tMT6NcYXdYSj4DCer1igSwt/ZXpcEl8vq/SQYC56fXQJM5VhxQvf1WU2sNa6fzmYJZ/hHjgsK684KSl0b8gMwCYmdLM2JMmMgxLbRD+dmW7zadu77toFC9IzxyYmOBrOYBrEjKxS6viSmvXLpzHE+4aZjdhpii6wi+Ttq1vk0SJu/NxmRnRc0836wH1gklr1hPTffuneaUy4x9HrgbqWJ3KRqIQKJ/ufXLeP1erd4gM1ICseduc/IEd0LwnTaZFtJYB8SJhLinbXxv7i9WjEXaQWvdpAjlJ5yiwEyE0D6sSE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LjGZyQkLOFJC6hPhCffXIPBCGZ9gbrL3ZRCoyd01Kx9DIySPWXV5zk7OCZtbWmeIINKxSqbMUJiRBFGQypgeqGkYFekPMvfHWqGA2wm1LUmbbz87E X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb1691c1-0dc5-4a3e-90dd-08dbcff342c3 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 15:59:50.8903 (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: 3W1EFH5QHzMVrocEcrtO3pulaVILJ0eWgdP/2M8bMLUw6gl+DbyKW+1fUHKcx/K4/6rD9BhjYHCrRT1UpMwj1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6966 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 09:00:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780109644705918562 X-GMAIL-MSGID: 1780109644705918562 |
Series |
i3c: master: svc: collection of bugs fixes
|
|
Commit Message
Frank Li
Oct. 18, 2023, 3:59 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 reach checking
point. As a result, mandatory data are being missed.
Add a wait for MSTATUS[COMPLETE] to ensure that all mandatory data is
already in FIFO.
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 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 Wed, 18 Oct 2023 11:59:23 -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 reach checking > point. As a result, mandatory data are being missed. reaches can be missed > Add a wait for MSTATUS[COMPLETE] to ensure that all mandatory data is > already in FIFO. > > 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 v1 to v2 > - update commit message > it also works without mandatory bytes This could be mentioned in the commit log? > > drivers/i3c/master/svc-i3c-master.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > 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); 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);