From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graeme Gregory Date: Mon, 7 Jun 2021 15:57:22 +0100 Subject: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy() In-Reply-To: <20210519074934.20712-6-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> <20210519074934.20712-6-quan@os.amperecomputing.com> Message-ID: <20210607145722.GA2682@ggregory-linuxws> List-Id: To: linux-aspeed@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, May 19, 2021 at 02:49:32PM +0700, Quan Nguyen wrote: > Slave i2c device on AST2500 received a lot of slave irq while it is > busy processing the response. To handle this case, adds and exports > aspeed_set_slave_busy() for controller to temporary stop slave irq > while slave is handling the response, and re-enable them again when > the response is ready. > > Signed-off-by: Quan Nguyen > --- > v3: > + First introduce in v3 [Quan] > > drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index b2e9c8f0ddf7..9926d04831a2 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, > return 0; > } > > +#if IS_ENABLED(CONFIG_I2C_SLAVE) > +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) > +{ > + struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap); > + unsigned long current_mask, flags; > + > + spin_lock_irqsave(&bus->lock, flags); This as far as I can see is still a recursive spinlock, and the spinlock debugger seems to agree with me. Graeme > + > + current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG); > + if (busy) > + current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH); > + else > + current_mask |= ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH; > + writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG); > + > + spin_unlock_irqrestore(&bus->lock, flags); > +} > +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy); > +#endif > + > static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) > { > struct platform_device *pdev = to_platform_device(bus->dev); > -- > 2.28.0 > 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D60BEC47082 for ; Mon, 7 Jun 2021 14:57:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C334561108 for ; Mon, 7 Jun 2021 14:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbhFGO7d (ORCPT ); Mon, 7 Jun 2021 10:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbhFGO72 (ORCPT ); Mon, 7 Jun 2021 10:59:28 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52728C061766 for ; Mon, 7 Jun 2021 07:57:26 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id n17-20020a7bc5d10000b0290169edfadac9so12957158wmk.1 for ; Mon, 07 Jun 2021 07:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=rggAUTyKTufq+dvlwzacJo9pgOVEdDk5fs3Ote0eHa9Ikr22ppYaRz2a4Jb4/ToGE9 pJkiZO7GFVstggttfUpKJid5MIj7MBT1ehm0kb1rXd+jJXGbHfBu1nJAIo31+xmCh7U/ qb+/J8pqkPvJ6Ej8kejnhPDprATZqkAHu1JjTInwUK9LZVOHnCjoQltUVh0qxxonZAQc Fu0WUKtDF2ECtEiAb9FDHkz7hTvmHveDDsQt3NyItj3IsxEReE4aEjQ5lm5VTo+Zkzbu lzBFaZn6VV0tk1fhsqtHtys6OoAI3vchKxv3CWnDoo4Gf3/RInJRII3o9R4/UDEFbizy vVsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=MQzpgKVZLQG8sGaI6Rdt2nWL9kzYQCTqfUOhpVY1/OzxbIoG6k1IlpWyL6+5tuZFV5 s6p0lXKVg3PSMKmbjOQzuXrNlAMwiyCCHB42a2aDSQXcgWPhtfH+jyL5ifqtpnWSFLK/ yQU9bubh6XMY7nAZehVZDugYK5DsszKaDfgKisTkiBAuFh11yNhL8M9wMgBZZ+1l6gRv P/XWz8QBM81PORB+ZF5c1jw3TdxSiwIlmH8INxqm1NlfYAZsevZiDs+SFbpg9zY7Q9w4 J8i/vXxNEc+tlBanvUsTXKncS2kISxFUd2kcU5JJaNqqoN08H4GluioDaEHhvL3FO7Ck BxbA== X-Gm-Message-State: AOAM531MAEA7WXZ4b8JAbfVxbkFI3eqJu2hx7mi2ykk8C1oy4CBub7Ea ZTFy2T91n/n4SJscYJP8wod/YA== X-Google-Smtp-Source: ABdhPJx6fGlVL5stxlu2ekuhuN/NXsWIomGXGgkt/9+9iT+k+wju9j4eewvseyJ0aY+TeXuGEd/cuQ== X-Received: by 2002:a7b:c7cd:: with SMTP id z13mr16901621wmk.54.1623077844897; Mon, 07 Jun 2021 07:57:24 -0700 (PDT) Received: from ggregory-linuxws ([2a02:8010:64d6:5343:6309:485e:2524:388a]) by smtp.gmail.com with ESMTPSA id f14sm15953806wry.40.2021.06.07.07.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 07:57:24 -0700 (PDT) Date: Mon, 7 Jun 2021 15:57:22 +0100 From: Graeme Gregory To: Quan Nguyen Cc: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Open Source Submission , "Thang Q . Nguyen" , Phong Vo , openbmc@lists.ozlabs.org Subject: Re: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy() Message-ID: <20210607145722.GA2682@ggregory-linuxws> References: <20210519074934.20712-1-quan@os.amperecomputing.com> <20210519074934.20712-6-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210519074934.20712-6-quan@os.amperecomputing.com> Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Wed, May 19, 2021 at 02:49:32PM +0700, Quan Nguyen wrote: > Slave i2c device on AST2500 received a lot of slave irq while it is > busy processing the response. To handle this case, adds and exports > aspeed_set_slave_busy() for controller to temporary stop slave irq > while slave is handling the response, and re-enable them again when > the response is ready. > > Signed-off-by: Quan Nguyen > --- > v3: > + First introduce in v3 [Quan] > > drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index b2e9c8f0ddf7..9926d04831a2 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, > return 0; > } > > +#if IS_ENABLED(CONFIG_I2C_SLAVE) > +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) > +{ > + struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap); > + unsigned long current_mask, flags; > + > + spin_lock_irqsave(&bus->lock, flags); This as far as I can see is still a recursive spinlock, and the spinlock debugger seems to agree with me. Graeme > + > + current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG); > + if (busy) > + current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH); > + else > + current_mask |= ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH; > + writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG); > + > + spin_unlock_irqrestore(&bus->lock, flags); > +} > +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy); > +#endif > + > static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) > { > struct platform_device *pdev = to_platform_device(bus->dev); > -- > 2.28.0 > 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.6 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 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 3F3B4C47082 for ; Mon, 7 Jun 2021 14:58:05 +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 B0A2461164 for ; Mon, 7 Jun 2021 14:58:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0A2461164 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=nuviainc.com 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 4FzGhC4CZZz307g for ; Tue, 8 Jun 2021 00:58:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nuviainc-com.20150623.gappssmtp.com header.i=@nuviainc-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=rggAUTyK; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nuviainc.com (client-ip=2a00:1450:4864:20::333; helo=mail-wm1-x333.google.com; envelope-from=graeme@nuviainc.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nuviainc-com.20150623.gappssmtp.com header.i=@nuviainc-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=rggAUTyK; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 4FzGgf3znHz2yWJ for ; Tue, 8 Jun 2021 00:57:32 +1000 (AEST) Received: by mail-wm1-x333.google.com with SMTP id b145-20020a1c80970000b029019c8c824054so12941336wmd.5 for ; Mon, 07 Jun 2021 07:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=rggAUTyKTufq+dvlwzacJo9pgOVEdDk5fs3Ote0eHa9Ikr22ppYaRz2a4Jb4/ToGE9 pJkiZO7GFVstggttfUpKJid5MIj7MBT1ehm0kb1rXd+jJXGbHfBu1nJAIo31+xmCh7U/ qb+/J8pqkPvJ6Ej8kejnhPDprATZqkAHu1JjTInwUK9LZVOHnCjoQltUVh0qxxonZAQc Fu0WUKtDF2ECtEiAb9FDHkz7hTvmHveDDsQt3NyItj3IsxEReE4aEjQ5lm5VTo+Zkzbu lzBFaZn6VV0tk1fhsqtHtys6OoAI3vchKxv3CWnDoo4Gf3/RInJRII3o9R4/UDEFbizy vVsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=dFGst4D3EJsYdLpsVuC1GafducmYanfMg1FFQ/4DOWkEM3jobCR2lBR2dqiJUM9gMp AF+/7+bfD8gf00oxLrlsD68SP/tf6Tp6TU6b8HX7BQmJEhkTD3hTsaMd8hc0iZ2DipRo vTmT702z6DR/WWjG8kBOIQ9Ia95c+botAINfhUR6/ZG8bJESwc3Cw2nkf+SP8lXT60Vb JfZ3gYw8HkfztzwFsdCtt8X8+QdgM/rOyZ5FEFSL4kOjHX2QqnQD9kK0DmPKLYzqAsjE rM4z8FN+HHLxeMhcVtHOZllEatPofN7mdjN+CuAbOnRT9ePGJ8h6vozBR9udqPzYZ06Y +V5Q== X-Gm-Message-State: AOAM531C76RmSd10H4O8SOx+4wWfqcDSA3WNYsQSi9sY8DI3pJaK9GVU QIjGGzGjad4A4u9LcZKd7O5JfA== X-Google-Smtp-Source: ABdhPJx6fGlVL5stxlu2ekuhuN/NXsWIomGXGgkt/9+9iT+k+wju9j4eewvseyJ0aY+TeXuGEd/cuQ== X-Received: by 2002:a7b:c7cd:: with SMTP id z13mr16901621wmk.54.1623077844897; Mon, 07 Jun 2021 07:57:24 -0700 (PDT) Received: from ggregory-linuxws ([2a02:8010:64d6:5343:6309:485e:2524:388a]) by smtp.gmail.com with ESMTPSA id f14sm15953806wry.40.2021.06.07.07.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 07:57:24 -0700 (PDT) Date: Mon, 7 Jun 2021 15:57:22 +0100 From: Graeme Gregory To: Quan Nguyen Subject: Re: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy() Message-ID: <20210607145722.GA2682@ggregory-linuxws> References: <20210519074934.20712-1-quan@os.amperecomputing.com> <20210519074934.20712-6-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210519074934.20712-6-quan@os.amperecomputing.com> 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@vger.kernel.org, linux-aspeed@lists.ozlabs.org, Corey Minyard , Andrew Jeffery , openbmc@lists.ozlabs.org, "Thang Q . Nguyen" , Brendan Higgins , linux-kernel@vger.kernel.org, Phong Vo , Wolfram Sang , Rob Herring , Philipp Zabel , openipmi-developer@lists.sourceforge.net, Open Source Submission , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Wed, May 19, 2021 at 02:49:32PM +0700, Quan Nguyen wrote: > Slave i2c device on AST2500 received a lot of slave irq while it is > busy processing the response. To handle this case, adds and exports > aspeed_set_slave_busy() for controller to temporary stop slave irq > while slave is handling the response, and re-enable them again when > the response is ready. > > Signed-off-by: Quan Nguyen > --- > v3: > + First introduce in v3 [Quan] > > drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index b2e9c8f0ddf7..9926d04831a2 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, > return 0; > } > > +#if IS_ENABLED(CONFIG_I2C_SLAVE) > +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) > +{ > + struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap); > + unsigned long current_mask, flags; > + > + spin_lock_irqsave(&bus->lock, flags); This as far as I can see is still a recursive spinlock, and the spinlock debugger seems to agree with me. Graeme > + > + current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG); > + if (busy) > + current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH); > + else > + current_mask |= ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH; > + writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG); > + > + spin_unlock_irqrestore(&bus->lock, flags); > +} > +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy); > +#endif > + > static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) > { > struct platform_device *pdev = to_platform_device(bus->dev); > -- > 2.28.0 > 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.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,SPF_HELO_NONE,SPF_PASS 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 8B7C5C47094 for ; Mon, 7 Jun 2021 14:58:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5C959610C8 for ; Mon, 7 Jun 2021 14:58:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C959610C8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=nuviainc.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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RNAuVbfXHcCQmB+G0+cajLOIUCca0dL1M10+ruVVNXc=; b=lPp+jYwXt8VM8M B4ImPF+CUwyjd21xEJSiCbN/rKmerCG6yqmwZmdB6IUNc92BhmLLv7YblvngSAEUNTNhJxR0MAT6+ ypSqIcB94rZsVNAEOjf1zJypmsnoFfTkji1StOklavk125Eefb9pCDSy5VHZI2qacgDiMDegRIfI+ eLsRkdSd+61iwLcC9Q1IrfM1CqUq86ul0k6M4flJEKCH/8Yo1tB/68yLCvzuRyQ7qIcbjNtrou5WI ha66ALEvWisbcFy+dU6kDndH8CLN/9PC7p//A33Du7V2C9o+Qm2T96VOlQXPGvi5vW0mce8pC8m2v Y/cMBAVJOhLd+ocqowbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqGh2-0048Bh-Tz; Mon, 07 Jun 2021 14:57:33 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqGgy-0048Ar-7r for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 14:57:30 +0000 Received: by mail-wm1-x334.google.com with SMTP id b145-20020a1c80970000b029019c8c824054so12941331wmd.5 for ; Mon, 07 Jun 2021 07:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=rggAUTyKTufq+dvlwzacJo9pgOVEdDk5fs3Ote0eHa9Ikr22ppYaRz2a4Jb4/ToGE9 pJkiZO7GFVstggttfUpKJid5MIj7MBT1ehm0kb1rXd+jJXGbHfBu1nJAIo31+xmCh7U/ qb+/J8pqkPvJ6Ej8kejnhPDprATZqkAHu1JjTInwUK9LZVOHnCjoQltUVh0qxxonZAQc Fu0WUKtDF2ECtEiAb9FDHkz7hTvmHveDDsQt3NyItj3IsxEReE4aEjQ5lm5VTo+Zkzbu lzBFaZn6VV0tk1fhsqtHtys6OoAI3vchKxv3CWnDoo4Gf3/RInJRII3o9R4/UDEFbizy vVsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=S1bn/jVCOau3//7FCgpqIbBTEv9oF+qjr1uiicPg2MdRsTUitVFpyB0EEKjAwcHZiv CnHNo3tgNF8WOOn8bFVWXqvM+X4VPu2zVOpX59yHP5DxY/hkRNwt8DlR6Mus3P6+xq5v Q9uere1vkBv4SiTeQLlbpJjJHU/xxCSDUG8mYKPNBar5bDmyAh2goZa3ZxEj5NkGRUyz sZYKd4wB6GX8T70TjT9rlbrEThEZleH4rDldRD8cQiXlxqtqDzyd6EbnyJxR91qLNp/o OJm8vaRuDL48hEadI8adduYZIeBomI7flOCPzObrIsX1LDHg8EKhMM5QwDnvJ1QNhju3 59tA== X-Gm-Message-State: AOAM530Y3nmwFA14TsVYLwLdcnAFb8ourR+uk9QQ/ronukOoPAVRinij fKxWHTc5u6VnT414fAXvIKqK8Q== X-Google-Smtp-Source: ABdhPJx6fGlVL5stxlu2ekuhuN/NXsWIomGXGgkt/9+9iT+k+wju9j4eewvseyJ0aY+TeXuGEd/cuQ== X-Received: by 2002:a7b:c7cd:: with SMTP id z13mr16901621wmk.54.1623077844897; Mon, 07 Jun 2021 07:57:24 -0700 (PDT) Received: from ggregory-linuxws ([2a02:8010:64d6:5343:6309:485e:2524:388a]) by smtp.gmail.com with ESMTPSA id f14sm15953806wry.40.2021.06.07.07.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 07:57:24 -0700 (PDT) Date: Mon, 7 Jun 2021 15:57:22 +0100 From: Graeme Gregory To: Quan Nguyen Cc: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Open Source Submission , "Thang Q . Nguyen" , Phong Vo , openbmc@lists.ozlabs.org Subject: Re: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy() Message-ID: <20210607145722.GA2682@ggregory-linuxws> References: <20210519074934.20712-1-quan@os.amperecomputing.com> <20210519074934.20712-6-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210519074934.20712-6-quan@os.amperecomputing.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_075728_358332_5C3AE908 X-CRM114-Status: GOOD ( 22.15 ) 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 On Wed, May 19, 2021 at 02:49:32PM +0700, Quan Nguyen wrote: > Slave i2c device on AST2500 received a lot of slave irq while it is > busy processing the response. To handle this case, adds and exports > aspeed_set_slave_busy() for controller to temporary stop slave irq > while slave is handling the response, and re-enable them again when > the response is ready. > > Signed-off-by: Quan Nguyen > --- > v3: > + First introduce in v3 [Quan] > > drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index b2e9c8f0ddf7..9926d04831a2 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, > return 0; > } > > +#if IS_ENABLED(CONFIG_I2C_SLAVE) > +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) > +{ > + struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap); > + unsigned long current_mask, flags; > + > + spin_lock_irqsave(&bus->lock, flags); This as far as I can see is still a recursive spinlock, and the spinlock debugger seems to agree with me. Graeme > + > + current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG); > + if (busy) > + current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH); > + else > + current_mask |= ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH; > + writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG); > + > + spin_unlock_irqrestore(&bus->lock, flags); > +} > +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy); > +#endif > + > static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) > { > struct platform_device *pdev = to_platform_device(bus->dev); > -- > 2.28.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel