OV7670 in RZ/A2M

Dear all,

I am using RZ/A2M EVB board of Linux 4.19bsp build-root version in which i am trying to  drive OV7670 camera, in my 4.19 bsp i found ceu_example DIR i followed the steps accordingly and the camera worked.

but i want below method to stream the camera in RZ/A2M board

I downloaded OV7670 driver from the github and compiled the driver i found example for configuring ov cameras in r7s72100-streamit.dts file like this

 

ov7740: camera@21 {
compatible = "ovti,ov7740";
reg = <0x21>;

clocks = <&camera_clk>;
clock-names = "xvclk";
assigned-clocks = <&camera_clk>;
assigned-clock-rates = <27000000>;

port {
ov7740_out: endpoint {
remote-endpoint = <&ceu_in>;
};
};
};

then i configured the dts for ov7670 in RZ/A2M  as below 

ov7670: camera@21 {
compatible = "ovti,ov7670";
reg = <0x21>;
clocks = <&extal_clk>;
assigned-clocks = <&extal_clk>;
assigned-clock-rates = <12000000>;

port {
ov7670_out: endpoint {
remote-endpoint = <&ceu_in>;
};
};

};

but i found the there is no ceu label defined in  r7s9210.dtsi

so i defined ceu label as follows

ceu: ceu@e8210000 {
reg = <0xe8210000 0x209c>;
compatible = "renesas,r7s9210-ceu";
interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cpg CPG_MOD 81>;
power-domains = <&cpg>;
status = "disabled";
};

i am getting error like this

ov7670 3-0021: Unsupported media bus type

please help me to resolve this or is there is any way to configure the ov7670 camera in dts file without using cue label so that the driver will be present in /dev eg /dev/video0

 

 

 

 

 

  • The CEU in the RZ/A2M is the same as in the RZ/A1. Make sure you enable CONFIG_VIDEO_RENESAS_CEU=y in the kernel.

    Also, you will probably need to register the CEU clock in the kernel.
    DEF_MOD_STB("ceu", 56, R7S9210_CLK_B),
    in file linux-4.19/drivers/clk/renesas/r7s9210-cpg-mssr.c


    The V4L2 driver for the CEU (/dev/video0) uses a lot of RAM, so you can only capture 1 frame at a time if you are going to use the default configuration (QSPI + HyperRAM). To stream video using the V4L2 driver, you will need to use SDRAM on the board. Those instructions are here: github.com/.../RZA2M_Enable_SDRAM.txt
  • In reply to Chris:

    Hi Chris,

    Thanks for the reply
    i made the following changes as you suggested
    1)enabled CONFIG_VIDEO_RENESAS_CEU=y
    2)made this change DEF_MOD_STB("ceu", 56, R7S9210_CLK_B),
    in file linux-4.19/drivers/clk/renesas/r7s9210-cpg-mssr.c


    in my r7s9210.dtsi file is this correct
    ceu: ceu@e8210000 {
    reg = <0xe8210000 0x209c>;
    compatible = "renesas,r7s9210-ceu";
    interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cpg CPG_MOD 81>;
    power-domains = <&cpg>;
    status = "disabled";
    };

    i am getting following messages after flashing and not able to see video0 in /dev eg:- /dev/video0

    ov7670 3-0021: Unsupported media bus type
    ov7670 3-0021: chip found @ 0x42 (Renesas RIIC adapter)


    when i checked the ov7670 driver i found where the error message is coming

    if (bus_cfg.bus_type != V4L2_MBUS_PARALLEL) {
    dev_err(dev, "Unsupported media bus type\n");
    return ret;
    }
    i'am not understanding plz help on this
  • In reply to mahesh:

    I think you also need to the camera information in the "ceu" device tree node.

    Look at the OV7740 example in the Device Tree for the Renesas Stream-it board.

    github.com/.../r7s72100-streamit.dts

    &ceu {
    pinctrl-names = "default";
    pinctrl-0 = <&vio_pins>;
    status = "okay";

    port {
    ceu_in: endpoint {
    remote-endpoint = <&ov7740_out>;
    hsync-active = <1>;
    vsync-active = <0>;
    };
    };
    };
  • In reply to Chris:

    Hi chris,

    As you suggested i made the following changes DEF_MOD_STB("ceu", 56, R7S9210_CLK_B),
    in file linux-4.19/drivers/clk/renesas/r7s9210-cpg-mssr.c
    like this
    static const struct mssr_mod_clk r7s9210_mod_clks[] __initconst = {
    DEF_MOD_STB("scif4", 43, R7S9210_CLK_P1C),
    DEF_MOD_STB("scif3", 44, R7S9210_CLK_P1C),
    DEF_MOD_STB("scif2", 45, R7S9210_CLK_P1C),
    DEF_MOD_STB("scif1", 46, R7S9210_CLK_P1C),
    DEF_MOD_STB("scif0", 47, R7S9210_CLK_P1C),

    DEF_MOD_STB("ceu", 56, R7S9210_CLK_B),

    but when i do like this even the basic camera is not working without using driver i.e when i run /root/bin/ceu_omni i can see pink image on the screen before it was working fine.

    but i want to run the camera using driver of 0v7670.

    in dts file i made changes like this
    /* RIIC ch3 (Touchscreen, EEPROM) */
    i2c3_pins: i2c3 {
    pinmux = <RZA2_PINMUX(PORTD, 6, 1)>, /* RIIC3SCL */
    <RZA2_PINMUX(PORTD, 7, 1)>, /* RIIC3SDA */
    #if 1
    <RZA2_PINMUX(PORTH, 1, 2)>, /* VIO_D0 */
    <RZA2_PINMUX(PORTH, 0, 2)>, /* VIO_D1 */
    <RZA2_PINMUX(PORTE, 6, 2)>, /* VIO_D2 */
    <RZA2_PINMUX(PORTE, 5, 2)>, /* VIO_D3 */
    <RZA2_PINMUX(PORTE, 4, 2)>, /* VIO_D4 */
    <RZA2_PINMUX(PORTE, 3, 2)>, /* VIO_D5 */
    <RZA2_PINMUX(PORTE, 2, 2)>, /* VIO_D6 */
    <RZA2_PINMUX(PORTE, 1, 2)>, /* VIO_D7 */
    <RZA2_PINMUX(PORT6, 1, 2)>, /* VIO_CLK */
    <RZA2_PINMUX(PORT6, 3, 2)>, /* VIO_HD */
    <RZA2_PINMUX(PORT6, 2, 2)>; /* VIO_VD */
    #endif

    };
    for calling driver i am using like this

    &i2c3 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c3_pins>;

    status = "okay";
    clock-frequency = <400000>;
    #if 1
    ov7670: camera@21 {
    compatible = "ovti,ov7670";
    reg = <0x21>;
    clocks = <&extal_clk>;
    clock-names = "xvclk";
    assigned-clocks = <&extal_clk>;
    assigned-clock-rates = <27000000>;

    port {
    ov7670_out: endpoint {
    remote-endpoint = <&ceu_in>;
    };
    };

    };
    #endif
    };

    &ceu {
    pinctrl-names = "default";
    status = "okay";

    port {
    ceu_in: endpoint {
    remote-endpoint = <&ov7670_out>;
    hsync-active = <1>;
    vsync-active = <0>;
    };
    };
    };

    but, i am getting this error and i am not able to see ant driver registered in /dev eg;- /dev/video0

    2.374032] i2c-riic e803a000.i2c: registered with 400000Hz bus speed
    [ 2.399440] i2c-riic e803ac00.i2c: registered with 400000Hz bus speed
    [ 2.413855] ov7670 3-0021: Unsupported media bus type
    [ 2.464843] ov7670 3-0021: chip found @ 0x42 (Renesas RIIC adapter)


    please help me in resolving this issue its very important to me .
  • In reply to Chris:

    my doubt is this

    ceu: ceu@e8210000 {
    reg = <0xe8210000 0x209c>;
    compatible = "renesas,r7s9210-ceu";
    interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cpg CPG_MOD 81>;
    power-domains = <&cpg>;
    status = "disabled";
    };

    is this correct way of configuring ceu label
  • In reply to mahesh:

    Yes, the device tree is your issue.

    There is no compatible string for RZ/A2 (r7s9210).

    $ grep compatible drivers/media/platform/renesas-ceu.c
           { .compatible = "renesas,r7s72100-ceu", .data = &ceu_data_rz },
           { .compatible = "renesas,r8a7740-ceu", .data = &ceu_data_rz },

     

    However, since the CEU in the RZ/A1 is the same as the RZ/A2, just use the RZ/A1 string.

    Also, the Interrupt vector is wrong. For ARM GIC Linux driver, the interrupt vectors have an offset of 32.

    Also, the clock index was wrong. The CEU clock enable is 56 (not 81)

    ceu: ceu@e8210000 {
    reg = <0xe8210000 0x209c>;
      compatible = "renesas,r7s72100-ceu";
    interrupts = <GIC_SPI (378 - 32) IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cpg CPG_MOD 56>;
    power-domains = <&cpg>;
    status = "disabled";
    };





  • In reply to Chris:

    Hi Chris,

    i tried like this
    ceu: ceu@e8210000 {
    reg = <0xe8210000 0x209c>;
    compatible = "renesas,r7s9210-ceu";
    //compatible = "renesas,r7s72100-ceu";
    interrupts = <GIC_SPI (378-32) IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&cpg CPG_MOD 56>;
    power-domains = <&cpg>;
    status = "disabled";
    };

    but the result is same

    [ 2.407465] ov7670 3-0021: Unsupported media bus type
    [ 2.458640] ov7670 3-0021: chip found @ 0x42 (Renesas RIIC adapter)

    and there is no driver registered in /dev
    $ ls /dev/vcs
    vcs vcs1 vcsa vcsa1 vcsu vcsu1
  • In reply to mahesh:

    Hi Chris,

    Please help me to resolve this issue.
  • In reply to mahesh:

    Hi mahesh,

    Just following up if you were able to solve this issue by this time?

    Herald
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    en-us.knowledgebase.renesas.com/