Received: by 10.223.164.202 with SMTP id h10csp4904381wrb; Tue, 21 Nov 2017 01:26:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMYuVyoBXCBAv1LoiFw6U7+pUSozBvEbHLkxRSK9bx6MAfTzRou/XVxini2gmfzhWcloDW9F X-Received: by 10.159.205.132 with SMTP id v4mr17226459plo.426.1511256367331; Tue, 21 Nov 2017 01:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511256367; cv=none; d=google.com; s=arc-20160816; b=RigCfcJe0i54yoGzxXipk2NjvxWolyygSc09V4Nz+kD1AAK5OsYZeRA3ki41VXAKb+ NGiODy6Rmh+1d5u5F5ySIcN52SgOreZWHpSgHVfoRxk3boyKz7Q+w3CgzGcse5mInsKr cXBiq0OD+zEFIX0Ct1mLgnCnvfKGS8yCyZ2qWPl4Q0i8i2GaWMDd9GM+GKS3JocwReT3 8XW8vsinyHZDkaaCWw3CTEKJUJ3kVOFiVQPImmvNddbKJvycVFeMhswvSEgOJ47NpKzW lFLYJzFtgREUhNg5CABZwlZdq/PhSXmoPj8SEELknI/GXwtuXuxgb3QjWXq7JGbLzBnU /MUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=AIrNrNjZcLuKf6hllejDaGbEjXXCFcMAbBgmOuI8Eew=; b=LjlKXBVui87TPV1vBdN6+5i/+RQs82M7E/hPQVIffH69rhBjYsdInFbClEFfu5QFWq WeEif7jfevcpHo4FVtJnnvV4JML18NcPOmpML8HlhqkdDjUFDYVZU3kv9doKdBKPT+Mv zV+yXqjZamVZAmBvJJzoe2gNs1DmagoNryy3gtqPLXYGaoX5vTDtq58I9HIGBwl6WiOB oYZyNfe5IBgURAdPFSNqdiWlsD7E95bTBAoMxGgaBZZkDfj12v6mXXyb05uKSMF3CvSq SmbZ07lzin82OEIqczJpr3PIDShquWfPFJyVYSPhUOXM6ErlhW8G8ykqKdVAmOO+750Y xmeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=I+lZVNug; dkim=pass header.i=@codeaurora.org header.s=default header.b=aX/4inMb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si10544767pln.195.2017.11.21.01.25.56; Tue, 21 Nov 2017 01:26:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=I+lZVNug; dkim=pass header.i=@codeaurora.org header.s=default header.b=aX/4inMb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdKUJYt (ORCPT + 72 others); Tue, 21 Nov 2017 04:24:49 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:41476 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbdKUJYq (ORCPT ); Tue, 21 Nov 2017 04:24:46 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5328D607EA; Tue, 21 Nov 2017 09:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511256286; bh=q41S3JyRNycwXsUXRpItMG6xzwoUpX1a4QlhO2k3TFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I+lZVNugHb/bbb0OvFsWmJstHi4k9ewW8LmTKV3yiFcqyIOMJrTyTKc2fh7lidjln p88IqwAvK+jArBhvJxLNlSkn5/bTg2J9LfL72CYTp9PRmWdx2eEf5l6Slx3jWdXy5J jO+XGLyebEhWVuFqmP3i5aT8u118mUHck5cx7CgQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mgautam-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 583A56024A; Tue, 21 Nov 2017 09:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511256285; bh=q41S3JyRNycwXsUXRpItMG6xzwoUpX1a4QlhO2k3TFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aX/4inMb8ESufmtEZvmu6dIv4kUTLcQA7BRrObWZmCFR0NgrIiW5GgXyeInXkErEU gf1VFk6VaXll97tEzRYJU1fwQbCgnjDiwZCeh6vt6DPrd9sflZ2dtfE/5vV4lfiX5l JWMHja/6xOBe5udCS5KmzD+GBGP+++0+52X4U5n0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 583A56024A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mgautam@codeaurora.org From: Manu Gautam To: Kishon Vijay Abraham I Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, Manu Gautam , Vivek Gautam , Krzysztof Kozlowski , Heiko Stuebner , linux-kernel@vger.kernel.org (open list:GENERIC PHY FRAMEWORK) Subject: [PATCH v3 09/16] phy: qcom-qusb2: Add support for QUSB2 V2 version Date: Tue, 21 Nov 2017 14:53:19 +0530 Message-Id: <1511256206-1587-10-git-send-email-mgautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511256206-1587-1-git-send-email-mgautam@codeaurora.org> References: <1511256206-1587-1-git-send-email-mgautam@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use register layout to add additional registers present on QUSB2 PHY V2 version for PHY initialization. Other than new registers on V2, following two register's offset and bit definitions are different: POWERDOWN control and PLL_STATUS. Signed-off-by: Manu Gautam --- drivers/phy/qualcomm/phy-qcom-qusb2.c | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c index c0c5358..bda1f4c 100644 --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c @@ -40,15 +40,34 @@ /* QUSB2PHY_PLL_STATUS register bits */ #define PLL_LOCKED BIT(5) +/* QUSB2PHY_PLL_COMMON_STATUS_ONE register bits */ +#define CORE_READY_STATUS BIT(0) + /* QUSB2PHY_PORT_POWERDOWN register bits */ #define CLAMP_N_EN BIT(5) #define FREEZIO_N BIT(1) #define POWER_DOWN BIT(0) +/* QUSB2PHY_PWR_CTRL1 register bits */ +#define PWR_CTRL1_VREF_SUPPLY_TRIM BIT(5) +#define PWR_CTRL1_CLAMP_N_EN BIT(1) + #define QUSB2PHY_REFCLK_ENABLE BIT(0) #define PHY_CLK_SCHEME_SEL BIT(0) +#define QUSB2PHY_PLL_ANALOG_CONTROLS_TWO 0x04 +#define QUSB2PHY_PLL_CLOCK_INVERTERS 0x18c +#define QUSB2PHY_PLL_CMODE 0x2c +#define QUSB2PHY_PLL_LOCK_DELAY 0x184 +#define QUSB2PHY_PLL_DIGITAL_TIMERS_TWO 0xb4 +#define QUSB2PHY_PLL_BIAS_CONTROL_1 0x194 +#define QUSB2PHY_PLL_BIAS_CONTROL_2 0x198 +#define QUSB2PHY_PWR_CTRL2 0x214 +#define QUSB2PHY_IMP_CTRL1 0x220 +#define QUSB2PHY_IMP_CTRL2 0x224 +#define QUSB2PHY_CHG_CTRL2 0x23c + struct qusb2_phy_init_tbl { unsigned int offset; unsigned int val; @@ -113,6 +132,38 @@ enum qusb2phy_reg_layout { QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_PWR_CTRL, 0x00), }; +static const unsigned int qusb2_v2_regs_layout[] = { + [QUSB2PHY_PLL_STATUS] = 0x1a0, + [QUSB2PHY_PORT_TUNE1] = 0x240, + [QUSB2PHY_PORT_TUNE2] = 0x244, + [QUSB2PHY_PORT_TUNE3] = 0x248, + [QUSB2PHY_PORT_TUNE4] = 0x24c, + [QUSB2PHY_PORT_TUNE5] = 0x250, + [QUSB2PHY_PORT_TEST2] = 0x258, + [QUSB2PHY_PORT_POWERDOWN] = 0x210, +}; + +static const struct qusb2_phy_init_tbl qusb2_v2_init_tbl[] = { + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_ANALOG_CONTROLS_TWO, 0x03), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CLOCK_INVERTERS, 0x7c), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_CMODE, 0x80), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_LOCK_DELAY, 0x0a), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_DIGITAL_TIMERS_TWO, 0x19), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_BIAS_CONTROL_1, 0x40), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_BIAS_CONTROL_2, 0x20), + QUSB2_PHY_INIT_CFG(QUSB2PHY_PWR_CTRL2, 0x21), + QUSB2_PHY_INIT_CFG(QUSB2PHY_IMP_CTRL1, 0x0), + QUSB2_PHY_INIT_CFG(QUSB2PHY_IMP_CTRL2, 0x58), + + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0x30), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0x29), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE3, 0xca), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0x04), + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE5, 0x03), + + QUSB2_PHY_INIT_CFG(QUSB2PHY_CHG_CTRL2, 0x0), +}; + struct qusb2_phy_cfg { const struct qusb2_phy_init_tbl *tbl; /* number of entries in the table */ @@ -139,6 +190,16 @@ struct qusb2_phy_cfg { .mask_core_ready = PLL_LOCKED, }; +static const struct qusb2_phy_cfg qusb2_v2_phy_cfg = { + .tbl = qusb2_v2_init_tbl, + .tbl_num = ARRAY_SIZE(qusb2_v2_init_tbl), + .regs = qusb2_v2_regs_layout, + + .disable_ctrl = (PWR_CTRL1_VREF_SUPPLY_TRIM | PWR_CTRL1_CLAMP_N_EN | + POWER_DOWN), + .mask_core_ready = CORE_READY_STATUS, +}; + static const char * const qusb2_phy_vreg_names[] = { "vdda-pll", "vdda-phy-dpdm", }; @@ -419,6 +480,9 @@ static int qusb2_phy_exit(struct phy *phy) { .compatible = "qcom,msm8996-qusb2-phy", .data = &msm8996_phy_cfg, + }, { + .compatible = "qcom,qusb2-v2-phy", + .data = &qusb2_v2_phy_cfg, }, { }, }; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project From 1584692367092419589@xxx Tue Nov 21 16:06:49 +0000 2017 X-GM-THRID: 1584692367092419589 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread