Skip to content

Commit f6eb92a

Browse files
committed
soc: renesas: rx: enable option function select register 0
Enables OSF0 register select for IWDT driver setting on start mode Signed-off-by: Quy Tran <[email protected]>
1 parent 45d8e00 commit f6eb92a

File tree

2 files changed

+179
-0
lines changed

2 files changed

+179
-0
lines changed

soc/renesas/rx/rx130/Kconfig

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,168 @@ config SOC_SERIES_RX130
88
select CLOCK_CONTROL_RENESAS_RX_CGC if CLOCK_CONTROL
99
select HAS_RENESAS_RX_RDP
1010
select CLOCK_CONTROL
11+
12+
if SOC_SERIES_RX130
13+
if WDT_RENESAS_RX_IWDT_AUTO_START_MODE
14+
15+
choice
16+
prompt "IWDT OFS0 Start Mode Select"
17+
default WDT_RENESAS_RX_STARTMODE_HALT
18+
19+
config WDT_RENESAS_RX_STARTMODE_AUTO_ACTIVATE
20+
bool "IWDT is automatically activated in auto-start mode after a reset"
21+
22+
config WDT_RENESAS_RX_STARTMODE_HALT
23+
bool "IWDT is halted after a reset"
24+
25+
endchoice
26+
27+
config WDT_RENESAS_RX_OFS0_IWDTSTRT
28+
int
29+
default 0 if WDT_RENESAS_RX_STARTMODE_HALT
30+
default 1 if WDT_RENESAS_RX_STARTMODE_AUTO_ACTIVATE
31+
32+
choice
33+
prompt "IWDT Timeout Period Select"
34+
default WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_2048
35+
36+
config WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_128
37+
bool "128 cycles"
38+
39+
config WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_512
40+
bool "512 cycles"
41+
42+
config WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_1024
43+
bool "1024 cycles"
44+
45+
config WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_2048
46+
bool "2048 cycles"
47+
48+
endchoice
49+
50+
config WDT_RENESAS_RX_OFS0_TIMEOUT_IWDTTOPS
51+
int
52+
default 0 if WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_128
53+
default 1 if WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_512
54+
default 2 if WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_1024
55+
default 3 if WDT_RENESAS_RX_OFS0_TIMEOUT_PERIOD_2048
56+
57+
choice
58+
prompt "IWDT Clock Divide Ratio Select"
59+
default WDT_RENESAS_RX_OFS0_CLKDIV_128
60+
61+
config WDT_RENESAS_RX_OFS0_CLKDIV_1
62+
bool "No division"
63+
64+
config WDT_RENESAS_RX_OFS0_CLKDIV_16
65+
bool "Divide-by-16"
66+
67+
config WDT_RENESAS_RX_OFS0_CLKDIV_32
68+
bool "Divide-by-32"
69+
70+
config WDT_RENESAS_RX_OFS0_CLKDIV_64
71+
bool "Divide-by-64"
72+
73+
config WDT_RENESAS_RX_OFS0_CLKDIV_128
74+
bool "Divide-by-128"
75+
76+
config WDT_RENESAS_RX_OFS0_CLKDIV_256
77+
bool "Divide-by-256"
78+
79+
endchoice
80+
81+
config WDT_RENESAS_RX_OFS0_CLKDIV_IWDTCKS
82+
int
83+
default 0 if WDT_RENESAS_RX_OFS0_CLKDIV_1
84+
default 2 if WDT_RENESAS_RX_OFS0_CLKDIV_16
85+
default 3 if WDT_RENESAS_RX_OFS0_CLKDIV_32
86+
default 4 if WDT_RENESAS_RX_OFS0_CLKDIV_64
87+
default 15 if WDT_RENESAS_RX_OFS0_CLKDIV_128
88+
default 5 if WDT_RENESAS_RX_OFS0_CLKDIV_256
89+
90+
choice
91+
prompt "IWDT Window Start Position Select"
92+
default WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_100
93+
94+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_25
95+
bool "25%"
96+
97+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_50
98+
bool "50%"
99+
100+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_75
101+
bool "75%"
102+
103+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_100
104+
bool "100% (window start position is not specified.)"
105+
106+
endchoice
107+
108+
config WDT_RENESAS_RX_OFS0_WINDOW_STRT_IWDTRPSS
109+
int
110+
default 0 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_25
111+
default 1 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_50
112+
default 2 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_75
113+
default 3 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_STRT_100
114+
115+
choice
116+
prompt "IWDT Window End Position Select"
117+
default WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_0
118+
119+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_75
120+
bool "75%"
121+
122+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_50
123+
bool "50%"
124+
125+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_25
126+
bool "25%"
127+
128+
config WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_0
129+
bool "0% (window end position is not specified.)"
130+
131+
endchoice
132+
133+
config WDT_RENESAS_RX_OFS0_WINDOW_END_IWDTRPES
134+
int
135+
default 0 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_75
136+
default 1 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_50
137+
default 2 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_25
138+
default 3 if WDT_RENESAS_RX_OFS0_IWDT_WINDOW_END_0
139+
140+
choice
141+
prompt "IWDT Reset Interrupt Request Select"
142+
default WDT_RENESAS_RX_OFS0_IRQ_ENA
143+
144+
config WDT_RENESAS_RX_OFS0_IRQ_ENA
145+
bool "Non-maskable interrupt request output is enabled."
146+
147+
config WDT_RENESAS_RX_OFS0_RESET_ENA
148+
bool "Reset output is enabled."
149+
150+
endchoice
151+
152+
config WDT_RENESAS_RX_OFS0_IRQ_SEL_IWDTRSTIRQS
153+
int
154+
default 0 if WDT_RENESAS_RX_OFS0_IRQ_ENA
155+
default 1 if WDT_RENESAS_RX_OFS0_RESET_ENA
156+
157+
choice
158+
prompt "IWDT Sleep Mode Count Stop Control"
159+
default WDT_RENESAS_RX_OFS0_COUNT_STOP_DIS
160+
161+
config WDT_RENESAS_RX_OFS0_COUNT_STOP_ENA
162+
bool "Count stop is disabled"
163+
164+
config WDT_RENESAS_RX_OFS0_COUNT_STOP_DIS
165+
bool "Count is stopped at a transition to sleep mode, software standby mode, or deep sleep mode."
166+
167+
endchoice
168+
169+
config WDT_RENESAS_RX_OFS0_IWDTSLCSTP
170+
int "IWDT Sleep Mode Count Stop Control"
171+
default 0 if WDT_RENESAS_RX_OFS0_COUNT_STOP_DIS
172+
default 1 if WDT_RENESAS_RX_OFS0_COUNT_STOP_ENA
173+
174+
endif # WDT_RENESAS_RX_IWDT_AUTO_START_MODE
175+
endif # SOC_SERIES_RX130

soc/renesas/rx/rx130/ofsm.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,21 @@
3333
* by programming the OFS0 register. When enabled, IWDT starts counting automatically
3434
* starts after a reset.
3535
*/
36+
37+
#ifdef CONFIG_WDT_RENESAS_RX_IWDT_AUTO_START_MODE
38+
#define SOC_RX_OFS0 \
39+
((CONFIG_WDT_RENESAS_RX_OFS0_IWDTSTRT << 1) | /* bit 1 */ \
40+
((CONFIG_WDT_RENESAS_RX_OFS0_TIMEOUT_IWDTTOPS & 0x3) << 2) | /* bits 2-3 */ \
41+
((CONFIG_WDT_RENESAS_RX_OFS0_CLKDIV_IWDTCKS & 0xF) << 4) | /* bits 4-7 */ \
42+
((CONFIG_WDT_RENESAS_RX_OFS0_WINDOW_END_IWDTRPES & 0x3) << 8) | /* bits 8-9 */ \
43+
((CONFIG_WDT_RENESAS_RX_OFS0_WINDOW_STRT_IWDTRPSS & 0x3) << 10) | /* bits 10-11 */ \
44+
((CONFIG_WDT_RENESAS_RX_OFS0_IRQ_SEL_IWDTRSTIRQS & 0x1) << 12) | /* bit 12 */ \
45+
((CONFIG_WDT_RENESAS_RX_OFS0_IWDTSLCSTP & 0x1) << 14) | /* bit 14 */ \
46+
0xFFFFA001UL /* reserved bits 0,13,15..31 */ \
47+
)
48+
#else
3649
#define SOC_RX_OFS0 (0xFFFFFFFFUL)
50+
#endif
3751

3852
/* Option Function Select Register 1 (OFS1) (Voltage detection and HOCO)
3953
*/

0 commit comments

Comments
 (0)