From patchwork Wed Jan 25 22:32:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9538067 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3A3D4601D7 for ; Wed, 25 Jan 2017 22:33:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B9F927F17 for ; Wed, 25 Jan 2017 22:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2033227F8F; Wed, 25 Jan 2017 22:33:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C37127F17 for ; Wed, 25 Jan 2017 22:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbdAYWdP (ORCPT ); Wed, 25 Jan 2017 17:33:15 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:34776 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752325AbdAYWdO (ORCPT ); Wed, 25 Jan 2017 17:33:14 -0500 Received: by mail-pf0-f180.google.com with SMTP id e4so60918036pfg.1 for ; Wed, 25 Jan 2017 14:33:03 -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=YuavNoEAfO0fLGx0kc21BcS+m4ga3n37NQtIH3imtrM=; b=Sd1e3MP4yJTHjpCm6m9WpceGWFFqmmBtnwyKHO1RW4L1KIhoq399wDdyEHlwQ8XNsH uNvUKkkX3VnCxg4jkqvMCrTL7ZCbQS4/nZmQh85hXvEr6NE9kf+9dTy9U9qO6ckHu4TS QubRjZw1+WcsMJQtv9dXPWxlic8C8YPzheQgQ= 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=YuavNoEAfO0fLGx0kc21BcS+m4ga3n37NQtIH3imtrM=; b=N/dnU1B+ydw7Jzxouw4Vbik8YHClx5z0qbwjfoSDHTR/2w28IE4qFMsKaxXePO/hBz 8kSn1gAao2jYwYuR66yhisPLVvJpahKAxSRom3rRv3XxONViiblXkbZnf4eBOMZm26Hx Uukxkp6UQ22F5kexAXVf4koefEccUduy5ilt28/Kdof5YUHU50M0gwLu3Qx0LXQ607M0 m/yomFhM1t8YwTly4/9d3uFVM1BO7prNB8y2PTCuZYIG8/aTwP0l5lgY5kQROWkAJQm7 SNnmMeVAbUek3DON1PSzw4o6jA/JOntwWmXYkmnRc5S9qbYv+BnCgrwkhZsk3TmQJDTC 45XA== X-Gm-Message-State: AIkVDXLrZT+twApSRo6vgbyk82B+c8VVIR42KQoToBPeAUhsfpor+urN1R3fiUsZMGKAjwJp X-Received: by 10.99.245.21 with SMTP id w21mr1771320pgh.117.1485383568356; Wed, 25 Jan 2017 14:32:48 -0800 (PST) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id k78sm3411637pfb.93.2017.01.25.14.32.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 14:32:47 -0800 (PST) From: Stephen Boyd To: Peter Chen Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, Andy Gross , Bjorn Andersson , Neil Armstrong , Arnd Bergmann , Felipe Balbi , Kishon Vijay Abraham I , Greg Kroah-Hartman Subject: [PATCH v8 1/3] usb: chipidea: Configure phy for appropriate mode Date: Wed, 25 Jan 2017 14:32:43 -0800 Message-Id: <20170125223245.2688-2-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.10.0.297.gf6727b0 In-Reply-To: <20170125223245.2688-1-stephen.boyd@linaro.org> References: <20170125223245.2688-1-stephen.boyd@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the qcom chipidea controller is used with an extcon, we need to signal device mode or host mode to the phy so it can configure itself for the correct mode. This should be done after the phy is powered up, so that the register writes work correctly. Add in the appropriate phy_set_mode() call here. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 802ca253cf6d..fc3b9e07aa81 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -428,13 +428,21 @@ void ci_platform_configure(struct ci_hdrc *ci) is_device_mode = hw_read(ci, OP_USBMODE, USBMODE_CM) == USBMODE_CM_DC; is_host_mode = hw_read(ci, OP_USBMODE, USBMODE_CM) == USBMODE_CM_HC; - if (is_device_mode && - (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)) - hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); + if (is_device_mode) { + phy_set_mode(ci->phy, PHY_MODE_USB_DEVICE); - if (is_host_mode && - (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)) - hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); + if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING) + hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, + USBMODE_CI_SDIS); + } + + if (is_host_mode) { + phy_set_mode(ci->phy, PHY_MODE_USB_HOST); + + if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING) + hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, + USBMODE_CI_SDIS); + } if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) { if (ci->hw_bank.lpm)