Skip to content

Commit

Permalink
boards: nxp: frdm_mcxa156: Support lpi2c for NXP frdm_mcxa156 board
Browse files Browse the repository at this point in the history
Support lpi2c for NXP frdm_mcxa156 board.

Signed-off-by: Neil Chen <[email protected]>
  • Loading branch information
NeilChen93 committed Dec 11, 2024
1 parent 366db61 commit ed38264
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
20 changes: 20 additions & 0 deletions boards/nxp/frdm_mcxa156/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ static int frdm_mcxa156_init(void)
SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0))
CLOCK_SetClockDiv(kCLOCK_DivLPI2C0, 1u);
CLOCK_AttachClk(kFRO12M_to_LPI2C0);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1))
CLOCK_SetClockDiv(kCLOCK_DivLPI2C1, 1u);
CLOCK_AttachClk(kFRO12M_to_LPI2C1);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c2))
CLOCK_SetClockDiv(kCLOCK_DivLPI2C2, 1u);
CLOCK_AttachClk(kFRO12M_to_LPI2C2);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c3))
CLOCK_SetClockDiv(kCLOCK_DivLPI2C3, 1u);
CLOCK_AttachClk(kFRO12M_to_LPI2C3);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0))

/*
Expand Down
2 changes: 2 additions & 0 deletions boards/nxp/frdm_mcxa156/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ The FRDM-MCXA156 board configuration supports the following hardware features:
+-----------+------------+-------------------------------------+
| DAC | on-chip | dac |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| LPCMP | on-chip | sensor(comparator) |
+-----------+------------+-------------------------------------+
| LPTMR | on-chip | counter |
Expand Down
33 changes: 33 additions & 0 deletions boards/nxp/frdm_mcxa156/frdm_mcxa156-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,37 @@
bias-pull-up;
};
};
pinmux_lpi2c0: pinmux_lpi2c0 {
group0 {
pinmux = <LPI2C0_SDA_P0_16>,
<LPI2C0_SCL_P0_17>;
slew-rate = "fast";
drive-strength = "low";
input-enable;
bias-pull-up;
drive-open-drain;
};
};
pinmux_lpi2c2: pinmux_lpi2c2 {
group0 {
pinmux = <LPI2C2_SDA_P1_8>,
<LPI2C2_SCL_P1_9>;
slew-rate = "fast";
drive-strength = "low";
input-enable;
bias-pull-up;
drive-open-drain;
};
};
pinmux_lpi2c3: pinmux_lpi2c3 {
group0 {
pinmux = <LPI2C3_SDA_P3_28>,
<LPI2C3_SCL_P3_27>;
slew-rate = "fast";
drive-strength = "low";
input-enable;
bias-pull-up;
drive-open-drain;
};
};
};
12 changes: 12 additions & 0 deletions boards/nxp/frdm_mcxa156/frdm_mcxa156.dts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@
pinctrl-names = "default";
};

&lpi2c0 {
status = "okay";
pinctrl-0 = <&pinmux_lpi2c0>;
pinctrl-names = "default";
};

&lpi2c3 {
status = "okay";
pinctrl-0 = <&pinmux_lpi2c3>;
pinctrl-names = "default";
};

&lptmr0 {
status = "okay";
};
1 change: 1 addition & 0 deletions boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ supported:
- gpio
- counter
- dac
- i2c
- pwm
vendor: nxp

0 comments on commit ed38264

Please sign in to comment.