Lines Matching refs:syscon
17 static void syscon_power_up(struct lpc11u6x_syscon_regs *syscon, in syscon_power_up() argument
21 syscon->pd_run_cfg = (syscon->pd_run_cfg & ~bit) in syscon_power_up()
24 syscon->pd_run_cfg = syscon->pd_run_cfg | bit in syscon_power_up()
29 static void syscon_set_pll_src(struct lpc11u6x_syscon_regs *syscon, in syscon_set_pll_src() argument
32 syscon->sys_pll_clk_sel = src; in syscon_set_pll_src()
33 syscon->sys_pll_clk_uen = 0; in syscon_set_pll_src()
34 syscon->sys_pll_clk_uen = 1; in syscon_set_pll_src()
44 static void syscon_setup_pll(struct lpc11u6x_syscon_regs *syscon, in syscon_setup_pll() argument
51 syscon->sys_pll_ctrl = val; in syscon_setup_pll()
54 static bool syscon_pll_locked(struct lpc11u6x_syscon_regs *syscon) in syscon_pll_locked() argument
56 return (syscon->sys_pll_stat & 0x1) != 0; in syscon_pll_locked()
59 static void syscon_set_main_clock_source(struct lpc11u6x_syscon_regs *syscon, in syscon_set_main_clock_source() argument
62 syscon->main_clk_sel = src; in syscon_set_main_clock_source()
63 syscon->main_clk_uen = 0; in syscon_set_main_clock_source()
64 syscon->main_clk_uen = 1; in syscon_set_main_clock_source()
67 static void syscon_ahb_clock_enable(struct lpc11u6x_syscon_regs *syscon, in syscon_ahb_clock_enable() argument
71 syscon->sys_ahb_clk_ctrl |= mask; in syscon_ahb_clock_enable()
73 syscon->sys_ahb_clk_ctrl &= ~mask; in syscon_ahb_clock_enable()
77 static void syscon_peripheral_reset(struct lpc11u6x_syscon_regs *syscon, in syscon_peripheral_reset() argument
81 syscon->p_reset_ctrl &= ~mask; in syscon_peripheral_reset()
83 syscon->p_reset_ctrl |= mask; in syscon_peripheral_reset()
86 static void syscon_frg_init(struct lpc11u6x_syscon_regs *syscon) in syscon_frg_init() argument
94 syscon->frg_clk_div = div; in syscon_frg_init()
96 syscon_peripheral_reset(syscon, LPC11U6X_PRESET_CTRL_FRG, false); in syscon_frg_init()
97 syscon->uart_frg_div = 0xFF; in syscon_frg_init()
98 syscon->uart_frg_mult = ((CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / div) in syscon_frg_init()
102 static void syscon_frg_deinit(struct lpc11u6x_syscon_regs *syscon) in syscon_frg_deinit() argument
104 syscon->uart_frg_div = 0x0; in syscon_frg_deinit()
105 syscon_peripheral_reset(syscon, LPC11U6X_PRESET_CTRL_FRG, true); in syscon_frg_deinit()
132 cfg->syscon->usart0_clk_div = 1; in lpc11u6x_clock_control_on()
170 syscon_ahb_clock_enable(cfg->syscon, clk_mask, true); in lpc11u6x_clock_control_on()
172 syscon_frg_init(cfg->syscon); in lpc11u6x_clock_control_on()
174 syscon_peripheral_reset(cfg->syscon, reset_mask, false); in lpc11u6x_clock_control_on()
204 cfg->syscon->usart0_clk_div = 0; in lpc11u6x_clock_control_off()
244 syscon_ahb_clock_enable(cfg->syscon, clk_mask, false); in lpc11u6x_clock_control_off()
246 syscon_frg_deinit(cfg->syscon); in lpc11u6x_clock_control_off()
248 syscon_peripheral_reset(cfg->syscon, reset_mask, true); in lpc11u6x_clock_control_off()
298 syscon_ahb_clock_enable(cfg->syscon, val, true); in lpc11u6x_syscon_init()
304 syscon_power_up(cfg->syscon, LPC11U6X_PDRUNCFG_SYSOSC_PD, true); in lpc11u6x_syscon_init()
311 syscon_set_pll_src(cfg->syscon, LPC11U6X_SYS_PLL_CLK_SEL_SYSOSC); in lpc11u6x_syscon_init()
316 syscon_power_up(cfg->syscon, LPC11U6X_PDRUNCFG_IRC_PD, true); in lpc11u6x_syscon_init()
317 syscon_set_pll_src(cfg->syscon, LPC11U6X_SYS_PLL_CLK_SEL_IRC); in lpc11u6x_syscon_init()
325 syscon_power_up(cfg->syscon, LPC11U6X_PDRUNCFG_PLL_PD, false); in lpc11u6x_syscon_init()
328 syscon_setup_pll(cfg->syscon, 3, 1); in lpc11u6x_syscon_init()
331 syscon_power_up(cfg->syscon, LPC11U6X_PDRUNCFG_PLL_PD, true); in lpc11u6x_syscon_init()
333 while (!syscon_pll_locked(cfg->syscon)) { in lpc11u6x_syscon_init()
336 cfg->syscon->sys_ahb_clk_div = 1; in lpc11u6x_syscon_init()
337 syscon_set_main_clock_source(cfg->syscon, LPC11U6X_MAIN_CLK_SRC_PLLOUT); in lpc11u6x_syscon_init()
351 .syscon = (struct lpc11u6x_syscon_regs *) DT_INST_REG_ADDR(0),