Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4357655imu; Mon, 28 Jan 2019 23:35:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN6WkidBftdPRCckHKeNgiYYb5YXlvWBj6s+GWR7XLc17W6xTnQe7Pzwhn6RfvKsLsh7CMi5 X-Received: by 2002:a63:86c1:: with SMTP id x184mr22527478pgd.305.1548747313202; Mon, 28 Jan 2019 23:35:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548747313; cv=none; d=google.com; s=arc-20160816; b=C1ZoNJZqgxOGzpcgu7Rfl7jqxEN/0u1WzCcHFR0z7b5+LiVAJzPWA05hzZin3ulFWv vnYSJrKg/vMAume4phsuDgtGDTQaYys/Bn5IiljHZIri7OMazs2SAhZ90K0iJKDLQ59Z YREg7VIb+sp76bYN02j0swBYd5447VpKLPe6fRjwYiCLrlOyVq7LYgdih5tNZdFTB3I0 1LG8H9hDj2gkR/Pg6By37nKfqlOZGImySO70MMC6dkSFp6pEE6eajE17Ey00e0Iy6cdX EW9QGUFBdBR4BmX3YHDXTnf19wqBbKwrMs68hSFKzBVj7J/Nwg/ZwC0qDwAuu8KuLciQ Kemw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=/Fm7vcqLvBqWFBDPQUy4xAs56MAhLtD2DvIUsEzl1LQ=; b=icLhD+K+Rql4TYsdWNiTH1J8v4gbz6eBUtb4PsF/ZKuLoB5CTW+ATfzwMb4V72jaA8 IOgsBYzkKAT3gxC4diV5MQgLgCw99WvUBuOhxgIWbwewnGtCH2lkRTze9E6AyYPwD376 XvOyHZOPBAEcZPICG+MybCFLnN9HroUuW0nMxV75Z4b6gS8J98FW0sVP6pgtn76KWEiw ZmquzjHD/6uVaVHth/FOJSoWvOTBc+aMF1JKJsdmCqo8aXcgTHdABeSVUUW+H1hGyEvq VZ+CpnLJN4k5xHvsU23nV6/p7mItYFG4cPUOImCCsdFA4Dg+wOBSF3WOxBMWTD9meIE6 P06Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22si32010108pgj.244.2019.01.28.23.34.57; Mon, 28 Jan 2019 23:35:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727445AbfA2HdD (ORCPT + 99 others); Tue, 29 Jan 2019 02:33:03 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:20119 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726925AbfA2HcX (ORCPT ); Tue, 29 Jan 2019 02:32:23 -0500 X-UUID: 8d97f6368e234e6ca84eb673c14691b3-20190129 X-UUID: 8d97f6368e234e6ca84eb673c14691b3-20190129 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 2075529359; Tue, 29 Jan 2019 15:32:13 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 29 Jan 2019 15:32:11 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 29 Jan 2019 15:32:11 +0800 From: Bibby Hsieh To: Jassi Brar , Matthias Brugger , Rob Herring , CK HU CC: Daniel Kurtz , Sascha Hauer , , , , , , Sascha Hauer , Philipp Zabel , Nicolas Boichat , Bibby Hsieh , YT Shen , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , , , Frederic Chen Subject: [PATCH 04/10] soc: mediatek: clear the event in cmdq initial flow Date: Tue, 29 Jan 2019 15:32:01 +0800 Message-ID: <1548747128-60136-5-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> References: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 2E5B5FCE1422E2CAA38FC4160DBCDBF8B30E9E4C85B91E8257532D0D8C7115082000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GCE hardware stored event information in own internal sysram, if the initial value in those sysram is not zero value it will cause a situation that gce can wait the event immediately after client ask gce to wait event but not really trigger the corresponding hardware. In order to make sure that the wait event function is exactly correct, we need to clear the sysram value in cmdq initial flow. Signed-off-by: Bibby Hsieh --- drivers/mailbox/mtk-cmdq-mailbox.c | 5 +++++ include/linux/mailbox/mtk-cmdq-mailbox.h | 2 ++ include/linux/soc/mediatek/mtk-cmdq.h | 3 --- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index f6174ca..2b5febd 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -33,6 +33,7 @@ #define CMDQ_THR_END_ADDR 0x24 #define CMDQ_THR_WAIT_TOKEN 0x30 #define CMDQ_THR_PRIORITY 0x40 +#define CMDQ_SYNC_TOKEN_UPDATE 0x68 #define CMDQ_THR_ACTIVE_SLOT_CYCLES 0x3200 #define CMDQ_THR_ENABLED 0x1 @@ -103,8 +104,12 @@ static void cmdq_thread_resume(struct cmdq_thread *thread) static void cmdq_init(struct cmdq *cmdq) { + int i; + WARN_ON(clk_enable(cmdq->clock) < 0); writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES); + for (i = 0; i <= CMDQ_MAX_EVENT; i++) + writel(i, cmdq->base + CMDQ_SYNC_TOKEN_UPDATE); clk_disable(cmdq->clock); } diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h index ccb7342..911475da 100644 --- a/include/linux/mailbox/mtk-cmdq-mailbox.h +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h @@ -19,6 +19,8 @@ #define CMDQ_WFE_UPDATE BIT(31) #define CMDQ_WFE_WAIT BIT(15) #define CMDQ_WFE_WAIT_VALUE 0x1 +/** cmdq event maximum */ +#define CMDQ_MAX_EVENT 0x3ff /* * CMDQ_CODE_MASK: diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 54ade13..4e88999 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -13,9 +13,6 @@ #define CMDQ_NO_TIMEOUT 0xffffffffu -/** cmdq event maximum */ -#define CMDQ_MAX_EVENT 0x3ff - struct cmdq_pkt; struct cmdq_client { -- 1.9.1