From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Abel Vesa <abel.vesa@linaro.org>
Cc: Marijn Suijten <marijn.suijten@somainline.org>,
linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Konrad Dybcio <konrad.dybcio@linaro.org>
Subject: [PATCH 4/4] phy: qualcomm: phy-qcom-eusb2-repeater: Add tuning overrides
Date: Wed, 30 Aug 2023 04:40:18 +0200 [thread overview]
Message-ID: <20230830-topic-eusb2_override-v1-4-ab23825385a8@linaro.org> (raw)
In-Reply-To: <20230830-topic-eusb2_override-v1-0-ab23825385a8@linaro.org>
There are devices in the wild, like the Sony Xperia 1 V that *require*
different tuning than the base design for USB to work.
Add support for overriding the necessary tuning values.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
index 645f0e95703a..53e10feb16a1 100644
--- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
+++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
@@ -141,7 +141,9 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr)
static int eusb2_repeater_init(struct phy *phy)
{
struct eusb2_repeater *rptr = phy_get_drvdata(phy);
- const u32 *init_tbl = rptr->cfg->init_tbl;
+ struct device_node *np = rptr->dev->of_node;
+ u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 };
+ u8 override;
u32 val;
int ret;
int i;
@@ -152,6 +154,17 @@ static int eusb2_repeater_init(struct phy *phy)
regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN);
+ memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl));
+
+ if (!of_property_read_u8(np, "qcom,tune-iusb2-value", &override))
+ init_tbl[F_TUNE_IUSB2] = override;
+
+ if (!of_property_read_u8(np, "qcom,tune-hsdisc-value", &override))
+ init_tbl[F_TUNE_HSDISC] = override;
+
+ if (!of_property_read_u8(np, "qcom,tune-usb2-preem-value", &override))
+ init_tbl[F_TUNE_USB2_PREEM] = override;
+
for (i = 0; i < F_NUM_TUNE_FIELDS; i++)
regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]);
--
2.42.0
prev parent reply other threads:[~2023-08-30 2:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 2:40 [PATCH 0/4] EUSB2 repeater init sequence override Konrad Dybcio
2023-08-30 2:40 ` [PATCH 1/4] dt-bindings: phy: qcom,snps-eusb2-repeater: Add magic tuning overrides Konrad Dybcio
2023-09-05 16:38 ` Rob Herring
2023-09-06 7:28 ` Konrad Dybcio
2023-08-30 2:40 ` [PATCH 2/4] phy: qualcomm: phy-qcom-eusb2-repeater: Use regmap_fields Konrad Dybcio
2023-08-30 2:40 ` [PATCH 3/4] phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs Konrad Dybcio
2023-08-31 15:11 ` Konrad Dybcio
2023-08-30 2:40 ` Konrad Dybcio [this message]
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=20230830-topic-eusb2_override-v1-4-ab23825385a8@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=abel.vesa@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=marijn.suijten@somainline.org \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).