From patchwork Fri Dec 18 13:58:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 58666 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1041890lbb; Fri, 18 Dec 2015 05:58:15 -0800 (PST) X-Received: by 10.66.193.73 with SMTP id hm9mr5339841pac.117.1450447094711; Fri, 18 Dec 2015 05:58:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si24205142pac.165.2015.12.18.05.58.14; Fri, 18 Dec 2015 05:58:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932582AbbLRN5z (ORCPT + 3 others); Fri, 18 Dec 2015 08:57:55 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:35717 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932468AbbLRN5w (ORCPT ); Fri, 18 Dec 2015 08:57:52 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id tBIDvQPN012726; Fri, 18 Dec 2015 07:57:26 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id tBIDvQIG007552; Fri, 18 Dec 2015 07:57:26 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Fri, 18 Dec 2015 07:57:25 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id tBIDvKUC021403; Fri, 18 Dec 2015 07:57:24 -0600 From: Tero Kristo To: , , , , CC: Subject: [RFC 1/9] ARM: OMAP2+: omap_device: create clock alias purely from DT data Date: Fri, 18 Dec 2015 15:58:53 +0200 Message-ID: <1450447141-29936-2-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1450447141-29936-1-git-send-email-t-kristo@ti.com> References: <1450447141-29936-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This avoids the need to add most of the clock aliases under drivers/clk/ti/clk-xyz.c files. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/omap_device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 72ebc4c..3389ce7 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -62,6 +62,18 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias, return; } + r = clk_get_sys(NULL, clk_name); + + if (IS_ERR(r) && of_have_populated_dt()) { + struct of_phandle_args clkspec; + + clkspec.np = of_find_node_by_name(NULL, clk_name); + + r = of_clk_get_from_provider(&clkspec); + + clk_register_clkdev(r, clk_name, NULL); + } + rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL); if (rc) { if (rc == -ENODEV || rc == -ENOMEM)