From patchwork Thu Jun 20 10:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13705078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A570C27C79 for ; Thu, 20 Jun 2024 10:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hZpY1O6ObrCWzPE53y30c4iuVMHGe0upfn5Eh4ECaOA=; b=FQaRj3eWIOFTOPYMY/dJ4skpBJ UM3m+Hm2vfyhXZH4HMQoEtDH+BtpKP6ChkeRIJ2z5p4VjueVrdyopoOGJWGKWJiG5c6X7wfZAq9GR Ds7GP6+mJOOWN7z7XgjIcZAvnDLgKQJ+xtU4xqs1P8a8AxEOv5C9MZAo9OcRaIlsSfQQPySKhOdoA SEF3XltlfxZzR2syj0V9Khly30Kfvvikj8qaqKTKJEM8QPXPWDEQePXLc6O87oqWfgye8exDHaq/E 5VqRWa2HFWzl5tLG0vrg+7XkJapa3jPtjnOIk4Jr5JvPYUscfikHGePVMVVlIJ30o1EViuNspM0S1 yoVI6AvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEiD-00000004VN3-0z0g; Thu, 20 Jun 2024 10:08:13 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEi8-00000004VJi-21mF; Thu, 20 Jun 2024 10:08:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1718878085; bh=uPSc/aFYOBicJU5ByMPn/EfmfsVERpR9NIo+Kp9Kuaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FQMd+sGaS9mWBAyggmubXUNDCT5UwAkXnXEqZhteD8k10mWqw27ky2hY4eoJ6d0H3 X9n5Kj0sN4A2YFJywWr8RPm0r/GD5+7MJ06SxpTZc1Ndh+915udFvdVMCs+Iv6ZuQa eEH5XWMa5yAyAVleCj9AvYcCZ56OEHWBavdbV6RD9/6CYSRlganxtXct8zQEJ14xLu drQLdqQuDKIWh/hc3OKVXD8ecBvOV7TcGUbhlLw5jeaxGuPG2VjRPmM80VjPJGFv+a rjvncXjkQj78TKTBlWYbuIAWoI5dEEty5Vks3T8H2XZod8vnYCQXce4vfbftDjSrdM +bTAJ9m5QYj8g== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 1DB2137821AA; Thu, 20 Jun 2024 10:08:05 +0000 (UTC) From: AngeloGioacchino Del Regno To: jassisinghbrar@gmail.com Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, houlong.wei@mediatek.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 1/4] mailbox: mtk-cmdq: Stop requiring name for GCE clock Date: Thu, 20 Jun 2024 12:07:47 +0200 Message-ID: <20240620100750.1075790-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> References: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240620_030808_727972_8B708C82 X-CRM114-Status: GOOD ( 10.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Global Command Engine mailbox has only one clock hence requiring clock-names is useless. Get the first (and only) clock instead, without name checks. Signed-off-by: AngeloGioacchino Del Regno --- drivers/mailbox/mtk-cmdq-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index 4aa394e91109..66dbc8e846d8 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -629,7 +629,7 @@ static int cmdq_probe(struct platform_device *pdev) } } else { cmdq->clocks[alias_id].id = clk_name; - cmdq->clocks[alias_id].clk = devm_clk_get(&pdev->dev, clk_name); + cmdq->clocks[alias_id].clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(cmdq->clocks[alias_id].clk)) { return dev_err_probe(dev, PTR_ERR(cmdq->clocks[alias_id].clk), "failed to get gce clk\n"); From patchwork Thu Jun 20 10:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13705082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D1C0C2BA1A for ; Thu, 20 Jun 2024 10:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uuc45dcsOFbDklcbCax139/gFsVDU2FrxHYl+FzFARc=; b=hYz5AQl7+k8qOB5dw7WGA/LS1L TWk5qAPXMuYRzpxSCrrLCvkE2t6VTJVRhD6VVD1VKzfy9bMyKfUKc6p2YjKTrrPUZfPzPXa/UR6ld chBQ+q8xGJ9zC/XnxkOXnGcguIfxvgEla8iDtAtUULsYrrVjfhaMdEL7BIt/D4GtxD6rgvGOuWMWz v+w4I9oj28RKYMvb6CEeTQ/pZs0V77syPFMvEhOtIxA3txqxDAKq3o2XUZBepoB+IBIQDuPS/R/7F O/CMZDmviQNxeDCGBW/cW7v8NrVdE7qGiNKc1v7EaEdNGZkM8kpAuWXEpsYiq9frRT91ty67hiSE+ QRstknnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEin-00000004Vjo-1VRD; Thu, 20 Jun 2024 10:08:49 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEi8-00000004VJk-37bB; Thu, 20 Jun 2024 10:08:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1718878086; bh=sKfuDPm0OAAN0rcXZxSfirkK6rJX8HN3Ps/0YrvMzTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/p8SCWvK4KdRf8+yrMiUmtbizUsMaUK3NU8hD5F+oPD2sG21vS2UEhwv9kMzTLnt Vy49BBq19VnIr5OG47pbT6XNnO70XjtKbuXGrwdqDgmB0YCh+JO3mokMsl6uk3M7OP mbfIYetcovSGCulGMLc5uykdrQVGXb6zwQGAHXF5e3uiZlGGw+0wqjc/9xlwpl+Rjo wH0wWtXmmgVJqgGUVD5gFLrzUtREkhUI8naF+kX0sTPi2nzWcO94umMgZqGzQT+ro7 a05A9rPd24i5aAFgT0QnKDqGlsIfMdBg+7awt30Wzt+sL3JxH4UCb1l2/XLNlC+1yz UHz4bXcqa3VqA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 1D26437821B0; Thu, 20 Jun 2024 10:08:06 +0000 (UTC) From: AngeloGioacchino Del Regno To: jassisinghbrar@gmail.com Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, houlong.wei@mediatek.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 2/4] mailbox: mtk-cmdq: Move and partially refactor clocks probe Date: Thu, 20 Jun 2024 12:07:48 +0200 Message-ID: <20240620100750.1075790-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> References: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240620_030808_947499_CEFCD314 X-CRM114-Status: GOOD ( 18.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move the clocks probe to a new cmdq_get_clocks() function; while at it, partially refactor the code: Drop the clk_names[] array and assign clock names to the array of clk_bulk_data with devm_kasprintf() instead, slightly reduce the indentation for the multi-gce clock probe path and add a comment describing the reason why we get clocks of other GCE instance instead of just the clock from the one that it is getting probed. Signed-off-by: AngeloGioacchino Del Regno --- drivers/mailbox/mtk-cmdq-mailbox.c | 79 +++++++++++++++++++----------- 1 file changed, 51 insertions(+), 28 deletions(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index 66dbc8e846d8..a3f57151a221 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -578,16 +578,59 @@ static struct mbox_chan *cmdq_xlate(struct mbox_controller *mbox, return &mbox->chans[ind]; } +static int cmdq_get_clocks(struct device *dev, struct cmdq *cmdq) +{ + static const char * const gce_name = "gce"; + struct device_node *node, *parent = dev->of_node->parent; + struct clk_bulk_data *clks; + + if (cmdq->pdata->gce_num == 1) { + clks = &cmdq->clocks[0]; + + clks->id = gce_name; + clks->clk = devm_clk_get(dev, NULL); + if (IS_ERR(clks->clk)) + return dev_err_probe(dev, PTR_ERR(clks->clk), + "failed to get gce clock\n"); + + return 0; + } + + /* + * If there is more than one GCE, get the clocks for the others too, + * as the clock of the main GCE must be enabled for additional IPs + * to be reachable. + */ + for_each_child_of_node(parent, node) { + int alias_id = of_alias_get_id(node, gce_name); + + if (alias_id < 0 || alias_id >= cmdq->pdata->gce_num) + continue; + + clks = &cmdq->clocks[alias_id]; + + clks->id = devm_kasprintf(dev, GFP_KERNEL, "gce%d", alias_id); + if (!clks->id) { + of_node_put(node); + return -ENOMEM; + } + + clks->clk = of_clk_get(node, 0); + if (IS_ERR(clks->clk)) { + of_node_put(node); + return dev_err_probe(dev, PTR_ERR(clks->clk), + "failed to get gce%d clock\n", alias_id); + } + } + + return 0; +} + static int cmdq_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct cmdq *cmdq; int err, i; - struct device_node *phandle = dev->of_node; - struct device_node *node; - int alias_id = 0; - static const char * const clk_name = "gce"; - static const char * const clk_names[] = { "gce0", "gce1" }; cmdq = devm_kzalloc(dev, sizeof(*cmdq), GFP_KERNEL); if (!cmdq) @@ -612,29 +655,9 @@ static int cmdq_probe(struct platform_device *pdev) dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n", dev, cmdq->base, cmdq->irq); - if (cmdq->pdata->gce_num > 1) { - for_each_child_of_node(phandle->parent, node) { - alias_id = of_alias_get_id(node, clk_name); - if (alias_id >= 0 && alias_id < cmdq->pdata->gce_num) { - cmdq->clocks[alias_id].id = clk_names[alias_id]; - cmdq->clocks[alias_id].clk = of_clk_get(node, 0); - if (IS_ERR(cmdq->clocks[alias_id].clk)) { - of_node_put(node); - return dev_err_probe(dev, - PTR_ERR(cmdq->clocks[alias_id].clk), - "failed to get gce clk: %d\n", - alias_id); - } - } - } - } else { - cmdq->clocks[alias_id].id = clk_name; - cmdq->clocks[alias_id].clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(cmdq->clocks[alias_id].clk)) { - return dev_err_probe(dev, PTR_ERR(cmdq->clocks[alias_id].clk), - "failed to get gce clk\n"); - } - } + err = cmdq_get_clocks(dev, cmdq); + if (err) + return err; cmdq->mbox.dev = dev; cmdq->mbox.chans = devm_kcalloc(dev, cmdq->pdata->thread_nr, From patchwork Thu Jun 20 10:07:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13705080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C34CC27C79 for ; Thu, 20 Jun 2024 10:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qNexE38T1XOJX3OeY5vUi1siBpItSGLAITa9a+bu2/g=; b=cCCee9mguMoFO6ZXww6DTtAXdZ m4cOzgKqTW6Q8dpymvslsc1H2oXEdaNrWcBsCJv3BfZqQE2EfaVYwTcboLa2AJCpjC5ZvCpJFi3w7 c0tuRlGjO//fCt3W7UouJD/OJ3V0mA+aRPOAsQCpMys7U/IG8VG0Awfex8UeDHnsnD3nQzhGt7LHS LE35V84QH+xP9EAlR7gW2vKIEjpiqpsr6XTHgS1CO1HIYmJoC0PcSDh4FeB8j8Ey63SAnD6rYKiN7 P6+7EkfLZ0CEswVCezaNGhgxzwNhVx/Mw9MjQgq/aRg5YanjdzM3DrDbyh0o2UfF/KuhLGi/nyosB lPFp++5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEiR-00000004VVw-1iCK; Thu, 20 Jun 2024 10:08:27 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEi9-00000004VJn-1Jbp; Thu, 20 Jun 2024 10:08:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1718878087; bh=ShQWh8bzftJTk5vQIrat2XfQUBjG3sEAiV/WjU/elxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2HMPMDYVWcGq4PnV37zbmAF+xEMSeM1JJDsyy6MTm13uJQdDX6DxIhm5NRTlYTmP /FukztWTTEajkuZYRD5GY8JiziXDIhKTLQlNy+PwIvnJH61PZUZR4n/g3ZJGF7D+Zf WQQ7imfkObBRppAQYAsGwGPbHPmUz3Ma45O9nguyEdJXEl7hbKCibpTfieluNt67Dc 4Iv1hK0xUFvUGyZpfg6tz37WdVyTY6nCRzhrOXkf7IhZc2gKAPbrKvAmp7VVKiZx1V kchRBPJvFtHZCY6RK11qtgAXxuP05p0olNt984jskAzWjihBkZAGbnMHkxwgMfQKRJ 3dM6Ef0eERang== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 1AAE837821B5; Thu, 20 Jun 2024 10:08:07 +0000 (UTC) From: AngeloGioacchino Del Regno To: jassisinghbrar@gmail.com Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, houlong.wei@mediatek.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/4] mailbox: mtk-cmdq: Dynamically allocate clk_bulk_data structure Date: Thu, 20 Jun 2024 12:07:49 +0200 Message-ID: <20240620100750.1075790-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> References: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240620_030809_507441_A1F4596C X-CRM114-Status: GOOD ( 12.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that the clock probing code uses devm_kasprintf(), there is no more restriction on the number of GCEs: dynamically allocate the clk_bulk_data clocks array to improve flexibility and also to get a slight memory saving on platforms featuring only one CMDQ mailbox (and consequently only one Global Command Engine). Signed-off-by: AngeloGioacchino Del Regno --- drivers/mailbox/mtk-cmdq-mailbox.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index a3f57151a221..2a71a5400088 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -22,7 +22,6 @@ #define CMDQ_OP_CODE_MASK (0xff << CMDQ_OP_CODE_SHIFT) #define CMDQ_NUM_CMD(t) (t->cmd_buf_size / CMDQ_INST_SIZE) -#define CMDQ_GCE_NUM_MAX (2) #define CMDQ_CURR_IRQ_STATUS 0x10 #define CMDQ_SYNC_TOKEN_UPDATE 0x68 @@ -81,7 +80,7 @@ struct cmdq { u32 irq_mask; const struct gce_plat *pdata; struct cmdq_thread *thread; - struct clk_bulk_data clocks[CMDQ_GCE_NUM_MAX]; + struct clk_bulk_data *clocks; bool suspended; }; @@ -584,6 +583,11 @@ static int cmdq_get_clocks(struct device *dev, struct cmdq *cmdq) struct device_node *node, *parent = dev->of_node->parent; struct clk_bulk_data *clks; + cmdq->clocks = devm_kcalloc(dev, cmdq->pdata->gce_num, + sizeof(cmdq->clocks), GFP_KERNEL); + if (!cmdq->clocks) + return -ENOMEM; + if (cmdq->pdata->gce_num == 1) { clks = &cmdq->clocks[0]; From patchwork Thu Jun 20 10:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13705081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35AF1C2BA18 for ; Thu, 20 Jun 2024 10:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WBfXbGSZzJ1bzOyGgFLoZdQ7cLHObW7qQd4WribkHLY=; b=ObKVvSmux4WsbNJ0LmvWcMcKlJ NJz/ugN9V2IPQ3wnaMfEKccBlfN/zadtNy5q3c7i/RRH/DCzKpMGwMHdmAFTbwjILMS9vePPFpVdK SCypXW95ryaEoN+aU/XF2eIyqXD95piGJoS9Z8wM8lVY52EP6WpfzF3/W2Jeecw6QpH2amU+zZI1A sJxHnI7v5xGxoT58Lc1OhUFnF8a0lzy5k1Tr9uOtFoDTSTHhtFnM1GJJILEIxwMxuPH+roYuECWPz Wcio+LYUsoMr1NeWr0so5Ckj8KCksyqUT9Y4MullFBfOCoxh0oL4hX9Zcm9hQZnmJm34guBTFjHZ8 q1aaKnjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEid-00000004Vdh-0QII; Thu, 20 Jun 2024 10:08:39 +0000 Received: from madrid.collaboradmins.com ([46.235.227.194]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEiA-00000004VKa-06MD; Thu, 20 Jun 2024 10:08:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1718878088; bh=Qj/kipAraX9/0CVC2c8sN/n2d+6ockxINPF5uDszWlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gV/5gmma6Co/G7DtA+fQ1jljPvTh6b/RlAEPYpuQRpZCQoXDdG3ggbCBD5hW7IpTB srLuDy2qRmJxHsX98n93oQbeWHPplZyDqmJogTIy4BPM6tv8SGzS1KJ3PASqTrFUXA d5eRRAhY3WR2vVciJds3aAMJWdTlRALiiWBis1tEZYxj52YMBmDqoeBucWWwM8Xs2p 7Xoh92coDKYrurL2X7vFP5utWUmXwP3RNTvJqLijIpQpMZLlgKeHb2i1etvF1yFWV9 4jE6ndyo6ejBCk95jHM1JP9Sryz0lpzlq/ou7AQChASzcDn8Gf9Fe8JnosxPTqmYuZ zo7kmVZA4O8Pw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 17FCF37821B9; Thu, 20 Jun 2024 10:08:08 +0000 (UTC) From: AngeloGioacchino Del Regno To: jassisinghbrar@gmail.com Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, houlong.wei@mediatek.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 4/4] dt-bindings: mailbox: mediatek,gce-mailbox: Stop requiring clock-names Date: Thu, 20 Jun 2024 12:07:50 +0200 Message-ID: <20240620100750.1075790-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> References: <20240620100750.1075790-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240620_030810_352282_74A76BD5 X-CRM114-Status: UNSURE ( 7.12 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On all MediaTek SoCs, each GCE Mailbox have got only one single clock, and this is true in both SoCs with a single mailbox and ones with multiple mailboxes. Stop requiring clock-names on all GCEs, as there is and there will always be only one CMDQ clock per HW instance. Signed-off-by: AngeloGioacchino Del Regno --- .../bindings/mailbox/mediatek,gce-mailbox.yaml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Documentation/devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml b/Documentation/devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml index cef9d7601398..ff5d010fbcf0 100644 --- a/Documentation/devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml +++ b/Documentation/devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml @@ -56,17 +56,6 @@ required: - interrupts - clocks -allOf: - - if: - not: - properties: - compatible: - contains: - const: mediatek,mt8195-gce - then: - required: - - clock-names - additionalProperties: false examples: