correctly set mapbase while registering the UART (#4622)
[openwrt/openwrt.git] / target / linux / brcm47xx / patches-2.6.28 / 400-arch-bcm47xx.patch
index ae7bd74..ad7e667 100644 (file)
@@ -1,26 +1,29 @@
-diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
+Index: linux-2.6.28.7/arch/mips/Kconfig
+===================================================================
+--- linux-2.6.28.7.orig/arch/mips/Kconfig      2009-03-17 17:26:23.000000000 +0100
++++ linux-2.6.28.7/arch/mips/Kconfig   2009-03-17 17:27:33.000000000 +0100
 @@ -53,6 +53,7 @@ config BCM47XX
        select SSB_DRIVER_MIPS
        select SSB_DRIVER_EXTIF
        select SSB_EMBEDDED
-+      select SSB_B43_PCI_BRIDGE
++      select SSB_B43_PCI_BRIDGE if PCI
        select SSB_PCICORE_HOSTMODE if PCI
        select GENERIC_GPIO
        select SYS_HAS_EARLY_PRINTK
-diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
---- a/arch/mips/bcm47xx/Makefile
-+++ b/arch/mips/bcm47xx/Makefile
+Index: linux-2.6.28.7/arch/mips/bcm47xx/Makefile
+===================================================================
+--- linux-2.6.28.7.orig/arch/mips/bcm47xx/Makefile     2009-03-17 17:26:19.000000000 +0100
++++ linux-2.6.28.7/arch/mips/bcm47xx/Makefile  2009-03-17 17:26:56.000000000 +0100
 @@ -3,4 +3,4 @@
  # under Linux.
  #
  
 -obj-y := gpio.o irq.o prom.o serial.o setup.o time.o wgt634u.o
 +obj-y := cfe_env.o gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o
-diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
---- a/arch/mips/bcm47xx/irq.c
-+++ b/arch/mips/bcm47xx/irq.c
+Index: linux-2.6.28.7/arch/mips/bcm47xx/irq.c
+===================================================================
+--- linux-2.6.28.7.orig/arch/mips/bcm47xx/irq.c        2009-03-17 17:26:19.000000000 +0100
++++ linux-2.6.28.7/arch/mips/bcm47xx/irq.c     2009-03-17 17:26:23.000000000 +0100
 @@ -1,5 +1,6 @@
  /*
   *  Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org>
@@ -48,9 +51,10 @@ diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
  void plat_irq_dispatch(void)
  {
        u32 cause;
-diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
---- a/arch/mips/bcm47xx/nvram.c
-+++ b/arch/mips/bcm47xx/nvram.c
+Index: linux-2.6.28.7/arch/mips/bcm47xx/nvram.c
+===================================================================
+--- linux-2.6.28.7.orig/arch/mips/bcm47xx/nvram.c      2009-03-17 17:26:19.000000000 +0100
++++ linux-2.6.28.7/arch/mips/bcm47xx/nvram.c   2009-03-17 17:26:23.000000000 +0100
 @@ -24,10 +24,10 @@
  #include <asm/io.h>
  #include <asm/uaccess.h>
@@ -64,7 +68,7 @@ diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
  
  static char nvram_buf[NVRAM_SPACE];
  static int cfe_env;
-@@ -36,7 +36,7 @@ extern char *cfe_env_get(char *nv_buf, const char *name);
+@@ -36,7 +36,7 @@ extern char *cfe_env_get(char *nv_buf, c
  /* Probe for NVRAM header */
  static void __init early_nvram_init(void)
  {
@@ -73,9 +77,10 @@ diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
        struct nvram_header *header;
        int i;
        u32 base, lim, off;
-diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
---- a/arch/mips/bcm47xx/setup.c
-+++ b/arch/mips/bcm47xx/setup.c
+Index: linux-2.6.28.7/arch/mips/bcm47xx/setup.c
+===================================================================
+--- linux-2.6.28.7.orig/arch/mips/bcm47xx/setup.c      2009-03-17 17:26:19.000000000 +0100
++++ linux-2.6.28.7/arch/mips/bcm47xx/setup.c   2009-03-17 17:26:23.000000000 +0100
 @@ -2,7 +2,7 @@
   *  Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org>
   *  Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
@@ -124,18 +129,44 @@ diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
  {
        int i = 0;
  
-@@ -73,52 +83,141 @@ static void str2eaddr(char *str, char *dest)
+@@ -73,52 +83,142 @@ static void str2eaddr(char *str, char *d
        }
  }
  
 -static int bcm47xx_get_invariants(struct ssb_bus *bus,
 -                                 struct ssb_init_invariants *iv)
 +static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
-+{
+ {
+-      char buf[100];
 +      char *s;
-+
+-      /* Fill boardinfo structure */
+-      memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
 +      memset(sprom, 0xFF, sizeof(struct ssb_sprom));
-+
+-      if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0)
+-              iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
+-      if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0)
+-              iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
+-      if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0)
+-              iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
+-
+-      /* Fill sprom structure */
+-      memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
+-      iv->sprom.revision = 3;
+-
+-      if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
+-              str2eaddr(buf, iv->sprom.et0mac);
+-      if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
+-              str2eaddr(buf, iv->sprom.et1mac);
+-      if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
+-              iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 10);
+-      if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
+-              iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 10);
+-      if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
+-              iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
+-      if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
+-              iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
 +      sprom->revision = 1;
 +      if ((s = nvram_get("il0macaddr")))
 +              e_aton(s, sprom->il0mac);
@@ -188,35 +219,7 @@ diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
 +}
 +
 +static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariants *iv)
- {
--      char buf[100];
--
--      /* Fill boardinfo structure */
--      memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
--
--      if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0)
--              iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
--      if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0)
--              iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
--      if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0)
--              iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
--
--      /* Fill sprom structure */
--      memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
--      iv->sprom.revision = 3;
--
--      if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
--              str2eaddr(buf, iv->sprom.et0mac);
--      if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
--              str2eaddr(buf, iv->sprom.et1mac);
--      if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
--              iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 10);
--      if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
--              iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 10);
--      if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
--              iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
--      if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
--              iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
++{
 +      char *s;
 +
 +      iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
@@ -247,15 +250,15 @@ diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
 +              panic(msg, err);
 +      }
 +      mcore = &ssb_bcm47xx.mipscore;
-+
-+      s = nvram_get("kernel_args");
-+      if (s && !strncmp(s, "console=ttyS1", 13)) {
-+              struct ssb_serial_port port;
  
 -      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);
++      s = nvram_get("kernel_args");
++      if (s && !strncmp(s, "console=ttyS1", 13)) {
++              struct ssb_serial_port port;
++
 +              printk("Swapping serial ports!\n");
 +              /* swap serial ports */
 +              memcpy(&port, &mcore->serial_ports[0], sizeof(port));
@@ -269,6 +272,7 @@ diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
 +
 +              memset(&s, 0, sizeof(s));
 +              s.line = i;
++              s.mapbase = (unsigned int) port->regs;
 +              s.membase = port->regs;
 +              s.irq = port->irq + 2;
 +              s.uartclk = port->baud_base;
@@ -301,9 +305,10 @@ diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
 +      return 0;
 +}
 +device_initcall(bcm47xx_register_gpiodev);
-diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
---- a/arch/mips/bcm47xx/time.c
-+++ b/arch/mips/bcm47xx/time.c
+Index: linux-2.6.28.7/arch/mips/bcm47xx/time.c
+===================================================================
+--- linux-2.6.28.7.orig/arch/mips/bcm47xx/time.c       2009-03-17 17:26:19.000000000 +0100
++++ linux-2.6.28.7/arch/mips/bcm47xx/time.c    2009-03-17 17:26:23.000000000 +0100
 @@ -22,11 +22,17 @@
   *  675 Mass Ave, Cambridge, MA 02139, USA.
   */