Skip to content

Commit 6560128

Browse files
pefechcarlescufi
authored andcommitted
dts: arm: nxp: nxp_imx8m_m4: Add ECSPI devices
Add device tree instances for ECSPI devices, update SoC code to enable clocks. Signed-off-by: Peter Fecher <[email protected]>
1 parent 8a1785b commit 6560128

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

dts/arm/nxp/nxp_imx8m_m4.dtsi

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,36 @@
136136
#clock-cells = <3>;
137137
};
138138

139+
ecspi1: spi@30820000 {
140+
compatible = "nxp,imx-ecspi";
141+
reg = <0x30820000 DT_SIZE_K(64)>;
142+
#address-cells = <1>;
143+
#size-cells = <0>;
144+
interrupts = <31 3>;
145+
clocks = <&ccm IMX_CCM_ECSPI1_CLK 0 0>;
146+
status = "disabled";
147+
};
148+
149+
ecspi2: spi@30830000 {
150+
compatible = "nxp,imx-ecspi";
151+
reg = <0x30830000 DT_SIZE_K(64)>;
152+
#address-cells = <1>;
153+
#size-cells = <0>;
154+
interrupts = <32 3>;
155+
clocks = <&ccm IMX_CCM_ECSPI2_CLK 0 0>;
156+
status = "disabled";
157+
};
158+
159+
ecspi3: spi@30840000 {
160+
compatible = "nxp,imx-ecspi";
161+
reg = <0x30840000 DT_SIZE_K(64)>;
162+
#address-cells = <1>;
163+
#size-cells = <0>;
164+
interrupts = <33 3>;
165+
clocks = <&ccm IMX_CCM_ECSPI3_CLK 0 0>;
166+
status = "disabled";
167+
};
168+
139169
uart1: uart@30860000 {
140170
compatible = "nxp,imx-iuart";
141171
reg = <0x30860000 0x10000>;

soc/nxp/imx/imx8m/m4_mini/soc.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ static void SOC_ClockInit(void)
128128
/* Set root clock to 80MHZ/ 1= 80MHZ */
129129
CLOCK_SetRootDivider(kCLOCK_RootUart4, 1U, 1U);
130130
#endif
131+
#endif
132+
133+
#if defined(CONFIG_SPI_MCUX_ECSPI)
134+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi1), okay)
135+
/* Set ECSPI1 source to SYSTEM PLL1 800MHZ */
136+
CLOCK_SetRootMux(kCLOCK_RootEcspi1, kCLOCK_EcspiRootmuxSysPll1);
137+
/* Set root clock to 800MHZ / 10 = 80MHZ */
138+
CLOCK_SetRootDivider(kCLOCK_RootEcspi1, 2U, 5U);
139+
#endif
140+
141+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi2), okay)
142+
/* Set ECSPI2 source to SYSTEM PLL1 800MHZ */
143+
CLOCK_SetRootMux(kCLOCK_RootEcspi2, kCLOCK_EcspiRootmuxSysPll1);
144+
/* Set root clock to 800MHZ / 10 = 80MHZ */
145+
CLOCK_SetRootDivider(kCLOCK_RootEcspi2, 2U, 5U);
146+
#endif
147+
148+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi3), okay)
149+
/* Set ECSPI3 source to SYSTEM PLL1 800MHZ */
150+
CLOCK_SetRootMux(kCLOCK_RootEcspi3, kCLOCK_EcspiRootmuxSysPll1);
151+
/* Set root clock to 800MHZ / 10 = 80MHZ */
152+
CLOCK_SetRootDivider(kCLOCK_RootEcspi3, 2U, 5U);
153+
#endif
131154
#endif
132155

133156
/* Enable RDC clock */

0 commit comments

Comments
 (0)