From patchwork Mon Oct 30 13:04:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 117462 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2563205qgn; Mon, 30 Oct 2017 06:05:20 -0700 (PDT) X-Google-Smtp-Source: ABhQp+S+FdtHRNiOu3aW0LStbi8lBggusklgYWqiuJqf5KavUT+rbZRcOlz8gsaH/Ebu86eGJ19C X-Received: by 10.84.148.203 with SMTP id y11mr7326994plg.198.1509368720818; Mon, 30 Oct 2017 06:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509368720; cv=none; d=google.com; s=arc-20160816; b=ibHEKI2kLkZpK5TZ3EqXHOZLm1icxxpJslRhYO6DDe0HrkHxBm9EL88LyK7fi3FXqr YMdZgdOJl++Z1Mcistweu4s/IVxh2W0C6eCmOm/uF6SZbEBjgpUTQTKmHawUlJ6hUdus veVooWZCTeYyaolWqkUy/35t4KWinjKP+Rbgu4UtpPR71naSZKq1vRwVDAnhbKkZcKx+ 2p0iBKPNFAhmSi9r7V1Hm/7uLDjrmni+/TX05l2IVm3Rg1pCCmlrb0X6/KeZFckgi5Pn wuReiRR/f2ft9QnXH9U4jG1C0u26JxBFWwc+xrZ30WSbWvCrCQWRIX2XKIr0zXTDgxTa CeRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UhYW1W1Ag+1nwo5Aent418w5Lilho7hFMeMHvnSFxuA=; b=cANhDHFMjbmkQQjO1+lZmM/Ynn3DgUd8fPX1/d9WxZjyTElrS8PQqn5BbB0YrxOsf2 /fKkF22STOAFYHqhvpksLhV0leIhrV2LtsLajeeCHQmrtNwP0YAFrwiHMlMt/mNzyG4o mmHiysDD9VtEjbIuWvUNOe8BxpUycA4ytUWOdr/C6JLsw3mQl/AJ73Emxtzb6MmG2fsf 8lYnDdEecIZ/bQedrrW4Ec5APetUR1HYkR+VaK0HCGicOBUUInQxZQDZN+f6u3/Qalzv A/Lt512fq22rYxpVdDQ70E6mxavAgv39OXFy0Xz/EpwqTf9SRhH/TCEBA/iwC1x1C5KG 04yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=KHIcXVIf; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si10891364pfe.573.2017.10.30.06.05.20; Mon, 30 Oct 2017 06:05:20 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=KHIcXVIf; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbdJ3NFR (ORCPT + 4 others); Mon, 30 Oct 2017 09:05:17 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:53046 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbdJ3NFP (ORCPT ); Mon, 30 Oct 2017 09:05:15 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v9UD5Cnk011306; Mon, 30 Oct 2017 08:05:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1509368712; bh=Xcq93modt7skhxuS8qmjC/F5wm26SHVTsAY9Bt51qsc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KHIcXVIf9ZP8w/rta5gJ03e2TGZUBvhlhtuNFBSd7+RA45DDbATyIwhECXOYn+DC8 +fxevtlP+BKvJg2heKe/jbpNI2oU+GEy9y37Nq2pBLOAzmZ6s7W9KwXibmYxL52qiY AdnQXSL1bGehV/q7/l8BOcLkubPqs6/W+TGbSgak= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9UD5C6l004718; Mon, 30 Oct 2017 08:05:12 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Mon, 30 Oct 2017 08:05:12 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Mon, 30 Oct 2017 08:05:12 -0500 Received: from gomoku.home (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9UD54ws005221; Mon, 30 Oct 2017 08:05:10 -0500 From: Tero Kristo To: , , CC: , Subject: [PATCH 03/27] clk: ti: add support for clkctrl aliases Date: Mon, 30 Oct 2017 15:04:21 +0200 Message-ID: <1509368685-29112-4-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509368685-29112-1-git-send-email-t-kristo@ti.com> References: <1509368685-29112-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org hwmod core still depends on certain clocks being found by name, so we need to add support for adding clkctrl clock aliases. This patch can be reverted when no longer needed by hwmod core code. Signed-off-by: Tero Kristo --- drivers/clk/ti/clk.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) -- 1.9.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki -- 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/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index e5a1c82..10a7045 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -108,18 +108,70 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) struct device_node *node; struct clk *clk; struct of_phandle_args clkspec; + char buf[64]; + char *ptr; + char *tags[2]; + int i; + int num_args; + int ret; + static bool clkctrl_nodes_missing; + static bool has_clkctrl_data; for (c = oclks; c->node_name != NULL; c++) { - node = of_find_node_by_name(NULL, c->node_name); + strcpy(buf, c->node_name); + ptr = buf; + for (i = 0; i < 2; i++) + tags[i] = NULL; + num_args = 0; + while (*ptr) { + if (*ptr == ':') { + if (num_args >= 2) { + pr_warn("Bad number of tags on %s\n", + c->node_name); + return; + } + tags[num_args++] = ptr + 1; + *ptr = 0; + } + ptr++; + } + + if (num_args && clkctrl_nodes_missing) + continue; + + node = of_find_node_by_name(NULL, buf); + if (num_args) + node = of_find_node_by_name(node, "clk"); clkspec.np = node; + clkspec.args_count = num_args; + for (i = 0; i < num_args; i++) { + ret = kstrtoint(tags[i], i ? 10 : 16, clkspec.args + i); + if (ret) { + pr_warn("Bad tag in %s at %d: %s\n", + c->node_name, i, tags[i]); + return; + } + } clk = of_clk_get_from_provider(&clkspec); if (!IS_ERR(clk)) { c->lk.clk = clk; clkdev_add(&c->lk); } else { - pr_warn("failed to lookup clock node %s\n", - c->node_name); + if (num_args && !has_clkctrl_data) { + if (of_find_compatible_node(NULL, NULL, + "ti,clkctrl")) { + has_clkctrl_data = true; + } else { + clkctrl_nodes_missing = true; + + pr_warn("missing clkctrl nodes, please update your dts.\n"); + continue; + } + } + + pr_warn("failed to lookup clock node %s, ret=%ld\n", + c->node_name, PTR_ERR(clk)); } } }