Skip to content

Commit

Permalink
drivers: dma: siwx917: Manage the clock
Browse files Browse the repository at this point in the history
SiWx917 DMA is now able to enable the clock when required.

Signed-off-by: Jérôme Pouiller <[email protected]>
  • Loading branch information
jerome-pouiller committed Jan 15, 2025
1 parent 1d58e92 commit d9c0882
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 0 additions & 8 deletions drivers/clock_control/clock_control_silabs_siwx917.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ static int siwx917_clock_init(const struct device *dev)
siwx917_clock_on(dev, (clock_control_subsys_t)SIWX917_CLK_ULP_I2C);
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(ulpdma), okay)
siwx917_clock_on(dev, (clock_control_subsys_t)SIWX917_CLK_ULP_DMA);
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay)
siwx917_clock_on(dev, (clock_control_subsys_t)SIWX917_CLK_UART1);
#endif
Expand All @@ -183,10 +179,6 @@ static int siwx917_clock_init(const struct device *dev)
siwx917_clock_on(dev, (clock_control_subsys_t)SIWX917_CLK_I2C1);
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(udma0), okay)
siwx917_clock_on(dev, (clock_control_subsys_t)SIWX917_CLK_DMA0);
#endif

return 0;
}

Expand Down
11 changes: 11 additions & 0 deletions drivers/dma/dma_silabs_siwx917.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/device.h>
#include <zephyr/drivers/dma.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/logging/log.h>
#include <zephyr/types.h>
#include "rsi_rom_udma_wrapper.h"
Expand All @@ -29,6 +30,8 @@ struct dma_siwx917_config {
uint8_t channels; /* UDMA channel count */
uint8_t irq_number; /* IRQ number */
RSI_UDMA_DESC_T *sram_desc_addr; /* SRAM Address for UDMA Descriptor Storage */
const struct device *clock_dev;
clock_control_subsys_t clock_subsys;
void (*irq_configure)(void); /* IRQ configure function */
};

Expand Down Expand Up @@ -326,6 +329,12 @@ static int dma_siwx917_init(const struct device *dev)
.udma_irq_num = cfg->irq_number,
.desc = cfg->sram_desc_addr,
};
int ret;

ret = clock_control_on(cfg->clock_dev, cfg->clock_subsys);
if (ret) {
return ret;
}

udma_handle = UDMAx_Initialize(&udma_resources, udma_resources.desc, NULL,
(uint32_t *)&data->dma_rom_buff);
Expand Down Expand Up @@ -406,6 +415,8 @@ static const struct dma_driver_api siwx917_dma_driver_api = {
irq_enable(DT_INST_IRQ(inst, irq)); \
} \
static const struct dma_siwx917_config dma##inst##_cfg = { \
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(inst)), \
.clock_subsys = (clock_control_subsys_t)DT_INST_PHA(inst, clocks, clkid), \
.reg = (UDMA0_Type *)DT_INST_REG_ADDR(inst), \
.channels = DT_INST_PROP(inst, dma_channels), \
.irq_number = DT_INST_PROP_BY_IDX(inst, interrupts, 0), \
Expand Down

0 comments on commit d9c0882

Please sign in to comment.