Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4762847imu; Tue, 29 Jan 2019 07:08:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN6E4G3wdbsA7A1xmnZI7tTZpZpf7obHXIPS/ZuJzebr413uMUK8RATQFbFZAo5WpHYjZDWW X-Received: by 2002:a17:902:b48b:: with SMTP id y11mr25348253plr.200.1548774512739; Tue, 29 Jan 2019 07:08:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548774512; cv=none; d=google.com; s=arc-20160816; b=Y+sm7KYgmsOgd1RLlI0mRkNh95qohTvV1A96UtqSowqXfHz7Ydq3PuTATO3qUzHqhR hVctwCJefF92tBW1ddLHVQ58Izm6lS3Y4AXNky4m5tjIeSlTGx/bL1VDGGqYd4RPzXT1 Qk0IZL96xM7gJXnotZMgHjQMJaACE1H2LQHi2K+1zMwfSU/3xamysEyK4gwL3xdBxZWB igoL7Ee/XA0qTAfPrwSdVewP/PagqP/JKHUGnjwBCm3aNwkRp09/NDcpmiYA2zuFxWoF EXc4jEUMEbW8rqxhii4ZDx/4DRKCAfLtrJkrQdq59gvLJ8Fx99proDkgMZ8f4WTUIMr9 jatQ== 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=1L622cKIwqGovZBdNTa4+4MhuWpcLpLSNwzLVV0e290=; b=O/E3VS9SFYrLiPnlkDcbZNudBwJOX62RUSfSvoQvXC1KSK5tK7Vc/EHzlERSXLyPyK z9JlVUnUxiy//kzmII+BQGLbTGStmIdoq0NLSdwZF/mWXK3NfwfJvsaZwJuP3+gijEbR w5qKC/qKt9bLwsM7IS5TD/TVmR7ROb0JzzuKjk3sfFT2bkyt/XYafVUgI2GC5aX+FFmZ ooG+DY7xnGEEgpaT1BFb0uTgtXjr+nGEim6xPg6bInNIeOGYaFxgshWRCT2woV8eVRC1 8mp9Tnu40+wM7l0I84ghoeBdUnjYkourfv+hcK7eTui2Ji24erRHv79y1bmdHkGihCa2 MP+g== 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 r4si35045596pgi.387.2019.01.29.07.08.16; Tue, 29 Jan 2019 07:08:32 -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 S1727826AbfA2PBs (ORCPT + 99 others); Tue, 29 Jan 2019 10:01:48 -0500 Received: from mga12.intel.com ([192.55.52.136]:8099 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbfA2PBr (ORCPT ); Tue, 29 Jan 2019 10:01:47 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2019 07:01:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,537,1539673200"; d="scan'208";a="314531707" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 29 Jan 2019 07:01:45 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id 525DF377; Tue, 29 Jan 2019 17:01:44 +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 04/28] thunderbolt: Add dummy read after port capability list walk on Light Ridge Date: Tue, 29 Jan 2019 18:01:19 +0300 Message-Id: <20190129150143.12681-5-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129150143.12681-1-mika.westerberg@linux.intel.com> References: <20190129150143.12681-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 94a507f12b71..b7a3b62805a6 100644 --- a/drivers/thunderbolt/cap.c +++ b/drivers/thunderbolt/cap.c @@ -56,6 +56,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; @@ -96,6 +111,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