[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48201368.1090200@seznam.cz>
Date: Tue, 06 May 2008 10:14:32 +0200
From: Michal Simek <monstr@...nam.cz>
To: John Williams <john.williams@...alogix.com>
CC: linux-kernel@...r.kernel.org, arnd@...db.de,
linux-arch@...r.kernel.org, stephen.neuendorffer@...inx.com,
John.Linn@...inx.com, matthew@....cx, will.newton@...il.com,
drepper@...hat.com, microblaze-uclinux@...e.uq.edu.au,
grant.likely@...retlab.ca, Michal Simek <monstr@...str.eu>
Subject: Re: [PATCH 18/56] microblaze_v2: early_printk support
Make sense.
I'll add it.
Thanks,
M
> On Sun, 2008-05-04 at 13:41 +0200, monstr@...nam.cz wrote:
>
>> +++ b/arch/microblaze/kernel/early_printk.c
>
>> +static void early_printk_putc(char c)
>> +{
>> + while (ioread32(STATUS) & (1<<3));
>> + iowrite32((c & 0xff), TX_FIFO);
>> +}
>
> The while() loop needs a retry counter - if you configure
> EARLY_PRINTK_BASE_ADDRESS wrongly and it points to memory or anything
> that is not a uartlite, the loop spins forever and you get silent
> lockup. Not nice behaviour from debug code :)
>
> Here's my current implementation:
>
> static void early_printk_putc(char c)
> {
> /* Limit how many times we'll spin waiting for TX FIFO status.
> This will prevent lockups if the base address is incorrectly
> set, or
> any other issue on the UARTLITE.
>
> This limit is pretty arbitrary, unless we are at about 10
> baud
> we'll never timeout on a working UART. */
>
> unsigned retries=10000;
> while (retries-- && (ioread32(STATUS) & (1<<3)))
> ;
>
> /* Only attempt the iowrite if we didn't timeout */
> if(retries)
> iowrite32((c & 0xff), TX_FIFO);
> }
>
> Cheers
>
> John
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists