On 04-11-22, 11:17, Lizhi Hou wrote:Got it. Thanks. :)
On 11/4/22 10:57, Vinod Koul wrote:Okay, either way if xdma_write_reg() is doing only regmap_write() then
On 04-11-22, 09:57, Lizhi Hou wrote:Ok. As you mentioned below,
On 11/4/22 07:32, Vinod Koul wrote:Nope, I refer to using regmap_write() intead of xdma_write_reg()
On 25-10-22, 10:57, Lizhi Hou wrote:Do you mean using readl / writel instead of regmap_* here?
+static inline int xdma_write_reg(struct xdma_device *xdev, u32 base, u32 reg,Do you really need one more level indirection?
+ u32 val)
+{
+ return regmap_write(xdev->regmap, base + reg, val);
+}
why not move err into xdma_write_reg(), rather than adding in each
helper!
If I use regmap_write() directly, I will not be able to move err into
xdma_write_reg(). Having a inline function might be useful to add debug
code. May I keep xdma_write_reg()?
no, if it has extra logic like logging on error etc then it makes sense
okI meant the descriptor is freed inside xdma_free_desc() which is calledIN case of error, you are returning NULL, so allocated descriptor leakssw_desc is freed by xdma_free_desc(). xdma_free_desc() is virt-dma callback+failed:who will free sw_desc here?
+ xdma_free_desc(&sw_desc->vdesc);
it converts struct virt_dma_desc pointer to driver sw_desc pointer and free
the whole thing.
before 'return NULL'.
xdma_free_desc(struct virt_dma_desc *vdesc)
{
sw_desc = to_xdma_desc(vdesc);
.....
kfree(sw_desc);
}
So it is a platform_device type? Why not make it something like auxdev?This dma engine is on PCI device (exposed on PCI BAR). Thus, the pci deviceWhat is the device mode, who creates this dma device, devicetree ormax_dma_channels is used to specify the maximum dma channels will be used.+#ifndef _PLATDATA_AMD_XDMA_Hwhy do you need this plat data
+#define _PLATDATA_AMD_XDMA_H
+
+#include <linux/dmaengine.h>
+
+/**
+ * struct xdma_chan_info - DMA channel information
+ * This information is used to match channel when request dma channel
+ * @dir: Channel transfer direction
+ */
+struct xdma_chan_info {
+ enum dma_transfer_direction dir;
+};
+
+#define XDMA_FILTER_PARAM(chan_info) ((void *)(chan_info))
+
+struct dma_slave_map;
+
+/**
+ * struct xdma_platdata - platform specific data for XDMA engine
+ * @max_dma_channels: Maximum dma channels in each direction
+ */
+struct xdma_platdata {
+ u32 max_dma_channels;
+ u32 device_map_cnt;
+ struct dma_slave_map *device_map;
+};
something else?
driver creates this dma device.