From 8fa9fecd8c0ada74d5991a35e3050a1175f6212b Mon Sep 17 00:00:00 2001 From: Song Qiang Date: Thu, 24 Oct 2019 12:29:47 +0800 Subject: [PATCH] dt-bindings: add support for parsing stm32 dma consumer cells Add support for parsing stm32 dma consumer cells, format of which follows dma dts format declared in the Linux Kernel for the dma of stm32: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/plain/Bindings/dma/stm32-dma.txt Signed-off-by: Song Qiang --- CODEOWNERS | 1 + dts/bindings/dma/st,stm32-dma.yaml | 34 +++++++++++++++++++++++++++++ include/dt-bindings/dma/stm32_dma.h | 13 +++++++++++ 3 files changed, 48 insertions(+) create mode 100644 dts/bindings/dma/st,stm32-dma.yaml create mode 100644 include/dt-bindings/dma/stm32_dma.h diff --git a/CODEOWNERS b/CODEOWNERS index 757619a8f2f..710a632828a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -251,6 +251,7 @@ /include/display/ @vanwinkeljan /include/dt-bindings/clock/kinetis_mcg.h @henrikbrixandersen /include/dt-bindings/clock/kinetis_scg.h @henrikbrixandersen +/include/dt-bindings/dma/stm32_dma.h @cybertale /include/dt-bindings/pcie/ @andrewboie /include/dt-bindings/usb/usb.h @galak @finikorg /include/fs/ @nashif @wentongwu diff --git a/dts/bindings/dma/st,stm32-dma.yaml b/dts/bindings/dma/st,stm32-dma.yaml new file mode 100644 index 00000000000..ee94db13f86 --- /dev/null +++ b/dts/bindings/dma/st,stm32-dma.yaml @@ -0,0 +1,34 @@ +# Copyright (c) 2019, Song Qiang +# SPDX-License-Identifier: Apache-2.0 + +title: STM32 DMA + +description: STM32 DMA controller + +compatible: "st,stm32-dma" + +include: dma-controller.yaml + +properties: + reg: + required: true + + interrupts: + required: true + + st,mem2mem: + type: boolean + description: If the controller supports memory to memory transfer + + "#dma-cells": + const: 4 + +# Parameter syntax of stm32 follows the dma client dts syntax +# in the Linux kernel declared in +# https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/plain/Bindings/dma/stm32-dma.txt + +dma-cells: + - channel + - slot + - channel-config + - features diff --git a/include/dt-bindings/dma/stm32_dma.h b/include/dt-bindings/dma/stm32_dma.h new file mode 100644 index 00000000000..623012a021a --- /dev/null +++ b/include/dt-bindings/dma/stm32_dma.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2019 Song Qiang + * + * SPDX-License-Identifier: Apache-2.0 + */ +/* macros for channel-config */ +#define STM32_DMA_CONFIG_PERIPH_ADDR_INC(config) (config & 0x1 << 9) +#define STM32_DMA_CONFIG_MEM_ADDR_INC(config) (config & 0x1 << 10) +#define STM32_DMA_CONFIG_PERIPH_INC_FIXED(config) (config & 0x1 << 15) +#define STM32_DMA_CONFIG_PRIORITY(config) ((config >> 16) & 0x3) + +/* macros for features */ +#define STM32_DMA_FEATURES_FIFO_THRESHOLD(features) (features & 0x3)