Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp309547pxk; Wed, 2 Sep 2020 23:34:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQZXNk+0bXMAUIKfiSKBrHV1yXtnWKdo2vfBQ5pw2/T+VLTywcRfqeDRaveGwYUxI+ROmH X-Received: by 2002:a17:906:48d6:: with SMTP id d22mr634132ejt.462.1599114892764; Wed, 02 Sep 2020 23:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599114892; cv=none; d=google.com; s=arc-20160816; b=B3zduI2MQNE7t8BNszHZdqaS0zm+3i+iCyINFqjzZ1Pt5qv3MeekzRGhi8/qqxS3J/ bXzR8TwXlS1wf1Lta35hQWoXqa/PBBlTRAhcXrjT4HwdYNBzYXkkTvBPkvKb4/50gBRi PDnFYlYXRiJffMRVxUe7E07zHpM8lnBLmpoLFqo69VDAWaw9SSZycyN2/+iqc+31Ky2Y bevAYQqXa6bu+xXfdXq3qNX/ojcRSkSiFUEZg/1uEZSkGSlK5+DJ7mJ2/pzpf5BLOQng tMZRI/NErwAY1yRIekMyOfD6pYJL8LGCEwtG5VBxpHVcLtsYVpJfP89hyKFGqOs9r3L+ LJbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=akP7yXQprJYZBzw7Umyb0QXFwh+gEdFsamNyI8a5xZU=; b=DnGosEncBhvbR+LoP9s/6AkShm/FExmPLZT/kozGdyGzzL2F6cmL9sm8Ii4f/v4h48 dRVqWDfxImuChZ5thl6B9oaqBGwnheE5TfmDDf0qF+Ml/J4Z4+q7ONIQ/us2Z/keGj25 ZP56CGGisMoEljLE+H9sQOCwDP+KAq8d+MGlqiw2XkMXLr4l2e2Cd4aFwocsb9TXzmhK ajvBz5TwCt9ZBPhRODQce0IJiO/hwx4c5tcFXpe4yz0LgX6xh80XbeEjMNKzqEAMYNnP eSAoy2fOBGuGftUdJcRT7ASBtoKPfOao1xnb59E9j/+wO3h3yxu4CmxkIqVYRHP7HPg5 cSvw== 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 dr21si1939791ejc.23.2020.09.02.23.34.29; Wed, 02 Sep 2020 23:34:52 -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 S1728054AbgICGck (ORCPT + 99 others); Thu, 3 Sep 2020 02:32:40 -0400 Received: from lucky1.263xmail.com ([211.157.147.132]:40334 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726288AbgICGck (ORCPT ); Thu, 3 Sep 2020 02:32:40 -0400 Received: from localhost (unknown [192.168.167.13]) by lucky1.263xmail.com (Postfix) with ESMTP id 44257ED62A; Thu, 3 Sep 2020 14:32:37 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P29633T140716441319168S1599114756148900_; Thu, 03 Sep 2020 14:32:37 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: zhangqing@rock-chips.com X-SENDER: zhangqing@rock-chips.com X-LOGIN-NAME: zhangqing@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Elaine Zhang To: heiko@sntech.de Cc: mturquette@baylibre.com, sboyd@kernel.org, linux-clk@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, xxx@rock-chips.com, xf@rock-chips.com, huangtao@rock-chips.com, kever.yang@rock-chips.com, Elaine Zhang Subject: [PATCH v2 6/6] clk: rockchip: rk3399: Support module build Date: Thu, 3 Sep 2020 14:32:34 +0800 Message-Id: <20200903063234.10639-1-zhangqing@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200903063147.10237-1-zhangqing@rock-chips.com> References: <20200903063147.10237-1-zhangqing@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org support CLK_OF_DECLARE and builtin_platform_driver_probe double clk init method. add module author, description and license to support building Soc Rk3399 clock driver as module. Signed-off-by: Elaine Zhang --- drivers/clk/rockchip/clk-rk3399.c | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c index ce1d2446f142..40ff17aee5b6 100644 --- a/drivers/clk/rockchip/clk-rk3399.c +++ b/drivers/clk/rockchip/clk-rk3399.c @@ -5,9 +5,11 @@ */ #include +#include #include #include #include +#include #include #include #include @@ -1600,3 +1602,56 @@ static void __init rk3399_pmu_clk_init(struct device_node *np) rockchip_clk_of_add_provider(np, ctx); } CLK_OF_DECLARE(rk3399_cru_pmu, "rockchip,rk3399-pmucru", rk3399_pmu_clk_init); + +struct clk_rk3399_inits { + void (*inits)(struct device_node *np); +}; + +static const struct clk_rk3399_inits clk_rk3399_pmucru_init = { + .inits = rk3399_pmu_clk_init, +}; + +static const struct clk_rk3399_inits clk_rk3399_cru_init = { + .inits = rk3399_clk_init, +}; + +static const struct of_device_id clk_rk3399_match_table[] = { + { + .compatible = "rockchip,rk3399-cru", + .data = &clk_rk3399_cru_init, + }, { + .compatible = "rockchip,rk3399-pmucru", + .data = &clk_rk3399_pmucru_init, + }, + { } +}; +MODULE_DEVICE_TABLE(of, clk_rk3399_match_table); + +static int __init clk_rk3399_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + const struct clk_rk3399_inits *init_data; + + match = of_match_device(clk_rk3399_match_table, &pdev->dev); + if (!match || !match->data) + return -EINVAL; + + init_data = match->data; + if (init_data->inits) + init_data->inits(np); + + return 0; +} + +static struct platform_driver clk_rk3399_driver = { + .driver = { + .name = "clk-rk3399", + .of_match_table = clk_rk3399_match_table, + }, +}; +builtin_platform_driver_probe(clk_rk3399_driver, clk_rk3399_probe); + +MODULE_DESCRIPTION("Rockchip RK3399 Clock Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:clk-rk3399"); -- 2.17.1