[PATCH 2/4] usb: misc: qcom_eud: set the TCSR check register before enabling on QCM2290

From: Igor Opaniuk

Date: Sat Nov 14 2026 - 10:39:50 EST


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@xxxxxxxxxxxxxxxx>
---
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