device: rv32m1: Convert clock control to use DEVICE_DT_GET

Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-02-11 18:05:31 -06:00 committed by Kumar Gala
commit 3a8fffb9c3
6 changed files with 24 additions and 71 deletions

View file

@ -40,7 +40,7 @@
struct rv32m1_intmux_config {
INTMUX_Type *regs;
char *clock_name;
const struct device *clock_dev;
clock_control_subsys_t clock_subsys;
struct _isr_table_entry *isr_base;
};
@ -145,7 +145,7 @@ static const struct irq_next_level_api rv32m1_intmux_apis = {
static const struct rv32m1_intmux_config rv32m1_intmux_cfg = {
.regs = (INTMUX_Type *)DT_INST_REG_ADDR(0),
.clock_name = DT_INST_CLOCKS_LABEL(0),
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0)),
.clock_subsys = UINT_TO_POINTER(DT_INST_CLOCKS_CELL(0, name)),
.isr_base = &_sw_isr_table[CONFIG_2ND_LVL_ISR_TBL_OFFSET],
};
@ -154,15 +154,10 @@ static int rv32m1_intmux_init(const struct device *dev)
{
const struct rv32m1_intmux_config *config = DEV_CFG(dev);
INTMUX_Type *regs = DEV_REGS(dev);
const struct device *clock_dev = device_get_binding(config->clock_name);
size_t i;
if (!clock_dev) {
return -ENODEV;
}
/* Enable INTMUX clock. */
clock_control_on(clock_dev, config->clock_subsys);
clock_control_on(config->clock_dev, config->clock_subsys);
/*
* Reset all channels, not just the ones we're configured to