From patchwork Sun Jul 23 16:22:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangfl X-Patchwork-Id: 124513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1356706vqg; Sun, 23 Jul 2023 10:20:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlGx9zf0RMda5VPaCw4XvDe8EhE76SIQNPQu4s/P6SM0IoflCMlKegxzzuDK8nvTtqJZ4gR4 X-Received: by 2002:a05:6a20:cd:b0:137:7add:b7cd with SMTP id 13-20020a056a2000cd00b001377addb7cdmr8929958pzh.17.1690132839092; Sun, 23 Jul 2023 10:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690132839; cv=none; d=google.com; s=arc-20160816; b=NXN1JFCKHKQZ8U+Zkyvxdzcld0/njBUvbgieFMvSLgCiwZS8S+cNBN//XLe/xGm2eu DojAyExWF+t0pkjcQDS1iEc7on+X6gdv22sYtR0x/REal3q6qBEeZtPvGupQ+uQv8dIR QqlzdRmuQY7BkjSsB9jjuWSoY3cXmUaS69V+iFQZ4RjkGEj1j4gHwgOe1oBdcXuevuQk APEhVp4UjFnN8cX3X6djTtRqH1J9fEbuRucr6jbuL7TwByYhzNPrFJWownBOOLnLXcEQ gWfoupV07wIppD1E6TvvdmFlXfR2pPLTfW5Kod8U/mhOptDlW+O7z4d2T6LpCF2QABQu nlgg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZNZDSYoGb3uZl1I3ymSzL6L6meDQzuQ8PM9FVmAR7qU=; fh=6op8AbJPoSQyJcsI0L5qUJDM8pym4PtkpWqFZ6dkle0=; b=eisXuA9n3xH8ZEIwkhG5UwVN0wChAk0nEZVi+FSDW4X7r0+B/W/WVIiZtSdYWrh6qd TyjGtcPSAmHtRKA8LwfsefzbjKmiH3WKy99Dum2nYB9Q3B/c7ksbxfKq4XIorpaUZF9A AwhQZhJx9CXDnzCEUpkVSRW8SRuNE7+D+2dhhwMeGA5mCEasOL8v85cqofh8fkw5dOju cQ6M8hQRVSN/Ay8q7voQE/rF1qXNt7Mm5Xi8XhURix9F+CNDpoaAN1nwWiecezdpEcqu qOj4TTJ8T1VEdi5M4jbxED5mVcVh86RMV2VRz2cy8EqOhj0lSmkMFhfxwGtxalF58lq0 Z1hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PEfU5yjj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a056a00248f00b006834175c797si7585130pfv.330.2023.07.23.10.20.15; Sun, 23 Jul 2023 10:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PEfU5yjj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjGWQ0j (ORCPT + 99 others); Sun, 23 Jul 2023 12:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbjGWQ02 (ORCPT ); Sun, 23 Jul 2023 12:26:28 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3BF01999; Sun, 23 Jul 2023 09:26:04 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-55adfa61199so2561412a12.2; Sun, 23 Jul 2023 09:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690129548; x=1690734348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZNZDSYoGb3uZl1I3ymSzL6L6meDQzuQ8PM9FVmAR7qU=; b=PEfU5yjjNgEDTN/b3EIfG3zOydNiwp4jwFDp7XbfB9kgD7nbTsgXc74/g4N49AI68/ 8UuV1157/Ve4YkeLCEUk+cf442JFUvqtuwhirxZQWUJdPyU96L9Ng94Ejnz8Qq3r+dqw 1bSRdLpyGW2gf5qEqa95eJrDCh02NEwPgJonTsm7GuZizmobBFrgnBySgMbUZHETdLhk 3GKQcDjNsD8QsQNRvSDp4gmxNLFIxn4V2u1AYQL73e/VDrj4vBCJpFv5ajTEaKI26cfp CBNRSNsuMZzHNJUTBZF5hZxKRRMsk0uOME286IF8Xaiv1DiMFu97zSE81+5D8yToaauL o1vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690129548; x=1690734348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZNZDSYoGb3uZl1I3ymSzL6L6meDQzuQ8PM9FVmAR7qU=; b=AeALi36blOio4YpzxVC3ZXy8Zd/iweGD9LbYYWNsQxGxMFnqZtsbIWUupuUSLtpwgS SrQKxxi+n87YR3WTJ+7NAg8HENu5RyN4QL5DFPE6O3eMZV6ztKMy5eihKP5Fv/O89vbx Fp46PXo1+FLpka3E5LVgRlXaDqi+JZCahzXA8PXvoAYMStlPf0pjkundl+1VQpp9NfL7 pw5uPFGaZBqaanIQbpF/gQVVn474/cccjgXGDx6F6L+CXeS+MvL/Eqrx+I1418Qznmqf u5jR7veNybs4+C4a6jglf/CTEHt17L/kTqd20EsmyYIBoOu9ne/KQQJxv1xbBjel1eTP S8nA== X-Gm-Message-State: ABy/qLb8jn9u49yKgH+6oBqkv9/BsBW20YY7G872GuZ3l8n4qXd/pOfr QGEdTuO3F1uGtbfKsnmBxyLGNcdw7nGkIP3V X-Received: by 2002:a17:90b:1b47:b0:263:6114:f0f9 with SMTP id nv7-20020a17090b1b4700b002636114f0f9mr7023160pjb.42.1690129548626; Sun, 23 Jul 2023 09:25:48 -0700 (PDT) Received: from d.home.yangfl.dn42 ([104.28.245.199]) by smtp.gmail.com with ESMTPSA id u3-20020a17090aae8300b00265a7145fe5sm6883787pjq.41.2023.07.23.09.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 09:25:48 -0700 (PDT) From: David Yang To: linux-clk@vger.kernel.org Cc: David Yang , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org Subject: [PATCH v5 11/13] clk: hisilicon: hip04: Convert into platform driver module Date: Mon, 24 Jul 2023 00:22:36 +0800 Message-Id: <20230723162245.35033-12-mmyangfl@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230723162245.35033-1-mmyangfl@gmail.com> References: <20230723162245.35033-1-mmyangfl@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772232731851482460 X-GMAIL-MSGID: 1772232731851482460 Use common helper functions and register clks with a single of_device_id data. Signed-off-by: David Yang --- drivers/clk/hisilicon/clk-hip04.c | 39 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/clk/hisilicon/clk-hip04.c b/drivers/clk/hisilicon/clk-hip04.c index 785b9faf3ea5..9aa2481781cb 100644 --- a/drivers/clk/hisilicon/clk-hip04.c +++ b/drivers/clk/hisilicon/clk-hip04.c @@ -10,11 +10,8 @@ #include #include -#include -#include -#include +#include #include -#include #include @@ -27,16 +24,28 @@ static struct hisi_fixed_rate_clock hip04_fixed_rate_clks[] __initdata = { { HIP04_CLK_168M, "clk168m", NULL, 0, 168750000, }, }; -static void __init hip04_clk_init(struct device_node *np) -{ - struct hisi_clock_data *clk_data; +static const struct hisi_clocks hip04_clks = { + .fixed_rate_clks = hip04_fixed_rate_clks, + .fixed_factor_clks_num = ARRAY_SIZE(hip04_fixed_rate_clks), +}; + +static const struct of_device_id hip04_clk_match_table[] = { + { .compatible = "hisilicon,hip04-clock", + .data = &hip04_clks }, + { } +}; +MODULE_DEVICE_TABLE(of, hip04_clk_match_table); + +static struct platform_driver hip04_clk_driver = { + .probe = hisi_clk_probe, + .remove_new = hisi_clk_remove, + .driver = { + .name = "hip04-clock", + .of_match_table = hip04_clk_match_table, + }, +}; - clk_data = hisi_clk_init(np, HIP04_NR_CLKS); - if (!clk_data) - return; +module_platform_driver(hip04_clk_driver); - hisi_clk_register_fixed_rate(hip04_fixed_rate_clks, - ARRAY_SIZE(hip04_fixed_rate_clks), - clk_data); -} -CLK_OF_DECLARE(hip04_clk, "hisilicon,hip04-clock", hip04_clk_init); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("HiSilicon HiP04 Clock Driver");