Lines Matching refs:c
237 struct clk *c; in alchemy_clk_setup_aux() local
254 c = clk_register(NULL, &a->hw); in alchemy_clk_setup_aux()
255 if (!IS_ERR(c)) in alchemy_clk_setup_aux()
256 clk_register_clkdev(c, name, NULL); in alchemy_clk_setup_aux()
260 return c; in alchemy_clk_setup_aux()
268 struct clk *c; in alchemy_clk_setup_sysbus() local
270 c = clk_register_fixed_factor(NULL, ALCHEMY_SYSBUS_CLK, in alchemy_clk_setup_sysbus()
272 if (!IS_ERR(c)) in alchemy_clk_setup_sysbus()
273 clk_register_clkdev(c, ALCHEMY_SYSBUS_CLK, NULL); in alchemy_clk_setup_sysbus()
274 return c; in alchemy_clk_setup_sysbus()
282 struct clk *c; in alchemy_clk_setup_periph() local
284 c = clk_register_fixed_factor(NULL, ALCHEMY_PERIPH_CLK, in alchemy_clk_setup_periph()
286 if (!IS_ERR(c)) in alchemy_clk_setup_periph()
287 clk_register_clkdev(c, ALCHEMY_PERIPH_CLK, NULL); in alchemy_clk_setup_periph()
288 return c; in alchemy_clk_setup_periph()
297 struct clk *c; in alchemy_clk_setup_mem() local
318 c = clk_register_fixed_factor(NULL, ALCHEMY_MEM_CLK, pn, in alchemy_clk_setup_mem()
320 if (!IS_ERR(c)) in alchemy_clk_setup_mem()
321 clk_register_clkdev(c, ALCHEMY_MEM_CLK, NULL); in alchemy_clk_setup_mem()
322 return c; in alchemy_clk_setup_mem()
336 struct clk *c; in alchemy_clk_setup_lrclk() local
347 c = clk_register_fixed_factor(NULL, ALCHEMY_LR_CLK, in alchemy_clk_setup_lrclk()
349 if (!IS_ERR(c)) in alchemy_clk_setup_lrclk()
350 clk_register_clkdev(c, ALCHEMY_LR_CLK, NULL); in alchemy_clk_setup_lrclk()
351 return c; in alchemy_clk_setup_lrclk()
485 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_en() local
488 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_en()
489 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_en()
490 v |= (1 << 1) << c->shift; in alchemy_clk_fgv1_en()
491 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_en()
492 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_en()
499 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_isen() local
500 unsigned long v = alchemy_rdsys(c->reg) >> (c->shift + 1); in alchemy_clk_fgv1_isen()
507 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_dis() local
510 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_dis()
511 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_dis()
512 v &= ~((1 << 1) << c->shift); in alchemy_clk_fgv1_dis()
513 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_dis()
514 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_dis()
519 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_setp() local
522 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_setp()
523 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_setp()
525 v |= (1 << c->shift); in alchemy_clk_fgv1_setp()
527 v &= ~(1 << c->shift); in alchemy_clk_fgv1_setp()
528 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_setp()
529 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_setp()
536 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_getp() local
538 return (alchemy_rdsys(c->reg) >> c->shift) & 1; in alchemy_clk_fgv1_getp()
544 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_setr() local
546 int sh = c->shift + 2; in alchemy_clk_fgv1_setr()
551 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_setr()
552 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_setr()
555 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_setr()
556 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_setr()
564 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_recalc() local
565 unsigned long v = alchemy_rdsys(c->reg) >> (c->shift + 2); in alchemy_clk_fgv1_recalc()
589 static void __alchemy_clk_fgv2_en(struct alchemy_fgcs_clk *c) in __alchemy_clk_fgv2_en() argument
591 unsigned long v = alchemy_rdsys(c->reg); in __alchemy_clk_fgv2_en()
593 v &= ~(3 << c->shift); in __alchemy_clk_fgv2_en()
594 v |= (c->parent & 3) << c->shift; in __alchemy_clk_fgv2_en()
595 alchemy_wrsys(v, c->reg); in __alchemy_clk_fgv2_en()
596 c->isen = 1; in __alchemy_clk_fgv2_en()
601 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_en() local
605 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_en()
606 __alchemy_clk_fgv2_en(c); in alchemy_clk_fgv2_en()
607 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_en()
614 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_isen() local
616 return ((alchemy_rdsys(c->reg) >> c->shift) & 3) != 0; in alchemy_clk_fgv2_isen()
621 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_dis() local
624 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_dis()
625 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv2_dis()
626 v &= ~(3 << c->shift); /* set input mux to "disabled" state */ in alchemy_clk_fgv2_dis()
627 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv2_dis()
628 c->isen = 0; in alchemy_clk_fgv2_dis()
629 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_dis()
634 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_setp() local
637 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_setp()
638 c->parent = index + 1; /* value to write to register */ in alchemy_clk_fgv2_setp()
639 if (c->isen) in alchemy_clk_fgv2_setp()
640 __alchemy_clk_fgv2_en(c); in alchemy_clk_fgv2_setp()
641 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_setp()
648 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_getp() local
651 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_getp()
652 v = c->parent - 1; in alchemy_clk_fgv2_getp()
653 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_getp()
665 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_setr() local
666 int sh = c->shift + 2; in alchemy_clk_fgv2_setr()
672 v = alchemy_rdsys(c->reg) & (1 << 30); /* test "scale" bit */ in alchemy_clk_fgv2_setr()
676 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_setr()
677 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv2_setr()
680 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv2_setr()
681 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_setr()
689 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_recalc() local
690 int sh = c->shift + 2; in alchemy_clk_fgv2_recalc()
693 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv2_recalc()
704 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_detr() local
707 if (alchemy_rdsys(c->reg) & (1 << 30)) { in alchemy_clk_fgv2_detr()
744 struct clk *c; in alchemy_clk_init_fgens() local
798 c = clk_register(NULL, &a->hw); in alchemy_clk_init_fgens()
799 if (IS_ERR(c)) in alchemy_clk_init_fgens()
802 clk_register_clkdev(c, id.name, NULL); in alchemy_clk_init_fgens()
813 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_isen() local
814 unsigned long v = alchemy_rdsys(c->reg); in alchemy_clk_csrc_isen()
816 return (((v >> c->shift) >> 2) & 7) != 0; in alchemy_clk_csrc_isen()
819 static void __alchemy_clk_csrc_en(struct alchemy_fgcs_clk *c) in __alchemy_clk_csrc_en() argument
821 unsigned long v = alchemy_rdsys(c->reg); in __alchemy_clk_csrc_en()
823 v &= ~((7 << 2) << c->shift); in __alchemy_clk_csrc_en()
824 v |= ((c->parent & 7) << 2) << c->shift; in __alchemy_clk_csrc_en()
825 alchemy_wrsys(v, c->reg); in __alchemy_clk_csrc_en()
826 c->isen = 1; in __alchemy_clk_csrc_en()
831 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_en() local
835 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_en()
836 __alchemy_clk_csrc_en(c); in alchemy_clk_csrc_en()
837 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_en()
844 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_dis() local
847 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_dis()
848 v = alchemy_rdsys(c->reg); in alchemy_clk_csrc_dis()
849 v &= ~((3 << 2) << c->shift); /* mux to "disabled" state */ in alchemy_clk_csrc_dis()
850 alchemy_wrsys(v, c->reg); in alchemy_clk_csrc_dis()
851 c->isen = 0; in alchemy_clk_csrc_dis()
852 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_dis()
857 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_setp() local
860 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_setp()
861 c->parent = index + 1; /* value to write to register */ in alchemy_clk_csrc_setp()
862 if (c->isen) in alchemy_clk_csrc_setp()
863 __alchemy_clk_csrc_en(c); in alchemy_clk_csrc_setp()
864 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_setp()
871 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_getp() local
873 return c->parent - 1; in alchemy_clk_csrc_getp()
879 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_recalc() local
880 unsigned long v = (alchemy_rdsys(c->reg) >> c->shift) & 3; in alchemy_clk_csrc_recalc()
882 return parent_rate / c->dt[v]; in alchemy_clk_csrc_recalc()
888 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_setr() local
898 if ((d == 3) && (c->dt[2] != 3)) in alchemy_clk_csrc_setr()
902 if (c->dt[i] == d) in alchemy_clk_csrc_setr()
908 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_setr()
909 v = alchemy_rdsys(c->reg); in alchemy_clk_csrc_setr()
910 v &= ~(3 << c->shift); in alchemy_clk_csrc_setr()
911 v |= (i & 3) << c->shift; in alchemy_clk_csrc_setr()
912 alchemy_wrsys(v, c->reg); in alchemy_clk_csrc_setr()
913 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_setr()
921 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_detr() local
922 int scale = c->dt[2] == 3 ? 1 : 2; /* au1300 check */ in alchemy_clk_csrc_detr()
955 struct clk *c; in alchemy_clk_setup_imux() local
1016 c = clk_register(NULL, &a->hw); in alchemy_clk_setup_imux()
1017 if (IS_ERR(c)) in alchemy_clk_setup_imux()
1020 clk_register_clkdev(c, id.name, NULL); in alchemy_clk_setup_imux()
1042 struct clk *c; in alchemy_clk_init() local
1045 c = clk_register_fixed_rate(NULL, ALCHEMY_ROOT_CLK, NULL, in alchemy_clk_init()
1047 ERRCK(c) in alchemy_clk_init()
1050 c = alchemy_clk_setup_cpu(ALCHEMY_ROOT_CLK, ctype); in alchemy_clk_init()
1051 ERRCK(c) in alchemy_clk_init()
1055 c = alchemy_clk_setup_aux(ALCHEMY_ROOT_CLK, ALCHEMY_AUXPLL_CLK, in alchemy_clk_init()
1057 ERRCK(c) in alchemy_clk_init()
1060 c = alchemy_clk_setup_aux(ALCHEMY_ROOT_CLK, in alchemy_clk_init()
1063 ERRCK(c) in alchemy_clk_init()
1067 c = alchemy_clk_setup_sysbus(ALCHEMY_CPU_CLK); in alchemy_clk_init()
1068 ERRCK(c) in alchemy_clk_init()
1071 c = alchemy_clk_setup_periph(ALCHEMY_SYSBUS_CLK); in alchemy_clk_init()
1072 ERRCK(c) in alchemy_clk_init()
1075 c = alchemy_clk_setup_mem(ALCHEMY_SYSBUS_CLK, ctype); in alchemy_clk_init()
1076 ERRCK(c) in alchemy_clk_init()
1079 c = alchemy_clk_setup_lrclk(ALCHEMY_PERIPH_CLK, ctype); in alchemy_clk_init()
1080 ERRCK(c) in alchemy_clk_init()