diff options
author | Florian Fainelli <florian@openwrt.org> | 2011-08-02 18:55:46 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2011-08-02 18:55:46 +0000 |
commit | 11c412877095f3d6e754038a6c83be278d613393 (patch) | |
tree | 34330b9634559b8673054e75fd941fafaf2038d2 /target/linux | |
parent | c4af036ec73d84d04e5299f5749cc5103988b15f (diff) | |
download | mtk-20170518-11c412877095f3d6e754038a6c83be278d613393.zip mtk-20170518-11c412877095f3d6e754038a6c83be278d613393.tar.gz mtk-20170518-11c412877095f3d6e754038a6c83be278d613393.tar.bz2 |
improve BCM6345 support
- 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
Diffstat (limited to 'target/linux')
33 files changed, 314 insertions, 72 deletions
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 index 0000000..b8cb016 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.39/001-6345_cpu.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-2.6.39/007-usb-ohci-support.patch b/target/linux/brcm63xx/patches-2.6.39/007-usb-ohci-support.patch index a70b501..6ea57d9 100644 --- a/target/linux/brcm63xx/patches-2.6.39/007-usb-ohci-support.patch +++ b/target/linux/brcm63xx/patches-2.6.39/007-usb-ohci-support.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-2.6.39/008-usb-ehci-support.patch b/target/linux/brcm63xx/patches-2.6.39/008-usb-ehci-support.patch index 0c236f0..b6810d5 100644 --- a/target/linux/brcm63xx/patches-2.6.39/008-usb-ehci-support.patch +++ b/target/linux/brcm63xx/patches-2.6.39/008-usb-ehci-support.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-2.6.39/040-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-2.6.39/040-bcm963xx_flashmap.patch index a216230..ec21ba7 100644 --- a/target/linux/brcm63xx/patches-2.6.39/040-bcm963xx_flashmap.patch +++ b/target/linux/brcm63xx/patches-2.6.39/040-bcm963xx_flashmap.patch @@ -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 = { diff --git a/target/linux/brcm63xx/patches-2.6.39/100-reset_buttons.patch b/target/linux/brcm63xx/patches-2.6.39/100-reset_buttons.patch index 786c18b..208ec55 100644 --- a/target/linux/brcm63xx/patches-2.6.39/100-reset_buttons.patch +++ b/target/linux/brcm63xx/patches-2.6.39/100-reset_buttons.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-2.6.39/141-led_count.patch b/target/linux/brcm63xx/patches-2.6.39/141-led_count.patch index 48aca11..216f857 100644 --- a/target/linux/brcm63xx/patches-2.6.39/141-led_count.patch +++ b/target/linux/brcm63xx/patches-2.6.39/141-led_count.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-2.6.39/180-udc_preliminary_support.patch b/target/linux/brcm63xx/patches-2.6.39/180-udc_preliminary_support.patch index 9c9ffbb..9c37c00 100644 --- a/target/linux/brcm63xx/patches-2.6.39/180-udc_preliminary_support.patch +++ b/target/linux/brcm63xx/patches-2.6.39/180-udc_preliminary_support.patch @@ -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 @@ diff --git a/target/linux/brcm63xx/patches-2.6.39/200-extended-platform-devices.patch b/target/linux/brcm63xx/patches-2.6.39/200-extended-platform-devices.patch index 12e431b..e4e44b3 100644 --- a/target/linux/brcm63xx/patches-2.6.39/200-extended-platform-devices.patch +++ b/target/linux/brcm63xx/patches-2.6.39/200-extended-platform-devices.patch @@ -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 { diff --git a/target/linux/brcm63xx/patches-2.6.39/200-spi-board-info.patch b/target/linux/brcm63xx/patches-2.6.39/200-spi-board-info.patch index 6205202..f665952 100644 --- a/target/linux/brcm63xx/patches-2.6.39/200-spi-board-info.patch +++ b/target/linux/brcm63xx/patches-2.6.39/200-spi-board-info.patch @@ -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 { diff --git a/target/linux/brcm63xx/patches-2.6.39/220-wl_exports.patch b/target/linux/brcm63xx/patches-2.6.39/220-wl_exports.patch index 8cd87b8..39bde43 100644 --- a/target/linux/brcm63xx/patches-2.6.39/220-wl_exports.patch +++ b/target/linux/brcm63xx/patches-2.6.39/220-wl_exports.patch @@ -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)); diff --git a/target/linux/brcm63xx/patches-2.6.39/230-6358-enet1-external-mii-clk.patch b/target/linux/brcm63xx/patches-2.6.39/230-6358-enet1-external-mii-clk.patch index d859410..f4c1ed9 100644 --- a/target/linux/brcm63xx/patches-2.6.39/230-6358-enet1-external-mii-clk.patch +++ b/target/linux/brcm63xx/patches-2.6.39/230-6358-enet1-external-mii-clk.patch @@ -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; diff --git a/target/linux/brcm63xx/patches-2.6.39/240-spi.patch b/target/linux/brcm63xx/patches-2.6.39/240-spi.patch index 437d906..b30190e 100644 --- a/target/linux/brcm63xx/patches-2.6.39/240-spi.patch +++ b/target/linux/brcm63xx/patches-2.6.39/240-spi.patch @@ -170,7 +170,7 @@ #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) @@ -919,12 +919,12 @@ #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; diff --git a/target/linux/brcm63xx/patches-2.6.39/250-boardid_fixup.patch b/target/linux/brcm63xx/patches-2.6.39/250-boardid_fixup.patch index 50e8016..2035854 100644 --- a/target/linux/brcm63xx/patches-2.6.39/250-boardid_fixup.patch +++ b/target/linux/brcm63xx/patches-2.6.39/250-boardid_fixup.patch @@ -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; } diff --git a/target/linux/brcm63xx/patches-2.6.39/260-ssb_sprom_mac_pool.patch b/target/linux/brcm63xx/patches-2.6.39/260-ssb_sprom_mac_pool.patch index 40849c8..8dc7f24 100644 --- a/target/linux/brcm63xx/patches-2.6.39/260-ssb_sprom_mac_pool.patch +++ b/target/linux/brcm63xx/patches-2.6.39/260-ssb_sprom_mac_pool.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-2.6.39/441-board-NB4.patch b/target/linux/brcm63xx/patches-2.6.39/441-board-NB4.patch index 2fb7ff2..26a48c9 100644 --- a/target/linux/brcm63xx/patches-2.6.39/441-board-NB4.patch +++ b/target/linux/brcm63xx/patches-2.6.39/441-board-NB4.patch @@ -557,7 +557,7 @@ /* * 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); } diff --git a/target/linux/brcm63xx/patches-2.6.39/452-board_V2500V.patch b/target/linux/brcm63xx/patches-2.6.39/452-board_V2500V.patch index 8ee9984..dc1ba79 100644 --- a/target/linux/brcm63xx/patches-2.6.39/452-board_V2500V.patch +++ b/target/linux/brcm63xx/patches-2.6.39/452-board_V2500V.patch @@ -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); + @@ -95,11 +95,10 @@ /* 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")) { diff --git a/target/linux/brcm63xx/patches-2.6.39/500-ssb-add-callback-for-sprom.patch b/target/linux/brcm63xx/patches-2.6.39/500-ssb-add-callback-for-sprom.patch index ab4b0e5..1ac6f1a 100644 --- a/target/linux/brcm63xx/patches-2.6.39/500-ssb-add-callback-for-sprom.patch +++ b/target/linux/brcm63xx/patches-2.6.39/500-ssb-add-callback-for-sprom.patch @@ -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 index 0000000..4c5f14c --- /dev/null +++ b/target/linux/brcm63xx/patches-3.0/001-6345_cpu.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.0/007-usb-ohci-support.patch b/target/linux/brcm63xx/patches-3.0/007-usb-ohci-support.patch index e4327af..b30b3d1 100644 --- a/target/linux/brcm63xx/patches-3.0/007-usb-ohci-support.patch +++ b/target/linux/brcm63xx/patches-3.0/007-usb-ohci-support.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.0/008-usb-ehci-support.patch b/target/linux/brcm63xx/patches-3.0/008-usb-ehci-support.patch index c044e52..e7f1f47 100644 --- a/target/linux/brcm63xx/patches-3.0/008-usb-ehci-support.patch +++ b/target/linux/brcm63xx/patches-3.0/008-usb-ehci-support.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.0/040-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-3.0/040-bcm963xx_flashmap.patch index 6a352da..c8d257f 100644 --- a/target/linux/brcm63xx/patches-3.0/040-bcm963xx_flashmap.patch +++ b/target/linux/brcm63xx/patches-3.0/040-bcm963xx_flashmap.patch @@ -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 = { diff --git a/target/linux/brcm63xx/patches-3.0/100-reset_buttons.patch b/target/linux/brcm63xx/patches-3.0/100-reset_buttons.patch index 486054f..f1f69f4 100644 --- a/target/linux/brcm63xx/patches-3.0/100-reset_buttons.patch +++ b/target/linux/brcm63xx/patches-3.0/100-reset_buttons.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.0/141-led_count.patch b/target/linux/brcm63xx/patches-3.0/141-led_count.patch index 67bc9b2..0e61d4d 100644 --- a/target/linux/brcm63xx/patches-3.0/141-led_count.patch +++ b/target/linux/brcm63xx/patches-3.0/141-led_count.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.0/180-udc_preliminary_support.patch b/target/linux/brcm63xx/patches-3.0/180-udc_preliminary_support.patch index 255e3fb..2787742 100644 --- a/target/linux/brcm63xx/patches-3.0/180-udc_preliminary_support.patch +++ b/target/linux/brcm63xx/patches-3.0/180-udc_preliminary_support.patch @@ -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 @@ diff --git a/target/linux/brcm63xx/patches-3.0/200-extended-platform-devices.patch b/target/linux/brcm63xx/patches-3.0/200-extended-platform-devices.patch index c2c6879..2ec70c1 100644 --- a/target/linux/brcm63xx/patches-3.0/200-extended-platform-devices.patch +++ b/target/linux/brcm63xx/patches-3.0/200-extended-platform-devices.patch @@ -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 { diff --git a/target/linux/brcm63xx/patches-3.0/200-spi-board-info.patch b/target/linux/brcm63xx/patches-3.0/200-spi-board-info.patch index b63e713..b82032f 100644 --- a/target/linux/brcm63xx/patches-3.0/200-spi-board-info.patch +++ b/target/linux/brcm63xx/patches-3.0/200-spi-board-info.patch @@ -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 { diff --git a/target/linux/brcm63xx/patches-3.0/220-wl_exports.patch b/target/linux/brcm63xx/patches-3.0/220-wl_exports.patch index 2e43006..fbf28ad 100644 --- a/target/linux/brcm63xx/patches-3.0/220-wl_exports.patch +++ b/target/linux/brcm63xx/patches-3.0/220-wl_exports.patch @@ -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)); diff --git a/target/linux/brcm63xx/patches-3.0/230-6358-enet1-external-mii-clk.patch b/target/linux/brcm63xx/patches-3.0/230-6358-enet1-external-mii-clk.patch index 58fa709..8aba413 100644 --- a/target/linux/brcm63xx/patches-3.0/230-6358-enet1-external-mii-clk.patch +++ b/target/linux/brcm63xx/patches-3.0/230-6358-enet1-external-mii-clk.patch @@ -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; diff --git a/target/linux/brcm63xx/patches-3.0/240-spi.patch b/target/linux/brcm63xx/patches-3.0/240-spi.patch index 5e3f1f5..73d1048 100644 --- a/target/linux/brcm63xx/patches-3.0/240-spi.patch +++ b/target/linux/brcm63xx/patches-3.0/240-spi.patch @@ -170,7 +170,7 @@ #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) @@ -919,12 +919,12 @@ #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; diff --git a/target/linux/brcm63xx/patches-3.0/250-boardid_fixup.patch b/target/linux/brcm63xx/patches-3.0/250-boardid_fixup.patch index 36a5805..a80a23f 100644 --- a/target/linux/brcm63xx/patches-3.0/250-boardid_fixup.patch +++ b/target/linux/brcm63xx/patches-3.0/250-boardid_fixup.patch @@ -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; } diff --git a/target/linux/brcm63xx/patches-3.0/260-ssb_sprom_mac_pool.patch b/target/linux/brcm63xx/patches-3.0/260-ssb_sprom_mac_pool.patch index c76b43d..6321ed1 100644 --- a/target/linux/brcm63xx/patches-3.0/260-ssb_sprom_mac_pool.patch +++ b/target/linux/brcm63xx/patches-3.0/260-ssb_sprom_mac_pool.patch @@ -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); diff --git a/target/linux/brcm63xx/patches-3.0/441-board-NB4.patch b/target/linux/brcm63xx/patches-3.0/441-board-NB4.patch index 8dec892..b2fb0e2 100644 --- a/target/linux/brcm63xx/patches-3.0/441-board-NB4.patch +++ b/target/linux/brcm63xx/patches-3.0/441-board-NB4.patch @@ -557,7 +557,7 @@ /* * 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); } diff --git a/target/linux/brcm63xx/patches-3.0/452-board_V2500V.patch b/target/linux/brcm63xx/patches-3.0/452-board_V2500V.patch index 12d03f3..f28a10d 100644 --- a/target/linux/brcm63xx/patches-3.0/452-board_V2500V.patch +++ b/target/linux/brcm63xx/patches-3.0/452-board_V2500V.patch @@ -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); + @@ -95,17 +95,16 @@ /* 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; |