linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: david@lechnology.com (David Lechner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 08/42] clk: davinci: Add platform information for TI DM646x PLL
Date: Mon, 19 Feb 2018 14:21:29 -0600	[thread overview]
Message-ID: <1519071723-31790-9-git-send-email-david@lechnology.com> (raw)
In-Reply-To: <1519071723-31790-1-git-send-email-david@lechnology.com>

This adds platform-specific declarations for the PLL clocks on TI
DM646x based systems.

Signed-off-by: David Lechner <david@lechnology.com>
---

v7 changes:
- split registration functions for each PLL
- Add platform_device_id lookup

Note: I meant to drop the fixed factor clock for timer2 and use pll1_sysclk3
directly in the lookup but noticed it too late. Will fix in the next rev.

v6 changes:
- Added dm646x_pll{1,2}_info with controller-specific information
- Add empty lines between function calls


 drivers/clk/davinci/Makefile     |  1 +
 drivers/clk/davinci/pll-dm646x.c | 78 ++++++++++++++++++++++++++++++++++++++++
 drivers/clk/davinci/pll.c        |  2 ++
 drivers/clk/davinci/pll.h        |  3 ++
 4 files changed, 84 insertions(+)
 create mode 100644 drivers/clk/davinci/pll-dm646x.c

diff --git a/drivers/clk/davinci/Makefile b/drivers/clk/davinci/Makefile
index 59d8ab6..d471386 100644
--- a/drivers/clk/davinci/Makefile
+++ b/drivers/clk/davinci/Makefile
@@ -7,4 +7,5 @@ obj-$(CONFIG_ARCH_DAVINCI_DA850)	+= pll-da850.o
 obj-$(CONFIG_ARCH_DAVINCI_DM355)	+= pll-dm355.o
 obj-$(CONFIG_ARCH_DAVINCI_DM365)	+= pll-dm365.o
 obj-$(CONFIG_ARCH_DAVINCI_DM644x)	+= pll-dm644x.o
+obj-$(CONFIG_ARCH_DAVINCI_DM646x)	+= pll-dm646x.o
 endif
diff --git a/drivers/clk/davinci/pll-dm646x.c b/drivers/clk/davinci/pll-dm646x.c
new file mode 100644
index 0000000..9d3e0c2
--- /dev/null
+++ b/drivers/clk/davinci/pll-dm646x.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PLL clock descriptions for TI DM646X
+ *
+ * Copyright (C) 2018 David Lechner <david@lechnology.com>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/init.h>
+#include <linux/types.h>
+
+#include "pll.h"
+
+static const struct davinci_pll_clk_info dm646x_pll1_info __initconst = {
+	.name = "pll1",
+	.pllm_mask = GENMASK(4, 0),
+	.pllm_min = 14,
+	.pllm_max = 32,
+	.flags = PLL_HAS_CLKMODE,
+};
+
+static const struct davinci_pll_sysclk_info dm646x_pll1_sysclk_info[] __initconst = {
+	SYSCLK(1, pll1_sysclk1, pll1_pllen, 4, SYSCLK_FIXED_DIV),
+	SYSCLK(2, pll1_sysclk2, pll1_pllen, 4, SYSCLK_FIXED_DIV),
+	SYSCLK(3, pll1_sysclk3, pll1_pllen, 4, SYSCLK_FIXED_DIV),
+	SYSCLK(4, pll1_sysclk4, pll1_pllen, 4, 0),
+	SYSCLK(5, pll1_sysclk5, pll1_pllen, 4, 0),
+	SYSCLK(6, pll1_sysclk6, pll1_pllen, 4, 0),
+	SYSCLK(8, pll1_sysclk8, pll1_pllen, 4, 0),
+	SYSCLK(9, pll1_sysclk9, pll1_pllen, 4, 0),
+	{ }
+};
+
+static const struct davinci_pll_clk_info dm646x_pll2_info __initconst = {
+	.name = "pll2",
+	.pllm_mask = GENMASK(4, 0),
+	.pllm_min = 14,
+	.pllm_max = 32,
+	.flags = 0,
+};
+
+static const struct davinci_pll_sysclk_info dm646x_pll2_sysclk_info[] __initconst = {
+	SYSCLK(1, pll2_sysclk1, pll2_pllen, 4, 0),
+	{ }
+};
+
+int __init dm646x_pll1_init(struct device *dev, void __iomem *base)
+{
+	const struct davinci_pll_sysclk_info *info;
+
+	davinci_pll_clk_register(dev, &dm646x_pll1_info, "ref_clk", base);
+
+	for (info = dm646x_pll1_sysclk_info; info->name; info++)
+		davinci_pll_sysclk_register(dev, info, base);
+
+	davinci_pll_sysclkbp_clk_register(dev, "pll1_sysclkbp", base);
+
+	davinci_pll_auxclk_register(dev, "pll1_auxclk", base);
+
+	return 0;
+}
+
+int __init dm646x_pll2_init(struct device *dev, void __iomem *base)
+{
+	const struct davinci_pll_sysclk_info *info;
+	struct clk *clk;
+
+	davinci_pll_clk_register(dev, &dm646x_pll2_info, "oscin", base);
+
+	for (info = dm646x_pll2_sysclk_info; info->name; info++)
+		davinci_pll_sysclk_register(dev, info, base);
+
+	clk = clk_register_fixed_factor(dev, "timer2", "pll1_sysclk3", 0, 1, 1);
+	clk_register_clkdev(clk, NULL, "davinci-wdt");
+
+	return 0;
+}
diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c
index 613ec24..8fad491 100644
--- a/drivers/clk/davinci/pll.c
+++ b/drivers/clk/davinci/pll.c
@@ -762,6 +762,8 @@ static const struct platform_device_id davinci_pll_id_table[] = {
 	{ .name = "dm365-pll2",  .driver_data = (kernel_ulong_t)dm365_pll2_init  },
 	{ .name = "dm644x-pll1", .driver_data = (kernel_ulong_t)dm644x_pll1_init },
 	{ .name = "dm644x-pll2", .driver_data = (kernel_ulong_t)dm644x_pll2_init },
+	{ .name = "dm646x-pll1", .driver_data = (kernel_ulong_t)dm646x_pll1_init },
+	{ .name = "dm646x-pll2", .driver_data = (kernel_ulong_t)dm646x_pll2_init },
 	{ }
 };
 
diff --git a/drivers/clk/davinci/pll.h b/drivers/clk/davinci/pll.h
index df977a6..5977be0 100644
--- a/drivers/clk/davinci/pll.h
+++ b/drivers/clk/davinci/pll.h
@@ -135,4 +135,7 @@ int dm365_pll2_init(struct device *dev, void __iomem *base);
 int dm644x_pll1_init(struct device *dev, void __iomem *base);
 int dm644x_pll2_init(struct device *dev, void __iomem *base);
 
+int dm646x_pll1_init(struct device *dev, void __iomem *base);
+int dm646x_pll2_init(struct device *dev, void __iomem *base);
+
 #endif /* __CLK_DAVINCI_PLL_H___ */
-- 
2.7.4

  parent reply	other threads:[~2018-02-19 20:21 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 20:21 [PATCH v7 00/42] ARM: davinci: convert to common clock framework​ David Lechner
2018-02-19 20:21 ` [PATCH v7 01/42] dt-bindings: clock: Add new bindings for TI Davinci PLL clocks David Lechner
2018-03-01 21:41   ` Rob Herring
2018-02-19 20:21 ` [PATCH v7 02/42] clk: davinci: New driver for davinci " David Lechner
2018-02-19 20:21 ` [PATCH v7 03/42] clk: davinci: Add platform information for TI DA830 PLL David Lechner
2018-02-19 20:21 ` [PATCH v7 04/42] clk: davinci: Add platform information for TI DA850 PLL David Lechner
2018-02-19 20:21 ` [PATCH v7 05/42] clk: davinci: Add platform information for TI DM355 PLL David Lechner
2018-02-19 20:21 ` [PATCH v7 06/42] clk: davinci: Add platform information for TI DM365 PLL David Lechner
2018-02-19 20:21 ` [PATCH v7 07/42] clk: davinci: Add platform information for TI DM644x PLL David Lechner
2018-02-19 20:21 ` David Lechner [this message]
2018-02-19 20:21 ` [PATCH v7 09/42] dt-bindings: clock: New bindings for TI Davinci PSC David Lechner
2018-03-01 21:13   ` Rob Herring
2018-02-19 20:21 ` [PATCH v7 10/42] clk: davinci: New driver for davinci PSC clocks David Lechner
2018-02-28 12:38   ` Bartosz Golaszewski
2018-02-28 21:40     ` David Lechner
2018-03-01  8:36       ` Bartosz Golaszewski
2018-03-01 16:44         ` David Lechner
2018-03-02 17:39           ` Bartosz Golaszewski
2018-03-05 13:02           ` Bartosz Golaszewski
2018-03-05 16:23             ` David Lechner
2018-03-05 17:46               ` David Lechner
2018-03-16 17:55     ` Stephen Boyd
2018-03-19 10:26       ` Bartosz Golaszewski
2018-02-19 20:21 ` [PATCH v7 11/42] clk: davinci: Add platform information for TI DA830 PSC David Lechner
2018-02-19 20:21 ` [PATCH v7 12/42] clk: davinci: Add platform information for TI DA850 PSC David Lechner
2018-02-19 20:21 ` [PATCH v7 13/42] clk: davinci: Add platform information for TI DM355 PSC David Lechner
2018-02-19 20:21 ` [PATCH v7 14/42] clk: davinci: Add platform information for TI DM365 PSC David Lechner
2018-02-19 20:21 ` [PATCH v7 15/42] clk: davinci: Add platform information for TI DM644x PSC David Lechner
2018-02-19 20:21 ` [PATCH v7 16/42] clk: davinci: Add platform information for TI DM646x PSC David Lechner
2018-02-19 20:21 ` [PATCH v7 17/42] dt-bindings: clock: Add bindings for DA8XX CFGCHIP clocks David Lechner
2018-02-19 20:21 ` [PATCH v7 18/42] clk: davinci: New driver for TI " David Lechner
2018-02-19 20:21 ` [PATCH v7 19/42] clk: davinci: cfgchip: Add TI DA8XX USB PHY clocks David Lechner
2018-02-19 20:21 ` [PATCH v7 20/42] ARM: davinci: pass clock as parameter to davinci_timer_init() David Lechner
2018-02-19 20:21 ` [PATCH v7 21/42] ARM: davinci: da830: add new clock init using common clock framework David Lechner
2018-02-19 20:21 ` [PATCH v7 22/42] ARM: davinci: da850: " David Lechner
2018-02-19 20:21 ` [PATCH v7 23/42] ARM: davinci: dm355: " David Lechner
2018-02-19 20:21 ` [PATCH v7 24/42] ARM: davinci: dm365: " David Lechner
2018-02-19 20:21 ` [PATCH v7 25/42] ARM: davinci: dm644x: " David Lechner
2018-02-19 20:21 ` [PATCH v7 26/42] ARM: davinci: dm646x: " David Lechner
2018-02-19 20:21 ` [PATCH v7 27/42] ARM: davinci: da8xx: add new USB PHY " David Lechner
2018-02-19 20:21 ` [PATCH v7 28/42] ARM: davinci: da8xx: add new sata_refclk " David Lechner
2018-02-19 20:21 ` [PATCH v7 29/42] ARM: davinci: remove CONFIG_DAVINCI_RESET_CLOCKS David Lechner
2018-02-19 20:21 ` [PATCH v7 30/42] ARM: davinci_all_defconfig: " David Lechner
2018-02-19 20:21 ` [PATCH v7 31/42] ARM: davinci: switch to common clock framework David Lechner
2018-02-19 20:21 ` [PATCH v7 32/42] ARM: davinci: da830: Remove legacy clock init David Lechner
2018-02-19 20:21 ` [PATCH v7 33/42] ARM: davinci: da850: " David Lechner
2018-02-19 20:21 ` [PATCH v7 34/42] ARM: davinci: dm355: " David Lechner
2018-02-19 20:21 ` [PATCH v7 35/42] ARM: davinci: dm365: " David Lechner
2018-02-19 20:21 ` [PATCH v7 36/42] ARM: davinci: dm644x: " David Lechner
2018-02-19 20:21 ` [PATCH v7 37/42] ARM: davinci: dm646x: " David Lechner
2018-02-19 20:21 ` [PATCH v7 38/42] ARM: davinci: da8xx: Remove legacy USB and SATA " David Lechner
2018-02-19 20:22 ` [PATCH v7 39/42] ARM: davinci: remove legacy clocks David Lechner
2018-02-19 20:22 ` [PATCH v7 40/42] ARM: davinci: add device tree support to timer David Lechner
2018-02-19 20:22 ` [PATCH v7 41/42] ARM: davinci: da8xx-dt: switch to device tree clocks David Lechner
2018-02-19 20:22 ` [PATCH v7 42/42] ARM: dts: da850: Add clocks David Lechner
2018-02-20 13:33 ` [PATCH v7 00/42] ARM: davinci: convert to common clock framework​ Bartosz Golaszewski
2018-02-20 18:39   ` David Lechner
2018-02-21 12:01     ` Bartosz Golaszewski
2018-02-21 17:05       ` David Lechner
2018-02-21 17:46         ` Bartosz Golaszewski
2018-02-22 13:36           ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1519071723-31790-9-git-send-email-david@lechnology.com \
    --to=david@lechnology.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).