Skip to content

Commit 041f286

Browse files
KATE-WANG-NXPkartben
authored andcommitted
boards: nxp: add configuration for MIPI-DSI and LCDIF on mimxrt700_evk
1.Add clock configuration for DCNano LCDIF video and command mode. 2.Update board dts file Signed-off-by: Kate Wang <yumeng.wang@nxp.com>
1 parent 560b8ba commit 041f286

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

boards/nxp/mimxrt700_evk/board.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,62 @@ void board_early_init_hook(void)
441441
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sc_timer), okay)
442442
CLOCK_AttachClk(kFRO0_DIV6_to_SCT);
443443
#endif
444+
445+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lcdif), nxp_dcnano_lcdif, okay) && \
446+
CONFIG_DISPLAY
447+
/* Assert LCDIF reset. */
448+
RESET_SetPeripheralReset(kLCDIF_RST_SHIFT_RSTn);
449+
450+
/* Disable media main and LCDIF power down. */
451+
POWER_DisablePD(kPDRUNCFG_SHUT_MEDIA_MAINCLK);
452+
POWER_DisablePD(kPDRUNCFG_APD_LCDIF);
453+
POWER_DisablePD(kPDRUNCFG_PPD_LCDIF);
454+
455+
/* Apply power down configuration. */
456+
POWER_ApplyPD();
457+
458+
CLOCK_AttachClk(kMAIN_PLL_PFD2_to_LCDIF);
459+
/* Note- pixel clock follows formula
460+
* (height VSW VFP VBP) * (width HSW HFP HBP) * frame rate.
461+
* this means the clock divider will vary depending on
462+
* the attached display.
463+
*
464+
* The root clock used here is the main PLL (PLL PFD2).
465+
*/
466+
CLOCK_SetClkDiv(
467+
kCLOCK_DivLcdifClk,
468+
(CLOCK_GetMainPfdFreq(kCLOCK_Pfd2) /
469+
DT_PROP(DT_CHILD(DT_NODELABEL(lcdif), display_timings), clock_frequency)));
470+
471+
CLOCK_EnableClock(kCLOCK_Lcdif);
472+
473+
/* Clear LCDIF reset. */
474+
RESET_ClearPeripheralReset(kLCDIF_RST_SHIFT_RSTn);
475+
#endif
476+
477+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lcdif), nxp_mipi_dbi_dcnano_lcdif, okay)
478+
/* Assert LCDIF reset. */
479+
RESET_SetPeripheralReset(kLCDIF_RST_SHIFT_RSTn);
480+
481+
/* Disable media main and LCDIF power down. */
482+
POWER_DisablePD(kPDRUNCFG_SHUT_MEDIA_MAINCLK);
483+
POWER_DisablePD(kPDRUNCFG_APD_LCDIF);
484+
POWER_DisablePD(kPDRUNCFG_PPD_LCDIF);
485+
486+
/* Apply power down configuration. */
487+
POWER_ApplyPD();
488+
489+
/* Calculate the divider for MEDIA MAIN clock source main pll pfd2. */
490+
CLOCK_InitMainPfd(kCLOCK_Pfd2, (uint64_t)CLOCK_GetMainPllFreq() * 18UL /
491+
DT_PROP(DT_NODELABEL(lcdif), clock_frequency));
492+
CLOCK_SetClkDiv(kCLOCK_DivMediaMainClk, 1U);
493+
CLOCK_AttachClk(kMAIN_PLL_PFD2_to_MEDIA_MAIN);
494+
495+
CLOCK_EnableClock(kCLOCK_Lcdif);
496+
497+
/* Clear LCDIF reset. */
498+
RESET_ClearPeripheralReset(kLCDIF_RST_SHIFT_RSTn);
499+
#endif
444500
}
445501

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

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
zephyr,sram = &sram0;
3131
zephyr,console = &flexcomm0_lpuart0;
3232
zephyr,shell-uart = &flexcomm0_lpuart0;
33+
zephyr,display = &lcdif;
3334
};
3435

3536
leds {
@@ -57,6 +58,35 @@
5758
zephyr,code = <INPUT_KEY_1>;
5859
};
5960
};
61+
62+
/*
63+
* This node describes the GPIO pins of the MIPI FPC interface,
64+
* J50 on the EVK. This interface is standard to several
65+
* NXP EVKs, and is used with several MIPI displays
66+
* (available as zephyr shields)
67+
*/
68+
nxp_mipi_connector: mipi-connector {
69+
compatible = "gpio-nexus";
70+
#gpio-cells = <2>;
71+
gpio-map-mask = <0xffffffff 0xffffffc0>;
72+
gpio-map-pass-thru = <0 0x3f>;
73+
gpio-map = <0 0 &gpio1 14 0>, /* Pin 1, LEDK */
74+
<21 0 &gpio3 4 0>, /* Pin 21, RESET */
75+
<22 0 &gpio3 5 0>, /* Pin 22, LPTE */
76+
<26 0 &gpio0 6 0>, /* Pin 26, CTP_I2C SDA */
77+
<27 0 &gpio0 7 0>, /* Pin 27, CTP_I2C SCL */
78+
<28 0 &gpio3 8 0>, /* Pin 28, CTP_RST */
79+
<29 0 &gpio1 13 0>, /* Pin 29, CTP_INT */
80+
<32 0 &gpio1 10 0>, /* Pin 32, PWR_EN */
81+
<34 0 &gpio1 14 0>; /* Pin 34, BL_PWM */
82+
};
83+
84+
en_mipi_display: enable-mipi-display {
85+
compatible = "regulator-fixed";
86+
regulator-name = "en_mipi_display";
87+
enable-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
88+
regulator-boot-on;
89+
};
6090
};
6191

6292
&ctimer0 {
@@ -107,6 +137,12 @@
107137
clock-frequency = <I2C_BITRATE_STANDARD>;
108138
};
109139

140+
nxp_mipi_i2c: &flexcomm8_lpi2c8 {};
141+
142+
zephyr_mipi_dsi: &mipi_dsi {};
143+
144+
zephyr_lcdif: &lcdif {};
145+
110146
&gpio0 {
111147
status = "okay";
112148
};
@@ -115,6 +151,14 @@
115151
status = "okay";
116152
};
117153

154+
&gpio2 {
155+
status = "okay";
156+
};
157+
158+
&gpio3 {
159+
status = "okay";
160+
};
161+
118162
&green_led {
119163
status = "okay";
120164
};

0 commit comments

Comments
 (0)