Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3324088pxj; Mon, 7 Jun 2021 07:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwehxgwjRXlbo2tokMzweSK9+XtEFYALrigN3Z26WO4FsMaHzdIgSPEzci8K3aZs2lz6Wob X-Received: by 2002:a05:6402:1d06:: with SMTP id dg6mr19851515edb.132.1623077975083; Mon, 07 Jun 2021 07:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623077975; cv=none; d=google.com; s=arc-20160816; b=Q62NT1G248r7jevkE0c+RPRVYKPiwCOdPWNraGs6llge6tKuIw1A5iRLvzYmRJgajw e44o8+MLyFzGEF3+8qeTPrY9F9ga5qw2wO6lx/YKQ+AebgHxzmQw+Fd9dMmIzM7rZETO eBUok5XIjyw0Emkmt00cqiqPC8JjCWu+yImzSmupjxrxDFFqae/0atGWz+wYDeuCLnaZ X26V4W4otgqOyLkfbBROvSHknbJ4+35zFLCXnnENPvWbFCjapQSC2+Tm1u44Js/nVpni cQG3B5ZFuBqIadzXqU58tn0SbOCmAAQnFRuhTNELdOyGz8QwUuyMVtOzuuzKMeV3dpVM LiFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VlCXU9+MFpUy7SArdgNYI/tiU14CG8Xgo06o1Uxsr38=; b=F2yQiqrzfPwXL0ykmWN/mw4nLp8Eu3V3igFErVU6u/38TP+guEKF6mcjyxRPepPdvx e+Ly4i6TCLTZGMRbI7tz+KqqRRWer2rJ0ENqAm3kbT0PwRGN88OTl332xQItz2RG9kqE Z80Gsj1oc5HrmoMAzw1OtYRF+aYfUG8cY1ea7/IcVNu1+muaBDIUfJUDOMt9KiQKTzPx dGiwYVRxn/PTxT8EF16EJjtuoesJMTcSc4PnbHV4VWNrj7AZSwWsq+6K37IcpFWX+aYw BuJxm3tCDJdCAuvB4u9NRZM3d4DH/5irxcJXH+bs6wY4BPvnXVQsPyzdOsD5rX1Vy/FW RFnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=rggAUTyK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si16470997ejl.693.2021.06.07.07.59.12; Mon, 07 Jun 2021 07:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=rggAUTyK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230504AbhFGO7e (ORCPT + 99 others); Mon, 7 Jun 2021 10:59:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbhFGO7S (ORCPT ); Mon, 7 Jun 2021 10:59:18 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C57C061787 for ; Mon, 7 Jun 2021 07:57:26 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id v206-20020a1cded70000b02901a586d3fa23so183612wmg.4 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=lQIt4mBbsPUUcwXQFmuIa5FMqCsEo7d2IfHHb9nHisf6GklfyqYfThXOWWJFcZHq1N eWn1dzt3QaJ29HwyJQ/VXO7hPiicrxbcNPxw6VrkhKtZG5IlqhXAuPTkbkzyMDnmFWSI R335RVwYeonj7yfLCO3qqpXvmVDme7YWv/xmUAA0K+tkavTXT50y5lCd+xyYv9jjXX+I gl7N3aPaPG64k0F5YijZk12sXD9dbT7Wi+w3EYu+zyaiHzLRtwb41LBwwFrhTk2RK0p7 hnGzVM5AN+J84ZjPyFOLS24VvyLw1AGce837cijHOUT7HMm3nVdlDvQr1lL0PUaWWDDd hhKQ== X-Gm-Message-State: AOAM530sVxIAbQz9sGb+hoRxgpxA1fs2cBHBuDJoDuHanNxX1mA55gjn OlR7mqHTuHEf1I4hzPnNW97eIA== 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-kernel@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 >