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: 13705073 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 5251BC41513 for ; Thu, 20 Jun 2024 10:08:15 +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=GW5BUgKtL4af/31ljc9wgMATgj GOmkKl9t29Z4rZicK1awCIp4CVn7VRsnuHZdEDc/2c+gcO2ggUAiKC+2lVoaYrHjinbT9eT8KNfsM g5JUKHiurr1R10LCSbeuUE4r4ZMeGfswnNnT4HAiz69oir7X2Lhj3NjLjUyGQ1eBpcWlhicUUumtn 0H36jNO5gqutQ8AOFf+0s0Pj+xCrnCQLrtWjTXjolGIIEYNl7ceWc7cBFEYVmEcdfJ3WoM1VcG7lU g1FPXTp9xVn58x8Xny+OTMz7riU/N3hxom+2gAhYaUvPuTkgrrshJKA4jpaWcoo2Iy+QQqg9a2X48 H/PxkmiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEiE-00000004VNu-33jI; Thu, 20 Jun 2024 10:08:14 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13705076 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 5DA6BC2BA1A for ; Thu, 20 Jun 2024 10:08:32 +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=WVrvz9NvIlddFE51m/cdcb7NBZ TnPH+lH31MAb+/hWSR3XhjJZ8CVSxfibNwfSxD06yXtdE+YruYc8NwGlMATdWm5KYVL8pv3lWNws7 Og1uWqDnNSRn3d6fqNYrbfwnRUoZ36DVes/G9+N/l54T1MA7S41RCCMMuSdrQd7xQsiIg0syBsheC sh1abSsGZoiaTolOWuHwORZji1KKZWzbbiQILeuj1G4s/VRCfmO33eN+WdhJtX6B1mNZM+1tiS8hf 531cG6n3S/y0Sp+AVtrijBxnjHE2/OfZrwbfTPd3Og+9+psWIeZBP4GPwvQqg8cIgj4LtHxBDUyX4 ogU0hmKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEiV-00000004VYS-3e5R; Thu, 20 Jun 2024 10:08:31 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13705075 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 D3D44C27C79 for ; Thu, 20 Jun 2024 10:08:31 +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=Bfejs3RbQiiFKIPzkddF/tSgIv N2smZjKGTcBamZMwRvn51ouxlQtSjKjHLjTCDvs2zxL75O9RcKI03N0dKR4PaEUONSJOTHeycbYI/ qMby00JGNayrm10oXT4TlT0U7HrV3C3JKQ/SSAPp+KIVtAhacmy7r6tHq5l4nkCSnJznzQEZJJmuR 0whItypPkL+AqJUwwUfRyrNL61WbIbCvRUMuzCDhM///BbcGEkZctP4rRkYjlcBGd2FhRAWxg1SSg ANR12aEu1tvEpyqGumSMtu2nuQig9CcwbTrvdCNe3kVakFH9uLIRVp/4EVshFxWld4tfHA4HBV8Cp 19OLgxVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEiV-00000004VXy-1Zhm; Thu, 20 Jun 2024 10:08:31 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 13705077 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 E44E5C27C79 for ; Thu, 20 Jun 2024 10:08:42 +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=sLOPrXan0yXVnXMt/4AUO3ytQw Rb7bJQfYBCLLFsiQ1k8FBB/lQEfEpCrfOkgtFmeP/70hun2UZUgAIdtMimU/97yt8iiGw12butKO2 r2aRUOeyRCOwgkb1slVft86TYqhsTUHbiEQdP7Abc7RRx0GQ/4yvhEDeo1p+kPlPF+LFMIoKkDbFu htQJa1xSVCN3brU0W4reYgUtyW36of3rAvl75JnXqJky8IVyfUTrwGPh4SMW9rV/tdHjS4PZJSRa5 LQuEKxY1ornJICr2B4u+96pibFNSTnTr9W9b760R8jjjHBarkdTzxWPt7R9E8tscb/LT6CUT3DV01 xguePt2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKEig-00000004VfY-2C7m; Thu, 20 Jun 2024 10:08:42 +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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: