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 v3 05/13] remoteproc: qcom_q6v5_mss: Add modem support on MSM8226
Date: Tue, 28 Jan 2025 08:50:49 +0100 [thread overview]
Message-ID: <Z5iMWeiZKFBbHPLF@linaro.org> (raw)
In-Reply-To: <20250127-msm8226-modem-v3-5-67e968787eef@lucaweiss.eu>
On Mon, Jan 27, 2025 at 11:45:37PM +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>
> ---
> drivers/remoteproc/qcom_q6v5_mss.c | 113 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 113 insertions(+)
>
> diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
> index 0e1b0934ceedd13d5790b798afc95d68a8314c75..32f35fe89416f167fe49be7ca02a24af842e0073 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 {
> bool has_mba_logs;
> bool has_spare_reg;
> bool has_qaccept_regs;
> + bool has_ext_bhs_reg;
> bool has_ext_cntl_regs;
> bool has_vq6;
> };
> @@ -180,6 +186,7 @@ struct q6v5 {
> u32 halt_nc;
> u32 halt_vq6;
> u32 conn_box;
> + u32 ext_bhs;
>
> u32 qaccept_mdm;
> u32 qaccept_cx;
> @@ -237,6 +244,7 @@ struct q6v5 {
> bool has_mba_logs;
> bool has_spare_reg;
> bool has_qaccept_regs;
> + bool has_ext_bhs_reg;
> bool has_ext_cntl_regs;
> bool has_vq6;
> u64 mpss_perm;
> @@ -246,6 +254,7 @@ struct q6v5 {
> };
>
> enum {
> + MSS_MSM8226,
> MSS_MSM8909,
> MSS_MSM8916,
> MSS_MSM8953,
> @@ -1750,6 +1759,23 @@ static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev)
> qproc->qaccept_axi = args.args[2];
> }
>
> + if (qproc->has_ext_bhs_reg) {
> + ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
> + "qcom,ext-bhs-reg",
> + 1, 0, &args);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "failed to parse ext-bhs-reg index 0\n");
> + return -EINVAL;
> + }
> +
> + qproc->conn_map = syscon_node_to_regmap(args.np);
> + of_node_put(args.np);
> + if (IS_ERR(qproc->conn_map))
> + return PTR_ERR(qproc->conn_map);
> +
> + qproc->ext_bhs = args.args[0];
> + }
> +
> if (qproc->has_ext_cntl_regs) {
> ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
> "qcom,ext-regs",
> @@ -1871,6 +1897,34 @@ 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_set_bits(qproc->conn_map, qproc->ext_bhs, 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_clear_bits(qproc->conn_map, qproc->ext_bhs, EXTERNAL_BHS_ON);
> +}
> +
> static int q6v5_init_reset(struct q6v5 *qproc)
> {
> qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev,
> @@ -2021,6 +2075,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 +2134,12 @@ 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)
> + goto detach_proxy_pds;
> + }
> +
> qproc->has_alt_reset = desc->has_alt_reset;
> ret = q6v5_init_reset(qproc);
> if (ret)
> @@ -2143,6 +2204,9 @@ static void q6v5_remove(struct platform_device *pdev)
> qcom_remove_smd_subdev(rproc, &qproc->smd_subdev);
> qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
>
> + if (qproc->has_ext_bhs_reg)
> + q6v5_external_bhs_disable(qproc);
Sorry, just seeing this now: I think this is like the "active_supply"
you just added for MSM8926. It should get enabled when the modem is
started, and disabled when it gets stopped.
The calls to q6v5_external_bhs_enable() / q6v5_external_bhs_disable()
should be next to
ret = q6v5_regulator_enable(qproc, qproc->active_regs,
qproc->active_reg_count);
and
q6v5_regulator_disable(qproc, qproc->active_regs,
qproc->active_reg_count);
, instead of being called in the driver probe()/remove() function.
Downstream also has this next to the regulator_enable()/disable() [1]
(drv->vreg = mss-supply).
Thanks,
Stephan
[1]: https://git.codelinaro.org/clo/la/kernel/msm-3.10/-/blob/LA.BF.1.1.3-02310-8x26.0/arch/arm/mach-msm/pil-msa.c#L71-109
next prev parent reply other threads:[~2025-01-28 7:50 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 22:45 [PATCH v3 00/13] Modem support for MSM8226 Luca Weiss
2025-01-27 22:45 ` [PATCH v3 01/13] dt-bindings: remoteproc: qcom,msm8916-mss-pil: Support platforms with one power domain Luca Weiss
2025-01-27 22:45 ` [PATCH v3 02/13] dt-bindings: remoteproc: qcom,msm8916-mss-pil: Add MSM8226 Luca Weiss
2025-01-27 22:45 ` [PATCH v3 03/13] dt-bindings: remoteproc: qcom,msm8916-mss-pil: Add MSM8926 Luca Weiss
2025-01-28 7:39 ` Krzysztof Kozlowski
2025-01-27 22:45 ` [PATCH v3 04/13] remoteproc: qcom_q6v5_mss: Handle platforms with one power domain Luca Weiss
2025-01-28 7:33 ` Stephan Gerhold
2025-01-28 10:45 ` Konrad Dybcio
2025-01-28 10:55 ` Stephan Gerhold
2025-01-28 11:15 ` Konrad Dybcio
2025-01-27 22:45 ` [PATCH v3 05/13] remoteproc: qcom_q6v5_mss: Add modem support on MSM8226 Luca Weiss
2025-01-28 7:50 ` Stephan Gerhold [this message]
2025-01-27 22:45 ` [PATCH v3 06/13] remoteproc: qcom_q6v5_mss: Add modem support on MSM8926 Luca Weiss
2025-01-28 7:55 ` Stephan Gerhold
2025-01-27 22:45 ` [PATCH v3 07/13] ARM: dts: qcom: msm8226: Add node for TCSR halt regs Luca Weiss
2025-01-28 11:11 ` Konrad Dybcio
2025-01-27 22:45 ` [PATCH v3 08/13] ARM: dts: qcom: msm8226: Add smsm node Luca Weiss
2025-01-27 22:45 ` [PATCH v3 09/13] ARM: dts: qcom: msm8226: Add modem remoteproc node Luca Weiss
2025-01-28 8:05 ` Stephan Gerhold
2025-01-27 22:45 ` [PATCH v3 10/13] ARM: dts: qcom: msm8226: Add BAM DMUX Ethernet/IP device Luca Weiss
2025-01-27 22:45 ` [PATCH v3 11/13] ARM: dts: qcom: Introduce dtsi for LTE-capable MSM8926 Luca Weiss
2025-01-28 8:07 ` Stephan Gerhold
2025-01-28 16:46 ` Luca Weiss
2025-01-28 17:45 ` Stephan Gerhold
2025-01-28 11:13 ` Konrad Dybcio
2025-01-27 22:45 ` [PATCH v3 12/13] ARM: dts: qcom: msm8926-htc-memul: Enable modem Luca Weiss
2025-01-28 8:12 ` Stephan Gerhold
2025-01-28 11:14 ` Konrad Dybcio
2025-01-28 16:48 ` Luca Weiss
2025-01-27 22:45 ` [PATCH v3 13/13] ARM: dts: qcom: msm8226-samsung-matisse-common: " Luca Weiss
2025-01-28 8:12 ` Stephan Gerhold
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=Z5iMWeiZKFBbHPLF@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).