AnsweredAssumed Answered

i.MX7D 24MHz clock output to CCM_CLK1_P pin

Question asked by Rasmus Rahunen on Dec 30, 2016
Latest reply on Jan 4, 2017 by Rasmus Rahunen

Hi,

 

I'm trying to enable 24MHz clock output to i.MX7D CCM_CLK1_P output pin (pin id = Y2). It is going to be used as reference clock to OV5640 camera sensor module. We are using Linux Yocto environment and I would like to know if it is possible to configure this somehow in Linux device tree.

 

I was already able to get the clock working by hard-coding / direct register write to CCM_ANALOG_CLK_MISC0n register (address 0x30360170). When LVDS1_CLK_SEL field is set to 0x15 and LVDSCLK1_OBEN bit is set to 1, the 24MHz clock appears at CCM_CLK1_P pin.

 

But I would assume there is a better and cleaner approach to achieve this. Is it possible to enable 24MHz clock to this pin by making configuration changes to Linux device tree only?

 

I've seen the IMX7D_LVDS1_OUT_SEL and IMX7D_LVDS1_OUT_CLK clocks in imx7d-clock.h file, which could be referenced from the device tree. But I don't know how to make the necessary configuration change.

 

This is how the device tree entry for the OV5640 sensor looks like now, I suspect that the "clocks" entry should be changed somehow perhaps by setting it to IMX7D_LVDS1_OUT_CLK. But how can I adjust the IMX7D_LVDS1_OUT_SEL field so that 24MHz gets selected?:

 

    ov5640_mipi: ov5640_mipi@3c {
        compatible = "ovti,ov5640_mipi";
        reg = <0x3c>;
        clocks = <&clks IMX7D_CLK_DUMMY>;
        clock-names = "csi_mclk";

 

        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>;
            };
        };
    };

 

Any advice on this? Is it possible via device tree, or do I need to handle this in code?

 

Best regards,

Rasmus Rahunen

Outcomes