sm8550: Add USB HC and PHYs support
Subsystems (4)
v3 cover sm8550: Add USB HC and PHYs support
This patchset adds support for USB for Qualcomm SM8550 platform.
This patchset is based on top of the following patchset:
https://lore.kernel.org/all/[email protected]/
For changelogs please look at each patch individually.
Abel Vesa (8):
dt-bindings: phy: Add qcom,snps-eusb2-phy schema file
phy: qcom: Add QCOM SNPS eUSB2 driver
dt-bindings: phy: qcom,qmp-usb: Document SM8550 compatible
phy: qcom-qmp: pcs-usb: Add v6 register offsets
phy: qcom-qmp: Add v6 DP register offsets
phy: qcom-qmp-combo: Add support for SM8550
arm64: dts: qcom: sm8550: Add USB PHYs and controller nodes
arm64: dts: qcom: sm8550-mtp: Add USB PHYs and HC nodes
.../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 1 + .../bindings/phy/qcom,snps-eusb2-phy.yaml | 78 ++++ arch/arm64/boot/dts/qcom/sm8550-mtp.dts | 22 + arch/arm64/boot/dts/qcom/sm8550.dtsi | 92 +++- drivers/phy/qualcomm/Kconfig | 9 + drivers/phy/qualcomm/Makefile | 1 + drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 406 ++++++++++++++++- .../phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 31 ++ drivers/phy/qualcomm/phy-qcom-qmp.h | 4 + drivers/phy/qualcomm/phy-qcom-snps-eusb2.c | 423 ++++++++++++++++++ 10 files changed, 1063 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml create mode 100644 drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h create mode 100644 drivers/phy/qualcomm/phy-qcom-snps-eusb2.c
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 1/8 dt-bindings: phy: Add qcom,snps-eusb2-phy schema file
The SM8550 SoC uses Synopsis eUSB2 PHY. Add a dt-binding schema for the new driver.
---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* none
Changes since v1:
* dropped the "ref src" clock
* dropped the usb-repeater property
.../bindings/phy/qcom,snps-eusb2-phy.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +78 -0
@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/qcom,snps-eusb2-phy.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm SNPS eUSB2 phy controller + +maintainers: + - Abel Vesa <[email protected]> + +description: + eUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. + +properties: + compatible: + const: qcom,sm8550-snps-eusb2-phy + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + + clocks: + items: + - description: ref + + clock-names: + items: + - const: ref + + resets: + maxItems: 1 + description: + Phandle to reset to phy block. + + vdd-supply: + description: + Phandle to 0.88V regulator supply to PHY digital circuit. + + vdda12-supply: + description: + Phandle to 1.2V regulator supply to PHY refclk pll block. + +required: + - compatible + - reg + - "#phy-cells" + - clocks + - clock-names + - vdd-supply + - vdda12-supply + - resets + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-sm8550.h> + #include <dt-bindings/clock/qcom,rpmh.h> + #include <dt-bindings/clock/qcom,tcsrcc-sm8550.h> + + usb_1_hsphy: phy@88e3000 { + compatible = "qcom,sm8550-snps-eusb2-phy"; + reg = <0x88e3000 0x154>; + #phy-cells = <0>; + + clocks = <&rpmhcc RPMH_CXO_PAD_CLK>, + <&tcsrcc TCSR_USB2_CLKREF_EN>; + clock-names = "ref_src", "ref"; + + vdd-supply = <&vreg_l1e_0p88>; + vdda12-supply = <&vreg_l3e_1p2>; + + resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>; + };
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Rob Herring
maintainerRe: [PATCH v3 1/8] dt-bindings: phy: Add qcom,snps-eusb2-phy schema file
Quoted 12 lines · Abel Vesa
The SM8550 SoC uses Synopsis eUSB2 PHY. Add a dt-binding schema for the new driver.
Signed-off-by Abel Vesa <[email protected]>---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/Changes since v2:
* none
Quoted 8 lines
Changes since v1:
* dropped the "ref src" clock
* dropped the usb-repeater property.../bindings/phy/qcom,snps-eusb2-phy.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.example.dts:18:18: fatal error: dt-bindings/clock/qcom,gcc-sm8550.h: No such file or directory
18 | #include <dt-bindings/clock/qcom,gcc-sm8550.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:434: Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.example.dtb] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1508: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Rob Herring
maintainerRe: [PATCH v3 1/8] dt-bindings: phy: Add qcom,snps-eusb2-phy schema file
In reply to Abel VesaQuoted 26 lines · Abel Vesa
The SM8550 SoC uses Synopsis eUSB2 PHY. Add a dt-binding schema for the new driver.
Signed-off-by Abel Vesa <[email protected]>---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/Changes since v2:
* noneChanges since v1:
* dropped the "ref src" clock
* dropped the usb-repeater property.../bindings/phy/qcom,snps-eusb2-phy.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yamlDocumentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +0
-0
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml line 2
Quoted 2 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +2
-0@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +
Remove blank line
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml line 6
Quoted 4 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +4
-0+%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/qcom,snps-eusb2-phy.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
Drop quotes
Quoted 21 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +21
-0+ +title: Qualcomm SNPS eUSB2 phy controller + +maintainers: + - Abel Vesa <[email protected]> + +description: + eUSB2 controller supports LS/FS/HS usb connectivity on Qualcomm chipsets. + +properties: + compatible: + const: qcom,sm8550-snps-eusb2-phy + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + + clocks: + items:
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml line 37
Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +10
-0+ - description: ref + + clock-names: + items: + - const: ref + + resets: + maxItems: 1 + description: + Phandle to reset to phy block.
Drop description.
Quoted 25 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +25
-0+ + vdd-supply: + description: + Phandle to 0.88V regulator supply to PHY digital circuit. + + vdda12-supply: + description: + Phandle to 1.2V regulator supply to PHY refclk pll block. + +required: + - compatible + - reg + - "#phy-cells" + - clocks + - clock-names + - vdd-supply + - vdda12-supply + - resets + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-sm8550.h> + #include <dt-bindings/clock/qcom,rpmh.h>
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml line 72
Quoted 10 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +10
-0+ #include <dt-bindings/clock/qcom,tcsrcc-sm8550.h> + + usb_1_hsphy: phy@88e3000 { + compatible = "qcom,sm8550-snps-eusb2-phy"; + reg = <0x88e3000 0x154>; + #phy-cells = <0>; + + clocks = <&rpmhcc RPMH_CXO_PAD_CLK>, + <&tcsrcc TCSR_USB2_CLKREF_EN>; + clock-names = "ref_src", "ref";
Doesn't match the schema.
Quoted 9 lines
Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml new file +6
-0+ + vdd-supply = <&vreg_l1e_0p88>; + vdda12-supply = <&vreg_l3e_1p2>; + + resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>; + };Signature · 1 line
2.34.1
PATCH v3 2/8 phy: qcom: Add QCOM SNPS eUSB2 driver
In reply to Abel VesaThe SM8550 SoC uses Synopsis eUSB2 PHY for USB 2.0. Add a new driver for it.
The driver is based on a downstream implementation.
---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* this time actually dropped the qcom_snps_, which I missed in the v2
* this time actually added the new lines after break in switch clause, as Vinod suggested, which I missed in the v2
Changes since v1:
* replaced qualcomm with qcom in subject line
* dropped all unnecessary includes
* dropped qcom_snps prefix from qcom_snps_eusb2_hsphy_vreg_names
* properly aligned the arguments for qcom_snps_eusb2_hsphy_write_mask
* added empty lines after break in switch clause, like Vinod suggested
drivers/phy/qualcomm/Kconfig | 9 + drivers/phy/qualcomm/Makefile | 1 + drivers/phy/qualcomm/phy-qcom-snps-eusb2.c | 423 +++++++++++++++++++++ 3 files changed, 433 insertions(+) create mode 100644 drivers/phy/qualcomm/phy-qcom-snps-eusb2.c
drivers/phy/qualcomm/Kconfig +9 -0
@@ -70,6 +70,15 @@ config PHY_QCOM_QUSB2 PHY which is usually paired with either the ChipIdea or Synopsys DWC3 USB IPs on MSM SOCs. +config PHY_QCOM_SNPS_EUSB2 + tristate "Qualcomm SNPS eUSB2 PHY Driver" + depends on OF && (ARCH_QCOM || COMPILE_TEST) + select GENERIC_PHY + help + Enable support for the USB high-speed SNPS eUSB2 phy on Qualcomm + chipsets. The PHY is paired with a Synopsys DWC3 USB controller + on Qualcomm SOCs. + config PHY_QCOM_USB_HS tristate "Qualcomm USB HS PHY module" depends on USB_ULPI_BUS
drivers/phy/qualcomm/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_QCOM_QMP) += \ phy-qcom-qmp-usb.o obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o +obj-$(CONFIG_PHY_QCOM_SNPS_EUSB2) += phy-qcom-snps-eusb2.o obj-$(CONFIG_PHY_QCOM_USB_HS) += phy-qcom-usb-hs.o obj-$(CONFIG_PHY_QCOM_USB_HSIC) += phy-qcom-usb-hsic.o obj-$(CONFIG_PHY_QCOM_USB_HS_28NM) += phy-qcom-usb-hs-28nm.o
drivers/phy/qualcomm/phy-qcom-snps-eusb2.c new file +423 -0
423 lines not on this page · raw message
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 3/8 dt-bindings: phy: qcom,qmp-usb: Document SM8550 compatible
In reply to Abel VesaAdd the SM8550 compatible to the list.
---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* none
Changes since v1:
* moved to sc8280xp bindings
.../devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml +1 -0
@@ -17,6 +17,7 @@ properties: compatible: enum: - qcom,sc8280xp-qmp-usb43dp-phy + - qcom,sm8550-qmp-usb3-dp-phy reg: maxItems: 1
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 3/8] dt-bindings: phy: qcom,qmp-usb: Document SM8550 compatible
Quoted 7 lines · Abel Vesa
Add the SM8550 compatible to the list.
Signed-off-by Abel Vesa <[email protected]>---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Quoted 9 lines
Changes since v2:
* noneChanges since v1:
* moved to sc8280xp bindings.../devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 1 + 1 file changed, 1 insertion(+)
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 4/8 phy: qcom-qmp: pcs-usb: Add v6 register offsets
In reply to Abel VesaThe new SM8550 SoC bumps up the HW version of QMP phy to v6 for USB. Add the new PCS USB specific offsets in a dedicated header file.
---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* none
Changes since v1:
* split all the offsets into separate patches, like Vinod suggested
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 1 + .../phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1 -0
@@ -26,6 +26,7 @@#include "phy-qcom-qmp-pcs-misc-v3.h" #include "phy-qcom-qmp-pcs-usb-v4.h" #include "phy-qcom-qmp-pcs-usb-v5.h" +#include "phy-qcom-qmp-pcs-usb-v6.h" /* QPHY_SW_RESET bit */ #define SW_RESET BIT(0)
drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2022, The Linux Foundation. All rights reserved. +*/ + +#ifndef QCOM_PHY_QMP_PCS_USB_V6_H_ +#define QCOM_PHY_QMP_PCS_USB_V6_H_ + +/* Only for QMP V6 PHY - USB3 have different offsets than V5 */ +#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG1 0xc4 +#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG2 0xc8 +#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 0xcc +#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 0xd8 +#define QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 0xdc +#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x90 +#define QPHY_USB_V6_PCS_RX_SIGDET_LVL 0x188 +#define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 +#define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194 +#define QPHY_USB_V6_PCS_CDR_RESET_TIME 0x1b0 +#define QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG1 0x1c0 +#define QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG2 0x1c4 +#define QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG 0x1d0 +#define QPHY_USB_V6_PCS_EQ_CONFIG1 0x1dc +#define QPHY_USB_V6_PCS_EQ_CONFIG5 0x1ec + +#define QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18 +#define QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c +#define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40 +#define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H 0x44 + +#endif
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 5/8 phy: qcom-qmp: Add v6 DP register offsets
In reply to Abel VesaThe new SM8550 SoC bumps up the HW version of QMP phy to v6. Add the new DP specific offsets in the generic qmp header file.
---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* none
This patch did not exist in v1. Since then, the DP support has been added.
drivers/phy/qualcomm/phy-qcom-qmp.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/phy/qualcomm/phy-qcom-qmp.h +4 -0
@@ -134,4 +134,8 @@#define QPHY_V4_PCS_MISC_TYPEC_STATUS 0x10#define QPHY_V4_PCS_MISC_PLACEHOLDER_STATUS 0x14 +/* Only for QMP V6 PHY - DP PHY registers */ +#define QSERDES_V6_DP_PHY_AUX_INTERRUPT_STATUS 0x0e0 +#define QSERDES_V6_DP_PHY_STATUS 0x0e4 +#endif
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 6/8 phy: qcom-qmp-combo: Add support for SM8550
In reply to Abel VesaAdd SM8550 specific register layout and table configs.
---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/
Changes since v2:
* none
Changes since v1:
* switched from qmp-usb to qmp-combo as it will support DP also
* changed all hex offset values to lowercase, like Vinod suggested
drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 405 +++++++++++++++++++++- 1 file changed, 402 insertions(+), 3 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +402 -3
@@ -498,6 +498,145 @@ static const struct qmp_phy_init_tbl sm8250_usb3_pcs_usb_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), }; +static const struct qmp_phy_init_tbl sm8550_usb3_serdes_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE1_MODE1 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE2_MODE1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE1 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE1 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE1 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CORECLK_DIV_MODE1 ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE1 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE1 ,0x41 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE1 ,0x41 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MSB_MODE1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START1_MODE1 ,0x55 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE1 ,0x75 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE1_MODE1 ,0x25 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE2_MODE1 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE1 ,0x5c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE1 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x5c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE0 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE0 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE0 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x1a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x41 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MSB_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START1_MODE0 ,0x55 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0x75 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE1_MODE0 ,0x25 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE2_MODE0 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BG_TIMER ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_EN_CENTER ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_PER1 ,0x62 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_PER2 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_BUF_ENABLE ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_EN_SEL ,0x1a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_CFG ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_MAP ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CORE_CLK_EN ,0x20 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CMN_CONFIG_1 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_1 ,0xb6 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_2 ,0x4b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_3 ,0x37 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_ADDITIONAL_MISC ,0x0c ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_tx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_TX ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_RX ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_TX ,0x1f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_RX ,0x09 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_1 ,0xf5 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_3 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_4 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_5 ,0x5f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RCV_DETECT_LVL_2 ,0x12 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_TX_PI_QEC_CTRL ,0x21 ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_TX_PI_QEC_CTRL ,0x05 ,2 ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_rx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FO_GAIN ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SO_GAIN ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FASTLOCK_FO_GAIN ,0x2f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SO_SATURATION_AND_ENABLE ,0x7f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FASTLOCK_COUNT_LOW ,0xff ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FASTLOCK_COUNT_HIGH ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_PI_CONTROLS ,0x99 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_THRESH1 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_THRESH2 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_GAIN1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_GAIN2 ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_AUX_DATA_TCOARSE_TFINE ,0xa0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_VGA_CAL_CNTRL1 ,0x54 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_VGA_CAL_CNTRL2 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_GM_CAL ,0x13 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQU_ADAPTOR_CNTRL2 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQU_ADAPTOR_CNTRL3 ,0x4a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQU_ADAPTOR_CNTRL4 ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_IDAC_TSETTLE_LOW ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_IDAC_TSETTLE_HIGH ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 ,0x47 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_CNTRL ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_DEGLITCH_CNTRL ,0x0e ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_LOW ,0xdc ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH ,0x5c ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH2 ,0x9c ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH3 ,0x1d ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH4 ,0x09 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_DFE_EN_TIMER ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_DFE_CTLE_POST_CAL_OFFSET ,0x38 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_DCC_CTRL1 ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_VTH_CODE ,0x10 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_CAL_CTRL1 ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_CAL_TRIM ,0x08 ), + +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_LOW ,0x3f ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH ,0xbf ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH2 ,0xff ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH3 ,0xdf ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH4 ,0xed ,1 ), + +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_LOW ,0xbf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH ,0xbf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH2 ,0xbf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH3 ,0xdf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH4 ,0xfd ,2 ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_pcs_tbl[] = { +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG1 ,0xc4 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG2 ,0x89 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 ,0x20 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 ,0x13 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 ,0x21 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_RX_SIGDET_LVL ,0x99 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L ,0xe7 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H ,0x03 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_CDR_RESET_TIME ,0x0a ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG1 ,0x88 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG2 ,0x13 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG ,0x0c ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_EQ_CONFIG1 ,0x4b ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_EQ_CONFIG5 ,0x10 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 ,0x68 ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL ,0xf8 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 ,0x07 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L ,0x40 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H ,0x00 ), +}; +static const struct qmp_phy_init_tbl qmp_v4_dp_serdes_tbl[] = {QMP_PHY_INIT_CFG (QSERDES_V4_COM_SVS_MODE_CLK_SEL ,0x05 ),QMP_PHY_INIT_CFG (QSERDES_V4_COM_SYSCLK_EN_SEL ,0x3b ),
@@ -619,6 +758,91 @@ static const struct qmp_phy_init_tbl qmp_v5_5nm_dp_tx_tbl[] = { QMP_PHY_INIT_CFG(QSERDES_V5_5NM_TX_TX_BAND, 0x01), }; +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SVS_MODE_CLK_SEL ,0x15 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_EN_SEL ,0x3b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYS_CLK_CTRL ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CLK_ENABLE1 ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_BUF_ENABLE ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CLK_SELECT ,0x30 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_IVCO ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE0 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE0 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE0 ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START1_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CMN_CONFIG_1 ,0x12 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_INTEGLOOP_GAIN0_MODE0 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_INTEGLOOP_GAIN1_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_MAP ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BG_TIMER ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CORE_CLK_DIV_MODE0 ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_CTRL ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN ,0x17 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CORE_CLK_EN ,0x0f ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_tx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_TX_VMODE_CTRL1 ,0x40 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_PRE_STALL_LDO_BOOST_EN ,0x30 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_INTERFACE_SELECT ,0x3b ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_CLKBUF_ENABLE ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RESET_TSYNC_EN ,0x03 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_TRAN_DRVR_EMP_EN ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_PARRATE_REC_DETECT_IDLE_EN ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_TX_INTERFACE_MODE ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_TX ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_RX ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_TX_BAND ,0x4 ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_rbr[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x05 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x37 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x71 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0c ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_hbr[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x03 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x71 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0c ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_hbr2[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x46 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x05 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x0e ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x97 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x10 ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_hbr3[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x17 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x15 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x71 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0c ), +}; +static const struct qmp_phy_init_tbl sc8280xp_usb43dp_serdes_tbl[] = {QMP_PHY_INIT_CFG (QSERDES_V5_COM_SSC_EN_CENTER ,0x01 ),QMP_PHY_INIT_CFG (QSERDES_V5_COM_SSC_PER1 ,0x31 ),
@@ -800,6 +1024,13 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { { 0x3f, 0xff, 0xff, 0xff } }; +static const u8 qmp_dp_v6_pre_emphasis_hbr_rbr[4 ][4 ] = { + {0x20 ,0x2d ,0x34 ,0x3a }, + {0x20 ,0x2e ,0x35 ,0xff }, + {0x20 ,0x2e ,0xff ,0xff }, + {0x22 ,0xff ,0xff ,0xff } +}; +struct qmp_combo ;struct qmp_combo_offsets {
@@ -813,6 +1044,8 @@ struct qmp_combo_offsets {u16 usb3_pcs;u16 usb3_pcs_usb;u16 dp_serdes; +u16 dp_tx0; +u16 dp_tx1;u16 dp_dp_phy; };
@@ -932,6 +1165,9 @@ static int qmp_v4_calibrate_dp_phy(struct qmp_combo *qmp);static int qmp_v5_configure_dp_phy (struct qmp_combo *qmp); +static void qmp_v6_dp_aux_init (struct qmp_combo *qmp); +static int qmp_v6_configure_dp_phy (struct qmp_combo *qmp); +static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val) {u32 reg;
@@ -990,9 +1226,27 @@ static const struct qmp_combo_offsets qmp_combo_offsets_v5 = { .usb3_pcs = 0x1400, .usb3_pcs_usb = 0x1700, .dp_serdes = 0x2000, + .dp_tx0 = 0x2200, + .dp_tx1 = 0x2600, .dp_dp_phy = 0x2200, }; +static const struct qmp_combo_offsets qmp_combo_offsets_v6 = { + .com =0x0000 , + .txa =0x1200 , + .rxa =0x1400 , + .txb =0x1600 , + .rxb =0x1800 , + .usb3_serdes =0x1000 , + .usb3_pcs_misc =0x1a00 , + .usb3_pcs =0x1c00 , + .usb3_pcs_usb =0x1f00 , + .dp_serdes =0x2000 , + .dp_tx0 =0x2200 , + .dp_tx1 =0x2600 , + .dp_dp_phy =0x2a00 , +}; +static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { .serdes_tbl = qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_serdes_tbl),
@@ -1224,6 +1478,54 @@ static const struct qmp_phy_cfg sm8250_usb3dpphy_cfg = { .has_pwrdn_delay = true, }; +static const struct qmp_phy_cfg sm8550_usb3dpphy_cfg = { + .offsets = &qmp_combo_offsets_v6, + + .serdes_tbl = sm8550_usb3_serdes_tbl, + .serdes_tbl_num =ARRAY_SIZE (sm8550_usb3_serdes_tbl), + .tx_tbl = sm8550_usb3_tx_tbl, + .tx_tbl_num =ARRAY_SIZE (sm8550_usb3_tx_tbl), + .rx_tbl = sm8550_usb3_rx_tbl, + .rx_tbl_num =ARRAY_SIZE (sm8550_usb3_rx_tbl), + .pcs_tbl = sm8550_usb3_pcs_tbl, + .pcs_tbl_num =ARRAY_SIZE (sm8550_usb3_pcs_tbl), + .pcs_usb_tbl = sm8550_usb3_pcs_usb_tbl, + .pcs_usb_tbl_num =ARRAY_SIZE (sm8550_usb3_pcs_usb_tbl), + + .dp_serdes_tbl = qmp_v6_dp_serdes_tbl, + .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl), + .dp_tx_tbl = qmp_v6_dp_tx_tbl, + .dp_tx_tbl_num =ARRAY_SIZE (qmp_v6_dp_tx_tbl), + + .serdes_tbl_rbr = qmp_v6_dp_serdes_tbl_rbr, + .serdes_tbl_rbr_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_rbr), + .serdes_tbl_hbr = qmp_v6_dp_serdes_tbl_hbr, + .serdes_tbl_hbr_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_hbr), + .serdes_tbl_hbr2 = qmp_v6_dp_serdes_tbl_hbr2, + .serdes_tbl_hbr2_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_hbr2), + .serdes_tbl_hbr3 = qmp_v6_dp_serdes_tbl_hbr3, + .serdes_tbl_hbr3_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_hbr3), + + .swing_hbr_rbr = &qmp_dp_v5_voltage_swing_hbr_rbr, + .pre_emphasis_hbr_rbr = &qmp_dp_v6_pre_emphasis_hbr_rbr, + .swing_hbr3_hbr2 = &qmp_dp_v5_voltage_swing_hbr3_hbr2, + .pre_emphasis_hbr3_hbr2 = &qmp_dp_v5_pre_emphasis_hbr3_hbr2, + + .dp_aux_init = qmp_v6_dp_aux_init, + .configure_dp_tx = qmp_v4_configure_dp_tx, + .configure_dp_phy = qmp_v6_configure_dp_phy, + .calibrate_dp_phy = qmp_v4_calibrate_dp_phy, + + .regs = qmp_v4_usb3phy_regs_layout, + .clk_list = qmp_v4_phy_clk_l, + .num_clks =ARRAY_SIZE (qmp_v4_phy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets =ARRAY_SIZE (msm8996_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs =ARRAY_SIZE (qmp_phy_vreg_l), + .pcs_usb_offset =0x300 , +}; + static void qmp_combo_configure_lane(void __iomem *base, const struct qmp_phy_init_tbl tbl[], int num,
@@ -1534,6 +1836,33 @@ static void qmp_v4_dp_aux_init(struct qmp_combo *qmp) qmp->dp_dp_phy + QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK); } +static void qmp_v6_dp_aux_init (struct qmp_combo *qmp) +{ +writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_PSR_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN | +DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , + qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL ); + +/* Turn on BIAS current for PHY/PLL */ +writel (0x17 , qmp->dp_serdes +QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN ); + +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xb7 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG9 ); + qmp->dp_aux_cfg =0 ; + +writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK | +PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK | +PHY_AUX_REQ_ERR_MASK , + qmp->dp_dp_phy +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); +} +static void qmp_v4_configure_dp_tx (struct qmp_combo *qmp) {/* Program default values before writing proper values */
@@ -1547,7 +1876,10 @@ static void qmp_v4_configure_dp_tx(struct qmp_combo *qmp) QSERDES_V4_TX_TX_EMP_POST1_LVL); } -static int qmp_v45_configure_dp_phy (struct qmp_combo *qmp) +static int qmp_v456_configure_dp_phy (struct qmp_combo *qmp, +unsigned int com_resetm_ctrl_reg, +unsigned int com_c_ready_status_reg, +unsigned int dp_phy_status_reg) {const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 phy_vco_div, status;
@@ -1644,7 +1976,9 @@ static int qmp_v4_configure_dp_phy(struct qmp_combo *qmp)u32 status;int ret; - ret =qmp_v45_configure_dp_phy (qmp); + ret =qmp_v456_configure_dp_phy (qmp,QSERDES_V4_COM_RESETSM_CNTRL , +QSERDES_V4_COM_C_READY_STATUS , +QSERDES_V4_DP_PHY_STATUS );if (ret <0 )return ret;
@@ -1706,7 +2040,9 @@ static int qmp_v5_configure_dp_phy(struct qmp_combo *qmp)u32 status;int ret; - ret =qmp_v45_configure_dp_phy (qmp); + ret =qmp_v456_configure_dp_phy (qmp,QSERDES_V4_COM_RESETSM_CNTRL , +QSERDES_V4_COM_C_READY_STATUS , +QSERDES_V4_DP_PHY_STATUS );if (ret <0 )return ret;
@@ -1755,6 +2091,65 @@ static int qmp_v5_configure_dp_phy(struct qmp_combo *qmp)return 0 ; } +static int qmp_v6_configure_dp_phy (struct qmp_combo *qmp) +{ +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts; +u32 bias0_en, drvr0_en, bias1_en, drvr1_en; +bool reverse = false; +u32 status; +int ret; + + ret =qmp_v456_configure_dp_phy (qmp,QSERDES_V6_COM_RESETSM_CNTRL , +QSERDES_V6_COM_C_READY_STATUS , +QSERDES_V6_DP_PHY_STATUS ); +if (ret <0 ) +return ret; + +if (dp_opts->lanes ==1 ) { + bias0_en = reverse ?0x3e :0x1a ; + drvr0_en = reverse ?0x13 :0x10 ; + bias1_en = reverse ?0x15 :0x3e ; + drvr1_en = reverse ?0x10 :0x13 ; + }else if (dp_opts->lanes ==2 ) { + bias0_en = reverse ?0x3f :0x15 ; + drvr0_en =0x10 ; + bias1_en = reverse ?0x15 :0x3f ; + drvr1_en =0x10 ; + }else { + bias0_en =0x3f ; + bias1_en =0x3f ; + drvr0_en =0x10 ; + drvr1_en =0x10 ; + } + +writel (drvr0_en, qmp->dp_tx +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias0_en, qmp->dp_tx +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr1_en, qmp->dp_tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias1_en, qmp->dp_tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); + +writel (0x18 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +udelay (2000 ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); + +if (readl_poll_timeout (qmp->dp_dp_phy +QSERDES_V6_DP_PHY_STATUS , + status, + ((status &BIT (1 )) >0 ), +500 , +10000 )) +return -ETIMEDOUT ; + +writel (0x0a , qmp->dp_tx +QSERDES_V4_TX_TX_POL_INV ); +writel (0x0a , qmp->dp_tx2 +QSERDES_V4_TX_TX_POL_INV ); + +writel (0x27 , qmp->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); + +writel (0x20 , qmp->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); + +return 0 ; +} +/* * We need to calibrate the aux setting here as many times * as the caller tries
@@ -2797,6 +3192,10 @@ static const struct of_device_id qmp_combo_of_match_table[] = { .compatible = "qcom,sm8250-qmp-usb3-dp-phy", .data = &sm8250_usb3dpphy_cfg, }, + { + .compatible = "qcom,sm8550-qmp-usb3-dp-phy", + .data = &sm8550_usb3dpphy_cfg, + }, { } };MODULE_DEVICE_TABLE (of, qmp_combo_of_match_table);
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Neil Armstrong
reviewerRe: [PATCH v3 6/8] phy: qcom-qmp-combo: Add support for SM8550
Quoted 294 lines · Abel Vesa
Add SM8550 specific register layout and table configs.
Signed-off-by Abel Vesa <[email protected]>---
The v2 version of this patch was here:
https://lore.kernel.org/all/[email protected]/Changes since v2:
* noneChanges since v1:
* switched from qmp-usb to qmp-combo as it will support DP also
* changed all hex offset values to lowercase, like Vinod suggesteddrivers/phy/qualcomm/phy-qcom-qmp-combo.c | 405 +++++++++++++++++++++- 1 file changed, 402 insertions(+), 3 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-combo.c +236
-0@@ -498,6 +498,145 @@ static const struct qmp_phy_init_tbl sm8250_usb3_pcs_usb_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), }; +static const struct qmp_phy_init_tbl sm8550_usb3_serdes_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE1_MODE1 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE2_MODE1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE1 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE1 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE1 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CORECLK_DIV_MODE1 ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE1 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE1 ,0x41 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE1 ,0x41 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MSB_MODE1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START1_MODE1 ,0x55 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE1 ,0x75 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE1_MODE1 ,0x25 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE2_MODE1 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE1 ,0x5c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE1 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x5c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE0 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE0 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE0 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x1a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x41 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MSB_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START1_MODE0 ,0x55 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0x75 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE1_MODE0 ,0x25 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE2_MODE0 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BG_TIMER ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_EN_CENTER ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_PER1 ,0x62 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SSC_PER2 ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_BUF_ENABLE ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_EN_SEL ,0x1a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_CFG ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_MAP ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CORE_CLK_EN ,0x20 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CMN_CONFIG_1 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_1 ,0xb6 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_2 ,0x4b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_3 ,0x37 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_ADDITIONAL_MISC ,0x0c ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_tx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_TX ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_RX ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_TX ,0x1f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_RX ,0x09 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_1 ,0xf5 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_3 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_4 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_5 ,0x5f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RCV_DETECT_LVL_2 ,0x12 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_TX_PI_QEC_CTRL ,0x21 ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_TX_PI_QEC_CTRL ,0x05 ,2 ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_rx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FO_GAIN ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SO_GAIN ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FASTLOCK_FO_GAIN ,0x2f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SO_SATURATION_AND_ENABLE ,0x7f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FASTLOCK_COUNT_LOW ,0xff ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_FASTLOCK_COUNT_HIGH ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_PI_CONTROLS ,0x99 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_THRESH1 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_THRESH2 ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_GAIN1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_UCDR_SB2_GAIN2 ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_AUX_DATA_TCOARSE_TFINE ,0xa0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_VGA_CAL_CNTRL1 ,0x54 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_VGA_CAL_CNTRL2 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_GM_CAL ,0x13 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQU_ADAPTOR_CNTRL2 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQU_ADAPTOR_CNTRL3 ,0x4a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQU_ADAPTOR_CNTRL4 ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_IDAC_TSETTLE_LOW ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_IDAC_TSETTLE_HIGH ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 ,0x47 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_CNTRL ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_DEGLITCH_CNTRL ,0x0e ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_LOW ,0xdc ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH ,0x5c ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH2 ,0x9c ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH3 ,0x1d ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_RX_MODE_01_HIGH4 ,0x09 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_DFE_EN_TIMER ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_DFE_CTLE_POST_CAL_OFFSET ,0x38 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_DCC_CTRL1 ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_VTH_CODE ,0x10 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_CAL_CTRL1 ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_RX_SIGDET_CAL_TRIM ,0x08 ), + +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_LOW ,0x3f ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH ,0xbf ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH2 ,0xff ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH3 ,0xdf ,1 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH4 ,0xed ,1 ), + +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_LOW ,0xbf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH ,0xbf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH2 ,0xbf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH3 ,0xdf ,2 ), +QMP_PHY_INIT_CFG_LANE (QSERDES_V6_RX_RX_MODE_00_HIGH4 ,0xfd ,2 ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_pcs_tbl[] = { +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG1 ,0xc4 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG2 ,0x89 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 ,0x20 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 ,0x13 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 ,0x21 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_RX_SIGDET_LVL ,0x99 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L ,0xe7 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H ,0x03 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_CDR_RESET_TIME ,0x0a ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG1 ,0x88 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG2 ,0x13 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG ,0x0c ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_EQ_CONFIG1 ,0x4b ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_EQ_CONFIG5 ,0x10 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 ,0x68 ), +}; + +static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL ,0xf8 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 ,0x07 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L ,0x40 ), +QMP_PHY_INIT_CFG (QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H ,0x00 ), +}; +static const struct qmp_phy_init_tbl qmp_v4_dp_serdes_tbl[] = {QMP_PHY_INIT_CFG (QSERDES_V4_COM_SVS_MODE_CLK_SEL ,0x05 ),QMP_PHY_INIT_CFG (QSERDES_V4_COM_SYSCLK_EN_SEL ,0x3b ),@@ -619,6 +758,91 @@ static const struct qmp_phy_init_tbl qmp_v5_5nm_dp_tx_tbl[] = { QMP_PHY_INIT_CFG(QSERDES_V5_5NM_TX_TX_BAND, 0x01), }; +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SVS_MODE_CLK_SEL ,0x15 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_EN_SEL ,0x3b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYS_CLK_CTRL ,0x02 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CLK_ENABLE1 ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_SYSCLK_BUF_ENABLE ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CLK_SELECT ,0x30 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_IVCO ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE0 ,0x36 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE0 ,0x16 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE0 ,0x06 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START1_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CMN_CONFIG_1 ,0x12 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_INTEGLOOP_GAIN0_MODE0 ,0x3f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_INTEGLOOP_GAIN1_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_MAP ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BG_TIMER ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CORE_CLK_DIV_MODE0 ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_CTRL ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN ,0x17 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CORE_CLK_EN ,0x0f ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_tx_tbl[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_TX_VMODE_CTRL1 ,0x40 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_PRE_STALL_LDO_BOOST_EN ,0x30 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_INTERFACE_SELECT ,0x3b ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_CLKBUF_ENABLE ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RESET_TSYNC_EN ,0x03 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_TRAN_DRVR_EMP_EN ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_PARRATE_REC_DETECT_IDLE_EN ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_TX_INTERFACE_MODE ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_TX ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_RES_CODE_LANE_OFFSET_RX ,0x0c ), +QMP_PHY_INIT_CFG (QSERDES_V6_TX_TX_BAND ,0x4 ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_rbr[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x05 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x37 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x04 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x71 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0c ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_hbr[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x03 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x71 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0c ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_hbr2[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x01 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x46 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x05 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x0e ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x97 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x10 ), +}; + +static const struct qmp_phy_init_tbl qmp_v6_dp_serdes_tbl_hbr3[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_HSCLK_SEL_1 ,0x00 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x34 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START2_MODE0 ,0xc0 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DIV_FRAC_START3_MODE0 ,0x0b ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x17 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x15 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP_EN ,0x08 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0 ,0x71 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0 ,0x0c ), +}; +static const struct qmp_phy_init_tbl sc8280xp_usb43dp_serdes_tbl[] = {QMP_PHY_INIT_CFG (QSERDES_V5_COM_SSC_EN_CENTER ,0x01 ),QMP_PHY_INIT_CFG (QSERDES_V5_COM_SSC_PER1 ,0x31 ),@@ -800,6 +1024,13 @@ static const u8 qmp_dp_v5_voltage_swing_hbr_rbr[4][4] = { { 0x3f, 0xff, 0xff, 0xff } }; +static const u8 qmp_dp_v6_pre_emphasis_hbr_rbr[4 ][4 ] = { + {0x20 ,0x2d ,0x34 ,0x3a }, + {0x20 ,0x2e ,0x35 ,0xff }, + {0x20 ,0x2e ,0xff ,0xff }, + {0x22 ,0xff ,0xff ,0xff } +}; +struct qmp_combo ;struct qmp_combo_offsets {@@ -813,6 +1044,8 @@ struct qmp_combo_offsets {u16 usb3_pcs;u16 usb3_pcs_usb;u16 dp_serdes; +u16 dp_tx0; +u16 dp_tx1;u16 dp_dp_phy; };@@ -932,6 +1165,9 @@ static int qmp_v4_calibrate_dp_phy(struct qmp_combo *qmp);static int qmp_v5_configure_dp_phy (struct qmp_combo *qmp); +static void qmp_v6_dp_aux_init (struct qmp_combo *qmp); +static int qmp_v6_configure_dp_phy (struct qmp_combo *qmp); +static inline void qphy_setbits (void __iomem *base,u32 offset,u32 val) {u32 reg;
drivers/phy/qualcomm/phy-qcom-qmp-combo.c static const struct qmp_combo_offsets qmp_combo_offsets_v5 = { · line 1230
Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +2
-0@@ -990,9 +1226,27 @@ static const struct qmp_combo_offsets qmp_combo_offsets_v5 = { .usb3_pcs = 0x1400, .usb3_pcs_usb = 0x1700, .dp_serdes = 0x2000, + .dp_tx0 = 0x2200, + .dp_tx1 = 0x2600,
It seems the code in qmp_combo_parse_dt() using those dp_tx0/dp_tx1 were lost in the combo comversion process.
The code was:
=================================================
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +2 -2
@@ -3034,8 +3034,8 @@ static int qmp_combo_parse_dt(struct qmp_combo *qmp) qmp->pcs_usb = base + offs->usb3_pcs_usb; qmp->dp_serdes = base + offs->dp_serdes; - qmp->dp_tx = base + offs->txa; - qmp->dp_tx2 = base + offs->txb; + qmp->dp_tx = base + offs->dp_tx0; + qmp->dp_tx2 = base + offs->dp_tx1; qmp->dp_dp_phy = base + offs->dp_dp_phy; qmp->pipe_clk =devm_clk_get (dev,"usb3_pipe" );
=================================================
But something similar is being discussed in https://lore.kernel.org/all/[email protected]/
and also submitted as https://lore.kernel.org/all/[email protected]/
I'm not a bug fan of the "txa" & "txb" namings since HW registers are named TX0/1 and RX0/1, and the non-combo PHY uses 0 & 1...
Quoted 222 lines
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +164
-3.dp_dp_phy = 0x2200, }; +static const struct qmp_combo_offsets qmp_combo_offsets_v6 = { + .com =0x0000 , + .txa =0x1200 , + .rxa =0x1400 , + .txb =0x1600 , + .rxb =0x1800 , + .usb3_serdes =0x1000 , + .usb3_pcs_misc =0x1a00 , + .usb3_pcs =0x1c00 , + .usb3_pcs_usb =0x1f00 , + .dp_serdes =0x2000 , + .dp_tx0 =0x2200 , + .dp_tx1 =0x2600 , + .dp_dp_phy =0x2a00 , +}; +static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { .serdes_tbl = qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =ARRAY_SIZE (qmp_v3_usb3_serdes_tbl),@@ -1224,6 +1478,54 @@ static const struct qmp_phy_cfg sm8250_usb3dpphy_cfg = { .has_pwrdn_delay = true, }; +static const struct qmp_phy_cfg sm8550_usb3dpphy_cfg = { + .offsets = &qmp_combo_offsets_v6, + + .serdes_tbl = sm8550_usb3_serdes_tbl, + .serdes_tbl_num =ARRAY_SIZE (sm8550_usb3_serdes_tbl), + .tx_tbl = sm8550_usb3_tx_tbl, + .tx_tbl_num =ARRAY_SIZE (sm8550_usb3_tx_tbl), + .rx_tbl = sm8550_usb3_rx_tbl, + .rx_tbl_num =ARRAY_SIZE (sm8550_usb3_rx_tbl), + .pcs_tbl = sm8550_usb3_pcs_tbl, + .pcs_tbl_num =ARRAY_SIZE (sm8550_usb3_pcs_tbl), + .pcs_usb_tbl = sm8550_usb3_pcs_usb_tbl, + .pcs_usb_tbl_num =ARRAY_SIZE (sm8550_usb3_pcs_usb_tbl), + + .dp_serdes_tbl = qmp_v6_dp_serdes_tbl, + .dp_serdes_tbl_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl), + .dp_tx_tbl = qmp_v6_dp_tx_tbl, + .dp_tx_tbl_num =ARRAY_SIZE (qmp_v6_dp_tx_tbl), + + .serdes_tbl_rbr = qmp_v6_dp_serdes_tbl_rbr, + .serdes_tbl_rbr_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_rbr), + .serdes_tbl_hbr = qmp_v6_dp_serdes_tbl_hbr, + .serdes_tbl_hbr_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_hbr), + .serdes_tbl_hbr2 = qmp_v6_dp_serdes_tbl_hbr2, + .serdes_tbl_hbr2_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_hbr2), + .serdes_tbl_hbr3 = qmp_v6_dp_serdes_tbl_hbr3, + .serdes_tbl_hbr3_num =ARRAY_SIZE (qmp_v6_dp_serdes_tbl_hbr3), + + .swing_hbr_rbr = &qmp_dp_v5_voltage_swing_hbr_rbr, + .pre_emphasis_hbr_rbr = &qmp_dp_v6_pre_emphasis_hbr_rbr, + .swing_hbr3_hbr2 = &qmp_dp_v5_voltage_swing_hbr3_hbr2, + .pre_emphasis_hbr3_hbr2 = &qmp_dp_v5_pre_emphasis_hbr3_hbr2, + + .dp_aux_init = qmp_v6_dp_aux_init, + .configure_dp_tx = qmp_v4_configure_dp_tx, + .configure_dp_phy = qmp_v6_configure_dp_phy, + .calibrate_dp_phy = qmp_v4_calibrate_dp_phy, + + .regs = qmp_v4_usb3phy_regs_layout, + .clk_list = qmp_v4_phy_clk_l, + .num_clks =ARRAY_SIZE (qmp_v4_phy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets =ARRAY_SIZE (msm8996_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs =ARRAY_SIZE (qmp_phy_vreg_l), + .pcs_usb_offset =0x300 , +}; + static void qmp_combo_configure_lane(void __iomem *base, const struct qmp_phy_init_tbl tbl[], int num,@@ -1534,6 +1836,33 @@ static void qmp_v4_dp_aux_init(struct qmp_combo *qmp) qmp->dp_dp_phy + QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK); } +static void qmp_v6_dp_aux_init (struct qmp_combo *qmp) +{ +writel (DP_PHY_PD_CTL_PWRDN |DP_PHY_PD_CTL_PSR_PWRDN |DP_PHY_PD_CTL_AUX_PWRDN | +DP_PHY_PD_CTL_PLL_PWRDN |DP_PHY_PD_CTL_DP_CLAMP_EN , + qmp->dp_dp_phy +QSERDES_DP_PHY_PD_CTL ); + +/* Turn on BIAS current for PHY/PLL */ +writel (0x17 , qmp->dp_serdes +QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN ); + +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG0 ); +writel (0x13 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG1 ); +writel (0xa4 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG2 ); +writel (0x00 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG3 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG4 ); +writel (0x26 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG5 ); +writel (0x0a , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG6 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG7 ); +writel (0xb7 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG8 ); +writel (0x03 , qmp->dp_dp_phy +QSERDES_DP_PHY_AUX_CFG9 ); + qmp->dp_aux_cfg =0 ; + +writel (PHY_AUX_STOP_ERR_MASK |PHY_AUX_DEC_ERR_MASK | +PHY_AUX_SYNC_ERR_MASK |PHY_AUX_ALIGN_ERR_MASK | +PHY_AUX_REQ_ERR_MASK , + qmp->dp_dp_phy +QSERDES_V4_DP_PHY_AUX_INTERRUPT_MASK ); +} +static void qmp_v4_configure_dp_tx (struct qmp_combo *qmp) {/* Program default values before writing proper values */ @@ -1547,7 +1876,10 @@ static void qmp_v4_configure_dp_tx(struct qmp_combo *qmp) QSERDES_V4_TX_TX_EMP_POST1_LVL); } -static int qmp_v45_configure_dp_phy (struct qmp_combo *qmp) +static int qmp_v456_configure_dp_phy (struct qmp_combo *qmp, +unsigned int com_resetm_ctrl_reg, +unsigned int com_c_ready_status_reg, +unsigned int dp_phy_status_reg) {const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;u32 phy_vco_div, status;@@ -1644,7 +1976,9 @@ static int qmp_v4_configure_dp_phy(struct qmp_combo *qmp)u32 status;int ret; - ret =qmp_v45_configure_dp_phy (qmp); + ret =qmp_v456_configure_dp_phy (qmp,QSERDES_V4_COM_RESETSM_CNTRL , +QSERDES_V4_COM_C_READY_STATUS , +QSERDES_V4_DP_PHY_STATUS );if (ret <0 )return ret;@@ -1706,7 +2040,9 @@ static int qmp_v5_configure_dp_phy(struct qmp_combo *qmp)u32 status;int ret; - ret =qmp_v45_configure_dp_phy (qmp); + ret =qmp_v456_configure_dp_phy (qmp,QSERDES_V4_COM_RESETSM_CNTRL , +QSERDES_V4_COM_C_READY_STATUS , +QSERDES_V4_DP_PHY_STATUS );if (ret <0 )return ret;@@ -1755,6 +2091,65 @@ static int qmp_v5_configure_dp_phy(struct qmp_combo *qmp)return 0 ; } +static int qmp_v6_configure_dp_phy (struct qmp_combo *qmp) +{ +const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts; +u32 bias0_en, drvr0_en, bias1_en, drvr1_en; +bool reverse = false; +u32 status; +int ret; + + ret =qmp_v456_configure_dp_phy (qmp,QSERDES_V6_COM_RESETSM_CNTRL , +QSERDES_V6_COM_C_READY_STATUS , +QSERDES_V6_DP_PHY_STATUS ); +if (ret <0 ) +return ret; + +if (dp_opts->lanes ==1 ) { + bias0_en = reverse ?0x3e :0x1a ; + drvr0_en = reverse ?0x13 :0x10 ; + bias1_en = reverse ?0x15 :0x3e ; + drvr1_en = reverse ?0x10 :0x13 ; + }else if (dp_opts->lanes ==2 ) { + bias0_en = reverse ?0x3f :0x15 ; + drvr0_en =0x10 ; + bias1_en = reverse ?0x15 :0x3f ; + drvr1_en =0x10 ; + }else { + bias0_en =0x3f ; + bias1_en =0x3f ; + drvr0_en =0x10 ; + drvr1_en =0x10 ; + } + +writel (drvr0_en, qmp->dp_tx +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias0_en, qmp->dp_tx +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); +writel (drvr1_en, qmp->dp_tx2 +QSERDES_V4_TX_HIGHZ_DRVR_EN ); +writel (bias1_en, qmp->dp_tx2 +QSERDES_V4_TX_TRANSCEIVER_BIAS_EN ); + +writel (0x18 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); +udelay (2000 ); +writel (0x19 , qmp->dp_dp_phy +QSERDES_DP_PHY_CFG ); + +if (readl_poll_timeout (qmp->dp_dp_phy +QSERDES_V6_DP_PHY_STATUS , + status, + ((status &BIT (1 )) >0 ), +500 , +10000 )) +return -ETIMEDOUT ; + +writel (0x0a , qmp->dp_tx +QSERDES_V4_TX_TX_POL_INV ); +writel (0x0a , qmp->dp_tx2 +QSERDES_V4_TX_TX_POL_INV ); + +writel (0x27 , qmp->dp_tx +QSERDES_V4_TX_TX_DRV_LVL ); +writel (0x27 , qmp->dp_tx2 +QSERDES_V4_TX_TX_DRV_LVL ); + +writel (0x20 , qmp->dp_tx +QSERDES_V4_TX_TX_EMP_POST1_LVL ); +writel (0x20 , qmp->dp_tx2 +QSERDES_V4_TX_TX_EMP_POST1_LVL ); + +return 0 ; +} +/* * We need to calibrate the aux setting here as many times * as the caller tries @@ -2797,6 +3192,10 @@ static const struct of_device_id qmp_combo_of_match_table[] = { .compatible = "qcom,sm8250-qmp-usb3-dp-phy", .data = &sm8250_usb3dpphy_cfg, }, + { + .compatible = "qcom,sm8550-qmp-usb3-dp-phy", + .data = &sm8550_usb3dpphy_cfg, + }, { } };MODULE_DEVICE_TABLE (of, qmp_combo_of_match_table);
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 7/8 arm64: dts: qcom: sm8550: Add USB PHYs and controller nodes
In reply to Abel VesaAdd USB host controller and PHY nodes.
---
Changes since v2:
* none
NOTE: This patch has been already merged. It is here only to provide context for the rest of the patchset. There is a change with respect to the clocks, but that will be sent as a separate/individual fix patch.
arch/arm64/boot/dts/qcom/sm8550.dtsi | 92 +++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +91 -1
@@ -13,6 +13,7 @@ #include <dt-bindings/mailbox/qcom-ipcc.h> #include <dt-bindings/power/qcom-rpmpd.h> #include <dt-bindings/soc/qcom,rpmh-rsc.h> +#include <dt-bindings/phy/phy-qcom-qmp.h> #include <dt-bindings/thermal/thermal.h> / {
@@ -652,7 +653,7 @@ gcc: clock-controller@100000 { <&ufs_mem_phy 0>, <&ufs_mem_phy 1>, <&ufs_mem_phy 2>, - <0>; + <&usb_dp_qmpphy QMP_USB43DP_USB3_PIPE_CLK>; }; ipcc: mailbox@408000 {
@@ -1924,6 +1925,95 @@ opp-202000000 { }; }; + usb_1_hsphy: phy@88e3000 { + compatible = "qcom,sm8550-snps-eusb2-phy"; + reg = <0x0 0x088e3000 0x0 0x154>; + #phy-cells = <0>; + + clocks = <&tcsr TCSR_USB2_CLKREF_EN>; + clock-names = "ref"; + + resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>; + + status = "disabled"; + }; + + usb_dp_qmpphy: phy@88e8000 { + compatible = "qcom,sm8550-qmp-usb3-dp-phy"; + reg = <0x0 0x088e8000 0x0 0x3000>; + + clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>, + <&rpmhcc RPMH_CXO_CLK>, + <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>, + <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; + clock-names = "aux", "ref", "com_aux", "usb3_pipe"; + + power-domains = <&gcc USB3_PHY_GDSC>; + + resets = <&gcc GCC_USB3_DP_PHY_PRIM_BCR>, + <&gcc GCC_USB3_PHY_PRIM_BCR>; + reset-names = "phy", "common"; + + #clock-cells = <1>; + #phy-cells = <1>; + + status = "disabled"; + }; + + usb_1: usb@a6f8800 { + compatible = "qcom,sm8550-dwc3", "qcom,dwc3"; + reg = <0x0 0x0a6f8800 0x0 0x400>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + clocks = <&gcc GCC_CFG_NOC_USB3_PRIM_AXI_CLK>, + <&gcc GCC_USB30_PRIM_MASTER_CLK>, + <&gcc GCC_AGGRE_USB3_PRIM_AXI_CLK>, + <&gcc GCC_USB30_PRIM_SLEEP_CLK>, + <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>, + <&rpmhcc TCSR_USB3_CLKREF_EN>; + clock-names = "cfg_noc", + "core", + "iface", + "sleep", + "mock_utmi", + "xo"; + + assigned-clocks = <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>, + <&gcc GCC_USB30_PRIM_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + + interrupts-extended = <&intc GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 17 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 15 IRQ_TYPE_EDGE_RISING>, + <&pdc 14 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "hs_phy_irq", + "ss_phy_irq", + "dm_hs_phy_irq", + "dp_hs_phy_irq"; + + power-domains = <&gcc USB30_PRIM_GDSC>; + required-opps = <&rpmhpd_opp_nom>; + + resets = <&gcc GCC_USB30_PRIM_BCR>; + + status = "disabled"; + + usb_1_dwc3: usb@a600000 { + compatible = "snps,dwc3"; + reg = <0x0 0x0a600000 0x0 0xcd00>; + interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; + iommus = <&apps_smmu 0x40 0x0>; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; + snps,usb3_lpm_capable; + phys = <&usb_1_hsphy>, + <&usb_dp_qmpphy QMP_USB43DP_USB3_PHY>; + phy-names = "usb2-phy", "usb3-phy"; + }; + }; + pdc: interrupt-controller@b220000 { compatible = "qcom,sm8550-pdc", "qcom,pdc"; reg = <0 0x0b220000 0 0x30000>, <0 0x174000f0 0 0x64>;
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 7/8] arm64: dts: qcom: sm8550: Add USB PHYs and controller nodes
Quoted 4 lines · Abel Vesa
Add USB host controller and PHY nodes.
Signed-off-by Abel Vesa <[email protected]>---
(...)
Quoted 25 lines
arch/arm64/boot/dts/qcom/sm8550.dtsi +25
-0+ usb_1: usb@a6f8800 { + compatible = "qcom,sm8550-dwc3", "qcom,dwc3"; + reg = <0x0 0x0a6f8800 0x0 0x400>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + clocks = <&gcc GCC_CFG_NOC_USB3_PRIM_AXI_CLK>, + <&gcc GCC_USB30_PRIM_MASTER_CLK>, + <&gcc GCC_AGGRE_USB3_PRIM_AXI_CLK>, + <&gcc GCC_USB30_PRIM_SLEEP_CLK>, + <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>, + <&rpmhcc TCSR_USB3_CLKREF_EN>; + clock-names = "cfg_noc", + "core", + "iface", + "sleep", + "mock_utmi", + "xo"; + + assigned-clocks = <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>, + <&gcc GCC_USB30_PRIM_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + + interrupts-extended = <&intc GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>,
arch/arm64/boot/dts/qcom/sm8550.dtsi opp-202000000 { · line 1997
Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8550.dtsi +10
-0+ <&pdc 17 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 15 IRQ_TYPE_EDGE_RISING>, + <&pdc 14 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "hs_phy_irq", + "ss_phy_irq", + "dm_hs_phy_irq", + "dp_hs_phy_irq"; + + power-domains = <&gcc USB30_PRIM_GDSC>; + required-opps = <&rpmhpd_opp_nom>;
This is not accepted, so far. Can we drop it?
Or revive:
https://lore.kernel.org/all/YXcBK7zqny0s4gd4@ripper/
Best regards,
Krzysztof
PATCH v3 8/8 arm64: dts: qcom: sm8550-mtp: Add USB PHYs and HC nodes
In reply to Abel VesaEnable USB HC and PHYs nodes on SM8550 MTP board.
---
Changes since v2:
* none
NOTE: This patch has been already merged. It is here only to provide context for the rest of the patchset. There is a change with respect to the clocks, but that will be sent as a separate/individual fix patch.
arch/arm64/boot/dts/qcom/sm8550-mtp.dts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/qcom/sm8550-mtp.dts +22 -0
@@ -455,6 +455,28 @@ &ufs_mem_phy { status = "okay"; }; +&usb_1 { + status = "okay"; +}; + +&usb_1_dwc3 { + dr_mode = "peripheral"; +}; + +&usb_1_hsphy { + vdd-supply = <&vreg_l1e_0p88>; + vdda12-supply = <&vreg_l3e_1p2>; + + status = "okay"; +}; + +&usb_dp_qmpphy { + vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-pll-supply = <&vreg_l3f_0p91>; + + status = "okay"; +}; + &xo_board { clock-frequency = <76800000>; };
Signature · 7 lines
2.34.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy