Received: by 10.223.164.202 with SMTP id h10csp1400680wrb; Mon, 27 Nov 2017 02:12:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMZkQGCMpl3pepSNcbdaRuoKKdt6Dl67l/Inln/4YoOMNtmabjeMitdIddT8Xs7Use1Jr0Wy X-Received: by 10.159.208.67 with SMTP id w3mr38402254plz.175.1511777565978; Mon, 27 Nov 2017 02:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511777565; cv=none; d=google.com; s=arc-20160816; b=Kx+NBeqVEHy1zkR5LBvw0C/D3fyNzf7AOYSxRvRs4htKxD3eLZQxWWE4fCBmZVclw9 y6HxXuga+54QM7vrR9eDThN5hiXf8LDwCsqiuHBDYj4SxZPvZS4JsHlOOpQTJmtOlRZs psjZyHyHm9u4wqgozIPz+AL9fNjw2wzSx6cdgorgl5nAaEBcdVvQNmTsLykBTOj61QBl Ce7vccoIhUb9w583xHwL8+JpWCdEXU83mM5zT9CBcsE8nlkfya3xbWddAWudPWieZqX5 hs3hzSpPr53LsCCzdovDVrb0y2mj4v8ZOjPlVsElPPWbw8UkZP0EfH6TCUEqg1DeEg+q 3Pkg== 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=lP5e8Yr0maWdqkW8IELFRsjfppXlExLNyhGpQVVXnxURRU948+SIuK+C3fJMjiUjJq MDNS1oiuYQy8VknRWtJ7iUpCFgvVtd3L26cD3xUT1Crcvr5pFxbGB0bqXMzd3Mry0S8b XxBU2EE1M0HtZpk1iVJdl6iVCr25eNGOKWqt59RD3UX1M7C7bCfJJl96rF8l31KM67F0 4LQYoghR8DufYJnen+F1108tgUSvUUnqcuaqQCfdYcnA56TdzEmU/xCCn7tr8n81UfjK dmm9gp2zoM6xu2nKxliyXEFV/dr08oKuzg/nFre1Xv/1tmV7uvZIjkHGWMIF44fBR/jh /ifg== 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 x81si25095727pff.17.2017.11.27.02.12.34; Mon, 27 Nov 2017 02:12:45 -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 S1751833AbdK0KHU (ORCPT + 78 others); Mon, 27 Nov 2017 05:07:20 -0500 Received: from sci-ig2.spreadtrum.com ([222.66.158.135]:19146 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751381AbdK0KHR (ORCPT ); Mon, 27 Nov 2017 05:07:17 -0500 Received: from ig2.spreadtrum.com (shmbx01.spreadtrum.com [10.0.1.203]) by SHSQR01.spreadtrum.com with ESMTP id vARA6c6U032553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Nov 2017 18:06:38 +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; Mon, 27 Nov 2017 18:07: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; Mon, 27 Nov 2017 18:07:04 +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 V6 01/12] drivers: move clock common macros out from vendor directories Date: Mon, 27 Nov 2017 18:01:04 +0800 Message-ID: <20171127100115.20655-2-chunyan.zhang@spreadtrum.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171127100115.20655-1-chunyan.zhang@spreadtrum.com> References: <20171127100115.20655-1-chunyan.zhang@spreadtrum.com> MIME-Version: 1.0 Content-Type: text/plain X-MAIL: SHSQR01.spreadtrum.com vARA6c6U032553 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 1586089488878027749@xxx Thu Dec 07 02:13:29 +0000 2017 X-GM-THRID: 1586032700990262711 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread