29 Jan, 2021
1 commit
-
For some tough multi channels test, the default priority of channel0 may
not be scheduled in 500us so that channel context can't be loaded as the
below warning, hence sdma channel transfer will be failed. So raise up
channel0 to the highest one since context load is important to all
channels. Besides, enlarge 500us to 5ms for safe since many highest channel
also may run at the same time like asrc/easrc tough test(8 channel run)."imx-sdma 30e10000.dma-controller: Timeout waiting for CH0 ready"
Signed-off-by: Robin Gong
Reviewed-by: Peng Zhang
16 Dec, 2020
2 commits
-
check iram_pool before sdma_init_sw() so that ccb/context could be
allocated from iram because DDR maybe in self-referesh in lower power
audio case while sdma still running.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang
(cherry picked from commit 6087a1b040c7df054efefd6eda7c031b49b80276) -
Save iram pool bd allocated in in i.mx6sll low power audio playback case,
including below refine points:
1. corrected to bd_size instead of page size for iram pool case.
2. use common DDR memory instead of iram for script loading.
3. channel0 also down to 1 bd size instead of page size.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang
(cherry picked from commit 0cc37c475172c5d91c20380acd737e198f8986ff)
14 Dec, 2020
26 commits
-
ERR009165 are not fix on i.mx8m family, so remove 'ecspi_fixed' on
sdma_imx8mq, otherwise, i.mx8mn ecspi not work in dma mode as below:[ 8163.444680] SPI transfer using DMA
[ 8163.448144] SPI DMA tx transfer timer: 500
[ 8165.468250] spi_imx 30820000.spi: I/O Error in DMA TX
[ 8165.473353] spidev spi0.0: SPI transfer failed: -110
[ 8165.478446] spi_master spi0: failed to transfer one message from queueSigned-off-by: Robin Gong
Reviewed-by: Clark Wang
(cherry picked from commit c18cc22344c003ad9b277c372b31bdb76262b669) -
There are two more DONE0_CONFIG/DONE1_CONFIG registers on i.mx8m family.
Add them to save/restore register list during systerm level suspend/
resume to restore them after resume back, otherwise, PDM case maybe failed
in suspend/resume case.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang
(cherry picked from commit 2c213d8ac495065f5ec4182335c151d32d0eb482) -
Add sdma_get_firmware_wait() since sdma firmware have to be ready after
runtime resume. That could be done for runtime feature on i.mx8mp since
the only sdma client audio driver request sdma channel after rootfs
mounted which means no any block in sdma_get_firmware_wait() as
sdma_get_firmware().Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang
(cherry picked from commit b97783e4c8a3f754cb616df2ab901a1a0a4c730e) -
Add runtime suspend/resume support on i.mx8mp. So sdma will be initialized
and firmware will be loaded at first channel requested, sdma will be off
once no any channel is running.For the legacy chips just keep sdma on
always as before.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang
(cherry picked from commit 65e87c257b8222d433bbf11c2faba1a2d8c092a5) -
Split sdma_init_sw and sdma_init_hw from sdma_init, so that sdma_init_hw
could be delayed in channel allocate phase and it's easier for implementing
runtime suspend/resume in the next.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang
(cherry picked from commit 4da4ba1aed135fa1a760497e2be52d077794a463) -
Add sdma restore back for i.mx8mp since its power resource audioimx will
be off after suspend.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang -
In multi audio play/stop case,sdma_alloc_chan_resources/
sdma_free_chan_resources will be called quickly, especially,dma done
interrupt comes after sdma_free_chan_resources, thus, system will be
hang in interrupt since it'll check sdma register but clocks have
already been disabled in sdma_free_chan_resources. To avoid it, enable
clock in isr.Signed-off-by: Robin Gong
(cherry picked from commit 80b0e31cdd38d77ea5b0a116fe9f2b2dec23dd2b) -
This reverts commit d288bddd8374e0a043ac9dde64a1ae6a09411d74.
This patch is invalid since local commit:
a03180986b79 ("Revert "dmaengine: imx-sdma: refine to load context only once"")Otherwise, met build break as follows:
../drivers/dma/imx-sdma.c: In function ‘sdma_free_chan_resources’:
../drivers/dma/imx-sdma.c:1533:7: error: ‘struct sdma_channel’ has no member named ‘context_loaded’
1533 | sdmac->context_loaded = false;
| ^~Module onwer could follow for a fine tuned solution.
Signed-off-by: Dong Aisheng
-
In case 60 seconds maybe not enough for Yocto loading sdma firmware on
some poor performance chips such as i.mx6sll in nfs case, add another
round to load firmware.Signed-off-by: Robin Gong
Reviewed-by: Fugang Duan -
Correct is_ram_script checking in case sdma firmware not loaded as
expected, otherwise all scripts are considered as rom script without
correct "sdma firmware not ready!" since sdma->ram_code_start is 0.Note: only add the doubtless is_ram_script for sdma-imx6q.bin/sdma-imx7d.
bin , and leave the legacy i.mx5x/i.mx3x/i.mx2x firmware alone since not
sure which of the remain scripts should be in ram.Signed-off-by: Robin Gong
Reviewed-by: Shengjiu Wang -
Correct data size of channel context which would be save and restore back
during suspend/resume. Otherwise, potential memory break may come as
USB met.Signed-off-by: Robin Gong
Acked-by: Fugang Duan
Reported-by: Jun Li
Tested-by: Jun Li -
Correct the ram script number for v3.
Signed-off-by: Fugang Duan
-
Add pm_ops to support suspend & resume
Signed-off-by: Shengjiu Wang
-
There is no bds for HDMI, so add one more condition
for sdma_alloc_bdSigned-off-by: Shengjiu Wang
-
Support 24bit/3bytes for sg mode.
Signed-off-by: Shengjiu Wang
Acked-by: Robin Gong -
update sdma script for multi fifo SAI on i.mx8MQ. Besides,Add
new cell for sw_done/sw_done_selector, because PDM need enable
software done feature in sdma script(same multi fifo script).
The new fourth cell defined as below:
Bit31: sw_done
Bit15~bit0: selector
For example: 0x80000000 means sw_done enabled for done0 sector which
is for PDM on i.mx8mm.Signed-off-by: Robin Gong
-
update buswidth that is supported by sdma.
Signed-off-by: Shengjiu Wang
Signed-off-by: Vipul Kumar
Signed-off-by: Srikanth Krishnakar
(cherry picked from commit c6e6f9cf2661dc1a5ba6fbcfdd15f096191ed47d) -
As SSI has dual fifo, add src_dualfifo and dst_dualfifo in imx_dma_data
to support dual fifo in DMA_DEV_TO_DEV.Signed-off-by: Shengjiu Wang
(cherry picked from commit cfde1308f170166a0099ca39ee8733895f9626f0)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar
Signed-off-by: Srikanth Krishnakar(cherry picked from commit 0ea90e5f83725fe5e4b8933cc546c1ff22156717)
Signed-off-by: Robin Gong -
On i.mx6sx or i.mx7d chip, megafast could be off in suspend which
means sdma controller will be power-ed off, thus sdma driver
should resume back including firmware loaded again.Signed-off-by: Robin Gong
[ Aisheng: fix rebase conflict ]
Signed-off-by: Dong Aisheng -
Add hdmi audio support.
Signed-off-by: Robin Gong
-
Allocate memory from SoC internal SRAM so that we can turn off
voltage of external DDR to save power if 'iram' property in dts.Signed-off-by: Robin Gong
-
ECSPI issue fixed from i.mx6ul at hardware level, no need
ERR009165 anymore on those chips such as i.mx8mq. Add i.mx6sx
from where i.mx6ul source.Signed-off-by: Robin Gong
-
Add mcu_2_ecspi script to fix ecspi errata ERR009165.
Signed-off-by: Robin Gong
-
Since sdma_transfer_init() will do sdma_load_context before any
sdma transfer, no need once more in sdma_config_channel().Signed-off-by: Robin Gong
-
update sdma script for multi fifo SAI on i.mx8MQ.
Signed-off-by: Robin Gong
[ Aisheng: fix build error ]
Signed-off-by: Dong Aisheng -
This reverts commit ad0d92d7ba6aecbe2705907c38ff8d8be4da1e9c, because
in spi-imx case, burst length may be changed dynamically.Signed-off-by: Robin Gong
11 Sep, 2020
1 commit
-
Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
for platform devices"), struct platform_device already provides a
dma_parms structure, so we can save allocating another one.Signed-off-by: Robin Murphy
Link: https://lore.kernel.org/r/d9b551dcf712a91860af3c5dd01a31b9b97ac1c5.1599164692.git.robin.murphy@arm.com
Signed-off-by: Vinod Koul
05 Aug, 2020
1 commit
-
Signed-off-by: Vinod Koul
Conflicts:
drivers/dma/idxd/sysfs.c
15 Jul, 2020
1 commit
-
Fixes the following W=1 kernel build warning(s):
drivers/dma/imx-sdma.c:383: warning: Function parameter or member 'slave_config' not described in 'sdma_channel'
drivers/dma/imx-sdma.c:383: warning: Function parameter or member 'context_loaded' not described in 'sdma_channel'
drivers/dma/imx-sdma.c:383: warning: Function parameter or member 'terminate_worker' not described in 'sdma_channel'Signed-off-by: Lee Jones
Cc: Shawn Guo
Cc: Sascha Hauer
Cc: Pengutronix Kernel Team
Cc: Fabio Estevam
Cc: NXP Linux Team
Link: https://lore.kernel.org/r/20200714111546.1755231-12-lee.jones@linaro.org
Signed-off-by: Vinod Koul
24 Jun, 2020
1 commit
-
event_id0 is defined as 'unsigned int', so it is always greater or
equal to zero.Remove the unneeded comparisons to fix the following W=1 build
warning:drivers/dma/imx-sdma.c: In function 'sdma_free_chan_resources':
drivers/dma/imx-sdma.c:1334:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
1334 | if (sdmac->event_id0 >= 0)
| ^~
drivers/dma/imx-sdma.c: In function 'sdma_config':
drivers/dma/imx-sdma.c:1635:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
1635 | if (sdmac->event_id0 >= 0) {
|Fixes: 25962e1a7f1d ("dmaengine: imx-sdma: Fix the event id check to include RX event for UART6")
Reported-by: kernel test robot
Signed-off-by: Fabio Estevam
Reviewed-by: Frieder Schrempf
Link: https://lore.kernel.org/r/20200621155730.28766-1-festevam@gmail.com
Signed-off-by: Vinod Koul
15 May, 2020
1 commit
-
The script addresses array increases with each new version. The driver
initializes the array to -EINVAL initially, but only up to the size
of the v1 array. Initialize the additional addresses for the newer
versions as well. Without this uninitialized values of the newer arrays
are treated as valid.Signed-off-by: Sascha Hauer
Reviewed-by: Robin Gong
Link: https://lore.kernel.org/r/20200513060405.18685-1-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul
25 Feb, 2020
2 commits
-
On i.MX6UL/ULL and i.MX6SX the DMA event id for the RX channel of
UART6 is '0'. To fix the broken DMA support for UART6, we change
the check for event_id0 to include '0' as a valid id.Fixes: 1ec1e82f2510 ("dmaengine: Add Freescale i.MX SDMA support")
Signed-off-by: Frieder Schrempf
Reviewed-by: Fabio Estevam
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200225082139.7646-1-frieder.schrempf@kontron.de
Signed-off-by: Vinod Koul -
There is a DMA problem with the serial ports on i.MX6.
When the following sequence is performed:
1) Open a port
2) Write some data
3) Close the port
4) Open a *different* port
5) Write some data
6) Close the portThe second write sends nothing and the second close hangs.
If the first close() is omitted it works.Adding logs to the the UART driver shows that the DMA is being setup but
the callback is never invoked for the second write.This used to work in 4.19.
Git bisect leads to:
ad0d92d: "dmaengine: imx-sdma: refine to load context only once"This commit adds a "context_loaded" flag used to avoid unnecessary context
setups.
However the flag is only reset in sdma_channel_terminate_work(),
which is only invoked in a worker triggered by sdma_terminate_all() IF
there is an active descriptor.So, if no active descriptor remains when the channel is terminated, the
flag is not reset and, when the channel is later reused the old context
is used.Fix the problem by always resetting the flag in sdma_free_chan_resources().
Cc: stable@vger.kernel.org
Signed-off-by: Martin Fuzzey
Fixes: ad0d92d7ba6a ("dmaengine: imx-sdma: refine to load context only once")
Reviewed-by: Fabio Estevam
Link: https://lore.kernel.org/r/1580305274-27274-1-git-send-email-martin.fuzzey@flowbird.group
Signed-off-by: Vinod Koul
26 Dec, 2019
3 commits
-
The current descriptor is not on any list of the virtual DMA channel.
Once sdma_terminate_all() is called when a descriptor is currently
in flight then this one is forgotten to be freed. We have to call
vchan_terminate_vdesc() on this descriptor to re-add it to the lists.
Now that we also free the currently running descriptor we can (and
actually have to) remove the current descriptor from its list also
for the cyclic case.Signed-off-by: Sascha Hauer
Reviewed-by: Robin Gong
Tested-by: Robin Gong
Link: https://lore.kernel.org/r/20191216105328.15198-10-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul -
In sdma_tx_status() we must first find the current sdma_desc. In cyclic
mode we assume that this can always be found with vchan_find_desc().
This is true because do not remove the current descriptor from the
desc_issued list:/*
* Do not delete the node in desc_issued list in cyclic mode, otherwise
* the desc allocated will never be freed in vchan_dma_desc_free_list
*/
if (!(sdmac->flags & IMX_DMA_SG_LOOP))
list_del(&vd->node);We will change this in the next step, so check if the current descriptor is
the desired one also for the cyclic case.Signed-off-by: Sascha Hauer
Link: https://lore.kernel.org/r/20191216105328.15198-9-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul -
Rename sdma_disable_channel_async() after the hook it implements, like
done for all other functions in the SDMA driver.Signed-off-by: Sascha Hauer
Link: https://lore.kernel.org/r/20191216105328.15198-8-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul
14 Oct, 2019
1 commit
-
Illegal memory will be touch if SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
(41) exceed the size of structure sdma_script_start_addrs(40),
thus cause memory corrupt such as slob block header so that kernel
trap into while() loop forever in slob_free(). Please refer to below
code piece in imx-sdma.c:
for (i = 0; i < sdma->script_number; i++)
if (addr_arr[i] > 0)
saddr_arr[i] = addr_arr[i]; /* memory corrupt here */
That issue was brought by commit a572460be9cf ("dmaengine: imx-sdma: Add
support for version 3 firmware") because SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
(38->41 3 scripts added) not align with script number added in
sdma_script_start_addrs(2 scripts).Fixes: a572460be9cf ("dmaengine: imx-sdma: Add support for version 3 firmware")
Cc: stable@vger.kernel
Link: https://www.spinics.net/lists/arm-kernel/msg754895.html
Signed-off-by: Robin Gong
Reported-by: Jurgen Lambrecht
Link: https://lore.kernel.org/r/1569347584-3478-1-git-send-email-yibin.gong@nxp.com
[vkoul: update the patch title]
Signed-off-by: Vinod Koul