Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3164323ybi; Fri, 5 Jul 2019 03:01:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDQ7mIYMy6GFTOwn5kaXIKjQ1rrLlZiSX+PprJ4ztht4Fuj11jpy1kyL9z/2ZyS2twZ/TW X-Received: by 2002:a63:69c1:: with SMTP id e184mr4287302pgc.198.1562320887250; Fri, 05 Jul 2019 03:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562320887; cv=none; d=google.com; s=arc-20160816; b=FqFKWx7QUdvOmpEs12Vg56JfEfW1NhbfaH7pVsHogMTVWRI8/T+Ns7NI4/qer0J27N IvnmJLstSWvBt2H4aQdmkqSOZNQHMhXZPLIPE1HRjRU8MKPZn2QILQiStQuxneZ+VbIa tO7N/QKh5fFBpH5aK3E+vhnseGGIKdXEWARPZ62YBxRDTtWa38DvJ1DbvuuUsgoL0tSw aCxgX+Y8EVnGTKccJSrnG+bHaW+KMY0KjBCrjxo1BqimIz/LAkyUDHHUlAC+jKhlV/AV pM71pjyNh3JlNLtg1MSYhxwzPoWAn2o7CIa0AYgBk9fOKdwH7QekmVs5vqhLQ64za551 dI1Q== 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=oivn2Mi/RAPIM5Jcm+++fYzCT6aFadBo7VIiz6PzOMY=; b=BjkWcQr+GceO25SmTc583tW2hPbbrF0xPacT42q9T/Fyr4UPCNH5fRhV1JL/1CWhDW qDPGF5B0jcyGwBqAQSKSyxjIOEdyVtL/fwgtVX8lRhebv9fMw3Jxvu6E+7H/vr3C0dHU 1UtVIV6AnpG539NMHN9B4fDK+vTzQRCMaT3oj7je8/9NvlUiS3HDjrHCbk8ul/su0qUM R2nMQoBOnLnW7fBE1gFYrz0k4ef0Kn5jmiDT/3I+VIKyu/mFvuhZAqqGxkg1Un9edE77 K1XfCuSAUoSKAR/63kJ4FIETKp1q8dfIn61ulG98pkO2oQH4hVIruJ9++8VsGhRmy2cR 8T+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 b13si8442093pgn.212.2019.07.05.03.01.10; Fri, 05 Jul 2019 03:01:27 -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; 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 S1728416AbfGEJ6F (ORCPT + 99 others); Fri, 5 Jul 2019 05:58:05 -0400 Received: from mga06.intel.com ([134.134.136.31]:42516 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728401AbfGEJ6F (ORCPT ); Fri, 5 Jul 2019 05:58:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 02:58:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,454,1557212400"; d="scan'208";a="169637165" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 05 Jul 2019 02:58:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id E780A370; Fri, 5 Jul 2019 12:58:00 +0300 (EEST) From: Mika Westerberg To: linux-kernel@vger.kernel.org Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , "Rafael J . Wysocki" , Len Brown , Lukas Wunner , Mario.Limonciello@dell.com, Anthony Wong , Mika Westerberg , linux-acpi@vger.kernel.org Subject: [PATCH 3/8] thunderbolt: Use 32-bit writes when writing ring producer/consumer Date: Fri, 5 Jul 2019 12:57:55 +0300 Message-Id: <20190705095800.43534-4-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190705095800.43534-1-mika.westerberg@linux.intel.com> References: <20190705095800.43534-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 The register access should be using 32-bit reads/writes according to the datasheet. With the previous generation hardware 16-bit writes have been working but starting with ICL this is not the case anymore so fix producer/consumer register update to use correct width register address. Signed-off-by: Mika Westerberg --- drivers/thunderbolt/nhi.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c index 27fbe62c7ddd..09242653da67 100644 --- a/drivers/thunderbolt/nhi.c +++ b/drivers/thunderbolt/nhi.c @@ -143,9 +143,24 @@ static void __iomem *ring_options_base(struct tb_ring *ring) return io; } -static void ring_iowrite16desc(struct tb_ring *ring, u32 value, u32 offset) +static void ring_iowrite_prod(struct tb_ring *ring, u16 prod) { - iowrite16(value, ring_desc_base(ring) + offset); + u32 val; + + val = ioread32(ring_desc_base(ring) + 8); + val &= 0x0000ffff; + val |= prod << 16; + iowrite32(val, ring_desc_base(ring) + 8); +} + +static void ring_iowrite_cons(struct tb_ring *ring, u16 cons) +{ + u32 val; + + val = ioread32(ring_desc_base(ring) + 8); + val &= 0xffff0000; + val |= cons; + iowrite32(val, ring_desc_base(ring) + 8); } static void ring_iowrite32desc(struct tb_ring *ring, u32 value, u32 offset) @@ -197,7 +212,10 @@ static void ring_write_descriptors(struct tb_ring *ring) descriptor->sof = frame->sof; } ring->head = (ring->head + 1) % ring->size; - ring_iowrite16desc(ring, ring->head, ring->is_tx ? 10 : 8); + if (ring->is_tx) + ring_iowrite_prod(ring, ring->head); + else + ring_iowrite_cons(ring, ring->head); } } @@ -662,7 +680,7 @@ void tb_ring_stop(struct tb_ring *ring) ring_iowrite32options(ring, 0, 0); ring_iowrite64desc(ring, 0, 0); - ring_iowrite16desc(ring, 0, ring->is_tx ? 10 : 8); + ring_iowrite32desc(ring, 0, 8); ring_iowrite32desc(ring, 0, 12); ring->head = 0; ring->tail = 0; -- 2.20.1