From: Vladimir Zapolskiy <vz@mleia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 1/5] dma: lpc32xx: add DMA driver
Date: Thu, 06 Aug 2015 21:42:56 +0300 [thread overview]
Message-ID: <55C3AAB0.902@mleia.com> (raw)
In-Reply-To: <4F172219764C784B84C2C1FF44E7DFB10300AC73@003FCH1MPN2-041.003f.mgd2.msft.net>
Hi Sylvain,
On 06.08.2015 16:50, LEMIEUX, SYLVAIN wrote:
> Hi Vladimir,
>
> Thanks for the feedback;
>
> Marek, Vladimir,
>
> there is a question below; I will wait for feedback before sending an updated version of the patch.
>
>
> Sylvain
>
>> -----Original Message-----
>> From: Vladimir Zapolskiy [mailto:vz at mleia.com]
>>
>> Hi Sylvain,
>>
>> On 05.08.2015 21:31, slemieux.tyco at gmail.com wrote:
>>> From: Sylvain Lemieux <slemieux@tycoint.com>
>>>
>>> Incorporate DMA driver from legacy LPCLinux NXP BSP.
>>> The files taken from the legacy patch are:
>>> - lpc32xx DMA driver
>>> - lpc3250 header file DMA registers definition.
>>>
>>> The legacy driver was updated and clean-up as part of the integration with the latest u-boot.
>>>
>>> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
>>> ---
>
> [...]
>
>>>
>>> diff --git a/arch/arm/include/asm/arch-lpc32xx/dma.h b/arch/arm/include/asm/arch-lpc32xx/dma.h
>>> new file mode 100644
>>> index 0000000..15d829c
>>> --- /dev/null
>>> +++ b/arch/arm/include/asm/arch-lpc32xx/dma.h
>>> @@ -0,0 +1,37 @@
>>> +/*
>>> + * LPC32xx DMA Controller Interface
>>> + *
>
> [...]
>
>>> +
>>> +int lpc32xx_dma_get_channel(void);
>>> +int lpc32xx_dma_start_xfer(int channel, const struct lpc32xx_dmac_ll *desc,
>>> + u32 config);
>>> +int lpc32xx_dma_wait_status(int channel);
>>> +void lpc32xx_dma_put_channel(int channel);
>>
>> There is no users of lpc32xx_dma_put_channel() interface, do you have
>> them in mind?
>>
> The legacy NXP BSP driver was providing the support the get and release a channel;
> I kept it there, knowing is currently not used.
>
> Do we want to keep this feature or remove it and only allowed channel allocation only?
>
> [...]
I have no definite answer, in my opinion dead code should be removed, if
its use is not planned. I would recommend to get the answer from a
maintainer, who accepts this code (Tom Rini ?).
>>> +++ b/drivers/dma/lpc32xx_dma.c
>>> @@ -0,0 +1,163 @@
>>> +/*
>
>
> [...]
>
>>> +
>>> +int lpc32xx_dma_start_xfer(int channel, const struct lpc32xx_dmac_ll *desc,
>>> + u32 config)
>>> +{
>>> + if (unlikely((BIT_MASK(channel) & alloc_ch) == 0)) {
>>
>> Would it be possible to change "int channel" to some unsigned type?
>>
>> If the intention is to reserve (channel < 0) for potentially
>> invalid/unallocated channel, as it is done in NAND SLC, please add a
>> check for this case here.
>
> This was the legacy NXP BSP original behavior.
>
> I will change the channel to "unsigned int" for the transfer API;
> the reserve API will continue to be return the channel as "int", to allowed validation;
Generally there is no need to preserve any correspondence between
mainlined code and code found in legacy BSP.
> the NAND SLC will keep the channel number as an "unsigned int".
Okay, in this case the correctness of the passed argument is offloaded
to a client. Fortunately the sole client NAND SLC does not pass -1 here
(the statement is based on code review).
>>
>>> + printf("ERR: Request for xfer on unallocated channel %d\r\n",
>>
> [...]
>>
>>> + channel);
>>> + BUG();
>>
>> The function returns int type, but in fact it returns only 0, either
>> this function return type can be changed to void, or IMO better to
>> return error here instead of fatal BUG() and add a check on client side.
>
> I will modify it to return -1 on error and check on client side;
> The client side will generate the fatal BUG().
>
Sounds good, I can imagine a potential client, which may gracefully
handle this error, but NAND drivers are not in the list. If problem is
encountered here, it means that the problem is on the client side and it
is fair enough to place BUG() right on that client side.
--
With best wishes,
Vladimir
next prev parent reply other threads:[~2015-08-06 18:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 18:31 [U-Boot] [PATCH v5 1/5] dma: lpc32xx: add DMA driver slemieux.tyco at gmail.com
2015-08-05 18:48 ` Marek Vasut
2015-08-05 20:48 ` Vladimir Zapolskiy
2015-08-06 13:50 ` LEMIEUX, SYLVAIN
2015-08-06 18:42 ` Vladimir Zapolskiy [this message]
2015-08-06 21:04 ` LEMIEUX, SYLVAIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55C3AAB0.902@mleia.com \
--to=vz@mleia.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox