Hi Igor,
Thank you for this advice. I managed to get it working with your help!
Here is the device tree node for the OV5640, I've highlighted the important changes in red color:
ov5640_mipi: ov5640_mipi@3c {
compatible = "ovti,ov5640_mipi";
reg = <0x3c>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_camera>;
clocks = <&clks IMX7D_LVDS1_OUT_CLK>;
clock-names = "csi_mclk";
assigned-clocks = <&clks IMX7D_LVDS1_OUT_SEL>, <&clks IMX7D_OSC_24M_CLK>;
assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
csi_id = <0>;
pwn-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
AVDD-supply = <&vgen6_reg>;
mclk = <24000000>;
mclk_source = <0>;
port {
ov5640_mipi_ep: endpoint {
remote-endpoint = <&mipi_sensor_ep>;
};
};
};
In addition I had to make one small tweak to the arch/arm/mach-imx/clk-imx7d.c file. By default it doesn't support all available clock output options that are defined in i.MX7D reference manual for the LVDS1_CLK_SEL field and I had to add a few entries to the lvds1_sel array, so that the 24MHz clock ("osc") is defined in the array index 0x15:
static const char *lvds1_sel[] = { "pll_arm_main_clk",
"pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_sys_pfd1_332m_clk",
"pll_sys_pfd2_270m_clk", "pll_sys_pfd3_clk", "pll_sys_pfd4_clk",
"pll_sys_pfd5_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk",
"pll_audio_post_div", "pll_video_post_div", "pll_enet_500m_clk",
"pll_enet_250m_clk", "pll_enet_125m_clk", "pll_enet_100m_clk",
"pll_enet_50m_clk", "pll_enet_40m_clk", "pll_enet_25m_clk",
"pll_dram_main_clk", "UNDEFINED_CLOCK", "osc" };
With these two changes, the 24MHz clock appears at the CCM_CLK1_P output pin.
Best regards,
Rasmus