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_RZA_CLOCK_H_
8 : #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZA_CLOCK_H_
9 :
10 : /* RZ/A 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_SCI 1UL /* Serial Communications Interface */
22 0 : #define RZ_IP_SCIF 2UL /* Serial Communications Interface with FIFO */
23 0 : #define RZ_IP_RIIC 3UL /* I2C Bus Interface */
24 0 : #define RZ_IP_RSPI 4UL /* Renesas Serial Peripheral Interface */
25 0 : #define RZ_IP_DMAC 5UL /* Direct Memory Access Controller */
26 0 : #define RZ_IP_CANFD 6UL /* CANFD Interface (RS-CANFD) */
27 0 : #define RZ_IP_ADC 7UL /* A/D Converter */
28 0 : #define RZ_IP_WDT 8UL /* Watchdog Timer */
29 :
30 0 : #define RZ_CLOCK_ICLK 0UL /* Cortex-A55 Clock */
31 0 : #define RZ_CLOCK_I2CLK 1UL /* Cortex-M33 Clock */
32 0 : #define RZ_CLOCK_S0CLK 2UL /* DDR-PHY Clock */
33 0 : #define RZ_CLOCK_SPI0CLK 3UL /* SPI0 Clock */
34 0 : #define RZ_CLOCK_SPI1CLK 4UL /* SPI1 Clock */
35 0 : #define RZ_CLOCK_OC0CLK 5UL /* Octa0 Clock */
36 0 : #define RZ_CLOCK_OC1CLK 6UL /* Octa1 Clock */
37 0 : #define RZ_CLOCK_SD0CLK 7UL /* SDH0 Clock */
38 0 : #define RZ_CLOCK_SD1CLK 8UL /* SDH1 Clock */
39 0 : #define RZ_CLOCK_M0CLK 9UL /* VCP, LCDC Clock */
40 0 : #define RZ_CLOCK_M2CLK 10UL /* CRU, MIPI-DSI Clock */
41 0 : #define RZ_CLOCK_M3CLK 11UL /* MIPI-DSI, LCDC Clock */
42 0 : #define RZ_CLOCK_HPCLK 12UL /* Ethernet Clock */
43 0 : #define RZ_CLOCK_TSUCLK 13UL /* TSU Clock */
44 0 : #define RZ_CLOCK_ZTCLK 14UL /* JAUTH Clock */
45 0 : #define RZ_CLOCK_P0CLK 15UL /* APB-BUS Clock */
46 0 : #define RZ_CLOCK_P1CLK 16UL /* AXI-BUS Clock */
47 0 : #define RZ_CLOCK_P2CLK 17UL /* P2CLK */
48 0 : #define RZ_CLOCK_ATCLK 18UL /* ATCLK */
49 0 : #define RZ_CLOCK_OSCCLK 19UL /* OSC Clock */
50 :
51 0 : #define RZ_CLOCK(IP, ch, clk, div) \
52 : ((RZ_IP_##IP << RZ_IP_SHIFT) | ((ch) << RZ_IP_CH_SHIFT) | ((clk) << RZ_CLOCK_SHIFT) | \
53 : ((div) << RZ_CLOCK_DIV_SHIFT))
54 :
55 : /**
56 : * Pack clock configurations in a 32-bit value
57 : * as expected for the Device Tree `clocks` property on Renesas RZ/A.
58 : *
59 : * @param ch Peripheral channel/unit
60 : */
61 :
62 : /* GTM */
63 1 : #define RZ_CLOCK_GTM(ch) RZ_CLOCK(GTM, ch, RZ_CLOCK_P0CLK, 1)
64 :
65 : /* SCI */
66 0 : #define RZ_CLOCK_SCI(ch) RZ_CLOCK(SCI, ch, RZ_CLOCK_P0CLK, 1)
67 :
68 : /* SCIF */
69 0 : #define RZ_CLOCK_SCIF(ch) RZ_CLOCK(SCIF, ch, RZ_CLOCK_P0CLK, 1)
70 :
71 : /* RIIC */
72 0 : #define RZ_CLOCK_RIIC(ch) RZ_CLOCK(RIIC, ch, RZ_CLOCK_P0CLK, 1)
73 :
74 : /* RSPI */
75 0 : #define RZ_CLOCK_RSPI(ch) RZ_CLOCK(RSPI, ch, RZ_CLOCK_P0CLK, 1)
76 :
77 : /* DMAC */
78 0 : #define RZ_CLOCK_DMAC_NS(ch) RZ_CLOCK(DMAC, ch, RZ_CLOCK_P1CLK, 1)
79 :
80 : /* CAN */
81 0 : #define RZ_CLOCK_CANFD(ch) RZ_CLOCK(CANFD, ch, RZ_CLOCK_P0CLK, 1)
82 :
83 : /* ADC */
84 0 : #define RZ_CLOCK_ADC(ch) RZ_CLOCK(ADC, ch, RZ_CLOCK_P0CLK, 1)
85 :
86 : /* WDT */
87 0 : #define RZ_CLOCK_WDT(ch) RZ_CLOCK(WDT, ch, RZ_CLOCK_P0CLK, 1)
88 :
89 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RENESAS_RZA_CLOCK_H_ */
|