From patchwork Mon Mar 11 23:05:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 2251861 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0153DDF5B1 for ; Mon, 11 Mar 2013 23:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754571Ab3CKXFk (ORCPT ); Mon, 11 Mar 2013 19:05:40 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:38149 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752994Ab3CKXFi (ORCPT ); Mon, 11 Mar 2013 19:05:38 -0400 Received: by mail-ob0-f174.google.com with SMTP id 16so3915693obc.33 for ; Mon, 11 Mar 2013 16:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=BkrxiesqXdsjt3HIlxQa5wACbr1M5ucOtrcW+dhHFcg=; b=hrHQ7Gl/gb5y2o9LGVkDUQsl84lfywMfSCEqnwZF5SUcR7OfYTZM2XZi8LJCLPzvNn R0ZKS5FCASpeO/ldYYfPYgRLZle68T3WxjJkZiLEmAuyXgF0l/8VYi55e2IkhqQQKDZ5 1NSxXes7RfdLbXvR4IJejMEmxM3h8WeYhDfvi7c0JKX3RoUicsxNKCB+rYr0A+KE8c2+ 0f2ATRCnGvD+s9N/dzaB1PRxZIQE8RXlUcATuaK/H5SABy6wOGF6acfNrkPw9M8N/MHo O2+JItiKjRd23KVR/sF6iH3kPZb6bff0QVodDhbc1mizbO8O1FesmL1w6fsp7L5QQ5Ym FHnA== X-Received: by 10.60.23.226 with SMTP id p2mr10237899oef.103.1363043137123; Mon, 11 Mar 2013 16:05:37 -0700 (PDT) Received: from localhost (cpe-24-27-111-228.tx.res.rr.com. [24.27.111.228]) by mx.google.com with ESMTPS id m7sm19064235obk.2.2013.03.11.16.05.35 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 11 Mar 2013 16:05:36 -0700 (PDT) From: Nishanth Menon To: cpufreq Cc: Nishanth Menon , "Rafael J. Wysocki" , Santosh Shilimkar , Shawn Guo , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH 1/2] cpufreq: cpufreq-cpu0: support for clock which are not in DT yet. Date: Mon, 11 Mar 2013 18:05:29 -0500 Message-Id: <1363043130-30270-2-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363043130-30270-1-git-send-email-nm@ti.com> References: <1363043130-30270-1-git-send-email-nm@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On certain SoCs like variants of OMAP, the clock conversion to DT is not complete. In short, the ability to: cpus { cpu@0 { clocks = <&cpuclk 0>; }; }; is not possible. However, the clock node is registered. Allow for clk names to be provided as string so as to be used when needed. Example (for OMAP3630): cpus { cpu@0 { clock-name = "cpufreq_ck"; }; }; Cc: "Rafael J. Wysocki" Cc: Santosh Shilimkar Cc: Shawn Guo Cc: linux-kernel@vger.kernel.org Cc: cpufreq@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-omap@vger.kernel.org Signed-off-by: Nishanth Menon Acked-by: Santosh Shilimkar --- .../devicetree/bindings/cpufreq/cpufreq-cpu0.txt | 3 +++ drivers/cpufreq/cpufreq-cpu0.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt index 4416ccc..f180963 100644 --- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt @@ -12,6 +12,9 @@ Required properties: for details Optional properties: +- clock-name: If the clock is not converted to device tree, then describe + the clock name as a string. This may also be replaced with clocks=<&cpuclk> + cpu clocks has already been converted to device tree. - clock-latency: Specify the possible maximum transition latency for clock, in unit of nanoseconds. - voltage-tolerance: Specify the CPU voltage tolerance in percentage. diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 4e5b7fb..28223c9 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -180,6 +180,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; int ret; + const char *clk_name = NULL; for_each_child_of_node(of_find_node_by_path("/cpus"), np) { if (of_get_property(np, "operating-points", NULL)) @@ -194,7 +195,10 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) cpu_dev = &pdev->dev; cpu_dev->of_node = np; - cpu_clk = devm_clk_get(cpu_dev, NULL); + /* If clocks are not in DT yet, allow to define it part of CPU node */ + of_property_read_string(np, "clock-name", &clk_name); + + cpu_clk = devm_clk_get(cpu_dev, clk_name); if (IS_ERR(cpu_clk)) { ret = PTR_ERR(cpu_clk); pr_err("failed to get cpu0 clock: %d\n", ret);