Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4011052imb; Wed, 6 Mar 2019 03:07:45 -0800 (PST) X-Google-Smtp-Source: APXvYqx+FfzBYNANxxfSwDn5F0mATRWoqyqRa8b0oiigVgLoCrZvQveZZ6k0QNXvmdh2gw8j8fi6 X-Received: by 2002:a63:6545:: with SMTP id z66mr5886236pgb.182.1551870465511; Wed, 06 Mar 2019 03:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551870465; cv=none; d=google.com; s=arc-20160816; b=rwolBmKJpCj0Y7zOyR+icX26IcN9wrjvcbOt9Br283Ltx8Iea54Qej3tmeBxHP6f2o NdZgpNWyib56uhMABNYhRT8nrj3LDcqmeTfDph8Eml8gcVD9FSfg0TX4seZCEYCBHU/W 78NW9XvsxIJPwkkYWTELs3g9fGqmNMaV7p8h0ItHrvPVULK7Tm8AGJSXtas3JFSjIinx +vfCyPb80EGqAsYXLd4KA3vENriFOquO+cK6gnw3q1nkk6TNeeCyGaxWLHqvDwtjpK7C w0UAp4fs2l4o9KlIvFeyxmMzgzJqITfOliy9pH4zFnJVrmqQnNWtTgo8K1pS5BYCLTSC kEkw== 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=cmgFdCUhCju7vLjte7026mIm9lwEEXp6FrAPlK3QFg4=; b=0K5bxdwOmhJfCz+KpfgESBFC0j6EzSg02rikMY/iCUzW5Oq4PThl3cM6ontCQjiVHW mE9KVPvIchoZexREHrHPpR3ivijw39M0gF3awe61XXP4fy7166Jng5vxvmDBPn2vo6Td t1M5zQ6RBNSpMhwhzF35LLprW3q/s4IaEerEoy953VT0FsE//GQTeTMoGSEv2ex0DXVP vV/u98W+9Uo8TMEL2EuESz0rZZkgVq2PzVuo8VpoAjF3XYcj5DoBEajZULgWyM5HiM2N xx/U7k9qDrqUOZUwKDiPuOHc6mtosS84IHoaBX4ZlRAydTsfiSFRkbjvJgaC6BioGgBv UlXw== 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 61si1046692plc.134.2019.03.06.03.07.30; Wed, 06 Mar 2019 03:07:45 -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 S1730019AbfCFJvb (ORCPT + 99 others); Wed, 6 Mar 2019 04:51:31 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:47991 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729904AbfCFJuz (ORCPT ); Wed, 6 Mar 2019 04:50:55 -0500 X-UUID: fe1cf75f51884d76a84d0e503b2211d9-20190306 X-UUID: fe1cf75f51884d76a84d0e503b2211d9-20190306 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1433124800; Wed, 06 Mar 2019 17:50:43 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 6 Mar 2019 17:50:38 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 6 Mar 2019 17:50:38 +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 v2 06/10] soc: mediatek: cmdq: clear the event in cmdq initial flow Date: Wed, 6 Mar 2019 17:50:31 +0800 Message-ID: <1551865835-50974-7-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1551865835-50974-1-git-send-email-bibby.hsieh@mediatek.com> References: <1551865835-50974-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 76201BCD511718890A0025E9A3C3FEF14A0B54AD6E19EA7CB7C12D4F0640A29D2000: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. Fixup commit 623a6143a845 ("mailbox: mediatek: Add Mediatek CMDQ driver") 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 6db1e2d..4e744cf 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