Lines Matching refs:sclk
774 struct pic32_sys_clk *sclk = clkhw_to_sys_clk(hw); in sclk_get_rate() local
777 div = (readl(sclk->slew_reg) >> SLEW_SYSDIV_SHIFT) & SLEW_SYSDIV; in sclk_get_rate()
792 struct pic32_sys_clk *sclk = clkhw_to_sys_clk(hw); in sclk_set_rate() local
799 spin_lock_irqsave(&sclk->core->reg_lock, flags); in sclk_set_rate()
802 v = readl(sclk->slew_reg); in sclk_set_rate()
808 writel(v, sclk->slew_reg); in sclk_set_rate()
811 err = readl_poll_timeout_atomic(sclk->slew_reg, v, in sclk_set_rate()
814 spin_unlock_irqrestore(&sclk->core->reg_lock, flags); in sclk_set_rate()
821 struct pic32_sys_clk *sclk = clkhw_to_sys_clk(hw); in sclk_get_parent() local
824 v = (readl(sclk->mux_reg) >> OSC_CUR_SHIFT) & OSC_CUR_MASK; in sclk_get_parent()
826 if (!sclk->parent_map) in sclk_get_parent()
830 if (sclk->parent_map[i] == v) in sclk_get_parent()
837 struct pic32_sys_clk *sclk = clkhw_to_sys_clk(hw); in sclk_set_parent() local
842 spin_lock_irqsave(&sclk->core->reg_lock, flags); in sclk_set_parent()
845 nosc = sclk->parent_map ? sclk->parent_map[index] : index; in sclk_set_parent()
848 v = readl(sclk->mux_reg); in sclk_set_parent()
854 writel(v, sclk->mux_reg); in sclk_set_parent()
857 writel(OSC_SWEN, PIC32_SET(sclk->mux_reg)); in sclk_set_parent()
864 err = readl_poll_timeout_atomic(sclk->slew_reg, v, in sclk_set_parent()
867 spin_unlock_irqrestore(&sclk->core->reg_lock, flags); in sclk_set_parent()
875 cosc = (readl(sclk->mux_reg) >> OSC_CUR_SHIFT) & OSC_CUR_MASK; in sclk_set_parent()
887 struct pic32_sys_clk *sclk = clkhw_to_sys_clk(hw); in sclk_init() local
895 if (sclk->slew_div) { in sclk_init()
896 spin_lock_irqsave(&sclk->core->reg_lock, flags); in sclk_init()
897 v = readl(sclk->slew_reg); in sclk_init()
899 v |= sclk->slew_div << SLEW_DIV_SHIFT; in sclk_init()
901 writel(v, sclk->slew_reg); in sclk_init()
902 spin_unlock_irqrestore(&sclk->core->reg_lock, flags); in sclk_init()
930 struct pic32_sys_clk *sclk; in pic32_sys_clk_register() local
933 sclk = devm_kzalloc(core->dev, sizeof(*sclk), GFP_KERNEL); in pic32_sys_clk_register()
934 if (!sclk) in pic32_sys_clk_register()
937 sclk->core = core; in pic32_sys_clk_register()
938 sclk->hw.init = &data->init_data; in pic32_sys_clk_register()
939 sclk->mux_reg = data->mux_reg + core->iobase; in pic32_sys_clk_register()
940 sclk->slew_reg = data->slew_reg + core->iobase; in pic32_sys_clk_register()
941 sclk->slew_div = data->slew_div; in pic32_sys_clk_register()
942 sclk->parent_map = data->parent_map; in pic32_sys_clk_register()
944 clk = devm_clk_register(core->dev, &sclk->hw); in pic32_sys_clk_register()