From: Abel Vesa <abel.vesa@linaro.org>
To: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] phy: qualcomm: eusb2-repeater: Fix the regfields for multiple instances
Date: Thu, 4 Jan 2024 21:12:51 +0200 [thread overview]
Message-ID: <ZZcDM1CU3e1XfS/B@linaro.org> (raw)
In-Reply-To: <20240104-phy-qcom-eusb2-repeater-fixes-v1-1-047b7b6b8333@linaro.org>
On 24-01-04 16:52:11, Abel Vesa wrote:
> The global regmap fields offsets currently get incremented with the base
> address of the repeater. This issue doesn't get noticed unless the probe
> defers or there are multiple repeaters on that platform. So instead of
> incrementing the global ones, copy them for each instance of the
> repeater.
>
> Fixes: 4ba2e52718c0 ("phy: qualcomm: phy-qcom-eusb2-repeater: Use regmap_fields")
> Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> ---
> drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> index a623f092b11f..5f5862a68b73 100644
> --- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> +++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
> @@ -101,6 +101,7 @@ struct eusb2_repeater {
> struct regmap_field *regs[F_NUM_FIELDS];
> struct phy *phy;
> struct regulator_bulk_data *vregs;
> + struct reg_field *regfields;
> const struct eusb2_repeater_cfg *cfg;
> enum phy_mode mode;
> };
> @@ -140,8 +141,8 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr)
>
> static int eusb2_repeater_init(struct phy *phy)
> {
> - struct reg_field *regfields = eusb2_repeater_tune_reg_fields;
> struct eusb2_repeater *rptr = phy_get_drvdata(phy);
> + struct reg_field *regfields = rptr->regfields;
Oups, this is not needed. Will drop after I get some more comments on
this.
> struct device_node *np = rptr->dev->of_node;
> u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 };
> u8 override;
> @@ -262,15 +263,21 @@ static int eusb2_repeater_probe(struct platform_device *pdev)
> if (!regmap)
> return -ENODEV;
>
> + rptr->regfields = devm_kmemdup(dev, eusb2_repeater_tune_reg_fields,
> + sizeof(eusb2_repeater_tune_reg_fields),
> + GFP_KERNEL);
> + if (!rptr->regfields)
> + return -ENOMEM;
> +
> ret = of_property_read_u32(np, "reg", &res);
> if (ret < 0)
> return ret;
>
> for (i = 0; i < F_NUM_FIELDS; i++)
> - eusb2_repeater_tune_reg_fields[i].reg += res;
> + rptr->regfields[i].reg += res;
>
> ret = devm_regmap_field_bulk_alloc(dev, regmap, rptr->regs,
> - eusb2_repeater_tune_reg_fields,
> + rptr->regfields,
> F_NUM_FIELDS);
> if (ret)
> return ret;
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-01-04 19:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 14:52 [PATCH 0/2] phy: qualcomm: eusb2-repeater: Some fixes after the regmap rework Abel Vesa
2024-01-04 14:52 ` [PATCH 1/2] phy: qualcomm: eusb2-repeater: Fix the regfields for multiple instances Abel Vesa
2024-01-04 19:12 ` Abel Vesa [this message]
2024-01-04 22:46 ` Konrad Dybcio
2024-01-04 14:52 ` [PATCH 2/2] phy: qualcomm: eusb2-repeater: Drop the redundant zeroing Abel Vesa
2024-01-04 22:50 ` Konrad Dybcio
2024-01-05 9:16 ` Abel Vesa
2024-01-05 10:09 ` Konrad Dybcio
2024-01-05 10:19 ` Abel Vesa
2024-01-06 17:30 ` kernel test robot
2024-01-04 22:58 ` [PATCH 0/2] phy: qualcomm: eusb2-repeater: Some fixes after the regmap rework Elliot Berman
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=ZZcDM1CU3e1XfS/B@linaro.org \
--to=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=kishon@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=vkoul@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