Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4498098ybz; Tue, 21 Apr 2020 01:32:23 -0700 (PDT) X-Google-Smtp-Source: APiQypIX6902rg5hrg346jFt2bdrCXy/Pgkd6zypa24D1/0yvJWOQvbTPkRYuZGwoN7KxAOu8w4i X-Received: by 2002:a17:906:4cc3:: with SMTP id q3mr10986428ejt.170.1587457943375; Tue, 21 Apr 2020 01:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587457943; cv=none; d=google.com; s=arc-20160816; b=cBMNHhHnMQFcgVeHjwWM3ebHvfcqt3u6G76Ft+8ZYJQJ0y3hCAkdAb07ycTgeHBKdg p6r9KN0D83HQI8+ky7VsWNPFXoUrt0PY6o1SD3cV59F8lTL0wlSdu56+xZYPqmboJl5y nVkOED4QRaCcaicyKabXLizb0CqFhOb8LtuWC9IG3ly4/NlhC0dNwqsebtRku/MRgEBc z7NCfaY9JWbUOQh6bFC76rLJWI5C6BzG1ZbMbIiOVLONN4dRBpj+Bxs0hmfpFdLssQuI UWgCsRaHPB4PIwLndaT/JGW2tjsLFhaIZt4dJ7p4ewmD/s0vfl24wCg+4/sHdYuvMbC1 pO+A== 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=hDyTmm7ObJhnXuIIuM4ITFxIh1Ydqh6+BvcmmOFFMBs=; b=NBOSn11A05zAu2M8WWpj+81Di1gIH1MVtNL5uZsRx5Yq+GgW5XTA5kslQuaTl01cNh BTHAF3MAgqwmIkhnzV6Xrhs5Gkm6LoXQUyT9HcG9XHOGCkQDB9kl3S8+5Z3pg2Xu98jy O9a602j4wN2V57r2ogB6Ll4Xu9jCNO6QOa0V2ZrDAJN6WP0zatVgRCuU5P5ZvdXYNOLE 2snqCCLy6y0Wvw+A+GkcaWxwjlI56EvXOU9UmrEcHCrEsAYp88o0e+s+5ZgbPtwUtvLh ksX+y+5IqOs1xD0592sJ9iBe2NGfkq0wYA08ZHl4N2cE8FDekEsNLwu3OjeUd2rafZXh pyJA== 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 s19si1103210ejz.320.2020.04.21.01.32.00; Tue, 21 Apr 2020 01:32:23 -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 S1728461AbgDUIah (ORCPT + 99 others); Tue, 21 Apr 2020 04:30:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:56340 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbgDUIaf (ORCPT ); Tue, 21 Apr 2020 04:30:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A3046ACAE; Tue, 21 Apr 2020 08:30:33 +0000 (UTC) From: Mian Yousaf Kaukab To: linux-pm@vger.kernel.org, andy.tang@nxp.com, sboyd@kernel.org, linux-clk@vger.kernel.org, rjw@rjwysocki.net, shawnguo@kernel.org, leoyang.li@nxp.com Cc: viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Mian Yousaf Kaukab Subject: [PATCH v2 2/2] clk: qoriq: add cpufreq platform device Date: Tue, 21 Apr 2020 10:30:00 +0200 Message-Id: <20200421083000.16740-2-ykaukab@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200421083000.16740-1-ykaukab@suse.de> References: <20200421083000.16740-1-ykaukab@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a platform device for qoirq-cpufreq driver for the compatible clockgen blocks. Reviewed-by: Yuantian Tang Acked-by: Viresh Kumar Signed-off-by: Mian Yousaf Kaukab --- v2: +Rafael, Stephen, linux-clk Add Reviewed-by and Acked-by tags drivers/clk/clk-qoriq.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index d5946f7486d6..374afcab89af 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -95,6 +95,7 @@ struct clockgen { }; static struct clockgen clockgen; +static bool add_cpufreq_dev __initdata; static void cg_out(struct clockgen *cg, u32 val, u32 __iomem *reg) { @@ -1019,7 +1020,7 @@ static void __init create_muxes(struct clockgen *cg) } } -static void __init clockgen_init(struct device_node *np); +static void __init _clockgen_init(struct device_node *np, bool legacy); /* * Legacy nodes may get probed before the parent clockgen node. @@ -1030,7 +1031,7 @@ static void __init clockgen_init(struct device_node *np); static void __init legacy_init_clockgen(struct device_node *np) { if (!clockgen.node) - clockgen_init(of_get_parent(np)); + _clockgen_init(of_get_parent(np), true); } /* Legacy node */ @@ -1447,7 +1448,7 @@ static bool __init has_erratum_a4510(void) } #endif -static void __init clockgen_init(struct device_node *np) +static void __init _clockgen_init(struct device_node *np, bool legacy) { int i, ret; bool is_old_ls1021a = false; @@ -1516,12 +1517,35 @@ static void __init clockgen_init(struct device_node *np) __func__, np, ret); } + /* Don't create cpufreq device for legacy clockgen blocks */ + add_cpufreq_dev = !legacy; + return; err: iounmap(clockgen.regs); clockgen.regs = NULL; } +static void __init clockgen_init(struct device_node *np) +{ + _clockgen_init(np, false); +} + +static int __init clockgen_cpufreq_init(void) +{ + struct platform_device *pdev; + + if (add_cpufreq_dev) { + pdev = platform_device_register_simple("qoriq-cpufreq", -1, + NULL, 0); + if (IS_ERR(pdev)) + pr_err("Couldn't register qoriq-cpufreq err=%ld\n", + PTR_ERR(pdev)); + } + return 0; +} +device_initcall(clockgen_cpufreq_init); + CLK_OF_DECLARE(qoriq_clockgen_1, "fsl,qoriq-clockgen-1.0", clockgen_init); CLK_OF_DECLARE(qoriq_clockgen_2, "fsl,qoriq-clockgen-2.0", clockgen_init); CLK_OF_DECLARE(qoriq_clockgen_b4420, "fsl,b4420-clockgen", clockgen_init); -- 2.16.4