lkml.org 
[lkml]   [2020]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 02/10] dmaengine: Actions: Add support for S700 DMA engine
From
Date
On 24/06/2020 07:15, Vinod Koul wrote:

Hi,

> On 09-06-20, 15:47, Amit Singh Tomar wrote:
>
>> @@ -372,6 +383,7 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan *vchan,
>> struct dma_slave_config *sconfig,
>> bool is_cyclic)
>> {
>> + struct owl_dma *od = to_owl_dma(vchan->vc.chan.device);
>> u32 mode, ctrlb;
>>
>> mode = OWL_DMA_MODE_PW(0);
>> @@ -427,14 +439,26 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan *vchan,
>> lli->hw[OWL_DMADESC_DADDR] = dst;
>> lli->hw[OWL_DMADESC_SRC_STRIDE] = 0;
>> lli->hw[OWL_DMADESC_DST_STRIDE] = 0;
>> - /*
>> - * Word starts from offset 0xC is shared between frame length
>> - * (max frame length is 1MB) and frame count, where first 20
>> - * bits are for frame length and rest of 12 bits are for frame
>> - * count.
>> - */
>> - lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20;
>> - lli->hw[OWL_DMADESC_CTRLB] = ctrlb;
>> +
>> + if (od->devid == S700_DMA) {
>> + /* Max frame length is 1MB */
>> + lli->hw[OWL_DMADESC_FLEN] = len;
>> + /*
>> + * On S700, word starts from offset 0x1C is shared between
>> + * frame count and ctrlb, where first 12 bits are for frame
>> + * count and rest of 20 bits are for ctrlb.
>> + */
>> + lli->hw[OWL_DMADESC_CTRLB] = FCNT_VAL | ctrlb;
>> + } else {
>> + /*
>> + * On S900, word starts from offset 0xC is shared between
>> + * frame length (max frame length is 1MB) and frame count,
>> + * where first 20 bits are for frame length and rest of
>> + * 12 bits are for frame count.
>> + */
>> + lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20;
>> + lli->hw[OWL_DMADESC_CTRLB] = ctrlb;
>
> Unfortunately this wont scale, we will keep adding new conditions for
> newer SoC's! So rather than this why not encode max frame length in
> driver_data rather than S900_DMA/S700_DMA.. In future one can add values
> for newer SoC and not code above logic again.

What newer SoCs? I don't think we should try to guess the future here.
We can always introduce further abstractions later, once we actually
*know* what we are looking at.

Besides, I don't understand what you are after. The max frame length is
1MB in both cases, it's just a matter of where to put FCNT_VAL, either
in FLEN or in CTRLB. And having an extra flag for that in driver data
sounds a bit over the top at the moment.

Cheers,
Andre.

>
>> +static const struct of_device_id owl_dma_match[] = {
>> + { .compatible = "actions,s900-dma", .data = (void *)S900_DMA,},
>> + { .compatible = "actions,s700-dma", .data = (void *)S700_DMA,},
>
> Is the .compatible documented, Documentation patch should come before
> the driver use patch in a series
>
>> static int owl_dma_probe(struct platform_device *pdev)
>> {
>> struct device_node *np = pdev->dev.of_node;
>> struct owl_dma *od;
>> int ret, i, nr_channels, nr_requests;
>> + const struct of_device_id *of_id =
>> + of_match_device(owl_dma_match, &pdev->dev);
>
> You care about driver_data rather than of_id, so using
> of_device_get_match_data() would be better..
>
>> od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL);
>> if (!od)
>> @@ -1083,6 +1116,8 @@ static int owl_dma_probe(struct platform_device *pdev)
>> dev_info(&pdev->dev, "dma-channels %d, dma-requests %d\n",
>> nr_channels, nr_requests);
>>
>> + od->devid = (enum owl_dma_id)(uintptr_t)of_id->data;
>
> Funny casts, I dont think you need uintptr_t!
>

\
 
 \ /
  Last update: 2020-06-24 11:37    [W:1.112 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site