From patchwork Thu Sep 1 00:40:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 75138 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp19989qga; Wed, 31 Aug 2016 17:41:24 -0700 (PDT) X-Received: by 10.66.197.131 with SMTP id iu3mr21797918pac.97.1472690482032; Wed, 31 Aug 2016 17:41:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oy8si2396026pac.126.2016.08.31.17.41.19; Wed, 31 Aug 2016 17:41:22 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934020AbcIAAlA (ORCPT + 8 others); Wed, 31 Aug 2016 20:41:00 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36532 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933957AbcIAAkz (ORCPT ); Wed, 31 Aug 2016 20:40:55 -0400 Received: by mail-pf0-f170.google.com with SMTP id h186so24733048pfg.3 for ; Wed, 31 Aug 2016 17:40:55 -0700 (PDT) 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=W5OGgCLVYAlJVxdGldLv8BwPMgl9E7A/j4PMMvGEBKY=; b=U4xW3+BpMMnTTdAE01gmxKdfY3ZKju3UYdieMZ/FsqCLBoze08n2V3xei9R63uIpyi +1PaoXGRThXhatRjRPw7cvUau4eyfjb0D0pYrLAH3QpZpX+Te83MQsmN7LlqD3Mme+Z0 B5R6yqjJyY577jWE0bVOljoH+BHNFrSoftk0s= 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:in-reply-to :references; bh=W5OGgCLVYAlJVxdGldLv8BwPMgl9E7A/j4PMMvGEBKY=; b=UUYKFLUaFOB21RuvMwKFpUcJUIn3Ndzdm0jatr0xMpsL+lbGe932id8Bxxh1i1PkwG FQnu9XYCrFHpY4RWB6+XDZK/P6oaSvIxJ6WeK6IgDVy/l2XULEV4Uy2DUhN7HFQHJMnX AbdNPoZZTjrDEtlhzmgck5cTuDIpLFtEbPGxWZS3ncafx8wfrp3uzZ416dymI8ow2JXt SIcb7OUxPuX4fkvINvtMP+Esg6pS4NsorQyB3JnocOghcRteK3mt4VYyce2i7Nohvm/I wtUXaEMwQzGpm3wLNxliw/6kQGcqpMEZ/g6KgH4TbAC+XQYaj433jrYTCl1JQ5aZyb7P F2aA== X-Gm-Message-State: AE9vXwM4qmSc3evedt3osuc7epvNmANzA60aRS0PUgP+kyO2ELJdqq+yR5mYQnhiJn0XzVAM X-Received: by 10.98.35.145 with SMTP id q17mr22028239pfj.42.1472690454887; Wed, 31 Aug 2016 17:40:54 -0700 (PDT) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id m5sm2292303paw.40.2016.08.31.17.40.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Aug 2016 17:40:54 -0700 (PDT) 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 v3 16/22] usb: chipidea: msm: Restore wrapper settings after reset Date: Wed, 31 Aug 2016 17:40:30 -0700 Message-Id: <20160901004036.23936-17-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160901004036.23936-1-stephen.boyd@linaro.org> References: <20160901004036.23936-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 When the RESET bit is set in the USBCMD register it resets quite a few of the wrapper's registers to their reset state. This includes the GENCONFIG and GENCONFIG2 registers. Currently this is done by the usb phy and ehci-msm drivers writing into the controller wrapper's MMIO address space. Let's consolidate the register writes into the wrapper driver instead so that we clearly split the wrapper from the phys. Acked-by: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/ci_hdrc_msm.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- 2.9.0.rc2.8.ga28705d -- 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/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 4b0aadc2be2f..333817291798 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -14,11 +14,22 @@ #include #include #include +#include +#include #include "ci.h" #define HS_PHY_AHB_MODE 0x0098 +#define HS_PHY_GENCONFIG 0x009c +#define HS_PHY_TXFIFO_IDLE_FORCE_DIS BIT(4) + +#define HS_PHY_GENCONFIG_2 0x00a0 +#define HS_PHY_SESS_VLD_CTRL_EN BIT(7) +#define HS_PHY_ULPI_TX_PKT_EN_CLR_FIX BIT(19) + +#define HSPHY_SESS_VLD_CTRL BIT(25) + /* Vendor base starts at 0x200 beyond CI base */ #define HS_PHY_SEC_CTRL 0x0078 #define HS_PHY_DIG_CLAMP_N BIT(16) @@ -29,6 +40,7 @@ struct ci_hdrc_msm { struct clk *iface_clk; struct clk *fs_clk; bool secondary_phy; + bool hsic; void __iomem *base; }; @@ -48,6 +60,24 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) /* use AHB transactor, allow posted data writes */ hw_write_id_reg(ci, HS_PHY_AHB_MODE, 0xffffffff, 0x8); + + /* workaround for rx buffer collision issue */ + hw_write_id_reg(ci, HS_PHY_GENCONFIG, + HS_PHY_TXFIFO_IDLE_FORCE_DIS, 0); + + if (!msm_ci->hsic) + hw_write_id_reg(ci, HS_PHY_GENCONFIG_2, + HS_PHY_ULPI_TX_PKT_EN_CLR_FIX, 0); + + if (!IS_ERR(ci->platdata->vbus_extcon.edev)) { + hw_write_id_reg(ci, HS_PHY_GENCONFIG_2, + HS_PHY_SESS_VLD_CTRL_EN, + HS_PHY_SESS_VLD_CTRL_EN); + hw_write(ci, OP_USBCMD, HSPHY_SESS_VLD_CTRL, + HSPHY_SESS_VLD_CTRL); + + } + usb_phy_init(ci->usb_phy); break; case CI_HDRC_CONTROLLER_STOPPED_EVENT: @@ -116,6 +146,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) struct reset_control *reset; struct resource *res; int ret; + struct device_node *ulpi_node, *phy_node; dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n"); @@ -181,6 +212,14 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) if (ret) goto err_mux; + ulpi_node = of_find_node_by_name(pdev->dev.of_node, "ulpi"); + if (ulpi_node) { + phy_node = of_get_next_available_child(ulpi_node, NULL); + ci->hsic = of_device_is_compatible(phy_node, "qcom,usb-hsic-phy"); + of_node_put(phy_node); + } + of_node_put(ulpi_node); + plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, pdev->num_resources, &ci_hdrc_msm_platdata);