Skip to contentSkip to conversation

add support for clocks on MT7981 SoC

PATCH Superseded Daniel Golle 3 participants 6 messages Jan 19, 2023 – Jan 23, 2023

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover add support for clocks on MT7981 SoC

The MediaTek MT7981 SoC is quite similar to its big sibling, the MT7986. Hence most drivers can be reused and not much is missing the get also this SoC working on mainline Linux.

Start with a cleaned-up version of the clock drivers, based on what can also be found in MediaTek's SDK[1].

[1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/refs/heads/master/target/linux/mediatek/files-5.4/drivers/clk/mediatek/clk-mt7981.c

Daniel Golle (2):
dt-bindings: clock: add some compatible strings for MT7981
clk: mediatek: add MT7981 clock support

 .../bindings/clock/mediatek,apmixedsys.yaml   |   1 +
 .../bindings/clock/mediatek,topckgen.yaml     |   1 +
 drivers/clk/mediatek/Kconfig                  |  17 +
 drivers/clk/mediatek/Makefile                 |   4 +
 drivers/clk/mediatek/clk-mt7981-apmixed.c     | 103 +++++
 drivers/clk/mediatek/clk-mt7981-eth.c         | 138 ++++++
 drivers/clk/mediatek/clk-mt7981-infracfg.c    | 236 ++++++++++
 drivers/clk/mediatek/clk-mt7981-topckgen.c    | 431 ++++++++++++++++++
 include/dt-bindings/clock/mt7981-clk.h        | 215 +++++++++
 9 files changed, 1146 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt7981-apmixed.c
 create mode 100644 drivers/clk/mediatek/clk-mt7981-eth.c
 create mode 100644 drivers/clk/mediatek/clk-mt7981-infracfg.c
 create mode 100644 drivers/clk/mediatek/clk-mt7981-topckgen.c
 create mode 100644 include/dt-bindings/clock/mt7981-clk.h

base-commit: aa5c49149a823599764e6953229b028e4bf6e9cc

Signature · 1 line
2.39.1
#1 lore raw

PATCH 1/2 dt-bindings: clock: add some compatible strings for MT7981

Add compatible strings for MT7981 to existing binding documenation at mediatek,apmixedsys.yaml and mediatek,topckgen.yaml.

---
 Documentation/devicetree/bindings/clock/mediatek,apmixedsys.yaml | 1 +
 Documentation/devicetree/bindings/clock/mediatek,topckgen.yaml   | 1 +
 2 files changed, 2 insertions(+)
Documentation/devicetree/bindings/clock/mediatek,apmixedsys.yaml +1 -0
index 731bfe0408c20..dae25dba4ba69 100644
@@ -20,6 +20,7 @@ properties:
       - enum:
           - mediatek,mt6797-apmixedsys
           - mediatek,mt7622-apmixedsys
+          - mediatek,mt7981-apmixedsys
           - mediatek,mt7986-apmixedsys
           - mediatek,mt8135-apmixedsys
           - mediatek,mt8173-apmixedsys
Documentation/devicetree/bindings/clock/mediatek,topckgen.yaml +1 -0
index 81531b5b0db79..0fdf564148334 100644
@@ -35,6 +35,7 @@ properties:
               - mediatek,mt6779-topckgen
               - mediatek,mt6795-topckgen
               - mediatek,mt7629-topckgen
+              - mediatek,mt7981-topckgen
               - mediatek,mt7986-topckgen
               - mediatek,mt8167-topckgen
               - mediatek,mt8183-topckgen
Signature · 1 line
2.39.1
#2 lore raw

Re: [PATCH 1/2] dt-bindings: clock: add some compatible strings for MT7981

Il 19/01/23 15:11, Daniel Golle ha scritto:

Quoted 5 lines

Add compatible strings for MT7981 to existing binding documenation at mediatek,apmixedsys.yaml and mediatek,topckgen.yaml.

dt-bindings: clock: Add apmixedsys/topckgen compatibles for MT7981

looks better as a title... :-)

Regards,
Angelo

Quoted 5 lines
---
  Documentation/devicetree/bindings/clock/mediatek,apmixedsys.yaml | 1 +
  Documentation/devicetree/bindings/clock/mediatek,topckgen.yaml   | 1 +
  2 files changed, 2 insertions(+)
#3 lore raw

PATCH 2/2 clk: mediatek: add MT7981 clock support

In reply to Daniel Golle

Add MT7986 clock support, include topckgen, apmixedsys, infracfg and ethernet subsystem clocks.

The drivers are based on clk-mt7981.c which can be found in MediaTek's SDK sources. To be fit for upstream inclusion the driver has been split into clock domains and the infracfg part has been significantly de-bloated by removing all the 1:1 factors (aliases).

---
 drivers/clk/mediatek/Kconfig               |  17 +
 drivers/clk/mediatek/Makefile              |   4 +
 drivers/clk/mediatek/clk-mt7981-apmixed.c  | 103 +++++
 drivers/clk/mediatek/clk-mt7981-eth.c      | 138 +++++++
 drivers/clk/mediatek/clk-mt7981-infracfg.c | 236 +++++++++++
 drivers/clk/mediatek/clk-mt7981-topckgen.c | 431 +++++++++++++++++++++
 include/dt-bindings/clock/mt7981-clk.h     | 215 ++++++++++
 7 files changed, 1144 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt7981-apmixed.c
 create mode 100644 drivers/clk/mediatek/clk-mt7981-eth.c
 create mode 100644 drivers/clk/mediatek/clk-mt7981-infracfg.c
 create mode 100644 drivers/clk/mediatek/clk-mt7981-topckgen.c
 create mode 100644 include/dt-bindings/clock/mt7981-clk.h
drivers/clk/mediatek/Kconfig +17 -0
index 22e8e79475ee4..c20d03895f382 100644
@@ -388,6 +388,23 @@ config COMMON_CLK_MT7629_HIFSYS
 	  This driver supports MediaTek MT7629 HIFSYS clocks providing
 	  to PCI-E and USB.
 
+config COMMON_CLK_MT7981
+	bool "Clock driver for MediaTek MT7981"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	select COMMON_CLK_MEDIATEK
+	default ARCH_MEDIATEK
+	help
+	  This driver supports MediaTek MT7981 basic clocks and clocks
+	  required for various peripherals found on this SoC.
+
+config COMMON_CLK_MT7981_ETHSYS
+	bool "Clock driver for MediaTek MT7981 ETHSYS"
+	depends on COMMON_CLK_MT7981
+	default COMMON_CLK_MT7981
+	help
+	  This driver adds support for clocks for Ethernet and SGMII
+	  required on MediaTek MT7981 SoC.
+
 config COMMON_CLK_MT7986
 	bool "Clock driver for MediaTek MT7986"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +4 -0
index e24080fd6e7f7..5d6f3cd34acee 100644
@@ -53,6 +53,10 @@ obj-$(CONFIG_COMMON_CLK_MT7622_AUDSYS) += clk-mt7622-aud.o
 obj-$(CONFIG_COMMON_CLK_MT7629) += clk-mt7629.o
 obj-$(CONFIG_COMMON_CLK_MT7629_ETHSYS) += clk-mt7629-eth.o
 obj-$(CONFIG_COMMON_CLK_MT7629_HIFSYS) += clk-mt7629-hif.o
+obj-$(CONFIG_COMMON_CLK_MT7981) += clk-mt7981-apmixed.o
+obj-$(CONFIG_COMMON_CLK_MT7981) += clk-mt7981-topckgen.o
+obj-$(CONFIG_COMMON_CLK_MT7981) += clk-mt7981-infracfg.o
+obj-$(CONFIG_COMMON_CLK_MT7981_ETHSYS) += clk-mt7981-eth.o
 obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-apmixed.o
 obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-topckgen.o
 obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-infracfg.o
drivers/clk/mediatek/clk-mt7981-apmixed.c new file +103 -0

103 lines not on this page · raw message

drivers/clk/mediatek/clk-mt7981-eth.c new file +138 -0

138 lines not on this page · raw message

drivers/clk/mediatek/clk-mt7981-infracfg.c new file +236 -0

236 lines not on this page · raw message

drivers/clk/mediatek/clk-mt7981-topckgen.c new file +431 -0

431 lines not on this page · raw message

include/dt-bindings/clock/mt7981-clk.h new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.39.1
#4 lore raw

Re: [PATCH 2/2] clk: mediatek: add MT7981 clock support

Il 19/01/23 15:12, Daniel Golle ha scritto:

Quoted 10 lines

Add MT7986 clock support, include topckgen, apmixedsys, infracfg and ethernet subsystem clocks.

The drivers are based on clk-mt7981.c which can be found in MediaTek's SDK sources. To be fit for upstream inclusion the driver has been split into clock domains and the infracfg part has been significantly de-bloated by removing all the 1:1 factors (aliases).

Quoted 8 lines
---
  drivers/clk/mediatek/Kconfig               |  17 +
  drivers/clk/mediatek/Makefile              |   4 +
  drivers/clk/mediatek/clk-mt7981-apmixed.c  | 103 +++++
  drivers/clk/mediatek/clk-mt7981-eth.c      | 138 +++++++
  drivers/clk/mediatek/clk-mt7981-infracfg.c | 236 +++++++++++
  drivers/clk/mediatek/clk-mt7981-topckgen.c | 431 +++++++++++++++++++++
  include/dt-bindings/clock/mt7981-clk.h     | 215 ++++++++++

dt-bindings go in a different commit; also, please follow binding rules for filenames... mt7981-clk.h -> mediatek,mt7981-clk.h

Quoted 7 lines
  7 files changed, 1144 insertions(+)

create mode 100644 drivers/clk/mediatek/clk-mt7981-apmixed.c create mode 100644 drivers/clk/mediatek/clk-mt7981-eth.c create mode 100644 drivers/clk/mediatek/clk-mt7981-infracfg.c create mode 100644 drivers/clk/mediatek/clk-mt7981-topckgen.c create mode 100644 include/dt-bindings/clock/mt7981-clk.h

Moreover, I have pushed a pretty big cleanup series, which would reduce a bit the size of the drivers that you're trying to introduce, and which is well tested and reviewed: can you please rebase this on top of [1]?

Thanks!

[1]: https://patchwork.kernel.org/project/linux-mediatek/list/?series=711734

Regards,
Angelo

maintainer Acked-by on the v1 series
#5 lore raw

Re: [PATCH 1/2] dt-bindings: clock: add some compatible strings for MT7981

In reply to Daniel Golle
Quoted 10 lines · Daniel Golle

Add compatible strings for MT7981 to existing binding documenation at mediatek,apmixedsys.yaml and mediatek,topckgen.yaml.

---
 Documentation/devicetree/bindings/clock/mediatek,apmixedsys.yaml | 1 +
 Documentation/devicetree/bindings/clock/mediatek,topckgen.yaml   | 1 +
 2 files changed, 2 insertions(+)