From patchwork Fri Feb 5 19:17:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 61347 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp149189lbl; Fri, 5 Feb 2016 11:17:21 -0800 (PST) X-Received: by 10.67.2.10 with SMTP id bk10mr21751002pad.26.1454699841330; Fri, 05 Feb 2016 11:17:21 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wu1si25565102pab.71.2016.02.05.11.17.21; Fri, 05 Feb 2016 11:17:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752895AbcBETRT (ORCPT + 7 others); Fri, 5 Feb 2016 14:17:19 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:35925 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbcBETRR (ORCPT ); Fri, 5 Feb 2016 14:17:17 -0500 Received: by mail-wm0-f48.google.com with SMTP id p63so40078892wmp.1 for ; Fri, 05 Feb 2016 11:17:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=20b31QPX9BZZP59z0IeWixbfBCMQAqrmCfE/928Dw2o=; b=MBV90ls4RZkCraptJfpjrpvh1bo9Zf6h59y9p6/GWnkO/31cYoEslEs3oLVIfC5RTX kxx8u9ORQ1V0xjQ2hH9mjvoxu7OxiEIi34ejifu5oPzdtEQ+xgNOj04faF30uR95DTzY DDXoTXXrqepUHf8MTVQxijTsQI8r/LARXO+zc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=20b31QPX9BZZP59z0IeWixbfBCMQAqrmCfE/928Dw2o=; b=HjBdsAcaPhGFQsd3Ki59Pi4vKiQCHV+bgul32oQY1yWUs6lzB/g3j8qxXIefiU3qHX ZU0g2A8Gsz+iO7L7hN0ECeTWqTwoj+exZ2lKxuC068q1banuRgWr/NZNTUwtHf9Zei0m dUx8zll8XSRjjMu14vVdYY0UUIheWDbIRGOJ61rxJe/5p65t9WaAwXw5shfkicC8bEOq hdPZAPLn02CGXPOPqiwKS/dLNdctC5OHBh/iwDgEWnVLEeXFLqQ6qBduBLQGzT/6x/SA RrDfoB9Rtz2TFBP7zp7bI4rJ9NrdiIRx7+EDsi3nZF4G0i1WV3XwK7nAmZ9k9fzezumb U7rQ== X-Gm-Message-State: AG10YOQvnmG2hJaMlq/F46M9vDYbR2acSJd2Bmdr3HESG9ZN8U3BxgKQdw/AjOZ7u6GBpA7B X-Received: by 10.28.222.68 with SMTP id v65mr18656698wmg.66.1454699836856; Fri, 05 Feb 2016 11:17:16 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id c136sm55028wmd.3.2016.02.05.11.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Feb 2016 11:17:16 -0800 (PST) From: Srinivas Kandagatla To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Felipe Balbi , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, "Ivan T. Ivanov" , Srinivas Kandagatla Subject: [PATCH] usb: phy: msm: Trigger USB state detection work in DRD mode Date: Fri, 5 Feb 2016 19:17:09 +0000 Message-Id: <1454699829-20324-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: "Ivan T. Ivanov" When working in Dual Role Device mode, USB state machine is not kicked, when host or gadget drivers are loaded. Fix this be explicitly triggering state detection on client driver load. Issue is that if the board is booted without micro usb cable and usb device attached, kernel fails to populate the usb host and device. The reason for this is that the state machine worker logic only checks for USB_DR_MODE_PERIPHERAL and USB_DR_MODE_HOST modes to run worker thread. However if the phy is configured in OTG mode it would fail to run the state machine, resulting in failure to detect for very first time. This patch fixes the issue by removing the explicit checks. Issue is noticed on Qualcomm Dragon board DB410C. [srinivas.kandagatla@linaro.org: Added more details to log] Signed-off-by: Ivan T. Ivanov Signed-off-by: Srinivas Kandagatla --- drivers/usb/phy/phy-msm-usb.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 970a30e..72b387d 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -757,14 +757,8 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) otg->host = host; dev_dbg(otg->usb_phy->dev, "host driver registered w/ tranceiver\n"); - /* - * Kick the state machine work, if peripheral is not supported - * or peripheral is already registered with us. - */ - if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) { - pm_runtime_get_sync(otg->usb_phy->dev); - schedule_work(&motg->sm_work); - } + pm_runtime_get_sync(otg->usb_phy->dev); + schedule_work(&motg->sm_work); return 0; } @@ -827,14 +821,8 @@ static int msm_otg_set_peripheral(struct usb_otg *otg, dev_dbg(otg->usb_phy->dev, "peripheral driver registered w/ tranceiver\n"); - /* - * Kick the state machine work, if host is not supported - * or host is already registered with us. - */ - if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) { - pm_runtime_get_sync(otg->usb_phy->dev); - schedule_work(&motg->sm_work); - } + pm_runtime_get_sync(otg->usb_phy->dev); + schedule_work(&motg->sm_work); return 0; }