Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp598406ima; Wed, 6 Feb 2019 05:26:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IYAkvgXUhxg9HydXuIhXZFxkwur+DnkZRZrVnh0GfdR6rTvE9E3vR1crBke51YOWjQjSLIX X-Received: by 2002:a17:902:7044:: with SMTP id h4mr10689704plt.35.1549459570293; Wed, 06 Feb 2019 05:26:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549459570; cv=none; d=google.com; s=arc-20160816; b=Y1uG8zZsgmNs84Mb13YdDn+0nmbJCDJcnQJ8X64eBja/VfSv1YXA+dbOUnv08m4K1k 6T329qls1UgvCTqCYeKduwK0H2GqX+y6UHVzpOuvqDxPOGJY536JxcPnhGVs654TZerC by0TatdbZIv5TJN080KCi/a1zQmPFW9YX50DfsG/A2nLPTacDyx5Serk57wGrRv7uCd2 emOOtHNDnYToVo18pniDit7Sr1b3WtGv3xFPVnUExdM4dx9Bw50B5aktxCh+fIdeAEdu CQ1P4zTBTg1509jABxeCNPLkrveBKE8TpjVkTU51xXPBcsgSmH46io1ECcCRGX4uZwgm IdAQ== 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; bh=P7Z6H+PkESXZ6YBo7QRpv+aNySoD+GLi9ZSVZBbAcSM=; b=eECv5yMUVw92Dg/etsIpEIDYXEUCO/2CZySjaCK1/i7bwOBn/s1XFaDkJC4zH8qVKI 6DdVxXredQvieRMg/Hi4pXkUeIraWQRXd8PT1dVR6CldwTYglpfqItGdT+XK2Fb7SFPE 3AjCc+/ctlShKjqNi9h/Sml3qIDV1SRU5rHypG173ObHtJEHnBgSs6kWQjfMYtzn23zy W8RbLhQRtMl8n39JCOI+yOz4WoSSphYXOfBZxgZnfcoZuQ4Ho0EsW0u02juj87gF5a+J tJuZwYJAXa0RBEoLM1LSeZlwHCqBnIad28giMM5MU+qIQN0MK0yY0+59BnXY1L7YIX/s 60ag== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si5915404pgg.314.2019.02.06.05.25.54; Wed, 06 Feb 2019 05:26:10 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729171AbfBFNRn (ORCPT + 99 others); Wed, 6 Feb 2019 08:17:43 -0500 Received: from mga03.intel.com ([134.134.136.65]:26739 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbfBFNRn (ORCPT ); Wed, 6 Feb 2019 08:17:43 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2019 05:17:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,340,1544515200"; d="scan'208";a="136336010" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 06 Feb 2019 05:17:39 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id AAB7215B; Wed, 6 Feb 2019 15:17:38 +0200 (EET) From: Mika Westerberg To: linux-kernel@vger.kernel.org Cc: Michael Jamet , Yehezkel Bernat , Andreas Noever , Lukas Wunner , "David S . Miller" , Mika Westerberg , Andy Shevchenko , netdev@vger.kernel.org Subject: [PATCH v2 04/28] thunderbolt: Add dummy read after port capability list walk on Light Ridge Date: Wed, 6 Feb 2019 16:17:14 +0300 Message-Id: <20190206131738.43696-5-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206131738.43696-1-mika.westerberg@linux.intel.com> References: <20190206131738.43696-1-mika.westerberg@linux.intel.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 Light Ridge has an issue where reading the next capability pointer location in port config space the read data is not cleared. It is fine to read capabilities each after another so only thing we need to do is to make sure we issue dummy read after tb_port_find_cap() is finished to avoid the issue in next read. Signed-off-by: Mika Westerberg --- drivers/thunderbolt/cap.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/thunderbolt/cap.c b/drivers/thunderbolt/cap.c index 0de548bda663..8aceb0d97a63 100644 --- a/drivers/thunderbolt/cap.c +++ b/drivers/thunderbolt/cap.c @@ -57,6 +57,21 @@ static int tb_port_enable_tmu(struct tb_port *port, bool enable) return tb_sw_write(sw, &value, TB_CFG_SWITCH, offset, 1); } +static void tb_port_dummy_read(struct tb_port *port) +{ + /* + * When reading from next capability pointer location in port + * config space the read data is not cleared on LR. To avoid + * reading stale data on next read perform one dummy read after + * port capabilities are walked. + */ + if (port->sw->config.device_id == PCI_DEVICE_ID_INTEL_LIGHT_RIDGE) { + u32 dummy; + + tb_port_read(port, &dummy, TB_CFG_PORT, 0, 1); + } +} + static int __tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap) { u32 offset = 1; @@ -97,6 +112,7 @@ int tb_port_find_cap(struct tb_port *port, enum tb_port_cap cap) ret = __tb_port_find_cap(port, cap); + tb_port_dummy_read(port); tb_port_enable_tmu(port, false); return ret; -- 2.20.1