From patchwork Mon Mar 30 05:24:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 46470 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D230214AF for ; Mon, 30 Mar 2015 05:25:19 +0000 (UTC) Received: by qgez6 with SMTP id z6sf133826297qge.0 for ; Sun, 29 Mar 2015 22:25:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=EXmN3RuAt6FHHzQ6iAA/CgWwzVntPB5J99pZMwo4gyk=; b=cRz6Myk+9H0UN5izxa337AUfdhNAbXyL2t4lLNQeo9lePwtx7j5iwFDD/WVBqjNAQB PxCoOr1vNZLkAsZmu/7LKV26cOfdE+ElxxeryB1833+83ZVDI3nswLS1c7hjbPDhe1iP XJovTnrDEsZpqBkua4A5lsM32+F/kUkK9rmQ3SjnpwBsWn7IbFYRdkVzuUUzS3vx5wxl vM8BUB0UNv9LcCcguJxzT3y+nikx3jMixHW7OgrPfggPlzk2djpYtCeUCM1xeFORKKGi /t7lnpxouduTanYLgNx1aD2HTUr+yRr9ngw45TR9l1HdPFbRjAie9Jb8EA0IZuV4LW7u acjw== X-Gm-Message-State: ALoCoQl+/g3NWZPaWJPNStuz2A1EoPm5L84lTpP/tRV27KMystoFANjjYbKe5JZtNr1NIPJQuRoW X-Received: by 10.236.39.171 with SMTP id d31mr32049858yhb.55.1427693119272; Sun, 29 Mar 2015 22:25:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.33 with SMTP id 30ls2099394qga.19.gmail; Sun, 29 Mar 2015 22:25:19 -0700 (PDT) X-Received: by 10.140.30.52 with SMTP id c49mr14501505qgc.66.1427693119104; Sun, 29 Mar 2015 22:25:19 -0700 (PDT) Received: from mail-qg0-f42.google.com (mail-qg0-f42.google.com. [209.85.192.42]) by mx.google.com with ESMTPS id b79si9405982qge.107.2015.03.29.22.25.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Mar 2015 22:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.192.42 as permitted sender) client-ip=209.85.192.42; Received: by qgep97 with SMTP id p97so178708580qge.1 for ; Sun, 29 Mar 2015 22:25:19 -0700 (PDT) X-Received: by 10.140.105.10 with SMTP id b10mr38011586qgf.61.1427693118993; Sun, 29 Mar 2015 22:25:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.96.155.231 with SMTP id vz7csp1207687qdb; Sun, 29 Mar 2015 22:25:18 -0700 (PDT) X-Received: by 10.70.89.174 with SMTP id bp14mr55857651pdb.14.1427693117722; Sun, 29 Mar 2015 22:25:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gz5si12682125pbc.124.2015.03.29.22.25.16; Sun, 29 Mar 2015 22:25:17 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752263AbbC3FZP (ORCPT + 5 others); Mon, 30 Mar 2015 01:25:15 -0400 Received: from mail-yk0-f182.google.com ([209.85.160.182]:36573 "EHLO mail-yk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbbC3FZP (ORCPT ); Mon, 30 Mar 2015 01:25:15 -0400 Received: by ykcn8 with SMTP id n8so56535859ykc.3 for ; Sun, 29 Mar 2015 22:25:14 -0700 (PDT) X-Received: by 10.170.84.134 with SMTP id b128mr35973895yka.82.1427693114661; Sun, 29 Mar 2015 22:25:14 -0700 (PDT) Received: from localhost.localdomain ([104.207.83.1]) by mx.google.com with ESMTPSA id g46sm9852584yhd.42.2015.03.29.22.25.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Mar 2015 22:25:14 -0700 (PDT) From: Leo Yan To: Wei Xu , Dan Zhao , zhenwei.wang@hisilicon.com, Haojian Zhuang , Bintian Wang , mturquette@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 5/5] clk: hisi: add stub clock register function Date: Mon, 30 Mar 2015 13:24:24 +0800 Message-Id: <1427693064-11062-6-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427693064-11062-1-git-send-email-leo.yan@linaro.org> References: <1427693064-11062-1-git-send-email-leo.yan@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leo.yan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.192.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add stub clock register function, so can easily enable stub clock for platforms. Signed-off-by: Leo Yan --- drivers/clk/hisilicon/clk.c | 29 +++++++++++++++++++++++++++++ drivers/clk/hisilicon/clk.h | 12 ++++++++++++ 2 files changed, 41 insertions(+) diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c index 87f8173..0859e4d 100644 --- a/drivers/clk/hisilicon/clk.c +++ b/drivers/clk/hisilicon/clk.c @@ -243,3 +243,32 @@ void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *clks, data->clk_data.clks[clks[i].id] = clk; } } + +void __init hisi_clk_register_stub(struct hisi_stub_clock *clks, int nums, + struct hisi_clock_data *data, + struct device_node *np) +{ + struct clk *clk; + int i; + + for (i = 0; i < nums; i++) { + clk = hisi_register_stub_clk(np, + clks[i].id, + clks[i].name, + clks[i].parent_name, + clks[i].flags, + &hisi_clk_lock); + if (IS_ERR(clk)) { + pr_err("%s: failed to register clock %s\n", + __func__, clks[i].name); + continue; + } + + if (clks[i].alias) + clk_register_clkdev(clk, clks[i].name, NULL); + + data->clk_data.clks[clks[i].id] = clk; + } + + return; +} diff --git a/drivers/clk/hisilicon/clk.h b/drivers/clk/hisilicon/clk.h index e99184a..89ce9ad 100644 --- a/drivers/clk/hisilicon/clk.h +++ b/drivers/clk/hisilicon/clk.h @@ -90,6 +90,14 @@ struct hisi_gate_clock { const char *alias; }; +struct hisi_stub_clock { + unsigned int id; + char *name; + const char *parent_name; + unsigned long flags; + const char *alias; +}; + struct clk *hisi_register_clkgate_sep(struct device *, const char *, const char *, unsigned long, void __iomem *, u8, @@ -113,4 +121,8 @@ void __init hisi_clk_register_gate(struct hisi_gate_clock *, int, struct hisi_clock_data *); void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *, int, struct hisi_clock_data *); +void __init hisi_clk_register_stub(struct hisi_stub_clock *clks, int nums, + struct hisi_clock_data *data, + struct device_node *np); + #endif /* __HISI_CLK_H */