From: Stephan Gerhold <stephan.gerhold@linaro.org>
To: Luca Weiss <luca@lucaweiss.eu>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org,
"Bjorn Andersson" <andersson@kernel.org>,
"Mathieu Poirier" <mathieu.poirier@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Stephan Gerhold" <stephan@gerhold.net>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Matti Lehtimäki" <matti.lehtimaki@gmail.com>,
linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/9] remoteproc: qcom_q6v5_mss: Add modem support on MSM8226
Date: Mon, 27 Jan 2025 10:06:24 +0100 [thread overview]
Message-ID: <Z5dMkPvhjCkb9e9w@linaro.org> (raw)
In-Reply-To: <20250126-msm8226-modem-v2-4-e88d76d6daff@lucaweiss.eu>
On Sun, Jan 26, 2025 at 09:57:23PM +0100, Luca Weiss wrote:
> Add support for the external power block headswitch register needed by
> MSM8226 and some other qcom platforms.
>
> Co-developed-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
> Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
> Signed-off-by: Luca Weiss <luca@lucaweiss.eu>
> ---
> Changes in v2:
> - Remove cx-supply from MSM8226 "fallback_proxy_supply" because it's
> always used as power domain
> ---
> drivers/remoteproc/qcom_q6v5_mss.c | 117 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 117 insertions(+)
>
> diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
> index e2523b01febf393abfe50740a68b85a04011293c..ef85c9843a12acb0e4e9ee6167c34d4981d4dc8a 100644
> --- a/drivers/remoteproc/qcom_q6v5_mss.c
> +++ b/drivers/remoteproc/qcom_q6v5_mss.c
> @@ -134,6 +134,11 @@
> #define BOOT_FSM_TIMEOUT 10000
> #define BHS_CHECK_MAX_LOOPS 200
>
> +/* External power block headswitch */
> +#define EXTERNAL_BHS_ON BIT(0)
> +#define EXTERNAL_BHS_STATUS BIT(4)
> +#define EXTERNAL_BHS_TIMEOUT_US 50
> +
> struct reg_info {
> struct regulator *reg;
> int uV;
> @@ -161,6 +166,7 @@ struct rproc_hexagon_res {
> [...]
> @@ -1871,6 +1897,36 @@ static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds,
> dev_pm_domain_detach(pds[i], false);
> }
>
> +static int q6v5_external_bhs_enable(struct q6v5 *qproc)
> +{
> + u32 val;
> + int ret = 0;
> +
> + /*
> + * Enable external power block headswitch and wait for it to
> + * stabilize
> + */
> + regmap_update_bits(qproc->conn_map, qproc->ext_bhs,
> + EXTERNAL_BHS_ON, 1);
Nitpick: regmap_update_bits() doesn't take a bool (0/1) as last value,
it's the actual value. The 1 as last argument is essentially a magic
number here that happens to be equal to EXTERNAL_BHS_ON = BIT(0).
This should be
regmap_update_bits(..., EXTERNAL_BHS_ON, EXTERNAL_BHS_ON);
or even better just
regmap_set_bits(..., EXTERNAL_BHS_ON);
> +
> + ret = regmap_read_poll_timeout(qproc->conn_map, qproc->ext_bhs,
> + val, val & EXTERNAL_BHS_STATUS,
> + 1, EXTERNAL_BHS_TIMEOUT_US);
> +
> + if (ret) {
> + dev_err(qproc->dev, "External BHS timed out\n");
> + ret = -ETIMEDOUT;
> + }
> +
> + return ret;
> +}
> +
> +static void q6v5_external_bhs_disable(struct q6v5 *qproc)
> +{
> + regmap_update_bits(qproc->conn_map, qproc->ext_bhs,
> + EXTERNAL_BHS_ON, 0);
regmap_clear_bits(..., EXTERNAL_BHS_ON);
> +}
> +
> static int q6v5_init_reset(struct q6v5 *qproc)
> {
> qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev,
> @@ -2021,6 +2077,7 @@ static int q6v5_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, qproc);
>
> qproc->has_qaccept_regs = desc->has_qaccept_regs;
> + qproc->has_ext_bhs_reg = desc->has_ext_bhs_reg;
> qproc->has_ext_cntl_regs = desc->has_ext_cntl_regs;
> qproc->has_vq6 = desc->has_vq6;
> qproc->has_spare_reg = desc->has_spare_reg;
> @@ -2079,6 +2136,14 @@ static int q6v5_probe(struct platform_device *pdev)
> qproc->proxy_pd_count = ret;
> }
>
> + if (qproc->has_ext_bhs_reg) {
> + ret = q6v5_external_bhs_enable(qproc);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Failed to enable external BHS.\n");
Since the only possible error condition inside
q6v5_external_bhs_enable() is the timeout condition that is already
logged, you might as well drop this error message.
Thanks,
Stephan
next prev parent reply other threads:[~2025-01-27 9:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-26 20:57 [PATCH v2 0/9] Modem support for MSM8226 Luca Weiss
2025-01-26 20:57 ` [PATCH v2 1/9] dt-bindings: remoteproc: qcom,msm8916-mss-pil: Support platforms with one power domain Luca Weiss
2025-01-27 7:48 ` Krzysztof Kozlowski
2025-01-26 20:57 ` [PATCH v2 2/9] dt-bindings: remoteproc: qcom,msm8916-mss-pil: Add MSM8226 Luca Weiss
2025-01-27 7:48 ` Krzysztof Kozlowski
2025-01-26 20:57 ` [PATCH v2 3/9] remoteproc: qcom_q6v5_mss: Handle platforms with one power domain Luca Weiss
2025-01-27 8:58 ` Stephan Gerhold
2025-01-27 22:21 ` Luca Weiss
2025-01-28 7:30 ` Stephan Gerhold
2025-01-28 22:02 ` Luca Weiss
2025-01-26 20:57 ` [PATCH v2 4/9] remoteproc: qcom_q6v5_mss: Add modem support on MSM8226 Luca Weiss
2025-01-27 9:06 ` Stephan Gerhold [this message]
2025-01-26 20:57 ` [PATCH v2 5/9] ARM: dts: qcom: msm8226: Add node for TCSR halt regs Luca Weiss
2025-01-28 11:27 ` Konrad Dybcio
2025-01-26 20:57 ` [PATCH v2 6/9] ARM: dts: qcom: msm8226: Add smsm node Luca Weiss
2025-01-27 9:28 ` Stephan Gerhold
2025-01-26 20:57 ` [PATCH v2 7/9] ARM: dts: qcom: msm8226: Add modem remoteproc node Luca Weiss
2025-01-27 9:19 ` Stephan Gerhold
2025-01-27 13:27 ` Luca Weiss
2025-01-26 20:57 ` [PATCH v2 8/9] ARM: dts: qcom: msm8226: Add BAM DMUX Ethernet/IP device Luca Weiss
2025-01-27 9:25 ` Stephan Gerhold
2025-01-26 20:57 ` [PATCH v2 9/9] ARM: dts: qcom: msm8226-samsung-matisse-common: Enable modem Luca Weiss
2025-01-27 9:44 ` Stephan Gerhold
2025-01-27 13:34 ` Luca Weiss
2025-01-27 13:44 ` Stephan Gerhold
2025-01-27 15:09 ` Konrad Dybcio
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=Z5dMkPvhjCkb9e9w@linaro.org \
--to=stephan.gerhold@linaro.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.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-remoteproc@vger.kernel.org \
--cc=luca@lucaweiss.eu \
--cc=mathieu.poirier@linaro.org \
--cc=matti.lehtimaki@gmail.com \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=stephan@gerhold.net \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.