Line data Source code
1 0 : /*
2 : * Copyright (c) 2025 Renesas Electronics Corporation
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZV_CLOCK_H_
8 : #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZV_CLOCK_H_
9 :
10 : /* RZ/V clock configuration values */
11 0 : #define RZ_IP_MASK 0xFF000000UL
12 0 : #define RZ_IP_SHIFT 24UL
13 0 : #define RZ_IP_CH_MASK 0xFF0000UL
14 0 : #define RZ_IP_CH_SHIFT 16UL
15 0 : #define RZ_CLOCK_MASK 0xFF00UL
16 0 : #define RZ_CLOCK_SHIFT 8UL
17 0 : #define RZ_CLOCK_DIV_MASK 0xFFUL
18 0 : #define RZ_CLOCK_DIV_SHIFT 0UL
19 :
20 0 : #define RZ_IP_GTM 0UL /* General Timer */
21 0 : #define RZ_IP_GPT 1UL /* General PWM Timer */
22 0 : #define RZ_IP_SCI 2UL /* Serial Communications Interface */
23 0 : #define RZ_IP_SCIF 3UL /* Serial Communications Interface with FIFO */
24 0 : #define RZ_IP_RIIC 4UL /* I2C Bus Interface */
25 0 : #define RZ_IP_RSPI 5UL /* Renesas Serial Peripheral Interface */
26 0 : #define RZ_IP_MHU 6UL /* Message Handling Unit */
27 0 : #define RZ_IP_DMAC 7UL /* Direct Memory Access Controller */
28 0 : #define RZ_IP_CANFD 8UL /* CANFD Interface (RS-CANFD) */
29 : #if !defined(CONFIG_SOC_SERIES_RZV2L)
30 0 : #define RZ_IP_ADC 10UL /* A/D Converter */
31 0 : #define RZ_IP_WDT 11UL /* Watchdog Timer */
32 : #endif
33 :
34 0 : #define RZ_CLOCK_ICLK 0UL /* Cortex-A55 Clock */
35 0 : #define RZ_CLOCK_I2CLK 1UL /* Cortex-M33 Clock */
36 0 : #define RZ_CLOCK_GCLK 2UL /* GPU Clock */
37 0 : #define RZ_CLOCK_S0CLK 3UL /* DDR-PHY Clock */
38 0 : #define RZ_CLOCK_SPI0CLK 4UL /* SPI0 Clock */
39 0 : #define RZ_CLOCK_SPI1CLK 5UL /* SPI1 Clock */
40 0 : #define RZ_CLOCK_SD0CLK 6UL /* SDH0 Clock */
41 0 : #define RZ_CLOCK_SD1CLK 7UL /* SDH1 Clock */
42 0 : #define RZ_CLOCK_M0CLK 8UL /* VCP, LCDC Clock */
43 0 : #define RZ_CLOCK_M1CLK 9UL /* MIPI-DSI, MIPI-CSI Clock */
44 0 : #define RZ_CLOCK_M2CLK 10UL /* CRU, MIPI-DSI Clock */
45 0 : #define RZ_CLOCK_M3CLK 11UL /* MIPI-DSI, LCDC Clock */
46 0 : #define RZ_CLOCK_M4CLK 12UL /* MIPI-DSI Clock */
47 0 : #define RZ_CLOCK_HPCLK 13UL /* Ethernet Clock */
48 0 : #define RZ_CLOCK_TSUCLK 14UL /* TSU Clock */
49 0 : #define RZ_CLOCK_ZTCLK 15UL /* JAUTH Clock */
50 0 : #define RZ_CLOCK_P0CLK 16UL /* APB-BUS Clock */
51 0 : #define RZ_CLOCK_P1CLK 17UL /* AXI-BUS Clock */
52 0 : #define RZ_CLOCK_P2CLK 18UL /* P2CLK */
53 0 : #define RZ_CLOCK_ATCLK 19UL /* ATCLK */
54 0 : #define RZ_CLOCK_OSCCLK 20UL /* OSC Clock */
55 :
56 0 : #define RZ_CLOCK(IP, ch, clk, div) \
57 : ((RZ_IP_##IP << RZ_IP_SHIFT) | ((ch) << RZ_IP_CH_SHIFT) | ((clk) << RZ_CLOCK_SHIFT) | \
58 : ((div) << RZ_CLOCK_DIV_SHIFT))
59 :
60 : /**
61 : * Pack clock configurations in a 32-bit value
62 : * as expected for the Device Tree `clocks` property on Renesas RZ/V.
63 : *
64 : * @param ch Peripheral channel/unit
65 : */
66 :
67 : /* GTM */
68 1 : #define RZ_CLOCK_GTM(ch) RZ_CLOCK(GTM, ch, RZ_CLOCK_P0CLK, 1)
69 :
70 : /* GPT */
71 0 : #define RZ_CLOCK_GPT(ch) RZ_CLOCK(GPT, ch, RZ_CLOCK_P0CLK, 1)
72 :
73 : /* SCI */
74 0 : #define RZ_CLOCK_SCI(ch) RZ_CLOCK(SCI, ch, RZ_CLOCK_P0CLK, 1)
75 :
76 : /* SCIF */
77 0 : #define RZ_CLOCK_SCIF(ch) RZ_CLOCK(SCIF, ch, RZ_CLOCK_P0CLK, 1)
78 :
79 : /* RIIC */
80 0 : #define RZ_CLOCK_RIIC(ch) RZ_CLOCK(RIIC, ch, RZ_CLOCK_P0CLK, 1)
81 :
82 : /* RSPI */
83 0 : #define RZ_CLOCK_RSPI(ch) RZ_CLOCK(RSPI, ch, RZ_CLOCK_P0CLK, 1)
84 :
85 : /* MHU */
86 0 : #define RZ_CLOCK_MHU(ch) RZ_CLOCK(MHU, ch, RZ_CLOCK_P1CLK, 2)
87 :
88 : /* DMAC */
89 0 : #define RZ_CLOCK_DMAC(ch) RZ_CLOCK(DMAC, ch, RZ_CLOCK_P1CLK, 1)
90 :
91 : /* CAN */
92 0 : #define RZ_CLOCK_CANFD(ch) RZ_CLOCK(CANFD, ch, RZ_CLOCK_P0CLK, 1)
93 :
94 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZV_CLOCK_H_ */
|