Skip to contentSkip to conversation

Introduce ASPEED AST27XX BMC SoC

PATCH Superseded Kevin Chen 6 participants 28 messages Aug 2, 2024 – Oct 8, 2024

Subsystems (8)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kevin Chen

author
#0 lore raw

cover Introduce ASPEED AST27XX BMC SoC

This patchset adds initial support for the ASPEED. AST27XX Board Management controller (BMC) SoC family.

AST2700 is ASPEED's 8th-generation server management processor. Featuring a quad-core ARM Cortex A35 64-bit processor and two independent ARM Cortex M4 processors

This patchset adds minimal architecture and drivers such as:
Clocksource, Clock and Reset

This patchset was tested on the ASPEED AST2700 evaluation board.

Kevin Chen (10):
dt-binding: mfd: aspeed,ast2x00-scu: Add binding for ASPEED AST2700
SCU
dt-binding: clk: ast2700: Add binding for Aspeed AST27xx Clock
clk: ast2700: add clock controller
dt-bindings: reset: ast2700: Add binding for ASPEED AST2700 Reset
dt-bindings: arm: aspeed: Add maintainer
dt-bindings: arm: aspeed: Add aspeed,ast2700-evb compatible string
arm64: aspeed: Add support for ASPEED AST2700 BMC SoC
arm64: dts: aspeed: Add initial AST27XX device tree
arm64: dts: aspeed: Add initial AST2700 EVB device tree
arm64: defconfig: Add ASPEED AST2700 family support

 .../bindings/arm/aspeed/aspeed.yaml           |    6 +
 .../bindings/mfd/aspeed,ast2x00-scu.yaml      |    3 +
 MAINTAINERS                                   |    3 +
 arch/arm64/Kconfig.platforms                  |   14 +
 arch/arm64/boot/dts/Makefile                  |    1 +
 arch/arm64/boot/dts/aspeed/Makefile           |    4 +
 arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi     |  217 +++
 arch/arm64/boot/dts/aspeed/ast2700-evb.dts    |   50 +
 arch/arm64/configs/defconfig                  |    1 +
 drivers/clk/Makefile                          |    1 +
 drivers/clk/clk-ast2700.c                     | 1166 +++++++++++++++++
 .../dt-bindings/clock/aspeed,ast2700-clk.h    |  180 +++
 .../dt-bindings/reset/aspeed,ast2700-reset.h  |  126 ++
 13 files changed, 1772 insertions(+)
 create mode 100644 arch/arm64/boot/dts/aspeed/Makefile
 create mode 100644 arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi
 create mode 100644 arch/arm64/boot/dts/aspeed/ast2700-evb.dts
 create mode 100644 drivers/clk/clk-ast2700.c
 create mode 100644 include/dt-bindings/clock/aspeed,ast2700-clk.h
 create mode 100644 include/dt-bindings/reset/aspeed,ast2700-reset.h
Signature · 1 line
2.34.1
author
#1 lore raw

v2 cover Introduce ASPEED AST27XX BMC SoC

This patchset adds initial support for the ASPEED. AST27XX Board Management controller (BMC) SoC family.

AST2700 is ASPEED's 8th-generation server management processor. Featuring a quad-core ARM Cortex A35 64-bit processor and two independent ARM Cortex M4 processors

This patchset adds minimal architecture and drivers such as:
Clocksource, Clock and Reset

This patchset was tested on the ASPEED AST2700 evaluation board.

Kevin Chen (9):
dt-bindings: mfd: aspeed,ast2x00-scu: Add ASPEED AST2700-SCUX schema
dt-bindings: reset: ast2700: Add ASPEED AST27xx Reset schema
dt-bindings: clk: ast2700: Add ASPEED AST27XX Clock schema
clk: ast2700: add clock controller
dt-bindings: arm: aspeed: Add ASPEED AST27XX SoC
arm64: aspeed: Add support for ASPEED AST27XX BMC SoC
arm64: defconfig: Add ASPEED AST2700 family support
arm64: dts: aspeed: Add initial AST27XX device tree
arm64: dts: aspeed: Add initial AST2700 EVB device tree

 .../bindings/arm/aspeed/aspeed.yaml           |    7 +
 .../bindings/mfd/aspeed,ast2x00-scu.yaml      |   70 +-
 MAINTAINERS                                   |    3 +
 arch/arm64/Kconfig.platforms                  |   14 +
 arch/arm64/boot/dts/Makefile                  |    1 +
 arch/arm64/boot/dts/aspeed/Makefile           |    4 +
 arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi     |  185 +++
 arch/arm64/boot/dts/aspeed/ast2700-evb.dts    |   58 +
 arch/arm64/configs/defconfig                  |    1 +
 drivers/clk/Makefile                          |    1 +
 drivers/clk/clk-ast2700.c                     | 1173 +++++++++++++++++
 .../dt-bindings/clock/aspeed,ast2700-clk.h    |  175 +++
 .../dt-bindings/reset/aspeed,ast2700-reset.h  |  132 ++
 13 files changed, 1804 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm64/boot/dts/aspeed/Makefile
 create mode 100644 arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi
 create mode 100644 arch/arm64/boot/dts/aspeed/ast2700-evb.dts
 create mode 100644 drivers/clk/clk-ast2700.c
 create mode 100644 include/dt-bindings/clock/aspeed,ast2700-clk.h
 create mode 100644 include/dt-bindings/reset/aspeed,ast2700-reset.h
Signature · 1 line
2.34.1
#2 lore raw
Quoted 11 lines · Kevin Chen

This patchset adds initial support for the ASPEED. AST27XX Board Management controller (BMC) SoC family.

AST2700 is ASPEED's 8th-generation server management processor. Featuring a quad-core ARM Cortex A35 64-bit processor and two independent ARM Cortex M4 processors

This patchset adds minimal architecture and drivers such as:
Clocksource, Clock and Reset

This patchset was tested on the ASPEED AST2700 evaluation board.

Where is the changelog? You ignored several comments, did not bother to respond them, did not implement them.

No changelog means you sent exactly the same? This is not how it works. Please read submitting patches, respond to all comments or implement them, provide *DETAILED* changelog in the cover letter or individual patches (---).

Best regards,
Krzysztof

author
#3 lore raw

PATCH v2 1/9 dt-bindings: mfd: aspeed,ast2x00-scu: Add ASPEED AST2700-SCUX schema

In reply to Kevin Chen

Add compatible for two SCU of SCU0 and SCU1 in AST2700.

---
 .../bindings/mfd/aspeed,ast2x00-scu.yaml      | 70 +++++++++++++------
 1 file changed, 50 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml +50 -20
index 86ee69c0f45b..3426b1c84132 100644
@@ -13,33 +13,62 @@ description:
 maintainers:
   - Joel Stanley <[email protected]>
   - Andrew Jeffery <[email protected]>
+  - Kevin Chen <[email protected]>
 
-properties:
-  compatible:
-    items:
-      - enum:
-          - aspeed,ast2400-scu
-          - aspeed,ast2500-scu
-          - aspeed,ast2600-scu
-      - const: syscon
-      - const: simple-mfd
+scu@ast2xx00-scu:
+  properties:
+    compatible:
+      items:
+        - enum:
+            - aspeed,ast2400-scu
+            - aspeed,ast2500-scu
+            - aspeed,ast2600-scu
+        - const: syscon
+        - const: simple-mfd
 
-  reg:
-    maxItems: 1
+    reg:
+      maxItems: 1
 
-  ranges: true
+    ranges: true
 
-  '#address-cells':
-    const: 1
+    '#address-cells':
+      const: 1
 
-  '#size-cells':
-    const: 1
+    '#size-cells':
+      const: 1
 
-  '#clock-cells':
-    const: 1
+    '#clock-cells':
+      const: 1
 
-  '#reset-cells':
-    const: 1
+    '#reset-cells':
+      const: 1
+
+scu@ast2xx00-scux:
+  properties:
+    compatible:
+      items:
+        - enum:
+            - aspeed,ast2700-scu0
+            - aspeed,ast2700-scu1
+        - const: syscon
+        - const: simple-mfd
+
+    reg:
+      maxItems: 1
+
+    ranges: true
+
+    '#address-cells':
+      const: 2
+
+    '#size-cells':
+      const: 2
+
+    '#clock-cells':
+      const: 1
+
+    '#reset-cells':
+      const: 1
 
 patternProperties:
   '^p2a-control@[0-9a-f]+$':
@@ -76,6 +105,7 @@ patternProperties:
               - aspeed,ast2400-silicon-id
               - aspeed,ast2500-silicon-id
               - aspeed,ast2600-silicon-id
+              - aspeed,ast2700-silicon-id
           - const: aspeed,silicon-id
 
       reg:
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 1/9] dt-bindings: mfd: aspeed,ast2x00-scu: Add ASPEED AST2700-SCUX schema

Quoted 4 lines · Kevin Chen

Add compatible for two SCU of SCU0 and SCU1 in AST2700.

---

A nit, subject: drop second/last, redundant "schema". The "dt-bindings" prefix is already stating that these are bindings in the schema. See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

Quoted 22 lines
 .../bindings/mfd/aspeed,ast2x00-scu.yaml      | 70 +++++++++++++------
 1 file changed, 50 insertions(+), 20 deletions(-)
Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml +1 -9
index 86ee69c0f45b..3426b1c84132 100644
@@ -13,33 +13,62 @@ description:
 maintainers:
   - Joel Stanley <[email protected]>
   - Andrew Jeffery <[email protected]>
+  - Kevin Chen <[email protected]>
 
-properties:
-  compatible:
-    items:
-      - enum:
-          - aspeed,ast2400-scu
-          - aspeed,ast2500-scu
-          - aspeed,ast2600-scu
-      - const: syscon
-      - const: simple-mfd

Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml description: · line 27

Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml +10 -0
+scu at ast2xx00-scu:
+  properties:
+    compatible:
+      items:
+        - enum:
+            - aspeed,ast2400-scu
+            - aspeed,ast2500-scu
+            - aspeed,ast2600-scu
+        - const: syscon
+        - const: simple-mfd

No, no, no, this code is neither correct nor makes any sense.

Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml description: · line 32

Quoted 8 lines
Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml +3 -3
-  reg:
-    maxItems: 1
+    reg:
+      maxItems: 1
 
-  ranges: true
+    ranges: true

What?

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v2 1/9] dt-bindings: mfd: aspeed,ast2x00-scu: Add ASPEED AST2700-SCUX schema

In reply to Kevin Chen
Quoted 7 lines · Kevin Chen

Add compatible for two SCU of SCU0 and SCU1 in AST2700.

---
 .../bindings/mfd/aspeed,ast2x00-scu.yaml      | 70 +++++++++++++------
 1 file changed, 50 insertions(+), 20 deletions(-)

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml: 'scu at ast2xx00-scu' is not one of ['$id', '$schema', 'title', 'description', 'examples', 'required', 'allOf', 'anyOf', 'oneOf', 'definitions', '$defs', 'additionalProperties', 'dependencies', 'dependentRequired', 'dependentSchemas', 'patternProperties', 'properties', 'not', 'if', 'then', 'else', 'unevaluatedProperties', 'deprecated', 'maintainers', 'select', '$ref']
from schema $id: http://devicetree.org/meta-schemas/base.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml: 'scu at ast2xx00-scux' is not one of ['$id', '$schema', 'title', 'description', 'examples', 'required', 'allOf', 'anyOf', 'oneOf', 'definitions', '$defs', 'additionalProperties', 'dependencies', 'dependentRequired', 'dependentSchemas', 'patternProperties', 'properties', 'not', 'if', 'then', 'else', 'unevaluatedProperties', 'deprecated', 'maintainers', 'select', '$ref']
from schema $id: http://devicetree.org/meta-schemas/base.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml: scu at ast2xx00-scu: Missing additionalProperties/unevaluatedProperties constraint
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml: scu at ast2xx00-scux: Missing additionalProperties/unevaluatedProperties constraint

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240802090544.2741206-3-kevin_chen at aspeedtech.com

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.

author
#6 lore raw

PATCH v2 2/9 dt-bindings: reset: ast2700: Add ASPEED AST27xx Reset schema

In reply to Kevin Chen

Add Reset schema for AST2700.

---
 .../dt-bindings/reset/aspeed,ast2700-reset.h  | 132 ++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 include/dt-bindings/reset/aspeed,ast2700-reset.h
include/dt-bindings/reset/aspeed,ast2700-reset.h new file +132 -0
new file mode 100644
index 000000000000..c75653c1bbf3
@@ -0,0 +1,132 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Device Tree binding constants for AST2700 reset controller.
+ *
+ * Copyright (c) 2023 Aspeed Technology Inc.
+ */
+
+#ifndef _MACH_ASPEED_AST2700_RESET_H_
+#define _MACH_ASPEED_AST2700_RESET_H_
+
+/* SOC0 */
+#define SCU0_RESET_SDRAM	(0)
+#define SCU0_RESET_DDRPHY	(1)
+#define SCU0_RESET_RSA		(2)
+#define SCU0_RESET_SHA3	(3)
+#define SCU0_RESET_HACE	(4)
+#define SCU0_RESET_SOC		(5)
+#define SCU0_RESET_VIDEO	(6)
+#define SCU0_RESET_2D		(7)
+#define SCU0_RESET_PCIS	(8)
+#define SCU0_RESET_RVAS0	(9)
+#define SCU0_RESET_RVAS1	(10)
+#define SCU0_RESET_SM3		(11)
+#define SCU0_RESET_SM4		(12)
+#define SCU0_RESET_CRT0	(13)
+#define SCU0_RESET_ECC		(14)
+#define SCU0_RESET_DP_PCI	(15)
+#define SCU0_RESET_UFS		(16)
+#define SCU0_RESET_EMMC	(17)
+#define SCU0_RESET_PCIE1RST	(18)
+#define SCU0_RESET_PCIE1RSTOE	(19)
+#define SCU0_RESET_PCIE0RST	(20)
+#define SCU0_RESET_PCIE0RSTOE	(21)
+#define SCU0_RESET_JTAG	(22)
+#define SCU0_RESET_MCTP0	(23)
+#define SCU0_RESET_MCTP1	(24)
+#define SCU0_RESET_XDMA0	(25)
+#define SCU0_RESET_XDMA1	(26)
+#define SCU0_RESET_H2X1	(27)
+#define SCU0_RESET_DP		(28)
+#define SCU0_RESET_DP_MCU	(29)
+#define SCU0_RESET_SSP		(30)
+#define SCU0_RESET_H2X0	(31)
+#define SCU0_RESET_PORTA_VHUB1	(32)
+#define SCU0_RESET_PORTA_PHY3	(33)
+#define SCU0_RESET_PORTA_XHCI	(34)
+#define SCU0_RESET_PORTB_VHUB1	(35)
+#define SCU0_RESET_PORTB_PHY3	(36)
+#define SCU0_RESET_PORTB_XHCI	(37)
+#define SCU0_RESET_PORTA_EHCI	(38)
+#define SCU0_RESET_PORTA_VHUB0	(38)
+#define SCU0_RESET_PORTB_EHCI	(39)
+#define SCU0_RESET_PORTB_VHUB0	(39)
+#define SCU0_RESET_UHCI	(40)
+#define SCU0_RESET_TSP		(41)
+#define SCU0_RESET_E2M0	(42)
+#define SCU0_RESET_E2M1	(43)
+#define SCU0_RESET_VLINK	(44)
+
+#define SOC0_RESET_NUMS	(SCU0_RESET_VLINK + 1)
+
+/* SOC1 */
+#define SCU1_RESET_LPC0	(0)
+#define SCU1_RESET_LPC1	(1)
+#define SCU1_RESET_MII		(2)
+#define SCU1_RESET_PECI	(3)
+#define SCU1_RESET_PWM		(4)
+#define SCU1_RESET_MAC0	(5)
+#define SCU1_RESET_MAC1	(6)
+#define SCU1_RESET_MAC2	(7)
+#define SCU1_RESET_ADC		(8)
+#define SCU1_RESET_SD		(9)
+#define SCU1_RESET_ESPI0	(10)
+#define SCU1_RESET_ESPI1	(11)
+#define SCU1_RESET_JTAG1	(12)
+#define SCU1_RESET_SPI0	(13)
+#define SCU1_RESET_SPI1	(14)
+#define SCU1_RESET_SPI2	(15)
+#define SCU1_RESET_I3C0	(16)
+#define SCU1_RESET_I3C1	(17)
+#define SCU1_RESET_I3C2	(18)
+#define SCU1_RESET_I3C3	(19)
+#define SCU1_RESET_I3C4	(20)
+#define SCU1_RESET_I3C5	(21)
+#define SCU1_RESET_I3C6	(22)
+#define SCU1_RESET_I3C7	(23)
+#define SCU1_RESET_I3C8	(24)
+#define SCU1_RESET_I3C9	(25)
+#define SCU1_RESET_I3C10	(26)
+#define SCU1_RESET_I3C11	(27)
+#define SCU1_RESET_I3C12	(28)
+#define SCU1_RESET_I3C13	(29)
+#define SCU1_RESET_I3C14	(30)
+#define SCU1_RESET_I3C15	(31)
+#define SCU1_RESET_I3C15	(31)
+#define SCU1_RESET_MCU0	(32)
+#define SCU1_RESET_MCU1	(33)
+#define SCU1_RESET_H2A_SPI1	(34)
+#define SCU1_RESET_H2A_SPI2	(35)
+#define SCU1_RESET_UART0	(36)
+#define SCU1_RESET_UART1	(37)
+#define SCU1_RESET_UART2	(38)
+#define SCU1_RESET_UART3	(39)
+#define SCU1_RESET_I2C_FILTER	(40)
+#define SCU1_RESET_CALIPTRA	(41)
+#define SCU1_RESET_XDMA	(42)
+/* reserved 43 */
+#define SCU1_RESET_FSI		(44)
+#define SCU1_RESET_CAN		(45)
+#define SCU1_RESET_MCTP	(46)
+#define SCU1_RESET_I2C		(47)
+#define SCU1_RESET_UART6	(48)
+#define SCU1_RESET_UART7	(49)
+#define SCU1_RESET_UART8	(50)
+#define SCU1_RESET_UART9	(51)
+#define SCU1_RESET_LTPI	(52)
+#define SCU1_RESET_VGAL	(53)
+#define SCU1_RESET_LTPI1	(54)
+#define SCU1_RESET_ACE		(55)
+#define SCU1_RESET_E2M		(56)
+#define SCU1_RESET_UHCI	(57)
+#define SCU1_RESET_PORTC_EHCI	(58)
+#define SCU1_RESET_PORTC_VHUB	(59)
+#define SCU1_RESET_PORTD_EHCI	(60)
+#define SCU1_RESET_PORTD_VHUB	(61)
+#define SCU1_RESET_H2X		(62)
+#define SCU1_RESET_I3CDMA	(63)
+#define SCU1_RESET_PCIE2RST	(64)
+
+#define SOC1_RESET_NUMS	(SCU1_RESET_PCIE2RST + 1)
+
+#endif  /* _MACH_ASPEED_AST2700_RESET_H_ */
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH v2 2/9] dt-bindings: reset: ast2700: Add ASPEED AST27xx Reset schema

Quoted 3 lines · Kevin Chen

Add Reset schema for AST2700.

So you just ignored all the comments?

No, respond to each of them so we will all know that you understood them.

You already got this comment:
A nit, subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

and not much improved. Drop "schema".

Anyway, rest was ignored:

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof

author
#8 lore raw

PATCH v2 3/9 dt-bindings: clk: ast2700: Add ASPEED AST27XX Clock schema

In reply to Kevin Chen

Add Clock schema for AST2700.

---
 .../dt-bindings/clock/aspeed,ast2700-clk.h    | 175 ++++++++++++++++++
 1 file changed, 175 insertions(+)
 create mode 100644 include/dt-bindings/clock/aspeed,ast2700-clk.h
include/dt-bindings/clock/aspeed,ast2700-clk.h new file +175 -0
new file mode 100644
index 000000000000..e2850b0b8920
@@ -0,0 +1,175 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Device Tree binding constants for AST2700 clock controller.
+ *
+ * Copyright (c) 2023 Aspeed Technology Inc.
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_AST2700_H
+#define __DT_BINDINGS_CLOCK_AST2700_H
+
+/* SOC0 clk-gate */
+#define SCU0_CLK_GATE_MCLK		(0)
+#define SCU0_CLK_GATE_ECLK		(1)
+#define SCU0_CLK_GATE_2DCLK		(2)
+#define SCU0_CLK_GATE_VCLK		(3)
+#define SCU0_CLK_GATE_BCLK		(4)
+#define SCU0_CLK_GATE_VGA0CLK		(5)
+#define SCU0_CLK_GATE_REFCLK		(6)
+#define SCU0_CLK_GATE_PORTBUSB2CLK	(7)
+#define SCU0_CLK_GATE_RSV8		(8)
+#define SCU0_CLK_GATE_UHCICLK		(9)
+#define SCU0_CLK_GATE_VGA1CLK		(10)
+#define SCU0_CLK_GATE_DDRPHYCLK	(11)
+#define SCU0_CLK_GATE_E2M0CLK		(12)
+#define SCU0_CLK_GATE_HACCLK		(13)
+#define SCU0_CLK_GATE_PORTAUSB2CLK	(14)
+#define SCU0_CLK_GATE_UART4CLK		(15)
+#define SCU0_CLK_GATE_SLICLK		(16)
+#define SCU0_CLK_GATE_DACCLK		(17)
+#define SCU0_CLK_GATE_DP		(18)
+#define SCU0_CLK_GATE_E2M1CLK		(19)
+#define SCU0_CLK_GATE_CRT0CLK		(20)
+#define SCU0_CLK_GATE_CRT1CLK		(21)
+#define SCU0_CLK_GATE_VLCLK		(22)
+#define SCU0_CLK_GATE_ECDSACLK		(23)
+#define SCU0_CLK_GATE_RSACLK		(24)
+#define SCU0_CLK_GATE_RVAS0CLK		(25)
+#define SCU0_CLK_GATE_UFSCLK		(26)
+#define SCU0_CLK_GATE_EMMCCLK		(27)
+#define SCU0_CLK_GATE_RVAS1CLK		(28)
+/* reserved 29 ~ 31*/
+#define SCU0_CLK_GATE_NUM	(SCU0_CLK_GATE_RVAS1CLK + 1)
+
+/* SOC0 clk */
+#define SCU0_CLKIN		(SCU0_CLK_GATE_NUM + 0)
+#define SCU0_CLK_24M		(SCU0_CLK_GATE_NUM + 1)
+#define SCU0_CLK_192M		(SCU0_CLK_GATE_NUM + 2)
+#define SCU0_CLK_UART		(SCU0_CLK_GATE_NUM + 3)
+#define SCU0_CLK_PSP		(SCU0_CLK_GATE_NUM + 4)
+#define SCU0_CLK_HPLL		(SCU0_CLK_GATE_NUM + 5)
+#define SCU0_CLK_HPLL_DIV2	(SCU0_CLK_GATE_NUM + 6)
+#define SCU0_CLK_HPLL_DIV4	(SCU0_CLK_GATE_NUM + 7)
+#define SCU0_CLK_DPLL		(SCU0_CLK_GATE_NUM + 8)
+#define SCU0_CLK_MPLL		(SCU0_CLK_GATE_NUM + 9)
+#define SCU0_CLK_MPLL_DIV2	(SCU0_CLK_GATE_NUM + 10)
+#define SCU0_CLK_MPLL_DIV4	(SCU0_CLK_GATE_NUM + 11)
+#define SCU0_CLK_MPLL_DIV8	(SCU0_CLK_GATE_NUM + 12)
+#define SCU0_CLK_VGA0		(SCU0_CLK_GATE_NUM + 13)
+#define SCU0_CLK_VGA1		(SCU0_CLK_GATE_NUM + 14)
+#define SCU0_CLK_CRT0		(SCU0_CLK_GATE_NUM + 15)
+#define SCU0_CLK_CRT1		(SCU0_CLK_GATE_NUM + 16)
+#define SCU0_CLK_MPHY		(SCU0_CLK_GATE_NUM + 17)
+#define SCU0_CLK_AXI0		(SCU0_CLK_GATE_NUM + 18)
+#define SCU0_CLK_AXI1		(SCU0_CLK_GATE_NUM + 19)
+#define SCU0_CLK_AHB		(SCU0_CLK_GATE_NUM + 20)
+#define SCU0_CLK_APB		(SCU0_CLK_GATE_NUM + 21)
+#define SCU0_CLK_MCLK		(SCU0_CLK_GATE_NUM + 22)
+#define SCU0_CLK_ECLK		(SCU0_CLK_GATE_NUM + 23)
+#define SCU0_CLK_VCLK		(SCU0_CLK_GATE_NUM + 24)
+#define SCU0_CLK_BCLK		(SCU0_CLK_GATE_NUM + 25)
+#define SCU0_CLK_REF		(SCU0_CLK_GATE_NUM + 26)
+#define SCU0_CLK_UART4		(SCU0_CLK_GATE_NUM + 27)
+#define SCU0_CLK_SLI		(SCU0_CLK_GATE_NUM + 28)
+#define SCU0_CLK_UFS		(SCU0_CLK_GATE_NUM + 29)
+#define SCU0_CLK_EMMCMUX	(SCU0_CLK_GATE_NUM + 30)
+#define SCU0_CLK_EMMC		(SCU0_CLK_GATE_NUM + 31)
+#define SCU0_CLK_U2PHY_CLK12M	(SCU0_CLK_GATE_NUM + 32)
+#define SCU0_CLK_U2PHY_REFCLK	(SCU0_CLK_GATE_NUM + 33)
+
+#define SOC0_NUM_CLKS		(SCU0_CLK_U2PHY_REFCLK + 1)
+
+/* SOC1 clk gate */
+#define SCU1_CLK_GATE_LCLK0		(0)
+#define SCU1_CLK_GATE_LCLK1		(1)
+#define SCU1_CLK_GATE_ESPI0CLK		(2)
+#define SCU1_CLK_GATE_ESPI1CLK		(3)
+#define SCU1_CLK_GATE_SDCLK		(4)
+#define SCU1_CLK_GATE_IPEREFCLK	(5) /* io die pcie ref clk */
+#define SCU1_CLK_GATE_RSV5CLK		(6)
+#define SCU1_CLK_GATE_LPCHCLK		(7)
+#define SCU1_CLK_GATE_MAC0CLK		(8)
+#define SCU1_CLK_GATE_MAC1CLK		(9)
+#define SCU1_CLK_GATE_MAC2CLK		(10)
+#define SCU1_CLK_GATE_UART0CLK		(11)
+#define SCU1_CLK_GATE_UART1CLK		(12)
+#define SCU1_CLK_GATE_UART2CLK		(13)
+#define SCU1_CLK_GATE_UART3CLK		(14)
+#define SCU1_CLK_GATE_I2CCLK		(15)
+#define SCU1_CLK_GATE_I3C0CLK		(16)
+#define SCU1_CLK_GATE_I3C1CLK		(17)
+#define SCU1_CLK_GATE_I3C2CLK		(18)
+#define SCU1_CLK_GATE_I3C3CLK		(19)
+#define SCU1_CLK_GATE_I3C4CLK		(20)
+#define SCU1_CLK_GATE_I3C5CLK		(21)
+#define SCU1_CLK_GATE_I3C6CLK		(22)
+#define SCU1_CLK_GATE_I3C7CLK		(23)
+#define SCU1_CLK_GATE_I3C8CLK		(24)
+#define SCU1_CLK_GATE_I3C9CLK		(25)
+#define SCU1_CLK_GATE_I3C10CLK		(26)
+#define SCU1_CLK_GATE_I3C11CLK		(27)
+#define SCU1_CLK_GATE_I3C12CLK		(28)
+#define SCU1_CLK_GATE_I3C13CLK		(29)
+#define SCU1_CLK_GATE_I3C14CLK		(30)
+#define SCU1_CLK_GATE_I3C15CLK		(31)
+
+#define SCU1_CLK_GATE_UART5CLK		(32 + 0)
+#define SCU1_CLK_GATE_UART6CLK		(32 + 1)
+#define SCU1_CLK_GATE_UART7CLK		(32 + 2)
+#define SCU1_CLK_GATE_UART8CLK		(32 + 3)
+#define SCU1_CLK_GATE_UART9CLK		(32 + 4)
+#define SCU1_CLK_GATE_UART10CLK	(32 + 5)
+#define SCU1_CLK_GATE_UART11CLK	(32 + 6)
+#define SCU1_CLK_GATE_UART12CLK	(32 + 7)
+#define SCU1_CLK_GATE_FSICLK		(32 + 8)
+#define SCU1_CLK_GATE_LTPIPHYCLK	(32 + 9)
+#define SCU1_CLK_GATE_LTPICLK		(32 + 10)
+#define SCU1_CLK_GATE_VGALCLK		(32 + 11)
+#define SCU1_CLK_GATE_USBUARTCLK	(32 + 12)
+#define SCU1_CLK_GATE_CANCLK		(32 + 13)
+#define SCU1_CLK_GATE_PCICLK		(32 + 14)
+#define SCU1_CLK_GATE_SLICLK		(32 + 15)
+#define SCU1_CLK_GATE_E2MCLK		(32 + 16)
+#define SCU1_CLK_GATE_PORTCUSB2CLK	(32 + 17)
+#define SCU1_CLK_GATE_PORTDUSB2CLK	(32 + 18)
+#define SCU1_CLK_GATE_LTPI1TXCLK	(32 + 19)
+
+#define SCU1_CLK_GATE_NUM	(SCU1_CLK_GATE_LTPI1TXCLK + 1)
+
+/* SOC1 clk */
+#define SCU1_CLKIN		(SCU1_CLK_GATE_NUM + 0)
+#define SCU1_CLK_HPLL		(SCU1_CLK_GATE_NUM + 1)
+#define SCU1_CLK_APLL		(SCU1_CLK_GATE_NUM + 2)
+#define SCU1_CLK_APLL_DIV2	(SCU1_CLK_GATE_NUM + 3)
+#define SCU1_CLK_APLL_DIV4	(SCU1_CLK_GATE_NUM + 4)
+#define SCU1_CLK_DPLL		(SCU1_CLK_GATE_NUM + 5)
+#define SCU1_CLK_UXCLK		(SCU1_CLK_GATE_NUM + 6)
+#define SCU1_CLK_HUXCLK	(SCU1_CLK_GATE_NUM + 7)
+#define SCU1_CLK_UARTX		(SCU1_CLK_GATE_NUM + 8)
+#define SCU1_CLK_HUARTX	(SCU1_CLK_GATE_NUM + 9)
+#define SCU1_CLK_AHB		(SCU1_CLK_GATE_NUM + 10)
+#define SCU1_CLK_APB		(SCU1_CLK_GATE_NUM + 11)
+#define SCU1_CLK_UART0		(SCU1_CLK_GATE_NUM + 12)
+#define SCU1_CLK_UART1		(SCU1_CLK_GATE_NUM + 13)
+#define SCU1_CLK_UART2		(SCU1_CLK_GATE_NUM + 14)
+#define SCU1_CLK_UART3		(SCU1_CLK_GATE_NUM + 15)
+#define SCU1_CLK_UART5		(SCU1_CLK_GATE_NUM + 16)
+#define SCU1_CLK_UART6		(SCU1_CLK_GATE_NUM + 17)
+#define SCU1_CLK_UART7		(SCU1_CLK_GATE_NUM + 18)
+#define SCU1_CLK_UART8		(SCU1_CLK_GATE_NUM + 19)
+#define SCU1_CLK_UART9		(SCU1_CLK_GATE_NUM + 20)
+#define SCU1_CLK_UART10	(SCU1_CLK_GATE_NUM + 21)
+#define SCU1_CLK_UART11	(SCU1_CLK_GATE_NUM + 22)
+#define SCU1_CLK_UART12	(SCU1_CLK_GATE_NUM + 23)
+#define SCU1_CLK_APLL_DIVN	(SCU1_CLK_GATE_NUM + 24)
+#define SCU1_CLK_SDMUX		(SCU1_CLK_GATE_NUM + 25)
+#define SCU1_CLK_SDCLK		(SCU1_CLK_GATE_NUM + 26)
+#define SCU1_CLK_RMII		(SCU1_CLK_GATE_NUM + 27)
+#define SCU1_CLK_RGMII		(SCU1_CLK_GATE_NUM + 28)
+#define SCU1_CLK_MACHCLK	(SCU1_CLK_GATE_NUM + 29)
+#define SCU1_CLK_MAC0RCLK	(SCU1_CLK_GATE_NUM + 30)
+#define SCU1_CLK_MAC1RCLK	(SCU1_CLK_GATE_NUM + 31)
+
+#define SOC1_NUM_CLKS		(SCU1_CLK_MAC1RCLK + 1)
+
+#endif
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v2 3/9] dt-bindings: clk: ast2700: Add ASPEED AST27XX Clock schema

Quoted 3 lines · Kevin Chen

Add Clock schema for AST2700.

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof

author
#10 lore raw

PATCH v2 4/9 clk: ast2700: add clock controller

In reply to Kevin Chen

Add support for ast2700 clock controller.

---
 drivers/clk/Makefile      |    1 +
 drivers/clk/clk-ast2700.c | 1173 +++++++++++++++++++++++++++++++++++++
 2 files changed, 1174 insertions(+)
 create mode 100644 drivers/clk/clk-ast2700.c
drivers/clk/Makefile +1 -0
index f793a16cad40..0d5992ea0fa4 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_COMMON_CLK_FSL_SAI)	+= clk-fsl-sai.o
 obj-$(CONFIG_COMMON_CLK_GEMINI)		+= clk-gemini.o
 obj-$(CONFIG_COMMON_CLK_ASPEED)		+= clk-aspeed.o
 obj-$(CONFIG_MACH_ASPEED_G6)		+= clk-ast2600.o
+obj-$(CONFIG_MACH_ASPEED_G7)		+= clk-ast2700.o
 obj-$(CONFIG_ARCH_HIGHBANK)		+= clk-highbank.o
 obj-$(CONFIG_CLK_HSDK)			+= clk-hsdk-pll.o
 obj-$(CONFIG_COMMON_CLK_K210)		+= clk-k210.o
drivers/clk/clk-ast2700.c new file +1173 -0

1,173 lines not on this page · raw message

Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH v2 4/9] clk: ast2700: add clock controller

Quoted 8 lines · Kevin Chen

Add support for ast2700 clock controller.

---
 drivers/clk/Makefile      |    1 +
 drivers/clk/clk-ast2700.c | 1173 +++++++++++++++++++++++++++++++++++++
 2 files changed, 1174 insertions(+)
 create mode 100644 drivers/clk/clk-ast2700.c

Missing bindings.

Best regards,
Krzysztof

#12 lore raw

Re: [PATCH v2 4/9] clk: ast2700: add clock controller

In reply to Kevin Chen
Quoted 30 lines · Kevin Chen

Add support for ast2700 clock controller.

---
 drivers/clk/Makefile      |    1 +
 drivers/clk/clk-ast2700.c | 1173 +++++++++++++++++++++++++++++++++++++
 2 files changed, 1174 insertions(+)
 create mode 100644 drivers/clk/clk-ast2700.c
drivers/clk/Makefile +1 -0
index f793a16cad40..0d5992ea0fa4 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_COMMON_CLK_FSL_SAI)      += clk-fsl-sai.o
 obj-$(CONFIG_COMMON_CLK_GEMINI)                += clk-gemini.o
 obj-$(CONFIG_COMMON_CLK_ASPEED)                += clk-aspeed.o
 obj-$(CONFIG_MACH_ASPEED_G6)           += clk-ast2600.o
+obj-$(CONFIG_MACH_ASPEED_G7)           += clk-ast2700.o
 obj-$(CONFIG_ARCH_HIGHBANK)            += clk-highbank.o
 obj-$(CONFIG_CLK_HSDK)                 += clk-hsdk-pll.o
 obj-$(CONFIG_COMMON_CLK_K210)          += clk-k210.o
drivers/clk/clk-ast2700.c new file +2 -0
new file mode 100644
index 000000000000..eec8e0cb83d9
@@ -0,0 +1,1173 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// Copyright ASPEED Technology

drivers/clk/clk-ast2700.c line 12

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+
+#include <linux/clk-provider.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/aspeed,ast2700-clk.h>
+#include <dt-bindings/reset/aspeed,ast2700-reset.h>
+
+#define SCU_CLK_24MHZ 24000000

Are Aspeed's 24 MHz somehow different from 24 MHz on other platforms? Please use <linux/units.h> and refrain from defining just random values. If it has some special meaning (like XO clock or some other fixed funcion), please use logical names.

drivers/clk/clk-ast2700.c line 16

Quoted 4 lines
drivers/clk/clk-ast2700.c new file +4 -0
+#define SCU_CLK_25MHZ 25000000
+#define SCU_CLK_192MHZ 192000000
+/* SOC0 USB2 PHY CLK*/
+#define SCU_CLK_12MHZ 12000000

So, this can be #define ASPEED_SOC0_USB2_PHY_RATE (12 * HZ_PER_MHZ)

Quoted 49 lines
drivers/clk/clk-ast2700.c new file +49 -0
+/* SOC0 */
+#define SCU0_HWSTRAP1 0x010
+#define SCU0_CLK_STOP 0x240
+#define SCU0_CLK_SEL1 0x280
+#define SCU0_CLK_SEL2 0x284
+#define GET_USB_REFCLK_DIV(x) ((GENMASK(23, 20) & (x)) >> 20)
+#define UART_DIV13_EN BIT(30)
+#define SCU0_HPLL_PARAM 0x300
+#define SCU0_DPLL_PARAM 0x308
+#define SCU0_MPLL_PARAM 0x310
+#define SCU0_D1CLK_PARAM 0x320
+#define SCU0_D2CLK_PARAM 0x330
+#define SCU0_CRT1CLK_PARAM 0x340
+#define SCU0_CRT2CLK_PARAM 0x350
+#define SCU0_MPHYCLK_PARAM 0x360
+
+/* SOC1 */
+#define SCU1_CLK_STOP 0x240
+#define SCU1_CLK_STOP2 0x260
+#define SCU1_CLK_SEL1 0x280
+#define SCU1_CLK_SEL2 0x284
+#define UXCLK_MASK GENMASK(1, 0)
+#define HUXCLK_MASK GENMASK(4, 3)
+#define SCU1_HPLL_PARAM 0x300
+#define SCU1_APLL_PARAM 0x310
+#define SCU1_DPLL_PARAM 0x320
+#define SCU1_UXCLK_CTRL 0x330
+#define SCU1_HUXCLK_CTRL 0x334
+#define SCU1_MAC12_CLK_DLY 0x390
+#define SCU1_MAC12_CLK_DLY_100M 0x394
+#define SCU1_MAC12_CLK_DLY_10M 0x398
+
+/*
+ * MAC Clock Delay settings
+ */
+#define MAC_CLK_RMII1_50M_RCLK_O_CTRL          BIT(30)
+#define   MAC_CLK_RMII1_50M_RCLK_O_DIS         0
+#define   MAC_CLK_RMII1_50M_RCLK_O_EN          1
+#define MAC_CLK_RMII0_50M_RCLK_O_CTRL          BIT(29)
+#define   MAC_CLK_RMII0_5M_RCLK_O_DIS          0
+#define   MAC_CLK_RMII0_5M_RCLK_O_EN           1
+#define MAC_CLK_RMII_TXD_FALLING_2             BIT(27)
+#define MAC_CLK_RMII_TXD_FALLING_1             BIT(26)
+#define MAC_CLK_RXCLK_INV_2                    BIT(25)
+#define MAC_CLK_RXCLK_INV_1                    BIT(24)
+#define MAC_CLK_1G_INPUT_DELAY_2               GENMASK(23, 18)
+#define MAC_CLK_1G_INPUT_DELAY_1               GENMASK(17, 12)
+#define MAC_CLK_1G_OUTPUT_DELAY_2              GENMASK(11, 6)
+#define MAC_CLK_1G_OUTPUT_DELAY_1              GENMASK(5, 0)

drivers/clk/clk-ast2700.c line 75

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+
+#define MAC_CLK_100M_10M_RESERVED              GENMASK(31, 26)
+#define MAC_CLK_100M_10M_RXCLK_INV_2           BIT(25)
+#define MAC_CLK_100M_10M_RXCLK_INV_1           BIT(24)
+#define MAC_CLK_100M_10M_INPUT_DELAY_2         GENMASK(23, 18)
+#define MAC_CLK_100M_10M_INPUT_DELAY_1         GENMASK(17, 12)
+#define MAC_CLK_100M_10M_OUTPUT_DELAY_2                GENMASK(11, 6)
+#define MAC_CLK_100M_10M_OUTPUT_DELAY_1                GENMASK(5, 0)
+
+#define AST2700_DEF_MAC12_DELAY_1G     0x00CF4D75

lowcase hex, please.

Quoted 59 lines
drivers/clk/clk-ast2700.c new file +59 -0
+#define AST2700_DEF_MAC12_DELAY_100M   0x00410410
+#define AST2700_DEF_MAC12_DELAY_10M    0x00410410
+
+struct mac_delay_config {
+       u32 tx_delay_1000;
+       u32 rx_delay_1000;
+       u32 tx_delay_100;
+       u32 rx_delay_100;
+       u32 tx_delay_10;
+       u32 rx_delay_10;
+};
+
+/* Globally visible clocks */
+static DEFINE_SPINLOCK(ast2700_clk_lock);
+
+/* Division of RGMII Clock */
+static const struct clk_div_table ast2700_rgmii_div_table[] = {
+       { 0x0, 4 },
+       { 0x1, 4 },
+       { 0x2, 6 },
+       { 0x3, 8 },
+       { 0x4, 10 },
+       { 0x5, 12 },
+       { 0x6, 14 },
+       { 0x7, 16 },
+       { 0 }
+};
+
+/* Division of RMII Clock */
+static const struct clk_div_table ast2700_rmii_div_table[] = {
+       { 0x0, 8 },
+       { 0x1, 8 },
+       { 0x2, 12 },
+       { 0x3, 16 },
+       { 0x4, 20 },
+       { 0x5, 24 },
+       { 0x6, 28 },
+       { 0x7, 32 },
+       { 0 }
+};
+
+/* Division of HCLK/SDIO/MAC/apll_divn CLK */
+static const struct clk_div_table ast2700_clk_div_table[] = {
+       { 0x0, 2 },
+       { 0x1, 2 },
+       { 0x2, 3 },
+       { 0x3, 4 },
+       { 0x4, 5 },
+       { 0x5, 6 },
+       { 0x6, 7 },
+       { 0x7, 8 },
+       { 0 }
+};
+
+/* Division of PCLK/EMMC CLK */
+static const struct clk_div_table ast2700_clk_div_table2[] = {
+       { 0x0, 2 },
+       { 0x1, 4 },
+       { 0x2, 6 },

drivers/clk/clk-ast2700.c line 144

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+       { 0x3, 8 },
+       { 0x4, 10 },
+       { 0x5, 12 },
+       { 0x6, 14 },
+       { 0x7, 16 },
+       { 0 }
+};
+
+/* HPLL/DPLL: 2000Mhz(default) */
+static struct clk_hw *ast2700_soc0_hw_pll(const char *name, const char *parent_name, u32 val)

Please migrate from using parent_names to either using parent_hw or using fwname to specify the parent clock.

Quoted 60 lines
drivers/clk/clk-ast2700.c new file +60 -0
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               mult = 1;
+               div = 1;
+       } else {
+               /* F = CLKIN(25MHz) * [(M+1) / 2(N+1)] / (P+1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = (m + 1) / (2 * (n + 1));
+               div = (p + 1);
+       }
+
+       return clk_hw_register_fixed_factor(NULL, name, parent_name, 0, mult, div);
+};
+
+/* MPLL 1600Mhz(default) */
+static struct clk_hw *ast2700_calc_mpll(const char *name, const char *parent_name, u32 val)
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               div = 1;
+               mult = div;
+       } else {
+               /* F = CLKIN(25MHz) * [CLKF/(CLKR+1)] /(CLKOD+1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = m / (n + 1);
+               div = (p + 1);
+       }
+       return clk_hw_register_fixed_factor(NULL, name, parent_name, 0, mult, div);
+};
+
+static struct clk_hw *ast2700_calc_uclk(const char *name, u32 val)
+{
+       unsigned int mult, div;
+
+       /* UARTCLK = UXCLK * R / (N * 2) */
+       u32 r = val & 0xff;
+       u32 n = (val >> 8) & 0x3ff;
+
+       mult = r;
+       div = n * 2;
+
+       return clk_hw_register_fixed_factor(NULL, name, "uxclk", 0, mult, div);
+};
+
+static struct clk_hw *ast2700_calc_huclk(const char *name, u32 val)
+{
+       unsigned int mult, div;
+
+       /* UARTCLK = UXCLK * R / (N * 2) */

drivers/clk/clk-ast2700.c line 214

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+       u32 r = val & 0xff;
+       u32 n = (val >> 8) & 0x3ff;
+
+       mult = r;
+       div = n * 2;
+
+       return clk_hw_register_fixed_factor(NULL, name, "huxclk", 0, mult, div);
+};
+
+static struct clk_hw *ast2700_calc_soc1_pll(const char *name, const char *parent_name, u32 val)

How is this different from ast2700_soc0_hw_pll() ?

Quoted 19 lines
drivers/clk/clk-ast2700.c new file +19 -0
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               div = 1;
+               mult = div;
+       } else {
+               /* F = 25Mhz * [(M + 1) / (n + 1)] / (p + 1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = (m + 1) / (n + 1);
+               div = (p + 1);
+       }
+       return clk_hw_register_fixed_factor(NULL, name, parent_name, 0, mult, div);
+};
+
Signature · 2 lines
With best wishes
Dmitry
author
#13 lore raw

RE: [PATCH v2 4/9] clk: ast2700: add clock controller

Quoted 38 lines

drivers/clk/Makefile obj-$(CONFIG_COMMON_CLK_FSL_SAI) +=

Quoted 16 lines

Add support for ast2700 clock controller.

---
 drivers/clk/Makefile      |    1 +
 drivers/clk/clk-ast2700.c | 1173
+++++++++++++++++++++++++++++++++++++
 2 files changed, 1174 insertions(+)
 create mode 100644 drivers/clk/clk-ast2700.c
drivers/clk/Makefile index renamed from drivers/clk/Makefile +0 -0

f793a16cad40..0d5992ea0fa4 100644

drivers/clk/Makefile +0 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_COMMON_CLK_FSL_SAI)      +=

clk-fsl-sai.o

Quoted 21 lines
drivers/clk/Makefile +1 -0
 obj-$(CONFIG_COMMON_CLK_GEMINI)                += clk-gemini.o
 obj-$(CONFIG_COMMON_CLK_ASPEED)                += clk-aspeed.o
 obj-$(CONFIG_MACH_ASPEED_G6)           += clk-ast2600.o
+obj-$(CONFIG_MACH_ASPEED_G7)           += clk-ast2700.o
 obj-$(CONFIG_ARCH_HIGHBANK)            += clk-highbank.o
 obj-$(CONFIG_CLK_HSDK)                 += clk-hsdk-pll.o
 obj-$(CONFIG_COMMON_CLK_K210)          += clk-k210.o
drivers/clk/clk-ast2700.c new renamed from drivers/clk/clk-ast2700.c +0 -0

file mode 100644 index 000000000000..eec8e0cb83d9

drivers/clk/clk-ast2700.c new file +9 -0
@@ -0,0 +1,1173 @@
+// SPDX-License-Identifier: GPL-2.0-or-later // Copyright ASPEED
+Technology
+
+#include <linux/clk-provider.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/aspeed,ast2700-clk.h>
Quoted 8 lines

drivers/clk/clk-ast2700.c line 12

Quoted 3 lines
drivers/clk/clk-ast2700.c new file +3 -0
+#include <dt-bindings/reset/aspeed,ast2700-reset.h>
+
+#define SCU_CLK_24MHZ 24000000

Are Aspeed's 24 MHz somehow different from 24 MHz on other platforms? Please use <linux/units.h> and refrain from defining just random values. If it has some special meaning (like XO clock or some other fixed funcion), please use logical names.

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 7 lines

drivers/clk/clk-ast2700.c line 16

Quoted 5 lines
drivers/clk/clk-ast2700.c new file +4 -0
+#define SCU_CLK_25MHZ 25000000
+#define SCU_CLK_192MHZ 192000000
+/* SOC0 USB2 PHY CLK*/
+#define SCU_CLK_12MHZ 12000000

So, this can be #define ASPEED_SOC0_USB2_PHY_RATE (12 * HZ_PER_MHZ)

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 57 lines

drivers/clk/clk-ast2700.c

Quoted 11 lines
drivers/clk/clk-ast2700.c new file +10 -0
+/* SOC0 */
+#define SCU0_HWSTRAP1 0x010
+#define SCU0_CLK_STOP 0x240
+#define SCU0_CLK_SEL1 0x280
+#define SCU0_CLK_SEL2 0x284
+#define GET_USB_REFCLK_DIV(x) ((GENMASK(23, 20) & (x)) >> 20) #define
+UART_DIV13_EN BIT(30) #define SCU0_HPLL_PARAM 0x300 #define
+SCU0_DPLL_PARAM 0x308 #define SCU0_MPLL_PARAM 0x310 #define
+SCU0_D1CLK_PARAM 0x320 #define SCU0_D2CLK_PARAM 0x330 #define
+SCU0_CRT1CLK_PARAM 0x340 #define SCU0_CRT2CLK_PARAM 0x350

#define

Quoted 6 lines
drivers/clk/clk-ast2700.c new file +6 -0
+SCU0_MPHYCLK_PARAM 0x360
+
+/* SOC1 */
+#define SCU1_CLK_STOP 0x240
+#define SCU1_CLK_STOP2 0x260
+#define SCU1_CLK_SEL1 0x280

drivers/clk/clk-ast2700.c

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+#define SCU1_CLK_SEL2 0x284
+#define UXCLK_MASK GENMASK(1, 0)
+#define HUXCLK_MASK GENMASK(4, 3)
+#define SCU1_HPLL_PARAM 0x300
+#define SCU1_APLL_PARAM 0x310
+#define SCU1_DPLL_PARAM 0x320
+#define SCU1_UXCLK_CTRL 0x330
+#define SCU1_HUXCLK_CTRL 0x334
+#define SCU1_MAC12_CLK_DLY 0x390
+#define SCU1_MAC12_CLK_DLY_100M 0x394 #define

SCU1_MAC12_CLK_DLY_10M

Quoted 11 lines
drivers/clk/clk-ast2700.c new file +11 -0
+0x398
+
+/*
+ * MAC Clock Delay settings
+ */
+#define MAC_CLK_RMII1_50M_RCLK_O_CTRL          BIT(30)
+#define   MAC_CLK_RMII1_50M_RCLK_O_DIS         0
+#define   MAC_CLK_RMII1_50M_RCLK_O_EN          1
+#define MAC_CLK_RMII0_50M_RCLK_O_CTRL          BIT(29)
+#define   MAC_CLK_RMII0_5M_RCLK_O_DIS          0
+#define   MAC_CLK_RMII0_5M_RCLK_O_EN           1

drivers/clk/clk-ast2700.c

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+#define MAC_CLK_RMII_TXD_FALLING_2             BIT(27)
+#define MAC_CLK_RMII_TXD_FALLING_1             BIT(26)
+#define MAC_CLK_RXCLK_INV_2                    BIT(25)
+#define MAC_CLK_RXCLK_INV_1                    BIT(24)
+#define MAC_CLK_1G_INPUT_DELAY_2               GENMASK(23, 18)
+#define MAC_CLK_1G_INPUT_DELAY_1               GENMASK(17, 12)
+#define MAC_CLK_1G_OUTPUT_DELAY_2              GENMASK(11, 6)
+#define MAC_CLK_1G_OUTPUT_DELAY_1              GENMASK(5, 0)
+
+#define MAC_CLK_100M_10M_RESERVED              GENMASK(31,

26)

drivers/clk/clk-ast2700.c

Quoted 3 lines
drivers/clk/clk-ast2700.c new file +3 -0
+#define MAC_CLK_100M_10M_RXCLK_INV_2           BIT(25)
+#define MAC_CLK_100M_10M_RXCLK_INV_1           BIT(24)
+#define MAC_CLK_100M_10M_INPUT_DELAY_2         GENMASK(23,

18)

drivers/clk/clk-ast2700.c line 67

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_100M_10M_INPUT_DELAY_1         GENMASK(17,

12)

Quoted 8 lines

drivers/clk/clk-ast2700.c line 68

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_100M_10M_OUTPUT_DELAY_2

GENMASK(11, 6)

drivers/clk/clk-ast2700.c line 69

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_100M_10M_OUTPUT_DELAY_1

GENMASK(5, 0)

drivers/clk/clk-ast2700.c line 71

Quoted 2 lines
drivers/clk/clk-ast2700.c new file +2 -0
+
+#define AST2700_DEF_MAC12_DELAY_1G     0x00CF4D75

lowcase hex, please.

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 66 lines
Quoted 66 lines
drivers/clk/clk-ast2700.c new file +65 -0
+#define AST2700_DEF_MAC12_DELAY_100M   0x00410410
+#define AST2700_DEF_MAC12_DELAY_10M    0x00410410
+
+struct mac_delay_config {
+       u32 tx_delay_1000;
+       u32 rx_delay_1000;
+       u32 tx_delay_100;
+       u32 rx_delay_100;
+       u32 tx_delay_10;
+       u32 rx_delay_10;
+};
+
+/* Globally visible clocks */
+static DEFINE_SPINLOCK(ast2700_clk_lock);
+
+/* Division of RGMII Clock */
+static const struct clk_div_table ast2700_rgmii_div_table[] = {
+       { 0x0, 4 },
+       { 0x1, 4 },
+       { 0x2, 6 },
+       { 0x3, 8 },
+       { 0x4, 10 },
+       { 0x5, 12 },
+       { 0x6, 14 },
+       { 0x7, 16 },
+       { 0 }
+};
+
+/* Division of RMII Clock */
+static const struct clk_div_table ast2700_rmii_div_table[] = {
+       { 0x0, 8 },
+       { 0x1, 8 },
+       { 0x2, 12 },
+       { 0x3, 16 },
+       { 0x4, 20 },
+       { 0x5, 24 },
+       { 0x6, 28 },
+       { 0x7, 32 },
+       { 0 }
+};
+
+/* Division of HCLK/SDIO/MAC/apll_divn CLK */ static const struct
+clk_div_table ast2700_clk_div_table[] = {
+       { 0x0, 2 },
+       { 0x1, 2 },
+       { 0x2, 3 },
+       { 0x3, 4 },
+       { 0x4, 5 },
+       { 0x5, 6 },
+       { 0x6, 7 },
+       { 0x7, 8 },
+       { 0 }
+};
+
+/* Division of PCLK/EMMC CLK */
+static const struct clk_div_table ast2700_clk_div_table2[] = {
+       { 0x0, 2 },
+       { 0x1, 4 },
+       { 0x2, 6 },
+       { 0x3, 8 },
+       { 0x4, 10 },
+       { 0x5, 12 },
+       { 0x6, 14 },
+       { 0x7, 16 },
+       { 0 }
Quoted 8 lines

drivers/clk/clk-ast2700.c

Quoted 5 lines
drivers/clk/clk-ast2700.c new file +5 -0
+};
+
+/* HPLL/DPLL: 2000Mhz(default) */
+static struct clk_hw *ast2700_soc0_hw_pll(const char *name, const
+char *parent_name, u32 val)

Please migrate from using parent_names to either using parent_hw or using fwname to specify the parent clock.

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 64 lines
Quoted 64 lines
drivers/clk/clk-ast2700.c new file +63 -0
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               mult = 1;
+               div = 1;
+       } else {
+               /* F = CLKIN(25MHz) * [(M+1) / 2(N+1)] / (P+1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = (m + 1) / (2 * (n + 1));
+               div = (p + 1);
+       }
+
+       return clk_hw_register_fixed_factor(NULL, name, parent_name,
+0, mult, div); };
+
+/* MPLL 1600Mhz(default) */
+static struct clk_hw *ast2700_calc_mpll(const char *name, const char
+*parent_name, u32 val) {
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               div = 1;
+               mult = div;
+       } else {
+               /* F = CLKIN(25MHz) * [CLKF/(CLKR+1)] /(CLKOD+1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = m / (n + 1);
+               div = (p + 1);
+       }
+       return clk_hw_register_fixed_factor(NULL, name, parent_name,
+0, mult, div); };
+
+static struct clk_hw *ast2700_calc_uclk(const char *name, u32 val) {
+       unsigned int mult, div;
+
+       /* UARTCLK = UXCLK * R / (N * 2) */
+       u32 r = val & 0xff;
+       u32 n = (val >> 8) & 0x3ff;
+
+       mult = r;
+       div = n * 2;
+
+       return clk_hw_register_fixed_factor(NULL, name, "uxclk", 0,
+mult, div); };
+
+static struct clk_hw *ast2700_calc_huclk(const char *name, u32 val) {
+       unsigned int mult, div;
+
+       /* UARTCLK = UXCLK * R / (N * 2) */
+       u32 r = val & 0xff;
+       u32 n = (val >> 8) & 0x3ff;
+
+       mult = r;
+       div = n * 2;
Quoted 8 lines

drivers/clk/clk-ast2700.c line 210

Quoted 6 lines
drivers/clk/clk-ast2700.c new file +6 -0
+
+       return clk_hw_register_fixed_factor(NULL, name, "huxclk", 0,
+mult, div); };
+
+static struct clk_hw *ast2700_calc_soc1_pll(const char *name, const
+char *parent_name, u32 val)

How is this different from ast2700_soc0_hw_pll() ?

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 25 lines
Quoted 10 lines
drivers/clk/clk-ast2700.c new file +9 -0
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               div = 1;
+               mult = div;
+       } else {
+               /* F = 25Mhz * [(M + 1) / (n + 1)] / (p + 1) */

drivers/clk/clk-ast2700.c line 233

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = (m + 1) / (n + 1);
+               div = (p + 1);
+       }
+       return clk_hw_register_fixed_factor(NULL, name, parent_name,
+0, mult, div); };
+

--
With best wishes
Dmitry

maintainer
#14 lore raw

RE: [PATCH v2 4/9] clk: ast2700: add clock controller

Hello Dmitry,
Thanks, your review.
I will update in my next clk patch.
And include you in review email.

Quoted 321 lines

Subject: RE: [PATCH v2 4/9] clk: ast2700: add clock controller

Quoted 11 lines
Quoted 11 lines

Add support for ast2700 clock controller.

---
 drivers/clk/Makefile      |    1 +
 drivers/clk/clk-ast2700.c | 1173
+++++++++++++++++++++++++++++++++++++
 2 files changed, 1174 insertions(+)  create mode 100644

drivers/clk/clk-ast2700.c

Quoted 7 lines

drivers/clk/Makefile obj-$(CONFIG_COMMON_CLK_FSL_SAI) +=

Quoted 5 lines
drivers/clk/Makefile index renamed from drivers/clk/Makefile +0 -0

f793a16cad40..0d5992ea0fa4 100644

drivers/clk/Makefile +0 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_COMMON_CLK_FSL_SAI)      +=

clk-fsl-sai.o

Quoted 1 line
drivers/clk/Makefile +0 -0
 obj-$(CONFIG_COMMON_CLK_GEMINI)                +=

clk-gemini.o

Quoted 1 line

drivers/clk/Makefile obj-$(CONFIG_COMMON_CLK_FSL_SAI) += · line 39

Quoted 1 line
drivers/clk/Makefile +0 -0
 obj-$(CONFIG_COMMON_CLK_ASPEED)                +=

clk-aspeed.o

Quoted 19 lines
Quoted 19 lines
drivers/clk/Makefile +1 -0
 obj-$(CONFIG_MACH_ASPEED_G6)           += clk-ast2600.o
+obj-$(CONFIG_MACH_ASPEED_G7)           += clk-ast2700.o
 obj-$(CONFIG_ARCH_HIGHBANK)            += clk-highbank.o
 obj-$(CONFIG_CLK_HSDK)                 += clk-hsdk-pll.o
 obj-$(CONFIG_COMMON_CLK_K210)          += clk-k210.o
drivers/clk/clk-ast2700.c new file +9 -0
new file mode 100644 index 000000000000..eec8e0cb83d9
@@ -0,0 +1,1173 @@
+// SPDX-License-Identifier: GPL-2.0-or-later // Copyright ASPEED
+Technology
+
+#include <linux/clk-provider.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/aspeed,ast2700-clk.h>
Quoted 8 lines

drivers/clk/clk-ast2700.c line 12

Quoted 3 lines
drivers/clk/clk-ast2700.c new file +3 -0
+#include <dt-bindings/reset/aspeed,ast2700-reset.h>
+
+#define SCU_CLK_24MHZ 24000000

Are Aspeed's 24 MHz somehow different from 24 MHz on other platforms? Please use <linux/units.h> and refrain from defining just random values. If it has some special meaning (like XO clock or some other fixed funcion), please use logical names.

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 7 lines

drivers/clk/clk-ast2700.c line 16

Quoted 5 lines
drivers/clk/clk-ast2700.c new file +4 -0
+#define SCU_CLK_25MHZ 25000000
+#define SCU_CLK_192MHZ 192000000
+/* SOC0 USB2 PHY CLK*/
+#define SCU_CLK_12MHZ 12000000

So, this can be #define ASPEED_SOC0_USB2_PHY_RATE (12 * HZ_PER_MHZ)

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 8 lines

drivers/clk/clk-ast2700.c

Quoted 8 lines
drivers/clk/clk-ast2700.c new file +7 -0
+/* SOC0 */
+#define SCU0_HWSTRAP1 0x010
+#define SCU0_CLK_STOP 0x240
+#define SCU0_CLK_SEL1 0x280
+#define SCU0_CLK_SEL2 0x284
+#define GET_USB_REFCLK_DIV(x) ((GENMASK(23, 20) & (x)) >> 20)
+#define UART_DIV13_EN BIT(30) #define SCU0_HPLL_PARAM 0x300

#define

Quoted 21 lines

drivers/clk/clk-ast2700.c line 26

Quoted 3 lines
drivers/clk/clk-ast2700.c new file +3 -0
+SCU0_DPLL_PARAM 0x308 #define SCU0_MPLL_PARAM 0x310 #define
+SCU0_D1CLK_PARAM 0x320 #define SCU0_D2CLK_PARAM 0x330 #define
+SCU0_CRT1CLK_PARAM 0x340 #define SCU0_CRT2CLK_PARAM 0x350

#define

Quoted 6 lines
drivers/clk/clk-ast2700.c new file +6 -0
+SCU0_MPHYCLK_PARAM 0x360
+
+/* SOC1 */
+#define SCU1_CLK_STOP 0x240
+#define SCU1_CLK_STOP2 0x260
+#define SCU1_CLK_SEL1 0x280

drivers/clk/clk-ast2700.c

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+#define SCU1_CLK_SEL2 0x284
+#define UXCLK_MASK GENMASK(1, 0)
+#define HUXCLK_MASK GENMASK(4, 3)
+#define SCU1_HPLL_PARAM 0x300
+#define SCU1_APLL_PARAM 0x310
+#define SCU1_DPLL_PARAM 0x320
+#define SCU1_UXCLK_CTRL 0x330
+#define SCU1_HUXCLK_CTRL 0x334
+#define SCU1_MAC12_CLK_DLY 0x390
+#define SCU1_MAC12_CLK_DLY_100M 0x394 #define

SCU1_MAC12_CLK_DLY_10M

Quoted 16 lines
Quoted 6 lines
drivers/clk/clk-ast2700.c new file +6 -0
+0x398
+
+/*
+ * MAC Clock Delay settings
+ */
+#define MAC_CLK_RMII1_50M_RCLK_O_CTRL          BIT(30)

drivers/clk/clk-ast2700.c

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+#define   MAC_CLK_RMII1_50M_RCLK_O_DIS         0
+#define   MAC_CLK_RMII1_50M_RCLK_O_EN          1
+#define MAC_CLK_RMII0_50M_RCLK_O_CTRL          BIT(29)
+#define   MAC_CLK_RMII0_5M_RCLK_O_DIS          0
+#define   MAC_CLK_RMII0_5M_RCLK_O_EN           1
+#define MAC_CLK_RMII_TXD_FALLING_2             BIT(27)
+#define MAC_CLK_RMII_TXD_FALLING_1             BIT(26)
+#define MAC_CLK_RXCLK_INV_2                    BIT(25)
+#define MAC_CLK_RXCLK_INV_1                    BIT(24)
+#define MAC_CLK_1G_INPUT_DELAY_2               GENMASK(23,

18)

Quoted 1 line

drivers/clk/clk-ast2700.c line 59

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_1G_INPUT_DELAY_1               GENMASK(17,

12)

Quoted 1 line

drivers/clk/clk-ast2700.c line 60

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_1G_OUTPUT_DELAY_2              GENMASK(11,

6)

Quoted 1 line

drivers/clk/clk-ast2700.c line 61

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_1G_OUTPUT_DELAY_1              GENMASK(5,

0)

Quoted 2 lines

drivers/clk/clk-ast2700.c line 63

Quoted 2 lines
drivers/clk/clk-ast2700.c new file +2 -0
+
+#define MAC_CLK_100M_10M_RESERVED

GENMASK(31,

Quoted 4 lines

26)

drivers/clk/clk-ast2700.c

Quoted 3 lines
drivers/clk/clk-ast2700.c new file +3 -0
+#define MAC_CLK_100M_10M_RXCLK_INV_2           BIT(25)
+#define MAC_CLK_100M_10M_RXCLK_INV_1           BIT(24)
+#define MAC_CLK_100M_10M_INPUT_DELAY_2

GENMASK(23,

Quoted 2 lines

18)

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_100M_10M_INPUT_DELAY_1

GENMASK(17,

Quoted 9 lines

12)

drivers/clk/clk-ast2700.c line 68

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_100M_10M_OUTPUT_DELAY_2

GENMASK(11, 6)

drivers/clk/clk-ast2700.c line 69

Quoted 1 line
drivers/clk/clk-ast2700.c new file +1 -0
+#define MAC_CLK_100M_10M_OUTPUT_DELAY_1

GENMASK(5, 0)

drivers/clk/clk-ast2700.c line 71

Quoted 2 lines
drivers/clk/clk-ast2700.c new file +2 -0
+
+#define AST2700_DEF_MAC12_DELAY_1G     0x00CF4D75

lowcase hex, please.

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 66 lines
Quoted 66 lines
drivers/clk/clk-ast2700.c new file +65 -0
+#define AST2700_DEF_MAC12_DELAY_100M   0x00410410
+#define AST2700_DEF_MAC12_DELAY_10M    0x00410410
+
+struct mac_delay_config {
+       u32 tx_delay_1000;
+       u32 rx_delay_1000;
+       u32 tx_delay_100;
+       u32 rx_delay_100;
+       u32 tx_delay_10;
+       u32 rx_delay_10;
+};
+
+/* Globally visible clocks */
+static DEFINE_SPINLOCK(ast2700_clk_lock);
+
+/* Division of RGMII Clock */
+static const struct clk_div_table ast2700_rgmii_div_table[] = {
+       { 0x0, 4 },
+       { 0x1, 4 },
+       { 0x2, 6 },
+       { 0x3, 8 },
+       { 0x4, 10 },
+       { 0x5, 12 },
+       { 0x6, 14 },
+       { 0x7, 16 },
+       { 0 }
+};
+
+/* Division of RMII Clock */
+static const struct clk_div_table ast2700_rmii_div_table[] = {
+       { 0x0, 8 },
+       { 0x1, 8 },
+       { 0x2, 12 },
+       { 0x3, 16 },
+       { 0x4, 20 },
+       { 0x5, 24 },
+       { 0x6, 28 },
+       { 0x7, 32 },
+       { 0 }
+};
+
+/* Division of HCLK/SDIO/MAC/apll_divn CLK */ static const struct
+clk_div_table ast2700_clk_div_table[] = {
+       { 0x0, 2 },
+       { 0x1, 2 },
+       { 0x2, 3 },
+       { 0x3, 4 },
+       { 0x4, 5 },
+       { 0x5, 6 },
+       { 0x6, 7 },
+       { 0x7, 8 },
+       { 0 }
+};
+
+/* Division of PCLK/EMMC CLK */
+static const struct clk_div_table ast2700_clk_div_table2[] = {
+       { 0x0, 2 },
+       { 0x1, 4 },
+       { 0x2, 6 },
+       { 0x3, 8 },
+       { 0x4, 10 },
+       { 0x5, 12 },
+       { 0x6, 14 },
+       { 0x7, 16 },
+       { 0 }
Quoted 8 lines

drivers/clk/clk-ast2700.c

Quoted 5 lines
drivers/clk/clk-ast2700.c new file +5 -0
+};
+
+/* HPLL/DPLL: 2000Mhz(default) */
+static struct clk_hw *ast2700_soc0_hw_pll(const char *name, const
+char *parent_name, u32 val)

Please migrate from using parent_names to either using parent_hw or using fwname to specify the parent clock.

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 64 lines
Quoted 64 lines
drivers/clk/clk-ast2700.c new file +63 -0
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               mult = 1;
+               div = 1;
+       } else {
+               /* F = CLKIN(25MHz) * [(M+1) / 2(N+1)] / (P+1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = (m + 1) / (2 * (n + 1));
+               div = (p + 1);
+       }
+
+       return clk_hw_register_fixed_factor(NULL, name, parent_name,
+0, mult, div); };
+
+/* MPLL 1600Mhz(default) */
+static struct clk_hw *ast2700_calc_mpll(const char *name, const
+char *parent_name, u32 val) {
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               div = 1;
+               mult = div;
+       } else {
+               /* F = CLKIN(25MHz) * [CLKF/(CLKR+1)] /(CLKOD+1) */
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = m / (n + 1);
+               div = (p + 1);
+       }
+       return clk_hw_register_fixed_factor(NULL, name, parent_name,
+0, mult, div); };
+
+static struct clk_hw *ast2700_calc_uclk(const char *name, u32 val) {
+       unsigned int mult, div;
+
+       /* UARTCLK = UXCLK * R / (N * 2) */
+       u32 r = val & 0xff;
+       u32 n = (val >> 8) & 0x3ff;
+
+       mult = r;
+       div = n * 2;
+
+       return clk_hw_register_fixed_factor(NULL, name, "uxclk", 0,
+mult, div); };
+
+static struct clk_hw *ast2700_calc_huclk(const char *name, u32 val) {
+       unsigned int mult, div;
+
+       /* UARTCLK = UXCLK * R / (N * 2) */
+       u32 r = val & 0xff;
+       u32 n = (val >> 8) & 0x3ff;
+
+       mult = r;
+       div = n * 2;
Quoted 8 lines

drivers/clk/clk-ast2700.c line 210

Quoted 6 lines
drivers/clk/clk-ast2700.c new file +6 -0
+
+       return clk_hw_register_fixed_factor(NULL, name, "huxclk", 0,
+mult, div); };
+
+static struct clk_hw *ast2700_calc_soc1_pll(const char *name, const
+char *parent_name, u32 val)

How is this different from ast2700_soc0_hw_pll() ?

Already split clock and reset to Ryan's commit.
https://patchwork.kernel.org/project/linux-clk/list/?series=892020
Please check the series of " Add support for AST2700 clk driver".

Quoted 25 lines
Quoted 10 lines
drivers/clk/clk-ast2700.c new file +9 -0
+{
+       unsigned int mult, div;
+
+       if (val & BIT(24)) {
+               /* Pass through mode */
+               div = 1;
+               mult = div;
+       } else {
+               /* F = 25Mhz * [(M + 1) / (n + 1)] / (p + 1) */

drivers/clk/clk-ast2700.c line 233

Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10 -0
+               u32 m = val & 0x1fff;
+               u32 n = (val >> 13) & 0x3f;
+               u32 p = (val >> 19) & 0xf;
+
+               mult = (m + 1) / (n + 1);
+               div = (p + 1);
+       }
+       return clk_hw_register_fixed_factor(NULL, name, parent_name,
+0, mult, div); };
+

--
With best wishes
Dmitry

author
#15 lore raw

PATCH v2 5/9 dt-bindings: arm: aspeed: Add ASPEED AST27XX SoC

In reply to Kevin Chen
---
 Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/aspeed/aspeed.yaml +7 -0
index 95113df178cc..18fcd44377bd 100644
@@ -8,6 +8,7 @@ title: Aspeed SoC based boards
 
 maintainers:
   - Joel Stanley <[email protected]>
+  - Kevin Chen <[email protected]>
 
 properties:
   $nodename:
@@ -98,4 +99,10 @@ properties:
               - ufispace,ncplite-bmc
           - const: aspeed,ast2600
 
+      - description: AST2700 based boards
+        items:
+          - enum:
+              - aspeed,ast2700-evb
+          - const: aspeed,ast2700
+
 additionalProperties: true
Signature · 1 line
2.34.1
#16 lore raw

Re: [PATCH v2 5/9] dt-bindings: arm: aspeed: Add ASPEED AST27XX SoC

Quoted 1 line · Kevin Chen

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof

author
#17 lore raw

PATCH v2 6/9 arm64: aspeed: Add support for ASPEED AST27XX BMC SoC

In reply to Kevin Chen

Add two configs of ARCH_ASPEED and MACH_ASPEED_G7.
In current arm64 architecture, ARCH_ASPEED would select MACH_ASPEED_G7.

---
 MAINTAINERS                  |  3 +++
 arch/arm64/Kconfig.platforms | 14 ++++++++++++++
 2 files changed, 17 insertions(+)
MAINTAINERS +3 -0
index 8766f3e5e87e..7d7eded0d6a3 100644
@@ -2121,7 +2121,10 @@ Q:	https://patchwork.ozlabs.org/project/linux-aspeed/list/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/joel/bmc.git
 F:	Documentation/devicetree/bindings/arm/aspeed/
 F:	arch/arm/boot/dts/aspeed/
+F:	arch/arm64/boot/dts/aspeed/
 F:	arch/arm/mach-aspeed/
+F:	include/dt-bindings/clock/aspeed,ast2700-clk.h
+F:	include/dt-bindings/reset/aspeed,ast2700-reset.h
 N:	aspeed
 
 ARM/AXM LSI SOC
arch/arm64/Kconfig.platforms +14 -0
index 6c6d11536b42..1db7b6f1ee0a 100644
@@ -40,6 +40,20 @@ config ARCH_APPLE
 	  This enables support for Apple's in-house ARM SoC family, starting
 	  with the Apple M1.
 
+config ARCH_ASPEED
+	bool "Aspeed SoC family"
+	select MACH_ASPEED_G7
+	help
+	  Say yes if you intend to run on an Aspeed ast2700 or similar
+	  seventh generation Aspeed BMCs.
+
+config MACH_ASPEED_G7
+	bool "Aspeed SoC AST2700"
+	help
+	  Say yes if you intend to run on an Aspeed ast2700
+	  seventh generation Aspeed BMCs.
+	  Aspeed ast2700 BMC based on the Cortex A35.
+
 menuconfig ARCH_BCM
 	bool "Broadcom SoC Support"
 
Signature · 1 line
2.34.1
maintainer NAK
#18 lore raw

Re: [PATCH v2 6/9] arm64: aspeed: Add support for ASPEED AST27XX BMC SoC

Quoted 5 lines · Kevin Chen

Add two configs of ARCH_ASPEED and MACH_ASPEED_G7.
In current arm64 architecture, ARCH_ASPEED would select MACH_ASPEED_G7.

---

NAK.

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof

author
#19 lore raw

PATCH v2 7/9 arm64: defconfig: Add ASPEED AST2700 family support

In reply to Kevin Chen

Enable CONFIG_ARCH_ASPEED in arm64 defconfig.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 7d32fca64996..b393735a695f 100644
@@ -38,6 +38,7 @@ CONFIG_ARCH_AIROHA=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_ALPINE=y
 CONFIG_ARCH_APPLE=y
+CONFIG_ARCH_ASPEED=y
 CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM2835=y
 CONFIG_ARCH_BCM_IPROC=y
Signature · 1 line
2.34.1
#20 lore raw

Re: [PATCH v2 7/9] arm64: defconfig: Add ASPEED AST2700 family support

Quoted 2 lines · Kevin Chen

Enable CONFIG_ARCH_ASPEED in arm64 defconfig.

Why? Usually the defconfig changes have "Enable CONFIG_FOO as it is used on the Bar Baz platform" commit message.

Quoted 21 lines
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -1
index 7d32fca64996..b393735a695f 100644
@@ -38,6 +38,7 @@ CONFIG_ARCH_AIROHA=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_ALPINE=y
 CONFIG_ARCH_APPLE=y
+CONFIG_ARCH_ASPEED=y
 CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM2835=y
 CONFIG_ARCH_BCM_IPROC=y
--

2.34.1

Signature · 2 lines
With best wishes
Dmitry
maintainer
#21 lore raw

Re: [PATCH v2 7/9] arm64: defconfig: Add ASPEED AST2700 family support

Quoted 6 lines · Dmitry Baryshkov
Quoted 2 lines · Kevin Chen

Enable CONFIG_ARCH_ASPEED in arm64 defconfig.

Why? Usually the defconfig changes have "Enable CONFIG_FOO as it is used on the Bar Baz platform" commit message.

I would also expect to see aspeed specific device drivers to get enabled in the same commit. On arm32, I see

CONFIG_ASPEED_KCS_IPMI_BMC=m
CONFIG_ASPEED_BT_IPMI_BMC=m
CONFIG_I2C_ASPEED=m
CONFIG_SPI_ASPEED_SMC=m
CONFIG_GPIO_ASPEED_SGPIO=y
CONFIG_SENSORS_ASPEED=m
CONFIG_VIDEO_ASPEED=m
CONFIG_DRM_ASPEED_GFX=m
CONFIG_USB_ASPEED_VHUB=m
CONFIG_RTC_DRV_ASPEED=m
CONFIG_ASPEED_LPC_CTRL=m
CONFIG_ASPEED_LPC_SNOOP=m
CONFIG_ASPEED_P2A_CTRL=m
CONFIG_ASPEED_ADC=m
CONFIG_FSI_MASTER_ASPEED=m

Presumably not all but a lot of these are also used on AST2700.

Arnd

author
#22 lore raw

RE: [PATCH v2 7/9] arm64: defconfig: Add ASPEED AST2700 family support

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Enable CONFIG_ARCH_ASPEED in arm64 defconfig.

Why? Usually the defconfig changes have "Enable CONFIG_FOO as it is used on the Bar Baz platform" commit message.

I would also expect to see aspeed specific device drivers to get enabled in the same commit. On arm32, I see

For different device drivers, ASPEED would submit code by its owner with CONFIG enabled.

Quoted 20 lines

CONFIG_ASPEED_KCS_IPMI_BMC=m
CONFIG_ASPEED_BT_IPMI_BMC=m
CONFIG_I2C_ASPEED=m
CONFIG_SPI_ASPEED_SMC=m
CONFIG_GPIO_ASPEED_SGPIO=y
CONFIG_SENSORS_ASPEED=m
CONFIG_VIDEO_ASPEED=m
CONFIG_DRM_ASPEED_GFX=m
CONFIG_USB_ASPEED_VHUB=m
CONFIG_RTC_DRV_ASPEED=m
CONFIG_ASPEED_LPC_CTRL=m
CONFIG_ASPEED_LPC_SNOOP=m
CONFIG_ASPEED_P2A_CTRL=m
CONFIG_ASPEED_ADC=m
CONFIG_FSI_MASTER_ASPEED=m

Presumably not all but a lot of these are also used on AST2700.

Arnd

author
#23 lore raw

RE: [PATCH v2 7/9] arm64: defconfig: Add ASPEED AST2700 family support

In reply to Dmitry Baryshkov
Quoted 5 lines
Quoted 2 lines

Enable CONFIG_ARCH_ASPEED in arm64 defconfig.

Why? Usually the defconfig changes have "Enable CONFIG_FOO as it is used on the Bar Baz platform" commit message.

Agree. I will fix it in next patch.

Quoted 25 lines
Quoted 12 lines
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/arch/arm64/configs/defconfig index 7d32fca64996..b393735a695f 100644

arch/arm64/configs/defconfig +0 -0
@@ -38,6 +38,7 @@ CONFIG_ARCH_AIROHA=y  CONFIG_ARCH_SUNXI=y
Quoted 8 lines

CONFIG_ARCH_ALPINE=y CONFIG_ARCH_APPLE=y
+CONFIG_ARCH_ASPEED=y
CONFIG_ARCH_BCM=y
CONFIG_ARCH_BCM2835=y
CONFIG_ARCH_BCM_IPROC=y
--
2.34.1

--
With best wishes
Dmitry

author
#24 lore raw

PATCH v2 8/9 arm64: dts: aspeed: Add initial AST27XX device tree

In reply to Kevin Chen

Add aspeed-g7.dtsi to be AST27XX device tree.

---
 arch/arm64/boot/dts/Makefile              |   1 +
 arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi | 185 ++++++++++++++++++++++
 2 files changed, 186 insertions(+)
 create mode 100644 arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi
arch/arm64/boot/dts/Makefile +1 -0
index 21cd3a87f385..c909c19dc5dd 100644
@@ -34,3 +34,4 @@ subdir-y += tesla
 subdir-y += ti
 subdir-y += toshiba
 subdir-y += xilinx
+subdir-y += aspeed
arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
2.34.1
#25 lore raw

Re: [PATCH v2 8/9] arm64: dts: aspeed: Add initial AST27XX device tree

Quoted 1 line · Kevin Chen

Add aspeed-g7.dtsi to be AST27XX device tree.

Hardware description is missing, e.g. answering why you have two "soc" nodes.

Quoted 11 lines
arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi new file +6 -0
+	soc0: soc at 10000000 {
+		compatible = "simple-bus";
+		reg = <0x0 0x10000000 0x0 0x10000000>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;

arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi line 120

Quoted 10 lines
arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi new file +10 -0
+
+		gic: interrupt-controller at 12200000 {
+			compatible = "arm,gic-v3";
+			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+			#interrupt-cells = <3>;
+			interrupt-controller;
+			interrupt-parent = <&gic>;
+			reg = <0 0x12200000 0 0x10000>, /* GICD */
+				  <0 0x12280000 0 0x80000>, /* GICR */
+				  <0 0x40440000 0 0x1000>;  /* GICC */

Still the same things to fix... Please go to the DTS coding style and read what is the order of properties.

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi line 29

Quoted 3 lines
arch/arm64/boot/dts/aspeed/aspeed-g7.dtsi new file +3 -0
+			#address-cells = <2>;
+			#size-cells = <2>;
+		};

Best regards,
Krzysztof

author
#26 lore raw

PATCH v2 9/9 arm64: dts: aspeed: Add initial AST2700 EVB device tree

In reply to Kevin Chen

Add EVB board of AST2700 in ASPEED G7 Architecture.

---
 arch/arm64/boot/dts/aspeed/Makefile        |  4 ++
 arch/arm64/boot/dts/aspeed/ast2700-evb.dts | 58 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 arch/arm64/boot/dts/aspeed/Makefile
 create mode 100644 arch/arm64/boot/dts/aspeed/ast2700-evb.dts
arch/arm64/boot/dts/aspeed/Makefile new file +4 -0
new file mode 100644
index 000000000000..ffe7e15017cc
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtb-$(CONFIG_ARCH_ASPEED) += \
+	ast2700-evb.dtb
arch/arm64/boot/dts/aspeed/ast2700-evb.dts new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.34.1
#27 lore raw

Re: [PATCH v2 9/9] arm64: dts: aspeed: Add initial AST2700 EVB device tree

Quoted 34 lines · Kevin Chen

Add EVB board of AST2700 in ASPEED G7 Architecture.

---
 arch/arm64/boot/dts/aspeed/Makefile        |  4 ++
 arch/arm64/boot/dts/aspeed/ast2700-evb.dts | 58 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 arch/arm64/boot/dts/aspeed/Makefile
 create mode 100644 arch/arm64/boot/dts/aspeed/ast2700-evb.dts
arch/arm64/boot/dts/aspeed/Makefile new file +4 -0
new file mode 100644
index 000000000000..ffe7e15017cc
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+dtb-$(CONFIG_ARCH_ASPEED) += \
+	ast2700-evb.dtb
arch/arm64/boot/dts/aspeed/ast2700-evb.dts new file +8 -0
new file mode 100644
index 000000000000..09c9569c0f7b
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/dts-v1/;
+
+#include "aspeed-g7.dtsi"
+#include <dt-bindings/gpio/aspeed-gpio.h>
+
+/ {

arch/arm64/boot/dts/aspeed/ast2700-evb.dts line 18

Quoted 10 lines
arch/arm64/boot/dts/aspeed/ast2700-evb.dts new file +10 -0
+	model = "AST2700A1-EVB";
+	compatible = "aspeed,ast2700-evb", "aspeed,ast2700";
+
+	aliases {
+		serial4 = &uart4;
+	};
+
+	chosen {
+		bootargs = "console=ttyS4,115200n8";
+		stdout-path = &uart4;

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof