Loading Documentation/devicetree/bindings/usb/msm-hsusb.txt +2 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,8 @@ Optional properties : both "USB" and "USB-HOST" events. - qcom,phy-id-high-as-peripheral: If present, specifies device to switch to device mode if PHY ID state is high or host mode if PHY ID state is low. - qcom,enumeration-check-for-sdp: If present, start timer for SDP charger to check enumeration happen or not. Example HSUSB OTG controller device node : usb@f9690000 { Loading arch/arm64/boot/dts/qcom/msm8909w.dtsi +5 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -75,6 +75,10 @@ }; }; &usb_otg { qcom,enumeration-check-for-sdp; }; &qcom_crypto { qcom,msm-bus,vectors-KBps = <55 512 0 0>, Loading drivers/usb/gadget/ci13xxx_udc.c +2 −0 Original line number Diff line number Diff line Loading @@ -400,7 +400,9 @@ static int hw_device_state(u32 dma) hw_cwrite(CAP_USBINTR, ~0, USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); hw_cwrite(CAP_USBCMD, USBCMD_RS, USBCMD_RS); udc->transceiver->flags |= PHY_SOFT_CONNECT; } else { udc->transceiver->flags &= ~PHY_SOFT_CONNECT; hw_cwrite(CAP_USBCMD, USBCMD_RS, 0); hw_cwrite(CAP_USBINTR, ~0, 0); /* Clear BIT(31) to disable AHB2AHB Bypass functionality */ Loading drivers/usb/phy/phy-msm-usb.c +21 −11 Original line number Diff line number Diff line Loading @@ -218,6 +218,7 @@ struct msm_otg_platform_data { }; #define SDP_CHECK_DELAY_MS 10000 /* in ms */ #define SDP_CHECK_BOOT_DELAY_MS 30000 /* in ms */ #define MSM_USB_BASE (motg->regs) #define MSM_USB_PHY_CSR_BASE (motg->phy_csr_regs) Loading Loading @@ -1919,13 +1920,14 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned int mA) motg->chg_type); psy_type = get_psy_type(motg); if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT) { if (!mA) if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT || (psy_type == POWER_SUPPLY_TYPE_USB && motg->enable_sdp_check_timer)) { if (!mA) { pval.intval = -ETIMEDOUT; else pval.intval = 1000 * mA; goto set_prop; } } if (motg->cur_power == mA) return; Loading Loading @@ -2775,7 +2777,7 @@ static void check_for_sdp_connection(struct work_struct *w) struct msm_otg *motg = container_of(w, struct msm_otg, sdp_check.work); /* Cable disconnected or device enumerated as SDP */ if (!motg->vbus_state || motg->phy.otg->gadget->state >= if (!motg->vbus_state || motg->phy.otg->gadget->state > USB_STATE_DEFAULT) return; Loading Loading @@ -2856,13 +2858,18 @@ static void msm_otg_sm_work(struct work_struct *w) break; } if (get_psy_type(motg) == POWER_SUPPLY_TYPE_USB_FLOAT) queue_delayed_work(motg->otg_wq, &motg->sdp_check, msecs_to_jiffies(SDP_CHECK_DELAY_MS)); pm_runtime_get_sync(otg->usb_phy->dev); msm_otg_start_peripheral(otg, 1); if (get_psy_type(motg) == POWER_SUPPLY_TYPE_USB_FLOAT || (get_psy_type(motg) == POWER_SUPPLY_TYPE_USB && motg->enable_sdp_check_timer)) { queue_delayed_work(motg->otg_wq, &motg->sdp_check, msecs_to_jiffies( (phy->flags & PHY_SOFT_CONNECT) ? SDP_CHECK_DELAY_MS : SDP_CHECK_BOOT_DELAY_MS)); } otg->state = OTG_STATE_B_PERIPHERAL; } else { pr_debug("Cable disconnected\n"); Loading Loading @@ -4116,6 +4123,9 @@ static int msm_otg_probe(struct platform_device *pdev) of_property_read_u32(pdev->dev.of_node, "qcom,pm-qos-latency", &motg->pm_qos_latency); motg->enable_sdp_check_timer = of_property_read_bool(pdev->dev.of_node, "qcom,enumeration-check-for-sdp"); pdata = msm_otg_dt_to_pdata(pdev); if (!pdata) { ret = -ENOMEM; Loading include/linux/usb/msm_hsusb.h +2 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * * Copyright (C) 2008 Google, Inc. * Author: Brian Swetland <swetland@google.com> * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2009-2019, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and Loading Loading @@ -319,6 +319,7 @@ struct msm_otg { struct work_struct notify_charger_work; struct work_struct extcon_register_work; struct notifier_block psy_nb; bool enable_sdp_check_timer; }; struct ci13xxx_platform_data { Loading Loading
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,8 @@ Optional properties : both "USB" and "USB-HOST" events. - qcom,phy-id-high-as-peripheral: If present, specifies device to switch to device mode if PHY ID state is high or host mode if PHY ID state is low. - qcom,enumeration-check-for-sdp: If present, start timer for SDP charger to check enumeration happen or not. Example HSUSB OTG controller device node : usb@f9690000 { Loading
arch/arm64/boot/dts/qcom/msm8909w.dtsi +5 −1 Original line number Diff line number Diff line /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -75,6 +75,10 @@ }; }; &usb_otg { qcom,enumeration-check-for-sdp; }; &qcom_crypto { qcom,msm-bus,vectors-KBps = <55 512 0 0>, Loading
drivers/usb/gadget/ci13xxx_udc.c +2 −0 Original line number Diff line number Diff line Loading @@ -400,7 +400,9 @@ static int hw_device_state(u32 dma) hw_cwrite(CAP_USBINTR, ~0, USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); hw_cwrite(CAP_USBCMD, USBCMD_RS, USBCMD_RS); udc->transceiver->flags |= PHY_SOFT_CONNECT; } else { udc->transceiver->flags &= ~PHY_SOFT_CONNECT; hw_cwrite(CAP_USBCMD, USBCMD_RS, 0); hw_cwrite(CAP_USBINTR, ~0, 0); /* Clear BIT(31) to disable AHB2AHB Bypass functionality */ Loading
drivers/usb/phy/phy-msm-usb.c +21 −11 Original line number Diff line number Diff line Loading @@ -218,6 +218,7 @@ struct msm_otg_platform_data { }; #define SDP_CHECK_DELAY_MS 10000 /* in ms */ #define SDP_CHECK_BOOT_DELAY_MS 30000 /* in ms */ #define MSM_USB_BASE (motg->regs) #define MSM_USB_PHY_CSR_BASE (motg->phy_csr_regs) Loading Loading @@ -1919,13 +1920,14 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned int mA) motg->chg_type); psy_type = get_psy_type(motg); if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT) { if (!mA) if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT || (psy_type == POWER_SUPPLY_TYPE_USB && motg->enable_sdp_check_timer)) { if (!mA) { pval.intval = -ETIMEDOUT; else pval.intval = 1000 * mA; goto set_prop; } } if (motg->cur_power == mA) return; Loading Loading @@ -2775,7 +2777,7 @@ static void check_for_sdp_connection(struct work_struct *w) struct msm_otg *motg = container_of(w, struct msm_otg, sdp_check.work); /* Cable disconnected or device enumerated as SDP */ if (!motg->vbus_state || motg->phy.otg->gadget->state >= if (!motg->vbus_state || motg->phy.otg->gadget->state > USB_STATE_DEFAULT) return; Loading Loading @@ -2856,13 +2858,18 @@ static void msm_otg_sm_work(struct work_struct *w) break; } if (get_psy_type(motg) == POWER_SUPPLY_TYPE_USB_FLOAT) queue_delayed_work(motg->otg_wq, &motg->sdp_check, msecs_to_jiffies(SDP_CHECK_DELAY_MS)); pm_runtime_get_sync(otg->usb_phy->dev); msm_otg_start_peripheral(otg, 1); if (get_psy_type(motg) == POWER_SUPPLY_TYPE_USB_FLOAT || (get_psy_type(motg) == POWER_SUPPLY_TYPE_USB && motg->enable_sdp_check_timer)) { queue_delayed_work(motg->otg_wq, &motg->sdp_check, msecs_to_jiffies( (phy->flags & PHY_SOFT_CONNECT) ? SDP_CHECK_DELAY_MS : SDP_CHECK_BOOT_DELAY_MS)); } otg->state = OTG_STATE_B_PERIPHERAL; } else { pr_debug("Cable disconnected\n"); Loading Loading @@ -4116,6 +4123,9 @@ static int msm_otg_probe(struct platform_device *pdev) of_property_read_u32(pdev->dev.of_node, "qcom,pm-qos-latency", &motg->pm_qos_latency); motg->enable_sdp_check_timer = of_property_read_bool(pdev->dev.of_node, "qcom,enumeration-check-for-sdp"); pdata = msm_otg_dt_to_pdata(pdev); if (!pdata) { ret = -ENOMEM; Loading
include/linux/usb/msm_hsusb.h +2 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * * Copyright (C) 2008 Google, Inc. * Author: Brian Swetland <swetland@google.com> * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2009-2019, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and Loading Loading @@ -319,6 +319,7 @@ struct msm_otg { struct work_struct notify_charger_work; struct work_struct extcon_register_work; struct notifier_block psy_nb; bool enable_sdp_check_timer; }; struct ci13xxx_platform_data { Loading