Line data Source code
1 0 : /*
2 : * Copyright (c) 2024 Renesas Electronics Corporation
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZG_CLOCK_H_
8 : #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZG_CLOCK_H_
9 :
10 : /** RZ clock configuration values */
11 1 : #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 0 : #define RZ_IP_ADC 9UL /* A/D Converter */
30 0 : #define RZ_IP_WDT 10UL /* Watchdog Timer */
31 :
32 0 : #define RZ_CLOCK_ICLK 0UL /* Cortex-A55 Clock */
33 0 : #define RZ_CLOCK_I2CLK 1UL /* Cortex-M33 Clock */
34 0 : #define RZ_CLOCK_I3CLK 2UL /* Cortex-M33 FPU Clock */
35 0 : #define RZ_CLOCK_S0CLK 3UL /* DDR-PHY Clock */
36 0 : #define RZ_CLOCK_OC0CLK 4UL /* OCTA0 Clock */
37 0 : #define RZ_CLOCK_OC1CLK 5UL /* OCTA1 Clock */
38 0 : #define RZ_CLOCK_SPI0CLK 6UL /* SPI0 Clock */
39 0 : #define RZ_CLOCK_SPI1CLK 7UL /* SPI1 Clock */
40 0 : #define RZ_CLOCK_SD0CLK 8UL /* SDH0 Clock */
41 0 : #define RZ_CLOCK_SD1CLK 9UL /* SDH1 Clock */
42 0 : #define RZ_CLOCK_SD2CLK 10UL /* SDH2 Clock */
43 0 : #define RZ_CLOCK_M0CLK 11UL /* VCP LCDC Clock */
44 0 : #define RZ_CLOCK_HPCLK 12UL /* Ethernet Clock */
45 0 : #define RZ_CLOCK_TSUCLK 13UL /* TSU Clock */
46 0 : #define RZ_CLOCK_ZTCLK 14UL /* JAUTH Clock */
47 0 : #define RZ_CLOCK_P0CLK 15UL /* APB-BUS Clock */
48 0 : #define RZ_CLOCK_P1CLK 16UL /* AXI-BUS Clock */
49 0 : #define RZ_CLOCK_P2CLK 17UL /* P2CLK */
50 0 : #define RZ_CLOCK_P3CLK 18UL /* P3CLK */
51 0 : #define RZ_CLOCK_P4CLK 19UL /* P4CLK */
52 0 : #define RZ_CLOCK_P5CLK 20UL /* P5CLK */
53 0 : #define RZ_CLOCK_ATCLK 21UL /* ATCLK */
54 0 : #define RZ_CLOCK_OSCCLK 22UL /* OSC Clock */
55 0 : #define RZ_CLOCK_OSCCLK2 23UL /* OSC2 Clock */
56 :
57 0 : #define RZ_CLOCK(IP, ch, clk, div) \
58 : ((RZ_IP_##IP << RZ_IP_SHIFT) | ((ch) << RZ_IP_CH_SHIFT) | ((clk) << RZ_CLOCK_SHIFT) | \
59 : ((div) << RZ_CLOCK_DIV_SHIFT))
60 :
61 : /**
62 : * Pack clock configurations in a 32-bit value
63 : * as expected for the Device Tree `clocks` property on Renesas RZ/G.
64 : *
65 : * @param ch Peripheral channel/unit
66 : */
67 :
68 : /* SCIF */
69 1 : #define RZ_CLOCK_SCIF(ch) RZ_CLOCK(SCIF, ch, RZ_CLOCK_P0CLK, 1)
70 :
71 : /* GPT */
72 0 : #define RZ_CLOCK_GPT(ch) RZ_CLOCK(GPT, ch, RZ_CLOCK_P0CLK, 1)
73 :
74 : /* MHU */
75 0 : #define RZ_CLOCK_MHU(ch) RZ_CLOCK(MHU, ch, RZ_CLOCK_P1CLK, 2)
76 :
77 : /* ADC */
78 0 : #define RZ_CLOCK_ADC(ch) RZ_CLOCK(ADC, ch, RZ_CLOCK_TSUCLK, 1)
79 :
80 : /* RIIC */
81 0 : #define RZ_CLOCK_RIIC(ch) RZ_CLOCK(RIIC, ch, RZ_CLOCK_P0CLK, 1)
82 :
83 : /* GTM */
84 0 : #define RZ_CLOCK_GTM(ch) RZ_CLOCK(GTM, ch, RZ_CLOCK_P0CLK, 1)
85 :
86 : /* CAN */
87 0 : #define RZ_CLOCK_CANFD(ch) RZ_CLOCK(CANFD, ch, RZ_CLOCK_P4CLK, 2)
88 :
89 : /* RSPI */
90 0 : #define RZ_CLOCK_RSPI(ch) RZ_CLOCK(RSPI, ch, RZ_CLOCK_P0CLK, 1)
91 :
92 : /* DMAC */
93 0 : #define RZ_CLOCK_DMAC(ch) RZ_CLOCK(DMAC, ch, RZ_CLOCK_P3CLK, 1)
94 :
95 : /* SCI */
96 0 : #define RZ_CLOCK_SCI(ch) RZ_CLOCK(SCI, ch, RZ_CLOCK_P0CLK, 1)
97 :
98 : /* WDT */
99 0 : #define RZ_CLOCK_WDT(ch) RZ_CLOCK(WDT, ch, RZ_CLOCK_OSCCLK, 1)
100 :
101 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZG_CLOCK_H_ */
|