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

    Robin Gong
     

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)

    Robin Gong
     
  • 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)

    Robin Gong
     

14 Dec, 2020

26 commits


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

    Robin Murphy
     

05 Aug, 2020

1 commit


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

    Lee Jones
     

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

    Fabio Estevam
     

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

    Sascha Hauer
     

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

    Frieder Schrempf
     
  • 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 port

    The 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

    Martin Fuzzey
     

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

    Sascha Hauer
     
  • 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

    Sascha Hauer
     
  • 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

    Sascha Hauer
     

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

    Robin Gong