I try to Enable OV5640 on Banana Pi M64 too;used armbian with kernel 5.10; but when kernel start OV5640 has an error
[ 6.771712] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Mar 30 2016 11:30:56 version 7.45.77.h8.4 FWID 01-ee8a6268
[ 7.185164] ov5640 1-003c: ov5640_read_reg: error: reg=300a
[ 7.185180] ov5640 1-003c: ov5640_set_power_on: failed to read chip identifier
[ 7.904788] Adding 985724k swap on /dev/zram0. Priority:5 extents:1 across:985724k SSFS
[ 9.133355] zram1: detected capacity change from 0 to 52428800
I added this to sun50i-a64-bananapi-m64.dts:
i2c-csi {
compatible = "i2c-gpio";
sda-gpios = <&pio 4 13 GPIO_ACTIVE_HIGH>; /* PE13 */
scl-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>; /* PE12 */
i2c-gpio,delay-us = <5>;
#address-cells = <1>;
#size-cells = <0>;
ov5640: camera@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
pinctrl-names = "default";
pinctrl-0 = <&csi_mclk_pin>;
clocks = <&ccu CLK_CSI_MCLK>;
clock-names = "xclk";
AVDD-supply = <®_dldo3>;
DOVDD-supply = <®_aldo1>;
DVDD-supply = <®_eldo3>;
reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* PE17 */
port {
ov5640_ep: endpoint {
remote-endpoint = <&csi_ep>;
bus-width = <8>;
hsync-active = <1>; /* Active high */
vsync-active = <0>; /* Active low */
data-active = <1>; /* Active high */
pclk-sample = <1>; /* Rising */
};
};
};
};
&csi {
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
csi_ep: endpoint {
remote-endpoint = <&ov5640_ep>;
bus-width = <8>;
hsync-active = <1>; /* Active high */
vsync-active = <0>; /* Active low */
data-active = <1>; /* Active high */
pclk-sample = <1>; /* Rising */
};
};
};
and try change I2C to:
sda-gpios = <&pio 4 13 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN|GPIO_PULL_UP)>; /* CSI0-SDA: PE13 */
scl-gpios = <&pio 4 12 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN|GPIO_PULL_UP)>; /* CSI0-SCK: PE12 */
but the result is the same
I just check my I2C setting,it seems right
root@bananapim64:~# cat /boot/config-`uname -r` | grep I2C | grep GPIO
CONFIG_I2C_ARB_GPIO_CHALLENGE=m
CONFIG_I2C_MUX_GPIO=m
CONFIG_I2C_CBUS_GPIO=m
CONFIG_I2C_GPIO=m
# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set
# I2C GPIO expanders
# end of I2C GPIO expanders
also I have add sun6i_csi and ov5640
root@bananapim64:~# lsmod|grep ov
ov5640 28672 1
v4l2_fwnode 24576 2 ov5640,sun6i_csi
videodev 233472 9 sunxi_cedrus,sun8i_rotate,v4l2_fwnode,ov5640,videobuf2_v4l2,sun8i_di,sun6i_csi,videobuf2_common,v4l2_mem2mem
mc 49152 7 sunxi_cedrus,videodev,ov5640,videobuf2_v4l2,sun6i_csi,videobuf2_common,v4l2_mem2mem
root@bananapim64:~# dmesg | grep sun6i-csi
[ 5.985118] sun6i-csi 1cb0000.csi: creating ov5640 1-003c:0 -> sun6i-csi:0 link
root@bananapim64:~#