Skip to content

Commit

Permalink
boards: nxp: frdm_mcnx947: add support for SMARTDMA camera engine
Browse files Browse the repository at this point in the history
Add support for SMARTDMA camera engine, and a OV7670 parallel camera
definition for the frdm_mcnx947 board. This support has been tested with
the video capture sample.

Signed-off-by: Daniel DeGrasse <[email protected]>
  • Loading branch information
danieldegrasse committed Oct 7, 2024
1 parent 8f8aaa8 commit d9189a9
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
13 changes: 13 additions & 0 deletions boards/nxp/frdm_mcxn947/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,19 @@ static int frdm_mcxn947_init(void)
enable_cache64();
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smartdma))
CLOCK_EnableClock(kCLOCK_Smartdma);
RESET_PeripheralReset(kSMART_DMA_RST_SHIFT_RSTn);
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(video_sdma))
/* Drive CLKOUT from PLL0, divided by 27 to yield ~5.5MHz clock
* The camera will use this clock signal to generate
* PCLK, HSYNC, and VSYNC
*/
SYSCON->CLKOUTSEL = 0x1;
SYSCON->CLKOUTDIV = 26;
#endif
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vref))
CLOCK_EnableClock(kCLOCK_Vref);
SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref);
Expand Down
25 changes: 25 additions & 0 deletions boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,31 @@
};
};

pinmux_smartdma_camera: pinmux_smartdma_camera {
group0 {
/*
* SmartDMA pinmux is not defined by SOC header, so
* we encode it manually
*/
pinmux = <N9X_MUX('1',4,7)>,
<N9X_MUX('1',5,7)>,
<N9X_MUX('1',6,7)>,
<N9X_MUX('1',7,7)>,
<N9X_MUX('3',4,7)>,
<N9X_MUX('3',5,7)>,
<N9X_MUX('1',10,7)>,
<N9X_MUX('1',11,7)>,
<PIO0_4>,
<PIO0_5>,
<PIO0_11>,
<CLKOUT_PIO2_2>,
<CLKOUT_PIO0_6>;
drive-strength = "low";
slew-rate = "fast";
input-enable;
};
};

pinmux_usdhc0: pinmux_usdhc0 {
group0 {
pinmux = <SDHC0_CMD_PIO2_5>,
Expand Down
22 changes: 22 additions & 0 deletions boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,28 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 {
pinctrl-0 = <&pinmux_flexcomm7_lpi2c>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_STANDARD>;
ov7670: ov7670@21 {
compatible = "ovti,ov7670";
reset-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
reg = <0x21>;
};
};

/* SmartDMA is used for video driver on this board */
&smartdma {
status = "okay";
program-mem = <0x4000000>;
video_sdma: video-sdma {
status = "okay";
compatible = "nxp,video-smartdma";
pinctrl-0 = <&pinmux_smartdma_camera>;
pinctrl-names = "default";
sensor = <&ov7670>;
vsync-pin = <4>;
hsync-pin = <11>;
pclk-pin = <5>;
};
};

/*
Expand Down

0 comments on commit d9189a9

Please sign in to comment.