Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Igor Opaniuk" <igor.opaniuk@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, linux-usb@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/4] usb: misc: qcom_eud: set the TCSR check register before enabling on QCM2290
Date: Sat, 14 Nov 2026 15:49:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-214730@kernel.org> (raw)
In-Reply-To: <20261114-qcm2290-eud-v1-2-b6157b817377@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: misc: qcom_eud: tcsr_check left set when EUD_EN2 write
  fails
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [Medium] usb: misc: qcom_eud: missing state update in enable_store()
  [1]
--

commit c35f742b781c2fbb7146624bfd77bf246348e228
Author: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>

usb: misc: qcom_eud: set the TCSR check register before enabling on QCM2290

This commit adds support for an optional third memory resource for the
TCSR check register on QCM2290 and writes to it via qcom_scm_io_writel()
when enabling and disabling the EUD.

> diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c
> index 73f9fac22e19a..217f6c1791f01 100644
> --- a/drivers/usb/misc/qcom_eud.c
> +++ b/drivers/usb/misc/qcom_eud.c

[ ... ]

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

[Severity: Medium]
Does this leave priv->tcsr_check set to 1 when the write to
EUD_REG_EUD_EN2 fails?

On non-debug TF-A builds, the write to priv->tcsr_check succeeds while the
write to EUD_REG_EUD_EN2 is rejected.  When enable_store() calls
disable_eud() to roll back after enable_eud() fails, disable_eud() also
writes to EUD_REG_EUD_EN2 first and returns on error before clearing
priv->tcsr_check:

drivers/usb/misc/qcom_eud.c:disable_eud() {
	ret = qcom_scm_io_writel(priv->mode_mgr + EUD_REG_EUD_EN2, 0);
	if (ret)
		return ret;

	if (priv->tcsr_check)
		qcom_scm_io_writel(priv->tcsr_check, 0);
    ...
}

As a result, the TCSR check register remains set to 1 even though enabling
the EUD failed.

> @@ -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;
>  }

[Severity: Medium]
This problem wasn't introduced by this patch, but does enable_store()
leave chip->enabled stuck as true [1] after disable_eud() succeeds?

drivers/usb/misc/qcom_eud.c:enable_store() {
    ...
	if (enable) {
		ret = enable_eud(chip);
		if (!ret)
			chip->enabled = enable;
		else
			disable_eud(chip);

	} else {
		ret = disable_eud(chip);
	}
    ...
}

Because the disable branch never clears chip->enabled, subsequent reads of
the enable sysfs attribute still report 1 after the EUD has been disabled.

[1] https://sashiko.dev/#/bug/linux-99d39974-0e5d-4e78-9df1-4c5cd22f0990

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261114-qcm2290-eud-v1-0-b6157b817377@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-14 15:49 UTC|newest]

Thread overview: 7+ 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-14 15:49   ` sashiko-bot
2026-11-14 15:39 ` [PATCH 2/4] usb: misc: qcom_eud: set the TCSR check register before enabling on QCM2290 Igor Opaniuk
2026-11-14 15:49   ` sashiko-bot [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=sashiko-outbox-214730@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=igor.opaniuk@oss.qualcomm.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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