Skip to content

Commit 473c550

Browse files
Ta Minh Nhatkartben
authored andcommitted
board: renesas: add i3c support for ra8 and ra4 boards
Enable support i3c driver for ek_ra8m1, ek_ra8d1, mck_ra8t1, ek_ra4l1, ek_ra4e2. Signed-off-by: Ta Minh Nhat <nhat-minh.ta.yn@bp.renesas.com>
1 parent 33619a9 commit 473c550

25 files changed

+336
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library()
5+
zephyr_library_sources(board.c)

boards/renesas/ek_ra4e2/board.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/init.h>
8+
#include <zephyr/drivers/gpio.h>
9+
#include <zephyr/devicetree.h>
10+
#include <zephyr/logging/log.h>
11+
12+
LOG_MODULE_REGISTER(board_control, CONFIG_LOG_DEFAULT_LEVEL);
13+
14+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i3c0)) && defined(CONFIG_I3C)
15+
static int i3c_init(void)
16+
{
17+
const struct gpio_dt_spec i3c_pullup_gpios[2] = {
18+
GPIO_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), i3c_pullup_gpios, 0),
19+
GPIO_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), i3c_pullup_gpios, 1),
20+
};
21+
22+
if (!gpio_is_ready_dt(&i3c_pullup_gpios[0]) || !gpio_is_ready_dt(&i3c_pullup_gpios[1])) {
23+
LOG_ERR("I3C pull-up control is not ready");
24+
return -ENODEV;
25+
}
26+
27+
if (gpio_pin_configure_dt(&i3c_pullup_gpios[0], GPIO_INPUT) ||
28+
gpio_pin_configure_dt(&i3c_pullup_gpios[1], GPIO_INPUT)) {
29+
LOG_ERR("Failed to configure pull-up control");
30+
return -EIO;
31+
}
32+
33+
return 0;
34+
}
35+
36+
SYS_INIT(i3c_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
37+
#endif

boards/renesas/ek_ra4e2/ek_ra4e2-pinctrl.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
};
2323
};
2424

25+
i3c0_default: i3c0_default {
26+
group1 {
27+
/* SCL SDA */
28+
psels = <RA_PSEL(RA_PSEL_I3C, 1, 0)>,
29+
<RA_PSEL(RA_PSEL_I3C, 1, 1)>;
30+
};
31+
};
32+
2533
canfd0_default: canfd0_default {
2634
group1 {
2735
/* CRX0 CTX0 */

boards/renesas/ek_ra4e2/ek_ra4e2.dts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
max-bitrate = <5000000>;
6969
#phy-cells = <0>;
7070
};
71+
72+
zephyr,user {
73+
i3c-pullup-gpios = <&ioport2 5 GPIO_ACTIVE_LOW>,
74+
<&ioport2 6 GPIO_ACTIVE_LOW>;
75+
};
7176
};
7277

7378
&xtal {
@@ -116,6 +121,16 @@
116121
status = "okay";
117122
};
118123

124+
&i3c0 {
125+
i2c-scl-hz = <DT_FREQ_K(400)>;
126+
i3c-scl-hz = <DT_FREQ_M(4)>;
127+
pinctrl-0 = <&i3c0_default>;
128+
pinctrl-names = "default";
129+
interrupts = <51 1>, <52 1>, <53 1>, <54 1>, <55 1>, <56 1>;
130+
interrupt-names = "resp", "rx", "tx", "rcv", "ibi", "eei";
131+
status = "okay";
132+
};
133+
119134
&ioport4 {
120135
status = "okay";
121136
};
@@ -126,6 +141,12 @@
126141
status = "okay";
127142
};
128143

144+
&i3cclk {
145+
clocks = <&pll>;
146+
div = <2>;
147+
status = "okay";
148+
};
149+
129150
&canfd_global {
130151
status = "okay";
131152
canfd0 {

boards/renesas/ek_ra4e2/ek_ra4e2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ supported:
1212
- uart
1313
- watchdog
1414
- counter
15+
- i3c
1516
vendor: renesas
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library()
5+
zephyr_library_sources(board.c)

boards/renesas/ek_ra4l1/board.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/init.h>
8+
#include <zephyr/drivers/gpio.h>
9+
#include <zephyr/devicetree.h>
10+
#include <zephyr/logging/log.h>
11+
12+
LOG_MODULE_REGISTER(board_control, CONFIG_LOG_DEFAULT_LEVEL);
13+
14+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i3c0)) && defined(CONFIG_I3C)
15+
static int i3c_init(void)
16+
{
17+
const struct gpio_dt_spec i3c_pullup_gpios[2] = {
18+
GPIO_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), i3c_pullup_gpios, 0),
19+
GPIO_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), i3c_pullup_gpios, 1),
20+
};
21+
22+
if (!gpio_is_ready_dt(&i3c_pullup_gpios[0]) || !gpio_is_ready_dt(&i3c_pullup_gpios[1])) {
23+
LOG_ERR("I3C pull-up control is not ready");
24+
return -ENODEV;
25+
}
26+
27+
if (gpio_pin_configure_dt(&i3c_pullup_gpios[0], GPIO_INPUT) ||
28+
gpio_pin_configure_dt(&i3c_pullup_gpios[1], GPIO_INPUT)) {
29+
LOG_ERR("Failed to configure pull-up control");
30+
return -EIO;
31+
}
32+
33+
return 0;
34+
}
35+
36+
SYS_INIT(i3c_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
37+
#endif

boards/renesas/ek_ra4l1/ek_ra4l1-pinctrl.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
};
2323
};
2424

25+
i3c0_default: i3c0_default {
26+
group1 {
27+
/* SCL SDA */
28+
psels = <RA_PSEL(RA_PSEL_I3C, 4, 0)>,
29+
<RA_PSEL(RA_PSEL_I3C, 4, 1)>;
30+
};
31+
};
32+
2533
adc0_default: adc0_default {
2634
group1 {
2735
/* input */

boards/renesas/ek_ra4l1/ek_ra4l1.dts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
max-bitrate = <5000000>;
7373
#phy-cells = <0>;
7474
};
75+
76+
zephyr,user {
77+
i3c-pullup-gpios = <&ioport5 8 GPIO_ACTIVE_LOW>,
78+
<&ioport5 9 GPIO_ACTIVE_LOW>;
79+
};
7580
};
7681

7782
&xtal {
@@ -98,6 +103,12 @@
98103
status = "okay";
99104
};
100105

106+
&i3cclk {
107+
clocks = <&pll>;
108+
div = <1>;
109+
status = "okay";
110+
};
111+
101112
&sci5 {
102113
pinctrl-0 = <&sci5_default>;
103114
pinctrl-names = "default";
@@ -135,6 +146,16 @@
135146
status = "okay";
136147
};
137148

149+
&i3c0 {
150+
i2c-scl-hz = <DT_FREQ_K(400)>;
151+
i3c-scl-hz = <DT_FREQ_M(4)>;
152+
pinctrl-0 = <&i3c0_default>;
153+
pinctrl-names = "default";
154+
interrupts = <32 1>, <33 1>, <34 1>, <35 1>, <36 1>, <37 1>;
155+
interrupt-names = "resp", "rx", "tx", "rcv", "ibi", "eei";
156+
status = "okay";
157+
};
158+
138159
&adc0 {
139160
status = "okay";
140161
pinctrl-0 = <&adc0_default>;

boards/renesas/ek_ra4l1/ek_ra4l1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ supported:
1313
- watchdog
1414
- counter
1515
- i2s
16+
- i3c
1617
vendor: renesas

0 commit comments

Comments
 (0)