Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp570238lqr; Wed, 5 Jun 2024 14:28:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX123hyBl4ib4wFleP1zEQG5veqGLX97kJ83q/WrPhRkO5hFFvDFHY+QNn7Jq+ytWACdrn1P6CjQU0z1nLm+y+d/30e14hUWdEpjfZY/g== X-Google-Smtp-Source: AGHT+IG1dtYupCQmp/QkziFGR2cQkMKg25mPwojH+73lgH52xVIId9IdsElrQMrPz8+JdS8e5D2e X-Received: by 2002:a05:6a00:1903:b0:6ea:f351:1df9 with SMTP id d2e1a72fcca58-703e5a1bbf2mr4481915b3a.23.1717622903866; Wed, 05 Jun 2024 14:28:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717622903; cv=pass; d=google.com; s=arc-20160816; b=TzTepeY+hztN2PEeWyEoSv9or5/UmHXpyNV0lZAqn9thcbNHgMngZFktedxFB+se+g 12gH2GYBnw6RHVP0S9nQ3p7iyGvw4fnnvICn0V7whoTWjlVieuraxuKNIsNoMWDcmBxj IX21Q9OiNLZVknVA5wLgi4AX565JbtAxyXzDs3xJO4heOAW0Lhi2iKar1hmjnVq0kGka ZpFnnLgP6m0LQMQb7d+bVC4nAAKCADQOKffAQYFl9Ku/90Dq97ARcZnsVa18BzjaIqd7 4a2N6IgHZJlWnyDyQKucpOGfRKrrKbyC1c2ZROvd28BIi+eHw0qQPvqjjzNCmziJ37qo CjJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dqdJlR5MaTztZMJgWYsXAeJqjv1L5VBfiwva68G3Zto=; fh=F5i+rNW4hjf57QJHDx14Nq4Eso4Z4OyY/LhC2i40VT4=; b=RKqGo6vZk6imGtrWRt54gelov7hzAlEoMkT1VqOHnoborMV+OMWBSI2bpiErYdySb5 H4keRjvYXcI4m0hDmoJmjz3Dch5rKtm8SqQpZLmSWG/ZF/vpa+T/rSQI8O/8HqV6qGLX +hemJ0aPcIyHEJZ1f+MWvBqayQ48S5AXqgPjHHYZD/2IvnZYxAMmyA/u+rZFOUEWtXEl nciRsXsmo7COPieFhyKVEcGWACidPBWpsNGPNgy1LV6X2CcXJdgSbffa07OCI5AyksnQ C+K6gRnv7uRSskCGNsilNd3Cl4n2Y9iqJmWrgM7WqYLKW7DC2KcPnao/KDVgPRT+1c2t /VPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=hGDMIDpS; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-203265-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242d58ec7si2559961b3a.314.2024.06.05.14.28.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203265-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=hGDMIDpS; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-203265-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D2145B235B9 for ; Wed, 5 Jun 2024 21:26:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FD0E172BD0; Wed, 5 Jun 2024 21:23:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="hGDMIDpS" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 468EB1607BC; Wed, 5 Jun 2024 21:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717622621; cv=none; b=ICiMWuuZgTcdhadqM52wr3q27NcjKUE7BQJRfGUt21yhL+M0epfIUJ4AMBTtYhTAH8YvMAL3vvbWhMwcVd0vSYXnx7d8WW+4FuzetcQgeUvlAFLyVHzaE7US6qjYU8NElZoqyH6DZLTWG8r+D72eSkJihwurrmwEzR0YRvammhc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717622621; c=relaxed/simple; bh=3CmP8SDqXBiFId98haK+7Undt4Hf31Bd450GNQU9UOg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=peRvBwHsGz/fLYceEACda5bOdPMNzbUS4K8OzKurJBKkWDxtghGW4JAL7h3PhqAzN7vMM6FaHAlr2mFeQawZXBgzKGcqZ2pk8kLD4RdV9dmnUwPinL91Fp5NegtKbJvueYRMnzrkcLM10j5Ult4JVs3jKzlah/W46zo4pS2hALQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=hGDMIDpS; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 455L0dbZ020650; Wed, 5 Jun 2024 21:23:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=dqdJlR5MaTztZMJgWYsXAeJqjv1L5VBfiwva68G3Zto=; b=hGDMIDpS0M7aoWUNZgqpIHhh5x/XsCAyhUXPhjmsgVncnwGmPz4xybC5RkwVbQRR3QP9 kiFkMhWYFXpoh7pibMsIACyLTc6Szn3QisF9aWN+6URVsEOCIa1ODVsHpFuIYaODHttN 3IRwKZqRgSQbt3yUee40Vq7UlGKqLw9EB9eQc4U51lp9rM8bfQWl+WgfMg1wqlPiz1vG dho3aTgjQCd2jMA7UkWj4bGiSO8X70GJH4KX3Z9rjFTUViqeOomZ1DE56ANMEmIyf7ie XUzZtKyiD7Lw0/4/4GLWulVBjUlhEJsaHXWogJ6JEy4fQ6Xrc0CIfpvK4/cgVnJWOXd4 qA== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yjyhyr1mr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 21:23:23 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 455IRgLm000829; Wed, 5 Jun 2024 21:23:22 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ygdyu6wsc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 21:23:22 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 455LNJew40042804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Jun 2024 21:23:21 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED52A58066; Wed, 5 Jun 2024 21:23:18 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1DA358063; Wed, 5 Jun 2024 21:23:18 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.121.242]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Jun 2024 21:23:18 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: eajames@linux.ibm.com, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, broonie@kernel.org, andi.shyti@kernel.org, joel@jms.id.au, alistair@popple.id.au, jk@ozlabs.org, andrew@codeconstruct.com.au, linux-aspeed@lists.ozlabs.org, ninad@linux.ibm.com, lakshmiy@us.ibm.com Subject: [PATCH v4 18/40] fsi: aspeed: Don't clear all IRQs during OPB transfers Date: Wed, 5 Jun 2024 16:22:50 -0500 Message-Id: <20240605212312.349188-19-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240605212312.349188-1-eajames@linux.ibm.com> References: <20240605212312.349188-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: UiNXHZseH_KlB6lbNa7IxWdp0FQw7QVl X-Proofpoint-GUID: UiNXHZseH_KlB6lbNa7IxWdp0FQw7QVl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-05_02,2024-06-05_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 mlxscore=0 suspectscore=0 malwarescore=0 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406050160 In order to support FSI interrupts, the OPB transfer functions should not clear all the IRQs pending. Instead, just write the OPB ACK bit to the IRQ status register. As commented, this register invisibly masks the interrupt once the interrupt condition is cleared. Fix this by writing 0 before each OPB transfer. Signed-off-by: Eddie James --- drivers/fsi/fsi-master-aspeed.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 04aa5cb9b6fad..f840c7c4a56b9 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -47,6 +47,11 @@ static const u32 fsi_base = 0xa0000000; #define OPB_CLK_SYNC 0x3c #define OPB_IRQ_CLEAR 0x40 #define OPB_IRQ_MASK 0x44 +/* + * This register does NOT behave in the expected manner. It is expected that writing 1b would clear + * the corresponding interrupt condition. However it also invisibly masks the interrupt! Writing 0b + * unmasks again. + */ #define OPB_IRQ_STATUS 0x48 #define OPB0_SELECT 0x10 @@ -113,13 +118,14 @@ static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr, writel_relaxed(transfer_size, base + OPB0_XFER_SIZE); writel_relaxed(addr, base + OPB0_FSI_ADDR); writel_relaxed(val, base + OPB0_FSI_DATA_W); - writel_relaxed(0x1, base + OPB_IRQ_CLEAR); + writel_relaxed(0, base + OPB_IRQ_STATUS); writel(0x1, base + OPB_TRIGGER); ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg, (reg & OPB0_XFER_ACK_EN) != 0, 0, OPB_POLL_TIMEOUT); + writel(OPB0_XFER_ACK_EN, base + OPB_IRQ_STATUS); status = readl(base + OPB0_STATUS); /* Return error when poll timed out */ @@ -165,13 +171,14 @@ static int __opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, writel_relaxed(CMD_READ, base + OPB0_RW); writel_relaxed(transfer_size, base + OPB0_XFER_SIZE); writel_relaxed(addr, base + OPB0_FSI_ADDR); - writel_relaxed(0x1, base + OPB_IRQ_CLEAR); + writel_relaxed(0, aspeed->base + OPB_IRQ_STATUS); writel(0x1, base + OPB_TRIGGER); ret = readl_poll_timeout(base + OPB_IRQ_STATUS, reg, (reg & OPB0_XFER_ACK_EN) != 0, 0, OPB_POLL_TIMEOUT); + writel(OPB0_XFER_ACK_EN, base + OPB_IRQ_STATUS); status = readl(base + OPB0_STATUS); result = readl(base + OPB0_FSI_DATA_R); @@ -530,8 +537,6 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) } writel(0x1, aspeed->base + OPB_CLK_SYNC); - writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN, - aspeed->base + OPB_IRQ_MASK); writel(opb_retry_counter, aspeed->base + OPB_RETRY_COUNTER); -- 2.39.3