From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.1 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,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 40D96C433B4 for ; Wed, 19 May 2021 23:31:30 +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 AF099610CB for ; Wed, 19 May 2021 23:31:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF099610CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au 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:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RyapwL95j+DHNfyN29dt9vk8ClRS9B1b+PXBGit+j5s=; b=VLA/vQZZfjKftjsT9oMJ5NYpk 8zuSxjeiphMKrhD2QKemWrfUeif3QSAqmwV/P5MAkhaBf9T7TQVFWxmxT4eyrPsPKYnNZl/Z1RiQj lluM1WZUi7/Yk3NhQmf8MNQ/FB/cwF778uJvjFHE9kaQRP4ORlWNcONaBXv7wO7mgvy51/ZjcmgzV tHVmWpDDjLOAP89K38GF36afELkOpYqW9K3huAghESSCXWW3EiQ3d5N8+4IiU1yXij0cl8h3cmxKJ zb7Sgwkr1FOZKV5inw9LrBmY5jz0Nj8GldsR7XKks8W4ASIyePIPgpgsMUiMH/N4WUP/Ve8HNT8SD qvLk5IX6A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljVcZ-005LMZ-SI; Wed, 19 May 2021 23:29:00 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljVcU-005LLw-Pa for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 23:28:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+sRe31lrHGcUgSFKKGzM5XKzbij36J+nU6GLQsIGJJk=; b=H5vDpVUF0dYkpnmc7kDZaMn76G eHlj1P9ng8hiLnhdEzBmKiq0ZDtTTiXrkh2ZydzJMk1wlkU9Jh/NEghqOJ/PfwWMH2sFdH7FmfneZ Lj1JSdr84IBzn2MXJusfiNwY3kby3mZxTMuyMOC7iTTzLMkYP/K9aUocmN6JegqknzAVDyYCl4cXS h2XcBR43/kEN5exVIVTVZUZcm4U0D655R/FOfnqimTNW6EYbthdKjkc37PIORbQ4bbzI8IykBIRWU q5TAjqmYjjp5T5YnpASXJVtvvpOTVc4F5uziXQqXDh5VmbnE4iG8CePr0EjdM2T9MvHlb8GBZ62EK uuJiRTxQ==; Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljVcR-00FqME-TI for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 23:28:53 +0000 Received: by mail-qk1-x72f.google.com with SMTP id 76so14457858qkn.13 for ; Wed, 19 May 2021 16:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+sRe31lrHGcUgSFKKGzM5XKzbij36J+nU6GLQsIGJJk=; b=HAOlx4M74XjBWQ8LN2fsuibOmX34Rxz0V7tqxzf7ZIWM+X+lRP/M7KyCNN/h19Q2ze ou41sL+m6NfWT9Y4u75hnp/iUQWwcpgGnc3lU4BxL1BpRf14BKJUseUHnAKYSRbMoIbB 8WFQrW9H6mTEzhMJ8n8yJGvDHvomUkP+pmbBM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+sRe31lrHGcUgSFKKGzM5XKzbij36J+nU6GLQsIGJJk=; b=Lu8naleIVm6ISEz5pcSFXCN2Tca5HdvKMHo/a86MmgDEk2PY0o4h9R6YzPGARZ9bqf xmH6T2yFp+vNDK/y0mK5WljFTUet8fPngDNGmUfd+CclhAOfpXtS6xhHZSFcmcQlE6F7 qxQ9yHcwBbyeWLWlUEeXCzIA1uUpqWowOPdDSJQhaClmqxgLEdRZuJy4c7YUCk32fbJf py10h+vpWZB84uEm8/MdnMM/8N2J5QPrDv0it1PQXlZG+uVjORXApuqUJQc70XdD5+Kv Tfa80AXYy9Pq6HO4YXXuq7Kr5LLM0+2r7cot9zDS9Flel5qtlCSgdZs5xzVaiQId7PNT JSlQ== X-Gm-Message-State: AOAM532pEfrqdvPnDfI9gHmXPhot+jUsTmQQxOdUaAMzvmNoW3R7ojZu 4jHpGzS8q+Ymlbu5noTUypJ7QDOFlorThGL3a6g= X-Google-Smtp-Source: ABdhPJzs/PNVyZHXiN60/U4ROwriKRalRsyur5ioWhvG9uZxMJo/oQyw0WnlQ0RLEb2ucWzVwat0FQEtGAkFU+vY1FU= X-Received: by 2002:a05:620a:704:: with SMTP id 4mr1279089qkc.66.1621466929079; Wed, 19 May 2021 16:28:49 -0700 (PDT) MIME-Version: 1.0 References: <20210519074934.20712-1-quan@os.amperecomputing.com> <20210519074934.20712-4-quan@os.amperecomputing.com> In-Reply-To: <20210519074934.20712-4-quan@os.amperecomputing.com> From: Joel Stanley Date: Wed, 19 May 2021 23:28:37 +0000 Message-ID: Subject: Re: [PATCH v3 3/7] i2c: aspeed: Fix unhandled Tx done with NAK To: Quan Nguyen , Ryan Chen Cc: Corey Minyard , Rob Herring , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree , Linux ARM , linux-aspeed , Linux Kernel Mailing List , linux-i2c@vger.kernel.org, Open Source Submission , Phong Vo , "Thang Q . Nguyen" , OpenBMC Maillist X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_162851_972164_937F504D X-CRM114-Status: GOOD ( 26.57 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ryan, can you please review this change? On Wed, 19 May 2021 at 07:50, Quan Nguyen wrote: > > It is observed that in normal condition, when the last byte sent by > slave, the Tx Done with NAK irq will raise. > But it is also observed that sometimes master issues next transaction > too quick while the slave irq handler is not yet invoked and Tx Done > with NAK irq of last byte of previous READ PROCESSED was not ack'ed. > This Tx Done with NAK irq is raised together with the Slave Match and > Rx Done irq of the next coming transaction from master. > Unfortunately, the current slave irq handler handles the Slave Match and > Rx Done only in higher priority and ignore the Tx Done with NAK, causing > the complain as below: > "aspeed-i2c-bus 1e78a040.i2c-bus: irq handled != irq. expected > 0x00000086, but was 0x00000084" > > This commit handles this case by emitting a Slave Stop event for the > Tx Done with NAK before processing Slave Match and Rx Done for the > coming transaction from master. It sounds like this patch is independent of the rest of the series, and can go in on it's own. Please send it separately to the i2c maintainers and add a suitable Fixes line, such as: Fixes: f9eb91350bb2 ("i2c: aspeed: added slave support for Aspeed I2C driver") > > Signed-off-by: Quan Nguyen > --- > v3: > + First introduce in v3 [Quan] > > drivers/i2c/busses/i2c-aspeed.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index 724bf30600d6..3fb37c3f23d4 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -254,6 +254,11 @@ 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) { Can you explain why you need to do this handing inside the SLAVE_MATCH case? Could you instead move the TX_NAK handling to be above the SLAVE_MATCH case? > + if (irq_status & ASPEED_I2CD_INTR_TX_NAK && > + bus->slave_state == ASPEED_I2C_SLAVE_READ_PROCESSED) { Either way, this needs a comment to explain what we're working around. > + irq_handled |= ASPEED_I2CD_INTR_TX_NAK; > + i2c_slave_event(slave, I2C_SLAVE_STOP, &value); > + } > irq_handled |= ASPEED_I2CD_INTR_SLAVE_MATCH; > bus->slave_state = ASPEED_I2C_SLAVE_START; > } > -- > 2.28.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel