From patchwork Wed Mar 17 06:53:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12144955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99C52C433DB for ; Wed, 17 Mar 2021 06:55:47 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3D6764F99 for ; Wed, 17 Mar 2021 06:55:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3D6764F99 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yRHfRTrsAG97lngZqTZEArqJx6dF5STjtmGztnkfmBE=; b=I2djEzcQSsbpNMxOhZXOrE35L BFKylbBxnaOeHaYMiUbtXn8yfvO7m1bclmssfiwUElT99LczfYHCbn28mLcPONz5nOiHrVbS1xlyc 3JVCcfw1xocU62JVVsoQ1WK2Bi+7hRUmiFMjiTP7dRNE95RqGRimhap5AiUbs+XZRH1K589P6fVEg f+Xq3E/6XNjXhVUYURmXyWCgp34TdpTigC2xdwX6bv01GTJjb1iV31KEIlYf3Bg8xwH22+YEes6BO 4UTPTfiSzUULBw+9w5mlP7KMK7Mbb8PbVI3WziIABhp1dnyJ1/DCN2CN5vi5YEEcsh7wbqYe5YJNe 2dDUWkTJQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ4H-002bAx-2p; Wed, 17 Mar 2021 06:54:09 +0000 Received: from mail-eopbgr80048.outbound.protection.outlook.com ([40.107.8.48] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ43-002b6E-SC for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 06:53:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQSijPWpDwbpZ6PRVq9SgzItkUFGzx/0kIJKzV1+TQ3gCeymWvioKWIYFE1cllwMFKh0/hROjQVHXy0NC+/jrsVxGZhGDQnjB/IKLHjQitzEHYb1O1ESHKkH4a0N/SM2zH0K+8Kj6QbnbB2F6S1Jel9NrDQ/kTGWk2NZFXTiZAuWPwtYtiHw8zt1zkem0GRmmIyFhBUfNBAxmA2emb5loiND6MRgZ/akXyL2+Ki9jM9r9j47gt4zjFGjj1kOE1qeblWsLEpGHsjVx0wIMLlep8p6g5WUicxnR4LWt7+BSqAUobVL4rstUsPYusY3oFamiH48YTB3InHnnxDtAqZwmA== 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-SenderADCheck; bh=9Se8hWqGvCo9wJQw1RkitCxcl2pq7EcTPAm1sjr//KQ=; b=JVNAkeXaXwogc7XkHh7euH6pR3lzpWQTovFlbUzgOCyzSjANSM7rUOczedxqMwwO00JthvwCwLyPA9a/5D9rO6V2jkHjevYA0OcZ4eqYZ4PKgM4SVloTPtbeM7S3/PHMFLI58KgXdeEJSIosL6t6Q3HOaWXk2YzNCzyid1ufZiwRF5OfebTQf4GTPs7JAqNIEIP2W6/oGapfnzT4JwIPVOZoL+Mg5IO+bltltWb2I5Koe6swG/2KSZTAYt/OYBBX0oc7XKEe6I2QRohLE5DF4nS24vv/1o/2haNWIx23qWIpLHSx26YEFUtXK922RIO1NCtmmTBnzm8ko2ppZMJnoQ== 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=9Se8hWqGvCo9wJQw1RkitCxcl2pq7EcTPAm1sjr//KQ=; b=NKN+px0ww2+yL5lbRGw46IaJGmIXTWzN8m2ZFbbGpIMturOXc39DCt9u7s+SkbdVYQ9kmnRGaHvmRkK1G6Lfv8lfO15r50iy3K/HJVctPWXoCbtJZq3t4XAKqtr4pRIc2FyhuWFHhOUfQqAtucLg+D4gh10UjGrqxJJp9wboYi4= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) by AM0PR04MB7091.eurprd04.prod.outlook.com (2603:10a6:208:197::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Wed, 17 Mar 2021 06:53:52 +0000 Received: from AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236]) by AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236%7]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 06:53:52 +0000 From: Clark Wang To: aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, sumit.semwal@linaro.org, christian.koenig@amd.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/11] i2c: imx-lpi2c: directly retrun ISR when detect a NACK Date: Wed, 17 Mar 2021 14:53:49 +0800 Message-Id: <20210317065359.3109394-2-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317065359.3109394-1-xiaoning.wang@nxp.com> References: <20210317065359.3109394-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) To AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 06:53:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 96b3eca0-040d-465b-8662-08d8e9116cac X-MS-TrafficTypeDiagnostic: AM0PR04MB7091: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:741; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IwM31GGqK8BF4WOu2azxXFYhwaGiiTrsM1DRwRKlAczaeZd1auXah5iCRCmXUhWWXGZWevDTsDTTSgx7z3beKqoTawuhj8cgXB1qa+jTf1KUybllT/ws8iNYrnNQvnSShqqaSE/tJBxjAHO8le0NnU2ib5px3TlxDWEq9kaVBrBCs4S8axJ7xL79UMI66KrW/tUVJBpUxnQ6B0M/n8hcqdpTC0qHjCQI//0m1B7k9ajD82M+/g2nFIX88vh8kG4LB/XIwoZiV8eLiXnpOa2uoKWdthyDW3JIvCn3V59qKyVxZUmeb6b1BY0OCnK5uVY9MBM5d3ePOL398WlmcbCFen2gUgfrIIfSsyRtG8kCdUAuySbWAtJ1kTJ0Dh49C3ANk5GU/rWlxAAfvr0SEQqjuk6WpBl0zfdYfRFD1PeSwEhjO3VGzOvyNAb/xap7sxY3c4h/573ZyqzOc9REUXeMNQJM3OSKVqp6M327ZJN1YwwFwcBExzhFrg+AetHRC1Du7D/pmjP75UMRmDzyjewiYWFSq3TY6606BJkkKCsgYD2+orXmcfwUPCcUfrL9z93JYXdM6wropGz0OYzmFEVZJ9V9VYZ4o4KhVt9sTQ5J7PXUggtPA13Na7BMrZEVt673 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5618.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(376002)(396003)(346002)(39860400002)(136003)(478600001)(66556008)(66476007)(69590400012)(6506007)(66946007)(83380400001)(36756003)(16526019)(5660300002)(2616005)(316002)(2906002)(1076003)(8936002)(26005)(52116002)(186003)(956004)(4326008)(6512007)(6486002)(8676002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NjvVRzFk502hwF/Kssyyw4GRVrONJ+v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GaYIeGrwhLHfYbvI6/PW2L6oT2VR25ENPN7t7dJEXkByPjRDTR2hwINSOkVn0tlhdTM63T0YeTIKLdlO+6ucTes0Egs4RnPFj3buBhFIckMYlTBQZ7TFmUbUno98QGgwetsCG0t6YXEMqr5xo8rLZXTdNr42u8rLXEVFwLCqEp/iZVAyn+16JX4Q9mH+WYCI+CpF5at9vgv9fM4lCSKCwMybJt57BECnCXaO/Yt3mwKHwkk X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96b3eca0-040d-465b-8662-08d8e9116cac X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5618.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 06:53:52.3464 (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: nAYj9Q1EKiKIAOMBMSNuE431/uFlI9RGwimzhYfU7+lb+Fyfh7yuLI5uIVpaom+jEVZey5wZs7nkygDJhvtbww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7091 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_065356_115284_B84053B7 X-CRM114-Status: GOOD ( 14.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Gao Pan Signed-off-by: Clark Wang Reviewed-by: Dong Aisheng --- drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 9db6ccded5e9..bbf44ac95021 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -507,15 +507,17 @@ static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id) lpi2c_imx_intctrl(lpi2c_imx, 0); temp = readl(lpi2c_imx->base + LPI2C_MSR); + if (temp & MSR_NDF) { + complete(&lpi2c_imx->complete); + goto ret; + } + 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); - +ret: return IRQ_HANDLED; }