From 15ade055295d13f95d49e3d99b09f3bbfb4a43e7 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 06 Nov 2023 07:25:24 +0000
Subject: [PATCH] add at24 driver

---
 kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi |  304 ++++++++++++++++++++++++++------------------------
 1 files changed, 158 insertions(+), 146 deletions(-)

diff --git a/kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi b/kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi
old mode 100755
new mode 100644
index 9424547..f45ce09
--- a/kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi
+++ b/kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi
@@ -15,13 +15,6 @@
 	model = "Rockchip RK3568 EVB1 DDR4 V10 Board";
 	compatible = "rockchip,rk3568-evb1-ddr4-v10", "rockchip,rk3568";
 
-	rk_headset: rk-headset {
-		compatible = "rockchip_headset";
-		headset_gpio = <&gpio0 RK_PD5 GPIO_ACTIVE_LOW>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&hp_det>;
-	};
-
 	vcc2v5_sys: vcc2v5-ddr {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc2v5-sys";
@@ -32,6 +25,15 @@
 		vin-supply = <&vcc3v3_sys>;
 	};
 
+	vcc3v3_vga: vcc3v3-vga {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3_vga";
+		regulator-always-on;
+		regulator-boot-on;
+		gpio = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+		vin-supply = <&vcc3v3_sys>;
+	};
 
 	pcie30_avdd0v9: pcie30-avdd0v9 {
 		compatible = "regulator-fixed";
@@ -83,42 +85,107 @@
 		enable-active-high;
 		regulator-always-on;
 		regulator-boot-on;
-    	};
+	};
 #endif
 
-	    nk_io_init {
-                compatible = "nk_io_control";
-//				usb_en_oc_gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;  //USB_EN_OC_GPIO0_A5
-				lcd_bk_en_gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; //LCD0_BKLT_EN_3V3
-				lcd_pwblk_gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;  //LCD0_BKLT_EN_3V3
-				vcc3_io_en_gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; //VCC3_IO_EN_GPIO0_C4_3V3
-                hub_host2_5V_rest_gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; //HUB_RST_GPIO4_D2_3V3
-                hub_host3_5v_gpio = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>; //HOST3_EN_GPIO4_B2_1V8
-//              hub_host3_5V_rest_gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; 
-                vcc_5v_io = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;   //VCC5_IO_EN_GPIO1_A4_3V3
-                vcc_12v_io = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; //VCC12_IO_EN_GPIO0_C7_3V3
-                en_4g_gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; //4G_PWREN_H_GPIO0_C6
-                reset_4g_gpio = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; //4G_RST_GPIO01_B2_3V3
-                air_mode_4g_gpio = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; //4G_AIR_MODE_GPIO01_B0_3V3
-                wake_4g_gpio = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>; //4G_WAKEUP_GPIO01_B1_3V3
-				hp_en_gpio = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;//HP_EN_GPIO3_A6_3V3
-                spk_out_gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;//AMP_SD_GPIO4_C2_3V3
-				
-				edp_enable_gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
-                edp_gpio0 = <&gpio3 RK_PD2 GPIO_ACTIVE_HIGH>; //7511_GPIO0-GPIO3_D2
-				edp_gpio1 = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; //7511_GPIO1-GPIO3_D3
-				edp_gpio2 = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; //7511_GPIO2-GPIO3_D4
-				edp_gpio3 = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; //7511_GPIO3-GPIO3_D5
-                edp_reset = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; //7511_RST_GPIO3_D1
-//              tp_reset = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>;
-//              vddio_mipi = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
-		
-				wifi_power_en_gpio = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; //WIFI_PWREN_GPIO3_C6_1V8
-
-				pinctrl-names = "default";
-				pinctrl-0 = <&nk_io_gpio>;
-				nodka_lvds = <9>;
-        };
+	ndj_io_init {
+         	compatible = "nk_io_control";	
+			pinctrl-names = "default";
+        	pinctrl-0 = <&nk_io_gpio>;
+			
+			//gpio_op0 = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
+			
+			vcc_5v {
+				gpio_num = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>; //VCC5_IO_EN_GPIO1_A4_3V3
+				gpio_function = <0>;	
+			};
+			
+			vcc_12v {
+				gpio_num = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;  //VCC12_IO_EN_GPIO0_C7_3V3
+				gpio_function = <0>;
+			};
+			
+			hub_host2_rst {
+				gpio_num = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;  //HUB_RST_GPIO4_D2_3V3
+				gpio_function = <3>;
+			};
+			
+			hub_host3 {
+				gpio_num = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>; //HOST3_EN_GPIO4_B2_1V8
+				gpio_function = <0>;
+			};
+			
+			wake_4g {
+				gpio_num = <&gpio1 RK_PB1 GPIO_ACTIVE_LOW>; //4G_WAKEUP_GPIO01_B1_3V3
+				gpio_function = <0>;
+			};
+			
+			air_mode_4g {
+				gpio_num = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>; //4G_AIR_MODE_GPIO01_B0_3V3
+				gpio_function = <0>;
+			};
+			
+			reset_4g {
+				gpio_num = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>; //4G_RST_GPIO01_B2_3V3
+				gpio_function = <3>;
+			};
+			
+			en_4g {
+				gpio_num = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; //4G_PWREN_H_GPIO0_C6
+				gpio_function = <0>;
+			};
+			
+			hp_en {
+				gpio_num = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;//HP_EN_GPIO3_A6_3V3
+				gpio_function = <0>;
+			};
+			
+			wifi_power_en {
+				gpio_num = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; //WIFI_PWREN_GPIO3_C6_1V8
+				gpio_function = <0>;
+			};
+	#if 0		
+			do1 {
+				gpio_num = <&gpio1 RK_PD0 GPIO_ACTIVE_LOW>; 
+				gpio_function = <0>;
+			};
+			
+			do2 {
+				gpio_num = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
+				gpio_function = <0>;
+			};
+			
+			do3 {
+				gpio_num = <&gpio1 RK_PD1 GPIO_ACTIVE_HIGH>;
+				gpio_function = <0>;
+			};
+			
+			do4 {
+				gpio_num = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
+				gpio_function = <0>;
+			};
+			
+			do5 {
+				gpio_num = <&gpio2 RK_PD6 GPIO_ACTIVE_LOW>; 
+				gpio_function = <0>;
+			};
+			
+			do6 {
+				gpio_num = <&gpio2 RK_PD7 GPIO_ACTIVE_LOW>; 
+				gpio_function = <0>;
+			};
+			
+			do7 {
+				gpio_num = <&gpio3 RK_PA0 GPIO_ACTIVE_LOW>; 
+				gpio_function = <0>;
+			};
+			
+			di1 {
+				gpio_num = <&gpio2 RK_PD5 GPIO_ACTIVE_HIGH>;
+				gpio_function = <1>;
+			};
+	#endif
+};
 };
 
 &combphy0_us {
@@ -134,11 +201,11 @@
 };
 
 &csi2_dphy_hw {
-	status = "okay";
+	status = "disabled";
 };
 
 &csi2_dphy0 {
-	status = "okay";
+	status = "disabled";
 
 	ports {
 		#address-cells = <1>;
@@ -182,7 +249,7 @@
  * when dsi0 is enabled
  */
 &dsi0 {
-	status = "okay";
+	status = "disabled";
 };
 
 &dsi0_in_vp0 {
@@ -190,7 +257,7 @@
 };
 
 &dsi0_in_vp1 {
-	status = "okay";
+	status = "disabled";
 };
 
 &dsi0_panel {
@@ -296,24 +363,8 @@
 	power-supply = <&vcc3v3_lcd0_n>;
 };
 
-&i2c3 {
-	status = "okay";
-       //mac eeprom
-        eeprom@51 {
-                //compatible = "atmel,24c02";
-                compatible = "atmel,24c256";
-                reg = <0x51>;
-        };
-	
-	  //nk-mcu
-        nkmcu@15 {
-                compatible = "nk_mcu";
-                reg = <0x15>;
-        };
-};
-
 &i2c4 {
-	status = "okay";
+	status = "disabled";
 	gc8034: gc8034@37 {
 		compatible = "galaxycore,gc8034";
 		status = "okay";
@@ -359,7 +410,7 @@
 		};
 	};
 	ov5695: ov5695@36 {
-		status = "okay";
+		status = "disabled";
 		compatible = "ovti,ov5695";
 		reg = <0x36>;
 		clocks = <&cru CLK_CIF_OUT>;
@@ -382,19 +433,6 @@
 	};
 };
 
-&i2c5 {
-	status = "okay";
-
-	hym8563: hym8563@51 {
-		compatible = "haoyu,hym8563";
-		reg = <0x51>;
-		#clock-cells = <0>;
-		clock-frequency = <32768>;
-		clock-output-names = "xin32k";
-		/* rtc_int is not connected */
-	};
-};
-
 &mdio0 {
 	rgmii_phy0: phy@0 {
 		compatible = "ethernet-phy-ieee802.3-c22";
@@ -410,7 +448,7 @@
 };
 
 &video_phy0 {
-	status = "okay";
+	status = "disabled";
 };
 
 &video_phy1 {
@@ -428,30 +466,31 @@
 };
 
 &pinctrl {
-//	cam {
-//		camera_pwr: camera-pwr {
-//			rockchip,pins =
-//				/* camera power en */
-//				<0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
-//		};
-//	};
+	cam {
+		camera_pwr: camera-pwr {
+			rockchip,pins =
+				/* camera power en */
+				<0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
 	headphone {
 		hp_det: hp-det {
-			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_down>;
+			rockchip,pins = <3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
 		};
 	};
 
 	wireless-wlan {
 		wifi_host_wake_irq: wifi-host-wake-irq {
-			rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>;
+			rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_down>;
 		};
 	};
 
 	wireless-bluetooth {
-		uart1_gpios: uart1-gpios {
-			rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
+		uart8_gpios: uart8-gpios {
+			rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
+	
 	nk_io_init{
 		nk_io_gpio: nk-io-gpio{
 			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
@@ -461,27 +500,34 @@
 							<4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>,
 							<1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>,
 							<0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>,
-							<1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>,
+							<1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>, 
 							<1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
 							<1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>,
 							<3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>,
-							<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>,
 							<3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>,
 							<3 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>,
 							<3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>,
 							<3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>,
 							<3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>,
+							<2 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>,//93 SPI2_CS0_M1_3V3
+							<2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>,//94 SPI2_MOSI_M1_3V3
+							<2 RK_PD7 RK_FUNC_GPIO &pcfg_pull_none>,//95 SPI2_MISO_M1_3V3
+							<3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>,//96 SPI2_CLK_M1_3V3
 							<0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
 };
 
+&rk809_sound {
+	hp-det-gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
+};
+
 &rkisp {
-	status = "okay";
+	status = "disabled";
 };
 
 &rkisp_mmu {
-	status = "okay";
+	status = "disabled";
 };
 
 &rkisp_vir0 {
@@ -499,7 +545,7 @@
 };
 
 &route_dsi0 {
-	status = "okay";
+	status = "disabled";
 	connect = <&vp1_out_dsi0>;
 };
 
@@ -513,23 +559,19 @@
 };
 
 &sdmmc2 {
-        status = "disabled";
-};
-
-&sdmmc1 {
-        max-frequency = <150000000>;
-        supports-sdio;
-        bus-width = <4>;
-        disable-wp;
-        cap-sd-highspeed;
-        cap-sdio-irq;
-        keep-power-in-suspend;
-        mmc-pwrseq = <&sdio_pwrseq>;
-        non-removable;
-        pinctrl-names = "default";
-        pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
-        sd-uhs-sdr104;
-        status = "okay";
+	max-frequency = <150000000>;
+	supports-sdio;
+	bus-width = <4>;
+	disable-wp;
+	cap-sd-highspeed;
+	cap-sdio-irq;
+	keep-power-in-suspend;
+	mmc-pwrseq = <&sdio_pwrseq>;
+	non-removable;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>;
+	sd-uhs-sdr104;
+	status = "okay";
 };
 
 &spdif_8ch {
@@ -539,13 +581,13 @@
 };
 
 &uart8 {
-	status = "disabled";
+	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart8m0_xfer &uart8m0_ctsn>;
 };
 
 &vcc3v3_lcd0_n {
-	gpio = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
+	gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
 	enable-active-high;
 };
 
@@ -557,7 +599,7 @@
 &wireless_wlan {
 	pinctrl-names = "default";
 	pinctrl-0 = <&wifi_host_wake_irq>;
-	WIFI,host_wake_irq = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>;
+	WIFI,host_wake_irq = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>;
 };
 
 &wireless_bluetooth {
@@ -565,42 +607,12 @@
 	clocks = <&rk809 1>;
 	clock-names = "ext_clock";
 	//wifi-bt-power-toggle;
-	uart_rts_gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
-	BT,power_gpio = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
+	uart_rts_gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;
 	pinctrl-names = "default", "rts_gpio";
-	pinctrl-0 = <&uart1m0_rtsn>;
-	pinctrl-1 = <&uart1_gpios>;
+	pinctrl-0 = <&uart8m0_rtsn>;
+	pinctrl-1 = <&uart8_gpios>;
 	BT,reset_gpio    = <&gpio3 RK_PA0 GPIO_ACTIVE_HIGH>;
 	BT,wake_gpio     = <&gpio3 RK_PA2 GPIO_ACTIVE_HIGH>;
 	BT,wake_host_irq = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>;
-	status = "disabled";
-};
-
-&uart0 {
 	status = "okay";
-};
-
-&uart3 {
-	status = "okay";
-	pinctrl-0 = <&uart3m1_xfer>;
-};
-
-&uart4 {
-	status = "okay";
-	pinctrl-0 = <&uart4m1_xfer>;
-};
-
-&uart5 {
-	status = "okay";
-	pinctrl-0 = <&uart5m1_xfer>;
-};
-
-&uart7 {
-	status = "okay";
-	pinctrl-0 = <&uart7m1_xfer>;
-};
-
-&uart9 {
-	status = "okay";
-	pinctrl-0 = <&uart9m1_xfer>;
 };

--
Gitblit v1.6.2