phy: mediatek: Add PCIe PHY driver
v6 cover phy: mediatek: Add PCIe PHY driver
These series patches add support for PCIe PHY driver on MediaTek chipsets.
Changes in v6:
1. Remove unnecessary header files;
2. Use FILELD_PREP in bitfield.h to set value.
Changes in v5:
1. Fix typo in kerneldoc: "eFues" => "eFuse".
Changes in v4:
1. Fix no return when calling dev_err_probe.
Changes in v3:
1. Add introductions for structure members;
2. Add SoC dependent data;
3. Dynamically allocate efuse data;
4. Check return value if it's an -EPROBE_DEFER.
Changes in v2:
1. Add specific compatible name;
2. Read NVMEM data at probe time;
3. Fix typos.
Jianjun Wang (2):
dt-bindings: phy: mediatek: Add YAML schema for PCIe PHY
phy: mediatek: Add PCIe PHY driver
.../bindings/phy/mediatek,pcie-phy.yaml | 75 +++++ drivers/phy/mediatek/Kconfig | 11 + drivers/phy/mediatek/Makefile | 1 + drivers/phy/mediatek/phy-mtk-pcie.c | 266 ++++++++++++++++++ 4 files changed, 353 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml create mode 100644 drivers/phy/mediatek/phy-mtk-pcie.c
Signature · 1 line
2.18.0
PATCH v6 1/2 dt-bindings: phy: mediatek: Add YAML schema for PCIe PHY
Add YAML schema documentation for PCIe PHY on MediaTek chipsets.
--- .../bindings/phy/mediatek,pcie-phy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml
Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml new file +75 -0
@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/mediatek,pcie-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek PCIe PHY + +maintainers: + - Jianjun Wang <[email protected]> + +description: | + The PCIe PHY supports physical layer functionality for PCIe Gen3 port. + +properties: + compatible: + const: mediatek,mt8195-pcie-phy + + reg: + maxItems: 1 + + reg-names: + items: + - const: sif + + "#phy-cells": + const: 0 + + nvmem-cells: + maxItems: 7 + description: + Phandles to nvmem cell that contains the efuse data, if unspecified, + default value is used. + + nvmem-cell-names: + items: + - const: glb_intr + - const: tx_ln0_pmos + - const: tx_ln0_nmos + - const: rx_ln0 + - const: tx_ln1_pmos + - const: tx_ln1_nmos + - const: rx_ln1 + + power-domains: + maxItems: 1 + +required: + - compatible + - reg + - reg-names + - "#phy-cells" + +additionalProperties: false + +examples: + - | + phy@11e80000 { + compatible = "mediatek,mt8195-pcie-phy"; + #phy-cells = <0>; + reg = <0x11e80000 0x10000>; + reg-names = "sif"; + nvmem-cells = <&pciephy_glb_intr>, + <&pciephy_tx_ln0_pmos>, + <&pciephy_tx_ln0_nmos>, + <&pciephy_rx_ln0>, + <&pciephy_tx_ln1_pmos>, + <&pciephy_tx_ln1_nmos>, + <&pciephy_rx_ln1>; + nvmem-cell-names = "glb_intr", "tx_ln0_pmos", + "tx_ln0_nmos", "rx_ln0", + "tx_ln1_pmos", "tx_ln1_nmos", + "rx_ln1"; + power-domains = <&spm 2>; + };
Signature · 1 line
2.18.0
Re: [PATCH v6 1/2] dt-bindings: phy: mediatek: Add YAML schema for PCIe PHY
Il 22/04/22 06:11, Jianjun Wang ha scritto:
Quoted 4 lines
Add YAML schema documentation for PCIe PHY on MediaTek chipsets.
Signed-off-by Jianjun Wang <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>
PATCH v6 2/2 phy: mediatek: Add PCIe PHY driver
In reply to Jianjun WangAdd PCIe GEN3 PHY driver support on MediaTek chipsets.
--- drivers/phy/mediatek/Kconfig | 11 ++ drivers/phy/mediatek/Makefile | 1 + drivers/phy/mediatek/phy-mtk-pcie.c | 266 ++++++++++++++++++++++++++++ 3 files changed, 278 insertions(+) create mode 100644 drivers/phy/mediatek/phy-mtk-pcie.c
drivers/phy/mediatek/Kconfig +11 -0
@@ -55,3 +55,14 @@ config PHY_MTK_MIPI_DSI select GENERIC_PHY help Support MIPI DSI for Mediatek SoCs. + +config PHY_MTK_PCIE + tristate "MediaTek PCIe-PHY Driver" + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on OF + select GENERIC_PHY + help + Say 'Y' here to add support for MediaTek PCIe PHY driver. + This driver create the basic PHY instance and provides initialize + callback for PCIe GEN3 port, it supports software efuse + initialization.
drivers/phy/mediatek/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o obj-$(CONFIG_PHY_MTK_UFS) += phy-mtk-ufs.o obj-$(CONFIG_PHY_MTK_XSPHY) += phy-mtk-xsphy.o +obj-$(CONFIG_PHY_MTK_PCIE) += phy-mtk-pcie.o phy-mtk-hdmi-drv-y := phy-mtk-hdmi.o phy-mtk-hdmi-drv-y += phy-mtk-hdmi-mt2701.o
drivers/phy/mediatek/phy-mtk-pcie.c new file +266 -0
266 lines not on this page · raw message
Signature · 1 line
2.18.0
kernel test robot
build botI love your patch! Yet something to improve:
Hi Jianjun,
I love your patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v5.18-rc3 next-20220421] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Jianjun-Wang/phy-mediatek-Add-PCIe-PHY-driver/20220422-121407 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220422/[email protected]/config) compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/c2ea770ff29995df64bc82ad12ece5b671415a62
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jianjun-Wang/phy-mediatek-Add-PCIe-PHY-driver/20220422-121407 git checkout c2ea770ff29995df64bc82ad12ece5b671415a62
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/phy/mediatek/phy-mtk-pcie.c: In function 'mtk_pcie_efuse_set_lane':
>> drivers/phy/mediatek/phy-mtk-pcie.c:92:29: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
92 | FIELD_PREP(EFUSE_LN_TX_PMOS_SEL, data->tx_pmos));
| ^~~~~~~~~~cc1: some warnings being treated as errors
vim +/FIELD_PREP +92 drivers/phy/mediatek/phy-mtk-pcie.c
78
79 static void mtk_pcie_efuse_set_lane(struct mtk_pcie_phy *pcie_phy,
80 unsigned int lane)
81 {
82 struct mtk_pcie_lane_efuse *data = &pcie_phy->efuse[lane];
83 void __iomem *addr;
84
85 if (!data->lane_efuse_supported)
86 return;
87
88 addr = pcie_phy->sif_base + PEXTP_ANA_LN0_TRX_REG +
89 lane * PEXTP_ANA_LANE_OFFSET;
90
91 mtk_phy_update_bits(addr + PEXTP_ANA_TX_REG, EFUSE_LN_TX_PMOS_SEL,
> 92 FIELD_PREP(EFUSE_LN_TX_PMOS_SEL, data->tx_pmos));
93
94 mtk_phy_update_bits(addr + PEXTP_ANA_TX_REG, EFUSE_LN_TX_NMOS_SEL,
95 FIELD_PREP(EFUSE_LN_TX_NMOS_SEL, data->tx_nmos));
96
97 mtk_phy_update_bits(addr + PEXTP_ANA_RX_REG, EFUSE_LN_RX_SEL,
98 FIELD_PREP(EFUSE_LN_RX_SEL, data->rx_data));
99 }100
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp