Skip to content

Feature/frdm mcxw71 i3c support #88921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,21 @@
slew-rate = "fast";
};
};

pinmux_i3c: pinmux_i3c {
group0 {
pinmux = <I3C0_SDA_PTB4>,
<I3C0_SCL_PTB5>;
slew-rate = "fast";
drive-strength = "low";
input-enable;
bias-pull-up;
};
group1 {
pinmux = <I3C0_PUR_PTC2>;
slew-rate = "fast";
drive-strength = "low";
input-enable;
};
};
};
21 changes: 9 additions & 12 deletions boards/nxp/frdm_mcxw71/frdm_mcxw71.dts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <nxp/nxp_mcxw71.dtsi>
#include "frdm_mcxw71-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <freq.h>

/ {
model = "NXP FRDM-MCXW71 board";
Expand All @@ -18,6 +19,7 @@
blue-pwm-led = &blue_pwm_led;
green-pwm-led = &green_pwm_led;
red-pwm-led = &red_pwm_led;
ambient-temp0 = &p3t1755;
};

chosen {
Expand Down Expand Up @@ -90,18 +92,6 @@
pinctrl-names = "default";
};

&lpi2c1 {
status = "okay";
pinctrl-0 = <&pinmux_lpi2c1>;
pinctrl-names = "default";

accelerometer: accelerometer@19 {
status = "okay";
compatible = "nxp,fxls8974";
reg = <0x19>;
};
};

&lpspi1 {
status = "okay";
pinctrl-0 = <&pinmux_lpspi1>;
Expand Down Expand Up @@ -191,3 +181,10 @@
&rtc {
status = "okay";
};

&i3c0 {
pinctrl-0 = <&pinmux_i3c>;
pinctrl-names = "default";
};

p3t1755dp_ard_i3c_interface: &i3c0 {};
1 change: 1 addition & 0 deletions boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ supported:
- flash
- gpio
- i2c
- i3c
- pinctrl
- pwm
- regulator
Expand Down
27 changes: 27 additions & 0 deletions boards/shields/p3t1755dp_ard_i3c/boards/frdm_mcxw71.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/*
* The p3t1755 shield board is plugged into the arduino interface on
* the FRDM-MCXW71 board, and the J13 on the shield board is connected
* to the J22 on the MCXW71 referred below.
* J13-1 -> J22-8; J13-2 -> J22-6;
* J13-3 -> J22-1; J13-4 -> J22-10;
*/

#include <freq.h>

&i3c0 {
status = "okay";

i2c-scl-hz = <DT_FREQ_K(200)>;
i3c-scl-hz = <DT_FREQ_K(1200)>;
i3c-od-scl-hz = <DT_FREQ_K(600)>;
};

&lpi2c1 {
status = "disabled";
};
3 changes: 3 additions & 0 deletions drivers/clock_control/clock_control_mcux_scg_k4.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ static int mcux_scg_k4_get_rate(const struct device *dev, clock_control_subsys_t
case SCG_K4_RTCOSC_CLK:
clock_name = kCLOCK_RtcOscClk;
break;
case SCG_K4_I3C_CLK:
*rate = CLOCK_GetIpFreq(kCLOCK_I3c0);
return 0;
default:
LOG_ERR("Unsupported clock name");
return -EINVAL;
Expand Down
13 changes: 13 additions & 0 deletions dts/arm/nxp/nxp_mcxw7x_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@
clock-frequency = <32768>;
prescaler = <32768>;
};

i3c0: i3c@40035000 {
compatible = "nxp,mcux-i3c";
reg = <0x40035000 0xFFF>;
interrupts = <41 0>;
clocks = <&scg SCG_K4_I3C_CLK 0xd4>;
clk-divider = <15>;
clk-divider-slow = <1>;
clk-divider-tc = <1>;
status = "disabled";
#address-cells = <3>;
#size-cells = <0>;
};
};

&fast_peripheral0 {
Expand Down
1 change: 1 addition & 0 deletions include/zephyr/dt-bindings/clock/scg_k4.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
#define SCG_K4_SIRC_CLK 6U
#define SCG_K4_FIRC_CLK 7U
#define SCG_K4_RTCOSC_CLK 8U
#define SCG_K4_I3C_CLK 9U
1 change: 1 addition & 0 deletions samples/sensor/thermometer/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ tests:
- platform:mimxrt1180_evk/mimxrt1189/cm33:SHIELD=p3t1755dp_ard_i3c
- platform:mimxrt1180_evk/mimxrt1189/cm7:SHIELD=p3t1755dp_ard_i3c
- platform:frdm_mcxn236/mcxn236:SHIELD=p3t1755dp_ard_i3c
- platform:frdm_mcxw71:SHIELD=p3t1755dp_ard_i3c
6 changes: 6 additions & 0 deletions soc/nxp/mcx/mcxw/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ __weak void clock_init(void)
CLOCK_SetIpSrc(kCLOCK_Lpspi1, kCLOCK_IpSrcFro192M);
CLOCK_SetIpSrc(kCLOCK_Lpadc0, kCLOCK_IpSrcFro192M);
CLOCK_SetIpSrcDiv(kCLOCK_Lpadc0, kSCG_SysClkDivBy10);
CLOCK_SetIpSrc(kCLOCK_I3c0, kCLOCK_IpSrcFro192M);
CLOCK_SetIpSrcDiv(kCLOCK_I3c0, DT_PROP(DT_NODELABEL(i3c0), clk_divider));

/* Ungate clocks if the peripheral is enabled in devicetree */
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(gpioa), nxp_kinetis_gpio, okay)) {
Expand Down Expand Up @@ -188,6 +190,10 @@ __weak void clock_init(void)
if (DT_NODE_HAS_COMPAT_STATUS(adc0, nxp_lpadc, okay)) {
CLOCK_EnableClock(kCLOCK_Lpadc0);
}

if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(i3c0), nxp_mcux_i3c, okay)) {
CLOCK_EnableClock(kCLOCK_I3c0);
}
}

static void vbat_init(void)
Expand Down
Loading