Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp916813ybb; Fri, 3 Apr 2020 14:22:34 -0700 (PDT) X-Google-Smtp-Source: APiQypL18b/fFHpuCd/U9TdZyRChvqcmW0pq4uhbBut0xx3VeJCIhHY+DTvLJ5DbOhCvuI2EMYIU X-Received: by 2002:aca:682:: with SMTP id 124mr4767832oig.69.1585948954562; Fri, 03 Apr 2020 14:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585948954; cv=none; d=google.com; s=arc-20160816; b=XAxsFagQlouckfHyMTRCU14nUFLFCsYcwWtQoO6a4h2lxTDMwcRGJCQXpVIIa5nXpv TnT/k5YjomHqzsrOb1scCe3alhvQZK3l9qaZBXmvAKVhfeHPiq0ZnJTvnEvNC1AAnFX7 S5rdrmo/4OUmj3trBUyMPtVoOkhd8Kr4kLt2y5uf2iQPRPxSYT5pddEtz3DuTkJl8e1o Vlejxo6NYermjK5YXHXNTiJsXRNg7CBKOxao/GRL97cV/G0MSlwnNtCTMai1r3T/Gvfo /zXeD7XX9khs4ZMJgrR3fAfkGt45C2s+P0HvC8jQo+LFDjw16yZ0ZveyKxi6ZgkrBKpy 5Bbg== 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=aiNtMchu05ifT371gI8ea0ubTb4KiPoO7fPWxUsmRVk=; b=Z4FwEJ5GvI+nNmhBo9IwtpiJNhzPFtS4fRHKjht1MpTrz/F1GG4zM1mA6fvZRyUUdS rhttub3UwaviiiqgC483kKDI1L1gr71aj6Gu4FEOTq7dIn6aKAGK+m7mzI+klrRryQ4D 19vP2ho8jN0dAsCirWxdoqdAQzrjfGEKpTATbtgTnoMQ8Ij314QhTOCuehf/kqKtqtlP 5Ee+DpzJO4wdLY+sV54TtE1SBJ4Sm1Gw7ViYJZBTO7Wd3VVnIqzVM2uh/3ff2184dXtc FmdPtGhSp7WLz5BrWYxWN2KLHN3LrScYwGnt6b4UA9NtQ256SKQJvmvUBui09OihjtTp cbAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si3983660oth.307.2020.04.03.14.22.22; Fri, 03 Apr 2020 14:22:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbgDCVVu (ORCPT + 99 others); Fri, 3 Apr 2020 17:21:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:44378 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727879AbgDCVVu (ORCPT ); Fri, 3 Apr 2020 17:21:50 -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 E75EFAD57; Fri, 3 Apr 2020 21:21:47 +0000 (UTC) From: Mian Yousaf Kaukab To: linux-pm@vger.kernel.org, andy.tang@nxp.com, 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 2/2] clk: qoriq: add cpufreq platform device Date: Fri, 3 Apr 2020 23:21:14 +0200 Message-Id: <20200403212114.15565-2-ykaukab@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200403212114.15565-1-ykaukab@suse.de> References: <20200403212114.15565-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. Signed-off-by: Mian Yousaf Kaukab --- 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