dma: xilinx: vdma: Remove unused variables

Remove sg_waiting, max_len, and is_lite variables in struct xilinx_vdma_chan
which are not used anywhere.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Register DMA controller to DT

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Don't reconfigure channel after reset

VDMA users usually don't supply channel configuration parameter when
requesting a reset. The driver would then reconfigure the channel with
random parameters. Avoid this by returning immediately after resetting
the channel. Users will reconfigure it afterwards anyway.

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

The client must not control whether interrupts should be enabled. Remove
that.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Replace I/O accessor macros with static inlines

Beside improving type-safety, this will help debugging by allowing easy
logging on register read and write.

Also add two new clr() and set() accessors to respectively clear and set
bit fields to improve readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Use register offsets

Clean up all the register-related macros and replace the register data
structures with register offsets.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Use devm_* managers allocators

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Used managed I/O mapping function

Replace the of_iomap() call with a combination of
platform_get_resource() and devm_request_and_ioremap().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Handle reset timeouts when probing channel

Make the vdma_init() function return a proper error code, and propagate
it to the caller of xilinx_vdma_chan_probe() when vdma_init() fails.
This fixes returning an uninitialized error value to the probe function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
dma: xilinx: vdma: Remove initialized channels when channel probe fails

If a channel fails to probe correctly when need to clean up the already
initialized channels. Check the return value of xilinx_vdma_chan_probe()
and call xilinx_vdma_chan_remove() on all previously initialized
channels in case of failure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Remove unused struct xilinx_vdma_device irq field

The field is unused, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Reorder headers alphabetically

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Replace custom my_log() function with fls()

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
dma: xilinx: vdma: Make boolean DT properties real bools

Turn the xlnx,include-sg, xlnx,genlock-mode and xlnx,include-dre DT
properties into bool properties and use of_property_read_bool() to parse
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.com>
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>
Acked-by: Srikanth Thokala <srikanth.thokala@xilinx.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: 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>