{"id":2175658,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2175658/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20251218-clk-mtk-improvements-v1-3-72db131ba148@baylibre.com>","date":"2025-12-18T17:17:01","name":"[3/8] clk: mediatek: add array size field for id_offs_map","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"db5f7b558191499add557ef1c6f7a4858a06c3dc","submitter":{"id":87228,"url":"http://patchwork.ozlabs.org/api/1.0/people/87228/?format=json","name":"David Lechner","email":"dlechner@baylibre.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.0/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20251218-clk-mtk-improvements-v1-3-72db131ba148@baylibre.com/mbox/","series":[{"id":485889,"url":"http://patchwork.ozlabs.org/api/1.0/series/485889/?format=json","date":"2025-12-18T17:16:58","name":"clk: mediatek: implement of_xlate and dump","version":1,"mbox":"http://patchwork.ozlabs.org/series/485889/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2175658/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20230601.gappssmtp.com\n header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256\n header.s=20230601 header.b=Qlb6+11y;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=baylibre.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20230601.gappssmtp.com\n header.i=@baylibre-com.20230601.gappssmtp.com header.b=\"Qlb6+11y\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=baylibre.com","phobos.denx.de;\n spf=pass smtp.mailfrom=dlechner@baylibre.com"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dXHT93PZ7z1y2f\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 19 Dec 2025 04:19:09 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 886C183700;\n\tThu, 18 Dec 2025 18:18:41 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 4ED918042F; Thu, 18 Dec 2025 18:18:10 +0100 (CET)","from mail-oa1-x30.google.com (mail-oa1-x30.google.com\n [IPv6:2001:4860:4864:20::30])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id DDA0483642\n for <u-boot@lists.denx.de>; Thu, 18 Dec 2025 18:18:07 +0100 (CET)","by mail-oa1-x30.google.com with SMTP id\n 586e51a60fabf-3e89d226c3aso599399fac.2\n for <u-boot@lists.denx.de>; Thu, 18 Dec 2025 09:18:07 -0800 (PST)","from [127.0.1.1] ([2600:8803:e7e4:500:e5ea:76dc:e589:2d5e])\n by smtp.gmail.com with ESMTPSA id\n 006d021491bc7-65cff214d66sm1316372eaf.9.2025.12.18.09.18.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 18 Dec 2025 09:18:06 -0800 (PST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1766078286;\n x=1766683086;\n darn=lists.denx.de;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to; bh=GKp0fr5JhUJcOhH4Hmt5nHr6hwz0Aouh98zA89Jj6CQ=;\n b=Qlb6+11yZ/yLXWXnH5ylG2SSAUcciw3t3e0hcMqNu2OyXdrxj/7ppU4gyX/+e+EF6X\n LyvJ1icjZFTnb8d7Zc0To3vnYqANt0zLKsM67up0wz1WnRPvGAh5oV/bz8Fr4JNaXWVg\n 7Ek0dyzNk+6MdmNsSkzZRIZ0nuE8CW4VYLfYmgk8ZEJVA3nedjiQgM9pl/XRDD1lQnyE\n ebvDDlGNnByt7lMHciKYXMhlusMt0eQn5vpK7C7T1QlbsZPkoI4e4cOegLZGccJboBMS\n HhXWjXHp0rUkH4n5MAc0TnDifmnKAYs3l8BJshwC/zofqaMp580ooPBJPnbBvwdm8wEn\n shNA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1766078286; x=1766683086;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=GKp0fr5JhUJcOhH4Hmt5nHr6hwz0Aouh98zA89Jj6CQ=;\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BSodftj\n bO3Gj3wg32owMZ578=","X-Google-Smtp-Source":"\n AGHT+IEKIKXOFq2fzYxsr6FLHOBJ15da2aDmhxURc1gpXTYJ3oLoyG4xU5znLLdJvZp+FRLPOPK+8Q==","X-Received":"by 2002:a05:6820:2d81:20b0:65c:f583:d3e3 with SMTP id\n 006d021491bc7-65d0eb73c3emr69108eaf.57.1766078286574;\n Thu, 18 Dec 2025 09:18:06 -0800 (PST)","From":"David Lechner <dlechner@baylibre.com>","Date":"Thu, 18 Dec 2025 11:17:01 -0600","Subject":"[PATCH 3/8] clk: mediatek: add array size field for id_offs_map","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20251218-clk-mtk-improvements-v1-3-72db131ba148@baylibre.com>","References":"<20251218-clk-mtk-improvements-v1-0-72db131ba148@baylibre.com>","In-Reply-To":"<20251218-clk-mtk-improvements-v1-0-72db131ba148@baylibre.com>","To":"Lukasz Majewski <lukma@denx.de>, Ryder Lee <ryder.lee@mediatek.com>,\n Weijie Gao <weijie.gao@mediatek.com>,\n Chunfeng Yun <chunfeng.yun@mediatek.com>,\n Igor Belwon <igor.belwon@mentallysanemainliners.org>,\n GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,\n Tom Rini <trini@konsulko.com>","Cc":"Julien Stephan <jstephan@baylibre.com>, u-boot@lists.denx.de,\n David Lechner <dlechner@baylibre.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=2161; i=dlechner@baylibre.com;\n h=from:subject:message-id;\n bh=ca4K+MSDoKO/hMCf2/m2RTuz6BsAKeOYIfb6YJKtfDs=;\n b=owEBhAF7/pANAwAKAcLMIAH/AY/AAcsmYgBpRDcigNHuR6FQv6wGNbWXOJBoFRzCEYPkaYO6w\n yVJD9zs2WOJAUoEAAEKADQWIQTsGNmeYg6D1pzYaJjCzCAB/wGPwAUCaUQ3IhYcZGxlY2huZXJA\n YmF5bGlicmUuY29tAAoJEMLMIAH/AY/AaHgH/jjuA924PCqFFDuac5ilowZ0FQF7oySCnJ1NKcv\n 6HoIIdA88MbNyvxsVxeKmQeTYLGgYCB9xNANhcqCOyZxMFYOOLjozw/F8kHs87LiGjXqBJiWZ6p\n 1SF81Bz0Z82B7wkgrmTJe7dxyXL4WkXjCMzN9r0XUuZ8FnO6yYiHHHFsl56Zz/yRCrUz8CIdmwU\n xDp9uX8cV8jtra9sxzL1SrLYGPO8BqhZAiOS7Owt/C+j6LGW8ape1M77S9dTmqtZAG/twUnRJhv\n QGX9Mp/HZLn1tavcrHhvkwi+fozBCXaN+8099OwmoDKCjB29zFvx/yxEV6r8lvOdJ+J7rmjPgvU\n mEFw=","X-Developer-Key":"i=dlechner@baylibre.com; a=openpgp;\n fpr=8A73D82A6A1F509907F373881F8AF88C82F77C03","X-Mailman-Approved-At":"Thu, 18 Dec 2025 18:18:40 +0100","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Add id_offs_map_size field to struct mtk_clk_tree and populate it for\nall existing drivers.\n\nCurrently, there is no bounds checking when accessing the id_offs_map\narray. Adding this field will allow for bounds checking in the future.\n\nSigned-off-by: David Lechner <dlechner@baylibre.com>\n---\n drivers/clk/mediatek/clk-mt7623.c | 3 +++\n drivers/clk/mediatek/clk-mtk.h    | 1 +\n 2 files changed, 4 insertions(+)","diff":"diff --git a/drivers/clk/mediatek/clk-mt7623.c b/drivers/clk/mediatek/clk-mt7623.c\nindex 5a60a86233e..eca8352d8e6 100644\n--- a/drivers/clk/mediatek/clk-mt7623.c\n+++ b/drivers/clk/mediatek/clk-mt7623.c\n@@ -996,6 +996,7 @@ static const struct mtk_gate hif_cgs[] = {\n static const struct mtk_clk_tree mt7623_apmixedsys_clk_tree = {\n \t.xtal2_rate = 26 * MHZ,\n \t.id_offs_map = pll_id_offs_map,\n+\t.id_offs_map_size = ARRAY_SIZE(pll_id_offs_map),\n \t.plls = apmixed_plls,\n \t.num_plls = ARRAY_SIZE(apmixed_plls),\n };\n@@ -1003,6 +1004,7 @@ static const struct mtk_clk_tree mt7623_apmixedsys_clk_tree = {\n static const struct mtk_clk_tree mt7623_topckgen_clk_tree = {\n \t.xtal_rate = 26 * MHZ,\n \t.id_offs_map = top_id_offs_map,\n+\t.id_offs_map_size = ARRAY_SIZE(top_id_offs_map),\n \t.fdivs_offs = top_id_offs_map[CLK_TOP_SYSPLL],\n \t.muxes_offs = top_id_offs_map[CLK_TOP_AXI_SEL],\n \t.fclks = top_fixed_clks,\n@@ -1063,6 +1065,7 @@ static int mt7623_infracfg_probe(struct udevice *dev)\n \n static const struct mtk_clk_tree mt7623_clk_peri_tree = {\n \t.id_offs_map = peri_id_offs_map,\n+\t.id_offs_map_size = ARRAY_SIZE(peri_id_offs_map),\n \t.muxes_offs = peri_id_offs_map[CLK_PERI_UART0_SEL],\n \t.gates_offs = peri_id_offs_map[CLK_PERI_NFI],\n \t.muxes = peri_muxes,\ndiff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h\nindex 3259f6281dd..980d9aab809 100644\n--- a/drivers/clk/mediatek/clk-mtk.h\n+++ b/drivers/clk/mediatek/clk-mtk.h\n@@ -257,6 +257,7 @@ struct mtk_clk_tree {\n \t * ID for factor, mux and gates.\n \t */\n \tconst int *id_offs_map; /* optional, table clk.h to driver ID */\n+\tconst int id_offs_map_size;\n \tconst int fdivs_offs;\n \tconst int muxes_offs;\n \tconst int gates_offs;\n","prefixes":["3/8"]}