RE: [PATCH v4 2/4] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
From: Biju Das <biju.das.jz@bp.renesas.com>
Date: 2021-07-27 13:45:15
Also in:
linux-renesas-soc
Hi Vinod, Thanks for the feedback.
Subject: Re: [PATCH v4 2/4] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC On 19-07-21, 10:25, Biju Das wrote:quoted
+struct rz_dmac_chan { + struct virt_dma_chan vc; + void __iomem *ch_base; + void __iomem *ch_cmn_base; + unsigned int index; + int irq; + struct rz_dmac_desc *desc; + int descs_allocated; + + enum dma_slave_buswidth src_word_size; + enum dma_slave_buswidth dst_word_size; + dma_addr_t src_per_address; + dma_addr_t dst_per_address; + + u32 chcfg; + u32 chctrl; + int mid_rid; + + struct list_head ld_free; + struct list_head ld_queue; + struct list_head ld_active; + + struct { + struct rz_lmdesc *base; + struct rz_lmdesc *head; + struct rz_lmdesc *tail; + int valid; + dma_addr_t base_dma; + } lmdesc;should this be not part of rz_dmac_desc than channel?
No. It is channel specific. A channel has 64 HW legacy descriptors(see rz_dmac_chan_probe function) and 16 rz_dmac_desc( see rz_dmac_chan_resources function)
quoted
+static int rz_dmac_config(struct dma_chan *chan, + struct dma_slave_config *config) { + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan); + u32 *ch_cfg; + + channel->src_per_address = config->src_addr; + channel->src_word_size = config->src_addr_width; + channel->dst_per_address = config->dst_addr; + channel->dst_word_size = config->dst_addr_width; + + if (config->peripheral_config) { + ch_cfg = config->peripheral_config; + channel->chcfg = *ch_cfg; + }can you explain what this the ch_cfg here and what does it represent?
It is a 32 bit value represent channel config value which supplied by each client driver during slave config. It contains information like transfer mode,src/destination data size, Ack mode, Level type, DMA request on rising edge or falling Edge, request direction etc... For eg:- The channel config for SSI tx is (0x11228). An example usage can be found here [1] [1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210719134040.7964-8-biju.das.jz@bp.renesas.com/ Regards, Biju
-- ~Vinod