dma: xilinx: vdma: Use of_property_read_u32() to read u32 DT properties

Replace the of_get_property() calls with of_property_read_u32() DT
properties that store a single unsigned integer.

Return an error when the xlnx,device-id or xlnx,num-fstores property
isn't set.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Device is always compatible with xlnx,axi-vdma

The xilinx-axivdma driver only supports VDMA devices. There is no need
to test for compatibility.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Deconstruct feature fields

Store features in dedicated fields or process them directly instead of
storing them in a bitfield only to read them back right afterwards.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Remove unnecessary braces

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Turn channel flush_fsync field into a bool

The field stores a boolean, make it bool.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Turn the channel has_dre field into a local variable

The field value is assigned and used locally only, replace it with a
local variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Don't increment the DMA engine channel count

The counter is updated by dma_async_device_register(), don't increment
it manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Reorganize probe functions

Group initialization statements by type.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Remove desc_dump function

The function is unused, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Rename vdma_init() to vdma_reset()

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Rename all functions to use the xilinx_vdma_ prefix

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Remove unneeded error checking

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Split xilinx_vdma_device_control() function

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Remove the xilinx_vdma_config direction field

The direction is fixed for a given channel, there's not need to pass it
through the configuration structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Call xilinx_vdma_start_transfer() directly

The function pointer is currently stored in the channel structure
start_transfer field and called indirectly. As the start_transfer field
always points to the same function, remove it and call
xilinx_vdma_start_transfer() directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Configure the hardware when starting the transfer

Set the XILINX_VDMA_REG_HSIZE and XILINX_VDMA_REG_FRMDLY_STRIDE
registers when starting the transfer, not when preparing the request.
This is needed to allow several requests to be prepared and submitted
for execution.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Rename xilinx_vdma_desc_sw to xilinx_vdma_tx_segment

The structure describes one scatter-gather segment from a transaction,
rename it accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Split xilinx_vdma_free_chan_resources() function

The xilinx_vdma_free_chan_resources() function frees both the
descriptors and the descriptors pool. Split the descriptors freeing code
into a separate function to increase code reuse.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Simplify interrupt handler

Perform actions directly instead of setting intermediate variables only
to test them right afterwards.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Support queuing multiple transactions

Create a xilinx_vdma_tx_descriptor structure and use it model DMA
transactions. A transaction can contain several segments, and multiple
transactions can be prepared and submitted without waiting for the
previous transactions to complete.

Replace the active descriptors list with an active descriptor pointer,
and add a new complete descriptors list to store complete descriptors
that need to be handed back to the client.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>