From nobody Sun May 10 06:27:53 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 0CD601A08B8 for ; Mon, 30 Dec 2024 07:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735545284; cv=none; b=VNKS19xeyWVALrEuEeqORE2GA7+7MbXcN70qQQX7+Bk70vkhTzMIp0aNYxdDarfDZ1cGAehivXzjC/DY/aLnIh3C8LrJA6l8jzZwo1rQKsEfAZ0ncmHNER2GxBjb3S2SZV4tZbfxjyDFThC8gwbsy4pJMBIzEDz/t+g1ieag5aA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735545284; c=relaxed/simple; bh=79hzgthwyngoM4BpEeXnmFJ6ovPLb0WBGK9JKyWpdQU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fdNOSO68fTHvyb5Yt2ZMK9wOXs0PNVYQ4UxJtHAdMaRUx5598MKRaP8LdSul3i5BbPI3EaWQdgOlwVl32+ESQsfRR1jYmdDIE8rw12ZAW4NMPGQJwUXzueNAepNyBYYHMMWclPfF/PX3MeXtn5RD2nUtVm4UGNXLRgV58WzcOAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=OsjYB5m2; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="OsjYB5m2" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BU7FtMq027208 for ; Mon, 30 Dec 2024 07:54:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=gBJuLcNHpA8puK83xiFzArM/wXiLOzeGaBA Bx3fDy/w=; b=OsjYB5m2bozEthmJA2K1b2ZsgYUz8FIZF29EYbTZq2W8NjZdno/ wWM2+9ZExQts+icIl0zaOT/uLxU8kZDcwc+bwWE3hm9n06tEfEQeWmc3mqDjAXXw 3F2RLCCZaH62uJVHz3C98Vr9u74xCW2LcOiOS67DAU4d5oPOQwrK4JZK7kdrQaQp 4gSyNDUH2b/yx4XTS85CBXQJji5UjEYzLtpxUhxWS/GZijtkrWT/XcOQ/gEU1tqk yCZ2r4plQAKlgIWZlFsjxlieWQerOLEbzI89e/bKnCwIKMSbjcDmuPMZJskmuOFm j7vD/m0kxCgIu0sHzS2E3JZgiYqLv5TD9Dg== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43upyr826x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 30 Dec 2024 07:54:42 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2ef79403c5eso18352203a91.0 for ; Sun, 29 Dec 2024 23:54:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735545281; x=1736150081; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gBJuLcNHpA8puK83xiFzArM/wXiLOzeGaBABx3fDy/w=; b=vyHR6eKpPFVLwj7NaOJa5wf8eIGGu30VTd6fbJl4SyeKhNygB6H4AYZDCy3ssnyBJA 2cADgfaRCssCQXeU8S3GfCydP0nuloRMEHYlKFyDQs64A/6/3yGDmwMRj4qv2FFn+22v UmdurErpqv0pxNV/qd9rKXDwQ6YKO8PDaLBaleBMPAaH+jk2/IOzDwPRNHjiOhGGE1iv OIs92hREZNdzpBapPxR1yq5MhsDRo5T10ObMA2oIU730JKW3fQ2dY7dYxmaK7/3Y7CDB 6o7lFytc8X3cGvJXRSycK1/nDOWcBdvBjOQ1pt2dLCXn5E3uoJkEw8bUiZWjhP1Jp7J2 7zxg== X-Forwarded-Encrypted: i=1; AJvYcCWhh2Rz70zmXLPEaof+kFUMHn7fODMvO+3i5vJMvLYlt0WrqeV8EfdKZLasidv0qjzCjDEHqGKGK2S/O7I=@vger.kernel.org X-Gm-Message-State: AOJu0YxA89ETlsSu+DU3QSRG1AmqS4Ae/q9UqgtbPytlujWnVwSqAosx 0vwH1/PXwOd+0p5U1X9aQpm+TIow8YMrKr081okJ/2VkbTtj52i5y3cOkRhm1R+t5CmAT6p46Dn SzjtYcHlLudwtRKW3dh1A1kzvIaSKiQpDGMlRwqPRrTtax8oAtHW9w/Bfsvq0fSk= X-Gm-Gg: ASbGncv+dnfAlY8HoWGr8GPtQjDIxBTG0orhA4tSfYv86IssT8sDWjW0W4AJwwJEvwO EX49tdInA5ye53lmxr3uCl6+RxkWjmmx/ruL2i5fSl0GixPKWa0Vo5LmwCFxhoHZY3MH+ja/bVs gkWbL/dREUa0qGdCksYFLqjvl8W+SRrYDGq4ZHwFV1Dr/gh9dRJubCG7Weex2/QwcMj08trfSR/ zSzlbLKc8vRd4D7mackEHa8ltZq6sf+OhHnzj0XhtRiMEQoevQWzeB1Bb+4aRTBaweOXeekeCth hJWWjyJt X-Received: by 2002:a17:90b:2c84:b0:2ee:d797:40a4 with SMTP id 98e67ed59e1d1-2f452dfccacmr58440642a91.8.1735545281165; Sun, 29 Dec 2024 23:54:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKHCgciY4fAbJOIz7jklcG5BtlTgjH2Bhu08Ido0AfuJjfu9wC/d7zyUJzqYVKRAXE52p+Og== X-Received: by 2002:a17:90b:2c84:b0:2ee:d797:40a4 with SMTP id 98e67ed59e1d1-2f452dfccacmr58440625a91.8.1735545280818; Sun, 29 Dec 2024 23:54:40 -0800 (PST) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee071387sm24425912a91.37.2024.12.29.23.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2024 23:54:40 -0800 (PST) From: Mukesh Ojha To: manivannan.sadhasivam@linaro.org, jassisinghbrar@gmail.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mukesh Ojha Subject: [PATCH v2] mailbox: qcom-ipcc: Reset CLEAR_ON_RECV_RD if set from boot firmware Date: Mon, 30 Dec 2024 13:24:25 +0530 Message-Id: <20241230075425.2534765-1-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: hM2Rt-g38X4VAI3hhoBIOOH2_apCxAfM X-Proofpoint-ORIG-GUID: hM2Rt-g38X4VAI3hhoBIOOH2_apCxAfM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 suspectscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412300065 Content-Type: text/plain; charset="utf-8" For some SoCs, boot firmware is using the same IPCC instance used by Linux and it has kept CLEAR_ON_RECV_RD set which basically means interrupt pending registers are cleared when RECV_ID is read and the register automatically updates to the next pending interrupt/client status based on priority. Clear the CLEAR_ON_RECV_RD if it is set from the boot firmware. Signed-off-by: Mukesh Ojha --- Change in v2: - Corrected email id in the Sob. drivers/mailbox/qcom-ipcc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c index 14c7907c6632..0b17a38ea6bf 100644 --- a/drivers/mailbox/qcom-ipcc.c +++ b/drivers/mailbox/qcom-ipcc.c @@ -14,6 +14,7 @@ #include =20 /* IPCC Register offsets */ +#define IPCC_REG_CONFIG 0x08 #define IPCC_REG_SEND_ID 0x0c #define IPCC_REG_RECV_ID 0x10 #define IPCC_REG_RECV_SIGNAL_ENABLE 0x14 @@ -21,6 +22,7 @@ #define IPCC_REG_RECV_SIGNAL_CLEAR 0x1c #define IPCC_REG_CLIENT_CLEAR 0x38 =20 +#define IPCC_CLEAR_ON_RECV_RD BIT(0) #define IPCC_SIGNAL_ID_MASK GENMASK(15, 0) #define IPCC_CLIENT_ID_MASK GENMASK(31, 16) =20 @@ -274,6 +276,7 @@ static int qcom_ipcc_pm_resume(struct device *dev) static int qcom_ipcc_probe(struct platform_device *pdev) { struct qcom_ipcc *ipcc; + u32 config_value; static int id; char *name; int ret; @@ -288,6 +291,19 @@ static int qcom_ipcc_probe(struct platform_device *pde= v) if (IS_ERR(ipcc->base)) return PTR_ERR(ipcc->base); =20 + /* + * It is possible that boot firmware is using the same IPCC instance + * as of the HLOS and it has kept CLEAR_ON_RECV_RD set which basically + * means Interrupt pending registers are cleared when RECV_ID is read. + * The register automatically updates to the next pending interrupt/client + * status based on priority. + */ + config_value =3D readl(ipcc->base + IPCC_REG_CONFIG); + if (config_value & IPCC_CLEAR_ON_RECV_RD) { + config_value &=3D ~(IPCC_CLEAR_ON_RECV_RD); + writel(config_value, ipcc->base + IPCC_REG_CONFIG); + } + ipcc->irq =3D platform_get_irq(pdev, 0); if (ipcc->irq < 0) return ipcc->irq; --=20 2.34.1