Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp2604204pja; Thu, 2 Apr 2020 19:25:16 -0700 (PDT) X-Google-Smtp-Source: APiQypKO1nk78qNL5Q6khrRBb8y1fkaJyTm2nn6y4NY3BrwHeClfPcbrmAcAfgFQVv4zJPFFg/oX X-Received: by 2002:aca:4fc3:: with SMTP id d186mr1374574oib.171.1585880716731; Thu, 02 Apr 2020 19:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585880716; cv=none; d=google.com; s=arc-20160816; b=pVeFSi5vmkQvz6y4Mr/ZCS80MZkpSskzwGTXFC05/FZrdjg1TyMZtg42O98EZhpxb3 NWW1t1FXBGV1pAJPMYl4OJ5TvnCV30AIdPvtV7ldZ4Gdd3JBTMAxKTIl3iPgTDTSIg6L P1++/K75ssJrqloLaJZAnRf1+YxJKdDAWdk6U159kQDXXlNJny7HvlYo5T4RaRpE3y4g BrKAYgB/KHckkqKwPb93vBY/XCRUyJw6ZL/NM1mpX1uYmigs/lhYLR6fOgux+tn3fVZS UBQ5paWIciEltVIsRyms/XkK8ZeRSBp+aceH+FG01M/5gvleudRhZbac7aq1gA9Wm91N CbXQ== 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; bh=4vghYQszLcvqawDIfla40RK+7FQh007MZP7UoG1fd9M=; b=TlBJ/5KiteyzgfXyNJui8ScpjOh2swYnjLKVJ3lEn3JQX9R1qGXNzuXEok9rVgbgNp tSJKGgnon/XiXVTWXW33rBpccIKdEWe70a7U1EcrjJfvfIvxB2tqBNBhyNoiGMzFmwpc o6uGwTCV4mJ6xRPEuE+v9DkV+ihVKx3Ef6M9P35w6d0jiGFxo1Eyk3kFyOo/k0+NTWex /ZEY0ObannnQXs/DOdlta1KR24ocrOmk3Isfp7f3f2QRSf/le8QbxrQGBTPSXccKkktB wyfkVsbChZlWIagYD9NAJuqUiytvQHcd62UpBQeAQjU+7TA52v+gU3/bYWs45+yCAuSi VOeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Gxd1lG3i; 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 z25si3022022otp.310.2020.04.02.19.25.03; Thu, 02 Apr 2020 19:25:16 -0700 (PDT) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Gxd1lG3i; 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 S2390363AbgDCCYN (ORCPT + 99 others); Thu, 2 Apr 2020 22:24:13 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:41356 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390342AbgDCCYM (ORCPT ); Thu, 2 Apr 2020 22:24:12 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1585880651; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=4vghYQszLcvqawDIfla40RK+7FQh007MZP7UoG1fd9M=; b=Gxd1lG3iAIlA90BURqTFMy1x/F0o+7KxjOEpSv2uB/ba/Vmb2xFFRe+K1vPqg/icd0PUllVV eNPVLU3rAVQTRFJjTL9B/Tx5k08a2EuYslFIPisbDQNd7J8ix31Eg3oOvsSNBCdWws3NNpbr IowiiDJt66sHeTTOf9NHAgF/oho= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e869e4b.7f069bf1fe68-smtp-out-n02; Fri, 03 Apr 2020 02:24:11 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 55DBCC44791; Fri, 3 Apr 2020 02:24:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from wcheng-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wcheng) by smtp.codeaurora.org (Postfix) with ESMTPSA id B54D0C44788; Fri, 3 Apr 2020 02:24:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B54D0C44788 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=wcheng@codeaurora.org From: Wesley Cheng To: agross@kernel.org, bjorn.andersson@linaro.org, kishon@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, p.zabel@pengutronix.de, mgautam@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Wesley Cheng Subject: [PATCH v5 4/5] phy: qcom-qmp: Use proper PWRDOWN offset for sm8150 USB Date: Thu, 2 Apr 2020 19:23:53 -0700 Message-Id: <1585880634-15222-5-git-send-email-wcheng@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1585880634-15222-1-git-send-email-wcheng@codeaurora.org> References: <1585880634-15222-1-git-send-email-wcheng@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The register map for SM8150 QMP USB SSPHY has moved QPHY_POWER_DOWN_CONTROL to a different offset. Allow for an offset in the register table to override default value if it is a DP capable PHY. Signed-off-by: Wesley Cheng Reviewed-by: Manu Gautam --- drivers/phy/qualcomm/phy-qcom-qmp.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index cc04471..5363a99 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -119,6 +119,7 @@ enum qphy_reg_layout { QPHY_PCS_AUTONOMOUS_MODE_CTRL, QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR, QPHY_PCS_LFPS_RXTERM_IRQ_STATUS, + QPHY_PCS_POWER_DOWN_CONTROL, }; static const unsigned int pciephy_regs_layout[] = { @@ -164,6 +165,7 @@ enum qphy_reg_layout { [QPHY_SW_RESET] = 0x00, [QPHY_START_CTRL] = 0x44, [QPHY_PCS_STATUS] = 0x14, + [QPHY_PCS_POWER_DOWN_CONTROL] = 0x40, }; static const unsigned int sdm845_ufsphy_regs_layout[] = { @@ -1624,11 +1626,16 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy) SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); } - if (cfg->has_phy_com_ctrl) + if (cfg->has_phy_com_ctrl) { qphy_setbits(serdes, cfg->regs[QPHY_COM_POWER_DOWN_CONTROL], SW_PWRDN); - else - qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl); + } else { + if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) + qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + cfg->pwrdn_ctrl); + else + qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl); + } /* Serdes configuration */ qcom_qmp_phy_configure(serdes, cfg->regs, cfg->serdes_tbl, @@ -1850,7 +1857,12 @@ static int qcom_qmp_phy_disable(struct phy *phy) qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], cfg->start_ctrl); /* Put PHY into POWER DOWN state: active low */ - qphy_clrbits(qphy->pcs, QPHY_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl); + if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL]) { + qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + cfg->pwrdn_ctrl); + } else { + qphy_clrbits(qphy->pcs, QPHY_POWER_DOWN_CONTROL, cfg->pwrdn_ctrl); + } if (cfg->has_lane_rst) reset_control_assert(qphy->lane_rst); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project