From patchwork Wed Dec 28 22:57:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 89212 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp5738982qgi; Wed, 28 Dec 2016 14:57:57 -0800 (PST) X-Received: by 10.84.232.198 with SMTP id x6mr46368477plm.8.1482965877045; Wed, 28 Dec 2016 14:57:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si51337689pga.8.2016.12.28.14.57.56; Wed, 28 Dec 2016 14:57:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752395AbcL1W5q (ORCPT + 4 others); Wed, 28 Dec 2016 17:57:46 -0500 Received: from mail-pg0-f47.google.com ([74.125.83.47]:36106 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752393AbcL1W5p (ORCPT ); Wed, 28 Dec 2016 17:57:45 -0500 Received: by mail-pg0-f47.google.com with SMTP id f188so159841113pgc.3 for ; Wed, 28 Dec 2016 14:57:45 -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:in-reply-to:references; bh=mYTMjkxQAIcQAHkHVOczbaXgnAaS+k4HcwrihiqCEJY=; b=cE/F5be+wblmXbUmMaB+K0QaI452KPlQ9YVVg2tnNvkM+DLo68hfNTgSRfL+HV7A0d rlr71uDB5avMesWthuokNr6gcRhk9pLAHgwD+RWChoHlhG8ppiXTaPWiNIsS6OkGY18o HFBqCjdyg2UJ4lxnjKyoyuV18y8GjnqIZX7fE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mYTMjkxQAIcQAHkHVOczbaXgnAaS+k4HcwrihiqCEJY=; b=Fl3u43XIp8016VYFQc3NzqJ0eZYTA5D715TKk4OQxgq7Sce6rJa71u2ZV3hq+TQB7p cXxDCL9rTb9VmxVQT+ViBaggKLoF8zyLmehZOiyoqpZj9pqwEOfQ00/a/2xH3tgO6qPc /vBirupGMkA/oLMW45vHieK6YHPf+WbHdmkF6rBSXXQts0IWha9flJNlgr0fHq3JBkLM mOaSKC4GS8g34LhbaUvAUoJ5HTQdF+wWd5mdkoE3FSa/NgbjGqBtg5hL9uScaoaUh9MK pVgpTisUX3c3EnUvg7QL6X0MkYJvuHNAIDsc/Fh6EevQuVaVw1J6KqHoFJ2AqAITjTuf VkuA== X-Gm-Message-State: AIkVDXLHByJgbv8RYVCzofa1I7vU5oJXxTptit3siVnQ4LadxSf+zXdd6zItGQgWGmKd8+wS X-Received: by 10.84.218.204 with SMTP id g12mr80792740plm.78.1482965859740; Wed, 28 Dec 2016 14:57:39 -0800 (PST) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id x4sm100355741pgc.14.2016.12.28.14.57.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Dec 2016 14:57:39 -0800 (PST) From: Stephen Boyd To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson , Neil Armstrong , Arnd Bergmann , Felipe Balbi , Peter Chen , Greg Kroah-Hartman Subject: [PATCH v6 23/25] usb: chipidea: Pullup D+ in device mode via phy APIs Date: Wed, 28 Dec 2016 14:57:09 -0800 Message-Id: <20161228225711.698-24-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.10.0.297.gf6727b0 In-Reply-To: <20161228225711.698-1-stephen.boyd@linaro.org> References: <20161228225711.698-1-stephen.boyd@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If the phy supports it, call phy_set_mode() to pull up D+ when required by setting the mode to PHY_MODE_USB_DEVICE. If we want to remove the pullup, set the mode to PHY_MODE_USB_HOST. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/udc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.10.0.297.gf6727b0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" 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/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 0d532a724d48..6d61fa0689b0 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1609,10 +1610,15 @@ static int ci_udc_pullup(struct usb_gadget *_gadget, int is_on) return 0; pm_runtime_get_sync(&ci->gadget.dev); - if (is_on) + if (is_on) { + if (ci->phy) + phy_set_mode(ci->phy, PHY_MODE_USB_DEVICE); hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); - else + } else { hw_write(ci, OP_USBCMD, USBCMD_RS, 0); + if (ci->phy) + phy_set_mode(ci->phy, PHY_MODE_USB_HOST); + } pm_runtime_put_sync(&ci->gadget.dev); return 0;