From: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
To: Souradeep Chowdhury <quic_schowdhu@quicinc.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Elson Serrao <elson.serrao@oss.qualcomm.com>,
Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Subject: [PATCH 2/4] usb: misc: qcom_eud: set the TCSR check register before enabling on QCM2290
Date: Sat, 14 Nov 2026 16:39:05 +0100 [thread overview]
Message-ID: <20261114-qcm2290-eud-v1-2-b6157b817377@oss.qualcomm.com> (raw)
In-Reply-To: <20261114-qcm2290-eud-v1-0-b6157b817377@oss.qualcomm.com>
On QCM2290 the EUD mode manager ignores EUD_EN2 unless the TCSR
register TCSR_APSS_SPARE_REG1 is set first. The boot firmware does
exactly that when it enables the EUD itself (TCSR_APSS_SPARE_REG1 = 1,
then EUD_EN2 = 1), but only when the device's debug policy asks for
it. Otherwise EUD_EN2 is accepted, the driver reports success, and the
EUD stays in bypass.
Take the register from an optional third reg entry and, like EUD_EN2,
write it through qcom_scm_io_writel(), right before EUD_EN2 on enable
and back to 0 after the disable. Whether the writes are allowed stays
the secure firmware's decision: QTEE accepts both when secure boot is
off or debug is not disabled; TF-A accepts TCSR_APSS_SPARE_REG1 always
and EUD_EN2 in debug builds only.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
---
drivers/usb/misc/qcom_eud.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
index 73f9fac22e19..217f6c1791f0 100644
--- a/drivers/usb/misc/qcom_eud.c
+++ b/drivers/usb/misc/qcom_eud.c
@@ -36,6 +36,7 @@ struct eud_chip {
struct usb_role_switch *role_sw;
void __iomem *base;
phys_addr_t mode_mgr;
+ phys_addr_t tcsr_check;
unsigned int int_status;
int irq;
bool enabled;
@@ -46,6 +47,16 @@ static int enable_eud(struct eud_chip *priv)
{
int ret;
+ /*
+ * On QCM2290 the boot firmware sets the TCSR check register before
+ * EUD_EN2; without it the mode manager ignores the enable.
+ */
+ if (priv->tcsr_check) {
+ ret = qcom_scm_io_writel(priv->tcsr_check, 1);
+ if (ret)
+ return ret;
+ }
+
ret = qcom_scm_io_writel(priv->mode_mgr + EUD_REG_EUD_EN2, 1);
if (ret)
return ret;
@@ -65,6 +76,9 @@ static int disable_eud(struct eud_chip *priv)
if (ret)
return ret;
+ if (priv->tcsr_check)
+ qcom_scm_io_writel(priv->tcsr_check, 0);
+
writel(0, priv->base + EUD_REG_CSR_EUD_EN);
return 0;
}
@@ -218,6 +232,11 @@ static int eud_probe(struct platform_device *pdev)
return -ENODEV;
chip->mode_mgr = res->start;
+ /* Optional TCSR check register, written through the secure IO SMC */
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+ if (res)
+ chip->tcsr_check = res->start;
+
chip->irq = platform_get_irq(pdev, 0);
if (chip->irq < 0)
return chip->irq;
--
2.53.0
next prev parent reply other threads:[~2026-11-14 15:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 15:39 [PATCH 0/4] arm64: qcom: QCM2290: add the Embedded USB Debugger Igor Opaniuk
2026-11-14 15:39 ` [PATCH 1/4] dt-bindings: soc: qcom: eud: add the QCM2290 EUD Igor Opaniuk
2026-11-23 10:22 ` Krzysztof Kozlowski
2026-11-23 10:41 ` Igor Opaniuk
2026-11-23 10:50 ` Krzysztof Kozlowski
2026-11-14 15:39 ` Igor Opaniuk [this message]
2026-11-14 15:39 ` [PATCH 3/4] arm64: dts: qcom: agatti: add the Embedded USB Debugger Igor Opaniuk
2026-11-14 15:39 ` [PATCH 4/4] arm64: dts: qcom: qrb2210-arduino-imola: enable the EUD Igor Opaniuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261114-qcm2290-eud-v1-2-b6157b817377@oss.qualcomm.com \
--to=igor.opaniuk@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=elson.serrao@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_schowdhu@quicinc.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®