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

Merge tag 'phy-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy into usb-next

Kishon writes:

phy: for 5.8

*) Add new PHY driver to support Cadence SALVO PHY which supports USB3 & USB2
*) Add new PHY driver to support Intel ComboPhy which supports PCIe, SATA and
EMAC
*) Add new PHY driver for Qualcomm IPQ40xx USB PHY
*) Add new PHY driver for Synopsys FemtoPHY V2 driver used in Qualcomm SOCs
*) Add support for Qualcomm SM8250 UFS PHY and SM8150 QMP USB3 PHY in
qcom-qmp-phy driver
*) Add support for Amlogic USB2 PHY on Meson8m2 in phy-meson8b-usb2 driver
*) Add DisplayPort mode support in Wiz (TI Cadence PHY wrapper), to enable eDP
in TI's J721E SoC
*) Add support for super speed USB PHY in TI's AM654 SoC
*) Add fix in Broadcom Stingray USB PHY to get USB PHY PLL lock reliably
*) Add fix in Samsung phy-s5pv210-usb2 to get USB working on s5pv210
*) Add fix in Amlogic phy-meson8b-usb2 to get host only mode working on Meson8
*) Add fix in Cadence phy-cadence-sierra to get USB3 device disconnect issue
*) Convert meson8b-usb2-phy, qcom-qmp-phy, rcar-gen3-phy-usb2 and
rcar-gen3-phy-usb3 device tree binding to YAML schema
*) Minor fixes and cleanups in phy-cpcap-usb, j721e-wiz, omap-usb2,
phy-bcm-sr-usb, phy-brcm-usb PHY driver

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

* tag 'phy-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (43 commits)
phy: intel: Add driver support for ComboPhy
dt-bindings: phy: Add YAML schemas for Intel ComboPhy
dt-bindings: phy: Add PHY_TYPE_XPCS definition
phy: qcom-qmp: Add QMP V3 USB3 PHY support for SC7180
dt-bindings: phy: qcom,qmp-usb3-dp: Add support for SC7180
dt-bindings: phy: qcom,qmp-usb3-dp: Add dt bindings for USB3 DP PHY
dt-bindings: phy: qcom,qmp: Convert QMP PHY bindings to yaml
phy: cadence: sierra: Fix for USB3 U1/U2 state
phy: ti: am654: add support for USB super-speed
phy: ti: am654: show up in regmap debugfs
drivers: phy: sr-usb: do not use internal fsm for USB2 phy init
dt-bindings: phy: renesas: usb3-phy: add r8a77961 support
dt-bindings: phy: renesas: usb3-phy: convert bindings to json-schema
dt-bindings: phy: renesas: usb2-phy: add r8a77961 support
dt-bindings: phy: renesas: usb2-phy: convert bindings to json-schema
phy: qcom-qmp: Ensure register indirection arrays initialized
phy: omap-usb2: Clean up exported header
phy: phy-bcm-ns2-usbdrd: Constify phy_ops
phy: phy-brcm-usb: Constify static structs
phy: sr-usb: Constify phy_ops
...

+3228 -644
+64
Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: "http://devicetree.org/schemas/phy/amlogic,meson8b-usb2-phy.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: Amlogic Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY 8 + 9 + maintainers: 10 + - Martin Blumenstingl <martin.blumenstingl@googlemail.com> 11 + 12 + properties: 13 + compatible: 14 + oneOf: 15 + - items: 16 + - enum: 17 + - amlogic,meson8-usb2-phy 18 + - amlogic,meson8b-usb2-phy 19 + - amlogic,meson8m2-usb2-phy 20 + - const: amlogic,meson-mx-usb2-phy 21 + - const: amlogic,meson-gxbb-usb2-phy 22 + 23 + reg: 24 + maxItems: 1 25 + 26 + clocks: 27 + minItems: 2 28 + 29 + clock-names: 30 + items: 31 + - const: usb_general 32 + - const: usb 33 + 34 + resets: 35 + minItems: 1 36 + 37 + "#phy-cells": 38 + const: 0 39 + 40 + phy-supply: 41 + description: 42 + Phandle to a regulator that provides power to the PHY. This 43 + regulator will be managed during the PHY power on/off sequence. 44 + 45 + required: 46 + - compatible 47 + - reg 48 + - clocks 49 + - clock-names 50 + - "#phy-cells" 51 + 52 + additionalProperties: false 53 + 54 + examples: 55 + - | 56 + usb-phy@c0000000 { 57 + compatible = "amlogic,meson-gxbb-usb2-phy"; 58 + reg = <0xc0000000 0x20>; 59 + resets = <&reset_usb_phy>; 60 + clocks = <&clk_usb_general>, <&reset_usb>; 61 + clock-names = "usb_general", "usb"; 62 + phy-supply = <&usb_vbus>; 63 + #phy-cells = <0>; 64 + };
+52
Documentation/devicetree/bindings/phy/cdns,salvo-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + # Copyright (c) 2020 NXP 3 + %YAML 1.2 4 + --- 5 + $id: "http://devicetree.org/schemas/phy/cdns,salvo-phy.yaml#" 6 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 7 + 8 + title: Cadence SALVO PHY 9 + 10 + maintainers: 11 + - Peter Chen <peter.chen@nxp.com> 12 + 13 + properties: 14 + compatible: 15 + enum: 16 + - nxp,salvo-phy 17 + 18 + reg: 19 + maxItems: 1 20 + 21 + clocks: 22 + maxItems: 1 23 + 24 + clock-names: 25 + items: 26 + - const: salvo_phy_clk 27 + 28 + power-domains: 29 + maxItems: 1 30 + 31 + "#phy-cells": 32 + const: 0 33 + 34 + required: 35 + - compatible 36 + - reg 37 + - "#phy-cells" 38 + 39 + additionalProperties: false 40 + 41 + examples: 42 + - | 43 + #include <dt-bindings/firmware/imx/rsrc.h> 44 + 45 + usb3phy: usb3-phy@5b160000 { 46 + compatible = "nxp,salvo-phy"; 47 + reg = <0x5b160000 0x40000>; 48 + clocks = <&usb3_lpcg 4>; 49 + clock-names = "salvo_phy_clk"; 50 + power-domains = <&pd IMX_SC_R_USB_2_PHY>; 51 + #phy-cells = <0>; 52 + };
+101
Documentation/devicetree/bindings/phy/intel,combo-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/phy/intel,combo-phy.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Intel ComboPhy Subsystem 8 + 9 + maintainers: 10 + - Dilip Kota <eswara.kota@linux.intel.com> 11 + 12 + description: | 13 + Intel Combophy subsystem supports PHYs for PCIe, EMAC and SATA 14 + controllers. A single Combophy provides two PHY instances. 15 + 16 + properties: 17 + $nodename: 18 + pattern: "combophy(@.*|-[0-9a-f])*$" 19 + 20 + compatible: 21 + items: 22 + - const: intel,combophy-lgm 23 + - const: intel,combo-phy 24 + 25 + clocks: 26 + maxItems: 1 27 + 28 + reg: 29 + items: 30 + - description: ComboPhy core registers 31 + - description: PCIe app core control registers 32 + 33 + reg-names: 34 + items: 35 + - const: core 36 + - const: app 37 + 38 + resets: 39 + maxItems: 4 40 + 41 + reset-names: 42 + items: 43 + - const: phy 44 + - const: core 45 + - const: iphy0 46 + - const: iphy1 47 + 48 + intel,syscfg: 49 + $ref: /schemas/types.yaml#/definitions/phandle-array 50 + description: Chip configuration registers handle and ComboPhy instance id 51 + 52 + intel,hsio: 53 + $ref: /schemas/types.yaml#/definitions/phandle-array 54 + description: HSIO registers handle and ComboPhy instance id on NOC 55 + 56 + intel,aggregation: 57 + type: boolean 58 + description: | 59 + Specify the flag to configure ComboPHY in dual lane mode. 60 + 61 + intel,phy-mode: 62 + $ref: /schemas/types.yaml#/definitions/uint32 63 + description: | 64 + Mode of the two phys in ComboPhy. 65 + See dt-bindings/phy/phy.h for values. 66 + 67 + "#phy-cells": 68 + const: 1 69 + 70 + required: 71 + - compatible 72 + - clocks 73 + - reg 74 + - reg-names 75 + - intel,syscfg 76 + - intel,hsio 77 + - intel,phy-mode 78 + - "#phy-cells" 79 + 80 + additionalProperties: false 81 + 82 + examples: 83 + - | 84 + #include <dt-bindings/phy/phy.h> 85 + combophy@d0a00000 { 86 + compatible = "intel,combophy-lgm", "intel,combo-phy"; 87 + clocks = <&cgu0 1>; 88 + #phy-cells = <1>; 89 + reg = <0xd0a00000 0x40000>, 90 + <0xd0a40000 0x1000>; 91 + reg-names = "core", "app"; 92 + resets = <&rcu0 0x50 6>, 93 + <&rcu0 0x50 17>, 94 + <&rcu0 0x50 23>, 95 + <&rcu0 0x50 24>; 96 + reset-names = "phy", "core", "iphy0", "iphy1"; 97 + intel,syscfg = <&sysconf 0>; 98 + intel,hsio = <&hsiol 0>; 99 + intel,phy-mode = <PHY_TYPE_PCIE>; 100 + intel,aggregation; 101 + };
-28
Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt
··· 1 - * Amlogic Meson8, Meson8b and GXBB USB2 PHY 2 - 3 - Required properties: 4 - - compatible: Depending on the platform this should be one of: 5 - "amlogic,meson8-usb2-phy" 6 - "amlogic,meson8b-usb2-phy" 7 - "amlogic,meson-gxbb-usb2-phy" 8 - - reg: The base address and length of the registers 9 - - #phys-cells: should be 0 (see phy-bindings.txt in this directory) 10 - - clocks: phandle and clock identifier for the phy clocks 11 - - clock-names: "usb_general" and "usb" 12 - 13 - Optional properties: 14 - - resets: reference to the reset controller 15 - - phy-supply: see phy-bindings.txt in this directory 16 - 17 - 18 - Example: 19 - 20 - usb0_phy: usb-phy@c0000000 { 21 - compatible = "amlogic,meson-gxbb-usb2-phy"; 22 - #phy-cells = <0>; 23 - reg = <0x0 0xc0000000 0x0 0x20>; 24 - resets = <&reset RESET_USB_OTG>; 25 - clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>; 26 - clock-names = "usb_general", "usb"; 27 - phy-supply = <&usb_vbus>; 28 - };
+313
Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + 3 + %YAML 1.2 4 + --- 5 + $id: "http://devicetree.org/schemas/phy/qcom,qmp-phy.yaml#" 6 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 7 + 8 + title: Qualcomm QMP PHY controller 9 + 10 + maintainers: 11 + - Manu Gautam <mgautam@codeaurora.org> 12 + 13 + description: 14 + QMP phy controller supports physical layer functionality for a number of 15 + controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. 16 + 17 + properties: 18 + compatible: 19 + enum: 20 + - qcom,ipq8074-qmp-pcie-phy 21 + - qcom,msm8996-qmp-pcie-phy 22 + - qcom,msm8996-qmp-ufs-phy 23 + - qcom,msm8996-qmp-usb3-phy 24 + - qcom,msm8998-qmp-pcie-phy 25 + - qcom,msm8998-qmp-ufs-phy 26 + - qcom,msm8998-qmp-usb3-phy 27 + - qcom,sdm845-qhp-pcie-phy 28 + - qcom,sdm845-qmp-pcie-phy 29 + - qcom,sdm845-qmp-ufs-phy 30 + - qcom,sdm845-qmp-usb3-uni-phy 31 + - qcom,sm8150-qmp-ufs-phy 32 + - qcom,sm8250-qmp-ufs-phy 33 + 34 + reg: 35 + items: 36 + - description: Address and length of PHY's common serdes block. 37 + 38 + "#clock-cells": 39 + enum: [ 1, 2 ] 40 + 41 + "#address-cells": 42 + enum: [ 1, 2 ] 43 + 44 + "#size-cells": 45 + enum: [ 1, 2 ] 46 + 47 + clocks: 48 + minItems: 1 49 + maxItems: 4 50 + 51 + clock-names: 52 + minItems: 1 53 + maxItems: 4 54 + 55 + resets: 56 + minItems: 1 57 + maxItems: 3 58 + 59 + reset-names: 60 + minItems: 1 61 + maxItems: 3 62 + 63 + vdda-phy-supply: 64 + description: 65 + Phandle to a regulator supply to PHY core block. 66 + 67 + vdda-pll-supply: 68 + description: 69 + Phandle to 1.8V regulator supply to PHY refclk pll block. 70 + 71 + vddp-ref-clk-supply: 72 + description: 73 + Phandle to a regulator supply to any specific refclk 74 + pll block. 75 + 76 + #Required nodes: 77 + patternProperties: 78 + "^phy@[0-9a-f]+$": 79 + type: object 80 + description: 81 + Each device node of QMP phy is required to have as many child nodes as 82 + the number of lanes the PHY has. 83 + 84 + required: 85 + - compatible 86 + - reg 87 + - "#clock-cells" 88 + - "#address-cells" 89 + - "#size-cells" 90 + - clocks 91 + - clock-names 92 + - resets 93 + - reset-names 94 + - vdda-phy-supply 95 + - vdda-pll-supply 96 + 97 + additionalProperties: false 98 + 99 + allOf: 100 + - if: 101 + properties: 102 + compatible: 103 + contains: 104 + enum: 105 + - qcom,sdm845-qmp-usb3-uni-phy 106 + then: 107 + properties: 108 + clocks: 109 + items: 110 + - description: Phy aux clock. 111 + - description: Phy config clock. 112 + - description: 19.2 MHz ref clk. 113 + - description: Phy common block aux clock. 114 + clock-names: 115 + items: 116 + - const: aux 117 + - const: cfg_ahb 118 + - const: ref 119 + - const: com_aux 120 + resets: 121 + items: 122 + - description: reset of phy block. 123 + - description: phy common block reset. 124 + reset-names: 125 + items: 126 + - const: phy 127 + - const: common 128 + - if: 129 + properties: 130 + compatible: 131 + contains: 132 + enum: 133 + - qcom,msm8996-qmp-pcie-phy 134 + then: 135 + properties: 136 + clocks: 137 + items: 138 + - description: Phy aux clock. 139 + - description: Phy config clock. 140 + - description: 19.2 MHz ref clk. 141 + clock-names: 142 + items: 143 + - const: aux 144 + - const: cfg_ahb 145 + - const: ref 146 + resets: 147 + items: 148 + - description: reset of phy block. 149 + - description: phy common block reset. 150 + - description: phy's ahb cfg block reset. 151 + reset-names: 152 + items: 153 + - const: phy 154 + - const: common 155 + - const: cfg 156 + - if: 157 + properties: 158 + compatible: 159 + contains: 160 + enum: 161 + - qcom,msm8996-qmp-usb3-phy 162 + - qcom,msm8998-qmp-pcie-phy 163 + - qcom,msm8998-qmp-usb3-phy 164 + then: 165 + properties: 166 + clocks: 167 + items: 168 + - description: Phy aux clock. 169 + - description: Phy config clock. 170 + - description: 19.2 MHz ref clk. 171 + clock-names: 172 + items: 173 + - const: aux 174 + - const: cfg_ahb 175 + - const: ref 176 + resets: 177 + items: 178 + - description: reset of phy block. 179 + - description: phy common block reset. 180 + reset-names: 181 + items: 182 + - const: phy 183 + - const: common 184 + - if: 185 + properties: 186 + compatible: 187 + contains: 188 + enum: 189 + - qcom,msm8996-qmp-ufs-phy 190 + then: 191 + properties: 192 + clocks: 193 + items: 194 + - description: 19.2 MHz ref clk. 195 + clock-names: 196 + items: 197 + - const: ref 198 + resets: 199 + items: 200 + - description: PHY reset in the UFS controller. 201 + reset-names: 202 + items: 203 + - const: ufsphy 204 + - if: 205 + properties: 206 + compatible: 207 + contains: 208 + enum: 209 + - qcom,msm8998-qmp-ufs-phy 210 + - qcom,sdm845-qmp-ufs-phy 211 + - qcom,sm8150-qmp-ufs-phy 212 + - qcom,sm8250-qmp-ufs-phy 213 + then: 214 + properties: 215 + clocks: 216 + items: 217 + - description: 19.2 MHz ref clk. 218 + - description: Phy reference aux clock. 219 + clock-names: 220 + items: 221 + - const: ref 222 + - const: ref_aux 223 + resets: 224 + items: 225 + - description: PHY reset in the UFS controller. 226 + reset-names: 227 + items: 228 + - const: ufsphy 229 + - if: 230 + properties: 231 + compatible: 232 + contains: 233 + enum: 234 + - qcom,ipq8074-qmp-pcie-phy 235 + then: 236 + properties: 237 + clocks: 238 + items: 239 + - description: pipe clk. 240 + clock-names: 241 + items: 242 + - const: pipe_clk 243 + resets: 244 + items: 245 + - description: reset of phy block. 246 + - description: phy common block reset. 247 + reset-names: 248 + items: 249 + - const: phy 250 + - const: common 251 + - if: 252 + properties: 253 + compatible: 254 + contains: 255 + enum: 256 + - qcom,sdm845-qhp-pcie-phy 257 + - qcom,sdm845-qmp-pcie-phy 258 + then: 259 + properties: 260 + clocks: 261 + items: 262 + - description: Phy aux clock. 263 + - description: Phy config clock. 264 + - description: 19.2 MHz ref clk. 265 + - description: Phy refgen clk. 266 + clock-names: 267 + items: 268 + - const: aux 269 + - const: cfg_ahb 270 + - const: ref 271 + - const: refgen 272 + resets: 273 + items: 274 + - description: reset of phy block. 275 + reset-names: 276 + items: 277 + - const: phy 278 + 279 + examples: 280 + - | 281 + #include <dt-bindings/clock/qcom,gcc-sdm845.h> 282 + usb_2_qmpphy: phy-wrapper@88eb000 { 283 + compatible = "qcom,sdm845-qmp-usb3-uni-phy"; 284 + reg = <0 0x088eb000 0 0x18c>; 285 + #clock-cells = <1>; 286 + #address-cells = <2>; 287 + #size-cells = <2>; 288 + 289 + clocks = <&gcc GCC_USB3_SEC_PHY_AUX_CLK >, 290 + <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, 291 + <&gcc GCC_USB3_SEC_CLKREF_CLK>, 292 + <&gcc GCC_USB3_SEC_PHY_COM_AUX_CLK>; 293 + clock-names = "aux", "cfg_ahb", "ref", "com_aux"; 294 + 295 + resets = <&gcc GCC_USB3PHY_PHY_SEC_BCR>, 296 + <&gcc GCC_USB3_PHY_SEC_BCR>; 297 + reset-names = "phy", "common"; 298 + 299 + vdda-phy-supply = <&vdda_usb2_ss_1p2>; 300 + vdda-pll-supply = <&vdda_usb2_ss_core>; 301 + 302 + usb_2_ssphy: phy@88eb200 { 303 + reg = <0 0x088eb200 0 0x128>, 304 + <0 0x088eb400 0 0x1fc>, 305 + <0 0x088eb800 0 0x218>, 306 + <0 0x088eb600 0 0x70>; 307 + #clock-cells = <0>; 308 + #phy-cells = <0>; 309 + clocks = <&gcc GCC_USB3_SEC_PHY_PIPE_CLK>; 310 + clock-names = "pipe0"; 311 + clock-output-names = "usb3_uni_phy_pipe_clk_src"; 312 + }; 313 + };
+136
Documentation/devicetree/bindings/phy/qcom,qmp-usb3-dp-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + 3 + %YAML 1.2 4 + --- 5 + $id: "http://devicetree.org/schemas/phy/qcom,qmp-usb3-dp-phy.yaml#" 6 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 7 + 8 + title: Qualcomm QMP USB3 DP PHY controller 9 + 10 + maintainers: 11 + - Manu Gautam <mgautam@codeaurora.org> 12 + 13 + properties: 14 + compatible: 15 + enum: 16 + - qcom,sc7180-qmp-usb3-phy 17 + - qcom,sdm845-qmp-usb3-phy 18 + reg: 19 + items: 20 + - description: Address and length of PHY's common serdes block. 21 + - description: Address and length of the DP_COM control block. 22 + 23 + reg-names: 24 + items: 25 + - const: reg-base 26 + - const: dp_com 27 + 28 + "#clock-cells": 29 + enum: [ 1, 2 ] 30 + 31 + "#address-cells": 32 + enum: [ 1, 2 ] 33 + 34 + "#size-cells": 35 + enum: [ 1, 2 ] 36 + 37 + clocks: 38 + items: 39 + - description: Phy aux clock. 40 + - description: Phy config clock. 41 + - description: 19.2 MHz ref clk. 42 + - description: Phy common block aux clock. 43 + 44 + clock-names: 45 + items: 46 + - const: aux 47 + - const: cfg_ahb 48 + - const: ref 49 + - const: com_aux 50 + 51 + resets: 52 + items: 53 + - description: reset of phy block. 54 + - description: phy common block reset. 55 + 56 + reset-names: 57 + items: 58 + - const: phy 59 + - const: common 60 + 61 + vdda-phy-supply: 62 + description: 63 + Phandle to a regulator supply to PHY core block. 64 + 65 + vdda-pll-supply: 66 + description: 67 + Phandle to 1.8V regulator supply to PHY refclk pll block. 68 + 69 + vddp-ref-clk-supply: 70 + description: 71 + Phandle to a regulator supply to any specific refclk 72 + pll block. 73 + 74 + #Required nodes: 75 + patternProperties: 76 + "^phy@[0-9a-f]+$": 77 + type: object 78 + description: 79 + Each device node of QMP phy is required to have as many child nodes as 80 + the number of lanes the PHY has. 81 + 82 + required: 83 + - compatible 84 + - reg 85 + - reg-names 86 + - "#clock-cells" 87 + - "#address-cells" 88 + - "#size-cells" 89 + - clocks 90 + - clock-names 91 + - resets 92 + - reset-names 93 + - vdda-phy-supply 94 + - vdda-pll-supply 95 + 96 + additionalProperties: false 97 + 98 + examples: 99 + - | 100 + #include <dt-bindings/clock/qcom,gcc-sdm845.h> 101 + usb_1_qmpphy: phy-wrapper@88e9000 { 102 + compatible = "qcom,sdm845-qmp-usb3-phy"; 103 + reg = <0 0x088e9000 0 0x18c>, 104 + <0 0x088e8000 0 0x10>; 105 + reg-names = "reg-base", "dp_com"; 106 + #clock-cells = <1>; 107 + #address-cells = <2>; 108 + #size-cells = <2>; 109 + 110 + clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>, 111 + <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, 112 + <&gcc GCC_USB3_PRIM_CLKREF_CLK>, 113 + <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>; 114 + clock-names = "aux", "cfg_ahb", "ref", "com_aux"; 115 + 116 + resets = <&gcc GCC_USB3_PHY_PRIM_BCR>, 117 + <&gcc GCC_USB3_DP_PHY_PRIM_BCR>; 118 + reset-names = "phy", "common"; 119 + 120 + vdda-phy-supply = <&vdda_usb2_ss_1p2>; 121 + vdda-pll-supply = <&vdda_usb2_ss_core>; 122 + 123 + usb_1_ssphy: phy@88e9200 { 124 + reg = <0 0x088e9200 0 0x128>, 125 + <0 0x088e9400 0 0x200>, 126 + <0 0x088e9c00 0 0x218>, 127 + <0 0x088e9600 0 0x128>, 128 + <0 0x088e9800 0 0x200>, 129 + <0 0x088e9a00 0 0x100>; 130 + #clock-cells = <0>; 131 + #phy-cells = <0>; 132 + clocks = <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; 133 + clock-names = "pipe0"; 134 + clock-output-names = "usb3_phy_pipe_clk_src"; 135 + }; 136 + };
+80
Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: "http://devicetree.org/schemas/phy/qcom,usb-snps-femto-v2.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: Qualcomm Synopsys Femto High-Speed USB PHY V2 8 + 9 + maintainers: 10 + - Wesley Cheng <wcheng@codeaurora.org> 11 + 12 + description: | 13 + Qualcomm High-Speed USB PHY 14 + 15 + properties: 16 + compatible: 17 + enum: 18 + - qcom,usb-snps-hs-7nm-phy 19 + - qcom,sm8150-usb-hs-phy 20 + - qcom,usb-snps-femto-v2-phy 21 + 22 + reg: 23 + maxItems: 1 24 + 25 + "#phy-cells": 26 + const: 0 27 + 28 + clocks: 29 + items: 30 + - description: rpmhcc ref clock 31 + 32 + clock-names: 33 + items: 34 + - const: ref 35 + 36 + resets: 37 + items: 38 + - description: PHY core reset 39 + 40 + vdda-pll-supply: 41 + description: phandle to the regulator VDD supply node. 42 + 43 + vdda18-supply: 44 + description: phandle to the regulator 1.8V supply node. 45 + 46 + vdda33-supply: 47 + description: phandle to the regulator 3.3V supply node. 48 + 49 + required: 50 + - compatible 51 + - reg 52 + - "#phy-cells" 53 + - clocks 54 + - clock-names 55 + - resets 56 + - vdda-pll-supply 57 + - vdda18-supply 58 + - vdda33-supply 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + #include <dt-bindings/clock/qcom,rpmh.h> 65 + #include <dt-bindings/clock/qcom,gcc-sm8150.h> 66 + phy@88e2000 { 67 + compatible = "qcom,sm8150-usb-hs-phy"; 68 + reg = <0 0x088e2000 0 0x400>; 69 + #phy-cells = <0>; 70 + 71 + clocks = <&rpmhcc RPMH_CXO_CLK>; 72 + clock-names = "ref"; 73 + 74 + resets = <&gcc GCC_QUSB2PHY_PRIM_BCR>; 75 + 76 + vdda-pll-supply = <&vdd_usb_hs_core>; 77 + vdda33-supply = <&vdda_usb_hs_3p1>; 78 + vdda18-supply = <&vdda_usb_hs_1p8>; 79 + }; 80 + ...
-242
Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt
··· 1 - Qualcomm QMP PHY controller 2 - =========================== 3 - 4 - QMP phy controller supports physical layer functionality for a number of 5 - controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. 6 - 7 - Required properties: 8 - - compatible: compatible list, contains: 9 - "qcom,ipq8074-qmp-pcie-phy" for PCIe phy on IPQ8074 10 - "qcom,msm8996-qmp-pcie-phy" for 14nm PCIe phy on msm8996, 11 - "qcom,msm8996-qmp-ufs-phy" for 14nm UFS phy on msm8996, 12 - "qcom,msm8996-qmp-usb3-phy" for 14nm USB3 phy on msm8996, 13 - "qcom,msm8998-qmp-usb3-phy" for USB3 QMP V3 phy on msm8998, 14 - "qcom,msm8998-qmp-ufs-phy" for UFS QMP phy on msm8998, 15 - "qcom,msm8998-qmp-pcie-phy" for PCIe QMP phy on msm8998, 16 - "qcom,sdm845-qhp-pcie-phy" for QHP PCIe phy on sdm845, 17 - "qcom,sdm845-qmp-pcie-phy" for QMP PCIe phy on sdm845, 18 - "qcom,sdm845-qmp-usb3-phy" for USB3 QMP V3 phy on sdm845, 19 - "qcom,sdm845-qmp-usb3-uni-phy" for USB3 QMP V3 UNI phy on sdm845, 20 - "qcom,sdm845-qmp-ufs-phy" for UFS QMP phy on sdm845, 21 - "qcom,sm8150-qmp-ufs-phy" for UFS QMP phy on sm8150. 22 - 23 - - reg: 24 - - index 0: address and length of register set for PHY's common 25 - serdes block. 26 - - index 1: address and length of the DP_COM control block (for 27 - "qcom,sdm845-qmp-usb3-phy" only). 28 - 29 - - reg-names: 30 - - For "qcom,sdm845-qmp-usb3-phy": 31 - - Should be: "reg-base", "dp_com" 32 - - For all others: 33 - - The reg-names property shouldn't be defined. 34 - 35 - - #address-cells: must be 1 36 - - #size-cells: must be 1 37 - - ranges: must be present 38 - 39 - - clocks: a list of phandles and clock-specifier pairs, 40 - one for each entry in clock-names. 41 - - clock-names: "cfg_ahb" for phy config clock, 42 - "aux" for phy aux clock, 43 - "ref" for 19.2 MHz ref clk, 44 - "com_aux" for phy common block aux clock, 45 - "ref_aux" for phy reference aux clock, 46 - 47 - For "qcom,ipq8074-qmp-pcie-phy": no clocks are listed. 48 - For "qcom,msm8996-qmp-pcie-phy" must contain: 49 - "aux", "cfg_ahb", "ref". 50 - For "qcom,msm8996-qmp-ufs-phy" must contain: 51 - "ref". 52 - For "qcom,msm8996-qmp-usb3-phy" must contain: 53 - "aux", "cfg_ahb", "ref". 54 - For "qcom,msm8998-qmp-usb3-phy" must contain: 55 - "aux", "cfg_ahb", "ref". 56 - For "qcom,msm8998-qmp-ufs-phy" must contain: 57 - "ref", "ref_aux". 58 - For "qcom,msm8998-qmp-pcie-phy" must contain: 59 - "aux", "cfg_ahb", "ref". 60 - For "qcom,sdm845-qhp-pcie-phy" must contain: 61 - "aux", "cfg_ahb", "ref", "refgen". 62 - For "qcom,sdm845-qmp-pcie-phy" must contain: 63 - "aux", "cfg_ahb", "ref", "refgen". 64 - For "qcom,sdm845-qmp-usb3-phy" must contain: 65 - "aux", "cfg_ahb", "ref", "com_aux". 66 - For "qcom,sdm845-qmp-usb3-uni-phy" must contain: 67 - "aux", "cfg_ahb", "ref", "com_aux". 68 - For "qcom,sdm845-qmp-ufs-phy" must contain: 69 - "ref", "ref_aux". 70 - For "qcom,sm8150-qmp-ufs-phy" must contain: 71 - "ref", "ref_aux". 72 - 73 - - resets: a list of phandles and reset controller specifier pairs, 74 - one for each entry in reset-names. 75 - - reset-names: "phy" for reset of phy block, 76 - "common" for phy common block reset, 77 - "cfg" for phy's ahb cfg block reset, 78 - "ufsphy" for the PHY reset in the UFS controller. 79 - 80 - For "qcom,ipq8074-qmp-pcie-phy" must contain: 81 - "phy", "common". 82 - For "qcom,msm8996-qmp-pcie-phy" must contain: 83 - "phy", "common", "cfg". 84 - For "qcom,msm8996-qmp-ufs-phy": must contain: 85 - "ufsphy". 86 - For "qcom,msm8996-qmp-usb3-phy" must contain 87 - "phy", "common". 88 - For "qcom,msm8998-qmp-usb3-phy" must contain 89 - "phy", "common". 90 - For "qcom,msm8998-qmp-ufs-phy": must contain: 91 - "ufsphy". 92 - For "qcom,msm8998-qmp-pcie-phy" must contain: 93 - "phy", "common". 94 - For "qcom,sdm845-qhp-pcie-phy" must contain: 95 - "phy". 96 - For "qcom,sdm845-qmp-pcie-phy" must contain: 97 - "phy". 98 - For "qcom,sdm845-qmp-usb3-phy" must contain: 99 - "phy", "common". 100 - For "qcom,sdm845-qmp-usb3-uni-phy" must contain: 101 - "phy", "common". 102 - For "qcom,sdm845-qmp-ufs-phy": must contain: 103 - "ufsphy". 104 - For "qcom,sm8150-qmp-ufs-phy": must contain: 105 - "ufsphy". 106 - 107 - - vdda-phy-supply: Phandle to a regulator supply to PHY core block. 108 - - vdda-pll-supply: Phandle to 1.8V regulator supply to PHY refclk pll block. 109 - 110 - Optional properties: 111 - - vddp-ref-clk-supply: Phandle to a regulator supply to any specific refclk 112 - pll block. 113 - 114 - Required nodes: 115 - - Each device node of QMP phy is required to have as many child nodes as 116 - the number of lanes the PHY has. 117 - 118 - Required properties for child nodes of PCIe PHYs (one child per lane): 119 - - reg: list of offset and length pairs of register sets for PHY blocks - 120 - tx, rx, pcs, and pcs_misc (optional). 121 - - #phy-cells: must be 0 122 - 123 - Required properties for a single "lanes" child node of non-PCIe PHYs: 124 - - reg: list of offset and length pairs of register sets for PHY blocks 125 - For 1-lane devices: 126 - tx, rx, pcs, and (optionally) pcs_misc 127 - For 2-lane devices: 128 - tx0, rx0, pcs, tx1, rx1, and (optionally) pcs_misc 129 - - #phy-cells: must be 0 130 - 131 - Required properties for child node of PCIe and USB3 qmp phys: 132 - - clocks: a list of phandles and clock-specifier pairs, 133 - one for each entry in clock-names. 134 - - clock-names: Must contain following: 135 - "pipe<lane-number>" for pipe clock specific to each lane. 136 - - clock-output-names: Name of the PHY clock that will be the parent for 137 - the above pipe clock. 138 - For "qcom,ipq8074-qmp-pcie-phy": 139 - - "pcie20_phy0_pipe_clk" Pipe Clock parent 140 - (or) 141 - "pcie20_phy1_pipe_clk" 142 - - #clock-cells: must be 0 143 - - Phy pll outputs pipe clocks for pipe based PHYs. These clocks are then 144 - gate-controlled by the gcc. 145 - 146 - Required properties for child node of PHYs with lane reset, AKA: 147 - "qcom,msm8996-qmp-pcie-phy" 148 - - resets: a list of phandles and reset controller specifier pairs, 149 - one for each entry in reset-names. 150 - - reset-names: Must contain following: 151 - "lane<lane-number>" for reset specific to each lane. 152 - 153 - Example: 154 - phy@34000 { 155 - compatible = "qcom,msm8996-qmp-pcie-phy"; 156 - reg = <0x34000 0x488>; 157 - #address-cells = <1>; 158 - #size-cells = <1>; 159 - ranges; 160 - 161 - clocks = <&gcc GCC_PCIE_PHY_AUX_CLK>, 162 - <&gcc GCC_PCIE_PHY_CFG_AHB_CLK>, 163 - <&gcc GCC_PCIE_CLKREF_CLK>; 164 - clock-names = "aux", "cfg_ahb", "ref"; 165 - 166 - vdda-phy-supply = <&pm8994_l28>; 167 - vdda-pll-supply = <&pm8994_l12>; 168 - 169 - resets = <&gcc GCC_PCIE_PHY_BCR>, 170 - <&gcc GCC_PCIE_PHY_COM_BCR>, 171 - <&gcc GCC_PCIE_PHY_COM_NOCSR_BCR>; 172 - reset-names = "phy", "common", "cfg"; 173 - 174 - pciephy_0: lane@35000 { 175 - reg = <0x35000 0x130>, 176 - <0x35200 0x200>, 177 - <0x35400 0x1dc>; 178 - #clock-cells = <0>; 179 - #phy-cells = <0>; 180 - 181 - clocks = <&gcc GCC_PCIE_0_PIPE_CLK>; 182 - clock-names = "pipe0"; 183 - clock-output-names = "pcie_0_pipe_clk_src"; 184 - resets = <&gcc GCC_PCIE_0_PHY_BCR>; 185 - reset-names = "lane0"; 186 - }; 187 - 188 - pciephy_1: lane@36000 { 189 - ... 190 - ... 191 - }; 192 - 193 - phy@88eb000 { 194 - compatible = "qcom,sdm845-qmp-usb3-uni-phy"; 195 - reg = <0x88eb000 0x18c>; 196 - #address-cells = <1>; 197 - #size-cells = <1>; 198 - ranges; 199 - 200 - clocks = <&gcc GCC_USB3_SEC_PHY_AUX_CLK>, 201 - <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, 202 - <&gcc GCC_USB3_SEC_CLKREF_CLK>, 203 - <&gcc GCC_USB3_SEC_PHY_COM_AUX_CLK>; 204 - clock-names = "aux", "cfg_ahb", "ref", "com_aux"; 205 - 206 - resets = <&gcc GCC_USB3PHY_PHY_SEC_BCR>, 207 - <&gcc GCC_USB3_PHY_SEC_BCR>; 208 - reset-names = "phy", "common"; 209 - 210 - lane@88eb200 { 211 - reg = <0x88eb200 0x128>, 212 - <0x88eb400 0x1fc>, 213 - <0x88eb800 0x218>, 214 - <0x88eb600 0x70>; 215 - #clock-cells = <0>; 216 - #phy-cells = <0>; 217 - clocks = <&gcc GCC_USB3_SEC_PHY_PIPE_CLK>; 218 - clock-names = "pipe0"; 219 - clock-output-names = "usb3_uni_phy_pipe_clk_src"; 220 - }; 221 - }; 222 - 223 - phy@1d87000 { 224 - compatible = "qcom,sdm845-qmp-ufs-phy"; 225 - reg = <0x1d87000 0x18c>; 226 - #address-cells = <1>; 227 - #size-cells = <1>; 228 - ranges; 229 - clock-names = "ref", 230 - "ref_aux"; 231 - clocks = <&gcc GCC_UFS_MEM_CLKREF_CLK>, 232 - <&gcc GCC_UFS_PHY_PHY_AUX_CLK>; 233 - 234 - lanes@1d87400 { 235 - reg = <0x1d87400 0x108>, 236 - <0x1d87600 0x1e0>, 237 - <0x1d87c00 0x1dc>, 238 - <0x1d87800 0x108>, 239 - <0x1d87a00 0x1e0>; 240 - #phy-cells = <0>; 241 - }; 242 - };
+50
Documentation/devicetree/bindings/phy/qcom-usb-ipq4019-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: "http://devicetree.org/schemas/phy/qcom-usb-ipq4019-phy.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: Qualcom IPQ40xx Dakota HS/SS USB PHY 8 + 9 + maintainers: 10 + - Robert Marko <robert.marko@sartura.hr> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - qcom,usb-ss-ipq4019-phy 16 + - qcom,usb-hs-ipq4019-phy 17 + 18 + reg: 19 + maxItems: 1 20 + 21 + resets: 22 + maxItems: 2 23 + 24 + reset-names: 25 + items: 26 + - const: por_rst 27 + - const: srif_rst 28 + 29 + "#phy-cells": 30 + const: 0 31 + 32 + required: 33 + - compatible 34 + - reg 35 + - resets 36 + - reset-names 37 + - "#phy-cells" 38 + 39 + examples: 40 + - | 41 + #include <dt-bindings/clock/qcom,gcc-ipq4019.h> 42 + 43 + hsphy@a8000 { 44 + #phy-cells = <0>; 45 + compatible = "qcom,usb-hs-ipq4019-phy"; 46 + reg = <0xa8000 0x40>; 47 + resets = <&gcc USB2_HSPHY_POR_ARES>, 48 + <&gcc USB2_HSPHY_S_ARES>; 49 + reset-names = "por_rst", "srif_rst"; 50 + };
-70
Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
··· 1 - * Renesas R-Car generation 3 USB 2.0 PHY 2 - 3 - This file provides information on what the device node for the R-Car generation 4 - 3, RZ/G1C, RZ/G2 and RZ/A2 USB 2.0 PHY contain. 5 - 6 - Required properties: 7 - - compatible: "renesas,usb2-phy-r7s9210" if the device is a part of an R7S9210 8 - SoC. 9 - "renesas,usb2-phy-r8a77470" if the device is a part of an R8A77470 10 - SoC. 11 - "renesas,usb2-phy-r8a774a1" if the device is a part of an R8A774A1 12 - SoC. 13 - "renesas,usb2-phy-r8a774b1" if the device is a part of an R8A774B1 14 - SoC. 15 - "renesas,usb2-phy-r8a774c0" if the device is a part of an R8A774C0 16 - SoC. 17 - "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795 18 - SoC. 19 - "renesas,usb2-phy-r8a7796" if the device is a part of an R8A7796 20 - SoC. 21 - "renesas,usb2-phy-r8a77965" if the device is a part of an 22 - R8A77965 SoC. 23 - "renesas,usb2-phy-r8a77990" if the device is a part of an 24 - R8A77990 SoC. 25 - "renesas,usb2-phy-r8a77995" if the device is a part of an 26 - R8A77995 SoC. 27 - "renesas,rcar-gen3-usb2-phy" for a generic R-Car Gen3, RZ/G2 or 28 - RZ/A2 compatible device. 29 - 30 - When compatible with the generic version, nodes must list the 31 - SoC-specific version corresponding to the platform first 32 - followed by the generic version. 33 - 34 - - reg: offset and length of the partial USB 2.0 Host register block. 35 - - clocks: clock phandle and specifier pair(s). 36 - - #phy-cells: see phy-bindings.txt in the same directory, must be <1> (and 37 - using <0> is deprecated). 38 - 39 - The phandle's argument in the PHY specifier is the INT_STATUS bit of controller: 40 - - 1 = USBH_INTA (OHCI) 41 - - 2 = USBH_INTB (EHCI) 42 - - 3 = UCOM_INT (OTG and BC) 43 - 44 - Optional properties: 45 - To use a USB channel where USB 2.0 Host and HSUSB (USB 2.0 Peripheral) are 46 - combined, the device tree node should set interrupt properties to use the 47 - channel as USB OTG: 48 - - interrupts: interrupt specifier for the PHY. 49 - - vbus-supply: Phandle to a regulator that provides power to the VBUS. This 50 - regulator will be managed during the PHY power on/off sequence. 51 - - renesas,no-otg-pins: boolean, specify when a board does not provide proper 52 - otg pins. 53 - - dr_mode: string, indicates the working mode for the PHY. Can be "host", 54 - "peripheral", or "otg". Should be set if otg controller is not used. 55 - 56 - 57 - Example (R-Car H3): 58 - 59 - usb-phy@ee080200 { 60 - compatible = "renesas,usb2-phy-r8a7795", "renesas,rcar-gen3-usb2-phy"; 61 - reg = <0 0xee080200 0 0x700>; 62 - interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>; 63 - clocks = <&cpg CPG_MOD 703>; 64 - }; 65 - 66 - usb-phy@ee0a0200 { 67 - compatible = "renesas,usb2-phy-r8a7795", "renesas,rcar-gen3-usb2-phy"; 68 - reg = <0 0xee0a0200 0 0x700>; 69 - clocks = <&cpg CPG_MOD 702>; 70 - };
-52
Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb3.txt
··· 1 - * Renesas R-Car generation 3 USB 3.0 PHY 2 - 3 - This file provides information on what the device node for the R-Car generation 4 - 3 and RZ/G2 USB 3.0 PHY contain. 5 - If you want to enable spread spectrum clock (ssc), you should use USB_EXTAL 6 - instead of USB3_CLK. However, if you don't want to these features, you don't 7 - need this driver. 8 - 9 - Required properties: 10 - - compatible: "renesas,r8a774a1-usb3-phy" if the device is a part of an R8A774A1 11 - SoC. 12 - "renesas,r8a774b1-usb3-phy" if the device is a part of an R8A774B1 13 - SoC. 14 - "renesas,r8a7795-usb3-phy" if the device is a part of an R8A7795 15 - SoC. 16 - "renesas,r8a7796-usb3-phy" if the device is a part of an R8A7796 17 - SoC. 18 - "renesas,r8a77965-usb3-phy" if the device is a part of an 19 - R8A77965 SoC. 20 - "renesas,rcar-gen3-usb3-phy" for a generic R-Car Gen3 or RZ/G2 21 - compatible device. 22 - 23 - When compatible with the generic version, nodes must list the 24 - SoC-specific version corresponding to the platform first 25 - followed by the generic version. 26 - 27 - - reg: offset and length of the USB 3.0 PHY register block. 28 - - clocks: A list of phandles and clock-specifier pairs. 29 - - clock-names: Name of the clocks. 30 - - The funcional clock must be "usb3-if". 31 - - The usb3's external clock must be "usb3s_clk". 32 - - The usb2's external clock must be "usb_extal". If you want to use the ssc, 33 - the clock-frequency must not be 0. 34 - - #phy-cells: see phy-bindings.txt in the same directory, must be <0>. 35 - 36 - Optional properties: 37 - - renesas,ssc-range: Enable/disable spread spectrum clock (ssc) by using 38 - the following values as u32: 39 - - 0 (or the property doesn't exist): disable the ssc 40 - - 4980: enable the ssc as -4980 ppm 41 - - 4492: enable the ssc as -4492 ppm 42 - - 4003: enable the ssc as -4003 ppm 43 - 44 - Example (R-Car H3): 45 - 46 - usb-phy@e65ee000 { 47 - compatible = "renesas,r8a7795-usb3-phy", 48 - "renesas,rcar-gen3-usb3-phy"; 49 - reg = <0 0xe65ee000 0 0x90>; 50 - clocks = <&cpg CPG_MOD 328>, <&usb3s0_clk>, <&usb_extal>; 51 - clock-names = "usb3-if", "usb3s_clk", "usb_extal"; 52 - };
+117
Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/phy/renesas,usb2-phy.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Renesas R-Car generation 3 USB 2.0 PHY 8 + 9 + maintainers: 10 + - Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> 11 + 12 + properties: 13 + compatible: 14 + oneOf: 15 + - items: 16 + - const: renesas,usb2-phy-r8a77470 # RZ/G1C 17 + 18 + - items: 19 + - enum: 20 + - renesas,usb2-phy-r7s9210 # RZ/A2 21 + - renesas,usb2-phy-r8a774a1 # RZ/G2M 22 + - renesas,usb2-phy-r8a774b1 # RZ/G2N 23 + - renesas,usb2-phy-r8a774c0 # RZ/G2E 24 + - renesas,usb2-phy-r8a7795 # R-Car H3 25 + - renesas,usb2-phy-r8a7796 # R-Car M3-W 26 + - renesas,usb2-phy-r8a77961 # R-Car M3-W+ 27 + - renesas,usb2-phy-r8a77965 # R-Car M3-N 28 + - renesas,usb2-phy-r8a77990 # R-Car E3 29 + - renesas,usb2-phy-r8a77995 # R-Car D3 30 + - const: renesas,rcar-gen3-usb2-phy 31 + 32 + reg: 33 + maxItems: 1 34 + 35 + clocks: 36 + minItems: 1 37 + maxItems: 2 38 + 39 + clock-names: 40 + minItems: 1 41 + maxItems: 2 42 + items: 43 + - const: fck 44 + - const: usb_x1 45 + 46 + '#phy-cells': 47 + enum: [0, 1] # and 0 is deprecated. 48 + description: | 49 + The phandle's argument in the PHY specifier is the INT_STATUS bit of 50 + controller. 51 + - 1 = USBH_INTA (OHCI) 52 + - 2 = USBH_INTB (EHCI) 53 + - 3 = UCOM_INT (OTG and BC) 54 + 55 + interrupts: 56 + maxItems: 1 57 + 58 + power-domains: 59 + maxItems: 1 60 + 61 + resets: 62 + minItems: 1 63 + maxItems: 2 64 + items: 65 + - description: reset of USB 2.0 host side 66 + - description: reset of USB 2.0 peripheral side 67 + 68 + vbus-supply: 69 + description: | 70 + Phandle to a regulator that provides power to the VBUS. This regulator 71 + will be managed during the PHY power on/off sequence. 72 + 73 + renesas,no-otg-pins: 74 + $ref: /schemas/types.yaml#/definitions/flag 75 + description: | 76 + specify when a board does not provide proper otg pins. 77 + 78 + dr_mode: true 79 + 80 + if: 81 + properties: 82 + compatible: 83 + items: 84 + enum: 85 + - renesas,usb2-phy-r7s9210 86 + then: 87 + required: 88 + - clock-names 89 + 90 + required: 91 + - compatible 92 + - reg 93 + - clocks 94 + - '#phy-cells' 95 + 96 + additionalProperties: false 97 + 98 + examples: 99 + - | 100 + #include <dt-bindings/clock/r8a7795-cpg-mssr.h> 101 + #include <dt-bindings/interrupt-controller/arm-gic.h> 102 + #include <dt-bindings/power/r8a7795-sysc.h> 103 + 104 + usb-phy@ee080200 { 105 + compatible = "renesas,usb2-phy-r8a7795", "renesas,rcar-gen3-usb2-phy"; 106 + reg = <0xee080200 0x700>; 107 + interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>; 108 + clocks = <&cpg CPG_MOD 703>; 109 + #phy-cells = <1>; 110 + }; 111 + 112 + usb-phy@ee0a0200 { 113 + compatible = "renesas,usb2-phy-r8a7795", "renesas,rcar-gen3-usb2-phy"; 114 + reg = <0xee0a0200 0x700>; 115 + clocks = <&cpg CPG_MOD 702>; 116 + #phy-cells = <1>; 117 + };
+79
Documentation/devicetree/bindings/phy/renesas,usb3-phy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/phy/renesas,usb3-phy.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Renesas R-Car generation 3 USB 3.0 PHY 8 + 9 + maintainers: 10 + - Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> 11 + 12 + properties: 13 + compatible: 14 + items: 15 + - enum: 16 + - renesas,r8a774a1-usb3-phy # RZ/G2M 17 + - renesas,r8a774b1-usb3-phy # RZ/G2N 18 + - renesas,r8a7795-usb3-phy # R-Car H3 19 + - renesas,r8a7796-usb3-phy # R-Car M3-W 20 + - renesas,r8a77961-usb3-phy # R-Car M3-W+ 21 + - renesas,r8a77965-usb3-phy # R-Car M3-N 22 + - const: renesas,rcar-gen3-usb3-phy 23 + 24 + reg: 25 + maxItems: 1 26 + 27 + clocks: 28 + minItems: 2 29 + maxItems: 3 30 + 31 + clock-names: 32 + # If you want to use the ssc, the clock-frequency of usb_extal 33 + # must not be 0. 34 + minItems: 2 35 + maxItems: 3 36 + items: 37 + - const: usb3-if # The funcional clock 38 + - const: usb3s_clk # The usb3's external clock 39 + - const: usb_extal # The usb2's external clock 40 + 41 + '#phy-cells': 42 + # see phy-bindings.txt in the same directory 43 + const: 0 44 + 45 + power-domains: 46 + maxItems: 1 47 + 48 + resets: 49 + maxItems: 1 50 + 51 + renesas,ssc-range: 52 + description: | 53 + Enable/disable spread spectrum clock (ssc). 0 or the property doesn't 54 + exist means disabling the ssc. The actual value will be -<value> ppm. 55 + allOf: 56 + - $ref: /schemas/types.yaml#/definitions/uint32 57 + - enum: [ 0, 4003, 4492, 4980 ] 58 + 59 + required: 60 + - compatible 61 + - reg 62 + - clocks 63 + - clock-names 64 + - '#phy-cells' 65 + 66 + additionalProperties: false 67 + 68 + examples: 69 + - | 70 + #include <dt-bindings/clock/r8a7795-cpg-mssr.h> 71 + #include <dt-bindings/power/r8a7795-sysc.h> 72 + 73 + usb-phy@e65ee000 { 74 + compatible = "renesas,r8a7795-usb3-phy", "renesas,rcar-gen3-usb3-phy"; 75 + reg = <0xe65ee000 0x90>; 76 + clocks = <&cpg CPG_MOD 328>, <&usb3s0_clk>, <&usb_extal>; 77 + clock-names = "usb3-if", "usb3s_clk", "usb_extal"; 78 + #phy-cells = <0>; 79 + };
+2 -1
drivers/phy/amlogic/Kconfig
··· 3 3 # Phy drivers for Amlogic platforms 4 4 # 5 5 config PHY_MESON8B_USB2 6 - tristate "Meson8, Meson8b and GXBB USB2 PHY driver" 6 + tristate "Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY driver" 7 7 default ARCH_MESON 8 8 depends on OF && (ARCH_MESON || COMPILE_TEST) 9 9 depends on USB_SUPPORT 10 10 select USB_COMMON 11 11 select GENERIC_PHY 12 + select REGMAP_MMIO 12 13 help 13 14 Enable this to support the Meson USB2 PHYs found in Meson8, 14 15 Meson8b and GXBB SoCs.
+98 -51
drivers/phy/amlogic/phy-meson8b-usb2.c
··· 10 10 #include <linux/io.h> 11 11 #include <linux/module.h> 12 12 #include <linux/of_device.h> 13 + #include <linux/property.h> 14 + #include <linux/regmap.h> 13 15 #include <linux/reset.h> 14 16 #include <linux/phy/phy.h> 15 17 #include <linux/platform_device.h> ··· 78 76 #define REG_ADP_BC_ACA_PIN_FLOAT BIT(26) 79 77 80 78 #define REG_DBG_UART 0x10 79 + #define REG_DBG_UART_BYPASS_SEL BIT(0) 80 + #define REG_DBG_UART_BYPASS_DM_EN BIT(1) 81 + #define REG_DBG_UART_BYPASS_DP_EN BIT(2) 82 + #define REG_DBG_UART_BYPASS_DM_DATA BIT(3) 83 + #define REG_DBG_UART_BYPASS_DP_DATA BIT(4) 84 + #define REG_DBG_UART_FSV_MINUS BIT(5) 85 + #define REG_DBG_UART_FSV_PLUS BIT(6) 86 + #define REG_DBG_UART_FSV_BURN_IN_TEST BIT(7) 87 + #define REG_DBG_UART_LOOPBACK_EN_B BIT(8) 88 + #define REG_DBG_UART_SET_IDDQ BIT(9) 89 + #define REG_DBG_UART_ATE_RESET BIT(10) 81 90 82 91 #define REG_TEST 0x14 83 92 #define REG_TEST_DATA_IN_MASK GENMASK(3, 0) ··· 117 104 #define RESET_COMPLETE_TIME 500 118 105 #define ACA_ENABLE_COMPLETE_TIME 50 119 106 120 - struct phy_meson8b_usb2_priv { 121 - void __iomem *regs; 122 - enum usb_dr_mode dr_mode; 123 - struct clk *clk_usb_general; 124 - struct clk *clk_usb; 125 - struct reset_control *reset; 107 + struct phy_meson8b_usb2_match_data { 108 + bool host_enable_aca; 126 109 }; 127 110 128 - static u32 phy_meson8b_usb2_read(struct phy_meson8b_usb2_priv *phy_priv, 129 - u32 reg) 130 - { 131 - return readl(phy_priv->regs + reg); 132 - } 111 + struct phy_meson8b_usb2_priv { 112 + struct regmap *regmap; 113 + enum usb_dr_mode dr_mode; 114 + struct clk *clk_usb_general; 115 + struct clk *clk_usb; 116 + struct reset_control *reset; 117 + const struct phy_meson8b_usb2_match_data *match; 118 + }; 133 119 134 - static void phy_meson8b_usb2_mask_bits(struct phy_meson8b_usb2_priv *phy_priv, 135 - u32 reg, u32 mask, u32 value) 136 - { 137 - u32 data; 138 - 139 - data = phy_meson8b_usb2_read(phy_priv, reg); 140 - data &= ~mask; 141 - data |= (value & mask); 142 - 143 - writel(data, phy_priv->regs + reg); 144 - } 120 + static const struct regmap_config phy_meson8b_usb2_regmap_conf = { 121 + .reg_bits = 8, 122 + .val_bits = 32, 123 + .reg_stride = 4, 124 + .max_register = REG_TUNE, 125 + }; 145 126 146 127 static int phy_meson8b_usb2_power_on(struct phy *phy) 147 128 { 148 129 struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); 130 + u32 reg; 149 131 int ret; 150 132 151 133 if (!IS_ERR_OR_NULL(priv->reset)) { ··· 164 156 return ret; 165 157 } 166 158 167 - phy_meson8b_usb2_mask_bits(priv, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, 168 - REG_CONFIG_CLK_32k_ALTSEL); 159 + regmap_update_bits(priv->regmap, REG_CONFIG, REG_CONFIG_CLK_32k_ALTSEL, 160 + REG_CONFIG_CLK_32k_ALTSEL); 169 161 170 - phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_REF_CLK_SEL_MASK, 171 - 0x2 << REG_CTRL_REF_CLK_SEL_SHIFT); 162 + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_REF_CLK_SEL_MASK, 163 + 0x2 << REG_CTRL_REF_CLK_SEL_SHIFT); 172 164 173 - phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_FSEL_MASK, 174 - 0x5 << REG_CTRL_FSEL_SHIFT); 165 + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_FSEL_MASK, 166 + 0x5 << REG_CTRL_FSEL_SHIFT); 175 167 176 168 /* reset the PHY */ 177 - phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_POWER_ON_RESET, 178 - REG_CTRL_POWER_ON_RESET); 169 + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, 170 + REG_CTRL_POWER_ON_RESET); 179 171 udelay(RESET_COMPLETE_TIME); 180 - phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_POWER_ON_RESET, 0); 172 + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET, 0); 181 173 udelay(RESET_COMPLETE_TIME); 182 174 183 - phy_meson8b_usb2_mask_bits(priv, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, 184 - REG_CTRL_SOF_TOGGLE_OUT); 175 + regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_SOF_TOGGLE_OUT, 176 + REG_CTRL_SOF_TOGGLE_OUT); 185 177 186 178 if (priv->dr_mode == USB_DR_MODE_HOST) { 187 - phy_meson8b_usb2_mask_bits(priv, REG_ADP_BC, 179 + regmap_update_bits(priv->regmap, REG_DBG_UART, 180 + REG_DBG_UART_SET_IDDQ, 0); 181 + 182 + if (priv->match->host_enable_aca) { 183 + regmap_update_bits(priv->regmap, REG_ADP_BC, 188 184 REG_ADP_BC_ACA_ENABLE, 189 185 REG_ADP_BC_ACA_ENABLE); 190 186 191 - udelay(ACA_ENABLE_COMPLETE_TIME); 187 + udelay(ACA_ENABLE_COMPLETE_TIME); 192 188 193 - if (phy_meson8b_usb2_read(priv, REG_ADP_BC) & 194 - REG_ADP_BC_ACA_PIN_FLOAT) { 195 - dev_warn(&phy->dev, "USB ID detect failed!\n"); 196 - clk_disable_unprepare(priv->clk_usb); 197 - clk_disable_unprepare(priv->clk_usb_general); 198 - return -EINVAL; 189 + regmap_read(priv->regmap, REG_ADP_BC, &reg); 190 + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { 191 + dev_warn(&phy->dev, "USB ID detect failed!\n"); 192 + clk_disable_unprepare(priv->clk_usb); 193 + clk_disable_unprepare(priv->clk_usb_general); 194 + return -EINVAL; 195 + } 199 196 } 200 197 } 201 198 ··· 210 197 static int phy_meson8b_usb2_power_off(struct phy *phy) 211 198 { 212 199 struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy); 200 + 201 + if (priv->dr_mode == USB_DR_MODE_HOST) 202 + regmap_update_bits(priv->regmap, REG_DBG_UART, 203 + REG_DBG_UART_SET_IDDQ, 204 + REG_DBG_UART_SET_IDDQ); 213 205 214 206 clk_disable_unprepare(priv->clk_usb); 215 207 clk_disable_unprepare(priv->clk_usb_general); ··· 231 213 static int phy_meson8b_usb2_probe(struct platform_device *pdev) 232 214 { 233 215 struct phy_meson8b_usb2_priv *priv; 234 - struct resource *res; 235 216 struct phy *phy; 236 217 struct phy_provider *phy_provider; 218 + void __iomem *base; 237 219 238 220 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 239 221 if (!priv) 240 222 return -ENOMEM; 241 223 242 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 243 - priv->regs = devm_ioremap_resource(&pdev->dev, res); 244 - if (IS_ERR(priv->regs)) 245 - return PTR_ERR(priv->regs); 224 + base = devm_platform_ioremap_resource(pdev, 0); 225 + if (IS_ERR(base)) 226 + return PTR_ERR(base); 227 + 228 + priv->match = device_get_match_data(&pdev->dev); 229 + if (!priv->match) 230 + return -ENODEV; 231 + 232 + priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, 233 + &phy_meson8b_usb2_regmap_conf); 234 + if (IS_ERR(priv->regmap)) 235 + return PTR_ERR(priv->regmap); 246 236 247 237 priv->clk_usb_general = devm_clk_get(&pdev->dev, "usb_general"); 248 238 if (IS_ERR(priv->clk_usb_general)) ··· 285 259 return PTR_ERR_OR_ZERO(phy_provider); 286 260 } 287 261 262 + static const struct phy_meson8b_usb2_match_data phy_meson8_usb2_match_data = { 263 + .host_enable_aca = false, 264 + }; 265 + 266 + static const struct phy_meson8b_usb2_match_data phy_meson8b_usb2_match_data = { 267 + .host_enable_aca = true, 268 + }; 269 + 288 270 static const struct of_device_id phy_meson8b_usb2_of_match[] = { 289 - { .compatible = "amlogic,meson8-usb2-phy", }, 290 - { .compatible = "amlogic,meson8b-usb2-phy", }, 291 - { .compatible = "amlogic,meson-gxbb-usb2-phy", }, 292 - { }, 271 + { 272 + .compatible = "amlogic,meson8-usb2-phy", 273 + .data = &phy_meson8_usb2_match_data 274 + }, 275 + { 276 + .compatible = "amlogic,meson8b-usb2-phy", 277 + .data = &phy_meson8b_usb2_match_data 278 + }, 279 + { 280 + .compatible = "amlogic,meson8m2-usb2-phy", 281 + .data = &phy_meson8b_usb2_match_data 282 + }, 283 + { 284 + .compatible = "amlogic,meson-gxbb-usb2-phy", 285 + .data = &phy_meson8b_usb2_match_data 286 + }, 287 + { /* sentinel */ } 293 288 }; 294 289 MODULE_DEVICE_TABLE(of, phy_meson8b_usb2_of_match); 295 290 ··· 324 277 module_platform_driver(phy_meson8b_usb2_driver); 325 278 326 279 MODULE_AUTHOR("Martin Blumenstingl <martin.blumenstingl@googlemail.com>"); 327 - MODULE_DESCRIPTION("Meson8, Meson8b and GXBB USB2 PHY driver"); 280 + MODULE_DESCRIPTION("Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY driver"); 328 281 MODULE_LICENSE("GPL");
+1 -1
drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
··· 279 279 return IRQ_HANDLED; 280 280 } 281 281 282 - static struct phy_ops ops = { 282 + static const struct phy_ops ops = { 283 283 .init = ns2_drd_phy_init, 284 284 .power_on = ns2_drd_phy_poweron, 285 285 .power_off = ns2_drd_phy_poweroff,
+3 -54
drivers/phy/broadcom/phy-bcm-sr-usb.c
··· 16 16 }; 17 17 18 18 enum bcm_usb_phy_reg { 19 - PLL_NDIV_FRAC, 20 - PLL_NDIV_INT, 21 19 PLL_CTRL, 22 20 PHY_CTRL, 23 21 PHY_PLL_CTRL, ··· 29 31 }; 30 32 31 33 static const u8 bcm_usb_combo_phy_hs[] = { 32 - [PLL_NDIV_FRAC] = 0x04, 33 - [PLL_NDIV_INT] = 0x08, 34 34 [PLL_CTRL] = 0x0c, 35 35 [PHY_CTRL] = 0x10, 36 36 }; 37 37 38 - #define HSPLL_NDIV_INT_VAL 0x13 39 - #define HSPLL_NDIV_FRAC_VAL 0x1005 40 - 41 38 static const u8 bcm_usb_hs_phy[] = { 42 - [PLL_NDIV_FRAC] = 0x0, 43 - [PLL_NDIV_INT] = 0x4, 44 39 [PLL_CTRL] = 0x8, 45 40 [PHY_CTRL] = 0xc, 46 41 }; ··· 43 52 SSPLL_SUSPEND_EN, 44 53 PLL_SEQ_START, 45 54 PLL_LOCK, 46 - PLL_PDIV, 47 55 }; 48 56 49 57 static const u8 u3pll_ctrl[] = { ··· 56 66 #define HSPLL_PDIV_VAL 0x1 57 67 58 68 static const u8 u2pll_ctrl[] = { 59 - [PLL_PDIV] = 1, 60 69 [PLL_RESETB] = 5, 61 70 [PLL_LOCK] = 6, 62 71 }; 63 72 64 73 enum bcm_usb_phy_ctrl_bits { 65 74 CORERDY, 66 - AFE_LDO_PWRDWNB, 67 - AFE_PLL_PWRDWNB, 68 - AFE_BG_PWRDWNB, 69 - PHY_ISO, 70 75 PHY_RESETB, 71 76 PHY_PCTL, 72 77 }; 73 78 74 79 #define PHY_PCTL_MASK 0xffff 75 - /* 76 - * 0x0806 of PCTL_VAL has below bits set 77 - * BIT-8 : refclk divider 1 78 - * BIT-3:2: device mode; mode is not effect 79 - * BIT-1: soft reset active low 80 - */ 81 - #define HSPHY_PCTL_VAL 0x0806 82 80 #define SSPHY_PCTL_VAL 0x0006 83 81 84 82 static const u8 u3phy_ctrl[] = { ··· 76 98 77 99 static const u8 u2phy_ctrl[] = { 78 100 [CORERDY] = 0, 79 - [AFE_LDO_PWRDWNB] = 1, 80 - [AFE_PLL_PWRDWNB] = 2, 81 - [AFE_BG_PWRDWNB] = 3, 82 - [PHY_ISO] = 4, 83 101 [PHY_RESETB] = 5, 84 102 [PHY_PCTL] = 6, 85 103 }; ··· 160 186 int ret = 0; 161 187 void __iomem *regs = phy_cfg->regs; 162 188 const u8 *offset; 163 - u32 rd_data; 164 189 165 190 offset = phy_cfg->offset; 166 191 167 - writel(HSPLL_NDIV_INT_VAL, regs + offset[PLL_NDIV_INT]); 168 - writel(HSPLL_NDIV_FRAC_VAL, regs + offset[PLL_NDIV_FRAC]); 169 - 170 - rd_data = readl(regs + offset[PLL_CTRL]); 171 - rd_data &= ~(HSPLL_PDIV_MASK << u2pll_ctrl[PLL_PDIV]); 172 - rd_data |= (HSPLL_PDIV_VAL << u2pll_ctrl[PLL_PDIV]); 173 - writel(rd_data, regs + offset[PLL_CTRL]); 174 - 175 - /* Set Core Ready high */ 176 - bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], 177 - BIT(u2phy_ctrl[CORERDY])); 178 - 179 - /* Maximum timeout for Core Ready done */ 180 - msleep(30); 181 - 192 + bcm_usb_reg32_clrbits(regs + offset[PLL_CTRL], 193 + BIT(u2pll_ctrl[PLL_RESETB])); 182 194 bcm_usb_reg32_setbits(regs + offset[PLL_CTRL], 183 195 BIT(u2pll_ctrl[PLL_RESETB])); 184 - bcm_usb_reg32_setbits(regs + offset[PHY_CTRL], 185 - BIT(u2phy_ctrl[PHY_RESETB])); 186 - 187 - 188 - rd_data = readl(regs + offset[PHY_CTRL]); 189 - rd_data &= ~(PHY_PCTL_MASK << u2phy_ctrl[PHY_PCTL]); 190 - rd_data |= (HSPHY_PCTL_VAL << u2phy_ctrl[PHY_PCTL]); 191 - writel(rd_data, regs + offset[PHY_CTRL]); 192 - 193 - /* Maximum timeout for PLL reset done */ 194 - msleep(30); 195 196 196 197 ret = bcm_usb_pll_lock_check(regs + offset[PLL_CTRL], 197 198 BIT(u2pll_ctrl[PLL_LOCK])); ··· 205 256 return ret; 206 257 } 207 258 208 - static struct phy_ops sr_phy_ops = { 259 + static const struct phy_ops sr_phy_ops = { 209 260 .init = bcm_usb_phy_init, 210 261 .reset = bcm_usb_phy_reset, 211 262 .owner = THIS_MODULE,
+8 -8
drivers/phy/broadcom/phy-brcm-usb.c
··· 39 39 u8 optional_reg; 40 40 }; 41 41 42 - static struct value_to_name_map brcm_dr_mode_to_name[] = { 42 + static const struct value_to_name_map brcm_dr_mode_to_name[] = { 43 43 { USB_CTLR_MODE_HOST, "host" }, 44 44 { USB_CTLR_MODE_DEVICE, "peripheral" }, 45 45 { USB_CTLR_MODE_DRD, "drd" }, 46 46 { USB_CTLR_MODE_TYPEC_PD, "typec-pd" } 47 47 }; 48 48 49 - static struct value_to_name_map brcm_dual_mode_to_name[] = { 49 + static const struct value_to_name_map brcm_dual_mode_to_name[] = { 50 50 { 0, "host" }, 51 51 { 1, "device" }, 52 52 { 2, "auto" }, ··· 138 138 return 0; 139 139 } 140 140 141 - static struct phy_ops brcm_usb_phy_ops = { 141 + static const struct phy_ops brcm_usb_phy_ops = { 142 142 .init = brcm_usb_phy_init, 143 143 .exit = brcm_usb_phy_exit, 144 144 .owner = THIS_MODULE, ··· 170 170 return ERR_PTR(-ENODEV); 171 171 } 172 172 173 - static int name_to_value(struct value_to_name_map *table, int count, 173 + static int name_to_value(const struct value_to_name_map *table, int count, 174 174 const char *name, int *value) 175 175 { 176 176 int x; ··· 185 185 return -EINVAL; 186 186 } 187 187 188 - static const char *value_to_name(struct value_to_name_map *table, int count, 188 + static const char *value_to_name(const struct value_to_name_map *table, int count, 189 189 int value) 190 190 { 191 191 if (value >= count) ··· 252 252 .attrs = brcm_usb_phy_attrs, 253 253 }; 254 254 255 - static struct match_chip_info chip_info_7216 = { 255 + static const struct match_chip_info chip_info_7216 = { 256 256 .init_func = &brcm_usb_dvr_init_7216, 257 257 .required_regs = { 258 258 BRCM_REGS_CTRL, ··· 262 262 }, 263 263 }; 264 264 265 - static struct match_chip_info chip_info_7211b0 = { 265 + static const struct match_chip_info chip_info_7211b0 = { 266 266 .init_func = &brcm_usb_dvr_init_7211b0, 267 267 .required_regs = { 268 268 BRCM_REGS_CTRL, ··· 275 275 .optional_reg = BRCM_REGS_BDC_EC, 276 276 }; 277 277 278 - static struct match_chip_info chip_info_7445 = { 278 + static const struct match_chip_info chip_info_7445 = { 279 279 .init_func = &brcm_usb_dvr_init_7445, 280 280 .required_regs = { 281 281 BRCM_REGS_CTRL,
+9
drivers/phy/cadence/Kconfig
··· 27 27 select GENERIC_PHY 28 28 help 29 29 Enable this to support the Cadence Sierra PHY driver 30 + 31 + config PHY_CADENCE_SALVO 32 + tristate "Cadence Salvo PHY Driver" 33 + depends on OF && HAS_IOMEM 34 + select GENERIC_PHY 35 + help 36 + Enable this to support the Cadence SALVO PHY driver, 37 + this PHY is a legacy PHY, and only are used for USB3 38 + and USB2.
+1
drivers/phy/cadence/Makefile
··· 2 2 obj-$(CONFIG_PHY_CADENCE_TORRENT) += phy-cadence-torrent.o 3 3 obj-$(CONFIG_PHY_CADENCE_DPHY) += cdns-dphy.o 4 4 obj-$(CONFIG_PHY_CADENCE_SIERRA) += phy-cadence-sierra.o 5 + obj-$(CONFIG_PHY_CADENCE_SALVO) += phy-cadence-salvo.o
+325
drivers/phy/cadence/phy-cadence-salvo.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Salvo PHY is a 28nm PHY, it is a legacy PHY, and only 4 + * for USB3 and USB2. 5 + * 6 + * Copyright (c) 2019-2020 NXP 7 + */ 8 + 9 + #include <linux/clk.h> 10 + #include <linux/io.h> 11 + #include <linux/module.h> 12 + #include <linux/phy/phy.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/delay.h> 15 + #include <linux/of.h> 16 + #include <linux/of_platform.h> 17 + 18 + /* PHY register definition */ 19 + #define PHY_PMA_CMN_CTRL1 0xC800 20 + #define TB_ADDR_CMN_DIAG_HSCLK_SEL 0x01e0 21 + #define TB_ADDR_CMN_PLL0_VCOCAL_INIT_TMR 0x0084 22 + #define TB_ADDR_CMN_PLL0_VCOCAL_ITER_TMR 0x0085 23 + #define TB_ADDR_CMN_PLL0_INTDIV 0x0094 24 + #define TB_ADDR_CMN_PLL0_FRACDIV 0x0095 25 + #define TB_ADDR_CMN_PLL0_HIGH_THR 0x0096 26 + #define TB_ADDR_CMN_PLL0_SS_CTRL1 0x0098 27 + #define TB_ADDR_CMN_PLL0_SS_CTRL2 0x0099 28 + #define TB_ADDR_CMN_PLL0_DSM_DIAG 0x0097 29 + #define TB_ADDR_CMN_DIAG_PLL0_OVRD 0x01c2 30 + #define TB_ADDR_CMN_DIAG_PLL0_FBH_OVRD 0x01c0 31 + #define TB_ADDR_CMN_DIAG_PLL0_FBL_OVRD 0x01c1 32 + #define TB_ADDR_CMN_DIAG_PLL0_V2I_TUNE 0x01C5 33 + #define TB_ADDR_CMN_DIAG_PLL0_CP_TUNE 0x01C6 34 + #define TB_ADDR_CMN_DIAG_PLL0_LF_PROG 0x01C7 35 + #define TB_ADDR_CMN_DIAG_PLL0_TEST_MODE 0x01c4 36 + #define TB_ADDR_CMN_PSM_CLK_CTRL 0x0061 37 + #define TB_ADDR_XCVR_DIAG_RX_LANE_CAL_RST_TMR 0x40ea 38 + #define TB_ADDR_XCVR_PSM_RCTRL 0x4001 39 + #define TB_ADDR_TX_PSC_A0 0x4100 40 + #define TB_ADDR_TX_PSC_A1 0x4101 41 + #define TB_ADDR_TX_PSC_A2 0x4102 42 + #define TB_ADDR_TX_PSC_A3 0x4103 43 + #define TB_ADDR_TX_DIAG_ECTRL_OVRD 0x41f5 44 + #define TB_ADDR_TX_PSC_CAL 0x4106 45 + #define TB_ADDR_TX_PSC_RDY 0x4107 46 + #define TB_ADDR_RX_PSC_A0 0x8000 47 + #define TB_ADDR_RX_PSC_A1 0x8001 48 + #define TB_ADDR_RX_PSC_A2 0x8002 49 + #define TB_ADDR_RX_PSC_A3 0x8003 50 + #define TB_ADDR_RX_PSC_CAL 0x8006 51 + #define TB_ADDR_RX_PSC_RDY 0x8007 52 + #define TB_ADDR_TX_TXCC_MGNLS_MULT_000 0x4058 53 + #define TB_ADDR_TX_DIAG_BGREF_PREDRV_DELAY 0x41e7 54 + #define TB_ADDR_RX_SLC_CU_ITER_TMR 0x80e3 55 + #define TB_ADDR_RX_SIGDET_HL_FILT_TMR 0x8090 56 + #define TB_ADDR_RX_SAMP_DAC_CTRL 0x8058 57 + #define TB_ADDR_RX_DIAG_SIGDET_TUNE 0x81dc 58 + #define TB_ADDR_RX_DIAG_LFPSDET_TUNE2 0x81df 59 + #define TB_ADDR_RX_DIAG_BS_TM 0x81f5 60 + #define TB_ADDR_RX_DIAG_DFE_CTRL1 0x81d3 61 + #define TB_ADDR_RX_DIAG_ILL_IQE_TRIM4 0x81c7 62 + #define TB_ADDR_RX_DIAG_ILL_E_TRIM0 0x81c2 63 + #define TB_ADDR_RX_DIAG_ILL_IQ_TRIM0 0x81c1 64 + #define TB_ADDR_RX_DIAG_ILL_IQE_TRIM6 0x81c9 65 + #define TB_ADDR_RX_DIAG_RXFE_TM3 0x81f8 66 + #define TB_ADDR_RX_DIAG_RXFE_TM4 0x81f9 67 + #define TB_ADDR_RX_DIAG_LFPSDET_TUNE 0x81dd 68 + #define TB_ADDR_RX_DIAG_DFE_CTRL3 0x81d5 69 + #define TB_ADDR_RX_DIAG_SC2C_DELAY 0x81e1 70 + #define TB_ADDR_RX_REE_VGA_GAIN_NODFE 0x81bf 71 + #define TB_ADDR_XCVR_PSM_CAL_TMR 0x4002 72 + #define TB_ADDR_XCVR_PSM_A0BYP_TMR 0x4004 73 + #define TB_ADDR_XCVR_PSM_A0IN_TMR 0x4003 74 + #define TB_ADDR_XCVR_PSM_A1IN_TMR 0x4005 75 + #define TB_ADDR_XCVR_PSM_A2IN_TMR 0x4006 76 + #define TB_ADDR_XCVR_PSM_A3IN_TMR 0x4007 77 + #define TB_ADDR_XCVR_PSM_A4IN_TMR 0x4008 78 + #define TB_ADDR_XCVR_PSM_A5IN_TMR 0x4009 79 + #define TB_ADDR_XCVR_PSM_A0OUT_TMR 0x400a 80 + #define TB_ADDR_XCVR_PSM_A1OUT_TMR 0x400b 81 + #define TB_ADDR_XCVR_PSM_A2OUT_TMR 0x400c 82 + #define TB_ADDR_XCVR_PSM_A3OUT_TMR 0x400d 83 + #define TB_ADDR_XCVR_PSM_A4OUT_TMR 0x400e 84 + #define TB_ADDR_XCVR_PSM_A5OUT_TMR 0x400f 85 + #define TB_ADDR_TX_RCVDET_EN_TMR 0x4122 86 + #define TB_ADDR_TX_RCVDET_ST_TMR 0x4123 87 + #define TB_ADDR_XCVR_DIAG_LANE_FCM_EN_MGN_TMR 0x40f2 88 + #define TB_ADDR_TX_RCVDETSC_CTRL 0x4124 89 + 90 + /* TB_ADDR_TX_RCVDETSC_CTRL */ 91 + #define RXDET_IN_P3_32KHZ BIT(1) 92 + 93 + struct cdns_reg_pairs { 94 + u16 val; 95 + u32 off; 96 + }; 97 + 98 + struct cdns_salvo_data { 99 + u8 reg_offset_shift; 100 + struct cdns_reg_pairs *init_sequence_val; 101 + u8 init_sequence_length; 102 + }; 103 + 104 + struct cdns_salvo_phy { 105 + struct phy *phy; 106 + struct clk *clk; 107 + void __iomem *base; 108 + struct cdns_salvo_data *data; 109 + }; 110 + 111 + static const struct of_device_id cdns_salvo_phy_of_match[]; 112 + static u16 cdns_salvo_read(struct cdns_salvo_phy *salvo_phy, u32 reg) 113 + { 114 + return (u16)readl(salvo_phy->base + 115 + reg * (1 << salvo_phy->data->reg_offset_shift)); 116 + } 117 + 118 + static void cdns_salvo_write(struct cdns_salvo_phy *salvo_phy, 119 + u32 reg, u16 val) 120 + { 121 + writel(val, salvo_phy->base + 122 + reg * (1 << salvo_phy->data->reg_offset_shift)); 123 + } 124 + 125 + /* 126 + * Below bringup sequence pair are from Cadence PHY's User Guide 127 + * and NXP platform tuning results. 128 + */ 129 + static struct cdns_reg_pairs cdns_nxp_sequence_pair[] = { 130 + {0x0830, PHY_PMA_CMN_CTRL1}, 131 + {0x0010, TB_ADDR_CMN_DIAG_HSCLK_SEL}, 132 + {0x00f0, TB_ADDR_CMN_PLL0_VCOCAL_INIT_TMR}, 133 + {0x0018, TB_ADDR_CMN_PLL0_VCOCAL_ITER_TMR}, 134 + {0x00d0, TB_ADDR_CMN_PLL0_INTDIV}, 135 + {0x4aaa, TB_ADDR_CMN_PLL0_FRACDIV}, 136 + {0x0034, TB_ADDR_CMN_PLL0_HIGH_THR}, 137 + {0x01ee, TB_ADDR_CMN_PLL0_SS_CTRL1}, 138 + {0x7f03, TB_ADDR_CMN_PLL0_SS_CTRL2}, 139 + {0x0020, TB_ADDR_CMN_PLL0_DSM_DIAG}, 140 + {0x0000, TB_ADDR_CMN_DIAG_PLL0_OVRD}, 141 + {0x0000, TB_ADDR_CMN_DIAG_PLL0_FBH_OVRD}, 142 + {0x0000, TB_ADDR_CMN_DIAG_PLL0_FBL_OVRD}, 143 + {0x0007, TB_ADDR_CMN_DIAG_PLL0_V2I_TUNE}, 144 + {0x0027, TB_ADDR_CMN_DIAG_PLL0_CP_TUNE}, 145 + {0x0008, TB_ADDR_CMN_DIAG_PLL0_LF_PROG}, 146 + {0x0022, TB_ADDR_CMN_DIAG_PLL0_TEST_MODE}, 147 + {0x000a, TB_ADDR_CMN_PSM_CLK_CTRL}, 148 + {0x0139, TB_ADDR_XCVR_DIAG_RX_LANE_CAL_RST_TMR}, 149 + {0xbefc, TB_ADDR_XCVR_PSM_RCTRL}, 150 + 151 + {0x7799, TB_ADDR_TX_PSC_A0}, 152 + {0x7798, TB_ADDR_TX_PSC_A1}, 153 + {0x509b, TB_ADDR_TX_PSC_A2}, 154 + {0x0003, TB_ADDR_TX_DIAG_ECTRL_OVRD}, 155 + {0x509b, TB_ADDR_TX_PSC_A3}, 156 + {0x2090, TB_ADDR_TX_PSC_CAL}, 157 + {0x2090, TB_ADDR_TX_PSC_RDY}, 158 + 159 + {0xA6FD, TB_ADDR_RX_PSC_A0}, 160 + {0xA6FD, TB_ADDR_RX_PSC_A1}, 161 + {0xA410, TB_ADDR_RX_PSC_A2}, 162 + {0x2410, TB_ADDR_RX_PSC_A3}, 163 + 164 + {0x23FF, TB_ADDR_RX_PSC_CAL}, 165 + {0x2010, TB_ADDR_RX_PSC_RDY}, 166 + 167 + {0x0020, TB_ADDR_TX_TXCC_MGNLS_MULT_000}, 168 + {0x00ff, TB_ADDR_TX_DIAG_BGREF_PREDRV_DELAY}, 169 + {0x0002, TB_ADDR_RX_SLC_CU_ITER_TMR}, 170 + {0x0013, TB_ADDR_RX_SIGDET_HL_FILT_TMR}, 171 + {0x0000, TB_ADDR_RX_SAMP_DAC_CTRL}, 172 + {0x1004, TB_ADDR_RX_DIAG_SIGDET_TUNE}, 173 + {0x4041, TB_ADDR_RX_DIAG_LFPSDET_TUNE2}, 174 + {0x0480, TB_ADDR_RX_DIAG_BS_TM}, 175 + {0x8006, TB_ADDR_RX_DIAG_DFE_CTRL1}, 176 + {0x003f, TB_ADDR_RX_DIAG_ILL_IQE_TRIM4}, 177 + {0x543f, TB_ADDR_RX_DIAG_ILL_E_TRIM0}, 178 + {0x543f, TB_ADDR_RX_DIAG_ILL_IQ_TRIM0}, 179 + {0x0000, TB_ADDR_RX_DIAG_ILL_IQE_TRIM6}, 180 + {0x8000, TB_ADDR_RX_DIAG_RXFE_TM3}, 181 + {0x0003, TB_ADDR_RX_DIAG_RXFE_TM4}, 182 + {0x2408, TB_ADDR_RX_DIAG_LFPSDET_TUNE}, 183 + {0x05ca, TB_ADDR_RX_DIAG_DFE_CTRL3}, 184 + {0x0258, TB_ADDR_RX_DIAG_SC2C_DELAY}, 185 + {0x1fff, TB_ADDR_RX_REE_VGA_GAIN_NODFE}, 186 + 187 + {0x02c6, TB_ADDR_XCVR_PSM_CAL_TMR}, 188 + {0x0002, TB_ADDR_XCVR_PSM_A0BYP_TMR}, 189 + {0x02c6, TB_ADDR_XCVR_PSM_A0IN_TMR}, 190 + {0x0010, TB_ADDR_XCVR_PSM_A1IN_TMR}, 191 + {0x0010, TB_ADDR_XCVR_PSM_A2IN_TMR}, 192 + {0x0010, TB_ADDR_XCVR_PSM_A3IN_TMR}, 193 + {0x0010, TB_ADDR_XCVR_PSM_A4IN_TMR}, 194 + {0x0010, TB_ADDR_XCVR_PSM_A5IN_TMR}, 195 + 196 + {0x0002, TB_ADDR_XCVR_PSM_A0OUT_TMR}, 197 + {0x0002, TB_ADDR_XCVR_PSM_A1OUT_TMR}, 198 + {0x0002, TB_ADDR_XCVR_PSM_A2OUT_TMR}, 199 + {0x0002, TB_ADDR_XCVR_PSM_A3OUT_TMR}, 200 + {0x0002, TB_ADDR_XCVR_PSM_A4OUT_TMR}, 201 + {0x0002, TB_ADDR_XCVR_PSM_A5OUT_TMR}, 202 + /* Change rx detect parameter */ 203 + {0x0960, TB_ADDR_TX_RCVDET_EN_TMR}, 204 + {0x01e0, TB_ADDR_TX_RCVDET_ST_TMR}, 205 + {0x0090, TB_ADDR_XCVR_DIAG_LANE_FCM_EN_MGN_TMR}, 206 + }; 207 + 208 + static int cdns_salvo_phy_init(struct phy *phy) 209 + { 210 + struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); 211 + struct cdns_salvo_data *data = salvo_phy->data; 212 + int ret, i; 213 + u16 value; 214 + 215 + ret = clk_prepare_enable(salvo_phy->clk); 216 + if (ret) 217 + return ret; 218 + 219 + for (i = 0; i < data->init_sequence_length; i++) { 220 + struct cdns_reg_pairs *reg_pair = data->init_sequence_val + i; 221 + 222 + cdns_salvo_write(salvo_phy, reg_pair->off, reg_pair->val); 223 + } 224 + 225 + /* RXDET_IN_P3_32KHZ, Receiver detect slow clock enable */ 226 + value = cdns_salvo_read(salvo_phy, TB_ADDR_TX_RCVDETSC_CTRL); 227 + value |= RXDET_IN_P3_32KHZ; 228 + cdns_salvo_write(salvo_phy, TB_ADDR_TX_RCVDETSC_CTRL, 229 + RXDET_IN_P3_32KHZ); 230 + 231 + udelay(10); 232 + 233 + clk_disable_unprepare(salvo_phy->clk); 234 + 235 + return ret; 236 + } 237 + 238 + static int cdns_salvo_phy_power_on(struct phy *phy) 239 + { 240 + struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); 241 + 242 + return clk_prepare_enable(salvo_phy->clk); 243 + } 244 + 245 + static int cdns_salvo_phy_power_off(struct phy *phy) 246 + { 247 + struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); 248 + 249 + clk_disable_unprepare(salvo_phy->clk); 250 + 251 + return 0; 252 + } 253 + 254 + static struct phy_ops cdns_salvo_phy_ops = { 255 + .init = cdns_salvo_phy_init, 256 + .power_on = cdns_salvo_phy_power_on, 257 + .power_off = cdns_salvo_phy_power_off, 258 + .owner = THIS_MODULE, 259 + }; 260 + 261 + static int cdns_salvo_phy_probe(struct platform_device *pdev) 262 + { 263 + struct phy_provider *phy_provider; 264 + struct device *dev = &pdev->dev; 265 + struct cdns_salvo_phy *salvo_phy; 266 + struct resource *res; 267 + const struct of_device_id *match; 268 + struct cdns_salvo_data *data; 269 + 270 + match = of_match_device(cdns_salvo_phy_of_match, dev); 271 + if (!match) 272 + return -EINVAL; 273 + 274 + data = (struct cdns_salvo_data *)match->data; 275 + salvo_phy = devm_kzalloc(dev, sizeof(*salvo_phy), GFP_KERNEL); 276 + if (!salvo_phy) 277 + return -ENOMEM; 278 + 279 + salvo_phy->data = data; 280 + salvo_phy->clk = devm_clk_get_optional(dev, "salvo_phy_clk"); 281 + if (IS_ERR(salvo_phy->clk)) 282 + return PTR_ERR(salvo_phy->clk); 283 + 284 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 285 + salvo_phy->base = devm_ioremap_resource(dev, res); 286 + if (IS_ERR(salvo_phy->base)) 287 + return PTR_ERR(salvo_phy->base); 288 + 289 + salvo_phy->phy = devm_phy_create(dev, NULL, &cdns_salvo_phy_ops); 290 + if (IS_ERR(salvo_phy->phy)) 291 + return PTR_ERR(salvo_phy->phy); 292 + 293 + phy_set_drvdata(salvo_phy->phy, salvo_phy); 294 + 295 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 296 + return PTR_ERR_OR_ZERO(phy_provider); 297 + } 298 + 299 + static const struct cdns_salvo_data cdns_nxp_salvo_data = { 300 + 2, 301 + cdns_nxp_sequence_pair, 302 + ARRAY_SIZE(cdns_nxp_sequence_pair), 303 + }; 304 + 305 + static const struct of_device_id cdns_salvo_phy_of_match[] = { 306 + { 307 + .compatible = "nxp,salvo-phy", 308 + .data = &cdns_nxp_salvo_data, 309 + }, 310 + {} 311 + }; 312 + MODULE_DEVICE_TABLE(of, cdns_salvo_phy_of_match); 313 + 314 + static struct platform_driver cdns_salvo_phy_driver = { 315 + .probe = cdns_salvo_phy_probe, 316 + .driver = { 317 + .name = "cdns-salvo-phy", 318 + .of_match_table = cdns_salvo_phy_of_match, 319 + } 320 + }; 321 + module_platform_driver(cdns_salvo_phy_driver); 322 + 323 + MODULE_AUTHOR("Peter Chen <peter.chen@nxp.com>"); 324 + MODULE_LICENSE("GPL v2"); 325 + MODULE_DESCRIPTION("Cadence SALVO PHY Driver");
+14 -13
drivers/phy/cadence/phy-cadence-sierra.c
··· 685 685 static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { 686 686 {0xFE0A, SIERRA_DET_STANDEC_A_PREG}, 687 687 {0x000F, SIERRA_DET_STANDEC_B_PREG}, 688 - {0x00A5, SIERRA_DET_STANDEC_C_PREG}, 688 + {0x55A5, SIERRA_DET_STANDEC_C_PREG}, 689 689 {0x69ad, SIERRA_DET_STANDEC_D_PREG}, 690 690 {0x0241, SIERRA_DET_STANDEC_E_PREG}, 691 - {0x0010, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, 691 + {0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, 692 692 {0x0014, SIERRA_PSM_A0IN_TMR_PREG}, 693 693 {0xCF00, SIERRA_PSM_DIAG_PREG}, 694 694 {0x001F, SIERRA_PSC_TX_A0_PREG}, ··· 696 696 {0x0003, SIERRA_PSC_TX_A2_PREG}, 697 697 {0x0003, SIERRA_PSC_TX_A3_PREG}, 698 698 {0x0FFF, SIERRA_PSC_RX_A0_PREG}, 699 - {0x0619, SIERRA_PSC_RX_A1_PREG}, 699 + {0x0003, SIERRA_PSC_RX_A1_PREG}, 700 700 {0x0003, SIERRA_PSC_RX_A2_PREG}, 701 701 {0x0001, SIERRA_PSC_RX_A3_PREG}, 702 702 {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG}, ··· 705 705 {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG}, 706 706 {0x2512, SIERRA_DFE_BIASTRIM_PREG}, 707 707 {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 708 - {0x873E, SIERRA_CLKPATHCTRL_TMR_PREG}, 709 - {0x03CF, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 710 - {0x01CE, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 708 + {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, 709 + {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 710 + {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 711 711 {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 712 - {0x033F, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 712 + {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 713 713 {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, 714 714 {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 715 - {0x8000, SIERRA_CREQ_SPARE_PREG}, 715 + {0x0000, SIERRA_CREQ_SPARE_PREG}, 716 716 {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 717 - {0x8453, SIERRA_CTLELUT_CTRL_PREG}, 718 - {0x4110, SIERRA_DFE_ECMP_RATESEL_PREG}, 719 - {0x4110, SIERRA_DFE_SMP_RATESEL_PREG}, 720 - {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, 717 + {0x8452, SIERRA_CTLELUT_CTRL_PREG}, 718 + {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, 719 + {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, 720 + {0x0003, SIERRA_DEQ_PHALIGN_CTRL}, 721 721 {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG}, 722 722 {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 723 723 {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, ··· 725 725 {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 726 726 {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG}, 727 727 {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG}, 728 - {0x9A8A, SIERRA_DEQ_VGATUNE_CTRL_PREG}, 728 + {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, 729 729 {0x0014, SIERRA_DEQ_GLUT0}, 730 730 {0x0014, SIERRA_DEQ_GLUT1}, 731 731 {0x0014, SIERRA_DEQ_GLUT2}, ··· 772 772 {0x000F, SIERRA_LFPSFILT_NS_PREG}, 773 773 {0x0009, SIERRA_LFPSFILT_RD_PREG}, 774 774 {0x0001, SIERRA_LFPSFILT_MP_PREG}, 775 + {0x6013, SIERRA_SIGDET_SUPPORT_PREG}, 775 776 {0x8013, SIERRA_SDFILT_H2L_A_PREG}, 776 777 {0x8009, SIERRA_SDFILT_L2H_PREG}, 777 778 {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG},
+15
drivers/phy/intel/Kconfig
··· 2 2 # 3 3 # Phy drivers for Intel Lightning Mountain(LGM) platform 4 4 # 5 + config PHY_INTEL_COMBO 6 + bool "Intel ComboPHY driver" 7 + depends on X86 || COMPILE_TEST 8 + depends on OF && HAS_IOMEM 9 + select MFD_SYSCON 10 + select GENERIC_PHY 11 + select REGMAP 12 + help 13 + Enable this to support Intel ComboPhy. 14 + 15 + This driver configures ComboPhy subsystem on Intel gateway 16 + chipsets which provides PHYs for various controllers, EMAC, 17 + SATA and PCIe. 18 + 5 19 config PHY_INTEL_EMMC 6 20 tristate "Intel EMMC PHY driver" 21 + depends on X86 || COMPILE_TEST 7 22 select GENERIC_PHY 8 23 help 9 24 Enable this to support the Intel EMMC PHY
+1
drivers/phy/intel/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 + obj-$(CONFIG_PHY_INTEL_COMBO) += phy-intel-combo.o 2 3 obj-$(CONFIG_PHY_INTEL_EMMC) += phy-intel-emmc.o
+632
drivers/phy/intel/phy-intel-combo.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Intel Combo-PHY driver 4 + * 5 + * Copyright (C) 2019-2020 Intel Corporation. 6 + */ 7 + 8 + #include <linux/bitfield.h> 9 + #include <linux/clk.h> 10 + #include <linux/iopoll.h> 11 + #include <linux/mfd/syscon.h> 12 + #include <linux/module.h> 13 + #include <linux/mutex.h> 14 + #include <linux/of.h> 15 + #include <linux/phy/phy.h> 16 + #include <linux/platform_device.h> 17 + #include <linux/regmap.h> 18 + #include <linux/reset.h> 19 + 20 + #include <dt-bindings/phy/phy.h> 21 + 22 + #define PCIE_PHY_GEN_CTRL 0x00 23 + #define PCIE_PHY_CLK_PAD BIT(17) 24 + 25 + #define PAD_DIS_CFG 0x174 26 + 27 + #define PCS_XF_ATE_OVRD_IN_2 0x3008 28 + #define ADAPT_REQ_MSK GENMASK(5, 4) 29 + 30 + #define PCS_XF_RX_ADAPT_ACK 0x3010 31 + #define RX_ADAPT_ACK_BIT BIT(0) 32 + 33 + #define CR_ADDR(addr, lane) (((addr) + (lane) * 0x100) << 2) 34 + #define REG_COMBO_MODE(x) ((x) * 0x200) 35 + #define REG_CLK_DISABLE(x) ((x) * 0x200 + 0x124) 36 + 37 + #define COMBO_PHY_ID(x) ((x)->parent->id) 38 + #define PHY_ID(x) ((x)->id) 39 + 40 + #define CLK_100MHZ 100000000 41 + #define CLK_156_25MHZ 156250000 42 + 43 + static const unsigned long intel_iphy_clk_rates[] = { 44 + CLK_100MHZ, CLK_156_25MHZ, CLK_100MHZ, 45 + }; 46 + 47 + enum { 48 + PHY_0, 49 + PHY_1, 50 + PHY_MAX_NUM 51 + }; 52 + 53 + /* 54 + * Clock Register bit fields to enable clocks 55 + * for ComboPhy according to the mode. 56 + */ 57 + enum intel_phy_mode { 58 + PHY_PCIE_MODE = 0, 59 + PHY_XPCS_MODE, 60 + PHY_SATA_MODE, 61 + }; 62 + 63 + /* ComboPhy mode Register values */ 64 + enum intel_combo_mode { 65 + PCIE0_PCIE1_MODE = 0, 66 + PCIE_DL_MODE, 67 + RXAUI_MODE, 68 + XPCS0_XPCS1_MODE, 69 + SATA0_SATA1_MODE, 70 + }; 71 + 72 + enum aggregated_mode { 73 + PHY_SL_MODE, 74 + PHY_DL_MODE, 75 + }; 76 + 77 + struct intel_combo_phy; 78 + 79 + struct intel_cbphy_iphy { 80 + struct phy *phy; 81 + struct intel_combo_phy *parent; 82 + struct reset_control *app_rst; 83 + u32 id; 84 + }; 85 + 86 + struct intel_combo_phy { 87 + struct device *dev; 88 + struct clk *core_clk; 89 + unsigned long clk_rate; 90 + void __iomem *app_base; 91 + void __iomem *cr_base; 92 + struct regmap *syscfg; 93 + struct regmap *hsiocfg; 94 + u32 id; 95 + u32 bid; 96 + struct reset_control *phy_rst; 97 + struct reset_control *core_rst; 98 + struct intel_cbphy_iphy iphy[PHY_MAX_NUM]; 99 + enum intel_phy_mode phy_mode; 100 + enum aggregated_mode aggr_mode; 101 + u32 init_cnt; 102 + struct mutex lock; 103 + }; 104 + 105 + static int intel_cbphy_iphy_enable(struct intel_cbphy_iphy *iphy, bool set) 106 + { 107 + struct intel_combo_phy *cbphy = iphy->parent; 108 + u32 mask = BIT(cbphy->phy_mode * 2 + iphy->id); 109 + u32 val; 110 + 111 + /* Register: 0 is enable, 1 is disable */ 112 + val = set ? 0 : mask; 113 + 114 + return regmap_update_bits(cbphy->hsiocfg, REG_CLK_DISABLE(cbphy->bid), 115 + mask, val); 116 + } 117 + 118 + static int intel_cbphy_pcie_refclk_cfg(struct intel_cbphy_iphy *iphy, bool set) 119 + { 120 + struct intel_combo_phy *cbphy = iphy->parent; 121 + u32 mask = BIT(cbphy->id * 2 + iphy->id); 122 + u32 val; 123 + 124 + /* Register: 0 is enable, 1 is disable */ 125 + val = set ? 0 : mask; 126 + 127 + return regmap_update_bits(cbphy->syscfg, PAD_DIS_CFG, mask, val); 128 + } 129 + 130 + static inline void combo_phy_w32_off_mask(void __iomem *base, unsigned int reg, 131 + u32 mask, u32 val) 132 + { 133 + u32 reg_val; 134 + 135 + reg_val = readl(base + reg); 136 + reg_val &= ~mask; 137 + reg_val |= FIELD_PREP(mask, val); 138 + writel(reg_val, base + reg); 139 + } 140 + 141 + static int intel_cbphy_iphy_cfg(struct intel_cbphy_iphy *iphy, 142 + int (*phy_cfg)(struct intel_cbphy_iphy *)) 143 + { 144 + struct intel_combo_phy *cbphy = iphy->parent; 145 + int ret; 146 + 147 + ret = phy_cfg(iphy); 148 + if (ret) 149 + return ret; 150 + 151 + if (cbphy->aggr_mode != PHY_DL_MODE) 152 + return 0; 153 + 154 + return phy_cfg(&cbphy->iphy[PHY_1]); 155 + } 156 + 157 + static int intel_cbphy_pcie_en_pad_refclk(struct intel_cbphy_iphy *iphy) 158 + { 159 + struct intel_combo_phy *cbphy = iphy->parent; 160 + int ret; 161 + 162 + ret = intel_cbphy_pcie_refclk_cfg(iphy, true); 163 + if (ret) { 164 + dev_err(cbphy->dev, "Failed to enable PCIe pad refclk\n"); 165 + return ret; 166 + } 167 + 168 + if (cbphy->init_cnt) 169 + return 0; 170 + 171 + combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL, 172 + PCIE_PHY_CLK_PAD, 0); 173 + 174 + /* Delay for stable clock PLL */ 175 + usleep_range(50, 100); 176 + 177 + return 0; 178 + } 179 + 180 + static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy) 181 + { 182 + struct intel_combo_phy *cbphy = iphy->parent; 183 + int ret; 184 + 185 + ret = intel_cbphy_pcie_refclk_cfg(iphy, false); 186 + if (ret) { 187 + dev_err(cbphy->dev, "Failed to disable PCIe pad refclk\n"); 188 + return ret; 189 + } 190 + 191 + if (cbphy->init_cnt) 192 + return 0; 193 + 194 + combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL, 195 + PCIE_PHY_CLK_PAD, 1); 196 + 197 + return 0; 198 + } 199 + 200 + static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy) 201 + { 202 + enum intel_combo_mode cb_mode = PHY_PCIE_MODE; 203 + enum aggregated_mode aggr = cbphy->aggr_mode; 204 + struct device *dev = cbphy->dev; 205 + enum intel_phy_mode mode; 206 + int ret; 207 + 208 + mode = cbphy->phy_mode; 209 + 210 + switch (mode) { 211 + case PHY_PCIE_MODE: 212 + cb_mode = (aggr == PHY_DL_MODE) ? PCIE_DL_MODE : PCIE0_PCIE1_MODE; 213 + break; 214 + 215 + case PHY_XPCS_MODE: 216 + cb_mode = (aggr == PHY_DL_MODE) ? RXAUI_MODE : XPCS0_XPCS1_MODE; 217 + break; 218 + 219 + case PHY_SATA_MODE: 220 + if (aggr == PHY_DL_MODE) { 221 + dev_err(dev, "Mode:%u not support dual lane!\n", mode); 222 + return -EINVAL; 223 + } 224 + 225 + cb_mode = SATA0_SATA1_MODE; 226 + break; 227 + } 228 + 229 + ret = regmap_write(cbphy->hsiocfg, REG_COMBO_MODE(cbphy->bid), cb_mode); 230 + if (ret) 231 + dev_err(dev, "Failed to set ComboPhy mode: %d\n", ret); 232 + 233 + return ret; 234 + } 235 + 236 + static void intel_cbphy_rst_assert(struct intel_combo_phy *cbphy) 237 + { 238 + reset_control_assert(cbphy->core_rst); 239 + reset_control_assert(cbphy->phy_rst); 240 + } 241 + 242 + static void intel_cbphy_rst_deassert(struct intel_combo_phy *cbphy) 243 + { 244 + reset_control_deassert(cbphy->core_rst); 245 + reset_control_deassert(cbphy->phy_rst); 246 + /* Delay to ensure reset process is done */ 247 + usleep_range(10, 20); 248 + } 249 + 250 + static int intel_cbphy_iphy_power_on(struct intel_cbphy_iphy *iphy) 251 + { 252 + struct intel_combo_phy *cbphy = iphy->parent; 253 + int ret; 254 + 255 + if (!cbphy->init_cnt) { 256 + ret = clk_prepare_enable(cbphy->core_clk); 257 + if (ret) { 258 + dev_err(cbphy->dev, "Clock enable failed!\n"); 259 + return ret; 260 + } 261 + 262 + ret = clk_set_rate(cbphy->core_clk, cbphy->clk_rate); 263 + if (ret) { 264 + dev_err(cbphy->dev, "Clock freq set to %lu failed!\n", 265 + cbphy->clk_rate); 266 + goto clk_err; 267 + } 268 + 269 + intel_cbphy_rst_assert(cbphy); 270 + intel_cbphy_rst_deassert(cbphy); 271 + ret = intel_cbphy_set_mode(cbphy); 272 + if (ret) 273 + goto clk_err; 274 + } 275 + 276 + ret = intel_cbphy_iphy_enable(iphy, true); 277 + if (ret) { 278 + dev_err(cbphy->dev, "Failed enabling PHY core\n"); 279 + goto clk_err; 280 + } 281 + 282 + ret = reset_control_deassert(iphy->app_rst); 283 + if (ret) { 284 + dev_err(cbphy->dev, "PHY(%u:%u) reset deassert failed!\n", 285 + COMBO_PHY_ID(iphy), PHY_ID(iphy)); 286 + goto clk_err; 287 + } 288 + 289 + /* Delay to ensure reset process is done */ 290 + udelay(1); 291 + 292 + return 0; 293 + 294 + clk_err: 295 + clk_disable_unprepare(cbphy->core_clk); 296 + 297 + return ret; 298 + } 299 + 300 + static int intel_cbphy_iphy_power_off(struct intel_cbphy_iphy *iphy) 301 + { 302 + struct intel_combo_phy *cbphy = iphy->parent; 303 + int ret; 304 + 305 + ret = reset_control_assert(iphy->app_rst); 306 + if (ret) { 307 + dev_err(cbphy->dev, "PHY(%u:%u) reset assert failed!\n", 308 + COMBO_PHY_ID(iphy), PHY_ID(iphy)); 309 + return ret; 310 + } 311 + 312 + ret = intel_cbphy_iphy_enable(iphy, false); 313 + if (ret) { 314 + dev_err(cbphy->dev, "Failed disabling PHY core\n"); 315 + return ret; 316 + } 317 + 318 + if (cbphy->init_cnt) 319 + return 0; 320 + 321 + clk_disable_unprepare(cbphy->core_clk); 322 + intel_cbphy_rst_assert(cbphy); 323 + 324 + return 0; 325 + } 326 + 327 + static int intel_cbphy_init(struct phy *phy) 328 + { 329 + struct intel_cbphy_iphy *iphy = phy_get_drvdata(phy); 330 + struct intel_combo_phy *cbphy = iphy->parent; 331 + int ret; 332 + 333 + mutex_lock(&cbphy->lock); 334 + ret = intel_cbphy_iphy_cfg(iphy, intel_cbphy_iphy_power_on); 335 + if (ret) 336 + goto err; 337 + 338 + if (cbphy->phy_mode == PHY_PCIE_MODE) { 339 + ret = intel_cbphy_iphy_cfg(iphy, intel_cbphy_pcie_en_pad_refclk); 340 + if (ret) 341 + goto err; 342 + } 343 + 344 + cbphy->init_cnt++; 345 + 346 + err: 347 + mutex_unlock(&cbphy->lock); 348 + 349 + return ret; 350 + } 351 + 352 + static int intel_cbphy_exit(struct phy *phy) 353 + { 354 + struct intel_cbphy_iphy *iphy = phy_get_drvdata(phy); 355 + struct intel_combo_phy *cbphy = iphy->parent; 356 + int ret; 357 + 358 + mutex_lock(&cbphy->lock); 359 + cbphy->init_cnt--; 360 + if (cbphy->phy_mode == PHY_PCIE_MODE) { 361 + ret = intel_cbphy_iphy_cfg(iphy, intel_cbphy_pcie_dis_pad_refclk); 362 + if (ret) 363 + goto err; 364 + } 365 + 366 + ret = intel_cbphy_iphy_cfg(iphy, intel_cbphy_iphy_power_off); 367 + 368 + err: 369 + mutex_unlock(&cbphy->lock); 370 + 371 + return ret; 372 + } 373 + 374 + static int intel_cbphy_calibrate(struct phy *phy) 375 + { 376 + struct intel_cbphy_iphy *iphy = phy_get_drvdata(phy); 377 + struct intel_combo_phy *cbphy = iphy->parent; 378 + void __iomem *cr_base = cbphy->cr_base; 379 + int val, ret, id; 380 + 381 + if (cbphy->phy_mode != PHY_XPCS_MODE) 382 + return 0; 383 + 384 + id = PHY_ID(iphy); 385 + 386 + /* trigger auto RX adaptation */ 387 + combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id), 388 + ADAPT_REQ_MSK, 3); 389 + /* Wait RX adaptation to finish */ 390 + ret = readl_poll_timeout(cr_base + CR_ADDR(PCS_XF_RX_ADAPT_ACK, id), 391 + val, val & RX_ADAPT_ACK_BIT, 10, 5000); 392 + if (ret) 393 + dev_err(cbphy->dev, "RX Adaptation failed!\n"); 394 + else 395 + dev_dbg(cbphy->dev, "RX Adaptation success!\n"); 396 + 397 + /* Stop RX adaptation */ 398 + combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id), 399 + ADAPT_REQ_MSK, 0); 400 + 401 + return ret; 402 + } 403 + 404 + static int intel_cbphy_fwnode_parse(struct intel_combo_phy *cbphy) 405 + { 406 + struct device *dev = cbphy->dev; 407 + struct platform_device *pdev = to_platform_device(dev); 408 + struct fwnode_handle *fwnode = dev_fwnode(dev); 409 + struct fwnode_reference_args ref; 410 + int ret; 411 + u32 val; 412 + 413 + cbphy->core_clk = devm_clk_get(dev, NULL); 414 + if (IS_ERR(cbphy->core_clk)) { 415 + ret = PTR_ERR(cbphy->core_clk); 416 + if (ret != -EPROBE_DEFER) 417 + dev_err(dev, "Get clk failed:%d!\n", ret); 418 + return ret; 419 + } 420 + 421 + cbphy->core_rst = devm_reset_control_get_optional(dev, "core"); 422 + if (IS_ERR(cbphy->core_rst)) { 423 + ret = PTR_ERR(cbphy->core_rst); 424 + if (ret != -EPROBE_DEFER) 425 + dev_err(dev, "Get core reset control err: %d!\n", ret); 426 + return ret; 427 + } 428 + 429 + cbphy->phy_rst = devm_reset_control_get_optional(dev, "phy"); 430 + if (IS_ERR(cbphy->phy_rst)) { 431 + ret = PTR_ERR(cbphy->phy_rst); 432 + if (ret != -EPROBE_DEFER) 433 + dev_err(dev, "Get PHY reset control err: %d!\n", ret); 434 + return ret; 435 + } 436 + 437 + cbphy->iphy[0].app_rst = devm_reset_control_get_optional(dev, "iphy0"); 438 + if (IS_ERR(cbphy->iphy[0].app_rst)) { 439 + ret = PTR_ERR(cbphy->iphy[0].app_rst); 440 + if (ret != -EPROBE_DEFER) 441 + dev_err(dev, "Get phy0 reset control err: %d!\n", ret); 442 + return ret; 443 + } 444 + 445 + cbphy->iphy[1].app_rst = devm_reset_control_get_optional(dev, "iphy1"); 446 + if (IS_ERR(cbphy->iphy[1].app_rst)) { 447 + ret = PTR_ERR(cbphy->iphy[1].app_rst); 448 + if (ret != -EPROBE_DEFER) 449 + dev_err(dev, "Get phy1 reset control err: %d!\n", ret); 450 + return ret; 451 + } 452 + 453 + cbphy->app_base = devm_platform_ioremap_resource_byname(pdev, "app"); 454 + if (IS_ERR(cbphy->app_base)) 455 + return PTR_ERR(cbphy->app_base); 456 + 457 + cbphy->cr_base = devm_platform_ioremap_resource_byname(pdev, "core"); 458 + if (IS_ERR(cbphy->cr_base)) 459 + return PTR_ERR(cbphy->cr_base); 460 + 461 + /* 462 + * syscfg and hsiocfg variables stores the handle of the registers set 463 + * in which ComboPhy subsytem specific registers are subset. Using 464 + * Register map framework to access the registers set. 465 + */ 466 + ret = fwnode_property_get_reference_args(fwnode, "intel,syscfg", NULL, 467 + 1, 0, &ref); 468 + if (ret < 0) 469 + return ret; 470 + 471 + cbphy->id = ref.args[0]; 472 + cbphy->syscfg = device_node_to_regmap(to_of_node(ref.fwnode)); 473 + fwnode_handle_put(ref.fwnode); 474 + 475 + ret = fwnode_property_get_reference_args(fwnode, "intel,hsio", NULL, 1, 476 + 0, &ref); 477 + if (ret < 0) 478 + return ret; 479 + 480 + cbphy->bid = ref.args[0]; 481 + cbphy->hsiocfg = device_node_to_regmap(to_of_node(ref.fwnode)); 482 + fwnode_handle_put(ref.fwnode); 483 + 484 + ret = fwnode_property_read_u32_array(fwnode, "intel,phy-mode", &val, 1); 485 + if (ret) 486 + return ret; 487 + 488 + switch (val) { 489 + case PHY_TYPE_PCIE: 490 + cbphy->phy_mode = PHY_PCIE_MODE; 491 + break; 492 + 493 + case PHY_TYPE_SATA: 494 + cbphy->phy_mode = PHY_SATA_MODE; 495 + break; 496 + 497 + case PHY_TYPE_XPCS: 498 + cbphy->phy_mode = PHY_XPCS_MODE; 499 + break; 500 + 501 + default: 502 + dev_err(dev, "Invalid PHY mode: %u\n", val); 503 + return -EINVAL; 504 + } 505 + 506 + cbphy->clk_rate = intel_iphy_clk_rates[cbphy->phy_mode]; 507 + 508 + if (fwnode_property_present(fwnode, "intel,aggregation")) 509 + cbphy->aggr_mode = PHY_DL_MODE; 510 + else 511 + cbphy->aggr_mode = PHY_SL_MODE; 512 + 513 + return 0; 514 + } 515 + 516 + static const struct phy_ops intel_cbphy_ops = { 517 + .init = intel_cbphy_init, 518 + .exit = intel_cbphy_exit, 519 + .calibrate = intel_cbphy_calibrate, 520 + .owner = THIS_MODULE, 521 + }; 522 + 523 + static struct phy *intel_cbphy_xlate(struct device *dev, 524 + struct of_phandle_args *args) 525 + { 526 + struct intel_combo_phy *cbphy = dev_get_drvdata(dev); 527 + u32 iphy_id; 528 + 529 + if (args->args_count < 1) { 530 + dev_err(dev, "Invalid number of arguments\n"); 531 + return ERR_PTR(-EINVAL); 532 + } 533 + 534 + iphy_id = args->args[0]; 535 + if (iphy_id >= PHY_MAX_NUM) { 536 + dev_err(dev, "Invalid phy instance %d\n", iphy_id); 537 + return ERR_PTR(-EINVAL); 538 + } 539 + 540 + if (cbphy->aggr_mode == PHY_DL_MODE && iphy_id == PHY_1) { 541 + dev_err(dev, "Invalid. ComboPhy is in Dual lane mode %d\n", iphy_id); 542 + return ERR_PTR(-EINVAL); 543 + } 544 + 545 + return cbphy->iphy[iphy_id].phy; 546 + } 547 + 548 + static int intel_cbphy_create(struct intel_combo_phy *cbphy) 549 + { 550 + struct phy_provider *phy_provider; 551 + struct device *dev = cbphy->dev; 552 + struct intel_cbphy_iphy *iphy; 553 + int i; 554 + 555 + for (i = 0; i < PHY_MAX_NUM; i++) { 556 + iphy = &cbphy->iphy[i]; 557 + iphy->parent = cbphy; 558 + iphy->id = i; 559 + 560 + /* In dual lane mode skip phy creation for the second phy */ 561 + if (cbphy->aggr_mode == PHY_DL_MODE && iphy->id == PHY_1) 562 + continue; 563 + 564 + iphy->phy = devm_phy_create(dev, NULL, &intel_cbphy_ops); 565 + if (IS_ERR(iphy->phy)) { 566 + dev_err(dev, "PHY[%u:%u]: create PHY instance failed!\n", 567 + COMBO_PHY_ID(iphy), PHY_ID(iphy)); 568 + 569 + return PTR_ERR(iphy->phy); 570 + } 571 + 572 + phy_set_drvdata(iphy->phy, iphy); 573 + } 574 + 575 + dev_set_drvdata(dev, cbphy); 576 + phy_provider = devm_of_phy_provider_register(dev, intel_cbphy_xlate); 577 + if (IS_ERR(phy_provider)) 578 + dev_err(dev, "Register PHY provider failed!\n"); 579 + 580 + return PTR_ERR_OR_ZERO(phy_provider); 581 + } 582 + 583 + static int intel_cbphy_probe(struct platform_device *pdev) 584 + { 585 + struct device *dev = &pdev->dev; 586 + struct intel_combo_phy *cbphy; 587 + int ret; 588 + 589 + cbphy = devm_kzalloc(dev, sizeof(*cbphy), GFP_KERNEL); 590 + if (!cbphy) 591 + return -ENOMEM; 592 + 593 + cbphy->dev = dev; 594 + cbphy->init_cnt = 0; 595 + mutex_init(&cbphy->lock); 596 + ret = intel_cbphy_fwnode_parse(cbphy); 597 + if (ret) 598 + return ret; 599 + 600 + platform_set_drvdata(pdev, cbphy); 601 + 602 + return intel_cbphy_create(cbphy); 603 + } 604 + 605 + static int intel_cbphy_remove(struct platform_device *pdev) 606 + { 607 + struct intel_combo_phy *cbphy = platform_get_drvdata(pdev); 608 + 609 + intel_cbphy_rst_assert(cbphy); 610 + clk_disable_unprepare(cbphy->core_clk); 611 + return 0; 612 + } 613 + 614 + static const struct of_device_id of_intel_cbphy_match[] = { 615 + { .compatible = "intel,combo-phy" }, 616 + { .compatible = "intel,combophy-lgm" }, 617 + {} 618 + }; 619 + 620 + static struct platform_driver intel_cbphy_driver = { 621 + .probe = intel_cbphy_probe, 622 + .remove = intel_cbphy_remove, 623 + .driver = { 624 + .name = "intel-combo-phy", 625 + .of_match_table = of_intel_cbphy_match, 626 + } 627 + }; 628 + 629 + module_platform_driver(intel_cbphy_driver); 630 + 631 + MODULE_DESCRIPTION("Intel Combo-phy driver"); 632 + MODULE_LICENSE("GPL v2");
-2
drivers/phy/motorola/phy-cpcap-usb.c
··· 122 122 struct cpcap_phy_ddata { 123 123 struct regmap *reg; 124 124 struct device *dev; 125 - struct clk *refclk; 126 125 struct usb_phy phy; 127 126 struct delayed_work detect_work; 128 127 struct pinctrl *pins; ··· 706 707 707 708 usb_remove_phy(&ddata->phy); 708 709 cancel_delayed_work_sync(&ddata->detect_work); 709 - clk_unprepare(ddata->refclk); 710 710 regulator_disable(ddata->vusb); 711 711 712 712 return 0;
+17
drivers/phy/qualcomm/Kconfig
··· 18 18 depends on OF 19 19 select GENERIC_PHY 20 20 21 + config PHY_QCOM_IPQ4019_USB 22 + tristate "Qualcomm IPQ4019 USB PHY driver" 23 + depends on OF && (ARCH_QCOM || COMPILE_TEST) 24 + select GENERIC_PHY 25 + help 26 + Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s. 27 + 21 28 config PHY_QCOM_IPQ806X_SATA 22 29 tristate "Qualcomm IPQ806x SATA SerDes/PHY driver" 23 30 depends on ARCH_QCOM ··· 91 84 help 92 85 Support for the USB high-speed ULPI compliant phy on Qualcomm 93 86 chipsets. 87 + 88 + config PHY_QCOM_USB_SNPS_FEMTO_V2 89 + tristate "Qualcomm SNPS FEMTO USB HS PHY V2 module" 90 + depends on OF && (ARCH_QCOM || COMPILE_TEST) 91 + select GENERIC_PHY 92 + help 93 + Enable support for the USB high-speed SNPS Femto phy on Qualcomm 94 + chipsets. This PHY has differences in the register map compared 95 + to the V1 variants. The PHY is paired with a Synopsys DWC3 USB 96 + controller on Qualcomm SOCs. 94 97 95 98 config PHY_QCOM_USB_HSIC 96 99 tristate "Qualcomm USB HSIC ULPI PHY module"
+2
drivers/phy/qualcomm/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-$(CONFIG_PHY_ATH79_USB) += phy-ath79-usb.o 3 3 obj-$(CONFIG_PHY_QCOM_APQ8064_SATA) += phy-qcom-apq8064-sata.o 4 + obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o 4 5 obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA) += phy-qcom-ipq806x-sata.o 5 6 obj-$(CONFIG_PHY_QCOM_PCIE2) += phy-qcom-pcie2.o 6 7 obj-$(CONFIG_PHY_QCOM_QMP) += phy-qcom-qmp.o ··· 13 12 obj-$(CONFIG_PHY_QCOM_USB_HSIC) += phy-qcom-usb-hsic.o 14 13 obj-$(CONFIG_PHY_QCOM_USB_HS_28NM) += phy-qcom-usb-hs-28nm.o 15 14 obj-$(CONFIG_PHY_QCOM_USB_SS) += phy-qcom-usb-ss.o 15 + obj-$(CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2)+= phy-qcom-snps-femto-v2.o
+148
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright (C) 2018 John Crispin <john@phrozen.org> 4 + * 5 + * Based on code from 6 + * Allwinner Technology Co., Ltd. <www.allwinnertech.com> 7 + * 8 + */ 9 + 10 + #include <linux/delay.h> 11 + #include <linux/err.h> 12 + #include <linux/io.h> 13 + #include <linux/kernel.h> 14 + #include <linux/module.h> 15 + #include <linux/mutex.h> 16 + #include <linux/of_platform.h> 17 + #include <linux/of_device.h> 18 + #include <linux/phy/phy.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/reset.h> 21 + 22 + struct ipq4019_usb_phy { 23 + struct device *dev; 24 + struct phy *phy; 25 + void __iomem *base; 26 + struct reset_control *por_rst; 27 + struct reset_control *srif_rst; 28 + }; 29 + 30 + static int ipq4019_ss_phy_power_off(struct phy *_phy) 31 + { 32 + struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); 33 + 34 + reset_control_assert(phy->por_rst); 35 + msleep(10); 36 + 37 + return 0; 38 + } 39 + 40 + static int ipq4019_ss_phy_power_on(struct phy *_phy) 41 + { 42 + struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); 43 + 44 + ipq4019_ss_phy_power_off(_phy); 45 + 46 + reset_control_deassert(phy->por_rst); 47 + 48 + return 0; 49 + } 50 + 51 + static struct phy_ops ipq4019_usb_ss_phy_ops = { 52 + .power_on = ipq4019_ss_phy_power_on, 53 + .power_off = ipq4019_ss_phy_power_off, 54 + }; 55 + 56 + static int ipq4019_hs_phy_power_off(struct phy *_phy) 57 + { 58 + struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); 59 + 60 + reset_control_assert(phy->por_rst); 61 + msleep(10); 62 + 63 + reset_control_assert(phy->srif_rst); 64 + msleep(10); 65 + 66 + return 0; 67 + } 68 + 69 + static int ipq4019_hs_phy_power_on(struct phy *_phy) 70 + { 71 + struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy); 72 + 73 + ipq4019_hs_phy_power_off(_phy); 74 + 75 + reset_control_deassert(phy->srif_rst); 76 + msleep(10); 77 + 78 + reset_control_deassert(phy->por_rst); 79 + 80 + return 0; 81 + } 82 + 83 + static struct phy_ops ipq4019_usb_hs_phy_ops = { 84 + .power_on = ipq4019_hs_phy_power_on, 85 + .power_off = ipq4019_hs_phy_power_off, 86 + }; 87 + 88 + static const struct of_device_id ipq4019_usb_phy_of_match[] = { 89 + { .compatible = "qcom,usb-hs-ipq4019-phy", .data = &ipq4019_usb_hs_phy_ops}, 90 + { .compatible = "qcom,usb-ss-ipq4019-phy", .data = &ipq4019_usb_ss_phy_ops}, 91 + { }, 92 + }; 93 + MODULE_DEVICE_TABLE(of, ipq4019_usb_phy_of_match); 94 + 95 + static int ipq4019_usb_phy_probe(struct platform_device *pdev) 96 + { 97 + struct device *dev = &pdev->dev; 98 + struct resource *res; 99 + struct phy_provider *phy_provider; 100 + struct ipq4019_usb_phy *phy; 101 + 102 + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); 103 + if (!phy) 104 + return -ENOMEM; 105 + 106 + phy->dev = &pdev->dev; 107 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 108 + phy->base = devm_ioremap_resource(&pdev->dev, res); 109 + if (IS_ERR(phy->base)) { 110 + dev_err(dev, "failed to remap register memory\n"); 111 + return PTR_ERR(phy->base); 112 + } 113 + 114 + phy->por_rst = devm_reset_control_get(phy->dev, "por_rst"); 115 + if (IS_ERR(phy->por_rst)) { 116 + if (PTR_ERR(phy->por_rst) != -EPROBE_DEFER) 117 + dev_err(dev, "POR reset is missing\n"); 118 + return PTR_ERR(phy->por_rst); 119 + } 120 + 121 + phy->srif_rst = devm_reset_control_get_optional(phy->dev, "srif_rst"); 122 + if (IS_ERR(phy->srif_rst)) 123 + return PTR_ERR(phy->srif_rst); 124 + 125 + phy->phy = devm_phy_create(dev, NULL, of_device_get_match_data(dev)); 126 + if (IS_ERR(phy->phy)) { 127 + dev_err(dev, "failed to create PHY\n"); 128 + return PTR_ERR(phy->phy); 129 + } 130 + phy_set_drvdata(phy->phy, phy); 131 + 132 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 133 + 134 + return PTR_ERR_OR_ZERO(phy_provider); 135 + } 136 + 137 + static struct platform_driver ipq4019_usb_phy_driver = { 138 + .probe = ipq4019_usb_phy_probe, 139 + .driver = { 140 + .of_match_table = ipq4019_usb_phy_of_match, 141 + .name = "ipq4019-usb-phy", 142 + } 143 + }; 144 + module_platform_driver(ipq4019_usb_phy_driver); 145 + 146 + MODULE_DESCRIPTION("QCOM/IPQ4019 USB phy driver"); 147 + MODULE_AUTHOR("John Crispin <john@phrozen.org>"); 148 + MODULE_LICENSE("GPL v2");
+232 -22
drivers/phy/qualcomm/phy-qcom-qmp.c
··· 119 119 QPHY_PCS_AUTONOMOUS_MODE_CTRL, 120 120 QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR, 121 121 QPHY_PCS_LFPS_RXTERM_IRQ_STATUS, 122 + QPHY_PCS_POWER_DOWN_CONTROL, 123 + /* Keep last to ensure regs_layout arrays are properly initialized */ 124 + QPHY_LAYOUT_SIZE 122 125 }; 123 126 124 - static const unsigned int msm8996_ufsphy_regs_layout[] = { 127 + static const unsigned int msm8996_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = { 125 128 [QPHY_START_CTRL] = 0x00, 126 129 [QPHY_PCS_READY_STATUS] = 0x168, 127 130 }; 128 131 129 - static const unsigned int pciephy_regs_layout[] = { 132 + static const unsigned int pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { 130 133 [QPHY_COM_SW_RESET] = 0x400, 131 134 [QPHY_COM_POWER_DOWN_CONTROL] = 0x404, 132 135 [QPHY_COM_START_CONTROL] = 0x408, ··· 145 142 [QPHY_PCS_STATUS] = 0x174, 146 143 }; 147 144 148 - static const unsigned int usb3phy_regs_layout[] = { 145 + static const unsigned int usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { 149 146 [QPHY_FLL_CNTRL1] = 0xc0, 150 147 [QPHY_FLL_CNTRL2] = 0xc4, 151 148 [QPHY_FLL_CNT_VAL_L] = 0xc8, ··· 159 156 [QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x178, 160 157 }; 161 158 162 - static const unsigned int qmp_v3_usb3phy_regs_layout[] = { 159 + static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { 163 160 [QPHY_SW_RESET] = 0x00, 164 161 [QPHY_START_CTRL] = 0x08, 165 162 [QPHY_PCS_STATUS] = 0x174, ··· 168 165 [QPHY_PCS_LFPS_RXTERM_IRQ_STATUS] = 0x170, 169 166 }; 170 167 171 - static const unsigned int sdm845_qmp_pciephy_regs_layout[] = { 168 + static const unsigned int sdm845_qmp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { 172 169 [QPHY_SW_RESET] = 0x00, 173 170 [QPHY_START_CTRL] = 0x08, 174 171 [QPHY_PCS_STATUS] = 0x174, 175 172 }; 176 173 177 - static const unsigned int sdm845_qhp_pciephy_regs_layout[] = { 174 + static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { 178 175 [QPHY_SW_RESET] = 0x00, 179 176 [QPHY_START_CTRL] = 0x08, 180 177 [QPHY_PCS_STATUS] = 0x2ac, 181 178 }; 182 179 183 - static const unsigned int sdm845_ufsphy_regs_layout[] = { 180 + static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { 181 + [QPHY_SW_RESET] = 0x00, 182 + [QPHY_START_CTRL] = 0x44, 183 + [QPHY_PCS_STATUS] = 0x14, 184 + [QPHY_PCS_POWER_DOWN_CONTROL] = 0x40, 185 + }; 186 + 187 + static const unsigned int sdm845_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = { 184 188 [QPHY_START_CTRL] = 0x00, 185 189 [QPHY_PCS_READY_STATUS] = 0x160, 186 190 }; 187 191 188 - static const unsigned int sm8150_ufsphy_regs_layout[] = { 189 - [QPHY_START_CTRL] = QPHY_V4_PHY_START, 190 - [QPHY_PCS_READY_STATUS] = QPHY_V4_PCS_READY_STATUS, 191 - [QPHY_SW_RESET] = QPHY_V4_SW_RESET, 192 + static const unsigned int sm8150_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = { 193 + [QPHY_START_CTRL] = QPHY_V4_PCS_UFS_PHY_START, 194 + [QPHY_PCS_READY_STATUS] = QPHY_V4_PCS_UFS_READY_STATUS, 195 + [QPHY_SW_RESET] = QPHY_V4_PCS_UFS_SW_RESET, 192 196 }; 193 197 194 198 static const struct qmp_phy_init_tbl msm8996_pcie_serdes_tbl[] = { ··· 1282 1272 }; 1283 1273 1284 1274 static const struct qmp_phy_init_tbl sm8150_ufsphy_pcs_tbl[] = { 1285 - QMP_PHY_INIT_CFG(QPHY_V4_RX_SIGDET_CTRL2, 0x6d), 1286 - QMP_PHY_INIT_CFG(QPHY_V4_TX_LARGE_AMP_DRV_LVL, 0x0a), 1287 - QMP_PHY_INIT_CFG(QPHY_V4_TX_SMALL_AMP_DRV_LVL, 0x02), 1288 - QMP_PHY_INIT_CFG(QPHY_V4_TX_MID_TERM_CTRL1, 0x43), 1289 - QMP_PHY_INIT_CFG(QPHY_V4_DEBUG_BUS_CLKSEL, 0x1f), 1290 - QMP_PHY_INIT_CFG(QPHY_V4_RX_MIN_HIBERN8_TIME, 0xff), 1291 - QMP_PHY_INIT_CFG(QPHY_V4_MULTI_LANE_CTRL1, 0x02), 1275 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_RX_SIGDET_CTRL2, 0x6d), 1276 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_LARGE_AMP_DRV_LVL, 0x0a), 1277 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_SMALL_AMP_DRV_LVL, 0x02), 1278 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_TX_MID_TERM_CTRL1, 0x43), 1279 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_DEBUG_BUS_CLKSEL, 0x1f), 1280 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_RX_MIN_HIBERN8_TIME, 0xff), 1281 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_MULTI_LANE_CTRL1, 0x02), 1282 + }; 1283 + 1284 + static const struct qmp_phy_init_tbl sm8150_usb3_serdes_tbl[] = { 1285 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01), 1286 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31), 1287 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01), 1288 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde), 1289 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07), 1290 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0xde), 1291 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x07), 1292 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x0a), 1293 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_IPTRIM, 0x20), 1294 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06), 1295 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06), 1296 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16), 1297 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16), 1298 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36), 1299 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36), 1300 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x1a), 1301 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x04), 1302 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x14), 1303 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x34), 1304 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x34), 1305 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x82), 1306 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82), 1307 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x82), 1308 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0xab), 1309 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0xea), 1310 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x02), 1311 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 1312 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab), 1313 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xea), 1314 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02), 1315 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24), 1316 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0x24), 1317 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x02), 1318 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01), 1319 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08), 1320 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 1321 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 1322 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xca), 1323 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x1e), 1324 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 1325 + }; 1326 + 1327 + static const struct qmp_phy_init_tbl sm8150_usb3_tx_tbl[] = { 1328 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_TX, 0x00), 1329 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_RX, 0x00), 1330 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xd5), 1331 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 1332 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_PI_QEC_CTRL, 0x20), 1333 + }; 1334 + 1335 + static const struct qmp_phy_init_tbl sm8150_usb3_rx_tbl[] = { 1336 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x05), 1337 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 1338 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 1339 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 1340 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 1341 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x99), 1342 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH1, 0x04), 1343 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH2, 0x08), 1344 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN1, 0x05), 1345 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN2, 0x05), 1346 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54), 1347 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x0e), 1348 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 1349 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 1350 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 1351 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 1352 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 1353 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 1354 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x04), 1355 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 1356 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xbf), 1357 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xbf), 1358 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x3f), 1359 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 1360 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x94), 1361 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0xdc), 1362 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xdc), 1363 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0x5c), 1364 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x0b), 1365 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb3), 1366 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 1367 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 1368 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 1369 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 1370 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1f), 1371 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VTH_CODE, 0x10), 1372 + }; 1373 + 1374 + static const struct qmp_phy_init_tbl sm8150_usb3_pcs_tbl[] = { 1375 + /* Lock Det settings */ 1376 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 1377 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 1378 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 1379 + 1380 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 1381 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 1382 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 1383 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 1384 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 1385 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 1386 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 1387 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 1388 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 1389 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 1292 1390 }; 1293 1391 1294 1392 /* struct qmp_phy_cfg - per-PHY initialization config */ ··· 1563 1445 "aux", "cfg_ahb", "ref", "refgen", 1564 1446 }; 1565 1447 1448 + static const char * const qmp_v4_phy_clk_l[] = { 1449 + "aux", "ref_clk_src", "ref", "com_aux", 1450 + }; 1451 + 1566 1452 static const char * const sdm845_ufs_phy_clk_l[] = { 1567 1453 "ref", "ref_aux", 1568 1454 }; ··· 1578 1456 1579 1457 static const char * const msm8996_usb3phy_reset_l[] = { 1580 1458 "phy", "common", 1459 + }; 1460 + 1461 + static const char * const sc7180_usb3phy_reset_l[] = { 1462 + "phy", 1581 1463 }; 1582 1464 1583 1465 static const char * const sdm845_pciephy_reset_l[] = { ··· 1797 1671 .is_dual_lane_phy = true, 1798 1672 }; 1799 1673 1674 + static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { 1675 + .type = PHY_TYPE_USB3, 1676 + .nlanes = 1, 1677 + 1678 + .serdes_tbl = qmp_v3_usb3_serdes_tbl, 1679 + .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), 1680 + .tx_tbl = qmp_v3_usb3_tx_tbl, 1681 + .tx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_tx_tbl), 1682 + .rx_tbl = qmp_v3_usb3_rx_tbl, 1683 + .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), 1684 + .pcs_tbl = qmp_v3_usb3_pcs_tbl, 1685 + .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), 1686 + .clk_list = qmp_v3_phy_clk_l, 1687 + .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), 1688 + .reset_list = sc7180_usb3phy_reset_l, 1689 + .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), 1690 + .vreg_list = qmp_phy_vreg_l, 1691 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1692 + .regs = qmp_v3_usb3phy_regs_layout, 1693 + 1694 + .start_ctrl = SERDES_START | PCS_START, 1695 + .pwrdn_ctrl = SW_PWRDN, 1696 + 1697 + .has_pwrdn_delay = true, 1698 + .pwrdn_delay_min = POWER_DOWN_DELAY_US_MIN, 1699 + .pwrdn_delay_max = POWER_DOWN_DELAY_US_MAX, 1700 + 1701 + .has_phy_dp_com_ctrl = true, 1702 + .is_dual_lane_phy = true, 1703 + }; 1704 + 1800 1705 static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = { 1801 1706 .type = PHY_TYPE_USB3, 1802 1707 .nlanes = 1, ··· 1955 1798 .is_dual_lane_phy = true, 1956 1799 }; 1957 1800 1801 + static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { 1802 + .type = PHY_TYPE_USB3, 1803 + .nlanes = 1, 1804 + 1805 + .serdes_tbl = sm8150_usb3_serdes_tbl, 1806 + .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 1807 + .tx_tbl = sm8150_usb3_tx_tbl, 1808 + .tx_tbl_num = ARRAY_SIZE(sm8150_usb3_tx_tbl), 1809 + .rx_tbl = sm8150_usb3_rx_tbl, 1810 + .rx_tbl_num = ARRAY_SIZE(sm8150_usb3_rx_tbl), 1811 + .pcs_tbl = sm8150_usb3_pcs_tbl, 1812 + .pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_tbl), 1813 + .clk_list = qmp_v4_phy_clk_l, 1814 + .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), 1815 + .reset_list = msm8996_usb3phy_reset_l, 1816 + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 1817 + .vreg_list = qmp_phy_vreg_l, 1818 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1819 + .regs = qmp_v4_usb3phy_regs_layout, 1820 + 1821 + .start_ctrl = SERDES_START | PCS_START, 1822 + .pwrdn_ctrl = SW_PWRDN, 1823 + 1824 + .has_pwrdn_delay = true, 1825 + .pwrdn_delay_min = POWER_DOWN_DELAY_US_MIN, 1826 + .pwrdn_delay_max = POWER_DOWN_DELAY_US_MAX, 1827 + 1828 + .has_phy_dp_com_ctrl = true, 1829 + .is_dual_lane_phy = true, 1830 + }; 1831 + 1958 1832 static void qcom_qmp_phy_configure(void __iomem *base, 1959 1833 const unsigned int *regs, 1960 1834 const struct qmp_phy_init_tbl tbl[], ··· 2068 1880 SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); 2069 1881 } 2070 1882 2071 - if (cfg->has_phy_com_ctrl) 1883 + if (cfg->has_phy_com_ctrl) { 2072 1884 qphy_setbits(serdes, cfg->regs[QPHY_COM_POWER_DOWN_CONTROL], 2073 1885 SW_PWRDN); 2074 - else 2075 - qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl); 1886 + } else { 1887 + if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) 1888 + qphy_setbits(pcs, 1889 + cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], 1890 + cfg->pwrdn_ctrl); 1891 + else 1892 + qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, 1893 + cfg->pwrdn_ctrl); 1894 + } 2076 1895 2077 1896 /* Serdes configuration */ 2078 1897 qcom_qmp_phy_configure(serdes, cfg->regs, cfg->serdes_tbl, ··· 2305 2110 qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl); 2306 2111 2307 2112 /* Put PHY into POWER DOWN state: active low */ 2308 - qphy_clrbits(qphy->pcs, QPHY_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl); 2113 + if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) { 2114 + qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], 2115 + cfg->pwrdn_ctrl); 2116 + } else { 2117 + qphy_clrbits(qphy->pcs, QPHY_POWER_DOWN_CONTROL, 2118 + cfg->pwrdn_ctrl); 2119 + } 2309 2120 2310 2121 if (cfg->has_lane_rst) 2311 2122 reset_control_assert(qphy->lane_rst); ··· 2717 2516 .compatible = "qcom,ipq8074-qmp-pcie-phy", 2718 2517 .data = &ipq8074_pciephy_cfg, 2719 2518 }, { 2519 + .compatible = "qcom,sc7180-qmp-usb3-phy", 2520 + .data = &sc7180_usb3phy_cfg, 2521 + }, { 2720 2522 .compatible = "qcom,sdm845-qhp-pcie-phy", 2721 2523 .data = &sdm845_qhp_pciephy_cfg, 2722 2524 }, { ··· 2740 2536 }, { 2741 2537 .compatible = "qcom,sm8150-qmp-ufs-phy", 2742 2538 .data = &sm8150_ufsphy_cfg, 2539 + }, { 2540 + .compatible = "qcom,sm8250-qmp-ufs-phy", 2541 + .data = &sm8150_ufsphy_cfg, 2542 + }, { 2543 + .compatible = "qcom,sm8150-qmp-usb3-phy", 2544 + .data = &sm8150_usb3phy_cfg, 2743 2545 }, 2744 2546 { }, 2745 2547 };
+216 -22
drivers/phy/qualcomm/phy-qcom-qmp.h
··· 125 125 #define QPHY_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB 0x1DC 126 126 #define QPHY_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB 0x1E0 127 127 128 - /* Only for QMP V3 PHY - DP COM registers */ 128 + /* Only for QMP V3 & V4 PHY - DP COM registers */ 129 129 #define QPHY_V3_DP_COM_PHY_MODE_CTRL 0x00 130 130 #define QPHY_V3_DP_COM_SW_RESET 0x04 131 131 #define QPHY_V3_DP_COM_POWER_DOWN_CTRL 0x08 ··· 314 314 #define QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG5 0x60 315 315 316 316 /* Only for QMP V4 PHY - QSERDES COM registers */ 317 + #define QSERDES_V4_COM_SSC_EN_CENTER 0x010 318 + #define QSERDES_V4_COM_SSC_PER1 0x01c 319 + #define QSERDES_V4_COM_SSC_PER2 0x020 320 + #define QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0 0x024 321 + #define QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0 0x028 322 + #define QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1 0x030 323 + #define QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1 0x034 324 + #define QSERDES_V4_COM_SYSCLK_BUF_ENABLE 0x050 317 325 #define QSERDES_V4_COM_PLL_IVCO 0x058 318 326 #define QSERDES_V4_COM_CMN_IPTRIM 0x060 319 327 #define QSERDES_V4_COM_CP_CTRL_MODE0 0x074 ··· 338 330 #define QSERDES_V4_COM_DEC_START_MODE0 0x0bc 339 331 #define QSERDES_V4_COM_LOCK_CMP2_MODE1 0x0b8 340 332 #define QSERDES_V4_COM_DEC_START_MODE1 0x0c4 333 + #define QSERDES_V4_COM_DIV_FRAC_START1_MODE0 0x0cc 334 + #define QSERDES_V4_COM_DIV_FRAC_START2_MODE0 0x0d0 335 + #define QSERDES_V4_COM_DIV_FRAC_START3_MODE0 0x0d4 336 + #define QSERDES_V4_COM_DIV_FRAC_START1_MODE1 0x0d8 337 + #define QSERDES_V4_COM_DIV_FRAC_START2_MODE1 0x0dc 338 + #define QSERDES_V4_COM_DIV_FRAC_START3_MODE1 0x0e0 341 339 #define QSERDES_V4_COM_VCO_TUNE_MAP 0x10c 340 + #define QSERDES_V4_COM_VCO_TUNE1_MODE0 0x110 341 + #define QSERDES_V4_COM_VCO_TUNE2_MODE0 0x114 342 + #define QSERDES_V4_COM_VCO_TUNE1_MODE1 0x118 343 + #define QSERDES_V4_COM_VCO_TUNE2_MODE1 0x11c 342 344 #define QSERDES_V4_COM_VCO_TUNE_INITVAL2 0x124 343 345 #define QSERDES_V4_COM_HSCLK_SEL 0x158 344 346 #define QSERDES_V4_COM_HSCLK_HS_SWITCH_SEL 0x15c 347 + #define QSERDES_V4_COM_CORECLK_DIV_MODE1 0x16c 348 + #define QSERDES_V4_COM_SVS_MODE_CLK_SEL 0x184 345 349 #define QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0 0x1ac 346 350 #define QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0 0x1b0 347 351 #define QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1 0x1b4 ··· 361 341 #define QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1 0x1b8 362 342 363 343 /* Only for QMP V4 PHY - TX registers */ 344 + #define QSERDES_V4_TX_RES_CODE_LANE_TX 0x34 345 + #define QSERDES_V4_TX_RES_CODE_LANE_RX 0x38 364 346 #define QSERDES_V4_TX_LANE_MODE_1 0x84 347 + #define QSERDES_V4_TX_RCV_DETECT_LVL_2 0x9c 365 348 #define QSERDES_V4_TX_PWM_GEAR_1_DIVIDER_BAND0_1 0xd8 366 349 #define QSERDES_V4_TX_PWM_GEAR_2_DIVIDER_BAND0_1 0xdC 367 350 #define QSERDES_V4_TX_PWM_GEAR_3_DIVIDER_BAND0_1 0xe0 368 351 #define QSERDES_V4_TX_PWM_GEAR_4_DIVIDER_BAND0_1 0xe4 369 352 #define QSERDES_V4_TX_TRAN_DRVR_EMP_EN 0xb8 353 + #define QSERDES_V4_TX_PI_QEC_CTRL 0x104 370 354 371 355 /* Only for QMP V4 PHY - RX registers */ 372 356 #define QSERDES_V4_RX_UCDR_FO_GAIN 0x008 ··· 378 354 #define QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN 0x030 379 355 #define QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE 0x034 380 356 #define QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW 0x03c 357 + #define QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_HIGH 0x040 381 358 #define QSERDES_V4_RX_UCDR_PI_CONTROLS 0x044 382 359 #define QSERDES_V4_RX_UCDR_PI_CTRL2 0x048 360 + #define QSERDES_V4_RX_UCDR_SB2_THRESH1 0x04c 361 + #define QSERDES_V4_RX_UCDR_SB2_THRESH2 0x050 362 + #define QSERDES_V4_RX_UCDR_SB2_GAIN1 0x054 363 + #define QSERDES_V4_RX_UCDR_SB2_GAIN2 0x058 364 + #define QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE 0x060 383 365 #define QSERDES_V4_RX_AC_JTAG_ENABLE 0x068 384 366 #define QSERDES_V4_RX_AC_JTAG_MODE 0x078 385 367 #define QSERDES_V4_RX_RX_TERM_BW 0x080 368 + #define QSERDES_V4_RX_VGA_CAL_CNTRL1 0x0d4 369 + #define QSERDES_V4_RX_VGA_CAL_CNTRL2 0x0d8 370 + #define QSERDES_V4_RX_GM_CAL 0x0dc 386 371 #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2 0x0ec 387 372 #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3 0x0f0 388 373 #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4 0x0f4 389 374 #define QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW 0x0f8 390 375 #define QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH 0x0fc 391 376 #define QSERDES_V4_RX_RX_IDAC_MEASURE_TIME 0x100 377 + #define QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 0x110 392 378 #define QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2 0x114 393 379 #define QSERDES_V4_RX_SIGDET_CNTRL 0x11c 394 380 #define QSERDES_V4_RX_SIGDET_LVL 0x120 ··· 419 385 #define QSERDES_V4_RX_RX_MODE_10_HIGH2 0x1a0 420 386 #define QSERDES_V4_RX_RX_MODE_10_HIGH3 0x1a4 421 387 #define QSERDES_V4_RX_RX_MODE_10_HIGH4 0x1a8 388 + #define QSERDES_V4_RX_DFE_EN_TIMER 0x1b4 389 + #define QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET 0x1b8 422 390 #define QSERDES_V4_RX_DCC_CTRL1 0x1bc 391 + #define QSERDES_V4_RX_VTH_CODE 0x1c4 423 392 424 - /* Only for QMP V4 PHY - PCS registers */ 425 - #define QPHY_V4_PHY_START 0x000 426 - #define QPHY_V4_POWER_DOWN_CONTROL 0x004 427 - #define QPHY_V4_SW_RESET 0x008 428 - #define QPHY_V4_TIMER_20US_CORECLK_STEPS_MSB 0x00c 429 - #define QPHY_V4_TIMER_20US_CORECLK_STEPS_LSB 0x010 430 - #define QPHY_V4_PLL_CNTL 0x02c 431 - #define QPHY_V4_TX_LARGE_AMP_DRV_LVL 0x030 432 - #define QPHY_V4_TX_SMALL_AMP_DRV_LVL 0x038 433 - #define QPHY_V4_BIST_FIXED_PAT_CTRL 0x060 434 - #define QPHY_V4_TX_HSGEAR_CAPABILITY 0x074 435 - #define QPHY_V4_RX_HSGEAR_CAPABILITY 0x0b4 436 - #define QPHY_V4_DEBUG_BUS_CLKSEL 0x124 437 - #define QPHY_V4_LINECFG_DISABLE 0x148 438 - #define QPHY_V4_RX_MIN_HIBERN8_TIME 0x150 439 - #define QPHY_V4_RX_SIGDET_CTRL2 0x158 440 - #define QPHY_V4_TX_PWM_GEAR_BAND 0x160 441 - #define QPHY_V4_TX_HS_GEAR_BAND 0x168 442 - #define QPHY_V4_PCS_READY_STATUS 0x180 443 - #define QPHY_V4_TX_MID_TERM_CTRL1 0x1d8 444 - #define QPHY_V4_MULTI_LANE_CTRL1 0x1e0 393 + /* Only for QMP V4 PHY - UFS PCS registers */ 394 + #define QPHY_V4_PCS_UFS_PHY_START 0x000 395 + #define QPHY_V4_PCS_UFS_POWER_DOWN_CONTROL 0x004 396 + #define QPHY_V4_PCS_UFS_SW_RESET 0x008 397 + #define QPHY_V4_PCS_UFS_TIMER_20US_CORECLK_STEPS_MSB 0x00c 398 + #define QPHY_V4_PCS_UFS_TIMER_20US_CORECLK_STEPS_LSB 0x010 399 + #define QPHY_V4_PCS_UFS_PLL_CNTL 0x02c 400 + #define QPHY_V4_PCS_UFS_TX_LARGE_AMP_DRV_LVL 0x030 401 + #define QPHY_V4_PCS_UFS_TX_SMALL_AMP_DRV_LVL 0x038 402 + #define QPHY_V4_PCS_UFS_BIST_FIXED_PAT_CTRL 0x060 403 + #define QPHY_V4_PCS_UFS_TX_HSGEAR_CAPABILITY 0x074 404 + #define QPHY_V4_PCS_UFS_RX_HSGEAR_CAPABILITY 0x0b4 405 + #define QPHY_V4_PCS_UFS_DEBUG_BUS_CLKSEL 0x124 406 + #define QPHY_V4_PCS_UFS_LINECFG_DISABLE 0x148 407 + #define QPHY_V4_PCS_UFS_RX_MIN_HIBERN8_TIME 0x150 408 + #define QPHY_V4_PCS_UFS_RX_SIGDET_CTRL2 0x158 409 + #define QPHY_V4_PCS_UFS_TX_PWM_GEAR_BAND 0x160 410 + #define QPHY_V4_PCS_UFS_TX_HS_GEAR_BAND 0x168 411 + #define QPHY_V4_PCS_UFS_READY_STATUS 0x180 412 + #define QPHY_V4_PCS_UFS_TX_MID_TERM_CTRL1 0x1d8 413 + #define QPHY_V4_PCS_UFS_MULTI_LANE_CTRL1 0x1e0 445 414 446 415 /* PCIE GEN3 COM registers */ 447 416 #define PCIE_GEN3_QHP_COM_SSC_EN_CENTER 0x14 ··· 559 522 #define PCIE_GEN3_QHP_PHY_POWER_STATE_CONFIG 0x15c 560 523 #define PCIE_GEN3_QHP_PHY_POWER_STATE_CONFIG5 0x16c 561 524 #define PCIE_GEN3_QHP_PHY_PCS_TX_RX_CONFIG 0x174 525 + 526 + /* Only for QMP V4 PHY - USB/PCIe PCS registers */ 527 + #define QPHY_V4_PCS_SW_RESET 0x000 528 + #define QPHY_V4_PCS_REVISION_ID0 0x004 529 + #define QPHY_V4_PCS_REVISION_ID1 0x008 530 + #define QPHY_V4_PCS_REVISION_ID2 0x00c 531 + #define QPHY_V4_PCS_REVISION_ID3 0x010 532 + #define QPHY_V4_PCS_PCS_STATUS1 0x014 533 + #define QPHY_V4_PCS_PCS_STATUS2 0x018 534 + #define QPHY_V4_PCS_PCS_STATUS3 0x01c 535 + #define QPHY_V4_PCS_PCS_STATUS4 0x020 536 + #define QPHY_V4_PCS_PCS_STATUS5 0x024 537 + #define QPHY_V4_PCS_PCS_STATUS6 0x028 538 + #define QPHY_V4_PCS_PCS_STATUS7 0x02c 539 + #define QPHY_V4_PCS_DEBUG_BUS_0_STATUS 0x030 540 + #define QPHY_V4_PCS_DEBUG_BUS_1_STATUS 0x034 541 + #define QPHY_V4_PCS_DEBUG_BUS_2_STATUS 0x038 542 + #define QPHY_V4_PCS_DEBUG_BUS_3_STATUS 0x03c 543 + #define QPHY_V4_PCS_POWER_DOWN_CONTROL 0x040 544 + #define QPHY_V4_PCS_START_CONTROL 0x044 545 + #define QPHY_V4_PCS_INSIG_SW_CTRL1 0x048 546 + #define QPHY_V4_PCS_INSIG_SW_CTRL2 0x04c 547 + #define QPHY_V4_PCS_INSIG_SW_CTRL3 0x050 548 + #define QPHY_V4_PCS_INSIG_SW_CTRL4 0x054 549 + #define QPHY_V4_PCS_INSIG_SW_CTRL5 0x058 550 + #define QPHY_V4_PCS_INSIG_SW_CTRL6 0x05c 551 + #define QPHY_V4_PCS_INSIG_SW_CTRL7 0x060 552 + #define QPHY_V4_PCS_INSIG_SW_CTRL8 0x064 553 + #define QPHY_V4_PCS_INSIG_MX_CTRL1 0x068 554 + #define QPHY_V4_PCS_INSIG_MX_CTRL2 0x06c 555 + #define QPHY_V4_PCS_INSIG_MX_CTRL3 0x070 556 + #define QPHY_V4_PCS_INSIG_MX_CTRL4 0x074 557 + #define QPHY_V4_PCS_INSIG_MX_CTRL5 0x078 558 + #define QPHY_V4_PCS_INSIG_MX_CTRL7 0x07c 559 + #define QPHY_V4_PCS_INSIG_MX_CTRL8 0x080 560 + #define QPHY_V4_PCS_OUTSIG_SW_CTRL1 0x084 561 + #define QPHY_V4_PCS_OUTSIG_MX_CTRL1 0x088 562 + #define QPHY_V4_PCS_CLAMP_ENABLE 0x08c 563 + #define QPHY_V4_PCS_POWER_STATE_CONFIG1 0x090 564 + #define QPHY_V4_PCS_POWER_STATE_CONFIG2 0x094 565 + #define QPHY_V4_PCS_FLL_CNTRL1 0x098 566 + #define QPHY_V4_PCS_FLL_CNTRL2 0x09c 567 + #define QPHY_V4_PCS_FLL_CNT_VAL_L 0x0a0 568 + #define QPHY_V4_PCS_FLL_CNT_VAL_H_TOL 0x0a4 569 + #define QPHY_V4_PCS_FLL_MAN_CODE 0x0a8 570 + #define QPHY_V4_PCS_TEST_CONTROL1 0x0ac 571 + #define QPHY_V4_PCS_TEST_CONTROL2 0x0b0 572 + #define QPHY_V4_PCS_TEST_CONTROL3 0x0b4 573 + #define QPHY_V4_PCS_TEST_CONTROL4 0x0b8 574 + #define QPHY_V4_PCS_TEST_CONTROL5 0x0bc 575 + #define QPHY_V4_PCS_TEST_CONTROL6 0x0c0 576 + #define QPHY_V4_PCS_LOCK_DETECT_CONFIG1 0x0c4 577 + #define QPHY_V4_PCS_LOCK_DETECT_CONFIG2 0x0c8 578 + #define QPHY_V4_PCS_LOCK_DETECT_CONFIG3 0x0cc 579 + #define QPHY_V4_PCS_LOCK_DETECT_CONFIG4 0x0d0 580 + #define QPHY_V4_PCS_LOCK_DETECT_CONFIG5 0x0d4 581 + #define QPHY_V4_PCS_LOCK_DETECT_CONFIG6 0x0d8 582 + #define QPHY_V4_PCS_REFGEN_REQ_CONFIG1 0x0dc 583 + #define QPHY_V4_PCS_REFGEN_REQ_CONFIG2 0x0e0 584 + #define QPHY_V4_PCS_REFGEN_REQ_CONFIG3 0x0e4 585 + #define QPHY_V4_PCS_BIST_CTRL 0x0e8 586 + #define QPHY_V4_PCS_PRBS_POLY0 0x0ec 587 + #define QPHY_V4_PCS_PRBS_POLY1 0x0f0 588 + #define QPHY_V4_PCS_FIXED_PAT0 0x0f4 589 + #define QPHY_V4_PCS_FIXED_PAT1 0x0f8 590 + #define QPHY_V4_PCS_FIXED_PAT2 0x0fc 591 + #define QPHY_V4_PCS_FIXED_PAT3 0x100 592 + #define QPHY_V4_PCS_FIXED_PAT4 0x104 593 + #define QPHY_V4_PCS_FIXED_PAT5 0x108 594 + #define QPHY_V4_PCS_FIXED_PAT6 0x10c 595 + #define QPHY_V4_PCS_FIXED_PAT7 0x110 596 + #define QPHY_V4_PCS_FIXED_PAT8 0x114 597 + #define QPHY_V4_PCS_FIXED_PAT9 0x118 598 + #define QPHY_V4_PCS_FIXED_PAT10 0x11c 599 + #define QPHY_V4_PCS_FIXED_PAT11 0x120 600 + #define QPHY_V4_PCS_FIXED_PAT12 0x124 601 + #define QPHY_V4_PCS_FIXED_PAT13 0x128 602 + #define QPHY_V4_PCS_FIXED_PAT14 0x12c 603 + #define QPHY_V4_PCS_FIXED_PAT15 0x130 604 + #define QPHY_V4_PCS_TXMGN_CONFIG 0x134 605 + #define QPHY_V4_PCS_G12S1_TXMGN_V0 0x138 606 + #define QPHY_V4_PCS_G12S1_TXMGN_V1 0x13c 607 + #define QPHY_V4_PCS_G12S1_TXMGN_V2 0x140 608 + #define QPHY_V4_PCS_G12S1_TXMGN_V3 0x144 609 + #define QPHY_V4_PCS_G12S1_TXMGN_V4 0x148 610 + #define QPHY_V4_PCS_G12S1_TXMGN_V0_RS 0x14c 611 + #define QPHY_V4_PCS_G12S1_TXMGN_V1_RS 0x150 612 + #define QPHY_V4_PCS_G12S1_TXMGN_V2_RS 0x154 613 + #define QPHY_V4_PCS_G12S1_TXMGN_V3_RS 0x158 614 + #define QPHY_V4_PCS_G12S1_TXMGN_V4_RS 0x15c 615 + #define QPHY_V4_PCS_G3S2_TXMGN_MAIN 0x160 616 + #define QPHY_V4_PCS_G3S2_TXMGN_MAIN_RS 0x164 617 + #define QPHY_V4_PCS_G12S1_TXDEEMPH_M6DB 0x168 618 + #define QPHY_V4_PCS_G12S1_TXDEEMPH_M3P5DB 0x16c 619 + #define QPHY_V4_PCS_G3S2_PRE_GAIN 0x170 620 + #define QPHY_V4_PCS_G3S2_POST_GAIN 0x174 621 + #define QPHY_V4_PCS_G3S2_PRE_POST_OFFSET 0x178 622 + #define QPHY_V4_PCS_G3S2_PRE_GAIN_RS 0x17c 623 + #define QPHY_V4_PCS_G3S2_POST_GAIN_RS 0x180 624 + #define QPHY_V4_PCS_G3S2_PRE_POST_OFFSET_RS 0x184 625 + #define QPHY_V4_PCS_RX_SIGDET_LVL 0x188 626 + #define QPHY_V4_PCS_RX_SIGDET_DTCT_CNTRL 0x18c 627 + #define QPHY_V4_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 628 + #define QPHY_V4_PCS_RCVR_DTCT_DLY_P1U2_H 0x194 629 + #define QPHY_V4_PCS_RATE_SLEW_CNTRL1 0x198 630 + #define QPHY_V4_PCS_RATE_SLEW_CNTRL2 0x19c 631 + #define QPHY_V4_PCS_PWRUP_RESET_DLY_TIME_AUXCLK 0x1a0 632 + #define QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L 0x1a4 633 + #define QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_H 0x1a8 634 + #define QPHY_V4_PCS_TSYNC_RSYNC_TIME 0x1ac 635 + #define QPHY_V4_PCS_CDR_RESET_TIME 0x1b0 636 + #define QPHY_V4_PCS_TSYNC_DLY_TIME 0x1b4 637 + #define QPHY_V4_PCS_ELECIDLE_DLY_SEL 0x1b8 638 + #define QPHY_V4_PCS_CMN_ACK_OUT_SEL 0x1bc 639 + #define QPHY_V4_PCS_ALIGN_DETECT_CONFIG1 0x1c0 640 + #define QPHY_V4_PCS_ALIGN_DETECT_CONFIG2 0x1c4 641 + #define QPHY_V4_PCS_ALIGN_DETECT_CONFIG3 0x1c8 642 + #define QPHY_V4_PCS_ALIGN_DETECT_CONFIG4 0x1cc 643 + #define QPHY_V4_PCS_PCS_TX_RX_CONFIG 0x1d0 644 + #define QPHY_V4_PCS_RX_IDLE_DTCT_CNTRL 0x1d4 645 + #define QPHY_V4_PCS_RX_DCC_CAL_CONFIG 0x1d8 646 + #define QPHY_V4_PCS_EQ_CONFIG1 0x1dc 647 + #define QPHY_V4_PCS_EQ_CONFIG2 0x1e0 648 + #define QPHY_V4_PCS_EQ_CONFIG3 0x1e4 649 + #define QPHY_V4_PCS_EQ_CONFIG4 0x1e8 650 + #define QPHY_V4_PCS_EQ_CONFIG5 0x1ec 651 + #define QPHY_V4_PCS_USB3_POWER_STATE_CONFIG1 0x300 652 + #define QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_STATUS 0x304 653 + #define QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL 0x308 654 + #define QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL2 0x30c 655 + #define QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_SOURCE_STATUS 0x310 656 + #define QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR 0x314 657 + #define QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x318 658 + #define QPHY_V4_PCS_USB3_LFPS_TX_ECSTART 0x31c 659 + #define QPHY_V4_PCS_USB3_LFPS_PER_TIMER_VAL 0x320 660 + #define QPHY_V4_PCS_USB3_LFPS_TX_END_CNT_U3_START 0x324 661 + #define QPHY_V4_PCS_USB3_RXEQTRAINING_LOCK_TIME 0x328 662 + #define QPHY_V4_PCS_USB3_RXEQTRAINING_WAIT_TIME 0x32c 663 + #define QPHY_V4_PCS_USB3_RXEQTRAINING_CTLE_TIME 0x330 664 + #define QPHY_V4_PCS_USB3_RXEQTRAINING_WAIT_TIME_S2 0x334 665 + #define QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x338 666 + #define QPHY_V4_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x33c 667 + #define QPHY_V4_PCS_USB3_RCVR_DTCT_DLY_U3_H 0x340 668 + #define QPHY_V4_PCS_USB3_ARCVR_DTCT_EN_PERIOD 0x344 669 + #define QPHY_V4_PCS_USB3_ARCVR_DTCT_CM_DLY 0x348 670 + #define QPHY_V4_PCS_USB3_TXONESZEROS_RUN_LENGTH 0x34c 671 + #define QPHY_V4_PCS_USB3_ALFPS_DEGLITCH_VAL 0x350 672 + #define QPHY_V4_PCS_USB3_SIGDET_STARTUP_TIMER_VAL 0x354 673 + #define QPHY_V4_PCS_USB3_TEST_CONTROL 0x358 674 + 675 + /* Only for QMP V4 PHY - PCS_MISC registers */ 676 + #define QPHY_V4_PCS_MISC_TYPEC_CTRL 0x00 677 + #define QPHY_V4_PCS_MISC_TYPEC_PWRDN_CTRL 0x04 678 + #define QPHY_V4_PCS_MISC_PCS_MISC_CONFIG1 0x08 679 + #define QPHY_V4_PCS_MISC_CLAMP_ENABLE 0x0c 680 + #define QPHY_V4_PCS_MISC_TYPEC_STATUS 0x10 681 + #define QPHY_V4_PCS_MISC_PLACEHOLDER_STATUS 0x14 562 682 563 683 #endif
+287
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #include <linux/clk.h> 7 + #include <linux/delay.h> 8 + #include <linux/err.h> 9 + #include <linux/io.h> 10 + #include <linux/kernel.h> 11 + #include <linux/module.h> 12 + #include <linux/of.h> 13 + #include <linux/of_device.h> 14 + #include <linux/phy/phy.h> 15 + #include <linux/platform_device.h> 16 + #include <linux/regmap.h> 17 + #include <linux/regulator/consumer.h> 18 + #include <linux/reset.h> 19 + #include <linux/slab.h> 20 + 21 + #define USB2_PHY_USB_PHY_UTMI_CTRL0 (0x3c) 22 + #define SLEEPM BIT(0) 23 + #define OPMODE_MASK GENMASK(4, 3) 24 + #define OPMODE_NORMAL (0x00) 25 + #define OPMODE_NONDRIVING BIT(3) 26 + #define TERMSEL BIT(5) 27 + 28 + #define USB2_PHY_USB_PHY_UTMI_CTRL1 (0x40) 29 + #define XCVRSEL BIT(0) 30 + 31 + #define USB2_PHY_USB_PHY_UTMI_CTRL5 (0x50) 32 + #define POR BIT(1) 33 + 34 + #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0 (0x54) 35 + #define RETENABLEN BIT(3) 36 + #define FSEL_MASK GENMASK(7, 5) 37 + #define FSEL_DEFAULT (0x3 << 4) 38 + 39 + #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1 (0x58) 40 + #define VBUSVLDEXTSEL0 BIT(4) 41 + #define PLLBTUNE BIT(5) 42 + 43 + #define USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON2 (0x5c) 44 + #define VREGBYPASS BIT(0) 45 + 46 + #define USB2_PHY_USB_PHY_HS_PHY_CTRL1 (0x60) 47 + #define VBUSVLDEXT0 BIT(0) 48 + 49 + #define USB2_PHY_USB_PHY_HS_PHY_CTRL2 (0x64) 50 + #define USB2_AUTO_RESUME BIT(0) 51 + #define USB2_SUSPEND_N BIT(2) 52 + #define USB2_SUSPEND_N_SEL BIT(3) 53 + 54 + #define USB2_PHY_USB_PHY_CFG0 (0x94) 55 + #define UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN BIT(0) 56 + #define UTMI_PHY_CMN_CTRL_OVERRIDE_EN BIT(1) 57 + 58 + #define USB2_PHY_USB_PHY_REFCLK_CTRL (0xa0) 59 + #define REFCLK_SEL_MASK GENMASK(1, 0) 60 + #define REFCLK_SEL_DEFAULT (0x2 << 0) 61 + 62 + static const char * const qcom_snps_hsphy_vreg_names[] = { 63 + "vdda-pll", "vdda33", "vdda18", 64 + }; 65 + 66 + #define SNPS_HS_NUM_VREGS ARRAY_SIZE(qcom_snps_hsphy_vreg_names) 67 + 68 + /** 69 + * struct qcom_snps_hsphy - snps hs phy attributes 70 + * 71 + * @phy: generic phy 72 + * @base: iomapped memory space for snps hs phy 73 + * 74 + * @cfg_ahb_clk: AHB2PHY interface clock 75 + * @ref_clk: phy reference clock 76 + * @iface_clk: phy interface clock 77 + * @phy_reset: phy reset control 78 + * @vregs: regulator supplies bulk data 79 + * @phy_initialized: if PHY has been initialized correctly 80 + */ 81 + struct qcom_snps_hsphy { 82 + struct phy *phy; 83 + void __iomem *base; 84 + 85 + struct clk *cfg_ahb_clk; 86 + struct clk *ref_clk; 87 + struct reset_control *phy_reset; 88 + struct regulator_bulk_data vregs[SNPS_HS_NUM_VREGS]; 89 + 90 + bool phy_initialized; 91 + }; 92 + 93 + static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset, 94 + u32 mask, u32 val) 95 + { 96 + u32 reg; 97 + 98 + reg = readl_relaxed(base + offset); 99 + reg &= ~mask; 100 + reg |= val & mask; 101 + writel_relaxed(reg, base + offset); 102 + 103 + /* Ensure above write is completed */ 104 + readl_relaxed(base + offset); 105 + } 106 + 107 + static int qcom_snps_hsphy_init(struct phy *phy) 108 + { 109 + struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy); 110 + int ret; 111 + 112 + dev_vdbg(&phy->dev, "%s(): Initializing SNPS HS phy\n", __func__); 113 + 114 + ret = regulator_bulk_enable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); 115 + if (ret) 116 + return ret; 117 + 118 + ret = clk_prepare_enable(hsphy->cfg_ahb_clk); 119 + if (ret) { 120 + dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret); 121 + goto poweroff_phy; 122 + } 123 + 124 + ret = reset_control_assert(hsphy->phy_reset); 125 + if (ret) { 126 + dev_err(&phy->dev, "failed to assert phy_reset, %d\n", ret); 127 + goto disable_ahb_clk; 128 + } 129 + 130 + usleep_range(100, 150); 131 + 132 + ret = reset_control_deassert(hsphy->phy_reset); 133 + if (ret) { 134 + dev_err(&phy->dev, "failed to de-assert phy_reset, %d\n", ret); 135 + goto disable_ahb_clk; 136 + } 137 + 138 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_CFG0, 139 + UTMI_PHY_CMN_CTRL_OVERRIDE_EN, 140 + UTMI_PHY_CMN_CTRL_OVERRIDE_EN); 141 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_UTMI_CTRL5, 142 + POR, POR); 143 + qcom_snps_hsphy_write_mask(hsphy->base, 144 + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON0, 145 + FSEL_MASK, 0); 146 + qcom_snps_hsphy_write_mask(hsphy->base, 147 + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1, 148 + PLLBTUNE, PLLBTUNE); 149 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_REFCLK_CTRL, 150 + REFCLK_SEL_DEFAULT, REFCLK_SEL_MASK); 151 + qcom_snps_hsphy_write_mask(hsphy->base, 152 + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON1, 153 + VBUSVLDEXTSEL0, VBUSVLDEXTSEL0); 154 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL1, 155 + VBUSVLDEXT0, VBUSVLDEXT0); 156 + 157 + qcom_snps_hsphy_write_mask(hsphy->base, 158 + USB2_PHY_USB_PHY_HS_PHY_CTRL_COMMON2, 159 + VREGBYPASS, VREGBYPASS); 160 + 161 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2, 162 + USB2_SUSPEND_N_SEL | USB2_SUSPEND_N, 163 + USB2_SUSPEND_N_SEL | USB2_SUSPEND_N); 164 + 165 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_UTMI_CTRL0, 166 + SLEEPM, SLEEPM); 167 + 168 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_UTMI_CTRL5, 169 + POR, 0); 170 + 171 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_HS_PHY_CTRL2, 172 + USB2_SUSPEND_N_SEL, 0); 173 + 174 + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_CFG0, 175 + UTMI_PHY_CMN_CTRL_OVERRIDE_EN, 0); 176 + 177 + hsphy->phy_initialized = true; 178 + 179 + return 0; 180 + 181 + disable_ahb_clk: 182 + clk_disable_unprepare(hsphy->cfg_ahb_clk); 183 + poweroff_phy: 184 + regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); 185 + 186 + return ret; 187 + } 188 + 189 + static int qcom_snps_hsphy_exit(struct phy *phy) 190 + { 191 + struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy); 192 + 193 + reset_control_assert(hsphy->phy_reset); 194 + clk_disable_unprepare(hsphy->cfg_ahb_clk); 195 + regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); 196 + hsphy->phy_initialized = false; 197 + 198 + return 0; 199 + } 200 + 201 + static const struct phy_ops qcom_snps_hsphy_gen_ops = { 202 + .init = qcom_snps_hsphy_init, 203 + .exit = qcom_snps_hsphy_exit, 204 + .owner = THIS_MODULE, 205 + }; 206 + 207 + static const struct of_device_id qcom_snps_hsphy_of_match_table[] = { 208 + { .compatible = "qcom,sm8150-usb-hs-phy", }, 209 + { .compatible = "qcom,usb-snps-hs-7nm-phy", }, 210 + { .compatible = "qcom,usb-snps-femto-v2-phy", }, 211 + { } 212 + }; 213 + MODULE_DEVICE_TABLE(of, qcom_snps_hsphy_of_match_table); 214 + 215 + static int qcom_snps_hsphy_probe(struct platform_device *pdev) 216 + { 217 + struct device *dev = &pdev->dev; 218 + struct qcom_snps_hsphy *hsphy; 219 + struct phy_provider *phy_provider; 220 + struct phy *generic_phy; 221 + int ret, i; 222 + int num; 223 + 224 + hsphy = devm_kzalloc(dev, sizeof(*hsphy), GFP_KERNEL); 225 + if (!hsphy) 226 + return -ENOMEM; 227 + 228 + hsphy->base = devm_platform_ioremap_resource(pdev, 0); 229 + if (IS_ERR(hsphy->base)) 230 + return PTR_ERR(hsphy->base); 231 + 232 + hsphy->ref_clk = devm_clk_get(dev, "ref"); 233 + if (IS_ERR(hsphy->ref_clk)) { 234 + ret = PTR_ERR(hsphy->ref_clk); 235 + if (ret != -EPROBE_DEFER) 236 + dev_err(dev, "failed to get ref clk, %d\n", ret); 237 + return ret; 238 + } 239 + 240 + hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); 241 + if (IS_ERR(hsphy->phy_reset)) { 242 + dev_err(dev, "failed to get phy core reset\n"); 243 + return PTR_ERR(hsphy->phy_reset); 244 + } 245 + 246 + num = ARRAY_SIZE(hsphy->vregs); 247 + for (i = 0; i < num; i++) 248 + hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i]; 249 + 250 + ret = devm_regulator_bulk_get(dev, num, hsphy->vregs); 251 + if (ret) { 252 + if (ret != -EPROBE_DEFER) 253 + dev_err(dev, "failed to get regulator supplies: %d\n", 254 + ret); 255 + return ret; 256 + } 257 + 258 + generic_phy = devm_phy_create(dev, NULL, &qcom_snps_hsphy_gen_ops); 259 + if (IS_ERR(generic_phy)) { 260 + ret = PTR_ERR(generic_phy); 261 + dev_err(dev, "failed to create phy, %d\n", ret); 262 + return ret; 263 + } 264 + hsphy->phy = generic_phy; 265 + 266 + dev_set_drvdata(dev, hsphy); 267 + phy_set_drvdata(generic_phy, hsphy); 268 + 269 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 270 + if (!IS_ERR(phy_provider)) 271 + dev_dbg(dev, "Registered Qcom-SNPS HS phy\n"); 272 + 273 + return PTR_ERR_OR_ZERO(phy_provider); 274 + } 275 + 276 + static struct platform_driver qcom_snps_hsphy_driver = { 277 + .probe = qcom_snps_hsphy_probe, 278 + .driver = { 279 + .name = "qcom-snps-hs-femto-v2-phy", 280 + .of_match_table = qcom_snps_hsphy_of_match_table, 281 + }, 282 + }; 283 + 284 + module_platform_driver(qcom_snps_hsphy_driver); 285 + 286 + MODULE_DESCRIPTION("Qualcomm SNPS FEMTO USB HS PHY V2 driver"); 287 + MODULE_LICENSE("GPL v2");
+4
drivers/phy/samsung/phy-s5pv210-usb2.c
··· 139 139 udelay(10); 140 140 rst &= ~rstbits; 141 141 writel(rst, drv->reg_phy + S5PV210_UPHYRST); 142 + /* The following delay is necessary for the reset sequence to be 143 + * completed 144 + */ 145 + udelay(80); 142 146 } else { 143 147 pwr = readl(drv->reg_phy + S5PV210_UPHYPWR); 144 148 pwr |= phypwr;
+102 -2
drivers/phy/ti/phy-am654-serdes.c
··· 77 77 .val_bits = 32, 78 78 .reg_stride = 4, 79 79 .fast_io = true, 80 + .max_register = 0x1ffc, 80 81 }; 81 82 82 83 static const struct reg_field cmu_master_cdn_o = REG_FIELD(CMU_R07C, 24, 24); ··· 201 200 return 0; 202 201 } 203 202 204 - static int serdes_am654_init(struct phy *x) 203 + #define SERDES_AM654_CFG(offset, a, b, val) \ 204 + regmap_update_bits(phy->regmap, (offset),\ 205 + GENMASK((a), (b)), (val) << (b)) 206 + 207 + static int serdes_am654_usb3_init(struct serdes_am654 *phy) 205 208 { 206 - struct serdes_am654 *phy = phy_get_drvdata(x); 209 + SERDES_AM654_CFG(0x0000, 31, 24, 0x17); 210 + SERDES_AM654_CFG(0x0004, 15, 8, 0x02); 211 + SERDES_AM654_CFG(0x0004, 7, 0, 0x0e); 212 + SERDES_AM654_CFG(0x0008, 23, 16, 0x2e); 213 + SERDES_AM654_CFG(0x0008, 31, 24, 0x2e); 214 + SERDES_AM654_CFG(0x0060, 7, 0, 0x4b); 215 + SERDES_AM654_CFG(0x0060, 15, 8, 0x98); 216 + SERDES_AM654_CFG(0x0060, 23, 16, 0x60); 217 + SERDES_AM654_CFG(0x00d0, 31, 24, 0x45); 218 + SERDES_AM654_CFG(0x00e8, 15, 8, 0x0e); 219 + SERDES_AM654_CFG(0x0220, 7, 0, 0x34); 220 + SERDES_AM654_CFG(0x0220, 15, 8, 0x34); 221 + SERDES_AM654_CFG(0x0220, 31, 24, 0x37); 222 + SERDES_AM654_CFG(0x0224, 7, 0, 0x37); 223 + SERDES_AM654_CFG(0x0224, 15, 8, 0x37); 224 + SERDES_AM654_CFG(0x0228, 23, 16, 0x37); 225 + SERDES_AM654_CFG(0x0228, 31, 24, 0x37); 226 + SERDES_AM654_CFG(0x022c, 7, 0, 0x37); 227 + SERDES_AM654_CFG(0x022c, 15, 8, 0x37); 228 + SERDES_AM654_CFG(0x0230, 15, 8, 0x2a); 229 + SERDES_AM654_CFG(0x0230, 23, 16, 0x2a); 230 + SERDES_AM654_CFG(0x0240, 23, 16, 0x10); 231 + SERDES_AM654_CFG(0x0240, 31, 24, 0x34); 232 + SERDES_AM654_CFG(0x0244, 7, 0, 0x40); 233 + SERDES_AM654_CFG(0x0244, 23, 16, 0x34); 234 + SERDES_AM654_CFG(0x0248, 15, 8, 0x0d); 235 + SERDES_AM654_CFG(0x0258, 15, 8, 0x16); 236 + SERDES_AM654_CFG(0x0258, 23, 16, 0x84); 237 + SERDES_AM654_CFG(0x0258, 31, 24, 0xf2); 238 + SERDES_AM654_CFG(0x025c, 7, 0, 0x21); 239 + SERDES_AM654_CFG(0x0260, 7, 0, 0x27); 240 + SERDES_AM654_CFG(0x0260, 15, 8, 0x04); 241 + SERDES_AM654_CFG(0x0268, 15, 8, 0x04); 242 + SERDES_AM654_CFG(0x0288, 15, 8, 0x2c); 243 + SERDES_AM654_CFG(0x0330, 31, 24, 0xa0); 244 + SERDES_AM654_CFG(0x0338, 23, 16, 0x03); 245 + SERDES_AM654_CFG(0x0338, 31, 24, 0x00); 246 + SERDES_AM654_CFG(0x033c, 7, 0, 0x00); 247 + SERDES_AM654_CFG(0x0344, 31, 24, 0x18); 248 + SERDES_AM654_CFG(0x034c, 7, 0, 0x18); 249 + SERDES_AM654_CFG(0x039c, 23, 16, 0x3b); 250 + SERDES_AM654_CFG(0x0a04, 7, 0, 0x03); 251 + SERDES_AM654_CFG(0x0a14, 31, 24, 0x3c); 252 + SERDES_AM654_CFG(0x0a18, 15, 8, 0x3c); 253 + SERDES_AM654_CFG(0x0a38, 7, 0, 0x3e); 254 + SERDES_AM654_CFG(0x0a38, 15, 8, 0x3e); 255 + SERDES_AM654_CFG(0x0ae0, 7, 0, 0x07); 256 + SERDES_AM654_CFG(0x0b6c, 23, 16, 0xcd); 257 + SERDES_AM654_CFG(0x0b6c, 31, 24, 0x04); 258 + SERDES_AM654_CFG(0x0b98, 23, 16, 0x03); 259 + SERDES_AM654_CFG(0x1400, 7, 0, 0x3f); 260 + SERDES_AM654_CFG(0x1404, 23, 16, 0x6f); 261 + SERDES_AM654_CFG(0x1404, 31, 24, 0x6f); 262 + SERDES_AM654_CFG(0x140c, 7, 0, 0x6f); 263 + SERDES_AM654_CFG(0x140c, 15, 8, 0x6f); 264 + SERDES_AM654_CFG(0x1410, 15, 8, 0x27); 265 + SERDES_AM654_CFG(0x1414, 7, 0, 0x0c); 266 + SERDES_AM654_CFG(0x1414, 23, 16, 0x07); 267 + SERDES_AM654_CFG(0x1418, 23, 16, 0x40); 268 + SERDES_AM654_CFG(0x141c, 7, 0, 0x00); 269 + SERDES_AM654_CFG(0x141c, 15, 8, 0x1f); 270 + SERDES_AM654_CFG(0x1428, 31, 24, 0x08); 271 + SERDES_AM654_CFG(0x1434, 31, 24, 0x00); 272 + SERDES_AM654_CFG(0x1444, 7, 0, 0x94); 273 + SERDES_AM654_CFG(0x1460, 31, 24, 0x7f); 274 + SERDES_AM654_CFG(0x1464, 7, 0, 0x43); 275 + SERDES_AM654_CFG(0x1464, 23, 16, 0x6f); 276 + SERDES_AM654_CFG(0x1464, 31, 24, 0x43); 277 + SERDES_AM654_CFG(0x1484, 23, 16, 0x8f); 278 + SERDES_AM654_CFG(0x1498, 7, 0, 0x4f); 279 + SERDES_AM654_CFG(0x1498, 23, 16, 0x4f); 280 + SERDES_AM654_CFG(0x007c, 31, 24, 0x0d); 281 + SERDES_AM654_CFG(0x0b90, 15, 8, 0x0f); 282 + 283 + return 0; 284 + } 285 + 286 + static int serdes_am654_pcie_init(struct serdes_am654 *phy) 287 + { 207 288 int ret; 208 289 209 290 ret = regmap_field_write(phy->config_version, VERSION); ··· 303 220 return 0; 304 221 } 305 222 223 + static int serdes_am654_init(struct phy *x) 224 + { 225 + struct serdes_am654 *phy = phy_get_drvdata(x); 226 + 227 + switch (phy->type) { 228 + case PHY_TYPE_PCIE: 229 + return serdes_am654_pcie_init(phy); 230 + case PHY_TYPE_USB3: 231 + return serdes_am654_usb3_init(phy); 232 + default: 233 + return -EINVAL; 234 + } 235 + } 236 + 306 237 static int serdes_am654_reset(struct phy *x) 307 238 { 308 239 struct serdes_am654 *phy = phy_get_drvdata(x); 309 240 int ret; 241 + 242 + serdes_am654_disable_pll(phy); 243 + serdes_am654_disable_txrx(phy); 310 244 311 245 ret = regmap_field_write(phy->por_en, 0x1); 312 246 if (ret)
+60 -5
drivers/phy/ti/phy-j721e-wiz.c
··· 20 20 #include <linux/pm_runtime.h> 21 21 #include <linux/regmap.h> 22 22 #include <linux/reset-controller.h> 23 + #include <dt-bindings/phy/phy.h> 23 24 24 25 #define WIZ_SERDES_CTRL 0x404 25 26 #define WIZ_SERDES_TOP_CTRL 0x408 ··· 78 77 REG_FIELD(WIZ_LANECTL(2), 30, 31), 79 78 REG_FIELD(WIZ_LANECTL(3), 30, 31), 80 79 }; 80 + 81 + enum p_enable { P_ENABLE = 2, P_ENABLE_FORCE = 1, P_ENABLE_DISABLE = 0 }; 81 82 82 83 static const struct reg_field p_align[WIZ_MAX_LANES] = { 83 84 REG_FIELD(WIZ_LANECTL(0), 29, 29), ··· 223 220 struct reset_controller_dev wiz_phy_reset_dev; 224 221 struct gpio_desc *gpio_typec_dir; 225 222 int typec_dir_delay; 223 + u32 lane_phy_type[WIZ_MAX_LANES]; 226 224 }; 227 225 228 226 static int wiz_reset(struct wiz *wiz) ··· 246 242 static int wiz_mode_select(struct wiz *wiz) 247 243 { 248 244 u32 num_lanes = wiz->num_lanes; 245 + enum wiz_lane_standard_mode mode; 249 246 int ret; 250 247 int i; 251 248 252 249 for (i = 0; i < num_lanes; i++) { 253 - ret = regmap_field_write(wiz->p_standard_mode[i], 254 - LANE_MODE_GEN4); 250 + if (wiz->lane_phy_type[i] == PHY_TYPE_DP) 251 + mode = LANE_MODE_GEN1; 252 + else 253 + mode = LANE_MODE_GEN4; 254 + 255 + ret = regmap_field_write(wiz->p_standard_mode[i], mode); 255 256 if (ret) 256 257 return ret; 257 258 } ··· 716 707 return ret; 717 708 } 718 709 719 - ret = regmap_field_write(wiz->p_enable[id - 1], false); 710 + ret = regmap_field_write(wiz->p_enable[id - 1], P_ENABLE_DISABLE); 720 711 return ret; 721 712 } 722 713 ··· 743 734 return ret; 744 735 } 745 736 746 - ret = regmap_field_write(wiz->p_enable[id - 1], true); 737 + if (wiz->lane_phy_type[id - 1] == PHY_TYPE_DP) 738 + ret = regmap_field_write(wiz->p_enable[id - 1], P_ENABLE); 739 + else 740 + ret = regmap_field_write(wiz->p_enable[id - 1], P_ENABLE_FORCE); 741 + 747 742 return ret; 748 743 } 749 744 ··· 773 760 {} 774 761 }; 775 762 MODULE_DEVICE_TABLE(of, wiz_id_table); 763 + 764 + static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz) 765 + { 766 + struct device_node *serdes, *subnode; 767 + 768 + serdes = of_get_child_by_name(dev->of_node, "serdes"); 769 + if (!serdes) { 770 + dev_err(dev, "%s: Getting \"serdes\"-node failed\n", __func__); 771 + return -EINVAL; 772 + } 773 + 774 + for_each_child_of_node(serdes, subnode) { 775 + u32 reg, num_lanes = 1, phy_type = PHY_NONE; 776 + int ret, i; 777 + 778 + ret = of_property_read_u32(subnode, "reg", &reg); 779 + if (ret) { 780 + dev_err(dev, 781 + "%s: Reading \"reg\" from \"%s\" failed: %d\n", 782 + __func__, subnode->name, ret); 783 + return ret; 784 + } 785 + of_property_read_u32(subnode, "cdns,num-lanes", &num_lanes); 786 + of_property_read_u32(subnode, "cdns,phy-type", &phy_type); 787 + 788 + dev_dbg(dev, "%s: Lanes %u-%u have phy-type %u\n", __func__, 789 + reg, reg + num_lanes - 1, phy_type); 790 + 791 + for (i = reg; i < reg + num_lanes; i++) 792 + wiz->lane_phy_type[i] = phy_type; 793 + } 794 + 795 + return 0; 796 + } 776 797 777 798 static int wiz_probe(struct platform_device *pdev) 778 799 { ··· 841 794 } 842 795 843 796 base = devm_ioremap(dev, res.start, resource_size(&res)); 844 - if (!base) 797 + if (!base) { 798 + ret = -ENOMEM; 845 799 goto err_addr_to_resource; 800 + } 846 801 847 802 regmap = devm_regmap_init_mmio(dev, base, &wiz_regmap_config); 848 803 if (IS_ERR(regmap)) { ··· 861 812 862 813 if (num_lanes > WIZ_MAX_LANES) { 863 814 dev_err(dev, "Cannot support %d lanes\n", num_lanes); 815 + ret = -ENODEV; 864 816 goto err_addr_to_resource; 865 817 } 866 818 ··· 893 843 goto err_addr_to_resource; 894 844 } 895 845 } 846 + 847 + ret = wiz_get_lane_phy_types(dev, wiz); 848 + if (ret) 849 + return ret; 896 850 897 851 wiz->dev = dev; 898 852 wiz->regmap = regmap; ··· 951 897 serdes_pdev = of_platform_device_create(child_node, NULL, dev); 952 898 if (!serdes_pdev) { 953 899 dev_WARN(dev, "Unable to create SERDES platform device\n"); 900 + ret = -ENOMEM; 954 901 goto err_pdev_create; 955 902 } 956 903 wiz->serdes_pdev = serdes_pdev;
+56 -4
drivers/phy/ti/phy-omap-usb2.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * omap-usb2.c - USB PHY, talking to musb controller in OMAP. 3 + * omap-usb2.c - USB PHY, talking to USB controller on TI SoCs. 4 4 * 5 - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com 5 + * Copyright (C) 2012-2020 Texas Instruments Incorporated - http://www.ti.com 6 6 * Author: Kishon Vijay Abraham I <kishon@ti.com> 7 7 */ 8 8 ··· 23 23 #include <linux/regmap.h> 24 24 #include <linux/of_platform.h> 25 25 26 - #define USB2PHY_DISCON_BYP_LATCH (1 << 31) 27 - #define USB2PHY_ANA_CONFIG1 0x4c 26 + #define USB2PHY_ANA_CONFIG1 0x4c 27 + #define USB2PHY_DISCON_BYP_LATCH BIT(31) 28 28 29 + /* SoC Specific USB2_OTG register definitions */ 29 30 #define AM654_USB2_OTG_PD BIT(8) 30 31 #define AM654_USB2_VBUS_DET_EN BIT(5) 31 32 #define AM654_USB2_VBUSVALID_DET_EN BIT(4) 33 + 34 + #define OMAP_DEV_PHY_PD BIT(0) 35 + #define OMAP_USB2_PHY_PD BIT(28) 36 + 37 + #define AM437X_USB2_PHY_PD BIT(0) 38 + #define AM437X_USB2_OTG_PD BIT(1) 39 + #define AM437X_USB2_OTGVDET_EN BIT(19) 40 + #define AM437X_USB2_OTGSESSEND_EN BIT(20) 41 + 42 + /* Driver Flags */ 43 + #define OMAP_USB2_HAS_START_SRP BIT(0) 44 + #define OMAP_USB2_HAS_SET_VBUS BIT(1) 45 + #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2) 46 + 47 + struct omap_usb { 48 + struct usb_phy phy; 49 + struct phy_companion *comparator; 50 + void __iomem *pll_ctrl_base; 51 + void __iomem *phy_base; 52 + struct device *dev; 53 + struct device *control_dev; 54 + struct clk *wkupclk; 55 + struct clk *optclk; 56 + u8 flags; 57 + struct regmap *syscon_phy_power; /* ctrl. reg. acces */ 58 + unsigned int power_reg; /* power reg. index within syscon */ 59 + u32 mask; 60 + u32 power_on; 61 + u32 power_off; 62 + }; 63 + 64 + #define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 65 + 66 + struct usb_phy_data { 67 + const char *label; 68 + u8 flags; 69 + u32 mask; 70 + u32 power_on; 71 + u32 power_off; 72 + }; 73 + 74 + static inline u32 omap_usb_readl(void __iomem *addr, unsigned int offset) 75 + { 76 + return __raw_readl(addr + offset); 77 + } 78 + 79 + static inline void omap_usb_writel(void __iomem *addr, unsigned int offset, 80 + u32 data) 81 + { 82 + __raw_writel(data, addr + offset); 83 + } 32 84 33 85 /** 34 86 * omap_usb2_set_comparator - links the comparator present in the sytem with
+1
include/dt-bindings/phy/phy.h
··· 17 17 #define PHY_TYPE_USB3 4 18 18 #define PHY_TYPE_UFS 5 19 19 #define PHY_TYPE_DP 6 20 + #define PHY_TYPE_XPCS 7 20 21 21 22 #endif /* _DT_BINDINGS_PHY */
+2 -67
include/linux/phy/omap_usb.h
··· 2 2 /* 3 3 * omap_usb.h -- omap usb2 phy header file 4 4 * 5 - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com 5 + * Copyright (C) 2012-2020 Texas Instruments Incorporated - http://www.ti.com 6 6 * Author: Kishon Vijay Abraham I <kishon@ti.com> 7 7 */ 8 8 9 9 #ifndef __DRIVERS_OMAP_USB2_H 10 10 #define __DRIVERS_OMAP_USB2_H 11 11 12 - #include <linux/io.h> 13 - #include <linux/usb/otg.h> 14 - 15 - struct usb_dpll_params { 16 - u16 m; 17 - u8 n; 18 - u8 freq:3; 19 - u8 sd; 20 - u32 mf; 21 - }; 22 - 23 - enum omap_usb_phy_type { 24 - TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ 25 - TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */ 26 - TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ 27 - }; 28 - 29 - struct omap_usb { 30 - struct usb_phy phy; 31 - struct phy_companion *comparator; 32 - void __iomem *pll_ctrl_base; 33 - void __iomem *phy_base; 34 - struct device *dev; 35 - struct device *control_dev; 36 - struct clk *wkupclk; 37 - struct clk *optclk; 38 - u8 flags; 39 - enum omap_usb_phy_type type; 40 - struct regmap *syscon_phy_power; /* ctrl. reg. acces */ 41 - unsigned int power_reg; /* power reg. index within syscon */ 42 - u32 mask; 43 - u32 power_on; 44 - u32 power_off; 45 - }; 46 - 47 - struct usb_phy_data { 48 - const char *label; 49 - u8 flags; 50 - u32 mask; 51 - u32 power_on; 52 - u32 power_off; 53 - }; 54 - 55 - /* Driver Flags */ 56 - #define OMAP_USB2_HAS_START_SRP (1 << 0) 57 - #define OMAP_USB2_HAS_SET_VBUS (1 << 1) 58 - #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2) 59 - 60 - #define OMAP_DEV_PHY_PD BIT(0) 61 - #define OMAP_USB2_PHY_PD BIT(28) 62 - 63 - #define AM437X_USB2_PHY_PD BIT(0) 64 - #define AM437X_USB2_OTG_PD BIT(1) 65 - #define AM437X_USB2_OTGVDET_EN BIT(19) 66 - #define AM437X_USB2_OTGSESSEND_EN BIT(20) 12 + #include <linux/usb/phy_companion.h> 67 13 68 14 #define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 69 15 ··· 21 75 return -ENODEV; 22 76 } 23 77 #endif 24 - 25 - static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset) 26 - { 27 - return __raw_readl(addr + offset); 28 - } 29 - 30 - static inline void omap_usb_writel(void __iomem *addr, unsigned offset, 31 - u32 data) 32 - { 33 - __raw_writel(data, addr + offset); 34 - } 35 78 36 79 #endif /* __DRIVERS_OMAP_USB_H */