Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp741701rdb; Thu, 15 Feb 2024 14:10:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVzFJwwaIO2J1VfwBA3pKPc4u7F+xZ8fwiuVitWKRBOMhylZvMEAkNQ9oVla4RdZ3prFfyWf/Duuhot84Os5TnSWzQruFRqjaungfzjRQ== X-Google-Smtp-Source: AGHT+IEwfuhQ+ng7PqtTT65h2du5YsEvCkUveJII5DYsn7qWE/0Qu5lFn4Xw3GyZU/ETPgNej8NM X-Received: by 2002:a17:906:a3cc:b0:a3d:a84e:b0e9 with SMTP id ca12-20020a170906a3cc00b00a3da84eb0e9mr1445129ejb.7.1708035041637; Thu, 15 Feb 2024 14:10:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035041; cv=pass; d=google.com; s=arc-20160816; b=zaAlYQJ91sbt/7F3YKG4zWWuHQYqljBWSv5A80QA02igJsLiMG6nGIzw4zthIYy6HR BSjq4xfL7R+eYXJPvz1lnTBg+saOE3EBG2jrF2H+fpzwOqQt1TpM+DRpsbvsN7RdsQx7 GJd5PwAuYxxe+4swhwHVGJAmvgsWiId2lTWYFjxXtdOZ8kIzg/7u4VCxVcEnTA+LP4L3 pnxoTFvmi1Ehfs1XyYVssuuxL4ZlLpwrQJRe0TH5ppURV9ZCIUQSnpUinA4+qGy8Vs/v 4wnJtXZgAv+dZxmv7EA2i/pe39oNJNvWp0+qhsuJKzO+RP8XewX+BwPbPksydkElRsBX 1V+g== 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=bofokn5J04e0ZdqBwK6c6SN9GTgFjHTcEiDFXEpuQNw=; fh=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=1IYhJslrIvoeMKcdchAv6KWQQNxxYXzJK13xJ/oy8INV28RdN8ZJuVgf3nDY4Porv9 eq3yDsxA6Met8iUgMM5q2tZE4ZOGzMdkH0PNhKMS2B3GJ6UiPzwm+kFsImLkBiKYZkrh uTBE/MNR18MWFgALO1TCUqFsWBt5QvGfygNTqV31hSBNibP5GfsntHDKYQypK7lc2l9F IokXOwrP0KSLU7Q+hc7IBql++53UIWVNNBgwMbBv9g6h13DUYnemWzxFlbhhaJSRF3QP GxTXISHa+nO7bx6OIlabVfOAh7m43N7gY46goGrwRHtud6agvPkk7kKLMlo4ZL4qCmeu 75yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Bvc9Jgzj; 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-67741-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67741-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m27-20020a17090607db00b00a3cfe376122si981809ejc.364.2024.02.15.14.10.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:10:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67741-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Bvc9Jgzj; 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-67741-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67741-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 324781F23B57 for ; Thu, 15 Feb 2024 22:10:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 431261487C4; Thu, 15 Feb 2024 22:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Bvc9Jgzj" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 80902145FE3; Thu, 15 Feb 2024 22:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034907; cv=none; b=qdSoRRQtt6p8votZylQJHf9ItnoIRlZMopAfdXwnHY7xfRcQ338wVCTk4LSfUeh0sJTpJIIwMSqjKjhCE9zwOH9h3XHeT6vFHKtaJZEyf3DVUV7jFtpeEpDqArTIdezig9GpttuDqXzddj+RuuQBpBJ9q2WkHGgyLtWdieAoxXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034907; c=relaxed/simple; bh=N4MM9bu5cZzne7RyOcOdfSZDBM36xNIIHvybGlB7Shs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mmxefp3nj63wyJeIfTGsihMGcC2PmWkRj7Zw4vPUsAfcA55FF3n9Nnemep+Tk5Je9ZWy57Uhe003lt4+e5I/bvs7eUdhitP2ZCjjiuhzmxoCEYxtUkF0z8LRP6Sc8ryGLx69HOAcyvh3lFkpEX8+ce5qHGsq0Mg4IprkYN8p7TE= 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=Bvc9Jgzj; arc=none smtp.client-ip=148.163.158.5 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 (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLVJKw012203; Thu, 15 Feb 2024 22:08:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=bofokn5J04e0ZdqBwK6c6SN9GTgFjHTcEiDFXEpuQNw=; b=Bvc9JgzjfrEbiHjVe0L5qNBvZjzmotm8RgQ+0300xIrGSdybxscnoXV9GXPa+EGpw+xs kGmqWOGtVdVAjI+rIINO6dMQ/mfGzp+gMewUUPWs/VndEwO3fQUQBE/IqfKdQhx6tmyd wXEGRq8pH9kI4xgM63By4bmhnaNKxTR//PTMFXUTwwi7AIjIJIC22Gknu9RSTkBC7j5p P12whwU0b6BzsqhL6SX38eseLHv3sSvxctO/vpxoSRGQ+Da5GT8WAyduPcGA6MXmARuK Q1hbm81paJJqCu4MtNlvP2ZvleYKvZ9sGzpCrXpZKl0s4Y2BniNiLLjiB8Bn/0YXlCUk gw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w9q0v5ydc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:11 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41FLN4qd009920; Thu, 15 Feb 2024 22:08:10 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w6p6374qp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:10 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM88NU51905198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:10 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 546B85803F; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1432D58079; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:08 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 18/33] fsi: aspeed: Don't clear all IRQs during OPB transfers Date: Thu, 15 Feb 2024 16:07:44 -0600 Message-Id: <20240215220759.976998-19-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-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: 5UIetqF6FNCMnR2m7GAX3Uay-smOZhuE X-Proofpoint-GUID: 5UIetqF6FNCMnR2m7GAX3Uay-smOZhuE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 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 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 1a91f3acdfcc..64a5407a15ec 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -46,6 +46,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 @@ -64,8 +69,8 @@ static const u32 fsi_base = 0xa0000000; #define OPB1_READ_ORDER2 0x60 #define OPB_RETRY_COUNTER 0x64 -#define OPB_RETRY_COUNTER_AST2600 0x00000010 -#define OPB_RETRY_COUNTER_AST2700 0x000c0010 +#define OPB_RETRY_COUNTER_AST2600 0x00010010 +#define OPB_RETRY_COUNTER_AST2700 0x000d0010 /* OPBn_STATUS */ #define STATUS_HALFWORD_ACK BIT(0) @@ -107,13 +112,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 */ @@ -159,13 +165,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); @@ -489,8 +496,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