Commit graph

639 commits

Author SHA1 Message Date
Benjamin Björnsson
bd7929ce1a drivers: dma: dma_stm32: add stm32c0-series support
Add support for dma on the stm32c0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-05-27 06:21:39 -04:00
Emilio Benavente
73b1705eb7 drivers: dma: dma_mcux_lpc: Adjusted dma driver for channel chaining.
Added to the configuration function to enable
channel chaining for the DMA_LPC that utilizes
the total of the SOC OTrig channels.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-05-26 17:22:43 -05:00
Declan Snyder
2af408b8fa drivers: dma_mcux_lpc: Fix busy status
Driver should just say the channel is not busy if
it is not setup rather than returning an error.

Also, change the channel index to int8_t rather
than uint32_t since it is being assigned negative
values and that width is more appropriate.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Anisetti Avinash Krishna
5925a4670b drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface
Added intel LPSS DMA interface using dw common to support
usage of internal DMA in LPSS UART, SPI and I2C for
transfer and receive operations.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-05-26 10:06:00 -04:00
Anisetti Avinash Krishna
c828e8cd02 drivers: dma: dma_dw_common: Added 64bit address transfer
Added support for 64bit address source and destination
usage for dw common.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-05-26 10:06:00 -04:00
Anisetti Avinash Krishna
54ecda63cf drivers: dma: dma_dw_common: Added missing break in switch
Added a break and corrected wrong usage of source
instead of destination.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-05-26 10:06:00 -04:00
Mahesh Mahadevan
b8c21a6d88 drivers: dma_mcux: Add support for big data transfers
1. Transfers are not limited by XFERCOUNT transfer length of
   LPC DMA descriptor. Added code to handle block sizes
   greater than XFERCOUNT.
2. Use the reload_en flag to decide if we should setup
   a circular descriptor chain.
3. Improve handling of source and destination width.
4. Number of DMA descriptors are defined by a Kconfig value.
5. Changed the dma_reload function to handle transfers
   greater than XFERCOUNT.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 10:05:24 -04:00
Mahesh Mahadevan
723224f086 drivers: dma_mcux: Rename variables in NXP MCUX driver
Rename the variables to help understand the code flow.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 10:05:24 -04:00
Carlo Caione
cb11b2e84b barriers: Move __DSB() to the new API
Remove the arch-specific ARM-centric __DSB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Lucas Tamborrino
2f718dd369 drivers: dma: esp32xx: Fix get interrupts from DT
Simplify get interrupt numbers array by using DT_INST_PROP.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-05-23 08:55:51 +02:00
Gerard Marull-Paretas
2725155832 drivers: dma: mcux_lpc: remove unused device config
Device config is no longer used after
32da420126.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-18 11:09:29 -05:00
Declan Snyder
32da420126 drivers: dma_mcux_lpc: Change init level
Change init level of the mcux lpc dma driver to be
PRE_KERNEL_1 because some other hardware drivers
used on the same platforms as the lpc dma will be
dependent on the LPC DMA and are also initialized
in PRE_KERNEL_1, such as the Flexcomm UART driver
when using UART_ASYNC_API.

Therefore, remove k_malloc from init function and
make those variables statically defined instead of
heap allocated.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-17 14:25:13 -05:00
Declan Snyder
d8ca4e9e8f drivers: dma_mcux_lpc: Status fixes
Some miscellaneous fixes to LPC DMA driver regarding status tracking:

- If a DMA channel has not been configured for any transfer,
  there will be a bug caused by the virtual channel being -1
  and then trying to index -1 into the driver data structs.
  Add -EACCES return code to indicate this situation.

- Return -EINVAL from get_status if channel number is invalid

- Update the busy flag in the LPC DMA callback function.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-17 14:25:13 -05:00
Lucas Tamborrino
b916440b2e drivers: dma: esp32xx: Remove dynamic allocation for invalid buffers
According to the coding guidelines "dynamic allocation is not allowed".

This commit removes handling invalid DMA capable buffers by allocating
temporary buffer in a valid memory region, considering them as errors.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-05-10 10:15:05 +02:00
Lucas Tamborrino
a35dd4b926 drivers: dma: esp32s3: Add DMA support for esp32s3
Add GDMA support for esp32s3.
Remove suspend/resume since they are optional and do
the same as start/stop.
Fix possible null pointer derreference.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-05-10 10:15:05 +02:00
Cyril Fougeray
1be72d9888 dma: callback with 2 status codes for successful transfers
Make use of positive status values in the DMA callback to pass
info to the DMA client after a successful DMA operation.
A completed DMA transfer uses the status 0 while a reached
water mark uses the status 1.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-05-08 09:57:32 +02:00
Tomasz Leman
9028ad5d71 drivers: gpdma: pm runtime works only on ace
CAVS platforms are not fully integrated with zephyr. Some of the
registers are still programed from SOF side. This feature can be enabled
for those platforms later when integration is fully done.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
8575a6037b drivers: gpdma: enable clock gating
This patch is adding function enabling DMA clock gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
77805f3be4 drivers: gpdma: release dma ownership
Adding function that is allowing to release ownership of the DMA. When
DSP is no longer using dma instance it ownership can be released.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
9ef378f8d2 drivers: gpdma: power off
This patch allows device power manager to disable GPDMA instance when
its no longer in use.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
705d1c2c04 drivers: gpdma: power flow refactor
This patch is refactoring device power flow routine. DMA instance will
not be power up after kernel initialization if device power management
is enabled. Power menager will power up device and its power domain if
device will be in use and disable it when it's no longer needed.

The DMA disabling part has not yet been implemented.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Mahesh Mahadevan
629f8d83b5 drivers: dma: mcux_lpc: Update address increment logic
The address increment logic was looking at both source
and destination parameters together. Separate them so
we can set one.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-20 09:07:37 -05:00
Sylvain Chouleur
705e1e7916 dma_dw: separate intel specific registers from synopsys ones
CFG register uses fields that are not defined in Synopsys databook of
Designware AHB DMA Controller.

Since current Zephyr code uses this driver only for the
intel_adsp_gpdma driver I assume that those fields are specific to
this DMA which is not the standard Designware one.

This patch allows to use either the standard Designware register or
the Intel one.

Signed-off-by: Sylvain Chouleur <schouleur@graimatterlabs.ai>
2023-04-07 13:22:25 +02:00
Anas Nashif
402ac9e409 drivers: remove references to old CAVS platforms
Remove reference to all dropped CAVS platforms in drivers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-06 18:51:56 +02:00
Pieter De Gendt
6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Francois Ramu
93a1b61684 drivers: dma: stm32u5 dma driver with two dma instances
Add a second instance of DMA to the stm32 dma driver from the DTS
That can be found in the stm32H5 serie, where 2 GPDMA with 8 channels
are available. Rebuilding with Macro.
Use the dma_channels property of the dedive tree to count the nb
of dma channels: 16 or 8 (like in stm32h5).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-31 14:02:15 +02:00
Henrik Brix Andersen
c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
TOKITA Hiroshi
08606eac44 drivers: dma: rpi_pico: add support for RaspberryPi Pico DMA
Adding RaspberryPi Pico DMA driver.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-22 09:33:52 +01:00
Gerson Fernando Budke
bf46696057 drivers: dma: sam: Update to use clock control
This update Atmel SAM xdmac driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Tomasz Leman
fbe930ad0e driver: gpdma: balance the pm usage
Because the DMA driver allows multiple start and stop calls for the same
instance and the same channel, we cannot rely on the error codes
returned by these functions to notify the device's power manager that a
device is still in use.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-03-21 18:10:41 +00:00
Kai Vehmanen
e40859f787 Revert "dma: dw: Do not program SAR/DAR and CTL_HI/LO when using HW LLI"
Failures are seen with SOF digital mic capture test cases on Intel cAVS2.5
platforms if the SAR/DAR/CTL writes are skipped.

This reverts commit 08d9efb202.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-03-21 13:50:08 -04:00
Ranjani Sridharan
b32b321f50 dma: dw: Poll to check for channel disable with timeout
After disabling the channel, it is recommended to poll with timeout to
ensure that the channel has actually been disabled. Without this,
reconfiguring the DMA again while the channel is active could lead to
unexpected behavior and/or DMA underruns.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:25 +01:00
Ranjani Sridharan
6226f9e6e4 dma: dw: fix the return value check
The WAIT_FOR() function returns the value of checked expression. So fix
the return value check to log and return the timeout error when checking
if the FIFO is empty during stop.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:25 +01:00
Ranjani Sridharan
08d9efb202 dma: dw: Do not program SAR/DAR and CTL_HI/LO when using HW LLI
When using the HW LLI, there is no need to program these resgisters.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:25 +01:00
Ranjani Sridharan
045c686734 dma: dw: Add a debug utility function
Add a helper function to dump the GPDMA SHIM and channel registers for
debug along with a config option to enable it.

Co-developed-by: Tom Burdick <thomas.burdick@intel.com>
Singed-off-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:18 +01:00
Francois Ramu
c37272b321 drivers: dma: stm32 disabling stream waits for disable
Add the loop to wait until the stream is really disable after disabling
and also cleared the TCIF flag.
This is a specifity of the dma of type V1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-15 15:01:15 +01:00
Hein Wessels
7d76842fdf drivers: dma: stm32: dmamux: support dmamux2 and bdma
Extends dmamux driver to support DMAMUX 2,
which supports the BDMA on STM32H7 devices.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Hein Wessels
c4f88a9d6e drivers: dma: stm32: dmamux: abstact calls to dma drivers
Wrap calls to DMA drivers through fops to allow
different dmamuxes to point to different types of
dma with different function calls.

In preperation to add support for BDMA and DMAMUX2.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Hein Wessels
e01270793e drivers: dma: stm32: bdma support for H7
Implement STM32H7 BDMA driver.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Andriy Gelman
8a97da056b drivers: dma: Add infineon xmc4xxx dma support
Adds dma drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Jay Vasanth
c504e1e5cd drivers: dma: Add Microchip XEC DMA driver
The Microchip XEC family of microcontrollers includes a
simple DMA block implementing multiple channels. DMA supports
memory to memory, memory to peripheral, and peripheral to
memory transfers. Peripheral support is limited by each
chip to I2C and SPI controllers. DMA hardware does not support
scatter-gather or linked transactions.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-02-19 20:38:21 -05:00
Kai Vehmanen
0c0d73721e dma: dw: allow to stop in DW_DMA_SUSPENDED state
Allow DMA channel to be stopped even if it is in suspended state.
The current code in dw_dma_stop() supports this, but the recently
added early check for dw_dma_is_enabled() results in DMA stop
sequence to be skipped if the channel was in suspended state.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-19 20:37:26 -05:00
Kai Vehmanen
6422b2b094 dma: dw: fix include for chan_data
The conditional definitions are not correct as "chan_data"
is used without any include guards, but defined only if
CONFIG_DMA_DW_HW_LLI or CONFIG_DMA_DW_SUSPEND_DRAIN is defined.
Correct the declaration to match usage.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-19 20:37:26 -05:00
Francois Ramu
4de473e4c9 drivers: dma for stm32u5 returns from a repeated start or stop command
On a repeated dma_start, the stm3u5 dma driver should return
immediately if it is already started.
On a repeated dma_stop, the stm3u5 dma driver should return
immediately if it is already stopped.
This like the dma driver does for other stm32 series.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-11 07:57:44 +09:00
Daniel DeGrasse
844685224b drivers: dma: remove unused mutex from edma driver
Mutex initialized by edma driver is not used. Remove it from the
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-02-06 10:05:44 +01:00
Tom Burdick
58312e6104 dma: Repeated start/stop support for gpdma
Allows for repeatedly calling start/stop on designwares gpdma.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-23 11:51:21 -08:00
Tom Burdick
b14296af38 dma: HDA ignore repeated start/stop requests
The DMA API contract specifies that start/stop may be called multiple
times. Prior to adding power management this was perfectly fine as it was.
In adding power management, there are additional side effects that can
cause issues. Instead check the state of the channel prior to start/stop
and do nothing if already in the desired state.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-23 11:51:21 -08:00
Adrian Warecki
5d902ea621 dma: dw: Align error code for xrun reporting
The hda driver uses -EPIPE to signal xrun, as proposed in the alsa lib
https://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html. This commit
changes the xrun error code in dw dma driver from -ENODATA to -EPIPE to
make it consistent across drivers.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-01-19 15:45:16 +00:00
Francois Ramu
227226313a drivers: dma: stm32 dma driver support repeated start/stop
To support the repeated start/stop, the stm32 dma driver is
returning 0 if the channel is already started/stopped.
This is not done at the dmamux level if any.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-19 12:03:50 +01:00
Piotr Makaruk
00b5114344 dma: hda: enable xrun handling
Enable link under/overruns handling and reporting such events in dma
status

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2023-01-17 18:50:15 -05:00