dmaengine: Add support for Qcom GSI dma controller
Subsystems (3)
Vinod Koul
maintainerPATCH 3/3 dmaengine: qcom: Add GPI dma driver
In reply to Vinod KoulThis controller provides DMAengine capabilities for a variety of peripheral buses such as I2C, UART, and SPI. By using GPI dmaengine driver, bus drivers can use a standardize interface that is protocol independent to transfer data between memory and peripheral.
--- drivers/dma/qcom/Kconfig | 12 + drivers/dma/qcom/Makefile | 1 + drivers/dma/qcom/gpi.c | 2269 +++++++++++++++++++++++++++++++++++++ 3 files changed, 2282 insertions(+) create mode 100644 drivers/dma/qcom/gpi.c
drivers/dma/qcom/Kconfig +12 -0
@@ -8,6 +8,18 @@ config QCOM_BAM_DMA Enable support for the QCOM BAM DMA controller. This controller provides DMA capabilities for a variety of on-chip devices. +config QCOM_GPI_DMA + tristate "Qualcomm Technologies GPI DMA support" + depends on ARCH_QCOM + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help + Enable support for the QCOM GPI DMA controller. This controller + provides DMA capabilities for a variety of peripheral buses such + as I2C, UART, and SPI. By using GPI dmaengine driver, bus drivers + can use a standardize interface that is protocol independent to + transfer data between DDR and peripheral. + config QCOM_HIDMA_MGMT tristate "Qualcomm Technologies HIDMA Management support" select DMA_ENGINE
drivers/dma/qcom/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_QCOM_BAM_DMA) += bam_dma.o +obj-$(CONFIG_QCOM_GPI_DMA) += gpi.o obj-$(CONFIG_QCOM_HIDMA_MGMT) += hdma_mgmt.o hdma_mgmt-objs := hidma_mgmt.o hidma_mgmt_sys.o obj-$(CONFIG_QCOM_HIDMA) += hdma.o
drivers/dma/qcom/gpi.c new file +2269 -0
2,269 lines not on this page · raw message
Signature · 1 line
2.26.2
Vinod Koul
maintainerRFC PATCH 2/3 dmaengine: add peripheral configuration
In reply to Vinod KoulSome complex dmaengine controllers have capability to program the peripheral device, so pass on the peripheral configuration as part of dma_slave_config
--- include/linux/dmaengine.h | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
include/linux/dmaengine.h +75 -0
@@ -380,6 +380,73 @@ enum dma_slave_buswidth { DMA_SLAVE_BUSWIDTH_64_BYTES = 64, }; +/** +* enum spi_transfer_cmd - spi transfer commands +*/ +enum spi_transfer_cmd { +SPI_TX =1 , +SPI_RX , +SPI_DUPLEX , +}; + +/** +* struct dmaengine_spi_config - spi config for peripheral +* +* @loopback_en: spi loopback enable when set +* @clock_pol: clock polarity +* @data_pol: data polarity +* @pack_en: process tx/rx buffers as packed +* @word_len: spi word length +* @clk_div: source clock divider +* @clk_src: serial clock +* @cmd: spi cmd +* @cs: chip select toggle +* @rx_len: receive length for spi buffer +*/ +struct dmaengine_spi_config { +u8 loopback_en; +u8 clock_pol; +u8 data_pol; +u8 pack_en; +u8 word_len; +u32 clk_div; +u32 clk_src; +u8 fragmentation; +enum spi_transfer_cmd cmd; +u8 cs; +u32 rx_len; +}; + +/** +* struct dmaengine_i2c_config - i2c config for peripheral +* +* @pack_enable: process tx/rx buffers as packed +* @cycle_count: clock cycles to be sent +* @high_count: high period of clock +* @low_count: low period of clock +* @clk_div: source clock divider +* @addr: i2c bus address +* @strech: strech the clock at eot +* @op: i2c cmd +*/ +struct dmaengine_i2c_config { +u8 pack_enable; +u8 cycle_count; +u8 high_count; +u8 low_count; +u16 clk_div; +u8 addr; +u8 strech; +u8 op; +}; + +enum dmaengine_peripheral { +DMAENGINE_PERIPHERAL_SPI , +DMAENGINE_PERIPHERAL_I2C , +DMAENGINE_PERIPHERAL_UART , +DMAENGINE_PERIPHERAL_LAST =DMAENGINE_PERIPHERAL_UART , +}; +/** * struct dma_slave_config - dma slave channel runtime config * @direction: whether the data shall go in or out on this slave
@@ -418,6 +485,10 @@ enum dma_slave_buswidth {* @slave_id: Slave requester id. Only valid for slave channels. The dma * slave peripheral will have unique id as dma requester which need to be * pass as slave config. +* @peripheral: type of peripheral to DMA to/from +* @set_config: set peripheral config +* @spi: peripheral config for spi +* @:i2c peripheral config for i2c * * This struct is passed in as configuration data to a DMA engine * in order to set up a certain channel for DMA transport at runtime.
@@ -443,6 +514,10 @@ struct dma_slave_config {u32 dst_port_window_size;bool device_fc;unsigned int slave_id; +enum dmaengine_peripheral peripheral; +u8 set_config; +struct dmaengine_spi_config spi; +struct dmaengine_i2c_config i2c; };/**
Signature · 1 line
2.26.2
Vinod Koul
maintainercover dmaengine: Add support for Qcom GSI dma controller
This series adds support for Qcom GSI dma controller found on Qualcomm SoCs. This controller can program the peripheral configuration so we add additional parameters in dma_slave_config for configuring the peripherals like spi and i2c.
Vinod Koul (3):
dt-bindings: dmaengine: Document qcom,gpi dma binding
dmaengine: add peripheral configuration
dmaengine: qcom: Add GPI dma driver
.../devicetree/bindings/dma/qcom-gpi.yaml | 87 + drivers/dma/qcom/Kconfig | 12 + drivers/dma/qcom/Makefile | 1 + drivers/dma/qcom/gpi.c | 2269 +++++++++++++++++ include/linux/dmaengine.h | 75 + 5 files changed, 2444 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yaml create mode 100644 drivers/dma/qcom/gpi.c
Signature · 1 line
2.26.2
Vinod Koul
maintainerPATCH 1/3 dt-bindings: dmaengine: Document qcom,gpi dma binding
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yaml
Documentation/devicetree/bindings/dma/qcom-gpi.yaml new file +87 -0
@@ -0,0 +1,87 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/gpi-dma.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies Inc GPI DMA controller + +description: | + QCOM GPI DMA controller provides DMA capabilities for + peripheral buses such as I2C, UART, and SPI. + +maintainers: + - Vinod Koul <[email protected]> + +allOf: + - $ref: "dma-controller.yaml#" + +properties: + compatible: + enum: + - qcom,gpi-dma + + reg: + maxItems: 1 + + interrupts: + description: + Interrupt lines for each GPII instance + maxItems: 14 + + qcom,max-num-gpii: + description: + Maximum number of GPII instances available + maxItems: 1 + + "#dma-cells": + const: 1 + + qcom,gpii-mask: + description: + Bitmap of supported GPII instances for OS + maxItems: 1 + + qcom,ev-factor: + description: + Event ring transfer size compare to channel transfer ring. Event + ring length = ev-factor * transfer ring size + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - qcom,max-num-gpii + - qcom,gpii-mask + - qcom,ev-factor + - "#dma-cells" + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + gpi_dma0: dma@800000 { + #dma-cells = <5>; + compatible = "qcom,gpi-dma"; + reg = <0 0x00800000 0 0x60000>; + qcom,max-num-gpii = <13>; + qcom,gpii-mask = <0xfa>; + qcom,ev-factor = <2>; + interrupts = <GIC_SPI 244 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 247 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 248 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 252 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 253 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 254 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 255 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>; + }; + +...
Signature · 1 line
2.26.2
kernel test robot
build botRe: [PATCH 3/3] dmaengine: qcom: Add GPI dma driver
In reply to Vinod KoulI love your patch! Yet something to improve:
Hi Vinod,
I love your patch! Yet something to improve:
[auto build test ERROR on vkoul-dmaengine/next]
[also build test ERROR on v5.9-rc2 next-20200824]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vinod-Koul/dmaengine-Add-support-for-Qcom-GSI-dma-controller/20200824-174027 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next config: arm64-allyesconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
>> drivers/dma/qcom/gpi.c:7: warning: "DEBUG" redefined
7 | #define DEBUG
|
<command-line>: note: this is the location of the previous definition
drivers/dma/qcom/gpi.c: In function 'gpi_process_imed_data_event':
>> drivers/dma/qcom/gpi.c:1048:2: error: implicit declaration of function 'kfree'; did you mean 'vfree'? [-Werror=implicit-function-declaration]
1048 | kfree(gpi_desc);
| ^~~~~
| vfree
drivers/dma/qcom/gpi.c: In function 'gpi_prep_slave_sg':
>> drivers/dma/qcom/gpi.c:1772:13: error: implicit declaration of function 'kzalloc'; did you mean 'vzalloc'? [-Werror=implicit-function-declaration]
1772 | gpi_desc = kzalloc(sizeof(*gpi_desc), GFP_NOWAIT);
| ^~~~~~~
| vzalloc
>> drivers/dma/qcom/gpi.c:1772:11: warning: assignment to 'struct gpi_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1772 | gpi_desc = kzalloc(sizeof(*gpi_desc), GFP_NOWAIT);
| ^cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/25062cc46a95e9de91752963ea85b934fe7acfa1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vinod-Koul/dmaengine-Add-support-for-Qcom-GSI-dma-controller/20200824-174027 git checkout 25062cc46a95e9de91752963ea85b934fe7acfa1
vim +1048 drivers/dma/qcom/gpi.c
969
970 /* process DMA Immediate completion data events */
971 static void gpi_process_imed_data_event(struct gpii_chan *gpii_chan,
972 struct immediate_data_event *imed_event)
973 {
974 struct gpii *gpii = gpii_chan->gpii;
975 struct gpi_ring *ch_ring = &gpii_chan->ch_ring;
976 void *tre = ch_ring->base + (ch_ring->el_size * imed_event->tre_index);
977 struct dmaengine_result result;
978 struct gpi_desc *gpi_desc;
979 struct virt_dma_desc *vd;
980 unsigned long flags;
981 u32 chid;
982
983 /*
984 * If channel not active don't process event
985 */
986 if (gpii_chan->pm_state != ACTIVE_STATE) {
987 dev_err(gpii->gpi_dev->dev, "skipping processing event because ch @ %s state\n",
988 TO_GPI_PM_STR(gpii_chan->pm_state));
989 return;
990 }
991
992 spin_lock_irqsave(&gpii_chan->vc.lock, flags);
993 vd = vchan_next_desc(&gpii_chan->vc);
994 if (!vd) {
995 struct gpi_ere *gpi_ere;
996 struct gpi_tre *gpi_tre;
997
998 spin_unlock_irqrestore(&gpii_chan->vc.lock, flags);
999 dev_dbg(gpii->gpi_dev->dev, "event without a pending descriptor!\n");
1000 gpi_ere = (struct gpi_ere *)imed_event;
1001 dev_dbg(gpii->gpi_dev->dev,
1002 "Event: %08x %08x %08x %08x\n",
1003 gpi_ere->dword[0], gpi_ere->dword[1],
1004 gpi_ere->dword[2], gpi_ere->dword[3]);
1005 gpi_tre = tre;
1006 dev_dbg(gpii->gpi_dev->dev,
1007 "Pending TRE: %08x %08x %08x %08x\n",
1008 gpi_tre->dword[0], gpi_tre->dword[1],
1009 gpi_tre->dword[2], gpi_tre->dword[3]);
1010 return;
1011 }
1012 gpi_desc = to_gpi_desc(vd);
1013 spin_unlock_irqrestore(&gpii_chan->vc.lock, flags);
1014
1015 /*
1016 * RP pointed by Event is to last TRE processed,
1017 * we need to update ring rp to tre + 1
1018 */
1019 tre += ch_ring->el_size;
1020 if (tre >= (ch_ring->base + ch_ring->len))
1021 tre = ch_ring->base;
1022 ch_ring->rp = tre;
1023
1024 /* make sure rp updates are immediately visible to all cores */
1025 smp_wmb();
1026
1027 chid = imed_event->chid;
1028 if (imed_event->code == MSM_GPI_TCE_EOT && gpii->ieob_set) {
1029 if (chid == GPI_RX_CHAN)
1030 goto gpi_free_desc;
1031 else
1032 return;
1033 }
1034
1035 if (imed_event->code == MSM_GPI_TCE_UNEXP_ERR)
1036 result.result = DMA_TRANS_ABORTED;
1037 else
1038 result.result = DMA_TRANS_NOERROR;
1039 result.residue = gpi_desc->len - imed_event->length;
1040
1041 dma_cookie_complete(&vd->tx);
1042 dmaengine_desc_get_callback_invoke(&vd->tx, &result);
1043
1044 gpi_free_desc:
1045 spin_lock_irqsave(&gpii_chan->vc.lock, flags);
1046 list_del(&vd->node);
1047 spin_unlock_irqrestore(&gpii_chan->vc.lock, flags);
> 1048 kfree(gpi_desc);
1049 gpi_desc = NULL;
1050 }
1051
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH 3/3] dmaengine: qcom: Add GPI dma driver
In reply to Vinod KoulI love your patch! Perhaps something to improve:
Hi Vinod,
I love your patch! Perhaps something to improve:
[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on v5.9-rc2 next-20200824]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vinod-Koul/dmaengine-Add-support-for-Qcom-GSI-dma-controller/20200824-174027 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next config: arm-allyesconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/dma/qcom/gpi.c:7: warning: "DEBUG" redefined
7 | #define DEBUG
|
<command-line>: note: this is the location of the previous definition
drivers/dma/qcom/gpi.c: In function 'gpi_process_imed_data_event':
drivers/dma/qcom/gpi.c:1048:2: error: implicit declaration of function 'kfree'; did you mean 'vfree'? [-Werror=implicit-function-declaration]
1048 | kfree(gpi_desc);
| ^~~~~
| vfree
In file included from include/linux/printk.h:405,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:20,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/arm/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/qcom/gpi.c:10:
drivers/dma/qcom/gpi.c: In function 'gpi_alloc_ring':
>> drivers/dma/qcom/gpi.c:1450:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 8 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
1450 | "#el:%u el_size:%u len:%u actual_len:%llu alloc_size:%lu\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:2: note: in expansion of macro 'dynamic_dev_dbg'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:23: note: in expansion of macro 'dev_fmt'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/qcom/gpi.c:1449:2: note: in expansion of macro 'dev_dbg'
1449 | dev_dbg(gpii->gpi_dev->dev,
| ^~~~~~~
drivers/dma/qcom/gpi.c:1450:58: note: format string is defined here
1450 | "#el:%u el_size:%u len:%u actual_len:%llu alloc_size:%lu\n",
| ~~^
| |
| long unsigned int
| %u
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/qcom/gpi.c:10:
drivers/dma/qcom/gpi.c:1458:31: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
1458 | dev_err(gpii->gpi_dev->dev, "could not alloc size:%lu mem for ring\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/dma/qcom/gpi.c:1458:3: note: in expansion of macro 'dev_err'
1458 | dev_err(gpii->gpi_dev->dev, "could not alloc size:%lu mem for ring\n",
| ^~~~~~~
drivers/dma/qcom/gpi.c:1458:55: note: format string is defined here
1458 | dev_err(gpii->gpi_dev->dev, "could not alloc size:%lu mem for ring\n",
| ~~^
| |
| long unsigned int
| %u
In file included from include/linux/printk.h:405,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:20,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/arm/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/qcom/gpi.c:10:
>> drivers/dma/qcom/gpi.c:1478:3: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
1478 | "phy_pre:0x%0llx phy_alig:0x%0llx len:%u el_size:%u elements:%u\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:2: note: in expansion of macro 'dynamic_dev_dbg'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:23: note: in expansion of macro 'dev_fmt'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/qcom/gpi.c:1477:2: note: in expansion of macro 'dev_dbg'
1477 | dev_dbg(gpii->gpi_dev->dev,
| ^~~~~~~
drivers/dma/qcom/gpi.c:1478:18: note: format string is defined here
1478 | "phy_pre:0x%0llx phy_alig:0x%0llx len:%u el_size:%u elements:%u\n",
| ~~~~^
| |
| long long unsigned int
| %0x
In file included from include/linux/printk.h:405,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:20,
from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/arm/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/qcom/gpi.c:10:
>> drivers/dma/qcom/gpi.c:1478:3: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'phys_addr_t' {aka 'unsigned int'} [-Wformat=]
1478 | "phy_pre:0x%0llx phy_alig:0x%0llx len:%u el_size:%u elements:%u\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:2: note: in expansion of macro 'dynamic_dev_dbg'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:23: note: in expansion of macro 'dev_fmt'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/qcom/gpi.c:1477:2: note: in expansion of macro 'dev_dbg'
1477 | dev_dbg(gpii->gpi_dev->dev,
| ^~~~~~~
drivers/dma/qcom/gpi.c:1478:35: note: format string is defined here
1478 | "phy_pre:0x%0llx phy_alig:0x%0llx len:%u el_size:%u elements:%u\n",
| ~~~~^
| |
| long long unsigned int
| %0x
drivers/dma/qcom/gpi.c: In function 'gpi_prep_slave_sg':
drivers/dma/qcom/gpi.c:1772:13: error: implicit declaration of function 'kzalloc'; did you mean 'vzalloc'? [-Werror=implicit-function-declaration]
1772 | gpi_desc = kzalloc(sizeof(*gpi_desc), GFP_NOWAIT);
| ^~~~~~~
| vzalloc
drivers/dma/qcom/gpi.c:1772:11: warning: assignment to 'struct gpi_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1772 | gpi_desc = kzalloc(sizeof(*gpi_desc), GFP_NOWAIT);
| ^cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/25062cc46a95e9de91752963ea85b934fe7acfa1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vinod-Koul/dmaengine-Add-support-for-Qcom-GSI-dma-controller/20200824-174027 git checkout 25062cc46a95e9de91752963ea85b934fe7acfa1
vim +1450 drivers/dma/qcom/gpi.c
1435
1436 /* allocate memory for transfer and event rings */
1437 static int gpi_alloc_ring(struct gpi_ring *ring, u32 elements,
1438 u32 el_size, struct gpii *gpii)
1439 {
1440 u64 len = elements * el_size;
1441 int bit;
1442
1443 /* ring len must be power of 2 */
1444 bit = find_last_bit((unsigned long *)&len, 32);
1445 if (((1 << bit) - 1) & len)
1446 bit++;
1447 len = 1 << bit;
1448 ring->alloc_size = (len + (len - 1));
1449 dev_dbg(gpii->gpi_dev->dev,
> 1450 "#el:%u el_size:%u len:%u actual_len:%llu alloc_size:%lu\n",
1451 elements, el_size, (elements * el_size), len,
1452 ring->alloc_size);
1453
1454 ring->pre_aligned = dma_alloc_coherent(gpii->gpi_dev->dev,
1455 ring->alloc_size,
1456 &ring->dma_handle, GFP_KERNEL);
1457 if (!ring->pre_aligned) {
1458 dev_err(gpii->gpi_dev->dev, "could not alloc size:%lu mem for ring\n",
1459 ring->alloc_size);
1460 return -ENOMEM;
1461 }
1462
1463 /* align the physical mem */
1464 ring->phys_addr = (ring->dma_handle + (len - 1)) & ~(len - 1);
1465 ring->base = ring->pre_aligned + (ring->phys_addr - ring->dma_handle);
1466 ring->rp = ring->base;
1467 ring->wp = ring->base;
1468 ring->len = len;
1469 ring->el_size = el_size;
1470 ring->elements = ring->len / ring->el_size;
1471 memset(ring->base, 0, ring->len);
1472 ring->configured = true;
1473
1474 /* update to other cores */
1475 smp_wmb();
1476
1477 dev_dbg(gpii->gpi_dev->dev,
> 1478 "phy_pre:0x%0llx phy_alig:0x%0llx len:%u el_size:%u elements:%u\n", 1479 ring->dma_handle, ring->phys_addr, ring->len,
1480 ring->el_size, ring->elements);
1481
1482 return 0;
1483 }
1484
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: dmaengine: Document qcom,gpi dma binding
In reply to Vinod KoulQuoted 9 lines · Vinod Koul
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
Signed-off-by Vinod Koul <[email protected]>--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yaml
My bot found errors running 'make dt_binding_check' on your patch:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: {'description': 'Event ring transfer size compare to channel transfer ring. Event ring length = ev-factor * transfer ring size', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: 'not' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,gpii-mask: {'description': 'Bitmap of supported GPII instances for OS', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,gpii-mask: 'not' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,max-num-gpii: {'description': 'Maximum number of GPII instances available', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,max-num-gpii: 'not' is a required property
./Documentation/devicetree/bindings/dma/qcom-gpi.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/dma/qcom-gpi.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: ignoring, error in schema: properties: qcom,max-num-gpii
warning: no schema found in file: ./Documentation/devicetree/bindings/dma/qcom-gpi.yaml /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.example.dt.yaml: example-0: dma@800000:reg:0: [0, 8388608, 0, 393216] is too long
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
See https://patchwork.ozlabs.org/patch/1350170
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:
pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade
Please check and re-submit.
Re: [RFC PATCH 2/3] dmaengine: add peripheral configuration
In reply to Vinod KoulHi Vinod,
Quoted 99 lines · Vinod Koul
Some complex dmaengine controllers have capability to program the peripheral device, so pass on the peripheral configuration as part of
dma_slave_configSigned-off-by Vinod Koul <[email protected]>--- include/linux/dmaengine.h | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)include/linux/dmaengine.h +71
-0@@ -380,6 +380,73 @@ enum dma_slave_buswidth { DMA_SLAVE_BUSWIDTH_64_BYTES = 64, }; +/** +* enum spi_transfer_cmd - spi transfer commands +*/ +enum spi_transfer_cmd { +SPI_TX =1 , +SPI_RX , +SPI_DUPLEX , +}; + +/** +* struct dmaengine_spi_config - spi config for peripheral +* +* @loopback_en: spi loopback enable when set +* @clock_pol: clock polarity +* @data_pol: data polarity +* @pack_en: process tx/rx buffers as packed +* @word_len: spi word length +* @clk_div: source clock divider +* @clk_src: serial clock +* @cmd: spi cmd +* @cs: chip select toggle +* @rx_len: receive length for spi buffer +*/ +struct dmaengine_spi_config { +u8 loopback_en; +u8 clock_pol; +u8 data_pol; +u8 pack_en; +u8 word_len; +u32 clk_div; +u32 clk_src; +u8 fragmentation; +enum spi_transfer_cmd cmd; +u8 cs; +u32 rx_len; +}; + +/** +* struct dmaengine_i2c_config - i2c config for peripheral +* +* @pack_enable: process tx/rx buffers as packed +* @cycle_count: clock cycles to be sent +* @high_count: high period of clock +* @low_count: low period of clock +* @clk_div: source clock divider +* @addr: i2c bus address +* @strech: strech the clock at eot +* @op: i2c cmd +*/ +struct dmaengine_i2c_config { +u8 pack_enable; +u8 cycle_count; +u8 high_count; +u8 low_count; +u16 clk_div; +u8 addr; +u8 strech; +u8 op; +}; + +enum dmaengine_peripheral { +DMAENGINE_PERIPHERAL_SPI , +DMAENGINE_PERIPHERAL_I2C , +DMAENGINE_PERIPHERAL_UART , +DMAENGINE_PERIPHERAL_LAST =DMAENGINE_PERIPHERAL_UART , +}; +/** * struct dma_slave_config - dma slave channel runtime config * @direction: whether the data shall go in or out on this slave @@ -418,6 +485,10 @@ enum dma_slave_buswidth {* @slave_id: Slave requester id. Only valid for slave channels. The dma * slave peripheral will have unique id as dma requester which need to be * pass as slave config. +* @peripheral: type of peripheral to DMA to/from +* @set_config: set peripheral config +* @spi: peripheral config for spi +* @:i2c peripheral config for i2c * * This struct is passed in as configuration data to a DMA engine * in order to set up a certain channel for DMA transport at runtime.
include/linux/dmaengine.h struct dma_slave_config { · line 520
Quoted 7 lines
include/linux/dmaengine.h +4
-0@@ -443,6 +514,10 @@ struct dma_slave_config {u32 dst_port_window_size;bool device_fc;unsigned int slave_id; +enum dmaengine_peripheral peripheral; +u8 set_config; +struct dmaengine_spi_config spi; +struct dmaengine_i2c_config i2c;
Would it be possible to reuse one of the existing feature already supported by DMAengine?
We have DMA_PREP_CMD to give a command instead of a real transfer:
dmaengine_prep_slave_single(tx_chan, config_data, config_len,
DMA_MEM_TO_DEV, DMA_PREP_CMD); dmaengine_prep_slave_single(tx_chan, tx_buff, tx_len, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dma_async_issue_pending(tx_chan);
or the metadata support:
tx = dmaengine_prep_slave_single(tx_chan, tx_buff, tx_len,
DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dmaengine_desc_attach_metadata(tx, config_data, config_len); dma_async_issue_pending(tx_chan);
By reading the driver itself, it is not clear if you always need to send the config for TX, or only when the config is changing and what happens if the first transfer (for SPI, since that is the only implemented one) is RX, when you don't send config at all...
I'm concerned about the size increase of dma_slave_config (it grows by
Quoted 1 line
30 bytes) and for DMAs with hundreds of channels (UDMA) it will add up
to a sizeable amount.
Quoted 4 lines
};
/**
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Vinod Koul
maintainerRe: [RFC PATCH 2/3] dmaengine: add peripheral configuration
Hello Peter,
Quoted 123 lines · Peter Ujfalusi
Hi Vinod,
Quoted 99 lines · Vinod Koul
Some complex dmaengine controllers have capability to program the peripheral device, so pass on the peripheral configuration as part of
dma_slave_configSigned-off-by Vinod Koul <[email protected]>--- include/linux/dmaengine.h | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)include/linux/dmaengine.h +71
-0@@ -380,6 +380,73 @@ enum dma_slave_buswidth { DMA_SLAVE_BUSWIDTH_64_BYTES = 64, }; +/** +* enum spi_transfer_cmd - spi transfer commands +*/ +enum spi_transfer_cmd { +SPI_TX =1 , +SPI_RX , +SPI_DUPLEX , +}; + +/** +* struct dmaengine_spi_config - spi config for peripheral +* +* @loopback_en: spi loopback enable when set +* @clock_pol: clock polarity +* @data_pol: data polarity +* @pack_en: process tx/rx buffers as packed +* @word_len: spi word length +* @clk_div: source clock divider +* @clk_src: serial clock +* @cmd: spi cmd +* @cs: chip select toggle +* @rx_len: receive length for spi buffer +*/ +struct dmaengine_spi_config { +u8 loopback_en; +u8 clock_pol; +u8 data_pol; +u8 pack_en; +u8 word_len; +u32 clk_div; +u32 clk_src; +u8 fragmentation; +enum spi_transfer_cmd cmd; +u8 cs; +u32 rx_len; +}; + +/** +* struct dmaengine_i2c_config - i2c config for peripheral +* +* @pack_enable: process tx/rx buffers as packed +* @cycle_count: clock cycles to be sent +* @high_count: high period of clock +* @low_count: low period of clock +* @clk_div: source clock divider +* @addr: i2c bus address +* @strech: strech the clock at eot +* @op: i2c cmd +*/ +struct dmaengine_i2c_config { +u8 pack_enable; +u8 cycle_count; +u8 high_count; +u8 low_count; +u16 clk_div; +u8 addr; +u8 strech; +u8 op; +}; + +enum dmaengine_peripheral { +DMAENGINE_PERIPHERAL_SPI , +DMAENGINE_PERIPHERAL_I2C , +DMAENGINE_PERIPHERAL_UART , +DMAENGINE_PERIPHERAL_LAST =DMAENGINE_PERIPHERAL_UART , +}; +/** * struct dma_slave_config - dma slave channel runtime config * @direction: whether the data shall go in or out on this slave @@ -418,6 +485,10 @@ enum dma_slave_buswidth {* @slave_id: Slave requester id. Only valid for slave channels. The dma * slave peripheral will have unique id as dma requester which need to be * pass as slave config. +* @peripheral: type of peripheral to DMA to/from +* @set_config: set peripheral config +* @spi: peripheral config for spi +* @:i2c peripheral config for i2c * * This struct is passed in as configuration data to a DMA engine * in order to set up a certain channel for DMA transport at runtime. include/linux/dmaengine.h struct dma_slave_config { · line 520
Quoted 7 lines
include/linux/dmaengine.h +4
-0@@ -443,6 +514,10 @@ struct dma_slave_config {u32 dst_port_window_size;bool device_fc;unsigned int slave_id; +enum dmaengine_peripheral peripheral; +u8 set_config; +struct dmaengine_spi_config spi; +struct dmaengine_i2c_config i2c;Would it be possible to reuse one of the existing feature already supported by DMAengine?
We haveDMA_PREP_CMDto give a command instead of a real transfer:
dmaengine_prep_slave_single(tx_chan,config_data,config_len,DMA_MEM_TO_DEV, DMA_PREP_CMD); dmaengine_prep_slave_single(tx_chan, tx_buff, tx_len, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dma_async_issue_pending(tx_chan);or the metadata support:
tx = dmaengine_prep_slave_single(tx_chan,tx_buff,tx_len,DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
Quoted 7 lines
dmaengine_desc_attach_metadata(tx, config_data, config_len);dma_async_issue_pending(tx_chan);By reading the driver itself, it is not clear if you always need to send the config for TX, or only when the config is changing and what happens if the first transfer (for SPI, since that is the only implemented one) is RX, when you don't send config at all...
So this config is sent to driver everytime before the prep call (can be optimized to once if we have similar transfers in queue).
This config is used to create the configuration passed to dmaengine which is used to actually program both dmaengine as well as peripheral registers (i2c/spi/etc), so we need a way to pass the spi/i2c config.
I think prep cmd can be used to send this data, I do not see any issues with that, it would work if we want to go that route.
I did have a prototype with metadata but didnt work very well, the problem is it assumes metadata for tx/rx but here i send the data everytime from client data.
Quoted 3 lines
I'm concerned about the size increase of
dma_slave_config(it grows byQuoted 1 line
30 bytes) and for DMAs with hundreds of channels (UDMA) it will add up
to a sizeable amount.
I agree that is indeed a valid concern, that is the reason I tagged this as a RFC patch ;-)
I see the prep_cmd is a better approach for this, anyone else has better suggestions?
Thanks for looking in.
Signature · 1 line
~Vinod
Re: [RFC PATCH 2/3] dmaengine: add peripheral configuration
Hi Vinod,
Quoted 39 lines · Vinod Koul
Quoted 39 lines
Quoted 15 lines
/**
* structdma_slave_config- dma slave channel runtime config
* @direction: whether the data shall go in or out on this slaveinclude/linux/dmaengine.h +4
-0@@ -418,6 +485,10 @@ enum dma_slave_buswidth {* @slave_id: Slave requester id. Only valid for slave channels. The dma * slave peripheral will have unique id as dma requester which need to be * pass as slave config. +* @peripheral: type of peripheral to DMA to/from +* @set_config: set peripheral config +* @spi: peripheral config for spi +* @:i2c peripheral config for i2c * * This struct is passed in as configuration data to a DMA engine * in order to set up a certain channel for DMA transport at runtime. include/linux/dmaengine.h struct dma_slave_config { · line 520
Quoted 7 lines
include/linux/dmaengine.h +4
-0@@ -443,6 +514,10 @@ struct dma_slave_config {u32 dst_port_window_size;bool device_fc;unsigned int slave_id; +enum dmaengine_peripheral peripheral; +u8 set_config; +struct dmaengine_spi_config spi; +struct dmaengine_i2c_config i2c;Would it be possible to reuse one of the existing feature already supported by DMAengine?
We haveDMA_PREP_CMDto give a command instead of a real transfer:
dmaengine_prep_slave_single(tx_chan,config_data,config_len,DMA_MEM_TO_DEV, DMA_PREP_CMD); dmaengine_prep_slave_single(tx_chan, tx_buff, tx_len, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dma_async_issue_pending(tx_chan);or the metadata support:
tx = dmaengine_prep_slave_single(tx_chan,tx_buff,tx_len,DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dmaengine_desc_attach_metadata(tx, config_data, config_len);dma_async_issue_pending(tx_chan);
Quoted 7 lines
Quoted 4 lines
By reading the driver itself, it is not clear if you always need to send the config for TX, or only when the config is changing and what happens if the first transfer (for SPI, since that is the only implemented one) is RX, when you don't send config at all...
So this config is sent to driver everytime before the prep call (can be optimized to once if we have similar transfers in queue).
I see that you queue the TREs in the prep callback.
Quoted 3 lines
This config is used to create the configuration passed to dmaengine which is used to actually program both dmaengine as well as peripheral registers (i2c/spi/etc), so we need a way to pass the spi/i2c config.
But do you need to send it with each DMA_MEM_TO_DEV or only once? DMA_DEV_TO_MEM does not set the config, so I assume you must have one TX to initialize the peripheral as the first transfer.
Quoted 2 lines
I think prep cmd can be used to send this data, I do not see any issues with that, it would work if we want to go that route.
The only thing which might be an issue is that with the DMA_PREP_CMD the config_data is dma_addr_t (via dmaengine_prep_slave_single).
Quoted 3 lines
I did have a prototype with metadata but didnt work very well, the problem is it assumes metadata for tx/rx but here i send the data everytime from client data.
Yes, the intended use case for metadata (per descriptor!) is for channels where each transfer might have different metadata needed for the given transfer (tx/rx).
In your case you have semi static peripheral configuration data, which is not really changing between transfers.
A compromise would be to add:
void *peripheral_config;
to the dma_slave_config, move the set_config inside of the device specific struct you are passing from a client to the core?
Quoted 4 lines
Quoted 3 lines
I'm concerned about the size increase of
dma_slave_config(it grows byQuoted 1 line
30 bytes) and for DMAs with hundreds of channels (UDMA) it will add up
to a sizeable amount.
Quoted 8 lines
I agree that is indeed a valid concern, that is the reason I tagged this as a RFC patch ;-)
I see the
prep_cmdis a better approach for this, anyone else has better suggestions?Thanks for looking in.
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Vinod Koul
maintainerRe: [RFC PATCH 2/3] dmaengine: add peripheral configuration
Hi Peter,
Quoted 47 lines · Peter Ujfalusi
Hi Vinod,
Quoted 44 lines · Vinod Koul
Quoted 43 lines
Quoted 15 lines
/**
* structdma_slave_config- dma slave channel runtime config
* @direction: whether the data shall go in or out on this slaveinclude/linux/dmaengine.h +4
-0@@ -418,6 +485,10 @@ enum dma_slave_buswidth {* @slave_id: Slave requester id. Only valid for slave channels. The dma * slave peripheral will have unique id as dma requester which need to be * pass as slave config. +* @peripheral: type of peripheral to DMA to/from +* @set_config: set peripheral config +* @spi: peripheral config for spi +* @:i2c peripheral config for i2c * * This struct is passed in as configuration data to a DMA engine * in order to set up a certain channel for DMA transport at runtime. include/linux/dmaengine.h struct dma_slave_config { · line 520
Quoted 7 lines
include/linux/dmaengine.h +4
-0@@ -443,6 +514,10 @@ struct dma_slave_config {u32 dst_port_window_size;bool device_fc;unsigned int slave_id; +enum dmaengine_peripheral peripheral; +u8 set_config; +struct dmaengine_spi_config spi; +struct dmaengine_i2c_config i2c;Would it be possible to reuse one of the existing feature already supported by DMAengine?
We haveDMA_PREP_CMDto give a command instead of a real transfer:
dmaengine_prep_slave_single(tx_chan,config_data,config_len,DMA_MEM_TO_DEV, DMA_PREP_CMD); dmaengine_prep_slave_single(tx_chan, tx_buff, tx_len, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dma_async_issue_pending(tx_chan);or the metadata support:
tx = dmaengine_prep_slave_single(tx_chan,tx_buff,tx_len,DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
dmaengine_desc_attach_metadata(tx, config_data, config_len);dma_async_issue_pending(tx_chan);By reading the driver itself, it is not clear if you always need to send the config for TX, or only when the config is changing and what happens if the first transfer (for SPI, since that is the only implemented one) is RX, when you don't send config at all...
Quoted 4 lines
Quoted 2 lines
So this config is sent to driver everytime before the prep call (can be optimized to once if we have similar transfers in queue).
I see that you queue the TREs in the prep callback.
Yes
Quoted 7 lines
Quoted 3 lines
This config is used to create the configuration passed to dmaengine which is used to actually program both dmaengine as well as peripheral registers (i2c/spi/etc), so we need a way to pass the spi/i2c config.
But do you need to send it with each
DMA_MEM_TO_DEVor only once?DMA_DEV_TO_MEMdoes not set the config, so I assume you must have one TX to initialize the peripheral as the first transfer.
Correct and we do transfers on same without sending configuration again.
Quoted 5 lines
Quoted 2 lines
I think prep cmd can be used to send this data, I do not see any issues with that, it would work if we want to go that route.
The only thing which might be an issue is that with the
DMA_PREP_CMDtheconfig_dataisdma_addr_t(viadmaengine_prep_slave_single).
Yes I came to same conclusion
Quoted 8 lines
Quoted 3 lines
I did have a prototype with metadata but didnt work very well, the problem is it assumes metadata for tx/rx but here i send the data everytime from client data.
Yes, the intended use case for metadata (per descriptor!) is for channels where each transfer might have different metadata needed for the given transfer (tx/rx).
Quoted 7 lines
In your case you have semi static peripheral configuration data, which is not really changing between transfers.
A compromise would be to add:
void*peripheral_config;
to thedma_slave_config, move theset_configinside of the device specific struct you are passing from a client to the core?
That sounds more saner to me and uses existing interfaces cleanly. I think I like this option ;-)
Quoted 17 lines
Quoted 4 lines
Quoted 3 lines
I'm concerned about the size increase of
dma_slave_config(it grows byQuoted 1 line
30 bytes) and for DMAs with hundreds of channels (UDMA) it will add up
to a sizeable amount.
Quoted 8 lines
I agree that is indeed a valid concern, that is the reason I tagged this as a RFC patch ;-)
I see the
prep_cmdis a better approach for this, anyone else has better suggestions?Thanks for looking in.
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Signature · 1 line
~Vinod
Vinod Koul
maintainerRe: [PATCH 1/3] dt-bindings: dmaengine: Document qcom,gpi dma binding
In reply to Rob HerringHey Rob,
Quoted 12 lines · Rob Herring
Quoted 9 lines · Vinod Koul
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
Signed-off-by Vinod Koul <[email protected]>--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yaml
Quoted 4 lines
My bot found errors running 'make
dt_binding_check' on your patch:/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: {'description': 'Event ring transfer size compare to channel transfer ring. Event ring length = ev-factor * transfer ring size', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: 'not' is a required property
Okay updating dt-schema I do see this, now the question is what is this and what does it mean ;-) I am not sure I comprehend the error message. I see this for all the new properties I added as required for this device node
Quoted 23 lines
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,gpii-mask: {'description': 'Bitmap of supported GPII instances for OS', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,gpii-mask: 'not' is a required property/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,max-num-gpii: {'description': 'Maximum number of GPII instances available', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,max-num-gpii: 'not' is a required property
./Documentation/devicetree/bindings/dma/qcom-gpi.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/dma/qcom-gpi.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: ignoring, error in schema: properties: qcom,max-num-gpii
warning: no schema found in file:./Documentation/devicetree/bindings/dma/qcom-gpi.yaml/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.example.dt.yaml: example-0: dma@800000:reg:0: [0, 8388608, 0, 393216] is too long
From schema:/usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yamlSee https://patchwork.ozlabs.org/patch/1350170
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade
Please check and re-submit.
Signature · 1 line
~Vinod
Vinod Koul
maintainerRe: [PATCH 1/3] dt-bindings: dmaengine: Document qcom,gpi dma binding
Quoted 17 lines · Vinod Koul
Hey Rob,
Quoted 14 lines · Rob Herring
Quoted 9 lines · Vinod Koul
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
Signed-off-by Vinod Koul <[email protected]>--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yamlMy bot found errors running 'make
dt_binding_check' on your patch:
Quoted 7 lines
Quoted 2 lines
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: {'description': 'Event ring transfer size compare to channel transfer ring. Event ring length = ev-factor * transfer ring size', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: 'not' is a required propertyOkay updating dt-schema I do see this, now the question is what is this and what does it mean ;-) I am not sure I comprehend the error message. I see this for all the new properties I added as required for this device node
Okay I think I have figured it out, I need to provide ref to /schemas/types.yaml#definitions/uint32 for this to work, which does makes sense to me.
qcom,max-num-gpii:
$ref: /schemas/types.yaml#definitions/uint32
maxItems: 1
description:
Number of GPII instances
Looks good to schema tool
Signature · 1 line
~Vinod
Re: [RFC PATCH 2/3] dmaengine: add peripheral configuration
In reply to Vinod KoulHi Vinod,
Quoted 16 lines · Vinod Koul
Quoted 2 lines
The only thing which might be an issue is that with the
DMA_PREP_CMDtheconfig_dataisdma_addr_t(viadmaengine_prep_slave_single).Yes I came to same conclusion
Quoted 11 lines
Quoted 3 lines
I did have a prototype with metadata but didnt work very well, the problem is it assumes metadata for tx/rx but here i send the data everytime from client data.
Yes, the intended use case for metadata (per descriptor!) is for channels where each transfer might have different metadata needed for the given transfer (tx/rx).
In your case you have semi static peripheral configuration data, which is not really changing between transfers.
Quoted 7 lines
Quoted 4 lines
A compromise would be to add:
void*peripheral_config;
to thedma_slave_config, move theset_configinside of the device specific struct you are passing from a client to the core?That sounds more saner to me and uses existing interfaces cleanly. I think I like this option ;-)
The other option would be to use the descriptor metadata support and that might be even cleaner.
In gpi_create_tre() via gpi_prep_slave_sg() you would set up the desc->tre[1] and desc->tre[2] for TX
desc->tre[2] for RX
in the desc, you add a new variable, let's say first_tre and set it to 1 for TX, 2 for RX.
If you need to send a config, you attach it via either way metadata support allows you (get the pointer to desc->tre[0] or give a config struct to the DMA driver.
In the metadata handler, you check if the transfer is TX, if it is, then you update desc->tre[0] (or give the pointer to the client) and update the first_tre to 0.
In issue_pending, or a small helper which can be used to start the transfer you would do the queuing instead of prepare time:
for (i = gpi_desc->first_tre; i < MAX_TRE; i++)
gpi_queue_xfer(gpii, gpii_chan, &gpi_desc->tre[i], &wp);
With this change it should work neatly without any change to dma_slave_config.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
I'm concerned about the size increase of
dma_slave_config(it grows byQuoted 1 line
30 bytes) and for DMAs with hundreds of channels (UDMA) it will add up
to a sizeable amount.
I agree that is indeed a valid concern, that is the reason I tagged this as a RFC patch ;-)
I see the
prep_cmdis a better approach for this, anyone else has better suggestions?
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Thanks for looking in.
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: dmaengine: Document qcom,gpi dma binding
In reply to Vinod KoulQuoted 27 lines · Vinod Koul
Quoted 17 lines · Vinod Koul
Hey Rob,
Quoted 14 lines · Rob Herring
Quoted 9 lines · Vinod Koul
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
Signed-off-by Vinod Koul <[email protected]>--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yamlMy bot found errors running 'make
dt_binding_check' on your patch:Quoted 7 lines
Quoted 2 lines
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: {'description': 'Event ring transfer size compare to channel transfer ring. Event ring length = ev-factor * transfer ring size', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: 'not' is a required propertyOkay updating dt-schema I do see this, now the question is what is this and what does it mean ;-) I am not sure I comprehend the error message. I see this for all the new properties I added as required for this device node
Quoted 7 lines
Okay I think I have figured it out, I need to provide ref to /schemas/types.yaml#definitions/uint32 for this to work, which does makes sense to me.
qcom,max-num-gpii:
$ref: /schemas/types.yaml#definitions/uint32
maxItems: 1
uint32 is always 1 item, so drop. Is there a max value you can define? Otherwise, up to 2^32 - 1 is valid.
Quoted 7 lines
description:
Number of GPII instancesLooks good to schema tool
--
~Vinod
Vinod Koul
maintainerRe: [PATCH 1/3] dt-bindings: dmaengine: Document qcom,gpi dma binding
Quoted 32 lines · Rob Herring
Quoted 31 lines · Vinod Koul
Quoted 17 lines · Vinod Koul
Hey Rob,
Quoted 14 lines · Rob Herring
Quoted 9 lines · Vinod Koul
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
Signed-off-by Vinod Koul <[email protected]>--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yamlMy bot found errors running 'make
dt_binding_check' on your patch:Quoted 7 lines
Quoted 2 lines
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: {'description': 'Event ring transfer size compare to channel transfer ring. Event ring length = ev-factor * transfer ring size', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: 'not' is a required propertyOkay updating dt-schema I do see this, now the question is what is this and what does it mean ;-) I am not sure I comprehend the error message. I see this for all the new properties I added as required for this device node
Okay I think I have figured it out, I need to provide ref to /schemas/types.yaml#definitions/uint32 for this to work, which does makes sense to me.
Quoted 5 lines
Quoted 3 lines
qcom,max-num-gpii:
$ref: /schemas/types.yaml#definitions/uint32
maxItems: 1uint32 is always 1 item, so drop. Is there a max value you can define?
Sorry not sure I follow, to clarify you mean drop uint32, if so which type to use u8? I can use u8 as max wont be beyond 255.
Yes I will define min as well max values too.
Quoted 1 line
Otherwise, up to 2^32 - 1 is valid.
I see one more warning given by your bot which I am able to reproduce as
well:Documentation/devicetree/bindings/dma/qcom,gpi.example.dt.yaml: example-0: dma-controller@800000:reg:0: [0, 8388608, 0, 393216] is too long
So to fix this I added the #address-cells and #size-cells
#address-cells = <2>;
#size-cells = <2>;
reg = <0x0 0x00800000 0x0 0x60000>;But I am getting the warning, what am I doing incorrect
Signature · 1 line
~Vinod
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: dmaengine: Document qcom,gpi dma binding
Quoted 34 lines · Vinod Koul
Quoted 32 lines · Rob Herring
Quoted 31 lines · Vinod Koul
Quoted 17 lines · Vinod Koul
Hey Rob,
Quoted 14 lines · Rob Herring
Quoted 9 lines · Vinod Koul
Add devicetree binding documentation for GPI DMA controller implemented on Qualcomm SoCs
Signed-off-by Vinod Koul <[email protected]>--- .../devicetree/bindings/dma/qcom-gpi.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/qcom-gpi.yamlMy bot found errors running 'make
dt_binding_check' on your patch:Quoted 7 lines
Quoted 2 lines
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: {'description': 'Event ring transfer size compare to channel transfer ring. Event ring length = ev-factor * transfer ring size', 'maxItems': 1} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/dma/qcom-gpi.yaml: properties:qcom,ev-factor: 'not' is a required propertyOkay updating dt-schema I do see this, now the question is what is this and what does it mean ;-) I am not sure I comprehend the error message. I see this for all the new properties I added as required for this device node
Okay I think I have figured it out, I need to provide ref to /schemas/types.yaml#definitions/uint32 for this to work, which does makes sense to me.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
qcom,max-num-gpii:
$ref: /schemas/types.yaml#definitions/uint32
maxItems: 1uint32 is always 1 item, so drop. Is there a max value you can define?
Sorry not sure I follow, to clarify you mean drop uint32, if so which type to use u8? I can use u8 as max wont be beyond 255.
maxItems applies to arrays. A uint32 is not an array, so drop 'maxItems'.
Quoted 9 lines
Yes I will define min as well max values too.
Quoted 1 line
Otherwise, up to 2^32 - 1 is valid.
I see one more warning given by your bot which I am able to reproduce as
well:Documentation/devicetree/bindings/dma/qcom,gpi.example.dt.yaml: example-0: dma-controller@800000:reg:0: [0, 8388608, 0, 393216] is too long
Quoted 7 lines
So to fix this I added the #address-cells and #size-cells
#address-cells = <2>; #size-cells = <2>; reg = <0x0 0x00800000 0x0 0x60000>;But I am getting the warning, what am I doing incorrect
The cell sizes for reg come from the parent node. The default for examples is 1 cell each. The easiest thing to do is change reg to '<0x00800000 0x60000>'. Otherwise, you'd need to define a parent bus node.
Rob