drivers: atmel sam0: Convert atmel sam0 drivers to new DT_INST macros
Convert older DT_INST_ macro use in atmel sam0 drivers to the new include/devicetree.h DT_INST macro APIs. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
db0b4e15e9
commit
28870e7a32
10 changed files with 82 additions and 62 deletions
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT atmel_sam0_dmac
|
||||
|
||||
#include <device.h>
|
||||
#include <soc.h>
|
||||
#include <drivers/dma.h>
|
||||
|
@ -11,7 +13,7 @@
|
|||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(dma_sam0, CONFIG_DMA_LOG_LEVEL);
|
||||
|
||||
#define DMA_REGS ((Dmac *)DT_INST_0_ATMEL_SAM0_DMAC_BASE_ADDRESS)
|
||||
#define DMA_REGS ((Dmac *)DT_INST_REG_ADDR(0))
|
||||
|
||||
typedef void (*dma_callback)(void *callback_arg, u32_t channel,
|
||||
int error_code);
|
||||
|
@ -381,10 +383,10 @@ DEVICE_DECLARE(dma_sam0_0);
|
|||
|
||||
#define DMA_SAM0_IRQ_CONNECT(n) \
|
||||
do { \
|
||||
IRQ_CONNECT(DT_INST_0_ATMEL_SAM0_DMAC_IRQ_ ## n, \
|
||||
DT_INST_0_ATMEL_SAM0_DMAC_IRQ_ ## n ## _PRIORITY, \
|
||||
IRQ_CONNECT(DT_INST_IRQ_BY_IDX(0, n, irq), \
|
||||
DT_INST_IRQ_HAS_IDX(0, n, priority), \
|
||||
dma_sam0_isr, DEVICE_GET(dma_sam0_0), 0); \
|
||||
irq_enable(DT_INST_0_ATMEL_SAM0_DMAC_IRQ_ ## n); \
|
||||
irq_enable(DT_INST_IRQ_BY_IDX(0, n, irq)); \
|
||||
} while (0)
|
||||
|
||||
static int dma_sam0_init(struct device *dev)
|
||||
|
@ -411,19 +413,19 @@ static int dma_sam0_init(struct device *dev)
|
|||
/* Enable the unit and enable all priorities */
|
||||
DMA_REGS->CTRL.reg = DMAC_CTRL_DMAENABLE | DMAC_CTRL_LVLEN(0x0F);
|
||||
|
||||
#ifdef DT_INST_0_ATMEL_SAM0_DMAC_IRQ_0
|
||||
#if DT_INST_IRQ_HAS_CELL(0, irq)
|
||||
DMA_SAM0_IRQ_CONNECT(0);
|
||||
#endif
|
||||
#ifdef DT_INST_0_ATMEL_SAM0_DMAC_IRQ_1
|
||||
#if DT_INST_IRQ_HAS_IDX(0, 1)
|
||||
DMA_SAM0_IRQ_CONNECT(1);
|
||||
#endif
|
||||
#ifdef DT_INST_0_ATMEL_SAM0_DMAC_IRQ_2
|
||||
#if DT_INST_IRQ_HAS_IDX(0, 2)
|
||||
DMA_SAM0_IRQ_CONNECT(2);
|
||||
#endif
|
||||
#ifdef DT_INST_0_ATMEL_SAM0_DMAC_IRQ_3
|
||||
#if DT_INST_IRQ_HAS_IDX(0, 3)
|
||||
DMA_SAM0_IRQ_CONNECT(3);
|
||||
#endif
|
||||
#ifdef DT_INST_0_ATMEL_SAM0_DMAC_IRQ_4
|
||||
#if DT_INST_IRQ_HAS_IDX(0, 4)
|
||||
DMA_SAM0_IRQ_CONNECT(4);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue