Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1266827pxa; Thu, 20 Aug 2020 07:08:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc0/UIqXB4hr2oL1oLToCnUAHbncMrgnk5yv2VE1oUS1Q3qQt4P5wZxrNcuVrAbhEzLJR7 X-Received: by 2002:a17:906:2cc2:: with SMTP id r2mr3354896ejr.482.1597932480631; Thu, 20 Aug 2020 07:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597932480; cv=none; d=google.com; s=arc-20160816; b=lQZ5mzlBtROvk8xn9/m29d2XKqnC+NDWXnP6Br5BoATGIsUjW26275Q2RETVd/nm39 2V8tQkMA91wZ1pLseRA/Oq628OngikPRZ06JN3PXvAFmQioYw/93lIWTjce22mo8ET2/ y0jbHG8ZgommZxZav1MekH5z1u8FCbQ+w0Htk3Bst59YRsEZOBp5bimM9M/SRf9c2YLv gCagnZmpQcDpvqVwmkI12d/BToJDrYmBGFXymMcZukdJKckpuyAGf7Cf4gQ9E1gerkg1 uAZuMKiRBILySwkaeRf3TPHk1n4YZ2dIGU/+WL0rdSR3/0+F193CSHkGvhclNkxpA6Il Uhyg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e2xGJmWEA7Ns+z1wbcmt+HXo9yPjgJ7AS9PQPhu87Dg=; b=HOMpU7JhPwWMZmuntGx+m6i5T+xvGXbvHWPtg9ArMYM/UvYU8M563Or3Jfa4sCYWdV as+5u1JAJmo/DqkDnv/R2EMnUhRLoe17SuaVotBKEqZfI54H4+s4smm3kGjuG9FZ6F2X fdMaZuC+ej2UO5PjFaRXvbCYk2ma/Fi/p8Yu3iP5AW9/Ast0SUMGP5SWdjunh/rXsGNj cZEjSUDnIp6lKn/bw3s0qoGtu1lpAWYf6oI4M6Q/IR/f5BC4gFw358p16oNMccQ/MTc0 cIyphzwZi6ig3mo0ekpRkunWDzyaYpxGYx4jnURgTm660Bdvsfsw43kSvlOiHfwF36Le rMcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dvniVsky; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l21si1385263edw.181.2020.08.20.07.07.36; Thu, 20 Aug 2020 07:08:00 -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=@kernel.org header.s=default header.b=dvniVsky; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbgHTN74 (ORCPT + 99 others); Thu, 20 Aug 2020 09:59:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:59700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbgHTJXv (ORCPT ); Thu, 20 Aug 2020 05:23:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D85F22CB2; Thu, 20 Aug 2020 09:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915431; bh=Yorda5NEuOnH2beBNjDJoc7hFJMtvtZsSMq3am5igzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dvniVskyPWxktis5VPzyMSgCGhzCgQHbIlQwwvom9ceAiZJOPKsvN+oF4HZwaNeoN zEzQ2qVWfjda5hbgkJJ+PXP/0JkXn0YbN6J38vxIvq6WwCKTxOLHtOYsyyTfbPw6E6 zRCiIzB0SZhUF9XkQUCiTLCSr9LcqAftNFOu+HvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ansuel Smith , Lorenzo Pieralisi , Rob Herring , Stanimir Varbanov Subject: [PATCH 5.8 011/232] PCI: qcom: Define some PARF params needed for ipq8064 SoC Date: Thu, 20 Aug 2020 11:17:42 +0200 Message-Id: <20200820091613.264473965@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ansuel Smith commit 5149901e9e6deca487c01cc434a3ac4125c7b00b upstream. Set some specific value for Tx De-Emphasis, Tx Swing and Rx equalization needed on some ipq8064 based device (Netgear R7800 for example). Without this the system locks on kernel load. Link: https://lore.kernel.org/r/20200615210608.21469-8-ansuelsmth@gmail.com Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver") Signed-off-by: Ansuel Smith Signed-off-by: Lorenzo Pieralisi Reviewed-by: Rob Herring Acked-by: Stanimir Varbanov Cc: stable@vger.kernel.org # v4.5+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/dwc/pcie-qcom.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -77,6 +77,18 @@ #define DBI_RO_WR_EN 1 #define PERST_DELAY_US 1000 +/* PARF registers */ +#define PCIE20_PARF_PCS_DEEMPH 0x34 +#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16) +#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8) +#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0) + +#define PCIE20_PARF_PCS_SWING 0x38 +#define PCS_SWING_TX_SWING_FULL(x) ((x) << 8) +#define PCS_SWING_TX_SWING_LOW(x) ((x) << 0) + +#define PCIE20_PARF_CONFIG_BITS 0x50 +#define PHY_RX0_EQ(x) ((x) << 24) #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 #define SLV_ADDR_SPACE_SZ 0x10000000 @@ -286,6 +298,7 @@ static int qcom_pcie_init_2_1_0(struct q struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; + struct device_node *node = dev->of_node; u32 val; int ret; @@ -330,6 +343,17 @@ static int qcom_pcie_init_2_1_0(struct q val &= ~BIT(0); writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); + if (of_device_is_compatible(node, "qcom,pcie-ipq8064")) { + writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) | + PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(24) | + PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(34), + pcie->parf + PCIE20_PARF_PCS_DEEMPH); + writel(PCS_SWING_TX_SWING_FULL(120) | + PCS_SWING_TX_SWING_LOW(120), + pcie->parf + PCIE20_PARF_PCS_SWING); + writel(PHY_RX0_EQ(4), pcie->parf + PCIE20_PARF_CONFIG_BITS); + } + /* enable external reference clock */ val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK); val |= BIT(16);