Received: by 10.223.164.202 with SMTP id h10csp3431215wrb; Sun, 19 Nov 2017 22:12:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMZUbzz4rdrxUHcVrL+Fx6opAodhwNmJoCOLQilrLGjbrwvMw4KE0wU8+2AYqWe38XOYysfO X-Received: by 10.84.235.129 with SMTP id p1mr9009340plk.288.1511158376347; Sun, 19 Nov 2017 22:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511158376; cv=none; d=google.com; s=arc-20160816; b=mnK9SxaWj+bxQ6l8EVu6elqymIbzszFysLkPtL72wAK0Ffqw4+BTwKPLuB8B6pvKUt EsU292qLBhAmMGJ8ac76mVP8T2gyxlwpQ9rIK8yiJZAQcRkRBDnfWXC+2w7UF/lPZsAH 0lOOugEXc1xn0BybvD4TNpQ+icSeef59XmSo9kb+qCbaC7kvP7elge5Ugm8TYdWcdP1j SSENrXEU54Zg+Y2CtSNPgKIiHsa0MGAkIZYViZ9xjVfAsFP6cA5kR4p04mGYQBZcL/m/ hh5xyaEXaaULSgx+PK8nAgIBTmKXAbdySGh0ix3IldwEz0lNwMtodPiIvfrRYbM9VGiv foCQ== 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=cJkYOmfEdmei2OvDJ+SjBN63RzdSs8nCdZK9UH1KH+w6yY6dm80l3VaZNyGAhArKYn XKL/hAbpU3M0U6TEBLq4NIN9qCnE+dOTA+BBAZ5TmbszFpqYvxAALq1ykSDScIQMgjRK YCMr9B0hEKBL9+GFiAMvU5IF/exGW5k1v/OLm3+eR8InD4AIbS5bXTOZ3Wz4xuSSwNZz NRiYp+xdGadDtory3MkQNHMgnzUNjYJBTvAaNGC/EMv79+9i05acdL8io9vuaV6InGLI PhOXad34ZKdfdVrxLzN23wvpjCRms8zAvLjLJ4FY4tg1GSvKuy4lFTfsaiw8LehpCGia RLag== 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 i10si7446197pgc.159.2017.11.19.22.12.45; Sun, 19 Nov 2017 22:12:56 -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 S1751345AbdKTGKw (ORCPT + 68 others); Mon, 20 Nov 2017 01:10:52 -0500 Received: from sci-ig2.spreadtrum.com ([222.66.158.135]:26543 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751204AbdKTGIN (ORCPT ); Mon, 20 Nov 2017 01:08:13 -0500 Received: from ig2.spreadtrum.com (shmbx01.spreadtrum.com [10.0.1.203]) by SHSQR01.spreadtrum.com with ESMTP id vAK67cMT060655 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Nov 2017 14:07: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, 20 Nov 2017 14:07:46 +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, 20 Nov 2017 14:07:46 +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 V5 01/12] drivers: move clock common macros out from vendor directories Date: Mon, 20 Nov 2017 14:01:26 +0800 Message-ID: <20171120060137.27380-2-chunyan.zhang@spreadtrum.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171120060137.27380-1-chunyan.zhang@spreadtrum.com> References: <20171120060137.27380-1-chunyan.zhang@spreadtrum.com> MIME-Version: 1.0 Content-Type: text/plain X-MAIL: SHSQR01.spreadtrum.com vAK67cMT060655 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 1584463777448356596@xxx Sun Nov 19 03:33:29 +0000 2017 X-GM-THRID: 1580974266570737123 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread