Skip to content

Commit 9560a96

Browse files
SuperHeroAbnerdkalowsk
authored andcommitted
boards: Update related configuration for RT700 xspi case
Add flash and psram dts based on RT700 board resource. Add the clock and power setting for XSPI in board specfic initilization function. Signed-off-by: Ruijia Wang <[email protected]>
1 parent b1dc69e commit 9560a96

File tree

6 files changed

+238
-36
lines changed

6 files changed

+238
-36
lines changed

boards/nxp/mimxrt700_evk/board.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,34 @@ void board_early_init_hook(void)
568568
CLOCK_SetClkDiv(kCLOCK_DivMediaMainClk, 2U);
569569
CLOCK_AttachClk(kMAIN_PLL_PFD2_to_MEDIA_MAIN);
570570
#endif
571+
572+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xspi0))
573+
POWER_DisablePD(kPDRUNCFG_APD_XSPI0);
574+
POWER_DisablePD(kPDRUNCFG_PPD_XSPI0);
575+
POWER_ApplyPD();
576+
#endif
577+
578+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xspi1))
579+
xspi_setup_clock(XSPI1, 1U, 1U); /* Audio PLL PDF1 DIV1. */
580+
581+
POWER_DisablePD(kPDRUNCFG_APD_XSPI1);
582+
POWER_DisablePD(kPDRUNCFG_PPD_XSPI1);
583+
POWER_ApplyPD();
584+
#endif
585+
586+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xspi2))
587+
#if CONFIG_SOC_MIMXRT798S_CM33_CPU0
588+
CLOCK_AttachClk(kMAIN_PLL_PFD3_to_XSPI2);
589+
#elif CONFIG_SOC_MIMXRT798S_CM33_CPU1
590+
CLOCK_AttachClk(kFRO1_DIV1_to_COMMON_BASE);
591+
CLOCK_AttachClk(kCOMMON_BASE_to_XSPI2);
592+
#endif
593+
CLOCK_SetClkDiv(kCLOCK_DivXspi2Clk, 1U);
594+
595+
POWER_DisablePD(kPDRUNCFG_APD_XSPI2);
596+
POWER_DisablePD(kPDRUNCFG_PPD_XSPI2);
597+
POWER_ApplyPD();
598+
#endif
571599
}
572600

573601
static void GlikeyWriteEnable(GLIKEY_Type *base, uint8_t idx)

boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,83 @@
193193
slew-rate = "normal";
194194
};
195195
};
196+
197+
pinmux_xspi0: pinmux_xspi0 {
198+
group0 {
199+
pinmux = <XSPI0_SCK_A_N_PIO6_0>,
200+
<XSPI0_SCK_A_PIO6_1>,
201+
<XSPI0_PCS_A_0_PIO6_2>,
202+
<XSPI0_DATA0_PIO6_3>,
203+
<XSPI0_DATA1_PIO6_4>,
204+
<XSPI0_DATA2_PIO6_5>,
205+
<XSPI0_DATA3_PIO6_6>,
206+
<XSPI0_DQS_A_0_PIO6_7>,
207+
<XSPI0_DATA4_PIO6_8>,
208+
<XSPI0_DATA5_PIO6_9>,
209+
<XSPI0_DATA6_PIO6_10>,
210+
<XSPI0_DATA7_PIO6_11>,
211+
<XSPI0_PCS_A_1_PIO6_12>;
212+
drive-strength = "normal";
213+
slew-rate = "normal";
214+
input-enable;
215+
};
216+
};
217+
218+
pinmux_xspi1: pinmux_xspi1 {
219+
group0 {
220+
pinmux = <XSPI1_PCS_A_0_PIO5_0>,
221+
<XSPI1_DATA0_PIO5_1>,
222+
<XSPI1_DATA1_PIO5_2>,
223+
<XSPI1_DATA2_PIO5_3>,
224+
<XSPI1_DATA3_PIO5_4>,
225+
<XSPI1_DATA4_PIO5_6>,
226+
<XSPI1_DATA5_PIO5_7>,
227+
<XSPI1_DATA6_PIO5_8>,
228+
<XSPI1_DATA7_PIO5_9>,
229+
<XSPI1_DQS_A_0_PIO5_5>,
230+
<XSPI1_SCK_A_PIO5_10>,
231+
<XSPI1_SCK_A_N_PIO5_11>,
232+
<XSPI1_DATA8_PIO5_12>,
233+
<XSPI1_DATA9_PIO5_13>,
234+
<XSPI1_DATA10_PIO5_14>,
235+
<XSPI1_DATA11_PIO5_15>,
236+
<XSPI1_DQS_A_1_PIO5_16>,
237+
<XSPI1_DATA12_PIO5_17>,
238+
<XSPI1_DATA13_PIO5_18>,
239+
<XSPI1_DATA14_PIO5_19>,
240+
<XSPI1_DATA15_PIO5_20>;
241+
drive-strength = "normal";
242+
slew-rate = "normal";
243+
input-enable;
244+
};
245+
};
246+
247+
pinmux_xspi2: pinmux_xspi2 {
248+
group0 {
249+
pinmux = <XSPI2_PCS_A_0_PIO4_0>,
250+
<XSPI2_DATA0_PIO4_1>,
251+
<XSPI2_DATA1_PIO4_2>,
252+
<XSPI2_DATA2_PIO4_3>,
253+
<XSPI2_DATA3_PIO4_4>,
254+
<XSPI2_DQS_A_0_PIO4_5>,
255+
<XSPI2_DATA4_PIO4_6>,
256+
<XSPI2_DATA5_PIO4_7>,
257+
<XSPI2_DATA6_PIO4_8>,
258+
<XSPI2_DATA7_PIO4_9>,
259+
<XSPI2_SCK_A_PIO4_10>,
260+
<XSPI2_SCK_A_N_PIO4_11>,
261+
<XSPI2_DATA8_PIO4_12>,
262+
<XSPI2_DATA9_PIO4_13>,
263+
<XSPI2_DATA10_PIO4_14>,
264+
<XSPI2_DATA11_PIO4_15>,
265+
<XSPI2_DQS_A_1_PIO4_16>,
266+
<XSPI2_DATA12_PIO4_17>,
267+
<XSPI2_DATA13_PIO4_18>,
268+
<XSPI2_DATA14_PIO4_19>,
269+
<XSPI2_DATA15_PIO4_20>;
270+
drive-strength = "normal";
271+
slew-rate = "normal";
272+
input-enable;
273+
};
274+
};
196275
};

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts

Lines changed: 106 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
i2s-tx = &sai0;
2727
sdhc0 = &usdhc0;
2828
rtc = &rtc0;
29+
sram-ext = &psram0;
2930
};
3031

3132
chosen {
32-
zephyr,flash-controller = &mx25um51345g;
33-
zephyr,flash = &mx25um51345g;
33+
zephyr,flash-controller = &flash_controller0;
34+
zephyr,flash = &ext_flash;
3435
zephyr,sram = &sram0;
3536
zephyr,console = &flexcomm0_lpuart0;
3637
zephyr,shell-uart = &flexcomm0_lpuart0;
@@ -95,6 +96,19 @@
9596
enable-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
9697
regulator-boot-on;
9798
};
99+
100+
memc: memc@8000000 {
101+
status = "okay";
102+
reg = <0x08000000 DT_SIZE_M(32)>;
103+
#address-cells = <1>;
104+
#size-cells = <1>;
105+
106+
psram: memory@8000000 {
107+
compatible = "zephyr,memory-region";
108+
reg = <0x08000000 DT_SIZE_M(32)>;
109+
zephyr,memory-region = "PSRAM";
110+
};
111+
};
98112
};
99113

100114
&ctimer0 {
@@ -325,47 +339,103 @@ zephyr_lcdif: &lcdif {};
325339

326340
&xspi0 {
327341
status = "okay";
342+
pinctrl-0 = <&pinmux_xspi0>;
343+
pinctrl-names = "default";
344+
byte-order = <3>;
345+
ahb-buffer-write-flush;
346+
ahb-prefetch;
328347

329-
mx25um51345g: mx25um51345g@0 {
330-
compatible = "nxp,xspi-mx25um51345g";
331-
/* MX25UM51245G is 64MB, 512MBit flash part */
332-
size = <DT_SIZE_M(64 * 8)>;
333-
reg = <0>;
334-
spi-max-frequency = <DT_FREQ_M(200)>;
348+
flash_controller0: flash-controller@0 {
335349
status = "okay";
336-
jedec-id = [c2 81 3a];
337-
erase-block-size = <DT_SIZE_K(4)>;
338-
write-block-size = <2>;
339-
340-
partitions {
341-
compatible = "fixed-partitions";
342-
#address-cells = <1>;
343-
#size-cells = <1>;
344-
345-
/*
346-
* Partition sizes must be aligned
347-
* to the flash memory sector size of 4KB.
348-
*/
349-
boot_partition: partition@0 {
350-
label = "mcuboot";
351-
reg = <0x00000000 DT_SIZE_K(128)>;
352-
};
353-
slot0_partition: partition@20000 {
354-
label = "image-0";
355-
reg = <0x00020000 DT_SIZE_M(7)>;
356-
};
357-
slot1_partition: partition@720000 {
358-
label = "image-1";
359-
reg = <0x00720000 DT_SIZE_M(7)>;
360-
};
361-
storage_partition: partition@E20000 {
362-
label = "storage";
363-
reg = <0x00E20000 (DT_SIZE_M(2) - DT_SIZE_K(128))>;
350+
compatible = "nxp,xspi-nor";
351+
device-name = "mx25um51345g";
352+
/* MX25UM51245G is 64MB, 512Mbit flash part. */
353+
size = <DT_SIZE_M(64)>;
354+
reg = <0>;
355+
sample-clk-source = <3>;
356+
#address-cells = <1>;
357+
#size-cells = <1>;
358+
359+
ext_flash: flash@38000000 {
360+
compatible = "soc-nv-flash";
361+
reg = <0x38000000 DT_SIZE_M(64)>;
362+
erase-block-size = <DT_SIZE_K(4)>;
363+
write-block-size = <2>;
364+
365+
partitions {
366+
compatible = "fixed-partitions";
367+
#address-cells = <1>;
368+
#size-cells = <1>;
369+
370+
/*
371+
* Partition sizes must be aligned
372+
* to the flash memory sector size of 4KB.
373+
*/
374+
boot_partition: partition@0 {
375+
label = "mcuboot";
376+
reg = <0x00000000 DT_SIZE_K(128)>;
377+
};
378+
379+
slot0_partition: partition@20000 {
380+
label = "image-0";
381+
reg = <0x00020000 DT_SIZE_M(7)>;
382+
};
383+
384+
slot1_partition: partition@720000 {
385+
label = "image-1";
386+
reg = <0x00720000 DT_SIZE_M(7)>;
387+
};
388+
389+
storage_partition: partition@E20000 {
390+
label = "storage";
391+
reg = <0x00E20000 (DT_SIZE_M(2) - DT_SIZE_K(128))>;
392+
};
364393
};
365394
};
366395
};
367396
};
368397

398+
&xspi1 {
399+
status = "okay";
400+
pinctrl-0 = <&pinmux_xspi1>;
401+
pinctrl-names = "default";
402+
byte-order = <3>;
403+
ahb-buffer-write-flush;
404+
ahb-prefetch;
405+
enable-ahb-write;
406+
/* Connect JP45 1-2 to use XSPI1. */
407+
408+
psram0: memory-controller@0 {
409+
status = "okay";
410+
compatible = "nxp,xspi-psram";
411+
device-name = "w958d6nbkx5l";
412+
size = <DT_SIZE_M(32)>;
413+
reg = <0>;
414+
enable-differential-clk;
415+
sample-clk-source = <3>;
416+
};
417+
};
418+
419+
&xspi2 {
420+
status = "okay";
421+
pinctrl-0 = <&pinmux_xspi2>;
422+
pinctrl-names = "default";
423+
byte-order = <3>;
424+
ahb-buffer-write-flush;
425+
ahb-prefetch;
426+
enable-ahb-write;
427+
428+
psram1: memory-controller@0 {
429+
status = "okay";
430+
compatible = "nxp,xspi-psram";
431+
device-name = "w958d6nbkx4l";
432+
size = <DT_SIZE_M(32)>;
433+
reg = <0>;
434+
enable-differential-clk;
435+
sample-clk-source = <3>;
436+
};
437+
};
438+
369439
zephyr_udc0: &usb0 {
370440
status = "okay";
371441
phy-handle = <&usbphy>;

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ supported:
2424
- usb_device
2525
- watchdog
2626
- hwinfo
27+
- flash
28+
- memc
2729
vendor: nxp

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu1.dts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
sw0 = &user_button_1;
2121
ambient-temp0 = &p3t1755;
2222
rtc = &rtc1;
23+
sram-ext = &psram;
2324
};
2425

2526
chosen {
@@ -114,3 +115,23 @@
114115
&mbox1_b {
115116
status = "okay";
116117
};
118+
119+
&xspi2 {
120+
status = "okay";
121+
pinctrl-0 = <&pinmux_xspi2>;
122+
pinctrl-names = "default";
123+
byte-order = <3>;
124+
ahb-buffer-write-flush;
125+
ahb-prefetch;
126+
enable-ahb-write;
127+
128+
psram: memory-controller@0 {
129+
status = "okay";
130+
compatible = "nxp,xspi-psram";
131+
device-name = "w958d6nbkx4l";
132+
size = <DT_SIZE_M(32)>;
133+
reg = <0>;
134+
enable-differential-clk;
135+
sample-clk-source = <3>;
136+
};
137+
};

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu1.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ supported:
1919
- uart
2020
- adc
2121
- i3c
22+
- flash
23+
- memc
2224
vendor: nxp

0 commit comments

Comments
 (0)