//EC2X-QuecOpen
//开机切换USB MODE
ql-ol-sdk$vi ql-ol-kernel/arch/arm/boot/dts/qcom/mdm9607.dtsi
//注释掉: //qcom,usbid-gpio = <&pm8019_mpps 1 0>;
//下方输入:qcom,usbid-gpio = <&tlmm_pinmux 76 0>;
//然后
ql-ol-sdk$ vi ql-ol-kernel/drivers/usb/phy/phy-msm-usb.c
//在指定位置键入如下代码
//搜索关键字:USB_PHY_TYPE_USB2
#if 1
if ( motg->pdata->otg_control != OTG_PMIC_CONTROL )
{
if(gpio_is_valid(motg->pdata->usb_id_gpio)){
/* usb_id_gpio request */
ret = gpio_request(motg->pdata->usb_id_gpio,“USB_ID_GPIO”);
if (ret < 0){
dev_err(&pdev->dev,“gpio req failed for id\n”);
motg->pdata->usb_id_gpio = 0;
} else {
gpio_direction_input(motg->pdata->usb_id_gpio);
ret = gpio_get_value(motg->pdata->usb_id_gpio);
if(0 == ret && USB_HOST != motg->pdata->mode ){
motg->pdata->mode = USB_HOST;
}
}
printk(KERN_ALERT “quectel debug usb gpio is %s level, Current is %s MODE\n”,(ret == 0 ? “low” : “high”),(motg->pdata->mode == USB_HOST ? “USB_HOST” : “USB_PERIPHERAL”));
}
}
#endif
//然后重新编译,烧录。
// gpio76,当其电平值为 0 时,在 Bootloader code 中会设置为 USB HOST MODE。
//当其电平值为 1时,在Bootloader code 中会设置为USB PERIPHERAL MODE。
//可通过电脑识别USB设备来区分。