Skip to content

Commit dbf0d19

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 a6f7e0a commit dbf0d19

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