[brcm63xx] improve BCM6345 support
authorFlorian Fainelli <florian@openwrt.org>
Tue, 2 Aug 2011 18:55:46 +0000 (18:55 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Tue, 2 Aug 2011 18:55:46 +0000 (18:55 +0000)
- runtime detect the amount of memory available
- define EBI_BASE as MPI_BASE to get rid of chip-select specific hacks
- fix GPIO control

SVN-Revision: 27880

33 files changed:
target/linux/brcm63xx/patches-2.6.39/001-6345_cpu.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-2.6.39/007-usb-ohci-support.patch
target/linux/brcm63xx/patches-2.6.39/008-usb-ehci-support.patch
target/linux/brcm63xx/patches-2.6.39/040-bcm963xx_flashmap.patch
target/linux/brcm63xx/patches-2.6.39/100-reset_buttons.patch
target/linux/brcm63xx/patches-2.6.39/141-led_count.patch
target/linux/brcm63xx/patches-2.6.39/180-udc_preliminary_support.patch
target/linux/brcm63xx/patches-2.6.39/200-extended-platform-devices.patch
target/linux/brcm63xx/patches-2.6.39/200-spi-board-info.patch
target/linux/brcm63xx/patches-2.6.39/220-wl_exports.patch
target/linux/brcm63xx/patches-2.6.39/230-6358-enet1-external-mii-clk.patch
target/linux/brcm63xx/patches-2.6.39/240-spi.patch
target/linux/brcm63xx/patches-2.6.39/250-boardid_fixup.patch
target/linux/brcm63xx/patches-2.6.39/260-ssb_sprom_mac_pool.patch
target/linux/brcm63xx/patches-2.6.39/441-board-NB4.patch
target/linux/brcm63xx/patches-2.6.39/452-board_V2500V.patch
target/linux/brcm63xx/patches-2.6.39/500-ssb-add-callback-for-sprom.patch
target/linux/brcm63xx/patches-3.0/001-6345_cpu.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.0/007-usb-ohci-support.patch
target/linux/brcm63xx/patches-3.0/008-usb-ehci-support.patch
target/linux/brcm63xx/patches-3.0/040-bcm963xx_flashmap.patch
target/linux/brcm63xx/patches-3.0/100-reset_buttons.patch
target/linux/brcm63xx/patches-3.0/141-led_count.patch
target/linux/brcm63xx/patches-3.0/180-udc_preliminary_support.patch
target/linux/brcm63xx/patches-3.0/200-extended-platform-devices.patch
target/linux/brcm63xx/patches-3.0/200-spi-board-info.patch
target/linux/brcm63xx/patches-3.0/220-wl_exports.patch
target/linux/brcm63xx/patches-3.0/230-6358-enet1-external-mii-clk.patch
target/linux/brcm63xx/patches-3.0/240-spi.patch
target/linux/brcm63xx/patches-3.0/250-boardid_fixup.patch
target/linux/brcm63xx/patches-3.0/260-ssb_sprom_mac_pool.patch
target/linux/brcm63xx/patches-3.0/441-board-NB4.patch
target/linux/brcm63xx/patches-3.0/452-board_V2500V.patch

diff --git a/target/linux/brcm63xx/patches-2.6.39/001-6345_cpu.patch b/target/linux/brcm63xx/patches-2.6.39/001-6345_cpu.patch
new file mode 100644 (file)
index 0000000..b8cb016
--- /dev/null
@@ -0,0 +1,122 @@
+--- a/arch/mips/bcm63xx/cpu.c
++++ b/arch/mips/bcm63xx/cpu.c
+@@ -260,8 +260,10 @@ static unsigned int detect_memory_size(v
+       unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
+       u32 val;
+-      if (BCMCPU_IS_6345())
+-              return (8 * 1024 * 1024);
++      if (BCMCPU_IS_6345()) {
++              val = bcm_sdram_readl(SDRAM_MBASE_REG);
++              return (val * 8 * 1024 * 1024);
++      }
+       if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
+               val = bcm_sdram_readl(SDRAM_CFG_REG);
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+@@ -735,6 +735,8 @@
+ #define SDRAM_CFG_BANK_SHIFT          13
+ #define SDRAM_CFG_BANK_MASK           (1 << SDRAM_CFG_BANK_SHIFT)
++#define SDRAM_MBASE_REG                       0xc
++
+ #define SDRAM_PRIO_REG                        0x2C
+ #define SDRAM_PRIO_MIPS_SHIFT         29
+ #define SDRAM_PRIO_MIPS_MASK          (1 << SDRAM_PRIO_MIPS_SHIFT)
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -698,15 +698,9 @@ void __init board_prom_init(void)
+       char cfe_version[32];
+       u32 val;
+-      /* read base address of boot chip select (0)
+-       * 6345 does not have MPI but boots from standard
+-       * MIPS Flash address */
+-      if (BCMCPU_IS_6345())
+-              val = 0x1fc00000;
+-      else {
+-              val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+-              val &= MPI_CSBASE_BASE_MASK;
+-      }
++      /* read base address of boot chip select (0) */
++      val = bcm_mpi_readl(MPI_CSBASE_REG(0));
++      val &= MPI_CSBASE_BASE_MASK;
+       boot_addr = (u8 *)KSEG1ADDR(val);
+       /* dump cfe version */
+@@ -881,12 +875,9 @@ int __init board_register_devices(void)
+               bcm63xx_dsp_register(&board.dsp);
+       /* read base address of boot chip select (0) */
+-      if (BCMCPU_IS_6345())
+-              val = 0x1fc00000;
+-      else {
+-              val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+-              val &= MPI_CSBASE_BASE_MASK;
+-      }
++      val = bcm_mpi_readl(MPI_CSBASE_REG(0));
++      val &= MPI_CSBASE_BASE_MASK;
++
+       mtd_resources[0].start = val;
+       mtd_resources[0].end = 0x1FFFFFFF;
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+@@ -163,7 +163,7 @@ enum bcm63xx_regs_set {
+ #define BCM_6345_ENET0_BASE           (0xfffe1800)
+ #define BCM_6345_ENETDMA_BASE         (0xfffe2800)
+ #define BCM_6345_PCMCIA_BASE          (0xfffe2028)
+-#define BCM_6345_MPI_BASE             (0xdeadbeef)
++#define BCM_6345_MPI_BASE             (0xfffe2000)
+ #define BCM_6345_OHCI0_BASE           (0xfffe2100)
+ #define BCM_6345_OHCI_PRIV_BASE               (0xfffe2200)
+ #define BCM_6345_USBH_PRIV_BASE               (0xdeadbeef)
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -4,7 +4,7 @@
+  * for more details.
+  *
+  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+- * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
++ * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
+  */
+ #include <linux/kernel.h>
+@@ -33,7 +33,10 @@ static void bcm63xx_gpio_set(struct gpio
+               BUG();
+       if (gpio < 32) {
+-              reg = GPIO_DATA_LO_REG;
++              if (!BCMCPU_IS_6345())
++                      reg = GPIO_DATA_LO_REG;
++              else
++                      reg = GPIO_DATA_HI_REG;
+               mask = 1 << gpio;
+               v = &gpio_out_low;
+       } else {
+@@ -60,7 +63,10 @@ static int bcm63xx_gpio_get(struct gpio_
+               BUG();
+       if (gpio < 32) {
+-              reg = GPIO_DATA_LO_REG;
++              if (!BCMCPU_IS_6345())
++                      reg = GPIO_DATA_LO_REG;
++              else
++                      reg = GPIO_DATA_HI_REG;
+               mask = 1 << gpio;
+       } else {
+               reg = GPIO_DATA_HI_REG;
+@@ -125,7 +131,11 @@ static struct gpio_chip bcm63xx_gpio_chi
+ int __init bcm63xx_gpio_init(void)
+ {
+-      gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
++      if (!BCMCPU_IS_6345())
++              gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
++      else
++              gpio_out_low = bcm_gpio_readl(GPIO_DATA_HI_REG);
++
+       gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
+       bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
+       pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
index a70b5012e30680c3322cd4d908fc8cfe900fbd98..6ea57d9526ea1837778c5d5c6927f00ffb9b7882 100644 (file)
@@ -52,7 +52,7 @@ Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -877,6 +878,9 @@ int __init board_register_devices(void)
+@@ -871,6 +872,9 @@ int __init board_register_devices(void)
            !board_get_mac_address(board.enet1.mac_addr))
                bcm63xx_enet_register(1, &board.enet1);
  
index 0c236f0b7ca3aa59463c3c71065f34798c78e57a..b6810d5d5f2dc562167f78f8fe1c2661bbca3c71 100644 (file)
@@ -44,7 +44,7 @@ Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -878,6 +879,9 @@ int __init board_register_devices(void)
+@@ -872,6 +873,9 @@ int __init board_register_devices(void)
            !board_get_mac_address(board.enet1.mac_addr))
                bcm63xx_enet_register(1, &board.enet1);
  
index a2162302eaf760de3de9207869710a45bd41ab24..ec21ba7124d4c207e7022c9b7856e4d076e0e880 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org>
 
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -816,20 +816,6 @@ void __init board_setup(void)
+@@ -810,20 +810,6 @@ void __init board_setup(void)
                panic("unexpected CPU for bcm963xx board");
  }
  
@@ -33,7 +33,7 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org>
  static struct resource mtd_resources[] = {
        {
                .start          = 0,    /* filled at runtime */
-@@ -839,12 +825,9 @@ static struct resource mtd_resources[] =
+@@ -833,12 +819,9 @@ static struct resource mtd_resources[] =
  };
  
  static struct platform_device mtd_dev = {
index 786c18b77712efb4918f26de56c1eb4541a19afd..208ec55640c173a6e039a242d6b2a2e96cd7858b 100644 (file)
@@ -43,7 +43,7 @@
  };
  
  static struct board_info __initdata board_FAST2404 = {
-@@ -838,12 +860,23 @@ static struct platform_device bcm63xx_gp
+@@ -832,12 +854,23 @@ static struct platform_device bcm63xx_gp
        .dev.platform_data      = &bcm63xx_led_data,
  };
  
@@ -67,7 +67,7 @@
  
        if (board.has_uart0)
                bcm63xx_uart_register(0);
-@@ -888,5 +921,16 @@ int __init board_register_devices(void)
+@@ -879,5 +912,16 @@ int __init board_register_devices(void)
  
        platform_device_register(&bcm63xx_gpio_leds);
  
index 48aca11d45780920ab276fbcc84b58e94736d263..216f85797dc2c9f1b3b4aa9bb147000677aac902 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -877,6 +877,7 @@ int __init board_register_devices(void)
+@@ -871,6 +871,7 @@ int __init board_register_devices(void)
  {
        u32 val;
        int button_count = 0;
@@ -8,7 +8,7 @@
  
        if (board.has_uart0)
                bcm63xx_uart_register(0);
-@@ -916,7 +917,11 @@ int __init board_register_devices(void)
+@@ -907,7 +908,11 @@ int __init board_register_devices(void)
  
        platform_device_register(&mtd_dev);
  
index 9c9ffbbdd995ad7ff1852cdabb76ef0e497bd715..9c37c008d5e74496153c04161cf70f3ac0db9ffe 100644 (file)
@@ -17,7 +17,7 @@
  };
  
  static struct board_info __initdata board_rta1025w_16 = {
-@@ -905,6 +908,9 @@ int __init board_register_devices(void)
+@@ -899,6 +902,9 @@ int __init board_register_devices(void)
        if (board.has_dsp)
                bcm63xx_dsp_register(&board.dsp);
  
@@ -25,8 +25,8 @@
 +              bcm63xx_udc_register();
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 --- /dev/null
 +++ b/arch/mips/bcm63xx/dev-usb-udc.c
 @@ -0,0 +1,58 @@
index 12e431b285ec2c621a243b7865dff7690c594f99..e4e44b30818ca49649ce4ff30116667cb28c7e07 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -911,6 +911,9 @@ int __init board_register_devices(void)
+@@ -905,6 +905,9 @@ int __init board_register_devices(void)
        if (board.has_udc0)
                bcm63xx_udc_register();
  
@@ -8,8 +8,8 @@
 +              platform_add_devices(board.devs, board.num_devs);
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 @@ -61,6 +61,10 @@ struct board_info {
index 6205202912bd3b6b101aa6339f5d74ce083e8801..f66595276901250d6035b25b722cc25b4dc115ae 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -914,6 +914,9 @@ int __init board_register_devices(void)
+@@ -908,6 +908,9 @@ int __init board_register_devices(void)
        if (board.num_devs)
                platform_add_devices(board.devs, board.num_devs);
  
@@ -8,8 +8,8 @@
 +              spi_register_board_info(board.spis, board.num_spis);
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 @@ -65,6 +65,10 @@ struct board_info {
index 8cd87b8df795dc3861593aa279a3c89ef7ad2479..39bde43374a4e3a1e173a26a0daad0b054d10c0b 100644 (file)
@@ -14,7 +14,7 @@
   * known 6338 boards
   */
  #ifdef CONFIG_BCM63XX_CPU_6338
-@@ -747,6 +754,7 @@ void __init board_prom_init(void)
+@@ -741,6 +748,7 @@ void __init board_prom_init(void)
  
        /* extract nvram data */
        memcpy(&nvram, boot_addr + BCM963XX_NVRAM_OFFSET, sizeof(nvram));
index d859410b778841e87df37e5ad98022c7a92a277b..f4c1ed9a6d7b95f4772424c307bcf56d821cbfd5 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -818,6 +818,8 @@ void __init board_prom_init(void)
+@@ -812,6 +812,8 @@ void __init board_prom_init(void)
                if (BCMCPU_IS_6348())
                        val |= GPIO_MODE_6348_G3_EXT_MII |
                                GPIO_MODE_6348_G0_EXT_MII;
index 437d906388ecd717bc48d19a77eac5cc10226437..b30190ea3aeea206557311bd88481f2a9940baa8 100644 (file)
  #define BCM_6358_OHCI0_IRQ            (IRQ_INTERNAL_BASE + 5)
 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
-@@ -771,4 +771,116 @@
+@@ -773,4 +773,116 @@
  #define DMIPSPLLCFG_N2_SHIFT          29
  #define DMIPSPLLCFG_N2_MASK           (0x7 << DMIPSPLLCFG_N2_SHIFT)
  
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -927,6 +928,8 @@ int __init board_register_devices(void)
+@@ -921,6 +922,8 @@ int __init board_register_devices(void)
        if (board.num_spis)
                spi_register_board_info(board.spis, board.num_spis);
  
 +      bcm63xx_spi_register();
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
index 50e8016e3762da078146dddeff23d31bb8f66ff6..2035854c3a73010131902d6a43fd8850b5beeee3 100644 (file)
@@ -44,7 +44,7 @@
  /*
   * early init callback, read nvram data from flash and checksum it
   */
-@@ -771,6 +798,11 @@ void __init board_prom_init(void)
+@@ -765,6 +792,11 @@ void __init board_prom_init(void)
                return;
        }
  
index 40849c87d31daf070b1932529f3c039a3544428d..8dc7f248fd9fb63c0f6bc1a8978e594b7ad9bf16 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -856,17 +856,6 @@ void __init board_prom_init(void)
+@@ -850,17 +850,6 @@ void __init board_prom_init(void)
        }
  
        bcm_gpio_writel(val, GPIO_MODE_REG);
@@ -18,7 +18,7 @@
  }
  
  /*
-@@ -942,6 +931,18 @@ int __init board_register_devices(void)
+@@ -936,6 +925,18 @@ int __init board_register_devices(void)
            !board_get_mac_address(board.enet1.mac_addr))
                bcm63xx_enet_register(1, &board.enet1);
  
index 2fb7ff2726846c0cc18f548486bc788c9d5ad0b2..26a48c9d81ea3252fa0e208d95fc64742cf2aaad 100644 (file)
  /*
   * Register a sane SPROMv2 to make the on-board
   * bcm4318 WLAN work
-@@ -959,6 +1485,9 @@ void __init board_prom_init(void)
+@@ -953,6 +1479,9 @@ void __init board_prom_init(void)
                boardid_fixup(boot_addr);
        }
  
index 8ee99847bbec1dbe473dc65e2fcad54b318c8eca..dc1ba793de34f8fd8fc29bdace5320910aecd218 100644 (file)
@@ -72,9 +72,9 @@
  #endif
  
  #ifdef CONFIG_BCM63XX_CPU_6358
-@@ -2059,6 +2117,22 @@ void __init board_prom_init(void)
-               val &= MPI_CSBASE_BASE_MASK;
-       }
+@@ -2053,6 +2111,22 @@ void __init board_prom_init(void)
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
        boot_addr = (u8 *)KSEG1ADDR(val);
 +      printk(KERN_INFO PFX "Boot address 0x%08x\n",(unsigned int)boot_addr);
 +
  
        /* dump cfe version */
        cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
-@@ -2262,6 +2336,14 @@ int __init board_register_devices(void)
-               val = bcm_mpi_readl(MPI_CSBASE_REG(0));
-               val &= MPI_CSBASE_BASE_MASK;
-       }
-+
+@@ -2253,6 +2327,13 @@ int __init board_register_devices(void)
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 +      /* BT Voyager 2500V has 8 Meg flash in two 4 Meg banks
 +       * Loading from CFE always uses Bank 0 */
 +      if (!strcmp(board.name, "V2500V_BB")) {
index ab4b0e59a6ec4d025829c1a126537537db6ab445..1ac6f1ae54250d65dd99f155d1f50dfaf0291026 100644 (file)
@@ -18,7 +18,7 @@
  #endif
  
  /*
-@@ -2406,8 +2417,9 @@ int __init board_register_devices(void)
+@@ -2400,8 +2411,9 @@ int __init board_register_devices(void)
        if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
                memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
                memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
diff --git a/target/linux/brcm63xx/patches-3.0/001-6345_cpu.patch b/target/linux/brcm63xx/patches-3.0/001-6345_cpu.patch
new file mode 100644 (file)
index 0000000..4c5f14c
--- /dev/null
@@ -0,0 +1,122 @@
+--- a/arch/mips/bcm63xx/cpu.c
++++ b/arch/mips/bcm63xx/cpu.c
+@@ -260,8 +260,10 @@ static unsigned int detect_memory_size(v
+       unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
+       u32 val;
+-      if (BCMCPU_IS_6345())
+-              return (8 * 1024 * 1024);
++      if (BCMCPU_IS_6345()) {
++              val = bcm_sdram_readl(SDRAM_MBASE_REG);
++              return (val * 8 * 1024 * 1024);
++      }
+       if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
+               val = bcm_sdram_readl(SDRAM_CFG_REG);
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+@@ -735,6 +735,8 @@
+ #define SDRAM_CFG_BANK_SHIFT          13
+ #define SDRAM_CFG_BANK_MASK           (1 << SDRAM_CFG_BANK_SHIFT)
++#define SDRAM_MBASE_REG                       0xc
++
+ #define SDRAM_PRIO_REG                        0x2C
+ #define SDRAM_PRIO_MIPS_SHIFT         29
+ #define SDRAM_PRIO_MIPS_MASK          (1 << SDRAM_PRIO_MIPS_SHIFT)
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -709,15 +709,9 @@ void __init board_prom_init(void)
+       char cfe_version[32];
+       u32 val;
+-      /* read base address of boot chip select (0)
+-       * 6345 does not have MPI but boots from standard
+-       * MIPS Flash address */
+-      if (BCMCPU_IS_6345())
+-              val = 0x1fc00000;
+-      else {
+-              val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+-              val &= MPI_CSBASE_BASE_MASK;
+-      }
++      /* read base address of boot chip select (0) */
++      val = bcm_mpi_readl(MPI_CSBASE_REG(0));
++      val &= MPI_CSBASE_BASE_MASK;
+       boot_addr = (u8 *)KSEG1ADDR(val);
+       /* dump cfe version */
+@@ -893,12 +887,9 @@ int __init board_register_devices(void)
+               bcm63xx_dsp_register(&board.dsp);
+       /* read base address of boot chip select (0) */
+-      if (BCMCPU_IS_6345())
+-              val = 0x1fc00000;
+-      else {
+-              val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+-              val &= MPI_CSBASE_BASE_MASK;
+-      }
++      val = bcm_mpi_readl(MPI_CSBASE_REG(0));
++      val &= MPI_CSBASE_BASE_MASK;
++
+       mtd_resources[0].start = val;
+       mtd_resources[0].end = 0x1FFFFFFF;
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+@@ -163,7 +163,7 @@ enum bcm63xx_regs_set {
+ #define BCM_6345_ENET0_BASE           (0xfffe1800)
+ #define BCM_6345_ENETDMA_BASE         (0xfffe2800)
+ #define BCM_6345_PCMCIA_BASE          (0xfffe2028)
+-#define BCM_6345_MPI_BASE             (0xdeadbeef)
++#define BCM_6345_MPI_BASE             (0xfffe2000)
+ #define BCM_6345_OHCI0_BASE           (0xfffe2100)
+ #define BCM_6345_OHCI_PRIV_BASE               (0xfffe2200)
+ #define BCM_6345_USBH_PRIV_BASE               (0xdeadbeef)
+--- a/arch/mips/bcm63xx/gpio.c
++++ b/arch/mips/bcm63xx/gpio.c
+@@ -4,7 +4,7 @@
+  * for more details.
+  *
+  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+- * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
++ * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
+  */
+ #include <linux/kernel.h>
+@@ -33,7 +33,10 @@ static void bcm63xx_gpio_set(struct gpio
+               BUG();
+       if (gpio < 32) {
+-              reg = GPIO_DATA_LO_REG;
++              if (!BCMCPU_IS_6345())
++                      reg = GPIO_DATA_LO_REG;
++              else
++                      reg = GPIO_DATA_HI_REG;
+               mask = 1 << gpio;
+               v = &gpio_out_low;
+       } else {
+@@ -60,7 +63,10 @@ static int bcm63xx_gpio_get(struct gpio_
+               BUG();
+       if (gpio < 32) {
+-              reg = GPIO_DATA_LO_REG;
++              if (!BCMCPU_IS_6345())
++                      reg = GPIO_DATA_LO_REG;
++              else
++                      reg = GPIO_DATA_HI_REG;
+               mask = 1 << gpio;
+       } else {
+               reg = GPIO_DATA_HI_REG;
+@@ -125,7 +131,11 @@ static struct gpio_chip bcm63xx_gpio_chi
+ int __init bcm63xx_gpio_init(void)
+ {
+-      gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
++      if (!BCMCPU_IS_6345())
++              gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
++      else
++              gpio_out_low = bcm_gpio_readl(GPIO_DATA_HI_REG);
++
+       gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
+       bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
+       pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
index e4327afb2a7c6e194e5c3b66904eac24b4f3c6e2..b30b3d18ba62175bc724bf4dc4092f7b67cada89 100644 (file)
@@ -52,7 +52,7 @@ Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -889,6 +890,9 @@ int __init board_register_devices(void)
+@@ -883,6 +884,9 @@ int __init board_register_devices(void)
            !board_get_mac_address(board.enet1.mac_addr))
                bcm63xx_enet_register(1, &board.enet1);
  
index c044e52eaaee953c43f36bb644309abf54cff562..e7f1f47309e6cd3af2cf4c9a90069048bb56e918 100644 (file)
@@ -44,7 +44,7 @@ Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -890,6 +891,9 @@ int __init board_register_devices(void)
+@@ -884,6 +885,9 @@ int __init board_register_devices(void)
            !board_get_mac_address(board.enet1.mac_addr))
                bcm63xx_enet_register(1, &board.enet1);
  
index 6a352da29a52822046528d596680e0c1de1c6ca2..c8d257f90b99f9b09fa1b1da563226867e83afb7 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org>
 
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -828,20 +828,6 @@ void __init board_setup(void)
+@@ -822,20 +822,6 @@ void __init board_setup(void)
                panic("unexpected CPU for bcm963xx board");
  }
  
@@ -33,7 +33,7 @@ Signed-off-by: Axel Gembe <ago@bastart.eu.org>
  static struct resource mtd_resources[] = {
        {
                .start          = 0,    /* filled at runtime */
-@@ -851,12 +837,9 @@ static struct resource mtd_resources[] =
+@@ -845,12 +831,9 @@ static struct resource mtd_resources[] =
  };
  
  static struct platform_device mtd_dev = {
index 486054f9016f4d3ddc6225a74d839a07aa20dd25..f1f69f421ef939bdf933f16a563d04c4f6c9dc8d 100644 (file)
@@ -43,7 +43,7 @@
  };
  
  static struct board_info __initdata board_FAST2404 = {
-@@ -850,12 +872,23 @@ static struct platform_device bcm63xx_gp
+@@ -844,12 +866,23 @@ static struct platform_device bcm63xx_gp
        .dev.platform_data      = &bcm63xx_led_data,
  };
  
@@ -67,7 +67,7 @@
  
        if (board.has_uart0)
                bcm63xx_uart_register(0);
-@@ -900,5 +933,16 @@ int __init board_register_devices(void)
+@@ -891,5 +924,16 @@ int __init board_register_devices(void)
  
        platform_device_register(&bcm63xx_gpio_leds);
  
index 67bc9b25041954c1c1ae42a4f208e81b17078684..0e61d4d1d6c5f9c66cfd127b708bd1ccc1d723b5 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -889,6 +889,7 @@ int __init board_register_devices(void)
+@@ -883,6 +883,7 @@ int __init board_register_devices(void)
  {
        u32 val;
        int button_count = 0;
@@ -8,7 +8,7 @@
  
        if (board.has_uart0)
                bcm63xx_uart_register(0);
-@@ -928,7 +929,11 @@ int __init board_register_devices(void)
+@@ -919,7 +920,11 @@ int __init board_register_devices(void)
  
        platform_device_register(&mtd_dev);
  
index 255e3fb1f444afb441322a558548c461e2f6a588..2787742dcaecc5ea9830a3580b0da09464fbc1b0 100644 (file)
@@ -17,7 +17,7 @@
  };
  
  static struct board_info __initdata board_rta1025w_16 = {
-@@ -917,6 +920,9 @@ int __init board_register_devices(void)
+@@ -911,6 +914,9 @@ int __init board_register_devices(void)
        if (board.has_dsp)
                bcm63xx_dsp_register(&board.dsp);
  
@@ -25,8 +25,8 @@
 +              bcm63xx_udc_register();
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 --- /dev/null
 +++ b/arch/mips/bcm63xx/dev-usb-udc.c
 @@ -0,0 +1,58 @@
index c2c68792196292d3fbc58467ee3a9b1daa189263..2ec70c174c0af25ec70a63cc45f610c0cc487304 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -923,6 +923,9 @@ int __init board_register_devices(void)
+@@ -917,6 +917,9 @@ int __init board_register_devices(void)
        if (board.has_udc0)
                bcm63xx_udc_register();
  
@@ -8,8 +8,8 @@
 +              platform_add_devices(board.devs, board.num_devs);
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 @@ -61,6 +61,10 @@ struct board_info {
index b63e713992eee4712ddea455e5f3e4a38244b261..b82032fdae0519703316ad3ede0ecbcc54a6922b 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -926,6 +926,9 @@ int __init board_register_devices(void)
+@@ -920,6 +920,9 @@ int __init board_register_devices(void)
        if (board.num_devs)
                platform_add_devices(board.devs, board.num_devs);
  
@@ -8,8 +8,8 @@
 +              spi_register_board_info(board.spis, board.num_spis);
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 @@ -65,6 +65,10 @@ struct board_info {
index 2e43006c37e1b1b3faa25ecd18365aa07d21e5c2..fbf28adb196e6fd2bbaa1419e7ade4e0f981ccf8 100644 (file)
@@ -14,7 +14,7 @@
   * known 6338 boards
   */
  #ifdef CONFIG_BCM63XX_CPU_6338
-@@ -758,6 +765,7 @@ void __init board_prom_init(void)
+@@ -752,6 +759,7 @@ void __init board_prom_init(void)
  
        /* extract nvram data */
        memcpy(&nvram, boot_addr + BCM963XX_NVRAM_OFFSET, sizeof(nvram));
index 58fa7093710f565e8fa221ef91bf107b1404df26..8aba4130c0bcb950483bbee0a27520a15bc3ba9e 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -829,6 +829,8 @@ void __init board_prom_init(void)
+@@ -823,6 +823,8 @@ void __init board_prom_init(void)
                if (BCMCPU_IS_6348())
                        val |= GPIO_MODE_6348_G3_EXT_MII |
                                GPIO_MODE_6348_G0_EXT_MII;
index 5e3f1f51c05bacc7ba6c3892dc16b7c99cc1b1da..73d10481a5fcad2620adb735777256bf5fb59268 100644 (file)
  #define BCM_6358_OHCI0_IRQ            (IRQ_INTERNAL_BASE + 5)
 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
-@@ -771,4 +771,116 @@
+@@ -773,4 +773,116 @@
  #define DMIPSPLLCFG_N2_SHIFT          29
  #define DMIPSPLLCFG_N2_MASK           (0x7 << DMIPSPLLCFG_N2_SHIFT)
  
  #include <board_bcm963xx.h>
  
  #define PFX   "board_bcm963xx: "
-@@ -939,6 +940,8 @@ int __init board_register_devices(void)
+@@ -933,6 +934,8 @@ int __init board_register_devices(void)
        if (board.num_spis)
                spi_register_board_info(board.spis, board.num_spis);
  
 +      bcm63xx_spi_register();
 +
        /* read base address of boot chip select (0) */
-       if (BCMCPU_IS_6345())
-               val = 0x1fc00000;
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
index 36a5805141aa8c44eaaa522d5211abadd588be7f..a80a23fae33b4f1cf479e5163a279aba4a613cc5 100644 (file)
@@ -44,7 +44,7 @@
  /*
   * early init callback, read nvram data from flash and checksum it
   */
-@@ -782,6 +809,11 @@ void __init board_prom_init(void)
+@@ -776,6 +803,11 @@ void __init board_prom_init(void)
                return;
        }
  
index c76b43d96d1830f9a7ce57a0ab2aad7f13a011ef..6321ed1c637034eef16e8d8558df7d7a18682d19 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -867,18 +867,6 @@ void __init board_prom_init(void)
+@@ -861,18 +861,6 @@ void __init board_prom_init(void)
        }
  
        bcm_gpio_writel(val, GPIO_MODE_REG);
@@ -19,7 +19,7 @@
  }
  
  /*
-@@ -954,6 +942,19 @@ int __init board_register_devices(void)
+@@ -948,6 +936,19 @@ int __init board_register_devices(void)
            !board_get_mac_address(board.enet1.mac_addr))
                bcm63xx_enet_register(1, &board.enet1);
  
index 8dec89289663b27535902efea8266c89c4eebe0d..b2fb0e2fce2ab3faa83d3b01accf493ff4205c5d 100644 (file)
  /*
   * Register a sane SPROMv2 to make the on-board
   * bcm4318 WLAN work
-@@ -970,6 +1496,9 @@ void __init board_prom_init(void)
+@@ -964,6 +1490,9 @@ void __init board_prom_init(void)
                boardid_fixup(boot_addr);
        }
  
index 12d03f3f70eb740e62544198d469770faacd379a..f28a10d6ccbb391ab85fbb9900a5f741c7a87f98 100644 (file)
@@ -72,9 +72,9 @@
  #endif
  
  #ifdef CONFIG_BCM63XX_CPU_6358
-@@ -2070,6 +2128,22 @@ void __init board_prom_init(void)
-               val &= MPI_CSBASE_BASE_MASK;
-       }
+@@ -2064,6 +2122,22 @@ void __init board_prom_init(void)
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
        boot_addr = (u8 *)KSEG1ADDR(val);
 +      printk(KERN_INFO PFX "Boot address 0x%08x\n",(unsigned int)boot_addr);
 +
  
        /* dump cfe version */
        cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
-@@ -2274,6 +2348,14 @@ int __init board_register_devices(void)
-               val = bcm_mpi_readl(MPI_CSBASE_REG(0));
-               val &= MPI_CSBASE_BASE_MASK;
-       }
-+
+@@ -2265,6 +2339,13 @@ int __init board_register_devices(void)
+       val = bcm_mpi_readl(MPI_CSBASE_REG(0));
+       val &= MPI_CSBASE_BASE_MASK;
 +      /* BT Voyager 2500V has 8 Meg flash in two 4 Meg banks */
 +      /* Loading from CFE always uses Bank 0 */
 +      if (!strcmp(board.name, "V2500V_BB")) {
 +              printk(KERN_INFO PFX "V2500V: Start in Bank 0\n");
 +              val = val + 0x400000; // Select Bank 0 start address
-+              }
++      }
 +
        mtd_resources[0].start = val;
        mtd_resources[0].end = 0x1FFFFFFF;