Skip to content

Commit 2fc2c1d

Browse files
peterwangszkartben
authored andcommitted
boards: frdm_mcxa166, frdm_mcxa276: add spi support
1. enable spi support 2. verified tests/drivers/spi/spi_loopback Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
1 parent 8405754 commit 2fc2c1d

File tree

12 files changed

+150
-0
lines changed

12 files changed

+150
-0
lines changed

boards/nxp/frdm_mcxa166/board.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ void board_early_init_hook(void)
222222

223223
#endif
224224

225+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi0))
226+
/* Configure input clock to be able to reach the datasheet specified band rate. */
227+
CLOCK_SetClockDiv(kCLOCK_DivLPSPI0, 1u);
228+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPSPI0);
229+
#endif
230+
231+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1))
232+
/* Configure input clock to be able to reach the datasheet specified band rate. */
233+
CLOCK_SetClockDiv(kCLOCK_DivLPSPI1, 1u);
234+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPSPI1);
235+
#endif
236+
225237
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0))
226238

227239
/*

boards/nxp/frdm_mcxa166/frdm_mcxa166-pinctrl.dtsi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,15 @@
6969
};
7070
};
7171

72+
pinmux_lpspi0: pinmux_lpspi0 {
73+
group0 {
74+
pinmux = <LPSPI0_SDO_P1_0>,
75+
<LPSPI0_SCK_P1_1>,
76+
<LPSPI0_SDI_P1_2>,
77+
<LPSPI0_PCS0_P1_3>;
78+
slew-rate = "fast";
79+
drive-strength = "low";
80+
input-enable;
81+
};
82+
};
7283
};

boards/nxp/frdm_mcxa166/frdm_mcxa166.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@
138138
pinctrl-names = "default";
139139
};
140140

141+
&lpspi0 {
142+
status = "okay";
143+
pinctrl-0 = <&pinmux_lpspi0>;
144+
pinctrl-names = "default";
145+
};
146+
141147
&flash {
142148
partitions {
143149
compatible = "fixed-partitions";

boards/nxp/frdm_mcxa166/frdm_mcxa166.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ supported:
1919
- flash
2020
- adc
2121
- i2c
22+
- spi
2223
- watchdog
2324
- counter
2425
- dma

boards/nxp/frdm_mcxa276/board.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ void board_early_init_hook(void)
222222

223223
#endif
224224

225+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi0))
226+
/* Configure input clock to be able to reach the datasheet specified band rate. */
227+
CLOCK_SetClockDiv(kCLOCK_DivLPSPI0, 1u);
228+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPSPI0);
229+
#endif
230+
231+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1))
232+
/* Configure input clock to be able to reach the datasheet specified band rate. */
233+
CLOCK_SetClockDiv(kCLOCK_DivLPSPI1, 1u);
234+
CLOCK_AttachClk(kFRO_LF_DIV_to_LPSPI1);
235+
#endif
236+
225237
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0))
226238

227239
/*

boards/nxp/frdm_mcxa276/frdm_mcxa276-pinctrl.dtsi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,15 @@
6969
};
7070
};
7171

72+
pinmux_lpspi0: pinmux_lpspi0 {
73+
group0 {
74+
pinmux = <LPSPI0_SDO_P1_0>,
75+
<LPSPI0_SCK_P1_1>,
76+
<LPSPI0_SDI_P1_2>,
77+
<LPSPI0_PCS0_P1_3>;
78+
slew-rate = "fast";
79+
drive-strength = "low";
80+
input-enable;
81+
};
82+
};
7283
};

boards/nxp/frdm_mcxa276/frdm_mcxa276.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@
138138
pinctrl-names = "default";
139139
};
140140

141+
&lpspi0 {
142+
status = "okay";
143+
pinctrl-0 = <&pinmux_lpspi0>;
144+
pinctrl-names = "default";
145+
};
146+
141147
&flash {
142148
partitions {
143149
compatible = "fixed-partitions";

boards/nxp/frdm_mcxa276/frdm_mcxa276.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ supported:
1919
- flash
2020
- adc
2121
- i2c
22+
- spi
2223
- watchdog
2324
- counter
2425
- dma

dts/arm/nxp/nxp_mcxa166.dtsi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,30 @@
363363
status = "disabled";
364364
};
365365

366+
lpspi0: spi@4009c000 {
367+
compatible = "nxp,lpspi";
368+
reg = <0x4009c000 0x1000>;
369+
interrupts = <28 0>;
370+
clocks = <&syscon MCUX_LPSPI0_CLK>;
371+
tx-fifo-size = <4>;
372+
rx-fifo-size = <4>;
373+
#address-cells = <1>;
374+
#size-cells = <0>;
375+
status = "disabled";
376+
};
377+
378+
lpspi1: spi@4009d000 {
379+
compatible = "nxp,lpspi";
380+
reg = <0x4009d000 0x1000>;
381+
interrupts = <29 0>;
382+
clocks = <&syscon MCUX_LPSPI1_CLK>;
383+
tx-fifo-size = <4>;
384+
rx-fifo-size = <4>;
385+
#address-cells = <1>;
386+
#size-cells = <0>;
387+
status = "disabled";
388+
};
389+
366390
wwdt0: watchdog@4000c000 {
367391
compatible = "nxp,lpc-wwdt";
368392
reg = <0x4000c000 0x1000>;

dts/arm/nxp/nxp_mcxa276.dtsi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,30 @@
363363
status = "disabled";
364364
};
365365

366+
lpspi0: spi@4009c000 {
367+
compatible = "nxp,lpspi";
368+
reg = <0x4009c000 0x1000>;
369+
interrupts = <28 0>;
370+
clocks = <&syscon MCUX_LPSPI0_CLK>;
371+
tx-fifo-size = <4>;
372+
rx-fifo-size = <4>;
373+
#address-cells = <1>;
374+
#size-cells = <0>;
375+
status = "disabled";
376+
};
377+
378+
lpspi1: spi@4009d000 {
379+
compatible = "nxp,lpspi";
380+
reg = <0x4009d000 0x1000>;
381+
interrupts = <29 0>;
382+
clocks = <&syscon MCUX_LPSPI1_CLK>;
383+
tx-fifo-size = <4>;
384+
rx-fifo-size = <4>;
385+
#address-cells = <1>;
386+
#size-cells = <0>;
387+
status = "disabled";
388+
};
389+
366390
wwdt0: watchdog@4000c000 {
367391
compatible = "nxp,lpc-wwdt";
368392
reg = <0x4000c000 0x1000>;

0 commit comments

Comments
 (0)