Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp361903ybt; Wed, 24 Jun 2020 00:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvfGqcrx7FGpfSMO/VyZsGA+sALdIXd4hcs6ubBY72WNCaZNOmGNFwKWrk2K18aUj30Zg/ X-Received: by 2002:a17:906:9394:: with SMTP id l20mr14759671ejx.467.1592984976694; Wed, 24 Jun 2020 00:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592984976; cv=none; d=google.com; s=arc-20160816; b=Ha7Tqc8K1fJ+R9kv5W5FF8P4yTG6kzuVH0Sg5ANgn8uhWvDhpmeJApIIW7diWStsyR q0Hcr+XZEFF7XuvcHqM24BWQOtr22R4zwNQahGTEWPFqWnsiar0LGz369Yi3s8saC00b VgtnL8hnj5PYPQ4nBtXWN0pRpiv7aZ/mBByaY1JD2Cj8mdS/TyYjF7puGecQ4vWNupVs vRqgVwwbJ06O2VfWn7WXPcNh1sewiXdk4zNVhRGXyg6SK2Yv0gDD3XMX2xxgYyAI8oKh PYVE6LHxSkvpVN+srwO0xrn2Xz9lT8DoIZzJT+YI92c80d8jT8Us0tWNjRy1FVA5reLs Vv8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=+8WHfAXWo1+i3nt8wUTtdOs+A5Mocku9UFhp1oiZqRM=; b=HGH9WCUQhj9o/EF5fAQHmKHJmlbgqhSMqZACYTaDQ8w6a3xGpNyojeMKGcAMtsdEb6 LlBMZyTDFvjdqTiXRsclDa0sKHqftVcneoseyjH6BRqboQ9i9l0UIMquYAmXORFEbi3K mxVz8sjZQkdxy0kzRTK+3G+IBFp49Ubz4dumLqyCFPU6f5CUaihqxsnqE8FxrbzB23vh mri736U7+lgpHbI8aWbGieZ5m9mc6gW/4oVRkT3qfHbBNUM5S3ZviSKyOwcOut6d794k r60au6oOanPHdl6EmRTXUObDu8HipH+Indk8s8GkFpvG9/4zK2jgxhgrwUdtHJSoet0b m15g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si8700931ejw.135.2020.06.24.00.49.13; Wed, 24 Jun 2020 00:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388276AbgFXHrP (ORCPT + 99 others); Wed, 24 Jun 2020 03:47:15 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:36809 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387725AbgFXHrN (ORCPT ); Wed, 24 Jun 2020 03:47:13 -0400 Received: from mail-qk1-f174.google.com ([209.85.222.174]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MAfpQ-1jhRbT0yHQ-00B1Ch; Wed, 24 Jun 2020 09:47:11 +0200 Received: by mail-qk1-f174.google.com with SMTP id l17so1010201qki.9; Wed, 24 Jun 2020 00:47:10 -0700 (PDT) X-Gm-Message-State: AOAM5300cLsDr6w3XS6GDfYvty8eK9ekAv8iQenNQ7MW9Y8ja361SnNR 5MxBbJ3YuMc7BETrON84O/YmTDFNB8zgwKhKR4s= X-Received: by 2002:a37:a282:: with SMTP id l124mr9530251qke.3.1592984829990; Wed, 24 Jun 2020 00:47:09 -0700 (PDT) MIME-Version: 1.0 References: <1591687933-19495-1-git-send-email-Anson.Huang@nxp.com> <1591687933-19495-4-git-send-email-Anson.Huang@nxp.com> <159262367025.62212.11651547971712516448@swboyd.mtv.corp.google.com> <159290125202.62212.13172213909023205615@swboyd.mtv.corp.google.com> <159296027133.62212.18074403520585879907@swboyd.mtv.corp.google.com> In-Reply-To: From: Arnd Bergmann Date: Wed, 24 Jun 2020 09:46:53 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2 3/9] clk: imx: Support building SCU clock driver as module To: Aisheng Dong Cc: Stephen Boyd , Abel Vesa , Andy Duan , Anson Huang , Daniel Baluta , Leonard Crestez , Peng Fan , Stefan Agner , "allison@lohutok.net" , "festevam@gmail.com" , "gregkh@linuxfoundation.org" , "info@metux.net" , "kernel@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" , "linux-clk@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux@armlinux.org.uk" , "mturquette@baylibre.com" , "oleksandr.suvorov@toradex.com" , "s.hauer@pengutronix.de" , "sfr@canb.auug.org.au" , "shawnguo@kernel.org" , "tglx@linutronix.de" , "yuehaibing@huawei.com" , dl-linux-imx Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:Y6dkigMG8mvN+gfqKYP+s4ZHujfafsuTD60hVNB/9dcbFeFdW3w X9q3w7VLonDP27AowdBFEOjD0tBnnImA0qEInHEo5Wei/AXec+1OhyMv742nMHZ2LsSJzF9 oB6DXaGzddglJJHmjA3wddz+JCn8S22iG7Fkqiw4t4fadpL+KbyBkE4ur37o3rvriQsning P2NvqRi2rjXXtRrYjP9rw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:mPQ8zh+He6M=:NCZomK2k/5ze0TFOdfFKZv QdyirwjG5R2QbCVnb3gODIgxbhFHGXAOFHO+QgQ8xn7tPmyNCpGcsEYZO8elbgrFJAfjwmfpg 7M4TM3jvvvn/N1JmO//YUHtL2HIZk5SBn/K1AMvB0Y1Q/r/Ouxywvu1D/K63FqdctzW6pfJB/ sXq6UaFK0jUSUpBtGs1uD+34SK2IaP+L1Xo5yr8AzQjKZCgBd9e6Qhu12f+UjD+y4PWTpU6bD JEO3lSJKocj2ySx0MaA343c1lv+N1GWy9MiveeAq7Uoa9A6sreQIwE4pGbtzRBteRv58lhVWo tvtBj3Bw0cTunDyLYHZ3FsUG6HzfNBvFIvarH9NVNwyU4m0nM3Fr4eX2GoZ8qhPdBb5rVLWA9 Te2XWebJNvTMxnBDSXrQfV1qH8NU+I2araWnHUnCxiGj1AqVq1QqvvyvccWZj1+GEPRqGD/sM yGojBpq3jX7RyZmuAZRFaDm7F/wXyt1z4EIkDtisirDLXYB9O/YZJ2gDj7sJ5q0e5pnraz36J 93u93CGJzeKX36xsMGgD3sylRIwpTjfgq7I3ymJ+KrX6PhpllnZomEf19psUGmc34XKqnxLzp Irem8C9pbWbRpd52+fJ1tBQaFRPSe4AS8kX/Bwmv5l30N4VoV5N/oQ4qQMuFPPMzJurLW4ApP gCLhJVDeqb++3+eNElgLCnHTfajX+tyq56nttQmNmKYb4s2H6619CUKVP8NucIvFOlF7wmwn7 ZljQ9wKRB92ZuK5LFEHibURxXJKFRnWfRAwmqhYmzlsZJAOvidEXti+ltIZMxtBmfLSQcX3hB juedtzw484VgHcrNZ99401W8073yMSBe/3Icv4ifopduZuREfg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 4:19 AM Aisheng Dong wrote: > > Isn't that what we want? > > No, if user set MXC_CLK to m, the build will break for i.MX6&7. > > > Why does ARCH_MXC being enabled mandate that it is > > builtin? Is some architecture level code calling into the clk driver? > > > It's mainly because there's no Kconfig options for i.MX6 &7 clock drivers. > It just reuses ARCH config CONFIG_SOC_XXX which can only be y. > e.g. > obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o > obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o > obj-$(CONFIG_SOC_IMX7ULP) += clk-imx7ulp.o > obj-$(CONFIG_SOC_VF610) += clk-vf610.o > .. > > If setting MXC_CLK to m, the platform clock drivers will fail to build due to miss > to find symbols defined in the common clock library by CONFIG_MXC_CLK. > So we have to avoid users to be able to config MXC_CLK to m for i.MX6&7. > Only depends on ARCH_MXC mean user still can set it to m. The link error can be easily avoided by building all the clk support into a single loadable module like below. Hower this only works if all drivers that have a runtime dependency on the clk driver support deferred probing or are built as loadable modules as well and get loaded after the clk driver. Arnd 8<--- diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index 928f874c73d2..638bc00f5731 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_MXC_CLK) += \ +obj-$(CONFIG_MXC_CLK) := clk-imx.ko + +clk-imx-y += \ clk.o \ clk-busy.o \ clk-composite-8m.o \ @@ -25,24 +27,24 @@ obj-$(CONFIG_MXC_CLK_SCU) += \ clk-scu.o \ clk-lpcg-scu.o -obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o -obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o -obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o -obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o -obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o +clk-imx-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o +clk-imx-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o +clk-imx-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o +clk-imx-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o +clk-imx-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o -obj-$(CONFIG_SOC_IMX1) += clk-imx1.o -obj-$(CONFIG_SOC_IMX21) += clk-imx21.o -obj-$(CONFIG_SOC_IMX25) += clk-imx25.o -obj-$(CONFIG_SOC_IMX27) += clk-imx27.o -obj-$(CONFIG_SOC_IMX31) += clk-imx31.o -obj-$(CONFIG_SOC_IMX35) += clk-imx35.o -obj-$(CONFIG_SOC_IMX5) += clk-imx5.o -obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o -obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o -obj-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o -obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o -obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o -obj-$(CONFIG_SOC_IMX7D) += clk-imx7d.o -obj-$(CONFIG_SOC_IMX7ULP) += clk-imx7ulp.o -obj-$(CONFIG_SOC_VF610) += clk-vf610.o +clk-imx-$(CONFIG_SOC_IMX1) += clk-imx1.o +clk-imx-$(CONFIG_SOC_IMX21) += clk-imx21.o +clk-imx-$(CONFIG_SOC_IMX25) += clk-imx25.o +clk-imx-$(CONFIG_SOC_IMX27) += clk-imx27.o +clk-imx-$(CONFIG_SOC_IMX31) += clk-imx31.o +clk-imx-$(CONFIG_SOC_IMX35) += clk-imx35.o +clk-imx-$(CONFIG_SOC_IMX5) += clk-imx5.o +clk-imx-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o +clk-imx-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o +clk-imx-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o +clk-imx-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o +clk-imx-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o +clk-imx-$(CONFIG_SOC_IMX7D) += clk-imx7d.o +clk-imx-$(CONFIG_SOC_IMX7ULP) += clk-imx7ulp.o +clk-imx-$(CONFIG_SOC_VF610) += clk-vf610.o