From patchwork Mon Jul 24 10:55:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 124817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1724793vqg; Mon, 24 Jul 2023 04:14:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlE904vD9BVr9nMwCWrjkkNP14yV7OPQ2bMNycVkYzPFq6zjSv36EivwVvpXUOTKo8mUwc/a X-Received: by 2002:a19:3814:0:b0:4fb:8926:b137 with SMTP id f20-20020a193814000000b004fb8926b137mr4237782lfa.33.1690197289994; Mon, 24 Jul 2023 04:14:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690197289; cv=pass; d=google.com; s=arc-20160816; b=mEMAaMXJlykXP9fJTwLJlz0NV6O2i/M1bkEVXu7ROI1GKgXcvLGdK4aaB3HOwxQ2ai 4W+XB6CLaCiWrS0H9ZNEGHa/oa5UVxfodoIJkc+BCusF2Xry/9nTHrkOc2GLwlyBM5c9 LTZy5Ncv+J3+4V4MkwWjVYj/D92LDn7qze62pMDyR6GsmI4l58n2nmxs59aKpcX2jTYP +UR8VBwpC1Nk+iu0j3V6/UJqEjDGdXq78umYTcbRNy/6UFw58PX2QQq4wJKkxcy2fNlS dRrjqC9TKjRksu0ddoV8zN4osHixiJi2bwaiSyZeWz6723ujjvJL35sreyYhJ63RlzJI cdag== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6B52Xpi9DWPuNoI6324N8OwegJ6KPde7ZbNqimD6I+E=; fh=qWdxfVzWWvfmRVLDefanEuScnmFvja5nO5s1FtjPlJs=; b=yvQScemgr/2+bPvuBCtHz0tC5hppVuEU8lDWQtDisd01ObU0KeigRfb2c+XFfDhRN2 49QM7+AeMtynaIeTa3ew5Vq2AiX0ChDdv5YXBx2XW1q8Gxtoz+IJlhW/E6/Kjf4rxT38 D/+SlNKG/0j9Xb1DvNjaBqzIA3r2xF9Qm/FUIQsQ0ii56YxGhVcTxYugNaBcR6eHLsEF d5lhU4ozGiTxnPb3Ncwo8U2fx3v4+O6mPqCh9rOQuqgid4kP4ql8ZVnmnHahaAKqkf8w 8aiOc+t3hl0lcczMkhAD9Ipyb0v+eThQcn/2jki3zLx0Ovjwtb6X8zsWsyP51DRWlrmo Lotw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=L6NkzNU8; 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::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020aa7cf89000000b00521029a8eeesi6831535edx.313.2023.07.24.04.14.26; Mon, 24 Jul 2023 04:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=L6NkzNU8; 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::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbjGXKwT (ORCPT + 99 others); Mon, 24 Jul 2023 06:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbjGXKwR (ORCPT ); Mon, 24 Jul 2023 06:52:17 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FE0114; Mon, 24 Jul 2023 03:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIDUXLIS+Z8roHuO/psqNtBjxnaoZ0LSwU/UVsdN7qqWRXq6RndauSdd+a4LZBtL2WM/h1zB6934VHvUAutEZEIma9gskIwD7w0cEgIyju38dyDUGpQ82K9dBdGp4XNoH4DD9TXFeXEwCEacr9gReetNs3h1fbb76YIwWZW1WT47NWy3TvHJwmkoeagOhBBpa/31oH5Q5Kc6QFLrfzh7ZMeHq2hLmm0HQzBuBDU3lIgqbad0UywNi7cNYpE8g63HuhI/baBpUgy8HK6awu1wvGlx/TQ+Mv5qMTEQzKXfWRv4j1sjAGUSGjolwwuNqgCc9MPsKbaKj83oPLai62O2Ew== 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=6B52Xpi9DWPuNoI6324N8OwegJ6KPde7ZbNqimD6I+E=; b=lB5MN5JDjUKHadk7s7upEhXU9hkRg2fEmSNQEsgLX2aHn28dJJY90pUO76lwws0afMTOkd9mXy4dJ2i6OMZCgcCjvbqYqIOQkyc9RCuoOliW/yxCkvlwHvXy9LXMj9YE/rAdAHpF281ggCBce7H01b8e1lpFV4fwxXl86oPZA/uZn3BB74IfYgr6G4qdb26xoj2GUbI18XR4fL+EKuQMb2vXwHST9c4E8flwf48Pc9C6qYMlvozmaLsrLZ754EsJbhT31CsZ5mtzLLzrzT4zA4lIejjj9pFunG2NMsRRj8skD4DWz/Rg9E85SUsmxbowoFJKEbn1dH/KSd+hXK00BQ== 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=6B52Xpi9DWPuNoI6324N8OwegJ6KPde7ZbNqimD6I+E=; b=L6NkzNU8wUR0x6iVzy5KnCdVDqFE11yJx6J+Gzlsa1MCCB3+gIN55sGPfFOziiX2cvnv+PSgj3rN6ZhWe78czOlS5ehM+0ERV0yi0UIARgzau9gMkJokFTbnwra6eGXcY/sPS9olaRP2GINNGxyMPklEWNLRTteJVyf9hqVQdqs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by DBAPR04MB7288.eurprd04.prod.outlook.com (2603:10a6:10:1a3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Mon, 24 Jul 2023 10:52:06 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::7f26:a98a:b8c5:f620]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::7f26:a98a:b8c5:f620%4]) with mapi id 15.20.6609.031; Mon, 24 Jul 2023 10:52:06 +0000 From: carlos.song@nxp.com To: andi.shyti@kernel.org, aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com Cc: carlos.song@nxp.com, xiaoning.wang@nxp.com, haibo.chen@nxp.com, linux-imx@nxp.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] i2c: imx-lpi2c: directly return ISR when detect a NACK Date: Mon, 24 Jul 2023 18:55:44 +0800 Message-Id: <20230724105546.1964059-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0032.apcprd01.prod.exchangelabs.com (2603:1096:4:192::18) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|DBAPR04MB7288:EE_ X-MS-Office365-Filtering-Correlation-Id: 5185faa0-f32c-4894-2a95-08db8c34057a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: klHiqSx9tAgwVuzsrqOR4qmUsMGRBRkfNZzTiCg4FjoBobrIg00zr2yq0eSGtvrsQafe99fNmRJ0VCnRo5uujkyhjGNGXRn/WzFIMQK2X3OzLubSOvO6HOWugtrPjzWv2qBi4TmbRDcqWjQMQKJUo1sUbwAjBDSptiVQLRRcOomUZvV4gBCSGuQjQyKKsLiFVJqCkv+TMZ159NGNKEY82nAmNFcbh2EdbvWg6r1zpPR7Ra1qvnKTkp1M+X3GCDgYeqNBl8M69bC54F28/eDoVPtMYcYyJhOYL4k/TSf7PHlMxUOUk6qgFQhAjlcpinh5bIZAsc+pONnPBPBLmSqXq+RN2zQ+1PiBkexjic+dGhqVAyvEQwhnM/SZaYR/D2tg1Z82vBTEgAiN3+cUtxtykzaaAcaVIlBCpb3MuOMv1sRPPk/51wIbC7uvVbuXr0rqRS2CASWjk/lKc6IeP0iWEi7bf1JR5v+K45XJPOTOR0B+GxTGDdgoWfSte7pPJHDmVIRQIeQzg1b9A6zPaH7J8DGofUivO6VRUz+s8iPpFzeENFnEvjS5lI4wZVxhqZX3KnUHn2bkKwybysOiRHE+O9VJhah9Vw5FmuwIZspmLqWn9oTsPycBx5DuTrWN+mzA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(376002)(136003)(366004)(396003)(451199021)(41300700001)(8936002)(8676002)(316002)(66556008)(66476007)(66946007)(4326008)(2906002)(478600001)(86362001)(5660300002)(2616005)(6666004)(9686003)(6512007)(6486002)(52116002)(38350700002)(38100700002)(36756003)(83380400001)(26005)(186003)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BJSeWJNc1SekrAVCPr7jVMKgsWeVNbQh+3XsGa9dwM+3BUir8+flYCu78ndxoewM0qQrtlBERX99lVgnuNf5vuQW3WRtnBfQQ8C+Q83appOy5ZpbtvG5a24fDqpQ/GIQTz9PydFRHJ9dde3sP45JUycu7W7AG5jqzP4tDBIM9xfk7QJnjbvQ8+AVSzd07ZzBainCpi67hpwoH8D458bXWOp4FhdJWAT/Uy9278Yw4EHnWcXf+ZJUafh7SIeQ2y3gGzZKKhKfmuJq9oF7kVNqvukyLRD72C/oHVBVmz9OJIVImL0K3Bp4NlESEZb5SwdqM8KZKHJOdKRChTiNTAXvhxPN+fX+p48ZyC64uO3B1tTM+f8lqyb0uzV9sCGR4uuQh7aWKThCHh39uk5Y3UkjYpOYal6hAUj4NP+Z0Vdf1hKZ+Q8yV4AG9lvoICjqmQFqaPg48bwZpg9nW+E/d/dAM4FvI8CuViVa2m21g7fwbJGI4jWmMFvG/PFnG/1xTkwACC3Kn5YGTTA2d8SiXsnSCCB+M+mYhCtkfa27uH5G4G8bNH25wsWgR8mniwcohcBGm61VsJ4XB3A0Ge8VKR0NsZgpikGrVSmm4DlfEqnVA6bRKICT2Y/9CNSrp5zQPIUXdiiipHwNNuwex7D2f+ypAtt9fHg4UoxyJVEg1b85kxiGjm+lljQqAXH7ZXe2zqg1gcOztG7tel9UR+HPyxxKLI+u6qWJf6bkdSI6XPujynuDZiJh/fsatMx52SIokSrpYe0idI+z44ZsfYylDl9+9vMZzElLrq7Ktc9Rk6T5Myvaqruki+2b3iFF7l6hwvCVopZ+Kej0pw1FaFQ8pDFfV4Lrj2sBUXIO8MoNMmVGauUkXdxctRgyzYfi8zRZc4PxgwqLxIFsvdeD56YZ1Pq36ZwRGmZyCteR/5mrqm/eD9AZm0j6a6kWb3AIKojcie1L1/YBiAXNWREIK0eUXO9mrmNyX8t2FAGT/AQ59NJQ16xObwC/0bUxKZFGXyDv55FL7za3/pym/s4d+94tN7o4/u/3c8W/xcjyEU9V91iYHwsGNJG2g4wIVIKF3u12XHUkkvsBVLHmpyfgbBImTUDs05HstDaXVAgnTiX2yZAB4SqxO8UeQ3EMwv154OO93NkrB5OZahyIDisqlFeWXekJII3tll7aDlr7z5EPwi5oUB8BD/WRZQOFiYC9qqBoesoiNrQr4LqJJGpwXT4z6tsS71Qn6Yp08es5kw9UdSZhUY/RQnWLUyKTaBYEB99QCm1erdDnHhimAeSCF5BXUkrzdreexveQGJrAv8O6JTqMhsSvaHAbvqraUUCikOJj1lx6KcJHoMUnmp+QsR4W7LK/hML9/JaRxbeFa6TSCu1UNEaRkNdPuvDu90bD7QX5WBwslY9dcKikeffyeSjISS3OfeY42iVaEPsgmb8xsETMxPONNiNw3hBft9OJY6ZAiOMSY+svZZrQL0Es9jZ3QnNNsHxySZlz2MlheT11VYsZUdTg+1uOcGeJE8w25x7CoEa+Oq2Dzv7RtWl3f/lAyeEQAgtwTNCosh+UAf1a2pdMsJYMQ6WJ6b0alUqq3zN3KTnO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5185faa0-f32c-4894-2a95-08db8c34057a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2023 10:52:06.4582 (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: uSIry2RRLxWv1Jvyq54WQzYtkNSgV4jVuIMB0ArdV9G+VpSCQ890efRaC2SxGggK2hcv1OEdPrYydsWxGwtfcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7288 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,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772300313342023888 X-GMAIL-MSGID: 1772300313342023888 From: Gao Pan A NACK flag in ISR means i2c bus error. In such codition, there is no need to do read/write operation. It's better to return ISR directly and then stop i2c transfer. Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") Signed-off-by: Gao Pan Signed-off-by: Carlos Song --- drivers/i2c/busses/i2c-imx-lpi2c.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index c3287c887c6f..158de0b7f030 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -514,15 +514,14 @@ static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id) temp = readl(lpi2c_imx->base + LPI2C_MSR); temp &= enabled; - if (temp & MSR_RDF) + if (temp & MSR_NDF) { + complete(&lpi2c_imx->complete); + return IRQ_HANDLED; + } else if (temp & MSR_RDF) lpi2c_imx_read_rxfifo(lpi2c_imx); - - if (temp & MSR_TDF) + else if (temp & MSR_TDF) lpi2c_imx_write_txfifo(lpi2c_imx); - if (temp & MSR_NDF) - complete(&lpi2c_imx->complete); - return IRQ_HANDLED; }