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

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

Vinod writes:

phy-for-5.11

- New phy drivers:
- Mediatek MT7621 PCIe PHY (promoted from staging)
- Ingenic USB phy driver supporting JZ4775 and X2000
- Intel Keem Bay USB PHY driver
- Marvell USB HSIC PHY driver supporting MMP3 SoC
- AXG MIPI D-PHY driver

- Updates:
- Conversion to YAML binding for:
- Broadcom SATA PHY
- Cadence Sierra PHY bindings
- STM32 USBC Phy
- Support for Exynos5433 PCIe PHY
- Support for Qualcomm SM8250 PCIe QMP PHY
- Support for Exynos5420 USB2 phy
- devm_platform_ioremap_resource conversion for bunch of drivers

* tag 'phy-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (72 commits)
drm/mediatek: avoid dereferencing a null hdmi_phy on an error message
phy: ingenic: depend on HAS_IOMEM
phy: mediatek: statify mtk_hdmi_phy_driver
dt-bindings: phy: Convert Broadcom SATA PHY to YAML
devicetree: phy: rockchip-emmc add output-tapdelay-select
phy: rockchip-emmc: output tap delay dt property
PHY: Ingenic: Add USB PHY driver using generic PHY framework.
dt-bindings: USB: Add bindings for Ingenic JZ4775 and X2000.
USB: PHY: JZ4770: Remove unnecessary function calls.
devicetree: phy: rockchip-emmc: pulldown property
phy: rockchip: set pulldown for strobe line in dts
phy: renesas: rcar-gen3-usb2: disable runtime pm in case of failure
phy: mediatek: allow compile-testing the hdmi phy
phy/rockchip: Make PHY_ROCKCHIP_INNO_HDMI depend on HAS_IOMEM to fix build error
phy: samsung: Merge Kconfig for Exynos5420 and Exynos5250
phy: ralink: phy-mt7621-pci: set correct name in MODULE_DEVICE_TABLE macro
phy: ralink: phy-mt7621-pci: drop 'COMPILE_TEST' from Kconfig
phy: mediatek: Make PHY_MTK_{XSPHY, TPHY} depend on HAS_IOMEM and OF_ADDRESS to fix build errors
phy: tegra: xusb: Fix usb_phy device driver field
phy: amlogic: replace devm_reset_control_array_get()
...

+2659 -944
+1 -1
Documentation/devicetree/bindings/clock/ingenic,cgu.yaml
··· 92 92 93 93 patternProperties: 94 94 "^usb-phy@[a-f0-9]+$": 95 - allOf: [ $ref: "../usb/ingenic,jz4770-phy.yaml#" ] 95 + allOf: [ $ref: "../phy/ingenic,phy-usb.yaml#" ] 96 96 97 97 additionalProperties: false 98 98
+70
Documentation/devicetree/bindings/phy/amlogic,axg-mipi-dphy.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + # Copyright 2020 BayLibre, SAS 3 + %YAML 1.2 4 + --- 5 + $id: "http://devicetree.org/schemas/phy/amlogic,axg-mipi-dphy.yaml#" 6 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 7 + 8 + title: Amlogic AXG MIPI D-PHY 9 + 10 + maintainers: 11 + - Neil Armstrong <narmstrong@baylibre.com> 12 + 13 + properties: 14 + compatible: 15 + enum: 16 + - amlogic,axg-mipi-dphy 17 + 18 + reg: 19 + maxItems: 1 20 + 21 + clocks: 22 + maxItems: 1 23 + 24 + clock-names: 25 + items: 26 + - const: pclk 27 + 28 + resets: 29 + maxItems: 1 30 + 31 + reset-names: 32 + items: 33 + - const: phy 34 + 35 + "#phy-cells": 36 + const: 0 37 + 38 + phys: 39 + maxItems: 1 40 + 41 + phy-names: 42 + items: 43 + - const: analog 44 + 45 + required: 46 + - compatible 47 + - reg 48 + - clocks 49 + - clock-names 50 + - resets 51 + - reset-names 52 + - phys 53 + - phy-names 54 + - "#phy-cells" 55 + 56 + additionalProperties: false 57 + 58 + examples: 59 + - | 60 + phy@ff640000 { 61 + compatible = "amlogic,axg-mipi-dphy"; 62 + reg = <0xff640000 0x100>; 63 + clocks = <&clk_mipi_dsi_phy>; 64 + clock-names = "pclk"; 65 + resets = <&reset_phy>; 66 + reset-names = "phy"; 67 + phys = <&mipi_pcie_analog_dphy>; 68 + phy-names = "analog"; 69 + #phy-cells = <0>; 70 + };
+13 -8
Documentation/devicetree/bindings/phy/amlogic,meson-axg-mipi-pcie-analog.yaml
··· 9 9 maintainers: 10 10 - Remi Pommarel <repk@triplefau.lt> 11 11 12 + description: |+ 13 + The Everything-Else Power Domains node should be the child of a syscon 14 + node with the required property: 15 + 16 + - compatible: Should be the following: 17 + "amlogic,meson-gx-hhi-sysctrl", "simple-mfd", "syscon" 18 + 19 + Refer to the the bindings described in 20 + Documentation/devicetree/bindings/mfd/syscon.yaml 21 + 12 22 properties: 13 23 compatible: 14 24 const: amlogic,axg-mipi-pcie-analog-phy 15 25 16 - reg: 17 - maxItems: 1 18 - 19 26 "#phy-cells": 20 - const: 1 27 + const: 0 21 28 22 29 required: 23 30 - compatible 24 - - reg 25 31 - "#phy-cells" 26 32 27 33 additionalProperties: false 28 34 29 35 examples: 30 36 - | 31 - mpphy: phy@0 { 37 + mpphy: phy { 32 38 compatible = "amlogic,axg-mipi-pcie-analog-phy"; 33 - reg = <0x0 0xc>; 34 - #phy-cells = <1>; 39 + #phy-cells = <0>; 35 40 };
+148
Documentation/devicetree/bindings/phy/brcm,sata-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/brcm,sata-phy.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: Broadcom SATA3 PHY 8 + 9 + maintainers: 10 + - Florian Fainelli <f.fainelli@gmail.com> 11 + 12 + properties: 13 + $nodename: 14 + pattern: "^sata[-|_]phy(@.*)?$" 15 + 16 + compatible: 17 + oneOf: 18 + - items: 19 + - enum: 20 + - brcm,bcm7216-sata-phy 21 + - brcm,bcm7425-sata-phy 22 + - brcm,bcm7445-sata-phy 23 + - brcm,bcm63138-sata-phy 24 + - const: brcm,phy-sata3 25 + - items: 26 + - const: brcm,iproc-nsp-sata-phy 27 + - items: 28 + - const: brcm,iproc-ns2-sata-phy 29 + - items: 30 + - const: brcm,iproc-sr-sata-phy 31 + 32 + reg: 33 + minItems: 1 34 + maxItems: 2 35 + 36 + reg-names: 37 + minItems: 1 38 + maxItems: 2 39 + items: 40 + - const: phy 41 + - const: phy-ctrl 42 + 43 + "#address-cells": 44 + const: 1 45 + 46 + "#size-cells": 47 + const: 0 48 + 49 + patternProperties: 50 + "^sata-phy@[0-9]+$": 51 + type: object 52 + description: | 53 + Each port's PHY should be represented as a sub-node. 54 + 55 + properties: 56 + reg: 57 + description: The SATA PHY port number 58 + maxItems: 1 59 + 60 + "#phy-cells": 61 + const: 0 62 + 63 + "brcm,enable-ssc": 64 + $ref: /schemas/types.yaml#/definitions/flag 65 + description: | 66 + Use spread spectrum clocking (SSC) on this port 67 + This property is not applicable for "brcm,iproc-ns2-sata-phy", 68 + "brcm,iproc-nsp-sata-phy" and "brcm,iproc-sr-sata-phy". 69 + 70 + "brcm,rxaeq-mode": 71 + $ref: /schemas/types.yaml#/definitions/string 72 + description: 73 + String that indicates the desired RX equalizer mode. 74 + enum: 75 + - off 76 + - auto 77 + - manual 78 + 79 + "brcm,rxaeq-value": 80 + $ref: /schemas/types.yaml#/definitions/uint32 81 + description: | 82 + When 'brcm,rxaeq-mode' is set to "manual", provides the RX 83 + equalizer value that should be used. 84 + minimum: 0 85 + maximum: 63 86 + 87 + "brcm,tx-amplitude-millivolt": 88 + description: | 89 + Transmit amplitude voltage in millivolt. 90 + $ref: /schemas/types.yaml#/definitions/uint32 91 + enum: [400, 500, 600, 800] 92 + 93 + required: 94 + - reg 95 + - "#phy-cells" 96 + 97 + additionalProperties: false 98 + 99 + if: 100 + properties: 101 + compatible: 102 + items: 103 + const: brcm,iproc-ns2-sata-phy 104 + then: 105 + properties: 106 + reg: 107 + maxItems: 2 108 + reg-names: 109 + items: 110 + - const: "phy" 111 + - const: "phy-ctrl" 112 + else: 113 + properties: 114 + reg: 115 + maxItems: 1 116 + reg-names: 117 + maxItems: 1 118 + items: 119 + - const: "phy" 120 + 121 + required: 122 + - compatible 123 + - "#address-cells" 124 + - "#size-cells" 125 + - reg 126 + - reg-names 127 + 128 + additionalProperties: false 129 + 130 + examples: 131 + - | 132 + sata_phy@f0458100 { 133 + compatible = "brcm,bcm7445-sata-phy", "brcm,phy-sata3"; 134 + reg = <0xf0458100 0x1e00>; 135 + reg-names = "phy"; 136 + #address-cells = <1>; 137 + #size-cells = <0>; 138 + 139 + sata-phy@0 { 140 + reg = <0>; 141 + #phy-cells = <0>; 142 + }; 143 + 144 + sata-phy@1 { 145 + reg = <1>; 146 + #phy-cells = <0>; 147 + }; 148 + };
-58
Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
··· 1 - * Broadcom SATA3 PHY 2 - 3 - Required properties: 4 - - compatible: should be one or more of 5 - "brcm,bcm7216-sata-phy" 6 - "brcm,bcm7425-sata-phy" 7 - "brcm,bcm7445-sata-phy" 8 - "brcm,iproc-ns2-sata-phy" 9 - "brcm,iproc-nsp-sata-phy" 10 - "brcm,phy-sata3" 11 - "brcm,iproc-sr-sata-phy" 12 - "brcm,bcm63138-sata-phy" 13 - - address-cells: should be 1 14 - - size-cells: should be 0 15 - - reg: register ranges for the PHY PCB interface 16 - - reg-names: should be "phy" and "phy-ctrl" 17 - The "phy-ctrl" registers are only required for 18 - "brcm,iproc-ns2-sata-phy" and "brcm,iproc-sr-sata-phy". 19 - 20 - Sub-nodes: 21 - Each port's PHY should be represented as a sub-node. 22 - 23 - Sub-nodes required properties: 24 - - reg: the PHY number 25 - - phy-cells: generic PHY binding; must be 0 26 - 27 - Sub-nodes optional properties: 28 - - brcm,enable-ssc: use spread spectrum clocking (SSC) on this port 29 - This property is not applicable for "brcm,iproc-ns2-sata-phy", 30 - "brcm,iproc-nsp-sata-phy" and "brcm,iproc-sr-sata-phy". 31 - 32 - - brcm,rxaeq-mode: string that indicates the desired RX equalizer 33 - mode, possible values are: 34 - "off" (equivalent to not specifying the property) 35 - "auto" 36 - "manual" (brcm,rxaeq-value is used in that case) 37 - 38 - - brcm,rxaeq-value: when 'rxaeq-mode' is set to "manual", provides the RX 39 - equalizer value that should be used. Allowed range is 0..63. 40 - 41 - Example 42 - sata-phy@f0458100 { 43 - compatible = "brcm,bcm7445-sata-phy", "brcm,phy-sata3"; 44 - reg = <0xf0458100 0x1e00>, <0xf045804c 0x10>; 45 - reg-names = "phy"; 46 - #address-cells = <1>; 47 - #size-cells = <0>; 48 - 49 - sata-phy@0 { 50 - reg = <0>; 51 - #phy-cells = <0>; 52 - }; 53 - 54 - sata-phy@1 { 55 - reg = <1>; 56 - #phy-cells = <0>; 57 - }; 58 - };
+44
Documentation/devicetree/bindings/phy/intel,phy-keembay-usb.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/intel,phy-keembay-usb.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Intel Keem Bay USB PHY bindings 8 + 9 + maintainers: 10 + - Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com> 11 + 12 + properties: 13 + compatible: 14 + const: intel,keembay-usb-phy 15 + 16 + reg: 17 + items: 18 + - description: USB APB CPR (clock, power, reset) register 19 + - description: USB APB slave register 20 + 21 + reg-names: 22 + items: 23 + - const: cpr-apb-base 24 + - const: slv-apb-base 25 + 26 + '#phy-cells': 27 + const: 0 28 + 29 + required: 30 + - compatible 31 + - reg 32 + - '#phy-cells' 33 + 34 + additionalProperties: false 35 + 36 + examples: 37 + - | 38 + usb-phy@20400000 { 39 + compatible = "intel,keembay-usb-phy"; 40 + reg = <0x20400000 0x1c>, 41 + <0x20480000 0xd0>; 42 + reg-names = "cpr-apb-base", "slv-apb-base"; 43 + #phy-cells = <0>; 44 + };
+1 -8
Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml
··· 1 - # SPDX-License-Identifier: GPL-2.0-or-later 1 + # SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) 2 2 # Copyright 2019 Lubomir Rintel <lkundrak@v3.sk> 3 3 %YAML 1.2 4 4 --- ··· 18 18 maxItems: 1 19 19 description: base address of the device 20 20 21 - reset-gpios: 22 - maxItems: 1 23 - description: GPIO connected to reset 24 - 25 21 "#phy-cells": 26 22 const: 0 27 23 28 24 required: 29 25 - compatible 30 26 - reg 31 - - reset-gpios 32 27 - "#phy-cells" 33 28 34 29 additionalProperties: false 35 30 36 31 examples: 37 32 - | 38 - #include <dt-bindings/gpio/gpio.h> 39 33 hsic-phy@f0001800 { 40 34 compatible = "marvell,mmp3-hsic-phy"; 41 35 reg = <0xf0001800 0x40>; 42 - reset-gpios = <&gpio 63 GPIO_ACTIVE_HIGH>; 43 36 #phy-cells = <0>; 44 37 };
-70
Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt
··· 1 - Cadence Sierra PHY 2 - ----------------------- 3 - 4 - Required properties: 5 - - compatible: Must be "cdns,sierra-phy-t0" for Sierra in Cadence platform 6 - Must be "ti,sierra-phy-t0" for Sierra in TI's J721E SoC. 7 - - resets: Must contain an entry for each in reset-names. 8 - See ../reset/reset.txt for details. 9 - - reset-names: Must include "sierra_reset" and "sierra_apb". 10 - "sierra_reset" must control the reset line to the PHY. 11 - "sierra_apb" must control the reset line to the APB PHY 12 - interface ("sierra_apb" is optional). 13 - - reg: register range for the PHY. 14 - - #address-cells: Must be 1 15 - - #size-cells: Must be 0 16 - 17 - Optional properties: 18 - - clocks: Must contain an entry in clock-names. 19 - See ../clocks/clock-bindings.txt for details. 20 - - clock-names: Must contain "cmn_refclk_dig_div" and 21 - "cmn_refclk1_dig_div" for configuring the frequency of 22 - the clock to the lanes. "phy_clk" is deprecated. 23 - - cdns,autoconf: A boolean property whose presence indicates that the 24 - PHY registers will be configured by hardware. If not 25 - present, all sub-node optional properties must be 26 - provided. 27 - 28 - Sub-nodes: 29 - Each group of PHY lanes with a single master lane should be represented as 30 - a sub-node. Note that the actual configuration of each lane is determined by 31 - hardware strapping, and must match the configuration specified here. 32 - 33 - Sub-node required properties: 34 - - #phy-cells: Generic PHY binding; must be 0. 35 - - reg: The master lane number. This is the lowest numbered lane 36 - in the lane group. 37 - - resets: Must contain one entry which controls the reset line for the 38 - master lane of the sub-node. 39 - See ../reset/reset.txt for details. 40 - 41 - Sub-node optional properties: 42 - - cdns,num-lanes: Number of lanes in this group. From 1 to 4. The 43 - group is made up of consecutive lanes. 44 - - cdns,phy-type: Can be PHY_TYPE_PCIE or PHY_TYPE_USB3, depending on 45 - configuration of lanes. 46 - 47 - Example: 48 - pcie_phy4: pcie-phy@fd240000 { 49 - compatible = "cdns,sierra-phy-t0"; 50 - reg = <0x0 0xfd240000 0x0 0x40000>; 51 - resets = <&phyrst 0>, <&phyrst 1>; 52 - reset-names = "sierra_reset", "sierra_apb"; 53 - clocks = <&phyclock>; 54 - clock-names = "phy_clk"; 55 - #address-cells = <1>; 56 - #size-cells = <0>; 57 - pcie0_phy0: pcie-phy@0 { 58 - reg = <0>; 59 - resets = <&phyrst 2>; 60 - cdns,num-lanes = <2>; 61 - #phy-cells = <0>; 62 - cdns,phy-type = <PHY_TYPE_PCIE>; 63 - }; 64 - pcie0_phy1: pcie-phy@2 { 65 - reg = <2>; 66 - resets = <&phyrst 4>; 67 - cdns,num-lanes = <1>; 68 - #phy-cells = <0>; 69 - cdns,phy-type = <PHY_TYPE_PCIE>; 70 - };
+152
Documentation/devicetree/bindings/phy/phy-cadence-sierra.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: "http://devicetree.org/schemas/phy/phy-cadence-sierra.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: Cadence Sierra PHY binding 8 + 9 + description: 10 + This binding describes the Cadence Sierra PHY. Sierra PHY supports multilink 11 + multiprotocol combinations including protocols such as PCIe, USB etc. 12 + 13 + maintainers: 14 + - Swapnil Jakhade <sjakhade@cadence.com> 15 + - Yuti Amonkar <yamonkar@cadence.com> 16 + 17 + properties: 18 + compatible: 19 + enum: 20 + - cdns,sierra-phy-t0 21 + - ti,sierra-phy-t0 22 + 23 + '#address-cells': 24 + const: 1 25 + 26 + '#size-cells': 27 + const: 0 28 + 29 + resets: 30 + minItems: 1 31 + maxItems: 2 32 + items: 33 + - description: Sierra PHY reset. 34 + - description: Sierra APB reset. This is optional. 35 + 36 + reset-names: 37 + minItems: 1 38 + maxItems: 2 39 + items: 40 + - const: sierra_reset 41 + - const: sierra_apb 42 + 43 + reg: 44 + maxItems: 1 45 + description: 46 + Offset of the Sierra PHY configuration registers. 47 + 48 + reg-names: 49 + const: serdes 50 + 51 + clocks: 52 + maxItems: 2 53 + 54 + clock-names: 55 + items: 56 + - const: cmn_refclk_dig_div 57 + - const: cmn_refclk1_dig_div 58 + 59 + cdns,autoconf: 60 + type: boolean 61 + description: 62 + A boolean property whose presence indicates that the PHY registers will be 63 + configured by hardware. If not present, all sub-node optional properties 64 + must be provided. 65 + 66 + patternProperties: 67 + '^phy@[0-9a-f]$': 68 + type: object 69 + description: 70 + Each group of PHY lanes with a single master lane should be represented as 71 + a sub-node. Note that the actual configuration of each lane is determined 72 + by hardware strapping, and must match the configuration specified here. 73 + properties: 74 + reg: 75 + description: 76 + The master lane number. This is the lowest numbered lane in the lane group. 77 + minimum: 0 78 + maximum: 15 79 + 80 + resets: 81 + minItems: 1 82 + maxItems: 4 83 + description: 84 + Contains list of resets, one per lane, to get all the link lanes out of reset. 85 + 86 + "#phy-cells": 87 + const: 0 88 + 89 + cdns,phy-type: 90 + description: 91 + Specifies the type of PHY for which the group of PHY lanes is used. 92 + Refer include/dt-bindings/phy/phy.h. Constants from the header should be used. 93 + $ref: /schemas/types.yaml#/definitions/uint32 94 + enum: [2, 4] 95 + 96 + cdns,num-lanes: 97 + description: 98 + Number of lanes in this group. The group is made up of consecutive lanes. 99 + $ref: /schemas/types.yaml#/definitions/uint32 100 + minimum: 1 101 + maximum: 16 102 + 103 + required: 104 + - reg 105 + - resets 106 + - "#phy-cells" 107 + 108 + additionalProperties: false 109 + 110 + required: 111 + - compatible 112 + - "#address-cells" 113 + - "#size-cells" 114 + - reg 115 + - resets 116 + - reset-names 117 + 118 + additionalProperties: false 119 + 120 + examples: 121 + - | 122 + #include <dt-bindings/phy/phy.h> 123 + 124 + bus { 125 + #address-cells = <2>; 126 + #size-cells = <2>; 127 + 128 + sierra-phy@fd240000 { 129 + compatible = "cdns,sierra-phy-t0"; 130 + reg = <0x0 0xfd240000 0x0 0x40000>; 131 + resets = <&phyrst 0>, <&phyrst 1>; 132 + reset-names = "sierra_reset", "sierra_apb"; 133 + clocks = <&cmn_refclk_dig_div>, <&cmn_refclk1_dig_div>; 134 + clock-names = "cmn_refclk_dig_div", "cmn_refclk1_dig_div"; 135 + #address-cells = <1>; 136 + #size-cells = <0>; 137 + pcie0_phy0: phy@0 { 138 + reg = <0>; 139 + resets = <&phyrst 2>; 140 + cdns,num-lanes = <2>; 141 + #phy-cells = <0>; 142 + cdns,phy-type = <PHY_TYPE_PCIE>; 143 + }; 144 + pcie0_phy1: phy@2 { 145 + reg = <2>; 146 + resets = <&phyrst 4>; 147 + cdns,num-lanes = <1>; 148 + #phy-cells = <0>; 149 + cdns,phy-type = <PHY_TYPE_PCIE>; 150 + }; 151 + }; 152 + };
-73
Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.txt
··· 1 - STMicroelectronics STM32 USB HS PHY controller 2 - 3 - The STM32 USBPHYC block contains a dual port High Speed UTMI+ PHY and a UTMI 4 - switch. It controls PHY configuration and status, and the UTMI+ switch that 5 - selects either OTG or HOST controller for the second PHY port. It also sets 6 - PLL configuration. 7 - 8 - USBPHYC 9 - |_ PLL 10 - | 11 - |_ PHY port#1 _________________ HOST controller 12 - | _ | 13 - | / 1|________________| 14 - |_ PHY port#2 ----| |________________ 15 - | \_0| | 16 - |_ UTMI switch_______| OTG controller 17 - 18 - 19 - Phy provider node 20 - ================= 21 - 22 - Required properties: 23 - - compatible: must be "st,stm32mp1-usbphyc" 24 - - reg: address and length of the usb phy control register set 25 - - clocks: phandle + clock specifier for the PLL phy clock 26 - - #address-cells: number of address cells for phys sub-nodes, must be <1> 27 - - #size-cells: number of size cells for phys sub-nodes, must be <0> 28 - 29 - Optional properties: 30 - - assigned-clocks: phandle + clock specifier for the PLL phy clock 31 - - assigned-clock-parents: the PLL phy clock parent 32 - - resets: phandle + reset specifier 33 - 34 - Required nodes: one sub-node per port the controller provides. 35 - 36 - Phy sub-nodes 37 - ============== 38 - 39 - Required properties: 40 - - reg: phy port index 41 - - phy-supply: phandle to the regulator providing 3V3 power to the PHY, 42 - see phy-bindings.txt in the same directory. 43 - - vdda1v1-supply: phandle to the regulator providing 1V1 power to the PHY 44 - - vdda1v8-supply: phandle to the regulator providing 1V8 power to the PHY 45 - - #phy-cells: see phy-bindings.txt in the same directory, must be <0> for PHY 46 - port#1 and must be <1> for PHY port#2, to select USB controller 47 - 48 - 49 - Example: 50 - usbphyc: usb-phy@5a006000 { 51 - compatible = "st,stm32mp1-usbphyc"; 52 - reg = <0x5a006000 0x1000>; 53 - clocks = <&rcc_clk USBPHY_K>; 54 - resets = <&rcc_rst USBPHY_R>; 55 - #address-cells = <1>; 56 - #size-cells = <0>; 57 - 58 - usbphyc_port0: usb-phy@0 { 59 - reg = <0>; 60 - phy-supply = <&vdd_usb>; 61 - vdda1v1-supply = <&reg11>; 62 - vdda1v8-supply = <&reg18> 63 - #phy-cells = <0>; 64 - }; 65 - 66 - usbphyc_port1: usb-phy@1 { 67 - reg = <1>; 68 - phy-supply = <&vdd_usb>; 69 - vdda1v1-supply = <&reg11>; 70 - vdda1v8-supply = <&reg18> 71 - #phy-cells = <1>; 72 - }; 73 - };
+138
Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.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/phy-stm32-usbphyc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: STMicroelectronics STM32 USB HS PHY controller binding 8 + 9 + description: 10 + 11 + The STM32 USBPHYC block contains a dual port High Speed UTMI+ PHY and a UTMI 12 + switch. It controls PHY configuration and status, and the UTMI+ switch that 13 + selects either OTG or HOST controller for the second PHY port. It also sets 14 + PLL configuration. 15 + 16 + USBPHYC 17 + |_ PLL 18 + | 19 + |_ PHY port#1 _________________ HOST controller 20 + | __ | 21 + | / 1|________________| 22 + |_ PHY port#2 ----| |________________ 23 + | \_0| | 24 + |_ UTMI switch_______| OTG controller 25 + 26 + maintainers: 27 + - Amelie Delaunay <amelie.delaunay@st.com> 28 + 29 + properties: 30 + compatible: 31 + const: st,stm32mp1-usbphyc 32 + 33 + reg: 34 + maxItems: 1 35 + 36 + clocks: 37 + maxItems: 1 38 + 39 + resets: 40 + maxItems: 1 41 + 42 + "#address-cells": 43 + const: 1 44 + 45 + "#size-cells": 46 + const: 0 47 + 48 + #Required child nodes: 49 + 50 + patternProperties: 51 + "^usb-phy@[0|1]$": 52 + type: object 53 + description: 54 + Each port the controller provides must be represented as a sub-node. 55 + 56 + properties: 57 + reg: 58 + description: phy port index. 59 + maxItems: 1 60 + 61 + phy-supply: 62 + description: regulator providing 3V3 power supply to the PHY. 63 + 64 + vdda1v1-supply: 65 + description: regulator providing 1V1 power supply to the PLL block 66 + 67 + vdda1v8-supply: 68 + description: regulator providing 1V8 power supply to the PLL block 69 + 70 + "#phy-cells": 71 + enum: [ 0x0, 0x1 ] 72 + 73 + allOf: 74 + - if: 75 + properties: 76 + reg: 77 + const: 0 78 + then: 79 + properties: 80 + "#phy-cells": 81 + const: 0 82 + else: 83 + properties: 84 + "#phy-cells": 85 + const: 1 86 + description: 87 + The value is used to select UTMI switch output. 88 + 0 for OTG controller and 1 for Host controller. 89 + 90 + required: 91 + - reg 92 + - phy-supply 93 + - vdda1v1-supply 94 + - vdda1v8-supply 95 + - "#phy-cells" 96 + 97 + additionalProperties: false 98 + 99 + required: 100 + - compatible 101 + - reg 102 + - clocks 103 + - "#address-cells" 104 + - "#size-cells" 105 + - usb-phy@0 106 + - usb-phy@1 107 + 108 + additionalProperties: false 109 + 110 + examples: 111 + - | 112 + #include <dt-bindings/clock/stm32mp1-clks.h> 113 + #include <dt-bindings/reset/stm32mp1-resets.h> 114 + usbphyc: usbphyc@5a006000 { 115 + compatible = "st,stm32mp1-usbphyc"; 116 + reg = <0x5a006000 0x1000>; 117 + clocks = <&rcc USBPHY_K>; 118 + resets = <&rcc USBPHY_R>; 119 + #address-cells = <1>; 120 + #size-cells = <0>; 121 + 122 + usbphyc_port0: usb-phy@0 { 123 + reg = <0>; 124 + phy-supply = <&vdd_usb>; 125 + vdda1v1-supply = <&reg11>; 126 + vdda1v8-supply = <&reg18>; 127 + #phy-cells = <0>; 128 + }; 129 + 130 + usbphyc_port1: usb-phy@1 { 131 + reg = <1>; 132 + phy-supply = <&vdd_usb>; 133 + vdda1v1-supply = <&reg11>; 134 + vdda1v8-supply = <&reg18>; 135 + #phy-cells = <1>; 136 + }; 137 + }; 138 + ...
+6
Documentation/devicetree/bindings/phy/qcom,qmp-phy.yaml
··· 31 31 - qcom,sdm845-qmp-usb3-uni-phy 32 32 - qcom,sm8150-qmp-ufs-phy 33 33 - qcom,sm8250-qmp-ufs-phy 34 + - qcom,sm8250-qmp-gen3x1-pcie-phy 35 + - qcom,sm8250-qmp-gen3x2-pcie-phy 36 + - qcom,sm8250-qmp-modem-pcie-phy 34 37 35 38 reg: 36 39 items: ··· 262 259 enum: 263 260 - qcom,sdm845-qhp-pcie-phy 264 261 - qcom,sdm845-qmp-pcie-phy 262 + - qcom,sm8250-qmp-gen3x1-pcie-phy 263 + - qcom,sm8250-qmp-gen3x2-pcie-phy 264 + - qcom,sm8250-qmp-modem-pcie-phy 265 265 then: 266 266 properties: 267 267 clocks:
+5
Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
··· 16 16 - drive-impedance-ohm: Specifies the drive impedance in Ohm. 17 17 Possible values are 33, 40, 50, 66 and 100. 18 18 If not set, the default value of 50 will be applied. 19 + - enable-strobe-pulldown: Enable internal pull-down for the strobe line. 20 + If not set, pull-down is not used. 21 + - output-tapdelay-select: Specifies the phyctrl_otapdlysec register. 22 + If not set, the register defaults to 0x4. 23 + Maximum value 0xf. 19 24 20 25 Example: 21 26
+1
Documentation/devicetree/bindings/phy/samsung-phy.txt
··· 47 47 - "samsung,exynos4210-usb2-phy" 48 48 - "samsung,exynos4x12-usb2-phy" 49 49 - "samsung,exynos5250-usb2-phy" 50 + - "samsung,exynos5420-usb2-phy" 50 51 - "samsung,s5pv210-usb2-phy" 51 52 - reg : a list of registers used by phy driver 52 53 - first and obligatory is the location of phy modules registers
+3 -1
Documentation/devicetree/bindings/usb/ingenic,jz4770-phy.yaml Documentation/devicetree/bindings/phy/ingenic,phy-usb.yaml
··· 1 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 %YAML 1.2 3 3 --- 4 - $id: http://devicetree.org/schemas/usb/ingenic,jz4770-phy.yaml# 4 + $id: http://devicetree.org/schemas/phy/ingenic,phy-usb.yaml# 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: Ingenic SoCs USB PHY devicetree bindings ··· 17 17 compatible: 18 18 enum: 19 19 - ingenic,jz4770-phy 20 + - ingenic,jz4775-phy 20 21 - ingenic,jz4780-phy 21 22 - ingenic,x1000-phy 22 23 - ingenic,x1830-phy 24 + - ingenic,x2000-phy 23 25 24 26 reg: 25 27 maxItems: 1
+14
MAINTAINERS
··· 11082 11082 F: Documentation/devicetree/bindings/i2c/i2c-mt7621.txt 11083 11083 F: drivers/i2c/busses/i2c-mt7621.c 11084 11084 11085 + MEDIATEK MT7621 PHY PCI DRIVER 11086 + M: Sergio Paracuellos <sergio.paracuellos@gmail.com> 11087 + S: Maintained 11088 + F: Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.yaml 11089 + F: drivers/phy/ralink/phy-mt7621-pci.c 11090 + 11085 11091 MEDIATEK NAND CONTROLLER DRIVER 11086 11092 L: linux-mtd@lists.infradead.org 11087 11093 S: Orphan ··· 14526 14520 F: Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml 14527 14521 F: drivers/mailbox/qcom-ipcc.c 14528 14522 F: include/dt-bindings/mailbox/qcom-ipcc.h 14523 + 14524 + QUALCOMM IPQ4019 USB PHY DRIVER 14525 + M: Robert Marko <robert.marko@sartura.hr> 14526 + M: Luka Perkov <luka.perkov@sartura.hr> 14527 + L: linux-arm-msm@vger.kernel.org 14528 + S: Maintained 14529 + F: Documentation/devicetree/bindings/phy/qcom-usb-ipq4019-phy.yaml 14530 + F: drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c 14529 14531 14530 14532 QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER 14531 14533 M: Robert Marko <robert.marko@sartura.hr>
+1
drivers/phy/Kconfig
··· 66 66 source "drivers/phy/cadence/Kconfig" 67 67 source "drivers/phy/freescale/Kconfig" 68 68 source "drivers/phy/hisilicon/Kconfig" 69 + source "drivers/phy/ingenic/Kconfig" 69 70 source "drivers/phy/lantiq/Kconfig" 70 71 source "drivers/phy/marvell/Kconfig" 71 72 source "drivers/phy/mediatek/Kconfig"
+1
drivers/phy/Makefile
··· 15 15 cadence/ \ 16 16 freescale/ \ 17 17 hisilicon/ \ 18 + ingenic/ \ 18 19 intel/ \ 19 20 lantiq/ \ 20 21 marvell/ \
+2 -7
drivers/phy/allwinner/phy-sun4i-usb.c
··· 686 686 struct device *dev = &pdev->dev; 687 687 struct device_node *np = dev->of_node; 688 688 struct phy_provider *phy_provider; 689 - struct resource *res; 690 689 int i, ret; 691 690 692 691 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); ··· 699 700 if (!data->cfg) 700 701 return -EINVAL; 701 702 702 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_ctrl"); 703 - data->base = devm_ioremap_resource(dev, res); 703 + data->base = devm_platform_ioremap_resource_byname(pdev, "phy_ctrl"); 704 704 if (IS_ERR(data->base)) 705 705 return PTR_ERR(data->base); 706 706 ··· 794 796 795 797 if (i || data->cfg->phy0_dual_route) { /* No pmu for musb */ 796 798 snprintf(name, sizeof(name), "pmu%d", i); 797 - res = platform_get_resource_byname(pdev, 798 - IORESOURCE_MEM, name); 799 - phy->pmu = devm_ioremap_resource(dev, res); 799 + phy->pmu = devm_platform_ioremap_resource_byname(pdev, name); 800 800 if (IS_ERR(phy->pmu)) 801 801 return PTR_ERR(phy->pmu); 802 802 } ··· 965 969 .disc_thresh = 3, 966 970 .phyctl_offset = REG_PHYCTL_A33, 967 971 .dedicated_clocks = true, 968 - .enable_pmu_unk1 = true, 969 972 .phy0_dual_route = true, 970 973 .missing_phys = BIT(1) | BIT(2), 971 974 };
+1 -3
drivers/phy/allwinner/phy-sun50i-usb3.c
··· 134 134 struct sun50i_usb3_phy *phy; 135 135 struct device *dev = &pdev->dev; 136 136 struct phy_provider *phy_provider; 137 - struct resource *res; 138 137 139 138 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); 140 139 if (!phy) ··· 152 153 return PTR_ERR(phy->reset); 153 154 } 154 155 155 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 156 - phy->regs = devm_ioremap_resource(dev, res); 156 + phy->regs = devm_platform_ioremap_resource(pdev, 0); 157 157 if (IS_ERR(phy->regs)) 158 158 return PTR_ERR(phy->regs); 159 159
+1 -3
drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
··· 253 253 { 254 254 struct phy_provider *phy_provider; 255 255 struct sun6i_dphy *dphy; 256 - struct resource *res; 257 256 void __iomem *regs; 258 257 259 258 dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); 260 259 if (!dphy) 261 260 return -ENOMEM; 262 261 263 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 264 - regs = devm_ioremap_resource(&pdev->dev, res); 262 + regs = devm_platform_ioremap_resource(pdev, 0); 265 263 if (IS_ERR(regs)) { 266 264 dev_err(&pdev->dev, "Couldn't map the DPHY encoder registers\n"); 267 265 return PTR_ERR(regs);
+1 -3
drivers/phy/allwinner/phy-sun9i-usb.c
··· 117 117 struct device *dev = &pdev->dev; 118 118 struct device_node *np = dev->of_node; 119 119 struct phy_provider *phy_provider; 120 - struct resource *res; 121 120 122 121 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); 123 122 if (!phy) ··· 155 156 } 156 157 } 157 158 158 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 159 - phy->pmu = devm_ioremap_resource(dev, res); 159 + phy->pmu = devm_platform_ioremap_resource(pdev, 0); 160 160 if (IS_ERR(phy->pmu)) 161 161 return PTR_ERR(phy->pmu); 162 162
+13
drivers/phy/amlogic/Kconfig
··· 66 66 depends on OF && (ARCH_MESON || COMPILE_TEST) 67 67 select GENERIC_PHY 68 68 select REGMAP_MMIO 69 + select GENERIC_PHY_MIPI_DPHY 69 70 help 70 71 Enable this to support the Meson MIPI + PCIE analog PHY 71 72 found in Meson AXG SoCs. 73 + If unsure, say N. 74 + 75 + config PHY_MESON_AXG_MIPI_DPHY 76 + tristate "Meson AXG MIPI DPHY driver" 77 + default ARCH_MESON 78 + depends on OF && (ARCH_MESON || COMPILE_TEST) 79 + select GENERIC_PHY 80 + select REGMAP_MMIO 81 + select GENERIC_PHY_MIPI_DPHY 82 + help 83 + Enable this to support the Meson MIPI DPHY found in Meson AXG 84 + SoCs. 72 85 If unsure, say N.
+1
drivers/phy/amlogic/Makefile
··· 5 5 obj-$(CONFIG_PHY_MESON_G12A_USB3_PCIE) += phy-meson-g12a-usb3-pcie.o 6 6 obj-$(CONFIG_PHY_MESON_AXG_PCIE) += phy-meson-axg-pcie.o 7 7 obj-$(CONFIG_PHY_MESON_AXG_MIPI_PCIE_ANALOG) += phy-meson-axg-mipi-pcie-analog.o 8 + obj-$(CONFIG_PHY_MESON_AXG_MIPI_DPHY) += phy-meson-axg-mipi-dphy.o
+413
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Meson AXG MIPI DPHY driver 4 + * 5 + * Copyright (C) 2018 Amlogic, Inc. All rights reserved 6 + * Copyright (C) 2020 BayLibre, SAS 7 + * Author: Neil Armstrong <narmstrong@baylibre.com> 8 + */ 9 + 10 + #include <linux/bitfield.h> 11 + #include <linux/bitops.h> 12 + #include <linux/clk.h> 13 + #include <linux/delay.h> 14 + #include <linux/io.h> 15 + #include <linux/module.h> 16 + #include <linux/of_device.h> 17 + #include <linux/regmap.h> 18 + #include <linux/reset.h> 19 + #include <linux/phy/phy.h> 20 + #include <linux/platform_device.h> 21 + 22 + /* [31] soft reset for the phy. 23 + * 1: reset. 0: dessert the reset. 24 + * [30] clock lane soft reset. 25 + * [29] data byte lane 3 soft reset. 26 + * [28] data byte lane 2 soft reset. 27 + * [27] data byte lane 1 soft reset. 28 + * [26] data byte lane 0 soft reset. 29 + * [25] mipi dsi pll clock selection. 30 + * 1: clock from fixed 850Mhz clock source. 0: from VID2 PLL. 31 + * [12] mipi HSbyteclk enable. 32 + * [11] mipi divider clk selection. 33 + * 1: select the mipi DDRCLKHS from clock divider. 34 + * 0: from PLL clock. 35 + * [10] mipi clock divider control. 36 + * 1: /4. 0: /2. 37 + * [9] mipi divider output enable. 38 + * [8] mipi divider counter enable. 39 + * [7] PLL clock enable. 40 + * [5] LPDT data endian. 41 + * 1 = transfer the high bit first. 0 : transfer the low bit first. 42 + * [4] HS data endian. 43 + * [3] force data byte lane in stop mode. 44 + * [2] force data byte lane 0 in receiver mode. 45 + * [1] write 1 to sync the txclkesc input. the internal logic have to 46 + * use txclkesc to decide Txvalid and Txready. 47 + * [0] enalbe the MIPI DPHY TxDDRClk. 48 + */ 49 + #define MIPI_DSI_PHY_CTRL 0x0 50 + 51 + /* [31] clk lane tx_hs_en control selection. 52 + * 1: from register. 0: use clk lane state machine. 53 + * [30] register bit for clock lane tx_hs_en. 54 + * [29] clk lane tx_lp_en contrl selection. 55 + * 1: from register. 0: from clk lane state machine. 56 + * [28] register bit for clock lane tx_lp_en. 57 + * [27] chan0 tx_hs_en control selection. 58 + * 1: from register. 0: from chan0 state machine. 59 + * [26] register bit for chan0 tx_hs_en. 60 + * [25] chan0 tx_lp_en control selection. 61 + * 1: from register. 0: from chan0 state machine. 62 + * [24] register bit from chan0 tx_lp_en. 63 + * [23] chan0 rx_lp_en control selection. 64 + * 1: from register. 0: from chan0 state machine. 65 + * [22] register bit from chan0 rx_lp_en. 66 + * [21] chan0 contention detection enable control selection. 67 + * 1: from register. 0: from chan0 state machine. 68 + * [20] register bit from chan0 contention dectection enable. 69 + * [19] chan1 tx_hs_en control selection. 70 + * 1: from register. 0: from chan0 state machine. 71 + * [18] register bit for chan1 tx_hs_en. 72 + * [17] chan1 tx_lp_en control selection. 73 + * 1: from register. 0: from chan0 state machine. 74 + * [16] register bit from chan1 tx_lp_en. 75 + * [15] chan2 tx_hs_en control selection. 76 + * 1: from register. 0: from chan0 state machine. 77 + * [14] register bit for chan2 tx_hs_en. 78 + * [13] chan2 tx_lp_en control selection. 79 + * 1: from register. 0: from chan0 state machine. 80 + * [12] register bit from chan2 tx_lp_en. 81 + * [11] chan3 tx_hs_en control selection. 82 + * 1: from register. 0: from chan0 state machine. 83 + * [10] register bit for chan3 tx_hs_en. 84 + * [9] chan3 tx_lp_en control selection. 85 + * 1: from register. 0: from chan0 state machine. 86 + * [8] register bit from chan3 tx_lp_en. 87 + * [4] clk chan power down. this bit is also used as the power down 88 + * of the whole MIPI_DSI_PHY. 89 + * [3] chan3 power down. 90 + * [2] chan2 power down. 91 + * [1] chan1 power down. 92 + * [0] chan0 power down. 93 + */ 94 + #define MIPI_DSI_CHAN_CTRL 0x4 95 + 96 + /* [24] rx turn watch dog triggered. 97 + * [23] rx esc watchdog triggered. 98 + * [22] mbias ready. 99 + * [21] txclkesc synced and ready. 100 + * [20:17] clk lane state. {mbias_ready, tx_stop, tx_ulps, tx_hs_active} 101 + * [16:13] chan3 state{0, tx_stop, tx_ulps, tx_hs_active} 102 + * [12:9] chan2 state.{0, tx_stop, tx_ulps, tx_hs_active} 103 + * [8:5] chan1 state. {0, tx_stop, tx_ulps, tx_hs_active} 104 + * [4:0] chan0 state. {TX_STOP, tx_ULPS, hs_active, direction, rxulpsesc} 105 + */ 106 + #define MIPI_DSI_CHAN_STS 0x8 107 + 108 + /* [31:24] TCLK_PREPARE. 109 + * [23:16] TCLK_ZERO. 110 + * [15:8] TCLK_POST. 111 + * [7:0] TCLK_TRAIL. 112 + */ 113 + #define MIPI_DSI_CLK_TIM 0xc 114 + 115 + /* [31:24] THS_PREPARE. 116 + * [23:16] THS_ZERO. 117 + * [15:8] THS_TRAIL. 118 + * [7:0] THS_EXIT. 119 + */ 120 + #define MIPI_DSI_HS_TIM 0x10 121 + 122 + /* [31:24] tTA_GET. 123 + * [23:16] tTA_GO. 124 + * [15:8] tTA_SURE. 125 + * [7:0] tLPX. 126 + */ 127 + #define MIPI_DSI_LP_TIM 0x14 128 + 129 + /* wait time to MIPI DIS analog ready. */ 130 + #define MIPI_DSI_ANA_UP_TIM 0x18 131 + 132 + /* TINIT. */ 133 + #define MIPI_DSI_INIT_TIM 0x1c 134 + 135 + /* TWAKEUP. */ 136 + #define MIPI_DSI_WAKEUP_TIM 0x20 137 + 138 + /* when in RxULPS check state, after the the logic enable the analog, 139 + * how long we should wait to check the lP state . 140 + */ 141 + #define MIPI_DSI_LPOK_TIM 0x24 142 + 143 + /* Watchdog for RX low power state no finished. */ 144 + #define MIPI_DSI_LP_WCHDOG 0x28 145 + 146 + /* tMBIAS, after send power up signals to analog, 147 + * how long we should wait for analog powered up. 148 + */ 149 + #define MIPI_DSI_ANA_CTRL 0x2c 150 + 151 + /* [31:8] reserved for future. 152 + * [7:0] tCLK_PRE. 153 + */ 154 + #define MIPI_DSI_CLK_TIM1 0x30 155 + 156 + /* watchdog for turn around waiting time. */ 157 + #define MIPI_DSI_TURN_WCHDOG 0x34 158 + 159 + /* When in RxULPS state, how frequency we should to check 160 + * if the TX side out of ULPS state. 161 + */ 162 + #define MIPI_DSI_ULPS_CHECK 0x38 163 + #define MIPI_DSI_TEST_CTRL0 0x3c 164 + #define MIPI_DSI_TEST_CTRL1 0x40 165 + 166 + struct phy_meson_axg_mipi_dphy_priv { 167 + struct device *dev; 168 + struct regmap *regmap; 169 + struct clk *clk; 170 + struct reset_control *reset; 171 + struct phy *analog; 172 + struct phy_configure_opts_mipi_dphy config; 173 + }; 174 + 175 + static const struct regmap_config phy_meson_axg_mipi_dphy_regmap_conf = { 176 + .reg_bits = 8, 177 + .val_bits = 32, 178 + .reg_stride = 4, 179 + .max_register = MIPI_DSI_TEST_CTRL1, 180 + }; 181 + 182 + static int phy_meson_axg_mipi_dphy_init(struct phy *phy) 183 + { 184 + struct phy_meson_axg_mipi_dphy_priv *priv = phy_get_drvdata(phy); 185 + int ret; 186 + 187 + ret = phy_init(priv->analog); 188 + if (ret) 189 + return ret; 190 + 191 + ret = reset_control_reset(priv->reset); 192 + if (ret) 193 + return ret; 194 + 195 + return 0; 196 + } 197 + 198 + static int phy_meson_axg_mipi_dphy_configure(struct phy *phy, 199 + union phy_configure_opts *opts) 200 + { 201 + struct phy_meson_axg_mipi_dphy_priv *priv = phy_get_drvdata(phy); 202 + int ret; 203 + 204 + ret = phy_mipi_dphy_config_validate(&opts->mipi_dphy); 205 + if (ret) 206 + return ret; 207 + 208 + ret = phy_configure(priv->analog, opts); 209 + if (ret) 210 + return ret; 211 + 212 + memcpy(&priv->config, opts, sizeof(priv->config)); 213 + 214 + return 0; 215 + } 216 + 217 + static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) 218 + { 219 + struct phy_meson_axg_mipi_dphy_priv *priv = phy_get_drvdata(phy); 220 + int ret; 221 + unsigned long temp; 222 + 223 + ret = phy_power_on(priv->analog); 224 + if (ret) 225 + return ret; 226 + 227 + /* enable phy clock */ 228 + regmap_write(priv->regmap, MIPI_DSI_PHY_CTRL, 0x1); 229 + regmap_write(priv->regmap, MIPI_DSI_PHY_CTRL, 230 + BIT(0) | /* enable the DSI PLL clock . */ 231 + BIT(7) | /* enable pll clock which connected to DDR clock path */ 232 + BIT(8)); /* enable the clock divider counter */ 233 + 234 + /* enable the divider clock out */ 235 + regmap_update_bits(priv->regmap, MIPI_DSI_PHY_CTRL, BIT(9), BIT(9)); 236 + 237 + /* enable the byte clock generation. */ 238 + regmap_update_bits(priv->regmap, MIPI_DSI_PHY_CTRL, BIT(12), BIT(12)); 239 + regmap_update_bits(priv->regmap, MIPI_DSI_PHY_CTRL, BIT(31), BIT(31)); 240 + regmap_update_bits(priv->regmap, MIPI_DSI_PHY_CTRL, BIT(31), 0); 241 + 242 + /* Calculate lanebyteclk period in ps */ 243 + temp = (1000000 * 100) / (priv->config.hs_clk_rate / 1000); 244 + temp = temp * 8 * 10; 245 + 246 + regmap_write(priv->regmap, MIPI_DSI_CLK_TIM, 247 + DIV_ROUND_UP(priv->config.clk_trail, temp) | 248 + (DIV_ROUND_UP(priv->config.clk_post + 249 + priv->config.hs_trail, temp) << 8) | 250 + (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | 251 + (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); 252 + regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, 253 + DIV_ROUND_UP(priv->config.clk_pre, temp)); 254 + 255 + regmap_write(priv->regmap, MIPI_DSI_HS_TIM, 256 + DIV_ROUND_UP(priv->config.hs_exit, temp) | 257 + (DIV_ROUND_UP(priv->config.hs_trail, temp) << 8) | 258 + (DIV_ROUND_UP(priv->config.hs_zero, temp) << 16) | 259 + (DIV_ROUND_UP(priv->config.hs_prepare, temp) << 24)); 260 + 261 + regmap_write(priv->regmap, MIPI_DSI_LP_TIM, 262 + DIV_ROUND_UP(priv->config.lpx, temp) | 263 + (DIV_ROUND_UP(priv->config.ta_sure, temp) << 8) | 264 + (DIV_ROUND_UP(priv->config.ta_go, temp) << 16) | 265 + (DIV_ROUND_UP(priv->config.ta_get, temp) << 24)); 266 + 267 + regmap_write(priv->regmap, MIPI_DSI_ANA_UP_TIM, 0x0100); 268 + regmap_write(priv->regmap, MIPI_DSI_INIT_TIM, 269 + DIV_ROUND_UP(priv->config.init * NSEC_PER_MSEC, temp)); 270 + regmap_write(priv->regmap, MIPI_DSI_WAKEUP_TIM, 271 + DIV_ROUND_UP(priv->config.wakeup * NSEC_PER_MSEC, temp)); 272 + regmap_write(priv->regmap, MIPI_DSI_LPOK_TIM, 0x7C); 273 + regmap_write(priv->regmap, MIPI_DSI_ULPS_CHECK, 0x927C); 274 + regmap_write(priv->regmap, MIPI_DSI_LP_WCHDOG, 0x1000); 275 + regmap_write(priv->regmap, MIPI_DSI_TURN_WCHDOG, 0x1000); 276 + 277 + /* Powerup the analog circuit */ 278 + switch (priv->config.lanes) { 279 + case 1: 280 + regmap_write(priv->regmap, MIPI_DSI_CHAN_CTRL, 0xe); 281 + break; 282 + case 2: 283 + regmap_write(priv->regmap, MIPI_DSI_CHAN_CTRL, 0xc); 284 + break; 285 + case 3: 286 + regmap_write(priv->regmap, MIPI_DSI_CHAN_CTRL, 0x8); 287 + break; 288 + case 4: 289 + default: 290 + regmap_write(priv->regmap, MIPI_DSI_CHAN_CTRL, 0); 291 + break; 292 + } 293 + 294 + /* Trigger a sync active for esc_clk */ 295 + regmap_update_bits(priv->regmap, MIPI_DSI_PHY_CTRL, BIT(1), BIT(1)); 296 + 297 + return 0; 298 + } 299 + 300 + static int phy_meson_axg_mipi_dphy_power_off(struct phy *phy) 301 + { 302 + struct phy_meson_axg_mipi_dphy_priv *priv = phy_get_drvdata(phy); 303 + 304 + regmap_write(priv->regmap, MIPI_DSI_CHAN_CTRL, 0xf); 305 + regmap_write(priv->regmap, MIPI_DSI_PHY_CTRL, BIT(31)); 306 + 307 + phy_power_off(priv->analog); 308 + 309 + return 0; 310 + } 311 + 312 + static int phy_meson_axg_mipi_dphy_exit(struct phy *phy) 313 + { 314 + struct phy_meson_axg_mipi_dphy_priv *priv = phy_get_drvdata(phy); 315 + int ret; 316 + 317 + ret = phy_exit(priv->analog); 318 + if (ret) 319 + return ret; 320 + 321 + return reset_control_reset(priv->reset); 322 + } 323 + 324 + static const struct phy_ops phy_meson_axg_mipi_dphy_ops = { 325 + .configure = phy_meson_axg_mipi_dphy_configure, 326 + .init = phy_meson_axg_mipi_dphy_init, 327 + .exit = phy_meson_axg_mipi_dphy_exit, 328 + .power_on = phy_meson_axg_mipi_dphy_power_on, 329 + .power_off = phy_meson_axg_mipi_dphy_power_off, 330 + .owner = THIS_MODULE, 331 + }; 332 + 333 + static int phy_meson_axg_mipi_dphy_probe(struct platform_device *pdev) 334 + { 335 + struct device *dev = &pdev->dev; 336 + struct phy_provider *phy_provider; 337 + struct resource *res; 338 + struct phy_meson_axg_mipi_dphy_priv *priv; 339 + struct phy *phy; 340 + void __iomem *base; 341 + int ret; 342 + 343 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 344 + if (!priv) 345 + return -ENOMEM; 346 + 347 + priv->dev = dev; 348 + platform_set_drvdata(pdev, priv); 349 + 350 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 351 + base = devm_ioremap_resource(dev, res); 352 + if (IS_ERR(base)) 353 + return PTR_ERR(base); 354 + 355 + priv->regmap = devm_regmap_init_mmio(dev, base, 356 + &phy_meson_axg_mipi_dphy_regmap_conf); 357 + if (IS_ERR(priv->regmap)) 358 + return PTR_ERR(priv->regmap); 359 + 360 + priv->clk = devm_clk_get(dev, "pclk"); 361 + if (IS_ERR(priv->clk)) 362 + return PTR_ERR(priv->clk); 363 + 364 + priv->reset = devm_reset_control_get(dev, "phy"); 365 + if (IS_ERR(priv->reset)) 366 + return PTR_ERR(priv->reset); 367 + 368 + priv->analog = devm_phy_get(dev, "analog"); 369 + if (IS_ERR(priv->analog)) 370 + return PTR_ERR(priv->analog); 371 + 372 + ret = clk_prepare_enable(priv->clk); 373 + if (ret) 374 + return ret; 375 + 376 + ret = reset_control_deassert(priv->reset); 377 + if (ret) 378 + return ret; 379 + 380 + phy = devm_phy_create(dev, NULL, &phy_meson_axg_mipi_dphy_ops); 381 + if (IS_ERR(phy)) { 382 + ret = PTR_ERR(phy); 383 + if (ret != -EPROBE_DEFER) 384 + dev_err(dev, "failed to create PHY\n"); 385 + 386 + return ret; 387 + } 388 + 389 + phy_set_drvdata(phy, priv); 390 + 391 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 392 + 393 + return PTR_ERR_OR_ZERO(phy_provider); 394 + } 395 + 396 + static const struct of_device_id phy_meson_axg_mipi_dphy_of_match[] = { 397 + { .compatible = "amlogic,axg-mipi-dphy", }, 398 + { }, 399 + }; 400 + MODULE_DEVICE_TABLE(of, phy_meson_axg_mipi_dphy_of_match); 401 + 402 + static struct platform_driver phy_meson_axg_mipi_dphy_driver = { 403 + .probe = phy_meson_axg_mipi_dphy_probe, 404 + .driver = { 405 + .name = "phy-meson-axg-mipi-dphy", 406 + .of_match_table = phy_meson_axg_mipi_dphy_of_match, 407 + }, 408 + }; 409 + module_platform_driver(phy_meson_axg_mipi_dphy_driver); 410 + 411 + MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>"); 412 + MODULE_DESCRIPTION("Meson AXG MIPI DPHY driver"); 413 + MODULE_LICENSE("GPL v2");
+138 -73
drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c
··· 4 4 * 5 5 * Copyright (C) 2019 Remi Pommarel <repk@triplefau.lt> 6 6 */ 7 + #include <linux/bitfield.h> 8 + #include <linux/bitops.h> 7 9 #include <linux/module.h> 8 10 #include <linux/phy/phy.h> 9 11 #include <linux/regmap.h> 12 + #include <linux/delay.h> 13 + #include <linux/mfd/syscon.h> 10 14 #include <linux/platform_device.h> 11 15 #include <dt-bindings/phy/phy.h> 12 16 ··· 18 14 #define HHI_MIPI_CNTL0_COMMON_BLOCK GENMASK(31, 28) 19 15 #define HHI_MIPI_CNTL0_ENABLE BIT(29) 20 16 #define HHI_MIPI_CNTL0_BANDGAP BIT(26) 21 - #define HHI_MIPI_CNTL0_DECODE_TO_RTERM GENMASK(15, 12) 22 - #define HHI_MIPI_CNTL0_OUTPUT_EN BIT(3) 17 + #define HHI_MIPI_CNTL0_DIF_REF_CTL1 GENMASK(25, 16) 18 + #define HHI_MIPI_CNTL0_DIF_REF_CTL0 GENMASK(15, 0) 23 19 24 - #define HHI_MIPI_CNTL1 0x01 20 + #define HHI_MIPI_CNTL1 0x04 25 21 #define HHI_MIPI_CNTL1_CH0_CML_PDR_EN BIT(12) 26 22 #define HHI_MIPI_CNTL1_LP_ABILITY GENMASK(5, 4) 27 23 #define HHI_MIPI_CNTL1_LP_RESISTER BIT(3) ··· 29 25 #define HHI_MIPI_CNTL1_INPUT_SEL BIT(1) 30 26 #define HHI_MIPI_CNTL1_PRBS7_EN BIT(0) 31 27 32 - #define HHI_MIPI_CNTL2 0x02 28 + #define HHI_MIPI_CNTL2 0x08 33 29 #define HHI_MIPI_CNTL2_CH_PU GENMASK(31, 25) 34 30 #define HHI_MIPI_CNTL2_CH_CTL GENMASK(24, 19) 35 31 #define HHI_MIPI_CNTL2_CH0_DIGDR_EN BIT(18) 36 32 #define HHI_MIPI_CNTL2_CH_DIGDR_EN BIT(17) 37 33 #define HHI_MIPI_CNTL2_LPULPS_EN BIT(16) 38 - #define HHI_MIPI_CNTL2_CH_EN(n) BIT(15 - (n)) 34 + #define HHI_MIPI_CNTL2_CH_EN GENMASK(15, 11) 39 35 #define HHI_MIPI_CNTL2_CH0_LP_CTL GENMASK(10, 1) 36 + 37 + #define DSI_LANE_0 BIT(4) 38 + #define DSI_LANE_1 BIT(3) 39 + #define DSI_LANE_CLK BIT(2) 40 + #define DSI_LANE_2 BIT(1) 41 + #define DSI_LANE_3 BIT(0) 40 42 41 43 struct phy_axg_mipi_pcie_analog_priv { 42 44 struct phy *phy; 43 - unsigned int mode; 44 45 struct regmap *regmap; 46 + bool dsi_configured; 47 + bool dsi_enabled; 48 + bool powered; 49 + struct phy_configure_opts_mipi_dphy config; 45 50 }; 46 51 47 - static const struct regmap_config phy_axg_mipi_pcie_analog_regmap_conf = { 48 - .reg_bits = 8, 49 - .val_bits = 32, 50 - .reg_stride = 4, 51 - .max_register = HHI_MIPI_CNTL2, 52 - }; 52 + static void phy_bandgap_enable(struct phy_axg_mipi_pcie_analog_priv *priv) 53 + { 54 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 55 + HHI_MIPI_CNTL0_BANDGAP, HHI_MIPI_CNTL0_BANDGAP); 56 + 57 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 58 + HHI_MIPI_CNTL0_ENABLE, HHI_MIPI_CNTL0_ENABLE); 59 + } 60 + 61 + static void phy_bandgap_disable(struct phy_axg_mipi_pcie_analog_priv *priv) 62 + { 63 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 64 + HHI_MIPI_CNTL0_BANDGAP, 0); 65 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 66 + HHI_MIPI_CNTL0_ENABLE, 0); 67 + } 68 + 69 + static void phy_dsi_analog_enable(struct phy_axg_mipi_pcie_analog_priv *priv) 70 + { 71 + u32 reg; 72 + 73 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 74 + HHI_MIPI_CNTL0_DIF_REF_CTL1, 75 + FIELD_PREP(HHI_MIPI_CNTL0_DIF_REF_CTL1, 0x1b8)); 76 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 77 + BIT(31), BIT(31)); 78 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 79 + HHI_MIPI_CNTL0_DIF_REF_CTL0, 80 + FIELD_PREP(HHI_MIPI_CNTL0_DIF_REF_CTL0, 0x8)); 81 + 82 + regmap_write(priv->regmap, HHI_MIPI_CNTL1, 0x001e); 83 + 84 + regmap_write(priv->regmap, HHI_MIPI_CNTL2, 85 + (0x26e0 << 16) | (0x459 << 0)); 86 + 87 + reg = DSI_LANE_CLK; 88 + switch (priv->config.lanes) { 89 + case 4: 90 + reg |= DSI_LANE_3; 91 + fallthrough; 92 + case 3: 93 + reg |= DSI_LANE_2; 94 + fallthrough; 95 + case 2: 96 + reg |= DSI_LANE_1; 97 + fallthrough; 98 + case 1: 99 + reg |= DSI_LANE_0; 100 + break; 101 + default: 102 + reg = 0; 103 + } 104 + 105 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL2, 106 + HHI_MIPI_CNTL2_CH_EN, 107 + FIELD_PREP(HHI_MIPI_CNTL2_CH_EN, reg)); 108 + 109 + priv->dsi_enabled = true; 110 + } 111 + 112 + static void phy_dsi_analog_disable(struct phy_axg_mipi_pcie_analog_priv *priv) 113 + { 114 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 115 + HHI_MIPI_CNTL0_DIF_REF_CTL1, 116 + FIELD_PREP(HHI_MIPI_CNTL0_DIF_REF_CTL1, 0)); 117 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, BIT(31), 0); 118 + regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 119 + HHI_MIPI_CNTL0_DIF_REF_CTL1, 0); 120 + 121 + regmap_write(priv->regmap, HHI_MIPI_CNTL1, 0x6); 122 + 123 + regmap_write(priv->regmap, HHI_MIPI_CNTL2, 0x00200000); 124 + 125 + priv->dsi_enabled = false; 126 + } 127 + 128 + static int phy_axg_mipi_pcie_analog_configure(struct phy *phy, 129 + union phy_configure_opts *opts) 130 + { 131 + struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); 132 + int ret; 133 + 134 + ret = phy_mipi_dphy_config_validate(&opts->mipi_dphy); 135 + if (ret) 136 + return ret; 137 + 138 + memcpy(&priv->config, opts, sizeof(priv->config)); 139 + 140 + priv->dsi_configured = true; 141 + 142 + /* If PHY was already powered on, setup the DSI analog part */ 143 + if (priv->powered) { 144 + /* If reconfiguring, disable & reconfigure */ 145 + if (priv->dsi_enabled) 146 + phy_dsi_analog_disable(priv); 147 + 148 + usleep_range(100, 200); 149 + 150 + phy_dsi_analog_enable(priv); 151 + } 152 + 153 + return 0; 154 + } 53 155 54 156 static int phy_axg_mipi_pcie_analog_power_on(struct phy *phy) 55 157 { 56 158 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); 57 159 58 - /* MIPI not supported yet */ 59 - if (priv->mode != PHY_TYPE_PCIE) 60 - return -EINVAL; 160 + phy_bandgap_enable(priv); 61 161 62 - regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 63 - HHI_MIPI_CNTL0_BANDGAP, HHI_MIPI_CNTL0_BANDGAP); 162 + if (priv->dsi_configured) 163 + phy_dsi_analog_enable(priv); 64 164 65 - regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 66 - HHI_MIPI_CNTL0_ENABLE, HHI_MIPI_CNTL0_ENABLE); 165 + priv->powered = true; 166 + 67 167 return 0; 68 168 } 69 169 ··· 175 67 { 176 68 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); 177 69 178 - /* MIPI not supported yet */ 179 - if (priv->mode != PHY_TYPE_PCIE) 180 - return -EINVAL; 70 + phy_bandgap_disable(priv); 181 71 182 - regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 183 - HHI_MIPI_CNTL0_BANDGAP, 0); 184 - regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, 185 - HHI_MIPI_CNTL0_ENABLE, 0); 186 - return 0; 187 - } 72 + if (priv->dsi_enabled) 73 + phy_dsi_analog_disable(priv); 188 74 189 - static int phy_axg_mipi_pcie_analog_init(struct phy *phy) 190 - { 191 - return 0; 192 - } 75 + priv->powered = false; 193 76 194 - static int phy_axg_mipi_pcie_analog_exit(struct phy *phy) 195 - { 196 77 return 0; 197 78 } 198 79 199 80 static const struct phy_ops phy_axg_mipi_pcie_analog_ops = { 200 - .init = phy_axg_mipi_pcie_analog_init, 201 - .exit = phy_axg_mipi_pcie_analog_exit, 81 + .configure = phy_axg_mipi_pcie_analog_configure, 202 82 .power_on = phy_axg_mipi_pcie_analog_power_on, 203 83 .power_off = phy_axg_mipi_pcie_analog_power_off, 204 84 .owner = THIS_MODULE, 205 85 }; 206 - 207 - static struct phy *phy_axg_mipi_pcie_analog_xlate(struct device *dev, 208 - struct of_phandle_args *args) 209 - { 210 - struct phy_axg_mipi_pcie_analog_priv *priv = dev_get_drvdata(dev); 211 - unsigned int mode; 212 - 213 - if (args->args_count != 1) { 214 - dev_err(dev, "invalid number of arguments\n"); 215 - return ERR_PTR(-EINVAL); 216 - } 217 - 218 - mode = args->args[0]; 219 - 220 - /* MIPI mode is not supported yet */ 221 - if (mode != PHY_TYPE_PCIE) { 222 - dev_err(dev, "invalid phy mode select argument\n"); 223 - return ERR_PTR(-EINVAL); 224 - } 225 - 226 - priv->mode = mode; 227 - return priv->phy; 228 - } 229 86 230 87 static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) 231 88 { ··· 199 126 struct phy_axg_mipi_pcie_analog_priv *priv; 200 127 struct device_node *np = dev->of_node; 201 128 struct regmap *map; 202 - struct resource *res; 203 - void __iomem *base; 204 129 int ret; 205 130 206 131 priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL); 207 132 if (!priv) 208 133 return -ENOMEM; 209 134 210 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 211 - base = devm_ioremap_resource(dev, res); 212 - if (IS_ERR(base)) { 213 - dev_err(dev, "failed to get regmap base\n"); 214 - return PTR_ERR(base); 215 - } 216 - 217 - map = devm_regmap_init_mmio(dev, base, 218 - &phy_axg_mipi_pcie_analog_regmap_conf); 135 + /* Get the hhi system controller node */ 136 + map = syscon_node_to_regmap(of_get_parent(dev->of_node)); 219 137 if (IS_ERR(map)) { 220 - dev_err(dev, "failed to get HHI regmap\n"); 138 + dev_err(dev, 139 + "failed to get HHI regmap\n"); 221 140 return PTR_ERR(map); 222 141 } 142 + 223 143 priv->regmap = map; 224 144 225 145 priv->phy = devm_phy_create(dev, np, &phy_axg_mipi_pcie_analog_ops); ··· 226 160 phy_set_drvdata(priv->phy, priv); 227 161 dev_set_drvdata(dev, priv); 228 162 229 - phy = devm_of_phy_provider_register(dev, 230 - phy_axg_mipi_pcie_analog_xlate); 163 + phy = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 231 164 232 165 return PTR_ERR_OR_ZERO(phy); 233 166 }
+2 -4
drivers/phy/amlogic/phy-meson-axg-pcie.c
··· 129 129 struct device *dev = &pdev->dev; 130 130 struct phy_axg_pcie_priv *priv; 131 131 struct device_node *np = dev->of_node; 132 - struct resource *res; 133 132 void __iomem *base; 134 133 int ret; 135 134 ··· 144 145 return ret; 145 146 } 146 147 147 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 148 - base = devm_ioremap_resource(dev, res); 148 + base = devm_platform_ioremap_resource(pdev, 0); 149 149 if (IS_ERR(base)) 150 150 return PTR_ERR(base); 151 151 ··· 153 155 if (IS_ERR(priv->regmap)) 154 156 return PTR_ERR(priv->regmap); 155 157 156 - priv->reset = devm_reset_control_array_get(dev, false, false); 158 + priv->reset = devm_reset_control_array_get_exclusive(dev); 157 159 if (IS_ERR(priv->reset)) 158 160 return PTR_ERR(priv->reset); 159 161
+1 -3
drivers/phy/amlogic/phy-meson-g12a-usb2.c
··· 292 292 { 293 293 struct device *dev = &pdev->dev; 294 294 struct phy_provider *phy_provider; 295 - struct resource *res; 296 295 struct phy_meson_g12a_usb2_priv *priv; 297 296 struct phy *phy; 298 297 void __iomem *base; ··· 304 305 priv->dev = dev; 305 306 platform_set_drvdata(pdev, priv); 306 307 307 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 308 - base = devm_ioremap_resource(dev, res); 308 + base = devm_platform_ioremap_resource(pdev, 0); 309 309 if (IS_ERR(base)) 310 310 return PTR_ERR(base); 311 311
+2 -4
drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c
··· 386 386 struct device *dev = &pdev->dev; 387 387 struct device_node *np = dev->of_node; 388 388 struct phy_g12a_usb3_pcie_priv *priv; 389 - struct resource *res; 390 389 struct phy_provider *phy_provider; 391 390 void __iomem *base; 392 391 int ret; ··· 394 395 if (!priv) 395 396 return -ENOMEM; 396 397 397 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 398 - base = devm_ioremap_resource(dev, res); 398 + base = devm_platform_ioremap_resource(pdev, 0); 399 399 if (IS_ERR(base)) 400 400 return PTR_ERR(base); 401 401 ··· 416 418 if (ret) 417 419 goto err_disable_clk_ref; 418 420 419 - priv->reset = devm_reset_control_array_get(dev, false, false); 421 + priv->reset = devm_reset_control_array_get_exclusive(dev); 420 422 if (IS_ERR(priv->reset)) 421 423 return PTR_ERR(priv->reset); 422 424
+3 -4
drivers/phy/amlogic/phy-meson-gxl-usb2.c
··· 158 158 U2P_R0_DM_PULLDOWN); 159 159 regmap_update_bits(priv->regmap, U2P_R0, U2P_R0_DP_PULLDOWN, 160 160 U2P_R0_DP_PULLDOWN); 161 - regmap_update_bits(priv->regmap, U2P_R0, U2P_R0_ID_PULLUP, 0); 161 + regmap_update_bits(priv->regmap, U2P_R0, U2P_R0_ID_PULLUP, 162 + U2P_R0_ID_PULLUP); 162 163 break; 163 164 164 165 case PHY_MODE_USB_DEVICE: ··· 231 230 { 232 231 struct device *dev = &pdev->dev; 233 232 struct phy_provider *phy_provider; 234 - struct resource *res; 235 233 struct phy_meson_gxl_usb2_priv *priv; 236 234 struct phy *phy; 237 235 void __iomem *base; ··· 242 242 243 243 platform_set_drvdata(pdev, priv); 244 244 245 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 246 - base = devm_ioremap_resource(dev, res); 245 + base = devm_platform_ioremap_resource(pdev, 0); 247 246 if (IS_ERR(base)) 248 247 return PTR_ERR(base); 249 248
+1 -3
drivers/phy/broadcom/phy-bcm-cygnus-pcie.c
··· 126 126 struct device_node *node = dev->of_node, *child; 127 127 struct cygnus_pcie_phy_core *core; 128 128 struct phy_provider *provider; 129 - struct resource *res; 130 129 unsigned cnt = 0; 131 130 int ret; 132 131 ··· 140 141 141 142 core->dev = dev; 142 143 143 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 144 - core->base = devm_ioremap_resource(dev, res); 144 + core->base = devm_platform_ioremap_resource(pdev, 0); 145 145 if (IS_ERR(core->base)) 146 146 return PTR_ERR(core->base); 147 147
+1 -3
drivers/phy/broadcom/phy-bcm-kona-usb2.c
··· 94 94 { 95 95 struct device *dev = &pdev->dev; 96 96 struct bcm_kona_usb *phy; 97 - struct resource *res; 98 97 struct phy *gphy; 99 98 struct phy_provider *phy_provider; 100 99 ··· 101 102 if (!phy) 102 103 return -ENOMEM; 103 104 104 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 105 - phy->regs = devm_ioremap_resource(&pdev->dev, res); 105 + phy->regs = devm_platform_ioremap_resource(pdev, 0); 106 106 if (IS_ERR(phy->regs)) 107 107 return PTR_ERR(phy->regs); 108 108
+1 -3
drivers/phy/broadcom/phy-bcm-ns-usb2.c
··· 83 83 { 84 84 struct device *dev = &pdev->dev; 85 85 struct bcm_ns_usb2 *usb2; 86 - struct resource *res; 87 86 struct phy_provider *phy_provider; 88 87 89 88 usb2 = devm_kzalloc(&pdev->dev, sizeof(*usb2), GFP_KERNEL); ··· 90 91 return -ENOMEM; 91 92 usb2->dev = dev; 92 93 93 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmu"); 94 - usb2->dmu = devm_ioremap_resource(dev, res); 94 + usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu"); 95 95 if (IS_ERR(usb2->dmu)) { 96 96 dev_err(dev, "Failed to map DMU regs\n"); 97 97 return PTR_ERR(usb2->dmu);
+5 -154
drivers/phy/broadcom/phy-bcm-ns-usb3.c
··· 22 22 #include <linux/phy/phy.h> 23 23 #include <linux/slab.h> 24 24 25 - #define BCM_NS_USB3_MII_MNG_TIMEOUT_US 1000 /* usecs */ 26 - 27 25 #define BCM_NS_USB3_PHY_BASE_ADDR_REG 0x1f 28 26 #define BCM_NS_USB3_PHY_PLL30_BLOCK 0x8000 29 27 #define BCM_NS_USB3_PHY_TX_PMD_BLOCK 0x8040 ··· 49 51 struct device *dev; 50 52 enum bcm_ns_family family; 51 53 void __iomem *dmp; 52 - void __iomem *ccb_mii; 53 54 struct mdio_device *mdiodev; 54 55 struct phy *phy; 55 - 56 - int (*phy_write)(struct bcm_ns_usb3 *usb3, u16 reg, u16 value); 57 56 }; 58 57 59 58 static const struct of_device_id bcm_ns_usb3_id_table[] = { ··· 64 69 }, 65 70 {}, 66 71 }; 67 - MODULE_DEVICE_TABLE(of, bcm_ns_usb3_id_table); 68 72 69 73 static int bcm_ns_usb3_mdio_phy_write(struct bcm_ns_usb3 *usb3, u16 reg, 70 - u16 value) 71 - { 72 - return usb3->phy_write(usb3, reg, value); 73 - } 74 + u16 value); 74 75 75 76 static int bcm_ns_usb3_phy_init_ns_bx(struct bcm_ns_usb3 *usb3) 76 77 { ··· 178 187 * MDIO driver code 179 188 **************************************************/ 180 189 181 - static int bcm_ns_usb3_mdiodev_phy_write(struct bcm_ns_usb3 *usb3, u16 reg, 182 - u16 value) 190 + static int bcm_ns_usb3_mdio_phy_write(struct bcm_ns_usb3 *usb3, u16 reg, 191 + u16 value) 183 192 { 184 193 struct mdio_device *mdiodev = usb3->mdiodev; 185 194 ··· 220 229 return PTR_ERR(usb3->dmp); 221 230 } 222 231 223 - usb3->phy_write = bcm_ns_usb3_mdiodev_phy_write; 224 - 225 232 usb3->phy = devm_phy_create(dev, NULL, &ops); 226 233 if (IS_ERR(usb3->phy)) { 227 234 dev_err(dev, "Failed to create PHY\n"); ··· 243 254 .probe = bcm_ns_usb3_mdio_probe, 244 255 }; 245 256 246 - /************************************************** 247 - * Platform driver code 248 - **************************************************/ 249 - 250 - static int bcm_ns_usb3_wait_reg(struct bcm_ns_usb3 *usb3, void __iomem *addr, 251 - u32 mask, u32 value, int usec) 252 - { 253 - u32 val; 254 - int ret; 255 - 256 - ret = readl_poll_timeout_atomic(addr, val, ((val & mask) == value), 257 - 10, usec); 258 - if (ret) 259 - dev_err(usb3->dev, "Timeout waiting for register %p\n", addr); 260 - 261 - return ret; 262 - } 263 - 264 - static inline int bcm_ns_usb3_mii_mng_wait_idle(struct bcm_ns_usb3 *usb3) 265 - { 266 - return bcm_ns_usb3_wait_reg(usb3, usb3->ccb_mii + BCMA_CCB_MII_MNG_CTL, 267 - 0x0100, 0x0000, 268 - BCM_NS_USB3_MII_MNG_TIMEOUT_US); 269 - } 270 - 271 - static int bcm_ns_usb3_platform_phy_write(struct bcm_ns_usb3 *usb3, u16 reg, 272 - u16 value) 273 - { 274 - u32 tmp = 0; 275 - int err; 276 - 277 - err = bcm_ns_usb3_mii_mng_wait_idle(usb3); 278 - if (err < 0) { 279 - dev_err(usb3->dev, "Couldn't write 0x%08x value\n", value); 280 - return err; 281 - } 282 - 283 - /* TODO: Use a proper MDIO bus layer */ 284 - tmp |= 0x58020000; /* Magic value for MDIO PHY write */ 285 - tmp |= reg << 18; 286 - tmp |= value; 287 - writel(tmp, usb3->ccb_mii + BCMA_CCB_MII_MNG_CMD_DATA); 288 - 289 - return bcm_ns_usb3_mii_mng_wait_idle(usb3); 290 - } 291 - 292 - static int bcm_ns_usb3_probe(struct platform_device *pdev) 293 - { 294 - struct device *dev = &pdev->dev; 295 - const struct of_device_id *of_id; 296 - struct bcm_ns_usb3 *usb3; 297 - struct resource *res; 298 - struct phy_provider *phy_provider; 299 - 300 - usb3 = devm_kzalloc(dev, sizeof(*usb3), GFP_KERNEL); 301 - if (!usb3) 302 - return -ENOMEM; 303 - 304 - usb3->dev = dev; 305 - 306 - of_id = of_match_device(bcm_ns_usb3_id_table, dev); 307 - if (!of_id) 308 - return -EINVAL; 309 - usb3->family = (enum bcm_ns_family)of_id->data; 310 - 311 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmp"); 312 - usb3->dmp = devm_ioremap_resource(dev, res); 313 - if (IS_ERR(usb3->dmp)) { 314 - dev_err(dev, "Failed to map DMP regs\n"); 315 - return PTR_ERR(usb3->dmp); 316 - } 317 - 318 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ccb-mii"); 319 - usb3->ccb_mii = devm_ioremap_resource(dev, res); 320 - if (IS_ERR(usb3->ccb_mii)) { 321 - dev_err(dev, "Failed to map ChipCommon B MII regs\n"); 322 - return PTR_ERR(usb3->ccb_mii); 323 - } 324 - 325 - /* Enable MDIO. Setting MDCDIV as 26 */ 326 - writel(0x0000009a, usb3->ccb_mii + BCMA_CCB_MII_MNG_CTL); 327 - 328 - /* Wait for MDIO? */ 329 - udelay(2); 330 - 331 - usb3->phy_write = bcm_ns_usb3_platform_phy_write; 332 - 333 - usb3->phy = devm_phy_create(dev, NULL, &ops); 334 - if (IS_ERR(usb3->phy)) { 335 - dev_err(dev, "Failed to create PHY\n"); 336 - return PTR_ERR(usb3->phy); 337 - } 338 - 339 - phy_set_drvdata(usb3->phy, usb3); 340 - platform_set_drvdata(pdev, usb3); 341 - 342 - phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 343 - if (!IS_ERR(phy_provider)) 344 - dev_info(dev, "Registered Broadcom Northstar USB 3.0 PHY driver\n"); 345 - 346 - return PTR_ERR_OR_ZERO(phy_provider); 347 - } 348 - 349 - static struct platform_driver bcm_ns_usb3_driver = { 350 - .probe = bcm_ns_usb3_probe, 351 - .driver = { 352 - .name = "bcm_ns_usb3", 353 - .of_match_table = bcm_ns_usb3_id_table, 354 - }, 355 - }; 356 - 357 - static int __init bcm_ns_usb3_module_init(void) 358 - { 359 - int err; 360 - 361 - /* 362 - * For backward compatibility we register as MDIO and platform driver. 363 - * After getting MDIO binding commonly used (e.g. switching all DT files 364 - * to use it) we should deprecate the old binding and eventually drop 365 - * support for it. 366 - */ 367 - 368 - err = mdio_driver_register(&bcm_ns_usb3_mdio_driver); 369 - if (err) 370 - return err; 371 - 372 - err = platform_driver_register(&bcm_ns_usb3_driver); 373 - if (err) 374 - mdio_driver_unregister(&bcm_ns_usb3_mdio_driver); 375 - 376 - return err; 377 - } 378 - module_init(bcm_ns_usb3_module_init); 379 - 380 - static void __exit bcm_ns_usb3_module_exit(void) 381 - { 382 - platform_driver_unregister(&bcm_ns_usb3_driver); 383 - mdio_driver_unregister(&bcm_ns_usb3_mdio_driver); 384 - } 385 - module_exit(bcm_ns_usb3_module_exit) 257 + mdio_module_driver(bcm_ns_usb3_mdio_driver); 386 258 387 259 MODULE_LICENSE("GPL v2"); 260 + MODULE_DEVICE_TABLE(of, bcm_ns_usb3_id_table);
+4 -9
drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
··· 293 293 struct device *dev = &pdev->dev; 294 294 struct ns2_phy_driver *driver; 295 295 struct ns2_phy_data *data; 296 - struct resource *res; 297 296 int ret; 298 297 u32 val; 299 298 ··· 306 307 if (!driver->data) 307 308 return -ENOMEM; 308 309 309 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "icfg"); 310 - driver->icfgdrd_regs = devm_ioremap_resource(dev, res); 310 + driver->icfgdrd_regs = devm_platform_ioremap_resource_byname(pdev, "icfg"); 311 311 if (IS_ERR(driver->icfgdrd_regs)) 312 312 return PTR_ERR(driver->icfgdrd_regs); 313 313 314 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rst-ctrl"); 315 - driver->idmdrd_rst_ctrl = devm_ioremap_resource(dev, res); 314 + driver->idmdrd_rst_ctrl = devm_platform_ioremap_resource_byname(pdev, "rst-ctrl"); 316 315 if (IS_ERR(driver->idmdrd_rst_ctrl)) 317 316 return PTR_ERR(driver->idmdrd_rst_ctrl); 318 317 319 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crmu-ctrl"); 320 - driver->crmu_usb2_ctrl = devm_ioremap_resource(dev, res); 318 + driver->crmu_usb2_ctrl = devm_platform_ioremap_resource_byname(pdev, "crmu-ctrl"); 321 319 if (IS_ERR(driver->crmu_usb2_ctrl)) 322 320 return PTR_ERR(driver->crmu_usb2_ctrl); 323 321 324 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usb2-strap"); 325 - driver->usb2h_strap_reg = devm_ioremap_resource(dev, res); 322 + driver->usb2h_strap_reg = devm_platform_ioremap_resource_byname(pdev, "usb2-strap"); 326 323 if (IS_ERR(driver->usb2h_strap_reg)) 327 324 return PTR_ERR(driver->usb2h_strap_reg); 328 325
+1 -4
drivers/phy/broadcom/phy-bcm-sr-pcie.c
··· 217 217 struct device *dev = &pdev->dev; 218 218 struct device_node *node = dev->of_node; 219 219 struct sr_pcie_phy_core *core; 220 - struct resource *res; 221 220 struct phy_provider *provider; 222 221 unsigned int phy_idx = 0; 223 222 ··· 225 226 return -ENOMEM; 226 227 227 228 core->dev = dev; 228 - 229 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 230 - core->base = devm_ioremap_resource(core->dev, res); 229 + core->base = devm_platform_ioremap_resource(pdev, 0); 231 230 if (IS_ERR(core->base)) 232 231 return PTR_ERR(core->base); 233 232
+1 -3
drivers/phy/broadcom/phy-bcm-sr-usb.c
··· 300 300 struct device *dev = &pdev->dev; 301 301 struct device_node *dn = dev->of_node; 302 302 const struct of_device_id *of_id; 303 - struct resource *res; 304 303 void __iomem *regs; 305 304 int ret; 306 305 enum bcm_usb_phy_version version; 307 306 struct phy_provider *phy_provider; 308 307 309 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 310 - regs = devm_ioremap_resource(dev, res); 308 + regs = devm_platform_ioremap_resource(pdev, 0); 311 309 if (IS_ERR(regs)) 312 310 return PTR_ERR(regs); 313 311
+34 -6
drivers/phy/broadcom/phy-brcm-sata.c
··· 65 65 bool ssc_en; 66 66 enum brcm_sata_phy_rxaeq_mode rxaeq_mode; 67 67 u32 rxaeq_val; 68 + u32 tx_amplitude_val; 68 69 }; 69 70 70 71 struct brcm_sata_phy { ··· 84 83 BLOCK0_SPARE = 0x8d, 85 84 BLOCK0_SPARE_OOB_CLK_SEL_MASK = 0x3, 86 85 BLOCK0_SPARE_OOB_CLK_SEL_REFBY2 = 0x1, 86 + 87 + BLOCK1_REG_BANK = 0x10, 88 + BLOCK1_TEST_TX = 0x83, 89 + BLOCK1_TEST_TX_AMP_SHIFT = 12, 87 90 88 91 PLL_REG_BANK_0 = 0x050, 89 92 PLL_REG_BANK_0_PLLCONTROL_0 = 0x81, ··· 383 378 value = 0; 384 379 brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_FREQ_MON_CONTROL1, 385 380 ~tmp, RXPMD_MON_CORRECT_EN | value); 381 + 382 + tmp = GENMASK(15, 12); 383 + switch (port->tx_amplitude_val) { 384 + case 400: 385 + value = BIT(12) | BIT(13); 386 + break; 387 + case 500: 388 + value = BIT(13); 389 + break; 390 + case 600: 391 + value = BIT(12); 392 + break; 393 + case 800: 394 + value = 0; 395 + break; 396 + default: 397 + value = tmp; 398 + break; 399 + } 400 + 401 + if (value != tmp) 402 + brcm_sata_phy_wr(port, BLOCK1_REG_BANK, BLOCK1_TEST_TX, ~tmp, 403 + value); 386 404 387 405 /* Turn on/off SSC */ 388 406 brcm_sata_phy_wr(port, TX_REG_BANK, TX_ACTRL5, ~TX_ACTRL5_SSC_EN, ··· 754 726 struct device_node *dn = dev->of_node, *child; 755 727 const struct of_device_id *of_id; 756 728 struct brcm_sata_phy *priv; 757 - struct resource *res; 758 729 struct phy_provider *provider; 759 730 int ret, count = 0; 760 731 ··· 766 739 dev_set_drvdata(dev, priv); 767 740 priv->dev = dev; 768 741 769 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy"); 770 - priv->phy_base = devm_ioremap_resource(dev, res); 742 + priv->phy_base = devm_platform_ioremap_resource_byname(pdev, "phy"); 771 743 if (IS_ERR(priv->phy_base)) 772 744 return PTR_ERR(priv->phy_base); 773 745 ··· 777 751 priv->version = BRCM_SATA_PHY_STB_28NM; 778 752 779 753 if (priv->version == BRCM_SATA_PHY_IPROC_NS2) { 780 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 781 - "phy-ctrl"); 782 - priv->ctrl_base = devm_ioremap_resource(dev, res); 754 + priv->ctrl_base = devm_platform_ioremap_resource_byname(pdev, "phy-ctrl"); 783 755 if (IS_ERR(priv->ctrl_base)) 784 756 return PTR_ERR(priv->ctrl_base); 785 757 } ··· 815 791 if (port->rxaeq_mode == RXAEQ_MODE_MANUAL) 816 792 of_property_read_u32(child, "brcm,rxaeq-value", 817 793 &port->rxaeq_val); 794 + 795 + of_property_read_u32(child, "brcm,tx-amplitude-millivolt", 796 + &port->tx_amplitude_val); 797 + 818 798 port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc"); 819 799 if (IS_ERR(port->phy)) { 820 800 dev_err(dev, "failed to create PHY\n");
+1 -3
drivers/phy/cadence/cdns-dphy.c
··· 314 314 { 315 315 struct phy_provider *phy_provider; 316 316 struct cdns_dphy *dphy; 317 - struct resource *res; 318 317 int ret; 319 318 320 319 dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); ··· 325 326 if (!dphy->ops) 326 327 return -EINVAL; 327 328 328 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 329 - dphy->regs = devm_ioremap_resource(&pdev->dev, res); 329 + dphy->regs = devm_platform_ioremap_resource(pdev, 0); 330 330 if (IS_ERR(dphy->regs)) 331 331 return PTR_ERR(dphy->regs); 332 332
+1 -3
drivers/phy/cadence/phy-cadence-salvo.c
··· 263 263 struct phy_provider *phy_provider; 264 264 struct device *dev = &pdev->dev; 265 265 struct cdns_salvo_phy *salvo_phy; 266 - struct resource *res; 267 266 const struct of_device_id *match; 268 267 struct cdns_salvo_data *data; 269 268 ··· 280 281 if (IS_ERR(salvo_phy->clk)) 281 282 return PTR_ERR(salvo_phy->clk); 282 283 283 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 284 - salvo_phy->base = devm_ioremap_resource(dev, res); 284 + salvo_phy->base = devm_platform_ioremap_resource(pdev, 0); 285 285 if (IS_ERR(salvo_phy->base)) 286 286 return PTR_ERR(salvo_phy->base); 287 287
+1 -3
drivers/phy/cadence/phy-cadence-sierra.c
··· 479 479 const struct of_device_id *match; 480 480 struct cdns_sierra_data *data; 481 481 unsigned int id_value; 482 - struct resource *res; 483 482 int i, ret, node = 0; 484 483 void __iomem *base; 485 484 struct clk *clk; ··· 501 502 sp->dev = dev; 502 503 sp->init_data = data; 503 504 504 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 505 - base = devm_ioremap_resource(dev, res); 505 + base = devm_platform_ioremap_resource(pdev, 0); 506 506 if (IS_ERR(base)) { 507 507 dev_err(dev, "missing \"reg\"\n"); 508 508 return PTR_ERR(base);
+1 -3
drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c
··· 434 434 struct device_node *np = dev->of_node; 435 435 struct phy_provider *phy_provider; 436 436 struct mixel_dphy_priv *priv; 437 - struct resource *res; 438 437 struct phy *phy; 439 438 void __iomem *base; 440 439 ··· 448 449 if (!priv->devdata) 449 450 return -EINVAL; 450 451 451 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 452 - base = devm_ioremap_resource(dev, res); 452 + base = devm_platform_ioremap_resource(pdev, 0); 453 453 if (IS_ERR(base)) 454 454 return PTR_ERR(base); 455 455
+2 -4
drivers/phy/freescale/phy-fsl-imx8mq-usb.c
··· 131 131 .owner = THIS_MODULE, 132 132 }; 133 133 134 - static struct phy_ops imx8mp_usb_phy_ops = { 134 + static const struct phy_ops imx8mp_usb_phy_ops = { 135 135 .init = imx8mp_usb_phy_init, 136 136 .power_on = imx8mq_phy_power_on, 137 137 .power_off = imx8mq_phy_power_off, ··· 152 152 struct phy_provider *phy_provider; 153 153 struct device *dev = &pdev->dev; 154 154 struct imx8mq_usb_phy *imx_phy; 155 - struct resource *res; 156 155 const struct phy_ops *phy_ops; 157 156 158 157 imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL); ··· 164 165 return PTR_ERR(imx_phy->clk); 165 166 } 166 167 167 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 168 - imx_phy->base = devm_ioremap_resource(dev, res); 168 + imx_phy->base = devm_platform_ioremap_resource(pdev, 0); 169 169 if (IS_ERR(imx_phy->base)) 170 170 return PTR_ERR(imx_phy->base); 171 171
+13
drivers/phy/ingenic/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # Phy drivers for Ingenic platforms 4 + # 5 + config PHY_INGENIC_USB 6 + tristate "Ingenic SoCs USB PHY Driver" 7 + depends on MIPS || COMPILE_TEST 8 + depends on USB_SUPPORT 9 + depends on HAS_IOMEM 10 + select GENERIC_PHY 11 + help 12 + This driver provides USB PHY support for the USB controller found 13 + on the JZ-series and X-series SoCs from Ingenic.
+2
drivers/phy/ingenic/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + obj-y += phy-ingenic-usb.o
+412
drivers/phy/ingenic/phy-ingenic-usb.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Ingenic SoCs USB PHY driver 4 + * Copyright (c) Paul Cercueil <paul@crapouillou.net> 5 + * Copyright (c) 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com> 6 + * Copyright (c) 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> 7 + */ 8 + 9 + #include <linux/bitfield.h> 10 + #include <linux/clk.h> 11 + #include <linux/delay.h> 12 + #include <linux/io.h> 13 + #include <linux/module.h> 14 + #include <linux/phy/phy.h> 15 + #include <linux/platform_device.h> 16 + #include <linux/regulator/consumer.h> 17 + 18 + /* OTGPHY register offsets */ 19 + #define REG_USBPCR_OFFSET 0x00 20 + #define REG_USBRDT_OFFSET 0x04 21 + #define REG_USBVBFIL_OFFSET 0x08 22 + #define REG_USBPCR1_OFFSET 0x0c 23 + 24 + /* bits within the USBPCR register */ 25 + #define USBPCR_USB_MODE BIT(31) 26 + #define USBPCR_AVLD_REG BIT(30) 27 + #define USBPCR_COMMONONN BIT(25) 28 + #define USBPCR_VBUSVLDEXT BIT(24) 29 + #define USBPCR_VBUSVLDEXTSEL BIT(23) 30 + #define USBPCR_POR BIT(22) 31 + #define USBPCR_SIDDQ BIT(21) 32 + #define USBPCR_OTG_DISABLE BIT(20) 33 + #define USBPCR_TXPREEMPHTUNE BIT(6) 34 + 35 + #define USBPCR_IDPULLUP_MASK GENMASK(29, 28) 36 + #define USBPCR_IDPULLUP_ALWAYS 0x2 37 + #define USBPCR_IDPULLUP_SUSPEND 0x1 38 + #define USBPCR_IDPULLUP_OTG 0x0 39 + 40 + #define USBPCR_COMPDISTUNE_MASK GENMASK(19, 17) 41 + #define USBPCR_COMPDISTUNE_DFT 0x4 42 + 43 + #define USBPCR_OTGTUNE_MASK GENMASK(16, 14) 44 + #define USBPCR_OTGTUNE_DFT 0x4 45 + 46 + #define USBPCR_SQRXTUNE_MASK GENMASK(13, 11) 47 + #define USBPCR_SQRXTUNE_DCR_20PCT 0x7 48 + #define USBPCR_SQRXTUNE_DFT 0x3 49 + 50 + #define USBPCR_TXFSLSTUNE_MASK GENMASK(10, 7) 51 + #define USBPCR_TXFSLSTUNE_DCR_50PPT 0xf 52 + #define USBPCR_TXFSLSTUNE_DCR_25PPT 0x7 53 + #define USBPCR_TXFSLSTUNE_DFT 0x3 54 + #define USBPCR_TXFSLSTUNE_INC_25PPT 0x1 55 + #define USBPCR_TXFSLSTUNE_INC_50PPT 0x0 56 + 57 + #define USBPCR_TXHSXVTUNE_MASK GENMASK(5, 4) 58 + #define USBPCR_TXHSXVTUNE_DFT 0x3 59 + #define USBPCR_TXHSXVTUNE_DCR_15MV 0x1 60 + 61 + #define USBPCR_TXRISETUNE_MASK GENMASK(5, 4) 62 + #define USBPCR_TXRISETUNE_DFT 0x3 63 + 64 + #define USBPCR_TXVREFTUNE_MASK GENMASK(3, 0) 65 + #define USBPCR_TXVREFTUNE_INC_75PPT 0xb 66 + #define USBPCR_TXVREFTUNE_INC_25PPT 0x7 67 + #define USBPCR_TXVREFTUNE_DFT 0x5 68 + 69 + /* bits within the USBRDTR register */ 70 + #define USBRDT_UTMI_RST BIT(27) 71 + #define USBRDT_HB_MASK BIT(26) 72 + #define USBRDT_VBFIL_LD_EN BIT(25) 73 + #define USBRDT_IDDIG_EN BIT(24) 74 + #define USBRDT_IDDIG_REG BIT(23) 75 + #define USBRDT_VBFIL_EN BIT(2) 76 + 77 + /* bits within the USBPCR1 register */ 78 + #define USBPCR1_BVLD_REG BIT(31) 79 + #define USBPCR1_DPPD BIT(29) 80 + #define USBPCR1_DMPD BIT(28) 81 + #define USBPCR1_USB_SEL BIT(28) 82 + #define USBPCR1_PORT_RST BIT(21) 83 + #define USBPCR1_WORD_IF_16BIT BIT(19) 84 + 85 + enum ingenic_usb_phy_version { 86 + ID_JZ4770, 87 + ID_JZ4775, 88 + ID_JZ4780, 89 + ID_X1000, 90 + ID_X1830, 91 + ID_X2000, 92 + }; 93 + 94 + struct ingenic_soc_info { 95 + enum ingenic_usb_phy_version version; 96 + 97 + void (*usb_phy_init)(struct phy *phy); 98 + }; 99 + 100 + struct ingenic_usb_phy { 101 + const struct ingenic_soc_info *soc_info; 102 + 103 + struct phy *phy; 104 + void __iomem *base; 105 + struct clk *clk; 106 + struct regulator *vcc_supply; 107 + }; 108 + 109 + static int ingenic_usb_phy_init(struct phy *phy) 110 + { 111 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 112 + int err; 113 + u32 reg; 114 + 115 + err = clk_prepare_enable(priv->clk); 116 + if (err) { 117 + dev_err(&phy->dev, "Unable to start clock: %d\n", err); 118 + return err; 119 + } 120 + 121 + priv->soc_info->usb_phy_init(phy); 122 + 123 + /* Wait for PHY to reset */ 124 + usleep_range(30, 300); 125 + reg = readl(priv->base + REG_USBPCR_OFFSET); 126 + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); 127 + usleep_range(300, 1000); 128 + 129 + return 0; 130 + } 131 + 132 + static int ingenic_usb_phy_exit(struct phy *phy) 133 + { 134 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 135 + 136 + clk_disable_unprepare(priv->clk); 137 + regulator_disable(priv->vcc_supply); 138 + 139 + return 0; 140 + } 141 + 142 + static int ingenic_usb_phy_power_on(struct phy *phy) 143 + { 144 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 145 + int err; 146 + 147 + err = regulator_enable(priv->vcc_supply); 148 + if (err) { 149 + dev_err(&phy->dev, "Unable to enable VCC: %d\n", err); 150 + return err; 151 + } 152 + 153 + return 0; 154 + } 155 + 156 + static int ingenic_usb_phy_power_off(struct phy *phy) 157 + { 158 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 159 + 160 + regulator_disable(priv->vcc_supply); 161 + 162 + return 0; 163 + } 164 + 165 + static int ingenic_usb_phy_set_mode(struct phy *phy, 166 + enum phy_mode mode, int submode) 167 + { 168 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 169 + u32 reg; 170 + 171 + switch (mode) { 172 + case PHY_MODE_USB_HOST: 173 + reg = readl(priv->base + REG_USBPCR_OFFSET); 174 + u32p_replace_bits(&reg, 1, USBPCR_USB_MODE); 175 + u32p_replace_bits(&reg, 0, USBPCR_VBUSVLDEXT); 176 + u32p_replace_bits(&reg, 0, USBPCR_VBUSVLDEXTSEL); 177 + u32p_replace_bits(&reg, 0, USBPCR_OTG_DISABLE); 178 + writel(reg, priv->base + REG_USBPCR_OFFSET); 179 + 180 + break; 181 + case PHY_MODE_USB_DEVICE: 182 + reg = readl(priv->base + REG_USBPCR_OFFSET); 183 + u32p_replace_bits(&reg, 0, USBPCR_USB_MODE); 184 + u32p_replace_bits(&reg, 1, USBPCR_VBUSVLDEXT); 185 + u32p_replace_bits(&reg, 1, USBPCR_VBUSVLDEXTSEL); 186 + u32p_replace_bits(&reg, 1, USBPCR_OTG_DISABLE); 187 + writel(reg, priv->base + REG_USBPCR_OFFSET); 188 + 189 + break; 190 + case PHY_MODE_USB_OTG: 191 + reg = readl(priv->base + REG_USBPCR_OFFSET); 192 + u32p_replace_bits(&reg, 1, USBPCR_USB_MODE); 193 + u32p_replace_bits(&reg, 1, USBPCR_VBUSVLDEXT); 194 + u32p_replace_bits(&reg, 1, USBPCR_VBUSVLDEXTSEL); 195 + u32p_replace_bits(&reg, 0, USBPCR_OTG_DISABLE); 196 + writel(reg, priv->base + REG_USBPCR_OFFSET); 197 + 198 + break; 199 + default: 200 + return -EINVAL; 201 + } 202 + 203 + return 0; 204 + } 205 + 206 + static const struct phy_ops ingenic_usb_phy_ops = { 207 + .init = ingenic_usb_phy_init, 208 + .exit = ingenic_usb_phy_exit, 209 + .power_on = ingenic_usb_phy_power_on, 210 + .power_off = ingenic_usb_phy_power_off, 211 + .set_mode = ingenic_usb_phy_set_mode, 212 + .owner = THIS_MODULE, 213 + }; 214 + 215 + static void jz4770_usb_phy_init(struct phy *phy) 216 + { 217 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 218 + u32 reg; 219 + 220 + reg = USBPCR_AVLD_REG | USBPCR_COMMONONN | USBPCR_POR | 221 + FIELD_PREP(USBPCR_IDPULLUP_MASK, USBPCR_IDPULLUP_ALWAYS) | 222 + FIELD_PREP(USBPCR_COMPDISTUNE_MASK, USBPCR_COMPDISTUNE_DFT) | 223 + FIELD_PREP(USBPCR_OTGTUNE_MASK, USBPCR_OTGTUNE_DFT) | 224 + FIELD_PREP(USBPCR_SQRXTUNE_MASK, USBPCR_SQRXTUNE_DFT) | 225 + FIELD_PREP(USBPCR_TXFSLSTUNE_MASK, USBPCR_TXFSLSTUNE_DFT) | 226 + FIELD_PREP(USBPCR_TXRISETUNE_MASK, USBPCR_TXRISETUNE_DFT) | 227 + FIELD_PREP(USBPCR_TXVREFTUNE_MASK, USBPCR_TXVREFTUNE_DFT); 228 + writel(reg, priv->base + REG_USBPCR_OFFSET); 229 + } 230 + 231 + static void jz4775_usb_phy_init(struct phy *phy) 232 + { 233 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 234 + u32 reg; 235 + 236 + reg = readl(priv->base + REG_USBPCR1_OFFSET) | USBPCR1_USB_SEL | 237 + USBPCR1_WORD_IF_16BIT; 238 + writel(reg, priv->base + REG_USBPCR1_OFFSET); 239 + 240 + reg = USBPCR_COMMONONN | USBPCR_POR | 241 + FIELD_PREP(USBPCR_TXVREFTUNE_MASK, USBPCR_TXVREFTUNE_INC_75PPT); 242 + writel(reg, priv->base + REG_USBPCR_OFFSET); 243 + } 244 + 245 + static void jz4780_usb_phy_init(struct phy *phy) 246 + { 247 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 248 + u32 reg; 249 + 250 + reg = readl(priv->base + REG_USBPCR1_OFFSET) | USBPCR1_USB_SEL | 251 + USBPCR1_WORD_IF_16BIT; 252 + writel(reg, priv->base + REG_USBPCR1_OFFSET); 253 + 254 + reg = USBPCR_TXPREEMPHTUNE | USBPCR_COMMONONN | USBPCR_POR; 255 + writel(reg, priv->base + REG_USBPCR_OFFSET); 256 + } 257 + 258 + static void x1000_usb_phy_init(struct phy *phy) 259 + { 260 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 261 + u32 reg; 262 + 263 + reg = readl(priv->base + REG_USBPCR1_OFFSET) | USBPCR1_WORD_IF_16BIT; 264 + writel(reg, priv->base + REG_USBPCR1_OFFSET); 265 + 266 + reg = USBPCR_TXPREEMPHTUNE | USBPCR_COMMONONN | USBPCR_POR | 267 + FIELD_PREP(USBPCR_SQRXTUNE_MASK, USBPCR_SQRXTUNE_DCR_20PCT) | 268 + FIELD_PREP(USBPCR_TXHSXVTUNE_MASK, USBPCR_TXHSXVTUNE_DCR_15MV) | 269 + FIELD_PREP(USBPCR_TXVREFTUNE_MASK, USBPCR_TXVREFTUNE_INC_25PPT); 270 + writel(reg, priv->base + REG_USBPCR_OFFSET); 271 + } 272 + 273 + static void x1830_usb_phy_init(struct phy *phy) 274 + { 275 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 276 + u32 reg; 277 + 278 + /* rdt */ 279 + writel(USBRDT_VBFIL_EN | USBRDT_UTMI_RST, priv->base + REG_USBRDT_OFFSET); 280 + 281 + reg = readl(priv->base + REG_USBPCR1_OFFSET) | USBPCR1_WORD_IF_16BIT | 282 + USBPCR1_DMPD | USBPCR1_DPPD; 283 + writel(reg, priv->base + REG_USBPCR1_OFFSET); 284 + 285 + reg = USBPCR_VBUSVLDEXT | USBPCR_TXPREEMPHTUNE | USBPCR_COMMONONN | USBPCR_POR | 286 + FIELD_PREP(USBPCR_IDPULLUP_MASK, USBPCR_IDPULLUP_OTG); 287 + writel(reg, priv->base + REG_USBPCR_OFFSET); 288 + } 289 + 290 + static void x2000_usb_phy_init(struct phy *phy) 291 + { 292 + struct ingenic_usb_phy *priv = phy_get_drvdata(phy); 293 + u32 reg; 294 + 295 + reg = readl(priv->base + REG_USBPCR1_OFFSET) | USBPCR1_DPPD | USBPCR1_DMPD; 296 + writel(reg & ~USBPCR1_PORT_RST, priv->base + REG_USBPCR1_OFFSET); 297 + 298 + reg = USBPCR_POR | FIELD_PREP(USBPCR_IDPULLUP_MASK, USBPCR_IDPULLUP_OTG); 299 + writel(reg, priv->base + REG_USBPCR_OFFSET); 300 + } 301 + 302 + static const struct ingenic_soc_info jz4770_soc_info = { 303 + .version = ID_JZ4770, 304 + 305 + .usb_phy_init = jz4770_usb_phy_init, 306 + }; 307 + 308 + static const struct ingenic_soc_info jz4775_soc_info = { 309 + .version = ID_JZ4775, 310 + 311 + .usb_phy_init = jz4775_usb_phy_init, 312 + }; 313 + 314 + static const struct ingenic_soc_info jz4780_soc_info = { 315 + .version = ID_JZ4780, 316 + 317 + .usb_phy_init = jz4780_usb_phy_init, 318 + }; 319 + 320 + static const struct ingenic_soc_info x1000_soc_info = { 321 + .version = ID_X1000, 322 + 323 + .usb_phy_init = x1000_usb_phy_init, 324 + }; 325 + 326 + static const struct ingenic_soc_info x1830_soc_info = { 327 + .version = ID_X1830, 328 + 329 + .usb_phy_init = x1830_usb_phy_init, 330 + }; 331 + 332 + static const struct ingenic_soc_info x2000_soc_info = { 333 + .version = ID_X2000, 334 + 335 + .usb_phy_init = x2000_usb_phy_init, 336 + }; 337 + 338 + static int ingenic_usb_phy_probe(struct platform_device *pdev) 339 + { 340 + struct ingenic_usb_phy *priv; 341 + struct phy_provider *provider; 342 + struct device *dev = &pdev->dev; 343 + int err; 344 + 345 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 346 + if (!priv) 347 + return -ENOMEM; 348 + 349 + priv->soc_info = device_get_match_data(dev); 350 + if (!priv->soc_info) { 351 + dev_err(dev, "Error: No device match found\n"); 352 + return -ENODEV; 353 + } 354 + 355 + priv->base = devm_platform_ioremap_resource(pdev, 0); 356 + if (IS_ERR(priv->base)) { 357 + dev_err(dev, "Failed to map registers\n"); 358 + return PTR_ERR(priv->base); 359 + } 360 + 361 + priv->clk = devm_clk_get(dev, NULL); 362 + if (IS_ERR(priv->clk)) { 363 + err = PTR_ERR(priv->clk); 364 + if (err != -EPROBE_DEFER) 365 + dev_err(dev, "Failed to get clock\n"); 366 + return err; 367 + } 368 + 369 + priv->vcc_supply = devm_regulator_get(dev, "vcc"); 370 + if (IS_ERR(priv->vcc_supply)) { 371 + err = PTR_ERR(priv->vcc_supply); 372 + if (err != -EPROBE_DEFER) 373 + dev_err(dev, "Failed to get regulator\n"); 374 + return err; 375 + } 376 + 377 + priv->phy = devm_phy_create(dev, NULL, &ingenic_usb_phy_ops); 378 + if (IS_ERR(priv)) 379 + return PTR_ERR(priv); 380 + 381 + phy_set_drvdata(priv->phy, priv); 382 + 383 + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 384 + 385 + return PTR_ERR_OR_ZERO(provider); 386 + } 387 + 388 + static const struct of_device_id ingenic_usb_phy_of_matches[] = { 389 + { .compatible = "ingenic,jz4770-phy", .data = &jz4770_soc_info }, 390 + { .compatible = "ingenic,jz4775-phy", .data = &jz4775_soc_info }, 391 + { .compatible = "ingenic,jz4780-phy", .data = &jz4780_soc_info }, 392 + { .compatible = "ingenic,x1000-phy", .data = &x1000_soc_info }, 393 + { .compatible = "ingenic,x1830-phy", .data = &x1830_soc_info }, 394 + { .compatible = "ingenic,x2000-phy", .data = &x2000_soc_info }, 395 + { /* sentinel */ } 396 + }; 397 + MODULE_DEVICE_TABLE(of, ingenic_usb_phy_of_matches); 398 + 399 + static struct platform_driver ingenic_usb_phy_driver = { 400 + .probe = ingenic_usb_phy_probe, 401 + .driver = { 402 + .name = "ingenic-usb-phy", 403 + .of_match_table = ingenic_usb_phy_of_matches, 404 + }, 405 + }; 406 + module_platform_driver(ingenic_usb_phy_driver); 407 + 408 + MODULE_AUTHOR("周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>"); 409 + MODULE_AUTHOR("漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com>"); 410 + MODULE_AUTHOR("Paul Cercueil <paul@crapouillou.net>"); 411 + MODULE_DESCRIPTION("Ingenic SoCs USB PHY driver"); 412 + MODULE_LICENSE("GPL");
+12
drivers/phy/intel/Kconfig
··· 14 14 To compile this driver as a module, choose M here: the module 15 15 will be called phy-keembay-emmc.ko. 16 16 17 + config PHY_INTEL_KEEMBAY_USB 18 + tristate "Intel Keem Bay USB PHY driver" 19 + depends on ARCH_KEEMBAY || COMPILE_TEST 20 + depends on HAS_IOMEM 21 + select GENERIC_PHY 22 + select REGMAP_MMIO 23 + help 24 + Choose this option if you have an Intel Keem Bay SoC. 25 + 26 + To compile this driver as a module, choose M here: the module 27 + will be called phy-keembay-usb.ko. 28 + 17 29 config PHY_INTEL_LGM_COMBO 18 30 bool "Intel Lightning Mountain ComboPHY driver" 19 31 depends on X86 || COMPILE_TEST
+1
drivers/phy/intel/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-$(CONFIG_PHY_INTEL_KEEMBAY_EMMC) += phy-intel-keembay-emmc.o 3 + obj-$(CONFIG_PHY_INTEL_KEEMBAY_USB) += phy-intel-keembay-usb.o 3 4 obj-$(CONFIG_PHY_INTEL_LGM_COMBO) += phy-intel-lgm-combo.o 4 5 obj-$(CONFIG_PHY_INTEL_LGM_EMMC) += phy-intel-lgm-emmc.o
+301
drivers/phy/intel/phy-intel-keembay-usb.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Intel Keem Bay USB PHY driver 4 + * Copyright (C) 2020 Intel Corporation 5 + */ 6 + 7 + #include <linux/bitfield.h> 8 + #include <linux/bits.h> 9 + #include <linux/clk.h> 10 + #include <linux/delay.h> 11 + #include <linux/mod_devicetable.h> 12 + #include <linux/module.h> 13 + #include <linux/phy/phy.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + /* USS (USB Subsystem) clock control registers */ 18 + #define USS_CPR_CLK_EN 0x00 19 + #define USS_CPR_CLK_SET 0x04 20 + #define USS_CPR_CLK_CLR 0x08 21 + #define USS_CPR_RST_EN 0x10 22 + #define USS_CPR_RST_SET 0x14 23 + #define USS_CPR_RST_CLR 0x18 24 + 25 + /* USS clock/reset bit fields */ 26 + #define USS_CPR_PHY_TST BIT(6) 27 + #define USS_CPR_LOW_JIT BIT(5) 28 + #define USS_CPR_CORE BIT(4) 29 + #define USS_CPR_SUSPEND BIT(3) 30 + #define USS_CPR_ALT_REF BIT(2) 31 + #define USS_CPR_REF BIT(1) 32 + #define USS_CPR_SYS BIT(0) 33 + #define USS_CPR_MASK GENMASK(6, 0) 34 + 35 + /* USS APB slave registers */ 36 + #define USS_USB_CTRL_CFG0 0x10 37 + #define VCC_RESET_N_MASK BIT(31) 38 + 39 + #define USS_USB_PHY_CFG0 0x30 40 + #define POR_MASK BIT(15) 41 + #define PHY_RESET_MASK BIT(14) 42 + #define PHY_REF_USE_PAD_MASK BIT(5) 43 + 44 + #define USS_USB_PHY_CFG6 0x64 45 + #define PHY0_SRAM_EXT_LD_DONE_MASK BIT(23) 46 + 47 + #define USS_USB_PARALLEL_IF_CTRL 0xa0 48 + #define USB_PHY_CR_PARA_SEL_MASK BIT(2) 49 + 50 + #define USS_USB_TSET_SIGNALS_AND_GLOB 0xac 51 + #define USB_PHY_CR_PARA_CLK_EN_MASK BIT(7) 52 + 53 + #define USS_USB_STATUS_REG 0xb8 54 + #define PHY0_SRAM_INIT_DONE_MASK BIT(3) 55 + 56 + #define USS_USB_TIEOFFS_CONSTANTS_REG1 0xc0 57 + #define IDDQ_ENABLE_MASK BIT(10) 58 + 59 + struct keembay_usb_phy { 60 + struct device *dev; 61 + struct regmap *regmap_cpr; 62 + struct regmap *regmap_slv; 63 + }; 64 + 65 + static const struct regmap_config keembay_regmap_config = { 66 + .reg_bits = 32, 67 + .val_bits = 32, 68 + .reg_stride = 4, 69 + .max_register = USS_USB_TIEOFFS_CONSTANTS_REG1, 70 + }; 71 + 72 + static int keembay_usb_clocks_on(struct keembay_usb_phy *priv) 73 + { 74 + int ret; 75 + 76 + ret = regmap_update_bits(priv->regmap_cpr, USS_CPR_CLK_SET, 77 + USS_CPR_MASK, USS_CPR_MASK); 78 + if (ret) { 79 + dev_err(priv->dev, "error clock set: %d\n", ret); 80 + return ret; 81 + } 82 + 83 + ret = regmap_update_bits(priv->regmap_cpr, USS_CPR_RST_SET, 84 + USS_CPR_MASK, USS_CPR_MASK); 85 + if (ret) { 86 + dev_err(priv->dev, "error reset set: %d\n", ret); 87 + return ret; 88 + } 89 + 90 + ret = regmap_update_bits(priv->regmap_slv, 91 + USS_USB_TIEOFFS_CONSTANTS_REG1, 92 + IDDQ_ENABLE_MASK, 93 + FIELD_PREP(IDDQ_ENABLE_MASK, 0)); 94 + if (ret) { 95 + dev_err(priv->dev, "error iddq disable: %d\n", ret); 96 + return ret; 97 + } 98 + 99 + /* Wait 30us to ensure all analog blocks are powered up. */ 100 + usleep_range(30, 60); 101 + 102 + ret = regmap_update_bits(priv->regmap_slv, USS_USB_PHY_CFG0, 103 + PHY_REF_USE_PAD_MASK, 104 + FIELD_PREP(PHY_REF_USE_PAD_MASK, 1)); 105 + if (ret) 106 + dev_err(priv->dev, "error ref clock select: %d\n", ret); 107 + 108 + return ret; 109 + } 110 + 111 + static int keembay_usb_core_off(struct keembay_usb_phy *priv) 112 + { 113 + int ret; 114 + 115 + ret = regmap_update_bits(priv->regmap_slv, USS_USB_CTRL_CFG0, 116 + VCC_RESET_N_MASK, 117 + FIELD_PREP(VCC_RESET_N_MASK, 0)); 118 + if (ret) 119 + dev_err(priv->dev, "error core reset: %d\n", ret); 120 + 121 + return ret; 122 + } 123 + 124 + static int keembay_usb_core_on(struct keembay_usb_phy *priv) 125 + { 126 + int ret; 127 + 128 + ret = regmap_update_bits(priv->regmap_slv, USS_USB_CTRL_CFG0, 129 + VCC_RESET_N_MASK, 130 + FIELD_PREP(VCC_RESET_N_MASK, 1)); 131 + if (ret) 132 + dev_err(priv->dev, "error core on: %d\n", ret); 133 + 134 + return ret; 135 + } 136 + 137 + static int keembay_usb_phys_on(struct keembay_usb_phy *priv) 138 + { 139 + int ret; 140 + 141 + ret = regmap_update_bits(priv->regmap_slv, USS_USB_PHY_CFG0, 142 + POR_MASK | PHY_RESET_MASK, 143 + FIELD_PREP(POR_MASK | PHY_RESET_MASK, 0)); 144 + if (ret) 145 + dev_err(priv->dev, "error phys on: %d\n", ret); 146 + 147 + return ret; 148 + } 149 + 150 + static int keembay_usb_phy_init(struct phy *phy) 151 + { 152 + struct keembay_usb_phy *priv = phy_get_drvdata(phy); 153 + u32 val; 154 + int ret; 155 + 156 + ret = keembay_usb_core_off(priv); 157 + if (ret) 158 + return ret; 159 + 160 + /* 161 + * According to Keem Bay datasheet, wait minimum 20us after clock 162 + * enable before bringing PHYs out of reset. 163 + */ 164 + usleep_range(20, 40); 165 + 166 + ret = keembay_usb_phys_on(priv); 167 + if (ret) 168 + return ret; 169 + 170 + ret = regmap_update_bits(priv->regmap_slv, 171 + USS_USB_TSET_SIGNALS_AND_GLOB, 172 + USB_PHY_CR_PARA_CLK_EN_MASK, 173 + FIELD_PREP(USB_PHY_CR_PARA_CLK_EN_MASK, 0)); 174 + if (ret) { 175 + dev_err(priv->dev, "error cr clock disable: %d\n", ret); 176 + return ret; 177 + } 178 + 179 + /* 180 + * According to Keem Bay datasheet, wait 2us after disabling the 181 + * clock into the USB 3.x parallel interface. 182 + */ 183 + udelay(2); 184 + 185 + ret = regmap_update_bits(priv->regmap_slv, 186 + USS_USB_PARALLEL_IF_CTRL, 187 + USB_PHY_CR_PARA_SEL_MASK, 188 + FIELD_PREP(USB_PHY_CR_PARA_SEL_MASK, 1)); 189 + if (ret) { 190 + dev_err(priv->dev, "error cr select: %d\n", ret); 191 + return ret; 192 + } 193 + 194 + ret = regmap_update_bits(priv->regmap_slv, 195 + USS_USB_TSET_SIGNALS_AND_GLOB, 196 + USB_PHY_CR_PARA_CLK_EN_MASK, 197 + FIELD_PREP(USB_PHY_CR_PARA_CLK_EN_MASK, 1)); 198 + if (ret) { 199 + dev_err(priv->dev, "error cr clock enable: %d\n", ret); 200 + return ret; 201 + } 202 + 203 + ret = regmap_read_poll_timeout(priv->regmap_slv, USS_USB_STATUS_REG, 204 + val, val & PHY0_SRAM_INIT_DONE_MASK, 205 + USEC_PER_MSEC, 10 * USEC_PER_MSEC); 206 + if (ret) { 207 + dev_err(priv->dev, "SRAM init not done: %d\n", ret); 208 + return ret; 209 + } 210 + 211 + ret = regmap_update_bits(priv->regmap_slv, USS_USB_PHY_CFG6, 212 + PHY0_SRAM_EXT_LD_DONE_MASK, 213 + FIELD_PREP(PHY0_SRAM_EXT_LD_DONE_MASK, 1)); 214 + if (ret) { 215 + dev_err(priv->dev, "error SRAM init done set: %d\n", ret); 216 + return ret; 217 + } 218 + 219 + /* 220 + * According to Keem Bay datasheet, wait 20us after setting the 221 + * SRAM load done bit, before releasing the controller reset. 222 + */ 223 + usleep_range(20, 40); 224 + 225 + return keembay_usb_core_on(priv); 226 + } 227 + 228 + static const struct phy_ops ops = { 229 + .init = keembay_usb_phy_init, 230 + .owner = THIS_MODULE, 231 + }; 232 + 233 + static int keembay_usb_phy_probe(struct platform_device *pdev) 234 + { 235 + struct device *dev = &pdev->dev; 236 + struct keembay_usb_phy *priv; 237 + struct phy *generic_phy; 238 + struct phy_provider *phy_provider; 239 + void __iomem *base; 240 + int ret; 241 + 242 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 243 + if (!priv) 244 + return -ENOMEM; 245 + 246 + base = devm_platform_ioremap_resource_byname(pdev, "cpr-apb-base"); 247 + if (IS_ERR(base)) 248 + return PTR_ERR(base); 249 + 250 + priv->regmap_cpr = devm_regmap_init_mmio(dev, base, 251 + &keembay_regmap_config); 252 + if (IS_ERR(priv->regmap_cpr)) 253 + return PTR_ERR(priv->regmap_cpr); 254 + 255 + base = devm_platform_ioremap_resource_byname(pdev, "slv-apb-base"); 256 + if (IS_ERR(base)) 257 + return PTR_ERR(base); 258 + 259 + priv->regmap_slv = devm_regmap_init_mmio(dev, base, 260 + &keembay_regmap_config); 261 + if (IS_ERR(priv->regmap_slv)) 262 + return PTR_ERR(priv->regmap_slv); 263 + 264 + generic_phy = devm_phy_create(dev, dev->of_node, &ops); 265 + if (IS_ERR(generic_phy)) 266 + return dev_err_probe(dev, PTR_ERR(generic_phy), 267 + "failed to create PHY\n"); 268 + 269 + phy_set_drvdata(generic_phy, priv); 270 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 271 + if (IS_ERR(phy_provider)) 272 + return dev_err_probe(dev, PTR_ERR(phy_provider), 273 + "failed to register phy provider\n"); 274 + 275 + /* Setup USB subsystem clocks */ 276 + ret = keembay_usb_clocks_on(priv); 277 + if (ret) 278 + return ret; 279 + 280 + /* and turn on the DWC3 core, prior to DWC3 driver init. */ 281 + return keembay_usb_core_on(priv); 282 + } 283 + 284 + static const struct of_device_id keembay_usb_phy_dt_ids[] = { 285 + { .compatible = "intel,keembay-usb-phy" }, 286 + {} 287 + }; 288 + MODULE_DEVICE_TABLE(of, keembay_usb_phy_dt_ids); 289 + 290 + static struct platform_driver keembay_usb_phy_driver = { 291 + .probe = keembay_usb_phy_probe, 292 + .driver = { 293 + .name = "keembay-usb-phy", 294 + .of_match_table = keembay_usb_phy_dt_ids, 295 + }, 296 + }; 297 + module_platform_driver(keembay_usb_phy_driver); 298 + 299 + MODULE_AUTHOR("Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>"); 300 + MODULE_DESCRIPTION("Intel Keem Bay USB PHY driver"); 301 + MODULE_LICENSE("GPL v2");
+1 -3
drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
··· 402 402 struct ltq_vrx200_pcie_phy_priv *priv; 403 403 struct device *dev = &pdev->dev; 404 404 struct phy_provider *provider; 405 - struct resource *res; 406 405 void __iomem *base; 407 406 int ret; 408 407 ··· 409 410 if (!priv) 410 411 return -ENOMEM; 411 412 412 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 413 - base = devm_ioremap_resource(dev, res); 413 + base = devm_platform_ioremap_resource(pdev, 0); 414 414 if (IS_ERR(base)) 415 415 return PTR_ERR(base); 416 416
+12
drivers/phy/marvell/Kconfig
··· 116 116 The PHY driver will be used by Marvell udc/ehci/otg driver. 117 117 118 118 To compile this driver as a module, choose M here. 119 + 120 + config PHY_MMP3_HSIC 121 + tristate "Marvell MMP3 USB HSIC PHY Driver" 122 + depends on MACH_MMP3_DT || COMPILE_TEST 123 + select GENERIC_PHY 124 + help 125 + Enable this to support Marvell MMP3 USB HSIC PHY driver for 126 + Marvell MMP3 SoC. This driver will be used my the Marvell EHCI 127 + driver to initialize the interface to internal USB HSIC 128 + components on MMP3-based boards. 129 + 130 + To compile this driver as a module, choose M here.
+1
drivers/phy/marvell/Makefile
··· 3 3 obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o 4 4 obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o 5 5 obj-$(CONFIG_PHY_MMP3_USB) += phy-mmp3-usb.o 6 + obj-$(CONFIG_PHY_MMP3_HSIC) += phy-mmp3-hsic.o 6 7 obj-$(CONFIG_PHY_MVEBU_A3700_COMPHY) += phy-mvebu-a3700-comphy.o 7 8 obj-$(CONFIG_PHY_MVEBU_A3700_UTMI) += phy-mvebu-a3700-utmi.o 8 9 obj-$(CONFIG_PHY_MVEBU_A38X_COMPHY) += phy-armada38x-comphy.o
+1 -3
drivers/phy/marvell/phy-armada375-usb2.c
··· 105 105 struct phy *phy; 106 106 struct phy_provider *phy_provider; 107 107 void __iomem *usb_cluster_base; 108 - struct resource *res; 109 108 struct armada375_cluster_phy *cluster_phy; 110 109 111 110 cluster_phy = devm_kzalloc(dev, sizeof(*cluster_phy), GFP_KERNEL); 112 111 if (!cluster_phy) 113 112 return -ENOMEM; 114 113 115 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 116 - usb_cluster_base = devm_ioremap_resource(&pdev->dev, res); 114 + usb_cluster_base = devm_platform_ioremap_resource(pdev, 0); 117 115 if (IS_ERR(usb_cluster_base)) 118 116 return PTR_ERR(usb_cluster_base); 119 117
+1 -3
drivers/phy/marvell/phy-berlin-usb.c
··· 165 165 const struct of_device_id *match = 166 166 of_match_device(phy_berlin_usb_of_match, &pdev->dev); 167 167 struct phy_berlin_usb_priv *priv; 168 - struct resource *res; 169 168 struct phy *phy; 170 169 struct phy_provider *phy_provider; 171 170 ··· 172 173 if (!priv) 173 174 return -ENOMEM; 174 175 175 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 176 - priv->base = devm_ioremap_resource(&pdev->dev, res); 176 + priv->base = devm_platform_ioremap_resource(pdev, 0); 177 177 if (IS_ERR(priv->base)) 178 178 return PTR_ERR(priv->base); 179 179
+82
drivers/phy/marvell/phy-mmp3-hsic.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Copyright (C) 2020 Lubomir Rintel <lkundrak@v3.sk> 4 + */ 5 + 6 + #include <linux/delay.h> 7 + #include <linux/io.h> 8 + #include <linux/module.h> 9 + #include <linux/phy/phy.h> 10 + #include <linux/platform_device.h> 11 + 12 + #define HSIC_CTRL 0x08 13 + #define HSIC_ENABLE BIT(7) 14 + #define PLL_BYPASS BIT(4) 15 + 16 + static int mmp3_hsic_phy_init(struct phy *phy) 17 + { 18 + void __iomem *base = (void __iomem *)phy_get_drvdata(phy); 19 + u32 hsic_ctrl; 20 + 21 + hsic_ctrl = readl_relaxed(base + HSIC_CTRL); 22 + hsic_ctrl |= HSIC_ENABLE; 23 + hsic_ctrl |= PLL_BYPASS; 24 + writel_relaxed(hsic_ctrl, base + HSIC_CTRL); 25 + 26 + return 0; 27 + } 28 + 29 + static const struct phy_ops mmp3_hsic_phy_ops = { 30 + .init = mmp3_hsic_phy_init, 31 + .owner = THIS_MODULE, 32 + }; 33 + 34 + static const struct of_device_id mmp3_hsic_phy_of_match[] = { 35 + { .compatible = "marvell,mmp3-hsic-phy", }, 36 + { }, 37 + }; 38 + MODULE_DEVICE_TABLE(of, mmp3_hsic_phy_of_match); 39 + 40 + static int mmp3_hsic_phy_probe(struct platform_device *pdev) 41 + { 42 + struct device *dev = &pdev->dev; 43 + struct phy_provider *provider; 44 + struct resource *resource; 45 + void __iomem *base; 46 + struct phy *phy; 47 + 48 + resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); 49 + base = devm_ioremap_resource(dev, resource); 50 + if (IS_ERR(base)) { 51 + dev_err(dev, "failed to remap PHY regs\n"); 52 + return PTR_ERR(base); 53 + } 54 + 55 + phy = devm_phy_create(dev, NULL, &mmp3_hsic_phy_ops); 56 + if (IS_ERR(phy)) { 57 + dev_err(dev, "failed to create PHY\n"); 58 + return PTR_ERR(phy); 59 + } 60 + 61 + phy_set_drvdata(phy, (void *)base); 62 + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 63 + if (IS_ERR(provider)) { 64 + dev_err(dev, "failed to register PHY provider\n"); 65 + return PTR_ERR(provider); 66 + } 67 + 68 + return 0; 69 + } 70 + 71 + static struct platform_driver mmp3_hsic_phy_driver = { 72 + .probe = mmp3_hsic_phy_probe, 73 + .driver = { 74 + .name = "mmp3-hsic-phy", 75 + .of_match_table = mmp3_hsic_phy_of_match, 76 + }, 77 + }; 78 + module_platform_driver(mmp3_hsic_phy_driver); 79 + 80 + MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); 81 + MODULE_DESCRIPTION("Marvell MMP3 USB HSIC PHY Driver"); 82 + MODULE_LICENSE("GPL");
+1 -3
drivers/phy/marvell/phy-mmp3-usb.c
··· 246 246 static int mmp3_usb_phy_probe(struct platform_device *pdev) 247 247 { 248 248 struct device *dev = &pdev->dev; 249 - struct resource *resource; 250 249 struct mmp3_usb_phy *mmp3_usb_phy; 251 250 struct phy_provider *provider; 252 251 ··· 253 254 if (!mmp3_usb_phy) 254 255 return -ENOMEM; 255 256 256 - resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); 257 - mmp3_usb_phy->base = devm_ioremap_resource(dev, resource); 257 + mmp3_usb_phy->base = devm_platform_ioremap_resource(pdev, 0); 258 258 if (IS_ERR(mmp3_usb_phy->base)) { 259 259 dev_err(dev, "failed to remap PHY regs\n"); 260 260 return PTR_ERR(mmp3_usb_phy->base);
+1 -3
drivers/phy/marvell/phy-mvebu-sata.c
··· 80 80 static int phy_mvebu_sata_probe(struct platform_device *pdev) 81 81 { 82 82 struct phy_provider *phy_provider; 83 - struct resource *res; 84 83 struct priv *priv; 85 84 struct phy *phy; 86 85 ··· 87 88 if (!priv) 88 89 return -ENOMEM; 89 90 90 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 91 - priv->base = devm_ioremap_resource(&pdev->dev, res); 91 + priv->base = devm_platform_ioremap_resource(pdev, 0); 92 92 if (IS_ERR(priv->base)) 93 93 return PTR_ERR(priv->base); 94 94
+1 -3
drivers/phy/marvell/phy-pxa-28nm-hsic.c
··· 162 162 { 163 163 struct phy_provider *phy_provider; 164 164 struct mv_hsic_phy *mv_phy; 165 - struct resource *r; 166 165 167 166 mv_phy = devm_kzalloc(&pdev->dev, sizeof(*mv_phy), GFP_KERNEL); 168 167 if (!mv_phy) ··· 175 176 return PTR_ERR(mv_phy->clk); 176 177 } 177 178 178 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 179 - mv_phy->base = devm_ioremap_resource(&pdev->dev, r); 179 + mv_phy->base = devm_platform_ioremap_resource(pdev, 0); 180 180 if (IS_ERR(mv_phy->base)) 181 181 return PTR_ERR(mv_phy->base); 182 182
+1 -3
drivers/phy/marvell/phy-pxa-28nm-usb2.c
··· 294 294 { 295 295 struct phy_provider *phy_provider; 296 296 struct mv_usb2_phy *mv_phy; 297 - struct resource *r; 298 297 299 298 mv_phy = devm_kzalloc(&pdev->dev, sizeof(*mv_phy), GFP_KERNEL); 300 299 if (!mv_phy) ··· 307 308 return PTR_ERR(mv_phy->clk); 308 309 } 309 310 310 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 311 - mv_phy->base = devm_ioremap_resource(&pdev->dev, r); 311 + mv_phy->base = devm_platform_ioremap_resource(pdev, 0); 312 312 if (IS_ERR(mv_phy->base)) 313 313 return PTR_ERR(mv_phy->base); 314 314
+1 -3
drivers/phy/marvell/phy-pxa-usb.c
··· 286 286 static int pxa_usb_phy_probe(struct platform_device *pdev) 287 287 { 288 288 struct device *dev = &pdev->dev; 289 - struct resource *resource; 290 289 struct pxa_usb_phy *pxa_usb_phy; 291 290 struct phy_provider *provider; 292 291 const struct of_device_id *of_id; ··· 300 301 else 301 302 pxa_usb_phy->version = PXA_USB_PHY_MMP2; 302 303 303 - resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); 304 - pxa_usb_phy->base = devm_ioremap_resource(dev, resource); 304 + pxa_usb_phy->base = devm_platform_ioremap_resource(pdev, 0); 305 305 if (IS_ERR(pxa_usb_phy->base)) { 306 306 dev_err(dev, "failed to remap PHY regs\n"); 307 307 return PTR_ERR(pxa_usb_phy->base);
+7 -3
drivers/phy/mediatek/Kconfig
··· 5 5 config PHY_MTK_TPHY 6 6 tristate "MediaTek T-PHY Driver" 7 7 depends on ARCH_MEDIATEK || COMPILE_TEST 8 - depends on OF 8 + depends on OF && OF_ADDRESS 9 + depends on HAS_IOMEM 9 10 select GENERIC_PHY 10 11 help 11 12 Say 'Y' here to add support for MediaTek T-PHY driver, ··· 30 29 config PHY_MTK_XSPHY 31 30 tristate "MediaTek XS-PHY Driver" 32 31 depends on ARCH_MEDIATEK || COMPILE_TEST 33 - depends on OF 32 + depends on OF && OF_ADDRESS 33 + depends on HAS_IOMEM 34 34 select GENERIC_PHY 35 35 help 36 36 Enable this to support the SuperSpeedPlus XS-PHY transceiver for ··· 40 38 41 39 config PHY_MTK_HDMI 42 40 tristate "MediaTek HDMI-PHY Driver" 43 - depends on ARCH_MEDIATEK && OF 41 + depends on ARCH_MEDIATEK || COMPILE_TEST 42 + depends on COMMON_CLK 43 + depends on OF 44 44 select GENERIC_PHY 45 45 help 46 46 Support HDMI PHY for Mediatek SoCs.
+4 -3
drivers/phy/mediatek/phy-mtk-hdmi.c
··· 84 84 hdmi_phy->conf->hdmi_phy_disable_tmds) 85 85 return &mtk_hdmi_phy_dev_ops; 86 86 87 - dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); 88 - return NULL; 87 + if (hdmi_phy) 88 + dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); 89 + return NULL; 89 90 } 90 91 91 92 static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy, ··· 202 201 {}, 203 202 }; 204 203 205 - struct platform_driver mtk_hdmi_phy_driver = { 204 + static struct platform_driver mtk_hdmi_phy_driver = { 206 205 .probe = mtk_hdmi_phy_probe, 207 206 .driver = { 208 207 .name = "mediatek-hdmi-phy",
+1 -3
drivers/phy/mediatek/phy-mtk-ufs.c
··· 195 195 struct device *dev = &pdev->dev; 196 196 struct phy *generic_phy; 197 197 struct phy_provider *phy_provider; 198 - struct resource *res; 199 198 struct ufs_mtk_phy *phy; 200 199 int ret; 201 200 ··· 202 203 if (!phy) 203 204 return -ENOMEM; 204 205 205 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 206 - phy->mmio = devm_ioremap_resource(dev, res); 206 + phy->mmio = devm_platform_ioremap_resource(pdev, 0); 207 207 if (IS_ERR(phy->mmio)) 208 208 return PTR_ERR(phy->mmio); 209 209
+1 -3
drivers/phy/phy-xgene.c
··· 1644 1644 { 1645 1645 struct phy_provider *phy_provider; 1646 1646 struct xgene_phy_ctx *ctx; 1647 - struct resource *res; 1648 1647 u32 default_spd[] = DEFAULT_SATA_SPD_SEL; 1649 1648 u32 default_txboost_gain[] = DEFAULT_SATA_TXBOOST_GAIN; 1650 1649 u32 default_txeye_direction[] = DEFAULT_SATA_TXEYEDIRECTION; ··· 1660 1661 1661 1662 ctx->dev = &pdev->dev; 1662 1663 1663 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1664 - ctx->sds_base = devm_ioremap_resource(&pdev->dev, res); 1664 + ctx->sds_base = devm_platform_ioremap_resource(pdev, 0); 1665 1665 if (IS_ERR(ctx->sds_base)) 1666 1666 return PTR_ERR(ctx->sds_base); 1667 1667
+1 -3
drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
··· 201 201 { 202 202 struct qcom_apq8064_sata_phy *phy; 203 203 struct device *dev = &pdev->dev; 204 - struct resource *res; 205 204 struct phy_provider *phy_provider; 206 205 struct phy *generic_phy; 207 206 int ret; ··· 209 210 if (!phy) 210 211 return -ENOMEM; 211 212 212 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 213 - phy->mmio = devm_ioremap_resource(dev, res); 213 + phy->mmio = devm_platform_ioremap_resource(pdev, 0); 214 214 if (IS_ERR(phy->mmio)) 215 215 return PTR_ERR(phy->mmio); 216 216
+1 -3
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
··· 95 95 static int ipq4019_usb_phy_probe(struct platform_device *pdev) 96 96 { 97 97 struct device *dev = &pdev->dev; 98 - struct resource *res; 99 98 struct phy_provider *phy_provider; 100 99 struct ipq4019_usb_phy *phy; 101 100 ··· 103 104 return -ENOMEM; 104 105 105 106 phy->dev = &pdev->dev; 106 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 107 - phy->base = devm_ioremap_resource(&pdev->dev, res); 107 + phy->base = devm_platform_ioremap_resource(pdev, 0); 108 108 if (IS_ERR(phy->base)) { 109 109 dev_err(dev, "failed to remap register memory\n"); 110 110 return PTR_ERR(phy->base);
+1 -3
drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c
··· 128 128 { 129 129 struct qcom_ipq806x_sata_phy *phy; 130 130 struct device *dev = &pdev->dev; 131 - struct resource *res; 132 131 struct phy_provider *phy_provider; 133 132 struct phy *generic_phy; 134 133 int ret; ··· 136 137 if (!phy) 137 138 return -ENOMEM; 138 139 139 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 140 - phy->mmio = devm_ioremap_resource(dev, res); 140 + phy->mmio = devm_platform_ioremap_resource(pdev, 0); 141 141 if (IS_ERR(phy->mmio)) 142 142 return PTR_ERR(phy->mmio); 143 143
+1 -4
drivers/phy/qualcomm/phy-qcom-pcie2.c
··· 250 250 { 251 251 struct phy_provider *phy_provider; 252 252 struct qcom_phy *qphy; 253 - struct resource *res; 254 253 struct device *dev = &pdev->dev; 255 254 struct phy *phy; 256 255 int ret; ··· 259 260 return -ENOMEM; 260 261 261 262 qphy->dev = dev; 262 - 263 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 264 - qphy->base = devm_ioremap_resource(dev, res); 263 + qphy->base = devm_platform_ioremap_resource(pdev, 0); 265 264 if (IS_ERR(qphy->base)) 266 265 return PTR_ERR(qphy->base); 267 266
+277 -4
drivers/phy/qualcomm/phy-qcom-qmp.c
··· 217 217 [QPHY_PCS_READY_STATUS] = 0x160, 218 218 }; 219 219 220 + static const unsigned int sm8250_pcie_regs_layout[QPHY_LAYOUT_SIZE] = { 221 + [QPHY_SW_RESET] = 0x00, 222 + [QPHY_START_CTRL] = 0x44, 223 + [QPHY_PCS_STATUS] = 0x14, 224 + [QPHY_PCS_POWER_DOWN_CONTROL] = 0x40, 225 + }; 226 + 220 227 static const unsigned int sm8150_ufsphy_regs_layout[QPHY_LAYOUT_SIZE] = { 221 228 [QPHY_START_CTRL] = QPHY_V4_PCS_UFS_PHY_START, 222 229 [QPHY_PCS_READY_STATUS] = QPHY_V4_PCS_UFS_READY_STATUS, ··· 1831 1824 QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 1832 1825 }; 1833 1826 1827 + static const struct qmp_phy_init_tbl sm8250_qmp_pcie_serdes_tbl[] = { 1828 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x08), 1829 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_SELECT, 0x34), 1830 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08), 1831 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f), 1832 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x42), 1833 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24), 1834 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x03), 1835 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0xb4), 1836 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 1837 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 1838 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82), 1839 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x03), 1840 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0x55), 1841 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0x55), 1842 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x1a), 1843 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x0a), 1844 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x68), 1845 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02), 1846 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xaa), 1847 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab), 1848 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x34), 1849 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x14), 1850 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01), 1851 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06), 1852 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16), 1853 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36), 1854 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06), 1855 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16), 1856 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36), 1857 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 1858 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 1859 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18), 1860 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2), 1861 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01), 1862 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31), 1863 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01), 1864 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde), 1865 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07), 1866 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0x4c), 1867 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x06), 1868 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_ENABLE1, 0x90), 1869 + }; 1870 + 1871 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_serdes_tbl[] = { 1872 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x07), 1873 + }; 1874 + 1875 + static const struct qmp_phy_init_tbl sm8250_qmp_pcie_tx_tbl[] = { 1876 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 1877 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x35), 1878 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x11), 1879 + }; 1880 + 1881 + static const struct qmp_phy_init_tbl sm8250_qmp_pcie_rx_tbl[] = { 1882 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c), 1883 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x03), 1884 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1b), 1885 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 1886 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 1887 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0x30), 1888 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x04), 1889 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x07), 1890 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 1891 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70), 1892 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0e), 1893 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 1894 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0f), 1895 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03), 1896 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c), 1897 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x1e), 1898 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17), 1899 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xd4), 1900 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x54), 1901 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xdb), 1902 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x3b), 1903 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0x31), 1904 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x24), 1905 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff), 1906 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 1907 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 1908 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xe4), 1909 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xec), 1910 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x3b), 1911 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x36), 1912 + }; 1913 + 1914 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_rx_tbl[] = { 1915 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RCLK_AUXDATA_SEL, 0x00), 1916 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x00), 1917 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 1918 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x3f), 1919 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x14), 1920 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x30), 1921 + }; 1922 + 1923 + static const struct qmp_phy_init_tbl sm8250_qmp_pcie_pcs_tbl[] = { 1924 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 1925 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0x77), 1926 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RATE_SLEW_CNTRL1, 0x0b), 1927 + }; 1928 + 1929 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_pcs_tbl[] = { 1930 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d), 1931 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x12), 1932 + }; 1933 + 1934 + static const struct qmp_phy_init_tbl sm8250_qmp_pcie_pcs_misc_tbl[] = { 1935 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 1936 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 1937 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 1938 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P6_P7_PRE, 0x33), 1939 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00), 1940 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58), 1941 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 1942 + }; 1943 + 1944 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_pcs_misc_tbl[] = { 1945 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00), 1946 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG2, 0x0f), 1947 + }; 1948 + 1949 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_tx_tbl[] = { 1950 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_PI_QEC_CTRL, 0x20), 1951 + }; 1952 + 1953 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_rx_tbl[] = { 1954 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x04), 1955 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xbf), 1956 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x15), 1957 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 1958 + }; 1959 + 1960 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_pcs_tbl[] = { 1961 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x05), 1962 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG2, 0x0f), 1963 + }; 1964 + 1965 + static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_pcs_misc_tbl[] = { 1966 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG2, 0x0d), 1967 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07), 1968 + }; 1969 + 1834 1970 /* struct qmp_phy_cfg - per-PHY initialization config */ 1835 1971 struct qmp_phy_cfg { 1836 1972 /* phy-type - PCIE/UFS/USB */ ··· 1984 1834 /* Init sequence for PHY blocks - serdes, tx, rx, pcs */ 1985 1835 const struct qmp_phy_init_tbl *serdes_tbl; 1986 1836 int serdes_tbl_num; 1837 + const struct qmp_phy_init_tbl *serdes_tbl_sec; 1838 + int serdes_tbl_num_sec; 1987 1839 const struct qmp_phy_init_tbl *tx_tbl; 1988 1840 int tx_tbl_num; 1841 + const struct qmp_phy_init_tbl *tx_tbl_sec; 1842 + int tx_tbl_num_sec; 1989 1843 const struct qmp_phy_init_tbl *rx_tbl; 1990 1844 int rx_tbl_num; 1845 + const struct qmp_phy_init_tbl *rx_tbl_sec; 1846 + int rx_tbl_num_sec; 1991 1847 const struct qmp_phy_init_tbl *pcs_tbl; 1992 1848 int pcs_tbl_num; 1849 + const struct qmp_phy_init_tbl *pcs_tbl_sec; 1850 + int pcs_tbl_num_sec; 1993 1851 const struct qmp_phy_init_tbl *pcs_misc_tbl; 1994 1852 int pcs_misc_tbl_num; 1853 + const struct qmp_phy_init_tbl *pcs_misc_tbl_sec; 1854 + int pcs_misc_tbl_num_sec; 1995 1855 1996 1856 /* Init sequence for DP PHY block link rates */ 1997 1857 const struct qmp_phy_init_tbl *serdes_tbl_rbr; ··· 2405 2245 .pwrdn_delay_max = 1005, /* us */ 2406 2246 }; 2407 2247 2248 + static const struct qmp_phy_cfg sm8250_qmp_gen3x1_pciephy_cfg = { 2249 + .type = PHY_TYPE_PCIE, 2250 + .nlanes = 1, 2251 + 2252 + .serdes_tbl = sm8250_qmp_pcie_serdes_tbl, 2253 + .serdes_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl), 2254 + .serdes_tbl_sec = sm8250_qmp_gen3x1_pcie_serdes_tbl, 2255 + .serdes_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_serdes_tbl), 2256 + .tx_tbl = sm8250_qmp_pcie_tx_tbl, 2257 + .tx_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_tx_tbl), 2258 + .rx_tbl = sm8250_qmp_pcie_rx_tbl, 2259 + .rx_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_rx_tbl), 2260 + .rx_tbl_sec = sm8250_qmp_gen3x1_pcie_rx_tbl, 2261 + .rx_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_rx_tbl), 2262 + .pcs_tbl = sm8250_qmp_pcie_pcs_tbl, 2263 + .pcs_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_tbl), 2264 + .pcs_tbl_sec = sm8250_qmp_gen3x1_pcie_pcs_tbl, 2265 + .pcs_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_pcs_tbl), 2266 + .pcs_misc_tbl = sm8250_qmp_pcie_pcs_misc_tbl, 2267 + .pcs_misc_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_misc_tbl), 2268 + .pcs_misc_tbl_sec = sm8250_qmp_gen3x1_pcie_pcs_misc_tbl, 2269 + .pcs_misc_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_pcs_misc_tbl), 2270 + .clk_list = sdm845_pciephy_clk_l, 2271 + .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 2272 + .reset_list = sdm845_pciephy_reset_l, 2273 + .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 2274 + .vreg_list = qmp_phy_vreg_l, 2275 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 2276 + .regs = sm8250_pcie_regs_layout, 2277 + 2278 + .start_ctrl = PCS_START | SERDES_START, 2279 + .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 2280 + 2281 + .has_pwrdn_delay = true, 2282 + .pwrdn_delay_min = 995, /* us */ 2283 + .pwrdn_delay_max = 1005, /* us */ 2284 + }; 2285 + 2286 + static const struct qmp_phy_cfg sm8250_qmp_gen3x2_pciephy_cfg = { 2287 + .type = PHY_TYPE_PCIE, 2288 + .nlanes = 2, 2289 + 2290 + .serdes_tbl = sm8250_qmp_pcie_serdes_tbl, 2291 + .serdes_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl), 2292 + .tx_tbl = sm8250_qmp_pcie_tx_tbl, 2293 + .tx_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_tx_tbl), 2294 + .tx_tbl_sec = sm8250_qmp_gen3x2_pcie_tx_tbl, 2295 + .tx_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_tx_tbl), 2296 + .rx_tbl = sm8250_qmp_pcie_rx_tbl, 2297 + .rx_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_rx_tbl), 2298 + .rx_tbl_sec = sm8250_qmp_gen3x2_pcie_rx_tbl, 2299 + .rx_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_rx_tbl), 2300 + .pcs_tbl = sm8250_qmp_pcie_pcs_tbl, 2301 + .pcs_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_tbl), 2302 + .pcs_tbl_sec = sm8250_qmp_gen3x2_pcie_pcs_tbl, 2303 + .pcs_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_pcs_tbl), 2304 + .pcs_misc_tbl = sm8250_qmp_pcie_pcs_misc_tbl, 2305 + .pcs_misc_tbl_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_misc_tbl), 2306 + .pcs_misc_tbl_sec = sm8250_qmp_gen3x2_pcie_pcs_misc_tbl, 2307 + .pcs_misc_tbl_num_sec = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_pcs_misc_tbl), 2308 + .clk_list = sdm845_pciephy_clk_l, 2309 + .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 2310 + .reset_list = sdm845_pciephy_reset_l, 2311 + .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 2312 + .vreg_list = qmp_phy_vreg_l, 2313 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 2314 + .regs = sm8250_pcie_regs_layout, 2315 + 2316 + .start_ctrl = PCS_START | SERDES_START, 2317 + .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 2318 + 2319 + .is_dual_lane_phy = true, 2320 + .has_pwrdn_delay = true, 2321 + .pwrdn_delay_min = 995, /* us */ 2322 + .pwrdn_delay_max = 1005, /* us */ 2323 + }; 2324 + 2408 2325 static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg = { 2409 2326 .type = PHY_TYPE_USB3, 2410 2327 .nlanes = 1, ··· 2866 2629 int ret; 2867 2630 2868 2631 qcom_qmp_phy_configure(serdes, cfg->regs, serdes_tbl, serdes_tbl_num); 2632 + if (cfg->serdes_tbl_sec) 2633 + qcom_qmp_phy_configure(serdes, cfg->regs, cfg->serdes_tbl_sec, 2634 + cfg->serdes_tbl_num_sec); 2869 2635 2870 2636 if (cfg->type == PHY_TYPE_DP) { 2871 2637 switch (dp_opts->link_rate) { ··· 3357 3117 /* Tx, Rx, and PCS configurations */ 3358 3118 qcom_qmp_phy_configure_lane(tx, cfg->regs, 3359 3119 cfg->tx_tbl, cfg->tx_tbl_num, 1); 3120 + if (cfg->tx_tbl_sec) 3121 + qcom_qmp_phy_configure_lane(tx, cfg->regs, cfg->tx_tbl_sec, 3122 + cfg->tx_tbl_num_sec, 1); 3123 + 3360 3124 /* Configuration for other LANE for USB-DP combo PHY */ 3361 - if (cfg->is_dual_lane_phy) 3125 + if (cfg->is_dual_lane_phy) { 3362 3126 qcom_qmp_phy_configure_lane(qphy->tx2, cfg->regs, 3363 3127 cfg->tx_tbl, cfg->tx_tbl_num, 2); 3128 + if (cfg->tx_tbl_sec) 3129 + qcom_qmp_phy_configure_lane(qphy->tx2, cfg->regs, 3130 + cfg->tx_tbl_sec, 3131 + cfg->tx_tbl_num_sec, 2); 3132 + } 3364 3133 3365 3134 /* Configure special DP tx tunings */ 3366 3135 if (cfg->type == PHY_TYPE_DP) ··· 3377 3128 3378 3129 qcom_qmp_phy_configure_lane(rx, cfg->regs, 3379 3130 cfg->rx_tbl, cfg->rx_tbl_num, 1); 3131 + if (cfg->rx_tbl_sec) 3132 + qcom_qmp_phy_configure_lane(rx, cfg->regs, 3133 + cfg->rx_tbl_sec, cfg->rx_tbl_num_sec, 1); 3380 3134 3381 - if (cfg->is_dual_lane_phy) 3135 + if (cfg->is_dual_lane_phy) { 3382 3136 qcom_qmp_phy_configure_lane(qphy->rx2, cfg->regs, 3383 3137 cfg->rx_tbl, cfg->rx_tbl_num, 2); 3138 + if (cfg->rx_tbl_sec) 3139 + qcom_qmp_phy_configure_lane(qphy->rx2, cfg->regs, 3140 + cfg->rx_tbl_sec, 3141 + cfg->rx_tbl_num_sec, 2); 3142 + } 3384 3143 3385 3144 /* Configure link rate, swing, etc. */ 3386 - if (cfg->type == PHY_TYPE_DP) 3145 + if (cfg->type == PHY_TYPE_DP) { 3387 3146 qcom_qmp_phy_configure_dp_phy(qphy); 3388 - else 3147 + } else { 3389 3148 qcom_qmp_phy_configure(pcs, cfg->regs, cfg->pcs_tbl, cfg->pcs_tbl_num); 3149 + if (cfg->pcs_tbl_sec) 3150 + qcom_qmp_phy_configure(pcs, cfg->regs, cfg->pcs_tbl_sec, 3151 + cfg->pcs_tbl_num_sec); 3152 + } 3390 3153 3391 3154 ret = reset_control_deassert(qmp->ufs_reset); 3392 3155 if (ret) ··· 3406 3145 3407 3146 qcom_qmp_phy_configure(pcs_misc, cfg->regs, cfg->pcs_misc_tbl, 3408 3147 cfg->pcs_misc_tbl_num); 3148 + if (cfg->pcs_misc_tbl_sec) 3149 + qcom_qmp_phy_configure(pcs_misc, cfg->regs, cfg->pcs_misc_tbl_sec, 3150 + cfg->pcs_misc_tbl_num_sec); 3409 3151 3410 3152 /* 3411 3153 * Pull out PHY from POWER DOWN state. ··· 4164 3900 }, { 4165 3901 .compatible = "qcom,sm8250-qmp-usb3-uni-phy", 4166 3902 .data = &sm8250_usb3_uniphy_cfg, 3903 + }, { 3904 + .compatible = "qcom,sm8250-qmp-gen3x1-pcie-phy", 3905 + .data = &sm8250_qmp_gen3x1_pciephy_cfg, 3906 + }, { 3907 + .compatible = "qcom,sm8250-qmp-gen3x2-pcie-phy", 3908 + .data = &sm8250_qmp_gen3x2_pciephy_cfg, 3909 + }, { 3910 + .compatible = "qcom,sm8250-qmp-modem-pcie-phy", 3911 + .data = &sm8250_qmp_gen3x2_pciephy_cfg, 4167 3912 }, 4168 3913 { }, 4169 3914 };
+18
drivers/phy/qualcomm/phy-qcom-qmp.h
··· 403 403 #define QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0 0x028 404 404 #define QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1 0x030 405 405 #define QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1 0x034 406 + #define QSERDES_V4_COM_CLK_ENABLE1 0x048 406 407 #define QSERDES_V4_COM_SYSCLK_BUF_ENABLE 0x050 407 408 #define QSERDES_V4_COM_PLL_IVCO 0x058 408 409 #define QSERDES_V4_COM_CMN_IPTRIM 0x060 ··· 433 432 #define QSERDES_V4_COM_VCO_TUNE1_MODE1 0x118 434 433 #define QSERDES_V4_COM_VCO_TUNE2_MODE1 0x11c 435 434 #define QSERDES_V4_COM_VCO_TUNE_INITVAL2 0x124 435 + #define QSERDES_V4_COM_CLK_SELECT 0x154 436 436 #define QSERDES_V4_COM_HSCLK_SEL 0x158 437 437 #define QSERDES_V4_COM_HSCLK_HS_SWITCH_SEL 0x15c 438 438 #define QSERDES_V4_COM_CORECLK_DIV_MODE1 0x16c ··· 473 471 #define QSERDES_V4_RX_UCDR_SB2_GAIN1 0x054 474 472 #define QSERDES_V4_RX_UCDR_SB2_GAIN2 0x058 475 473 #define QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE 0x060 474 + #define QSERDES_V4_RX_RCLK_AUXDATA_SEL 0x064 476 475 #define QSERDES_V4_RX_AC_JTAG_ENABLE 0x068 477 476 #define QSERDES_V4_RX_AC_JTAG_MODE 0x078 478 477 #define QSERDES_V4_RX_RX_TERM_BW 0x080 479 478 #define QSERDES_V4_RX_VGA_CAL_CNTRL1 0x0d4 480 479 #define QSERDES_V4_RX_VGA_CAL_CNTRL2 0x0d8 481 480 #define QSERDES_V4_RX_GM_CAL 0x0dc 481 + #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1 0x0e8 482 482 #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2 0x0ec 483 483 #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3 0x0f0 484 484 #define QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4 0x0f4 ··· 489 485 #define QSERDES_V4_RX_RX_IDAC_MEASURE_TIME 0x100 490 486 #define QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1 0x110 491 487 #define QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2 0x114 488 + #define QSERDES_V4_RX_SIGDET_ENABLES 0x118 492 489 #define QSERDES_V4_RX_SIGDET_CNTRL 0x11c 493 490 #define QSERDES_V4_RX_SIGDET_LVL 0x120 494 491 #define QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL 0x124 ··· 810 805 #define QPHY_V4_PCS_MISC_CLAMP_ENABLE 0x0c 811 806 #define QPHY_V4_PCS_MISC_TYPEC_STATUS 0x10 812 807 #define QPHY_V4_PCS_MISC_PLACEHOLDER_STATUS 0x14 808 + 809 + /* Only for QMP V4 PHY - PCS_PCIE registers (same as PCS_MISC?) */ 810 + #define QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG2 0x0c 811 + #define QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4 0x14 812 + #define QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x1c 813 + #define QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L 0x40 814 + #define QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L 0x48 815 + #define QPHY_V4_PCS_PCIE_INT_AUX_CLK_CONFIG1 0x50 816 + #define QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS 0x90 817 + #define QPHY_V4_PCS_PCIE_EQ_CONFIG2 0xa4 818 + #define QPHY_V4_PCS_PCIE_PRESET_P6_P7_PRE 0xb4 819 + #define QPHY_V4_PCS_PCIE_PRESET_P10_PRE 0xbc 820 + #define QPHY_V4_PCS_PCIE_PRESET_P10_POST 0xe0 813 821 814 822 #endif
+1 -3
drivers/phy/qualcomm/phy-qcom-qusb2.c
··· 844 844 struct qusb2_phy *qphy; 845 845 struct phy_provider *phy_provider; 846 846 struct phy *generic_phy; 847 - struct resource *res; 848 847 int ret, i; 849 848 int num; 850 849 u32 value; ··· 854 855 return -ENOMEM; 855 856 or = &qphy->overrides; 856 857 857 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 858 - qphy->base = devm_ioremap_resource(dev, res); 858 + qphy->base = devm_platform_ioremap_resource(pdev, 0); 859 859 if (IS_ERR(qphy->base)) 860 860 return PTR_ERR(qphy->base); 861 861
+8
drivers/phy/ralink/Kconfig
··· 2 2 # 3 3 # PHY drivers for Ralink platforms. 4 4 # 5 + config PHY_MT7621_PCI 6 + tristate "MediaTek MT7621 PCI PHY Driver" 7 + depends on RALINK && OF 8 + select GENERIC_PHY 9 + select REGMAP_MMIO 10 + help 11 + Say 'Y' here to add support for MediaTek MT7621 PCI PHY driver, 12 + 5 13 config PHY_RALINK_USB 6 14 tristate "Ralink USB PHY driver" 7 15 depends on RALINK || COMPILE_TEST
+1
drivers/phy/ralink/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + obj-$(CONFIG_PHY_MT7621_PCI) += phy-mt7621-pci.o 2 3 obj-$(CONFIG_PHY_RALINK_USB) += phy-ralink-usb.o
+1 -3
drivers/phy/renesas/phy-rcar-gen2.c
··· 339 339 struct rcar_gen2_phy_driver *drv; 340 340 struct phy_provider *provider; 341 341 struct device_node *np; 342 - struct resource *res; 343 342 void __iomem *base; 344 343 struct clk *clk; 345 344 const struct rcar_gen2_phy_data *data; ··· 356 357 return PTR_ERR(clk); 357 358 } 358 359 359 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 360 - base = devm_ioremap_resource(dev, res); 360 + base = devm_platform_ioremap_resource(pdev, 0); 361 361 if (IS_ERR(base)) 362 362 return PTR_ERR(base); 363 363
+1 -3
drivers/phy/renesas/phy-rcar-gen3-pcie.c
··· 76 76 struct device *dev = &pdev->dev; 77 77 struct phy_provider *provider; 78 78 struct rcar_gen3_phy *phy; 79 - struct resource *res; 80 79 void __iomem *base; 81 80 int error; 82 81 ··· 85 86 return -EINVAL; 86 87 } 87 88 88 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 89 - base = devm_ioremap_resource(dev, res); 89 + base = devm_platform_ioremap_resource(pdev, 0); 90 90 if (IS_ERR(base)) 91 91 return PTR_ERR(base); 92 92
+5 -5
drivers/phy/renesas/phy-rcar-gen3-usb2.c
··· 611 611 struct device *dev = &pdev->dev; 612 612 struct rcar_gen3_chan *channel; 613 613 struct phy_provider *provider; 614 - struct resource *res; 615 614 const struct phy_ops *phy_usb2_ops; 616 615 int ret = 0, i; 617 616 ··· 623 624 if (!channel) 624 625 return -ENOMEM; 625 626 626 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 627 - channel->base = devm_ioremap_resource(dev, res); 627 + channel->base = devm_platform_ioremap_resource(pdev, 0); 628 628 if (IS_ERR(channel->base)) 629 629 return PTR_ERR(channel->base); 630 630 ··· 654 656 */ 655 657 pm_runtime_enable(dev); 656 658 phy_usb2_ops = of_device_get_match_data(dev); 657 - if (!phy_usb2_ops) 658 - return -EINVAL; 659 + if (!phy_usb2_ops) { 660 + ret = -EINVAL; 661 + goto error; 662 + } 659 663 660 664 mutex_init(&channel->lock); 661 665 for (i = 0; i < NUM_OF_PHYS; i++) {
+1 -3
drivers/phy/renesas/phy-rcar-gen3-usb3.c
··· 133 133 struct device *dev = &pdev->dev; 134 134 struct rcar_gen3_usb3 *r; 135 135 struct phy_provider *provider; 136 - struct resource *res; 137 136 int ret = 0; 138 137 struct clk *clk; 139 138 ··· 145 146 if (!r) 146 147 return -ENOMEM; 147 148 148 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 149 - r->base = devm_ioremap_resource(dev, res); 149 + r->base = devm_platform_ioremap_resource(pdev, 0); 150 150 if (IS_ERR(r->base)) 151 151 return PTR_ERR(r->base); 152 152
+1
drivers/phy/rockchip/Kconfig
··· 32 32 tristate "Rockchip INNO HDMI PHY Driver" 33 33 depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF 34 34 depends on COMMON_CLK 35 + depends on HAS_IOMEM 35 36 select GENERIC_PHY 36 37 help 37 38 Enable this to support the Rockchip Innosilicon HDMI PHY.
+28 -1
drivers/phy/rockchip/phy-rockchip-emmc.c
··· 65 65 #define PHYCTRL_OTAPDLYENA 0x1 66 66 #define PHYCTRL_OTAPDLYENA_MASK 0x1 67 67 #define PHYCTRL_OTAPDLYENA_SHIFT 0xb 68 + #define PHYCTRL_OTAPDLYSEL_DEFAULT 0x4 69 + #define PHYCTRL_OTAPDLYSEL_MAXVALUE 0xf 68 70 #define PHYCTRL_OTAPDLYSEL_MASK 0xf 69 71 #define PHYCTRL_OTAPDLYSEL_SHIFT 0x7 72 + #define PHYCTRL_REN_STRB_DISABLE 0x0 73 + #define PHYCTRL_REN_STRB_ENABLE 0x1 74 + #define PHYCTRL_REN_STRB_MASK 0x1 75 + #define PHYCTRL_REN_STRB_SHIFT 0x9 70 76 71 77 #define PHYCTRL_IS_CALDONE(x) \ 72 78 ((((x) >> PHYCTRL_CALDONE_SHIFT) & \ ··· 86 80 struct regmap *reg_base; 87 81 struct clk *emmcclk; 88 82 unsigned int drive_impedance; 83 + unsigned int enable_strobe_pulldown; 84 + unsigned int output_tapdelay_select; 89 85 }; 90 86 91 87 static int rockchip_emmc_phy_power(struct phy *phy, bool on_off) ··· 299 291 /* Output tap delay */ 300 292 regmap_write(rk_phy->reg_base, 301 293 rk_phy->reg_offset + GRF_EMMCPHY_CON0, 302 - HIWORD_UPDATE(4, 294 + HIWORD_UPDATE(rk_phy->output_tapdelay_select, 303 295 PHYCTRL_OTAPDLYSEL_MASK, 304 296 PHYCTRL_OTAPDLYSEL_SHIFT)); 297 + 298 + /* Internal pull-down for strobe line */ 299 + regmap_write(rk_phy->reg_base, 300 + rk_phy->reg_offset + GRF_EMMCPHY_CON2, 301 + HIWORD_UPDATE(rk_phy->enable_strobe_pulldown, 302 + PHYCTRL_REN_STRB_MASK, 303 + PHYCTRL_REN_STRB_SHIFT)); 305 304 306 305 /* Power up emmc phy analog blocks */ 307 306 return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON); ··· 374 359 rk_phy->reg_offset = reg_offset; 375 360 rk_phy->reg_base = grf; 376 361 rk_phy->drive_impedance = PHYCTRL_DR_50OHM; 362 + rk_phy->enable_strobe_pulldown = PHYCTRL_REN_STRB_DISABLE; 363 + rk_phy->output_tapdelay_select = PHYCTRL_OTAPDLYSEL_DEFAULT; 377 364 378 365 if (!of_property_read_u32(dev->of_node, "drive-impedance-ohm", &val)) 379 366 rk_phy->drive_impedance = convert_drive_impedance_ohm(pdev, val); 367 + 368 + if (of_property_read_bool(dev->of_node, "enable-strobe-pulldown")) 369 + rk_phy->enable_strobe_pulldown = PHYCTRL_REN_STRB_ENABLE; 370 + 371 + if (!of_property_read_u32(dev->of_node, "output-tapdelay-select", &val)) { 372 + if (val <= PHYCTRL_OTAPDLYSEL_MAXVALUE) 373 + rk_phy->output_tapdelay_select = val; 374 + else 375 + dev_err(dev, "output-tapdelay-select exceeds limit, apply default\n"); 376 + } 380 377 381 378 generic_phy = devm_phy_create(dev, dev->of_node, &ops); 382 379 if (IS_ERR(generic_phy)) {
+1 -3
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
··· 1144 1144 { 1145 1145 struct inno_hdmi_phy *inno; 1146 1146 struct phy_provider *phy_provider; 1147 - struct resource *res; 1148 1147 void __iomem *regs; 1149 1148 int ret; 1150 1149 ··· 1157 1158 if (!inno->plat_data || !inno->plat_data->ops) 1158 1159 return -EINVAL; 1159 1160 1160 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1161 - regs = devm_ioremap_resource(inno->dev, res); 1161 + regs = devm_platform_ioremap_resource(pdev, 0); 1162 1162 if (IS_ERR(regs)) 1163 1163 return PTR_ERR(regs); 1164 1164
+107 -187
drivers/phy/samsung/phy-exynos-pcie.c
··· 4 4 * 5 5 * Phy provider for PCIe controller on Exynos SoC series 6 6 * 7 - * Copyright (C) 2017 Samsung Electronics Co., Ltd. 7 + * Copyright (C) 2017-2020 Samsung Electronics Co., Ltd. 8 8 * Jaehoon Chung <jh80.chung@samsung.com> 9 9 */ 10 10 11 - #include <linux/delay.h> 12 11 #include <linux/io.h> 13 - #include <linux/iopoll.h> 14 - #include <linux/init.h> 15 12 #include <linux/mfd/syscon.h> 16 - #include <linux/of.h> 17 - #include <linux/of_address.h> 18 13 #include <linux/of_platform.h> 19 14 #include <linux/platform_device.h> 20 15 #include <linux/phy/phy.h> 21 16 #include <linux/regmap.h> 22 17 23 - /* PCIe Purple registers */ 24 - #define PCIE_PHY_GLOBAL_RESET 0x000 25 - #define PCIE_PHY_COMMON_RESET 0x004 26 - #define PCIE_PHY_CMN_REG 0x008 27 - #define PCIE_PHY_MAC_RESET 0x00c 28 - #define PCIE_PHY_PLL_LOCKED 0x010 29 - #define PCIE_PHY_TRSVREG_RESET 0x020 30 - #define PCIE_PHY_TRSV_RESET 0x024 18 + #define PCIE_PHY_OFFSET(x) ((x) * 0x4) 31 19 32 - /* PCIe PHY registers */ 33 - #define PCIE_PHY_IMPEDANCE 0x004 34 - #define PCIE_PHY_PLL_DIV_0 0x008 35 - #define PCIE_PHY_PLL_BIAS 0x00c 36 - #define PCIE_PHY_DCC_FEEDBACK 0x014 37 - #define PCIE_PHY_PLL_DIV_1 0x05c 38 - #define PCIE_PHY_COMMON_POWER 0x064 39 - #define PCIE_PHY_COMMON_PD_CMN BIT(3) 40 - #define PCIE_PHY_TRSV0_EMP_LVL 0x084 41 - #define PCIE_PHY_TRSV0_DRV_LVL 0x088 42 - #define PCIE_PHY_TRSV0_RXCDR 0x0ac 43 - #define PCIE_PHY_TRSV0_POWER 0x0c4 44 - #define PCIE_PHY_TRSV0_PD_TSV BIT(7) 45 - #define PCIE_PHY_TRSV0_LVCC 0x0dc 46 - #define PCIE_PHY_TRSV1_EMP_LVL 0x144 47 - #define PCIE_PHY_TRSV1_RXCDR 0x16c 48 - #define PCIE_PHY_TRSV1_POWER 0x184 49 - #define PCIE_PHY_TRSV1_PD_TSV BIT(7) 50 - #define PCIE_PHY_TRSV1_LVCC 0x19c 51 - #define PCIE_PHY_TRSV2_EMP_LVL 0x204 52 - #define PCIE_PHY_TRSV2_RXCDR 0x22c 53 - #define PCIE_PHY_TRSV2_POWER 0x244 54 - #define PCIE_PHY_TRSV2_PD_TSV BIT(7) 55 - #define PCIE_PHY_TRSV2_LVCC 0x25c 56 - #define PCIE_PHY_TRSV3_EMP_LVL 0x2c4 57 - #define PCIE_PHY_TRSV3_RXCDR 0x2ec 58 - #define PCIE_PHY_TRSV3_POWER 0x304 59 - #define PCIE_PHY_TRSV3_PD_TSV BIT(7) 60 - #define PCIE_PHY_TRSV3_LVCC 0x31c 20 + /* Sysreg FSYS register offsets and bits for Exynos5433 */ 21 + #define PCIE_EXYNOS5433_PHY_MAC_RESET 0x0208 22 + #define PCIE_MAC_RESET_MASK 0xFF 23 + #define PCIE_MAC_RESET BIT(4) 24 + #define PCIE_EXYNOS5433_PHY_L1SUB_CM_CON 0x1010 25 + #define PCIE_REFCLK_GATING_EN BIT(0) 26 + #define PCIE_EXYNOS5433_PHY_COMMON_RESET 0x1020 27 + #define PCIE_PHY_RESET BIT(0) 28 + #define PCIE_EXYNOS5433_PHY_GLOBAL_RESET 0x1040 29 + #define PCIE_GLOBAL_RESET BIT(0) 30 + #define PCIE_REFCLK BIT(1) 31 + #define PCIE_REFCLK_MASK 0x16 32 + #define PCIE_APP_REQ_EXIT_L1_MODE BIT(5) 61 33 62 - struct exynos_pcie_phy_data { 63 - const struct phy_ops *ops; 64 - }; 34 + /* PMU PCIE PHY isolation control */ 35 + #define EXYNOS5433_PMU_PCIE_PHY_OFFSET 0x730 65 36 66 37 /* For Exynos pcie phy */ 67 38 struct exynos_pcie_phy { 68 - const struct exynos_pcie_phy_data *drv_data; 69 - void __iomem *phy_base; 70 - void __iomem *blk_base; /* For exynos5440 */ 39 + void __iomem *base; 40 + struct regmap *pmureg; 41 + struct regmap *fsysreg; 71 42 }; 72 43 73 44 static void exynos_pcie_phy_writel(void __iomem *base, u32 val, u32 offset) ··· 46 75 writel(val, base + offset); 47 76 } 48 77 49 - static u32 exynos_pcie_phy_readl(void __iomem *base, u32 offset) 50 - { 51 - return readl(base + offset); 52 - } 53 - 54 - /* For Exynos5440 specific functions */ 55 - static int exynos5440_pcie_phy_init(struct phy *phy) 78 + /* Exynos5433 specific functions */ 79 + static int exynos5433_pcie_phy_init(struct phy *phy) 56 80 { 57 81 struct exynos_pcie_phy *ep = phy_get_drvdata(phy); 58 82 59 - /* DCC feedback control off */ 60 - exynos_pcie_phy_writel(ep->phy_base, 0x29, PCIE_PHY_DCC_FEEDBACK); 83 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_COMMON_RESET, 84 + PCIE_PHY_RESET, 1); 85 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_MAC_RESET, 86 + PCIE_MAC_RESET, 0); 61 87 62 - /* set TX/RX impedance */ 63 - exynos_pcie_phy_writel(ep->phy_base, 0xd5, PCIE_PHY_IMPEDANCE); 88 + /* PHY refclk 24MHz */ 89 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, 90 + PCIE_REFCLK_MASK, PCIE_REFCLK); 91 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, 92 + PCIE_GLOBAL_RESET, 0); 64 93 65 - /* set 50Mhz PHY clock */ 66 - exynos_pcie_phy_writel(ep->phy_base, 0x14, PCIE_PHY_PLL_DIV_0); 67 - exynos_pcie_phy_writel(ep->phy_base, 0x12, PCIE_PHY_PLL_DIV_1); 68 94 69 - /* set TX Differential output for lane 0 */ 70 - exynos_pcie_phy_writel(ep->phy_base, 0x7f, PCIE_PHY_TRSV0_DRV_LVL); 95 + exynos_pcie_phy_writel(ep->base, 0x11, PCIE_PHY_OFFSET(0x3)); 71 96 72 - /* set TX Pre-emphasis Level Control for lane 0 to minimum */ 73 - exynos_pcie_phy_writel(ep->phy_base, 0x0, PCIE_PHY_TRSV0_EMP_LVL); 97 + /* band gap reference on */ 98 + exynos_pcie_phy_writel(ep->base, 0, PCIE_PHY_OFFSET(0x20)); 99 + exynos_pcie_phy_writel(ep->base, 0, PCIE_PHY_OFFSET(0x4b)); 74 100 75 - /* set RX clock and data recovery bandwidth */ 76 - exynos_pcie_phy_writel(ep->phy_base, 0xe7, PCIE_PHY_PLL_BIAS); 77 - exynos_pcie_phy_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV0_RXCDR); 78 - exynos_pcie_phy_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV1_RXCDR); 79 - exynos_pcie_phy_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV2_RXCDR); 80 - exynos_pcie_phy_writel(ep->phy_base, 0x82, PCIE_PHY_TRSV3_RXCDR); 101 + /* jitter tuning */ 102 + exynos_pcie_phy_writel(ep->base, 0x34, PCIE_PHY_OFFSET(0x4)); 103 + exynos_pcie_phy_writel(ep->base, 0x02, PCIE_PHY_OFFSET(0x7)); 104 + exynos_pcie_phy_writel(ep->base, 0x41, PCIE_PHY_OFFSET(0x21)); 105 + exynos_pcie_phy_writel(ep->base, 0x7F, PCIE_PHY_OFFSET(0x14)); 106 + exynos_pcie_phy_writel(ep->base, 0xC0, PCIE_PHY_OFFSET(0x15)); 107 + exynos_pcie_phy_writel(ep->base, 0x61, PCIE_PHY_OFFSET(0x36)); 81 108 82 - /* change TX Pre-emphasis Level Control for lanes */ 83 - exynos_pcie_phy_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV0_EMP_LVL); 84 - exynos_pcie_phy_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV1_EMP_LVL); 85 - exynos_pcie_phy_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV2_EMP_LVL); 86 - exynos_pcie_phy_writel(ep->phy_base, 0x39, PCIE_PHY_TRSV3_EMP_LVL); 109 + /* D0 uninit.. */ 110 + exynos_pcie_phy_writel(ep->base, 0x44, PCIE_PHY_OFFSET(0x3D)); 87 111 88 - /* set LVCC */ 89 - exynos_pcie_phy_writel(ep->phy_base, 0x20, PCIE_PHY_TRSV0_LVCC); 90 - exynos_pcie_phy_writel(ep->phy_base, 0xa0, PCIE_PHY_TRSV1_LVCC); 91 - exynos_pcie_phy_writel(ep->phy_base, 0xa0, PCIE_PHY_TRSV2_LVCC); 92 - exynos_pcie_phy_writel(ep->phy_base, 0xa0, PCIE_PHY_TRSV3_LVCC); 112 + /* 24MHz */ 113 + exynos_pcie_phy_writel(ep->base, 0x94, PCIE_PHY_OFFSET(0x8)); 114 + exynos_pcie_phy_writel(ep->base, 0xA7, PCIE_PHY_OFFSET(0x9)); 115 + exynos_pcie_phy_writel(ep->base, 0x93, PCIE_PHY_OFFSET(0xA)); 116 + exynos_pcie_phy_writel(ep->base, 0x6B, PCIE_PHY_OFFSET(0xC)); 117 + exynos_pcie_phy_writel(ep->base, 0xA5, PCIE_PHY_OFFSET(0xF)); 118 + exynos_pcie_phy_writel(ep->base, 0x34, PCIE_PHY_OFFSET(0x16)); 119 + exynos_pcie_phy_writel(ep->base, 0xA3, PCIE_PHY_OFFSET(0x17)); 120 + exynos_pcie_phy_writel(ep->base, 0xA7, PCIE_PHY_OFFSET(0x1A)); 121 + exynos_pcie_phy_writel(ep->base, 0x71, PCIE_PHY_OFFSET(0x23)); 122 + exynos_pcie_phy_writel(ep->base, 0x4C, PCIE_PHY_OFFSET(0x24)); 93 123 94 - /* pulse for common reset */ 95 - exynos_pcie_phy_writel(ep->blk_base, 1, PCIE_PHY_COMMON_RESET); 96 - udelay(500); 97 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_COMMON_RESET); 124 + exynos_pcie_phy_writel(ep->base, 0x0E, PCIE_PHY_OFFSET(0x26)); 125 + exynos_pcie_phy_writel(ep->base, 0x14, PCIE_PHY_OFFSET(0x7)); 126 + exynos_pcie_phy_writel(ep->base, 0x48, PCIE_PHY_OFFSET(0x43)); 127 + exynos_pcie_phy_writel(ep->base, 0x44, PCIE_PHY_OFFSET(0x44)); 128 + exynos_pcie_phy_writel(ep->base, 0x03, PCIE_PHY_OFFSET(0x45)); 129 + exynos_pcie_phy_writel(ep->base, 0xA7, PCIE_PHY_OFFSET(0x48)); 130 + exynos_pcie_phy_writel(ep->base, 0x13, PCIE_PHY_OFFSET(0x54)); 131 + exynos_pcie_phy_writel(ep->base, 0x04, PCIE_PHY_OFFSET(0x31)); 132 + exynos_pcie_phy_writel(ep->base, 0, PCIE_PHY_OFFSET(0x32)); 98 133 134 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_COMMON_RESET, 135 + PCIE_PHY_RESET, 0); 136 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_MAC_RESET, 137 + PCIE_MAC_RESET_MASK, PCIE_MAC_RESET); 99 138 return 0; 100 139 } 101 140 102 - static int exynos5440_pcie_phy_power_on(struct phy *phy) 103 - { 104 - struct exynos_pcie_phy *ep = phy_get_drvdata(phy); 105 - u32 val; 106 - 107 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_COMMON_RESET); 108 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_CMN_REG); 109 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_TRSVREG_RESET); 110 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_TRSV_RESET); 111 - 112 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_COMMON_POWER); 113 - val &= ~PCIE_PHY_COMMON_PD_CMN; 114 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_COMMON_POWER); 115 - 116 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV0_POWER); 117 - val &= ~PCIE_PHY_TRSV0_PD_TSV; 118 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV0_POWER); 119 - 120 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV1_POWER); 121 - val &= ~PCIE_PHY_TRSV1_PD_TSV; 122 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV1_POWER); 123 - 124 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV2_POWER); 125 - val &= ~PCIE_PHY_TRSV2_PD_TSV; 126 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV2_POWER); 127 - 128 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV3_POWER); 129 - val &= ~PCIE_PHY_TRSV3_PD_TSV; 130 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV3_POWER); 131 - 132 - return 0; 133 - } 134 - 135 - static int exynos5440_pcie_phy_power_off(struct phy *phy) 136 - { 137 - struct exynos_pcie_phy *ep = phy_get_drvdata(phy); 138 - u32 val; 139 - 140 - if (readl_poll_timeout(ep->phy_base + PCIE_PHY_PLL_LOCKED, val, 141 - (val != 0), 1, 500)) { 142 - dev_err(&phy->dev, "PLL Locked: 0x%x\n", val); 143 - return -ETIMEDOUT; 144 - } 145 - 146 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_COMMON_POWER); 147 - val |= PCIE_PHY_COMMON_PD_CMN; 148 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_COMMON_POWER); 149 - 150 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV0_POWER); 151 - val |= PCIE_PHY_TRSV0_PD_TSV; 152 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV0_POWER); 153 - 154 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV1_POWER); 155 - val |= PCIE_PHY_TRSV1_PD_TSV; 156 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV1_POWER); 157 - 158 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV2_POWER); 159 - val |= PCIE_PHY_TRSV2_PD_TSV; 160 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV2_POWER); 161 - 162 - val = exynos_pcie_phy_readl(ep->phy_base, PCIE_PHY_TRSV3_POWER); 163 - val |= PCIE_PHY_TRSV3_PD_TSV; 164 - exynos_pcie_phy_writel(ep->phy_base, val, PCIE_PHY_TRSV3_POWER); 165 - 166 - return 0; 167 - } 168 - 169 - static int exynos5440_pcie_phy_reset(struct phy *phy) 141 + static int exynos5433_pcie_phy_power_on(struct phy *phy) 170 142 { 171 143 struct exynos_pcie_phy *ep = phy_get_drvdata(phy); 172 144 173 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_MAC_RESET); 174 - exynos_pcie_phy_writel(ep->blk_base, 1, PCIE_PHY_GLOBAL_RESET); 175 - exynos_pcie_phy_writel(ep->blk_base, 0, PCIE_PHY_GLOBAL_RESET); 176 - 145 + regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET, 146 + BIT(0), 1); 147 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET, 148 + PCIE_APP_REQ_EXIT_L1_MODE, 0); 149 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON, 150 + PCIE_REFCLK_GATING_EN, 0); 177 151 return 0; 178 152 } 179 153 180 - static const struct phy_ops exynos5440_phy_ops = { 181 - .init = exynos5440_pcie_phy_init, 182 - .power_on = exynos5440_pcie_phy_power_on, 183 - .power_off = exynos5440_pcie_phy_power_off, 184 - .reset = exynos5440_pcie_phy_reset, 154 + static int exynos5433_pcie_phy_power_off(struct phy *phy) 155 + { 156 + struct exynos_pcie_phy *ep = phy_get_drvdata(phy); 157 + 158 + regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON, 159 + PCIE_REFCLK_GATING_EN, PCIE_REFCLK_GATING_EN); 160 + regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET, 161 + BIT(0), 0); 162 + return 0; 163 + } 164 + 165 + static const struct phy_ops exynos5433_phy_ops = { 166 + .init = exynos5433_pcie_phy_init, 167 + .power_on = exynos5433_pcie_phy_power_on, 168 + .power_off = exynos5433_pcie_phy_power_off, 185 169 .owner = THIS_MODULE, 186 - }; 187 - 188 - static const struct exynos_pcie_phy_data exynos5440_pcie_phy_data = { 189 - .ops = &exynos5440_phy_ops, 190 170 }; 191 171 192 172 static const struct of_device_id exynos_pcie_phy_match[] = { 193 173 { 194 - .compatible = "samsung,exynos5440-pcie-phy", 195 - .data = &exynos5440_pcie_phy_data, 174 + .compatible = "samsung,exynos5433-pcie-phy", 196 175 }, 197 176 {}, 198 177 }; ··· 153 232 struct exynos_pcie_phy *exynos_phy; 154 233 struct phy *generic_phy; 155 234 struct phy_provider *phy_provider; 156 - struct resource *res; 157 - const struct exynos_pcie_phy_data *drv_data; 158 - 159 - drv_data = of_device_get_match_data(dev); 160 - if (!drv_data) 161 - return -ENODEV; 162 235 163 236 exynos_phy = devm_kzalloc(dev, sizeof(*exynos_phy), GFP_KERNEL); 164 237 if (!exynos_phy) 165 238 return -ENOMEM; 166 239 167 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 168 - exynos_phy->phy_base = devm_ioremap_resource(dev, res); 169 - if (IS_ERR(exynos_phy->phy_base)) 170 - return PTR_ERR(exynos_phy->phy_base); 240 + exynos_phy->base = devm_platform_ioremap_resource(pdev, 0); 241 + if (IS_ERR(exynos_phy->base)) 242 + return PTR_ERR(exynos_phy->base); 171 243 172 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 173 - exynos_phy->blk_base = devm_ioremap_resource(dev, res); 174 - if (IS_ERR(exynos_phy->blk_base)) 175 - return PTR_ERR(exynos_phy->blk_base); 244 + exynos_phy->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, 245 + "samsung,pmu-syscon"); 246 + if (IS_ERR(exynos_phy->pmureg)) { 247 + dev_err(&pdev->dev, "PMU regmap lookup failed.\n"); 248 + return PTR_ERR(exynos_phy->pmureg); 249 + } 176 250 177 - exynos_phy->drv_data = drv_data; 251 + exynos_phy->fsysreg = syscon_regmap_lookup_by_phandle(dev->of_node, 252 + "samsung,fsys-sysreg"); 253 + if (IS_ERR(exynos_phy->fsysreg)) { 254 + dev_err(&pdev->dev, "FSYS sysreg regmap lookup failed.\n"); 255 + return PTR_ERR(exynos_phy->fsysreg); 256 + } 178 257 179 - generic_phy = devm_phy_create(dev, dev->of_node, drv_data->ops); 258 + generic_phy = devm_phy_create(dev, dev->of_node, &exynos5433_phy_ops); 180 259 if (IS_ERR(generic_phy)) { 181 260 dev_err(dev, "failed to create PHY\n"); 182 261 return PTR_ERR(generic_phy); ··· 196 275 .suppress_bind_attrs = true, 197 276 } 198 277 }; 199 - 200 278 builtin_platform_driver(exynos_pcie_phy_driver);
+1 -3
drivers/phy/samsung/phy-exynos5-usbdrd.c
··· 829 829 struct device_node *node = dev->of_node; 830 830 struct exynos5_usbdrd_phy *phy_drd; 831 831 struct phy_provider *phy_provider; 832 - struct resource *res; 833 832 const struct exynos5_usbdrd_phy_drvdata *drv_data; 834 833 struct regmap *reg_pmu; 835 834 u32 pmu_offset; ··· 842 843 dev_set_drvdata(dev, phy_drd); 843 844 phy_drd->dev = dev; 844 845 845 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 846 - phy_drd->reg_phy = devm_ioremap_resource(dev, res); 846 + phy_drd->reg_phy = devm_platform_ioremap_resource(pdev, 0); 847 847 if (IS_ERR(phy_drd->reg_phy)) 848 848 return PTR_ERR(phy_drd->reg_phy); 849 849
+1 -4
drivers/phy/samsung/phy-exynos5250-sata.c
··· 162 162 { 163 163 struct exynos_sata_phy *sata_phy; 164 164 struct device *dev = &pdev->dev; 165 - struct resource *res; 166 165 struct phy_provider *phy_provider; 167 166 struct device_node *node; 168 167 int ret = 0; ··· 170 171 if (!sata_phy) 171 172 return -ENOMEM; 172 173 173 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 174 - 175 - sata_phy->regs = devm_ioremap_resource(dev, res); 174 + sata_phy->regs = devm_platform_ioremap_resource(pdev, 0); 176 175 if (IS_ERR(sata_phy->regs)) 177 176 return PTR_ERR(sata_phy->regs); 178 177
+34 -14
drivers/phy/samsung/phy-exynos5250-usb2.c
··· 117 117 118 118 /* Isolation, configured in the power management unit */ 119 119 #define EXYNOS_5250_USB_ISOL_OTG_OFFSET 0x704 120 - #define EXYNOS_5250_USB_ISOL_OTG BIT(0) 121 120 #define EXYNOS_5250_USB_ISOL_HOST_OFFSET 0x708 122 - #define EXYNOS_5250_USB_ISOL_HOST BIT(0) 121 + #define EXYNOS_5420_USB_ISOL_HOST_OFFSET 0x70C 122 + #define EXYNOS_5250_USB_ISOL_ENABLE BIT(0) 123 123 124 124 /* Mode swtich register */ 125 125 #define EXYNOS_5250_MODE_SWITCH_OFFSET 0x230 ··· 132 132 EXYNOS5250_HOST, 133 133 EXYNOS5250_HSIC0, 134 134 EXYNOS5250_HSIC1, 135 - EXYNOS5250_NUM_PHYS, 136 135 }; 137 136 138 137 /* ··· 175 176 { 176 177 struct samsung_usb2_phy_driver *drv = inst->drv; 177 178 u32 offset; 178 - u32 mask; 179 + u32 mask = EXYNOS_5250_USB_ISOL_ENABLE; 179 180 180 - switch (inst->cfg->id) { 181 - case EXYNOS5250_DEVICE: 181 + if (drv->cfg == &exynos5250_usb2_phy_config && 182 + inst->cfg->id == EXYNOS5250_DEVICE) 182 183 offset = EXYNOS_5250_USB_ISOL_OTG_OFFSET; 183 - mask = EXYNOS_5250_USB_ISOL_OTG; 184 - break; 185 - case EXYNOS5250_HOST: 184 + else if (drv->cfg == &exynos5250_usb2_phy_config && 185 + inst->cfg->id == EXYNOS5250_HOST) 186 186 offset = EXYNOS_5250_USB_ISOL_HOST_OFFSET; 187 - mask = EXYNOS_5250_USB_ISOL_HOST; 188 - break; 189 - default: 187 + else if (drv->cfg == &exynos5420_usb2_phy_config && 188 + inst->cfg->id == EXYNOS5250_HOST) 189 + offset = EXYNOS_5420_USB_ISOL_HOST_OFFSET; 190 + else 190 191 return; 191 - } 192 192 193 193 regmap_update_bits(drv->reg_pmu, offset, mask, on ? 0 : mask); 194 194 } ··· 388 390 }, 389 391 }; 390 392 393 + static const struct samsung_usb2_common_phy exynos5420_phys[] = { 394 + { 395 + .label = "host", 396 + .id = EXYNOS5250_HOST, 397 + .power_on = exynos5250_power_on, 398 + .power_off = exynos5250_power_off, 399 + }, 400 + { 401 + .label = "hsic", 402 + .id = EXYNOS5250_HSIC0, 403 + .power_on = exynos5250_power_on, 404 + .power_off = exynos5250_power_off, 405 + }, 406 + }; 407 + 391 408 const struct samsung_usb2_phy_config exynos5250_usb2_phy_config = { 392 409 .has_mode_switch = 1, 393 - .num_phys = EXYNOS5250_NUM_PHYS, 410 + .num_phys = ARRAY_SIZE(exynos5250_phys), 394 411 .phys = exynos5250_phys, 412 + .rate_to_clk = exynos5250_rate_to_clk, 413 + }; 414 + 415 + const struct samsung_usb2_phy_config exynos5420_usb2_phy_config = { 416 + .has_mode_switch = 1, 417 + .num_phys = ARRAY_SIZE(exynos5420_phys), 418 + .phys = exynos5420_phys, 395 419 .rate_to_clk = exynos5250_rate_to_clk, 396 420 };
+5 -3
drivers/phy/samsung/phy-samsung-usb2.c
··· 127 127 .compatible = "samsung,exynos5250-usb2-phy", 128 128 .data = &exynos5250_usb2_phy_config, 129 129 }, 130 + { 131 + .compatible = "samsung,exynos5420-usb2-phy", 132 + .data = &exynos5420_usb2_phy_config, 133 + }, 130 134 #endif 131 135 #ifdef CONFIG_PHY_S5PV210_USB2 132 136 { ··· 147 143 const struct samsung_usb2_phy_config *cfg; 148 144 struct device *dev = &pdev->dev; 149 145 struct phy_provider *phy_provider; 150 - struct resource *mem; 151 146 struct samsung_usb2_phy_driver *drv; 152 147 int i, ret; 153 148 ··· 170 167 drv->cfg = cfg; 171 168 drv->dev = dev; 172 169 173 - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 174 - drv->reg_phy = devm_ioremap_resource(dev, mem); 170 + drv->reg_phy = devm_platform_ioremap_resource(pdev, 0); 175 171 if (IS_ERR(drv->reg_phy)) { 176 172 dev_err(dev, "Failed to map register memory (phy)\n"); 177 173 return PTR_ERR(drv->reg_phy);
+1
drivers/phy/samsung/phy-samsung-usb2.h
··· 66 66 extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config; 67 67 extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config; 68 68 extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config; 69 + extern const struct samsung_usb2_phy_config exynos5420_usb2_phy_config; 69 70 extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config; 70 71 #endif
+7 -8
drivers/phy/st/phy-stm32-usbphyc.c
··· 311 311 struct stm32_usbphyc *usbphyc; 312 312 struct device *dev = &pdev->dev; 313 313 struct device_node *child, *np = dev->of_node; 314 - struct resource *res; 315 314 struct phy_provider *phy_provider; 316 315 u32 version; 317 316 int ret, port = 0; ··· 321 322 usbphyc->dev = dev; 322 323 dev_set_drvdata(dev, usbphyc); 323 324 324 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 325 - usbphyc->base = devm_ioremap_resource(dev, res); 325 + usbphyc->base = devm_platform_ioremap_resource(pdev, 0); 326 326 if (IS_ERR(usbphyc->base)) 327 327 return PTR_ERR(usbphyc->base); 328 328 329 329 usbphyc->clk = devm_clk_get(dev, NULL); 330 - if (IS_ERR(usbphyc->clk)) { 331 - ret = PTR_ERR(usbphyc->clk); 332 - dev_err(dev, "clk get failed: %d\n", ret); 333 - return ret; 334 - } 330 + if (IS_ERR(usbphyc->clk)) 331 + return dev_err_probe(dev, PTR_ERR(usbphyc->clk), "clk get_failed\n"); 335 332 336 333 ret = clk_prepare_enable(usbphyc->clk); 337 334 if (ret) { ··· 340 345 reset_control_assert(usbphyc->rst); 341 346 udelay(2); 342 347 reset_control_deassert(usbphyc->rst); 348 + } else { 349 + ret = PTR_ERR(usbphyc->rst); 350 + if (ret == -EPROBE_DEFER) 351 + goto clk_disable; 343 352 } 344 353 345 354 usbphyc->switch_setup = -EINVAL;
+1 -3
drivers/phy/tegra/phy-tegra194-p2u.c
··· 72 72 struct device *dev = &pdev->dev; 73 73 struct phy *generic_phy; 74 74 struct tegra_p2u *phy; 75 - struct resource *res; 76 75 77 76 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); 78 77 if (!phy) 79 78 return -ENOMEM; 80 79 81 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctl"); 82 - phy->base = devm_ioremap_resource(dev, res); 80 + phy->base = devm_platform_ioremap_resource_byname(pdev, "ctl"); 83 81 if (IS_ERR(phy->base)) 84 82 return PTR_ERR(phy->base); 85 83
+5 -7
drivers/phy/tegra/xusb.c
··· 146 146 pad->soc->ops->remove(pad); 147 147 } 148 148 149 - static struct device_type tegra_xusb_pad_type = { 149 + static const struct device_type tegra_xusb_pad_type = { 150 150 .release = tegra_xusb_pad_release, 151 151 }; 152 152 ··· 513 513 port->ops->release(port); 514 514 } 515 515 516 - static struct device_type tegra_xusb_port_type = { 516 + static const struct device_type tegra_xusb_port_type = { 517 517 .release = tegra_xusb_port_release, 518 518 }; 519 519 ··· 688 688 * reference to retrieve usb-phy details. 689 689 */ 690 690 port->usb_phy.dev = &lane->pad->lanes[port->index]->dev; 691 - port->usb_phy.dev->driver = port->padctl->dev->driver; 691 + port->usb_phy.dev->driver = port->dev.driver; 692 692 port->usb_phy.otg->usb_phy = &port->usb_phy; 693 693 port->usb_phy.otg->set_peripheral = tegra_xusb_set_peripheral; 694 694 port->usb_phy.otg->set_host = tegra_xusb_set_host; ··· 1148 1148 const struct tegra_xusb_padctl_soc *soc; 1149 1149 struct tegra_xusb_padctl *padctl; 1150 1150 const struct of_device_id *match; 1151 - struct resource *res; 1152 1151 int err; 1153 1152 1154 1153 /* for backwards compatibility with old device trees */ ··· 1172 1173 INIT_LIST_HEAD(&padctl->pads); 1173 1174 mutex_init(&padctl->lock); 1174 1175 1175 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1176 - padctl->regs = devm_ioremap_resource(&pdev->dev, res); 1176 + padctl->regs = devm_platform_ioremap_resource(pdev, 0); 1177 1177 if (IS_ERR(padctl->regs)) { 1178 1178 err = PTR_ERR(padctl->regs); 1179 1179 goto remove; ··· 1198 1200 err = devm_regulator_bulk_get(&pdev->dev, padctl->soc->num_supplies, 1199 1201 padctl->supplies); 1200 1202 if (err < 0) { 1201 - dev_err(&pdev->dev, "failed to get regulators: %d\n", err); 1203 + dev_err_probe(&pdev->dev, err, "failed to get regulators\n"); 1202 1204 goto remove; 1203 1205 } 1204 1206
+6 -11
drivers/phy/ti/phy-omap-control.c
··· 268 268 269 269 static int omap_control_phy_probe(struct platform_device *pdev) 270 270 { 271 - struct resource *res; 272 271 const struct of_device_id *of_id; 273 272 struct omap_control_phy *control_phy; 274 273 ··· 284 285 control_phy->type = *(enum omap_control_phy_type *)of_id->data; 285 286 286 287 if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) { 287 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 288 - "otghs_control"); 289 - control_phy->otghs_control = devm_ioremap_resource( 290 - &pdev->dev, res); 288 + control_phy->otghs_control = 289 + devm_platform_ioremap_resource_byname(pdev, "otghs_control"); 291 290 if (IS_ERR(control_phy->otghs_control)) 292 291 return PTR_ERR(control_phy->otghs_control); 293 292 } else { 294 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 295 - "power"); 296 - control_phy->power = devm_ioremap_resource(&pdev->dev, res); 293 + control_phy->power = 294 + devm_platform_ioremap_resource_byname(pdev, "power"); 297 295 if (IS_ERR(control_phy->power)) { 298 296 dev_err(&pdev->dev, "Couldn't get power register\n"); 299 297 return PTR_ERR(control_phy->power); ··· 308 312 } 309 313 310 314 if (control_phy->type == OMAP_CTRL_TYPE_PCIE) { 311 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 312 - "pcie_pcs"); 313 - control_phy->pcie_pcs = devm_ioremap_resource(&pdev->dev, res); 315 + control_phy->pcie_pcs = 316 + devm_platform_ioremap_resource_byname(pdev, "pcie_pcs"); 314 317 if (IS_ERR(control_phy->pcie_pcs)) 315 318 return PTR_ERR(control_phy->pcie_pcs); 316 319 }
+1 -3
drivers/phy/ti/phy-omap-usb2.c
··· 366 366 { 367 367 struct omap_usb *phy; 368 368 struct phy *generic_phy; 369 - struct resource *res; 370 369 struct phy_provider *phy_provider; 371 370 struct usb_otg *otg; 372 371 struct device_node *node = pdev->dev.of_node; ··· 402 403 403 404 omap_usb2_init_errata(phy); 404 405 405 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 406 - phy->phy_base = devm_ioremap_resource(&pdev->dev, res); 406 + phy->phy_base = devm_platform_ioremap_resource(pdev, 0); 407 407 if (IS_ERR(phy->phy_base)) 408 408 return PTR_ERR(phy->phy_base); 409 409
+4 -11
drivers/phy/ti/phy-ti-pipe3.c
··· 745 745 746 746 static int ti_pipe3_get_tx_rx_base(struct ti_pipe3 *phy) 747 747 { 748 - struct resource *res; 749 748 struct device *dev = phy->dev; 750 749 struct platform_device *pdev = to_platform_device(dev); 751 750 752 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 753 - "phy_rx"); 754 - phy->phy_rx = devm_ioremap_resource(dev, res); 751 + phy->phy_rx = devm_platform_ioremap_resource_byname(pdev, "phy_rx"); 755 752 if (IS_ERR(phy->phy_rx)) 756 753 return PTR_ERR(phy->phy_rx); 757 754 758 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 759 - "phy_tx"); 760 - phy->phy_tx = devm_ioremap_resource(dev, res); 755 + phy->phy_tx = devm_platform_ioremap_resource_byname(pdev, "phy_tx"); 761 756 762 757 return PTR_ERR_OR_ZERO(phy->phy_tx); 763 758 } 764 759 765 760 static int ti_pipe3_get_pll_base(struct ti_pipe3 *phy) 766 761 { 767 - struct resource *res; 768 762 struct device *dev = phy->dev; 769 763 struct platform_device *pdev = to_platform_device(dev); 770 764 771 765 if (phy->mode == PIPE3_MODE_PCIE) 772 766 return 0; 773 767 774 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 775 - "pll_ctrl"); 776 - phy->pll_ctrl_base = devm_ioremap_resource(dev, res); 768 + phy->pll_ctrl_base = 769 + devm_platform_ioremap_resource_byname(pdev, "pll_ctrl"); 777 770 return PTR_ERR_OR_ZERO(phy->pll_ctrl_base); 778 771 } 779 772
-2
drivers/staging/Kconfig
··· 94 94 95 95 source "drivers/staging/mt7621-pci/Kconfig" 96 96 97 - source "drivers/staging/mt7621-pci-phy/Kconfig" 98 - 99 97 source "drivers/staging/mt7621-pinctrl/Kconfig" 100 98 101 99 source "drivers/staging/mt7621-dma/Kconfig"
-1
drivers/staging/Makefile
··· 37 37 obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/ 38 38 obj-$(CONFIG_PI433) += pi433/ 39 39 obj-$(CONFIG_PCI_MT7621) += mt7621-pci/ 40 - obj-$(CONFIG_PCI_MT7621_PHY) += mt7621-pci-phy/ 41 40 obj-$(CONFIG_PINCTRL_RT2880) += mt7621-pinctrl/ 42 41 obj-$(CONFIG_SOC_MT7621) += mt7621-dma/ 43 42 obj-$(CONFIG_DMA_RALINK) += ralink-gdma/
-8
drivers/staging/mt7621-pci-phy/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - config PCI_MT7621_PHY 3 - tristate "MediaTek MT7621 PCI PHY Driver" 4 - depends on RALINK && OF 5 - select GENERIC_PHY 6 - help 7 - Say 'Y' here to add support for MediaTek MT7621 PCI PHY driver, 8 -
-2
drivers/staging/mt7621-pci-phy/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - obj-$(CONFIG_PCI_MT7621_PHY) += pci-mt7621-phy.o
-4
drivers/staging/mt7621-pci-phy/TODO
··· 1 - 2 - - general code review and cleanup 3 - 4 - Cc: NeilBrown <neil@brown.name> and Sergio Paracuellos <sergio.paracuellos@gmail.com>
+1 -1
drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.yaml Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.yaml
··· 1 - # SPDX-License-Identifier: GPL-2.0 1 + # SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) 2 2 %YAML 1.2 3 3 --- 4 4 $id: "http://devicetree.org/schemas/phy/mediatek,mt7621-pci-phy.yaml#"
+49 -70
drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c drivers/phy/ralink/phy-mt7621-pci.c
··· 5 5 */ 6 6 7 7 #include <dt-bindings/phy/phy.h> 8 + #include <linux/bitfield.h> 8 9 #include <linux/bitops.h> 9 10 #include <linux/module.h> 10 11 #include <linux/of_address.h> ··· 24 23 #define RG_P0_TO_P1_WIDTH 0x100 25 24 #define RG_PE1_H_LCDDS_REG 0x49c 26 25 #define RG_PE1_H_LCDDS_PCW GENMASK(30, 0) 27 - #define RG_PE1_H_LCDDS_PCW_VAL(x) ((0x7fffffff & (x)) << 0) 28 26 29 27 #define RG_PE1_FRC_H_XTAL_REG 0x400 30 28 #define RG_PE1_FRC_H_XTAL_TYPE BIT(8) 31 29 #define RG_PE1_H_XTAL_TYPE GENMASK(10, 9) 32 - #define RG_PE1_H_XTAL_TYPE_VAL(x) ((0x3 & (x)) << 9) 33 30 34 31 #define RG_PE1_FRC_PHY_REG 0x000 35 32 #define RG_PE1_FRC_PHY_EN BIT(4) ··· 35 36 36 37 #define RG_PE1_H_PLL_REG 0x490 37 38 #define RG_PE1_H_PLL_BC GENMASK(23, 22) 38 - #define RG_PE1_H_PLL_BC_VAL(x) ((0x3 & (x)) << 22) 39 39 #define RG_PE1_H_PLL_BP GENMASK(21, 18) 40 - #define RG_PE1_H_PLL_BP_VAL(x) ((0xf & (x)) << 18) 41 40 #define RG_PE1_H_PLL_IR GENMASK(15, 12) 42 - #define RG_PE1_H_PLL_IR_VAL(x) ((0xf & (x)) << 12) 43 41 #define RG_PE1_H_PLL_IC GENMASK(11, 8) 44 - #define RG_PE1_H_PLL_IC_VAL(x) ((0xf & (x)) << 8) 45 42 #define RG_PE1_H_PLL_PREDIV GENMASK(7, 6) 46 - #define RG_PE1_H_PLL_PREDIV_VAL(x) ((0x3 & (x)) << 6) 47 43 #define RG_PE1_PLL_DIVEN GENMASK(3, 1) 48 - #define RG_PE1_PLL_DIVEN_VAL(x) ((0x7 & (x)) << 1) 49 44 50 45 #define RG_PE1_H_PLL_FBKSEL_REG 0x4bc 51 46 #define RG_PE1_H_PLL_FBKSEL GENMASK(5, 4) 52 - #define RG_PE1_H_PLL_FBKSEL_VAL(x) ((0x3 & (x)) << 4) 53 47 54 48 #define RG_PE1_H_LCDDS_SSC_PRD_REG 0x4a4 55 49 #define RG_PE1_H_LCDDS_SSC_PRD GENMASK(15, 0) 56 - #define RG_PE1_H_LCDDS_SSC_PRD_VAL(x) ((0xffff & (x)) << 0) 57 50 58 51 #define RG_PE1_H_LCDDS_SSC_DELTA_REG 0x4a8 59 52 #define RG_PE1_H_LCDDS_SSC_DELTA GENMASK(11, 0) 60 - #define RG_PE1_H_LCDDS_SSC_DELTA_VAL(x) ((0xfff & (x)) << 0) 61 53 #define RG_PE1_H_LCDDS_SSC_DELTA1 GENMASK(27, 16) 62 - #define RG_PE1_H_LCDDS_SSC_DELTA1_VAL(x) ((0xff & (x)) << 16) 63 54 64 55 #define RG_PE1_LCDDS_CLK_PH_INV_REG 0x4a0 65 56 #define RG_PE1_LCDDS_CLK_PH_INV BIT(5) 66 57 67 58 #define RG_PE1_H_PLL_BR_REG 0x4ac 68 59 #define RG_PE1_H_PLL_BR GENMASK(18, 16) 69 - #define RG_PE1_H_PLL_BR_VAL(x) ((0x7 & (x)) << 16) 70 60 71 61 #define RG_PE1_MSTCKDIV_REG 0x414 72 62 #define RG_PE1_MSTCKDIV GENMASK(7, 6) 73 - #define RG_PE1_MSTCKDIV_VAL(x) ((0x3 & (x)) << 6) 74 63 75 64 #define RG_PE1_FRC_MSTCKDIV BIT(5) 76 65 77 - #define XTAL_MODE_SEL_SHIFT 6 78 - #define XTAL_MODE_SEL_MASK 0x7 66 + #define XTAL_MASK GENMASK(7, 6) 79 67 80 68 #define MAX_PHYS 2 81 69 ··· 85 99 bool bypass_pipe_rst; 86 100 }; 87 101 88 - static inline u32 phy_read(struct mt7621_pci_phy *phy, u32 reg) 89 - { 90 - u32 val; 91 - 92 - regmap_read(phy->regmap, reg, &val); 93 - 94 - return val; 95 - } 96 - 97 - static inline void phy_write(struct mt7621_pci_phy *phy, u32 val, u32 reg) 98 - { 99 - regmap_write(phy->regmap, reg, val); 100 - } 101 - 102 102 static inline void mt7621_phy_rmw(struct mt7621_pci_phy *phy, 103 103 u32 reg, u32 clr, u32 set) 104 104 { 105 - u32 val = phy_read(phy, reg); 105 + u32 val; 106 106 107 + /* 108 + * We cannot use 'regmap_write_bits' here because internally 109 + * 'set' is masked before is set to the value that will be 110 + * written to the register. That way results in no reliable 111 + * pci setup. Avoid to mask 'set' before set value to 'val' 112 + * completely avoid the problem. 113 + */ 114 + regmap_read(phy->regmap, reg, &val); 107 115 val &= ~clr; 108 116 val |= set; 109 - phy_write(phy, val, reg); 117 + regmap_write(phy->regmap, reg, val); 110 118 } 111 119 112 120 static void mt7621_bypass_pipe_rst(struct mt7621_pci_phy *phy) ··· 121 141 struct device *dev = phy->dev; 122 142 u32 xtal_mode; 123 143 124 - xtal_mode = (rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG0) 125 - >> XTAL_MODE_SEL_SHIFT) & XTAL_MODE_SEL_MASK; 144 + xtal_mode = FIELD_GET(XTAL_MASK, rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG0)); 126 145 127 146 /* Set PCIe Port PHY to disable SSC */ 128 147 /* Debug Xtal Type */ 129 148 mt7621_phy_rmw(phy, RG_PE1_FRC_H_XTAL_REG, 130 149 RG_PE1_FRC_H_XTAL_TYPE | RG_PE1_H_XTAL_TYPE, 131 - RG_PE1_FRC_H_XTAL_TYPE | RG_PE1_H_XTAL_TYPE_VAL(0x00)); 150 + RG_PE1_FRC_H_XTAL_TYPE | 151 + FIELD_PREP(RG_PE1_H_XTAL_TYPE, 0x00)); 132 152 133 153 /* disable port */ 134 - mt7621_phy_rmw(phy, RG_PE1_FRC_PHY_REG, 135 - RG_PE1_PHY_EN, RG_PE1_FRC_PHY_EN); 154 + mt7621_phy_rmw(phy, RG_PE1_FRC_PHY_REG, RG_PE1_PHY_EN, 155 + RG_PE1_FRC_PHY_EN); 136 156 137 157 if (phy->has_dual_port) { 138 158 mt7621_phy_rmw(phy, RG_PE1_FRC_PHY_REG + RG_P0_TO_P1_WIDTH, ··· 141 161 142 162 if (xtal_mode <= 5 && xtal_mode >= 3) { /* 40MHz Xtal */ 143 163 /* Set Pre-divider ratio (for host mode) */ 144 - mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, 145 - RG_PE1_H_PLL_PREDIV, 146 - RG_PE1_H_PLL_PREDIV_VAL(0x01)); 147 - dev_info(dev, "Xtal is 40MHz\n"); 164 + mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, RG_PE1_H_PLL_PREDIV, 165 + FIELD_PREP(RG_PE1_H_PLL_PREDIV, 0x01)); 166 + 167 + dev_dbg(dev, "Xtal is 40MHz\n"); 148 168 } else if (xtal_mode >= 6) { /* 25MHz Xal */ 149 - mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, 150 - RG_PE1_H_PLL_PREDIV, 151 - RG_PE1_H_PLL_PREDIV_VAL(0x00)); 169 + mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, RG_PE1_H_PLL_PREDIV, 170 + FIELD_PREP(RG_PE1_H_PLL_PREDIV, 0x00)); 171 + 152 172 /* Select feedback clock */ 153 173 mt7621_phy_rmw(phy, RG_PE1_H_PLL_FBKSEL_REG, 154 174 RG_PE1_H_PLL_FBKSEL, 155 - RG_PE1_H_PLL_FBKSEL_VAL(0x01)); 175 + FIELD_PREP(RG_PE1_H_PLL_FBKSEL, 0x01)); 176 + 156 177 /* DDS NCPO PCW (for host mode) */ 157 178 mt7621_phy_rmw(phy, RG_PE1_H_LCDDS_SSC_PRD_REG, 158 179 RG_PE1_H_LCDDS_SSC_PRD, 159 - RG_PE1_H_LCDDS_SSC_PRD_VAL(0x18000000)); 180 + FIELD_PREP(RG_PE1_H_LCDDS_SSC_PRD, 0x00)); 181 + 160 182 /* DDS SSC dither period control */ 161 183 mt7621_phy_rmw(phy, RG_PE1_H_LCDDS_SSC_PRD_REG, 162 184 RG_PE1_H_LCDDS_SSC_PRD, 163 - RG_PE1_H_LCDDS_SSC_PRD_VAL(0x18d)); 185 + FIELD_PREP(RG_PE1_H_LCDDS_SSC_PRD, 0x18d)); 186 + 164 187 /* DDS SSC dither amplitude control */ 165 188 mt7621_phy_rmw(phy, RG_PE1_H_LCDDS_SSC_DELTA_REG, 166 189 RG_PE1_H_LCDDS_SSC_DELTA | 167 190 RG_PE1_H_LCDDS_SSC_DELTA1, 168 - RG_PE1_H_LCDDS_SSC_DELTA_VAL(0x4a) | 169 - RG_PE1_H_LCDDS_SSC_DELTA1_VAL(0x4a)); 170 - dev_info(dev, "Xtal is 25MHz\n"); 171 - } else { /* 20MHz Xtal */ 172 - mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, 173 - RG_PE1_H_PLL_PREDIV, 174 - RG_PE1_H_PLL_PREDIV_VAL(0x00)); 191 + FIELD_PREP(RG_PE1_H_LCDDS_SSC_DELTA, 0x4a) | 192 + FIELD_PREP(RG_PE1_H_LCDDS_SSC_DELTA1, 0x4a)); 175 193 176 - dev_info(dev, "Xtal is 20MHz\n"); 194 + dev_dbg(dev, "Xtal is 25MHz\n"); 195 + } else { /* 20MHz Xtal */ 196 + mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, RG_PE1_H_PLL_PREDIV, 197 + FIELD_PREP(RG_PE1_H_PLL_PREDIV, 0x00)); 198 + 199 + dev_dbg(dev, "Xtal is 20MHz\n"); 177 200 } 178 201 179 202 /* DDS clock inversion */ ··· 187 204 mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG, 188 205 RG_PE1_H_PLL_BC | RG_PE1_H_PLL_BP | RG_PE1_H_PLL_IR | 189 206 RG_PE1_H_PLL_IC | RG_PE1_PLL_DIVEN, 190 - RG_PE1_H_PLL_BC_VAL(0x02) | RG_PE1_H_PLL_BP_VAL(0x06) | 191 - RG_PE1_H_PLL_IR_VAL(0x02) | RG_PE1_H_PLL_IC_VAL(0x01) | 192 - RG_PE1_PLL_DIVEN_VAL(0x02)); 207 + FIELD_PREP(RG_PE1_H_PLL_BC, 0x02) | 208 + FIELD_PREP(RG_PE1_H_PLL_BP, 0x06) | 209 + FIELD_PREP(RG_PE1_H_PLL_IR, 0x02) | 210 + FIELD_PREP(RG_PE1_H_PLL_IC, 0x01) | 211 + FIELD_PREP(RG_PE1_PLL_DIVEN, 0x02)); 193 212 194 - mt7621_phy_rmw(phy, RG_PE1_H_PLL_BR_REG, 195 - RG_PE1_H_PLL_BR, RG_PE1_H_PLL_BR_VAL(0x00)); 213 + mt7621_phy_rmw(phy, RG_PE1_H_PLL_BR_REG, RG_PE1_H_PLL_BR, 214 + FIELD_PREP(RG_PE1_H_PLL_BR, 0x00)); 196 215 197 216 if (xtal_mode <= 5 && xtal_mode >= 3) { /* 40MHz Xtal */ 198 217 /* set force mode enable of da_pe1_mstckdiv */ 199 218 mt7621_phy_rmw(phy, RG_PE1_MSTCKDIV_REG, 200 219 RG_PE1_MSTCKDIV | RG_PE1_FRC_MSTCKDIV, 201 - RG_PE1_MSTCKDIV_VAL(0x01) | RG_PE1_FRC_MSTCKDIV); 220 + FIELD_PREP(RG_PE1_MSTCKDIV, 0x01) | 221 + RG_PE1_FRC_MSTCKDIV); 202 222 } 203 223 } 204 224 ··· 295 309 const struct soc_device_attribute *attr; 296 310 struct phy_provider *provider; 297 311 struct mt7621_pci_phy *phy; 298 - struct resource *res; 299 312 300 313 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); 301 314 if (!phy) ··· 307 322 phy->dev = dev; 308 323 platform_set_drvdata(pdev, phy); 309 324 310 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 311 - if (!res) { 312 - dev_err(dev, "failed to get address resource\n"); 313 - return -ENXIO; 314 - } 315 - 316 - phy->port_base = devm_ioremap_resource(dev, res); 325 + phy->port_base = devm_platform_ioremap_resource(pdev, 0); 317 326 if (IS_ERR(phy->port_base)) { 318 327 dev_err(dev, "failed to remap phy regs\n"); 319 328 return PTR_ERR(phy->port_base); ··· 335 356 { .compatible = "mediatek,mt7621-pci-phy" }, 336 357 {}, 337 358 }; 338 - MODULE_DEVICE_TABLE(of, mt7621_pci_ids); 359 + MODULE_DEVICE_TABLE(of, mt7621_pci_phy_ids); 339 360 340 361 static struct platform_driver mt7621_pci_phy_driver = { 341 362 .probe = mt7621_pci_phy_probe,
+1 -1
drivers/usb/phy/phy-jz4770.c
··· 350 350 .probe = jz4770_phy_probe, 351 351 .driver = { 352 352 .name = "jz4770-phy", 353 - .of_match_table = of_match_ptr(ingenic_usb_phy_of_matches), 353 + .of_match_table = ingenic_usb_phy_of_matches, 354 354 }, 355 355 }; 356 356 module_platform_driver(ingenic_phy_driver);