From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 07/25] clk: tegra: allow to register clocks with 16 bit divider
Date: Wed, 14 May 2014 22:45:34 +0200 [thread overview]
Message-ID: <1400100352-13002-7-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1400100352-13002-1-git-send-email-dev@lynxeye.de>
Some peripherals have a double wide divider in front
of them.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
drivers/clk/tegra/clk-periph.c | 28 +++++++++++++++++++++-------
drivers/clk/tegra/clk.h | 4 ++++
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index c05e563aae55..e4e5412b0980 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -106,10 +106,10 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = {
.disable = clk_periph_disable,
};
-struct clk *_tegra_clk_register_periph(const char *name,
+static struct clk *_tegra_clk_register_periph(const char *name,
const char **parent_names, int num_parents,
void __iomem *clk_base, u32 reg_offset, u8 id, u8 flags,
- bool has_div)
+ int div)
{
struct tegra_clk_periph *periph;
int ret, gate_offs, rst_offs;
@@ -136,15 +136,20 @@ struct clk *_tegra_clk_register_periph(const char *name,
if (!periph->gate)
goto out_gate;
- if (has_div) {
+ if (div == 8) {
periph->div = tegra_clk_divider_alloc(NULL, NULL, clk_base +
- reg_offset, 0, TEGRA_DIVIDER_ROUND_UP, 0, 8, 1);
+ reg_offset, 0, TEGRA_DIVIDER_ROUND_UP, 0, 8, 1);
+ if (!periph->div)
+ goto out_div;
+ } else if (div == 16) {
+ periph->div = tegra_clk_divider_alloc(NULL, NULL, clk_base +
+ reg_offset, 0, TEGRA_DIVIDER_ROUND_UP, 0, 16, 0);
if (!periph->div)
goto out_div;
}
periph->hw.name = name;
- periph->hw.ops = has_div ? &tegra_clk_periph_ops :
+ periph->hw.ops = div ? &tegra_clk_periph_ops :
&tegra_clk_periph_nodiv_ops;
periph->hw.parent_names = parent_names;
periph->hw.num_parents = num_parents;
@@ -181,7 +186,7 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name,
{
return _tegra_clk_register_periph(name, parent_names, num_parents,
clk_base, reg_offset, id, flags,
- false);
+ 0);
}
struct clk *tegra_clk_register_periph(const char *name,
@@ -190,5 +195,14 @@ struct clk *tegra_clk_register_periph(const char *name,
{
return _tegra_clk_register_periph(name, parent_names, num_parents,
clk_base, reg_offset, id, flags,
- true);
+ 8);
+}
+
+struct clk *tegra_clk_register_periph_div16(const char *name,
+ const char **parent_names, int num_parents,
+ void __iomem *clk_base, u32 reg_offset, u8 id, u8 flags)
+{
+ return _tegra_clk_register_periph(name, parent_names, num_parents,
+ clk_base, reg_offset, id, flags,
+ 16);
}
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h
index 6ce9f7e26daa..d5d07306021c 100644
--- a/drivers/clk/tegra/clk.h
+++ b/drivers/clk/tegra/clk.h
@@ -138,6 +138,10 @@ struct clk *tegra_clk_register_periph(const char *name,
const char **parent_names, int num_parents,
void __iomem *clk_base, u32 reg_offset, u8 id, u8 flags);
+struct clk *tegra_clk_register_periph_div16(const char *name,
+ const char **parent_names, int num_parents,
+ void __iomem *clk_base, u32 reg_offset, u8 id, u8 flags);
+
/* struct clk_init_table - clock initialization table */
struct tegra_clk_init_table {
unsigned int clk_id;
--
1.9.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-05-14 20:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 20:45 [PATCH v2 01/25] reset: add reset controller framework Lucas Stach
2014-05-14 20:45 ` [PATCH v2 02/25] tegra: lowlevel: add function to fetch chipid Lucas Stach
2014-05-14 20:45 ` [PATCH v2 03/25] reset: add tegra reset controller Lucas Stach
2014-05-14 20:45 ` [PATCH v2 04/25] clk: tegra: reset UARTS from clock controller Lucas Stach
2014-05-14 20:45 ` [PATCH v2 05/25] mci: tegra: add reset control Lucas Stach
2014-05-14 20:45 ` [PATCH v2 06/25] clk: tegra: remove device reset hack Lucas Stach
2014-05-14 20:45 ` Lucas Stach [this message]
2014-05-14 20:45 ` [PATCH v2 08/25] clk: tegra30: register i2c clocks Lucas Stach
2014-05-14 20:45 ` [PATCH v2 09/25] clk: tegra20: " Lucas Stach
2014-05-14 20:45 ` [PATCH v2 10/25] i2c: add Tegra driver Lucas Stach
2014-05-14 20:45 ` [PATCH v2 11/25] ARM: tegra: beaver: activate sdmmc1 voltage rail Lucas Stach
2014-05-14 20:45 ` [PATCH v2 12/25] ARM: tegra: beaver: adjust pinmux to make sdmmc1 work Lucas Stach
2014-05-14 20:45 ` [PATCH v2 13/25] mci: tegra: apply pad autocalibration on T30 Lucas Stach
2014-05-14 20:45 ` [PATCH v2 14/25] mci: tegra: don't set 8bit mode unconditionally Lucas Stach
2014-05-14 20:45 ` [PATCH v2 15/25] pinctrl: tegra30: parse drive groups Lucas Stach
2014-05-14 20:45 ` [PATCH v2 16/25] scripts: tegra: import cbootimage Lucas Stach
2014-05-14 20:45 ` [PATCH v2 17/25] tegra: cbootimage: remove noisy output Lucas Stach
2014-05-14 20:45 ` [PATCH v2 18/25] Makefile.lib: add rule to built Tegra BCTs Lucas Stach
2014-05-14 20:45 ` [PATCH v2 19/25] images: add Tegra20 image build rules Lucas Stach
2014-05-14 20:45 ` [PATCH v2 20/25] images: add Tegra30 " Lucas Stach
2014-05-14 20:45 ` [PATCH v2 21/25] ARM: boards: colibri t20: import BCT cfgs Lucas Stach
2014-05-14 20:45 ` [PATCH v2 22/25] images: tegra: build all Toradex Colibri images Lucas Stach
2014-05-14 20:45 ` [PATCH v2 23/25] ARM: boards: beaver: import BCT cfg Lucas Stach
2014-05-14 20:45 ` [PATCH v2 24/25] images: tegra: build NVidia Beaver image Lucas Stach
2014-05-14 20:45 ` [PATCH v2 25/25] images: tegra: rename ac100 image Lucas Stach
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=1400100352-13002-7-git-send-email-dev@lynxeye.de \
--to=dev@lynxeye.de \
--cc=barebox@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