diff options
-rw-r--r-- | arch/arm/mach-tegra/tegra20_clocks.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra20_clocks.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra20_clocks_data.c | 30 |
3 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra20_clocks.c b/arch/arm/mach-tegra/tegra20_clocks.c index d9ce0087f6a6..840ab262272a 100644 --- a/arch/arm/mach-tegra/tegra20_clocks.c +++ b/arch/arm/mach-tegra/tegra20_clocks.c | |||
@@ -376,6 +376,25 @@ struct clk_ops tegra_super_ops = { | |||
376 | .recalc_rate = tegra20_super_clk_recalc_rate, | 376 | .recalc_rate = tegra20_super_clk_recalc_rate, |
377 | }; | 377 | }; |
378 | 378 | ||
379 | static unsigned long tegra20_twd_clk_recalc_rate(struct clk_hw *hw, | ||
380 | unsigned long parent_rate) | ||
381 | { | ||
382 | struct clk_tegra *c = to_clk_tegra(hw); | ||
383 | u64 rate = parent_rate; | ||
384 | |||
385 | if (c->mul != 0 && c->div != 0) { | ||
386 | rate *= c->mul; | ||
387 | rate += c->div - 1; /* round up */ | ||
388 | do_div(rate, c->div); | ||
389 | } | ||
390 | |||
391 | return rate; | ||
392 | } | ||
393 | |||
394 | struct clk_ops tegra_twd_ops = { | ||
395 | .recalc_rate = tegra20_twd_clk_recalc_rate, | ||
396 | }; | ||
397 | |||
379 | static u8 tegra20_cop_clk_get_parent(struct clk_hw *hw) | 398 | static u8 tegra20_cop_clk_get_parent(struct clk_hw *hw) |
380 | { | 399 | { |
381 | return 0; | 400 | return 0; |
diff --git a/arch/arm/mach-tegra/tegra20_clocks.h b/arch/arm/mach-tegra/tegra20_clocks.h index 0e42ec065d4a..8bfd31bcc490 100644 --- a/arch/arm/mach-tegra/tegra20_clocks.h +++ b/arch/arm/mach-tegra/tegra20_clocks.h | |||
@@ -28,6 +28,7 @@ extern struct clk_ops tegra_cdev_clk_ops; | |||
28 | extern struct clk_ops tegra_audio_sync_clk_ops; | 28 | extern struct clk_ops tegra_audio_sync_clk_ops; |
29 | extern struct clk_ops tegra_super_ops; | 29 | extern struct clk_ops tegra_super_ops; |
30 | extern struct clk_ops tegra_cpu_ops; | 30 | extern struct clk_ops tegra_cpu_ops; |
31 | extern struct clk_ops tegra_twd_ops; | ||
31 | extern struct clk_ops tegra_cop_ops; | 32 | extern struct clk_ops tegra_cop_ops; |
32 | extern struct clk_ops tegra_bus_ops; | 33 | extern struct clk_ops tegra_bus_ops; |
33 | extern struct clk_ops tegra_blink_clk_ops; | 34 | extern struct clk_ops tegra_blink_clk_ops; |
diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c index 1eb50674721e..1a35c003fba8 100644 --- a/arch/arm/mach-tegra/tegra20_clocks_data.c +++ b/arch/arm/mach-tegra/tegra20_clocks_data.c | |||
@@ -583,6 +583,34 @@ static struct clk_tegra tegra_cclk_hw = { | |||
583 | DEFINE_CLK_TEGRA(cclk, 0, &tegra_super_ops, 0, mux_cclk, | 583 | DEFINE_CLK_TEGRA(cclk, 0, &tegra_super_ops, 0, mux_cclk, |
584 | mux_cclk_p, NULL); | 584 | mux_cclk_p, NULL); |
585 | 585 | ||
586 | static const char *mux_twd[] = { | ||
587 | "cclk", | ||
588 | }; | ||
589 | |||
590 | static struct clk *mux_twd_p[] = { | ||
591 | &tegra_cclk, | ||
592 | }; | ||
593 | |||
594 | static struct clk tegra_clk_twd; | ||
595 | static struct clk_tegra tegra_clk_twd_hw = { | ||
596 | .hw = { | ||
597 | .clk = &tegra_clk_twd, | ||
598 | }, | ||
599 | .max_rate = 1000000000, | ||
600 | .mul = 1, | ||
601 | .div = 4, | ||
602 | }; | ||
603 | |||
604 | static struct clk tegra_clk_twd = { | ||
605 | .name = "twd", | ||
606 | .ops = &tegra_twd_ops, | ||
607 | .hw = &tegra_clk_twd_hw.hw, | ||
608 | .parent = &tegra_cclk, | ||
609 | .parent_names = mux_twd, | ||
610 | .parents = mux_twd_p, | ||
611 | .num_parents = ARRAY_SIZE(mux_twd), | ||
612 | }; | ||
613 | |||
586 | static struct clk tegra_sclk; | 614 | static struct clk tegra_sclk; |
587 | static struct clk_tegra tegra_sclk_hw = { | 615 | static struct clk_tegra tegra_sclk_hw = { |
588 | .hw = { | 616 | .hw = { |
@@ -1027,6 +1055,7 @@ static struct clk_duplicate tegra_clk_duplicates[] = { | |||
1027 | CLK_DUPLICATE("cop", "tegra-avp", "cop"), | 1055 | CLK_DUPLICATE("cop", "tegra-avp", "cop"), |
1028 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), | 1056 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), |
1029 | CLK_DUPLICATE("cclk", NULL, "cpu"), | 1057 | CLK_DUPLICATE("cclk", NULL, "cpu"), |
1058 | CLK_DUPLICATE("twd", "smp_twd", NULL), | ||
1030 | }; | 1059 | }; |
1031 | 1060 | ||
1032 | #define CLK(dev, con, ck) \ | 1061 | #define CLK(dev, con, ck) \ |
@@ -1057,6 +1086,7 @@ static struct clk *tegra_ptr_clks[] = { | |||
1057 | &tegra_pll_x, | 1086 | &tegra_pll_x, |
1058 | &tegra_pll_e, | 1087 | &tegra_pll_e, |
1059 | &tegra_cclk, | 1088 | &tegra_cclk, |
1089 | &tegra_clk_twd, | ||
1060 | &tegra_sclk, | 1090 | &tegra_sclk, |
1061 | &tegra_hclk, | 1091 | &tegra_hclk, |
1062 | &tegra_pclk, | 1092 | &tegra_pclk, |