aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2008-10-31 07:15:07 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-12-22 04:42:50 -0500
commit7c7e02a28b4e7212dcdcc24bbd2b137790504a84 (patch)
tree09a749672364c52f8b9e850de4de8382027fb4ba /arch/sh/kernel/cpu
parent1dc7b776d91ac9f016982e418e74cb14f63c5b02 (diff)
sh: new sh_mobile mstpcr clocks base code
Add base code to handle new mstpcr clocks. Make sure clock rates propagate. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu')
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 69ab62dd0158..c7155f9b10f5 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -516,16 +516,19 @@ static struct clk_ops sh7722_video_clk_ops = {
516static struct clk sh7722_umem_clock = { 516static struct clk sh7722_umem_clock = {
517 .name = "umem_clk", 517 .name = "umem_clk",
518 .ops = &sh7722_frqcr_clk_ops, 518 .ops = &sh7722_frqcr_clk_ops,
519 .flags = CLK_RATE_PROPAGATES,
519}; 520};
520 521
521static struct clk sh7722_sh_clock = { 522static struct clk sh7722_sh_clock = {
522 .name = "sh_clk", 523 .name = "sh_clk",
523 .ops = &sh7722_frqcr_clk_ops, 524 .ops = &sh7722_frqcr_clk_ops,
525 .flags = CLK_RATE_PROPAGATES,
524}; 526};
525 527
526static struct clk sh7722_peripheral_clock = { 528static struct clk sh7722_peripheral_clock = {
527 .name = "peripheral_clk", 529 .name = "peripheral_clk",
528 .ops = &sh7722_frqcr_clk_ops, 530 .ops = &sh7722_frqcr_clk_ops,
531 .flags = CLK_RATE_PROPAGATES,
529}; 532};
530 533
531static struct clk sh7722_sdram_clock = { 534static struct clk sh7722_sdram_clock = {
@@ -533,6 +536,11 @@ static struct clk sh7722_sdram_clock = {
533 .ops = &sh7722_frqcr_clk_ops, 536 .ops = &sh7722_frqcr_clk_ops,
534}; 537};
535 538
539static struct clk sh7722_r_clock = {
540 .name = "r_clk",
541 .rate = 32768,
542 .flags = CLK_RATE_PROPAGATES,
543};
536 544
537#ifndef CONFIG_CPU_SUBTYPE_SH7343 545#ifndef CONFIG_CPU_SUBTYPE_SH7343
538 546
@@ -612,9 +620,16 @@ static void sh7722_mstpcr_disable(struct clk *clk)
612 sh7722_mstpcr_start_stop(clk, 0); 620 sh7722_mstpcr_start_stop(clk, 0);
613} 621}
614 622
623static void sh7722_mstpcr_recalc(struct clk *clk)
624{
625 if (clk->parent)
626 clk->rate = clk->parent->rate;
627}
628
615static struct clk_ops sh7722_mstpcr_clk_ops = { 629static struct clk_ops sh7722_mstpcr_clk_ops = {
616 .enable = sh7722_mstpcr_enable, 630 .enable = sh7722_mstpcr_enable,
617 .disable = sh7722_mstpcr_disable, 631 .disable = sh7722_mstpcr_disable,
632 .recalc = sh7722_mstpcr_recalc,
618}; 633};
619 634
620#define DECLARE_MSTPCRN(regnr, bitnr, bitstr) \ 635#define DECLARE_MSTPCRN(regnr, bitnr, bitstr) \
@@ -664,6 +679,16 @@ static struct clk sh7722_mstpcr[] = {
664 DECLARE_MSTPCR(2), 679 DECLARE_MSTPCR(2),
665}; 680};
666 681
682#define MSTPCR(_name, _parent, regnr, bitnr) \
683{ \
684 .name = _name, \
685 .arch_flags = MSTPCR_ARCH_FLAGS(regnr, bitnr), \
686 .ops = (void *)_parent, \
687}
688
689static struct clk sh7722_mstpcr_clocks[] = {
690};
691
667static struct clk *sh7722_clocks[] = { 692static struct clk *sh7722_clocks[] = {
668 &sh7722_umem_clock, 693 &sh7722_umem_clock,
669 &sh7722_sh_clock, 694 &sh7722_sh_clock,
@@ -698,16 +723,28 @@ arch_init_clk_ops(struct clk_ops **ops, int type)
698 723
699int __init arch_clk_init(void) 724int __init arch_clk_init(void)
700{ 725{
701 struct clk *master; 726 struct clk *clk;
702 int i; 727 int i;
703 728
704 master = clk_get(NULL, "master_clk"); 729 clk = clk_get(NULL, "master_clk");
705 for (i = 0; i < ARRAY_SIZE(sh7722_clocks); i++) { 730 for (i = 0; i < ARRAY_SIZE(sh7722_clocks); i++) {
706 pr_debug( "Registering clock '%s'\n", sh7722_clocks[i]->name); 731 pr_debug( "Registering clock '%s'\n", sh7722_clocks[i]->name);
707 sh7722_clocks[i]->parent = master; 732 sh7722_clocks[i]->parent = clk;
708 clk_register(sh7722_clocks[i]); 733 clk_register(sh7722_clocks[i]);
709 } 734 }
710 clk_put(master); 735 clk_put(clk);
736
737 clk_register(&sh7722_r_clock);
738
739 for (i = 0; i < ARRAY_SIZE(sh7722_mstpcr_clocks); i++) {
740 pr_debug( "Registering mstpcr clock '%s'\n",
741 sh7722_mstpcr_clocks[i].name);
742 clk = clk_get(NULL, (void *) sh7722_mstpcr_clocks[i].ops);
743 sh7722_mstpcr_clocks[i].parent = clk;
744 sh7722_mstpcr_clocks[i].ops = &sh7722_mstpcr_clk_ops;
745 clk_register(&sh7722_mstpcr_clocks[i]);
746 clk_put(clk);
747 }
711 748
712 for (i = 0; i < ARRAY_SIZE(sh7722_mstpcr); i++) { 749 for (i = 0; i < ARRAY_SIZE(sh7722_mstpcr); i++) {
713 pr_debug( "Registering mstpcr '%s'\n", sh7722_mstpcr[i].name); 750 pr_debug( "Registering mstpcr '%s'\n", sh7722_mstpcr[i].name);