From mboxrd@z Thu Jan 1 00:00:00 1970 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 92672C433F5 for ; Fri, 22 Apr 2022 01:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:To:Cc:From:Subject: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PeDs8ve4jP5yiHwx2pyFmktT7cjISf6e4zepFi1/yDg=; b=nWBsTrnQDQaHF6 n6G+qPHaghctBoaIlrJhv1d97x13N+XOS/fbe3wi9ByIIJuy4mpqmwHiWAMux2Yxqx+EDcImMfbq9 zL7BxzYbCqoi/awGe6eVm6IXUqcWhs/g0GwLH2ozlAxycgKbFzgpOkcTmGeIuWyXUHzSPizlNtRD/ 7Gv8jgzeapqdoobEycLKzsldcOexQ9VRwYNHpqz2rQUdCP1+LP4NH2qjLCp4hDh2RWLZic4u/89OV 8tp+1FKHzTgSfe+Il1rObS/q5ZFb26kEOVDTtsbcazWCdZrDaCZoOxIOzyECNriZ6ZubvaWr9B/or lKp40esMZVRbr4nAS9vA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhiHx-00Fb9G-7h; Fri, 22 Apr 2022 01:40:49 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhiHu-00Fb8R-Lw; Fri, 22 Apr 2022 01:40:48 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57365B829EB; Fri, 22 Apr 2022 01:40:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16530C385A7; Fri, 22 Apr 2022 01:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650591644; bh=84SSLoGtlEVQaRfEjpYyO2p8fJDHeUxLXOIa3sUjotE=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=m0XkKPNl8K7JR+f5fsbqjqiWh8SAu1HAp1/nxMkmWCOPNIetM2rqmlFauWr4gZOYw GGovyd5wEEhKxEcsb4EUxugGFwQleEX17IMpWLlmoZv1ybuNo+T5q+p28+IkFr5YT9 1FfWZ6sGbl1tdOO2oAoyHt4nVObY7Rn/noYEderABHAP3RMKkz6Zp4SgNdb10UI6ug P8ANMklg/ayhENT5ChqyJDZkOi5x0MqS5HVp32/7+0CbaCPMmCgwIFHL4oLhfmqlzC 2SgDFiI49v7XAsRRwf21N5PecBu4ik/lxox+VROAoN0nBttQZEHNdywDB4Qdg1ecOi 6I7IcfWeiuYdA== MIME-Version: 1.0 In-Reply-To: References: <20220419081246.2546159-1-wenst@chromium.org> <3591fcc1-d34a-b40a-4e78-edcf9d2ddf08@collabora.com> Subject: Re: [RFC PATCH 0/7] clk: mediatek: Move to struct clk_hw provider APIs From: Stephen Boyd Cc: Michael Turquette , Chun-Jie Chen , Miles Chen , Rex-BC Chen , Matthias Brugger , linux-clk@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org To: AngeloGioacchino Del Regno , Chen-Yu Tsai Date: Thu, 21 Apr 2022 18:40:42 -0700 User-Agent: alot/0.10 Message-Id: <20220422014044.16530C385A7@smtp.kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220421_184046_901243_F3D355E6 X-CRM114-Status: GOOD ( 15.75 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quoting Chen-Yu Tsai (2022-04-20 23:05:10) > > Not exactly. All the clocks in the MTK drivers are allocated at runtime, > so we can't use clk_parent_data to point to not-yet-allocated clk_hw-s. > Instead we'll need to have > > struct mtk_clk_parent_data { > unsigned int clk_id; /* Match CLK_XXX_YYY from dt-binding headers */ > ... /* remaining fields same as mtk_clk_parent_data */ > }; > > and create the actual clk_parent_data at runtime by looking up clk_id in > the set of already registered clks: > > int mtk_clk_register_XXX(..., struct mtk_clk_parent_data *pdata, > struct clk_hw_onecell_data *clk_data) { > struct clk_parent_data data = { > .hw = clk_data[pdata->clk_id], > /* copy other fields verbatim */ > }; > ... > } > > Obviously this forces some ordering of how the clks are registered. > I believe the order is already correct, and if it isn't, it would be > easy to detect, and we can reorder things to fix it. If this is a common problem, we may need to come up with a generic solution that either adds a new clk registration API that fills in the clk_parent_data hw pointer or add another member to struct clk_parent_data that says "index into this other array of clk_hw pointers". _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel