[PATCH 1/2] phy: qcom-qmp-usb: fix register offsets for ipq8074/ipq6018

Mantas Pucka posted 2 patches 1 year, 11 months ago
[PATCH 1/2] phy: qcom-qmp-usb: fix register offsets for ipq8074/ipq6018
Posted by Mantas Pucka 1 year, 11 months ago
Commit 2be22aae6b18 ("phy: qcom-qmp-usb: populate offsets configuration")
introduced register offsets to the driver but for ipq8074/ipq6018 they do
not match what was in the old style device tree. Example from old
ipq6018.dtsi:

<0x00078200 0x130>,     /* Tx */
<0x00078400 0x200>,     /* Rx */
<0x00078800 0x1f8>,     /* PCS */
<0x00078600 0x044>;     /* PCS misc */

which would translate to:
{.., .pcs = 0x800, .pcs_misc = 0x600, .tx = 0x200, .rx = 0x400 }

but was translated to:
{.., .pcs = 0x600, .tx = 0x200, .rx = 0x400 }

So split usb_offsets and fix USB initialization for IPQ8074 and IPQ6018.
Tested only on IPQ6018

Fixes: 2be22aae6b18 ("phy: qcom-qmp-usb: populate offsets configuration")
Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
index 243cc2b9a0fb..05b4c0e67896 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -1556,6 +1556,14 @@ static const char * const qmp_phy_vreg_l[] = {
 	"vdda-phy", "vdda-pll",
 };
 
+static const struct qmp_usb_offsets qmp_usb_offsets_ipq8074 = {
+	.serdes		= 0,
+	.pcs		= 0x800,
+	.pcs_misc	= 0x600,
+	.tx		= 0x200,
+	.rx		= 0x400,
+};
+
 static const struct qmp_usb_offsets qmp_usb_offsets_ipq9574 = {
 	.serdes		= 0,
 	.pcs		= 0x800,
@@ -1616,7 +1624,7 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v7 = {
 static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
 	.lanes			= 1,
 
-	.offsets		= &qmp_usb_offsets_v3,
+	.offsets		= &qmp_usb_offsets_ipq8074,
 
 	.serdes_tbl		= ipq8074_usb3_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(ipq8074_usb3_serdes_tbl),
-- 
2.7.4
Re: [PATCH 1/2] phy: qcom-qmp-usb: fix register offsets for ipq8074/ipq6018
Posted by Dmitry Baryshkov 1 year, 11 months ago
On Tue, 23 Jan 2024 at 18:09, Mantas Pucka <mantas@8devices.com> wrote:
>
> Commit 2be22aae6b18 ("phy: qcom-qmp-usb: populate offsets configuration")
> introduced register offsets to the driver but for ipq8074/ipq6018 they do
> not match what was in the old style device tree. Example from old
> ipq6018.dtsi:
>
> <0x00078200 0x130>,     /* Tx */
> <0x00078400 0x200>,     /* Rx */
> <0x00078800 0x1f8>,     /* PCS */
> <0x00078600 0x044>;     /* PCS misc */
>
> which would translate to:
> {.., .pcs = 0x800, .pcs_misc = 0x600, .tx = 0x200, .rx = 0x400 }
>
> but was translated to:
> {.., .pcs = 0x600, .tx = 0x200, .rx = 0x400 }

Even worse, it was translated to { ... .pcs = 0xc00, .pcs_misc = 0xa00 ... }

With this fixed:

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

>
> So split usb_offsets and fix USB initialization for IPQ8074 and IPQ6018.
> Tested only on IPQ6018
>
> Fixes: 2be22aae6b18 ("phy: qcom-qmp-usb: populate offsets configuration")
> Signed-off-by: Mantas Pucka <mantas@8devices.com>
> ---
>  drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)


-- 
With best wishes
Dmitry
Re: [PATCH 1/2] phy: qcom-qmp-usb: fix register offsets for ipq8074/ipq6018
Posted by Mantas 1 year, 11 months ago
On 2024-01-23 18:42, Dmitry Baryshkov wrote:
> On Tue, 23 Jan 2024 at 18:09, Mantas Pucka <mantas@8devices.com> wrote:
>> Commit 2be22aae6b18 ("phy: qcom-qmp-usb: populate offsets configuration")
>> introduced register offsets to the driver but for ipq8074/ipq6018 they do
>> not match what was in the old style device tree. Example from old
>> ipq6018.dtsi:
>>
>> <0x00078200 0x130>,     /* Tx */
>> <0x00078400 0x200>,     /* Rx */
>> <0x00078800 0x1f8>,     /* PCS */
>> <0x00078600 0x044>;     /* PCS misc */
>>
>> which would translate to:
>> {.., .pcs = 0x800, .pcs_misc = 0x600, .tx = 0x200, .rx = 0x400 }
>>
>> but was translated to:
>> {.., .pcs = 0x600, .tx = 0x200, .rx = 0x400 }
> Even worse, it was translated to { ... .pcs = 0xc00, .pcs_misc = 0xa00 ... }
I was referring to qmp_usb_offsets_v3 here as ipq8074/ipq6018 did use
them, not qmp_usb_offsets_v3_qcm2290.
>
> With this fixed:
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
>> So split usb_offsets and fix USB initialization for IPQ8074 and IPQ6018.
>> Tested only on IPQ6018
>>
>> Fixes: 2be22aae6b18 ("phy: qcom-qmp-usb: populate offsets configuration")
>> Signed-off-by: Mantas Pucka <mantas@8devices.com>
>> ---
>>   drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>