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: 11113509 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3680E912 for ; Sun, 25 Aug 2019 14:19:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13C1820870 for ; Sun, 25 Aug 2019 14:19:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Er3eZtWe"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fmj0w6Fa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13C1820870 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eZOCqLATXEAHOTZSif2Gn/Knw4eTKteNDWWyaWf40d4=; b=Er3eZtWe57YsnM 2QADrRxiDUDzOgUo+zfhU9XYpLZkDpO3pEDQkCtvCFhk1CDzOXyvqGm/QbxRcs+qG5kBql4GavW9y vuV0L7dYmzfg5RgGwnwgWo+KEt8BQtmBD2Ti57MGBXH2AGW4fMdI1JqkszCI5SbAKzoHV5oihIytS RH7HchDiEvSo8Plf5Eb4HHkvWFuWFkOEMpjLFAXn/PS/95+6dhphgBLSvStW4ConBwHNRLTbDWGJ4 noKyAqFpaJ8L9wn4jxzkkYB8a5jNYXcuDwZ3WHgN7UYMtrHyczJLU1CFko9yE407GqltSLRflFg0C T6cQ0wEYxUhP2v+Q6Row==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1tMf-0007D0-Nx; Sun, 25 Aug 2019 14:19:30 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1tMO-00072y-9E for linux-arm-kernel@lists.infradead.org; Sun, 25 Aug 2019 14:19:13 +0000 Received: by mail-pf1-x442.google.com with SMTP id d85so9896176pfd.2 for ; Sun, 25 Aug 2019 07:19:12 -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=Eh2b4koRmOZaZ9SQpyD/6zCvRYAKOQ5/8Vg/w+cYKmE6uSH67UDWXI5aFM5kbOqWwR DbKNmLS7FztjE1UDHOGLyyXhWibpIWGgZYPGAQcTwfkomEMxdzx60k65L/l8frjSNSFL Gppx9HCIbpw0IsCY3c9rH6JX1sYfbFXMZ0JnnhYqjCaztB5RO9gYLs/PVieZnkkRRMx5 PoD0EXQD+KtE8iOd+MppetHf9lkIv1BSX0JGN5PammKyx1k1n6fFEzqJair6pl54INZl 3O0stC5gHmY0lM0vu1aoslylmPbxzyFKF51aNzaJSZt2yT4XErNgGuWM/YCBwLe06fsy 04ew== X-Gm-Message-State: APjAAAWarFsj32iJBoUdXcc38nKcddqPgIi3aJOpMZL6CApua8SwHKSX lz02z5ls9ks/W9hKlnOCXZ+k7Slz X-Google-Smtp-Source: APXvYqzKESmVpB2PpNa7q5Q8l51H9Ksa648hdf0lESby6oBi9xrh0rz5puTH5viJQ284Y8gkE5TC2Q== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190825_071912_323434_AAB54667 X-CRM114-Status: GOOD ( 16.42 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (joel.stan[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, Andrew Jeffery , linux-kernel@vger.kernel.org, Rob Herring , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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); +};