Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp780556ybj; Thu, 7 May 2020 07:30:46 -0700 (PDT) X-Google-Smtp-Source: APiQypIqeM+8LCwcTPP1fp5DNnPbfnlYMJUfEk3/ajwOsLLktuJtuF0xjqgYFwOv53hfaSaXBZo/ X-Received: by 2002:a17:906:8152:: with SMTP id z18mr11890137ejw.4.1588861846480; Thu, 07 May 2020 07:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588861846; cv=none; d=google.com; s=arc-20160816; b=UBHz6R76sJVpNZNKUc5Y+X0XF+Nej4XXeug8VPrTcXOugqkEqF3cti3RZJJyH6Own1 jKBmXp4kAz5uZ3ZZMfVkPA5ZNidtTkSmOCZDE2lXYW4O45YA650nBcS49q7WtIkXtgre coq/hzV3OSpHlj/SzMUBQGXcMAIK6el5abunk59MZBoy0CBHNi6PZ0RcYvtJohWmm/IQ +UUXz3atqzpDg/Vfuv9lJTUhtDwMyVU38Qf1tw/JHp7s1/MA4WYvTVTh7L5vF4uBZctK 2wKwj/Bx7bLWafXoc/3au9L1zRWEAfLUSWFzfgVvHWzZRT7rj/QiJoDBAKeqjd+eHIup qG8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ypmug6xZki51t21+lmCleiPeOkkiDsY1FRQH+LEhfM4=; b=ME8b/FQo6NjiMyCgQtg+fE9nka/gXxJODxOkpybcUGOirDft2IqIX1q0tTaJZTtun5 AEuKIcZwjVKDTTtZr09YXoC57z7XTr4lPgYx/uGIKvXKYoI35MRXd8N8AMgFmAJGNwf6 gh681BP03C01ama1nm1gtjL+uwN1dgbZO5p0rCsaFY37fstqn71LkkfecEhNuQOPmaqJ jC60FvoIZuRyiRUSlGxcjeVB5rcqBeC02eB+3zeA0rW7/wHf9vVFcwfmmSgfESJOvGMT FNyOrj4qs5YSYopaX8e+cpLZz5eSXrbD1iVEGiYxyE5pB3oEIs1eaoehdjYrMo5KSlzS TQRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kAFbJKmw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba9si3097205edb.114.2020.05.07.07.30.22; Thu, 07 May 2020 07:30:46 -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=@kernel.org header.s=default header.b=kAFbJKmw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728103AbgEGO2Z (ORCPT + 99 others); Thu, 7 May 2020 10:28:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728058AbgEGO2U (ORCPT ); Thu, 7 May 2020 10:28:20 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EA892145D; Thu, 7 May 2020 14:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588861699; bh=wWICHhShsjiNXg4Lrs8fFbE9djX+UgP3NHhA9p/iUbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kAFbJKmw+kx+SNyLvkjCxoHkV2wHauOSygLJr1OgrBo5HjYYy4NCTm5u2V4kCsDzC iNq/4mXiwNFGWwHpkJAxF7QlYzucofEk6rH2gqcUoOIrrvAXciP1M9FOBhyc7ZUP41 g+4WwDXXuohA19NGyLQHOHKFbe8lfXBN0xjpJTA4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: ryan_chen , Benjamin Herrenschmidt , Wolfram Sang , Sasha Levin , linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH AUTOSEL 5.6 41/50] i2c: aspeed: Avoid i2c interrupt status clear race condition. Date: Thu, 7 May 2020 10:27:17 -0400 Message-Id: <20200507142726.25751-41-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200507142726.25751-1-sashal@kernel.org> References: <20200507142726.25751-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ryan_chen [ Upstream commit c926c87b8e36dcc0ea5c2a0a0227ed4f32d0516a ] In AST2600 there have a slow peripheral bus between CPU and i2c controller. Therefore GIC i2c interrupt status clear have delay timing, when CPU issue write clear i2c controller interrupt status. To avoid this issue, the driver need have read after write clear at i2c ISR. Fixes: f327c686d3ba ("i2c: aspeed: added driver for Aspeed I2C") Signed-off-by: ryan_chen Acked-by: Benjamin Herrenschmidt [wsa: added Fixes tag] Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-aspeed.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index a7be6f24450bd..538dfc4110f85 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -603,6 +603,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) /* Ack all interrupts except for Rx done */ writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE, bus->base + ASPEED_I2C_INTR_STS_REG); + readl(bus->base + ASPEED_I2C_INTR_STS_REG); irq_remaining = irq_received; #if IS_ENABLED(CONFIG_I2C_SLAVE) @@ -645,9 +646,11 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) irq_received, irq_handled); /* Ack Rx done */ - if (irq_received & ASPEED_I2CD_INTR_RX_DONE) + if (irq_received & ASPEED_I2CD_INTR_RX_DONE) { writel(ASPEED_I2CD_INTR_RX_DONE, bus->base + ASPEED_I2C_INTR_STS_REG); + readl(bus->base + ASPEED_I2C_INTR_STS_REG); + } spin_unlock(&bus->lock); return irq_remaining ? IRQ_NONE : IRQ_HANDLED; } -- 2.20.1