Loading Documentation/devicetree/bindings/usb/msm-hsusb.txt +2 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,8 @@ Optional properties : point to external connector device, which provide "USB-HOST" cable events. A single phandle may be specified if a single connector device provides 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. Example HSUSB OTG controller device node : usb@f9690000 { Loading drivers/usb/phy/phy-msm-usb.c +18 −2 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ struct msm_otg_platform_data { bool enable_streaming; bool enable_axi_prefetch; bool vbus_low_as_hostmode; bool phy_id_high_as_peripheral; }; #define SDP_CHECK_DELAY_MS 10000 /* in ms */ Loading Loading @@ -2325,10 +2326,17 @@ static void msm_otg_init_sm(struct msm_otg *motg) else clear_bit(ID, &motg->inputs); } else if (motg->phy_irq) { if (msm_otg_read_phy_id_state(motg)) if (msm_otg_read_phy_id_state(motg)) { set_bit(ID, &motg->inputs); else if (pdata->phy_id_high_as_peripheral) set_bit(B_SESS_VLD, &motg->inputs); } else { clear_bit(ID, &motg->inputs); if (pdata->phy_id_high_as_peripheral) clear_bit(B_SESS_VLD, &motg->inputs); } } } break; Loading Loading @@ -2637,6 +2645,8 @@ static void msm_id_status_w(struct work_struct *w) gpio_direction_input(motg->pdata->switch_sel_gpio); if (!test_and_set_bit(ID, &motg->inputs)) { pr_debug("ID set\n"); if (motg->pdata->phy_id_high_as_peripheral) set_bit(B_SESS_VLD, &motg->inputs); msm_otg_dbg_log_event(&motg->phy, "ID SET", motg->inputs, motg->phy.otg->state); work = 1; Loading @@ -2646,6 +2656,8 @@ static void msm_id_status_w(struct work_struct *w) gpio_direction_output(motg->pdata->switch_sel_gpio, 1); if (test_and_clear_bit(ID, &motg->inputs)) { pr_debug("ID clear\n"); if (motg->pdata->phy_id_high_as_peripheral) clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_dbg_log_event(&motg->phy, "ID CLEAR", motg->inputs, motg->phy.otg->state); work = 1; Loading Loading @@ -3424,6 +3436,10 @@ struct msm_otg_platform_data *msm_otg_dt_to_pdata(struct platform_device *pdev) pdata->vbus_low_as_hostmode = of_property_read_bool(node, "qcom,vbus-low-as-hostmode"); pdata->phy_id_high_as_peripheral = of_property_read_bool(node, "qcom,phy-id-high-as-peripheral"); return pdata; } Loading Loading
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,8 @@ Optional properties : point to external connector device, which provide "USB-HOST" cable events. A single phandle may be specified if a single connector device provides 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. Example HSUSB OTG controller device node : usb@f9690000 { Loading
drivers/usb/phy/phy-msm-usb.c +18 −2 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ struct msm_otg_platform_data { bool enable_streaming; bool enable_axi_prefetch; bool vbus_low_as_hostmode; bool phy_id_high_as_peripheral; }; #define SDP_CHECK_DELAY_MS 10000 /* in ms */ Loading Loading @@ -2325,10 +2326,17 @@ static void msm_otg_init_sm(struct msm_otg *motg) else clear_bit(ID, &motg->inputs); } else if (motg->phy_irq) { if (msm_otg_read_phy_id_state(motg)) if (msm_otg_read_phy_id_state(motg)) { set_bit(ID, &motg->inputs); else if (pdata->phy_id_high_as_peripheral) set_bit(B_SESS_VLD, &motg->inputs); } else { clear_bit(ID, &motg->inputs); if (pdata->phy_id_high_as_peripheral) clear_bit(B_SESS_VLD, &motg->inputs); } } } break; Loading Loading @@ -2637,6 +2645,8 @@ static void msm_id_status_w(struct work_struct *w) gpio_direction_input(motg->pdata->switch_sel_gpio); if (!test_and_set_bit(ID, &motg->inputs)) { pr_debug("ID set\n"); if (motg->pdata->phy_id_high_as_peripheral) set_bit(B_SESS_VLD, &motg->inputs); msm_otg_dbg_log_event(&motg->phy, "ID SET", motg->inputs, motg->phy.otg->state); work = 1; Loading @@ -2646,6 +2656,8 @@ static void msm_id_status_w(struct work_struct *w) gpio_direction_output(motg->pdata->switch_sel_gpio, 1); if (test_and_clear_bit(ID, &motg->inputs)) { pr_debug("ID clear\n"); if (motg->pdata->phy_id_high_as_peripheral) clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_dbg_log_event(&motg->phy, "ID CLEAR", motg->inputs, motg->phy.otg->state); work = 1; Loading Loading @@ -3424,6 +3436,10 @@ struct msm_otg_platform_data *msm_otg_dt_to_pdata(struct platform_device *pdev) pdata->vbus_low_as_hostmode = of_property_read_bool(node, "qcom,vbus-low-as-hostmode"); pdata->phy_id_high_as_peripheral = of_property_read_bool(node, "qcom,phy-id-high-as-peripheral"); return pdata; } Loading