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: 92485 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2428021qgi; Wed, 25 Jan 2017 14:33:35 -0800 (PST) X-Received: by 10.84.174.1 with SMTP id q1mr5040199plb.19.1485383615811; Wed, 25 Jan 2017 14:33:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si2894600pla.232.2017.01.25.14.33.35; Wed, 25 Jan 2017 14:33:35 -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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752434AbdAYWdA (ORCPT + 4 others); Wed, 25 Jan 2017 17:33:00 -0500 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35257 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752623AbdAYWc7 (ORCPT ); Wed, 25 Jan 2017 17:32:59 -0500 Received: by mail-pf0-f182.google.com with SMTP id f144so61104960pfa.2 for ; Wed, 25 Jan 2017 14:32:53 -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=VzWw5JijYLspOCk/XynN7qApyQL4q0xDoj/EXH7O3gz+p/YODVA4uljH4Bir3+dnKI UrBAawYLgLn6PmyyRk1fz/3ifWkX0Vkrt7Q1g2PiTrjSclpXtxgRy7J7WnDL8OMt013c rb2RbZf/v1UsQ6AIkmzaXQCIaYR9cXcMxUcM1zfY73HQ/6CrlHHira2V49eyjuTur6xz U5dCgl9/NV5eao0VHt6lGXRWet2pVlbSzZ7C/JpAOQ4cMU2jdyEfSqf9eY/YpXzuLPGV TljMlQPqJLVL54O42aVWlOrcz81TRr8csQizytdvm5T1dSKDA+3+wDhJ7OhJMHqdkEqu H/KA== X-Gm-Message-State: AIkVDXKcwmH1WUOhAMoqcm88iIxRZv1pSHshq1Uwpf24YxzzPj0TH494HBH5tN1afxg8+OOY 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-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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(-) -- 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/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)