phy-for-6.6

- New Support
   - Qualcomm sa8775p qmp-pcie support, IPQ5018 support,
     SC7280 qmp-ufs support
  - Mediatek MT8188 support
 
 - Updates
   - Device tree device_get_match_data() usage and dropping
     of_match_device() calls
   - Qualcomm qmp usb and combo phy updates for v6 register layout
   - Qualcomm eusb2-repeater updates for tuning overrides, regmap fields
   - STih407 usb binding and ralink usb-phy yaml conversion
   - renesas r8a779f0 serdes init sequencing updates
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmVE5rcACgkQfBQHDyUj
 g0dadhAAhdFR/vj17+Ah7Ru8AShPy1tNLMyFss6+X1+wUBmUYbc5gAmusMi0lIyQ
 n0GofAVARuNOYK+kNocOWeAqA8w9urKkCtfkAl29KzJ06YqZ0XVpOIW+z+GDCCiy
 ekGvgSwKpns/g8eZGRQ2r4O5tdwKolkVSk0SgLeeqtUfGKxLx6U+LS9/XOeO6GlZ
 XQaUpohuutr7xln8JTsJNWIOmYvqWZHUNe5R1Mdy15gyRYOLPZMqaSMPXhiUd/iL
 BJGHtWFJfqQRr7hbma6Ri9DunZAAGTdyfAefdVitTt66Ls9lT/jHxm8ky19C7oTC
 8GgfCMdE1ZdgxckGRKDWUBXIGT61x7dJ4EDfOQo25RRTOEh/1JPFOFvsWICTXHkt
 xLBnip8zX7f5OgejAGQXlXjsrmpBaYZM8J6+02oc9AzA2FCiD/ca7oB420Q5v9uw
 LMuLdv6eOHrzCEwhYOJYR4t4XxRCDFKk5QTu9LQWasUB5fJMJzZ8118s+2AylBEw
 l7EX6XFJ7nlCVUGiFHnqJCPwZDnnJw+irvre8Id0QYoJxW6XsSET49Us5Uh9I0vs
 grhn0WNVJ93yk87u2uTJkfhXUjajy6Mw0oy/zLyZ3KztY4u5dx/8NV+pYNEiGFiO
 ggc63Mv/QdR9KbJiKsJtxTOyuw1eG0e2j3RrEQvxqaBEPZLvTjs=
 =y7oj
 -----END PGP SIGNATURE-----

Merge tag 'phy-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy

Pull generic phy updates from Vinod Koul:
 "New Support:
   - Qualcomm sa8775p qmp-pcie, IPQ5018, and SC7280 qmp-ufs support
   - Mediatek MT8188 support

  Updates:
   - Device tree device_get_match_data() usage and dropping
     of_match_device() calls
   - Qualcomm qmp usb and combo phy updates for v6 register layout
   - Qualcomm eusb2-repeater updates for tuning overrides, regmap fields
   - STih407 usb binding and ralink usb-phy yaml conversion
   - renesas r8a779f0 serdes init sequencing updates"

* tag 'phy-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (32 commits)
  phy: Remove duplicated include in phy-ralink-usb.c
  phy: Kconfig: Select GENERIC_PHY for GENERIC_PHY_MIPI_DPHY
  phy: qcom-qmp-pcie: add endpoint support for sa8775p
  dt-bindings: phy: ralink-usb-phy: convert to dtschema
  dt-bindings: phy: Convert PXA1928 USB/HSIC PHY to DT schema
  phy: Drop unnecessary of_match_device() calls
  phy: rockchip-inno-usb2: Drop unnecessary DT includes
  phy: Use device_get_match_data()
  phy: realtek: Replace of_device.h with explicit includes
  phy: renesas: r8a779f0-ether-serdes: Add .exit() ops
  phy: renesas: r8a779f0-ether-serdes: Reset in .init()
  phy: qcom-qmp-combo: use v6 registers in v6 regs layout
  phy: qcom-qmp-usb: move PCS v6 register to the proper header
  phy: qcom-qmp-combo: fix the prefix for the PCS_USB v6 registers
  phy: sun4i-usb: update array size
  phy: qualcomm: phy-qcom-eusb2-repeater: Add tuning overrides
  phy: qualcomm: phy-qcom-eusb2-repeater: Zero out untouched tuning regs
  phy: qualcomm: phy-qcom-eusb2-repeater: Use regmap_fields
  dt-bindings: phy: qcom,snps-eusb2-repeater: Add magic tuning overrides
  dt-bindings: phy: Add compatible for Mediatek MT8188
  ...
This commit is contained in:
Linus Torvalds 2023-11-03 19:06:12 -10:00
commit bfafa2c19d
39 changed files with 828 additions and 650 deletions

View File

@ -0,0 +1,47 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/marvell,pxa1928-usb-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Marvell PXA1928 USB/HSIC PHY
maintainers:
- Duje Mihanović <duje.mihanovic@skole.hr>
properties:
compatible:
enum:
- marvell,pxa1928-usb-phy
- marvell,pxa1928-hsic-phy
reg:
maxItems: 1
clocks:
maxItems: 1
'#phy-cells':
const: 0
resets:
maxItems: 1
required:
- compatible
- reg
- clocks
- '#phy-cells'
additionalProperties: false
examples:
- |
#include <dt-bindings/clock/marvell,pxa1928.h>
usbphy: phy@7000 {
compatible = "marvell,pxa1928-usb-phy";
reg = <0x7000 0xe0>;
clocks = <&apmu PXA1928_CLK_USB>;
#phy-cells = <0>;
};

View File

@ -30,6 +30,7 @@ properties:
- const: mediatek,mt8173-mipi-tx - const: mediatek,mt8173-mipi-tx
- items: - items:
- enum: - enum:
- mediatek,mt8188-mipi-tx
- mediatek,mt8365-mipi-tx - mediatek,mt8365-mipi-tx
- const: mediatek,mt8183-mipi-tx - const: mediatek,mt8183-mipi-tx
- const: mediatek,mt2701-mipi-tx - const: mediatek,mt2701-mipi-tx

View File

@ -0,0 +1,74 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/mediatek,mt7628-usbphy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Mediatek/Ralink USB PHY
maintainers:
- Sergio Paracuellos <sergio.paracuellos@gmail.com>
properties:
compatible:
enum:
- mediatek,mt7620-usbphy
- mediatek,mt7628-usbphy
- ralink,rt3352-usbphy
reg:
maxItems: 1
"#phy-cells":
const: 0
ralink,sysctl:
description:
phandle to a ralink syscon register region.
$ref: /schemas/types.yaml#/definitions/phandle
resets:
items:
- description: USB Host reset controller
- description: USB Device reset controller
reset-names:
items:
- const: host
- const: device
required:
- compatible
- "#phy-cells"
- ralink,sysctl
- resets
- reset-names
allOf:
- if:
properties:
compatible:
contains:
const: mediatek,mt7628-usbphy
then:
required:
- reg
else:
properties:
reg: false
additionalProperties: false
examples:
- |
phy@10120000 {
compatible = "mediatek,mt7628-usbphy";
reg = <0x10120000 0x1000>;
#phy-cells = <0>;
ralink,sysctl = <&sysc>;
resets = <&rstctrl 22>,
<&rstctrl 25>;
reset-names = "host", "device";
};
...

View File

@ -1,24 +0,0 @@
ST STiH407 USB PHY controller
This file documents the dt bindings for the usb picoPHY driver which is the PHY for both USB2 and USB3
host controllers (when controlling usb2/1.1 devices) available on STiH407 SoC family from STMicroelectronics.
Required properties:
- compatible : should be "st,stih407-usb2-phy"
- st,syscfg : phandle of sysconfig bank plus integer array containing phyparam and phyctrl register offsets
- resets : list of phandle and reset specifier pairs. There should be two entries, one
for the whole phy and one for the port
- reset-names : list of reset signal names. Should be "global" and "port"
See: Documentation/devicetree/bindings/reset/st,stih407-powerdown.yaml
See: Documentation/devicetree/bindings/reset/reset.txt
Example:
usb2_picophy0: usbpicophy@f8 {
compatible = "st,stih407-usb2-phy";
#phy-cells = <0>;
st,syscfg = <&syscfg_core 0x100 0xf4>;
resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
<&picophyreset STIH407_PICOPHY0_RESET>;
reset-names = "global", "port";
};

View File

@ -1,18 +0,0 @@
* Marvell PXA1928 USB and HSIC PHYs
Required properties:
- compatible: "marvell,pxa1928-usb-phy" or "marvell,pxa1928-hsic-phy"
- reg: base address and length of the registers
- clocks - A single clock. From common clock binding.
- #phys-cells: should be 0. From common phy binding.
- resets: reference to the reset controller
Example:
usbphy: phy@7000 {
compatible = "marvell,pxa1928-usb-phy";
reg = <0x7000 0xe0>;
clocks = <&apmu_clocks PXA1928_CLK_USB>;
#phy-cells = <0>;
};

View File

@ -17,7 +17,9 @@ description:
properties: properties:
compatible: compatible:
items: items:
- const: qcom,ipq5332-usb-hsphy - enum:
- qcom,ipq5018-usb-hsphy
- qcom,ipq5332-usb-hsphy
"#phy-cells": "#phy-cells":
const: 0 const: 0

View File

@ -1,287 +0,0 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/qcom,msm8996-qmp-usb3-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm QMP PHY controller (USB, MSM8996)
maintainers:
- Vinod Koul <vkoul@kernel.org>
description:
QMP PHY controller supports physical layer functionality for a number of
controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB.
Note that these bindings are for SoCs up to SC8180X. For newer SoCs, see
qcom,sc8280xp-qmp-usb3-uni-phy.yaml.
properties:
compatible:
enum:
- qcom,ipq6018-qmp-usb3-phy
- qcom,ipq8074-qmp-usb3-phy
- qcom,msm8996-qmp-usb3-phy
- qcom,msm8998-qmp-usb3-phy
- qcom,sdm845-qmp-usb3-uni-phy
- qcom,sdx55-qmp-usb3-uni-phy
- qcom,sdx65-qmp-usb3-uni-phy
- qcom,sm8150-qmp-usb3-uni-phy
- qcom,sm8250-qmp-usb3-uni-phy
- qcom,sm8350-qmp-usb3-uni-phy
reg:
items:
- description: serdes
"#address-cells":
enum: [ 1, 2 ]
"#size-cells":
enum: [ 1, 2 ]
ranges: true
clocks:
minItems: 3
maxItems: 4
clock-names:
minItems: 3
maxItems: 4
power-domains:
maxItems: 1
resets:
maxItems: 2
reset-names:
maxItems: 2
vdda-phy-supply: true
vdda-pll-supply: true
vddp-ref-clk-supply: true
patternProperties:
"^phy@[0-9a-f]+$":
type: object
description: single PHY-provider child node
properties:
reg:
minItems: 3
maxItems: 6
clocks:
items:
- description: PIPE clock
clock-names:
deprecated: true
items:
- const: pipe0
"#clock-cells":
const: 0
clock-output-names:
maxItems: 1
"#phy-cells":
const: 0
required:
- reg
- clocks
- "#clock-cells"
- clock-output-names
- "#phy-cells"
additionalProperties: false
required:
- compatible
- reg
- "#address-cells"
- "#size-cells"
- ranges
- clocks
- clock-names
- resets
- reset-names
- vdda-phy-supply
- vdda-pll-supply
additionalProperties: false
allOf:
- if:
properties:
compatible:
contains:
enum:
- qcom,sdm845-qmp-usb3-uni-phy
then:
properties:
clocks:
maxItems: 4
clock-names:
items:
- const: aux
- const: cfg_ahb
- const: ref
- const: com_aux
resets:
maxItems: 2
reset-names:
items:
- const: phy
- const: common
- if:
properties:
compatible:
contains:
enum:
- qcom,ipq8074-qmp-usb3-phy
- qcom,msm8996-qmp-usb3-phy
- qcom,msm8998-qmp-usb3-phy
- qcom,sdx55-qmp-usb3-uni-phy
- qcom,sdx65-qmp-usb3-uni-phy
then:
properties:
clocks:
maxItems: 3
clock-names:
items:
- const: aux
- const: cfg_ahb
- const: ref
resets:
maxItems: 2
reset-names:
items:
- const: phy
- const: common
- if:
properties:
compatible:
contains:
enum:
- qcom,sm8150-qmp-usb3-uni-phy
- qcom,sm8250-qmp-usb3-uni-phy
- qcom,sm8350-qmp-usb3-uni-phy
then:
properties:
clocks:
maxItems: 4
clock-names:
items:
- const: aux
- const: ref_clk_src
- const: ref
- const: com_aux
resets:
maxItems: 2
reset-names:
items:
- const: phy
- const: common
- if:
properties:
compatible:
contains:
enum:
- qcom,msm8998-qmp-usb3-phy
then:
patternProperties:
"^phy@[0-9a-f]+$":
properties:
reg:
items:
- description: TX lane 1
- description: RX lane 1
- description: PCS
- description: TX lane 2
- description: RX lane 2
- if:
properties:
compatible:
contains:
enum:
- qcom,ipq6018-qmp-usb3-phy
- qcom,ipq8074-qmp-usb3-phy
- qcom,sdx55-qmp-usb3-uni-phy
- qcom,sdx65-qmp-usb3-uni-phy
- qcom,sm8150-qmp-usb3-uni-phy
then:
patternProperties:
"^phy@[0-9a-f]+$":
properties:
reg:
items:
- description: TX
- description: RX
- description: PCS
- description: PCS_MISC
- if:
properties:
compatible:
contains:
enum:
- qcom,msm8996-qmp-usb3-phy
- qcom,sm8250-qmp-usb3-uni-phy
- qcom,sm8350-qmp-usb3-uni-phy
then:
patternProperties:
"^phy@[0-9a-f]+$":
properties:
reg:
items:
- description: TX
- description: RX
- description: PCS
examples:
- |
#include <dt-bindings/clock/qcom,gcc-sdm845.h>
usb_2_qmpphy: phy-wrapper@88eb000 {
compatible = "qcom,sdm845-qmp-usb3-uni-phy";
reg = <0x088eb000 0x18c>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x088eb000 0x2000>;
clocks = <&gcc GCC_USB3_SEC_PHY_AUX_CLK >,
<&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>,
<&gcc GCC_USB3_SEC_CLKREF_CLK>,
<&gcc GCC_USB3_SEC_PHY_COM_AUX_CLK>;
clock-names = "aux", "cfg_ahb", "ref", "com_aux";
resets = <&gcc GCC_USB3PHY_PHY_SEC_BCR>,
<&gcc GCC_USB3_PHY_SEC_BCR>;
reset-names = "phy", "common";
vdda-phy-supply = <&vdda_usb2_ss_1p2>;
vdda-pll-supply = <&vdda_usb2_ss_core>;
usb_2_ssphy: phy@200 {
reg = <0x200 0x128>,
<0x400 0x1fc>,
<0x800 0x218>,
<0x600 0x70>;
clocks = <&gcc GCC_USB3_SEC_PHY_PIPE_CLK>;
#clock-cells = <0>;
clock-output-names = "usb3_uni_phy_pipe_clk_src";
#phy-cells = <0>;
};
};

View File

@ -19,6 +19,7 @@ properties:
- qcom,msm8996-qmp-ufs-phy - qcom,msm8996-qmp-ufs-phy
- qcom,msm8998-qmp-ufs-phy - qcom,msm8998-qmp-ufs-phy
- qcom,sa8775p-qmp-ufs-phy - qcom,sa8775p-qmp-ufs-phy
- qcom,sc7280-qmp-ufs-phy
- qcom,sc8180x-qmp-ufs-phy - qcom,sc8180x-qmp-ufs-phy
- qcom,sc8280xp-qmp-ufs-phy - qcom,sc8280xp-qmp-ufs-phy
- qcom,sdm845-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy
@ -85,6 +86,7 @@ allOf:
contains: contains:
enum: enum:
- qcom,sa8775p-qmp-ufs-phy - qcom,sa8775p-qmp-ufs-phy
- qcom,sc7280-qmp-ufs-phy
- qcom,sm8450-qmp-ufs-phy - qcom,sm8450-qmp-ufs-phy
then: then:
properties: properties:

View File

@ -16,21 +16,34 @@ description:
properties: properties:
compatible: compatible:
enum: enum:
- qcom,ipq6018-qmp-usb3-phy
- qcom,ipq8074-qmp-usb3-phy
- qcom,ipq9574-qmp-usb3-phy - qcom,ipq9574-qmp-usb3-phy
- qcom,msm8996-qmp-usb3-phy
- qcom,msm8998-qmp-usb3-phy
- qcom,qcm2290-qmp-usb3-phy - qcom,qcm2290-qmp-usb3-phy
- qcom,sa8775p-qmp-usb3-uni-phy - qcom,sa8775p-qmp-usb3-uni-phy
- qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sc8280xp-qmp-usb3-uni-phy
- qcom,sdm845-qmp-usb3-uni-phy
- qcom,sdx55-qmp-usb3-uni-phy
- qcom,sdx65-qmp-usb3-uni-phy
- qcom,sdx75-qmp-usb3-uni-phy - qcom,sdx75-qmp-usb3-uni-phy
- qcom,sm6115-qmp-usb3-phy - qcom,sm6115-qmp-usb3-phy
- qcom,sm8150-qmp-usb3-uni-phy
- qcom,sm8250-qmp-usb3-uni-phy
- qcom,sm8350-qmp-usb3-uni-phy
reg: reg:
maxItems: 1 maxItems: 1
clocks: clocks:
maxItems: 4 minItems: 4
maxItems: 5
clock-names: clock-names:
maxItems: 4 minItems: 4
maxItems: 5
power-domains: power-domains:
maxItems: 1 maxItems: 1
@ -75,10 +88,18 @@ allOf:
compatible: compatible:
contains: contains:
enum: enum:
- qcom,ipq6018-qmp-usb3-phy
- qcom,ipq8074-qmp-usb3-phy
- qcom,ipq9574-qmp-usb3-phy - qcom,ipq9574-qmp-usb3-phy
- qcom,msm8996-qmp-usb3-phy
- qcom,msm8998-qmp-usb3-phy
- qcom,sdx55-qmp-usb3-uni-phy
- qcom,sdx65-qmp-usb3-uni-phy
- qcom,sdx75-qmp-usb3-uni-phy - qcom,sdx75-qmp-usb3-uni-phy
then: then:
properties: properties:
clocks:
maxItems: 4
clock-names: clock-names:
items: items:
- const: aux - const: aux
@ -111,6 +132,9 @@ allOf:
enum: enum:
- qcom,sa8775p-qmp-usb3-uni-phy - qcom,sa8775p-qmp-usb3-uni-phy
- qcom,sc8280xp-qmp-usb3-uni-phy - qcom,sc8280xp-qmp-usb3-uni-phy
- qcom,sm8150-qmp-usb3-uni-phy
- qcom,sm8250-qmp-usb3-uni-phy
- qcom,sm8350-qmp-usb3-uni-phy
then: then:
properties: properties:
clocks: clocks:
@ -121,6 +145,33 @@ allOf:
- const: ref - const: ref
- const: com_aux - const: com_aux
- const: pipe - const: pipe
- if:
properties:
compatible:
contains:
enum:
- qcom,sdm845-qmp-usb3-uni-phy
then:
properties:
clocks:
maxItems: 5
clock-names:
items:
- const: aux
- const: cfg_ahb
- const: ref
- const: com_aux
- const: pipe
- if:
properties:
compatible:
contains:
enum:
- qcom,sa8775p-qmp-usb3-uni-phy
- qcom,sc8280xp-qmp-usb3-uni-phy
then:
required: required:
- power-domains - power-domains

View File

@ -32,6 +32,27 @@ properties:
vdd3-supply: true vdd3-supply: true
qcom,tune-usb2-disc-thres:
$ref: /schemas/types.yaml#/definitions/uint8
description: High-Speed disconnect threshold
minimum: 0
maximum: 7
default: 0
qcom,tune-usb2-amplitude:
$ref: /schemas/types.yaml#/definitions/uint8
description: High-Speed trasmit amplitude
minimum: 0
maximum: 15
default: 8
qcom,tune-usb2-preem:
$ref: /schemas/types.yaml#/definitions/uint8
description: High-Speed TX pre-emphasis tuning
minimum: 0
maximum: 7
default: 5
required: required:
- compatible - compatible
- reg - reg

View File

@ -1,23 +0,0 @@
Mediatek/Ralink USB PHY
Required properties:
- compatible: "ralink,rt3352-usbphy"
"mediatek,mt7620-usbphy"
"mediatek,mt7628-usbphy"
- reg: required for "mediatek,mt7628-usbphy", unused otherwise
- #phy-cells: should be 0
- ralink,sysctl: a phandle to a ralink syscon register region
- resets: the two reset controllers for host and device
- reset-names: the names of the 2 reset controllers
Example:
usbphy: phy {
compatible = "mediatek,mt7628-usbphy";
reg = <0x10120000 0x1000>;
#phy-cells = <0>;
ralink,sysctl = <&sysc>;
resets = <&rstctrl 22 &rstctrl 25>;
reset-names = "host", "device";
};

View File

@ -0,0 +1,63 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/st,stih407-usb2-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: STMicroelectronics STiH407 USB PHY controller
maintainers:
- Patrice Chotard <patrice.chotard@foss.st.com>
description:
The USB picoPHY device is the PHY for both USB2 and USB3 host controllers
(when controlling usb2/1.1 devices) available on STiH407 SoC family from
STMicroelectronics.
properties:
compatible:
const: st,stih407-usb2-phy
st,syscfg:
description: Phandle to the syscfg bank
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
- items:
- description: phandle to syscfg
- description: phyparam register offset
- description: phyctrl register offset
resets:
items:
- description: Phandle and reset specifier pair for the whole phy.
- description: Phandle and reset specifier pair for the port.
reset-names:
items:
- const: global
- const: port
"#phy-cells":
const: 0
required:
- compatible
- st,syscfg
- resets
- reset-names
- "#phy-cells"
additionalProperties: false
examples:
- |
#include <dt-bindings/reset/stih407-resets.h>
usb-phy {
compatible = "st,stih407-usb2-phy";
#phy-cells = <0>;
st,syscfg = <&syscfg_core 0x100 0xf4>;
resets = <&softreset STIH407_PICOPHY_SOFTRESET>,
<&picophyreset STIH407_PICOPHY0_RESET>;
reset-names = "global", "port";
};
...

View File

@ -18,7 +18,7 @@ config GENERIC_PHY
config GENERIC_PHY_MIPI_DPHY config GENERIC_PHY_MIPI_DPHY
bool bool
depends on GENERIC_PHY select GENERIC_PHY
help help
Generic MIPI D-PHY support. Generic MIPI D-PHY support.

View File

@ -782,7 +782,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
for (i = 0; i < data->cfg->num_phys; i++) { for (i = 0; i < data->cfg->num_phys; i++) {
struct sun4i_usb_phy *phy = data->phys + i; struct sun4i_usb_phy *phy = data->phys + i;
char name[16]; char name[32];
if (data->cfg->missing_phys & BIT(i)) if (data->cfg->missing_phys & BIT(i))
continue; continue;

View File

@ -16,10 +16,11 @@
#include <linux/iopoll.h> #include <linux/iopoll.h>
#include <linux/mdio.h> #include <linux/mdio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#define BCM_NS_USB3_PHY_BASE_ADDR_REG 0x1f #define BCM_NS_USB3_PHY_BASE_ADDR_REG 0x1f
@ -189,7 +190,6 @@ static int bcm_ns_usb3_mdio_phy_write(struct bcm_ns_usb3 *usb3, u16 reg,
static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev) static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev)
{ {
struct device *dev = &mdiodev->dev; struct device *dev = &mdiodev->dev;
const struct of_device_id *of_id;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct device_node *syscon_np; struct device_node *syscon_np;
struct bcm_ns_usb3 *usb3; struct bcm_ns_usb3 *usb3;
@ -203,10 +203,7 @@ static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev)
usb3->dev = dev; usb3->dev = dev;
usb3->mdiodev = mdiodev; usb3->mdiodev = mdiodev;
of_id = of_match_device(bcm_ns_usb3_id_table, dev); usb3->family = (enum bcm_ns_family)device_get_match_data(dev);
if (!of_id)
return -EINVAL;
usb3->family = (uintptr_t)of_id->data;
syscon_np = of_parse_phandle(dev->of_node, "usb3-dmp-syscon", 0); syscon_np = of_parse_phandle(dev->of_node, "usb3-dmp-syscon", 0);
err = of_address_to_resource(syscon_np, 0, &res); err = of_address_to_resource(syscon_np, 0, &res);

View File

@ -8,9 +8,10 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h> #include <linux/of.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/reset.h> #include <linux/reset.h>
#define USB_PHY_PLL 0x04 #define USB_PHY_PLL 0x04
@ -162,8 +163,6 @@ MODULE_DEVICE_TABLE(of, phy_berlin_usb_of_match);
static int phy_berlin_usb_probe(struct platform_device *pdev) static int phy_berlin_usb_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match =
of_match_device(phy_berlin_usb_of_match, &pdev->dev);
struct phy_berlin_usb_priv *priv; struct phy_berlin_usb_priv *priv;
struct phy *phy; struct phy *phy;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
@ -180,7 +179,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
if (IS_ERR(priv->rst_ctrl)) if (IS_ERR(priv->rst_ctrl))
return PTR_ERR(priv->rst_ctrl); return PTR_ERR(priv->rst_ctrl);
priv->pll_divider = *((u32 *)match->data); priv->pll_divider = *((u32 *)device_get_match_data(&pdev->dev));
phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops); phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
if (IS_ERR(phy)) { if (IS_ERR(phy)) {

View File

@ -15,7 +15,6 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/iio/consumer.h> #include <linux/iio/consumer.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
@ -612,14 +611,8 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev)
struct phy *generic_phy; struct phy *generic_phy;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct usb_otg *otg; struct usb_otg *otg;
const struct of_device_id *of_id;
int error; int error;
of_id = of_match_device(of_match_ptr(cpcap_usb_phy_id_table),
&pdev->dev);
if (!of_id)
return -EINVAL;
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata) if (!ddata)
return -ENOMEM; return -ENOMEM;

View File

@ -24,23 +24,73 @@
#define EUSB2_FORCE_VAL_5 0xeD #define EUSB2_FORCE_VAL_5 0xeD
#define V_CLK_19P2M_EN BIT(6) #define V_CLK_19P2M_EN BIT(6)
#define EUSB2_TUNE_USB2_CROSSOVER 0x50
#define EUSB2_TUNE_IUSB2 0x51 #define EUSB2_TUNE_IUSB2 0x51
#define EUSB2_TUNE_RES_FSDIF 0x52
#define EUSB2_TUNE_HSDISC 0x53
#define EUSB2_TUNE_SQUELCH_U 0x54 #define EUSB2_TUNE_SQUELCH_U 0x54
#define EUSB2_TUNE_USB2_SLEW 0x55
#define EUSB2_TUNE_USB2_EQU 0x56
#define EUSB2_TUNE_USB2_PREEM 0x57 #define EUSB2_TUNE_USB2_PREEM 0x57
#define EUSB2_TUNE_USB2_HS_COMP_CUR 0x58
#define EUSB2_TUNE_EUSB_SLEW 0x59
#define EUSB2_TUNE_EUSB_EQU 0x5A
#define EUSB2_TUNE_EUSB_HS_COMP_CUR 0x5B
#define QCOM_EUSB2_REPEATER_INIT_CFG(o, v) \ #define QCOM_EUSB2_REPEATER_INIT_CFG(r, v) \
{ \ { \
.offset = o, \ .reg = r, \
.val = v, \ .val = v, \
} }
struct eusb2_repeater_init_tbl { enum reg_fields {
unsigned int offset; F_TUNE_EUSB_HS_COMP_CUR,
unsigned int val; F_TUNE_EUSB_EQU,
F_TUNE_EUSB_SLEW,
F_TUNE_USB2_HS_COMP_CUR,
F_TUNE_USB2_PREEM,
F_TUNE_USB2_EQU,
F_TUNE_USB2_SLEW,
F_TUNE_SQUELCH_U,
F_TUNE_HSDISC,
F_TUNE_RES_FSDIF,
F_TUNE_IUSB2,
F_TUNE_USB2_CROSSOVER,
F_NUM_TUNE_FIELDS,
F_FORCE_VAL_5 = F_NUM_TUNE_FIELDS,
F_FORCE_EN_5,
F_EN_CTL1,
F_RPTR_STATUS,
F_NUM_FIELDS,
};
static struct reg_field eusb2_repeater_tune_reg_fields[F_NUM_FIELDS] = {
[F_TUNE_EUSB_HS_COMP_CUR] = REG_FIELD(EUSB2_TUNE_EUSB_HS_COMP_CUR, 0, 1),
[F_TUNE_EUSB_EQU] = REG_FIELD(EUSB2_TUNE_EUSB_EQU, 0, 1),
[F_TUNE_EUSB_SLEW] = REG_FIELD(EUSB2_TUNE_EUSB_SLEW, 0, 1),
[F_TUNE_USB2_HS_COMP_CUR] = REG_FIELD(EUSB2_TUNE_USB2_HS_COMP_CUR, 0, 1),
[F_TUNE_USB2_PREEM] = REG_FIELD(EUSB2_TUNE_USB2_PREEM, 0, 2),
[F_TUNE_USB2_EQU] = REG_FIELD(EUSB2_TUNE_USB2_EQU, 0, 1),
[F_TUNE_USB2_SLEW] = REG_FIELD(EUSB2_TUNE_USB2_SLEW, 0, 1),
[F_TUNE_SQUELCH_U] = REG_FIELD(EUSB2_TUNE_SQUELCH_U, 0, 2),
[F_TUNE_HSDISC] = REG_FIELD(EUSB2_TUNE_HSDISC, 0, 2),
[F_TUNE_RES_FSDIF] = REG_FIELD(EUSB2_TUNE_RES_FSDIF, 0, 2),
[F_TUNE_IUSB2] = REG_FIELD(EUSB2_TUNE_IUSB2, 0, 3),
[F_TUNE_USB2_CROSSOVER] = REG_FIELD(EUSB2_TUNE_USB2_CROSSOVER, 0, 2),
[F_FORCE_VAL_5] = REG_FIELD(EUSB2_FORCE_VAL_5, 0, 7),
[F_FORCE_EN_5] = REG_FIELD(EUSB2_FORCE_EN_5, 0, 7),
[F_EN_CTL1] = REG_FIELD(EUSB2_EN_CTL1, 0, 7),
[F_RPTR_STATUS] = REG_FIELD(EUSB2_RPTR_STATUS, 0, 7),
}; };
struct eusb2_repeater_cfg { struct eusb2_repeater_cfg {
const struct eusb2_repeater_init_tbl *init_tbl; const u32 *init_tbl;
int init_tbl_num; int init_tbl_num;
const char * const *vreg_list; const char * const *vreg_list;
int num_vregs; int num_vregs;
@ -48,11 +98,10 @@ struct eusb2_repeater_cfg {
struct eusb2_repeater { struct eusb2_repeater {
struct device *dev; struct device *dev;
struct regmap *regmap; struct regmap_field *regs[F_NUM_FIELDS];
struct phy *phy; struct phy *phy;
struct regulator_bulk_data *vregs; struct regulator_bulk_data *vregs;
const struct eusb2_repeater_cfg *cfg; const struct eusb2_repeater_cfg *cfg;
u16 base;
enum phy_mode mode; enum phy_mode mode;
}; };
@ -60,10 +109,10 @@ static const char * const pm8550b_vreg_l[] = {
"vdd18", "vdd3", "vdd18", "vdd3",
}; };
static const struct eusb2_repeater_init_tbl pm8550b_init_tbl[] = { static const u32 pm8550b_init_tbl[F_NUM_TUNE_FIELDS] = {
QCOM_EUSB2_REPEATER_INIT_CFG(EUSB2_TUNE_IUSB2, 0x8), [F_TUNE_IUSB2] = 0x8,
QCOM_EUSB2_REPEATER_INIT_CFG(EUSB2_TUNE_SQUELCH_U, 0x3), [F_TUNE_SQUELCH_U] = 0x3,
QCOM_EUSB2_REPEATER_INIT_CFG(EUSB2_TUNE_USB2_PREEM, 0x5), [F_TUNE_USB2_PREEM] = 0x5,
}; };
static const struct eusb2_repeater_cfg pm8550b_eusb2_cfg = { static const struct eusb2_repeater_cfg pm8550b_eusb2_cfg = {
@ -91,9 +140,11 @@ static int eusb2_repeater_init_vregs(struct eusb2_repeater *rptr)
static int eusb2_repeater_init(struct phy *phy) static int eusb2_repeater_init(struct phy *phy)
{ {
struct reg_field *regfields = eusb2_repeater_tune_reg_fields;
struct eusb2_repeater *rptr = phy_get_drvdata(phy); struct eusb2_repeater *rptr = phy_get_drvdata(phy);
const struct eusb2_repeater_init_tbl *init_tbl = rptr->cfg->init_tbl; struct device_node *np = rptr->dev->of_node;
int num = rptr->cfg->init_tbl_num; u32 init_tbl[F_NUM_TUNE_FIELDS] = { 0 };
u8 override;
u32 val; u32 val;
int ret; int ret;
int i; int i;
@ -102,17 +153,34 @@ static int eusb2_repeater_init(struct phy *phy)
if (ret) if (ret)
return ret; return ret;
regmap_update_bits(rptr->regmap, rptr->base + EUSB2_EN_CTL1, regmap_field_update_bits(rptr->regs[F_EN_CTL1], EUSB2_RPTR_EN, EUSB2_RPTR_EN);
EUSB2_RPTR_EN, EUSB2_RPTR_EN);
for (i = 0; i < num; i++) for (i = 0; i < F_NUM_TUNE_FIELDS; i++) {
regmap_update_bits(rptr->regmap, if (init_tbl[i]) {
rptr->base + init_tbl[i].offset, regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]);
init_tbl[i].val, init_tbl[i].val); } else {
/* Write 0 if there's no value set */
u32 mask = GENMASK(regfields[i].msb, regfields[i].lsb);
ret = regmap_read_poll_timeout(rptr->regmap, regmap_field_update_bits(rptr->regs[i], mask, 0);
rptr->base + EUSB2_RPTR_STATUS, val, }
val & RPTR_OK, 10, 5); }
memcpy(init_tbl, rptr->cfg->init_tbl, sizeof(init_tbl));
if (!of_property_read_u8(np, "qcom,tune-usb2-amplitude", &override))
init_tbl[F_TUNE_IUSB2] = override;
if (!of_property_read_u8(np, "qcom,tune-usb2-disc-thres", &override))
init_tbl[F_TUNE_HSDISC] = override;
if (!of_property_read_u8(np, "qcom,tune-usb2-preem", &override))
init_tbl[F_TUNE_USB2_PREEM] = override;
for (i = 0; i < F_NUM_TUNE_FIELDS; i++)
regmap_field_update_bits(rptr->regs[i], init_tbl[i], init_tbl[i]);
ret = regmap_field_read_poll_timeout(rptr->regs[F_RPTR_STATUS],
val, val & RPTR_OK, 10, 5);
if (ret) if (ret)
dev_err(rptr->dev, "initialization timed-out\n"); dev_err(rptr->dev, "initialization timed-out\n");
@ -131,10 +199,10 @@ static int eusb2_repeater_set_mode(struct phy *phy,
* per eUSB 1.2 Spec. Below implement software workaround until * per eUSB 1.2 Spec. Below implement software workaround until
* PHY and controller is fixing seen observation. * PHY and controller is fixing seen observation.
*/ */
regmap_update_bits(rptr->regmap, rptr->base + EUSB2_FORCE_EN_5, regmap_field_update_bits(rptr->regs[F_FORCE_EN_5],
F_CLK_19P2M_EN, F_CLK_19P2M_EN); F_CLK_19P2M_EN, F_CLK_19P2M_EN);
regmap_update_bits(rptr->regmap, rptr->base + EUSB2_FORCE_VAL_5, regmap_field_update_bits(rptr->regs[F_FORCE_VAL_5],
V_CLK_19P2M_EN, V_CLK_19P2M_EN); V_CLK_19P2M_EN, V_CLK_19P2M_EN);
break; break;
case PHY_MODE_USB_DEVICE: case PHY_MODE_USB_DEVICE:
/* /*
@ -143,10 +211,10 @@ static int eusb2_repeater_set_mode(struct phy *phy,
* repeater doesn't clear previous value due to shared * repeater doesn't clear previous value due to shared
* regulators (say host <-> device mode switch). * regulators (say host <-> device mode switch).
*/ */
regmap_update_bits(rptr->regmap, rptr->base + EUSB2_FORCE_EN_5, regmap_field_update_bits(rptr->regs[F_FORCE_EN_5],
F_CLK_19P2M_EN, 0); F_CLK_19P2M_EN, 0);
regmap_update_bits(rptr->regmap, rptr->base + EUSB2_FORCE_VAL_5, regmap_field_update_bits(rptr->regs[F_FORCE_VAL_5],
V_CLK_19P2M_EN, 0); V_CLK_19P2M_EN, 0);
break; break;
default: default:
return -EINVAL; return -EINVAL;
@ -175,8 +243,9 @@ static int eusb2_repeater_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct regmap *regmap;
int i, ret;
u32 res; u32 res;
int ret;
rptr = devm_kzalloc(dev, sizeof(*rptr), GFP_KERNEL); rptr = devm_kzalloc(dev, sizeof(*rptr), GFP_KERNEL);
if (!rptr) if (!rptr)
@ -189,15 +258,22 @@ static int eusb2_repeater_probe(struct platform_device *pdev)
if (!rptr->cfg) if (!rptr->cfg)
return -EINVAL; return -EINVAL;
rptr->regmap = dev_get_regmap(dev->parent, NULL); regmap = dev_get_regmap(dev->parent, NULL);
if (!rptr->regmap) if (!regmap)
return -ENODEV; return -ENODEV;
ret = of_property_read_u32(np, "reg", &res); ret = of_property_read_u32(np, "reg", &res);
if (ret < 0) if (ret < 0)
return ret; return ret;
rptr->base = res; for (i = 0; i < F_NUM_FIELDS; i++)
eusb2_repeater_tune_reg_fields[i].reg += res;
ret = devm_regmap_field_bulk_alloc(dev, regmap, rptr->regs,
eusb2_repeater_tune_reg_fields,
F_NUM_FIELDS);
if (ret)
return ret;
ret = eusb2_repeater_init_vregs(rptr); ret = eusb2_repeater_init_vregs(rptr);
if (ret < 0) { if (ret < 0) {

View File

@ -82,6 +82,50 @@ struct m31_priv_data {
unsigned int nregs; unsigned int nregs;
}; };
static const struct m31_phy_regs m31_ipq5018_regs[] = {
{
.off = USB_PHY_CFG0,
.val = UTMI_PHY_OVERRIDE_EN
},
{
.off = USB_PHY_UTMI_CTRL5,
.val = POR_EN,
.delay = 15
},
{
.off = USB_PHY_FSEL_SEL,
.val = FREQ_SEL
},
{
.off = USB_PHY_HS_PHY_CTRL_COMMON0,
.val = COMMONONN | FSEL | RETENABLEN
},
{
.off = USB_PHY_REFCLK_CTRL,
.val = CLKCORE
},
{
.off = USB_PHY_UTMI_CTRL5,
.val = POR_EN
},
{
.off = USB_PHY_HS_PHY_CTRL2,
.val = USB2_SUSPEND_N_SEL | USB2_SUSPEND_N | USB2_UTMI_CLK_EN
},
{
.off = USB_PHY_UTMI_CTRL5,
.val = 0x0
},
{
.off = USB_PHY_HS_PHY_CTRL2,
.val = USB2_SUSPEND_N | USB2_UTMI_CLK_EN
},
{
.off = USB_PHY_CFG0,
.val = 0x0
},
};
static struct m31_phy_regs m31_ipq5332_regs[] = { static struct m31_phy_regs m31_ipq5332_regs[] = {
{ {
USB_PHY_CFG0, USB_PHY_CFG0,
@ -241,7 +285,7 @@ static int m31usb_phy_probe(struct platform_device *pdev)
qphy->clk = devm_clk_get(dev, NULL); qphy->clk = devm_clk_get(dev, NULL);
if (IS_ERR(qphy->clk)) if (IS_ERR(qphy->clk))
return dev_err_probe(dev, PTR_ERR(qphy->clk), return dev_err_probe(dev, PTR_ERR(qphy->clk),
"failed to get clk\n"); "failed to get clk\n");
data = of_device_get_match_data(dev); data = of_device_get_match_data(dev);
qphy->regs = data->regs; qphy->regs = data->regs;
@ -251,12 +295,12 @@ static int m31usb_phy_probe(struct platform_device *pdev)
qphy->phy = devm_phy_create(dev, NULL, &m31usb_phy_gen_ops); qphy->phy = devm_phy_create(dev, NULL, &m31usb_phy_gen_ops);
if (IS_ERR(qphy->phy)) if (IS_ERR(qphy->phy))
return dev_err_probe(dev, PTR_ERR(qphy->phy), return dev_err_probe(dev, PTR_ERR(qphy->phy),
"failed to create phy\n"); "failed to create phy\n");
qphy->vreg = devm_regulator_get(dev, "vdda-phy"); qphy->vreg = devm_regulator_get(dev, "vdda-phy");
if (IS_ERR(qphy->vreg)) if (IS_ERR(qphy->vreg))
return dev_err_probe(dev, PTR_ERR(qphy->vreg), return dev_err_probe(dev, PTR_ERR(qphy->phy),
"failed to get vreg\n"); "failed to get vreg\n");
phy_set_drvdata(qphy->phy, qphy); phy_set_drvdata(qphy->phy, qphy);
@ -267,6 +311,12 @@ static int m31usb_phy_probe(struct platform_device *pdev)
return PTR_ERR_OR_ZERO(phy_provider); return PTR_ERR_OR_ZERO(phy_provider);
} }
static const struct m31_priv_data m31_ipq5018_data = {
.ulpi_mode = false,
.regs = m31_ipq5018_regs,
.nregs = ARRAY_SIZE(m31_ipq5018_regs),
};
static const struct m31_priv_data m31_ipq5332_data = { static const struct m31_priv_data m31_ipq5332_data = {
.ulpi_mode = false, .ulpi_mode = false,
.regs = m31_ipq5332_regs, .regs = m31_ipq5332_regs,
@ -274,6 +324,7 @@ static const struct m31_priv_data m31_ipq5332_data = {
}; };
static const struct of_device_id m31usb_phy_id_table[] = { static const struct of_device_id m31usb_phy_id_table[] = {
{ .compatible = "qcom,ipq5018-usb-hsphy", .data = &m31_ipq5018_data },
{ .compatible = "qcom,ipq5332-usb-hsphy", .data = &m31_ipq5332_data }, { .compatible = "qcom,ipq5332-usb-hsphy", .data = &m31_ipq5332_data },
{ }, { },
}; };

View File

@ -194,14 +194,14 @@ static const unsigned int qmp_v5_5nm_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
}; };
static const unsigned int qmp_v6_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { static const unsigned int qmp_v6_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = QPHY_V5_PCS_SW_RESET, [QPHY_SW_RESET] = QPHY_V6_PCS_SW_RESET,
[QPHY_START_CTRL] = QPHY_V5_PCS_START_CONTROL, [QPHY_START_CTRL] = QPHY_V6_PCS_START_CONTROL,
[QPHY_PCS_STATUS] = QPHY_V5_PCS_PCS_STATUS1, [QPHY_PCS_STATUS] = QPHY_V6_PCS_PCS_STATUS1,
[QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V5_PCS_POWER_DOWN_CONTROL, [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V6_PCS_POWER_DOWN_CONTROL,
/* In PCS_USB */ /* In PCS_USB */
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V5_PCS_USB3_AUTONOMOUS_MODE_CTRL, [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V6_PCS_USB3_AUTONOMOUS_MODE_CTRL,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V5_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V6_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR,
[QPHY_COM_RESETSM_CNTRL] = QSERDES_V6_COM_RESETSM_CNTRL, [QPHY_COM_RESETSM_CNTRL] = QSERDES_V6_COM_RESETSM_CNTRL,
[QPHY_COM_C_READY_STATUS] = QSERDES_V6_COM_C_READY_STATUS, [QPHY_COM_C_READY_STATUS] = QSERDES_V6_COM_C_READY_STATUS,
@ -845,28 +845,28 @@ static const struct qmp_phy_init_tbl sm8550_usb3_rx_tbl[] = {
}; };
static const struct qmp_phy_init_tbl sm8550_usb3_pcs_tbl[] = { 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_V6_PCS_LOCK_DETECT_CONFIG1, 0xc4),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG2, 0x89), QMP_PHY_INIT_CFG(QPHY_V6_PCS_LOCK_DETECT_CONFIG2, 0x89),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3, 0x20), QMP_PHY_INIT_CFG(QPHY_V6_PCS_LOCK_DETECT_CONFIG3, 0x20),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6, 0x13), QMP_PHY_INIT_CFG(QPHY_V6_PCS_LOCK_DETECT_CONFIG6, 0x13),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1, 0x21), QMP_PHY_INIT_CFG(QPHY_V6_PCS_REFGEN_REQ_CONFIG1, 0x21),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_RX_SIGDET_LVL, 0x99), QMP_PHY_INIT_CFG(QPHY_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_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_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_V6_PCS_CDR_RESET_TIME, 0x0a),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG1, 0x88), QMP_PHY_INIT_CFG(QPHY_V6_PCS_ALIGN_DETECT_CONFIG1, 0x88),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_ALIGN_DETECT_CONFIG2, 0x13), QMP_PHY_INIT_CFG(QPHY_V6_PCS_ALIGN_DETECT_CONFIG2, 0x13),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG, 0x0c), QMP_PHY_INIT_CFG(QPHY_V6_PCS_PCS_TX_RX_CONFIG, 0x0c),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG1, 0x4b), QMP_PHY_INIT_CFG(QPHY_V6_PCS_EQ_CONFIG1, 0x4b),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG5, 0x10), QMP_PHY_INIT_CFG(QPHY_V6_PCS_EQ_CONFIG5, 0x10),
}; };
static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = {
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), QMP_PHY_INIT_CFG(QPHY_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), QMP_PHY_INIT_CFG(QPHY_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), QMP_PHY_INIT_CFG(QPHY_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), QMP_PHY_INIT_CFG(QPHY_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H, 0x00),
QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H, 0x00), QMP_PHY_INIT_CFG(QPHY_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68),
}; };
static const struct qmp_phy_init_tbl qmp_v4_dp_serdes_tbl[] = { static const struct qmp_phy_init_tbl qmp_v4_dp_serdes_tbl[] = {

View File

@ -2147,6 +2147,34 @@ static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x4_pcie_rc_serdes_alt_tbl[]
QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34), QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34),
}; };
static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_ep_serdes_alt_tbl[] = {
QMP_PHY_INIT_CFG(QSERDES_V5_COM_BG_TIMER, 0x02),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYS_CLK_CTRL, 0x07),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x27),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x17),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x19),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x03),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE0, 0xfb),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE0, 0x01),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE1, 0xfb),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE1, 0x01),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE, 0x14),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0xff),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x04),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0xff),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x09),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x19),
QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x28),
};
static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_ep_pcs_alt_tbl[] = {
QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_INSIG_MX_CTRL7, 0x00),
QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_INSIG_SW_CTRL7, 0x00),
};
struct qmp_pcie_offsets { struct qmp_pcie_offsets {
u16 serdes; u16 serdes;
u16 pcs; u16 pcs;
@ -3043,6 +3071,15 @@ static const struct qmp_phy_cfg sa8775p_qmp_gen4x2_pciephy_cfg = {
.pcs_misc_num = ARRAY_SIZE(sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl), .pcs_misc_num = ARRAY_SIZE(sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl),
}, },
.tbls_ep = &(const struct qmp_phy_cfg_tbls) {
.serdes = sa8775p_qmp_gen4x2_pcie_ep_serdes_alt_tbl,
.serdes_num = ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_ep_serdes_alt_tbl),
.pcs_misc = sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl,
.pcs_misc_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl),
.pcs = sa8775p_qmp_gen4x2_pcie_ep_pcs_alt_tbl,
.pcs_num = ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_ep_pcs_alt_tbl),
},
.reset_list = sdm845_pciephy_reset_l, .reset_list = sdm845_pciephy_reset_l,
.num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,

View File

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
*/
#ifndef QCOM_PHY_QMP_PCS_MISC_V4_H_
#define QCOM_PHY_QMP_PCS_MISC_V4_H_
/* Only for QMP V4 PHY - PCS_MISC registers */
#define QPHY_V4_PCS_MISC_TYPEC_CTRL 0x00
#define QPHY_V4_PCS_MISC_TYPEC_PWRDN_CTRL 0x04
#define QPHY_V4_PCS_MISC_PCS_MISC_CONFIG1 0x08
#define QPHY_V4_PCS_MISC_CLAMP_ENABLE 0x0c
#define QPHY_V4_PCS_MISC_TYPEC_STATUS 0x10
#define QPHY_V4_PCS_MISC_PLACEHOLDER_STATUS 0x14
#endif

View File

@ -6,27 +6,12 @@
#ifndef QCOM_PHY_QMP_PCS_USB_V6_H_ #ifndef QCOM_PHY_QMP_PCS_USB_V6_H_
#define 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_V6_PCS_USB3_POWER_STATE_CONFIG1 0x00
#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG1 0xc4 #define QPHY_V6_PCS_USB3_AUTONOMOUS_MODE_CTRL 0x08
#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG2 0xc8 #define QPHY_V6_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR 0x14
#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 0xcc #define QPHY_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18
#define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 0xd8 #define QPHY_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c
#define QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 0xdc #define QPHY_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40
#define QPHY_USB_V6_PCS_POWER_STATE_CONFIG1 0x90 #define QPHY_V6_PCS_USB3_RCVR_DTCT_DLY_U3_H 0x44
#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_POWER_STATE_CONFIG1 0x00
#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 #endif

View File

@ -6,6 +6,8 @@
#ifndef QCOM_PHY_QMP_PCS_V5_20_H_ #ifndef QCOM_PHY_QMP_PCS_V5_20_H_
#define QCOM_PHY_QMP_PCS_V5_20_H_ #define QCOM_PHY_QMP_PCS_V5_20_H_
#define QPHY_V5_20_PCS_INSIG_SW_CTRL7 0x060
#define QPHY_V5_20_PCS_INSIG_MX_CTRL7 0x07c
#define QPHY_V5_20_PCS_G3S2_PRE_GAIN 0x170 #define QPHY_V5_20_PCS_G3S2_PRE_GAIN 0x170
#define QPHY_V5_20_PCS_RX_SIGDET_LVL 0x188 #define QPHY_V5_20_PCS_RX_SIGDET_LVL 0x188
#define QPHY_V5_20_PCS_EQ_CONFIG2 0x1d8 #define QPHY_V5_20_PCS_EQ_CONFIG2 0x1d8

View File

@ -7,10 +7,26 @@
#define QCOM_PHY_QMP_PCS_V6_H_ #define QCOM_PHY_QMP_PCS_V6_H_
/* Only for QMP V6 PHY - USB/PCIe PCS registers */ /* Only for QMP V6 PHY - USB/PCIe PCS registers */
#define QPHY_V6_PCS_REFGEN_REQ_CONFIG1 0xdc #define QPHY_V6_PCS_SW_RESET 0x000
#define QPHY_V6_PCS_PCS_STATUS1 0x014
#define QPHY_V6_PCS_POWER_DOWN_CONTROL 0x040
#define QPHY_V6_PCS_START_CONTROL 0x044
#define QPHY_V6_PCS_POWER_STATE_CONFIG1 0x090
#define QPHY_V6_PCS_LOCK_DETECT_CONFIG1 0x0c4
#define QPHY_V6_PCS_LOCK_DETECT_CONFIG2 0x0c8
#define QPHY_V6_PCS_LOCK_DETECT_CONFIG3 0x0cc
#define QPHY_V6_PCS_LOCK_DETECT_CONFIG6 0x0d8
#define QPHY_V6_PCS_REFGEN_REQ_CONFIG1 0x0dc
#define QPHY_V6_PCS_RX_SIGDET_LVL 0x188 #define QPHY_V6_PCS_RX_SIGDET_LVL 0x188
#define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190
#define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194
#define QPHY_V6_PCS_RATE_SLEW_CNTRL1 0x198 #define QPHY_V6_PCS_RATE_SLEW_CNTRL1 0x198
#define QPHY_V6_PCS_EQ_CONFIG2 0x1e0 #define QPHY_V6_PCS_CDR_RESET_TIME 0x1b0
#define QPHY_V6_PCS_ALIGN_DETECT_CONFIG1 0x1c0
#define QPHY_V6_PCS_ALIGN_DETECT_CONFIG2 0x1c4
#define QPHY_V6_PCS_PCS_TX_RX_CONFIG 0x1d0 #define QPHY_V6_PCS_PCS_TX_RX_CONFIG 0x1d0
#define QPHY_V6_PCS_EQ_CONFIG1 0x1dc
#define QPHY_V6_PCS_EQ_CONFIG2 0x1e0
#define QPHY_V6_PCS_EQ_CONFIG5 0x1ec
#endif #endif

View File

@ -177,6 +177,111 @@ static const struct qmp_phy_init_tbl msm8996_ufsphy_rx[] = {
QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0E), QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0E),
}; };
static const struct qmp_phy_init_tbl sc7280_ufsphy_tx[] = {
QMP_PHY_INIT_CFG(QSERDES_V4_TX_PWM_GEAR_1_DIVIDER_BAND0_1, 0x06),
QMP_PHY_INIT_CFG(QSERDES_V4_TX_PWM_GEAR_2_DIVIDER_BAND0_1, 0x03),
QMP_PHY_INIT_CFG(QSERDES_V4_TX_PWM_GEAR_3_DIVIDER_BAND0_1, 0x01),
QMP_PHY_INIT_CFG(QSERDES_V4_TX_PWM_GEAR_4_DIVIDER_BAND0_1, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x35),
QMP_PHY_INIT_CFG(QSERDES_V4_TX_TRAN_DRVR_EMP_EN, 0x0c),
};
static const struct qmp_phy_init_tbl sc7280_ufsphy_rx[] = {
QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_LVL, 0x24),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x0f),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x1e),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_BAND, 0x18),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x5a),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0xf1),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0x80),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CTRL2, 0x80),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0e),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x04),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_TERM_BW, 0x1b),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x06),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1d),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_MEASURE_TIME, 0x10),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x6d),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x6d),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xed),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x3b),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x3c),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0xe0),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xc8),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xc8),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x3b),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb1),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xe0),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0xc8),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xc8),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x3b),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c),
};
static const struct qmp_phy_init_tbl sc7280_ufsphy_pcs[] = {
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_RX_SIGDET_CTRL2, 0x6d),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_LARGE_AMP_DRV_LVL, 0x0a),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_SMALL_AMP_DRV_LVL, 0x02),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_MID_TERM_CTRL1, 0x43),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_DEBUG_BUS_CLKSEL, 0x1f),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_RX_MIN_HIBERN8_TIME, 0xff),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_MULTI_LANE_CTRL1, 0x02),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_PLL_CNTL, 0x03),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TIMER_20US_CORECLK_STEPS_MSB, 0x16),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TIMER_20US_CORECLK_STEPS_LSB, 0xd8),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_PWM_GEAR_BAND, 0xaa),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_HS_GEAR_BAND, 0x06),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_HSGEAR_CAPABILITY, 0x03),
QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_RX_HSGEAR_CAPABILITY, 0x03),
};
static const struct qmp_phy_init_tbl sc7280_ufsphy_hs_g4_rx[] = {
QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_LVL, 0x24),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x0f),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x1e),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_BAND, 0x18),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x0a),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x5a),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0xf1),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0x80),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CTRL2, 0x81),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0e),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x04),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_TERM_BW, 0x6f),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x04),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x09),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x07),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x00),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_MEASURE_TIME, 0x20),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0x80),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x01),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x3f),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x2c),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x6d),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x6d),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xed),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x3b),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x3c),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xe0),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0xc8),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xc8),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x3b),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c),
QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x0f),
};
static const struct qmp_phy_init_tbl sm6115_ufsphy_serdes[] = { static const struct qmp_phy_init_tbl sm6115_ufsphy_serdes[] = {
QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x0e), QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x0e),
QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x14), QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x14),
@ -888,6 +993,40 @@ static const struct qmp_phy_cfg sa8775p_ufsphy_cfg = {
.regs = ufsphy_v5_regs_layout, .regs = ufsphy_v5_regs_layout,
}; };
static const struct qmp_phy_cfg sc7280_ufsphy_cfg = {
.lanes = 2,
.offsets = &qmp_ufs_offsets,
.tbls = {
.serdes = sm8150_ufsphy_serdes,
.serdes_num = ARRAY_SIZE(sm8150_ufsphy_serdes),
.tx = sc7280_ufsphy_tx,
.tx_num = ARRAY_SIZE(sc7280_ufsphy_tx),
.rx = sc7280_ufsphy_rx,
.rx_num = ARRAY_SIZE(sc7280_ufsphy_rx),
.pcs = sc7280_ufsphy_pcs,
.pcs_num = ARRAY_SIZE(sc7280_ufsphy_pcs),
},
.tbls_hs_b = {
.serdes = sm8150_ufsphy_hs_b_serdes,
.serdes_num = ARRAY_SIZE(sm8150_ufsphy_hs_b_serdes),
},
.tbls_hs_g4 = {
.tx = sm8250_ufsphy_hs_g4_tx,
.tx_num = ARRAY_SIZE(sm8250_ufsphy_hs_g4_tx),
.rx = sc7280_ufsphy_hs_g4_rx,
.rx_num = ARRAY_SIZE(sc7280_ufsphy_hs_g4_rx),
.pcs = sm8150_ufsphy_hs_g4_pcs,
.pcs_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_pcs),
},
.clk_list = sm8450_ufs_phy_clk_l,
.num_clks = ARRAY_SIZE(sm8450_ufs_phy_clk_l),
.vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = ufsphy_v4_regs_layout,
};
static const struct qmp_phy_cfg sc8280xp_ufsphy_cfg = { static const struct qmp_phy_cfg sc8280xp_ufsphy_cfg = {
.lanes = 2, .lanes = 2,
@ -1648,6 +1787,9 @@ static const struct of_device_id qmp_ufs_of_match_table[] = {
}, { }, {
.compatible = "qcom,sa8775p-qmp-ufs-phy", .compatible = "qcom,sa8775p-qmp-ufs-phy",
.data = &sa8775p_ufsphy_cfg, .data = &sa8775p_ufsphy_cfg,
}, {
.compatible = "qcom,sc7280-qmp-ufs-phy",
.data = &sc7280_ufsphy_cfg,
}, { }, {
.compatible = "qcom,sc8180x-qmp-ufs-phy", .compatible = "qcom,sc8180x-qmp-ufs-phy",
.data = &sm8150_ufsphy_cfg, .data = &sm8150_ufsphy_cfg,

View File

@ -21,6 +21,7 @@
#include "phy-qcom-qmp.h" #include "phy-qcom-qmp.h"
#include "phy-qcom-qmp-pcs-misc-v3.h" #include "phy-qcom-qmp-pcs-misc-v3.h"
#include "phy-qcom-qmp-pcs-misc-v4.h"
#include "phy-qcom-qmp-pcs-usb-v4.h" #include "phy-qcom-qmp-pcs-usb-v4.h"
#include "phy-qcom-qmp-pcs-usb-v5.h" #include "phy-qcom-qmp-pcs-usb-v5.h"
@ -94,6 +95,7 @@ enum qphy_reg_layout {
QPHY_PCS_AUTONOMOUS_MODE_CTRL, QPHY_PCS_AUTONOMOUS_MODE_CTRL,
QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR, QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR,
QPHY_PCS_POWER_DOWN_CONTROL, QPHY_PCS_POWER_DOWN_CONTROL,
QPHY_PCS_MISC_CLAMP_ENABLE,
/* 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
}; };
@ -114,6 +116,16 @@ static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V3_PCS_AUTONOMOUS_MODE_CTRL, [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V3_PCS_AUTONOMOUS_MODE_CTRL,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V3_PCS_LFPS_RXTERM_IRQ_CLEAR, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V3_PCS_LFPS_RXTERM_IRQ_CLEAR,
[QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V3_PCS_POWER_DOWN_CONTROL, [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V3_PCS_POWER_DOWN_CONTROL,
[QPHY_PCS_MISC_CLAMP_ENABLE] = QPHY_V3_PCS_MISC_CLAMP_ENABLE,
};
static const unsigned int qmp_v3_usb3phy_regs_layout_qcm2290[QPHY_LAYOUT_SIZE] = {
[QPHY_SW_RESET] = QPHY_V3_PCS_SW_RESET,
[QPHY_START_CTRL] = QPHY_V3_PCS_START_CONTROL,
[QPHY_PCS_STATUS] = QPHY_V3_PCS_PCS_STATUS,
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V3_PCS_AUTONOMOUS_MODE_CTRL,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V3_PCS_LFPS_RXTERM_IRQ_CLEAR,
[QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V3_PCS_POWER_DOWN_CONTROL,
}; };
static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
@ -125,6 +137,7 @@ static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
/* In PCS_USB */ /* In PCS_USB */
[QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL, [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL,
[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR, [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR,
[QPHY_PCS_MISC_CLAMP_ENABLE] = QPHY_V4_PCS_MISC_CLAMP_ENABLE,
}; };
static const unsigned int qmp_v5_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { static const unsigned int qmp_v5_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
@ -1178,12 +1191,6 @@ struct qmp_phy_cfg {
const struct qmp_phy_init_tbl *pcs_usb_tbl; const struct qmp_phy_init_tbl *pcs_usb_tbl;
int pcs_usb_tbl_num; int pcs_usb_tbl_num;
/* clock ids to be requested */
const char * const *clk_list;
int num_clks;
/* resets to be requested */
const char * const *reset_list;
int num_resets;
/* regulators to be requested */ /* regulators to be requested */
const char * const *vreg_list; const char * const *vreg_list;
int num_vregs; int num_vregs;
@ -1214,6 +1221,8 @@ struct qmp_usb {
struct clk *pipe_clk; struct clk *pipe_clk;
struct clk_bulk_data *clks; struct clk_bulk_data *clks;
int num_clks;
int num_resets;
struct reset_control_bulk_data *resets; struct reset_control_bulk_data *resets;
struct regulator_bulk_data *vregs; struct regulator_bulk_data *vregs;
@ -1249,37 +1258,16 @@ static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val)
} }
/* list of clocks required by phy */ /* list of clocks required by phy */
static const char * const msm8996_phy_clk_l[] = { static const char * const qmp_usb_phy_clk_l[] = {
"aux", "cfg_ahb", "ref",
};
static const char * const qmp_v3_phy_clk_l[] = {
"aux", "cfg_ahb", "ref", "com_aux", "aux", "cfg_ahb", "ref", "com_aux",
}; };
static const char * const qmp_v4_phy_clk_l[] = {
"aux", "ref", "com_aux",
};
static const char * const qmp_v4_ref_phy_clk_l[] = {
"aux", "ref_clk_src", "ref", "com_aux",
};
/* usb3 phy on sdx55 doesn't have com_aux clock */
static const char * const qmp_v4_sdx55_usbphy_clk_l[] = {
"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_usb3phy_reset_l[] = { static const char * const usb3phy_legacy_reset_l[] = {
"phy", "common", "phy", "common",
}; };
static const char * const qcm2290_usb3phy_reset_l[] = { static const char * const usb3phy_reset_l[] = {
"phy_phy", "phy", "phy_phy", "phy",
}; };
@ -1298,6 +1286,13 @@ static const struct qmp_usb_offsets qmp_usb_offsets_ipq9574 = {
static const struct qmp_usb_offsets qmp_usb_offsets_v3 = { static const struct qmp_usb_offsets qmp_usb_offsets_v3 = {
.serdes = 0, .serdes = 0,
.pcs = 0x600,
.tx = 0x200,
.rx = 0x400,
};
static const struct qmp_usb_offsets qmp_usb_offsets_v3_qcm2290 = {
.serdes = 0x0,
.pcs = 0xc00, .pcs = 0xc00,
.pcs_misc = 0xa00, .pcs_misc = 0xa00,
.tx = 0x200, .tx = 0x200,
@ -1306,6 +1301,14 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v3 = {
.rx2 = 0x800, .rx2 = 0x800,
}; };
static const struct qmp_usb_offsets qmp_usb_offsets_v4 = {
.serdes = 0,
.pcs = 0x0800,
.pcs_usb = 0x0e00,
.tx = 0x0200,
.rx = 0x0400,
};
static const struct qmp_usb_offsets qmp_usb_offsets_v5 = { static const struct qmp_usb_offsets qmp_usb_offsets_v5 = {
.serdes = 0, .serdes = 0,
.pcs = 0x0200, .pcs = 0x0200,
@ -1317,6 +1320,8 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v5 = {
static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = { static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v3,
.serdes_tbl = ipq8074_usb3_serdes_tbl, .serdes_tbl = ipq8074_usb3_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(ipq8074_usb3_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(ipq8074_usb3_serdes_tbl),
.tx_tbl = msm8996_usb3_tx_tbl, .tx_tbl = msm8996_usb3_tx_tbl,
@ -1325,10 +1330,6 @@ static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
.rx_tbl_num = ARRAY_SIZE(ipq8074_usb3_rx_tbl), .rx_tbl_num = ARRAY_SIZE(ipq8074_usb3_rx_tbl),
.pcs_tbl = ipq8074_usb3_pcs_tbl, .pcs_tbl = ipq8074_usb3_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(ipq8074_usb3_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(ipq8074_usb3_pcs_tbl),
.clk_list = msm8996_phy_clk_l,
.num_clks = ARRAY_SIZE(msm8996_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v3_usb3phy_regs_layout, .regs = qmp_v3_usb3phy_regs_layout,
@ -1347,10 +1348,6 @@ static const struct qmp_phy_cfg ipq9574_usb3phy_cfg = {
.rx_tbl_num = ARRAY_SIZE(ipq9574_usb3_rx_tbl), .rx_tbl_num = ARRAY_SIZE(ipq9574_usb3_rx_tbl),
.pcs_tbl = ipq9574_usb3_pcs_tbl, .pcs_tbl = ipq9574_usb3_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(ipq9574_usb3_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(ipq9574_usb3_pcs_tbl),
.clk_list = msm8996_phy_clk_l,
.num_clks = ARRAY_SIZE(msm8996_phy_clk_l),
.reset_list = qcm2290_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(qcm2290_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v3_usb3phy_regs_layout, .regs = qmp_v3_usb3phy_regs_layout,
@ -1359,6 +1356,8 @@ static const struct qmp_phy_cfg ipq9574_usb3phy_cfg = {
static const struct qmp_phy_cfg msm8996_usb3phy_cfg = { static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v3,
.serdes_tbl = msm8996_usb3_serdes_tbl, .serdes_tbl = msm8996_usb3_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(msm8996_usb3_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(msm8996_usb3_serdes_tbl),
.tx_tbl = msm8996_usb3_tx_tbl, .tx_tbl = msm8996_usb3_tx_tbl,
@ -1367,10 +1366,6 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
.rx_tbl_num = ARRAY_SIZE(msm8996_usb3_rx_tbl), .rx_tbl_num = ARRAY_SIZE(msm8996_usb3_rx_tbl),
.pcs_tbl = msm8996_usb3_pcs_tbl, .pcs_tbl = msm8996_usb3_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(msm8996_usb3_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(msm8996_usb3_pcs_tbl),
.clk_list = msm8996_phy_clk_l,
.num_clks = ARRAY_SIZE(msm8996_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v2_usb3phy_regs_layout, .regs = qmp_v2_usb3phy_regs_layout,
@ -1391,10 +1386,6 @@ static const struct qmp_phy_cfg sa8775p_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sa8775p_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sa8775p_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_phy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
.reset_list = qcm2290_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(qcm2290_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v5_usb3phy_regs_layout, .regs = qmp_v5_usb3phy_regs_layout,
@ -1415,10 +1406,6 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sc8280xp_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sc8280xp_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_phy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l),
.reset_list = qcm2290_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(qcm2290_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v5_usb3phy_regs_layout, .regs = qmp_v5_usb3phy_regs_layout,
@ -1427,6 +1414,8 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = { static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v3,
.serdes_tbl = qmp_v3_usb3_uniphy_serdes_tbl, .serdes_tbl = qmp_v3_usb3_uniphy_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_uniphy_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_uniphy_serdes_tbl),
.tx_tbl = qmp_v3_usb3_uniphy_tx_tbl, .tx_tbl = qmp_v3_usb3_uniphy_tx_tbl,
@ -1435,10 +1424,6 @@ static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
.rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_uniphy_rx_tbl), .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_uniphy_rx_tbl),
.pcs_tbl = qmp_v3_usb3_uniphy_pcs_tbl, .pcs_tbl = qmp_v3_usb3_uniphy_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_uniphy_pcs_tbl),
.clk_list = qmp_v3_phy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v3_usb3phy_regs_layout, .regs = qmp_v3_usb3phy_regs_layout,
@ -1449,6 +1434,8 @@ static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg msm8998_usb3phy_cfg = { static const struct qmp_phy_cfg msm8998_usb3phy_cfg = {
.lanes = 2, .lanes = 2,
.offsets = &qmp_usb_offsets_v3_qcm2290,
.serdes_tbl = msm8998_usb3_serdes_tbl, .serdes_tbl = msm8998_usb3_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(msm8998_usb3_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(msm8998_usb3_serdes_tbl),
.tx_tbl = msm8998_usb3_tx_tbl, .tx_tbl = msm8998_usb3_tx_tbl,
@ -1457,10 +1444,6 @@ static const struct qmp_phy_cfg msm8998_usb3phy_cfg = {
.rx_tbl_num = ARRAY_SIZE(msm8998_usb3_rx_tbl), .rx_tbl_num = ARRAY_SIZE(msm8998_usb3_rx_tbl),
.pcs_tbl = msm8998_usb3_pcs_tbl, .pcs_tbl = msm8998_usb3_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(msm8998_usb3_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(msm8998_usb3_pcs_tbl),
.clk_list = msm8996_phy_clk_l,
.num_clks = ARRAY_SIZE(msm8996_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v3_usb3phy_regs_layout, .regs = qmp_v3_usb3phy_regs_layout,
@ -1469,6 +1452,8 @@ static const struct qmp_phy_cfg msm8998_usb3phy_cfg = {
static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = { static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v4,
.serdes_tbl = sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl = sm8150_usb3_uniphy_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
.tx_tbl = sm8150_usb3_uniphy_tx_tbl, .tx_tbl = sm8150_usb3_uniphy_tx_tbl,
@ -1479,10 +1464,6 @@ static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sm8150_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sm8150_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_ref_phy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_ref_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v4_usb3phy_regs_layout, .regs = qmp_v4_usb3phy_regs_layout,
@ -1494,6 +1475,8 @@ static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = { static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v4,
.serdes_tbl = sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl = sm8150_usb3_uniphy_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
.tx_tbl = sm8250_usb3_uniphy_tx_tbl, .tx_tbl = sm8250_usb3_uniphy_tx_tbl,
@ -1504,10 +1487,6 @@ static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sm8250_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sm8250_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_ref_phy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_ref_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v4_usb3phy_regs_layout, .regs = qmp_v4_usb3phy_regs_layout,
@ -1519,6 +1498,8 @@ static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg = { static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v4,
.serdes_tbl = sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl = sm8150_usb3_uniphy_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
.tx_tbl = sdx55_usb3_uniphy_tx_tbl, .tx_tbl = sdx55_usb3_uniphy_tx_tbl,
@ -1529,10 +1510,6 @@ static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sm8250_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sm8250_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_sdx55_usbphy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_sdx55_usbphy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v4_usb3phy_regs_layout, .regs = qmp_v4_usb3phy_regs_layout,
@ -1544,6 +1521,8 @@ static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg = { static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v5,
.serdes_tbl = sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl = sm8150_usb3_uniphy_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
.tx_tbl = sdx65_usb3_uniphy_tx_tbl, .tx_tbl = sdx65_usb3_uniphy_tx_tbl,
@ -1554,10 +1533,6 @@ static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sm8350_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sm8350_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_sdx55_usbphy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_sdx55_usbphy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v5_usb3phy_regs_layout, .regs = qmp_v5_usb3phy_regs_layout,
@ -1569,6 +1544,8 @@ static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = { static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = {
.lanes = 1, .lanes = 1,
.offsets = &qmp_usb_offsets_v5,
.serdes_tbl = sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl = sm8150_usb3_uniphy_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl),
.tx_tbl = sm8350_usb3_uniphy_tx_tbl, .tx_tbl = sm8350_usb3_uniphy_tx_tbl,
@ -1579,10 +1556,6 @@ static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = {
.pcs_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_tbl), .pcs_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_tbl),
.pcs_usb_tbl = sm8350_usb3_uniphy_pcs_usb_tbl, .pcs_usb_tbl = sm8350_usb3_uniphy_pcs_usb_tbl,
.pcs_usb_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_usb_tbl), .pcs_usb_tbl_num = ARRAY_SIZE(sm8350_usb3_uniphy_pcs_usb_tbl),
.clk_list = qmp_v4_ref_phy_clk_l,
.num_clks = ARRAY_SIZE(qmp_v4_ref_phy_clk_l),
.reset_list = msm8996_usb3phy_reset_l,
.num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l),
.vreg_list = qmp_phy_vreg_l, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v5_usb3phy_regs_layout, .regs = qmp_v5_usb3phy_regs_layout,
@ -1594,7 +1567,7 @@ static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = {
static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = { static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = {
.lanes = 2, .lanes = 2,
.offsets = &qmp_usb_offsets_v3, .offsets = &qmp_usb_offsets_v3_qcm2290,
.serdes_tbl = qcm2290_usb3_serdes_tbl, .serdes_tbl = qcm2290_usb3_serdes_tbl,
.serdes_tbl_num = ARRAY_SIZE(qcm2290_usb3_serdes_tbl), .serdes_tbl_num = ARRAY_SIZE(qcm2290_usb3_serdes_tbl),
@ -1604,13 +1577,9 @@ static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = {
.rx_tbl_num = ARRAY_SIZE(qcm2290_usb3_rx_tbl), .rx_tbl_num = ARRAY_SIZE(qcm2290_usb3_rx_tbl),
.pcs_tbl = qcm2290_usb3_pcs_tbl, .pcs_tbl = qcm2290_usb3_pcs_tbl,
.pcs_tbl_num = ARRAY_SIZE(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, .vreg_list = qmp_phy_vreg_l,
.num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
.regs = qmp_v3_usb3phy_regs_layout, .regs = qmp_v3_usb3phy_regs_layout_qcm2290,
}; };
static void qmp_usb_configure_lane(void __iomem *base, static void qmp_usb_configure_lane(void __iomem *base,
@ -1664,19 +1633,19 @@ static int qmp_usb_init(struct phy *phy)
return ret; return ret;
} }
ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets); ret = reset_control_bulk_assert(qmp->num_resets, qmp->resets);
if (ret) { if (ret) {
dev_err(qmp->dev, "reset assert failed\n"); dev_err(qmp->dev, "reset assert failed\n");
goto err_disable_regulators; goto err_disable_regulators;
} }
ret = reset_control_bulk_deassert(cfg->num_resets, qmp->resets); ret = reset_control_bulk_deassert(qmp->num_resets, qmp->resets);
if (ret) { if (ret) {
dev_err(qmp->dev, "reset deassert failed\n"); dev_err(qmp->dev, "reset deassert failed\n");
goto err_disable_regulators; goto err_disable_regulators;
} }
ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks); ret = clk_bulk_prepare_enable(qmp->num_clks, qmp->clks);
if (ret) if (ret)
goto err_assert_reset; goto err_assert_reset;
@ -1685,7 +1654,7 @@ static int qmp_usb_init(struct phy *phy)
return 0; return 0;
err_assert_reset: err_assert_reset:
reset_control_bulk_assert(cfg->num_resets, qmp->resets); reset_control_bulk_assert(qmp->num_resets, qmp->resets);
err_disable_regulators: err_disable_regulators:
regulator_bulk_disable(cfg->num_vregs, qmp->vregs); regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
@ -1697,9 +1666,9 @@ static int qmp_usb_exit(struct phy *phy)
struct qmp_usb *qmp = phy_get_drvdata(phy); struct qmp_usb *qmp = phy_get_drvdata(phy);
const struct qmp_phy_cfg *cfg = qmp->cfg; const struct qmp_phy_cfg *cfg = qmp->cfg;
reset_control_bulk_assert(cfg->num_resets, qmp->resets); reset_control_bulk_assert(qmp->num_resets, qmp->resets);
clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); clk_bulk_disable_unprepare(qmp->num_clks, qmp->clks);
regulator_bulk_disable(cfg->num_vregs, qmp->vregs); regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
@ -1852,8 +1821,8 @@ static void qmp_usb_enable_autonomous_mode(struct qmp_usb *qmp)
qphy_setbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], intr_mask); qphy_setbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], intr_mask);
/* Enable i/o clamp_n for autonomous mode */ /* Enable i/o clamp_n for autonomous mode */
if (pcs_misc) if (pcs_misc && cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE])
qphy_clrbits(pcs_misc, QPHY_V3_PCS_MISC_CLAMP_ENABLE, CLAMP_EN); qphy_clrbits(pcs_misc, cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE], CLAMP_EN);
} }
static void qmp_usb_disable_autonomous_mode(struct qmp_usb *qmp) static void qmp_usb_disable_autonomous_mode(struct qmp_usb *qmp)
@ -1863,8 +1832,8 @@ static void qmp_usb_disable_autonomous_mode(struct qmp_usb *qmp)
void __iomem *pcs_misc = qmp->pcs_misc; void __iomem *pcs_misc = qmp->pcs_misc;
/* Disable i/o clamp_n on resume for normal mode */ /* Disable i/o clamp_n on resume for normal mode */
if (pcs_misc) if (pcs_misc && cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE])
qphy_setbits(pcs_misc, QPHY_V3_PCS_MISC_CLAMP_ENABLE, CLAMP_EN); qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_MISC_CLAMP_ENABLE], CLAMP_EN);
qphy_clrbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], qphy_clrbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL],
ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL | ALFPS_DTCT_EN); ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL | ALFPS_DTCT_EN);
@ -1877,7 +1846,6 @@ static void qmp_usb_disable_autonomous_mode(struct qmp_usb *qmp)
static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev) static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev)
{ {
struct qmp_usb *qmp = dev_get_drvdata(dev); struct qmp_usb *qmp = dev_get_drvdata(dev);
const struct qmp_phy_cfg *cfg = qmp->cfg;
dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode); dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode);
@ -1889,7 +1857,7 @@ static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev)
qmp_usb_enable_autonomous_mode(qmp); qmp_usb_enable_autonomous_mode(qmp);
clk_disable_unprepare(qmp->pipe_clk); clk_disable_unprepare(qmp->pipe_clk);
clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); clk_bulk_disable_unprepare(qmp->num_clks, qmp->clks);
return 0; return 0;
} }
@ -1897,7 +1865,6 @@ static int __maybe_unused qmp_usb_runtime_suspend(struct device *dev)
static int __maybe_unused qmp_usb_runtime_resume(struct device *dev) static int __maybe_unused qmp_usb_runtime_resume(struct device *dev)
{ {
struct qmp_usb *qmp = dev_get_drvdata(dev); struct qmp_usb *qmp = dev_get_drvdata(dev);
const struct qmp_phy_cfg *cfg = qmp->cfg;
int ret = 0; int ret = 0;
dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode); dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode);
@ -1907,14 +1874,14 @@ static int __maybe_unused qmp_usb_runtime_resume(struct device *dev)
return 0; return 0;
} }
ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks); ret = clk_bulk_prepare_enable(qmp->num_clks, qmp->clks);
if (ret) if (ret)
return ret; return ret;
ret = clk_prepare_enable(qmp->pipe_clk); ret = clk_prepare_enable(qmp->pipe_clk);
if (ret) { if (ret) {
dev_err(dev, "pipe_clk enable failed, err=%d\n", ret); dev_err(dev, "pipe_clk enable failed, err=%d\n", ret);
clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); clk_bulk_disable_unprepare(qmp->num_clks, qmp->clks);
return ret; return ret;
} }
@ -1945,22 +1912,25 @@ static int qmp_usb_vreg_init(struct qmp_usb *qmp)
return devm_regulator_bulk_get(dev, num, qmp->vregs); return devm_regulator_bulk_get(dev, num, qmp->vregs);
} }
static int qmp_usb_reset_init(struct qmp_usb *qmp) static int qmp_usb_reset_init(struct qmp_usb *qmp,
const char *const *reset_list,
int num_resets)
{ {
const struct qmp_phy_cfg *cfg = qmp->cfg;
struct device *dev = qmp->dev; struct device *dev = qmp->dev;
int i; int i;
int ret; int ret;
qmp->resets = devm_kcalloc(dev, cfg->num_resets, qmp->resets = devm_kcalloc(dev, num_resets,
sizeof(*qmp->resets), GFP_KERNEL); sizeof(*qmp->resets), GFP_KERNEL);
if (!qmp->resets) if (!qmp->resets)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < cfg->num_resets; i++) for (i = 0; i < num_resets; i++)
qmp->resets[i].id = cfg->reset_list[i]; qmp->resets[i].id = reset_list[i];
ret = devm_reset_control_bulk_get_exclusive(dev, cfg->num_resets, qmp->resets); qmp->num_resets = num_resets;
ret = devm_reset_control_bulk_get_exclusive(dev, num_resets, qmp->resets);
if (ret) if (ret)
return dev_err_probe(dev, ret, "failed to get resets\n"); return dev_err_probe(dev, ret, "failed to get resets\n");
@ -1969,9 +1939,8 @@ static int qmp_usb_reset_init(struct qmp_usb *qmp)
static int qmp_usb_clk_init(struct qmp_usb *qmp) static int qmp_usb_clk_init(struct qmp_usb *qmp)
{ {
const struct qmp_phy_cfg *cfg = qmp->cfg;
struct device *dev = qmp->dev; struct device *dev = qmp->dev;
int num = cfg->num_clks; int num = ARRAY_SIZE(qmp_usb_phy_clk_l);
int i; int i;
qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL);
@ -1979,9 +1948,11 @@ static int qmp_usb_clk_init(struct qmp_usb *qmp)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
qmp->clks[i].id = cfg->clk_list[i]; qmp->clks[i].id = qmp_usb_phy_clk_l[i];
return devm_clk_bulk_get(dev, num, qmp->clks); qmp->num_clks = num;
return devm_clk_bulk_get_optional(dev, num, qmp->clks);
} }
static void phy_clk_release_provider(void *res) static void phy_clk_release_provider(void *res)
@ -2061,6 +2032,7 @@ static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np)
const struct qmp_phy_cfg *cfg = qmp->cfg; const struct qmp_phy_cfg *cfg = qmp->cfg;
struct device *dev = qmp->dev; struct device *dev = qmp->dev;
bool exclusive = true; bool exclusive = true;
int ret;
qmp->serdes = devm_platform_ioremap_resource(pdev, 0); qmp->serdes = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(qmp->serdes)) if (IS_ERR(qmp->serdes))
@ -2121,6 +2093,17 @@ static int qmp_usb_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np)
"failed to get pipe clock\n"); "failed to get pipe clock\n");
} }
ret = devm_clk_bulk_get_all(qmp->dev, &qmp->clks);
if (ret < 0)
return ret;
qmp->num_clks = ret;
ret = qmp_usb_reset_init(qmp, usb3phy_legacy_reset_l,
ARRAY_SIZE(usb3phy_legacy_reset_l));
if (ret)
return ret;
return 0; return 0;
} }
@ -2131,6 +2114,7 @@ static int qmp_usb_parse_dt(struct qmp_usb *qmp)
const struct qmp_usb_offsets *offs = cfg->offsets; const struct qmp_usb_offsets *offs = cfg->offsets;
struct device *dev = qmp->dev; struct device *dev = qmp->dev;
void __iomem *base; void __iomem *base;
int ret;
if (!offs) if (!offs)
return -EINVAL; return -EINVAL;
@ -2141,8 +2125,10 @@ static int qmp_usb_parse_dt(struct qmp_usb *qmp)
qmp->serdes = base + offs->serdes; qmp->serdes = base + offs->serdes;
qmp->pcs = base + offs->pcs; qmp->pcs = base + offs->pcs;
qmp->pcs_misc = base + offs->pcs_misc; if (offs->pcs_usb)
qmp->pcs_usb = base + offs->pcs_usb; qmp->pcs_usb = base + offs->pcs_usb;
if (offs->pcs_misc)
qmp->pcs_misc = base + offs->pcs_misc;
qmp->tx = base + offs->tx; qmp->tx = base + offs->tx;
qmp->rx = base + offs->rx; qmp->rx = base + offs->rx;
@ -2151,12 +2137,21 @@ static int qmp_usb_parse_dt(struct qmp_usb *qmp)
qmp->rx2 = base + offs->rx2; qmp->rx2 = base + offs->rx2;
} }
ret = qmp_usb_clk_init(qmp);
if (ret)
return ret;
qmp->pipe_clk = devm_clk_get(dev, "pipe"); qmp->pipe_clk = devm_clk_get(dev, "pipe");
if (IS_ERR(qmp->pipe_clk)) { if (IS_ERR(qmp->pipe_clk)) {
return dev_err_probe(dev, PTR_ERR(qmp->pipe_clk), return dev_err_probe(dev, PTR_ERR(qmp->pipe_clk),
"failed to get pipe clock\n"); "failed to get pipe clock\n");
} }
ret = qmp_usb_reset_init(qmp, usb3phy_reset_l,
ARRAY_SIZE(usb3phy_reset_l));
if (ret)
return ret;
return 0; return 0;
} }
@ -2178,14 +2173,6 @@ static int qmp_usb_probe(struct platform_device *pdev)
if (!qmp->cfg) if (!qmp->cfg)
return -EINVAL; return -EINVAL;
ret = qmp_usb_clk_init(qmp);
if (ret)
return ret;
ret = qmp_usb_reset_init(qmp);
if (ret)
return ret;
ret = qmp_usb_vreg_init(qmp); ret = qmp_usb_vreg_init(qmp);
if (ret) if (ret)
return ret; return ret;

View File

@ -126,14 +126,6 @@
#define QSERDES_V4_DP_PHY_AUX_INTERRUPT_STATUS 0x0d8 #define QSERDES_V4_DP_PHY_AUX_INTERRUPT_STATUS 0x0d8
#define QSERDES_V4_DP_PHY_STATUS 0x0dc #define QSERDES_V4_DP_PHY_STATUS 0x0dc
/* Only for QMP V4 PHY - PCS_MISC registers */
#define QPHY_V4_PCS_MISC_TYPEC_CTRL 0x00
#define QPHY_V4_PCS_MISC_TYPEC_PWRDN_CTRL 0x04
#define QPHY_V4_PCS_MISC_PCS_MISC_CONFIG1 0x08
#define QPHY_V4_PCS_MISC_CLAMP_ENABLE 0x0c
#define QPHY_V4_PCS_MISC_TYPEC_STATUS 0x10
#define QPHY_V4_PCS_MISC_PLACEHOLDER_STATUS 0x14
#define QSERDES_V5_DP_PHY_STATUS 0x0dc #define QSERDES_V5_DP_PHY_STATUS 0x0dc
/* Only for QMP V6 PHY - DP PHY registers */ /* Only for QMP V6 PHY - DP PHY registers */

View File

@ -13,7 +13,7 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/of_platform.h> #include <linux/of.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>
@ -171,18 +171,13 @@ static int ralink_usb_phy_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
const struct of_device_id *match;
struct ralink_usb_phy *phy; struct ralink_usb_phy *phy;
match = of_match_device(ralink_usb_phy_of_match, &pdev->dev);
if (!match)
return -ENODEV;
phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
if (!phy) if (!phy)
return -ENOMEM; return -ENOMEM;
phy->clk = (uintptr_t)match->data; phy->clk = (uintptr_t)device_get_match_data(&pdev->dev);
phy->base = NULL; phy->base = NULL;
phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl"); phy->sysctl = syscon_regmap_lookup_by_phandle(dev->of_node, "ralink,sysctl");

View File

@ -8,8 +8,8 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/nvmem-consumer.h> #include <linux/nvmem-consumer.h>

View File

@ -8,8 +8,8 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/nvmem-consumer.h> #include <linux/nvmem-consumer.h>

View File

@ -214,6 +214,10 @@ static int r8a779f0_eth_serdes_hw_init(struct r8a779f0_eth_serdes_channel *chann
if (dd->initialized) if (dd->initialized)
return 0; return 0;
reset_control_reset(dd->reset);
usleep_range(1000, 2000);
ret = r8a779f0_eth_serdes_common_init_ram(dd); ret = r8a779f0_eth_serdes_common_init_ram(dd);
if (ret) if (ret)
return ret; return ret;
@ -257,6 +261,15 @@ static int r8a779f0_eth_serdes_init(struct phy *p)
return ret; return ret;
} }
static int r8a779f0_eth_serdes_exit(struct phy *p)
{
struct r8a779f0_eth_serdes_channel *channel = phy_get_drvdata(p);
channel->dd->initialized = false;
return 0;
}
static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel
*channel) *channel)
{ {
@ -314,6 +327,7 @@ static int r8a779f0_eth_serdes_set_speed(struct phy *p, int speed)
static const struct phy_ops r8a779f0_eth_serdes_ops = { static const struct phy_ops r8a779f0_eth_serdes_ops = {
.init = r8a779f0_eth_serdes_init, .init = r8a779f0_eth_serdes_init,
.exit = r8a779f0_eth_serdes_exit,
.power_on = r8a779f0_eth_serdes_power_on, .power_on = r8a779f0_eth_serdes_power_on,
.set_mode = r8a779f0_eth_serdes_set_mode, .set_mode = r8a779f0_eth_serdes_set_mode,
.set_speed = r8a779f0_eth_serdes_set_speed, .set_speed = r8a779f0_eth_serdes_set_speed,
@ -356,8 +370,6 @@ static int r8a779f0_eth_serdes_probe(struct platform_device *pdev)
if (IS_ERR(dd->reset)) if (IS_ERR(dd->reset))
return PTR_ERR(dd->reset); return PTR_ERR(dd->reset);
reset_control_reset(dd->reset);
for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) { for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) {
struct r8a779f0_eth_serdes_channel *channel = &dd->channel[i]; struct r8a779f0_eth_serdes_channel *channel = &dd->channel[i];

View File

@ -17,9 +17,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>

View File

@ -12,10 +12,9 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/reset.h> #include <linux/reset.h>
@ -63,7 +62,7 @@ struct rockchip_pcie_data {
}; };
struct rockchip_pcie_phy { struct rockchip_pcie_phy {
struct rockchip_pcie_data *phy_data; const struct rockchip_pcie_data *phy_data;
struct regmap *reg_base; struct regmap *reg_base;
struct phy_pcie_instance { struct phy_pcie_instance {
struct phy *phy; struct phy *phy;
@ -350,7 +349,6 @@ static int rockchip_pcie_phy_probe(struct platform_device *pdev)
struct rockchip_pcie_phy *rk_phy; struct rockchip_pcie_phy *rk_phy;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct regmap *grf; struct regmap *grf;
const struct of_device_id *of_id;
int i; int i;
u32 phy_num; u32 phy_num;
@ -364,11 +362,10 @@ static int rockchip_pcie_phy_probe(struct platform_device *pdev)
if (!rk_phy) if (!rk_phy)
return -ENOMEM; return -ENOMEM;
of_id = of_match_device(rockchip_pcie_phy_dt_ids, &pdev->dev); rk_phy->phy_data = device_get_match_data(&pdev->dev);
if (!of_id) if (!rk_phy->phy_data)
return -EINVAL; return -EINVAL;
rk_phy->phy_data = (struct rockchip_pcie_data *)of_id->data;
rk_phy->reg_base = grf; rk_phy->reg_base = grf;
mutex_init(&rk_phy->pcie_mutex); mutex_init(&rk_phy->pcie_mutex);

View File

@ -13,10 +13,9 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/regmap.h> #include <linux/regmap.h>
@ -458,7 +457,6 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct rockchip_usb_phy_base *phy_base; struct rockchip_usb_phy_base *phy_base;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
const struct of_device_id *match;
struct device_node *child; struct device_node *child;
int err; int err;
@ -466,14 +464,12 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
if (!phy_base) if (!phy_base)
return -ENOMEM; return -ENOMEM;
match = of_match_device(dev->driver->of_match_table, dev); phy_base->pdata = device_get_match_data(dev);
if (!match || !match->data) { if (!phy_base->pdata) {
dev_err(dev, "missing phy data\n"); dev_err(dev, "missing phy data\n");
return -EINVAL; return -EINVAL;
} }
phy_base->pdata = match->data;
phy_base->dev = dev; phy_base->dev = dev;
phy_base->reg_base = ERR_PTR(-ENODEV); phy_base->reg_base = ERR_PTR(-ENODEV);
if (dev->parent && dev->parent->of_node) if (dev->parent && dev->parent->of_node)

View File

@ -13,7 +13,6 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/of_platform.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
@ -161,7 +160,6 @@ static UNIVERSAL_DEV_PM_OPS(dm816x_usb_phy_pm_ops,
dm816x_usb_phy_runtime_resume, dm816x_usb_phy_runtime_resume,
NULL); NULL);
#ifdef CONFIG_OF
static const struct of_device_id dm816x_usb_phy_id_table[] = { static const struct of_device_id dm816x_usb_phy_id_table[] = {
{ {
.compatible = "ti,dm8168-usb-phy", .compatible = "ti,dm8168-usb-phy",
@ -169,7 +167,6 @@ static const struct of_device_id dm816x_usb_phy_id_table[] = {
{}, {},
}; };
MODULE_DEVICE_TABLE(of, dm816x_usb_phy_id_table); MODULE_DEVICE_TABLE(of, dm816x_usb_phy_id_table);
#endif
static int dm816x_usb_phy_probe(struct platform_device *pdev) static int dm816x_usb_phy_probe(struct platform_device *pdev)
{ {
@ -178,14 +175,8 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev)
struct phy *generic_phy; struct phy *generic_phy;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct usb_otg *otg; struct usb_otg *otg;
const struct of_device_id *of_id;
int error; int error;
of_id = of_match_device(of_match_ptr(dm816x_usb_phy_id_table),
&pdev->dev);
if (!of_id)
return -EINVAL;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) if (!phy)
return -ENOMEM; return -ENOMEM;
@ -272,7 +263,7 @@ static struct platform_driver dm816x_usb_phy_driver = {
.driver = { .driver = {
.name = "dm816x-usb-phy", .name = "dm816x-usb-phy",
.pm = &dm816x_usb_phy_pm_ops, .pm = &dm816x_usb_phy_pm_ops,
.of_match_table = of_match_ptr(dm816x_usb_phy_id_table), .of_match_table = dm816x_usb_phy_id_table,
}, },
}; };

View File

@ -8,9 +8,9 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk.h>
@ -268,20 +268,15 @@ MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
static int omap_control_phy_probe(struct platform_device *pdev) static int omap_control_phy_probe(struct platform_device *pdev)
{ {
const struct of_device_id *of_id;
struct omap_control_phy *control_phy; struct omap_control_phy *control_phy;
of_id = of_match_device(omap_control_phy_id_table, &pdev->dev);
if (!of_id)
return -EINVAL;
control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy), control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy),
GFP_KERNEL); GFP_KERNEL);
if (!control_phy) if (!control_phy)
return -ENOMEM; return -ENOMEM;
control_phy->dev = &pdev->dev; control_phy->dev = &pdev->dev;
control_phy->type = *(enum omap_control_phy_type *)of_id->data; control_phy->type = *(enum omap_control_phy_type *)device_get_match_data(&pdev->dev);
if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) { if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) {
control_phy->otghs_control = control_phy->otghs_control =

View File

@ -19,6 +19,7 @@
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sys_soc.h> #include <linux/sys_soc.h>
@ -371,16 +372,12 @@ static int omap_usb2_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct device_node *control_node; struct device_node *control_node;
struct platform_device *control_pdev; struct platform_device *control_pdev;
const struct of_device_id *of_id; const struct usb_phy_data *phy_data;
struct usb_phy_data *phy_data;
of_id = of_match_device(omap_usb2_id_table, &pdev->dev); phy_data = device_get_match_data(&pdev->dev);
if (!phy_data)
if (!of_id)
return -EINVAL; return -EINVAL;
phy_data = (struct usb_phy_data *)of_id->data;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) if (!phy)
return -ENOMEM; return -ENOMEM;

View File

@ -8,6 +8,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/of.h> #include <linux/of.h>
@ -778,23 +779,16 @@ static int ti_pipe3_probe(struct platform_device *pdev)
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret; int ret;
const struct of_device_id *match; const struct pipe3_data *data;
struct pipe3_data *data;
phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
if (!phy) if (!phy)
return -ENOMEM; return -ENOMEM;
match = of_match_device(ti_pipe3_id_table, dev); data = device_get_match_data(dev);
if (!match) if (!data)
return -EINVAL; return -EINVAL;
data = (struct pipe3_data *)match->data;
if (!data) {
dev_err(dev, "no driver data\n");
return -EINVAL;
}
phy->dev = dev; phy->dev = dev;
phy->mode = data->mode; phy->mode = data->mode;
phy->dpll_map = data->dpll_map; phy->dpll_map = data->dpll_map;