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=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 788FEC433B4 for ; Wed, 19 May 2021 23:29:20 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 19CDE60FF0 for ; Wed, 19 May 2021 23:29:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19CDE60FF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Flpwt4JQqz301W for ; Thu, 20 May 2021 09:29:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=jms.id.au header.i=@jms.id.au header.a=rsa-sha256 header.s=google header.b=HAOlx4M7; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::732; helo=mail-qk1-x732.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=jms.id.au header.i=@jms.id.au header.a=rsa-sha256 header.s=google header.b=HAOlx4M7; dkim-atps=neutral Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FlpwP3L7bz2xb6; Thu, 20 May 2021 09:28:52 +1000 (AEST) Received: by mail-qk1-x732.google.com with SMTP id v8so14547056qkv.1; Wed, 19 May 2021 16:28:52 -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=Y6ZcTjOIFooI3FR3JKRq3bb4I8HiuWLCpeBrunZfQmrphiSN9VEIpy43SdCmGg4aop dl1NoTfBFJKcYw5fG9A0TxMLE6WINyLDp1sme28cRQ6vdahh4PRucpLCuCUTh+dd5O67 2VxqSljRbHLBOOH5dUhjoi2q/sn/nmkniR1SNJSPlhd/njzbg3h9mSTWtbAdW1MxGz65 5v+6twmR5T944FsD2BMSpxooFJJYGQgRK09uJ9Nhw+QTXFNmZldOrq9P/RyG9IVbaa+h H2vwBi9Y6IRP5yU/BLTmwz3a38QK1lpSNb285uUiQtZWKyrR6RaPNny43L7VQuDNOMgM OH4g== X-Gm-Message-State: AOAM533HS0fTliRVoFuyhW3Iq/54+T2btJ0HTxfXT1ABEmFBInjxxD1L XAkMFR476sDLh22LytLLkU6ns/3zJIDF8V5qW5M= 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 Content-Type: text/plain; charset="UTF-8" X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree , linux-aspeed , Corey Minyard , Andrew Jeffery , OpenBMC Maillist , "Thang Q . Nguyen" , Brendan Higgins , Linux Kernel Mailing List , Phong Vo , Wolfram Sang , Rob Herring , linux-i2c@vger.kernel.org, Philipp Zabel , openipmi-developer@lists.sourceforge.net, Open Source Submission , Linux ARM Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" 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 >