All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support
@ 2022-05-03 11:55 Phil Edworthy
  2022-05-03 11:55 ` [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers Phil Edworthy
                   ` (11 more replies)
  0 siblings, 12 replies; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Michael Turquette, Stephen Boyd,
	Greg Kroah-Hartman
  Cc: Phil Edworthy, Biju Das, Lad Prabhakar, Chris Paterson,
	linux-renesas-soc, devicetree, linux-clk, linux-serial,
	linux-kernel

Hello,

RZ/V2M has a dual-core Cortex-A53 (1.0 GHz) CPU and built-in AI
accelerator "DRP-AI" for vision, which is Renesas' original technology.
It also has a 32-bit LPDDR4 interface and video codec (H.264).

The RZ/V2M is used with ISP firmware that runs on one of the Cortex-A53
cores. The firmware is an integral part of the SoC such that the HW
User's Manual documents which of the peripheral modules are used by the
firmware.

Initial patches enables minimal peripherals on Renesas RZ/V2M EVK board
and booted via nfs. Ethernet is broadly compatible with the
etheravb-rcar-gen3 driver, but interrupts need some work so it's not
been included in this patch set.

Below blocks are enabled on Renesas RZ/V2M EVK board:
- memory
- External input clock
- CPG
- UART

Links for SoC and EVK:
[*] https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-cortex-a-mpus/rzv2m-dual-cortex-a53-lpddr4x32bit-ai-accelerator-isp-4k-video-codec-4k-camera-input-fhd-display-output


Sorry for cross posting the patches to multiple subsystems, as these are
just the dt-binding patches included as part of initial bringup patches.

v3:
 * Feedback addressed
 * Added patch [0001] for renesas,em-uart dt-bindings RZ/V2M clock for the regs
 * Added patch [0004] for arm,arch_timer dt-bindings optional clock and reset
 * Added patch [0005] for rzg2l clk to move the DEF_MUX array size calc into the macro
 * Added patch [0006] for rzg2l clk to add read-only versions of the macros

v2:
 * Removed SYS dt-bindings patch and corresponding SoC identification
   as we only used the LSI version register. This can be dealt with
   later on.
 * Fixed em-uart dt-bindings.
 * Included reviewed-by tags.

Thanks
Phil

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:06   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions Phil Edworthy
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Geert Uytterhoeven
  Cc: Phil Edworthy, Magnus Damm, Biju Das, linux-renesas-soc,
	linux-serial, devicetree

The RZ/V2M SoC has an additional clock to access the registers. The HW
manual says this clock should not be touched as it is used by the
"ISP Firmware".

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
v3:
 - New patch added
---
 .../bindings/serial/renesas,em-uart.yaml      | 32 +++++++++++++++----
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml b/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
index 332c385618e1..8d0e779d7d77 100644
--- a/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
@@ -9,9 +9,6 @@ title: Renesas EMMA Mobile UART Interface
 maintainers:
   - Magnus Damm <magnus.damm@gmail.com>
 
-allOf:
-  - $ref: serial.yaml#
-
 properties:
   compatible:
     oneOf:
@@ -29,11 +26,32 @@ properties:
   interrupts:
     maxItems: 1
 
-  clocks:
-    maxItems: 1
+allOf:
+  - $ref: serial.yaml#
 
-  clock-names:
-    const: sclk
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a09g011-uart
+    then:
+      properties:
+        clocks:
+          items:
+            - description: UART functional clock
+            - description: Optional internal clock to access the registers
+        clock-names:
+          items:
+            - const: sclk
+            - const: pclk
+    else:
+      properties:
+        clocks:
+          items:
+            - description: UART functional clock
+        clock-names:
+          items:
+            - const: sclk
 
 required:
   - compatible
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
  2022-05-03 11:55 ` [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:43   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC Phil Edworthy
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Herring, Krzysztof Kozlowski
  Cc: Phil Edworthy, linux-renesas-soc, devicetree, Biju Das

Define RZ/V2M (R9A09G011) Clock Pulse Generator module clock outputs
(CPG_CLK_ON* registers), and reset definitions (CPG_RST_* registers)
in Section 48.5 ("Register Description") of the RZ/V2M Hardware User's
Manual (Rev. 1.10, Sep. 2021).

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - Add missing clocks and resets.
 - Change names of ETH clocks to ETH0, even though there is just one ETH,
   to match the HW manual.
 - Change names of IIC PCLKs to better match the HW manual
---
 include/dt-bindings/clock/r9a09g011-cpg.h | 352 ++++++++++++++++++++++
 1 file changed, 352 insertions(+)
 create mode 100644 include/dt-bindings/clock/r9a09g011-cpg.h

diff --git a/include/dt-bindings/clock/r9a09g011-cpg.h b/include/dt-bindings/clock/r9a09g011-cpg.h
new file mode 100644
index 000000000000..41dd585d7115
--- /dev/null
+++ b/include/dt-bindings/clock/r9a09g011-cpg.h
@@ -0,0 +1,352 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+ *
+ * Copyright (C) 2022 Renesas Electronics Corp.
+ */
+#ifndef __DT_BINDINGS_CLOCK_R9A09G011_CPG_H__
+#define __DT_BINDINGS_CLOCK_R9A09G011_CPG_H__
+
+#include <dt-bindings/clock/renesas-cpg-mssr.h>
+
+/* Module Clocks */
+#define R9A09G011_SYS_CLK		0
+#define R9A09G011_PFC_PCLK		1
+#define R9A09G011_PMC_CORE_CLOCK	2
+#define R9A09G011_GIC_CLK		3
+#define R9A09G011_RAMA_ACLK		4
+#define R9A09G011_ROMA_ACLK		5
+#define R9A09G011_SEC_ACLK		6
+#define R9A09G011_SEC_PCLK		7
+#define R9A09G011_SEC_TCLK		8
+#define R9A09G011_DMAA_ACLK		9
+#define R9A09G011_TSU0_PCLK		10
+#define R9A09G011_TSU1_PCLK		11
+
+#define R9A09G011_CST_TRACECLK		12
+#define R9A09G011_CST_SB_CLK		13
+#define R9A09G011_CST_AHB_CLK		14
+#define R9A09G011_CST_ATB_SB_CLK	15
+#define R9A09G011_CST_TS_SB_CLK		16
+
+#define R9A09G011_SDI0_ACLK		17
+#define R9A09G011_SDI0_IMCLK		18
+#define R9A09G011_SDI0_IMCLK2		19
+#define R9A09G011_SDI0_CLK_HS		20
+#define R9A09G011_SDI1_ACLK		21
+#define R9A09G011_SDI1_IMCLK		22
+#define R9A09G011_SDI1_IMCLK2		23
+#define R9A09G011_SDI1_CLK_HS		24
+#define R9A09G011_EMM_ACLK		25
+#define R9A09G011_EMM_IMCLK		26
+#define R9A09G011_EMM_IMCLK2		27
+#define R9A09G011_EMM_CLK_HS		28
+#define R9A09G011_NFI_ACLK		29
+#define R9A09G011_NFI_NF_CLK		30
+
+#define R9A09G011_PCI_ACLK		31
+#define R9A09G011_PCI_CLK_PMU		32
+#define R9A09G011_PCI_APB_CLK		33
+#define R9A09G011_USB_ACLK_H		34
+#define R9A09G011_USB_ACLK_P		35
+#define R9A09G011_USB_PCLK		36
+#define R9A09G011_ETH0_CLK_AXI		37
+#define R9A09G011_ETH0_CLK_CHI		38
+#define R9A09G011_ETH0_GPTP_EXT		39
+
+#define R9A09G011_SDT_CLK		40
+#define R9A09G011_SDT_CLKAPB		41
+#define R9A09G011_SDT_CLK48		42
+#define R9A09G011_GRP_CLK		43
+#define R9A09G011_CIF_P0_CLK		44
+#define R9A09G011_CIF_P1_CLK		45
+#define R9A09G011_CIF_APB_CLK		46
+#define R9A09G011_DCI_CLKAXI		47
+#define R9A09G011_DCI_CLKAPB		48
+#define R9A09G011_DCI_CLKDCI2		49
+
+#define R9A09G011_HMI_PCLK		50
+#define R9A09G011_LCI_PCLK		51
+#define R9A09G011_LCI_ACLK		52
+#define R9A09G011_LCI_VCLK		53
+#define R9A09G011_LCI_LPCLK		54
+
+#define R9A09G011_AUI_CLK		55
+#define R9A09G011_AUI_CLKAXI		56
+#define R9A09G011_AUI_CLKAPB		57
+#define R9A09G011_AUMCLK		58
+#define R9A09G011_GMCLK0		59
+#define R9A09G011_GMCLK1		60
+#define R9A09G011_MTR_CLK0		61
+#define R9A09G011_MTR_CLK1		62
+#define R9A09G011_MTR_CLKAPB		63
+#define R9A09G011_GFT_CLK		64
+#define R9A09G011_GFT_CLKAPB		65
+#define R9A09G011_GFT_MCLK		66
+
+#define R9A09G011_ATGA_CLK		67
+#define R9A09G011_ATGA_CLKAPB		68
+#define R9A09G011_ATGB_CLK		69
+#define R9A09G011_ATGB_CLKAPB		70
+#define R9A09G011_SYC_CNT_CLK		71
+
+#define R9A09G011_CPERI_GRPA_PCLK	72
+#define R9A09G011_TIM0_CLK		73
+#define R9A09G011_TIM1_CLK		74
+#define R9A09G011_TIM2_CLK		75
+#define R9A09G011_TIM3_CLK		76
+#define R9A09G011_TIM4_CLK		77
+#define R9A09G011_TIM5_CLK		78
+#define R9A09G011_TIM6_CLK		79
+#define R9A09G011_TIM7_CLK		80
+#define R9A09G011_IIC_PCLK0		81
+
+#define R9A09G011_CPERI_GRPB_PCLK	82
+#define R9A09G011_TIM8_CLK		83
+#define R9A09G011_TIM9_CLK		84
+#define R9A09G011_TIM10_CLK		85
+#define R9A09G011_TIM11_CLK		86
+#define R9A09G011_TIM12_CLK		87
+#define R9A09G011_TIM13_CLK		88
+#define R9A09G011_TIM14_CLK		89
+#define R9A09G011_TIM15_CLK		90
+#define R9A09G011_IIC_PCLK1		91
+
+#define R9A09G011_CPERI_GRPC_PCLK	92
+#define R9A09G011_TIM16_CLK		93
+#define R9A09G011_TIM17_CLK		94
+#define R9A09G011_TIM18_CLK		95
+#define R9A09G011_TIM19_CLK		96
+#define R9A09G011_TIM20_CLK		97
+#define R9A09G011_TIM21_CLK		98
+#define R9A09G011_TIM22_CLK		99
+#define R9A09G011_TIM23_CLK		100
+#define R9A09G011_WDT0_PCLK		101
+#define R9A09G011_WDT0_CLK		102
+#define R9A09G011_WDT1_PCLK		103
+#define R9A09G011_WDT1_CLK		104
+
+#define R9A09G011_CPERI_GRPD_PCLK	105
+#define R9A09G011_TIM24_CLK		106
+#define R9A09G011_TIM25_CLK		107
+#define R9A09G011_TIM26_CLK		108
+#define R9A09G011_TIM27_CLK		109
+#define R9A09G011_TIM28_CLK		110
+#define R9A09G011_TIM29_CLK		111
+#define R9A09G011_TIM30_CLK		112
+#define R9A09G011_TIM31_CLK		113
+
+#define R9A09G011_CPERI_GRPE_PCLK	114
+#define R9A09G011_PWM0_CLK		115
+#define R9A09G011_PWM1_CLK		116
+#define R9A09G011_PWM2_CLK		117
+#define R9A09G011_PWM3_CLK		118
+#define R9A09G011_PWM4_CLK		119
+#define R9A09G011_PWM5_CLK		120
+#define R9A09G011_PWM6_CLK		121
+#define R9A09G011_PWM7_CLK		122
+
+#define R9A09G011_CPERI_GRPF_PCLK	123
+#define R9A09G011_PWM8_CLK		124
+#define R9A09G011_PWM9_CLK		125
+#define R9A09G011_PWM10_CLK		126
+#define R9A09G011_PWM11_CLK		127
+#define R9A09G011_PWM12_CLK		128
+#define R9A09G011_PWM13_CLK		129
+#define R9A09G011_PWM14_CLK		130
+#define R9A09G011_PWM15_CLK		131
+
+#define R9A09G011_CPERI_GRPG_PCLK	132
+#define R9A09G011_CPERI_GRPH_PCLK	133
+#define R9A09G011_URT_PCLK		134
+#define R9A09G011_URT0_CLK		135
+#define R9A09G011_URT1_CLK		136
+#define R9A09G011_CSI0_CLK		137
+#define R9A09G011_CSI1_CLK		138
+#define R9A09G011_CSI2_CLK		139
+#define R9A09G011_CSI3_CLK		140
+#define R9A09G011_CSI4_CLK		141
+#define R9A09G011_CSI5_CLK		142
+
+#define R9A09G011_ICB_ACLK1		143
+#define R9A09G011_ICB_GIC_CLK		144
+#define R9A09G011_ICB_MPCLK1		145
+#define R9A09G011_ICB_SPCLK1		146
+#define R9A09G011_ICB_CLK48		147
+#define R9A09G011_ICB_CLK48_2		148
+#define R9A09G011_ICB_CLK48_3		149
+#define R9A09G011_ICB_CLK48_4L		150
+#define R9A09G011_ICB_CLK48_4R		151
+#define R9A09G011_ICB_CLK48_5		152
+#define R9A09G011_ICB_CST_ATB_SB_CLK	153
+#define R9A09G011_ICB_CST_CS_CLK	154
+#define R9A09G011_ICB_CLK100_1		155
+#define R9A09G011_ICB_ETH0_CLK_AXI	156
+#define R9A09G011_ICB_DCI_CLKAXI	157
+#define R9A09G011_ICB_SYC_CNT_CLK	158
+
+#define R9A09G011_ICB_DRPA_ACLK		159
+#define R9A09G011_ICB_RFX_ACLK		160
+#define R9A09G011_ICB_RFX_PCLK5		161
+#define R9A09G011_ICB_MMC_ACLK		162
+
+#define R9A09G011_ICB_MPCLK3		163
+#define R9A09G011_ICB_CIMA_CLK		164
+#define R9A09G011_ICB_CIMB_CLK		165
+#define R9A09G011_ICB_BIMA_CLK		166
+#define R9A09G011_ICB_FCD_CLKAXI	167
+#define R9A09G011_ICB_VD_ACLK4		168
+#define R9A09G011_ICB_MPCLK4		169
+#define R9A09G011_ICB_VCD_PCLK4		170
+
+#define R9A09G011_CA53_CLK		171
+#define R9A09G011_CA53_ACLK		172
+#define R9A09G011_CA53_APCLK_DBG	173
+#define R9A09G011_CST_APB_CA53_CLK	174
+#define R9A09G011_CA53_ATCLK		175
+#define R9A09G011_CST_CS_CLK		176
+#define R9A09G011_CA53_TSCLK		177
+#define R9A09G011_CST_TS_CLK		178
+#define R9A09G011_CA53_APCLK_REG	179
+
+#define R9A09G011_DRPA_ACLK		180
+#define R9A09G011_DRPA_DCLK		181
+#define R9A09G011_DRPA_INITCLK		182
+
+#define R9A09G011_RAMB0_ACLK		183
+#define R9A09G011_RAMB1_ACLK		184
+#define R9A09G011_RAMB2_ACLK		185
+#define R9A09G011_RAMB3_ACLK		186
+
+#define R9A09G011_CIMA_CLKAPB		187
+#define R9A09G011_CIMA_CLK		188
+#define R9A09G011_CIMB_CLK		189
+#define R9A09G011_FAFA_CLK		190
+#define R9A09G011_STG_CLKAXI		191
+#define R9A09G011_STG_CLK0		192
+
+#define R9A09G011_BIMA_CLKAPB		193
+#define R9A09G011_BIMA_CLK		194
+#define R9A09G011_FAFB_CLK		195
+#define R9A09G011_FCD_CLK		196
+#define R9A09G011_FCD_CLKAXI		197
+
+#define R9A09G011_RIM_CLK		198
+#define R9A09G011_VCD_ACLK		199
+#define R9A09G011_VCD_PCLK		200
+#define R9A09G011_JPG0_CLK		201
+#define R9A09G011_JPG0_ACLK		202
+
+#define R9A09G011_MMC_CORE_DDRC_CLK	203
+#define R9A09G011_MMC_ACLK		204
+#define R9A09G011_MMC_PCLK		205
+#define R9A09G011_DDI_APBCLK		206
+
+/* Resets */
+#define R9A09G011_SYS_RST_N		0
+#define R9A09G011_PFC_PRESETN		1
+#define R9A09G011_RAMA_ARESETN		2
+#define R9A09G011_ROM_ARESETN		3
+#define R9A09G011_DMAA_ARESETN		4
+#define R9A09G011_SEC_ARESETN		5
+#define R9A09G011_SEC_PRESETN		6
+#define R9A09G011_SEC_RSTB		7
+#define R9A09G011_TSU0_RESETN		8
+#define R9A09G011_TSU1_RESETN		9
+#define R9A09G011_PMC_RESET_N		10
+
+#define R9A09G011_CST_NTRST		11
+#define R9A09G011_CST_NPOTRST		12
+#define R9A09G011_CST_NTRST2		13
+#define R9A09G011_CST_CS_RESETN		14
+#define R9A09G011_CST_TS_RESETN		15
+#define R9A09G011_CST_TRESETN		16
+#define R9A09G011_CST_SB_RESETN		17
+#define R9A09G011_CST_AHB_RESETN	18
+#define R9A09G011_CST_TS_SB_RESETN	19
+#define R9A09G011_CST_APB_CA53_RESETN	20
+#define R9A09G011_CST_ATB_SB_RESETN	21
+
+#define R9A09G011_SDI0_IXRST		22
+#define R9A09G011_SDI1_IXRST		23
+#define R9A09G011_EMM_IXRST		24
+#define R9A09G011_NFI_MARESETN		25
+#define R9A09G011_NFI_REG_RST_N		26
+#define R9A09G011_USB_PRESET_N		27
+#define R9A09G011_USB_DRD_RESET		28
+#define R9A09G011_USB_ARESETN_P		29
+#define R9A09G011_USB_ARESETN_H		30
+#define R9A09G011_ETH0_RST_HW_N		31
+#define R9A09G011_PCI_ARESETN		32
+
+#define R9A09G011_SDT_RSTSYSAX		33
+#define R9A09G011_GRP_RESETN		34
+#define R9A09G011_CIF_RST_N		35
+#define R9A09G011_DCU_RSTSYSAX		36
+#define R9A09G011_HMI_RST_N		37
+#define R9A09G011_HMI_PRESETN		38
+#define R9A09G011_LCI_PRESETN		39
+#define R9A09G011_LCI_ARESETN		40
+
+#define R9A09G011_AUI_RSTSYSAX		41
+#define R9A09G011_MTR_RSTSYSAX		42
+#define R9A09G011_GFT_RSTSYSAX		43
+#define R9A09G011_ATGA_RSTSYSAX		44
+#define R9A09G011_ATGB_RSTSYSAX		45
+#define R9A09G011_SYC_RST_N		46
+
+#define R9A09G011_TIM_GPA_PRESETN	47
+#define R9A09G011_TIM_GPB_PRESETN	48
+#define R9A09G011_TIM_GPC_PRESETN	49
+#define R9A09G011_TIM_GPD_PRESETN	50
+#define R9A09G011_PWM_GPE_PRESETN	51
+#define R9A09G011_PWM_GPF_PRESETN	52
+#define R9A09G011_CSI_GPG_PRESETN	53
+#define R9A09G011_CSI_GPH_PRESETN	54
+#define R9A09G011_IIC_GPA_PRESETN	55
+#define R9A09G011_IIC_GPB_PRESETN	56
+#define R9A09G011_URT_PRESETN		57
+#define R9A09G011_WDT0_PRESETN		58
+#define R9A09G011_WDT1_PRESETN		59
+
+#define R9A09G011_ICB_PD_AWO_RST_N	60
+#define R9A09G011_ICB_PD_MMC_RST_N	61
+#define R9A09G011_ICB_PD_VD0_RST_N	62
+#define R9A09G011_ICB_PD_VD1_RST_N	63
+#define R9A09G011_ICB_PD_RFX_RST_N	64
+
+#define R9A09G011_CA53_NCPUPORESET0	65
+#define R9A09G011_CA53_NCPUPORESET1	66
+#define R9A09G011_CA53_NCORERESET0	67
+#define R9A09G011_CA53_NCORERESET1	68
+#define R9A09G011_CA53_NPRESETDBG	69
+#define R9A09G011_CA53_L2RESET		70
+#define R9A09G011_CA53_NMISCRESET_HM	71
+#define R9A09G011_CA53_NMISCRESET_SM	72
+#define R9A09G011_CA53_NARESET		73
+
+#define R9A09G011_DRPA_ARESETN		74
+
+#define R9A09G011_RAMB0_ARESETN		75
+#define R9A09G011_RAMB1_ARESETN		76
+#define R9A09G011_RAMB2_ARESETN		77
+#define R9A09G011_RAMB3_ARESETN		78
+
+#define R9A09G011_CIMA_RSTSYSAX		79
+#define R9A09G011_CIMB_RSTSYSAX		80
+#define R9A09G011_FAFA_RSTSYSAX		81
+#define R9A09G011_STG_RSTSYSAX		82
+
+#define R9A09G011_BIMA_RSTSYSAX		83
+#define R9A09G011_FAFB_RSTSYSAX		84
+#define R9A09G011_FCD_RSTSYSAX		85
+#define R9A09G011_RIM_RSTSYSAX		86
+#define R9A09G011_VCD_RESETN		87
+#define R9A09G011_JPG_XRESET		88
+
+#define R9A09G011_MMC_CORE_DDRC_RSTN	89
+#define R9A09G011_MMC_ARESETN_N		90
+#define R9A09G011_MMC_PRESETN		91
+#define R9A09G011_DDI_PWROK		92
+#define R9A09G011_DDI_RESET		93
+#define R9A09G011_DDI_RESETN_APB	94
+
+#endif /* __DT_BINDINGS_CLOCK_R9A09G011_CPG_H__ */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
  2022-05-03 11:55 ` [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers Phil Edworthy
  2022-05-03 11:55 ` [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:43   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset Phil Edworthy
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski
  Cc: Phil Edworthy, linux-renesas-soc, linux-clk, devicetree,
	Biju Das, Krzysztof Kozlowski

Document the device tree binding for the Renesas RZ/V2M (r9a09g011) SoC.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
 - Simplify reference to header files.
---
 .../bindings/clock/renesas,rzg2l-cpg.yaml           | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/renesas,rzg2l-cpg.yaml b/Documentation/devicetree/bindings/clock/renesas,rzg2l-cpg.yaml
index 311a93590597..8880b834f264 100644
--- a/Documentation/devicetree/bindings/clock/renesas,rzg2l-cpg.yaml
+++ b/Documentation/devicetree/bindings/clock/renesas,rzg2l-cpg.yaml
@@ -4,14 +4,15 @@
 $id: "http://devicetree.org/schemas/clock/renesas,rzg2l-cpg.yaml#"
 $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 
-title: Renesas RZ/{G2L,V2L} Clock Pulse Generator / Module Standby Mode
+title: Renesas RZ/{G2L,V2L,V2M} Clock Pulse Generator / Module Standby Mode
 
 maintainers:
   - Geert Uytterhoeven <geert+renesas@glider.be>
 
 description: |
   On Renesas RZ/{G2L,V2L}-alike SoC's, the CPG (Clock Pulse Generator) and Module
-  Standby Mode share the same register block.
+  Standby Mode share the same register block. On RZ/V2M, the functionality is
+  similar, but does not have Clock Monitor Registers.
 
   They provide the following functionalities:
     - The CPG block generates various core clocks,
@@ -26,6 +27,7 @@ properties:
       - renesas,r9a07g043-cpg # RZ/G2UL{Type-1,Type-2}
       - renesas,r9a07g044-cpg # RZ/G2{L,LC}
       - renesas,r9a07g054-cpg # RZ/V2L
+      - renesas,r9a09g011-cpg # RZ/V2M
 
   reg:
     maxItems: 1
@@ -43,9 +45,10 @@ properties:
     description: |
       - For CPG core clocks, the two clock specifier cells must be "CPG_CORE"
         and a core clock reference, as defined in
-        <dt-bindings/clock/r9a07g*-cpg.h>
+        <dt-bindings/clock/r9a0*-cpg.h>
       - For module clocks, the two clock specifier cells must be "CPG_MOD" and
-        a module number, as defined in the <dt-bindings/clock/r9a07g0*-cpg.h>.
+        a module number, as defined in the <dt-bindings/clock/r9a07g0*-cpg.h> or
+        <dt-bindings/clock/r9a09g011-cpg.h>.
     const: 2
 
   '#power-domain-cells':
@@ -59,7 +62,7 @@ properties:
   '#reset-cells':
     description:
       The single reset specifier cell must be the module number, as defined in
-      the <dt-bindings/clock/r9a07g0*-cpg.h>.
+      the <dt-bindings/clock/r9a07g0*-cpg.h> or <dt-bindings/clock/r9a09g011-cpg.h>.
     const: 1
 
 required:
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer:  Add optional clock and reset
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (2 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-03 13:11   ` Mark Rutland
  2022-05-03 13:12   ` Marc Zyngier
  2022-05-03 11:55 ` [PATCH v3 05/12] clk: renesas: rzg2l: Move the DEF_MUX array size calc into the macro Phil Edworthy
                   ` (7 subsequent siblings)
  11 siblings, 2 replies; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Phil Edworthy, Geert Uytterhoeven, Biju Das, Daniel Lezcano,
	Thomas Gleixner, Marc Zyngier, Mark Rutland, devicetree,
	linux-renesas-soc

Some SoCs use a gated clock for the timer and the means to reset the timer.
Hence add these as optional.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 .../devicetree/bindings/timer/arm,arch_timer.yaml          | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
index df8ce87fd54b..20cd90fc7015 100644
--- a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
+++ b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
@@ -64,6 +64,13 @@ properties:
       CNTFRQ on all CPUs to a uniform correct value. Use of this property is
       strongly discouraged; fix your firmware unless absolutely impossible.
 
+  clocks:
+    description: Optional clock for the timer.
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
   always-on:
     type: boolean
     description: If present, the timer is powered through an always-on power
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 05/12] clk: renesas: rzg2l: Move the DEF_MUX array size calc into the macro
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (3 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:44   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 06/12] clk: renesas: rzg2l: Add read only versions of the clk macros Phil Edworthy
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Phil Edworthy, Biju Das, linux-renesas-soc, linux-clk

We only ever use ARRAY_SIZE() to populate the number of parents, so
move this into the macro to always detect it automatically. This
also makes the tables of clocks a little simpler.
Similarly for the DEF_SD_MUX macro.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
v3:
 - New patch inserted
---
 drivers/clk/renesas/r9a07g043-cpg.c | 10 ++++------
 drivers/clk/renesas/r9a07g044-cpg.c | 15 ++++++---------
 drivers/clk/renesas/rzg2l-cpg.h     | 16 +++++++++-------
 3 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/clk/renesas/r9a07g043-cpg.c b/drivers/clk/renesas/r9a07g043-cpg.c
index 7ef2c43ea891..8241f5972de1 100644
--- a/drivers/clk/renesas/r9a07g043-cpg.c
+++ b/drivers/clk/renesas/r9a07g043-cpg.c
@@ -99,7 +99,7 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
 	DEF_FIXED(".pll3_400", CLK_PLL3_400, CLK_PLL3, 1, 4),
 	DEF_FIXED(".pll3_533", CLK_PLL3_533, CLK_PLL3, 1, 3),
 	DEF_MUX(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3,
-		sel_pll3_3, ARRAY_SIZE(sel_pll3_3), 0, CLK_MUX_READ_ONLY),
+		sel_pll3_3, 0, CLK_MUX_READ_ONLY),
 	DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3,
 		DIVPL3C, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
 	DEF_FIXED(".pll5", CLK_PLL5, CLK_EXTAL, 125, 1),
@@ -123,13 +123,11 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
 	DEF_FIXED("M0", R9A07G043_CLK_M0, CLK_PLL3_DIV2_4, 1, 1),
 	DEF_FIXED("ZT", R9A07G043_CLK_ZT, CLK_PLL3_DIV2_4_2, 1, 1),
 	DEF_MUX("HP", R9A07G043_CLK_HP, SEL_PLL6_2,
-		sel_pll6_2, ARRAY_SIZE(sel_pll6_2), 0, CLK_MUX_HIWORD_MASK),
+		sel_pll6_2, 0, CLK_MUX_HIWORD_MASK),
 	DEF_FIXED("SPI0", R9A07G043_CLK_SPI0, CLK_DIV_PLL3_C, 1, 2),
 	DEF_FIXED("SPI1", R9A07G043_CLK_SPI1, CLK_DIV_PLL3_C, 1, 4),
-	DEF_SD_MUX("SD0", R9A07G043_CLK_SD0, SEL_SDHI0,
-		   sel_shdi, ARRAY_SIZE(sel_shdi)),
-	DEF_SD_MUX("SD1", R9A07G043_CLK_SD1, SEL_SDHI1,
-		   sel_shdi, ARRAY_SIZE(sel_shdi)),
+	DEF_SD_MUX("SD0", R9A07G043_CLK_SD0, SEL_SDHI0, sel_shdi),
+	DEF_SD_MUX("SD1", R9A07G043_CLK_SD1, SEL_SDHI1, sel_shdi),
 	DEF_FIXED("SD0_DIV4", CLK_SD0_DIV4, R9A07G043_CLK_SD0, 1, 4),
 	DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G043_CLK_SD1, 1, 4),
 };
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 0a5c2265b842..43c4d6b8ccf4 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -139,18 +139,17 @@ static const struct {
 		DEF_FIXED(".pll3_div2_4", CLK_PLL3_DIV2_4, CLK_PLL3_DIV2, 1, 4),
 		DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
 		DEF_MUX(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3,
-			sel_pll3_3, ARRAY_SIZE(sel_pll3_3), 0, CLK_MUX_READ_ONLY),
+			sel_pll3_3, 0, CLK_MUX_READ_ONLY),
 		DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3,
 			DIVPL3C, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
 
 		DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_FOUT3, 1, 2),
 		DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
 		DEF_MUX(".sel_gpu2", CLK_SEL_GPU2, SEL_GPU2,
-			sel_gpu2, ARRAY_SIZE(sel_gpu2), 0, CLK_MUX_READ_ONLY),
+			sel_gpu2, 0, CLK_MUX_READ_ONLY),
 		DEF_PLL5_FOUTPOSTDIV(".pll5_foutpostdiv", CLK_PLL5_FOUTPOSTDIV, CLK_EXTAL),
 		DEF_FIXED(".pll5_fout1ph0", CLK_PLL5_FOUT1PH0, CLK_PLL5_FOUTPOSTDIV, 1, 2),
-		DEF_PLL5_4_MUX(".sel_pll5_4", CLK_SEL_PLL5_4, SEL_PLL5_4,
-			       sel_pll5_4, ARRAY_SIZE(sel_pll5_4)),
+		DEF_PLL5_4_MUX(".sel_pll5_4", CLK_SEL_PLL5_4, SEL_PLL5_4, sel_pll5_4),
 		DEF_DIV(".div_dsi_lpclk", CLK_DIV_DSI_LPCLK, CLK_PLL2_533_DIV2,
 			DIVDSILPCLK, dtable_16_128, CLK_DIVIDER_HIWORD_MASK),
 
@@ -169,13 +168,11 @@ static const struct {
 		DEF_FIXED("M0", R9A07G044_CLK_M0, CLK_PLL3_DIV2_4, 1, 1),
 		DEF_FIXED("ZT", R9A07G044_CLK_ZT, CLK_PLL3_DIV2_4_2, 1, 1),
 		DEF_MUX("HP", R9A07G044_CLK_HP, SEL_PLL6_2,
-			sel_pll6_2, ARRAY_SIZE(sel_pll6_2), 0, CLK_MUX_HIWORD_MASK),
+			sel_pll6_2, 0, CLK_MUX_HIWORD_MASK),
 		DEF_FIXED("SPI0", R9A07G044_CLK_SPI0, CLK_DIV_PLL3_C, 1, 2),
 		DEF_FIXED("SPI1", R9A07G044_CLK_SPI1, CLK_DIV_PLL3_C, 1, 4),
-		DEF_SD_MUX("SD0", R9A07G044_CLK_SD0, SEL_SDHI0,
-			   sel_shdi, ARRAY_SIZE(sel_shdi)),
-		DEF_SD_MUX("SD1", R9A07G044_CLK_SD1, SEL_SDHI1,
-			   sel_shdi, ARRAY_SIZE(sel_shdi)),
+		DEF_SD_MUX("SD0", R9A07G044_CLK_SD0, SEL_SDHI0, sel_shdi),
+		DEF_SD_MUX("SD1", R9A07G044_CLK_SD1, SEL_SDHI1, sel_shdi),
 		DEF_FIXED("SD0_DIV4", CLK_SD0_DIV4, R9A07G044_CLK_SD0, 1, 4),
 		DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G044_CLK_SD1, 1, 4),
 		DEF_DIV("G", R9A07G044_CLK_G, CLK_SEL_GPU2, DIVGPU, dtable_1_8,
diff --git a/drivers/clk/renesas/rzg2l-cpg.h b/drivers/clk/renesas/rzg2l-cpg.h
index 1be29cec0cb2..dfef1e2792fa 100644
--- a/drivers/clk/renesas/rzg2l-cpg.h
+++ b/drivers/clk/renesas/rzg2l-cpg.h
@@ -138,19 +138,21 @@ enum clk_types {
 #define DEF_DIV(_name, _id, _parent, _conf, _dtable, _flag) \
 	DEF_TYPE(_name, _id, CLK_TYPE_DIV, .conf = _conf, \
 		 .parent = _parent, .dtable = _dtable, .flag = _flag)
-#define DEF_MUX(_name, _id, _conf, _parent_names, _num_parents, _flag, \
-		_mux_flags) \
+#define DEF_MUX(_name, _id, _conf, _parent_names, _flag, _mux_flags) \
 	DEF_TYPE(_name, _id, CLK_TYPE_MUX, .conf = _conf, \
-		 .parent_names = _parent_names, .num_parents = _num_parents, \
+		 .parent_names = _parent_names, \
+		 .num_parents = ARRAY_SIZE(_parent_names), \
 		 .flag = _flag, .mux_flags = _mux_flags)
-#define DEF_SD_MUX(_name, _id, _conf, _parent_names, _num_parents) \
+#define DEF_SD_MUX(_name, _id, _conf, _parent_names) \
 	DEF_TYPE(_name, _id, CLK_TYPE_SD_MUX, .conf = _conf, \
-		 .parent_names = _parent_names, .num_parents = _num_parents)
+		 .parent_names = _parent_names, \
+		 .num_parents = ARRAY_SIZE(_parent_names))
 #define DEF_PLL5_FOUTPOSTDIV(_name, _id, _parent) \
 	DEF_TYPE(_name, _id, CLK_TYPE_SIPLL5, .parent = _parent)
-#define DEF_PLL5_4_MUX(_name, _id, _conf, _parent_names, _num_parents) \
+#define DEF_PLL5_4_MUX(_name, _id, _conf, _parent_names) \
 	DEF_TYPE(_name, _id, CLK_TYPE_PLL5_4_MUX, .conf = _conf, \
-		 .parent_names = _parent_names, .num_parents = _num_parents)
+		 .parent_names = _parent_names, \
+		 .num_parents = ARRAY_SIZE(_parent_names))
 #define DEF_DSI_DIV(_name, _id, _parent, _flag) \
 	DEF_TYPE(_name, _id, CLK_TYPE_DSI_DIV, .parent = _parent, .flag = _flag)
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 06/12] clk: renesas: rzg2l: Add read only versions of the clk macros
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (4 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 05/12] clk: renesas: rzg2l: Move the DEF_MUX array size calc into the macro Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:44   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 07/12] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers Phil Edworthy
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Phil Edworthy, Biju Das, linux-renesas-soc, linux-clk

This just makes the clk tables easier to read.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
v3:
 - New patch inserted
---
 drivers/clk/renesas/r9a07g043-cpg.c | 3 +--
 drivers/clk/renesas/r9a07g044-cpg.c | 6 ++----
 drivers/clk/renesas/rzg2l-cpg.h     | 9 +++++++++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/renesas/r9a07g043-cpg.c b/drivers/clk/renesas/r9a07g043-cpg.c
index 8241f5972de1..fde934151b57 100644
--- a/drivers/clk/renesas/r9a07g043-cpg.c
+++ b/drivers/clk/renesas/r9a07g043-cpg.c
@@ -98,8 +98,7 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
 	DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
 	DEF_FIXED(".pll3_400", CLK_PLL3_400, CLK_PLL3, 1, 4),
 	DEF_FIXED(".pll3_533", CLK_PLL3_533, CLK_PLL3, 1, 3),
-	DEF_MUX(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3,
-		sel_pll3_3, 0, CLK_MUX_READ_ONLY),
+	DEF_MUX_RO(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3, sel_pll3_3),
 	DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3,
 		DIVPL3C, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
 	DEF_FIXED(".pll5", CLK_PLL5, CLK_EXTAL, 125, 1),
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 43c4d6b8ccf4..ee442684453b 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -138,15 +138,13 @@ static const struct {
 		DEF_FIXED(".pll3_div2_2", CLK_PLL3_DIV2_2, CLK_PLL3_DIV2, 1, 2),
 		DEF_FIXED(".pll3_div2_4", CLK_PLL3_DIV2_4, CLK_PLL3_DIV2, 1, 4),
 		DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
-		DEF_MUX(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3,
-			sel_pll3_3, 0, CLK_MUX_READ_ONLY),
+		DEF_MUX_RO(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3, sel_pll3_3),
 		DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3,
 			DIVPL3C, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
 
 		DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_FOUT3, 1, 2),
 		DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
-		DEF_MUX(".sel_gpu2", CLK_SEL_GPU2, SEL_GPU2,
-			sel_gpu2, 0, CLK_MUX_READ_ONLY),
+		DEF_MUX_RO(".sel_gpu2", CLK_SEL_GPU2, SEL_GPU2, sel_gpu2),
 		DEF_PLL5_FOUTPOSTDIV(".pll5_foutpostdiv", CLK_PLL5_FOUTPOSTDIV, CLK_EXTAL),
 		DEF_FIXED(".pll5_fout1ph0", CLK_PLL5_FOUT1PH0, CLK_PLL5_FOUTPOSTDIV, 1, 2),
 		DEF_PLL5_4_MUX(".sel_pll5_4", CLK_SEL_PLL5_4, SEL_PLL5_4, sel_pll5_4),
diff --git a/drivers/clk/renesas/rzg2l-cpg.h b/drivers/clk/renesas/rzg2l-cpg.h
index dfef1e2792fa..a6004f0b415a 100644
--- a/drivers/clk/renesas/rzg2l-cpg.h
+++ b/drivers/clk/renesas/rzg2l-cpg.h
@@ -138,11 +138,20 @@ enum clk_types {
 #define DEF_DIV(_name, _id, _parent, _conf, _dtable, _flag) \
 	DEF_TYPE(_name, _id, CLK_TYPE_DIV, .conf = _conf, \
 		 .parent = _parent, .dtable = _dtable, .flag = _flag)
+#define DEF_DIV_RO(_name, _id, _parent, _conf, _dtable) \
+	DEF_TYPE(_name, _id, CLK_TYPE_DIV, .conf = _conf, \
+		 .parent = _parent, .dtable = _dtable, \
+		 .flag = CLK_DIVIDER_READ_ONLY)
 #define DEF_MUX(_name, _id, _conf, _parent_names, _flag, _mux_flags) \
 	DEF_TYPE(_name, _id, CLK_TYPE_MUX, .conf = _conf, \
 		 .parent_names = _parent_names, \
 		 .num_parents = ARRAY_SIZE(_parent_names), \
 		 .flag = _flag, .mux_flags = _mux_flags)
+#define DEF_MUX_RO(_name, _id, _conf, _parent_names) \
+	DEF_TYPE(_name, _id, CLK_TYPE_MUX, .conf = _conf, \
+		 .parent_names = _parent_names, \
+		 .num_parents = ARRAY_SIZE(_parent_names), \
+		 .mux_flags = CLK_MUX_READ_ONLY)
 #define DEF_SD_MUX(_name, _id, _conf, _parent_names) \
 	DEF_TYPE(_name, _id, CLK_TYPE_SD_MUX, .conf = _conf, \
 		 .parent_names = _parent_names, \
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 07/12] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (5 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 06/12] clk: renesas: rzg2l: Add read only versions of the clk macros Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:44   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 08/12] clk: renesas: rzg2l: Make use of CLK_MON registers optional Phil Edworthy
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Phil Edworthy, linux-renesas-soc, linux-clk, Biju Das

All of the muxes and dividers that can be modified require the HIWORD
flags, so make the macros set them. It won't affect read only muxes and
dividers.
This will make the clock tables a little easier to read, particularly for
new SoCs coming.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - Remove HIWORD masks in new r9a07g043-cpg.c
 - Remove flags from DEF_MUX/DEF_DIV args
---
 drivers/clk/renesas/r9a07g043-cpg.c | 18 ++++++------------
 drivers/clk/renesas/r9a07g044-cpg.c | 23 ++++++++---------------
 drivers/clk/renesas/rzg2l-cpg.h     |  9 +++++----
 3 files changed, 19 insertions(+), 31 deletions(-)

diff --git a/drivers/clk/renesas/r9a07g043-cpg.c b/drivers/clk/renesas/r9a07g043-cpg.c
index fde934151b57..53a58034bef4 100644
--- a/drivers/clk/renesas/r9a07g043-cpg.c
+++ b/drivers/clk/renesas/r9a07g043-cpg.c
@@ -99,8 +99,7 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
 	DEF_FIXED(".pll3_400", CLK_PLL3_400, CLK_PLL3, 1, 4),
 	DEF_FIXED(".pll3_533", CLK_PLL3_533, CLK_PLL3, 1, 3),
 	DEF_MUX_RO(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3, sel_pll3_3),
-	DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3,
-		DIVPL3C, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+	DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3, DIVPL3C, dtable_1_32),
 	DEF_FIXED(".pll5", CLK_PLL5, CLK_EXTAL, 125, 1),
 	DEF_FIXED(".pll5_500", CLK_PLL5_500, CLK_PLL5, 1, 6),
 	DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_500, 1, 2),
@@ -108,21 +107,16 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
 	DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
 
 	/* Core output clk */
-	DEF_DIV("I", R9A07G043_CLK_I, CLK_PLL1, DIVPL1A, dtable_1_8,
-		CLK_DIVIDER_HIWORD_MASK),
-	DEF_DIV("P0", R9A07G043_CLK_P0, CLK_PLL2_DIV2_8, DIVPL2A,
-		dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+	DEF_DIV("I", R9A07G043_CLK_I, CLK_PLL1, DIVPL1A, dtable_1_8),
+	DEF_DIV("P0", R9A07G043_CLK_P0, CLK_PLL2_DIV2_8, DIVPL2A, dtable_1_32),
 	DEF_FIXED("P0_DIV2", R9A07G043_CLK_P0_DIV2, R9A07G043_CLK_P0, 1, 2),
 	DEF_FIXED("TSU", R9A07G043_CLK_TSU, CLK_PLL2_DIV2_10, 1, 1),
-	DEF_DIV("P1", R9A07G043_CLK_P1, CLK_PLL3_DIV2_4,
-		DIVPL3B, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+	DEF_DIV("P1", R9A07G043_CLK_P1, CLK_PLL3_DIV2_4, DIVPL3B, dtable_1_32),
 	DEF_FIXED("P1_DIV2", CLK_P1_DIV2, R9A07G043_CLK_P1, 1, 2),
-	DEF_DIV("P2", R9A07G043_CLK_P2, CLK_PLL3_DIV2_4_2,
-		DIVPL3A, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+	DEF_DIV("P2", R9A07G043_CLK_P2, CLK_PLL3_DIV2_4_2, DIVPL3A, dtable_1_32),
 	DEF_FIXED("M0", R9A07G043_CLK_M0, CLK_PLL3_DIV2_4, 1, 1),
 	DEF_FIXED("ZT", R9A07G043_CLK_ZT, CLK_PLL3_DIV2_4_2, 1, 1),
-	DEF_MUX("HP", R9A07G043_CLK_HP, SEL_PLL6_2,
-		sel_pll6_2, 0, CLK_MUX_HIWORD_MASK),
+	DEF_MUX("HP", R9A07G043_CLK_HP, SEL_PLL6_2, sel_pll6_2),
 	DEF_FIXED("SPI0", R9A07G043_CLK_SPI0, CLK_DIV_PLL3_C, 1, 2),
 	DEF_FIXED("SPI1", R9A07G043_CLK_SPI1, CLK_DIV_PLL3_C, 1, 4),
 	DEF_SD_MUX("SD0", R9A07G043_CLK_SD0, SEL_SDHI0, sel_shdi),
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index ee442684453b..8255b39dc147 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -139,8 +139,7 @@ static const struct {
 		DEF_FIXED(".pll3_div2_4", CLK_PLL3_DIV2_4, CLK_PLL3_DIV2, 1, 4),
 		DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
 		DEF_MUX_RO(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3, sel_pll3_3),
-		DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3,
-			DIVPL3C, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+		DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3, DIVPL3C, dtable_1_32),
 
 		DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_FOUT3, 1, 2),
 		DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
@@ -149,32 +148,26 @@ static const struct {
 		DEF_FIXED(".pll5_fout1ph0", CLK_PLL5_FOUT1PH0, CLK_PLL5_FOUTPOSTDIV, 1, 2),
 		DEF_PLL5_4_MUX(".sel_pll5_4", CLK_SEL_PLL5_4, SEL_PLL5_4, sel_pll5_4),
 		DEF_DIV(".div_dsi_lpclk", CLK_DIV_DSI_LPCLK, CLK_PLL2_533_DIV2,
-			DIVDSILPCLK, dtable_16_128, CLK_DIVIDER_HIWORD_MASK),
+			DIVDSILPCLK, dtable_16_128),
 
 		/* Core output clk */
-		DEF_DIV("I", R9A07G044_CLK_I, CLK_PLL1, DIVPL1A, dtable_1_8,
-			CLK_DIVIDER_HIWORD_MASK),
-		DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV2_8, DIVPL2A,
-			dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+		DEF_DIV("I", R9A07G044_CLK_I, CLK_PLL1, DIVPL1A, dtable_1_8),
+		DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV2_8, DIVPL2A, dtable_1_32),
 		DEF_FIXED("P0_DIV2", R9A07G044_CLK_P0_DIV2, R9A07G044_CLK_P0, 1, 2),
 		DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV2_10, 1, 1),
-		DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV2_4,
-			DIVPL3B, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+		DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV2_4, DIVPL3B, dtable_1_32),
 		DEF_FIXED("P1_DIV2", CLK_P1_DIV2, R9A07G044_CLK_P1, 1, 2),
-		DEF_DIV("P2", R9A07G044_CLK_P2, CLK_PLL3_DIV2_4_2,
-			DIVPL3A, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
+		DEF_DIV("P2", R9A07G044_CLK_P2, CLK_PLL3_DIV2_4_2, DIVPL3A, dtable_1_32),
 		DEF_FIXED("M0", R9A07G044_CLK_M0, CLK_PLL3_DIV2_4, 1, 1),
 		DEF_FIXED("ZT", R9A07G044_CLK_ZT, CLK_PLL3_DIV2_4_2, 1, 1),
-		DEF_MUX("HP", R9A07G044_CLK_HP, SEL_PLL6_2,
-			sel_pll6_2, 0, CLK_MUX_HIWORD_MASK),
+		DEF_MUX("HP", R9A07G044_CLK_HP, SEL_PLL6_2, sel_pll6_2),
 		DEF_FIXED("SPI0", R9A07G044_CLK_SPI0, CLK_DIV_PLL3_C, 1, 2),
 		DEF_FIXED("SPI1", R9A07G044_CLK_SPI1, CLK_DIV_PLL3_C, 1, 4),
 		DEF_SD_MUX("SD0", R9A07G044_CLK_SD0, SEL_SDHI0, sel_shdi),
 		DEF_SD_MUX("SD1", R9A07G044_CLK_SD1, SEL_SDHI1, sel_shdi),
 		DEF_FIXED("SD0_DIV4", CLK_SD0_DIV4, R9A07G044_CLK_SD0, 1, 4),
 		DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G044_CLK_SD1, 1, 4),
-		DEF_DIV("G", R9A07G044_CLK_G, CLK_SEL_GPU2, DIVGPU, dtable_1_8,
-			CLK_DIVIDER_HIWORD_MASK),
+		DEF_DIV("G", R9A07G044_CLK_G, CLK_SEL_GPU2, DIVGPU, dtable_1_8),
 		DEF_FIXED("M1", R9A07G044_CLK_M1, CLK_PLL5_FOUTPOSTDIV, 1, 1),
 		DEF_FIXED("M2", R9A07G044_CLK_M2, CLK_PLL3_533, 1, 2),
 		DEF_FIXED("M2_DIV2", CLK_M2_DIV2, R9A07G044_CLK_M2, 1, 2),
diff --git a/drivers/clk/renesas/rzg2l-cpg.h b/drivers/clk/renesas/rzg2l-cpg.h
index a6004f0b415a..59bbc8942e1d 100644
--- a/drivers/clk/renesas/rzg2l-cpg.h
+++ b/drivers/clk/renesas/rzg2l-cpg.h
@@ -135,18 +135,19 @@ enum clk_types {
 	DEF_TYPE(_name, _id, CLK_TYPE_IN)
 #define DEF_FIXED(_name, _id, _parent, _mult, _div) \
 	DEF_BASE(_name, _id, CLK_TYPE_FF, _parent, .div = _div, .mult = _mult)
-#define DEF_DIV(_name, _id, _parent, _conf, _dtable, _flag) \
+#define DEF_DIV(_name, _id, _parent, _conf, _dtable) \
 	DEF_TYPE(_name, _id, CLK_TYPE_DIV, .conf = _conf, \
-		 .parent = _parent, .dtable = _dtable, .flag = _flag)
+		 .parent = _parent, .dtable = _dtable, \
+		 .flag = CLK_DIVIDER_HIWORD_MASK)
 #define DEF_DIV_RO(_name, _id, _parent, _conf, _dtable) \
 	DEF_TYPE(_name, _id, CLK_TYPE_DIV, .conf = _conf, \
 		 .parent = _parent, .dtable = _dtable, \
 		 .flag = CLK_DIVIDER_READ_ONLY)
-#define DEF_MUX(_name, _id, _conf, _parent_names, _flag, _mux_flags) \
+#define DEF_MUX(_name, _id, _conf, _parent_names) \
 	DEF_TYPE(_name, _id, CLK_TYPE_MUX, .conf = _conf, \
 		 .parent_names = _parent_names, \
 		 .num_parents = ARRAY_SIZE(_parent_names), \
-		 .flag = _flag, .mux_flags = _mux_flags)
+		 .mux_flags = CLK_MUX_HIWORD_MASK)
 #define DEF_MUX_RO(_name, _id, _conf, _parent_names) \
 	DEF_TYPE(_name, _id, CLK_TYPE_MUX, .conf = _conf, \
 		 .parent_names = _parent_names, \
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 08/12] clk: renesas: rzg2l: Make use of CLK_MON registers optional
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (6 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 07/12] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:44   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 09/12] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg Phil Edworthy
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Phil Edworthy, linux-renesas-soc, linux-clk, Biju Das

The RZ/V2M SoC doesn't use CLK_MON registers, so make them optional.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - Add has_clk_mon_regs to r9a07g043-cpg.c
 - Improve commit msg.
 - Return early if no clk mon regs to simply the code
---
 drivers/clk/renesas/r9a07g043-cpg.c | 2 ++
 drivers/clk/renesas/r9a07g044-cpg.c | 4 ++++
 drivers/clk/renesas/rzg2l-cpg.c     | 8 +++++++-
 drivers/clk/renesas/rzg2l-cpg.h     | 3 +++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r9a07g043-cpg.c b/drivers/clk/renesas/r9a07g043-cpg.c
index 53a58034bef4..33c2bd8df2e5 100644
--- a/drivers/clk/renesas/r9a07g043-cpg.c
+++ b/drivers/clk/renesas/r9a07g043-cpg.c
@@ -315,4 +315,6 @@ const struct rzg2l_cpg_info r9a07g043_cpg_info = {
 	/* Resets */
 	.resets = r9a07g043_resets,
 	.num_resets = R9A07G043_TSU_PRESETN + 1, /* Last reset ID + 1 */
+
+	.has_clk_mon_regs = true,
 };
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 8255b39dc147..b288897852c7 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -418,6 +418,8 @@ const struct rzg2l_cpg_info r9a07g044_cpg_info = {
 	/* Resets */
 	.resets = r9a07g044_resets,
 	.num_resets = R9A07G044_TSU_PRESETN + 1, /* Last reset ID + 1 */
+
+	.has_clk_mon_regs = true,
 };
 
 #ifdef CONFIG_CLK_R9A07G054
@@ -440,5 +442,7 @@ const struct rzg2l_cpg_info r9a07g054_cpg_info = {
 	/* Resets */
 	.resets = r9a07g044_resets,
 	.num_resets = R9A07G054_STPAI_ARESETN + 1, /* Last reset ID + 1 */
+
+	.has_clk_mon_regs = true,
 };
 #endif
diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 15412cc58337..eaa7c9186163 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -926,6 +926,9 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
 	if (!enable)
 		return 0;
 
+	if (!priv->info->has_clk_mon_regs)
+		return 0;
+
 	for (i = 1000; i > 0; --i) {
 		if (((readl(priv->base + CLK_MON_R(reg))) & bitmask))
 			break;
@@ -996,7 +999,10 @@ static int rzg2l_mod_clock_is_enabled(struct clk_hw *hw)
 	if (clock->sibling)
 		return clock->enabled;
 
-	value = readl(priv->base + CLK_MON_R(clock->off));
+	if (priv->info->has_clk_mon_regs)
+		value = readl(priv->base + CLK_MON_R(clock->off));
+	else
+		value = readl(priv->base + clock->off);
 
 	return value & bitmask;
 }
diff --git a/drivers/clk/renesas/rzg2l-cpg.h b/drivers/clk/renesas/rzg2l-cpg.h
index 59bbc8942e1d..43ce319a477f 100644
--- a/drivers/clk/renesas/rzg2l-cpg.h
+++ b/drivers/clk/renesas/rzg2l-cpg.h
@@ -236,6 +236,7 @@ struct rzg2l_reset {
  * @crit_mod_clks: Array with Module Clock IDs of critical clocks that
  *                 should not be disabled without a knowledgeable driver
  * @num_crit_mod_clks: Number of entries in crit_mod_clks[]
+ * @has_clk_mon_regs: Flag indicating whether the SoC has CLK_MON registers
  */
 struct rzg2l_cpg_info {
 	/* Core Clocks */
@@ -256,6 +257,8 @@ struct rzg2l_cpg_info {
 	/* Critical Module Clocks that should not be disabled */
 	const unsigned int *crit_mod_clks;
 	unsigned int num_crit_mod_clks;
+
+	bool has_clk_mon_regs;
 };
 
 extern const struct rzg2l_cpg_info r9a07g043_cpg_info;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 09/12] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (7 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 08/12] clk: renesas: rzg2l: Make use of CLK_MON registers optional Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:44   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 10/12] clk: renesas: Add RZ/V2M support using the rzg2l driver Phil Edworthy
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Phil Edworthy, linux-renesas-soc, linux-clk, Biju Das

The RZ/V2M doesn't have a matching set of reset monitor regs for each reset
reg like the RZ/G2L. Instead, it has a single CPG_RST_MON reg which has a
single bit per module.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - If no clk mon regs and no clk monitor bit specified, return an error
---
 drivers/clk/renesas/rzg2l-cpg.c | 10 +++++++++-
 drivers/clk/renesas/rzg2l-cpg.h | 10 ++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index eaa7c9186163..89f63c09f089 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -1177,8 +1177,16 @@ static int rzg2l_cpg_status(struct reset_controller_dev *rcdev,
 	const struct rzg2l_cpg_info *info = priv->info;
 	unsigned int reg = info->resets[id].off;
 	u32 bitmask = BIT(info->resets[id].bit);
+	s8 monbit = info->resets[id].monbit;
 
-	return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
+	if (info->has_clk_mon_regs) {
+		return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
+	} else if (monbit >= 0) {
+		u32 monbitmask = BIT(monbit);
+
+		return !!(readl(priv->base + CPG_RST_MON) & monbitmask);
+	}
+	return -ENOTSUPP;
 }
 
 static const struct reset_control_ops rzg2l_cpg_reset_ops = {
diff --git a/drivers/clk/renesas/rzg2l-cpg.h b/drivers/clk/renesas/rzg2l-cpg.h
index 43ce319a477f..6fbb431fb331 100644
--- a/drivers/clk/renesas/rzg2l-cpg.h
+++ b/drivers/clk/renesas/rzg2l-cpg.h
@@ -25,6 +25,7 @@
 #define CPG_PL6_SSEL		(0x414)
 #define CPG_PL6_ETH_SSEL	(0x418)
 #define CPG_PL5_SDIV		(0x420)
+#define CPG_RST_MON		(0x680)
 #define CPG_OTHERFUNC1_REG	(0xBE8)
 
 #define CPG_SIPLL5_STBY_RESETB		BIT(0)
@@ -206,17 +207,22 @@ struct rzg2l_mod_clk {
  *
  * @off: register offset
  * @bit: reset bit
+ * @monbit: monitor bit in CPG_RST_MON register, -1 if none
  */
 struct rzg2l_reset {
 	u16 off;
 	u8 bit;
+	s8 monbit;
 };
 
-#define DEF_RST(_id, _off, _bit)	\
+#define DEF_RST_MON(_id, _off, _bit, _monbit)	\
 	[_id] = { \
 		.off = (_off), \
-		.bit = (_bit) \
+		.bit = (_bit), \
+		.monbit = (_monbit) \
 	}
+#define DEF_RST(_id, _off, _bit)	\
+	DEF_RST_MON(_id, _off, _bit, -1)
 
 /**
  * struct rzg2l_cpg_info - SoC-specific CPG Description
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 10/12] clk: renesas: Add RZ/V2M support using the rzg2l driver
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (8 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 09/12] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:44   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC Phil Edworthy
  2022-05-03 11:55 ` [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK Phil Edworthy
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: Phil Edworthy, linux-renesas-soc, linux-clk, Biju Das

The Renesas RZ/V2M SoC is very similar to RZ/G2L, though it doesn't have
any CLK_MON registers.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - Replace DEF_MUX2 with DEF_MUX
 - Add URT_PCLK, it depends on CLK_SEL_E
---
 drivers/clk/renesas/Kconfig         |   5 +
 drivers/clk/renesas/Makefile        |   1 +
 drivers/clk/renesas/r9a09g011-cpg.c | 168 ++++++++++++++++++++++++++++
 drivers/clk/renesas/rzg2l-cpg.c     |   6 +
 drivers/clk/renesas/rzg2l-cpg.h     |   1 +
 5 files changed, 181 insertions(+)
 create mode 100644 drivers/clk/renesas/r9a09g011-cpg.c

diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig
index 7e9b9a5bb5b7..cacaf9b87d26 100644
--- a/drivers/clk/renesas/Kconfig
+++ b/drivers/clk/renesas/Kconfig
@@ -37,6 +37,7 @@ config CLK_RENESAS
 	select CLK_R9A07G043 if ARCH_R9A07G043
 	select CLK_R9A07G044 if ARCH_R9A07G044
 	select CLK_R9A07G054 if ARCH_R9A07G054
+	select CLK_R9A09G011 if ARCH_R9A09G011
 	select CLK_SH73A0 if ARCH_SH73A0
 
 if CLK_RENESAS
@@ -178,6 +179,10 @@ config CLK_R9A07G054
 	bool "RZ/V2L clock support" if COMPILE_TEST
 	select CLK_RZG2L
 
+config CLK_R9A09G011
+	bool "RZ/V2M clock support" if COMPILE_TEST
+	select CLK_RZG2L
+
 config CLK_SH73A0
 	bool "SH-Mobile AG5 clock support" if COMPILE_TEST
 	select CLK_RENESAS_CPG_MSTP
diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile
index b83062af090c..de907623fe3f 100644
--- a/drivers/clk/renesas/Makefile
+++ b/drivers/clk/renesas/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_CLK_R9A06G032)		+= r9a06g032-clocks.o
 obj-$(CONFIG_CLK_R9A07G043)		+= r9a07g043-cpg.o
 obj-$(CONFIG_CLK_R9A07G044)		+= r9a07g044-cpg.o
 obj-$(CONFIG_CLK_R9A07G054)		+= r9a07g044-cpg.o
+obj-$(CONFIG_CLK_R9A09G011)		+= r9a09g011-cpg.o
 obj-$(CONFIG_CLK_SH73A0)		+= clk-sh73a0.o
 
 # Family
diff --git a/drivers/clk/renesas/r9a09g011-cpg.c b/drivers/clk/renesas/r9a09g011-cpg.c
new file mode 100644
index 000000000000..7f16a617dc8c
--- /dev/null
+++ b/drivers/clk/renesas/r9a09g011-cpg.c
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * RZ/V2M Clock Pulse Generator / Module Standby and Software Reset
+ *
+ * Copyright (C) 2022 Renesas Electronics Corp.
+ *
+ * Based on r9a07g044-cpg.c
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#include <dt-bindings/clock/r9a09g011-cpg.h>
+
+#include "rzg2l-cpg.h"
+
+#define RZV2M_SAMPLL4_CLK1	0x104
+#define RZV2M_SAMPLL4_CLK2	0x108
+
+#define PLL4_CONF	(RZV2M_SAMPLL4_CLK1 << 22 | RZV2M_SAMPLL4_CLK2 << 12)
+
+#define DIV_A		DDIV_PACK(0x200, 0, 3)
+#define DIV_B		DDIV_PACK(0x204, 0, 2)
+#define DIV_E		DDIV_PACK(0x204, 8, 1)
+#define DIV_W		DDIV_PACK(0x328, 0, 3)
+
+#define SEL_B		SEL_PLL_PACK(0x214, 0, 1)
+#define SEL_E		SEL_PLL_PACK(0x214, 2, 1)
+#define SEL_W0		SEL_PLL_PACK(0x32C, 0, 1)
+
+enum clk_ids {
+	/* Core Clock Outputs exported to DT */
+	LAST_DT_CORE_CLK = 0,
+
+	/* External Input Clocks */
+	CLK_EXTAL,
+
+	/* Internal Core Clocks */
+	CLK_MAIN,
+	CLK_MAIN_24,
+	CLK_MAIN_2,
+	CLK_PLL1,
+	CLK_PLL2,
+	CLK_PLL2_800,
+	CLK_PLL2_400,
+	CLK_PLL2_200,
+	CLK_PLL2_100,
+	CLK_PLL4,
+	CLK_DIV_A,
+	CLK_DIV_B,
+	CLK_DIV_E,
+	CLK_DIV_W,
+	CLK_SEL_B,
+	CLK_SEL_B_D2,
+	CLK_SEL_E,
+	CLK_SEL_W0,
+
+	/* Module Clocks */
+	MOD_CLK_BASE
+};
+
+/* Divider tables */
+static const struct clk_div_table dtable_diva[] = {
+	{0, 1},
+	{1, 2},
+	{2, 3},
+	{3, 4},
+	{4, 6},
+	{5, 12},
+	{6, 24},
+	{0, 0},
+};
+
+static const struct clk_div_table dtable_divb[] = {
+	{0, 1},
+	{1, 2},
+	{2, 4},
+	{3, 8},
+	{0, 0},
+};
+
+static const struct clk_div_table dtable_divw[] = {
+	{0, 6},
+	{1, 7},
+	{2, 8},
+	{3, 9},
+	{4, 10},
+	{5, 11},
+	{6, 12},
+	{0, 0},
+};
+
+/* Mux clock tables */
+static const char * const sel_b[] = { ".main", ".divb" };
+static const char * const sel_e[] = { ".main", ".dive" };
+static const char * const sel_w[] = { ".main", ".divw" };
+
+static const struct cpg_core_clk r9a09g011_core_clks[] __initconst = {
+	/* External Clock Inputs */
+	DEF_INPUT("extal",	CLK_EXTAL),
+
+	/* Internal Core Clocks */
+	DEF_FIXED(".main",	CLK_MAIN,	CLK_EXTAL,	1,	1),
+	DEF_FIXED(".main_24",	CLK_MAIN_24,	CLK_MAIN,	1,	2),
+	DEF_FIXED(".main_2",	CLK_MAIN_2,	CLK_MAIN,	1,	24),
+	DEF_FIXED(".pll1",	CLK_PLL1,	CLK_MAIN_2,	498,	1),
+	DEF_FIXED(".pll2",	CLK_PLL2,	CLK_MAIN_2,	800,	1),
+	DEF_FIXED(".pll2_800",	CLK_PLL2_800,	CLK_PLL2,	1,	2),
+	DEF_FIXED(".pll2_400",	CLK_PLL2_400,	CLK_PLL2_800,	1,	2),
+	DEF_FIXED(".pll2_200",	CLK_PLL2_200,	CLK_PLL2_800,	1,	4),
+	DEF_FIXED(".pll2_100",	CLK_PLL2_100,	CLK_PLL2_800,	1,	8),
+	DEF_SAMPLL(".pll4",	CLK_PLL4,	CLK_MAIN_2,	PLL4_CONF),
+
+	DEF_DIV_RO(".diva",	CLK_DIV_A,	CLK_PLL1,	DIV_A,	dtable_diva),
+	DEF_DIV_RO(".divb",	CLK_DIV_B,	CLK_PLL2_400,	DIV_B,	dtable_divb),
+	DEF_DIV_RO(".dive",	CLK_DIV_E,	CLK_PLL2_100,	DIV_E,	0),
+	DEF_DIV_RO(".divw",	CLK_DIV_W,	CLK_PLL4,	DIV_W,	dtable_divw),
+
+	DEF_MUX_RO(".selb",	CLK_SEL_B,	SEL_B,		sel_b),
+	DEF_MUX_RO(".sele",	CLK_SEL_E,	SEL_E,		sel_e),
+	DEF_MUX(".selw0",	CLK_SEL_W0,	SEL_W0,		sel_w),
+
+	DEF_FIXED(".selb_d2",	CLK_SEL_B_D2,	CLK_SEL_B,	1,	2),
+};
+
+static const struct rzg2l_mod_clk r9a09g011_mod_clks[] __initconst = {
+	DEF_MOD("gic",		R9A09G011_GIC_CLK,	CLK_SEL_B_D2, 0x400, 5),
+	DEF_MOD("syc_cnt_clk",	R9A09G011_SYC_CNT_CLK,	CLK_MAIN_24,  0x41c, 12),
+	DEF_MOD("urt_pclk",	R9A09G011_URT_PCLK,	CLK_SEL_E,    0x438, 4),
+	DEF_MOD("urt0_clk",	R9A09G011_URT0_CLK,	CLK_SEL_W0,   0x438, 5),
+	DEF_MOD("ca53",		R9A09G011_CA53_CLK,	CLK_DIV_A,    0x448, 0),
+};
+
+static const struct rzg2l_reset r9a09g011_resets[] = {
+	DEF_RST_MON(R9A09G011_SYC_RST_N,	0x610, 9,  13),
+};
+
+static const unsigned int r9a09g011_crit_mod_clks[] __initconst = {
+	MOD_CLK_BASE + R9A09G011_CA53_CLK,
+	MOD_CLK_BASE + R9A09G011_GIC_CLK,
+	MOD_CLK_BASE + R9A09G011_SYC_CNT_CLK,
+	MOD_CLK_BASE + R9A09G011_URT_PCLK,
+};
+
+const struct rzg2l_cpg_info r9a09g011_cpg_info = {
+	/* Core Clocks */
+	.core_clks = r9a09g011_core_clks,
+	.num_core_clks = ARRAY_SIZE(r9a09g011_core_clks),
+	.last_dt_core_clk = LAST_DT_CORE_CLK,
+	.num_total_core_clks = MOD_CLK_BASE,
+
+	/* Critical Module Clocks */
+	.crit_mod_clks = r9a09g011_crit_mod_clks,
+	.num_crit_mod_clks = ARRAY_SIZE(r9a09g011_crit_mod_clks),
+
+	/* Module Clocks */
+	.mod_clks = r9a09g011_mod_clks,
+	.num_mod_clks = ARRAY_SIZE(r9a09g011_mod_clks),
+	.num_hw_mod_clks = R9A09G011_CA53_CLK + 1,
+
+	/* Resets */
+	.resets = r9a09g011_resets,
+	.num_resets = ARRAY_SIZE(r9a09g011_resets),
+
+	.has_clk_mon_regs = false,
+};
diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 89f63c09f089..d41db915616b 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -1406,6 +1406,12 @@ static const struct of_device_id rzg2l_cpg_match[] = {
 		.compatible = "renesas,r9a07g054-cpg",
 		.data = &r9a07g054_cpg_info,
 	},
+#endif
+#ifdef CONFIG_CLK_R9A09G011
+	{
+		.compatible = "renesas,r9a09g011-cpg",
+		.data = &r9a09g011_cpg_info,
+	},
 #endif
 	{ /* sentinel */ }
 };
diff --git a/drivers/clk/renesas/rzg2l-cpg.h b/drivers/clk/renesas/rzg2l-cpg.h
index 6fbb431fb331..cecbdf5e4f93 100644
--- a/drivers/clk/renesas/rzg2l-cpg.h
+++ b/drivers/clk/renesas/rzg2l-cpg.h
@@ -270,5 +270,6 @@ struct rzg2l_cpg_info {
 extern const struct rzg2l_cpg_info r9a07g043_cpg_info;
 extern const struct rzg2l_cpg_info r9a07g044_cpg_info;
 extern const struct rzg2l_cpg_info r9a07g054_cpg_info;
+extern const struct rzg2l_cpg_info r9a09g011_cpg_info;
 
 #endif
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (9 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 10/12] clk: renesas: Add RZ/V2M support using the rzg2l driver Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:47   ` Geert Uytterhoeven
  2022-05-03 11:55 ` [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK Phil Edworthy
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Rob Herring, Krzysztof Kozlowski
  Cc: Phil Edworthy, linux-renesas-soc, devicetree, Biju Das

Details of the SoC can be found here:
https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-cortex-a-mpus/rzv2m-dual-cortex-a53-lpddr4x32bit-ai-accelerator-isp-4k-video-codec-4k-camera-input-fhd-display-output

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - Replace CPG_CORE with CPG_MOD
 - Add UART pclk
 - Add gic clk
 - Fix cpg and uart0 register region
 - Remove sys as we are currently not using it and binding not accepted
---
 arch/arm64/boot/dts/renesas/r9a09g011.dtsi | 95 ++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 arch/arm64/boot/dts/renesas/r9a09g011.dtsi

diff --git a/arch/arm64/boot/dts/renesas/r9a09g011.dtsi b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi
new file mode 100644
index 000000000000..dafc0837775b
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Device Tree Source for the RZ/V2M SoC
+ *
+ * Copyright (C) 2022 Renesas Electronics Corp.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/r9a09g011-cpg.h>
+
+/ {
+	compatible = "renesas,r9a09g011";
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	/* clock can be either from exclk or crystal oscillator (XIN/XOUT) */
+	extal_clk: extal {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		/* This value must be overridden by the board */
+		clock-frequency = <0>;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+			};
+		};
+
+		cpu0: cpu@0 {
+			compatible = "arm,cortex-a53";
+			reg = <0>;
+			device_type = "cpu";
+			clocks = <&cpg CPG_MOD R9A09G011_CA53_CLK>;
+		};
+	};
+
+	soc: soc {
+		compatible = "simple-bus";
+		interrupt-parent = <&gic>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		gic: interrupt-controller@82000000 {
+			compatible = "arm,gic-400";
+			#interrupt-cells = <3>;
+			#address-cells = <0>;
+			interrupt-controller;
+			reg = <0x0 0x82010000 0 0x1000>,
+			      <0x0 0x82020000 0 0x20000>,
+			      <0x0 0x82040000 0 0x20000>,
+			      <0x0 0x82060000 0 0x20000>;
+			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
+			clocks = <&cpg CPG_MOD R9A09G011_GIC_CLK>;
+			clock-names = "clk";
+		};
+
+		cpg: clock-controller@a3500000 {
+			compatible = "renesas,r9a09g011-cpg";
+			reg = <0 0xa3500000 0 0x1000>;
+			clocks = <&extal_clk>;
+			clock-names = "extal";
+			#clock-cells = <2>;
+			#reset-cells = <1>;
+			#power-domain-cells = <0>;
+		};
+
+		uart0: serial@a4040000 {
+			compatible = "renesas,r9a09g011-uart", "renesas,em-uart";
+			reg = <0 0xa4040000 0 0x80>;
+			interrupts = <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD R9A09G011_URT0_CLK>,
+				 <&cpg CPG_MOD R9A09G011_URT_PCLK>;
+			clock-names = "sclk", "pclk";
+			status = "disabled";
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts-extended = <&gic GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				      <&gic GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				      <&gic GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				      <&gic GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>;
+		clocks = <&cpg CPG_MOD R9A09G011_SYC_CNT_CLK>;
+		resets = <&cpg R9A09G011_SYC_RST_N>;
+	};
+};
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK
  2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
                   ` (10 preceding siblings ...)
  2022-05-03 11:55 ` [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC Phil Edworthy
@ 2022-05-03 11:55 ` Phil Edworthy
  2022-05-04  8:51   ` Geert Uytterhoeven
  11 siblings, 1 reply; 34+ messages in thread
From: Phil Edworthy @ 2022-05-03 11:55 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Rob Herring, Krzysztof Kozlowski
  Cc: Phil Edworthy, linux-renesas-soc, devicetree, Biju Das

Add basic support for RZ/V2M EVK (based on R9A09G011):
- memory
- External input clock
- UART

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3:
 - Add comment about mem reserved for ISP Firmware
 - Remove sys node
---
 arch/arm64/boot/dts/renesas/Makefile          |  2 +
 .../boot/dts/renesas/r9a09g011-v2mevk2.dts    | 44 +++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts

diff --git a/arch/arm64/boot/dts/renesas/Makefile b/arch/arm64/boot/dts/renesas/Makefile
index 15309309a2e1..e66d76d42e52 100644
--- a/arch/arm64/boot/dts/renesas/Makefile
+++ b/arch/arm64/boot/dts/renesas/Makefile
@@ -83,3 +83,5 @@ dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044c2-smarc.dtb
 dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044l2-smarc.dtb
 
 dtb-$(CONFIG_ARCH_R9A07G054) += r9a07g054l2-smarc.dtb
+
+dtb-$(CONFIG_ARCH_R9A09G011) += r9a09g011-v2mevk2.dtb
diff --git a/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
new file mode 100644
index 000000000000..41cba82c2252
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Device Tree Source for the RZ/V2M (r9a09g011) Evaluation Kit Board
+ *
+ * Copyright (C) 2022 Renesas Electronics Corp.
+ */
+
+/dts-v1/;
+#include "r9a09g011.dtsi"
+
+/ {
+	model = "RZ/V2M Evaluation Kit 2.0";
+	compatible = "renesas,rzv2mevk2", "renesas,r9a09g011";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@58000000 {
+		device_type = "memory";
+		/*
+		 * first 2GiB is reserved for ISP Firmware,
+		 * next 128MiB is reserved for secure area.
+		 */
+		reg = <0x0 0x58000000 0x0 0x28000000>;
+	};
+
+	memory@180000000 {
+		device_type = "memory";
+		reg = <0x1 0x80000000 0x0 0x80000000>;
+	};
+};
+
+&extal_clk {
+	clock-frequency = <48000000>;
+};
+
+&uart0 {
+	status = "okay";
+};
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer:  Add optional clock and reset
  2022-05-03 11:55 ` [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset Phil Edworthy
@ 2022-05-03 13:11   ` Mark Rutland
  2022-05-04 22:33     ` Rob Herring
  2022-05-03 13:12   ` Marc Zyngier
  1 sibling, 1 reply; 34+ messages in thread
From: Mark Rutland @ 2022-05-03 13:11 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Rob Herring, Krzysztof Kozlowski, Geert Uytterhoeven, Biju Das,
	Daniel Lezcano, Thomas Gleixner, Marc Zyngier, devicetree,
	linux-renesas-soc

Hi Phil,

This is the only patch from this series that I've received, and judging
by the CC list this hasn't gone to either LKML or LAKML, so I'm missing
the surrounding context for this.

Looking on lore, this is part of:

  https://lore.kernel.org/linux-devicetree/20220503115557.53370-1-phil.edworthy@renesas.com/T/#t

... which is adding support for an arm64 SoC.

On Tue, May 03, 2022 at 12:55:49PM +0100, Phil Edworthy wrote:
> Some SoCs use a gated clock for the timer and the means to reset the timer.
> Hence add these as optional.

The clock feeding the architected timer is supposed to be in an
always-on clock domain, and is supopsed to be enabled before running any
Normal World software.

The arm64 kernel *requires* that this is enabled prior to entry. If the
kernel ever has to touch either the clock or reset, then there are
phases where the counter will not function correctly, which is simply
broken.

Given that, I do not think this should be in the DT, and instead the
clock should be marked as critical in the provider node (and the reset
should never be touched).

Thanks,
Mark.

> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> ---
>  .../devicetree/bindings/timer/arm,arch_timer.yaml          | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> index df8ce87fd54b..20cd90fc7015 100644
> --- a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> +++ b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> @@ -64,6 +64,13 @@ properties:
>        CNTFRQ on all CPUs to a uniform correct value. Use of this property is
>        strongly discouraged; fix your firmware unless absolutely impossible.
>  
> +  clocks:
> +    description: Optional clock for the timer.
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
>    always-on:
>      type: boolean
>      description: If present, the timer is powered through an always-on power
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer:  Add optional clock and reset
  2022-05-03 11:55 ` [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset Phil Edworthy
  2022-05-03 13:11   ` Mark Rutland
@ 2022-05-03 13:12   ` Marc Zyngier
  2022-05-03 14:22     ` Geert Uytterhoeven
  1 sibling, 1 reply; 34+ messages in thread
From: Marc Zyngier @ 2022-05-03 13:12 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Rob Herring, Krzysztof Kozlowski, Geert Uytterhoeven, Biju Das,
	Daniel Lezcano, Thomas Gleixner, Mark Rutland, devicetree,
	linux-renesas-soc

On 2022-05-03 12:55, Phil Edworthy wrote:
> Some SoCs use a gated clock for the timer and the means to reset the 
> timer.
> Hence add these as optional.

The architecture is crystal clear on the subject: the counter
is in an always-on domain. Why should this be visible to SW?
Also, reseting the counter breaks the guaranteed monotonicity
we rely on.

Worse case, this belongs to the boot firmware, not the kernel,
and I don't think this should be described in the DT.

         M.

> 
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> ---
>  .../devicetree/bindings/timer/arm,arch_timer.yaml          | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git
> a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> index df8ce87fd54b..20cd90fc7015 100644
> --- a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> +++ b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> @@ -64,6 +64,13 @@ properties:
>        CNTFRQ on all CPUs to a uniform correct value. Use of this 
> property is
>        strongly discouraged; fix your firmware unless absolutely 
> impossible.
> 
> +  clocks:
> +    description: Optional clock for the timer.
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
>    always-on:
>      type: boolean
>      description: If present, the timer is powered through an always-on 
> power

-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset
  2022-05-03 13:12   ` Marc Zyngier
@ 2022-05-03 14:22     ` Geert Uytterhoeven
  2022-05-03 14:55       ` Mark Rutland
  2022-05-03 15:56       ` Marc Zyngier
  0 siblings, 2 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-03 14:22 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Phil Edworthy, Rob Herring, Krzysztof Kozlowski, Biju Das,
	Daniel Lezcano, Thomas Gleixner, Mark Rutland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux-Renesas

Hi Marc,

On Tue, May 3, 2022 at 3:12 PM Marc Zyngier <maz@kernel.org> wrote:
> On 2022-05-03 12:55, Phil Edworthy wrote:
> > Some SoCs use a gated clock for the timer and the means to reset the
> > timer.
> > Hence add these as optional.
>
> The architecture is crystal clear on the subject: the counter
> is in an always-on domain. Why should this be visible to SW?
> Also, reseting the counter breaks the guaranteed monotonicity
> we rely on.

The DT bindings do state:

  always-on:
    type: boolean
    description: If present, the timer is powered through an always-on power
      domain, therefore it never loses context.

and (surprisingly?) the absence of this property seems to be the
norm...

And:

  arm,no-tick-in-suspend:
    type: boolean
    description: The main counter does not tick when the system is in
      low-power system suspend on some SoCs. This behavior does not match the
      Architecture Reference Manual's specification that the system
counter "must
      be implemented in an always-on power domain."

So there's already precedent for clocks that can be disabled.

> Worse case, this belongs to the boot firmware, not the kernel,
> and I don't think this should be described in the DT.

"DT describes hardware, not software policy"?

> > --- a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> > +++ b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
> > @@ -64,6 +64,13 @@ properties:
> >        CNTFRQ on all CPUs to a uniform correct value. Use of this
> > property is
> >        strongly discouraged; fix your firmware unless absolutely
> > impossible.
> >
> > +  clocks:
> > +    description: Optional clock for the timer.
> > +    maxItems: 1
> > +
> > +  resets:
> > +    maxItems: 1
> > +
> >    always-on:
> >      type: boolean
> >      description: If present, the timer is powered through an always-on
> > power

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset
  2022-05-03 14:22     ` Geert Uytterhoeven
@ 2022-05-03 14:55       ` Mark Rutland
  2022-05-03 15:56       ` Marc Zyngier
  1 sibling, 0 replies; 34+ messages in thread
From: Mark Rutland @ 2022-05-03 14:55 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Marc Zyngier, Phil Edworthy, Rob Herring, Krzysztof Kozlowski,
	Biju Das, Daniel Lezcano, Thomas Gleixner,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux-Renesas

Hi Geert,

On Tue, May 03, 2022 at 04:22:35PM +0200, Geert Uytterhoeven wrote:
> On Tue, May 3, 2022 at 3:12 PM Marc Zyngier <maz@kernel.org> wrote:
> > On 2022-05-03 12:55, Phil Edworthy wrote:
> > > Some SoCs use a gated clock for the timer and the means to reset the
> > > timer.
> > > Hence add these as optional.
> >
> > The architecture is crystal clear on the subject: the counter
> > is in an always-on domain. Why should this be visible to SW?
> > Also, reseting the counter breaks the guaranteed monotonicity
> > we rely on.
> 
> The DT bindings do state:
> 
>   always-on:
>     type: boolean
>     description: If present, the timer is powered through an always-on power
>       domain, therefore it never loses context.
> 
> and (surprisingly?) the absence of this property seems to be the
> norm...

That's the *timer* (i.e. the comparator logic within each CPU which
fires an interrupt), not the *counter* (i.e. the incrementing value fed
by a clock). What this is trying to say is whether that can be relied
upon to cause a wakeup while the CPU is in a low-power state, or whether
it cannot (and hence SW needs to use another timer for the wakeup).

It's legitimate for each timer to not be in an always-on power domain
because it is part of each CPU, whereas the counter is global to the
system.

We can clear up the wording here since it's apparently confusing.

> And:
> 
>   arm,no-tick-in-suspend:
>     type: boolean
>     description: The main counter does not tick when the system is in
>       low-power system suspend on some SoCs. This behavior does not match the
>       Architecture Reference Manual's specification that the system
> counter "must
>       be implemented in an always-on power domain."

This is admittedly a workaround for an integration bug, but it's quite
different and only affects the time jump that can be observed when going
into suspend an exiting from it. Whenever software is running the
counter is incrementing.

> So there's already precedent for clocks that can be disabled.

There's precedent for the clock being disabled in a specific deep sleep
state, not when SW is actively running.

> > Worse case, this belongs to the boot firmware, not the kernel,
> > and I don't think this should be described in the DT.
> 
> "DT describes hardware, not software policy"?

It's still describing the HW. There's plenty of other always-on stuff
that we don't describe because for all intents and purposes it is always
on.

Note that this being always-on isn't just a Linux thing; that affects
plenty of other SW which may run and it's an *architectural property*
that's apparently being violated.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset
  2022-05-03 14:22     ` Geert Uytterhoeven
  2022-05-03 14:55       ` Mark Rutland
@ 2022-05-03 15:56       ` Marc Zyngier
  2022-05-04  9:05         ` Phil Edworthy
  1 sibling, 1 reply; 34+ messages in thread
From: Marc Zyngier @ 2022-05-03 15:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Phil Edworthy, Rob Herring, Krzysztof Kozlowski, Biju Das,
	Daniel Lezcano, Thomas Gleixner, Mark Rutland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux-Renesas

Geert,

On Tue, 03 May 2022 15:22:35 +0100,
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> Hi Marc,
> 
> On Tue, May 3, 2022 at 3:12 PM Marc Zyngier <maz@kernel.org> wrote:
> > On 2022-05-03 12:55, Phil Edworthy wrote:
> > > Some SoCs use a gated clock for the timer and the means to reset the
> > > timer.
> > > Hence add these as optional.
> >
> > The architecture is crystal clear on the subject: the counter
> > is in an always-on domain. Why should this be visible to SW?
> > Also, reseting the counter breaks the guaranteed monotonicity
> > we rely on.
> 
> The DT bindings do state:
> 
>   always-on:
>     type: boolean
>     description: If present, the timer is powered through an always-on power
>       domain, therefore it never loses context.
> 
> and (surprisingly?) the absence of this property seems to be the
> norm...

*timer* is the key word. And counter != timer. What your HW has is a
gate on the *counter* which is illegal if observable from NS SW.

> 
> And:
> 
>   arm,no-tick-in-suspend:
>     type: boolean
>     description: The main counter does not tick when the system is in
>       low-power system suspend on some SoCs. This behavior does not match the
>       Architecture Reference Manual's specification that the system
> counter "must
>       be implemented in an always-on power domain."
> 
> So there's already precedent for clocks that can be disabled.

No, this is only the case in *suspend*, as the name of the property
vaguely hints at. And that's a property for a bug. In your case, the
clock can be controlled arbitrarily, which is even worse.

> 
> > Worse case, this belongs to the boot firmware, not the kernel,
> > and I don't think this should be described in the DT.
> 
> "DT describes hardware, not software policy"?

I'm happy to spread "always-on" properties all over the shop, but
that's not helping. The HW spec says it in bold letters: the counter
is always running, and doesn't jump backward. I can't imagine how
secure SW will behave when you reset its counter... :-/

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers
  2022-05-03 11:55 ` [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers Phil Edworthy
@ 2022-05-04  8:06   ` Geert Uytterhoeven
  2022-05-04  8:13     ` Phil Edworthy
  0 siblings, 1 reply; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:06 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Biju Das, Linux-Renesas,
	open list:SERIAL DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Phil,

On Tue, May 3, 2022 at 2:01 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> The RZ/V2M SoC has an additional clock to access the registers. The HW
> manual says this clock should not be touched as it is used by the
> "ISP Firmware".
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
> @@ -9,9 +9,6 @@ title: Renesas EMMA Mobile UART Interface
>  maintainers:
>    - Magnus Damm <magnus.damm@gmail.com>
>
> -allOf:
> -  - $ref: serial.yaml#
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -29,11 +26,32 @@ properties:
>    interrupts:
>      maxItems: 1
>
> -  clocks:
> -    maxItems: 1
> +allOf:
> +  - $ref: serial.yaml#
>
> -  clock-names:
> -    const: sclk
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: renesas,r9a09g011-uart
> +    then:
> +      properties:
> +        clocks:
> +          items:
> +            - description: UART functional clock
> +            - description: Optional internal clock to access the registers

It's not optional on r9a09g011, right?

> +        clock-names:
> +          items:
> +            - const: sclk
> +            - const: pclk
> +    else:
> +      properties:
> +        clocks:
> +          items:
> +            - description: UART functional clock
> +        clock-names:
> +          items:
> +            - const: sclk
>
>  required:
>    - compatible

The rest LGTM, so with the above fixed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers
  2022-05-04  8:06   ` Geert Uytterhoeven
@ 2022-05-04  8:13     ` Phil Edworthy
  0 siblings, 0 replies; 34+ messages in thread
From: Phil Edworthy @ 2022-05-04  8:13 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Biju Das, Linux-Renesas,
	open list:SERIAL DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Geert,

> On Tue, May 3, 2022 at 2:01 PM Phil Edworthy wrote:
> > The RZ/V2M SoC has an additional clock to access the registers. The HW
> > manual says this clock should not be touched as it is used by the
> > "ISP Firmware".
> >
> > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> 
> Thanks for your patch!
> 
> > --- a/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
> > +++ b/Documentation/devicetree/bindings/serial/renesas,em-uart.yaml
> > @@ -9,9 +9,6 @@ title: Renesas EMMA Mobile UART Interface
> >  maintainers:
> >    - Magnus Damm <magnus.damm@gmail.com>
> >
> > -allOf:
> > -  - $ref: serial.yaml#
> > -
> >  properties:
> >    compatible:
> >      oneOf:
> > @@ -29,11 +26,32 @@ properties:
> >    interrupts:
> >      maxItems: 1
> >
> > -  clocks:
> > -    maxItems: 1
> > +allOf:
> > +  - $ref: serial.yaml#
> >
> > -  clock-names:
> > -    const: sclk
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: renesas,r9a09g011-uart
> > +    then:
> > +      properties:
> > +        clocks:
> > +          items:
> > +            - description: UART functional clock
> > +            - description: Optional internal clock to access the
> registers
> 
> It's not optional on r9a09g011, right?
Right. I'll fix in the next set of patches.

 
> > +        clock-names:
> > +          items:
> > +            - const: sclk
> > +            - const: pclk
> > +    else:
> > +      properties:
> > +        clocks:
> > +          items:
> > +            - description: UART functional clock
> > +        clock-names:
> > +          items:
> > +            - const: sclk
> >
> >  required:
> >    - compatible
> 
> The rest LGTM, so with the above fixed:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks!
Phil

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions
  2022-05-03 11:55 ` [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions Phil Edworthy
@ 2022-05-04  8:43   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:43 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Rob Herring, Krzysztof Kozlowski, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Biju Das

On Tue, May 3, 2022 at 2:01 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> Define RZ/V2M (R9A09G011) Clock Pulse Generator module clock outputs
> (CPG_CLK_ON* registers), and reset definitions (CPG_RST_* registers)
> in Section 48.5 ("Register Description") of the RZ/V2M Hardware User's
> Manual (Rev. 1.10, Sep. 2021).
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - Add missing clocks and resets.
>  - Change names of ETH clocks to ETH0, even though there is just one ETH,
>    to match the HW manual.
>  - Change names of IIC PCLKs to better match the HW manual

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in a branch shared by driver and DT source files.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC
  2022-05-03 11:55 ` [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC Phil Edworthy
@ 2022-05-04  8:43   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:43 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Linux-Renesas, linux-clk,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Biju Das, Krzysztof Kozlowski

On Tue, May 3, 2022 at 2:01 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> Document the device tree binding for the Renesas RZ/V2M (r9a09g011) SoC.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
>  - Simplify reference to header files.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 05/12] clk: renesas: rzg2l: Move the DEF_MUX array size calc into the macro
  2022-05-03 11:55 ` [PATCH v3 05/12] clk: renesas: rzg2l: Move the DEF_MUX array size calc into the macro Phil Edworthy
@ 2022-05-04  8:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:44 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Biju Das, Linux-Renesas, linux-clk

On Tue, May 3, 2022 at 2:01 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> We only ever use ARRAY_SIZE() to populate the number of parents, so
> move this into the macro to always detect it automatically. This
> also makes the tables of clocks a little simpler.
> Similarly for the DEF_SD_MUX macro.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> ---
> v3:
>  - New patch inserted

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 06/12] clk: renesas: rzg2l: Add read only versions of the clk macros
  2022-05-03 11:55 ` [PATCH v3 06/12] clk: renesas: rzg2l: Add read only versions of the clk macros Phil Edworthy
@ 2022-05-04  8:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:44 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Biju Das, Linux-Renesas, linux-clk

On Tue, May 3, 2022 at 2:01 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> This just makes the clk tables easier to read.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> ---
> v3:
>  - New patch inserted

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 07/12] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers
  2022-05-03 11:55 ` [PATCH v3 07/12] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers Phil Edworthy
@ 2022-05-04  8:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:44 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk, Biju Das

On Tue, May 3, 2022 at 2:02 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> All of the muxes and dividers that can be modified require the HIWORD
> flags, so make the macros set them. It won't affect read only muxes and
> dividers.
> This will make the clock tables a little easier to read, particularly for
> new SoCs coming.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - Remove HIWORD masks in new r9a07g043-cpg.c
>  - Remove flags from DEF_MUX/DEF_DIV args

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 08/12] clk: renesas: rzg2l: Make use of CLK_MON registers optional
  2022-05-03 11:55 ` [PATCH v3 08/12] clk: renesas: rzg2l: Make use of CLK_MON registers optional Phil Edworthy
@ 2022-05-04  8:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:44 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk, Biju Das

On Tue, May 3, 2022 at 2:02 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> The RZ/V2M SoC doesn't use CLK_MON registers, so make them optional.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - Add has_clk_mon_regs to r9a07g043-cpg.c
>  - Improve commit msg.
>  - Return early if no clk mon regs to simply the code

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 09/12] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg
  2022-05-03 11:55 ` [PATCH v3 09/12] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg Phil Edworthy
@ 2022-05-04  8:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:44 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk, Biju Das

Hi Phil,

On Tue, May 3, 2022 at 2:02 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> The RZ/V2M doesn't have a matching set of reset monitor regs for each reset
> reg like the RZ/G2L. Instead, it has a single CPG_RST_MON reg which has a
> single bit per module.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - If no clk mon regs and no clk monitor bit specified, return an error

Thanks for the update!

> --- a/drivers/clk/renesas/rzg2l-cpg.c
> +++ b/drivers/clk/renesas/rzg2l-cpg.c
> @@ -1177,8 +1177,16 @@ static int rzg2l_cpg_status(struct reset_controller_dev *rcdev,
>         const struct rzg2l_cpg_info *info = priv->info;
>         unsigned int reg = info->resets[id].off;
>         u32 bitmask = BIT(info->resets[id].bit);
> +       s8 monbit = info->resets[id].monbit;
>
> -       return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
> +       if (info->has_clk_mon_regs) {
> +               return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
> +       } else if (monbit >= 0) {
> +               u32 monbitmask = BIT(monbit);
> +
> +               return !!(readl(priv->base + CPG_RST_MON) & monbitmask);
> +       }
> +       return -ENOTSUPP;

I had my doubts about -ENOTSUPP, but
drivers/reset/core.c:reset_control_status() confirms it's the right
error code to return.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 10/12] clk: renesas: Add RZ/V2M support using the rzg2l driver
  2022-05-03 11:55 ` [PATCH v3 10/12] clk: renesas: Add RZ/V2M support using the rzg2l driver Phil Edworthy
@ 2022-05-04  8:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:44 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk, Biju Das

On Tue, May 3, 2022 at 2:02 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> The Renesas RZ/V2M SoC is very similar to RZ/G2L, though it doesn't have
> any CLK_MON registers.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - Replace DEF_MUX2 with DEF_MUX
>  - Add URT_PCLK, it depends on CLK_SEL_E

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.19.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC
  2022-05-03 11:55 ` [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC Phil Edworthy
@ 2022-05-04  8:47   ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:47 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Biju Das

Hi Phil,

On Tue, May 3, 2022 at 2:02 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> Details of the SoC can be found here:
> https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-cortex-a-mpus/rzv2m-dual-cortex-a53-lpddr4x32bit-ai-accelerator-isp-4k-video-codec-4k-camera-input-fhd-display-output
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - Replace CPG_CORE with CPG_MOD
>  - Add UART pclk
>  - Add gic clk
>  - Fix cpg and uart0 register region
>  - Remove sys as we are currently not using it and binding not accepted

Thanks for the update!

> --- /dev/null
> +++ b/arch/arm64/boot/dts/renesas/r9a09g011.dtsi

> +       timer {
> +               compatible = "arm,armv8-timer";
> +               interrupts-extended = <&gic GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
> +                                     <&gic GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
> +                                     <&gic GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
> +                                     <&gic GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>;
> +               clocks = <&cpg CPG_MOD R9A09G011_SYC_CNT_CLK>;
> +               resets = <&cpg R9A09G011_SYC_RST_N>;

As per the discussion about [PATCH v3 04/12], these two properties
should be dropped.

> +       };
> +};

The rest LGTM, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK
  2022-05-03 11:55 ` [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK Phil Edworthy
@ 2022-05-04  8:51   ` Geert Uytterhoeven
  2022-05-04  9:00     ` Phil Edworthy
  0 siblings, 1 reply; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-04  8:51 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Biju Das

Hi Phil,

On Tue, May 3, 2022 at 2:02 PM Phil Edworthy <phil.edworthy@renesas.com> wrote:
> Add basic support for RZ/V2M EVK (based on R9A09G011):
> - memory
> - External input clock
> - UART
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
>  - Add comment about mem reserved for ISP Firmware
>  - Remove sys node

Thanks for the update!

> --- /dev/null
> +++ b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
> @@ -0,0 +1,44 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +/*
> + * Device Tree Source for the RZ/V2M (r9a09g011) Evaluation Kit Board
> + *
> + * Copyright (C) 2022 Renesas Electronics Corp.
> + */
> +
> +/dts-v1/;
> +#include "r9a09g011.dtsi"
> +
> +/ {

> +       memory@58000000 {
> +               device_type = "memory";
> +               /*
> +                * first 2GiB is reserved for ISP Firmware,

"2GiB" (0x80000000) doesn't look right to me.
Perhaps 1.25 GIB?

If you confirm, I can fix up (and the previous patch), and queue in
renesas-devel for v5.19.

> +                * next 128MiB is reserved for secure area.
> +                */
> +               reg = <0x0 0x58000000 0x0 0x28000000>;
> +       };

The rest LGTM, so with the above fixed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK
  2022-05-04  8:51   ` Geert Uytterhoeven
@ 2022-05-04  9:00     ` Phil Edworthy
  0 siblings, 0 replies; 34+ messages in thread
From: Phil Edworthy @ 2022-05-04  9:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Biju Das

Hi Geert,

On 04 May 2022 09:52 Geert Uytterhoeven wrote:
> On Tue, May 3, 2022 at 2:02 PM Phil Edworthy wrote:
> > Add basic support for RZ/V2M EVK (based on R9A09G011):
> > - memory
> > - External input clock
> > - UART
> >
> > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v3:
> >  - Add comment about mem reserved for ISP Firmware
> >  - Remove sys node
> 
> Thanks for the update!
> 
> > --- /dev/null
> > +++ b/arch/arm64/boot/dts/renesas/r9a09g011-v2mevk2.dts
> > @@ -0,0 +1,44 @@
> > +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +/*
> > + * Device Tree Source for the RZ/V2M (r9a09g011) Evaluation Kit Board
> > + *
> > + * Copyright (C) 2022 Renesas Electronics Corp.
> > + */
> > +
> > +/dts-v1/;
> > +#include "r9a09g011.dtsi"
> > +
> > +/ {
> 
> > +       memory@58000000 {
> > +               device_type = "memory";
> > +               /*
> > +                * first 2GiB is reserved for ISP Firmware,
> 
> "2GiB" (0x80000000) doesn't look right to me.
> Perhaps 1.25 GIB?
How on earth did I do that?
Yes, 1.25 GiB is correct.

> If you confirm, I can fix up (and the previous patch), and queue in
> renesas-devel for v5.19.
> 
> > +                * next 128MiB is reserved for secure area.
> > +                */
> > +               reg = <0x0 0x58000000 0x0 0x28000000>;
> > +       };
> 
> The rest LGTM, so with the above fixed:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks!
Phil

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset
  2022-05-03 15:56       ` Marc Zyngier
@ 2022-05-04  9:05         ` Phil Edworthy
  0 siblings, 0 replies; 34+ messages in thread
From: Phil Edworthy @ 2022-05-04  9:05 UTC (permalink / raw)
  To: Marc Zyngier, Mark Rutland
  Cc: Rob Herring, Krzysztof Kozlowski, Biju Das, Geert Uytterhoeven,
	Daniel Lezcano, Thomas Gleixner,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux-Renesas

Hi Marc and Mark,

On 03 May 2022 16:57 Marc Zyngier wrote:
> On Tue, 03 May 2022 15:22:35 +0100, Geert Uytterhoeven wrote:
> > On Tue, May 3, 2022 at 3:12 PM Marc Zyngier wrote:
> > > On 2022-05-03 12:55, Phil Edworthy wrote:
> > > > Some SoCs use a gated clock for the timer and the means to reset the
> > > > timer.
> > > > Hence add these as optional.
> > >
> > > The architecture is crystal clear on the subject: the counter
> > > is in an always-on domain. Why should this be visible to SW?
> > > Also, reseting the counter breaks the guaranteed monotonicity
> > > we rely on.
> >
> > The DT bindings do state:
> >
> >   always-on:
> >     type: boolean
> >     description: If present, the timer is powered through an always-on
> power
> >       domain, therefore it never loses context.
> >
> > and (surprisingly?) the absence of this property seems to be the
> > norm...
> 
> *timer* is the key word. And counter != timer. What your HW has is a
> gate on the *counter* which is illegal if observable from NS SW.
Ok, thanks for your feedback. We'll pretend this clock gate and reset
doesn't exist and drop this patch.
 
> >
> > And:
> >
> >   arm,no-tick-in-suspend:
> >     type: boolean
> >     description: The main counter does not tick when the system is in
> >       low-power system suspend on some SoCs. This behavior does not
> match the
> >       Architecture Reference Manual's specification that the system
> > counter "must
> >       be implemented in an always-on power domain."
> >
> > So there's already precedent for clocks that can be disabled.
> 
> No, this is only the case in *suspend*, as the name of the property
> vaguely hints at. And that's a property for a bug. In your case, the
> clock can be controlled arbitrarily, which is even worse.
> 
> >
> > > Worse case, this belongs to the boot firmware, not the kernel,
> > > and I don't think this should be described in the DT.
> >
> > "DT describes hardware, not software policy"?
> 
> I'm happy to spread "always-on" properties all over the shop, but
> that's not helping. The HW spec says it in bold letters: the counter
> is always running, and doesn't jump backward. I can't imagine how
> secure SW will behave when you reset its counter... :-/

Thanks
Phil

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer:  Add optional clock and reset
  2022-05-03 13:11   ` Mark Rutland
@ 2022-05-04 22:33     ` Rob Herring
  2022-05-05  6:42       ` Geert Uytterhoeven
  0 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2022-05-04 22:33 UTC (permalink / raw)
  To: Mark Rutland, Phil Edworthy
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, Biju Das,
	Daniel Lezcano, Thomas Gleixner, Marc Zyngier, devicetree,
	linux-renesas-soc

On Tue, May 03, 2022 at 02:11:59PM +0100, Mark Rutland wrote:
> Hi Phil,
> 
> This is the only patch from this series that I've received, and judging
> by the CC list this hasn't gone to either LKML or LAKML, so I'm missing
> the surrounding context for this.
> 
> Looking on lore, this is part of:
> 
>   https://lore.kernel.org/linux-devicetree/20220503115557.53370-1-phil.edworthy@renesas.com/T/#t
> 
> ... which is adding support for an arm64 SoC.
> 
> On Tue, May 03, 2022 at 12:55:49PM +0100, Phil Edworthy wrote:
> > Some SoCs use a gated clock for the timer and the means to reset the timer.
> > Hence add these as optional.
> 
> The clock feeding the architected timer is supposed to be in an
> always-on clock domain, and is supopsed to be enabled before running any
> Normal World software.
> 
> The arm64 kernel *requires* that this is enabled prior to entry. If the
> kernel ever has to touch either the clock or reset, then there are
> phases where the counter will not function correctly, which is simply
> broken.
> 
> Given that, I do not think this should be in the DT, and instead the
> clock should be marked as critical in the provider node (and the reset
> should never be touched).

That is not yet an accepted DT property, but is currently on the list 
for review[1]. If that's something people need, chime in. More than 1 
person needing something is always better.

Rob

[1] https://lore.kernel.org/all/20220428110107.149524-1-marex@denx.de/

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset
  2022-05-04 22:33     ` Rob Herring
@ 2022-05-05  6:42       ` Geert Uytterhoeven
  0 siblings, 0 replies; 34+ messages in thread
From: Geert Uytterhoeven @ 2022-05-05  6:42 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Rutland, Phil Edworthy, Krzysztof Kozlowski, Biju Das,
	Daniel Lezcano, Thomas Gleixner, Marc Zyngier,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux-Renesas

Hi Rob,

On Thu, May 5, 2022 at 12:33 AM Rob Herring <robh@kernel.org> wrote:
> On Tue, May 03, 2022 at 02:11:59PM +0100, Mark Rutland wrote:
> > This is the only patch from this series that I've received, and judging
> > by the CC list this hasn't gone to either LKML or LAKML, so I'm missing
> > the surrounding context for this.
> >
> > Looking on lore, this is part of:
> >
> >   https://lore.kernel.org/linux-devicetree/20220503115557.53370-1-phil.edworthy@renesas.com/T/#t
> >
> > ... which is adding support for an arm64 SoC.
> >
> > On Tue, May 03, 2022 at 12:55:49PM +0100, Phil Edworthy wrote:
> > > Some SoCs use a gated clock for the timer and the means to reset the timer.
> > > Hence add these as optional.
> >
> > The clock feeding the architected timer is supposed to be in an
> > always-on clock domain, and is supopsed to be enabled before running any
> > Normal World software.
> >
> > The arm64 kernel *requires* that this is enabled prior to entry. If the
> > kernel ever has to touch either the clock or reset, then there are
> > phases where the counter will not function correctly, which is simply
> > broken.
> >
> > Given that, I do not think this should be in the DT, and instead the
> > clock should be marked as critical in the provider node (and the reset
> > should never be touched).
>
> That is not yet an accepted DT property, but is currently on the list
> for review[1]. If that's something people need, chime in. More than 1
> person needing something is always better.

I am aware of[1]. AFAIU, that is meant for clocks that need to stay
enabled for external reasons (external hardware driven by on-SoC
clock).
For internal reasons (e.g. arch-timer), CLK_IS_CRITICAL is fine.

> [1] https://lore.kernel.org/all/20220428110107.149524-1-marex@denx.de/

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2022-05-05  6:42 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 11:55 [PATCH v3 00/12] Add new Renesas RZ/V2M SoC and Renesas RZ/V2M EVK support Phil Edworthy
2022-05-03 11:55 ` [PATCH v3 01/12] dt-bindings: serial: renesas,em-uart: Add RZ/V2M clock to access the registers Phil Edworthy
2022-05-04  8:06   ` Geert Uytterhoeven
2022-05-04  8:13     ` Phil Edworthy
2022-05-03 11:55 ` [PATCH v3 02/12] dt-bindings: clock: Add r9a09g011 CPG Clock Definitions Phil Edworthy
2022-05-04  8:43   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 03/12] dt-bindings: clock: renesas,rzg2l: Document RZ/V2M SoC Phil Edworthy
2022-05-04  8:43   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 04/12] dt-bindings: timer: arm,arch_timer: Add optional clock and reset Phil Edworthy
2022-05-03 13:11   ` Mark Rutland
2022-05-04 22:33     ` Rob Herring
2022-05-05  6:42       ` Geert Uytterhoeven
2022-05-03 13:12   ` Marc Zyngier
2022-05-03 14:22     ` Geert Uytterhoeven
2022-05-03 14:55       ` Mark Rutland
2022-05-03 15:56       ` Marc Zyngier
2022-05-04  9:05         ` Phil Edworthy
2022-05-03 11:55 ` [PATCH v3 05/12] clk: renesas: rzg2l: Move the DEF_MUX array size calc into the macro Phil Edworthy
2022-05-04  8:44   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 06/12] clk: renesas: rzg2l: Add read only versions of the clk macros Phil Edworthy
2022-05-04  8:44   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 07/12] clk: renesas: rzg2l: Set HIWORD mask for all mux and dividers Phil Edworthy
2022-05-04  8:44   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 08/12] clk: renesas: rzg2l: Make use of CLK_MON registers optional Phil Edworthy
2022-05-04  8:44   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 09/12] clk: renesas: rzg2l: Add support for RZ/V2M reset monitor reg Phil Edworthy
2022-05-04  8:44   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 10/12] clk: renesas: Add RZ/V2M support using the rzg2l driver Phil Edworthy
2022-05-04  8:44   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 11/12] arm64: dts: renesas: Add initial DTSI for RZ/V2M SoC Phil Edworthy
2022-05-04  8:47   ` Geert Uytterhoeven
2022-05-03 11:55 ` [PATCH v3 12/12] arm64: dts: renesas: Add initial device tree for RZ/V2M EVK Phil Edworthy
2022-05-04  8:51   ` Geert Uytterhoeven
2022-05-04  9:00     ` Phil Edworthy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.