Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp163701rdb; Wed, 14 Feb 2024 16:51:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZv9sriJHxdpW6/EZtjoewNeRVy5PTFJCiV09+O1vBdL7RTqfsuRnJaUhLxRI4lEzLg2UsqXepHGnHUadj8rNMvelbrHae0ncr4UaVCQ== X-Google-Smtp-Source: AGHT+IHqJBG2sEFCVlPl4grjvLkXtKIOQCK7XTjy9CoftTeSDgcPDrW/LEUwQwHrohJGp1antu01 X-Received: by 2002:a05:620a:122d:b0:787:272d:e269 with SMTP id v13-20020a05620a122d00b00787272de269mr388540qkj.27.1707958313423; Wed, 14 Feb 2024 16:51:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707958313; cv=pass; d=google.com; s=arc-20160816; b=0z4fjUFKzo0fNeYDTWZZZY2OY2bESBAEzd5jlMgw1ycwB/4pEjzXrJefh5ihAJSSA8 oDVDJTG71qRg+YULGvuZc7cfxAeEH1fpc/OsciGT7yyWqt3ptII6LvQPcTp8vRJY5CYC kynlMru/rC8lzJdbRFOZYT0ILYEOODcTW9BLKQA1utVvH4W2aD2adpFy7EAP5SN4xDeY LpefEUU2USE7kYzhRVkMDbx2V9wt4N5THPwevPo8iyc4+oGJFETJ8uiOFu6NQaWOizO8 +LptQLlQ9czO3tKZxmlSZjOr1d8rRgziTsgMeW/oRHU2oQlv0vEYjZE1B0OiFhHWgO7F 7uEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TL24nmqzcuN/aA6k9o6mlcLy+zY4riqwYRuIiIlz3yM=; fh=5fJ5HuOhQ8tDYrJs098Y1CAol/Fv56LtamixBAqCzME=; b=pkGKWbshRP4n3kZYMsYprWyiv5i19cIDR4hd6jSaf6629Zm5xiNU/WHh4PGBUUVfI1 KXcA9tRDqvjYiO6gNaupFHI/+m3Asc3gIQQVEHimFu2d26XE0rCaMEJqS6PxCIQQTBK/ G7LSdaEnW+cIP+7O1qIqTIoAiCAW7YWV5DQnSGAuy0eFjgWv7cAOS05gV4xyg75AoTcy Frm27CSCpnkCJvsWWSX2kru/Gga8XifKRXGeXbRAZyLa5e4Mv8aEtQv4awWX6eqZy6je rXq7x0Y0zZyA/D3467MUMhfviWHZZFXQYVdp6aPT+zEOPIdmHwINzhEVJW/eNEpnBUdb Aotg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BG8swuC7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-66199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bk15-20020a05620a1a0f00b0078732d4c2desi402533qkb.85.2024.02.14.16.51.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 16:51:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BG8swuC7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-66199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EF0441C22D8B for ; Thu, 15 Feb 2024 00:51:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9688B663; Thu, 15 Feb 2024 00:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BG8swuC7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0E3918F6F; Thu, 15 Feb 2024 00:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707958211; cv=none; b=GPnJ/VWDUjegsU+Pg9ybFjMjUc0GDKrYURZ+cu8vdNklK7z7AeA1Y+zP85YTdTXyUTYJBxKnwgcfLBA+ud79//YvNDffoEfOITtf+l31ILQbF1argWmAYPf9bYyvg3hVbFvu5nij5Z9NUV2j4c4zhqaRtxVxIxeO2f3axfdo48g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707958211; c=relaxed/simple; bh=7Y5HUcTOOASw7q/i66H/i3KoMA/Mx0KFs62yKsM7Q3U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i1kprDMUG6VBEB2mnB88ezjyfhoPaerVBpHTXujCiz1diI9SEbvQj8pGunsgUJFZagaqK1cugRmw/GdLMQdj7xYzXPAOOHJTvIsieEZ+s8bEwzfbBzg3uj4Wu2/Oz2z3L48wMSOelK4qMpvt1fr2bJElaBzU7YVHFGdkF0CNeT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BG8swuC7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E13C433F1; Thu, 15 Feb 2024 00:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707958210; bh=7Y5HUcTOOASw7q/i66H/i3KoMA/Mx0KFs62yKsM7Q3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BG8swuC7G7o0rc6PZD+BP6DnZFqHhFPMSq6dQMm688+1cJOISJSAFtHpXi2YZs7Ol WeM5Fd70Is5xAllHt8MST0VoNH9/LjZeSNVZrZsaMs/kgdrFr9/8iIkpehRk2W+Ne3 aJyHnj0GkzPRAbiJdEgODAgTUqlsO12INSZffnQsk1XIV+W8jI2vYWyvUYgddYR8Fl BOHn13x+9jah2yOtFMQAJIB8uo9dfOc1Z9GYHhvFdWyLACPuFqdbel/LDDss5AGfc4 A3+Qn1MAxuyNIig+Xz/u5MAzjDAUoHUbC44eYRyOfN2e1QnoaavfLaCGt/CNTO7wOn ZNF7737Oj0biw== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH 4/9] soc: mediatek: cmdq: Add cmdq_pkt_nop() helper function Date: Thu, 15 Feb 2024 00:49:26 +0000 Message-Id: <20240215004931.3808-5-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215004931.3808-1-chunkuang.hu@kernel.org> References: <20240215004931.3808-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit cmdq_pkt_nop() append nop command to the packet. nop command ask GCE to do no operation. Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 11 +++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index e982997117c2..1be950b4ec7f 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -369,6 +369,17 @@ int cmdq_pkt_eoc(struct cmdq_pkt *pkt) } EXPORT_SYMBOL(cmdq_pkt_eoc); +int cmdq_pkt_nop(struct cmdq_pkt *pkt, u8 shift_pa) +{ + struct cmdq_instruction inst = { {0} }; + + /* Jumping to next instruction is equal to no operation */ + inst.op = CMDQ_CODE_JUMP; + inst.value = CMDQ_INST_SIZE >> shift_pa; + return cmdq_pkt_append_command(pkt, inst); +} +EXPORT_SYMBOL(cmdq_pkt_nop); + int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { struct cmdq_instruction inst = { {0} }; diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index a67f719dec0b..8179ba5238f9 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -255,6 +255,17 @@ int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); */ int cmdq_pkt_eoc(struct cmdq_pkt *pkt); +/** + * cmdq_pkt_nop() - Append nop command to the CMDQ packet, ask GCE + * to do no operation. + * @pkt: the CMDQ packet + * @shift_pa: shift bits of physical address in CMDQ instruction. This value + * is got by cmdq_get_shift_pa(). + * + * Return: 0 for success; else the error code is returned + */ +int cmdq_pkt_nop(struct cmdq_pkt *pkt, u8 shift_pa); + /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. * @pkt: the CMDQ packet @@ -361,6 +372,11 @@ static inline int cmdq_pkt_eoc(struct cmdq_pkt *pkt) return -EINVAL; } +static inline int cmdq_pkt_nop(struct cmdq_pkt *pkt, u8 shift_pa) +{ + return -EINVAL; +} + static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { return -EINVAL; -- 2.34.1