Received: by 10.223.164.221 with SMTP id h29csp1762042wrb; Thu, 2 Nov 2017 00:03:34 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QbSEA30da8spfjm3sS+7JDeaOFpFPiZBEEPK7BcYRPnZ4X1824/W6P5niY3nUNtLS9H8qr X-Received: by 10.84.215.204 with SMTP id g12mr1588033plj.27.1509606214185; Thu, 02 Nov 2017 00:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509606214; cv=none; d=google.com; s=arc-20160816; b=KwkR//MQpxAuJLXSYcfevsyUQhKBEwQ1XDfgh9rBwAdhsi2/QrmyOKKQyNvX8n7g49 LvDxTwG0Zf8COKyfSmV2gFl8OX3RvvKnet43eYjTSgDU25w4Aik/Ftui3bTnSguGbLfD YcSuCE2TS72cT7gg7574HJQ+4OxlCHdp/MPuh4WcaDKJQ0DWQtdfl1TN53bulBwQAzSD 8Uwco2E8nW95pzssonyyx++yXgMqEgm80B8FUu83VnEhMZvcb0PRSnl8AozP+m++fMbo L0S0wZtOZRqT1AHuZcs+awaHjDpOcSg59hVPBkRI7HG9BtAbu1W80z89okuuY8xUbJTQ lrbQ== 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:arc-authentication-results; bh=+bacJTYPP6PPvPwX/xWiNSUSxiZjjbGWwAoZuVXiNjs=; b=mXyJU05HV8NKUSQOhhaalcpbi4RPlETwN4uTD449wbK25tDU1OeG1CMS3426zOdvAt WX/tCayIvielo1R12xakzqh0tmXV4bu1NP0Lb/NSYbe8LIr+JvKNuMwlU7oFr8wFGyfc AfShkt6UkeNSOluu8LpDQSTktrJVq0CT+iYkIKD3GH9X6t0bcRcPAhdwvn55JBLrtAA8 pK+7FkL7xDex9/b3ATsaVg54neJeuZ7CAMgROnQaeEYj32gs55s6/Zo87/bsf4bl9QRL p27u0OZwwMQaONN+zO3SYZspIILX8nzR63jaysfq3Lhx11p6jyGuxMth9xkUiTcurH77 4BiA== 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 61si1543753plz.184.2017.11.02.00.03.20; Thu, 02 Nov 2017 00:03: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 S1755036AbdKBHCf (ORCPT + 99 others); Thu, 2 Nov 2017 03:02:35 -0400 Received: from sci-ig2.spreadtrum.com ([222.66.158.135]:53905 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751321AbdKBHCe (ORCPT ); Thu, 2 Nov 2017 03:02:34 -0400 Received: from ig2.spreadtrum.com (shmbx01.spreadtrum.com [10.0.1.203]) by SHSQR01.spreadtrum.com with ESMTP id vA27230W014271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Nov 2017 15:02:03 +0800 (CST) (envelope-from Chunyan.Zhang@spreadtrum.com) Received: from SHCAS02.spreadtrum.com (10.0.1.202) by SHMBX01.spreadtrum.com (10.0.1.203) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 2 Nov 2017 15:02:05 +0800 Received: from localhost (10.0.73.143) by SHCAS02.spreadtrum.com (10.0.1.250) with Microsoft SMTP Server (TLS) id 15.0.847.32 via Frontend Transport; Thu, 2 Nov 2017 15:01:47 +0800 From: Chunyan Zhang To: Stephen Boyd , Michael Turquette , Rob Herring , Mark Rutland CC: Catalin Marinas , Will Deacon , , , Arnd Bergmann , Mark Brown , Xiaolong Zhang , Ben Li , , , Orson Zhai , Chunyan Zhang Subject: [PATCH V3 01/11] drivers: move clock common macros out from vendor directories Date: Thu, 2 Nov 2017 14:56:16 +0800 Message-ID: <20171102065626.21835-2-chunyan.zhang@spreadtrum.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171102065626.21835-1-chunyan.zhang@spreadtrum.com> References: <20171102065626.21835-1-chunyan.zhang@spreadtrum.com> MIME-Version: 1.0 Content-Type: text/plain X-MAIL: SHSQR01.spreadtrum.com vA27230W014271 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These macros are used by more than one SoC vendor platforms, avoid to have many copies of these code, this patch moves them to the common clock directory which every clock drivers can access to. Signed-off-by: Chunyan Zhang --- drivers/clk/clk_common.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 drivers/clk/clk_common.h diff --git a/drivers/clk/clk_common.h b/drivers/clk/clk_common.h new file mode 100644 index 0000000..21e93d2 --- /dev/null +++ b/drivers/clk/clk_common.h @@ -0,0 +1,60 @@ +/* + * drivers/clk/clk_common.h + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#ifndef _CLK_COMMON_H_ +#define _CLK_COMMON_H_ + +#include + +#define CLK_HW_INIT(_name, _parent, _ops, _flags) \ + (&(struct clk_init_data) { \ + .flags = _flags, \ + .name = _name, \ + .parent_names = (const char *[]) { _parent }, \ + .num_parents = 1, \ + .ops = _ops, \ + }) + +#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \ + (&(struct clk_init_data) { \ + .flags = _flags, \ + .name = _name, \ + .parent_names = _parents, \ + .num_parents = ARRAY_SIZE(_parents), \ + .ops = _ops, \ + }) + +#define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags) \ + (&(struct clk_init_data) { \ + .flags = _flags, \ + .name = _name, \ + .parent_names = NULL, \ + .num_parents = 0, \ + .ops = _ops, \ + }) + +#define CLK_FIXED_FACTOR(_struct, _name, _parent, \ + _div, _mult, _flags) \ + struct clk_fixed_factor _struct = { \ + .div = _div, \ + .mult = _mult, \ + .hw.init = CLK_HW_INIT(_name, \ + _parent, \ + &clk_fixed_factor_ops, \ + _flags), \ + } + +#define CLK_FIXED_RATE(_struct, _name, _flags, \ + _fixed_rate, _fixed_accuracy) \ + struct clk_fixed_rate _struct = { \ + .fixed_rate = _fixed_rate, \ + .fixed_accuracy = _fixed_accuracy, \ + .hw.init = CLK_HW_INIT_NO_PARENT(_name, \ + &clk_fixed_rate_ops, \ + _flags), \ + } + +#endif /* _CLK_COMMON_H_ */ -- 2.7.4 From 1584419788600138964@xxx Sat Nov 18 15:54:18 +0000 2017 X-GM-THRID: 1584347621593014254 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread