Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: Revert "phy: qualcomm: usb28nm: Add MDM9607 init sequence"

This reverts commit 557a28811c7e0286d3816842032db5eb7bb5f156.

This commit introduced an init sequence from downstream DT [1] in the
driver. As mentioned by the comment above the HSPHY_INIT_CFG macro for
this sequence:

/*
* The macro is used to define an initialization sequence. Each tuple
* is meant to program 'value' into phy register at 'offset' with 'delay'
* in us followed.
*/

Instead of corresponding to offsets into the phy register, the sequence
read by the downstream driver [2] is passed into ulpi_write [3] which
crafts the address-value pair into a new value and writes it into the
same register at USB_ULPI_VIEWPORT [4]. In other words, this init
sequence is programmed into the hardware in a totally different way than
downstream and is unlikely to achieve the desired result, if the hsphy
is working at all.

An alternative method needs to be found to write these init values at
the desired location. Fortunately mdm9607 did not land upstream yet [5]
and should have its compatible revised to use the generic one, instead
of a compatible that writes wrong data to the wrong registers.

[1]: https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/arch/arm/boot/dts/qcom/mdm9607.dtsi#585
[2]: https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/drivers/usb/phy/phy-msm-usb.c#4183
[3]: https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/drivers/usb/phy/phy-msm-usb.c#468
[4]: https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/drivers/usb/phy/phy-msm-usb.c#418
[5]: https://lore.kernel.org/linux-arm-msm/20210805222812.40731-1-konrad.dybcio@somainline.org/

Reported-by: Michael Srba <Michael.Srba@seznam.cz>
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20221214223733.648167-1-marijn.suijten@somainline.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Marijn Suijten and committed by
Vinod Koul
d60c471a 5daba914

-14
-1
Documentation/devicetree/bindings/phy/qcom,usb-hs-28nm.yaml
··· 16 16 compatible: 17 17 enum: 18 18 - qcom,usb-hs-28nm-femtophy 19 - - qcom,usb-hs-28nm-mdm9607 20 19 21 20 reg: 22 21 maxItems: 1
-13
drivers/phy/qualcomm/phy-qcom-usb-hs-28nm.c
··· 401 401 HSPHY_INIT_CFG(0x90, 0x60, 0), 402 402 }; 403 403 404 - static const struct hsphy_init_seq init_seq_mdm9607[] = { 405 - HSPHY_INIT_CFG(0x80, 0x44, 0), 406 - HSPHY_INIT_CFG(0x81, 0x38, 0), 407 - HSPHY_INIT_CFG(0x82, 0x24, 0), 408 - HSPHY_INIT_CFG(0x83, 0x13, 0), 409 - }; 410 - 411 404 static const struct hsphy_data hsphy_data_femtophy = { 412 405 .init_seq = init_seq_femtophy, 413 406 .init_seq_num = ARRAY_SIZE(init_seq_femtophy), 414 407 }; 415 408 416 - static const struct hsphy_data hsphy_data_mdm9607 = { 417 - .init_seq = init_seq_mdm9607, 418 - .init_seq_num = ARRAY_SIZE(init_seq_mdm9607), 419 - }; 420 - 421 409 static const struct of_device_id qcom_snps_hsphy_match[] = { 422 410 { .compatible = "qcom,usb-hs-28nm-femtophy", .data = &hsphy_data_femtophy, }, 423 - { .compatible = "qcom,usb-hs-28nm-mdm9607", .data = &hsphy_data_mdm9607, }, 424 411 { }, 425 412 }; 426 413 MODULE_DEVICE_TABLE(of, qcom_snps_hsphy_match);