Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2323461ybz; Thu, 30 Apr 2020 15:09:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIagW2rQk+Dpr82/Ga0zoJrKBT+hqUNo8EP4Jxe12fArez3UvhFUIUfqmYOY6oUxIwdrdjY X-Received: by 2002:a05:6402:1543:: with SMTP id p3mr1077667edx.333.1588284578353; Thu, 30 Apr 2020 15:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588284578; cv=none; d=google.com; s=arc-20160816; b=HYL389UCUTadSuLmjIQLiRxYugVaH7OFJG21cd5xmWksp2AYtSlSIFiqHlDvq4MA7o WF5qOjjOPagSXLd8fWdSJsRBvLQU2ibsFFD7yjYL0WwiyBUem5Bw/AYfYRAr7Hte0AWq W+ezxWotS2JCGxtzEPla8PkWnSOKmsQ/JBYnuz6o8XLRHHOYqAgheK4JRGuKKsv9UVAi wE+EeQ2PpyDtKuOgasrsjznK18QBLowkFcrDn4BY/cawI5ZFtl3+2YAYQ5eFgBVuG0Om JCrtCBgy65hSEZU2FeTxaP87i2mdjynuFcdE42x1/DOJENIh43sOndrAEyvjblkkbPlx naoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p5qwOdOjBM0kR3h5Ux00+NLqsBpbJPVpfGyfoBvZ0KU=; b=GXS74FBppbN6CPip3k4Tlag7QF88Le9Dg0T+DsNCEi5xkj4aC+bhXdcfFxGKLZZfT4 CGYTkhfx8MlmZdMyGvo+Dql7FhzEvbFZlHEnTEPcXpNid2mBhauSjax8Oy9Lh1jd/Tqg nNXOmVoUYwEle2zfh+H15kjWFQKhmpNuyrkbEmc2NgYvcHivCh/BQ4Mjc5zjJ81Qkaai NuOxHpWp3//++2rQA7wYeyxzaIhaGhRZNPAZq+S64lu4KakWSAt+bXTPbo6yf3pVg4/m 52mH0fuht7VFfaXfmM6cFZMgUpycEeGti4OSUB3xOrmfqi3mJriJXffAfvLOYHocl4fS VLMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c5CYdiZZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si682478ejx.28.2020.04.30.15.09.15; Thu, 30 Apr 2020 15:09:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c5CYdiZZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728058AbgD3WHC (ORCPT + 99 others); Thu, 30 Apr 2020 18:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728039AbgD3WG7 (ORCPT ); Thu, 30 Apr 2020 18:06:59 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59429C035494; Thu, 30 Apr 2020 15:06:59 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id s3so6017667eji.6; Thu, 30 Apr 2020 15:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p5qwOdOjBM0kR3h5Ux00+NLqsBpbJPVpfGyfoBvZ0KU=; b=c5CYdiZZeep2K6qtPUqzur442gkAeLpmaznc9LJNKtnDY06F+DPUTIgjpf+0VNDeEc WV41w4nGCCBTsAnaRozUjiWqtmYyufG1BADcu/c/Yoe3+5/2U44N87u+FghlfBGkkHML a2qc51oGITjmf5QQMmqZRip+7UdC5YyQhe2LxbBLesBgTLu73zkmd9sa2QHxriHG8+FP n54Cy99LdxFGl35iKumefOEkTEkIqK0AAiZ/Th664L7KXr7pcTYHVfjuZqye9s80VCnf TivfTQTuisO3pn4ncaCOJJRHM0pprwhqKohaCrE8fBqQWsFDQ7aajqDHyKSOttcKd2Dn Tvjg== 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:mime-version:content-transfer-encoding; bh=p5qwOdOjBM0kR3h5Ux00+NLqsBpbJPVpfGyfoBvZ0KU=; b=adpUytGkKUTV9V9xd46liMfPEQDMmPB5am+hoE22IvNOVxUNs5ZyShsQhCQUFzRxZ2 hgFuwhnb1Qfs1FuaZJBhVBA8m9tS3Wj6/GNPbYbZTEsMqeMHT0Ps744pEn3Ty3YaExuv LYrRExvNFeDf6LKYw0zOI9n7EVb1JxeBsgiMxjjztCCcqi7AgxwOV/XC7DuByoDhgTqQ u7mVW6sxuN1JFRWbhLtvdGYM/mToYHXeKmEPN9DzxFRELBTdzV8jlk9b96g8KoN5wvYR 8aRQPkLhBqVmTFvoXTgB8XPmeq2UtQGF6g5ehzLwP8JlGmCCwRiPcG2OdZ4jPZlToxAi 0dAA== X-Gm-Message-State: AGi0PuaOQWG9k7MqjUQzO5yAbmj+L3wR0HHtDbglMFpth5JFZaaH3A1p hLxL94zMT/Qcn/X0HthvMzA= X-Received: by 2002:a17:906:1199:: with SMTP id n25mr623646eja.30.1588284418018; Thu, 30 Apr 2020 15:06:58 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:57 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Sham Muthayyan , Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 09/11] PCI: qcom: add ipq8064 rev2 variant and set tx term offset Date: Fri, 1 May 2020 00:06:16 +0200 Message-Id: <20200430220619.3169-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sham Muthayyan Add tx term offset support to pcie qcom driver need in some revision of the ipq806x SoC. Ipq8064 have tx term offset set to 7. Ipq8064-v2 revision and ipq8065 have the tx term offset set to 0. Signed-off-by: Sham Muthayyan Signed-off-by: Ansuel Smith --- drivers/pci/controller/dwc/pcie-qcom.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index da8058fd1925..372d2c8508b5 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -45,6 +45,9 @@ #define PCIE_CAP_CPL_TIMEOUT_DISABLE 0x10 #define PCIE20_PARF_PHY_CTRL 0x40 +#define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK GENMASK(12, 16) +#define PHY_CTRL_PHY_TX0_TERM_OFFSET(x) ((x) << 16) + #define PCIE20_PARF_PHY_REFCLK 0x4C #define PHY_REFCLK_SSP_EN BIT(16) #define PHY_REFCLK_USE_PAD BIT(12) @@ -118,6 +121,7 @@ struct qcom_pcie_resources_2_1_0 { u32 tx_swing_full; u32 tx_swing_low; u32 rx0_eq; + u8 phy_tx0_term_offset; }; struct qcom_pcie_resources_1_0_0 { @@ -318,6 +322,11 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->ext_reset)) return PTR_ERR(res->ext_reset); + if (of_device_is_compatible(dev->of_node, "qcom,pcie-ipq8064")) + res->phy_tx0_term_offset = 7; + else + res->phy_tx0_term_offset = 0; + res->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); return PTR_ERR_OR_ZERO(res->phy_reset); } @@ -402,6 +411,11 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) /* enable PCIe clocks and resets */ qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); + /* set TX termination offset */ + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, + PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK, + PHY_CTRL_PHY_TX0_TERM_OFFSET(res->phy_tx0_term_offset)); + writel(PCS_DEEMPH_TX_DEEMPH_GEN1(res->tx_deemph_gen1) | PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(res->tx_deemph_gen2_3p5db) | PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(res->tx_deemph_gen2_6db), @@ -1485,6 +1499,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-apq8084", .data = &ops_1_0_0 }, { .compatible = "qcom,pcie-ipq8064", .data = &ops_2_1_0 }, + { .compatible = "qcom,pcie-ipq8064-v2", .data = &ops_2_1_0 }, { .compatible = "qcom,pcie-apq8064", .data = &ops_2_1_0 }, { .compatible = "qcom,pcie-msm8996", .data = &ops_2_3_2 }, { .compatible = "qcom,pcie-ipq8074", .data = &ops_2_3_3 }, -- 2.25.1