lkml.org 
[lkml]   [2018]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 2/2] dmaengine: sprd: Add Spreadtrum DMA configuration
On 11 May 2018 at 19:53, Vinod Koul <vkoul@kernel.org> wrote:
> On 11-05-18, 19:44, Baolin Wang wrote:
>> Hi Vinod,
>>
>> On 11 May 2018 at 19:22, Vinod Koul <vkoul@kernel.org> wrote:
>> > On 09-05-18, 19:12, Baolin Wang wrote:
>> >
>> >> +/*
>> >> + * struct sprd_dma_config - DMA configuration structure
>> >> + * @cfg: dma slave channel runtime config
>> >> + * @src_addr: the source physical address
>> >> + * @dst_addr: the destination physical address
>> >> + * @block_len: specify one block transfer length
>> >> + * @transcation_len: specify one transcation transfer length
>> >> + * @src_step: source transfer step
>> >> + * @dst_step: destination transfer step
>> >> + * @wrap_ptr: wrap pointer address, once the transfer address reaches the
>> >> + * 'wrap_ptr', the next transfer address will jump to the 'wrap_to' address.
>> >> + * @wrap_to: wrap jump to address
>> >> + * @req_mode: specify the DMA request mode
>> >> + * @int_mode: specify the DMA interrupt type
>> >> + */
>> >> +struct sprd_dma_config {
>> >> + struct dma_slave_config cfg;
>> >> + phys_addr_t src_addr;
>> >> + phys_addr_t dst_addr;
>> >
>> > these are already in cfg so why duplicate, same for few more here.
>>
>> We save them in 'struct sprd_dma_config' as one parameter for
>> sprd_dma_config(), otherwise we need add 2 more parameters (src and
>> dst) for sprd_dma_config().
>
> I am not sure I follow...
>
> I meant you can use sprd_dma_config.cfg->src_addr/dst_addr and remove src_addr &
> dst_addr in the sprd_dma_config. It duplicate..

But we can not set values if dir == DMA_MEM_TO_DEV, since they
represent the device address, right?
sprd_dma_config.cfg->src_addr = sg_dma_address(sg);

>
> Same for few more params...
>
>> >> + if (!is_slave_direction(dir) || sglen > 1)
>> >> + return NULL;
>> >> +
>> >> + sdesc = kzalloc(sizeof(*sdesc), GFP_NOWAIT);
>> >> + if (!sdesc)
>> >> + return NULL;
>> >> +
>> >> + for_each_sg(sgl, sg, sglen, i) {
>> >> + if (dir == DMA_MEM_TO_DEV) {
>> >> + slave_cfg->src_addr = sg_dma_address(sg);
>> >> + slave_cfg->dst_addr = slave_cfg->cfg.dst_addr;
>> >> + slave_cfg->src_step =
>> >> + sprd_dma_get_step(slave_cfg->cfg.src_addr_width);
>> >> + slave_cfg->dst_step = SPRD_DMA_NONE_STEP;
>> >> + } else {
>> >> + slave_cfg->src_addr = slave_cfg->cfg.src_addr;
>> >> + slave_cfg->dst_addr = sg_dma_address(sg);
>> >> + slave_cfg->src_step = SPRD_DMA_NONE_STEP;
>> >> + slave_cfg->dst_step =
>> >> + sprd_dma_get_step(slave_cfg->cfg.dst_addr_width);
>> >
>> > use a helper for filling this and passing right values for each case?
>>
>> We need pass many values to this helper, but will try. Thanks.
>
> I think 5 and that may help to look it better :)

OK.

--
Baolin.wang
Best Regards

\
 
 \ /
  Last update: 2018-05-11 13:59    [W:0.045 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site