Received: by 10.223.164.202 with SMTP id h10csp1152779wrb; Thu, 9 Nov 2017 22:42:48 -0800 (PST) X-Google-Smtp-Source: ABhQp+RjObw6TbARwkIO/IMvmlqp4gOC61KaC2legoOmHGBnxesPvIu6Q2wsKQDOcAIkR4Hh3Jwx X-Received: by 10.98.156.210 with SMTP id u79mr3284116pfk.50.1510296167957; Thu, 09 Nov 2017 22:42:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510296167; cv=none; d=google.com; s=arc-20160816; b=NN+UFagAAf2+K4R8WySVY5NEXYsub0w2Or57l9bfb58u+O3LC8jFcndv9EAKZBchb2 1y0nk3B/Zu18Ta691qv94CiJUrNap4cxrLaMZU0GAKTb81o3+z+jI0lKfR8PcQ/uj+G5 fgCc7TxR4IZmaUB433BeHcXFlvQOFGmqYhiV0XLD8Bw3cm+GEf/h3q3YnUJQcKenzPbh Wxy/24482vAasVAlpvVqeL75M16ZOyxS8n4JGLmvLNzl1mKMXI3SHxJSU0Q/VXu25r9u hs3b0aSnE90JwQi5DZqTijNdoBi/P6d96dYPGbSt7GiWCwBIj289Eb7od1O8t0G+uloM yU5Q== 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=FBPbegQ801OU/IZEPwN6BUXQ573W2KsrfTa4uUtAwjU=; b=h9Fe7nRrpZ2AHi9+9SRKtq1+/Y0Ar5AgWkErFNNGTbLAzmbRLiFkKxq3L8SVILcHN8 o5h9zUl4ErP+4mG6UJYltePGmBWSq79vvP7VCXWxR8iPEiKXfHmwm6z/3jiiownw/A8d h+nApSe/5HdUOGnq48ZaKvKTvEhR+mvQah1DMmPXwSzWWNln4soKpnCmbfRt+FO0i5+t YqEZmWP5krgOjwxAklVB04iYeteVMYfDkLg9DyEUgzF0eggI8sKEuxejS/8ZMHrN8aKU Kteb7GvPb5oEUhf1EgpIlNcVzu59Fu3CUkZZ1jjksgbhkEAVy5uP7Eyg5nQzorAbozMI N6yA== 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 c4si8016950pgu.231.2017.11.09.22.42.36; Thu, 09 Nov 2017 22:42:47 -0800 (PST) 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 S1755497AbdKJGlz (ORCPT + 83 others); Fri, 10 Nov 2017 01:41:55 -0500 Received: from sci-ig2.spreadtrum.com ([222.66.158.135]:35590 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751043AbdKJGlx (ORCPT ); Fri, 10 Nov 2017 01:41:53 -0500 Received: from ig2.spreadtrum.com (shmbx01.spreadtrum.com [10.0.1.203]) by SHSQR01.spreadtrum.com with ESMTP id vAA6fK7X032820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Nov 2017 14:41:20 +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; Fri, 10 Nov 2017 14:41:30 +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; Fri, 10 Nov 2017 14:41:31 +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 V4 01/12] drivers: move clock common macros out from vendor directories Date: Fri, 10 Nov 2017 14:35:56 +0800 Message-ID: <20171110063607.3250-2-chunyan.zhang@spreadtrum.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171110063607.3250-1-chunyan.zhang@spreadtrum.com> References: <20171110063607.3250-1-chunyan.zhang@spreadtrum.com> MIME-Version: 1.0 Content-Type: text/plain X-MAIL: SHSQR01.spreadtrum.com vAA6fK7X032820 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 --- This patchset also added a few common clock mactos into drivers/clk/clk_common.h, which are generally useful for all vendors' clock driver, sunxi-ng, zte, sprd (added in this patchse) use them (or part of them) at present, once this patch is merged, I can help to remove the duplicated code which is under the vendors' respective directories. --- 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 1583622727380320939@xxx Thu Nov 09 20:45:21 +0000 2017 X-GM-THRID: 1583622727380320939 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread