Skip to contentSkip to conversation

Add Amlogic A311D2 and Khadas Vim4 Board Support

PATCH Superseded Lucas Tanure 6 participants 25 messages Jun 15, 2023 – Jun 21, 2023

Subsystems (5)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover Add Amlogic A311D2 and Khadas Vim4 Board Support

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic Meson T7 SoC family. This chip is not the same as A311D used in Vim3 board.

Work based on Khadas 5.4 branch:
https://github.com/khadas/linux/tree/khadas-vims-5.4.y

Board Features:
- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

Lucas Tanure (6):
dt-bindings: arm: amlogic: add Amlogic T7 based Khadas VIM4 bindings
dt-bindings: clock: Bindings for Meson T7 clock controller
clk: meson: t7: add peripheral clock controller
dt-bindings: serial: amlogic, meson-uart: support T7
tty: serial: meson: Added T7 SOC compatibility
arm64: dts: meson-t7-a311d2-khadas-vim4: add initial device-tree

 .../devicetree/bindings/arm/amlogic.yaml      |    7 +
 .../bindings/clock/amlogic,mesont7.yaml       |   69 +
 .../bindings/serial/amlogic,meson-uart.yaml   |    1 +
 arch/arm64/boot/dts/amlogic/Makefile          |    1 +
 .../amlogic/meson-t7-a311d2-khadas-vim4.dts   |  112 +
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     |  202 +
 drivers/clk/meson/Kconfig                     |   17 +
 drivers/clk/meson/Makefile                    |    1 +
 drivers/clk/meson/t7.c                        | 8014 +++++++++++++++++
 drivers/clk/meson/t7.h                        |  235 +
 drivers/tty/serial/meson_uart.c               |    4 +
 include/dt-bindings/clock/mesont7-clkc.h      |  487 +
 12 files changed, 9150 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
 create mode 100644 drivers/clk/meson/t7.c
 create mode 100644 drivers/clk/meson/t7.h
 create mode 100644 include/dt-bindings/clock/mesont7-clkc.h

--
2.41.0

#1 lore raw

PATCH 1/6 dt-bindings: arm: amlogic: add Amlogic T7 based Khadas VIM4 bindings

Add bindings for the Khadas Vim4 board.

---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/amlogic.yaml +7 -0
index 274ee0890312..1091abbae6a2 100644
@@ -159,6 +159,13 @@ properties:
           - const: amlogic,a311d
           - const: amlogic,g12b
 
+      - description: Boards with the Amlogic Meson t7 A311D2 SoC
+        items:
+          - enum:
+              - khadas,vim4
+          - const: amlogic,a311d2
+          - const: amlogic,t7
+
       - description: Boards using the BPI-CM4 module with Amlogic Meson G12B A311D SoC
         items:
           - enum:

--
2.41.0

Acked-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] dt-bindings: arm: amlogic: add Amlogic T7 based Khadas VIM4 bindings

Quoted 3 lines · Lucas Tanure

Add bindings for the Khadas Vim4 board.

Cheers,
Conor.

Quoted 25 lines
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/amlogic.yaml +7 -1
index 274ee0890312..1091abbae6a2 100644
@@ -159,6 +159,13 @@ properties:
           - const: amlogic,a311d
           - const: amlogic,g12b
 
+      - description: Boards with the Amlogic Meson t7 A311D2 SoC
+        items:
+          - enum:
+              - khadas,vim4
+          - const: amlogic,a311d2
+          - const: amlogic,t7
+
       - description: Boards using the BPI-CM4 module with Amlogic Meson G12B A311D SoC
         items:
           - enum:
--

2.41.0

#3 lore raw

PATCH 2/6 dt-bindings: clock: Bindings for Meson T7 clock controller

In reply to Lucas Tanure

Add documentation for T7 the clock controller.

---
 .../bindings/clock/amlogic,mesont7.yaml       |  69 +++
 include/dt-bindings/clock/mesont7-clkc.h      | 487 ++++++++++++++++++
 2 files changed, 556 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
 create mode 100644 include/dt-bindings/clock/mesont7-clkc.h
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +69 -0
new file mode 100644
index 000000000000..18e7cca0c0e1
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/amlogic,mesont7-clk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Meson T7 Clock Controller
+
+maintainers:
+  - Lucas Tanure <[email protected]>
+
+description: |
+  The Amlogic Meson T7 clock controller generates and supplies clock to
+  various peripherals within the SoC.
+
+  This binding uses common clock bindings
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+properties:
+  compatible:
+    const: amlogic,t7-clkc
+
+  reg:
+    items:
+      - description: basic registers
+      - description: pll registers
+      - description: cpu_clk registers
+
+  reg-names:
+    items:
+      - const: basic
+      - const: pll
+      - const: cpu_clk
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: xtal
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  # Clock controller node:
+  - |
+    clkc: clock-controller {
+        compatible = "amlogic,t7-clkc";
+        #clock-cells = <1>;
+        reg = <0x0 0x0000 0x00 0x49c>,
+              <0x0 0x8000 0x00 0x320>,
+              <0x0 0xe040 0x00 0x0bc>;
+        reg-names = "basic", "pll", "cpu_clk";
+        clocks = <&xtal>;
+        clock-names = "xtal";
+        status = "okay";
+    };
+
+...
include/dt-bindings/clock/mesont7-clkc.h new file +487 -0

487 lines not on this page · raw message

--
2.41.0

maintainer
#4 lore raw

Re: [PATCH 2/6] dt-bindings: clock: Bindings for Meson T7 clock controller

Quoted 10 lines · Lucas Tanure

Add documentation for T7 the clock controller.

---
 .../bindings/clock/amlogic,mesont7.yaml       |  69 +++
 include/dt-bindings/clock/mesont7-clkc.h      | 487 ++++++++++++++++++
 2 files changed, 556 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
 create mode 100644 include/dt-bindings/clock/mesont7-clkc.h

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
$id: http://devicetree.org/schemas/clock/amlogic,mesont7-clk.yaml
file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
Documentation/devicetree/bindings/clock/amlogic,mesont7.example.dts:18.32-28.11: Warning (unit_address_vs_reg): /example-0/clock-controller: node has a reg or ranges property, but no unit name /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/amlogic,mesont7.example.dtb: clock-controller: reg: [[0, 0], [0, 1180], [0, 32768], [0, 800], [0, 57408], [0, 188]] is too long
from schema $id: http://devicetree.org/schemas/clock/amlogic,mesont7-clk.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#5 lore raw

Re: [PATCH 2/6] dt-bindings: clock: Bindings for Meson T7 clock controller

In reply to Lucas Tanure

Hey Lucas,

Quoted 1 line · Lucas Tanure

Add documentation for T7 the clock controller.

Other than the bot's complaint, few comments for ya.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml

Quoted 13 lines
---
 .../bindings/clock/amlogic,mesont7.yaml       |  69 +++
 include/dt-bindings/clock/mesont7-clkc.h      | 487 ++++++++++++++++++
 2 files changed, 556 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
 create mode 100644 include/dt-bindings/clock/mesont7-clkc.h
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +0 -0
new file mode 100644
index 000000000000..18e7cca0c0e1

The filename should match the compatible - please test the bindings, dt_binding_check will complain.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 4

Quoted 5 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +4 -0
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/amlogic,mesont7-clk.yaml#

and this should match the filename

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 17

Quoted 13 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +13 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Meson T7 Clock Controller
+
+maintainers:
+  - Lucas Tanure <[email protected]>
+
+description: |
+  The Amlogic Meson T7 clock controller generates and supplies clock to
+  various peripherals within the SoC.
+
+  This binding uses common clock bindings
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt

This doesn't add anything as you're adding a yaml binding. I'd drop it (and the | from description: since you would no longer have formatting to preserve).

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 25

Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +8 -0
+
+properties:
+  compatible:
+    const: amlogic,t7-clkc
+
+  reg:
+    items:
+      - description: basic registers

What does "basic registers" mean? I think you should be more specific in your description.

Quoted 22 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +22 -0
+      - description: pll registers
+      - description: cpu_clk registers
+
+  reg-names:
+    items:
+      - const: basic
+      - const: pll
+      - const: cpu_clk
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: xtal
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +10 -0
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  # Clock controller node:
+  - |
+    clkc: clock-controller {

The comment above and the node name here can be dropped. You do however need to change "clock-controller" to "clock-controller@<addr>".

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 62

Quoted 5 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +5 -0
+        compatible = "amlogic,t7-clkc";
+        #clock-cells = <1>;
+        reg = <0x0 0x0000 0x00 0x49c>,
+              <0x0 0x8000 0x00 0x320>,
+              <0x0 0xe040 0x00 0x0bc>;

Drop the 0x0 stuff from here.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 66

Quoted 4 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +4 -0
+        reg-names = "basic", "pll", "cpu_clk";
+        clocks = <&xtal>;
+        clock-names = "xtal";
+        status = "okay";

status can be dropped, okay is the default.

Cheers,
Conor.

#6 lore raw

Re: [PATCH 2/6] dt-bindings: clock: Bindings for Meson T7 clock controller

Quoted 113 lines · Conor Dooley

Hey Lucas,

Quoted 1 line · Lucas Tanure

Add documentation for T7 the clock controller.

Other than the bot's complaint, few comments for ya.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml

Quoted 13 lines
---
 .../bindings/clock/amlogic,mesont7.yaml       |  69 +++
 include/dt-bindings/clock/mesont7-clkc.h      | 487 ++++++++++++++++++
 2 files changed, 556 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
 create mode 100644 include/dt-bindings/clock/mesont7-clkc.h
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +0 -0
new file mode 100644
index 000000000000..18e7cca0c0e1

The filename should match the compatible - please test the bindings, dt_binding_check will complain.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 4

Quoted 5 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +4 -0
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/amlogic,mesont7-clk.yaml#

and this should match the filename

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 17

Quoted 13 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +13 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Meson T7 Clock Controller
+
+maintainers:
+  - Lucas Tanure <[email protected]>
+
+description: |
+  The Amlogic Meson T7 clock controller generates and supplies clock to
+  various peripherals within the SoC.
+
+  This binding uses common clock bindings
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt

This doesn't add anything as you're adding a yaml binding. I'd drop it (and the | from description: since you would no longer have formatting to preserve).

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 25

Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +8 -0
+
+properties:
+  compatible:
+    const: amlogic,t7-clkc
+
+  reg:
+    items:
+      - description: basic registers

What does "basic registers" mean? I think you should be more specific in your description.

Quoted 22 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +22 -0
+      - description: pll registers
+      - description: cpu_clk registers
+
+  reg-names:
+    items:
+      - const: basic
+      - const: pll
+      - const: cpu_clk
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: xtal
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +10 -0
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  # Clock controller node:
+  - |
+    clkc: clock-controller {

The comment above and the node name here can be dropped. You do however need to change "clock-controller" to "clock-controller@<addr>".

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 62

Quoted 5 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +5 -0
+        compatible = "amlogic,t7-clkc";
+        #clock-cells = <1>;
+        reg = <0x0 0x0000 0x00 0x49c>,
+              <0x0 0x8000 0x00 0x320>,
+              <0x0 0xe040 0x00 0x0bc>;

Drop the 0x0 stuff from here.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 66

Quoted 4 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +4 -0
+        reg-names = "basic", "pll", "cpu_clk";
+        clocks = <&xtal>;
+        clock-names = "xtal";
+        status = "okay";
Quoted 5 lines

status can be dropped, okay is the default.

Cheers,
Conor.

I will drop this patch for now, wait for the S4 clock driver to be upstreamed, and use that as a base.

#7 lore raw

Re: [PATCH 2/6] dt-bindings: clock: Bindings for Meson T7 clock controller

Quoted 114 lines · Lucas Tanure
Quoted 113 lines · Conor Dooley

Hey Lucas,

Quoted 1 line · Lucas Tanure

Add documentation for T7 the clock controller.

Other than the bot's complaint, few comments for ya.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml

Quoted 13 lines
---
 .../bindings/clock/amlogic,mesont7.yaml       |  69 +++
 include/dt-bindings/clock/mesont7-clkc.h      | 487 ++++++++++++++++++
 2 files changed, 556 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml
 create mode 100644 include/dt-bindings/clock/mesont7-clkc.h
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +0 -0
new file mode 100644
index 000000000000..18e7cca0c0e1

The filename should match the compatible - please test the bindings, dt_binding_check will complain.

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 4

Quoted 5 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +4 -0
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/amlogic,mesont7-clk.yaml#

and this should match the filename

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 17

Quoted 13 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +13 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Meson T7 Clock Controller
+
+maintainers:
+  - Lucas Tanure <[email protected]>
+
+description: |
+  The Amlogic Meson T7 clock controller generates and supplies clock to
+  various peripherals within the SoC.
+
+  This binding uses common clock bindings
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt

This doesn't add anything as you're adding a yaml binding. I'd drop it (and the | from description: since you would no longer have formatting to preserve).

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 25

Quoted 8 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +8 -0
+
+properties:
+  compatible:
+    const: amlogic,t7-clkc
+
+  reg:
+    items:
+      - description: basic registers

What does "basic registers" mean? I think you should be more specific in your description.

Quoted 22 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +22 -0
+      - description: pll registers
+      - description: cpu_clk registers
+
+  reg-names:
+    items:
+      - const: basic
+      - const: pll
+      - const: cpu_clk
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: xtal
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +10 -0
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  # Clock controller node:
+  - |
+    clkc: clock-controller {

The comment above and the node name here can be dropped. You do however need to change "clock-controller" to "clock-controller@<addr>".

Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml line 62

Quoted 5 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +5 -0
+        compatible = "amlogic,t7-clkc";
+        #clock-cells = <1>;
+        reg = <0x0 0x0000 0x00 0x49c>,
+              <0x0 0x8000 0x00 0x320>,
+              <0x0 0xe040 0x00 0x0bc>;

Drop the 0x0 stuff from here.

Quoted 4 lines
Documentation/devicetree/bindings/clock/amlogic,mesont7.yaml new file +4 -0
+        reg-names = "basic", "pll", "cpu_clk";
+        clocks = <&xtal>;
+        clock-names = "xtal";
+        status = "okay";
Quoted 7 lines
Quoted 5 lines

status can be dropped, okay is the default.

Cheers,
Conor.

I will drop this patch for now, wait for the S4 clock driver to be upstreamed, and use that as a base.

Why? Is the t7-clkc IP the same or very similar to the S4?

#8 lore raw

PATCH 3/6 clk: meson: t7: add peripheral clock controller

In reply to Lucas Tanure

Add the peripheral clock controller found in the T7 SoC family

---
 drivers/clk/meson/Kconfig  |   17 +
 drivers/clk/meson/Makefile |    1 +
 drivers/clk/meson/t7.c     | 8014 ++++++++++++++++++++++++++++++++++++
 drivers/clk/meson/t7.h     |  235 ++
 4 files changed, 8267 insertions(+)
 create mode 100644 drivers/clk/meson/t7.c
 create mode 100644 drivers/clk/meson/t7.h
drivers/clk/meson/Kconfig +17 -0
index fc002c155bc3..32813e3f919e 100644
@@ -115,4 +115,21 @@ config COMMON_CLK_G12A
 	help
 	  Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2
 	  devices, aka g12a. Say Y if you want peripherals to work.
+
+config COMMON_CLK_T7
+	bool "T7 clock controllers support"
+	depends on ARM64
+	default y
+	select COMMON_CLK_MESON_REGMAP
+	select COMMON_CLK_MESON_DUALDIV
+	select COMMON_CLK_MESON_MPLL
+	select COMMON_CLK_MESON_PLL
+	select COMMON_CLK_MESON_AO_CLKC
+	select COMMON_CLK_MESON_EE_CLKC
+	select COMMON_CLK_MESON_CPU_DYNDIV
+	select COMMON_CLK_MESON_VID_PLL_DIV
+	select MFD_SYSCON
+	help
+	  Support for the clock controller on Amlogic A113D2 devices,
+	  aka meson t7. Say Y if you want peripherals to work.
 endmenu
drivers/clk/meson/Makefile +1 -0
index 6eca2a406ee3..b6ae796ecd06 100644
@@ -19,3 +19,4 @@ obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o
 obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o
 obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o
 obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o
+obj-$(CONFIG_COMMON_CLK_T7) += t7.o
drivers/clk/meson/t7.c new file +8014 -0

2,975 lines not on this page · raw message

drivers/clk/meson/t7.h new file +235 -0

235 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

--
2.41.0

Part of the diff is not shown here. View the raw message.

maintainer
#9 lore raw

Re: [PATCH 3/6] clk: meson: t7: add peripheral clock controller

Quoted 12 lines · Lucas Tanure

Add the peripheral clock controller found in the T7 SoC family

---
 drivers/clk/meson/Kconfig  |   17 +
 drivers/clk/meson/Makefile |    1 +
 drivers/clk/meson/t7.c     | 8014 ++++++++++++++++++++++++++++++++++++
 drivers/clk/meson/t7.h     |  235 ++
 4 files changed, 8267 insertions(+)
 create mode 100644 drivers/clk/meson/t7.c
 create mode 100644 drivers/clk/meson/t7.h

A lot of the comments made on the review for s4 clock controller is also applicable to this patch.

For example:
* Controller split
* Register calculation copied from the vendor tree
* Clock flags usage
* etc ...

Please have a look at the reviews for the s4 series:
https://patchwork.kernel.org/project/linux-amlogic/list/?series=&submitter=204205&state=*&q=clk&archive=both&delegate=

Also, looking at the register list, this t7 seems very similar to the s4. Like g12 and sm1, those should be able to share a driver, the differences being handle using the compatible

Quoted 8,296 lines
drivers/clk/meson/Kconfig +17 -0
index fc002c155bc3..32813e3f919e 100644
@@ -115,4 +115,21 @@ config COMMON_CLK_G12A
 	help
 	  Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2
 	  devices, aka g12a. Say Y if you want peripherals to work.
+
+config COMMON_CLK_T7
+	bool "T7 clock controllers support"
+	depends on ARM64
+	default y
+	select COMMON_CLK_MESON_REGMAP
+	select COMMON_CLK_MESON_DUALDIV
+	select COMMON_CLK_MESON_MPLL
+	select COMMON_CLK_MESON_PLL
+	select COMMON_CLK_MESON_AO_CLKC
+	select COMMON_CLK_MESON_EE_CLKC
+	select COMMON_CLK_MESON_CPU_DYNDIV
+	select COMMON_CLK_MESON_VID_PLL_DIV
+	select MFD_SYSCON
+	help
+	  Support for the clock controller on Amlogic A113D2 devices,
+	  aka meson t7. Say Y if you want peripherals to work.
 endmenu
drivers/clk/meson/Makefile +1 -0
index 6eca2a406ee3..b6ae796ecd06 100644
@@ -19,3 +19,4 @@ obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o
 obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o
 obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o
 obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o
+obj-$(CONFIG_COMMON_CLK_T7) += t7.o
drivers/clk/meson/t7.c new file +8014 -0
new file mode 100644
index 000000000000..0877ad4d9ea5
@@ -0,0 +1,8014 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Amlogic Meson-T7 Clock Controller Driver
+ *
+ * Copyright (c) 2018 Amlogic, inc.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/init.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+
+#include "clk-mpll.h"
+#include "clk-pll.h"
+#include "clk-regmap.h"
+#include "clk-cpu-dyndiv.h"
+#include "vid-pll-div.h"
+#include "clk-dualdiv.h"
+#include "t7.h"
+#include <dt-bindings/clock/mesont7-clkc.h>
+
+static DEFINE_SPINLOCK(meson_clk_lock);
+
+static struct clk_regmap t7_fixed_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_FIXPLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_FIXPLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_FIXPLL_CTRL0,
+			.shift   = 10,
+			.width   = 5,
+		},
+		.frac = {
+			.reg_off = ANACTRL_FIXPLL_CTRL1,
+			.shift   = 0,
+			.width   = 19,
+		},
+		.l = {
+			.reg_off = ANACTRL_FIXPLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_FIXPLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fixed_pll_dco",
+		.ops = &meson_clk_pll_ro_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		.flags = CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_fixed_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_FIXPLL_CTRL0,
+		.shift = 16,
+		.width = 2,
+		.flags = CLK_DIVIDER_POWER_OF_TWO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fixed_pll",
+		.ops = &clk_regmap_divider_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fixed_pll_dco.hw
+		},
+		.num_parents = 1,
+		/*
+		 * This clock won't ever change at runtime so
+		 * CLK_SET_RATE_PARENT is not required
+		 */
+		.flags = CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static const struct clk_ops meson_pll_clk_no_ops = {};
+
+/*
+ * the sys pll DCO value should be 3G~6G,
+ * otherwise the sys pll can not lock.
+ * od is for 32 bit.
+ */
+static const struct pll_params_table t7_sys_pll_params_table[] = {
+	PLL_PARAMS(67, 1), /*DCO=1608M OD=1608MM*/
+	PLL_PARAMS(71, 1), /*DCO=1704MM OD=1704M*/
+	PLL_PARAMS(75, 1), /*DCO=1800M OD=1800M*/
+	PLL_PARAMS(126, 1), /*DCO=3024 OD=1512M*/
+	PLL_PARAMS(116, 1), /*DCO=2784 OD=1392M*/
+	PLL_PARAMS(118, 1), /*DCO=2832M OD=1416M*/
+	PLL_PARAMS(100, 1), /*DCO=2400M OD=1200M*/
+	PLL_PARAMS(79, 1), /*DCO=1896M OD=1896M*/
+	PLL_PARAMS(80, 1), /*DCO=1920M OD=1920M*/
+	PLL_PARAMS(84, 1), /*DCO=2016M OD=2016M*/
+	PLL_PARAMS(92, 1), /*DCO=2208M OD=2208M*/
+	{ /* sentinel */ }
+};
+
+static struct clk_regmap t7_sys_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_SYS0PLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_SYS0PLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_SYS0PLL_CTRL0,
+			.shift   = 16,
+			.width   = 5,
+		},
+		.table = t7_sys_pll_params_table,
+		.l = {
+			.reg_off = ANACTRL_SYS0PLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_SYS0PLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sys_pll_dco",
+		.ops = &meson_clk_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		/* This clock feeds the CPU, avoid disabling it */
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_regmap t7_sys1_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_SYS1PLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_SYS1PLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_SYS1PLL_CTRL0,
+			.shift   = 16,
+			.width   = 5,
+		},
+		.table = t7_sys_pll_params_table,
+		.l = {
+			.reg_off = ANACTRL_SYS1PLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_SYS1PLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sys1_pll_dco",
+		.ops = &meson_clk_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		/* This clock feeds the CPU, avoid disabling it */
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_regmap t7_sys_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_SYS0PLL_CTRL0,
+		.shift = 12,
+		.width = 3,
+		.flags = CLK_DIVIDER_POWER_OF_TWO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sys_pll",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sys_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_sys1_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_SYS1PLL_CTRL0,
+		.shift = 12,
+		.width = 3,
+		.flags = CLK_DIVIDER_POWER_OF_TWO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sys1_pll",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sys1_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_fixed_factor t7_fclk_div2_div = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div2_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_fixed_pll.hw },
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_fclk_div2 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_FIXPLL_CTRL1,
+		.bit_idx = 24,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div2",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div2_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_fixed_factor t7_fclk_div3_div = {
+	.mult = 1,
+	.div = 3,
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div3_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_fixed_pll.hw },
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_fclk_div3 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_FIXPLL_CTRL1,
+		.bit_idx = 20,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div3",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div3_div.hw
+		},
+		.num_parents = 1,
+		/*
+		 * This clock is used by the resident firmware and is required
+		 * by the platform to operate correctly.
+		 * Until the following condition are met, we need this clock to
+		 * be marked as critical:
+		 * a) Mark the clock used by a firmware resource, if possible
+		 * b) CCF has a clock hand-off mechanism to make the sure the
+		 *    clock stays on until the proper driver comes along
+		 */
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_fixed_factor t7_fclk_div4_div = {
+	.mult = 1,
+	.div = 4,
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div4_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_fixed_pll.hw },
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_fclk_div4 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_FIXPLL_CTRL1,
+		.bit_idx = 21,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div4",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div4_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_fixed_factor t7_fclk_div5_div = {
+	.mult = 1,
+	.div = 5,
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div5_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_fixed_pll.hw },
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_fclk_div5 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_FIXPLL_CTRL1,
+		.bit_idx = 22,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div5",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div5_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_fixed_factor t7_fclk_div7_div = {
+	.mult = 1,
+	.div = 7,
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div7_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_fixed_pll.hw },
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_fclk_div7 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_FIXPLL_CTRL1,
+		.bit_idx = 23,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div7",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div7_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static struct clk_fixed_factor t7_fclk_div2p5_div = {
+	.mult = 2,
+	.div = 5,
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div2p5_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fixed_pll.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_fclk_div2p5 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_FIXPLL_CTRL1,
+		.bit_idx = 25,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "fclk_div2p5",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div2p5_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_IS_CRITICAL,
+	},
+};
+
+static const struct pll_params_table t7_gp0_pll_table[] = {
+	PLL_PARAMS(141, 1), /* DCO = 3384M OD = 2 PLL = 846M */
+	PLL_PARAMS(132, 1), /* DCO = 3168M OD = 2 PLL = 792M */
+	PLL_PARAMS(248, 1), /* DCO = 5952M OD = 3 PLL = 744M */
+	PLL_PARAMS(96, 1), /* DCO = 2304M OD = 1 PLL = 1152M */
+	{ /* sentinel */  }
+};
+
+/*
+ * Internal gp0 pll emulation configuration parameters
+ */
+static const struct reg_sequence t7_gp0_init_regs[] = {
+	{ .reg = ANACTRL_GP0PLL_CTRL1,	.def = 0x00000000 },
+	{ .reg = ANACTRL_GP0PLL_CTRL2,	.def = 0x00000000 },
+	{ .reg = ANACTRL_GP0PLL_CTRL3,	.def = 0x48681c00 },
+	{ .reg = ANACTRL_GP0PLL_CTRL4,	.def = 0x88770290 },
+	{ .reg = ANACTRL_GP0PLL_CTRL5,	.def = 0x3927200a },
+	{ .reg = ANACTRL_GP0PLL_CTRL6,	.def = 0x56540000 }
+};
+
+static struct clk_regmap t7_gp0_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_GP0PLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_GP0PLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_GP0PLL_CTRL0,
+			.shift   = 10,
+			.width   = 5,
+		},
+		.frac = {
+			.reg_off = ANACTRL_GP0PLL_CTRL1,
+			.shift   = 0,
+			.width   = 19,
+		},
+		.l = {
+			.reg_off = ANACTRL_GP0PLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_GP0PLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+		.table = t7_gp0_pll_table,
+		.init_regs = t7_gp0_init_regs,
+		.init_count = ARRAY_SIZE(t7_gp0_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "gp0_pll_dco",
+		.ops = &meson_clk_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_gp0_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_GP0PLL_CTRL0,
+		.shift = 16,
+		.width = 3,
+		.flags = (CLK_DIVIDER_POWER_OF_TWO |
+			  CLK_DIVIDER_ROUND_CLOSEST),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "gp0_pll",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_gp0_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static const struct pll_params_table t7_gp1_pll_table[] = {
+	PLL_PARAMS(100, 1), /*DCO=4800M OD=1200M*/
+	PLL_PARAMS(125, 1), /*DCO=3000M OD=1500M*/
+	{ /* sentinel */  }
+};
+
+static const struct reg_sequence t7_gp1_init_regs[] = {
+	{ .reg = ANACTRL_GP1PLL_CTRL1,	.def = 0x1420500f },
+	{ .reg = ANACTRL_GP1PLL_CTRL2,	.def = 0x00023001 },
+	{ .reg = ANACTRL_GP1PLL_CTRL3,	.def = 0x0, .delay_us = 20 },
+};
+
+static struct clk_regmap t7_gp1_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_GP1PLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_GP1PLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_GP1PLL_CTRL0,
+			.shift   = 16,
+			.width   = 5,
+		},
+		.l = {
+			.reg_off = ANACTRL_GP1PLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_GP1PLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+		.table = t7_gp1_pll_table,
+		.init_regs = t7_gp1_init_regs,
+		.init_count = ARRAY_SIZE(t7_gp1_init_regs)
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "gp1_pll_dco",
+		.ops = &meson_clk_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		/* This clock feeds the DSU, avoid disabling it */
+		.flags = CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_gp1_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_GP1PLL_CTRL0,
+		.shift = 12,
+		.width = 3,
+		.flags = (CLK_DIVIDER_POWER_OF_TWO |
+			  CLK_DIVIDER_ROUND_CLOSEST),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "gp1_pll",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_gp1_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct pll_params_table t7_mclk_pll_table[] = {
+	PLL_PARAMS(99, 1), /* DCO = 2376M OD = 1 PLL = 1152M */
+	PLL_PARAMS(100, 1), /* DCO = 2400M */
+	{ /* sentinel */  }
+};
+
+static const struct reg_sequence t7_mclk_init_regs[] = {
+	{ .reg = ANACTRL_MCLK_PLL_CNTL0, .def = 0x20011064, .delay_us = 20 },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL0, .def = 0x30011064 },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL1, .def = 0x1470500f },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL2, .def = 0x00023041 },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL3, .def = 0x18180000 },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL4, .def = 0x00180303 },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL0, .def = 0x10011064, .delay_us = 20 },
+	{ .reg = ANACTRL_MCLK_PLL_CNTL2, .def = 0x00023001, .delay_us = 20 }
+};
+
+static struct clk_regmap t7_mclk_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_MCLK_PLL_CNTL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_MCLK_PLL_CNTL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_MCLK_PLL_CNTL0,
+			.shift   = 16,
+			.width   = 5,
+		},
+		.l = {
+			.reg_off = ANACTRL_MCLK_PLL_CNTL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_MCLK_PLL_CNTL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+		.table = t7_mclk_pll_table,
+		.init_regs = t7_mclk_init_regs,
+		.init_count = ARRAY_SIZE(t7_mclk_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mclk_pll_dco",
+		.ops = &meson_clk_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED
+	},
+};
+
+/* max div is 16 */
+static const struct clk_div_table mclk_div[] = {
+	{ .val = 0, .div = 1 },
+	{ .val = 1, .div = 2 },
+	{ .val = 2, .div = 4 },
+	{ .val = 3, .div = 8 },
+	{ .val = 4, .div = 16 },
+	{ /* sentinel */ }
+};
+
+static struct clk_regmap t7_mclk_pre_od = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_MCLK_PLL_CNTL0,
+		.shift = 12,
+		.width = 3,
+		.table = mclk_div,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mclk_pre_od",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_mclk_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_mclk_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_MCLK_PLL_CNTL4,
+		.shift = 16,
+		.width = 5,
+		.flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ROUND_CLOSEST | CLK_DIVIDER_ALLOW_ZERO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mclk_pll",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_mclk_pre_od.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+/*a53 cpu_clk, get the table from ucode */
+static struct clk_regmap t7_cpu_clk = {
+	.data = &(struct clk_regmap_mux_data){
+		.mask = 0x1,
+		.shift = 11,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cpu_clk",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sys1_pll.hw,
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct clk_parent_data t7_a73_dyn_clk_sel[] = {
+	{ .fw_name = "xtal", },
+	{ .hw = &t7_fclk_div2.hw },
+	{ .hw = &t7_fclk_div3.hw },
+	{ .hw = &t7_fclk_div2p5.hw },
+};
+
+static struct clk_regmap t7_a73_clk = {
+	.data = &(struct clk_regmap_mux_data){
+		.mask = 0x1,
+		.shift = 11,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "a73_clk",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sys_pll.hw,
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+struct t7_sys_pll_nb_data {
+	struct notifier_block nb;
+	struct clk_hw *sys_pll;
+	struct clk_hw *cpu_clk;
+	struct clk_hw *cpu_dyn_clk;
+};
+
+static int t7_sys_pll_notifier_cb(struct notifier_block *nb, unsigned long event, void *data)
+{
+	struct t7_sys_pll_nb_data *nb_data = container_of(nb, struct t7_sys_pll_nb_data, nb);
+
+	switch (event) {
+	case PRE_RATE_CHANGE:
+		/*
+		 * This notifier means sys_pll clock will be changed
+		 * to feed cpu_clk, this the current path :
+		 * cpu_clk
+		 *    \- sys_pll
+		 *          \- sys_pll_dco
+		 */
+
+		/*
+		 * Configure cpu_clk to use cpu_clk_dyn
+		 * Make sure cpu clk is 1G, cpu_clk_dyn may equal 24M
+		 */
+
+		if (clk_set_rate(nb_data->cpu_dyn_clk->clk, 1000000000))
+			pr_err("%s: set CPU dyn clock to 1G failed\n", __func__);
+
+		clk_hw_set_parent(nb_data->cpu_clk, nb_data->cpu_dyn_clk);
+		/*
+		 * Now, cpu_clk uses the dyn path
+		 * cpu_clk
+		 *    \- cpu_clk_dyn
+		 *          \- cpu_clk_dynX
+		 *                \- cpu_clk_dynX_sel
+		 *		     \- cpu_clk_dynX_div
+		 *                      \- xtal/fclk_div2/fclk_div3
+		 *                   \- xtal/fclk_div2/fclk_div3
+		 */
+		udelay(5);
+
+		return NOTIFY_OK;
+
+	case POST_RATE_CHANGE:
+		/*
+		 * The sys_pll has ben updated, now switch back cpu_clk to
+		 * sys_pll
+		 */
+
+		/* Configure cpu_clk to use sys_pll */
+		clk_hw_set_parent(nb_data->cpu_clk, nb_data->sys_pll);
+		udelay(5);
+
+		/* new path :
+		 * cpu_clk
+		 *    \- sys_pll
+		 *          \- sys_pll_dco
+		 */
+
+		return NOTIFY_OK;
+
+	default:
+		return NOTIFY_DONE;
+	}
+}
+
+static struct t7_sys_pll_nb_data t7_sys1_pll_nb_data = {
+	.sys_pll = &t7_sys1_pll.hw,
+	.cpu_clk = &t7_cpu_clk.hw,
+	.nb.notifier_call = t7_sys_pll_notifier_cb,
+};
+
+static struct t7_sys_pll_nb_data t7_sys_pll_nb_data = {
+	.sys_pll = &t7_sys_pll.hw,
+	.cpu_clk = &t7_a73_clk.hw,
+	.nb.notifier_call = t7_sys_pll_notifier_cb,
+};
+
+static const struct pll_params_table t7_hifi_pll_table[] = {
+	PLL_PARAMS(163, 1), /* DCO = 3932.16M */
+	{ /* sentinel */  }
+};
+
+/*
+ * Internal hifi pll emulation configuration parameters
+ */
+static const struct reg_sequence t7_hifi_init_regs[] = {
+	{ .reg = ANACTRL_HIFIPLL_CTRL1,	.def = 0x00014820 }, /*frac = 20.16M */
+	{ .reg = ANACTRL_HIFIPLL_CTRL2,	.def = 0x00000000 },
+	{ .reg = ANACTRL_HIFIPLL_CTRL3,	.def = 0x6a285c00 },
+	{ .reg = ANACTRL_HIFIPLL_CTRL4,	.def = 0x65771290 },
+	{ .reg = ANACTRL_HIFIPLL_CTRL5,	.def = 0x3927200a },
+	{ .reg = ANACTRL_HIFIPLL_CTRL6,	.def = 0x56540000 }
+};
+
+static struct clk_regmap t7_hifi_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_HIFIPLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_HIFIPLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_HIFIPLL_CTRL0,
+			.shift   = 10,
+			.width   = 5,
+		},
+		.frac = {
+			.reg_off = ANACTRL_HIFIPLL_CTRL1,
+			.shift   = 0,
+			.width   = 19,
+		},
+		.l = {
+			.reg_off = ANACTRL_HIFIPLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_HIFIPLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+		.table = t7_hifi_pll_table,
+		.init_regs = t7_hifi_init_regs,
+		.init_count = ARRAY_SIZE(t7_hifi_init_regs),
+		.flags = CLK_MESON_PLL_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hifi_pll_dco",
+		.ops = &meson_clk_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_hifi_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_HIFIPLL_CTRL0,
+		.shift = 16,
+		.width = 2,
+		.flags = (CLK_DIVIDER_POWER_OF_TWO | CLK_DIVIDER_ROUND_CLOSEST),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hifi_pll",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_hifi_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+/*
+ * The Meson t7 PCIE PLL is fined tuned to deliver a very precise
+ * 100MHz reference clock for the PCIe Analog PHY, and thus requires
+ * a strict register sequence to enable the PLL.
+ */
+static const struct reg_sequence t7_pcie_pll_init_regs[] = {
+	{ .reg = ANACTRL_PCIEPLL_CTRL0,	.def = 0x200c04c8 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL0,	.def = 0x300c04c8 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL1,	.def = 0x30000000 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL2,	.def = 0x00001100 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL3,	.def = 0x10058e00 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL4,	.def = 0x000100c0 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL5,	.def = 0x68000040 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL5,	.def = 0x68000060, .delay_us = 20 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL4,	.def = 0x008100c0, .delay_us = 10 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL0,	.def = 0x340c04c8 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL0,	.def = 0x140c04c8, .delay_us = 10 },
+	{ .reg = ANACTRL_PCIEPLL_CTRL2,	.def = 0x00001000 }
+};
+
+/* Keep a single entry table for recalc/round_rate() ops */
+static const struct pll_params_table t7_pcie_pll_table[] = {
+	PLL_PARAMS(150, 1),
+	{0, 0}
+};
+
+static struct clk_regmap t7_pcie_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_PCIEPLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_PCIEPLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_PCIEPLL_CTRL0,
+			.shift   = 10,
+			.width   = 5,
+		},
+		.frac = {
+			.reg_off = ANACTRL_PCIEPLL_CTRL1,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.l = {
+			.reg_off = ANACTRL_PCIEPLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_PCIEPLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+		.table = t7_pcie_pll_table,
+		.init_regs = t7_pcie_pll_init_regs,
+		.init_count = ARRAY_SIZE(t7_pcie_pll_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "pcie_pll_dco",
+		.ops = &meson_clk_pcie_pll_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_pcie_pll_dco_div2 = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "pcie_pll_dco_div2",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_pcie_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_pcie_pll_od = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_PCIEPLL_CTRL0,
+		.shift = 16,
+		.width = 5,
+		.flags = CLK_DIVIDER_ROUND_CLOSEST | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "pcie_pll_od",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_pcie_pll_dco_div2.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_fixed_factor t7_pcie_pll = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "pcie_pll",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_pcie_pll_od.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_pcie_bgp = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_PCIEPLL_CTRL5,
+		.bit_idx = 27,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "pcie_bgp",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_pcie_pll.hw },
+		.num_parents = 1,
+		.flags = CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_pcie_hcsl = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_PCIEPLL_CTRL5,
+		.bit_idx = 3,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "pcie_hcsl",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_pcie_bgp.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_hdmi_pll_dco = {
+	.data = &(struct meson_clk_pll_data){
+		.en = {
+			.reg_off = ANACTRL_HDMIPLL_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.m = {
+			.reg_off = ANACTRL_HDMIPLL_CTRL0,
+			.shift   = 0,
+			.width   = 8,
+		},
+		.n = {
+			.reg_off = ANACTRL_HDMIPLL_CTRL0,
+			.shift   = 10,
+			.width   = 5,
+		},
+		.frac = {
+			.reg_off = ANACTRL_HDMIPLL_CTRL1,
+			.shift   = 0,
+			.width   = 19,
+		},
+		.l = {
+			.reg_off = ANACTRL_HDMIPLL_CTRL0,
+			.shift   = 31,
+			.width   = 1,
+		},
+		.rst = {
+			.reg_off = ANACTRL_HDMIPLL_CTRL0,
+			.shift   = 29,
+			.width   = 1,
+		},
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmi_pll_dco",
+		.ops = &meson_clk_pll_ro_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+		/*
+		 * Display directly handle hdmi pll registers ATM, we need
+		 * NOCACHE to keep our view of the clock as accurate as
+		 * possible
+		 */
+		.flags = CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_hdmi_pll_od = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_HDMIPLL_CTRL0,
+		.shift = 16,
+		.width = 4,
+		.flags = CLK_DIVIDER_POWER_OF_TWO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmi_pll_od",
+		.ops = &clk_regmap_divider_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_hdmi_pll_dco.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_hdmi_pll = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = ANACTRL_HDMIPLL_CTRL0,
+		.shift = 20,
+		.width = 2,
+		.flags = CLK_DIVIDER_POWER_OF_TWO,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmi_pll",
+		.ops = &clk_regmap_divider_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_hdmi_pll_od.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_fixed_factor t7_mpll_50m_div = {
+	.mult = 1,
+	.div = 80,
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll_50m_div",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fixed_pll_dco.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static const struct clk_parent_data t7_mpll_50m_sel[] = {
+	{ .fw_name = "xtal", },
+	{ .hw = &t7_mpll_50m_div.hw },
+};
+
+static struct clk_regmap t7_mpll_50m = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = ANACTRL_FIXPLL_CTRL3,
+		.mask = 0x1,
+		.shift = 5,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll_50m",
+		.ops = &clk_regmap_mux_ro_ops,
+		.parent_data = t7_mpll_50m_sel,
+		.num_parents = ARRAY_SIZE(t7_mpll_50m_sel),
+	},
+};
+
+static struct clk_fixed_factor t7_mpll_prediv = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll_prediv",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fixed_pll_dco.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static const struct reg_sequence t7_mpll0_init_regs[] = {
+	{ .reg = ANACTRL_MPLL_CTRL2, .def = 0x40000033 }
+};
+
+static struct clk_regmap t7_mpll0_div = {
+	.data = &(struct meson_clk_mpll_data){
+		.sdm = {
+			.reg_off = ANACTRL_MPLL_CTRL1,
+			.shift   = 0,
+			.width   = 14,
+		},
+		.sdm_en = {
+			.reg_off = ANACTRL_MPLL_CTRL1,
+			.shift   = 30,
+			.width	 = 1,
+		},
+		.n2 = {
+			.reg_off = ANACTRL_MPLL_CTRL1,
+			.shift   = 20,
+			.width   = 9,
+		},
+		.ssen = {
+			.reg_off = ANACTRL_MPLL_CTRL1,
+			.shift   = 29,
+			.width	 = 1,
+		},
+		.lock = &meson_clk_lock,
+		.init_regs = t7_mpll0_init_regs,
+		.init_count = ARRAY_SIZE(t7_mpll0_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll0_div",
+		.ops = &meson_clk_mpll_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_mpll_prediv.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_mpll0 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_MPLL_CTRL1,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll0",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_mpll0_div.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct reg_sequence t7_mpll1_init_regs[] = {
+	{ .reg = ANACTRL_MPLL_CTRL4,	.def = 0x40000033 }
+};
+
+static struct clk_regmap t7_mpll1_div = {
+	.data = &(struct meson_clk_mpll_data){
+		.sdm = {
+			.reg_off = ANACTRL_MPLL_CTRL3,
+			.shift   = 0,
+			.width   = 14,
+		},
+		.sdm_en = {
+			.reg_off = ANACTRL_MPLL_CTRL3,
+			.shift   = 30,
+			.width	 = 1,
+		},
+		.n2 = {
+			.reg_off = ANACTRL_MPLL_CTRL3,
+			.shift   = 20,
+			.width   = 9,
+		},
+		.ssen = {
+			.reg_off = ANACTRL_MPLL_CTRL3,
+			.shift   = 29,
+			.width	 = 1,
+		},
+		.lock = &meson_clk_lock,
+		.init_regs = t7_mpll1_init_regs,
+		.init_count = ARRAY_SIZE(t7_mpll1_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll1_div",
+		.ops = &meson_clk_mpll_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_mpll_prediv.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_mpll1 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_MPLL_CTRL3,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll1",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_mpll1_div.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct reg_sequence t7_mpll2_init_regs[] = {
+	{ .reg = ANACTRL_MPLL_CTRL6, .def = 0x40000033 }
+};
+
+static struct clk_regmap t7_mpll2_div = {
+	.data = &(struct meson_clk_mpll_data){
+		.sdm = {
+			.reg_off = ANACTRL_MPLL_CTRL5,
+			.shift   = 0,
+			.width   = 14,
+		},
+		.sdm_en = {
+			.reg_off = ANACTRL_MPLL_CTRL5,
+			.shift   = 30,
+			.width	 = 1,
+		},
+		.n2 = {
+			.reg_off = ANACTRL_MPLL_CTRL5,
+			.shift   = 20,
+			.width   = 9,
+		},
+		.ssen = {
+			.reg_off = ANACTRL_MPLL_CTRL5,
+			.shift   = 29,
+			.width	 = 1,
+		},
+		.lock = &meson_clk_lock,
+		.init_regs = t7_mpll2_init_regs,
+		.init_count = ARRAY_SIZE(t7_mpll2_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll2_div",
+		.ops = &meson_clk_mpll_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_mpll_prediv.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_mpll2 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_MPLL_CTRL5,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll2",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_mpll2_div.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct reg_sequence t7_mpll3_init_regs[] = {
+	{ .reg = ANACTRL_MPLL_CTRL8, .def = 0x40000033 }
+};
+
+static struct clk_regmap t7_mpll3_div = {
+	.data = &(struct meson_clk_mpll_data){
+		.sdm = {
+			.reg_off = ANACTRL_MPLL_CTRL7,
+			.shift   = 0,
+			.width   = 14,
+		},
+		.sdm_en = {
+			.reg_off = ANACTRL_MPLL_CTRL7,
+			.shift   = 30,
+			.width	 = 1,
+		},
+		.n2 = {
+			.reg_off = ANACTRL_MPLL_CTRL7,
+			.shift   = 20,
+			.width   = 9,
+		},
+		.ssen = {
+			.reg_off = ANACTRL_MPLL_CTRL7,
+			.shift   = 29,
+			.width	 = 1,
+		},
+		.lock = &meson_clk_lock,
+		.init_regs = t7_mpll3_init_regs,
+		.init_count = ARRAY_SIZE(t7_mpll3_init_regs),
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll3_div",
+		.ops = &meson_clk_mpll_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_mpll_prediv.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_mpll3 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = ANACTRL_MPLL_CTRL7,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "mpll3",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_mpll3_div.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+/*
+ *rtc 32k clock
+ *
+ *xtal--GATE------------------GATE---------------------|\
+ *	              |  --------                      | \
+ *	              |  |      |                      |  \
+ *	              ---| DUAL |----------------------|   |
+ *	                 |      |                      |   |____GATE__
+ *	                 --------                      |   |     rtc_32k_out
+ *	   PAD-----------------------------------------|  /
+ *	                                               | /
+ *	   DUAL function:                              |/
+ *	   bit 28 in RTC_BY_OSCIN_CTRL0 control the dual function.
+ *	   when bit 28 = 0
+ *	         f = 24M/N0
+ *	   when bit 28 = 1
+ *	         output N1 and N2 in turns.
+ *	   T = (x*T1 + y*T2)/x+y
+ *	   f = (24M/(N0*M0 + N1*M1)) * (M0 + M1)
+ *	   f: the frequecy value (HZ)
+ *	       |      | |      |
+ *	       | Div1 |-| Cnt1 |
+ *	      /|______| |______|\
+ *	    -|  ______   ______  ---> Out
+ *	      \|      | |      |/
+ *	       | Div2 |-| Cnt2 |
+ *	       |______| |______|
+ **/
+
+/*
+ * rtc 32k clock in gate
+ */
+static struct clk_regmap t7_rtc_32k_clkin = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_RTC_BY_OSCIN_CTRL0,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "rtc_32k_clkin",
+		.ops = &clk_regmap_gate_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+	},
+};
+
+static const struct meson_clk_dualdiv_param t7_32k_div_table[] = {
+	{
+		.dual	= 1,
+		.n1	= 733,
+		.m1	= 8,
+		.n2	= 732,
+		.m2	= 11,
+	},
+	{}
+};
+
+static struct clk_regmap t7_rtc_32k_div = {
+	.data = &(struct meson_clk_dualdiv_data){
+		.n1 = {
+			.reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL0,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.n2 = {
+			.reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL0,
+			.shift   = 12,
+			.width   = 12,
+		},
+		.m1 = {
+			.reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL1,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.m2 = {
+			.reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL1,
+			.shift   = 12,
+			.width   = 12,
+		},
+		.dual = {
+			.reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.table = t7_32k_div_table,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "rtc_32k_div",
+		.ops = &meson_clk_dualdiv_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_rtc_32k_clkin.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_rtc_32k_xtal = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_RTC_BY_OSCIN_CTRL1,
+		.bit_idx = 24,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "rtc_32k_xtal",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_rtc_32k_clkin.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+/*
+ * three parent for rtc clock out
+ * pad is from where?
+ */
+static u32 rtc_32k_sel[] = {0, 1};
+static struct clk_regmap t7_rtc_32k_sel = {
+	.data = &(struct clk_regmap_mux_data) {
+		.offset = CLKCTRL_RTC_CTRL,
+		.mask = 0x3,
+		.shift = 0,
+		.table = rtc_32k_sel,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "rtc_32k_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_rtc_32k_xtal.hw,
+			&t7_rtc_32k_div.hw
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_rtc_clk = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_RTC_BY_OSCIN_CTRL0,
+		.bit_idx = 30,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "rtc_clk",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_rtc_32k_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+/* sys clk */
+static u32 mux_table_sys_ab_clk_sel[] = { 0, 1, 2, 3, 4, 5, 7 };
+static const struct clk_parent_data t7_table_sys_ab_clk_sel[] = {
+	{ .fw_name = "xtal", },
+	{ .hw = &t7_fclk_div2.hw },
+	{ .hw = &t7_fclk_div3.hw },
+	{ .hw = &t7_fclk_div4.hw },
+	{ .hw = &t7_fclk_div5.hw },
+	{ .fw_name = "axi_clk_frcpu",  },
+	{ .hw = &t7_rtc_clk.hw }
+};
+
+static struct clk_regmap t7_sysclk_b_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.mask = 0x7,
+		.shift = 26,
+		.table = mux_table_sys_ab_clk_sel,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sysclk_b_sel",
+		.ops = &clk_regmap_mux_ro_ops,
+		.parent_data = t7_table_sys_ab_clk_sel,
+		.num_parents = ARRAY_SIZE(t7_table_sys_ab_clk_sel),
+	},
+};
+
+static struct clk_regmap t7_sysclk_b_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.shift = 16,
+		.width = 10,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sysclk_b_div",
+		.ops = &clk_regmap_divider_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sysclk_b_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_sysclk_b = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.bit_idx = 29,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "sysclk_b",
+		.ops = &clk_regmap_gate_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sysclk_b_div.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_sysclk_a_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.mask = 0x7,
+		.shift = 10,
+		.table = mux_table_sys_ab_clk_sel,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sysclk_a_sel",
+		.ops = &clk_regmap_mux_ro_ops,
+		.parent_data = t7_table_sys_ab_clk_sel,
+		.num_parents = ARRAY_SIZE(t7_table_sys_ab_clk_sel),
+	},
+};
+
+static struct clk_regmap t7_sysclk_a_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.shift = 0,
+		.width = 10,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sysclk_a_div",
+		.ops = &clk_regmap_divider_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sysclk_a_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_sysclk_a = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.bit_idx = 13,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "sysclk_a",
+		.ops = &clk_regmap_gate_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sysclk_a_div.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_sys_clk = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_SYS_CLK_CTRL0,
+		.mask = 0x1,
+		.shift = 15,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sys_clk",
+		.ops = &clk_regmap_mux_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sysclk_a.hw,
+			&t7_sysclk_b.hw,
+		},
+		.num_parents = 2,
+	},
+};
+
+/*ceca_clk*/
+static struct clk_regmap t7_ceca_32k_clkin = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CECA_CTRL0,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "ceca_32k_clkin",
+		.ops = &clk_regmap_gate_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_ceca_32k_div = {
+	.data = &(struct meson_clk_dualdiv_data){
+		.n1 = {
+			.reg_off = CLKCTRL_CECA_CTRL0,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.n2 = {
+			.reg_off = CLKCTRL_CECA_CTRL0,
+			.shift   = 12,
+			.width   = 12,
+		},
+		.m1 = {
+			.reg_off = CLKCTRL_CECA_CTRL1,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.m2 = {
+			.reg_off = CLKCTRL_CECA_CTRL1,
+			.shift   = 12,
+			.width   = 12,
+		},
+		.dual = {
+			.reg_off = CLKCTRL_CECA_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.table = t7_32k_div_table,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "ceca_32k_div",
+		.ops = &meson_clk_dualdiv_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_ceca_32k_clkin.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_ceca_32k_sel_pre = {
+	.data = &(struct clk_regmap_mux_data) {
+		.offset = CLKCTRL_CECA_CTRL1,
+		.mask = 0x1,
+		.shift = 24,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "ceca_32k_sel_pre",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_ceca_32k_div.hw,
+			&t7_ceca_32k_clkin.hw
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_ceca_32k_sel = {
+	.data = &(struct clk_regmap_mux_data) {
+		.offset = CLKCTRL_CECA_CTRL1,
+		.mask = 0x1,
+		.shift = 31,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "ceca_32k_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_ceca_32k_sel_pre.hw,
+			&t7_rtc_clk.hw
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_ceca_32k_clkout = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CECA_CTRL0,
+		.bit_idx = 30,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "ceca_32k_clkout",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_ceca_32k_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+/*cecb_clk*/
+static struct clk_regmap t7_cecb_32k_clkin = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CECB_CTRL0,
+		.bit_idx = 31,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "cecb_32k_clkin",
+		.ops = &clk_regmap_gate_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_cecb_32k_div = {
+	.data = &(struct meson_clk_dualdiv_data){
+		.n1 = {
+			.reg_off = CLKCTRL_CECB_CTRL0,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.n2 = {
+			.reg_off = CLKCTRL_CECB_CTRL0,
+			.shift   = 12,
+			.width   = 12,
+		},
+		.m1 = {
+			.reg_off = CLKCTRL_CECB_CTRL1,
+			.shift   = 0,
+			.width   = 12,
+		},
+		.m2 = {
+			.reg_off = CLKCTRL_CECB_CTRL1,
+			.shift   = 12,
+			.width   = 12,
+		},
+		.dual = {
+			.reg_off = CLKCTRL_CECB_CTRL0,
+			.shift   = 28,
+			.width   = 1,
+		},
+		.table = t7_32k_div_table,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cecb_32k_div",
+		.ops = &meson_clk_dualdiv_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cecb_32k_clkin.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_cecb_32k_sel_pre = {
+	.data = &(struct clk_regmap_mux_data) {
+		.offset = CLKCTRL_CECB_CTRL1,
+		.mask = 0x1,
+		.shift = 24,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cecb_32k_sel_pre",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cecb_32k_div.hw,
+			&t7_cecb_32k_clkin.hw
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_cecb_32k_sel = {
+	.data = &(struct clk_regmap_mux_data) {
+		.offset = CLKCTRL_CECB_CTRL1,
+		.mask = 0x1,
+		.shift = 31,
+		.flags = CLK_MUX_ROUND_CLOSEST,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cecb_32k_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cecb_32k_sel_pre.hw,
+			&t7_rtc_clk.hw
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_cecb_32k_clkout = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CECB_CTRL0,
+		.bit_idx = 30,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cecb_32k_clkout",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cecb_32k_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static const struct clk_parent_data t7_sc_parent_data[] = {
+	{ .hw = &t7_fclk_div4.hw },
+	{ .hw = &t7_fclk_div3.hw },
+	{ .hw = &t7_fclk_div5.hw },
+	{ .fw_name = "xtal", }
+};
+
+static struct clk_regmap t7_sc_clk_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_SC_CLK_CTRL,
+		.mask = 0x3,
+		.shift = 9,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "sc_clk_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_sc_parent_data,
+		.num_parents = ARRAY_SIZE(t7_sc_parent_data),
+		.flags = CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_sc_clk_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_SC_CLK_CTRL,
+		.shift = 0,
+		.width = 8,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "sc_clk_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sc_clk_mux.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_sc_clk_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_SC_CLK_CTRL,
+		.bit_idx = 8,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "sc_clk_gate",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_sc_clk_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
+	},
+};
+
+/*rama_clk*/
+
+/*dspa_clk*/
+static const struct clk_parent_data t7_dsp_parent_hws[] = {
+	{ .fw_name = "xtal", },
+	{ .hw = &t7_fclk_div2p5.hw },
+	{ .hw = &t7_fclk_div3.hw },
+	{ .hw = &t7_fclk_div5.hw },
+	{ .hw = &t7_hifi_pll.hw },
+	{ .hw = &t7_fclk_div4.hw },
+	{ .hw = &t7_fclk_div7.hw },
+	{ .hw = &t7_rtc_clk.hw }
+};
+
+static struct clk_regmap t7_dspa_a_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.mask = 0x7,
+		.shift = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspa_a_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_dsp_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_dsp_parent_hws),
+	},
+};
+
+static struct clk_regmap t7_dspa_a_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.shift = 0,
+		.width = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspa_a_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspa_a_mux.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspa_a_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.bit_idx = 13,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "dspa_a_gate",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspa_a_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspa_b_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.mask = 0x7,
+		.shift = 26,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspa_b_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_dsp_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_dsp_parent_hws),
+	},
+};
+
+static struct clk_regmap t7_dspa_b_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.shift = 16,
+		.width = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspa_b_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspa_b_mux.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspa_b_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.bit_idx = 29,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "dspa_b_gate",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspa_b_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspa_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_DSPA_CLK_CTRL0,
+		.mask = 0x1,
+		.shift = 15,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspa_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspa_a_gate.hw,
+			&t7_dspa_b_gate.hw,
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspb_a_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.mask = 0x7,
+		.shift = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspb_a_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_dsp_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_dsp_parent_hws),
+	},
+};
+
+static struct clk_regmap t7_dspb_a_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.shift = 0,
+		.width = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspb_a_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspb_a_mux.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspb_a_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.bit_idx = 13,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "dspb_a_gate",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspb_a_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspb_b_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.mask = 0x7,
+		.shift = 26,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspb_b_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_dsp_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_dsp_parent_hws),
+	},
+};
+
+static struct clk_regmap t7_dspb_b_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.shift = 16,
+		.width = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspb_b_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspb_b_mux.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspb_b_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.bit_idx = 29,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "dspb_b_gate",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspb_b_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_regmap t7_dspb_mux = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_DSPB_CLK_CTRL0,
+		.mask = 0x1,
+		.shift = 15,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "dspb_mux",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_dspb_a_gate.hw,
+			&t7_dspb_b_gate.hw,
+		},
+		.num_parents = 2,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+/*12_24M clk*/
+static struct clk_regmap t7_24M_clk_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CLK12_24_CTRL,
+		.bit_idx = 11,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "24m",
+		.ops = &clk_regmap_gate_ops,
+		.parent_data = &(const struct clk_parent_data) {
+			.fw_name = "xtal",
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_12M_clk_div = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "24m_div2",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_24M_clk_gate.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_12M_clk_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CLK12_24_CTRL,
+		.bit_idx = 10,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "12m",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_12M_clk_div.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_25M_clk_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_CLK12_24_CTRL,
+		.shift = 0,
+		.width = 8,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "25M_clk_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_fclk_div2.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_regmap t7_25M_clk_gate = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_CLK12_24_CTRL,
+		.bit_idx = 12,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "25m",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_25M_clk_div.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+/* Video Clocks */
+static struct clk_regmap t7_vid_pll_div = {
+	.data = &(struct meson_vid_pll_div_data){
+		.val = {
+			.reg_off = CLKCTRL_VID_PLL_CLK0_DIV,
+			.shift   = 0,
+			.width   = 15,
+		},
+		.sel = {
+			.reg_off = CLKCTRL_VID_PLL_CLK0_DIV,
+			.shift   = 16,
+			.width   = 2,
+		},
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vid_pll_div",
+		.ops = &meson_vid_pll_div_ro_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmi_pll.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static const struct clk_hw *t7_vid_pll_parent_hws[] = {
+	&t7_vid_pll_div.hw,
+	&t7_hdmi_pll.hw
+};
+
+static struct clk_regmap t7_vid_pll_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_VID_PLL_CLK0_DIV,
+		.mask = 0x1,
+		.shift = 18,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "vid_pll_sel",
+		.ops = &clk_regmap_mux_ops,
+		/*
+		 * bit 18 selects from 2 possible parents:
+		 * vid_pll_div or hdmi_pll
+		 */
+		.parent_hws = t7_vid_pll_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_vid_pll_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_vid_pll = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_PLL_CLK0_DIV,
+		.bit_idx = 19,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vid_pll",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vid_pll_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static const struct clk_hw *t7_vclk_parent_hws[] = {
+	&t7_vid_pll.hw,
+	&t7_gp0_pll.hw,
+	&t7_hifi_pll.hw,
+	&t7_mpll1.hw,
+	&t7_fclk_div3.hw,
+	&t7_fclk_div4.hw,
+	&t7_fclk_div5.hw,
+	&t7_fclk_div7.hw
+};
+
+static struct clk_regmap t7_vclk_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.mask = 0x7,
+		.shift = 16,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = t7_vclk_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_vclk_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_vclk2_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.mask = 0x7,
+		.shift = 16,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk2_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = t7_vclk_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_vclk_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_vclk_input = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_DIV,
+		.bit_idx = 16,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk_input",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk_sel.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2_input = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_DIV,
+		.bit_idx = 16,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2_input",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2_sel.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_VID_CLK0_DIV,
+		.shift = 0,
+		.width = 8,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk_input.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_vclk2_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_VIID_CLK0_DIV,
+		.shift = 0,
+		.width = 8,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk2_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk2_input.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_vclk = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.bit_idx = 19,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk_div.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.bit_idx = 19,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2_div.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk_div1 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.bit_idx = 0,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk_div1",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk_div2_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.bit_idx = 1,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk_div2_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk_div4_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.bit_idx = 2,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk_div4_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk_div6_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.bit_idx = 3,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk_div6_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk_div12_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK0_CTRL,
+		.bit_idx = 4,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk_div12_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2_div1 = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.bit_idx = 0,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2_div1",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2_div2_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.bit_idx = 1,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2_div2_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2_div4_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.bit_idx = 2,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2_div4_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2_div6_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.bit_idx = 3,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2_div6_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_vclk2_div12_en = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VIID_CLK0_CTRL,
+		.bit_idx = 4,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "vclk2_div12_en",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_vclk2.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk_div2 = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk_div2",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk_div2_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk_div4 = {
+	.mult = 1,
+	.div = 4,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk_div4",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk_div4_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk_div6 = {
+	.mult = 1,
+	.div = 6,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk_div6",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk_div6_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk_div12 = {
+	.mult = 1,
+	.div = 12,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk_div12",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk_div12_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk2_div2 = {
+	.mult = 1,
+	.div = 2,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk2_div2",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk2_div2_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk2_div4 = {
+	.mult = 1,
+	.div = 4,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk2_div4",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk2_div4_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk2_div6 = {
+	.mult = 1,
+	.div = 6,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk2_div6",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk2_div6_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static struct clk_fixed_factor t7_vclk2_div12 = {
+	.mult = 1,
+	.div = 12,
+	.hw.init = &(struct clk_init_data){
+		.name = "vclk2_div12",
+		.ops = &clk_fixed_factor_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_vclk2_div12_en.hw
+		},
+		.num_parents = 1,
+	},
+};
+
+static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
+static const struct clk_hw *t7_cts_parent_hws[] = {
+	&t7_vclk_div1.hw,
+	&t7_vclk_div2.hw,
+	&t7_vclk_div4.hw,
+	&t7_vclk_div6.hw,
+	&t7_vclk_div12.hw,
+	&t7_vclk2_div1.hw,
+	&t7_vclk2_div2.hw,
+	&t7_vclk2_div4.hw,
+	&t7_vclk2_div6.hw,
+	&t7_vclk2_div12.hw
+};
+
+static struct clk_regmap t7_cts_enci_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_VID_CLK0_DIV,
+		.mask = 0xf,
+		.shift = 28,
+		.table = mux_table_cts_sel,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cts_enci_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = t7_cts_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_cts_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_cts_encp_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_VID_CLK1_DIV,
+		.mask = 0xf,
+		.shift = 20,
+		.table = mux_table_cts_sel,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cts_encp_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = t7_cts_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_cts_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_cts_vdac_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_VIID_CLK1_DIV,
+		.mask = 0xf,
+		.shift = 28,
+		.table = mux_table_cts_sel,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "cts_vdac_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = t7_cts_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_cts_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+/* TOFIX: add support for cts_tcon */
+static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
+static const struct clk_hw *t7_cts_hdmi_tx_parent_hws[] = {
+	&t7_vclk_div1.hw,
+	&t7_vclk_div2.hw,
+	&t7_vclk_div4.hw,
+	&t7_vclk_div6.hw,
+	&t7_vclk_div12.hw,
+	&t7_vclk2_div1.hw,
+	&t7_vclk2_div2.hw,
+	&t7_vclk2_div4.hw,
+	&t7_vclk2_div6.hw,
+	&t7_vclk2_div12.hw
+};
+
+static struct clk_regmap t7_hdmi_tx_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_HDMI_CLK_CTRL,
+		.mask = 0xf,
+		.shift = 16,
+		.table = mux_table_hdmi_tx_sel,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmi_tx_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_hws = t7_cts_hdmi_tx_parent_hws,
+		.num_parents = ARRAY_SIZE(t7_cts_hdmi_tx_parent_hws),
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
+	},
+};
+
+static struct clk_regmap t7_cts_enci = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK2_CTRL2,
+		.bit_idx = 0,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "cts_enci",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cts_enci_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_cts_encp = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK2_CTRL2,
+		.bit_idx = 2,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "cts_encp",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cts_encp_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_cts_vdac = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK2_CTRL2,
+		.bit_idx = 4,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "cts_vdac",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_cts_vdac_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static struct clk_regmap t7_hdmi_tx = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_VID_CLK2_CTRL2,
+		.bit_idx = 5,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "hdmi_tx",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) {
+			&t7_hdmi_tx_sel.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+	},
+};
+
+static const struct clk_parent_data t7_hdmitx_sys_parent_data[] = {
+	{ .fw_name = "xtal", },
+	{ .hw = &t7_fclk_div4.hw },
+	{ .hw = &t7_fclk_div3.hw },
+	{ .hw = &t7_fclk_div5.hw }
+};
+
+static struct clk_regmap t7_hdmitx_sys_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_HDMI_CLK_CTRL,
+		.mask = 0x3,
+		.shift = 9,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_sys_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_hdmitx_sys_parent_data,
+		.num_parents = ARRAY_SIZE(t7_hdmitx_sys_parent_data),
+	},
+};
+
+static struct clk_regmap t7_hdmitx_sys_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_HDMI_CLK_CTRL,
+		.shift = 0,
+		.width = 7,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_sys_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmitx_sys_sel.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT
+	},
+};
+
+static struct clk_regmap t7_hdmitx_sys = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_HDMI_CLK_CTRL,
+		.bit_idx = 8,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "hdmitx_sys",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmitx_sys.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT
+	},
+};
+
+static struct clk_regmap t7_hdmitx_prif_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL0,
+		.mask = 0x3,
+		.shift = 9,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_prif_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_hdmitx_sys_parent_data,
+		.num_parents = ARRAY_SIZE(t7_hdmitx_sys_parent_data),
+	},
+};
+
+static struct clk_regmap t7_hdmitx_prif_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL0,
+		.shift = 0,
+		.width = 7,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_prif_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmitx_prif_sel.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT
+	},
+};
+
+static struct clk_regmap t7_hdmitx_prif = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL0,
+		.bit_idx = 8,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "hdmitx_prif",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmitx_prif.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT
+	},
+};
+
+static struct clk_regmap t7_hdmitx_200m_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL0,
+		.mask = 0x3,
+		.shift = 25,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_200m_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_hdmitx_sys_parent_data,
+		.num_parents = ARRAY_SIZE(t7_hdmitx_sys_parent_data),
+	},
+};
+
+static struct clk_regmap t7_hdmitx_200m_div = {
+	.data = &(struct clk_regmap_div_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL0,
+		.shift = 16,
+		.width = 7,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_200m_div",
+		.ops = &clk_regmap_divider_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmitx_200m_sel.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT
+	},
+};
+
+static struct clk_regmap t7_hdmitx_200m = {
+	.data = &(struct clk_regmap_gate_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL0,
+		.bit_idx = 24,
+	},
+	.hw.init = &(struct clk_init_data) {
+		.name = "hdmitx_200m",
+		.ops = &clk_regmap_gate_ops,
+		.parent_hws = (const struct clk_hw *[]) { &t7_hdmitx_200m.hw },
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT
+	},
+};
+
+static struct clk_regmap t7_hdmitx_aud_sel = {
+	.data = &(struct clk_regmap_mux_data){
+		.offset = CLKCTRL_HTX_CLK_CTRL1,
+		.mask = 0x3,
+		.shift = 9,
+	},
+	.hw.init = &(struct clk_init_data){
+		.name = "hdmitx_aud_sel",
+		.ops = &clk_regmap_mux_ops,
+		.parent_data = t7_hdmitx_sys_parent_data,
+		.num_parents = ARRAY_SIZE(t7_hdmitx_sys_parent_data),
+	},
+};
+
+static struct clk_regmap t7_hdmitx_aud_div = {
+	.data = &(struct clk_regmap_div_data){
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/clk/meson/t7.h new file +235 -0
new file mode 100644
index 000000000000..25961a658054

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#10 lore raw

Re: [PATCH 3/6] clk: meson: t7: add peripheral clock controller

In reply to Lucas Tanure
kernel test robot noticed the following build warnings:

Hi Lucas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on clk/clk-next tty/tty-testing tty/tty-next tty/tty-linus krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.4-rc6 next-20230616] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lucas-Tanure/dt-bindings-arm-amlogic-add-Amlogic-T7-based-Khadas-VIM4-bindings/20230616-023038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20230615182938.18487-4-tanure%40linux.com
patch subject: [PATCH 3/6] clk: meson: t7: add peripheral clock controller
config: arm64-buildonly-randconfig-r004-20230615 (https://download.01.org/0day-ci/archive/20230616/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230616/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/clk/meson/t7.c:7084:51: warning: initialized field overwritten [-Woverride-init]
7084 | [CLKID_VID_PLL] = &t7_vid_pll.hw,
| ^
drivers/clk/meson/t7.c:7084:51: note: (near initialization for 't7_hw_onecell_data.hws[93]') drivers/clk/meson/t7.c: In function 'meson_t7_probe':

>> drivers/clk/meson/t7.c:7946:36: warning: variable 'mclk_data' set but not used [-Wunused-but-set-variable]
    7946 |         struct meson_clk_pll_data *mclk_data;
         |                                    ^~~~~~~~~
   drivers/clk/meson/t7.c: At top level:
   drivers/clk/meson/t7.c:689:37: warning: 't7_a73_dyn_clk_sel' defined but not used [-Wunused-const-variable=]
     689 | static const struct clk_parent_data t7_a73_dyn_clk_sel[] = {
         |                                     ^~~~~~~~~~~~~~~~~~
   drivers/clk/meson/t7.c:93:29: warning: 'meson_pll_clk_no_ops' defined but not used [-Wunused-const-variable=]
      93 | static const struct clk_ops meson_pll_clk_no_ops = {};
         |                             ^~~~~~~~~~~~~~~~~~~~

vim +/mclk_data +7946 drivers/clk/meson/t7.c

7939
7940 static int __ref meson_t7_probe(struct platform_device *pdev)
7941 {
7942 struct device *dev = &pdev->dev;
7943 struct regmap *basic_map;
7944 struct regmap *pll_map;
7945 struct regmap *cpu_clk_map;

> 7946		struct meson_clk_pll_data *mclk_data;

7947 int ret, i;
7948
7949 /* Get regmap for different clock area */
7950 basic_map = t7_regmap_resource(dev, "basic");
7951 if (IS_ERR(basic_map)) {
7952 dev_err(dev, "basic clk registers not found\n");
7953 return PTR_ERR(basic_map);
7954 }
7955
7956 pll_map = t7_regmap_resource(dev, "pll");
7957 if (IS_ERR(pll_map)) {
7958 dev_err(dev, "pll clk registers not found\n");
7959 return PTR_ERR(pll_map);
7960 }
7961
7962 cpu_clk_map = t7_regmap_resource(dev, "cpu_clk");
7963 if (IS_ERR(cpu_clk_map)) {
7964 dev_err(dev, "cpu clk registers not found\n");
7965 return PTR_ERR(cpu_clk_map);
7966 }
7967
7968 /* Populate regmap for the regmap backed clocks */
7969 for (i = 0; i < ARRAY_SIZE(t7_clk_regmaps); i++)
7970 t7_clk_regmaps[i]->map = basic_map;
7971
7972 for (i = 0; i < ARRAY_SIZE(t7_cpu_clk_regmaps); i++)
7973 t7_cpu_clk_regmaps[i]->map = cpu_clk_map;
7974
7975 for (i = 0; i < ARRAY_SIZE(t7_pll_clk_regmaps); i++)
7976 t7_pll_clk_regmaps[i]->map = pll_map;
7977 regmap_write(pll_map, ANACTRL_MPLL_CTRL0, 0x00000543);
7978
7979 mclk_data = t7_mclk_pll_dco.data;
7980
7981 for (i = 0; i < t7_hw_onecell_data.num; i++) {
7982 /* array might be sparse */
7983 if (!t7_hw_onecell_data.hws[i])
7984 continue;
7985
7986 ret = devm_clk_hw_register(dev, t7_hw_onecell_data.hws[i]);
7987 if (ret) {
7988 dev_err(dev, "Clock registration failed\n");
7989 return ret;
7990 }
7991 }
7992 meson_t7_dvfs_setup(pdev);
7993
7994
7995 return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, &t7_hw_onecell_data);
7996 }
7997

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#11 lore raw

Re: [PATCH 3/6] clk: meson: t7: add peripheral clock controller

Quoted 105 lines · kernel test robot

Hi Lucas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on clk/clk-next tty/tty-testing tty/tty-next tty/tty-linus krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.4-rc6 next-20230616] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lucas-Tanure/dt-bindings-arm-amlogic-add-Amlogic-T7-based-Khadas-VIM4-bindings/20230616-023038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20230615182938.18487-4-tanure%40linux.com
patch subject: [PATCH 3/6] clk: meson: t7: add peripheral clock controller
config: arm64-buildonly-randconfig-r004-20230615 (https://download.01.org/0day-ci/archive/20230616/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230616/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/clk/meson/t7.c:7084:51: warning: initialized field overwritten [-Woverride-init]
7084 | [CLKID_VID_PLL] = &t7_vid_pll.hw,
| ^
drivers/clk/meson/t7.c:7084:51: note: (near initialization for 't7_hw_onecell_data.hws[93]') drivers/clk/meson/t7.c: In function 'meson_t7_probe':

Quoted 1 line
Quoted 1 line

drivers/clk/meson/t7.c:7946:36: warning: variable 'mclk_data' set but not used [-Wunused-but-set-variable]

    7946 |         struct meson_clk_pll_data *mclk_data;
         |                                    ^~~~~~~~~
   drivers/clk/meson/t7.c: At top level:
   drivers/clk/meson/t7.c:689:37: warning: 't7_a73_dyn_clk_sel' defined but not used [-Wunused-const-variable=]
     689 | static const struct clk_parent_data t7_a73_dyn_clk_sel[] = {
         |                                     ^~~~~~~~~~~~~~~~~~
   drivers/clk/meson/t7.c:93:29: warning: 'meson_pll_clk_no_ops' defined but not used [-Wunused-const-variable=]
      93 | static const struct clk_ops meson_pll_clk_no_ops = {};
         |                             ^~~~~~~~~~~~~~~~~~~~

vim +/mclk_data +7946 drivers/clk/meson/t7.c

7939
7940 static int __ref meson_t7_probe(struct platform_device *pdev) 7941 {

  7942          struct device *dev = &pdev->dev;
  7943          struct regmap *basic_map;
  7944          struct regmap *pll_map;
  7945          struct regmap *cpu_clk_map;
> 7946          struct meson_clk_pll_data *mclk_data;
  7947          int ret, i;
  7948
  7949          /* Get regmap for different clock area */
  7950          basic_map = t7_regmap_resource(dev, "basic");
  7951          if (IS_ERR(basic_map)) {

7952 dev_err(dev, "basic clk registers not found\n");
7953 return PTR_ERR(basic_map);
7954 }
7955
7956 pll_map = t7_regmap_resource(dev, "pll");
7957 if (IS_ERR(pll_map)) {
7958 dev_err(dev, "pll clk registers not found\n");
7959 return PTR_ERR(pll_map);
7960 }
7961
7962 cpu_clk_map = t7_regmap_resource(dev, "cpu_clk");
7963 if (IS_ERR(cpu_clk_map)) {
7964 dev_err(dev, "cpu clk registers not found\n");
7965 return PTR_ERR(cpu_clk_map);
7966 }
7967
7968 /* Populate regmap for the regmap backed clocks */
7969 for (i = 0; i < ARRAY_SIZE(t7_clk_regmaps); i++)
7970 t7_clk_regmaps[i]->map = basic_map;
7971
7972 for (i = 0; i < ARRAY_SIZE(t7_cpu_clk_regmaps); i++)
7973 t7_cpu_clk_regmaps[i]->map = cpu_clk_map;
7974
7975 for (i = 0; i < ARRAY_SIZE(t7_pll_clk_regmaps); i++)
7976 t7_pll_clk_regmaps[i]->map = pll_map;
7977 regmap_write(pll_map, ANACTRL_MPLL_CTRL0, 0x00000543);
7978
7979 mclk_data = t7_mclk_pll_dco.data;
7980
7981 for (i = 0; i < t7_hw_onecell_data.num; i++) {
7982 /* array might be sparse */
7983 if (!t7_hw_onecell_data.hws[i])
7984 continue;
7985
7986 ret = devm_clk_hw_register(dev, t7_hw_onecell_data.hws[i]);
7987 if (ret) {
7988 dev_err(dev, "Clock registration failed\n");
7989 return ret;
7990 }
7991 }
7992 meson_t7_dvfs_setup(pdev);
7993
7994
7995 return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, &t7_hw_onecell_data);
7996 }
7997

Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

I will drop this patch and use the S4 clock driver after it lands. Thanks

#12 lore raw

Re: [PATCH 3/6] clk: meson: t7: add peripheral clock controller

In reply to Lucas Tanure
kernel test robot noticed the following build warnings:

Hi Lucas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on clk/clk-next tty/tty-testing tty/tty-next tty/tty-linus krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.4-rc7 next-20230620] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lucas-Tanure/dt-bindings-arm-amlogic-add-Amlogic-T7-based-Khadas-VIM4-bindings/20230616-023038
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20230615182938.18487-4-tanure%40linux.com
patch subject: [PATCH 3/6] clk: meson: t7: add peripheral clock controller
config: arm64-randconfig-r001-20230620 (https://download.01.org/0day-ci/archive/20230621/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce: (https://download.01.org/0day-ci/archive/20230621/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/clk/meson/t7.c:7084:23: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[CLKID_VID_PLL] = &t7_vid_pll.hw,
^~~~~~~~~~~~~~
drivers/clk/meson/t7.c:7082:23: note: previous initialization is here
[CLKID_VID_PLL] = &t7_vid_pll_div.hw,
^~~~~~~~~~~~~~~~~~
drivers/clk/meson/t7.c:7946:29: warning: variable 'mclk_data' set but not used [-Wunused-but-set-variable]

           struct meson_clk_pll_data *mclk_data;
                                      ^
>> drivers/clk/meson/t7.c:93:29: warning: unused variable 'meson_pll_clk_no_ops' [-Wunused-const-variable]
   static const struct clk_ops meson_pll_clk_no_ops = {};
                               ^
>> drivers/clk/meson/t7.c:689:37: warning: unused variable 't7_a73_dyn_clk_sel' [-Wunused-const-variable]
   static const struct clk_parent_data t7_a73_dyn_clk_sel[] = {
                                       ^

4 warnings generated.

vim +/meson_pll_clk_no_ops +93 drivers/clk/meson/t7.c

    92	
  > 93	static const struct clk_ops meson_pll_clk_no_ops = {};
    94	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#13 lore raw

PATCH 4/6 dt-bindings: serial: amlogic, meson-uart: support T7

In reply to Lucas Tanure

Add serial bindings support menson T7 SoC family.

---
 Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
index 01ec45b3b406..01b01f8840ea 100644
@@ -46,6 +46,7 @@ properties:
           - amlogic,meson8b-uart
           - amlogic,meson-gx-uart
           - amlogic,meson-s4-uart
+          - amlogic,meson-t7-uart
       - description: Everything-Else power domain UART controller on G12A SoCs
         items:
           - const: amlogic,meson-g12a-uart

--
2.41.0

#14 lore raw

Re: [PATCH 4/6] dt-bindings: serial: amlogic, meson-uart: support T7

Quoted 12 lines · Lucas Tanure

Add serial bindings support menson T7 SoC family.

---
 Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -0
index 01ec45b3b406..01b01f8840ea 100644

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 4 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
@@ -46,6 +46,7 @@ properties:
           - amlogic,meson8b-uart
           - amlogic,meson-gx-uart
           - amlogic,meson-s4-uart
+          - amlogic,meson-t7-uart
| diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
| index 2501db5a7aaf..0208f9a6ba7e 100644
| --- a/drivers/tty/serial/meson_uart.c
| +++ b/drivers/tty/serial/meson_uart.c
| @@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
|                 .compatible = "amlogic,meson-s4-uart",
|                 .data = (void *)&meson_g12a_uart_data,
|         },
| +       {
| +               .compatible = "amlogic,meson-t7-uart",
| +               .data = (void *)&meson_g12a_uart_data,
| +       },
|         { /* sentinel */ },
|  };
|  MODULE_DEVICE_TABLE(of, meson_uart_dt_match);

You're adding another element to this enum, but the driver change implies compatibility with the s4 uart. Should you not set this up with fallback compatibles?

Cheers,
Conor.

Quoted 6 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -1
       - description: Everything-Else power domain UART controller on G12A SoCs
         items:
           - const: amlogic,meson-g12a-uart
--

2.41.0

#15 lore raw

Re: [PATCH 4/6] dt-bindings: serial: amlogic, meson-uart: support T7

Quoted 35 lines · Conor Dooley
Quoted 12 lines · Lucas Tanure

Add serial bindings support menson T7 SoC family.

---
 Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -0
index 01ec45b3b406..01b01f8840ea 100644

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 4 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
@@ -46,6 +46,7 @@ properties:
           - amlogic,meson8b-uart
           - amlogic,meson-gx-uart
           - amlogic,meson-s4-uart
+          - amlogic,meson-t7-uart
| diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
| index 2501db5a7aaf..0208f9a6ba7e 100644
| --- a/drivers/tty/serial/meson_uart.c
| +++ b/drivers/tty/serial/meson_uart.c
| @@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
|                 .compatible = "amlogic,meson-s4-uart",
|                 .data = (void *)&meson_g12a_uart_data,
|         },
| +       {
| +               .compatible = "amlogic,meson-t7-uart",
| +               .data = (void *)&meson_g12a_uart_data,
| +       },
|         { /* sentinel */ },
|  };
|  MODULE_DEVICE_TABLE(of, meson_uart_dt_match);
Quoted 3 lines

You're adding another element to this enum, but the driver change implies compatibility with the s4 uart. Should you not set this up with fallback compatibles?

I will drop this patch and use the s4 and g12a compatible strings.

Quoted 10 lines

Cheers,
Conor.

Quoted 6 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -1
       - description: Everything-Else power domain UART controller on G12A SoCs
         items:
           - const: amlogic,meson-g12a-uart
--

2.41.0

#16 lore raw

Re: [PATCH 4/6] dt-bindings: serial: amlogic, meson-uart: support T7

Quoted 36 lines · Lucas Tanure
Quoted 35 lines · Conor Dooley
Quoted 12 lines · Lucas Tanure

Add serial bindings support menson T7 SoC family.

---
 Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -0
index 01ec45b3b406..01b01f8840ea 100644

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 49

Quoted 4 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +1 -0
@@ -46,6 +46,7 @@ properties:
           - amlogic,meson8b-uart
           - amlogic,meson-gx-uart
           - amlogic,meson-s4-uart
+          - amlogic,meson-t7-uart
| diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
| index 2501db5a7aaf..0208f9a6ba7e 100644
| --- a/drivers/tty/serial/meson_uart.c
| +++ b/drivers/tty/serial/meson_uart.c
| @@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
|                 .compatible = "amlogic,meson-s4-uart",
|                 .data = (void *)&meson_g12a_uart_data,
|         },
| +       {
| +               .compatible = "amlogic,meson-t7-uart",
| +               .data = (void *)&meson_g12a_uart_data,
| +       },
|         { /* sentinel */ },
|  };
|  MODULE_DEVICE_TABLE(of, meson_uart_dt_match);
Quoted 5 lines
Quoted 3 lines

You're adding another element to this enum, but the driver change implies compatibility with the s4 uart. Should you not set this up with fallback compatibles?

I will drop this patch and use the s4 and g12a compatible strings.

You still need to add a compatible for the t7, just let it fall back to one of the others. Eg:
compatible = "amlogic,meson-t7-uart", "amlogic,meson-s4-uart";

Cheers,
Conor.

#17 lore raw

PATCH 5/6 tty: serial: meson: Added T7 SOC compatibility

In reply to Lucas Tanure

Make UART driver compatible with T7 SOC UART.

---
 drivers/tty/serial/meson_uart.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/meson_uart.c +4 -0
index 2501db5a7aaf..0208f9a6ba7e 100644
@@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
 		.compatible = "amlogic,meson-s4-uart",
 		.data = (void *)&meson_g12a_uart_data,
 	},
+	{
+		.compatible = "amlogic,meson-t7-uart",
+		.data = (void *)&meson_g12a_uart_data,
+	},
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, meson_uart_dt_match);

--
2.41.0

#18 lore raw

Re: [PATCH 5/6] tty: serial: meson: Added T7 SOC compatibility

Hi Lucas:

Quoted 12 lines · Lucas Tanure

Make UART driver compatible with T7 SOC UART.

---
 drivers/tty/serial/meson_uart.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/meson_uart.c +0 -0
index 2501db5a7aaf..0208f9a6ba7e 100644

drivers/tty/serial/meson_uart.c static const struct of_device_id meson_uart_dt_match[] = { · line 801

Quoted 6 lines
drivers/tty/serial/meson_uart.c +3 -0
@@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
 		.compatible = "amlogic,meson-s4-uart",
 		.data = (void *)&meson_g12a_uart_data,
 	},
+	{
+		.compatible = "amlogic,meson-t7-uart",
+		.data = (void *)&meson_g12a_uart_data,

I think you are trying to follow previous s4 scheme - to introduce a new compatible string, while I think it's not necessary or even wrong, this will just make the dt_match_list longer but without obvious benefits..

as Conor already raised this question in previous dt-binding patch[4/6], how about just using 'amlogic,meson-g12a-uart' which is the first compatible introduced.

if people agree, we could also drop 'amlogic,meson-s4-uart' since it use same compatible data as gl12a, anyway it should be separated into another patch..

Quoted 14 lines
drivers/tty/serial/meson_uart.c +1 -0
+	},
 	{ /* sentinel */ },
 
 

};
MODULE_DEVICE_TABLE(of, meson_uart_dt_match);
--
2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Signature · 3 lines
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55
#19 lore raw

Re: [PATCH 5/6] tty: serial: meson: Added T7 SOC compatibility

Quoted 48 lines · Yixun Lan

Hi Lucas:

Quoted 12 lines · Lucas Tanure

Make UART driver compatible with T7 SOC UART.

---
 drivers/tty/serial/meson_uart.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/meson_uart.c +0 -0
index 2501db5a7aaf..0208f9a6ba7e 100644

drivers/tty/serial/meson_uart.c static const struct of_device_id meson_uart_dt_match[] = { · line 801

Quoted 6 lines
drivers/tty/serial/meson_uart.c +3 -0
@@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
              .compatible = "amlogic,meson-s4-uart",
              .data = (void *)&meson_g12a_uart_data,
      },
+     {
+             .compatible = "amlogic,meson-t7-uart",
+             .data = (void *)&meson_g12a_uart_data,

I think you are trying to follow previous s4 scheme - to introduce a new compatible string, while I think it's not necessary or even wrong, this will just make the dt_match_list longer but without obvious benefits..

as Conor already raised this question in previous dt-binding patch[4/6], how about just using 'amlogic,meson-g12a-uart' which is the first compatible introduced.

if people agree, we could also drop 'amlogic,meson-s4-uart' since it use same compatible data as gl12a, anyway it should be separated into another patch..

Quoted 10 lines
drivers/tty/serial/meson_uart.c +1 -0
+     },
      { /* sentinel */ },
 
 

};
MODULE_DEVICE_TABLE(of, meson_uart_dt_match);
--
2.41.0

Quoted 4 lines

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Quoted 4 lines

--
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55

Yes, I am dropping this patch and using s4 and g12a compatible lines.

#20 lore raw

Re: [PATCH 5/6] tty: serial: meson: Added T7 SOC compatibility

Quoted 27 lines · Lucas Tanure
Quoted 26 lines · Yixun Lan

Hi Lucas:

Quoted 12 lines · Lucas Tanure

Make UART driver compatible with T7 SOC UART.

---
 drivers/tty/serial/meson_uart.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/meson_uart.c +0 -0
index 2501db5a7aaf..0208f9a6ba7e 100644

drivers/tty/serial/meson_uart.c static const struct of_device_id meson_uart_dt_match[] = { · line 801

Quoted 6 lines
drivers/tty/serial/meson_uart.c +3 -0
@@ -796,6 +796,10 @@ static const struct of_device_id meson_uart_dt_match[] = {
              .compatible = "amlogic,meson-s4-uart",
              .data = (void *)&meson_g12a_uart_data,
      },
+     {
+             .compatible = "amlogic,meson-t7-uart",
+             .data = (void *)&meson_g12a_uart_data,

I think you are trying to follow previous s4 scheme - to introduce a new compatible string, while I think it's not necessary or even wrong, this will just make the dt_match_list longer but without obvious benefits..

Quoted 8 lines
Quoted 6 lines

as Conor already raised this question in previous dt-binding patch[4/6], how about just using 'amlogic,meson-g12a-uart' which is the first compatible introduced.

if people agree, we could also drop 'amlogic,meson-s4-uart' since it use same compatible data as gl12a, anyway it should be separated into another patch..

Yes, I am dropping this patch and using s4 and g12a compatible lines.

If you drop the "amlogic,meson-s4-uart" from here it will break backwards compatibility, because the binding permits "amlogic,meson-s4-uart" in isolation. Please do not make that change.

When you introduce the new compatible for the t7, it can fall back to the s4 (or g12a), doesn't really matter, but the existing one for the s4 should not be touched.

Cheers,
Conor.

#21 lore raw

PATCH 6/6 arm64: dts: meson-t7-a311d2-khadas-vim4: add initial device-tree

In reply to Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/meson-t7-a311d2-khadas-vim4.dts   | 112 ++++++++++
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     | 202 ++++++++++++++++++
 3 files changed, 315 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..1c5846bd1ca0 100644
@@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-t7-a311d2-khadas-vim4.dtb
arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts new file +112 -0

112 lines not on this page · raw message

arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +202 -0

202 lines not on this page · raw message

--
2.41.0

#22 lore raw

Re: [PATCH 6/6] arm64: dts: meson-t7-a311d2-khadas-vim4: add initial device-tree

Hi Lucas:

Quoted 2 lines · Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

I'd like to see little bit more verbose messages here, like which functionality/driver added here - cpu, gic, timer, uart?

so, it's capable of booting into a serial console?

Quoted 299 lines

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/meson-t7-a311d2-khadas-vim4.dts   | 112 ++++++++++
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     | 202 ++++++++++++++++++
 3 files changed, 315 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..1c5846bd1ca0 100644
@@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-t7-a311d2-khadas-vim4.dtb
arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts new file +112 -0
new file mode 100644
index 000000000000..46e175536edf
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Wesion, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-t7.dtsi"
+
+/ {
+	model = "Khadas VIM4";
+
+	aliases {
+		serial0 = &uart_A;
+	};
+
+	reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		/* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+		secmon_reserved: secmon@5000000 {
+			reg = <0x0 0x05000000 0x0 0x300000>;
+			no-map;
+		};
+
+		/* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+		secmon_reserved_bl32: secmon@5300000 {
+			reg = <0x0 0x05300000 0x0 0x2000000>;
+			no-map;
+		};
+	};
+
+	xtal: xtal-clk {
+		compatible = "fixed-clock";
+		clock-frequency = <24000000>;
+		clock-output-names = "xtal";
+		#clock-cells = <0>;
+	};
+
+	vddcpu_a: regulator-vddcpu-a {
+		/*
+		 * MP8756GD Regulator.
+		 */
+		compatible = "pwm-regulator";
+
+		regulator-name = "VDDCPU_A";
+		regulator-min-microvolt = <689000>;
+		regulator-max-microvolt = <1049000>;
+
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	vddcpu_b: regulator-vddcpu-a {
+		/*
+		 * MP8756GD Regulator.
+		 */
+		compatible = "pwm-regulator";
+
+		regulator-name = "VDDCPU_B";
+		regulator-min-microvolt = <689000>;
+		regulator-max-microvolt = <1049000>;
+
+		regulator-boot-on;
+		regulator-always-on;
+	};
+};
+
+&clkc{
+	clocks = <&xtal>;
+	clock-names = "xtal";
+	status = "okay";
+};
+
+&uart_A {
+	status = "okay";
+};
+
+&cpu0 {
+	cpu-supply = <&vddcpu_a>;
+};
+
+&cpu1 {
+	cpu-supply = <&vddcpu_a>;
+};
+
+&cpu2 {
+	cpu-supply = <&vddcpu_a>;
+};
+
+&cpu3 {
+	cpu-supply = <&vddcpu_a>;
+};
+
+&cpu100 {
+	cpu-supply = <&vddcpu_b>;
+};
+
+&cpu101 {
+	cpu-supply = <&vddcpu_b>;
+};
+
+&cpu102 {
+	cpu-supply = <&vddcpu_b>;
+};
+
+&cpu103 {
+	cpu-supply = <&vddcpu_b>;
+};
+
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +141 -0
new file mode 100644
index 000000000000..453b3d9cb9d8
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/clock/mesont7-clkc.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "amlogic,t7";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <0x2>;
+		#size-cells = <0x0>;
+
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu100>;
+				};
+				core1 {
+					cpu = <&cpu101>;
+				};
+				core2 {
+					cpu = <&cpu102>;
+				};
+				core3 {
+					cpu = <&cpu103>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+				core1 {
+					cpu = <&cpu1>;
+				};
+				core2 {
+					cpu = <&cpu2>;
+				};
+				core3 {
+					cpu = <&cpu3>;
+				};
+			};
+		};
+
+		cpu100: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x100>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <632>;
+			dynamic-power-coefficient = <110>;
+			#cooling-cells = <2>;
+		};
+
+		cpu101: cpu@101{
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x101>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <632>;
+			dynamic-power-coefficient = <110>;
+			#cooling-cells = <2>;
+		};
+
+		cpu102: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x102>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <632>;
+			dynamic-power-coefficient = <110>;
+			#cooling-cells = <2>;
+		};
+
+		cpu103: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0 0x103>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <632>;
+			dynamic-power-coefficient = <110>;
+			#cooling-cells = <2>;
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+			dynamic-power-coefficient = <550>;
+			#cooling-cells = <2>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+			dynamic-power-coefficient = <550>;
+			#cooling-cells = <2>;
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+			dynamic-power-coefficient = <550>;
+			#cooling-cells = <2>;
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x3>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+			dynamic-power-coefficient = <550>;
+			#cooling-cells = <2>;
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 0xff08>,
+			     <GIC_PPI 14 0xff08>,
+			     <GIC_PPI 11 0xff08>,
+			     <GIC_PPI 10 0xff08>;
+	};
+
+	gic: interrupt-controller@fff01000 {
+		compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";

arch/arm64/boot/dts/amlogic/meson-t7.dtsi line 151

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +10 -0
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0x0 0xfff01000 0 0x1000>,
+		      <0x0 0xfff02000 0 0x0100>;
+		interrupts = <GIC_PPI 9 0xf04>;
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";

can you double check if it is actual version 0.2?
most recent Amlogic SoC should support psci-1.0

Quoted 38 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +38 -0
+		method = "smc";
+	};
+
+	sm: secure-monitor {
+		compatible = "amlogic,meson-gxbb-sm";
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		apb4: apb4@fe000000 {
+			compatible = "simple-bus";
+			reg = <0x0 0xfe000000 0x0 0x480000>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+			clkc: clock-controller {
+				compatible = "amlogic,t7-clkc";
+				#clock-cells = <1>;
+				reg = <0x0 0x0 0x0 0x49c>,
+				      <0x0 0x8000 0x0 0x320>,
+				      <0x0 0xe040 0x0 0xbc>;
+				reg-names = "basic",
+					    "pll",
+					    "cpu_clk";
+			};
+
+			ao-secure@140 {
+				compatible = "amlogic,meson-gx-ao-secure", "syscon";
+				reg=<0x0 0x10220 0x0 0x140>;
+				amlogic,has-chip-id;
+			};
+		};
+

arch/arm64/boot/dts/amlogic/meson-t7.dtsi line 199

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +10 -0
+		uart_A: serial@fe078000 {
+			compatible = "amlogic,meson-t7-uart";
+			reg = <0x0 0xfe078000 0x0 0x18>;
+			interrupts = <0 168 1>;
+			status = "disabled";
+			clocks = <&xtal>, <&clkc CLKID_UART_A>, <&xtal>;
+			clock-names = "xtal", "pclk", "baud";
+			fifo-size = < 64 >;
+			pinctrl-names = "default";
+		};

I believe there are more uart ports, it's worth the effort to add them all in one run, which sounds more consistent to me, anyway you could also choose to add them in later patch series, no problem..

Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +3 -1
+	};
+};
+
--

2.41.0

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Signature · 3 lines
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55
#23 lore raw

Re: [PATCH 6/6] arm64: dts: meson-t7-a311d2-khadas-vim4: add initial device-tree

Quoted 8 lines · Yixun Lan

Hi Lucas:

Quoted 2 lines · Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

I'd like to see little bit more verbose messages here, like which functionality/driver added here - cpu, gic, timer, uart?

Ok, I add this information in the next version.
Its adding CPU, GIC, and UART.

Quoted 2 lines

so, it's capable of booting into a serial console?

yes

Quoted 356 lines
Quoted 300 lines

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/meson-t7-a311d2-khadas-vim4.dts   | 112 ++++++++++
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     | 202 ++++++++++++++++++
 3 files changed, 315 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..1c5846bd1ca0 100644
@@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-t7-a311d2-khadas-vim4.dtb
arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts new file +112 -0
new file mode 100644
index 000000000000..46e175536edf
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Wesion, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-t7.dtsi"
+
+/ {
+     model = "Khadas VIM4";
+
+     aliases {
+             serial0 = &uart_A;
+     };
+
+     reserved-memory {
+             #address-cells = <2>;
+             #size-cells = <2>;
+             ranges;
+
+             /* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+             secmon_reserved: secmon@5000000 {
+                     reg = <0x0 0x05000000 0x0 0x300000>;
+                     no-map;
+             };
+
+             /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+             secmon_reserved_bl32: secmon@5300000 {
+                     reg = <0x0 0x05300000 0x0 0x2000000>;
+                     no-map;
+             };
+     };
+
+     xtal: xtal-clk {
+             compatible = "fixed-clock";
+             clock-frequency = <24000000>;
+             clock-output-names = "xtal";
+             #clock-cells = <0>;
+     };
+
+     vddcpu_a: regulator-vddcpu-a {
+             /*
+              * MP8756GD Regulator.
+              */
+             compatible = "pwm-regulator";
+
+             regulator-name = "VDDCPU_A";
+             regulator-min-microvolt = <689000>;
+             regulator-max-microvolt = <1049000>;
+
+             regulator-boot-on;
+             regulator-always-on;
+     };
+
+     vddcpu_b: regulator-vddcpu-a {
+             /*
+              * MP8756GD Regulator.
+              */
+             compatible = "pwm-regulator";
+
+             regulator-name = "VDDCPU_B";
+             regulator-min-microvolt = <689000>;
+             regulator-max-microvolt = <1049000>;
+
+             regulator-boot-on;
+             regulator-always-on;
+     };
+};
+
+&clkc{
+     clocks = <&xtal>;
+     clock-names = "xtal";
+     status = "okay";
+};
+
+&uart_A {
+     status = "okay";
+};
+
+&cpu0 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu1 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu2 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu3 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu100 {
+     cpu-supply = <&vddcpu_b>;
+};
+
+&cpu101 {
+     cpu-supply = <&vddcpu_b>;
+};
+
+&cpu102 {
+     cpu-supply = <&vddcpu_b>;
+};
+
+&cpu103 {
+     cpu-supply = <&vddcpu_b>;
+};
+
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +141 -0
new file mode 100644
index 000000000000..453b3d9cb9d8
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/clock/mesont7-clkc.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+     compatible = "amlogic,t7";
+     interrupt-parent = <&gic>;
+     #address-cells = <2>;
+     #size-cells = <2>;
+
+     cpus {
+             #address-cells = <0x2>;
+             #size-cells = <0x0>;
+
+             cpu-map {
+                     cluster0 {
+                             core0 {
+                                     cpu = <&cpu100>;
+                             };
+                             core1 {
+                                     cpu = <&cpu101>;
+                             };
+                             core2 {
+                                     cpu = <&cpu102>;
+                             };
+                             core3 {
+                                     cpu = <&cpu103>;
+                             };
+                     };
+
+                     cluster1 {
+                             core0 {
+                                     cpu = <&cpu0>;
+                             };
+                             core1 {
+                                     cpu = <&cpu1>;
+                             };
+                             core2 {
+                                     cpu = <&cpu2>;
+                             };
+                             core3 {
+                                     cpu = <&cpu3>;
+                             };
+                     };
+             };
+
+             cpu100: cpu@100 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x100>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu101: cpu@101{
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x101>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu102: cpu@102 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x102>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu103: cpu@103 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x103>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu0: cpu@0 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x0>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu1: cpu@1 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x1>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu2: cpu@2 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x2>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu3: cpu@3 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x3>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+     };
+
+     timer {
+             compatible = "arm,armv8-timer";
+             interrupts = <GIC_PPI 13 0xff08>,
+                          <GIC_PPI 14 0xff08>,
+                          <GIC_PPI 11 0xff08>,
+                          <GIC_PPI 10 0xff08>;
+     };
+
+     gic: interrupt-controller@fff01000 {
+             compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";

arch/arm64/boot/dts/amlogic/meson-t7.dtsi line 151

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +10 -0
+             #interrupt-cells = <3>;
+             #address-cells = <0>;
+             interrupt-controller;
+             reg = <0x0 0xfff01000 0 0x1000>,
+                   <0x0 0xfff02000 0 0x0100>;
+             interrupts = <GIC_PPI 9 0xf04>;
+     };
+
+     psci {
+             compatible = "arm,psci-0.2";

can you double check if it is actual version 0.2?
most recent Amlogic SoC should support psci-1.0

Quoted 43 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +43 -0
+             method = "smc";
+     };
+
+     sm: secure-monitor {
+             compatible = "amlogic,meson-gxbb-sm";
+     };
+
+     soc {
+             compatible = "simple-bus";
+             #address-cells = <2>;
+             #size-cells = <2>;
+             ranges;
+
+             apb4: apb4@fe000000 {
+                     compatible = "simple-bus";
+                     reg = <0x0 0xfe000000 0x0 0x480000>;
+                     #address-cells = <2>;
+                     #size-cells = <2>;
+                     ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+                     clkc: clock-controller {
+                             compatible = "amlogic,t7-clkc";
+                             #clock-cells = <1>;
+                             reg = <0x0 0x0 0x0 0x49c>,
+                                   <0x0 0x8000 0x0 0x320>,
+                                   <0x0 0xe040 0x0 0xbc>;
+                             reg-names = "basic",
+                                         "pll",
+                                         "cpu_clk";
+                     };
+
+                     ao-secure@140 {
+                             compatible = "amlogic,meson-gx-ao-secure", "syscon";
+                             reg=<0x0 0x10220 0x0 0x140>;
+                             amlogic,has-chip-id;
+                     };
+             };
+
+             uart_A: serial@fe078000 {
+                     compatible = "amlogic,meson-t7-uart";
+                     reg = <0x0 0xfe078000 0x0 0x18>;
+                     interrupts = <0 168 1>;
+                     status = "disabled";
Quoted 8 lines

arch/arm64/boot/dts/amlogic/meson-t7.dtsi line 199

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +5 -0
+                     clocks = <&xtal>, <&clkc CLKID_UART_A>, <&xtal>;
+                     clock-names = "xtal", "pclk", "baud";
+                     fifo-size = < 64 >;
+                     pinctrl-names = "default";
+             };

I believe there are more uart ports, it's worth the effort to add them all in one run, which sounds more consistent to me, anyway you could also choose to add them in later patch series, no problem..

Yeah, I prefer to add those uarts later, when I can propper test them.

Quoted 17 lines
Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +3 -1
+     };
+};
+
--

2.41.0

Quoted 4 lines

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

--
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55

#24 lore raw

Re: [PATCH 6/6] arm64: dts: meson-t7-a311d2-khadas-vim4: add initial device-tree

Quoted 382 lines · Lucas Tanure
Quoted 8 lines · Yixun Lan

Hi Lucas:

Quoted 2 lines · Lucas Tanure

The Khadas VIM4 uses the Amlogic A311D2 SoC, based on the Amlogic T7 SoC family, on a board with the same form factor as the VIM3 models.

I'd like to see little bit more verbose messages here, like which functionality/driver added here - cpu, gic, timer, uart?

Ok, I add this information in the next version.
Its adding CPU, GIC, and UART.

Quoted 2 lines

so, it's capable of booting into a serial console?

yes

Quoted 356 lines
Quoted 300 lines

- 8GB LPDDR4X 2016MHz
- 32GB eMMC 5.1 storage
- 32MB SPI flash
- 10/100/1000 Base-T Ethernet
- AP6275S Wireless (802.11 a/b/g/n/ac/ax, BT5.1)
- HDMI 2.1 video
- HDMI Input
- 1x USB 2.0 + 1x USB 3.0 ports
- 1x USB-C (power) with USB 2.0 OTG
- 3x LED's (1x red, 1x blue, 1x white)
- 3x buttons (power, function, reset)
- M2 socket with PCIe, USB, ADC & I2C
- 40pin GPIO Header
- 1x micro SD card slot

---
 arch/arm64/boot/dts/amlogic/Makefile          |   1 +
 .../amlogic/meson-t7-a311d2-khadas-vim4.dts   | 112 ++++++++++
 arch/arm64/boot/dts/amlogic/meson-t7.dtsi     | 202 ++++++++++++++++++
 3 files changed, 315 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-t7.dtsi
arch/arm64/boot/dts/amlogic/Makefile +1 -0
index cd1c5b04890a..1c5846bd1ca0 100644
@@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-t7-a311d2-khadas-vim4.dtb
arch/arm64/boot/dts/amlogic/meson-t7-a311d2-khadas-vim4.dts new file +112 -0
new file mode 100644
index 000000000000..46e175536edf
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Wesion, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-t7.dtsi"
+
+/ {
+     model = "Khadas VIM4";
+
+     aliases {
+             serial0 = &uart_A;
+     };
+
+     reserved-memory {
+             #address-cells = <2>;
+             #size-cells = <2>;
+             ranges;
+
+             /* 3 MiB reserved for ARM Trusted Firmware (BL31) */
+             secmon_reserved: secmon@5000000 {
+                     reg = <0x0 0x05000000 0x0 0x300000>;
+                     no-map;
+             };
+
+             /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+             secmon_reserved_bl32: secmon@5300000 {
+                     reg = <0x0 0x05300000 0x0 0x2000000>;
+                     no-map;
+             };
+     };
+
+     xtal: xtal-clk {
+             compatible = "fixed-clock";
+             clock-frequency = <24000000>;
+             clock-output-names = "xtal";
+             #clock-cells = <0>;
+     };
+
+     vddcpu_a: regulator-vddcpu-a {
+             /*
+              * MP8756GD Regulator.
+              */
+             compatible = "pwm-regulator";
+
+             regulator-name = "VDDCPU_A";
+             regulator-min-microvolt = <689000>;
+             regulator-max-microvolt = <1049000>;
+
+             regulator-boot-on;
+             regulator-always-on;
+     };
+
+     vddcpu_b: regulator-vddcpu-a {
+             /*
+              * MP8756GD Regulator.
+              */
+             compatible = "pwm-regulator";
+
+             regulator-name = "VDDCPU_B";
+             regulator-min-microvolt = <689000>;
+             regulator-max-microvolt = <1049000>;
+
+             regulator-boot-on;
+             regulator-always-on;
+     };
+};
+
+&clkc{
+     clocks = <&xtal>;
+     clock-names = "xtal";
+     status = "okay";
+};
+
+&uart_A {
+     status = "okay";
+};
+
+&cpu0 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu1 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu2 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu3 {
+     cpu-supply = <&vddcpu_a>;
+};
+
+&cpu100 {
+     cpu-supply = <&vddcpu_b>;
+};
+
+&cpu101 {
+     cpu-supply = <&vddcpu_b>;
+};
+
+&cpu102 {
+     cpu-supply = <&vddcpu_b>;
+};
+
+&cpu103 {
+     cpu-supply = <&vddcpu_b>;
+};
+
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +141 -0
new file mode 100644
index 000000000000..453b3d9cb9d8
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/clock/mesont7-clkc.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+     compatible = "amlogic,t7";
+     interrupt-parent = <&gic>;
+     #address-cells = <2>;
+     #size-cells = <2>;
+
+     cpus {
+             #address-cells = <0x2>;
+             #size-cells = <0x0>;
+
+             cpu-map {
+                     cluster0 {
+                             core0 {
+                                     cpu = <&cpu100>;
+                             };
+                             core1 {
+                                     cpu = <&cpu101>;
+                             };
+                             core2 {
+                                     cpu = <&cpu102>;
+                             };
+                             core3 {
+                                     cpu = <&cpu103>;
+                             };
+                     };
+
+                     cluster1 {
+                             core0 {
+                                     cpu = <&cpu0>;
+                             };
+                             core1 {
+                                     cpu = <&cpu1>;
+                             };
+                             core2 {
+                                     cpu = <&cpu2>;
+                             };
+                             core3 {
+                                     cpu = <&cpu3>;
+                             };
+                     };
+             };
+
+             cpu100: cpu@100 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x100>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu101: cpu@101{
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x101>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu102: cpu@102 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x102>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu103: cpu@103 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a53";
+                     reg = <0x0 0x103>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <632>;
+                     dynamic-power-coefficient = <110>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu0: cpu@0 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x0>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu1: cpu@1 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x1>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu2: cpu@2 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x2>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+
+             cpu3: cpu@3 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a73";
+                     reg = <0x0 0x3>;
+                     enable-method = "psci";
+                     capacity-dmips-mhz = <1024>;
+                     dynamic-power-coefficient = <550>;
+                     #cooling-cells = <2>;
+             };
+     };
+
+     timer {
+             compatible = "arm,armv8-timer";
+             interrupts = <GIC_PPI 13 0xff08>,
+                          <GIC_PPI 14 0xff08>,
+                          <GIC_PPI 11 0xff08>,
+                          <GIC_PPI 10 0xff08>;
+     };
+
+     gic: interrupt-controller@fff01000 {
+             compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";

arch/arm64/boot/dts/amlogic/meson-t7.dtsi line 151

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +10 -0
+             #interrupt-cells = <3>;
+             #address-cells = <0>;
+             interrupt-controller;
+             reg = <0x0 0xfff01000 0 0x1000>,
+                   <0x0 0xfff02000 0 0x0100>;
+             interrupts = <GIC_PPI 9 0xf04>;
+     };
+
+     psci {
+             compatible = "arm,psci-0.2";

can you double check if it is actual version 0.2?
most recent Amlogic SoC should support psci-1.0

Quoted 43 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +43 -0
+             method = "smc";
+     };
+
+     sm: secure-monitor {
+             compatible = "amlogic,meson-gxbb-sm";
+     };
+
+     soc {
+             compatible = "simple-bus";
+             #address-cells = <2>;
+             #size-cells = <2>;
+             ranges;
+
+             apb4: apb4@fe000000 {
+                     compatible = "simple-bus";
+                     reg = <0x0 0xfe000000 0x0 0x480000>;
+                     #address-cells = <2>;
+                     #size-cells = <2>;
+                     ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+                     clkc: clock-controller {
+                             compatible = "amlogic,t7-clkc";
+                             #clock-cells = <1>;
+                             reg = <0x0 0x0 0x0 0x49c>,
+                                   <0x0 0x8000 0x0 0x320>,
+                                   <0x0 0xe040 0x0 0xbc>;
+                             reg-names = "basic",
+                                         "pll",
+                                         "cpu_clk";
+                     };
+
+                     ao-secure@140 {
+                             compatible = "amlogic,meson-gx-ao-secure", "syscon";
+                             reg=<0x0 0x10220 0x0 0x140>;
+                             amlogic,has-chip-id;
+                     };
+             };
+
+             uart_A: serial@fe078000 {
+                     compatible = "amlogic,meson-t7-uart";
+                     reg = <0x0 0xfe078000 0x0 0x18>;
+                     interrupts = <0 168 1>;
+                     status = "disabled";
Quoted 8 lines

arch/arm64/boot/dts/amlogic/meson-t7.dtsi line 199

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +5 -0
+                     clocks = <&xtal>, <&clkc CLKID_UART_A>, <&xtal>;
+                     clock-names = "xtal", "pclk", "baud";
+                     fifo-size = < 64 >;
+                     pinctrl-names = "default";
+             };

I believe there are more uart ports, it's worth the effort to add them all in one run, which sounds more consistent to me, anyway you could also choose to add them in later patch series, no problem..

Quoted 19 lines

Yeah, I prefer to add those uarts later, when I can propper test them.

Quoted 17 lines
Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-t7.dtsi new file +3 -1
+     };
+};
+
--

2.41.0

Quoted 4 lines

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

--
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55

The datasheet I have doesn't mention the version of PSCI supported, so I can't check.
But It continues to work ( serial log ) when using the 1.0 version.