Play Transfer Far SC60 Android Development Board ------ (6) Remove the PMI chip

The SC60 module uses the Qualcomm MSM8953 chip, and the corresponding power chips used are PM8953 and PMI632.
PM8953 includes the following functions:
 ◆ Input power management
 ◆ Output power management
 ◆ General HK
 ◆ Audio
 ◆ IC interfaces
 ◆ Configurable pins: either multipurpose pins (MPPs) or general-purpose input/output (GPIOs)
and PMI632 mainly includes the following functions:
 ◆ Switching charger
 ◆ Qualcomm battery gauge
 ◆ Type-C and Micro USB connectors support
 ◆ Quick Charge 2.0 and Quick Charge 3.0 support
 ◆ Battery current limiting (BCL) module
 ◆ General housekeeping
 ◆ Analog to digital converter (ADC)
 ◆ Battery interface module (BIM )
 ◆ Red, green, blue (RGB) LED drivers, PBS pattern generator(PPG)
 ◆ Vibrator driver
 ◆ Qualcomm® camera flash
 ◆ LCD bias
 ◆ HR-LED
 ◆ GPIOs that can be configured to function within some of the other categories
  when not using charging, FG fuel gauge, charging instructions, flash drive, backlight drive, motor drive, Under the premise of battery ID and battery temperature detection, the PMI chip can be removed.

  The main modification here is USB. There is a PMI module by default, and the vbus pin is connected to the PMI side. Now you need to connect to the GPIO-7 of PM8953 for vbus insertion detection, and use GPIO_1 of MSM8953 for USB ID detection. The reference picture is as follows:
Insert picture description here
USB3.0 master-slave device detection is achieved by controlling USB_ID through CC1 and CC2, and then outputting through USB_ID, notifying GPIO_1 to achieve: When the device is inserted, USB_ID will output low level, and after GPIO_1 is received, the module will be notified to enter Host mode; if the OTG function is not required, the USB_ID pin can be left floating.

The driver modification is mainly to increase the extcon1 node.

//stone added for usb-detect
&soc {
    
    
	usb_detect {
    
    
		compatible = "linux,extcon-usb-gpio";
		vbus-gpio = <&pm8953_gpios 7 GPIO_ACTIVE_HIGH>;

		pinctrl-names = "default";
		pinctrl-0 = <&usb2_vbus_det_default>;
	};
};

&pm8953_gpios {
    
    
//shiyan added for usb-detect
	gpio@c600 {
    
     
		qcom,mode = <0>; 
		qcom,vin-sel = <3>; /*reference voltage 1.8v*/ 
		qcom,src-sel = <0>; 
		qcom,pull = <5>; /*no pull. */ 
		qcom,master-en = <1>; 
		status = "okay"; 
	}; 
	usb2_vbus_det {
    
    
		usb2_vbus_det_default: usb2_vbus_det_default {
    
    
			pins = "gpio7";
			function = "normal";
			input-enable;
			bias-pull-down;
			power-source = <1>;	/* VPH input supply */
		};
	};
};

+//stone added for usb-detect 3
+&soc {
    
    
+	usb_detect: usb_detect {
    
    
+		compatible = "linux,extcon-usb-gpio";
+		vbus-gpio = <&pm8953_gpios 7 GPIO_ACTIVE_HIGH>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb2_vbus_det_default>;
+	};
+};
+
+&soc {
    
    
+	id_detect: id_detect {
    
    
+		compatible = "linux,extcon-usb-gpio";
+		id-gpio = <&tlmm 1 GPIO_ACTIVE_HIGH>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&id_gpio_detect>;
+	};
+};
+
+//stone added for usb-detect 4
+&usb3 {
    
    
+	extcon1 = <&usb_detect>, <&id_detect>;
+	//if we only need support MicroUSB
+	//qcom,connector-type-uAB;
+};
+

The corresponding driver is in
kernel/msm-4.9/drivers/extcon/extcon-usb-gpio.c
kernel/msm-4.9/drivers/extcon/extcon.c
kernel/msm-4.9/drivers/usb/dwc3/dwc3-msm. c The new extcon1 is used here, which also needs to be modified:

+#ifdef CONFIG_EXTCON_USB_GPIO
+	if (of_property_read_bool(node, "extcon1"))
+	{
    
    
+		if (of_count_phandle_with_args(node, "extcon1", NULL) > start_idx + 1) {
    
    
+			edev = extcon_get_edev_by_phandle(mdwc->dev, start_idx + 1);
+			if (IS_ERR(edev) && PTR_ERR(edev) != -ENODEV) {
    
    
+				ret = PTR_ERR(edev);
+				goto err;
+			}
+		}
+	}
+
+	else
+	{
    
    
+		if (of_count_phandle_with_args(node, "extcon", NULL) > start_idx + 1) {
    
    
+			edev = extcon_get_edev_by_phandle(mdwc->dev, start_idx + 1);
+			if (IS_ERR(edev) && PTR_ERR(edev) != -ENODEV) {
    
    
+				ret = PTR_ERR(edev);
+				goto err;
+			}
+		}
+	}
+#else
 	if (of_count_phandle_with_args(node, "extcon", NULL) > start_idx + 1) {
    
    
 		edev = extcon_get_edev_by_phandle(mdwc->dev, start_idx + 1);
 		if (IS_ERR(edev) && PTR_ERR(edev) != -ENODEV) {
    
    
@@ -3090,6 +3117,7 @@ static int dwc3_msm_extcon_register(struct dwc3_msm *mdwc, int start_idx)
 			goto err;
 		}
 	}
+#endif

After the above configuration, using the extcon driver, the vbus insertion interrupt can be detected normally, and the device and otg modes of usb2.0 and type-C are normal.

Guess you like

Origin blog.csdn.net/cornerstone1/article/details/113250875