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: 9538075 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 D6246601D7 for ; Wed, 25 Jan 2017 22:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C864E27F17 for ; Wed, 25 Jan 2017 22:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC19527F99; Wed, 25 Jan 2017 22:35:16 +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=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7949927F17 for ; Wed, 25 Jan 2017 22:35:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cWW9l-0007f1-Ox; Wed, 25 Jan 2017 22:35:09 +0000 Received: from mail-pf0-f173.google.com ([209.85.192.173]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWW8n-00071q-7q for linux-arm-kernel@lists.infradead.org; Wed, 25 Jan 2017 22:34:11 +0000 Received: by mail-pf0-f173.google.com with SMTP id 189so61178003pfu.3 for ; Wed, 25 Jan 2017 14:33:48 -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=jn6KdWJ/0Cc+JrNnu3pEsCAOA0Z7+7chBDB0mEZIqqClwkCvxRIff3I8gPw0g7WKiw nviWlRsdnAJjC0Dn3JOH7VQ0gAGQW0lXlncVfRBar7yvGzl4t70o0gtNipJCZ3YC0anm QZG1cLiHpJ+8s74bIVoDTLU/HXEJ33IUPOE2zMRNG/hN57+7LciXk5sdySmRELoOYkbY tHX8oiObYLh8aVSG1FV6Xh0+A6TgpQHzFdAfXqBtxrFv30xoNbr/XraOTJucJ9uM8C6V INSWgam8f7q5qW3Rn2QH6o32cXpHP2o+wRG7a4dG8CCdYKTBoce+SvsIOVah2gZJnOA4 MP3A== X-Gm-Message-State: AIkVDXK88o4333BnkxMS+PRuOfMZ7kjpinUFBWtYXU9PmizX6GQFw24RjPgr2aXejKoeMHSj 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170125_143409_333641_D74B50EC X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Arnd Bergmann , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Greg Kroah-Hartman , Andy Gross , Kishon Vijay Abraham I , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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)