Skip to contentSkip to conversation

MT7621 PCIe PHY

PATCH Superseded Sergio Paracuellos 2 participants 7 messages Nov 19, 2020 – Nov 21, 2020

Subsystems (6)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Sergio Paracuellos

author maintainer
#0 lore raw

v5 cover MT7621 PCIe PHY

This series adds support for the PCIe PHY found in the Mediatek MT7621 SoC.

There is also a 'mt7621-pci' driver which is the controller part which is still in staging and is a client of this phy.

Both drivers have been tested together in a gnubee1 board.

This series are rebased on the top of linux-next:
commit 4e78c578cb98 ("Add linux-next specific files for 20201030")

Changes in v5:
- PATCH 1/4: Recollect Rob's Reviewed-by of bindings.
- PATCH 4/4: Recollect Greg's Acked-by for removing stuff from staging area.
- Make Vinod's review comments changes in [0]:
* Use FIELD_GET and FIELD_PREP apis and avoid multiple *_VAL and *_SHIFT custom definitions.
* Remove phy-read and phy-write internal functions and directly call regmap_read and regmap_write in 'mt7621_phy_rmw'.
* Change some traces from info to debug log level.
* Note that I have maintained 'mt7621_phy_rmw' instead of use 'regmap_update_bits'. This is because in order to get a reliable boot registers must be written event the contained value in that register is the same. I have preferred doing in this way instead of using 'regmap_update_bits_base' passing 'false' for async and 'true' for the force write. If this way of using 'regmap_update_bits_base' is preferred just let me know.

Changes in v4:
- Bindings moved from txt to yaml so previous Rob's Reviewed-by is not in the new patch with the yaml file.
- 'phy-cells' property means now if phy is dual-ported.
- Avoid custom 'xlate' function and properly set registers when the phy is dual ported.
- Add use of 'builtin_platform_driver'.
- Added a patch including myself as maintainer in the MAINTAINERS file.
- Add a patch removing patch from staging to make easier the complete inclusion and avoid possible problems might appear in 'linux-next' if the series are included.

Changes in v3:
- Recollect Rob's Reviewed-by of bindings.
- Make Kishon Vijay suggested changes in v2:
(See https://lkml.org/lkml/2019/4/17/53)
- Kconfig:
* Add depends on COMPILE_TEST
* Select REGMAP_MMIO
- Make use of 'soc_device_attribute' and 'soc_device_match'
- Use regmap mmio API instead of directly 'readl' and 'writel'.
- Use 'platform_get_resource' instead of 'of_address_to_resource'.

Changes in v2:
- Reorder patches to get bindings first in the series.
- Don't use child nodes in the device tree. Use #phy-cells=1 instead.
- Update driver code with new 'xlate' function for the new device tree.
- Minor changes in driver's macros changing some spaces to tabs.

Thanks in advance for your time.

Best regards,
Sergio Paracuellos

[0]: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2020-November/148864.html

Sergio Paracuellos (4):
dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY
phy: ralink: Add PHY driver for MT7621 PCIe PHY
MAINTAINERS: add MT7621 PHY PCI maintainer
staging: mt7621-pci-phy: remove driver from staging

 .../phy}/mediatek,mt7621-pci-phy.yaml         |   0
 MAINTAINERS                                   |   6 +
 drivers/phy/ralink/Kconfig                    |   8 ++
 drivers/phy/ralink/Makefile                   |   1 +
 .../ralink/phy-mt7621-pci.c}                  | 103 +++++++-----------
 drivers/staging/Kconfig                       |   2 -
 drivers/staging/Makefile                      |   1 -
 drivers/staging/mt7621-pci-phy/Kconfig        |   8 --
 drivers/staging/mt7621-pci-phy/Makefile       |   2 -
 drivers/staging/mt7621-pci-phy/TODO           |   4 -
 10 files changed, 53 insertions(+), 82 deletions(-)
 rename {drivers/staging/mt7621-pci-phy => Documentation/devicetree/bindings/phy}/mediatek,mt7621-pci-phy.yaml (100%)
 rename drivers/{staging/mt7621-pci-phy/pci-mt7621-phy.c => phy/ralink/phy-mt7621-pci.c} (76%)
 delete mode 100644 drivers/staging/mt7621-pci-phy/Kconfig
 delete mode 100644 drivers/staging/mt7621-pci-phy/Makefile
 delete mode 100644 drivers/staging/mt7621-pci-phy/TODO
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v5 1/4 dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY

Add bindings to describe Mediatek MT7621 PCIe PHY.

---
 .../bindings/phy/mediatek,mt7621-pci-phy.yaml | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.yaml
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.yaml new file +36 -0
new file mode 100644
index 000000000000..cf32bbc45b5d
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%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
author maintainer
#2 lore raw

PATCH v5 2/4 phy: ralink: Add PHY driver for MT7621 PCIe PHY

In reply to Sergio Paracuellos

This patch adds a driver for the PCIe PHY of MT7621 SoC.

---
 drivers/phy/ralink/Kconfig          |   8 +
 drivers/phy/ralink/Makefile         |   1 +
 drivers/phy/ralink/phy-mt7621-pci.c | 346 ++++++++++++++++++++++++++++
 3 files changed, 355 insertions(+)
 create mode 100644 drivers/phy/ralink/phy-mt7621-pci.c
drivers/phy/ralink/Kconfig +8 -0
index da982c9cffb3..2fabb14d2998 100644
@@ -2,6 +2,14 @@
 #
 # PHY drivers for Ralink platforms.
 #
+config PHY_MT7621_PCI
+	tristate "MediaTek MT7621 PCI PHY Driver"
+	depends on (RALINK || COMPILE_TEST) && OF
+	select GENERIC_PHY
+	select REGMAP_MMIO
+	help
+	  Say 'Y' here to add support for MediaTek MT7621 PCI PHY driver,
+
 config PHY_RALINK_USB
 	tristate "Ralink USB PHY driver"
 	depends on RALINK || COMPILE_TEST
drivers/phy/ralink/Makefile +1 -0
index d8d3ffcf0a15..cda2a4a7ca5e 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_PHY_MT7621_PCI)	+= phy-mt7621-pci.o
 obj-$(CONFIG_PHY_RALINK_USB)	+= phy-ralink-usb.o
drivers/phy/ralink/phy-mt7621-pci.c new file +346 -0

346 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH v5 3/4 MAINTAINERS: add MT7621 PHY PCI maintainer

In reply to Sergio Paracuellos

Adding myself as maintainer for mt7621 pci phy driver.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index aefbbecfb266..31f808e58e73 100644
@@ -11100,6 +11100,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/i2c/i2c-mt7621.txt
 F:	drivers/i2c/busses/i2c-mt7621.c
 
+MEDIATEK MT7621 PHY PCI DRIVER
+M:	Sergio Paracuellos <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.yaml
+F:	drivers/phy/ralink/phy-mt7621-pci.c
+
 MEDIATEK NAND CONTROLLER DRIVER
 L:	[email protected]
 S:	Orphan
Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH v5 4/4 staging: mt7621-pci-phy: remove driver from staging

In reply to Sergio Paracuellos

Remove this driver from staging because it has been moved into its properly place in the kernel.

---
 drivers/staging/Kconfig                       |   2 -
 drivers/staging/Makefile                      |   1 -
 drivers/staging/mt7621-pci-phy/Kconfig        |   8 -
 drivers/staging/mt7621-pci-phy/Makefile       |   2 -
 drivers/staging/mt7621-pci-phy/TODO           |   4 -
 .../mediatek,mt7621-pci-phy.yaml              |  36 --
 .../staging/mt7621-pci-phy/pci-mt7621-phy.c   | 373 ------------------
 7 files changed, 426 deletions(-)
 delete mode 100644 drivers/staging/mt7621-pci-phy/Kconfig
 delete mode 100644 drivers/staging/mt7621-pci-phy/Makefile
 delete mode 100644 drivers/staging/mt7621-pci-phy/TODO
 delete mode 100644 drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.yaml
 delete mode 100644 drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
drivers/staging/Kconfig +0 -2
index 2d0310448eba..8a03ba56def5 100644
@@ -94,8 +94,6 @@ source "drivers/staging/pi433/Kconfig"
 
 source "drivers/staging/mt7621-pci/Kconfig"
 
-source "drivers/staging/mt7621-pci-phy/Kconfig"
-
 source "drivers/staging/mt7621-pinctrl/Kconfig"
 
 source "drivers/staging/mt7621-dma/Kconfig"
drivers/staging/Makefile +0 -1
index 757a892ab5b9..39319161301c 100644
@@ -37,7 +37,6 @@ obj-$(CONFIG_GREYBUS)		+= greybus/
 obj-$(CONFIG_BCM2835_VCHIQ)	+= vc04_services/
 obj-$(CONFIG_PI433)		+= pi433/
 obj-$(CONFIG_PCI_MT7621)	+= mt7621-pci/
-obj-$(CONFIG_PCI_MT7621_PHY)	+= mt7621-pci-phy/
 obj-$(CONFIG_PINCTRL_RT2880)	+= mt7621-pinctrl/
 obj-$(CONFIG_SOC_MT7621)	+= mt7621-dma/
 obj-$(CONFIG_DMA_RALINK)	+= ralink-gdma/
drivers/staging/mt7621-pci-phy/Kconfig deleted +0 -8
deleted file mode 100644
index 263e0a91c424..000000000000
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config PCI_MT7621_PHY
-	tristate "MediaTek MT7621 PCI PHY Driver"
-	depends on RALINK && OF
-	select GENERIC_PHY
-	help
-	  Say 'Y' here to add support for MediaTek MT7621 PCI PHY driver,
-
drivers/staging/mt7621-pci-phy/Makefile deleted +0 -2
deleted file mode 100644
index b4d99b9119e0..000000000000
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_PCI_MT7621_PHY)       += pci-mt7621-phy.o
drivers/staging/mt7621-pci-phy/TODO deleted +0 -4
deleted file mode 100644
index a255e8f753eb..000000000000
@@ -1,4 +0,0 @@
-
-- general code review and cleanup
-
-Cc:  NeilBrown <[email protected]> and Sergio Paracuellos <[email protected]>
drivers/staging/mt7621-pci-phy/mediatek,mt7621-pci-phy.yaml deleted +0 -36
deleted file mode 100644
index cf32bbc45b5d..000000000000
@@ -1,36 +0,0 @@
-# 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>;
-    };
drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c deleted +0 -373

373 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#5 lore raw
In reply to Sergio Paracuellos

Hi Vinod,

Quoted 21 lines · Sergio Paracuellos

This series adds support for the PCIe PHY found in the Mediatek MT7621 SoC.

There is also a 'mt7621-pci' driver which is the controller part which is still in staging and is a client of this phy.

Both drivers have been tested together in a gnubee1 board.

This series are rebased on the top of linux-next:
commit 4e78c578cb98 ("Add linux-next specific files for 20201030")

Changes in v5:
- PATCH 1/4: Recollect Rob's Reviewed-by of bindings.
- PATCH 4/4: Recollect Greg's Acked-by for removing stuff from staging area.
- Make Vinod's review comments changes in [0]:
* Use FIELD_GET and FIELD_PREP apis and avoid multiple *_VAL and *_SHIFT custom definitions.
* Remove phy-read and phy-write internal functions and directly call regmap_read and regmap_write in 'mt7621_phy_rmw'.

Quoted 8 lines

* Change some traces from info to debug log level.
* Note that I have maintained 'mt7621_phy_rmw' instead of use 'regmap_update_bits'. This is because in order to get a reliable boot registers must be written event the contained value in that register is the same. I have preferred doing in this way instead of using 'regmap_update_bits_base' passing 'false' for async and 'true' for the force write. If this way of using 'regmap_update_bits_base' is preferred just let me know.

I notice we already have 'regmap_write_bits' function. I will use this and avoid mt7621_phy_rmw
and send v6 of this series.

Also, do you have any preference of where you want this series to be rebased on?

Best regards,
Sergio Paracuellos

Quoted 64 lines

Changes in v4:
- Bindings moved from txt to yaml so previous Rob's Reviewed-by is not in the new patch with the yaml file.
- 'phy-cells' property means now if phy is dual-ported.
- Avoid custom 'xlate' function and properly set registers when the phy is dual ported.
- Add use of 'builtin_platform_driver'.
- Added a patch including myself as maintainer in the MAINTAINERS file.
- Add a patch removing patch from staging to make easier the complete inclusion and avoid possible problems might appear in 'linux-next' if the series are included.

Changes in v3:
- Recollect Rob's Reviewed-by of bindings.
- Make Kishon Vijay suggested changes in v2:

   (See https://lkml.org/lkml/2019/4/17/53)

- Kconfig:
* Add depends on COMPILE_TEST
* Select REGMAP_MMIO
- Make use of 'soc_device_attribute' and 'soc_device_match'
- Use regmap mmio API instead of directly 'readl' and 'writel'.
- Use 'platform_get_resource' instead of 'of_address_to_resource'.

Changes in v2:
- Reorder patches to get bindings first in the series.
- Don't use child nodes in the device tree. Use #phy-cells=1 instead.
- Update driver code with new 'xlate' function for the new device tree.
- Minor changes in driver's macros changing some spaces to tabs.

Thanks in advance for your time.

Best regards,
Sergio Paracuellos

[0]: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2020-November/148864.html

Sergio Paracuellos (4):
dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY
phy: ralink: Add PHY driver for MT7621 PCIe PHY
MAINTAINERS: add MT7621 PHY PCI maintainer
staging: mt7621-pci-phy: remove driver from staging

 .../phy}/mediatek,mt7621-pci-phy.yaml         |   0
 MAINTAINERS                                   |   6 +
 drivers/phy/ralink/Kconfig                    |   8 ++
 drivers/phy/ralink/Makefile                   |   1 +
 .../ralink/phy-mt7621-pci.c}                  | 103 +++++++-----------
 drivers/staging/Kconfig                       |   2 -
 drivers/staging/Makefile                      |   1 -
 drivers/staging/mt7621-pci-phy/Kconfig        |   8 --
 drivers/staging/mt7621-pci-phy/Makefile       |   2 -
 drivers/staging/mt7621-pci-phy/TODO           |   4 -
 10 files changed, 53 insertions(+), 82 deletions(-)
 rename {drivers/staging/mt7621-pci-phy => Documentation/devicetree/bindings/phy}/mediatek,mt7621-pci-phy.yaml (100%)
 rename drivers/{staging/mt7621-pci-phy/pci-mt7621-phy.c => phy/ralink/phy-mt7621-pci.c} (76%)
 delete mode 100644 drivers/staging/mt7621-pci-phy/Kconfig
 delete mode 100644 drivers/staging/mt7621-pci-phy/Makefile
 delete mode 100644 drivers/staging/mt7621-pci-phy/TODO

--
2.25.1

maintainer
#6 lore raw
Quoted 34 lines · Sergio Paracuellos

Hi Vinod,

Quoted 21 lines · Sergio Paracuellos

This series adds support for the PCIe PHY found in the Mediatek MT7621 SoC.

There is also a 'mt7621-pci' driver which is the controller part which is still in staging and is a client of this phy.

Both drivers have been tested together in a gnubee1 board.

This series are rebased on the top of linux-next:
commit 4e78c578cb98 ("Add linux-next specific files for 20201030")

Changes in v5:
- PATCH 1/4: Recollect Rob's Reviewed-by of bindings.
- PATCH 4/4: Recollect Greg's Acked-by for removing stuff from staging area.
- Make Vinod's review comments changes in [0]:
* Use FIELD_GET and FIELD_PREP apis and avoid multiple *_VAL and *_SHIFT custom definitions.
* Remove phy-read and phy-write internal functions and directly call regmap_read and regmap_write in 'mt7621_phy_rmw'.

Quoted 8 lines

* Change some traces from info to debug log level.
* Note that I have maintained 'mt7621_phy_rmw' instead of use 'regmap_update_bits'. This is because in order to get a reliable boot registers must be written event the contained value in that register is the same. I have preferred doing in this way instead of using 'regmap_update_bits_base' passing 'false' for async and 'true' for the force write. If this way of using 'regmap_update_bits_base' is preferred just let me know.

Quoted 5 lines

I notice we already have 'regmap_write_bits' function. I will use this and avoid mt7621_phy_rmw
and send v6 of this series.

Also, do you have any preference of where you want this series to be rebased on?

Phy-next please

Signature · 1 line
~Vinod