Re: [PATCH] serial: apbuart: Let boards without apbuart boot
From: Anton Vorontsov
Date: Sun May 16 2010 - 06:20:51 EST
On Sun, May 16, 2010 at 10:41:50AM +0200, Miguel Ojeda wrote:
> On Fri, May 14, 2010 at 4:19 PM, Anton Vorontsov <avorontsov@xxxxxxxxxx> wrote:
> > This patch fixes the following oops:
> >
>
> I sent a patch that fixes that oops too. It is in mm right now. Please check it.
Hm, and my patch is in Greg's tree already...
Greg, if it didn't make it anywhere further your tree, please
drop it in favour of Miguel's patch, Miguel was the first who
sent a fix for this problem.
Thanks,
> > ÂUnable to handle kernel paging request for data at address 0x00000000
> > ÂFaulting instruction address: 0xc016dea8
> > ÂOops: Kernel access of bad area, sig: 11 [#1]
> > ÂP1020 RDB
> > Âlast sysfs file:
> > ÂNIP: c016dea8 LR: c016dea0 CTR: c0010948
> > ÂREGS: c033fea0 TRAP: 0300 Â Not tainted Â(2.6.34-rc7-00108-g83b5177-dirty)
> > Â[...]
> > ÂNIP [c016dea8] grlib_apbuart_configure+0xd0/0x3bc
> > ÂLR [c016dea0] grlib_apbuart_configure+0xc8/0x3bc
> > ÂCall Trace:
> > Â[c033ff50] [c016dea0] grlib_apbuart_configure+0xc8/0x3bc (unreliable)
> > Â[c033ffa0] [c0316144] apbuart_console_init+0x10/0x34
> > Â[c033ffb0] [c0314a10] console_init+0x40/0x5c
> >
> > There's no apbuart on P1020 boards, and what's worse, there's no
> > clock-frequency property for it. The driver didn't handle this
> > case, which resulted in the oops above. Once we fix this, the
> > next oops pops up:
> >
> > ÂUnable to handle kernel paging request for data at address 0x00000030
> > ÂFaulting instruction address: 0xc0166ecc
> > ÂOops: Kernel access of bad area, sig: 11 [#1]
> > ÂP1020 RDB
> > Â[...]
> > ÂNIP [c0166ecc] uart_set_options+0xd0/0x164
> > ÂLR [c0166e38] uart_set_options+0x3c/0x164
> > ÂCall Trace:
> > Â[c033fef0] [c0330000] 0xc0330000 (unreliable)
> > Â[c033ff50] [c03160dc] apbuart_console_setup+0xa8/0x100
> > Â[c033ff70] [c003d668] register_console+0x338/0x3ec
> > Â[c033ffa0] [c0316154] apbuart_console_init+0x20/0x34
> > Â[c033ffb0] [c0314a10] console_init+0x40/0x5c
> > Â[c033ffc0] [c0300968] start_kernel+0x12c/0x234
> > Â[c033fff0] [c0000398] skpinv+0x2b0/0x2ec
> >
> > And that one is because the driver tries to register the console
> > even if there were no matches in grlib_apbuart_configure().
> >
> > While at it, also annotate grlib_apbuart_configure() with __init,
> > that fixes several section mismatches:
> >
> > ÂSection mismatch in reference from the function
> > Âgrlib_apbuart_configure() to the variable .init.data:apbuart_match
> > ÂThe function grlib_apbuart_configure() references the variable
> > Â__initdata apbuart_match.
> >
> > Signed-off-by: Anton Vorontsov <avorontsov@xxxxxxxxxx>
> > ---
> > Âdrivers/serial/apbuart.c | Â 19 ++++++++++++++-----
> > Â1 files changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/serial/apbuart.c b/drivers/serial/apbuart.c
> > index fe91319..c908734 100644
> > --- a/drivers/serial/apbuart.c
> > +++ b/drivers/serial/apbuart.c
> > @@ -520,11 +520,16 @@ static struct console grlib_apbuart_console = {
> > Â};
> >
> >
> > -static void grlib_apbuart_configure(void);
> > +static int __init grlib_apbuart_configure(void);
> >
> > Âstatic int __init apbuart_console_init(void)
> > Â{
> > - Â Â Â grlib_apbuart_configure();
> > + Â Â Â int ret;
> > +
> > + Â Â Â ret = grlib_apbuart_configure();
> > + Â Â Â if (ret)
> > + Â Â Â Â Â Â Â return ret;
> > +
> > Â Â Â Âregister_console(&grlib_apbuart_console);
> > Â Â Â Âreturn 0;
> > Â}
> > @@ -593,7 +598,7 @@ static struct of_platform_driver grlib_apbuart_of_driver = {
> > Â};
> >
> >
> > -static void grlib_apbuart_configure(void)
> > +static int __init grlib_apbuart_configure(void)
> > Â{
> > Â Â Â Âstatic int enum_done;
> > Â Â Â Âstruct device_node *np, *rp;
> > @@ -606,12 +611,14 @@ static void grlib_apbuart_configure(void)
> > Â Â Â Âstruct amba_prom_registers *regs;
> >
> > Â Â Â Âif (enum_done)
> > - Â Â Â Â Â Â Â return;
> > + Â Â Â Â Â Â Â return -ENODEV;
> >
> > Â Â Â Â/* Get bus frequency */
> > Â Â Â Ârp = of_find_node_by_path("/");
> > Â Â Â Ârp = of_get_next_child(rp, NULL);
> > Â Â Â Âprop = of_get_property(rp, "clock-frequency", NULL);
> > + Â Â Â if (!prop)
> > + Â Â Â Â Â Â Â return -ENODEV;
> > Â Â Â Âfreq_khz = *prop;
> >
> > Â Â Â Âline = 0;
> > @@ -629,7 +636,7 @@ static void grlib_apbuart_configure(void)
> > Â Â Â Â Â Â Â Â Â Â Â Âd = *device;
> >
> > Â Â Â Â Â Â Â Âif (!irqs || !regs)
> > - Â Â Â Â Â Â Â Â Â Â Â return;
> > + Â Â Â Â Â Â Â Â Â Â Â return -ENODEV;
> >
> > Â Â Â Â Â Â Â Âgrlib_apbuart_nodes[line] = np;
> >
> > @@ -658,6 +665,8 @@ static void grlib_apbuart_configure(void)
> > Â Â Â Âenum_done = 1;
> >
> > Â Â Â Âgrlib_apbuart_driver.nr = grlib_apbuart_port_nr = line;
> > +
> > + Â Â Â return line ? 0 : -ENODEV;
> > Â}
> >
> > Âstatic int __init grlib_apbuart_init(void)
> > --
> > 1.7.0.5
--
Anton Vorontsov
email: cbouatmailru@xxxxxxxxx
irc://irc.freenode.net/bd2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/