Fix brcm63xx support. Now a kernel is booting, detecting the flash, and can probably mount a filesystem Huge thanks to Nico Huber for providing working patches !

SVN-Revision: 4117
lede-17.01
Florian Fainelli 2006-07-07 21:04:02 +00:00
parent aab4d0e3cf
commit 574b94a06b
12 changed files with 16814 additions and 48745 deletions

View File

@ -6,9 +6,9 @@
#
include $(TOPDIR)/rules.mk
LINUX_VERSION:=2.6.8.1
LINUX_VERSION:=2.6.16.7
LINUX_RELEASE:=1
LINUX_KERNEL_MD5SUM:=9517ca999e822b898fbdc7e72796b1aa
LINUX_KERNEL_MD5SUM:=9682b2bd6e02f3087982d7c3f5ba824e
include ./config
include $(INCLUDE_DIR)/kernel.mk
@ -19,6 +19,5 @@ $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
#[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
@$(CP) config $(LINUX_DIR)/.config
@$(CP) ./files/built-in.o $(LINUX_DIR)/bcmdrivers/broadcom/
touch $@

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,143 @@
diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/Kconfig linux-2.6.16.7-patched/arch/mips/Kconfig
--- linux-2.6.16.7-generic-patched/arch/mips/Kconfig 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/Kconfig 2006-07-05 15:21:58.000000000 +0200
@@ -10,7 +10,16 @@ menu "Machine selection"
choice
prompt "System type"
- default SGI_IP22
+ default MIPS_BRCM
+
+config MIPS_BRCM
+ bool "Support for the Broadcom boards"
+ select SYS_SUPPORTS_32BIT_KERNEL
+ select SYS_SUPPORTS_BIG_ENDIAN
+ select SYS_HAS_CPU_MIPS32_R1
+ select IRQ_CPU
+ help
+ This is a fmaily of boards based on the Broadcom MIPS32
config MIPS_MTX1
bool "Support for 4G Systems MTX-1 board"
@@ -777,6 +786,7 @@ config TOSHIBA_RBTX4938
endchoice
+source "arch/mips/brcm-boards/bcm963xx/Kconfig"
source "arch/mips/ddb5xxx/Kconfig"
source "arch/mips/gt64120/ev64120/Kconfig"
source "arch/mips/jazz/Kconfig"
@@ -1046,7 +1056,7 @@ menu "CPU selection"
choice
prompt "CPU type"
- default CPU_R4X00
+ default CPU_MIPS32_R1
config CPU_MIPS32_R1
bool "MIPS32 Release 1"
diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/Makefile linux-2.6.16.7-patched/arch/mips/Makefile
--- linux-2.6.16.7-generic-patched/arch/mips/Makefile 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/Makefile 2006-07-05 15:21:58.000000000 +0200
@@ -279,6 +279,20 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s
#
#
+# Broadcom board
+#
+core-$(CONFIG_MIPS_BRCM) += arch/mips/brcm-boards/generic/ arch/mips/brcm-boards/bcm963xx/
+core-$(CONFIG_MIPS_BRCM) += bcmdrivers/opensource/char/serial/impl1/
+#core-$(CONFIG_MIPS_BRCM) += bcmdrivers/opensource/char/board/bcm963xx/impl1/
+#core-$(CONFIG_MIPS_BRCM) += boardparms/bcm963xx/
+cflags-$(CONFIG_MIPS_BRCM) += -Iinclude/asm-mips/mach-bcm963xx
+cflags-$(CONFIG_MIPS_BRCM) += -Iarch/mips/brcm-boards/generic/include
+cflags-$(CONFIG_MIPS_BRCM) += -Ibcmdrivers/opensource/include/bcm963xx
+cflags-$(CONFIG_MIPS_BRCM) += -Iboardparms/bcm963xx
+load-$(CONFIG_MIPS_BRCM) += 0xffffffff80010000
+
+
+#
# Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
#
core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/kernel/cpu-probe.c linux-2.6.16.7-patched/arch/mips/kernel/cpu-probe.c
--- linux-2.6.16.7-generic-patched/arch/mips/kernel/cpu-probe.c 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/kernel/cpu-probe.c 2006-07-05 15:21:58.000000000 +0200
@@ -558,6 +558,25 @@ static inline void decode_configs(struct
return;
}
+static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
+{
+ decode_configs(c);
+ switch (c->processor_id & 0xff00) {
+ case PRID_IMP_BCM6338:
+ c->cputype = CPU_BCM6338;
+ break;
+ case PRID_IMP_BCM6345:
+ c->cputype = CPU_BCM6345;
+ break;
+ case PRID_IMP_BCM6348:
+ c->cputype = CPU_BCM6348;
+ break;
+ default:
+ c->cputype = CPU_UNKNOWN;
+ break;
+ }
+}
+
static inline void cpu_probe_mips(struct cpuinfo_mips *c)
{
decode_configs(c);
@@ -691,6 +710,9 @@ __init void cpu_probe(void)
case PRID_COMP_LEGACY:
cpu_probe_legacy(c);
break;
+ case PRID_COMP_BROADCOM:
+ cpu_probe_broadcom(c);
+ break;
case PRID_COMP_MIPS:
cpu_probe_mips(c);
break;
diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/kernel/proc.c linux-2.6.16.7-patched/arch/mips/kernel/proc.c
--- linux-2.6.16.7-generic-patched/arch/mips/kernel/proc.c 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/kernel/proc.c 2006-07-05 15:21:58.000000000 +0200
@@ -81,6 +81,9 @@ static const char *cpu_name[] = {
[CPU_VR4133] = "NEC VR4133",
[CPU_VR4181] = "NEC VR4181",
[CPU_VR4181A] = "NEC VR4181A",
+ [CPU_BCM6338] = "BCM6338",
+ [CPU_BCM6345] = "BCM6345",
+ [CPU_BCM6348] = "BCM6348",
[CPU_SR71000] = "Sandcraft SR71000",
[CPU_PR4450] = "Philips PR4450",
};
diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/mm/c-r4k.c linux-2.6.16.7-patched/arch/mips/mm/c-r4k.c
--- linux-2.6.16.7-generic-patched/arch/mips/mm/c-r4k.c 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/mm/c-r4k.c 2006-07-05 15:21:58.000000000 +0200
@@ -889,6 +889,12 @@ static void __init probe_pcache(void)
if (!(config & MIPS_CONF_M))
panic("Don't know how to probe P-caches on this cpu.");
+ if (c->cputype == CPU_BCM6338 || c->cputype == CPU_BCM6345 || c->cputype == CPU_BCM6348){
+ printk("brcm mips: enabling icache and dcache...\n");
+ /* Enable caches */
+ write_c0_diag(read_c0_diag() | 0xC0000000);
+ }
+
/*
* So we seem to be a MIPS32 or MIPS64 CPU
* So let's probe the I-cache ...
diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/mm/tlbex.c linux-2.6.16.7-patched/arch/mips/mm/tlbex.c
--- linux-2.6.16.7-generic-patched/arch/mips/mm/tlbex.c 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/mm/tlbex.c 2006-07-05 15:21:58.000000000 +0200
@@ -858,6 +858,9 @@ static __init void build_tlb_write_entry
case CPU_4KSC:
case CPU_20KC:
case CPU_25KF:
+ case CPU_BCM6338:
+ case CPU_BCM6345:
+ case CPU_BCM6348:
tlbw(p);
break;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,438 @@
diff -Naurp linux-2.6.16.7-generic-patched/arch/mips/pci/Makefile linux-2.6.16.7-patched/arch/mips/pci/Makefile
--- linux-2.6.16.7-generic-patched/arch/mips/pci/Makefile 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/arch/mips/pci/Makefile 2006-07-05 15:21:58.000000000 +0200
@@ -18,6 +18,7 @@ obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o
obj-$(CONFIG_MIPS_TX3927) += ops-tx3927.o
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
+obj-$(CONFIG_BCM_PCI) += fixup-bcm96348.o pci-bcm96348.o ops-bcm96348.o
#
# These are still pretty much in the old state, watch, go blind.
diff -Naurp linux-2.6.16.7-generic-patched/arch/mips/pci/fixup-bcm96348.c linux-2.6.16.7-patched/arch/mips/pci/fixup-bcm96348.c
--- linux-2.6.16.7-generic-patched/arch/mips/pci/fixup-bcm96348.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.16.7-patched/arch/mips/pci/fixup-bcm96348.c 2006-07-05 15:21:58.000000000 +0200
@@ -0,0 +1,85 @@
+/*
+<:copyright-gpl
+ Copyright 2002 Broadcom Corp. All Rights Reserved.
+
+ This program is free software; you can distribute it and/or modify it
+ under the terms of the GNU General Public License (Version 2) as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+:>
+*/
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/pci.h>
+
+#include <bcmpci.h>
+#include <bcm_intr.h>
+#include <bcm_map_part.h>
+
+static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
+
+static char irq_tab_bcm96348[] __initdata = {
+ [0] = INTERRUPT_ID_MPI,
+ [1] = INTERRUPT_ID_MPI,
+#if defined(CONFIG_USB)
+ [USB_HOST_SLOT] = INTERRUPT_ID_USBH
+#endif
+};
+
+int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+ return irq_tab_bcm96348[slot];
+}
+
+static void bcm96348_fixup(struct pci_dev *dev)
+{
+ uint32 memaddr;
+ uint32 size;
+
+ memaddr = pci_resource_start(dev, 0);
+ size = pci_resource_len(dev, 0);
+
+ switch (PCI_SLOT(dev->devfn)) {
+ case 0:
+ // UBUS to PCI address range
+ // Memory Window 1. Mask determines which bits are decoded.
+ mpi->l2pmrange1 = ~(size-1);
+ // UBUS to PCI Memory base address. This is akin to the ChipSelect base
+ // register.
+ mpi->l2pmbase1 = memaddr & BCM_PCI_ADDR_MASK;
+ // UBUS to PCI Remap Address. Replaces the masked address bits in the
+ // range register with this setting.
+ // Also, enable direct I/O and direct Memory accesses
+ mpi->l2pmremap1 = (memaddr | MEM_WINDOW_EN);
+ break;
+
+ case 1:
+ // Memory Window 2
+ mpi->l2pmrange2 = ~(size-1);
+ // UBUS to PCI Memory base address.
+ mpi->l2pmbase2 = memaddr & BCM_PCI_ADDR_MASK;
+ // UBUS to PCI Remap Address
+ mpi->l2pmremap2 = (memaddr | MEM_WINDOW_EN);
+ break;
+
+#if defined(CONFIG_USB)
+ case USB_HOST_SLOT:
+ dev->resource[0].start = USB_HOST_BASE;
+ dev->resource[0].end = USB_HOST_BASE+USB_BAR0_MEM_SIZE-1;
+ break;
+#endif
+ }
+}
+
+struct pci_fixup pcibios_fixups[] = {
+ { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, bcm96348_fixup },
+ {0}
+};
diff -Naurp linux-2.6.16.7-generic-patched/arch/mips/pci/ops-bcm96348.c linux-2.6.16.7-patched/arch/mips/pci/ops-bcm96348.c
--- linux-2.6.16.7-generic-patched/arch/mips/pci/ops-bcm96348.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.16.7-patched/arch/mips/pci/ops-bcm96348.c 2006-07-05 15:21:58.000000000 +0200
@@ -0,0 +1,276 @@
+/*
+<:copyright-gpl
+ Copyright 2002 Broadcom Corp. All Rights Reserved.
+
+ This program is free software; you can distribute it and/or modify it
+ under the terms of the GNU General Public License (Version 2) as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+:>
+*/
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <asm/addrspace.h>
+
+#include <bcm_intr.h>
+#include <bcm_map_part.h>
+#include <bcmpci.h>
+
+#include <linux/delay.h>
+
+#if defined(CONFIG_USB)
+#if 0
+#define DPRINT(x...) printk(x)
+#else
+#define DPRINT(x...)
+#endif
+
+static int
+pci63xx_int_read(unsigned int devfn, int where, u32 * value, int size);
+static int
+pci63xx_int_write(unsigned int devfn, int where, u32 * value, int size);
+
+static bool usb_mem_size_rd = FALSE;
+static uint32 usb_mem_base = 0;
+static uint32 usb_cfg_space_cmd_reg = 0;
+#endif
+static bool pci_mem_size_rd = FALSE;
+
+static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
+
+static void mpi_SetupPciConfigAccess(uint32 addr)
+{
+ mpi->l2pcfgctl = (DIR_CFG_SEL | DIR_CFG_USEREG | addr) & ~CONFIG_TYPE;
+}
+
+static void mpi_ClearPciConfigAccess(void)
+{
+ mpi->l2pcfgctl = 0x00000000;
+}
+
+#if defined(CONFIG_USB)
+/* --------------------------------------------------------------------------
+ Name: pci63xx_int_write
+Abstract: PCI Config write on internal device(s)
+ -------------------------------------------------------------------------- */
+static int
+pci63xx_int_write(unsigned int devfn, int where, u32 * value, int size)
+{
+ if (PCI_SLOT(devfn) != USB_HOST_SLOT) {
+ return PCIBIOS_SUCCESSFUL;
+ }
+
+ switch (size) {
+ case 1:
+ DPRINT("W => Slot: %d Where: %2X Len: %d Data: %02X\n",
+ PCI_SLOT(devfn), where, size, *value);
+ break;
+ case 2:
+ DPRINT("W => Slot: %d Where: %2X Len: %d Data: %04X\n",
+ PCI_SLOT(devfn), where, size, *value);
+ switch (where) {
+ case PCI_COMMAND:
+ usb_cfg_space_cmd_reg = *value;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 4:
+ DPRINT("W => Slot: %d Where: %2X Len: %d Data: %08lX\n",
+ PCI_SLOT(devfn), where, size, *value);
+ switch (where) {
+ case PCI_BASE_ADDRESS_0:
+ if (*value == 0xffffffff) {
+ usb_mem_size_rd = TRUE;
+ } else {
+ usb_mem_base = *value;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
+/* --------------------------------------------------------------------------
+ Name: pci63xx_int_read
+Abstract: PCI Config read on internal device(s)
+ -------------------------------------------------------------------------- */
+static int
+pci63xx_int_read(unsigned int devfn, int where, u32 * value, int size)
+{
+ uint32 retValue = 0xFFFFFFFF;
+
+ if (PCI_SLOT(devfn) != USB_HOST_SLOT) {
+ return PCIBIOS_SUCCESSFUL;
+ }
+
+ // For now, this is specific to the USB Host controller. We can
+ // make it more general if we have to...
+ // Emulate PCI Config accesses
+ switch (where) {
+ case PCI_VENDOR_ID:
+ case PCI_DEVICE_ID:
+ retValue = PCI_VENDOR_ID_BROADCOM | 0x63000000;
+ break;
+ case PCI_COMMAND:
+ case PCI_STATUS:
+ retValue = (0x0006 << 16) | usb_cfg_space_cmd_reg;
+ break;
+ case PCI_CLASS_REVISION:
+ case PCI_CLASS_DEVICE:
+ retValue = (PCI_CLASS_SERIAL_USB << 16) | (0x10 << 8) | 0x01;
+ break;
+ case PCI_BASE_ADDRESS_0:
+ if (usb_mem_size_rd) {
+ retValue = USB_BAR0_MEM_SIZE;
+ } else {
+ if (usb_mem_base != 0)
+ retValue = usb_mem_base;
+ else
+ retValue = USB_HOST_BASE;
+ }
+ usb_mem_size_rd = FALSE;
+ break;
+ case PCI_CACHE_LINE_SIZE:
+ case PCI_LATENCY_TIMER:
+ retValue = 0;
+ break;
+ case PCI_HEADER_TYPE:
+ retValue = PCI_HEADER_TYPE_NORMAL;
+ break;
+ case PCI_SUBSYSTEM_VENDOR_ID:
+ retValue = PCI_VENDOR_ID_BROADCOM;
+ break;
+ case PCI_SUBSYSTEM_ID:
+ retValue = 0x6300;
+ break;
+ case PCI_INTERRUPT_LINE:
+ retValue = INTERRUPT_ID_USBH;
+ break;
+ default:
+ break;
+ }
+
+ switch (size) {
+ case 1:
+ *value = (retValue >> ((where & 3) << 3)) & 0xff;
+ DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %02X\n",
+ PCI_SLOT(devfn), where, size, *value);
+ break;
+ case 2:
+ *value = (retValue >> ((where & 3) << 3)) & 0xffff;
+ DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %04X\n",
+ PCI_SLOT(devfn), where, size, *value);
+ break;
+ case 4:
+ *value = retValue;
+ DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %08lX\n",
+ PCI_SLOT(devfn), where, size, *value);
+ break;
+ default:
+ break;
+ }
+
+ return PCIBIOS_SUCCESSFUL;
+}
+#endif
+
+static int bcm96348_pcibios_read(struct pci_bus *bus, unsigned int devfn,
+ int where, int size, u32 * val)
+{
+ volatile unsigned char *ioBase = (unsigned char *)(mpi->l2piobase | KSEG1);
+ uint32 data;
+
+#if defined(CONFIG_USB)
+ if (PCI_SLOT(devfn) == USB_HOST_SLOT)
+ return pci63xx_int_read(devfn, where, val, size);
+#endif
+
+ mpi_SetupPciConfigAccess(BCM_PCI_CFG(PCI_SLOT(devfn), PCI_FUNC(devfn), where));
+ data = *(uint32 *)ioBase;
+ switch(size) {
+ case 1:
+ *val = (data >> ((where & 3) << 3)) & 0xff;
+ break;
+ case 2:
+ *val = (data >> ((where & 3) << 3)) & 0xffff;
+ break;
+ case 4:
+ *val = data;
+ /* Special case for reading PCI device range */
+ if ((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_5)) {
+ if (pci_mem_size_rd) {
+ /* bcm6348 PCI memory window minimum size is 64K */
+ *val &= PCI_SIZE_64K;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ pci_mem_size_rd = FALSE;
+ mpi_ClearPciConfigAccess();
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
+static int bcm96348_pcibios_write(struct pci_bus *bus, unsigned int devfn,
+ int where, int size, u32 val)
+{
+ volatile unsigned char *ioBase = (unsigned char *)(mpi->l2piobase | KSEG1);
+ uint32 data;
+
+#if defined(CONFIG_USB)
+ if (PCI_SLOT(devfn) == USB_HOST_SLOT)
+ return pci63xx_int_write(devfn, where, &val, size);
+#endif
+ mpi_SetupPciConfigAccess(BCM_PCI_CFG(PCI_SLOT(devfn), PCI_FUNC(devfn), where));
+ data = *(uint32 *)ioBase;
+ switch(size) {
+ case 1:
+ data = (data & ~(0xff << ((where & 3) << 3))) |
+ (val << ((where & 3) << 3));
+ break;
+ case 2:
+ data = (data & ~(0xffff << ((where & 3) << 3))) |
+ (val << ((where & 3) << 3));
+ break;
+ case 4:
+ data = val;
+ /* Special case for reading PCI device range */
+ if ((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_5)) {
+ if (val == 0xffffffff)
+ pci_mem_size_rd = TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+ *(uint32 *)ioBase = data;
+ udelay(500);
+ mpi_ClearPciConfigAccess();
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
+struct pci_ops bcm96348_pci_ops = {
+ .read = bcm96348_pcibios_read,
+ .write = bcm96348_pcibios_write
+};
diff -Naurp linux-2.6.16.7-generic-patched/arch/mips/pci/pci-bcm96348.c linux-2.6.16.7-patched/arch/mips/pci/pci-bcm96348.c
--- linux-2.6.16.7-generic-patched/arch/mips/pci/pci-bcm96348.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.16.7-patched/arch/mips/pci/pci-bcm96348.c 2006-07-05 15:21:58.000000000 +0200
@@ -0,0 +1,54 @@
+/*
+<:copyright-gpl
+ Copyright 2002 Broadcom Corp. All Rights Reserved.
+
+ This program is free software; you can distribute it and/or modify it
+ under the terms of the GNU General Public License (Version 2) as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+:>
+*/
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pci_channel.h>
+#include <bcmpci.h>
+
+static struct resource bcm_pci_io_resource = {
+ .name = "bcm96348 pci IO space",
+ .start = BCM_PCI_IO_BASE,
+ .end = BCM_PCI_IO_BASE + BCM_PCI_IO_SIZE_64KB - 1,
+ .flags = IORESOURCE_IO
+};
+
+static struct resource bcm_pci_mem_resource = {
+ .name = "bcm96348 pci memory space",
+ .start = BCM_PCI_MEM_BASE,
+ .end = BCM_PCI_MEM_BASE + BCM_PCI_MEM_SIZE_16MB - 1,
+ .flags = IORESOURCE_MEM
+};
+
+extern struct pci_ops bcm96348_pci_ops;
+
+struct pci_controller bcm96348_controller = {
+ .pci_ops = &bcm96348_pci_ops,
+ .io_resource = &bcm_pci_io_resource,
+ .mem_resource = &bcm_pci_mem_resource,
+};
+
+static void bcm96348_pci_init(void)
+{
+ register_pci_controller(&bcm96348_controller);
+}
+
+arch_initcall(bcm96348_pci_init);

View File

@ -0,0 +1,77 @@
diff -Naurp -x mach-bcm963xx linux-2.6.16.7-generic-patched/include/asm-mips/bootinfo.h linux-2.6.16.7-patched/include/asm-mips/bootinfo.h
--- linux-2.6.16.7-generic-patched/include/asm-mips/bootinfo.h 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/include/asm-mips/bootinfo.h 2006-07-05 15:21:58.000000000 +0200
@@ -218,6 +218,15 @@
#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
+/*
+ * Valid machtype for group BRCM
+ */
+#define MACH_GROUP_BRCM 23 /* Broadcom boards */
+#define MACH_BCM96338 0
+#define MACH_BCM96345 1
+#define MACH_BCM96348 2
+
+
#define CL_SIZE COMMAND_LINE_SIZE
const char *get_system_type(void);
diff -Naurp -x mach-bcm963xx linux-2.6.16.7-generic-patched/include/asm-mips/cpu.h linux-2.6.16.7-patched/include/asm-mips/cpu.h
--- linux-2.6.16.7-generic-patched/include/asm-mips/cpu.h 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/include/asm-mips/cpu.h 2006-07-05 15:21:58.000000000 +0200
@@ -102,6 +102,15 @@
#define PRID_IMP_SR71000 0x0400
/*
+ * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
+ */
+
+#define PRID_IMP_BCM6338 0x9000
+#define PRID_IMP_BCM6345 0x8000
+#define PRID_IMP_BCM6348 0x9100
+
+
+/*
* Definitions for 7:0 on legacy processors
*/
@@ -196,7 +205,10 @@
#define CPU_34K 60
#define CPU_PR4450 61
#define CPU_SB1A 62
-#define CPU_LAST 62
+#define CPU_BCM6338 63
+#define CPU_BCM6345 64
+#define CPU_BCM6348 65
+#define CPU_LAST 65
/*
* ISA Level encodings
diff -Naurp -x mach-bcm963xx linux-2.6.16.7-generic-patched/include/asm-mips/mach-generic/param.h linux-2.6.16.7-patched/include/asm-mips/mach-generic/param.h
--- linux-2.6.16.7-generic-patched/include/asm-mips/mach-generic/param.h 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/include/asm-mips/mach-generic/param.h 2006-07-05 15:21:58.000000000 +0200
@@ -8,6 +8,6 @@
#ifndef __ASM_MACH_GENERIC_PARAM_H
#define __ASM_MACH_GENERIC_PARAM_H
-#define HZ 1000 /* Internal kernel timer frequency */
+#define HZ 200 /* Internal kernel timer frequency */
#endif /* __ASM_MACH_GENERIC_PARAM_H */
diff -Naurp -x mach-bcm963xx linux-2.6.16.7-generic-patched/include/asm-mips/module.h linux-2.6.16.7-patched/include/asm-mips/module.h
--- linux-2.6.16.7-generic-patched/include/asm-mips/module.h 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/include/asm-mips/module.h 2006-07-05 15:21:58.000000000 +0200
@@ -113,6 +113,12 @@ search_module_dbetables(unsigned long ad
#define MODULE_PROC_FAMILY "RM9000 "
#elif defined CONFIG_CPU_SB1
#define MODULE_PROC_FAMILY "SB1 "
+#elif defined CONFIG_CPU_BCM6338
+#define MODULE_PROC_FAMILY "BCM6338 "
+#elif defined CONFIG_CPU_BCM6345
+#define MODULE_PROC_FAMILY "BCM6345 "
+#elif defined CONFIG_CPU_BCM6348
+#define MODULE_PROC_FAMILY "BCM6348 "
#else
#error MODULE_PROC_FAMILY undefined for your processor configuration
#endif

View File

@ -0,0 +1,40 @@
diff -Naurp linux-2.6.16.7-generic-patched/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h linux-2.6.16.7-patched/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h
--- linux-2.6.16.7-generic-patched/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.16.7-patched/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h 2006-07-05 15:21:58.000000000 +0200
@@ -0,0 +1,36 @@
+#ifndef __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
+#define __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
+
+#define cpu_has_tlb 1
+#define cpu_has_4kex 4
+#define cpu_has_4ktlb 8
+#define cpu_has_fpu 0
+#define cpu_has_32fpr 0
+#define cpu_has_counter 0x40
+#define cpu_has_watch 0
+#define cpu_has_mips16 0
+#define cpu_has_divec 0x200
+#define cpu_has_vce 0
+#define cpu_has_cache_cdex_p 0
+#define cpu_has_cache_cdex_s 0
+#define cpu_has_prefetch 0x40000
+#define cpu_has_mcheck 0x2000
+#define cpu_has_ejtag 0x4000
+#define cpu_has_llsc 0x10000
+#define cpu_has_vtag_icache 0
+#define cpu_has_dc_aliases 0
+#define cpu_has_ic_fills_f_dc 0
+
+#define cpu_has_nofpuex 0
+#define cpu_has_64bits 0
+#define cpu_has_64bit_zero_reg 0
+#define cpu_has_64bit_gp_regs 0
+#define cpu_has_64bit_addresses 0
+
+#define cpu_has_subset_pcaches 0
+
+#define cpu_dcache_line_size() 16
+#define cpu_icache_line_size() 16
+#define cpu_scache_line_size() 0
+
+#endif /* __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,135 @@
diff -urN linux-2.6.16.7/drivers/mtd/maps/bcm963xx.c linux-2.6.16.7-brcm63xx/drivers/mtd/maps/bcm963xx.c
--- linux-2.6.16.7/drivers/mtd/maps/bcm963xx.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.16.7-brcm63xx/drivers/mtd/maps/bcm963xx.c 2006-07-07 22:00:36.000000000 +0200
@@ -0,0 +1,106 @@
+/*
+ * A simple flash mapping code for BCM963xx board flash memory
+ * It is simple because it only treats all the flash memory as ROM
+ * It is used with chips/map_rom.c
+ *
+ * Song Wang (songw@broadcom.com)
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <asm/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/config.h>
+
+#include <board.h>
+#include <bcmTag.h>
+#define VERSION "1.0"
+
+extern PFILE_TAG kerSysImageTagGet(void);
+
+static struct mtd_info *mymtd;
+
+static map_word brcm_physmap_read16(struct map_info *map, unsigned long ofs)
+{
+ map_word val;
+
+ val.x[0] = __raw_readw(map->map_priv_1 + ofs);
+
+ return val;
+}
+
+static void brcm_physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
+{
+ memcpy_fromio(to, map->map_priv_1 + from, len);
+}
+
+static struct map_info brcm_physmap_map = {
+ .name = "Physically mapped flash",
+ .bankwidth = 2,
+ .read = brcm_physmap_read16,
+ .copy_from = brcm_physmap_copy_from
+};
+
+static int __init init_brcm_physmap(void)
+{
+ PFILE_TAG pTag = NULL;
+ u_int32_t rootfs_addr, kernel_addr;
+ FLASH_ADDR_INFO info;
+
+ printk("bcm963xx_mtd driver v%s\n", VERSION);
+ kerSysFlashAddrInfoGet( &info );
+
+ /* Read the flash memory map from flash memory. */
+ if (!(pTag = kerSysImageTagGet())) {
+ printk("Failed to read image tag from flash\n");
+ return -EIO;
+ }
+
+ rootfs_addr = (u_int32_t) simple_strtoul(pTag->rootfsAddress, NULL, 10);
+ kernel_addr = (u_int32_t) simple_strtoul(pTag->kernelAddress, NULL, 10);
+
+ brcm_physmap_map.size = kernel_addr - rootfs_addr;
+ brcm_physmap_map.map_priv_1 = (unsigned long)rootfs_addr;
+
+ if (!brcm_physmap_map.map_priv_1) {
+ printk("Wrong rootfs starting address\n");
+ return -EIO;
+ }
+
+ if (brcm_physmap_map.size <= 0) {
+ printk("Wrong rootfs size\n");
+ return -EIO;
+ }
+
+ mymtd = do_map_probe("map_rom", &brcm_physmap_map);
+ if (mymtd) {
+ mymtd->owner = THIS_MODULE;
+ add_mtd_device(mymtd);
+
+ return 0;
+ }
+
+ return -ENXIO;
+}
+
+static void __exit cleanup_brcm_physmap(void)
+{
+ if (mymtd) {
+ del_mtd_device(mymtd);
+ map_destroy(mymtd);
+ }
+ if (brcm_physmap_map.map_priv_1) {
+ brcm_physmap_map.map_priv_1 = 0;
+ }
+}
+
+module_init(init_brcm_physmap);
+module_exit(cleanup_brcm_physmap);
+
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Song Wang songw@broadcom.com");
+MODULE_DESCRIPTION("Configurable MTD map driver for read-only root file system");
diff -urN linux-2.6.16.7/drivers/mtd/maps/Kconfig linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Kconfig
--- linux-2.6.16.7/drivers/mtd/maps/Kconfig 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Kconfig 2006-07-07 22:02:13.000000000 +0200
@@ -224,6 +224,13 @@
Flash memory access on 4G Systems MTX-1 Board. If you have one of
these boards and would like to use the flash chips on it, say 'Y'.
+config MTD_BCM963XX
+ tristate "BCM963xx Flash device"
+ depends on MIPS && MIPS_BRCM
+ help
+ This driver seems to detect and provide a valid flash map to the system
+ of course, it needs checking and testing.
+
config MTD_DILNETPC
tristate "CFI Flash device mapped on DIL/Net PC"
depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
diff -urN linux-2.6.16.7/drivers/mtd/maps/Makefile linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Makefile
--- linux-2.6.16.7/drivers/mtd/maps/Makefile 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Makefile 2006-07-07 22:01:29.000000000 +0200
@@ -71,3 +71,4 @@
obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
+obj-$(CONFIG_MTD_BCM963XX) += bcm963xx.o

View File

@ -0,0 +1,13 @@
diff -Naurp linux-2.6.16.7-generic-patched/net/ipv4/af_inet.c linux-2.6.16.7-patched/net/ipv4/af_inet.c
--- linux-2.6.16.7-generic-patched/net/ipv4/af_inet.c 2006-04-17 23:53:25.000000000 +0200
+++ linux-2.6.16.7-patched/net/ipv4/af_inet.c 2006-07-05 15:33:47.000000000 +0200
@@ -940,7 +940,9 @@ void inet_register_protosw(struct inet_p
out:
spin_unlock_bh(&inetsw_lock);
+#ifndef CONFIG_MIPS_BRCM
synchronize_net();
+#endif
return;