From 89e9f58c817a3c2b2ed4f4c363cd90bf5d1fea0a Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Tue, 23 Nov 2021 20:08:18 +0800
Subject: [PATCH] update linux patch for ov5640 dts, ov5640 can work normal on 64x480

---
 bsp/kernel/patch/linux-imx-imx6ull.patch |  157 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 99 insertions(+), 58 deletions(-)

diff --git a/bsp/kernel/patch/linux-imx-imx6ull.patch b/bsp/kernel/patch/linux-imx-imx6ull.patch
index e1b5193..9d5f14f 100644
--- a/bsp/kernel/patch/linux-imx-imx6ull.patch
+++ b/bsp/kernel/patch/linux-imx-imx6ull.patch
@@ -1,6 +1,6 @@
 diff -Nuar -x include-prefixes -x logo_linux_clut224.ppm linux-imx/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi linux-imx-imx6ull/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi
 --- linux-imx/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi	2021-09-08 18:41:11.000000000 +0800
-+++ linux-imx-imx6ull/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi	2021-11-20 00:00:25.765567396 +0800
++++ linux-imx-imx6ull/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi	2021-11-23 19:58:00.218178392 +0800
 @@ -31,7 +31,41 @@
  		brightness-levels = <0 4 8 16 32 64 128 255>;
  		default-brightness-level = <6>;
@@ -65,7 +65,32 @@
  		/*
  		 * If you want to want to make this dynamic please
  		 * check schematics and test all affected peripherals:
-@@ -142,7 +173,7 @@
+@@ -78,6 +109,24 @@
+ 		gpios = <&gpio_spi 3 GPIO_ACTIVE_LOW>;
+ 	};
+ 
++	reg_3p3v: 3p3v {
++		compatible = "regulator-fixed";
++		regulator-name = "3P3V";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++		regulator-boot-on;
++		regulator-always-on;
++	};
++
++	reg_1p8v: 1p8v {
++		compatible = "regulator-fixed";
++		regulator-name = "1P8V";
++		regulator-min-microvolt = <1800000>;
++		regulator-max-microvolt = <1800000>;
++		regulator-boot-on;
++		regulator-always-on;
++	};
++
+ 	sound {
+ 		compatible = "simple-audio-card";
+ 		simple-audio-card,name = "mx6ul-wm8960";
+@@ -142,7 +191,7 @@
  		compatible = "spi-gpio";
  		pinctrl-names = "default";
  		pinctrl-0 = <&pinctrl_spi4>;
@@ -74,7 +99,16 @@
  		pinctrl-assert-gpios = <&gpio5 8 GPIO_ACTIVE_LOW>;
  		gpio-sck = <&gpio5 11 0>;
  		gpio-mosi = <&gpio5 10 0>;
-@@ -184,6 +215,26 @@
+@@ -169,7 +218,7 @@
+ };
+ 
+ &csi {
+-	status = "disabled";
++	status = "okay";
+ 
+ 	port {
+ 		csi1_ep: endpoint {
+@@ -184,6 +233,26 @@
  	pinctrl-0 = <&pinctrl_i2c2>;
  	status = "okay";
  
@@ -101,7 +135,7 @@
  	codec: wm8960@1a {
  		#sound-dai-cells = <0>;
  		compatible = "wlf,wm8960";
-@@ -192,7 +243,8 @@
+@@ -192,7 +261,8 @@
  		wlf,hp-cfg = <3 2 3>;
  		wlf,gpio-cfg = <1 3>;
  		clocks = <&clks IMX6UL_CLK_SAI2>;
@@ -111,22 +145,43 @@
  	};
  
  	ov5640: ov5640@3c {
-@@ -221,7 +273,9 @@
- 	pinctrl-0 = <&pinctrl_enet1>;
+@@ -202,12 +272,19 @@
+ 		pinctrl-0 = <&pinctrl_csi1>;
+ 		clocks = <&clks IMX6UL_CLK_CSI>;
+ 		clock-names = "csi_mclk";
+-		pwn-gpios = <&gpio_spi 6 1>;
+-		rst-gpios = <&gpio_spi 5 0>;
++
++		DOVDD-supply = <&reg_3p3v>;
++		VDD-supply = <&reg_1p8v>;
++		AVDD-supply = <&reg_3p3v>;
++		DVDD-supply = <&reg_3p3v>;
++
++        pwn-gpios = <&gpio5 6 GPIO_ACTIVE_HIGH>;
++        rst-gpios = <&gpio5 5 GPIO_ACTIVE_LOW>;
+ 		csi_id = <0>;
+ 		mclk = <24000000>;
+ 		mclk_source = <0>;
+-		status = "disabled";
++        /* rotation = <180>; */
++		status = "okay";
+ 		port {
+ 			ov5640_ep: endpoint {
+ 				remote-endpoint = <&csi1_ep>;
+@@ -222,6 +299,9 @@
  	phy-mode = "rmii";
  	phy-handle = <&ethphy0>;
--	phy-supply = <&reg_peri_3v3>;
+ 	phy-supply = <&reg_peri_3v3>;
 +    phy-reset-gpios = <&gpio5 7 GPIO_ACTIVE_LOW>; /* MX6UL_PAD_SNVS_TAMPER7__GPIO5_IO07 conflict with spi4 */
 +    phy-reset-duration = <50>;
 +    phy-reset-post-delay = <15>;
  	status = "okay";
  };
  
-@@ -230,15 +284,17 @@
- 	pinctrl-0 = <&pinctrl_enet2>;
+@@ -231,14 +311,17 @@
  	phy-mode = "rmii";
  	phy-handle = <&ethphy1>;
--	phy-supply = <&reg_peri_3v3>;
+ 	phy-supply = <&reg_peri_3v3>;
 +    phy-reset-gpios = <&gpio5 4 GPIO_ACTIVE_LOW>; /* MX6UL_PAD_SNVS_TAMPER4__GPIO5_IO04 conflict with sai2 */
 +    phy-reset-duration = <50>;
 +    phy-reset-post-delay = <15>;
@@ -143,7 +198,7 @@
  			micrel,led-mode = <1>;
  			clocks = <&clks IMX6UL_CLK_ENET_REF>;
  			clock-names = "rmii-ref";
-@@ -301,21 +357,21 @@
+@@ -301,21 +384,21 @@
  
  	display0: display@0 {
  		bits-per-pixel = <16>;
@@ -175,7 +230,7 @@
  				hsync-active = <0>;
  				vsync-active = <0>;
  				de-active = <1>;
-@@ -332,6 +388,13 @@
+@@ -332,6 +415,13 @@
  	status = "okay";
  };
  
@@ -189,7 +244,7 @@
  &pxp {
  	status = "okay";
  };
-@@ -339,7 +402,7 @@
+@@ -339,7 +429,7 @@
  &qspi {
  	pinctrl-names = "default";
  	pinctrl-0 = <&pinctrl_qspi>;
@@ -198,7 +253,7 @@
  
  	flash0: n25q256a@0 {
  		#address-cells = <1>;
-@@ -360,7 +423,7 @@
+@@ -360,7 +450,7 @@
  	assigned-clock-parents = <&clks IMX6UL_CLK_PLL4_AUDIO_DIV>;
  	assigned-clock-rates = <0>, <12288000>;
  	fsl,sai-mclk-direction-output;
@@ -207,7 +262,7 @@
  };
  
  &snvs_poweroff {
-@@ -439,6 +502,7 @@
+@@ -439,6 +529,7 @@
  	pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
  	pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
  	cd-gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
@@ -215,7 +270,7 @@
  	keep-power-in-suspend;
  	wakeup-source;
  	vmmc-supply = <&reg_sd1_vmmc>;
-@@ -446,8 +510,8 @@
+@@ -446,8 +537,8 @@
  };
  
  &usdhc2 {
@@ -226,7 +281,7 @@
  	non-removable;
  	keep-power-in-suspend;
  	wakeup-source;
-@@ -463,6 +527,25 @@
+@@ -463,6 +554,25 @@
  &iomuxc {
  	pinctrl-names = "default";
  
@@ -252,15 +307,15 @@
  	pinctrl_csi1: csi1grp {
  		fsl,pins = <
  			MX6UL_PAD_CSI_MCLK__CSI_MCLK		0x1b088
-@@ -490,6 +573,7 @@
+@@ -490,6 +600,7 @@
  			MX6UL_PAD_ENET1_TX_DATA0__ENET1_TDATA00	0x1b0b0
  			MX6UL_PAD_ENET1_TX_DATA1__ENET1_TDATA01	0x1b0b0
  			MX6UL_PAD_ENET1_TX_CLK__ENET1_REF_CLK1	0x4001b031
-+			MX6UL_PAD_SNVS_TAMPER7__GPIO5_IO07	0x10B0 /* ENET1 RESET conflict with pinctrl_spi4 */
++			MX6UL_PAD_SNVS_TAMPER7__GPIO5_IO07	    0x10B0 /* ENET1 RESET conflict with pinctrl_spi4 */
  		>;
  	};
  
-@@ -505,6 +589,7 @@
+@@ -505,6 +616,7 @@
  			MX6UL_PAD_ENET2_TX_DATA0__ENET2_TDATA00	0x1b0b0
  			MX6UL_PAD_ENET2_TX_DATA1__ENET2_TDATA01	0x1b0b0
  			MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2	0x4001b031
@@ -268,7 +323,7 @@
  		>;
  	};
  
-@@ -594,19 +679,18 @@
+@@ -594,19 +706,18 @@
  			MX6UL_PAD_JTAG_TRST_B__SAI2_TX_DATA	0x11088
  			MX6UL_PAD_JTAG_TCK__SAI2_RX_DATA	0x11088
  			MX6UL_PAD_JTAG_TMS__SAI2_MCLK		0x17088
@@ -292,7 +347,7 @@
  		>;
  	};
  
-@@ -625,7 +709,6 @@
+@@ -625,7 +736,6 @@
  		fsl,pins = <
  			MX6UL_PAD_BOOT_MODE0__GPIO5_IO10	0x70a1
  			MX6UL_PAD_BOOT_MODE1__GPIO5_IO11	0x70a1
@@ -300,7 +355,7 @@
  			MX6UL_PAD_SNVS_TAMPER8__GPIO5_IO08	0x80000000
  		>;
  	};
-@@ -678,9 +761,7 @@
+@@ -678,9 +788,7 @@
  			MX6UL_PAD_SD1_DATA1__USDHC1_DATA1 	0x17059
  			MX6UL_PAD_SD1_DATA2__USDHC1_DATA2 	0x17059
  			MX6UL_PAD_SD1_DATA3__USDHC1_DATA3 	0x17059
@@ -313,7 +368,7 @@
  
 diff -Nuar -x include-prefixes -x logo_linux_clut224.ppm linux-imx/arch/arm/boot/dts/imx6ul.dtsi linux-imx-imx6ull/arch/arm/boot/dts/imx6ul.dtsi
 --- linux-imx/arch/arm/boot/dts/imx6ul.dtsi	2021-09-08 18:41:11.000000000 +0800
-+++ linux-imx-imx6ull/arch/arm/boot/dts/imx6ul.dtsi	2021-11-18 23:10:08.149821196 +0800
++++ linux-imx-imx6ull/arch/arm/boot/dts/imx6ul.dtsi	2021-11-23 19:45:27.875382794 +0800
 @@ -727,6 +727,7 @@
  					offset = <0x34>;
  					interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
@@ -324,8 +379,8 @@
  				snvs_poweroff: snvs-poweroff {
 diff -Nuar -x include-prefixes -x logo_linux_clut224.ppm linux-imx/.cfg-imx6ull linux-imx-imx6ull/.cfg-imx6ull
 --- linux-imx/.cfg-imx6ull	1970-01-01 08:00:00.000000000 +0800
-+++ linux-imx-imx6ull/.cfg-imx6ull	2021-11-19 23:56:45.007385743 +0800
-@@ -0,0 +1,6833 @@
++++ linux-imx-imx6ull/.cfg-imx6ull	2021-11-23 20:06:37.849363291 +0800
+@@ -0,0 +1,6819 @@
 +#
 +# Automatically generated file; DO NOT EDIT.
 +# Linux/arm 5.10.52 Kernel Configuration
@@ -3508,9 +3563,9 @@
 +#
 +# Webcam devices
 +#
-+CONFIG_USB_VIDEO_CLASS=m
++CONFIG_USB_VIDEO_CLASS=y
 +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
-+CONFIG_USB_GSPCA=m
++CONFIG_USB_GSPCA=y
 +# CONFIG_USB_M5602 is not set
 +# CONFIG_USB_STV06XX is not set
 +# CONFIG_USB_GL860 is not set
@@ -3605,22 +3660,7 @@
 +# CONFIG_USB_HACKRF is not set
 +# CONFIG_USB_MSI2500 is not set
 +# CONFIG_MEDIA_PCI_SUPPORT is not set
-+CONFIG_RADIO_ADAPTERS=y
-+# CONFIG_RADIO_SI470X is not set
-+# CONFIG_RADIO_SI4713 is not set
-+CONFIG_RADIO_SI476X=y
-+# CONFIG_USB_MR800 is not set
-+# CONFIG_USB_DSBR is not set
-+# CONFIG_RADIO_MAXIRADIO is not set
-+# CONFIG_RADIO_SHARK is not set
-+# CONFIG_RADIO_SHARK2 is not set
-+# CONFIG_USB_KEENE is not set
-+# CONFIG_USB_RAREMONO is not set
-+# CONFIG_USB_MA901 is not set
-+# CONFIG_RADIO_TEA5764 is not set
-+# CONFIG_RADIO_SAA7706H is not set
-+# CONFIG_RADIO_TEF6862 is not set
-+# CONFIG_RADIO_WL1273 is not set
++# CONFIG_RADIO_ADAPTERS is not set
 +CONFIG_VIDEOBUF2_CORE=y
 +CONFIG_VIDEOBUF2_V4L2=y
 +CONFIG_VIDEOBUF2_MEMOPS=y
@@ -3631,28 +3671,29 @@
 +# CONFIG_VIDEO_CADENCE is not set
 +# CONFIG_VIDEO_ASPEED is not set
 +CONFIG_VIDEO_MUX=y
-+CONFIG_VIDEO_MXC_CAPTURE=m
++CONFIG_VIDEO_MXC_CAPTURE=y
 +# CONFIG_VIDEO_MX8_CAPTURE is not set
 +CONFIG_VIDEO_MXC_OUTPUT=y
-+CONFIG_VIDEO_V4L2_MXC_INT_DEVICE=m
-+CONFIG_VIDEO_MXC_CSI_CAMERA=m
-+CONFIG_MXC_VADC=m
-+CONFIG_MXC_MIPI_CSI=m
++CONFIG_VIDEO_V4L2_MXC_INT_DEVICE=y
++CONFIG_VIDEO_MXC_CSI_CAMERA=y
++CONFIG_MXC_VADC=y
++CONFIG_MXC_MIPI_CSI=y
 +
 +#
 +# MXC Camera/V4L2 PRP Features support
 +#
 +CONFIG_VIDEO_MXC_IPU_CAMERA=y
-+CONFIG_MXC_CAMERA_OV5640=m
-+CONFIG_MXC_CAMERA_OV5640_V2=m
++# CONFIG_MXC_CAMERA_OV5640 is not set
++CONFIG_MXC_CAMERA_OV5640_V2=y
 +# CONFIG_MXC_CAMERA_OV5642 is not set
-+CONFIG_MXC_CAMERA_OV5640_MIPI=m
-+CONFIG_MXC_CAMERA_OV5640_MIPI_V2=m
++# CONFIG_MXC_CAMERA_OV5640_MIPI is not set
++CONFIG_MXC_CAMERA_OV5640_MIPI_V2=y
 +# CONFIG_MXC_CAMERA_OV5647_MIPI is not set
-+CONFIG_MXC_TVIN_ADV7180=m
-+CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m
-+CONFIG_MXC_IPU_PRP_ENC=m
-+CONFIG_MXC_IPU_CSI_ENC=m
++# CONFIG_MXC_TVIN_ADV7180 is not set
++CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y
++# CONFIG_MXC_IPU_PRP_VF_SDC is not set
++CONFIG_MXC_IPU_PRP_ENC=y
++CONFIG_MXC_IPU_CSI_ENC=y
 +# end of MXC Camera/V4L2 PRP Features support
 +
 +CONFIG_VIDEO_MXC_IPU_OUTPUT=y
@@ -7161,7 +7202,7 @@
 +# end of Kernel hacking
 diff -Nuar -x include-prefixes -x logo_linux_clut224.ppm linux-imx/Makefile linux-imx-imx6ull/Makefile
 --- linux-imx/Makefile	2021-09-08 18:41:11.000000000 +0800
-+++ linux-imx-imx6ull/Makefile	2021-11-19 23:54:49.744292020 +0800
++++ linux-imx-imx6ull/Makefile	2021-11-23 19:58:23.629972395 +0800
 @@ -367,7 +367,8 @@
  # Alternatively CROSS_COMPILE can be set in the environment.
  # Default value for CROSS_COMPILE is not to prefix executables

--
Gitblit v1.9.1