Lines Matching +full:reg +full:- +full:rc

4  * SPDX-License-Identifier: Apache-2.0
47 const struct can_mcan_config *mcan_config = dev->config; in can_numaker_get_core_clock()
48 const struct can_numaker_config *config = mcan_config->custom; in can_numaker_get_core_clock()
53 clksrc_rate_idx = CLK_GetModuleClockSource(config->clk_modidx); in can_numaker_get_core_clock()
55 clkdiv_divider = CLK_GetModuleClockDivider(config->clk_modidx) + 1; in can_numaker_get_core_clock()
72 return -EIO; in can_numaker_get_core_clock()
82 const struct can_mcan_config *mcan_config = dev->config; in can_numaker_init_unlocked()
83 const struct can_numaker_config *config = mcan_config->custom; in can_numaker_init_unlocked()
85 int rc; in can_numaker_init_unlocked() local
89 scc_subsys.pcc.clk_modidx = config->clk_modidx; in can_numaker_init_unlocked()
90 scc_subsys.pcc.clk_src = config->clk_src; in can_numaker_init_unlocked()
91 scc_subsys.pcc.clk_div = config->clk_div; in can_numaker_init_unlocked()
94 rc = clock_control_on(config->clk_dev, (clock_control_subsys_t) &scc_subsys); in can_numaker_init_unlocked()
95 if (rc < 0) { in can_numaker_init_unlocked()
96 return rc; in can_numaker_init_unlocked()
99 rc = clock_control_configure(config->clk_dev, (clock_control_subsys_t)&scc_subsys, NULL); in can_numaker_init_unlocked()
100 if (rc < 0) { in can_numaker_init_unlocked()
101 return rc; in can_numaker_init_unlocked()
105 rc = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT); in can_numaker_init_unlocked()
106 if (rc < 0) { in can_numaker_init_unlocked()
107 return rc; in can_numaker_init_unlocked()
111 reset_line_toggle_dt(&config->reset); in can_numaker_init_unlocked()
113 config->irq_config_func(dev); in can_numaker_init_unlocked()
115 rc = can_mcan_configure_mram(dev, config->mrba, config->mram); in can_numaker_init_unlocked()
116 if (rc != 0) { in can_numaker_init_unlocked()
117 return rc; in can_numaker_init_unlocked()
120 rc = can_mcan_init(dev); in can_numaker_init_unlocked()
121 if (rc < 0) { in can_numaker_init_unlocked()
122 LOG_ERR("Failed to initialize mcan: %d", rc); in can_numaker_init_unlocked()
123 return rc; in can_numaker_init_unlocked()
129 rc = can_numaker_get_core_clock(dev, &rate); in can_numaker_init_unlocked()
130 if (rc < 0) { in can_numaker_init_unlocked()
131 return rc; in can_numaker_init_unlocked()
137 return rc; in can_numaker_init_unlocked()
142 const struct can_mcan_config *mcan_config = dev->config; in can_numaker_init()
143 const struct can_numaker_config *config = mcan_config->custom; in can_numaker_init()
144 int rc; in can_numaker_init() local
146 if (!device_is_ready(config->reset.dev)) { in can_numaker_init()
148 return -ENODEV; in can_numaker_init()
151 if (!device_is_ready(config->clk_dev)) { in can_numaker_init()
153 return -ENODEV; in can_numaker_init()
157 rc = can_numaker_init_unlocked(dev); in can_numaker_init()
160 return rc; in can_numaker_init()
188 static int can_numaker_read_reg(const struct device *dev, uint16_t reg, uint32_t *val) in can_numaker_read_reg() argument
190 const struct can_mcan_config *mcan_cfg = dev->config; in can_numaker_read_reg()
191 const struct can_numaker_config *numaker_cfg = mcan_cfg->custom; in can_numaker_read_reg()
193 return can_mcan_sys_read_reg(numaker_cfg->canfd_base, reg, val); in can_numaker_read_reg()
196 static int can_numaker_write_reg(const struct device *dev, uint16_t reg, uint32_t val) in can_numaker_write_reg() argument
198 const struct can_mcan_config *mcan_cfg = dev->config; in can_numaker_write_reg()
199 const struct can_numaker_config *numaker_cfg = mcan_cfg->custom; in can_numaker_write_reg()
201 return can_mcan_sys_write_reg(numaker_cfg->canfd_base, reg, val); in can_numaker_write_reg()
206 const struct can_mcan_config *mcan_cfg = dev->config; in can_numaker_read_mram()
207 const struct can_numaker_config *numaker_cfg = mcan_cfg->custom; in can_numaker_read_mram()
209 return can_mcan_sys_read_mram(numaker_cfg->mram, offset, dst, len); in can_numaker_read_mram()
215 const struct can_mcan_config *mcan_cfg = dev->config; in can_numaker_write_mram()
216 const struct can_numaker_config *numaker_cfg = mcan_cfg->custom; in can_numaker_write_mram()
218 return can_mcan_sys_write_mram(numaker_cfg->mram, offset, src, len); in can_numaker_write_mram()
223 const struct can_mcan_config *mcan_cfg = dev->config; in can_numaker_clear_mram()
224 const struct can_numaker_config *numaker_cfg = mcan_cfg->custom; in can_numaker_clear_mram()
226 return can_mcan_sys_clear_mram(numaker_cfg->mram, offset, len); in can_numaker_clear_mram()