Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2528209lqz; Tue, 2 Apr 2024 23:57:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWcgbjWeUZdzinkRYNzs0BrEhhSbufYFRr/wzltb3L7PZVEWS6aYAEQakp4qWGJGo9oWLVeddUx48egdRyJGYiPZKLneB81/ZFvmoGvvA== X-Google-Smtp-Source: AGHT+IHi0EDhNHxKWpf5pUt4YS/OR+P+pjWyb7HZyVZ+Xo5RuZcfQqiwdwBcbc+OBnwUJiIwsiqi X-Received: by 2002:a17:902:f691:b0:1e0:93b1:3a31 with SMTP id l17-20020a170902f69100b001e093b13a31mr2449472plg.18.1712127473550; Tue, 02 Apr 2024 23:57:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712127473; cv=pass; d=google.com; s=arc-20160816; b=yqxmmH2pdTEiwmggG9ag/nJbi1OpbbuEKfuDv/5zMphWK3JMxBhjkEO7gcKqeWyzS9 I579hjefl1CsWvUsfEUVdGsIUZEkCkI4vG5dZWQJX3gy4PsU4BKYTlt/IyHGaMoklDCw y9yKLeRPuMIyaDbHlarSgED1+lSsgXnDtbYbWXVFQAE4cPQiH59jmEzE/52r4nd/SWHF 1Ug0H+YRzDr7ILymTBzOaEyskT4WrQUsW7KR5Fjb5PTdyCCpZ5SLbBDotP3VlWfvGeMe SxVIWyfu/1MIRXN9QCO1S2f/G2AdcLt3qXM/YQ/yyjavqqFx3dwV4Pm0HpvQRAWvXPT0 3E+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dE8CZiIfKmGvgzSpu7F40SqpTOE/8BzlXpTbCxlZZYk=; fh=tIGUu/tS8clb6eJPLiL5PWTs4hLnmMTnIPhkNYRWhig=; b=T2yYZ8v3RAGo7DCSnNFthzdlcGe1q8PKR3uy0c3whqOVD/oxL2W53bisOEXE9kARW3 0CDkejEwqsGZDk5vw1++IVtnbOldpu1fB1IHP+9jGpXUzKBbxRMXyPh38lVTeyzC3ueH lq7l/zyxek6mNTb/OYUzbWJztqiyV1g6YIvUDw8n5cEdmxcyWOqV2kA5abyAzT/PXYVz RXNhF49VsVBEXyzjOr+vDrukZqOQtVta0MnNEUwaMNpPqga/kr4+zykg5SxaL9m2zY21 OJBCNqmYDR6kxpcMHXb5Ezx4ESGkqrP5vw1tuF4rM73SW6meRR0zmKAjGV7GxCSFuZxZ Z1ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=fybZKq0J; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-129109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s10-20020a170902ea0a00b001d8e974ed1dsi12827071plg.507.2024.04.02.23.57.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 23:57:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=fybZKq0J; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-129109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3A6332840A9 for ; Wed, 3 Apr 2024 06:57:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13E2C60ED1; Wed, 3 Apr 2024 06:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="fybZKq0J" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B29B5D731; Wed, 3 Apr 2024 06:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712127381; cv=none; b=D5+nuMEi7qLQyHGqkOAVFZ7oPo5qHBwPkE0kj/rZAQ77EYDRUay6OQKyHlss7msJe7wbvje/esimDSd3MOTRbTEwYIBZCZeJZRnmzAP3rypYDNPY3/MAg9Br4OafMVoCy+36TgZil+4z0nJp651xDzEY6m+HIvHWoEW3LH45+f4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712127381; c=relaxed/simple; bh=FPNN1O1Ns1b9srR31qOdIOjpst4gecd0X1Q9WoSiXOM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gaTnBZoueJ9IT2P/756o+ATUB0lLjg2OA22L8N6iPv3hHrOsDJxEw9AMrpsciZf0bExe1SrjlkUWM6up1khC82eibSgu6oIv0XO895FvXW/eI1hLdBJ+74To5aK/4oP895cKEsohJQylvbQ+dbo33FQUAn8rZR4DQIjRfFliK+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=fybZKq0J; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 3ed6b40ef18711eeb8927bc1f75efef4-20240403 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=dE8CZiIfKmGvgzSpu7F40SqpTOE/8BzlXpTbCxlZZYk=; b=fybZKq0JcHMkE4gUkerEDJOP2uaKxOgE8ErIc+xRNtEKEQGXAbAXg3M2M5PgM4R5wXu5bsnf3SUkfUxsqtI1mqC7aknXRTheskv5pMYYmBY/9SB2g71uBDmN8TODp+TVy+a3X7o4iZUP84TmjDHnPC/m9DREmJy4Iig0YSis1M4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:5128f2ce-01f1-482f-a6dc-833862100dd3,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6f543d0,CLOUDID:4074c385-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 3ed6b40ef18711eeb8927bc1f75efef4-20240403 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 729852714; Wed, 03 Apr 2024 14:56:07 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 3 Apr 2024 14:56:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 3 Apr 2024 14:56:05 +0800 From: Shawn Sung To: CK Hu , Jassi Brar , AngeloGioacchino Del Regno CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , Hsiao Chien Sung , "Jason-JH . Lin" , Houlong Wei , , , , Subject: [PATCH v4 4/9] soc: mediatek: cmdq: Add cmdq_pkt_write_s_reg_value to support write value to reg Date: Wed, 3 Apr 2024 14:55:58 +0800 Message-ID: <20240403065603.21920-5-shawn.sung@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240403065603.21920-1-shawn.sung@mediatek.com> References: <20240403065603.21920-1-shawn.sung@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--0.636100-8.000000 X-TMASE-MatchedRID: yvDAzrttxFVvH7GZAcw0g8nUT+eskUQPLoYOuiLW+uW3zA6sbFwEjUiO 7+wNDdeY8AyWk2NFMNbijpjet3oGSAQmkMsZWj5BaK+MsTwM+1nEoDEGChh7CY1Oeo4wEgnh4Zq BDBR3qqFwiZTswXH9qIAy6p60ZV62fJ5/bZ6npdiujVRFkkVsm0VYvJDbAFkSlg/AIisVOb5l7h vMrjmw2XD7moxOdqjs/FpB9CS/XD0mTAwxQ5IiPidnO6jnpBt4ZAHSV/vY5Ue6wvEU69I2vY6H7 DI0GsVcMmI24qiENwrMpIbcl3IoA+q1XYAYw09q9Z1yWryVTWo= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.636100-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: CE74E8CC9BD28DFD694685B9C0F2F96CC51DF2ED01786BDEEDF2CCD9D9CC6A522000:8 X-MTK: N From: "Jason-JH.Lin" Add cmdq_pkt_write_s_reg_value to support write a value to a register. It appends write_s command to the command buffer in a CMDQ packet, ask GCE to excute a write instruction to write a value to a register with low 16 bits physical address offset. Signed-off-by: Jason-JH.Lin Signed-off-by: Hsiao Chien Sung --- drivers/soc/mediatek/mtk-cmdq-helper.c | 13 +++++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 818e6ab24370a..1d79a127f2d3e 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -289,6 +289,19 @@ int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, } EXPORT_SYMBOL(cmdq_pkt_write_s_value); +int cmdq_pkt_write_s_reg_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u32 value) +{ + struct cmdq_instruction inst = {}; + + inst.op = CMDQ_CODE_WRITE_S; + inst.dst_t = CMDQ_REG_TYPE; + inst.reg_dst = high_addr_reg_idx; + inst.value = value; + + return cmdq_pkt_append_command(pkt, inst); +} +EXPORT_SYMBOL(cmdq_pkt_write_s_reg_value); + int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u16 addr_low, u32 value, u32 mask) { diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 1edb391ec604a..854b8b3d6fad0 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -219,6 +219,17 @@ int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, */ int cmdq_pkt_mem_move(struct cmdq_pkt *pkt, dma_addr_t src_addr, dma_addr_t dst_addr); +/** + * cmdq_pkt_write_s_reg_value() - append write_s command to the CMDQ packet which + * write value to a register with low address pa + * @pkt: the CMDQ packet + * @high_addr_reg_idx: internal register ID which contains high address of pa + * @value: the specified target value + * + * Return: 0 for success; else the error code is returned + */ +int cmdq_pkt_write_s_reg_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, u32 value); + /** * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet * @pkt: the CMDQ packet -- 2.18.0