From patchwork Sun Aug 25 14:18:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 172154 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3183071ily; Sun, 25 Aug 2019 07:19:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYR9DcwqzI1xj3Hs481KJ1Nu5UnvSdfw9oXj6LwNJ6bh/2R92b5ceVUsq3/xfRjpNocklk X-Received: by 2002:a63:595d:: with SMTP id j29mr12530562pgm.134.1566742759340; Sun, 25 Aug 2019 07:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566742759; cv=none; d=google.com; s=arc-20160816; b=fm/TknJ5DohPoqBSHHYf04VlXrk+rk5mU2DhtL5XhhI5FWqw6WFSne7bhb6k37OnKK 0ryTNeFoZfxSTknIrJX3J+WYcoPbeUZSQvc1hjqou4h0QcmJkKR782G6vPNkDMXz+0mg TuxbkrT8r8HdF0Y7ZKiv+cfBHhFTxWO8sfHoUgVKQ2t384KH5JAs295nCMiiDoJKG5HI 6jChF9TNAR6g67YXV0P5G/LPmhVa24AbKTPOi5Wsgb0vNy08LIs5EILJATR+M30s3a5F NVrPg040jSd35lhdKJ5QgjaEgzgFQiP1iGPQ2e6+XC3DWg+BmAIfSFb71DRsDl4Xkzao EnnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y+TiXTfy0GvucZpWMpF+hFSYcOEhRLjxhLj5EgYmgAI=; b=NWXx8ApKc2fRFTj5q2T6eBIE+bSeJ2Oxm3KgA+ImV5bs8fqxlbFbtpQpb1h5Rs+pzI t6d1WsXSK4dcLs4ZPSMdiISG4m7wqeZxMdDT3G3kUUPJEbKam4aO1y/TX2ywhLksQHao r8PuXw74E/2cZLMXw1EHpjOi8IleIBMXlE5NCbJc0qdQ6KbkBNbovDqoBuEUEs+78orp ruQxX8vZ90F4PWS9UrlRcsOL8eXCwV+/iAr3vi9CHrfCUMEGiheUGgqn0vZ1I11zk6gF R9IguqpE4d/zOp6KF6lqdGU4oEvqFRy9jPrDC9lg1KX9W6mWURlHG/6K6AJfuK7RnvYN Ga5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Fmj0w6Fa; 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 9si6780134pgn.337.2019.08.25.07.19.19; Sun, 25 Aug 2019 07:19:19 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Fmj0w6Fa; 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 S1728503AbfHYOTN (ORCPT + 28 others); Sun, 25 Aug 2019 10:19:13 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39188 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728382AbfHYOTM (ORCPT ); Sun, 25 Aug 2019 10:19:12 -0400 Received: by mail-pf1-f194.google.com with SMTP id y200so2194226pfb.6; Sun, 25 Aug 2019 07:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y+TiXTfy0GvucZpWMpF+hFSYcOEhRLjxhLj5EgYmgAI=; b=Fmj0w6FapHbABc+eh987fmHXPe8SCHwirQLQQP6cdae4qFHsUNAz1Siwh0NjJqvkfa COWY1/KpH6kxxFZWb2ckNWPSfK4YHU2vt/XlWuP6hGzLArij8okqzymSXrHeuyx5m8EM TsjBS11ZpnL4SSmyZIIk4lpjSPniC9YDes63aNa35olscVGvNBX9A5KqGOC6ESzv3ljC BoV1R5+gtzPIG6VZkRqRqmCoAQDOnScmWmP9FSIH4xRu/JA5/vWhrCw16R9eWFs3odxV dyv38klp+9OXGyfwPTTAzUWArNP4j5gawujiivYMxRIDgHdTCU+ZL6NyYVe8rvYuzCWM ZKaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Y+TiXTfy0GvucZpWMpF+hFSYcOEhRLjxhLj5EgYmgAI=; b=XYVwgsdb4iG03MgXH6LA+uozh8Hi0EW90LNz4Cb753S9ls95BntCVOsE/MSCd14tot HV4HoC8S/aKRghE/H3FO3hyxSpWUMZ1nEiKx6kpjhiRJ6UQp/LDNv/ry9KvV6DpToDXT LndOO5b0P74TcnwJKdFpfFmBywSgzMuTumIpOqYYqbyTTTQFWwm6XC01CFB+0Cn8ANzA mhiKRs9xhTgIOvdpsr8lpDIXY64dWiJX3IBqRi4pW6S/k6+tU8ugcG/Tl3tFeCYGYk6Z gsEigy0oQDIxoWlBWYG0X2CZFFR6K1HHjYKzjMM4MHR6YJRpUBXo3JXunsZMOfjFAPZX 93rw== X-Gm-Message-State: APjAAAUjnIgqDu3xFqa7+jeCszF4uI2guj5a28ZvNk39monhJ4CUjWFq 2ksa0jpoPubEtm8pBiYNTt8= X-Received: by 2002:a63:5920:: with SMTP id n32mr11870847pgb.352.1566742751322; Sun, 25 Aug 2019 07:19:11 -0700 (PDT) Received: from voyager.ozlabs.ibm.com (pa49-199-217-21.pa.vic.optusnet.com.au. [49.199.217.21]) by smtp.gmail.com with ESMTPSA id w1sm7734562pjt.30.2019.08.25.07.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 07:19:10 -0700 (PDT) From: Joel Stanley To: Stephen Boyd , Michael Turquette Cc: Andrew Jeffery , Rob Herring , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH v2 1/2] clk: aspeed: Move structures to header Date: Sun, 25 Aug 2019 23:48:47 +0930 Message-Id: <20190825141848.17346-2-joel@jms.id.au> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190825141848.17346-1-joel@jms.id.au> References: <20190825141848.17346-1-joel@jms.id.au> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org They will be reused by the ast2600 driver. Signed-off-by: Joel Stanley --- v2: include required headers for structures used by clk-aspeed.h drivers/clk/clk-aspeed.c | 67 ++------------------------------ drivers/clk/clk-aspeed.h | 82 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 64 deletions(-) create mode 100644 drivers/clk/clk-aspeed.h -- 2.23.0.rc1 diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c index 898291501f45..abf06fb6453e 100644 --- a/drivers/clk/clk-aspeed.c +++ b/drivers/clk/clk-aspeed.c @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-2.0+ +// Copyright IBM Corp #define pr_fmt(fmt) "clk-aspeed: " fmt -#include #include #include #include #include #include -#include #include -#include #include +#include "clk-aspeed.h" + #define ASPEED_NUM_CLKS 36 #define ASPEED_RESET2_OFFSET 32 @@ -42,48 +42,6 @@ static struct clk_hw_onecell_data *aspeed_clk_data; static void __iomem *scu_base; -/** - * struct aspeed_gate_data - Aspeed gated clocks - * @clock_idx: bit used to gate this clock in the clock register - * @reset_idx: bit used to reset this IP in the reset register. -1 if no - * reset is required when enabling the clock - * @name: the clock name - * @parent_name: the name of the parent clock - * @flags: standard clock framework flags - */ -struct aspeed_gate_data { - u8 clock_idx; - s8 reset_idx; - const char *name; - const char *parent_name; - unsigned long flags; -}; - -/** - * struct aspeed_clk_gate - Aspeed specific clk_gate structure - * @hw: handle between common and hardware-specific interfaces - * @reg: register controlling gate - * @clock_idx: bit used to gate this clock in the clock register - * @reset_idx: bit used to reset this IP in the reset register. -1 if no - * reset is required when enabling the clock - * @flags: hardware-specific flags - * @lock: register lock - * - * Some of the clocks in the Aspeed SoC must be put in reset before enabling. - * This modified version of clk_gate allows an optional reset bit to be - * specified. - */ -struct aspeed_clk_gate { - struct clk_hw hw; - struct regmap *map; - u8 clock_idx; - s8 reset_idx; - u8 flags; - spinlock_t *lock; -}; - -#define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw) - /* TODO: ask Aspeed about the actual parent data */ static const struct aspeed_gate_data aspeed_gates[] = { /* clk rst name parent flags */ @@ -208,13 +166,6 @@ static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val) mult, div); } -struct aspeed_clk_soc_data { - const struct clk_div_table *div_table; - const struct clk_div_table *eclk_div_table; - const struct clk_div_table *mac_div_table; - struct clk_hw *(*calc_pll)(const char *name, u32 val); -}; - static const struct aspeed_clk_soc_data ast2500_data = { .div_table = ast2500_div_table, .eclk_div_table = ast2500_eclk_div_table, @@ -315,18 +266,6 @@ static const struct clk_ops aspeed_clk_gate_ops = { .is_enabled = aspeed_clk_is_enabled, }; -/** - * struct aspeed_reset - Aspeed reset controller - * @map: regmap to access the containing system controller - * @rcdev: reset controller device - */ -struct aspeed_reset { - struct regmap *map; - struct reset_controller_dev rcdev; -}; - -#define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev) - static const u8 aspeed_resets[] = { /* SCU04 resets */ [ASPEED_RESET_XDMA] = 25, diff --git a/drivers/clk/clk-aspeed.h b/drivers/clk/clk-aspeed.h new file mode 100644 index 000000000000..5296b15b1c88 --- /dev/null +++ b/drivers/clk/clk-aspeed.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Structures used by ASPEED clock drivers + * + * Copyright 2019 IBM Corp. + */ + +#include +#include +#include +#include + +struct clk_div_table; +struct regmap; + +/** + * struct aspeed_gate_data - Aspeed gated clocks + * @clock_idx: bit used to gate this clock in the clock register + * @reset_idx: bit used to reset this IP in the reset register. -1 if no + * reset is required when enabling the clock + * @name: the clock name + * @parent_name: the name of the parent clock + * @flags: standard clock framework flags + */ +struct aspeed_gate_data { + u8 clock_idx; + s8 reset_idx; + const char *name; + const char *parent_name; + unsigned long flags; +}; + +/** + * struct aspeed_clk_gate - Aspeed specific clk_gate structure + * @hw: handle between common and hardware-specific interfaces + * @reg: register controlling gate + * @clock_idx: bit used to gate this clock in the clock register + * @reset_idx: bit used to reset this IP in the reset register. -1 if no + * reset is required when enabling the clock + * @flags: hardware-specific flags + * @lock: register lock + * + * Some of the clocks in the Aspeed SoC must be put in reset before enabling. + * This modified version of clk_gate allows an optional reset bit to be + * specified. + */ +struct aspeed_clk_gate { + struct clk_hw hw; + struct regmap *map; + u8 clock_idx; + s8 reset_idx; + u8 flags; + spinlock_t *lock; +}; + +#define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw) + +/** + * struct aspeed_reset - Aspeed reset controller + * @map: regmap to access the containing system controller + * @rcdev: reset controller device + */ +struct aspeed_reset { + struct regmap *map; + struct reset_controller_dev rcdev; +}; + +#define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev) + +/** + * struct aspeed_clk_soc_data - Aspeed SoC specific divisor information + * @div_table: Common divider lookup table + * @eclk_div_table: Divider lookup table for ECLK + * @mac_div_table: Divider lookup table for MAC (Ethernet) clocks + * @calc_pll: Callback to maculate common PLL settings + */ +struct aspeed_clk_soc_data { + const struct clk_div_table *div_table; + const struct clk_div_table *eclk_div_table; + const struct clk_div_table *mac_div_table; + struct clk_hw *(*calc_pll)(const char *name, u32 val); +};