Commit 27182be9 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'phy-for-5.16' of...

Merge tag 'phy-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy into char-misc-next

Vinod writes:

phy-for-5.16

  - New support:
	- Kirin 970 PCIe PHY driver
	- Qualcomm QCM2290 USB2 and USB3 support

  - Updates:
        - Qualcomm synopsis phy driver updates
	- sc8180x PCIe update
	- cadence-torrent driver updates for output reference clock
	- stm32 phy tuning support

* tag 'phy-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (28 commits)
  phy: Sparx5 Eth SerDes: Fix return value check in sparx5_serdes_probe()
  phy: qcom-snps: Correct the FSEL_MASK
  phy: hisilicon: Add of_node_put() in phy-hisi-inno-usb2
  phy: qcom-qmp: another fix for the sc8180x PCIe definition
  phy: cadence-torrent: Add support to output received reference clock
  phy: cadence-torrent: Model reference clock driver as a clock to enable derived refclk
  dt-bindings: phy: cadence-torrent: Add clock IDs for derived and received refclk
  phy: cadence-torrent: Migrate to clk_hw based registration and OF APIs
  phy: ti: gmii-sel: check of_get_address() for failure
  dt-bindings: phy: qcom,qmp: IPQ6018 and IPQ8074 PCIe PHY require no supply
  phy: stm32: add phy tuning support
  dt-bindings: phy: phy-stm32-usbphyc: add optional phy tuning properties
  phy: stm32: restore utmi switch on resume
  dt-bindings: phy: rockchip: remove usb-phy fallback string for rk3066a/rk3188
  phy: qcom-qusb2: Fix a memory leak on probe
  phy: qcom-qmp: Add QCM2290 USB3 PHY support
  dt-bindings: phy: qcom,qmp: Add QCM2290 USB3 PHY
  phy: qcom-qusb2: Add missing vdd supply
  dt-bindings: phy: qcom,qusb2: Add missing vdd-supply
  phy: rockchip-inno-usb2: Make use of the helper function devm_add_action_or_reset()
  ...
parents db788e6b b4dc97ab
...@@ -18,13 +18,21 @@ properties: ...@@ -18,13 +18,21 @@ properties:
const: brcm,ns-usb2-phy const: brcm,ns-usb2-phy
reg: reg:
items: anyOf:
- description: iomem address range of DMU (Device Management Unit) - maxItems: 1
description: PHY control register
- maxItems: 1
description: iomem address range of DMU (Device Management Unit)
deprecated: true
reg-names: reg-names:
items: items:
- const: dmu - const: dmu
brcm,syscon-clkset:
description: phandle to syscon for clkset register
$ref: /schemas/types.yaml#/definitions/phandle
clocks: clocks:
items: items:
- description: USB PHY reference clock - description: USB PHY reference clock
...@@ -39,20 +47,25 @@ properties: ...@@ -39,20 +47,25 @@ properties:
required: required:
- compatible - compatible
- reg - reg
- reg-names
- clocks - clocks
- clock-names - clock-names
- "#phy-cells" - "#phy-cells"
oneOf:
- required:
- brcm,syscon-clkset
- required:
- reg-names
additionalProperties: false additionalProperties: false
examples: examples:
- | - |
#include <dt-bindings/clock/bcm-nsp.h> #include <dt-bindings/clock/bcm-nsp.h>
phy@1800c000 { phy@1800c164 {
compatible = "brcm,ns-usb2-phy"; compatible = "brcm,ns-usb2-phy";
reg = <0x1800c000 0x1000>; reg = <0x1800c164 0x4>;
reg-names = "dmu"; brcm,syscon-clkset = <&clkset>;
clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
clock-names = "phy-ref-clk"; clock-names = "phy-ref-clk";
#phy-cells = <0>; #phy-cells = <0>;
......
...@@ -81,6 +81,119 @@ patternProperties: ...@@ -81,6 +81,119 @@ patternProperties:
properties: properties:
vbus-supply: true vbus-supply: true
# It can be necessary to adjust the PHY settings to compensate parasitics, which can be due
# to USB connector/receptacle, routing, ESD protection component,... Here is the list of
# all optional parameters to tune the interface of the PHY (HS for High-Speed, FS for Full-
# Speed, LS for Low-Speed)
st,current-boost-microamp:
description: Current boosting in uA
enum: [ 1000, 2000 ]
st,no-lsfs-fb-cap:
description: Disables the LS/FS feedback capacitor
type: boolean
st,decrease-hs-slew-rate:
description: Decreases the HS driver slew rate by 10%
type: boolean
st,tune-hs-dc-level:
description: |
Tunes the HS driver DC level
- <0> normal level
- <1> increases the level by 5 to 7 mV
- <2> increases the level by 10 to 14 mV
- <3> decreases the level by 5 to 7 mV
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 0
st,enable-fs-rftime-tuning:
description: Enables the FS rise/fall tuning option
type: boolean
st,enable-hs-rftime-reduction:
description: Enables the HS rise/fall reduction feature
type: boolean
st,trim-hs-current:
description: |
Controls HS driver current trimming for choke compensation
- <0> = 18.87 mA target current / nominal + 0%
- <1> = 19.165 mA target current / nominal + 1.56%
- <2> = 19.46 mA target current / nominal + 3.12%
- <3> = 19.755 mA target current / nominal + 4.68%
- <4> = 20.05 mA target current / nominal + 6.24%
- <5> = 20.345 mA target current / nominal + 7.8%
- <6> = 20.64 mA target current / nominal + 9.36%
- <7> = 20.935 mA target current / nominal + 10.92%
- <8> = 21.23 mA target current / nominal + 12.48%
- <9> = 21.525 mA target current / nominal + 14.04%
- <10> = 21.82 mA target current / nominal + 15.6%
- <11> = 22.115 mA target current / nominal + 17.16%
- <12> = 22.458 mA target current / nominal + 19.01%
- <13> = 22.755 mA target current / nominal + 20.58%
- <14> = 23.052 mA target current / nominal + 22.16%
- <15> = 23.348 mA target current / nominal + 23.73%
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 15
default: 0
st,trim-hs-impedance:
description: |
Controls HS driver impedance tuning for choke compensation
- <0> = no impedance offset
- <1> = reduce the impedance by 2 ohms
- <2> = reduce the impedance by 4 ohms
- <3> = reduce the impedance by 6 ohms
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 0
st,tune-squelch-level:
description: |
Tunes the squelch DC threshold value
- <0> = no shift in threshold
- <1> = threshold shift by +7 mV
- <2> = threshold shift by -5 mV
- <3> = threshold shift by +14 mV
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 0
st,enable-hs-rx-gain-eq:
description: Enables the HS Rx gain equalizer
type: boolean
st,tune-hs-rx-offset:
description: |
Adjusts the HS Rx offset
- <0> = no offset
- <1> = offset of +5 mV
- <2> = offset of +10 mV
- <3> = offset of -5 mV
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 0
st,no-hs-ftime-ctrl:
description: Disables the HS fall time control of single ended signals during pre-emphasis
type: boolean
st,no-lsfs-sc:
description: Disables the short circuit protection in LS/FS driver
type: boolean
st,enable-hs-tx-staggering:
description: Enables the basic staggering in HS Tx mode
type: boolean
allOf: allOf:
- if: - if:
properties: properties:
...@@ -137,6 +250,14 @@ examples: ...@@ -137,6 +250,14 @@ examples:
reg = <0>; reg = <0>;
phy-supply = <&vdd_usb>; phy-supply = <&vdd_usb>;
#phy-cells = <0>; #phy-cells = <0>;
st,tune-hs-dc-level = <2>;
st,enable-fs-rftime-tuning;
st,enable-hs-rftime-reduction;
st,trim-hs-current = <15>;
st,trim-hs-impedance = <1>;
st,tune-squelch-level = <3>;
st,tune-hs-rx-offset = <2>;
st,no-lsfs-sc;
connector { connector {
compatible = "usb-a-connector"; compatible = "usb-a-connector";
vbus-supply = <&vbus_sw>; vbus-supply = <&vbus_sw>;
...@@ -147,6 +268,14 @@ examples: ...@@ -147,6 +268,14 @@ examples:
reg = <1>; reg = <1>;
phy-supply = <&vdd_usb>; phy-supply = <&vdd_usb>;
#phy-cells = <1>; #phy-cells = <1>;
st,tune-hs-dc-level = <2>;
st,enable-fs-rftime-tuning;
st,enable-hs-rftime-reduction;
st,trim-hs-current = <15>;
st,trim-hs-impedance = <1>;
st,tune-squelch-level = <3>;
st,tune-hs-rx-offset = <2>;
st,no-lsfs-sc;
}; };
}; };
... ...
...@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#" ...@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
title: Qualcomm QMP PHY controller title: Qualcomm QMP PHY controller
maintainers: maintainers:
- Manu Gautam <mgautam@codeaurora.org> - Vinod Koul <vkoul@kernel.org>
description: description:
QMP phy controller supports physical layer functionality for a number of QMP phy controller supports physical layer functionality for a number of
...@@ -27,6 +27,7 @@ properties: ...@@ -27,6 +27,7 @@ properties:
- qcom,msm8998-qmp-pcie-phy - qcom,msm8998-qmp-pcie-phy
- qcom,msm8998-qmp-ufs-phy - qcom,msm8998-qmp-ufs-phy
- qcom,msm8998-qmp-usb3-phy - qcom,msm8998-qmp-usb3-phy
- qcom,qcm2290-qmp-usb3-phy
- qcom,sc7180-qmp-usb3-phy - qcom,sc7180-qmp-usb3-phy
- qcom,sc8180x-qmp-pcie-phy - qcom,sc8180x-qmp-pcie-phy
- qcom,sc8180x-qmp-ufs-phy - qcom,sc8180x-qmp-ufs-phy
...@@ -116,8 +117,6 @@ required: ...@@ -116,8 +117,6 @@ required:
- clock-names - clock-names
- resets - resets
- reset-names - reset-names
- vdda-phy-supply
- vdda-pll-supply
additionalProperties: false additionalProperties: false
...@@ -150,6 +149,9 @@ allOf: ...@@ -150,6 +149,9 @@ allOf:
items: items:
- const: phy - const: phy
- const: common - const: common
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -176,6 +178,9 @@ allOf: ...@@ -176,6 +178,9 @@ allOf:
items: items:
- const: phy - const: phy
- const: common - const: common
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -204,6 +209,9 @@ allOf: ...@@ -204,6 +209,9 @@ allOf:
- const: phy - const: phy
- const: common - const: common
- const: cfg - const: cfg
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -233,6 +241,9 @@ allOf: ...@@ -233,6 +241,9 @@ allOf:
items: items:
- const: phy - const: phy
- const: common - const: common
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -253,6 +264,9 @@ allOf: ...@@ -253,6 +264,9 @@ allOf:
reset-names: reset-names:
items: items:
- const: ufsphy - const: ufsphy
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -278,34 +292,16 @@ allOf: ...@@ -278,34 +292,16 @@ allOf:
reset-names: reset-names:
items: items:
- const: ufsphy - const: ufsphy
- if: required:
properties: - vdda-phy-supply
compatible: - vdda-pll-supply
contains:
enum:
- qcom,ipq8074-qmp-pcie-phy
then:
properties:
clocks:
items:
- description: pipe clk.
clock-names:
items:
- const: pipe_clk
resets:
items:
- description: reset of phy block.
- description: phy common block reset.
reset-names:
items:
- const: phy
- const: common
- if: - if:
properties: properties:
compatible: compatible:
contains: contains:
enum: enum:
- qcom,ipq6018-qmp-pcie-phy - qcom,ipq6018-qmp-pcie-phy
- qcom,ipq8074-qmp-pcie-phy
then: then:
properties: properties:
clocks: clocks:
...@@ -356,6 +352,9 @@ allOf: ...@@ -356,6 +352,9 @@ allOf:
reset-names: reset-names:
items: items:
- const: phy - const: phy
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -387,6 +386,9 @@ allOf: ...@@ -387,6 +386,9 @@ allOf:
items: items:
- const: phy - const: phy
- const: common - const: common
required:
- vdda-phy-supply
- vdda-pll-supply
- if: - if:
properties: properties:
compatible: compatible:
...@@ -414,6 +416,38 @@ allOf: ...@@ -414,6 +416,38 @@ allOf:
items: items:
- const: phy - const: phy
- const: common - const: common
required:
- vdda-phy-supply
- vdda-pll-supply
- if:
properties:
compatible:
contains:
enum:
- qcom,qcm2290-qmp-usb3-phy
then:
properties:
clocks:
items:
- description: Phy config clock.
- description: 19.2 MHz ref clk.
- description: Phy common block aux clock.
clock-names:
items:
- const: cfg_ahb
- const: ref
- const: com_aux
resets:
items:
- description: phy_phy reset.
- description: reset of phy block.
reset-names:
items:
- const: phy_phy
- const: phy
required:
- vdda-phy-supply
- vdda-pll-supply
examples: examples:
- | - |
......
...@@ -21,6 +21,7 @@ properties: ...@@ -21,6 +21,7 @@ properties:
- qcom,ipq8074-qusb2-phy - qcom,ipq8074-qusb2-phy
- qcom,msm8996-qusb2-phy - qcom,msm8996-qusb2-phy
- qcom,msm8998-qusb2-phy - qcom,msm8998-qusb2-phy
- qcom,qcm2290-qusb2-phy
- qcom,sdm660-qusb2-phy - qcom,sdm660-qusb2-phy
- qcom,ipq6018-qusb2-phy - qcom,ipq6018-qusb2-phy
- qcom,sm4250-qusb2-phy - qcom,sm4250-qusb2-phy
...@@ -50,6 +51,10 @@ properties: ...@@ -50,6 +51,10 @@ properties:
- const: ref - const: ref
- const: iface - const: iface
vdd-supply:
description:
Phandle to 0.9V regulator supply to PHY digital circuit.
vdda-pll-supply: vdda-pll-supply:
description: description:
Phandle to 1.8V regulator supply to PHY refclk pll block. Phandle to 1.8V regulator supply to PHY refclk pll block.
...@@ -156,6 +161,7 @@ required: ...@@ -156,6 +161,7 @@ required:
- "#phy-cells" - "#phy-cells"
- clocks - clocks
- clock-names - clock-names
- vdd-supply
- vdda-pll-supply - vdda-pll-supply
- vdda-phy-dpdm-supply - vdda-phy-dpdm-supply
- resets - resets
...@@ -174,6 +180,7 @@ examples: ...@@ -174,6 +180,7 @@ examples:
<&gcc GCC_RX1_USB2_CLKREF_CLK>; <&gcc GCC_RX1_USB2_CLKREF_CLK>;
clock-names = "cfg_ahb", "ref"; clock-names = "cfg_ahb", "ref";
vdd-supply = <&pm8994_l28>;
vdda-pll-supply = <&pm8994_l12>; vdda-pll-supply = <&pm8994_l12>;
vdda-phy-dpdm-supply = <&pm8994_l24>; vdda-phy-dpdm-supply = <&pm8994_l24>;
......
...@@ -11,13 +11,10 @@ maintainers: ...@@ -11,13 +11,10 @@ maintainers:
properties: properties:
compatible: compatible:
oneOf: enum:
- const: rockchip,rk3288-usb-phy
- items:
- enum:
- rockchip,rk3066a-usb-phy - rockchip,rk3066a-usb-phy
- rockchip,rk3188-usb-phy - rockchip,rk3188-usb-phy
- const: rockchip,rk3288-usb-phy - rockchip,rk3288-usb-phy
"#address-cells": "#address-cells":
const: 1 const: 1
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# #
# Phy drivers for Broadcom platforms # Phy drivers for Broadcom platforms
# #
menu "PHY drivers for Broadcom platforms"
config PHY_BCM63XX_USBH config PHY_BCM63XX_USBH
tristate "BCM63xx USBH PHY driver" tristate "BCM63xx USBH PHY driver"
depends on BMIPS_GENERIC || COMPILE_TEST depends on BMIPS_GENERIC || COMPILE_TEST
...@@ -112,3 +114,5 @@ config PHY_BCM_SR_PCIE ...@@ -112,3 +114,5 @@ config PHY_BCM_SR_PCIE
help help
Enable this to support the Broadcom Stingray PCIe PHY Enable this to support the Broadcom Stingray PCIe PHY
If unsure, say N. If unsure, say N.
endmenu
This diff is collapsed.
...@@ -33,6 +33,16 @@ config PHY_HI3670_USB ...@@ -33,6 +33,16 @@ config PHY_HI3670_USB
To compile this driver as a module, choose M here. To compile this driver as a module, choose M here.
config PHY_HI3670_PCIE
tristate "hi3670 PCIe PHY support"
depends on (ARCH_HISI && ARM64) || COMPILE_TEST
select GENERIC_PHY
select MFD_SYSCON
help
Enable this to support the HiSilicon hi3670 PCIe PHY.
To compile this driver as a module, choose M here.
config PHY_HISTB_COMBPHY config PHY_HISTB_COMBPHY
tristate "HiSilicon STB SoCs COMBPHY support" tristate "HiSilicon STB SoCs COMBPHY support"
depends on (ARCH_HISI && ARM64) || COMPILE_TEST depends on (ARCH_HISI && ARM64) || COMPILE_TEST
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
obj-$(CONFIG_PHY_HI6220_USB) += phy-hi6220-usb.o obj-$(CONFIG_PHY_HI6220_USB) += phy-hi6220-usb.o
obj-$(CONFIG_PHY_HI3660_USB) += phy-hi3660-usb3.o obj-$(CONFIG_PHY_HI3660_USB) += phy-hi3660-usb3.o
obj-$(CONFIG_PHY_HI3670_USB) += phy-hi3670-usb3.o obj-$(CONFIG_PHY_HI3670_USB) += phy-hi3670-usb3.o
obj-$(CONFIG_PHY_HI3670_PCIE) += phy-hi3670-pcie.o
obj-$(CONFIG_PHY_HISTB_COMBPHY) += phy-histb-combphy.o obj-$(CONFIG_PHY_HISTB_COMBPHY) += phy-histb-combphy.o
obj-$(CONFIG_PHY_HISI_INNO_USB2) += phy-hisi-inno-usb2.o obj-$(CONFIG_PHY_HISI_INNO_USB2) += phy-hisi-inno-usb2.o
obj-$(CONFIG_PHY_HIX5HD2_SATA) += phy-hix5hd2-sata.o obj-$(CONFIG_PHY_HIX5HD2_SATA) += phy-hix5hd2-sata.o
This diff is collapsed.
...@@ -140,14 +140,19 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) ...@@ -140,14 +140,19 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
struct phy *phy; struct phy *phy;
rst = of_reset_control_get_exclusive(child, NULL); rst = of_reset_control_get_exclusive(child, NULL);
if (IS_ERR(rst)) if (IS_ERR(rst)) {
of_node_put(child);
return PTR_ERR(rst); return PTR_ERR(rst);
}
priv->ports[i].utmi_rst = rst; priv->ports[i].utmi_rst = rst;
priv->ports[i].priv = priv; priv->ports[i].priv = priv;
phy = devm_phy_create(dev, child, &hisi_inno_phy_ops); phy = devm_phy_create(dev, child, &hisi_inno_phy_ops);
if (IS_ERR(phy)) if (IS_ERR(phy)) {
of_node_put(child);
return PTR_ERR(phy); return PTR_ERR(phy);
}
phy_set_bus_width(phy, 8); phy_set_bus_width(phy, 8);
phy_set_drvdata(phy, &priv->ports[i]); phy_set_drvdata(phy, &priv->ports[i]);
...@@ -155,6 +160,7 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) ...@@ -155,6 +160,7 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
if (i > INNO_PHY_PORT_NUM) { if (i > INNO_PHY_PORT_NUM) {
dev_warn(dev, "Support %d ports in maximum\n", i); dev_warn(dev, "Support %d ports in maximum\n", i);
of_node_put(child);
break; break;
} }
} }
......
...@@ -2475,10 +2475,10 @@ static int sparx5_serdes_probe(struct platform_device *pdev) ...@@ -2475,10 +2475,10 @@ static int sparx5_serdes_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores)); iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores));
if (IS_ERR(iomem)) { if (!iomem) {
dev_err(priv->dev, "Unable to get serdes registers: %s\n", dev_err(priv->dev, "Unable to get serdes registers: %s\n",
iores->name); iores->name);
return PTR_ERR(iomem); return -ENOMEM;
} }
for (idx = 0; idx < ARRAY_SIZE(sparx5_serdes_iomap); idx++) { for (idx = 0; idx < ARRAY_SIZE(sparx5_serdes_iomap); idx++) {
struct sparx5_serdes_io_resource *iomap = &sparx5_serdes_iomap[idx]; struct sparx5_serdes_io_resource *iomap = &sparx5_serdes_iomap[idx];
......
...@@ -135,6 +135,8 @@ enum qphy_reg_layout { ...@@ -135,6 +135,8 @@ enum qphy_reg_layout {
QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR, QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR,
QPHY_PCS_LFPS_RXTERM_IRQ_STATUS, QPHY_PCS_LFPS_RXTERM_IRQ_STATUS,
QPHY_PCS_POWER_DOWN_CONTROL, QPHY_PCS_POWER_DOWN_CONTROL,
/* PCS_MISC registers */
QPHY_PCS_MISC_TYPEC_CTRL,
/* Keep last to ensure regs_layout arrays are properly initialized */ /* Keep last to ensure regs_layout arrays are properly initialized */
QPHY_LAYOUT_SIZE QPHY_LAYOUT_SIZE
}; };
...@@ -229,6 +231,16 @@ static const unsigned int sm8350_usb3_uniphy_regs_layout[QPHY_LAYOUT_SIZE] = { ...@@ -229,6 +231,16 @@ static const unsigned int sm8350_usb3_uniphy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x1014, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0x1014,
}; };
static const unsigned int qcm2290_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = 0x00,
[QPHY_PCS_POWER_DOWN_CONTROL] = 0x04,
[QPHY_START_CTRL] = 0x08,
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = 0xd8,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = 0xdc,
[QPHY_PCS_STATUS] = 0x174,
[QPHY_PCS_MISC_TYPEC_CTRL] = 0x00,
};
static const unsigned int sdm845_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = { static const unsigned int sdm845_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_START_CTRL] = 0x00, [QPHY_START_CTRL] = 0x00,
[QPHY_PCS_READY_STATUS] = 0x160, [QPHY_PCS_READY_STATUS] = 0x160,
...@@ -2761,6 +2773,99 @@ static const struct qmp_phy_init_tbl sm8350_usb3_uniphy_pcs_tbl[] = { ...@@ -2761,6 +2773,99 @@ static const struct qmp_phy_init_tbl sm8350_usb3_uniphy_pcs_tbl[] = {
QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21),
}; };
static const struct qmp_phy_init_tbl qcm2290_usb3_serdes_tbl[] = {
QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x14),
QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x08),
QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x30),
QMP_PHY_INIT_CFG(QSERDES_COM_SYS_CLK_CTRL, 0x06),
QMP_PHY_INIT_CFG(QSERDES_COM_RESETSM_CNTRL, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_RESETSM_CNTRL2, 0x08),
QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0x0f),
QMP_PHY_INIT_CFG(QSERDES_COM_SVS_MODE_CLK_SEL, 0x01),
QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x82),
QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x55),
QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x55),
QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x03),
QMP_PHY_INIT_CFG(QSERDES_COM_CP_CTRL_MODE0, 0x0b),
QMP_PHY_INIT_CFG(QSERDES_COM_PLL_RCTRL_MODE0, 0x16),
QMP_PHY_INIT_CFG(QSERDES_COM_PLL_CCTRL_MODE0, 0x28),
QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_CORECLK_DIV, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0x15),
QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0x34),
QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_CORE_CLK_EN, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_CFG, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x01),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x01),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER1, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER2, 0x00),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0xde),
QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x07),
QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0x0f),
QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x06),
QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_INITVAL, 0x80),
QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x01),
};
static const struct qmp_phy_init_tbl qcm2290_usb3_tx_tbl[] = {
QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10),
QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12),
QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0xc6),
QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_RX, 0x00),
};
static const struct qmp_phy_init_tbl qcm2290_usb3_rx_tbl[] = {
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FO_GAIN, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN, 0x06),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x75),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x02),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4e),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x18),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_VGA_CAL_CNTRL2, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x16),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_ENABLES, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_MODE_00, 0x00),
};
static const struct qmp_phy_init_tbl qcm2290_usb3_pcs_tbl[] = {
QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V0, 0x9f),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V0, 0x17),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V0, 0x0f),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL2, 0x83),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL1, 0x02),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_L, 0x09),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_H_TOL, 0xa2),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_MAN_CODE, 0x85),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG1, 0xd1),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG2, 0x1f),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG3, 0x47),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_WAIT_TIME, 0x75),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_LFPS_TX_ECSTART_EQTLOCK, 0x86),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x04),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_TSYNC_RSYNC_TIME, 0x44),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_P1U2_L, 0xe7),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_U3_L, 0x40),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_U3_H, 0x00),
QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0x88),
};
struct qmp_phy; struct qmp_phy;
/* struct qmp_phy_cfg - per-PHY initialization config */ /* struct qmp_phy_cfg - per-PHY initialization config */
...@@ -2995,6 +3100,10 @@ static const char * const qmp_v4_sdx55_usbphy_clk_l[] = { ...@@ -2995,6 +3100,10 @@ static const char * const qmp_v4_sdx55_usbphy_clk_l[] = {
"aux", "cfg_ahb", "ref" "aux", "cfg_ahb", "ref"
}; };
static const char * const qcm2290_usb3phy_clk_l[] = {
"cfg_ahb", "ref", "com_aux",
};
/* list of resets */ /* list of resets */
static const char * const msm8996_pciephy_reset_l[] = { static const char * const msm8996_pciephy_reset_l[] = {
"phy", "common", "cfg", "phy", "common", "cfg",
...@@ -3008,6 +3117,10 @@ static const char * const sc7180_usb3phy_reset_l[] = { ...@@ -3008,6 +3117,10 @@ static const char * const sc7180_usb3phy_reset_l[] = {
"phy", "phy",
}; };
static const char * const qcm2290_usb3phy_reset_l[] = {
"phy_phy", "phy",
};
static const char * const sdm845_pciephy_reset_l[] = { static const char * const sdm845_pciephy_reset_l[] = {
"phy", "phy",
}; };
...@@ -3632,7 +3745,7 @@ static const struct qmp_phy_cfg sc8180x_pciephy_cfg = { ...@@ -3632,7 +3745,7 @@ static const struct qmp_phy_cfg sc8180x_pciephy_cfg = {
.nlanes = 1, .nlanes = 1,
.serdes_tbl = sc8180x_qmp_pcie_serdes_tbl, .serdes_tbl = sc8180x_qmp_pcie_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(sc8180x_qmp_pcie_serdes_tbl),
.tx_tbl = sc8180x_qmp_pcie_tx_tbl, .tx_tbl = sc8180x_qmp_pcie_tx_tbl,
.tx_tbl_num = ARRAY_SIZE(sc8180x_qmp_pcie_tx_tbl), .tx_tbl_num = ARRAY_SIZE(sc8180x_qmp_pcie_tx_tbl),
.rx_tbl = sc8180x_qmp_pcie_rx_tbl, .rx_tbl = sc8180x_qmp_pcie_rx_tbl,
...@@ -3974,6 +4087,33 @@ static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = { ...@@ -3974,6 +4087,33 @@ static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = {
.pwrdn_delay_max = POWER_DOWN_DELAY_US_MAX, .pwrdn_delay_max = POWER_DOWN_DELAY_US_MAX,
}; };
static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = {
.type = PHY_TYPE_USB3,
.nlanes = 1,
.serdes_tbl = qcm2290_usb3_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(qcm2290_usb3_serdes_tbl),
.tx_tbl = qcm2290_usb3_tx_tbl,
.tx_tbl_num = ARRAY_SIZE(qcm2290_usb3_tx_tbl),
.rx_tbl = qcm2290_usb3_rx_tbl,
.rx_tbl_num = ARRAY_SIZE(qcm2290_usb3_rx_tbl),
.pcs_tbl = qcm2290_usb3_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(qcm2290_usb3_pcs_tbl),
.clk_list = qcm2290_usb3phy_clk_l,
.num_clks = ARRAY_SIZE(qcm2290_usb3phy_clk_l),
.reset_list = qcm2290_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(qcm2290_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qcm2290_usb3phy_regs_layout,
.start_ctrl = SERDES_START | PCS_START,
.pwrdn_ctrl = SW_PWRDN,
.phy_status = PHYSTATUS,
.is_dual_lane_phy = true,
};
static void qcom_qmp_phy_configure_lane(void __iomem *base, static void qcom_qmp_phy_configure_lane(void __iomem *base,
const unsigned int *regs, const unsigned int *regs,
const struct qmp_phy_init_tbl tbl[], const struct qmp_phy_init_tbl tbl[],
...@@ -5154,11 +5294,7 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np) ...@@ -5154,11 +5294,7 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np)
* Roll a devm action because the clock provider is the child node, but * Roll a devm action because the clock provider is the child node, but
* the child node is not actually a device. * the child node is not actually a device.
*/ */
ret = devm_add_action(qmp->dev, phy_clk_release_provider, np); return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np);
if (ret)
phy_clk_release_provider(np);
return ret;
} }
/* /*
...@@ -5350,11 +5486,7 @@ static int phy_dp_clks_register(struct qcom_qmp *qmp, struct qmp_phy *qphy, ...@@ -5350,11 +5486,7 @@ static int phy_dp_clks_register(struct qcom_qmp *qmp, struct qmp_phy *qphy,
* Roll a devm action because the clock provider is the child node, but * Roll a devm action because the clock provider is the child node, but
* the child node is not actually a device. * the child node is not actually a device.
*/ */
ret = devm_add_action(qmp->dev, phy_clk_release_provider, np); return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np);
if (ret)
phy_clk_release_provider(np);
return ret;
} }
static const struct phy_ops qcom_qmp_phy_gen_ops = { static const struct phy_ops qcom_qmp_phy_gen_ops = {
...@@ -5613,6 +5745,9 @@ static const struct of_device_id qcom_qmp_phy_of_match_table[] = { ...@@ -5613,6 +5745,9 @@ static const struct of_device_id qcom_qmp_phy_of_match_table[] = {
}, { }, {
.compatible = "qcom,sm8350-qmp-usb3-uni-phy", .compatible = "qcom,sm8350-qmp-usb3-uni-phy",
.data = &sm8350_usb3_uniphy_cfg, .data = &sm8350_usb3_uniphy_cfg,
}, {
.compatible = "qcom,qcm2290-qmp-usb3-phy",
.data = &qcm2290_usb3phy_cfg,
}, },
{ }, { },
}; };
......
...@@ -169,6 +169,7 @@ ...@@ -169,6 +169,7 @@
#define QSERDES_COM_BIAS_EN_CTRL_BY_PSM 0x0a8 #define QSERDES_COM_BIAS_EN_CTRL_BY_PSM 0x0a8
#define QSERDES_COM_SYSCLK_EN_SEL 0x0ac #define QSERDES_COM_SYSCLK_EN_SEL 0x0ac
#define QSERDES_COM_RESETSM_CNTRL 0x0b4 #define QSERDES_COM_RESETSM_CNTRL 0x0b4
#define QSERDES_COM_RESETSM_CNTRL2 0x0b8
#define QSERDES_COM_RESTRIM_CTRL 0x0bc #define QSERDES_COM_RESTRIM_CTRL 0x0bc
#define QSERDES_COM_RESCODE_DIV_NUM 0x0c4 #define QSERDES_COM_RESCODE_DIV_NUM 0x0c4
#define QSERDES_COM_LOCK_CMP_EN 0x0c8 #define QSERDES_COM_LOCK_CMP_EN 0x0c8
...@@ -181,6 +182,7 @@ ...@@ -181,6 +182,7 @@
#define QSERDES_COM_DIV_FRAC_START1_MODE1 0x0e8 #define QSERDES_COM_DIV_FRAC_START1_MODE1 0x0e8
#define QSERDES_COM_DIV_FRAC_START2_MODE1 0x0ec #define QSERDES_COM_DIV_FRAC_START2_MODE1 0x0ec
#define QSERDES_COM_DIV_FRAC_START3_MODE1 0x0f0 #define QSERDES_COM_DIV_FRAC_START3_MODE1 0x0f0
#define QSERDES_COM_INTEGLOOP_INITVAL 0x100
#define QSERDES_COM_INTEGLOOP_GAIN0_MODE0 0x108 #define QSERDES_COM_INTEGLOOP_GAIN0_MODE0 0x108
#define QSERDES_COM_INTEGLOOP_GAIN1_MODE0 0x10c #define QSERDES_COM_INTEGLOOP_GAIN1_MODE0 0x10c
#define QSERDES_COM_INTEGLOOP_GAIN0_MODE1 0x110 #define QSERDES_COM_INTEGLOOP_GAIN0_MODE1 0x110
......
...@@ -371,7 +371,7 @@ static const struct qusb2_phy_cfg sm6115_phy_cfg = { ...@@ -371,7 +371,7 @@ static const struct qusb2_phy_cfg sm6115_phy_cfg = {
}; };
static const char * const qusb2_phy_vreg_names[] = { static const char * const qusb2_phy_vreg_names[] = {
"vdda-pll", "vdda-phy-dpdm", "vdd", "vdda-pll", "vdda-phy-dpdm",
}; };
#define QUSB2_NUM_VREGS ARRAY_SIZE(qusb2_phy_vreg_names) #define QUSB2_NUM_VREGS ARRAY_SIZE(qusb2_phy_vreg_names)
...@@ -561,7 +561,7 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) ...@@ -561,7 +561,7 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)
{ {
struct device *dev = &qphy->phy->dev; struct device *dev = &qphy->phy->dev;
const struct qusb2_phy_cfg *cfg = qphy->cfg; const struct qusb2_phy_cfg *cfg = qphy->cfg;
u8 *val; u8 *val, hstx_trim;
/* efuse register is optional */ /* efuse register is optional */
if (!qphy->cell) if (!qphy->cell)
...@@ -575,7 +575,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) ...@@ -575,7 +575,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)
* set while configuring the phy. * set while configuring the phy.
*/ */
val = nvmem_cell_read(qphy->cell, NULL); val = nvmem_cell_read(qphy->cell, NULL);
if (IS_ERR(val) || !val[0]) { if (IS_ERR(val)) {
dev_dbg(dev, "failed to read a valid hs-tx trim value\n");
return;
}
hstx_trim = val[0];
kfree(val);
if (!hstx_trim) {
dev_dbg(dev, "failed to read a valid hs-tx trim value\n"); dev_dbg(dev, "failed to read a valid hs-tx trim value\n");
return; return;
} }
...@@ -583,12 +589,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) ...@@ -583,12 +589,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy)
/* Fused TUNE1/2 value is the higher nibble only */ /* Fused TUNE1/2 value is the higher nibble only */
if (cfg->update_tune1_with_efuse) if (cfg->update_tune1_with_efuse)
qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1], qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
val[0] << HSTX_TRIM_SHIFT, hstx_trim << HSTX_TRIM_SHIFT, HSTX_TRIM_MASK);
HSTX_TRIM_MASK);
else else
qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2], qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2],
val[0] << HSTX_TRIM_SHIFT, hstx_trim << HSTX_TRIM_SHIFT, HSTX_TRIM_MASK);
HSTX_TRIM_MASK);
} }
static int qusb2_phy_set_mode(struct phy *phy, static int qusb2_phy_set_mode(struct phy *phy,
...@@ -913,6 +917,9 @@ static const struct of_device_id qusb2_phy_of_match_table[] = { ...@@ -913,6 +917,9 @@ static const struct of_device_id qusb2_phy_of_match_table[] = {
}, { }, {
.compatible = "qcom,msm8998-qusb2-phy", .compatible = "qcom,msm8998-qusb2-phy",
.data = &msm8998_phy_cfg, .data = &msm8998_phy_cfg,
}, {
.compatible = "qcom,qcm2290-qusb2-phy",
.data = &sm6115_phy_cfg,
}, { }, {
.compatible = "qcom,sdm660-qusb2-phy", .compatible = "qcom,sdm660-qusb2-phy",
.data = &sdm660_phy_cfg, .data = &sdm660_phy_cfg,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0 (0x54) #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0 (0x54)
#define RETENABLEN BIT(3) #define RETENABLEN BIT(3)
#define FSEL_MASK GENMASK(7, 5) #define FSEL_MASK GENMASK(6, 4)
#define FSEL_DEFAULT (0x3 << 4) #define FSEL_DEFAULT (0x3 << 4)
#define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1 (0x58) #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1 (0x58)
......
...@@ -321,7 +321,7 @@ rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy) ...@@ -321,7 +321,7 @@ rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy)
struct device_node *node = rphy->dev->of_node; struct device_node *node = rphy->dev->of_node;
struct clk_init_data init; struct clk_init_data init;
const char *clk_name; const char *clk_name;
int ret; int ret = 0;
init.flags = 0; init.flags = 0;
init.name = "clk_usbphy_480m"; init.name = "clk_usbphy_480m";
...@@ -352,15 +352,8 @@ rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy) ...@@ -352,15 +352,8 @@ rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy)
if (ret < 0) if (ret < 0)
goto err_clk_provider; goto err_clk_provider;
ret = devm_add_action(rphy->dev, rockchip_usb2phy_clk480m_unregister, return devm_add_action_or_reset(rphy->dev, rockchip_usb2phy_clk480m_unregister, rphy);
rphy);
if (ret < 0)
goto err_unreg_action;
return 0;
err_unreg_action:
of_clk_del_provider(node);
err_clk_provider: err_clk_provider:
clk_unregister(rphy->clk480m); clk_unregister(rphy->clk480m);
err_ret: err_ret:
......
...@@ -30,16 +30,16 @@ config PHY_EXYNOS_PCIE ...@@ -30,16 +30,16 @@ config PHY_EXYNOS_PCIE
This driver provides PHY interface for Exynos PCIe controller. This driver provides PHY interface for Exynos PCIe controller.
config PHY_SAMSUNG_UFS config PHY_SAMSUNG_UFS
tristate "SAMSUNG SoC series UFS PHY driver" tristate "Exynos SoC series UFS PHY driver"
depends on OF && (ARCH_EXYNOS || COMPILE_TEST) depends on OF && (ARCH_EXYNOS || COMPILE_TEST)
select GENERIC_PHY select GENERIC_PHY
help help
Enable this to support the Samsung UFS PHY driver for Enable this to support the Samsung Exynos SoC UFS PHY driver for
Samsung SoCs. This driver provides the interface for UFS Samsung Exynos SoCs. This driver provides the interface for UFS host
host controller to do PHY related programming. controller to do PHY related programming.
config PHY_SAMSUNG_USB2 config PHY_SAMSUNG_USB2
tristate "Samsung USB 2.0 PHY driver" tristate "S5P/Exynos SoC series USB 2.0 PHY driver"
depends on HAS_IOMEM depends on HAS_IOMEM
depends on USB_EHCI_EXYNOS || USB_OHCI_EXYNOS || USB_DWC2 || COMPILE_TEST depends on USB_EHCI_EXYNOS || USB_OHCI_EXYNOS || USB_DWC2 || COMPILE_TEST
select GENERIC_PHY select GENERIC_PHY
...@@ -47,9 +47,9 @@ config PHY_SAMSUNG_USB2 ...@@ -47,9 +47,9 @@ config PHY_SAMSUNG_USB2
default ARCH_EXYNOS default ARCH_EXYNOS
help help
Enable this to support the Samsung USB 2.0 PHY driver for Samsung Enable this to support the Samsung USB 2.0 PHY driver for Samsung
SoCs. This driver provides the interface for USB 2.0 PHY. Support S5Pv210 and Exynos SoCs. This driver provides the interface for USB
for particular PHYs will be enabled based on the SoC type in addition 2.0 PHY. Support for particular PHYs will be enabled based on the SoC
to this driver. type in addition to this driver.
config PHY_EXYNOS4210_USB2 config PHY_EXYNOS4210_USB2
bool bool
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define STM32_USBPHYC_PLL 0x0 #define STM32_USBPHYC_PLL 0x0
#define STM32_USBPHYC_MISC 0x8 #define STM32_USBPHYC_MISC 0x8
#define STM32_USBPHYC_MONITOR(X) (0x108 + ((X) * 0x100)) #define STM32_USBPHYC_MONITOR(X) (0x108 + ((X) * 0x100))
#define STM32_USBPHYC_TUNE(X) (0x10C + ((X) * 0x100))
#define STM32_USBPHYC_VERSION 0x3F4 #define STM32_USBPHYC_VERSION 0x3F4
/* STM32_USBPHYC_PLL bit fields */ /* STM32_USBPHYC_PLL bit fields */
...@@ -41,6 +42,83 @@ ...@@ -41,6 +42,83 @@
#define STM32_USBPHYC_MON_SEL_LOCKP 0x1F #define STM32_USBPHYC_MON_SEL_LOCKP 0x1F
#define STM32_USBPHYC_MON_OUT_LOCKP BIT(3) #define STM32_USBPHYC_MON_OUT_LOCKP BIT(3)
/* STM32_USBPHYC_TUNE bit fields */
#define INCURREN BIT(0)
#define INCURRINT BIT(1)
#define LFSCAPEN BIT(2)
#define HSDRVSLEW BIT(3)
#define HSDRVDCCUR BIT(4)
#define HSDRVDCLEV BIT(5)
#define HSDRVCURINCR BIT(6)
#define FSDRVRFADJ BIT(7)
#define HSDRVRFRED BIT(8)
#define HSDRVCHKITRM GENMASK(12, 9)
#define HSDRVCHKZTRM GENMASK(14, 13)
#define OTPCOMP GENMASK(19, 15)
#define SQLCHCTL GENMASK(21, 20)
#define HDRXGNEQEN BIT(22)
#define HSRXOFF GENMASK(24, 23)
#define HSFALLPREEM BIT(25)
#define SHTCCTCTLPROT BIT(26)
#define STAGSEL BIT(27)
enum boosting_vals {
BOOST_1000_UA = 1000,
BOOST_2000_UA = 2000,
};
enum dc_level_vals {
DC_NOMINAL,
DC_PLUS_5_TO_7_MV,
DC_PLUS_10_TO_14_MV,
DC_MINUS_5_TO_7_MV,
DC_MAX,
};
enum current_trim {
CUR_NOMINAL,
CUR_PLUS_1_56_PCT,
CUR_PLUS_3_12_PCT,
CUR_PLUS_4_68_PCT,
CUR_PLUS_6_24_PCT,
CUR_PLUS_7_8_PCT,
CUR_PLUS_9_36_PCT,
CUR_PLUS_10_92_PCT,
CUR_PLUS_12_48_PCT,
CUR_PLUS_14_04_PCT,
CUR_PLUS_15_6_PCT,
CUR_PLUS_17_16_PCT,
CUR_PLUS_19_01_PCT,
CUR_PLUS_20_58_PCT,
CUR_PLUS_22_16_PCT,
CUR_PLUS_23_73_PCT,
CUR_MAX,
};
enum impedance_trim {
IMP_NOMINAL,
IMP_MINUS_2_OHMS,
IMP_MINUS_4_OMHS,
IMP_MINUS_6_OHMS,
IMP_MAX,
};
enum squelch_level {
SQLCH_NOMINAL,
SQLCH_PLUS_7_MV,
SQLCH_MINUS_5_MV,
SQLCH_PLUS_14_MV,
SQLCH_MAX,
};
enum rx_offset {
NO_RX_OFFSET,
RX_OFFSET_PLUS_5_MV,
RX_OFFSET_PLUS_10_MV,
RX_OFFSET_MINUS_5_MV,
RX_OFFSET_MAX,
};
/* STM32_USBPHYC_VERSION bit fields */ /* STM32_USBPHYC_VERSION bit fields */
#define MINREV GENMASK(3, 0) #define MINREV GENMASK(3, 0)
#define MAJREV GENMASK(7, 4) #define MAJREV GENMASK(7, 4)
...@@ -60,6 +138,7 @@ struct stm32_usbphyc_phy { ...@@ -60,6 +138,7 @@ struct stm32_usbphyc_phy {
struct regulator *vbus; struct regulator *vbus;
u32 index; u32 index;
bool active; bool active;
u32 tune;
}; };
struct stm32_usbphyc { struct stm32_usbphyc {
...@@ -375,6 +454,107 @@ static int stm32_usbphyc_clk48_register(struct stm32_usbphyc *usbphyc) ...@@ -375,6 +454,107 @@ static int stm32_usbphyc_clk48_register(struct stm32_usbphyc *usbphyc)
return ret; return ret;
} }
static void stm32_usbphyc_phy_tuning(struct stm32_usbphyc *usbphyc,
struct device_node *np, u32 index)
{
struct stm32_usbphyc_phy *usbphyc_phy = usbphyc->phys[index];
u32 reg = STM32_USBPHYC_TUNE(index);
u32 otpcomp, val;
int ret;
/* Backup OTP compensation code */
otpcomp = FIELD_GET(OTPCOMP, readl_relaxed(usbphyc->base + reg));
ret = of_property_read_u32(np, "st,current-boost-microamp", &val);
if (ret != -EINVAL) {
if (!ret && (val == BOOST_1000_UA || val == BOOST_2000_UA)) {
val = (val == BOOST_2000_UA) ? 1 : 0;
usbphyc_phy->tune |= INCURREN | FIELD_PREP(INCURRINT, val);
} else {
dev_warn(usbphyc->dev, "phy%d: invalid st,current-boost-microamp\n", index);
}
}
if (!of_property_read_bool(np, "st,no-lsfs-fb-cap"))
usbphyc_phy->tune |= LFSCAPEN;
if (of_property_read_bool(np, "st,slow-hs-slew-rate"))
usbphyc_phy->tune |= HSDRVSLEW;
ret = of_property_read_u32(np, "st,tune-hs-dc-level", &val);
if (ret != -EINVAL) {
if (!ret && val < DC_MAX) {
if (val == DC_MINUS_5_TO_7_MV) {/* Decreases HS driver DC level */
usbphyc_phy->tune |= HSDRVDCCUR;
} else if (val > 0) { /* Increases HS driver DC level */
val = (val == DC_PLUS_10_TO_14_MV) ? 1 : 0;
usbphyc_phy->tune |= HSDRVCURINCR | FIELD_PREP(HSDRVDCLEV, val);
}
} else {
dev_warn(usbphyc->dev, "phy%d: invalid st,tune-hs-dc-level\n", index);
}
}
if (of_property_read_bool(np, "st,enable-fs-rftime-tuning"))
usbphyc_phy->tune |= FSDRVRFADJ;
if (of_property_read_bool(np, "st,enable-hs-rftime-reduction"))
usbphyc_phy->tune |= HSDRVRFRED;
ret = of_property_read_u32(np, "st,trim-hs-current", &val);
if (ret != -EINVAL) {
if (!ret && val < CUR_MAX)
usbphyc_phy->tune |= FIELD_PREP(HSDRVCHKITRM, val);
else
dev_warn(usbphyc->dev, "phy%d: invalid st,trim-hs-current\n", index);
}
ret = of_property_read_u32(np, "st,trim-hs-impedance", &val);
if (ret != -EINVAL) {
if (!ret && val < IMP_MAX)
usbphyc_phy->tune |= FIELD_PREP(HSDRVCHKZTRM, val);
else
dev_warn(usbphyc->dev, "phy%d: invalid st,trim-hs-impedance\n", index);
}
ret = of_property_read_u32(np, "st,tune-squelch-level", &val);
if (ret != -EINVAL) {
if (!ret && val < SQLCH_MAX)
usbphyc_phy->tune |= FIELD_PREP(SQLCHCTL, val);
else
dev_warn(usbphyc->dev, "phy%d: invalid st,tune-squelch\n", index);
}
if (of_property_read_bool(np, "st,enable-hs-rx-gain-eq"))
usbphyc_phy->tune |= HDRXGNEQEN;
ret = of_property_read_u32(np, "st,tune-hs-rx-offset", &val);
if (ret != -EINVAL) {
if (!ret && val < RX_OFFSET_MAX)
usbphyc_phy->tune |= FIELD_PREP(HSRXOFF, val);
else
dev_warn(usbphyc->dev, "phy%d: invalid st,tune-hs-rx-offset\n", index);
}
if (of_property_read_bool(np, "st,no-hs-ftime-ctrl"))
usbphyc_phy->tune |= HSFALLPREEM;
if (!of_property_read_bool(np, "st,no-lsfs-sc"))
usbphyc_phy->tune |= SHTCCTCTLPROT;
if (of_property_read_bool(np, "st,enable-hs-tx-staggering"))
usbphyc_phy->tune |= STAGSEL;
/* Restore OTP compensation code */
usbphyc_phy->tune |= FIELD_PREP(OTPCOMP, otpcomp);
/*
* By default, if no st,xxx tuning property is used, usbphyc_phy->tune is equal to
* STM32_USBPHYC_TUNE reset value (LFSCAPEN | SHTCCTCTLPROT | OTPCOMP).
*/
writel_relaxed(usbphyc_phy->tune, usbphyc->base + reg);
}
static void stm32_usbphyc_switch_setup(struct stm32_usbphyc *usbphyc, static void stm32_usbphyc_switch_setup(struct stm32_usbphyc *usbphyc,
u32 utmi_switch) u32 utmi_switch)
{ {
...@@ -550,6 +730,9 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) ...@@ -550,6 +730,9 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
usbphyc->phys[port]->vbus = NULL; usbphyc->phys[port]->vbus = NULL;
} }
/* Configure phy tuning */
stm32_usbphyc_phy_tuning(usbphyc, child, index);
port++; port++;
} }
...@@ -598,6 +781,25 @@ static int stm32_usbphyc_remove(struct platform_device *pdev) ...@@ -598,6 +781,25 @@ static int stm32_usbphyc_remove(struct platform_device *pdev)
return 0; return 0;
} }
static int __maybe_unused stm32_usbphyc_resume(struct device *dev)
{
struct stm32_usbphyc *usbphyc = dev_get_drvdata(dev);
struct stm32_usbphyc_phy *usbphyc_phy;
int port;
if (usbphyc->switch_setup >= 0)
stm32_usbphyc_switch_setup(usbphyc, usbphyc->switch_setup);
for (port = 0; port < usbphyc->nphys; port++) {
usbphyc_phy = usbphyc->phys[port];
writel_relaxed(usbphyc_phy->tune, usbphyc->base + STM32_USBPHYC_TUNE(port));
}
return 0;
}
static SIMPLE_DEV_PM_OPS(stm32_usbphyc_pm_ops, NULL, stm32_usbphyc_resume);
static const struct of_device_id stm32_usbphyc_of_match[] = { static const struct of_device_id stm32_usbphyc_of_match[] = {
{ .compatible = "st,stm32mp1-usbphyc", }, { .compatible = "st,stm32mp1-usbphyc", },
{ }, { },
...@@ -610,6 +812,7 @@ static struct platform_driver stm32_usbphyc_driver = { ...@@ -610,6 +812,7 @@ static struct platform_driver stm32_usbphyc_driver = {
.driver = { .driver = {
.of_match_table = stm32_usbphyc_of_match, .of_match_table = stm32_usbphyc_of_match,
.name = "stm32-usbphyc", .name = "stm32-usbphyc",
.pm = &stm32_usbphyc_pm_ops,
} }
}; };
module_platform_driver(stm32_usbphyc_driver); module_platform_driver(stm32_usbphyc_driver);
......
...@@ -320,6 +320,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv) ...@@ -320,6 +320,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv)
u64 size; u64 size;
offset = of_get_address(dev->of_node, 0, &size, NULL); offset = of_get_address(dev->of_node, 0, &size, NULL);
if (!offset)
return -EINVAL;
priv->num_ports = size / sizeof(u32); priv->num_ports = size / sizeof(u32);
if (!priv->num_ports) if (!priv->num_ports)
return -EINVAL; return -EINVAL;
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#define TORRENT_SERDES_INTERNAL_SSC 2 #define TORRENT_SERDES_INTERNAL_SSC 2
#define CDNS_TORRENT_REFCLK_DRIVER 0 #define CDNS_TORRENT_REFCLK_DRIVER 0
#define CDNS_TORRENT_DERIVED_REFCLK 1
#define CDNS_TORRENT_RECEIVED_REFCLK 2
/* Sierra */ /* Sierra */
#define CDNS_SIERRA_PLL_CMNLC 0 #define CDNS_SIERRA_PLL_CMNLC 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment