Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp519403rdb; Tue, 19 Sep 2023 02:24:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2NcZ+/Wb6q2ywyTeJ1buOx+yzh8YVNSuJosowIlpd0mjctZXYeRcZcOWBJbdTbWmnhkjI X-Received: by 2002:a92:dd83:0:b0:348:fe3b:c8b with SMTP id g3-20020a92dd83000000b00348fe3b0c8bmr12069073iln.1.1695115460901; Tue, 19 Sep 2023 02:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695115460; cv=none; d=google.com; s=arc-20160816; b=derXPwf6cDTXWVsb7MSdOytw6rszKoZC6ig2zdsg7sA3iq7XaLeogP/gumzJ8gkqmv zBneGzcSkIm7+49OFSTvI7WKaPoOV6TV+EUMdI9s5h8vnTRGFm3RNca5Xrk1c299P6Xh +D8/9jy44FQ7UvyDptwV4TPramTa5gjgFVhciEQIKZfeQSRH3D+GDwtSfrcW863kGFt7 TlxZB01F33kg8VtxApX5nD8yuRwVOmk/lXSai29DYaJ1jd59XeVqESfzRiB+69oMboPr 8X3LwBLJ4iQ/dxvHj/I4BpwOnVQ1vw0O6Z975KcuUiMClNtkaGCShQwn3dl0m8p5iaBx Kdwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=M+Pqjjyz5ZTGZJ4hfXwCOtDQXFkzRBUJzshKf45oTz0=; fh=2k08wi9L1izDXBTtchasZ3iTIKWixTv28lKy4suwg4Y=; b=BWuJyCMpRyzZ84POLWoGP0sThJ2yPHqF9t2oXWbwgP3K9It6QxGC0WEU9ycHhsI0XZ 9KZo0uD6bKDDSWp0C2c5GAuhrcCr68yk8Se+Pr2oIxNnsMTXLiTul0mDBhx7BRID6CIi L9L59Q2Azc58+WkXPtBWO9LO42EETSiteHEnxEMhSB8fuFwIWlxXoC9Wm5MW2JyKEnSy 14aWkuinqNaqRSVZpWEfHORI1iDCCoD0lzBZt3ud0K79ENdynO9b4UGYeTfUOzbSKloN sS3VeepHqVMsGG8Scf5rVLZh1LX4rpFfrnAttCaQ+4o9PafR+uXvBn7vi7oVfezUwtaE DU4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gNu8uZ5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id d9-20020a056a0010c900b006875398611csi9498768pfu.80.2023.09.19.02.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 02:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gNu8uZ5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CCAB78254A85; Tue, 19 Sep 2023 02:23:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbjISJXw (ORCPT + 99 others); Tue, 19 Sep 2023 05:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjISJXv (ORCPT ); Tue, 19 Sep 2023 05:23:51 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50AF3DA; Tue, 19 Sep 2023 02:23:45 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (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 madras.collabora.co.uk (Postfix) with ESMTPSA id 81B0F6607033; Tue, 19 Sep 2023 10:23:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695115424; bh=zr0JHbMPGnoB7W9Ga+/W4aCptT35gdUdHKTnbXaS1ao=; h=From:To:Cc:Subject:Date:From; b=gNu8uZ5h9bSSKMbkyuwIc++hFOXW8AthBtEaGp3olqat7QhHQQV1yuUtznTL1opyi 6q0B7NFlvHsusyAPXPORN3XaXbLKZmXO1j/E7uzxgJ2V0GE8Nz1yvy9gnMnbc3NvFG Vtb2kKQLtGwLlFiBELpiW94r74dHWzR3WxMfZy6Qc99xsrT8lshAUErJPPF56y+stf qTMarH6dNKpDv/yrvG0m9i/VvI0N7+bDPI3c0FtZFOr0wACFERn/tqjFW+ftkSoO4R ZSAMMZ/Si1RGBHYK9sSf+/u0r5MxmIW2kfsqDOuXESccspqQ3uyAUdkMI7KaYbODCz 0fEralOeKOMnQ== From: AngeloGioacchino Del Regno To: mathieu.poirier@linaro.org Cc: andersson@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, tinghan.shen@mediatek.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wenst@chromium.org, kernel@collabora.com Subject: [PATCH] remoteproc: mediatek: Refactor single core check and fix retrocompatibility Date: Tue, 19 Sep 2023 11:23:36 +0200 Message-ID: <20230919092336.51007-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 02:23:51 -0700 (PDT) In older devicetrees we had the ChromeOS EC in a node called "cros-ec" instead of the newer "cros-ec-rpmsg", but this driver is now checking only for the latter, breaking compatibility with those. Besides, we can check if the SCP is single or dual core by simply walking through the children of the main SCP node and checking if if there's more than one "mediatek,scp-core" compatible node. Fixes: 1fdbf0cdde98 ("remoteproc: mediatek: Probe SCP cluster on multi-core SCP") Signed-off-by: AngeloGioacchino Del Regno --- drivers/remoteproc/mtk_scp.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index ea227b566c54..a35409eda0cf 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -1144,29 +1144,25 @@ static int scp_add_multi_core(struct platform_device *pdev, return ret; } -static int scp_is_single_core(struct platform_device *pdev) +static bool scp_is_single_core(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev_of_node(dev); struct device_node *child; + int num_cores = 0; - child = of_get_next_available_child(np, NULL); - if (!child) - return dev_err_probe(dev, -ENODEV, "No child node\n"); + for_each_child_of_node(np, child) + if (of_device_is_compatible(child, "mediatek,scp-core")) + num_cores++; - of_node_put(child); - return of_node_name_eq(child, "cros-ec-rpmsg"); + return num_cores < 2; } static int scp_cluster_init(struct platform_device *pdev, struct mtk_scp_of_cluster *scp_cluster) { int ret; - ret = scp_is_single_core(pdev); - if (ret < 0) - return ret; - - if (ret) + if (scp_is_single_core(pdev)) ret = scp_add_single_core(pdev, scp_cluster); else ret = scp_add_multi_core(pdev, scp_cluster); -- 2.42.0