Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5864115ioo; Wed, 1 Jun 2022 14:24:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQnYohd9GfF7ibEntob8swYoC+L2lYEa3ZmGQSm/CLP5f708H5eu4Ys6FnIm7/OKkxUAJd X-Received: by 2002:a17:90a:6b41:b0:1e0:e082:14c7 with SMTP id x1-20020a17090a6b4100b001e0e08214c7mr35951188pjl.92.1654118640765; Wed, 01 Jun 2022 14:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654118640; cv=none; d=google.com; s=arc-20160816; b=AirooHIJw8xeUeD8YM7M0vtr85GWnBVgyO3FcduZBN6ysvXTW87onOAWF8jaRUqOo1 GM+2S0HX/v5b4xYrtG3c3AQjKgTEqyLJ0+toYn8JiDq9zpXnb2zA3vEKGGCQgMoflJ80 KfpGUCIcMXxg6c57pQ7dSqe35tjtpofMm7cHgMTKTcst/Veek/H84uHQO7IEAbQcV72P TYx/iO8mMCZEcUidQrLBmGIh2YJe50UZ54KroHJLn0hNN9ZJDgyTBA/FFFh7qXhUH4Mx s7Tj8b3G88rnqRz7llcUdfzllOFz/EgU3l627exaEmIhveD93vWnMKFuLix3C13aiUoe UnWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from; bh=gqwpWiuGU6dBjOJrGZDnPzcq8muo17DwBLompy8oTQk=; b=QwiHshgRQBQr2e5oETt9V2UmIysFaKz1lbd1vgIDxuu9bPLto3M1WChXoAyO+LOwzv K10ie/XNsJ8aiKfd9GQ1wut86TyLY/RfNjyZ+zRMBGA7z54EOj63Jmk2S1mdDlqM8iF3 EQ2Q7S6BIPMxiq7AIyUabJeihKtp7UPS3LAEhyqsKIersjUF3hEBX5qKIeb8uAH4WeXm g8i9FpAIQaND5TQ6aDHplLl+5k+n/QsRy+6ET3kTyuDIwteEBXnn951S3v864ALDLEiN gBuXft3O89yXU/tNCzCXs4chKAFGhpqr0yxns3SKYUmX9TzjpjZKamIQhetasmRcmfrx D+iA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t13-20020a65554d000000b003fbb78b87b1si3718898pgr.204.2022.06.01.14.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:24:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D79B8304112; Wed, 1 Jun 2022 13:15:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245229AbiEaJbw (ORCPT + 99 others); Tue, 31 May 2022 05:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237326AbiEaJbv (ORCPT ); Tue, 31 May 2022 05:31:51 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D75E627C for ; Tue, 31 May 2022 02:31:50 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 24V9HLNb095917; Tue, 31 May 2022 17:17:21 +0800 (GMT-8) (envelope-from ryan_chen@aspeedtech.com) Received: from localhost.localdomain (192.168.10.9) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 31 May 2022 17:31:46 +0800 From: ryan_chen To: , , , , , , , , Subject: [PATCH] i2c: aspeed: Fix slave mode unexpected irq handler Date: Tue, 31 May 2022 17:31:40 +0800 Message-ID: <20220531093140.28770-1-ryan_chen@aspeedtech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.10.9] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 24V9HLNb095917 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 When i2c master send the new i2c transfer immediately after stop. the i2c slave will see the stop and new address match stage together. And it needs handle the stop first. otherwise will occur unexpected handle isr. Fixes: f327c686d3ba ("i2c: aspeed: added drover for Aspeed I2C) Signed-off-by: ryan_chen --- drivers/i2c/busses/i2c-aspeed.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index 771e53d3d197..9f21e090ce47 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -252,6 +252,12 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) /* Slave was requested, restart state machine. */ if (irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH) { + if (irq_status & ASPEED_I2CD_INTR_NORMAL_STOP && + bus->slave_state == ASPEED_I2C_SLAVE_WRITE_RECEIVED) { + irq_handled |= ASPEED_I2CD_INTR_NORMAL_STOP; + irq_status &= ~ASPEED_I2CD_INTR_NORMAL_STOP; + i2c_slave_event(slave, I2C_SLAVE_STOP, &value); + } irq_handled |= ASPEED_I2CD_INTR_SLAVE_MATCH; bus->slave_state = ASPEED_I2C_SLAVE_START; } -- 2.17.1