linux-mips
[Top] [All Lists]

Re: [PATCH 4/4] MIPS: BCM47xx: Setup and register serial early

To: Hauke Mehrtens <hauke@hauke-m.de>
Subject: Re: [PATCH 4/4] MIPS: BCM47xx: Setup and register serial early
From: Sergei Shtylyov <sshtylyov@mvista.com>
Date: Wed, 28 Jul 2010 17:23:49 +0400
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org
In-reply-to: <1280261566-8247-5-git-send-email-hauke@hauke-m.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1280261566-8247-1-git-send-email-hauke@hauke-m.de> <1280261566-8247-5-git-send-email-hauke@hauke-m.de>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Hello.

Hauke Mehrtens wrote:

Swap the first and second serial if console=ttyS1 was set.
Set it up and register it for early serial support.

This patch has been in OpenWRT for a long time.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[...]
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 516ac89..a40d88e 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
[...]
@@ -190,12 +192,45 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
void __init plat_mem_setup(void)
 {
-       int err;
+       int i, err;
+       char buf[100];
+       struct ssb_mipscore *mcore;
err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
                                      bcm47xx_get_invariants);
        if (err)
                panic("Failed to initialize SSB bus (err %d)\n", err);
+       mcore = &ssb_bcm47xx.mipscore;
+
+       nvram_getenv("kernel_args", buf, sizeof(buf));
+       if (!strncmp(buf, "console=ttyS1", 13)) {

Perhaps strstr()? Else you're limiting the console= parameter to always come first in the command line...

+       for (i = 0; i < mcore->nr_serial_ports; i++) {
+               struct ssb_serial_port *port = &(mcore->serial_ports[i]);
+               struct uart_port s;
+
+               memset(&s, 0, sizeof(s));
+               s.line = i;
+               s.mapbase = (unsigned int) port->regs;
+               s.membase = port->regs;

Is the MMIO region identity-mapped? Why you have the same value in the 'mapbase' and 'membase' fields?

WBR, Sergei


<Prev in Thread] Current Thread [Next in Thread>