staging: mt7621-pci-phy: dt: bindings: convert bindings file from txt to yaml
Subsystems (2)
cover staging: mt7621-pci-phy: dt: bindings: convert bindings file from txt to yaml
In order to get this driver a new chance to be properly mainlined convert bindings file into a new yaml one is missing. Previous bindings got the 'Reviewed-by' tag from Rob Herring last year in a second attempt to get this driver mainlined.
See:
- https://patchwork.kernel.org/patch/10878071/
In new version the use of the '#phy-cells' property
has changed a bit. Before, we were using this cell to say which phy was dual ported but we were using three 'phys' and its 'phy-names' properties using instances inside the driver code making it a bit difficult. The fact of re-init registers and so on calling 'phy_init' for the phy1 was also introducing not stable clock signals on hard-resets and the kernel was hanging sometimes. Now we just use two 'phys' with two 'phy-names' nodes and we say which port is dual-ported (phy0 and phy1 share the same phy and it just use different offset in config registers to do the power on. The init process and so on shall be uniq to avoid problems so now the driver controller achieve this situation.
So now, the pci controller has the following:
pcie: pcie@1e140000 {
compatible = "mediatek,mt7621-pci";
...
phys = <&pcie0_phy 1>, <&pcie2_phy 0>;
phy-names = "pcie-phy0", "pcie-phy2";
...
}And the phys are defined as:
pcie0_phy: pcie-phy@1e149000 {
compatible = "mediatek,mt7621-pci-phy";
reg = <0x1e149000 0x0700>;
#phy-cells = <1>;
};pcie2_phy: pcie-phy@1e14a000 {
compatible = "mediatek,mt7621-pci-phy";
reg = <0x1e14a000 0x0700>;
#phy-cells = <1>;
};Doing in this way we get a deterministic behaviour and stable pci clocks for both soft and hard resets and the phy driver code got simplified a lot.
Rob, It would be nice to know if this is a valid approach.
Thanks in advance for your time.
Best regards,
Sergio Paracuellos
Sergio Paracuellos (2):
staging: mt7621-pci-phy: dt: bindings: add
mediatek,mt7621-pci-phy.yaml
staging: mt7621-pci-phy: dt: bindings: remove bindings txt file
.../mediatek,mt7621-pci-phy.txt | 28 --------------- .../mediatek,mt7621-pci-phy.yaml | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 28 deletions(-) delete mode 100644 drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.txt create mode 100644 drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.yaml
Signature · 1 line
2.25.1
PATCH 1/2 staging: mt7621-pci-phy: dt: bindings: add mediatek,mt7621-pci-phy.yaml
Add bindings to describe Mediatek MT7621 PCIe PHY.
--- .../mediatek,mt7621-pci-phy.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.yaml
drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.yaml new file +36 -0
@@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/mediatek,mt7621-pci-phy.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Mediatek Mt7621 PCIe PHY Device Tree Bindings + +maintainers: + - Sergio Paracuellos <[email protected]> + +properties: + compatible: + const: mediatek,mt7621-pci-phy + + reg: + maxItems: 1 + + "#phy-cells": + const: 1 + description: selects if the phy is dual-ported + +required: + - compatible + - reg + - "#phy-cells" + +additionalProperties: false + +examples: + - | + pcie0_phy: pcie-phy@1e149000 { + compatible = "mediatek,mt7621-pci-phy"; + reg = <0x1e149000 0x0700>; + #phy-cells = <1>; + };
Signature · 1 line
2.25.1
PATCH 2/2 staging: mt7621-pci-phy: dt: bindings: remove bindings txt file
In reply to Sergio ParacuellosYaml file for bindings has been properly added. Hence, remove the old txt file.
--- .../mediatek,mt7621-pci-phy.txt | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.txt
drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.txt deleted +0 -28
@@ -1,28 +0,0 @@ -Mediatek Mt7621 PCIe PHY - -Required properties: -- compatible: must be "mediatek,mt7621-pci-phy" -- reg: base address and length of the PCIe PHY block -- #phy-cells: must be <1> for pcie0_phy and for pcie1_phy. - -Example: - pcie0_phy: pcie-phy@1e149000 { - compatible = "mediatek,mt7621-pci-phy"; - reg = <0x1e149000 0x0700>; - #phy-cells = <1>; - }; - - pcie1_phy: pcie-phy@1e14a000 { - compatible = "mediatek,mt7621-pci-phy"; - reg = <0x1e14a000 0x0700>; - #phy-cells = <1>; - }; - - /* users of the PCIe phy */ - - pcie: pcie@1e140000 { - ... - ... - phys = <&pcie0_phy 0>, <&pcie0_phy 1>, <&pcie1_phy 0>; - phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2"; - };
Signature · 1 line
2.25.1
Hi Sergio,
thanks for your continuing work on mt7621-pci.
I've looked through you patches and while things seem to make sense I don't have the expertise to review them properly.
I've just a build a kernel based on v5.6.3 with the patches listed below applied from your various emails over the last couple of months.
I have confirm that PCI works and in particular I don't get the cold-boot hangs that are common without these patches. So that is an excellent result.
Thanks,
NeilBrown
7e4350e416ed staging: mt7621-pci: simplify 'mt7621_pcie_init_virtual_bridges' function 283e56fe3f49 staging: mt7621-pci: enable clock bit for each port 5edfd9ca31ad MIPS: ralink: mt7621: introduce 'soc_device' initialization 7ce68fa530ad staging: mt7621-pci: use gpios for properly resetccffb8f9a204 staging: mt7621-pci: change value for 'PERST_DELAY_MS' 840b0de42c22 staging: mt7621-dts: make use of 'reset-gpios' property for pci bd44f2c46e60 staging: mt7621-pci: bindings: update doc accordly to last changes a83cb7040463 staging: mt7621-pci: release gpios after pci initialization 51ae5f557464 staging: mt7621-pci: delete no more needed 'mt7621_reset_port' 6d5af2af8fdd staging: mt7621-pci-phy: add 'mt7621_phy_rmw' to simplify code 8f4e9d5f57ca staging: mt7621-pci: fix io space and properly set resource limits d907c205371d staging: mt7621-pci: fix register to set up virtual bridges 1a87910faf27 staging: mt7621-pci: don't return if get gpio fails dcd05b5bda59 staging: mt7621-pci-phy: avoid to create to different phys for a dual port one b2c3746212ae staging: mt7621-dts: set up only two pcie physef178ecf08bd staging: mt7621-pci: use only two phys from device tree 2553c237ffdc staging: mt7621-pci: change variable to print for slot 0bcb3caed96e staging: mt7621-pci: be sure gpio descriptor is null on fails 07d3877ebc7e staging: mt7621-pci: avoid to poweroff the phy for slot one ba5687b6220b staging: mt7621-dts: gpio 8 and 9 are vendor specific 04c8eb6ff776 staging: mt7621-pci: delete release gpios related code d3b3de21837b staging: mt7621-pci: use builtin_platform_driver()41cd2464a89e staging: mt7621-pci: add myself as a contributor of the driver 815535a5b6ad staging: mt7621-pci-phy: use builtin_platform_driver() 8c26a5eec020 staging: mt7621-pci-phy: re-do 'xtal_mode' detection ccaa47aeb530 staging: mt7621-pci: avoid to set 'iomem_resource' addresses 28dd5daf3b55 staging: mt7621-pci: properly power off dual-ported pcie phy 10e6aa437d6e staging: mt7621-pci-phy: dt: bindings: add mediatek,mt7621-pci-phy.yaml 8dc6eec861d2 staging: mt7621-pci-phy: dt: bindings: remove bindings txt file
Hi Neil,
Quoted 7 lines · NeilBrown
Hi Sergio,
thanks for your continuing work on mt7621-pci.
I've looked through you patches and while things seem to make sense I don't have the expertise to review them properly.
Quoted 6 lines
I've just a build a kernel based on v5.6.3 with the patches listed below applied from your various emails over the last couple of months.
I have confirm that PCI works and in particular I don't get the cold-boot hangs that are common without these patches. So that is an excellent result.
Yes, it seems it is not hanging anymore and that is always a good thing :-). For me the pci phy driver is ready to be mainlined if the two phys approach is correct.
and for the pci controller part I need to review how interrupts are being mapped and
then convert bindings into a yaml file and get feedback about what to do with the clock stuff.
According to this thread and because there is not a clock plan for mt7621 assumptions should not be done for peripherals clocks:
http://archive.lwn.net:8080/devicetree/[email protected]/
So maybe we can just forget about clocks and clock-names stuff in the pci controller binding and do what we are doing with the clock gate now which is setting up the bit manually as other similar drivers do.
What do you think? (your tree has the patches of the thread I am pointed out here applied)
Quoted 3 lines
Thanks,
NeilBrown
Best regards,
Sergio Paracuellos
Quoted 16 lines
7e4350e416edstaging: mt7621-pci: simplify 'mt7621_pcie_init_virtual_bridges' function283e56fe3f49staging: mt7621-pci: enable clock bit for each port5edfd9ca31adMIPS: ralink: mt7621: introduce 'soc_device' initialization7ce68fa530adstaging: mt7621-pci: use gpios for properly resetccffb8f9a204staging: mt7621-pci: change value for 'PERST_DELAY_MS'840b0de42c22staging: mt7621-dts: make use of 'reset-gpios' property for pcibd44f2c46e60staging: mt7621-pci: bindings: update doc accordly to last changesa83cb7040463staging: mt7621-pci: release gpios after pci initialization51ae5f557464staging: mt7621-pci: delete no more needed 'mt7621_reset_port'6d5af2af8fddstaging: mt7621-pci-phy: add 'mt7621_phy_rmw' to simplify code8f4e9d5f57castaging: mt7621-pci: fix io space and properly set resource limitsd907c205371dstaging: mt7621-pci: fix register to set up virtual bridges1a87910faf27staging: mt7621-pci: don't return if get gpio failsdcd05b5bda59staging: mt7621-pci-phy: avoid to create to different phys for a dual port oneb2c3746212aestaging: mt7621-dts: set up only two pcie phys
Quoted 8 lines
ef178ecf08bdstaging: mt7621-pci: use only two phys from device tree2553c237ffdcstaging: mt7621-pci: change variable to print for slot0bcb3caed96estaging: mt7621-pci: be sure gpio descriptor is null on fails07d3877ebc7estaging: mt7621-pci: avoid to poweroff the phy for slot oneba5687b6220bstaging: mt7621-dts: gpio 8 and 9 are vendor specific04c8eb6ff776staging: mt7621-pci: delete release gpios related coded3b3de21837bstaging: mt7621-pci: usebuiltin_platform_driver()41cd2464a89estaging: mt7621-pci: add myself as a contributor of the driver
^^^^
This one is not applied to the tree. This should be do throug the MAINTAINERS file. Will do when this is mainlined.
Quoted 6 lines
815535a5b6adstaging: mt7621-pci-phy: usebuiltin_platform_driver()8c26a5eec020staging: mt7621-pci-phy: re-do 'xtal_mode' detectionccaa47aeb530staging: mt7621-pci: avoid to set 'iomem_resource' addresses28dd5daf3b55staging: mt7621-pci: properly power off dual-ported pcie phy10e6aa437d6estaging: mt7621-pci-phy: dt: bindings: add mediatek,mt7621-pci-phy.yaml8dc6eec861d2staging: mt7621-pci-phy: dt: bindings: remove bindings txt file