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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84024C433E0 for ; Tue, 30 Jun 2020 04:09:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C930206A5 for ; Tue, 30 Jun 2020 04:09:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vN7H2Ca8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726129AbgF3EJv (ORCPT ); Tue, 30 Jun 2020 00:09:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbgF3EJu (ORCPT ); Tue, 30 Jun 2020 00:09:50 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29F7EC061755; Mon, 29 Jun 2020 21:09:50 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id rk21so19059849ejb.2; Mon, 29 Jun 2020 21:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Hey9HbRw/dVBfXOWAz6aoDUkLgkP19V6zpTJ8WVJch0=; b=vN7H2Ca8sOkOTtvwl3v6foRnaRBZiWn6uKrH2xydPPm7Zed43DfmUIi0f2YjMw6+/x uJOGmUrutRMHbnddJOwujquc0X1kJ7fov7nKK7fiFCRDhJzvBJPhxdNj4KGDM+3fBwl0 qJfUzy8859dmVn9XcRNwo+N1/SJi6tVscANDiThp63DeRsB6xa4lR5KE7C+s2f7lhsIl Jbc73GQIE2gYjLF0FMw+1d+apsSfFH16H0RPP2esr545hwkrDhLGoGoyQEuKhmNS1h5N YTmZT+KRz0oqQkDD8Fk+AdBfj0OKY3oZ+u5etDDMrKWWMGZ82sh8DfAMGfpdUyvP0jHc fClQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Hey9HbRw/dVBfXOWAz6aoDUkLgkP19V6zpTJ8WVJch0=; b=pD08qfLTzgif2v5UZMH4FGerpHLbtr1LbOb0yoPsbIhd/Eip3K/JJ76T8gEbB/PDb9 kbEVMtj0coNdHnlOpSMSbEAHchdtLa+FuPQfRi1P/x0uZ6zcPkuQ8Y+N2TYI3Pu+DpHq r04Fb4fQRCgT/YQ/2IrZJzJAMzCuV7If3Hzy8xn1746DDVbVUr+AN1Wr6Kr/uhpklNUF ZVN/3RKg1KjFjjNfc2oBSMx2gDRik4yjqekSMK8bMuRU5Ks1wNVMi/KAxTbNPYPsLwtd cUO916NRbnzsp1pJAyix/xXIXPxCGkkRYSPk4lJYNUOVBQZKATQJffKUixnIu3niElpy zWRA== X-Gm-Message-State: AOAM531Yhm5k6PmfOEtVuTlahIr7llI1WZK/fh3KcsndeRX6v65hczoS daRf5MWj6wMSNfRF1RSjaknZKsCgbhe3z1jfjss= X-Google-Smtp-Source: ABdhPJx0k3kHhhcmfRuwSQBAljpirUv4qs2fybiJfDd0o4Bl0x6GWFRJs4MEYUmcn6ESvQyn5fmZWG0OPMsgIoQQ0pM= X-Received: by 2002:a17:906:6d56:: with SMTP id a22mr17289015ejt.440.1593490188847; Mon, 29 Jun 2020 21:09:48 -0700 (PDT) MIME-Version: 1.0 References: <1593410042-10598-1-git-send-email-Anson.Huang@nxp.com> <1593410042-10598-5-git-send-email-Anson.Huang@nxp.com> In-Reply-To: From: Dong Aisheng Date: Tue, 30 Jun 2020 11:55:50 +0800 Message-ID: Subject: Re: [PATCH V3 04/10] clk: imx: Support building SCU clock driver as module To: Anson Huang Cc: Arnd Bergmann , Russell King - ARM Linux , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , Michael Turquette , Stephen Boyd , "oleksandr.suvorov@toradex.com" , Stefan Agner , Peng Fan , Abel Vesa , Aisheng Dong , Andy Duan , Daniel Baluta , YueHaibing , Stephen Rothwell , Al Viro , Linux ARM , "linux-kernel@vger.kernel.org" , linux-clk , dl-linux-imx Content-Type: text/plain; charset="UTF-8" Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org On Tue, Jun 30, 2020 at 5:16 AM Anson Huang wrote: > > Hi, Arnd > > > > Subject: Re: [PATCH V3 04/10] clk: imx: Support building SCU clock driver as > > module > > > > On Mon, Jun 29, 2020 at 4:52 PM Anson Huang > > wrote: > > > > Subject: Re: [PATCH V3 04/10] clk: imx: Support building SCU clock > > > > driver as module On Mon, Jun 29, 2020 at 2:53 PM Anson Huang > > wrote: > > > > > > > > Sorry, I misread the patch in multiple ways. First of all, you > > > > already put clk-scu.o and clk-lpcg-scu.o files into a combined > > > > loadable module, and I had only looked at clk-scu.c. > > > > > > > > What I actually meant here was to link clk-scu.o together with > > > > clk-imx8qxp.o (and possibly future chip-specific files) into a > > > > loadable module and drop the export. > > > > > > Sorry, could you please advise more details about how to do it in Makefile? > > > I tried below but it looks like NOT working. multiple definition of > > module_init() error reported. > > > > > > obj-$(CONFIG_MXC_CLK_SCU) := clk-imx.o clk-imx-y += clk-scu.o > > > clk-lpcg-scu.o > > > clk-imx-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o > > > > Right, you can't have multiple module_init() in a module, so what I suggested > > earlier won't work any more as soon as you add a second chip that uses the > > clk-scu driver, and then you have to use separate modules, or some hack that > > calls the init functions one at a time, which is probably worse. > > > > If it's only imx8qxp, you can do it like this: > > > > obj-$(CONFIG_MXC_CLK_SCU) := clk-imx-scu.o clk-imx-lpcg.o > > clk-imx-scu-y += clk-scu.o clk-imx8qxp.o > > clk-imx-lpcq-scu-y += clk-lpcg-scu.o clk-imx8qxp-lpcg.o > > > > If you already know that the scu driver is going to be used in future chips, then > > just stay with what you have now, using a separate module per file, exporting > > the symbols as needed. > > > > Thanks, and yes, I know that scu clk driver will be used for future i.MX8X chips with > SCU inside, the current i.MX8QXP clock driver can NOT cover all i.MX8X chips, so > I will stay with the exporting symbols. > SCU clock driver is a common driver for all SCU based platforms. Current i.MX8QXP SCU clock driver will be extended to support all future SCU based platforms. So theoretically clk-scu.o and clk-imx8qxp.o can be combined. LPCG is similar. Maybe you can give a try as Arnd suggested. Regards Aisheng > Thanks, > Anson