Commit graph

242 commits

Author SHA1 Message Date
Abel Radenac e8fa6b3f08 drivers: dma_stm32: init DMA struct in dma_stm32_configure
The init struct for DMA peripheral is allocated in stack
and must be initialized (e.g. with LL_DMA_StructInit here)
to avoid loading undefined values in the DMA peripheral
registers.

Signed-off-by: Abel Radenac <a.radenac@lacroix-sofrel.com>
2021-12-17 11:52:22 -06:00
Gerard Marull-Paretas d4a5a633a6 drivers: dma: mcux_edma: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Daniel DeGrasse 20eed64030 drivers: edma: update MCUX dma driver for multi-instance
Updates mcux edma driver to handle multiple DMA instances correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Maureen Helm b539699a98 drivers: dma: Refactor drivers to use shared init priority
Refactors all of the DMA drivers to use a shared driver class
initialization priority configuration, CONFIG_DMA_INIT_PRIORITY, to
allow configuring DMA drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_DEFAULT or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-29 22:55:03 -04:00
Josh Hansen ae4f68c16d drivers: dma: stm32 Fix for STM32F1 SoCs
Not all STM32 parts have at least 5 DMA interrupt vectors for DMA2. In
particular, some STM32F1 XL-density devices only have 4 DMA2 interrupt
vectors, with Channels 4 and 5 sharing the same vector. Added
#if DT_INST_IRQ_HAS_IDX(1, 4) to prevent compiler errors on these SoCs.

Signed-off-by: Josh Hansen <jhansen3141@gmail.com>
2021-10-17 10:58:39 -04:00
Ron Smith 4f9ac180b4 drivers: dma: dma_sam0: change sam0 DMA to higher priority init.
fixes peripheral drivers such as async uart that rely on dma being
ready failing because dma is not initialized yet.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Mahesh Mahadevan 91f172e4ad drivers: dma: Zero-initialize memory allocated using kmalloc
The code was wrongly calling DMA_Abort on a channel
that not initialized. This fixes Issue#38078

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-01 12:34:50 -04:00
Francois Ramu e90c47fbc4 drivers: dma: stm32 initialize a dma_stm32_data structure
In the dma.h there is a dma_ctx structure using a magic code
to be identify. This structure must be prepared as a new
element of the dma_stm32_data.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-27 13:08:33 -04:00
Francois Ramu c4161024c4 drivers: dma: stm32 dma of type V1 with mux
This is the configuration of the stm32h723 where the
dma1 & dma2 of type V1 with a MUX. Even if DMA is of type V1,
the 'feature' does not exist with DMAMUX

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-20 06:28:32 -04:00
Piotr Mienkowski 4b36416720 drivers: dma_sam_xdmac: add dma_reload function
Add implementation of `dma_reload()` function.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-27 09:52:07 -04:00
Francois Ramu 325edf23d7 drivers: dma: stm32 source_periph incorrectly set in dma_stm32
The flag source_periph seems to be incorrectly set in dma_stm32.
In case the transfer direction is from periph to mem, then the
stream->source_periph is 1 (true) else it is false.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 06:06:11 -04:00
Francois Ramu dcefbd67ed drivers: dma: stm32 dma driver for a new dma version
This is the dma V2bis which is particular DMA V2 instance for
stm32F1 and STM32L1 soc series. This DMA does not use the dma slot
Otherwise it is similar to version V2.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu 6312b7383d drivers: dma: stm32 dma driver using DT compat macro
Controlling the DMA offset  for the request, relies on the
dma version different from V1

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Krishna Mohan Dani ca0b261b7f drivers/dma: STM32: Initialising DMA_InitStruct with 0 for stm32l5xx
In stm32l5xx soc, the LL_DMA_InitTypeDef has 2 more fields
(DoubleBufferMode and TargetMemInDoubleBufferMode) that must be
initialised with 0 else the configuration is wrong and gives
wrong values to the LL_DMA_Init function. Due to this the test
tests/drivers/dma/loop_transfer too would fail.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-10 12:43:19 -04:00
Francois Ramu aa2e915fbf drivers: dma: stm32 dmamux has request 0 for mem-to-mem
The request ID = 0 is allowed for mem-to-mem data
transfer through the DMAMUX.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-05-21 04:55:02 -05:00
Simon Guinot 1945f70eee drivers: dma: stm32: fix build for STM32F0 MCUs
The STM32F0 MCUs (except STM32F030XC) don't have a DMA channel selection
register (DMA_CSELR). This patch fixes the build of the dma_stm32 driver
for them.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-20 13:24:18 -05:00
Thomas Stranger 04ee034f4b drivers/dma: stm32 fix dmamux request id valid check
The request id is given by the DMA request MUX id which start at offset
1 and are vaid until req_nb + gen_nb.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 09:28:33 -05:00
Thomas Stranger 0014193193 drivers/dma: stm32 dmamux: use util_listify to gen. func/dma_chan arrays
This commit continues simplifying the generation of
isActiveFlag/clearFlag funtion pointer array for the request generators
and does the same for the table_ll_channel.
Additionally move struct dmamux_stm32_channel to c file.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:10:02 -05:00
Thomas Stranger d7fb6fa9f1 drivers/dma: stm32 dmamux: fix isActiveFlag/clearFlag function array len
This commit uses dt property dma-channels instead of ll defines to
make sure every soc has correct number of function pointers defined.

While commit 5f6218a tried to fix this for g0 series, this caused
regression for other series(e.g. stm32g431). Using UTIL_LISTIFY and
dt properties this should finally be fixed and reduce boilerplate code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:10:02 -05:00
Mahesh Mahadevan b88d8070d7 drivers: dma: Update the LPC DMA driver
1. Update the SDK API's called in the configure implementation.
The DMA_PrepareTransfer and DMA_SubmitTransfer SDK functions
are not recommneded for use. Replaced the call to these SDK
functions with other SDK API's.
2. Fix the implementation the configure function when multiple
blocks are used.
3. Update the dma_reload implementation. The old reload function
would simply abort the transfer. The new implementation reloads
the DMA buffers for transfer.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-30 12:02:55 -05:00
Gerard Marull-Paretas 861eac31b8 drivers: dma: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:41:29 -04:00
Thomas Stranger 1e3512c94e drivers/dma: stm32: don't omit IRQ status check in dma_is_irq_active
Fix stm32_dma_is_irq_active not checking the IRQ status(IsEnabled) for
active interrupts.
While the transfer-complete, half-transfer comp.  and transfer-error
is_XX_irq_active() functions check for IRQ status (IsEnabled),
ORing the result with dma_stm32_is_gi_active() overrides the
status check as gi is always 1 in case any of these flags is active.
Related to commit 96c92ed93f.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Thomas Stranger e53ee41338 driver: dmamux: use LL_DMAMUX_CHANNEL_X flag to check if channels exists
Use LL_DMAMUX_CHANNEL_x defines instead of DMAMUX_CSR_SOF7x to check
if corresponding LL_DMAMUX_IsActiveFlag_SOx and LL_DMAMUX_ClearFlag_SOx
inline functions exist and should be added to func_ll_is_active_so[]
and func_ll_clear_so[].
The HAL of some socs uses the same flag to decide which registers exist
on a specific soc. And the same defines are used for table_ll_channel[]
initializations.

This is necessary because DMAMUX_CSR_SOF5 and DMAMUX_CSR_SOF6 were
wrongly added in the HALs soc header file for some stm32g0 socs,
therefore without this change some stm32g0 socs couldn't compile.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Thomas Stranger 5a475d7cc2 drivers/dma: stm32: add support for stm32g0 series
Update the existing driver to support STM32G0 series.
It enables the DMA_STM32_SHARED_IRQS flag for g0 series, such that
all interrupts are handled in a shared isr to avoid irq conflicts.
The shared isr is extended to be able to handle irqs from more than one
dma instance.

Furthermore the config_irq function of instance 1, which connects to the
irqs, was reworked to avoid irq conflicts when 2 dma instances on
stm32f0, or stm32g0 are enabled:
While dma1 has one exclusive irq for channel 1, and one irq for dma1
channels 2 and 3, all other channels share the same irq.
Therefore it is currently not possible to enable dma2 without enabling
dma1 at the same time, without getting an build errror due to an irq
conflict.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Thomas Stranger 73374fbfa9 driver: dmamux: enable clocks only if node has clocks property defined
Not all STM32 Series can enable a dedicated clock for dmamux.
In stm32g0 series for example the clock is enabled automatically
as long as either DMA1 or DMA2 is enabled.
This commit changes dmamux driver to cope with socs that don't have
defined a clocks property. Therefore it moves the config(and data)
struct into the c file to be able to use DT_INST_NODE_HAS_PROP macro.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Hake Huang b609242903 dma: add request channel and release channel helper
add two dma api for dynamic channel reqest and release

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-04-23 14:58:40 +02:00
Shlomi Vaknin 95143fc98e drivers: dma: stm32: add support for stm32h7
Add the missing parts for adding support
to stm32h7 dma driver.
The fix is to make dmamux driver work with
dma v1 driver.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-04-14 18:18:12 +02:00
Hake Huang 81ed02d341 dma: mcux edma driver support multi-channel
1. remove redundant protection on channel status
2. update link interface to support major and minor link

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-04-08 16:38:49 +02:00
Shlomi Vaknin e9efa8a77c dma: stm32: enable half transfer interrupt
Enable half transfer interrupt of the dma controller
in case the channel was enabled in circular mode.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-04-01 07:32:22 -05:00
Raveendra Padasalagi e2b51da6f5 drivers: dma: paxdma: increase bd buffers.
Increase BD buffers from 7 to 9 to handle 1024 block
counts having mega/normal src,dst bd combinations in one request.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-19 09:32:08 -04:00
Raveendra Padasalagi 9adbc5a616 drivers: dma: paxdma: Sync payload as separate packet
Sync packet is always CARD to HOST and if it's combined with HOST
to CARD transfers in one single RM header packet, it's not allowed
due to RM implementation constraints. RM implementation allows same
type of data transfer direction in all the BD's populated under one
header BD.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-19 09:32:08 -04:00
Raveendra Padasalagi 32d62972ce drivers: dma: paxdma: Use uncached sync bufer
Use uncached memory for sync payload buffer.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-19 09:32:08 -04:00
Arjun Jyothi 4fe04c84d4 drivers: dma: pl330: Zero initialize the ch_handle
Zero initialize the ch_handle in dma_pl330_configure().
The memset in dma_pl330_config_channel()is incorrect,
as the ch_handle is already populated with valid values and
the dma_pl330_config_channel() is overwriting with zeros.

Signed-off-by: Arjun Jyothi <arjun.jyothi@broadcom.com>
2021-03-04 12:59:46 +01:00
Raveendra Padasalagi 3c420566bd drivers: dma: pl330: remove callback
Removed dma callback in start() API, since dma
completion happens synchronously.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-04 12:59:46 +01:00
Raveendra Padasalagi 3bb095e710 drivers: dma: pl330: increase timeout
Increase timeout value related to dma completion status.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-04 12:59:46 +01:00
Raveendra Padasalagi f86889e7ec drivers: dma: pl330: fix warnings
Fix compile warnings in PL330 DMA driver.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-04 12:59:46 +01:00
Kumar Gala c308c4b1f6 drivers: dma: nios2_msgdma: Fix typo in irq priority
Extracting priority from the devicetree should specify instance 0, not
'inst'.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 06:28:34 -05:00
Kumar Gala d521129c4f dma: Kconfig remove unused kconfig symbols
All dma drivers are devicetree based now so we can remove the last
bits of Kconfig associated with the old driver style.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 20:28:35 -06:00
Kumar Gala b60b4be4e3 drivers: dma: nios2_msgdma: Conver to devicetree
Conver the NIOS-II mSGDMA driver to be devicetree based.  Add node for
dma controller into nios2f.dtsi.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 08:36:58 -06:00
Shlomi Vaknin 23bb30a73a stm32: dmamux: change initialization order to PRE_KERNEL_1
When running the tests of the async api of uart
on nucleo-l4r5zi we get MPU fault.
The reason is ordering initialization. The uart and dma
drivers are initialized PRE_KERNEL_1 while dmamux is
initialized POST_KERNEL.
Thus, the function device_get_binding fails since the
dmamux device is not ready to be used.

Fixes: #32715.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-03-01 15:41:11 -06:00
Thomas Stranger 49b490161d drivers: dmamux_stm32: compile time dmamux channels initialization
Move dmamux_stm32_channels struct from device data to device
configuration and initialize the dmamux channel - dma channel
assignment during build time,
as this association is hardwired in all known series.
The information is taken from dma_offset and dma_requests device tree
properties. The current implementation is valid for series with either
a single or two dma peripherals and a single dmamux peripheral.
Both dmas can independently enabled.
As the driver uses multi-instance DT_INST_DEFINE, also macros for a
second dmamux are are added that should allow easier extension to a
second dmamux instance.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-02-25 21:57:59 +03:00
Kumar Gala b275fec8c4 soc: stm32: convert to use DEVICE_DT_GET for clocks
Convert from device_get_binding to DEVICE_DT_GET.  In doing this we
no longer need the label in the devicetree node so we remove that.

Removed all __ASSERT_NO_MSG(clk) since we'll get a build error if
DEVICE_DT_GET cant be satisfied, and the clock control api's will
handle reporting if the device_is_ready.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-16 17:01:37 -06:00
Kumar Gala 937dad2cb7 drivers: dma: iProc PAX: Fix use of deprecated APIs
Drivers are using DEVICE_AND_API_INIT which is deprecated so convert
the iproc_pax dma drivers over to using DEVICE_DT_INST_DEFINE and
DEVICE_DT_INST_GET.

Fixes #32153

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-10 07:16:11 -05:00
Shlomi Vaknin 5ccb89c3bc dma: stm32: remove dump stream info in irq
Remove printing dma stream info in irq context.
This is printed in case of error.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-02-05 12:24:20 -05:00
Erwan Gouriou 96c92ed93f drivers/dma: stm32: Don't omit IRQ status check
When checking for IRQ flags, we should also check
for IRQ status (IsEnabled ?).
If this is not done we can end up in Half Transfer
interrupt processing while it is not enabled.

Additionaly always use the id translation function
in LL API calls.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-04 12:35:04 -05:00
Raveendra Padasalagi 228a3cffd6 drivers: dma: Add iProc PAXDMA driver
Add PAX[PCIE<->AXI] DMA driver which supports DMA
transfers between host and target memory over PCIe link.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-01-18 16:58:55 -05:00
Erwan Gouriou d43200e9c4 drivers/dma: stm32: Preparation for QSPI DMA mode support
In preparation for QSPI DMA mode:
-Add a possibility to override driver by the HAL DMA. In that case
stream is set as busy and no configuration nor treatment is done.
In case of interrupt, flags clearing is let to HAL.
-Treat Half Transfer interrupt prior to Transfer Complete for the
cases were both IRQ are both raised at the time IRQ handler is called

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-15 10:29:30 -05:00
Erwin Rol 4cc15d73dd drivers: dmamux: Remove need for kmalloc
Use file static variable for the channel config data, instead
of a dynamic array allocated with kmalloc.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2021-01-15 10:27:43 -05:00
Kumar Gala 02703e60d9 device: Remove DEVICE_DT_DECLARE / DEVICE_DT_INST_DECLARE
Now that we generate a header that extern's all possible devicetree
based device struct we can remove DEVICE_DT_DECLARE and
DEVICE_DT_INST_DECLARE as they aren't needed anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-15 07:16:21 -06:00
Erwan Gouriou b226f1d446 drivers/dma: stm32: Base Konfig symbols on dts compatible status
In order to simplify the handling of DMA_STM32_V1/V2 and DMAMUX_STM32
symbols, set them directly based on related compatible status.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-11 16:49:39 -05:00