Lines Matching refs:c

236 	struct clk *c;  in alchemy_clk_setup_aux()  local
253 c = clk_register(NULL, &a->hw); in alchemy_clk_setup_aux()
254 if (!IS_ERR(c)) in alchemy_clk_setup_aux()
255 clk_register_clkdev(c, name, NULL); in alchemy_clk_setup_aux()
259 return c; in alchemy_clk_setup_aux()
267 struct clk *c; in alchemy_clk_setup_sysbus() local
269 c = clk_register_fixed_factor(NULL, ALCHEMY_SYSBUS_CLK, in alchemy_clk_setup_sysbus()
271 if (!IS_ERR(c)) in alchemy_clk_setup_sysbus()
272 clk_register_clkdev(c, ALCHEMY_SYSBUS_CLK, NULL); in alchemy_clk_setup_sysbus()
273 return c; in alchemy_clk_setup_sysbus()
281 struct clk *c; in alchemy_clk_setup_periph() local
283 c = clk_register_fixed_factor(NULL, ALCHEMY_PERIPH_CLK, in alchemy_clk_setup_periph()
285 if (!IS_ERR(c)) in alchemy_clk_setup_periph()
286 clk_register_clkdev(c, ALCHEMY_PERIPH_CLK, NULL); in alchemy_clk_setup_periph()
287 return c; in alchemy_clk_setup_periph()
296 struct clk *c; in alchemy_clk_setup_mem() local
317 c = clk_register_fixed_factor(NULL, ALCHEMY_MEM_CLK, pn, in alchemy_clk_setup_mem()
319 if (!IS_ERR(c)) in alchemy_clk_setup_mem()
320 clk_register_clkdev(c, ALCHEMY_MEM_CLK, NULL); in alchemy_clk_setup_mem()
321 return c; in alchemy_clk_setup_mem()
335 struct clk *c; in alchemy_clk_setup_lrclk() local
346 c = clk_register_fixed_factor(NULL, ALCHEMY_LR_CLK, in alchemy_clk_setup_lrclk()
348 if (!IS_ERR(c)) in alchemy_clk_setup_lrclk()
349 clk_register_clkdev(c, ALCHEMY_LR_CLK, NULL); in alchemy_clk_setup_lrclk()
350 return c; in alchemy_clk_setup_lrclk()
479 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_en() local
482 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_en()
483 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_en()
484 v |= (1 << 1) << c->shift; in alchemy_clk_fgv1_en()
485 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_en()
486 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_en()
493 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_isen() local
494 unsigned long v = alchemy_rdsys(c->reg) >> (c->shift + 1); in alchemy_clk_fgv1_isen()
501 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_dis() local
504 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_dis()
505 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_dis()
506 v &= ~((1 << 1) << c->shift); in alchemy_clk_fgv1_dis()
507 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_dis()
508 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_dis()
513 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_setp() local
516 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_setp()
517 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_setp()
519 v |= (1 << c->shift); in alchemy_clk_fgv1_setp()
521 v &= ~(1 << c->shift); in alchemy_clk_fgv1_setp()
522 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_setp()
523 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_setp()
530 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_getp() local
532 return (alchemy_rdsys(c->reg) >> c->shift) & 1; in alchemy_clk_fgv1_getp()
538 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_setr() local
540 int sh = c->shift + 2; in alchemy_clk_fgv1_setr()
545 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv1_setr()
546 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv1_setr()
549 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv1_setr()
550 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv1_setr()
558 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv1_recalc() local
559 unsigned long v = alchemy_rdsys(c->reg) >> (c->shift + 2); in alchemy_clk_fgv1_recalc()
587 static void __alchemy_clk_fgv2_en(struct alchemy_fgcs_clk *c) in __alchemy_clk_fgv2_en() argument
589 unsigned long v = alchemy_rdsys(c->reg); in __alchemy_clk_fgv2_en()
591 v &= ~(3 << c->shift); in __alchemy_clk_fgv2_en()
592 v |= (c->parent & 3) << c->shift; in __alchemy_clk_fgv2_en()
593 alchemy_wrsys(v, c->reg); in __alchemy_clk_fgv2_en()
594 c->isen = 1; in __alchemy_clk_fgv2_en()
599 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_en() local
603 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_en()
604 __alchemy_clk_fgv2_en(c); in alchemy_clk_fgv2_en()
605 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_en()
612 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_isen() local
614 return ((alchemy_rdsys(c->reg) >> c->shift) & 3) != 0; in alchemy_clk_fgv2_isen()
619 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_dis() local
622 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_dis()
623 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv2_dis()
624 v &= ~(3 << c->shift); /* set input mux to "disabled" state */ in alchemy_clk_fgv2_dis()
625 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv2_dis()
626 c->isen = 0; in alchemy_clk_fgv2_dis()
627 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_dis()
632 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_setp() local
635 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_setp()
636 c->parent = index + 1; /* value to write to register */ in alchemy_clk_fgv2_setp()
637 if (c->isen) in alchemy_clk_fgv2_setp()
638 __alchemy_clk_fgv2_en(c); in alchemy_clk_fgv2_setp()
639 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_setp()
646 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_getp() local
649 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_getp()
650 v = c->parent - 1; in alchemy_clk_fgv2_getp()
651 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_getp()
663 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_setr() local
664 int sh = c->shift + 2; in alchemy_clk_fgv2_setr()
670 v = alchemy_rdsys(c->reg) & (1 << 30); /* test "scale" bit */ in alchemy_clk_fgv2_setr()
674 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_fgv2_setr()
675 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv2_setr()
678 alchemy_wrsys(v, c->reg); in alchemy_clk_fgv2_setr()
679 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_fgv2_setr()
687 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_recalc() local
688 int sh = c->shift + 2; in alchemy_clk_fgv2_recalc()
691 v = alchemy_rdsys(c->reg); in alchemy_clk_fgv2_recalc()
705 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_fgv2_detr() local
708 if (alchemy_rdsys(c->reg) & (1 << 30)) { in alchemy_clk_fgv2_detr()
746 struct clk *c; in alchemy_clk_init_fgens() local
800 c = clk_register(NULL, &a->hw); in alchemy_clk_init_fgens()
801 if (IS_ERR(c)) in alchemy_clk_init_fgens()
804 clk_register_clkdev(c, id.name, NULL); in alchemy_clk_init_fgens()
815 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_isen() local
816 unsigned long v = alchemy_rdsys(c->reg); in alchemy_clk_csrc_isen()
818 return (((v >> c->shift) >> 2) & 7) != 0; in alchemy_clk_csrc_isen()
821 static void __alchemy_clk_csrc_en(struct alchemy_fgcs_clk *c) in __alchemy_clk_csrc_en() argument
823 unsigned long v = alchemy_rdsys(c->reg); in __alchemy_clk_csrc_en()
825 v &= ~((7 << 2) << c->shift); in __alchemy_clk_csrc_en()
826 v |= ((c->parent & 7) << 2) << c->shift; in __alchemy_clk_csrc_en()
827 alchemy_wrsys(v, c->reg); in __alchemy_clk_csrc_en()
828 c->isen = 1; in __alchemy_clk_csrc_en()
833 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_en() local
837 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_en()
838 __alchemy_clk_csrc_en(c); in alchemy_clk_csrc_en()
839 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_en()
846 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_dis() local
849 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_dis()
850 v = alchemy_rdsys(c->reg); in alchemy_clk_csrc_dis()
851 v &= ~((3 << 2) << c->shift); /* mux to "disabled" state */ in alchemy_clk_csrc_dis()
852 alchemy_wrsys(v, c->reg); in alchemy_clk_csrc_dis()
853 c->isen = 0; in alchemy_clk_csrc_dis()
854 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_dis()
859 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_setp() local
862 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_setp()
863 c->parent = index + 1; /* value to write to register */ in alchemy_clk_csrc_setp()
864 if (c->isen) in alchemy_clk_csrc_setp()
865 __alchemy_clk_csrc_en(c); in alchemy_clk_csrc_setp()
866 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_setp()
873 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_getp() local
875 return c->parent - 1; in alchemy_clk_csrc_getp()
881 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_recalc() local
882 unsigned long v = (alchemy_rdsys(c->reg) >> c->shift) & 3; in alchemy_clk_csrc_recalc()
884 return parent_rate / c->dt[v]; in alchemy_clk_csrc_recalc()
890 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_setr() local
900 if ((d == 3) && (c->dt[2] != 3)) in alchemy_clk_csrc_setr()
904 if (c->dt[i] == d) in alchemy_clk_csrc_setr()
910 spin_lock_irqsave(c->reglock, flags); in alchemy_clk_csrc_setr()
911 v = alchemy_rdsys(c->reg); in alchemy_clk_csrc_setr()
912 v &= ~(3 << c->shift); in alchemy_clk_csrc_setr()
913 v |= (i & 3) << c->shift; in alchemy_clk_csrc_setr()
914 alchemy_wrsys(v, c->reg); in alchemy_clk_csrc_setr()
915 spin_unlock_irqrestore(c->reglock, flags); in alchemy_clk_csrc_setr()
926 struct alchemy_fgcs_clk *c = to_fgcs_clk(hw); in alchemy_clk_csrc_detr() local
927 int scale = c->dt[2] == 3 ? 1 : 2; /* au1300 check */ in alchemy_clk_csrc_detr()
961 struct clk *c; in alchemy_clk_setup_imux() local
1022 c = clk_register(NULL, &a->hw); in alchemy_clk_setup_imux()
1023 if (IS_ERR(c)) in alchemy_clk_setup_imux()
1026 clk_register_clkdev(c, id.name, NULL); in alchemy_clk_setup_imux()
1048 struct clk *c; in alchemy_clk_init() local
1051 c = clk_register_fixed_rate(NULL, ALCHEMY_ROOT_CLK, NULL, in alchemy_clk_init()
1054 ERRCK(c) in alchemy_clk_init()
1057 c = alchemy_clk_setup_cpu(ALCHEMY_ROOT_CLK, ctype); in alchemy_clk_init()
1058 ERRCK(c) in alchemy_clk_init()
1062 c = alchemy_clk_setup_aux(ALCHEMY_ROOT_CLK, ALCHEMY_AUXPLL_CLK, in alchemy_clk_init()
1064 ERRCK(c) in alchemy_clk_init()
1067 c = alchemy_clk_setup_aux(ALCHEMY_ROOT_CLK, in alchemy_clk_init()
1070 ERRCK(c) in alchemy_clk_init()
1074 c = alchemy_clk_setup_sysbus(ALCHEMY_CPU_CLK); in alchemy_clk_init()
1075 ERRCK(c) in alchemy_clk_init()
1078 c = alchemy_clk_setup_periph(ALCHEMY_SYSBUS_CLK); in alchemy_clk_init()
1079 ERRCK(c) in alchemy_clk_init()
1082 c = alchemy_clk_setup_mem(ALCHEMY_SYSBUS_CLK, ctype); in alchemy_clk_init()
1083 ERRCK(c) in alchemy_clk_init()
1086 c = alchemy_clk_setup_lrclk(ALCHEMY_PERIPH_CLK, ctype); in alchemy_clk_init()
1087 ERRCK(c) in alchemy_clk_init()