Message ID | 20231018154809.3304558-5-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 ib8csp4893525vqb; Wed, 18 Oct 2023 09:00:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiTib2IbPa39ER8UzoirhW20uIl+UsZYX56OjeHTyslNAbcep8VZNlEttQpNylcQJssOT1 X-Received: by 2002:a05:6870:15c2:b0:1e9:a8ff:67e3 with SMTP id k2-20020a05687015c200b001e9a8ff67e3mr6476629oad.4.1697644844159; Wed, 18 Oct 2023 09:00:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697644844; cv=pass; d=google.com; s=arc-20160816; b=vDj/d7pq+PFob8WNDOINrdQFTqcXuVLWGs1/KVwaNJIs0JAgoQ3ShCIIT7lQTPo0FO b/pPLH8r3EA8dpfY0CaCBDt4lPjqUHRzn9Eoc3TLnDfVIqesEgS/KKxhmhph3NPTedaQ IqDtxWPXV5r5kizYEP9tNV7a+WeKsslZMYMiVTkUxn/d7yfh+/soj/AXAFucjq1QRZRa MmcX7RNsqj9isq4EtF74v1s0u4HrSkE78/VRlZs3gmrNp2tCUHIPixcprs3m4djqJRfc 74qhppMDd+nL16RVeL2D6Qz2sOofvwbJucUzPQFCl60LmUKLffIgOxlkEpra9RJ6dnqc PHEw== 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=VyRkv42PltifMzGkqXyfvrxpNC3QLZfCmTFRgRUn+QsflwdpURl2y0PinIbIhFtQUJ uPGg1l2ID1zpwVT9vxp1JZ+G9BrRS0F3nLKX/X2wsltas1eMelIOOiNnSP2l7GrXp+/i pQaBDx8s1ioSM5B+qcmf8yqbe5I2pWKZhXmTqqHclV9TNopseGydc+nZxZYh7HplXwjM zGCWI0LLAIyeYg5kVgtbr8+SLo/V7XvFF0zsqnyEx46MkLmtIeNJDehyxy7LbQedTxU4 YeFt2tNu26/fDvIXtVQsdtrHmgfELXfkuA33VLg+UJ4hXHcy2joc1FAtRmlhm1W+OIpc +vXw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=BEaFHAB6; 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 23.128.96.36 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. [23.128.96.36]) by mx.google.com with ESMTPS id y72-20020a638a4b000000b005acd2009192si2469952pgd.13.2023.10.18.09.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=BEaFHAB6; 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 23.128.96.36 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 96B3E80725D4; Wed, 18 Oct 2023 09:00:21 -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 S1344803AbjJRPs4 (ORCPT <rfc822;zwp10758@gmail.com> + 23 others); Wed, 18 Oct 2023 11:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232191AbjJRPso (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 11:48:44 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2045.outbound.protection.outlook.com [40.107.6.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9435F12B for <linux-kernel@vger.kernel.org>; Wed, 18 Oct 2023 08:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mV3GhGnX77bCWJDXtc+GBx/BQCalJ0WBQJYLVUTS1YG2aZ22NwWD2fPYJYd6a7pwb4jTVahzNikIJmLMR/S8FXc3FNC55Zc0BD6ODOmeRmUqpHeEcpj6KRvRlb6WfVeVJwWIYEJaJIvKqZc7/R7zh1xsmrL7QIAhtzLqTeVuVEkBpe215B6MSwVFDXc8zTZvcxkntE8EuK3K/92X1LnR76EwGpqwLfQQw7oTpMQKTCGtUxHAKwPdXr90HZA7krKuun4WKj4lTreWHPuNK9Us8PbYKsxdjkoiDUo7H8QEB7KdEAHRTVTH1XSbhrLnUciY3pFu1b3cUDtI3tYitfsdcg== 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=lStxfRtmJbGx8B55Y7Ik43+YdQ6g6LH3gZZDz61mbus85+21+AylwHfCXoo7vOkarzz7Qi3JznMfmEU7uI6lqHeCkUDWcIFd0vMVD2zszXYkT1TSlTbJGl2Pz+XdIEyddS3jcKuY7kv9zSysP+DpbNAf+7PZ9UfApUqv69qB2erVlblXTER/8w5R5QwtyceHbe9lSmugVn99gi51K4/ZhXQjZRAfinIMMDGUOGxDBFSjFpHs8NU3+1wU62HSGyVL8P1S5b85VB5TNaHFmMlq6v3dT3xHeiLpv3QP/7oWS2XMsxKFdOa7noLTGXHdxVh/wBI3nCD0PWwcZBDlnBmLkQ== 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=BEaFHAB6VDbsMMlUgo69cCkGE2ySfMOXEGRVbxSovR+vH47CTMfZFlNadOu2vtqcwQuTWtxtt/mR92bTKv4Zlbrp5GCndqIzS3enF5l7E1dfrzi79jRJjRr3EVDYzSktWyxNsmhU80/zARJzbY2A5ETLTRk5IFmdfOK+19iqKk8= 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 GVXPR04MB9777.eurprd04.prod.outlook.com (2603:10a6:150:115::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 15:48:38 +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:48:38 +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 4/6] i3c: master: svc: fix ibi may not return mandatory data byte Date: Wed, 18 Oct 2023 11:48:07 -0400 Message-Id: <20231018154809.3304558-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018154809.3304558-1-Frank.Li@nxp.com> References: <20231018154809.3304558-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0087.namprd03.prod.outlook.com (2603:10b6:a03:331::32) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|GVXPR04MB9777:EE_ X-MS-Office365-Filtering-Correlation-Id: 2deb1180-91c4-4248-c2c1-08dbcff1b1d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tbe+w5H0apfWOZZNQ01OrziD8IaJqDRL8hba/zyUqCkirsK5Cu9nKV8MiYCKE4SoT5peguTEbqI+I6mI5evgK5KXeGh/fBrg+PtAfHuRdp/e4uRlNwHOji6tk1V8YUGLViZVBjUdnkjUyrDYW0QRze0EDf3XerNZpksGeRnVuSZqJWWXsAuQTKqK2WWicMaJN6QTn49ppaUheG4AsbhStMM5pDXvO2Q/zki3kP+84e5x88QSaEezWE2ZI/HBP/oNYraxBFoyVGjNbwo0jyhKfH38KE/VgEnp+UDj9jmiWMn93Xjr3H8i7OjRYi70XelSFVvNxm0AzbPxlb2l0/EsAFA3tEe5fM5y6YAyU6+hiE2+1RjMBCnqT86UZqyZXCTx7In0HGlU2ByDUqKh57SbMnKtnydh9ZKxo0vzmKV+9I+8kITCCu/314AEK3HIWyUc8PnXVbh53k+d6pOQAyeicgwxBP7WOt20mZaEgMTbh8mhsZj2VWwiBkx2EG58GmGLY9nyqm+CbQ3yPPvWP3M57BL/13k0Tx7dc00XebiaVGwxGmP0IVjw5XZZL1L2CWi0smjOx4iFq2uT21CzenLnIL5F0xbUX77shGBb8k8EEeUT/UW/HMpb3EBema/lZN6k 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)(396003)(136003)(346002)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(38350700005)(52116002)(6666004)(6486002)(6506007)(6512007)(478600001)(66556008)(6916009)(66476007)(316002)(66946007)(36756003)(2616005)(1076003)(83380400001)(26005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YjuaCyS/KmCK38k2Ppy9tfk0XizCa6ZuomtOKMGfaE/i03sLPDtbyTnt0+tPPQ/gGYUKnaj4267R39iD2z+lMt4SJtU/dfzhv91t/5Qve6WwPVtIJOdGMR0uTMDi6xZmYu/+BZgAe5wWlAprO0rHyaBDNbMli7XimCK1Es6lQY3bp25xOX0ZsdZ3cCIXsN1KbqRii6MMxVWwmHYBH2YIQnMKGyL5cJM5qwAWnyyYNHmK6IqBE3Cd4RFGdkYyYk7bdiTKT6E0eyx4nA6qOA0/X4FlqFrnJ7JxjVBB/5wGuJGlvpdgMzM1bMzkpc+l6PH5f8Ab/vpqzK6d0dyywCGWPuqjb6gLD0uN3++ilS0aKgrYMJ5SxLaxmKTIjtYeo2t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EDx6/2EGbXlInX4yUwU56VbLe/Fnf5DTPPwLAV9mHOfFixaP7ymd5nZa/RZc6RCkkHlXEehSZhM+9AfYNkNk44Ipzy4rBZpNokcNeLBjFN5A48QZLCOfT7D+M8d1m8ki+JqDm1QLC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2deb1180-91c4-4248-c2c1-08dbcff1b1d4 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:48:38.2040 (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: ogH19tpNhtZkONen2isHhbejKbKjlaM+yO53avLYa8F2Co9z5/rxbVBqscv+CkKEXTQ5HRLXE3thw4NaM2cw1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9777 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:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780109640406232398 X-GMAIL-MSGID: 1780109640406232398 |
Series |
i3c: master: svc: collection of bugs fixes
|
|
Commit Message
Frank Li
Oct. 18, 2023, 3:48 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(+)
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);