Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2095929rdb; Thu, 7 Dec 2023 19:32:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkAKTU76IxX3KyukDP+3tBZs5PXAYqZBr3vQQpll+rke2CJE0tWL3iMgMU84DTStoTvEWJ X-Received: by 2002:a17:902:ef89:b0:1d0:6ffd:ae0c with SMTP id iz9-20020a170902ef8900b001d06ffdae0cmr2565822plb.115.1702006354692; Thu, 07 Dec 2023 19:32:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702006354; cv=pass; d=google.com; s=arc-20160816; b=DI/SJtafsWgwIRa41ZbUEf/p9DAxxQ9Em13Q7m1MY/R0rbEZHRHWmJyrl34j2RJYvp 0rH/ww0C/cfy0+9CLOKCgCH0O0rqZTan/sbjmUTfaHnwXQYVpP29s37HtbDA8eYl1d9D WbhjR0QebtE7KXpd+iRAImQIHrGH3Z/pLJPCo6bE1GKaxWyV/rOqBr2pE11bk1F8LMV/ FieARRKF5QFYnsE9k8xBF2YdmSf1+ji/TMIwSmfomcwnFJ9R8q5gxFyU/nxdG0Sug3zK /LVnxEITxnZVPhy9I+rAxENH2YwcJbIWVvbVfT+iboFwRtiB81vwwScMk9zgBnT7oARJ KbhA== 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=vEQEln+Pxrd+g7XX0Erli+WSVR/HUZwZxj47st23ww4=; fh=WFcqSubssMIwC0Dm7Plh6RRvLP+WIFWeZgWd743wkLo=; b=STm03RMwoe/gXTonR9HDnoIWa/nSG5ivjb55zqNnQzyiPwKuLxxSo6IIZ3Quu1uRPd w3iy3VKVJCXsgCV/JO/v4TcCIG5DqlSaR7m1+TpINGa6ahnSIqKslOLMaty7DAhRbqXo xb1V71UvU97WzYC10RhinGntkHDjtIxbGV7cAnAucTU2rk1RxCsLiVQaC3iiy2Gsmxqp jw54QTkFTaQPDXM1PgIhuwJftsWVmUN+wkLI7oF5jaCu/KPSN5kWewZnIspA4s/8n4K/ nPmjFjp4JReAvF+KzcqwVkFv98wXhOqpPfi3h6wBel65ntBuZCXQigxL5HeJF8Owr14m N4wA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="HtVU/xeQ"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d16-20020a170902ced000b001d0bcd70814si865890plg.294.2023.12.07.19.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 19:32:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="HtVU/xeQ"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0B879836CE46; Thu, 7 Dec 2023 19:32:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232752AbjLHDcO (ORCPT + 99 others); Thu, 7 Dec 2023 22:32:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjLHDcK (ORCPT ); Thu, 7 Dec 2023 22:32:10 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2134.outbound.protection.outlook.com [40.107.100.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7234A173B; Thu, 7 Dec 2023 19:32:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mz+abDYuDut4REYi/I0ZHaabkE4LOY48DilKsT/NGM+ZroVCszEwQj7Yvyuj4ZB4RButAkV+x31Zq194ax7A1pTAWMiMLLIYJK4mweW3DGkMWm1K1262ReVGkvZ8yixpi2Y0N+N+YjGcPLhsz8l2BuWWnZBkhm9iqGKfuXtz+kCMTI6pNBn69Oc1o36ulfLE8r6sDnlvSnLHe0uG+1MbsQO5CWBhF4TNNhMwieea5YQpy5K2CkJ1xhnuM427tY48YIbgz+sup71h/QqjqYUsoEb3rTZYUFi847rCRZzdFl8dwxG22ErA/IrzjP20QeutvS3f4pcQj6vDER0m3M/C3A== 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=vEQEln+Pxrd+g7XX0Erli+WSVR/HUZwZxj47st23ww4=; b=C6hKiO4C4/GbtwPNu3BHdaSGxlDxMpGpc3foMwQURPOgECAB+UXUzb9qfeTUHwtlG/ElAPOY5G4WU8UT7o5YX70TAXLZXQ3p+jruc0W6IGJacWXX2XFHpxG9YbpAXF3oUI6WAerOZDDO8j1JLKjh6ApiyRLbj6EQ4ihxypzrZ1kxxfitj1ewtEfAcB3tAKf5tLUrMV3kTk+wPXoPPALmfNlLujsF1crMi18rt9UzyGVDP7yq/GNA2AtegDESbJ9W7cwL96tWFdV71dsBalvK9SsnGnIkeiHKdNYgA6V2femouzC2WzcnqJfgnOnTG8Ss2XzLNzYpru/X8XO0qpbzmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vEQEln+Pxrd+g7XX0Erli+WSVR/HUZwZxj47st23ww4=; b=HtVU/xeQ1YtTH/424Dr6exUPOAVgEx4hZJp5NYwgNjbPr2FMdtLxuT0iv5dKL5/XAF7mY+I+ttLBoJH/btYs6Mz66f3BYcrnLz6KHmL4Q//IM6bAYw5U+nv9pJLEZw74UJcIDzbSnG7WmKM4ZqD+aQSzX3Zz6VbX1j9dA4BhZr0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SN4PR01MB7455.prod.exchangelabs.com (2603:10b6:806:202::11) by DS7PR01MB7784.prod.exchangelabs.com (2603:10b6:8:7f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Fri, 8 Dec 2023 03:32:09 +0000 Received: from SN4PR01MB7455.prod.exchangelabs.com ([fe80::5682:1d84:171a:1d68]) by SN4PR01MB7455.prod.exchangelabs.com ([fe80::5682:1d84:171a:1d68%3]) with mapi id 15.20.7068.028; Fri, 8 Dec 2023 03:32:09 +0000 From: Quan Nguyen To: Brendan Higgins , Benjamin Herrenschmidt , Joel Stanley , Andi Shyti , Andrew Jeffery , Wolfram Sang , Jae Hyun Yoo , Guenter Roeck , linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Cosmo Chou , Open Source Submission , Phong Vo , "Thang Q . Nguyen" , Quan Nguyen Subject: [PATCH v3 1/2] i2c: aspeed: Handle the coalesced stop conditions with the start conditions. Date: Fri, 8 Dec 2023 10:31:41 +0700 Message-Id: <20231208033142.1673232-2-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231208033142.1673232-1-quan@os.amperecomputing.com> References: <20231208033142.1673232-1-quan@os.amperecomputing.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGAP274CA0014.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::26) To SN4PR01MB7455.prod.exchangelabs.com (2603:10b6:806:202::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN4PR01MB7455:EE_|DS7PR01MB7784:EE_ X-MS-Office365-Filtering-Correlation-Id: 89633b98-bcc3-45f3-f07b-08dbf79e4240 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MzIuvqeKDZG5XaJcallXThTZ6V3wImeTXqCT/J4p/5gfECvMm4UH9QpZrH8TsU1lY87wZjXI8wpKTFxOUJNpj2+Gp/FpP2ppITJrCV/hPOjPsG8iWeDyh2e0scB0555NsMP/to0q07r0va1/XKBp/wKdyhipytZ8KWFtTIESdQwc2zTWZWsuirpYFSOXXIOj6goPRJQscIDpebp1ba33MnoYEqacGXt/KCBvrM5ouJ3TqUDkAWrMC1Nr8CCVOu29xoXWtjmlrP+SlO8+eRljjfO892Y3AYONVv6Qe/5Hr5nwvWt+e0+papRrSv8E2R25OV0efgv99iRGplnq2MW9uzSLH6IFs3TiL9N3GhPeOwQ15z1xPOeP7nU/GEv+1v8WxqTG/NGz+lT4yqqypoE1vXuSLcdmm+mHhj5RVOkVBcJP586lkxtW/2XV2YfCKmP59tO5ih0cEWA0T/SwOAvtOXvbkv5HSJbzxpMOYQ22d2H1LwpXlFbP7wtqwU0mpUWPuTJUj1eICVcqw4YSwtBQaYuJGBg8PURqX13b22dhwGNtiTw4FaZnfnTTWnIWhoJNLKRsomJZHnP6eeKCxRrw+lCjUXNNJW7BRBT8p7MbL4Iw6+9/dNek0tNAL02WyuIt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN4PR01MB7455.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(376002)(366004)(39850400004)(136003)(396003)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(66899024)(38100700002)(41300700001)(7416002)(5660300002)(2906002)(8676002)(38350700005)(316002)(4326008)(921008)(1076003)(110136005)(478600001)(6512007)(6666004)(6506007)(52116002)(2616005)(66476007)(86362001)(66556008)(54906003)(26005)(66946007)(107886003)(8936002)(83380400001)(966005)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?E7OhJtKiDhISKT4bOFMLrFCD63yiAd4gZlbsfaDMvQMHv4LbnPXjg3TqrYdR?= =?us-ascii?Q?rXyh56HCZc1VKwVqJIJpDmZ67OqGl4H89zV9xNImMmlCf5WSzQ6hSvVbIBUp?= =?us-ascii?Q?v8u5BlyoHr+1EDBjfn6Wqv/B5vbhlbmgEhyIbyKkpUvffMuftHtMj61jauuI?= =?us-ascii?Q?GvOe1Dx0C2UQGAuAKmtodvryoPlmnFi5+oeR65d9qUDeEeQOFtrOtiYT7UxO?= =?us-ascii?Q?393nE7ebQzqCFM0iFIxPkkpGJMMPSHIwj2EQi6dLwdiJOkths+VI1tMJmipp?= =?us-ascii?Q?723iq9HTXUbc2ksNnn8jQ9Xl8mWHvl17zIs7t6FQl6yk9yn3QxQKw6GvtaiU?= =?us-ascii?Q?S5AN1s5C1FPF8oLYzwXrkdyAccIJscRlNUMZGXAPCUWzIjni68gbReyHkQYo?= =?us-ascii?Q?9j76Z1rAU6fFWO5/Z9MFBxre2PZSJ3z59JDg7x7nPQsQqZtnZ3k0Nw0tVrDs?= =?us-ascii?Q?Vd6r1j4GNB2G10tYQ3FojMlkgg0Ta2D8A+I8bBQLOW0abb3hyAAuq+xBIMj/?= =?us-ascii?Q?H1CPzmV8aqHby2EfTZZp2BpyTSrpFGWw5p1oHuCANqR91Q4gIxYz0cxqt64p?= =?us-ascii?Q?x4rn3LaF+FaSZReQ1+MDppKgP2eH2j9pFcC/hikJ1C+jjMD42rhH3Kkbbeza?= =?us-ascii?Q?s0Tr12MlOh40pqaVRExKp9mUO5GMfEbelT7DDPsNMaw74nVcH21yU5cCNBxU?= =?us-ascii?Q?IHeAFN9c7/TOjWwUcDaB0f2mJtU+IBuWodne68It1BDqzSyFf9tpJN9TtmQ4?= =?us-ascii?Q?CE1W20HQDH/xnPVMC9iA32ZwBipKYFDcPrkKvEMdy58k8zqirF/9AX8G/ar3?= =?us-ascii?Q?KHTg6BrL491FcZOxqFdNXy6PHqBj3u0VhVC6JZ3EE5evqBJ1+QQXizHvEem3?= =?us-ascii?Q?xOocrPYlm7APLHp6LuTkA22xa77DtiIgwEqbZkEqpOAFsbTDHywR4VKWObRe?= =?us-ascii?Q?zqMWSdvwWCQXCd+E161p5oQHEFInzs2Vtql7BoNNo7w8G5ymWhvAL1GbtLGJ?= =?us-ascii?Q?xlM4X9Ik0ix0nf4mkT2U9BvWmzab/Q0sySKLlgynPGp7mtDbn09Dj/V4WAQr?= =?us-ascii?Q?HFN+QliROH0Bh25VwFT6m/B560f6e94+DFW3j9S2MLfrn+g0W9NgXYaAUNO6?= =?us-ascii?Q?V2UyNgKI9ZkscDa6ooQ9huR61tuxwn29lKsM8s4uz5sMwXQMqJMM9ytXyqAO?= =?us-ascii?Q?hJAoTrkzbRj48+J4teYPvqLj2BnB4oScCGyFmI+UucEOIwbUA+MGbTaYlQNQ?= =?us-ascii?Q?1Jypfap0kZrzW3WhylykMKNrOwk71LkDbHJBAv1y/nvmyjE6vOZpFroZrwA1?= =?us-ascii?Q?0HrWkCKzLElb80P++OMJFKpZQ0ciwxNauyr7/3/5rDO9H9i/eHWnkm/BFWpk?= =?us-ascii?Q?TXbhOoBwuxtL+1gfUMOUn8cD/76R3L0ofaTZAo2ov8p4YULHYzRK1UUtq+0y?= =?us-ascii?Q?r+xV/eoRMXBV5RwGpbAXqIzexzjdZem99TsUyS65meFmUAmjfrBd+NKDHL9W?= =?us-ascii?Q?6glLHU0QQQx/WNqZ8ynoyMcIxEccvltCpXcY1rV1rv47TmjT5HauCmvtSNw/?= =?us-ascii?Q?d8TgKpQoMGMIBRjlGdphjaReEkjp/JxqFX66486G3OtWqAiOz0NuKYbOAGuH?= =?us-ascii?Q?J/sEq3a6Q/mDECKOzza4pTU=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89633b98-bcc3-45f3-f07b-08dbf79e4240 X-MS-Exchange-CrossTenant-AuthSource: SN4PR01MB7455.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 03:32:09.5231 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Z6G5GZfauDSwV1pkNdn6C7ZyKp0fstj/PFCss0K9VIKwXpQ73DIk/NDj5D9nLFM5/Qlv9Xh1nPUZvNNumCLD0f7Iu0r+SMdo+Fw8AkxcvIs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR01MB7784 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 19:32:32 -0800 (PST) Some masters may drive the transfers with low enough latency between the nak/stop phase of the current command and the start/address phase of the following command that the interrupts are coalesced by the time we process them. Handle the stop conditions before processing SLAVE_MATCH to fix the complaints that sometimes occur below. "aspeed-i2c-bus 1e78a040.i2c-bus: irq handled != irq. Expected 0x00000086, but was 0x00000084" Fixes: f9eb91350bb2 ("i2c: aspeed: added slave support for Aspeed I2C driver") Signed-off-by: Quan Nguyen --- v3: + Change to handle the coalesced stop condition with the start conditions [Andrew] + Revised commit message [Quan] v2: + Split to separate series [Joel] + Added the Fixes line [Joel] + Revised commit message [Quan] v1: + First introduced in https://lore.kernel.org/all/20210519074934.20712-1-quan@os.amperecomputing.com/ --- drivers/i2c/busses/i2c-aspeed.c | 47 ++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index 28e2a5fc4528..1c2a4f4c4e1b 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -249,18 +249,45 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) if (!slave) return 0; - command = readl(bus->base + ASPEED_I2C_CMD_REG); + /* + * Handle stop conditions early, prior to SLAVE_MATCH. Some masters may drive + * transfers with low enough latency between the nak/stop phase of the current + * command and the start/address phase of the following command that the + * interrupts are coalesced by the time we process them. + */ + if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) { + irq_handled |= ASPEED_I2CD_INTR_NORMAL_STOP; + bus->slave_state = ASPEED_I2C_SLAVE_STOP; + } - /* Slave was requested, restart state machine. */ + if (irq_status & ASPEED_I2CD_INTR_TX_NAK && + bus->slave_state == ASPEED_I2C_SLAVE_READ_PROCESSED) { + irq_handled |= ASPEED_I2CD_INTR_TX_NAK; + bus->slave_state = ASPEED_I2C_SLAVE_STOP; + } + + /* Propagate any stop conditions to the slave implementation. */ + if (bus->slave_state == ASPEED_I2C_SLAVE_STOP) { + i2c_slave_event(slave, I2C_SLAVE_STOP, &value); + bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; + } + /* + * Now that we've dealt with any potentially coalesced stop conditions, + * address any start conditions. + */ if (irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH) { irq_handled |= ASPEED_I2CD_INTR_SLAVE_MATCH; bus->slave_state = ASPEED_I2C_SLAVE_START; } - /* Slave is not currently active, irq was for someone else. */ + /* + * If the slave has been stopped and not started then slave interrupt + * handling is complete. + */ if (bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) return irq_handled; + command = readl(bus->base + ASPEED_I2C_CMD_REG); dev_dbg(bus->dev, "slave irq status 0x%08x, cmd 0x%08x\n", irq_status, command); @@ -279,17 +306,6 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) irq_handled |= ASPEED_I2CD_INTR_RX_DONE; } - /* Slave was asked to stop. */ - if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP) { - irq_handled |= ASPEED_I2CD_INTR_NORMAL_STOP; - bus->slave_state = ASPEED_I2C_SLAVE_STOP; - } - if (irq_status & ASPEED_I2CD_INTR_TX_NAK && - bus->slave_state == ASPEED_I2C_SLAVE_READ_PROCESSED) { - irq_handled |= ASPEED_I2CD_INTR_TX_NAK; - bus->slave_state = ASPEED_I2C_SLAVE_STOP; - } - switch (bus->slave_state) { case ASPEED_I2C_SLAVE_READ_REQUESTED: if (unlikely(irq_status & ASPEED_I2CD_INTR_TX_ACK)) @@ -324,8 +340,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); break; case ASPEED_I2C_SLAVE_STOP: - i2c_slave_event(slave, I2C_SLAVE_STOP, &value); - bus->slave_state = ASPEED_I2C_SLAVE_INACTIVE; + /* Stop event handling is done early. Unreachable. */ break; case ASPEED_I2C_SLAVE_START: /* Slave was just started. Waiting for the next event. */; -- 2.35.1