[U-Boot] [PATCH 2/5] MX28: DMA: Prolong the DMA timeout

Fabio Estevam
2012-08-22T18:53:54Z

On Wed, Aug 22, 2012 at 2:42 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Dear Fabio Estevam,
>
>> On Tue, Aug 21, 2012 at 11:17 PM, Marek Vasut <marex@denx.de> wrote:
>> > int mxs_dma_go(int chan)
>> > {
>> >
>> > - uint32_t timeout = 10000;
>> > + uint32_t timeout = 10000000;
>>
>> Should we use a proper timeout mechanism instead?
>
> What would that be? I think 10 seconds is more than plenty for now.

Ok, but we need to change to unsigned int to be able to fit 10000000:

--- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
+++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
@@ -81,7 +81,8 @@ void enable_caches(void)
#endif
}

-int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t mask, int timeout)
+int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t mask, unsigned
+ int timeout)
{
while (--timeout) {
if ((readl(&reg->reg) & mask) == mask)
@@ -92,7 +93,8 @@ int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t ma
return !timeout;
}

-int mxs_wait_mask_clr(struct mxs_register_32 *reg, uint32_t mask, int timeout)
+int mxs_wait_mask_clr(struct mxs_register_32 *reg, uint32_t mask, unsigned
+ int timeout)
{
while (--timeout) {
if ((readl(&reg->reg) & mask) == 0)
diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h b/arch/arm/include/asm/ar
index 4610363..983b888 100644
--- a/arch/arm/include/asm/arch-mxs/sys_proto.h
+++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
@@ -26,10 +26,10 @@
int mxs_reset_block(struct mxs_register_32 *reg);
int mxs_wait_mask_set(struct mxs_register_32 *reg,
uint32_t mask,
- int timeout);
+ unsigned int timeout);
int mxs_wait_mask_clr(struct mxs_register_32 *reg,
uint32_t mask,
- int timeout);
+ unsigned int timeout);

int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int));

Regards,

Fabio Estevam