From 11c412877095f3d6e754038a6c83be278d613393 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 2 Aug 2011 18:55:46 +0000 Subject: [PATCH] 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 --- .../patches-2.6.39/001-6345_cpu.patch | 122 ++++++++++++++++++ .../patches-2.6.39/007-usb-ohci-support.patch | 2 +- .../patches-2.6.39/008-usb-ehci-support.patch | 2 +- .../040-bcm963xx_flashmap.patch | 4 +- .../patches-2.6.39/100-reset_buttons.patch | 4 +- .../patches-2.6.39/141-led_count.patch | 4 +- .../180-udc_preliminary_support.patch | 6 +- .../200-extended-platform-devices.patch | 6 +- .../patches-2.6.39/200-spi-board-info.patch | 6 +- .../patches-2.6.39/220-wl_exports.patch | 2 +- .../230-6358-enet1-external-mii-clk.patch | 2 +- .../brcm63xx/patches-2.6.39/240-spi.patch | 8 +- .../patches-2.6.39/250-boardid_fixup.patch | 2 +- .../260-ssb_sprom_mac_pool.patch | 4 +- .../patches-2.6.39/441-board-NB4.patch | 2 +- .../patches-2.6.39/452-board_V2500V.patch | 15 +-- .../500-ssb-add-callback-for-sprom.patch | 2 +- .../brcm63xx/patches-3.0/001-6345_cpu.patch | 122 ++++++++++++++++++ .../patches-3.0/007-usb-ohci-support.patch | 2 +- .../patches-3.0/008-usb-ehci-support.patch | 2 +- .../patches-3.0/040-bcm963xx_flashmap.patch | 4 +- .../patches-3.0/100-reset_buttons.patch | 4 +- .../brcm63xx/patches-3.0/141-led_count.patch | 4 +- .../180-udc_preliminary_support.patch | 6 +- .../200-extended-platform-devices.patch | 6 +- .../patches-3.0/200-spi-board-info.patch | 6 +- .../brcm63xx/patches-3.0/220-wl_exports.patch | 2 +- .../230-6358-enet1-external-mii-clk.patch | 2 +- .../linux/brcm63xx/patches-3.0/240-spi.patch | 8 +- .../patches-3.0/250-boardid_fixup.patch | 2 +- .../patches-3.0/260-ssb_sprom_mac_pool.patch | 4 +- .../brcm63xx/patches-3.0/441-board-NB4.patch | 2 +- .../patches-3.0/452-board_V2500V.patch | 17 ++- 33 files changed, 314 insertions(+), 72 deletions(-) create mode 100644 target/linux/brcm63xx/patches-2.6.39/001-6345_cpu.patch create mode 100644 target/linux/brcm63xx/patches-3.0/001-6345_cpu.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 index 000000000000..b8cb016fb810 --- /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 +- * Copyright (C) 2008 Florian Fainelli ++ * Copyright (C) 2008-2011 Florian Fainelli + */ + + #include +@@ -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 a70b5012e306..6ea57d9526ea 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 #include #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 0c236f0b7ca3..b6810d5d5f2d 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 #include #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 a2162302eaf7..ec21ba7124d4 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 --- 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 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 786c18b77712..208ec55640c1 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 48aca11d4578..216f85797dc2 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 9c9ffbbdd995..9c37c008d5e7 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 12e431b285ec..e4e44b30818c 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 6205202912bd..f66595276901 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 8cd87b8df795..39bde43374a4 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 d859410b7788..f4c1ed9a6d7b 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 437d906388ec..b30190ea3aee 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 #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 50e8016e3762..2035854c3a73 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 40849c87d31d..8dc7f248fd9f 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 2fb7ff272684..26a48c9d81ea 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 8ee99847bbec..dc1ba793de34 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 ab4b0e59a6ec..1ac6f1ae5425 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 000000000000..4c5f14c61455 --- /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 +- * Copyright (C) 2008 Florian Fainelli ++ * Copyright (C) 2008-2011 Florian Fainelli + */ + + #include +@@ -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 e4327afb2a7c..b30b3d18ba62 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 #include #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 c044e52eaaee..e7f1f47309e6 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 #include #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 6a352da29a52..c8d257f90b99 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 --- 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 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 486054f9016f..f1f69f421ef9 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 67bc9b250419..0e61d4d1d6c5 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 255e3fb1f444..2787742dcaec 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 c2c687921962..2ec70c174c0a 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 b63e713992ee..b82032fdae05 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 2e43006c37e1..fbf28adb196e 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 58fa7093710f..8aba4130c0bc 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 5e3f1f51c05b..73d10481a5fc 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 #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 36a5805141aa..a80a23fae33b 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 c76b43d96d18..6321ed1c6370 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 8dec89289663..b2fb0e2fce2a 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 12d03f3f70eb..f28a10d6ccbb 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; -- 2.30.2