From patchwork Thu Feb 15 00:49:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 201214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp86034dyb; Wed, 14 Feb 2024 16:51:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmKlTtyPo/5UwlEvn4XTQ/WNONpQ9vEZJA22ntNw1btGG8vW9THuzft/BQpwNHATbvrxn9YSR3heenJO+ONPPtF6RFHw== X-Google-Smtp-Source: AGHT+IHM6DySaTs3//FSyzdRiix55mB54QNB2SgeP3UGhtui5wqGWEdw6Jtgx05daSlZ6c31yuPy X-Received: by 2002:a05:620a:14ad:b0:785:86e7:ed9c with SMTP id x13-20020a05620a14ad00b0078586e7ed9cmr441209qkj.2.1707958317860; Wed, 14 Feb 2024 16:51:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707958317; cv=pass; d=google.com; s=arc-20160816; b=y/tcv2urteJZQwAAx7uEHacOoVwpJAipw5Q7IoqKaUvlt2e51FMfj8VCd89Y5YJaX+ VHgLA2oLQaNV1FnkTsVCvKgycT/Sdg0HGiS1I+pqOVV6AlrdBO2sfrMPO5LCvTUIj8Pb WIQZaScln79s7ikOcwhtOqKvJRr52xuKJExmC1DMfgLr2joKHlvTZtyP0ycVCfhHSA9V T/8YPKooeIqnn6sxZmg4o0UoFMRAlnbLqDc769ctPUxipRtz0bMYGVDfCltIxg/Ul5iR An+V/LYXI6VTvKbwCF23vVxx/6zioXoEXcv/7UNgoWfRAwVjxmCH5T3Kt0VXSPIdDlUL iOdQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66199-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v20-20020a05620a0a9400b00785c992a039si337038qkg.597.2024.02.14.16.51.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 16:51:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66199-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66199-ouuuleilei=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 16A0F1C26AD5 for ; Thu, 15 Feb 2024 00:51:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FE40BA55; Thu, 15 Feb 2024 00:50:13 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790924101206951306 X-GMAIL-MSGID: 1790924101206951306 cmdq_pkt_nop() append nop command to the packet. nop command ask GCE to do no operation. Signed-off-by: Chun-Kuang Hu Reviewed-by: AngeloGioacchino Del Regno --- 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;