summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2014-06-03 22:35:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-06-05 08:01:14 +0200
commitd95bb6f81f4d827734477332bcffea3431d37cbc (patch)
treec5c8d7a9f378ff62fc6f8773ff08d94b1488db01 /drivers/clk
parent8d9cbe17d3cdebe49715d7be72349bc3c056545f (diff)
downloadbarebox-d95bb6f81f4d827734477332bcffea3431d37cbc.tar.gz
barebox-d95bb6f81f4d827734477332bcffea3431d37cbc.tar.xz
clk: tegra: allow variable sized muxes
Tegra124 extended the mux by 1bit to allow for more PLL sources. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/tegra/clk-periph.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index e4e5412b09..fd1e2ed2c6 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -21,6 +21,7 @@
#include <malloc.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/log2.h>
#include "clk.h"
@@ -113,6 +114,7 @@ static struct clk *_tegra_clk_register_periph(const char *name,
{
struct tegra_clk_periph *periph;
int ret, gate_offs, rst_offs;
+ u8 mux_size = order_base_2(num_parents);
periph = kzalloc(sizeof(*periph), GFP_KERNEL);
if (!periph) {
@@ -121,8 +123,8 @@ static struct clk *_tegra_clk_register_periph(const char *name,
goto out_periph;
}
- periph->mux = clk_mux_alloc(NULL, clk_base + reg_offset, 30, 2,
- parent_names, num_parents, 0);
+ periph->mux = clk_mux_alloc(NULL, clk_base + reg_offset, 32 - mux_size,
+ mux_size, parent_names, num_parents, 0);
if (!periph->mux)
goto out_mux;