From: Florian Fainelli Date: Sun, 28 Feb 2010 21:24:34 +0000 (+0000) Subject: add support for 2.6.33 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4f4066d3e057567c0f78a3069ef967fd787ac94a;p=openwrt%2Fstaging%2Flinusw.git add support for 2.6.33 SVN-Revision: 19921 --- diff --git a/target/linux/brcm63xx/config-2.6.33 b/target/linux/brcm63xx/config-2.6.33 new file mode 100644 index 0000000000..22d519ccfb --- /dev/null +++ b/target/linux/brcm63xx/config-2.6.33 @@ -0,0 +1,256 @@ +CONFIG_32BIT=y +# CONFIG_64BIT is not set +# CONFIG_ALCHEMY_GPIO_INDIRECT is not set +# CONFIG_AR7 is not set +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUPPORTS_OPROFILE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +# CONFIG_ATH_COMMON is not set +CONFIG_AUDIT=y +CONFIG_AUDIT_GENERIC=y +# CONFIG_BATMAN_ADV is not set +# CONFIG_BCM47XX is not set +CONFIG_BCM63XX=y +CONFIG_BCM63XX_CPU_6338=y +CONFIG_BCM63XX_CPU_6345=y +CONFIG_BCM63XX_CPU_6348=y +CONFIG_BCM63XX_CPU_6358=y +CONFIG_BCM63XX_ENET=y +CONFIG_BCM63XX_PHY=y +CONFIG_BCM63XX_WDT=y +CONFIG_BITREVERSE=y +CONFIG_BOARD_BCM963XX=y +# CONFIG_BOARD_LIVEBOX is not set +CONFIG_BSD_PROCESS_ACCT_V3=y +# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set +# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CEVT_R4K=y +CONFIG_CEVT_R4K_LIB=y +CONFIG_CFG80211=m +# CONFIG_CFG80211_DEBUGFS is not set +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_REG_DEBUG is not set +CONFIG_CFG80211_WEXT=y +CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +CONFIG_CPU_BIG_ENDIAN=y +# CONFIG_CPU_CAVIUM_OCTEON is not set +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +# CONFIG_CPU_LITTLE_ENDIAN is not set +# CONFIG_CPU_LOONGSON2E is not set +# CONFIG_CPU_LOONGSON2F is not set +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +# CONFIG_CPU_MIPS32_R2 is not set +# CONFIG_CPU_MIPS64_R1 is not set +# CONFIG_CPU_MIPS64_R2 is not set +CONFIG_CPU_MIPSR1=y +# CONFIG_CPU_NEVADA is not set +# CONFIG_CPU_R10000 is not set +# CONFIG_CPU_R3000 is not set +# CONFIG_CPU_R4300 is not set +# CONFIG_CPU_R4X00 is not set +# CONFIG_CPU_R5000 is not set +# CONFIG_CPU_R5432 is not set +# CONFIG_CPU_R5500 is not set +# CONFIG_CPU_R6000 is not set +# CONFIG_CPU_R8000 is not set +# CONFIG_CPU_RM7000 is not set +# CONFIG_CPU_RM9000 is not set +# CONFIG_CPU_SB1 is not set +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +# CONFIG_CPU_TX39XX is not set +# CONFIG_CPU_TX49XX is not set +# CONFIG_CPU_VR41XX is not set +CONFIG_CRAMFS=y +CONFIG_CSRC_R4K=y +CONFIG_CSRC_R4K_LIB=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_DEFAULT_SECURITY_DAC=y +# CONFIG_DEFAULT_SECURITY_SELINUX is not set +# CONFIG_DEFAULT_SECURITY_SMACK is not set +# CONFIG_DEFAULT_SECURITY_TOMOYO is not set +CONFIG_DEVPORT=y +# CONFIG_DM9000 is not set +CONFIG_DMA_NEED_PCI_MAP_STATE=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_EARLY_PRINTK=y +CONFIG_ELF_CORE=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GPIOLIB=y +# CONFIG_GPIO_CS5535 is not set +CONFIG_GPIO_DEVICE=y +CONFIG_GPIO_SYSFS=y +# CONFIG_HAMRADIO is not set +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HW_HAS_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_IMAGE_CMDLINE_HACK=y +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_INLINE_READ_LOCK is not set +# CONFIG_INLINE_READ_LOCK_BH is not set +# CONFIG_INLINE_READ_LOCK_IRQ is not set +# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set +# CONFIG_INLINE_READ_TRYLOCK is not set +CONFIG_INLINE_READ_UNLOCK=y +# CONFIG_INLINE_READ_UNLOCK_BH is not set +CONFIG_INLINE_READ_UNLOCK_IRQ=y +# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_SPIN_LOCK is not set +# CONFIG_INLINE_SPIN_LOCK_BH is not set +# CONFIG_INLINE_SPIN_LOCK_IRQ is not set +# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set +# CONFIG_INLINE_SPIN_TRYLOCK is not set +# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK=y +# CONFIG_INLINE_SPIN_UNLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_WRITE_LOCK is not set +# CONFIG_INLINE_WRITE_LOCK_BH is not set +# CONFIG_INLINE_WRITE_LOCK_IRQ is not set +# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set +# CONFIG_INLINE_WRITE_TRYLOCK is not set +CONFIG_INLINE_WRITE_UNLOCK=y +# CONFIG_INLINE_WRITE_UNLOCK_BH is not set +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set +CONFIG_INOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_IRQ_CPU=y +CONFIG_KEXEC=y +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +CONFIG_LOONGSON_UART_BASE=y +# CONFIG_MACH_ALCHEMY is not set +# CONFIG_MACH_DECSTATION is not set +# CONFIG_MACH_JAZZ is not set +# CONFIG_MACH_LOONGSON is not set +# CONFIG_MACH_TX39XX is not set +# CONFIG_MACH_TX49XX is not set +# CONFIG_MACH_VR41XX is not set +CONFIG_MAGIC_SYSRQ=y +# CONFIG_MIKROTIK_RB532 is not set +CONFIG_MIPS=y +# CONFIG_MIPS_COBALT is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_MACHINE is not set +# CONFIG_MIPS_MALTA is not set +CONFIG_MIPS_MT_DISABLED=y +# CONFIG_MIPS_MT_SMP is not set +# CONFIG_MIPS_MT_SMTC is not set +# CONFIG_MIPS_SIM is not set +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MTD_BCM963XX=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +CONFIG_MTD_CFI_BE_BYTE_SWAP=y +# CONFIG_MTD_CFI_GEOMETRY is not set +# CONFIG_MTD_CFI_NOSWAP is not set +CONFIG_MTD_CFI_STAA=y +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_CONCAT=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_REDBOOT_PARTS=y +CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y +# CONFIG_MUTEX_SPIN_ON_OWNER is not set +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_NO_IOPORT is not set +# CONFIG_NXP_STB220 is not set +# CONFIG_NXP_STB225 is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PCI_DOMAINS=y +CONFIG_PHYLIB=y +# CONFIG_PMC_MSP is not set +# CONFIG_PMC_YOSEMITE is not set +# CONFIG_PNX8550_JBS is not set +# CONFIG_PNX8550_STB810 is not set +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +# CONFIG_POWERTV is not set +# CONFIG_R8187SE is not set +# CONFIG_RAMZSWAP is not set +CONFIG_RELAY=y +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_BCM63XX=y +CONFIG_SERIAL_BCM63XX_CONSOLE=y +# CONFIG_SGI_IP22 is not set +# CONFIG_SGI_IP27 is not set +# CONFIG_SGI_IP28 is not set +# CONFIG_SGI_IP32 is not set +# CONFIG_SIBYTE_BIGSUR is not set +# CONFIG_SIBYTE_CARMEL is not set +# CONFIG_SIBYTE_CRHINE is not set +# CONFIG_SIBYTE_CRHONE is not set +# CONFIG_SIBYTE_LITTLESUR is not set +# CONFIG_SIBYTE_RHONE is not set +# CONFIG_SIBYTE_SENTOSA is not set +# CONFIG_SIBYTE_SWARM is not set +CONFIG_SQUASHFS_EMBEDDED=y +CONFIG_SSB=y +CONFIG_SSB_B43_PCI_BRIDGE=y +# CONFIG_SSB_DRIVER_MIPS is not set +CONFIG_SSB_DRIVER_PCICORE=y +CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_PCIHOST=y +CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_SPROM=y +CONFIG_SWAP_IO_SPACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +# CONFIG_TC35815 is not set +# CONFIG_TINY_RCU is not set +CONFIG_TRAD_SIGNALS=y +# CONFIG_TREE_PREEMPT_RCU is not set +CONFIG_TREE_RCU=y +CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y +CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y +CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y +CONFIG_USB_SUPPORT=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_WATCHDOG_NOWAYOUT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/brcm63xx/patches-2.6.33/007-usb-ohci-support.patch b/target/linux/brcm63xx/patches-2.6.33/007-usb-ohci-support.patch new file mode 100644 index 0000000000..526d3e7788 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/007-usb-ohci-support.patch @@ -0,0 +1,125 @@ +The bcm63xx SOC has an integrated OHCI controller, this patch adds +platform device registration and change board code to register ohci +device when necessary. + +Signed-off-by: Maxime Bizon +--- + arch/mips/bcm63xx/Kconfig | 6 ++ + arch/mips/bcm63xx/Makefile | 3 +- + arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++ + arch/mips/bcm63xx/dev-usb-ohci.c | 49 ++++++++++++++++++++ + .../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 ++ + 5 files changed, 67 insertions(+), 1 deletions(-) + create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c + create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h + +--- a/arch/mips/bcm63xx/Kconfig ++++ b/arch/mips/bcm63xx/Kconfig +@@ -16,10 +16,16 @@ config BCM63XX_CPU_6345 + config BCM63XX_CPU_6348 + bool "support 6348 CPU" + select HW_HAS_PCI ++ select USB_ARCH_HAS_OHCI ++ select USB_OHCI_BIG_ENDIAN_DESC ++ select USB_OHCI_BIG_ENDIAN_MMIO + + config BCM63XX_CPU_6358 + bool "support 6358 CPU" + select HW_HAS_PCI ++ select USB_ARCH_HAS_OHCI ++ select USB_OHCI_BIG_ENDIAN_DESC ++ select USB_OHCI_BIG_ENDIAN_MMIO + endmenu + + source "arch/mips/bcm63xx/boards/Kconfig" +--- a/arch/mips/bcm63xx/Makefile ++++ b/arch/mips/bcm63xx/Makefile +@@ -1,5 +1,6 @@ + obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ +- dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o ++ dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \ ++ dev-usb-ohci.o + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + + obj-y += boards/ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + + #define PFX "board_bcm963xx: " +@@ -803,6 +804,9 @@ int __init board_register_devices(void) + !board_get_mac_address(board.enet1.mac_addr)) + bcm63xx_enet_register(1, &board.enet1); + ++ if (board.has_ohci0) ++ bcm63xx_ohci_register(); ++ + if (board.has_dsp) + bcm63xx_dsp_register(&board.dsp); + +--- /dev/null ++++ b/arch/mips/bcm63xx/dev-usb-ohci.c +@@ -0,0 +1,49 @@ ++/* ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2010 Maxime Bizon ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static struct resource ohci_resources[] = { ++ { ++ /* start & end filled at runtime */ ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ /* start filled at runtime */ ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 ohci_dmamask = ~(u32)0; ++ ++static struct platform_device bcm63xx_ohci_device = { ++ .name = "bcm63xx_ohci", ++ .id = 0, ++ .num_resources = ARRAY_SIZE(ohci_resources), ++ .resource = ohci_resources, ++ .dev = { ++ .dma_mask = &ohci_dmamask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++}; ++ ++int __init bcm63xx_ohci_register(void) ++{ ++ if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358()) ++ return 0; ++ ++ ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0); ++ ohci_resources[0].end = ohci_resources[0].start; ++ ohci_resources[0].end += RSET_OHCI_SIZE - 1; ++ ohci_resources[1].start = bcm63xx_get_irq_number(IRQ_OHCI0); ++ return platform_device_register(&bcm63xx_ohci_device); ++} +--- /dev/null ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h +@@ -0,0 +1,6 @@ ++#ifndef BCM63XX_DEV_USB_OHCI_H_ ++#define BCM63XX_DEV_USB_OHCI_H_ ++ ++int bcm63xx_ohci_register(void); ++ ++#endif /* BCM63XX_DEV_USB_OHCI_H_ */ diff --git a/target/linux/brcm63xx/patches-2.6.33/008-usb-ehci-support.patch b/target/linux/brcm63xx/patches-2.6.33/008-usb-ehci-support.patch new file mode 100644 index 0000000000..e5a682d6cc --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/008-usb-ehci-support.patch @@ -0,0 +1,117 @@ +The bcm63xx SOC has an integrated EHCI controller, this patch adds +platform device registration and change board code to register +EHCI device when necessary. + +Signed-off-by: Maxime Bizon +--- + arch/mips/bcm63xx/Kconfig | 2 + + arch/mips/bcm63xx/Makefile | 2 +- + arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++ + arch/mips/bcm63xx/dev-usb-ehci.c | 49 ++++++++++++++++++++ + .../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 ++ + 5 files changed, 62 insertions(+), 1 deletions(-) + create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c + create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h + +--- a/arch/mips/bcm63xx/Kconfig ++++ b/arch/mips/bcm63xx/Kconfig +@@ -26,6 +26,8 @@ config BCM63XX_CPU_6358 + select USB_ARCH_HAS_OHCI + select USB_OHCI_BIG_ENDIAN_DESC + select USB_OHCI_BIG_ENDIAN_MMIO ++ select USB_ARCH_HAS_EHCI ++ select USB_EHCI_BIG_ENDIAN_MMIO + endmenu + + source "arch/mips/bcm63xx/boards/Kconfig" +--- a/arch/mips/bcm63xx/Makefile ++++ b/arch/mips/bcm63xx/Makefile +@@ -1,6 +1,6 @@ + obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ + dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \ +- dev-usb-ohci.o ++ dev-usb-ohci.o dev-usb-ehci.o + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + + obj-y += boards/ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + + #define PFX "board_bcm963xx: " +@@ -804,6 +805,9 @@ int __init board_register_devices(void) + !board_get_mac_address(board.enet1.mac_addr)) + bcm63xx_enet_register(1, &board.enet1); + ++ if (board.has_ehci0) ++ bcm63xx_ehci_register(); ++ + if (board.has_ohci0) + bcm63xx_ohci_register(); + +--- /dev/null ++++ b/arch/mips/bcm63xx/dev-usb-ehci.c +@@ -0,0 +1,49 @@ ++/* ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2010 Maxime Bizon ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static struct resource ehci_resources[] = { ++ { ++ /* start & end filled at runtime */ ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ /* start filled at runtime */ ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 ehci_dmamask = ~(u32)0; ++ ++static struct platform_device bcm63xx_ehci_device = { ++ .name = "bcm63xx_ehci", ++ .id = 0, ++ .num_resources = ARRAY_SIZE(ehci_resources), ++ .resource = ehci_resources, ++ .dev = { ++ .dma_mask = &ehci_dmamask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++}; ++ ++int __init bcm63xx_ehci_register(void) ++{ ++ if (!BCMCPU_IS_6358()) ++ return 0; ++ ++ ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); ++ ehci_resources[0].end = ehci_resources[0].start; ++ ehci_resources[0].end += RSET_EHCI_SIZE - 1; ++ ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0); ++ return platform_device_register(&bcm63xx_ehci_device); ++} +--- /dev/null ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h +@@ -0,0 +1,6 @@ ++#ifndef BCM63XX_DEV_USB_EHCI_H_ ++#define BCM63XX_DEV_USB_EHCI_H_ ++ ++int bcm63xx_ehci_register(void); ++ ++#endif /* BCM63XX_DEV_USB_EHCI_H_ */ diff --git a/target/linux/brcm63xx/patches-2.6.33/009-fix-double-gpio-registration.patch b/target/linux/brcm63xx/patches-2.6.33/009-fix-double-gpio-registration.patch new file mode 100644 index 0000000000..dfcb6e72c2 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/009-fix-double-gpio-registration.patch @@ -0,0 +1,80 @@ +From mbizon@freebox.fr Sat Jan 30 18:34:54 2010 +Delivered-To: f.fainelli@gmail.com +Received: by 10.204.59.143 with SMTP id l15cs160635bkh; + Sat, 30 Jan 2010 09:36:50 -0800 (PST) +Received: by 10.223.77.85 with SMTP id f21mr2160176fak.40.1264873010074; + Sat, 30 Jan 2010 09:36:50 -0800 (PST) +Return-Path: +Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) + by mx.google.com with ESMTP id 9si4978784fxm.2.2010.01.30.09.36.49; + Sat, 30 Jan 2010 09:36:50 -0800 (PST) +Received-SPF: neutral (google.com: 78.24.191.176 is neither permitted nor denied by best guess record for domain of linux-mips-bounce@linux-mips.org) client-ip=78.24.191.176; +Authentication-Results: mx.google.com; spf=neutral (google.com: 78.24.191.176 is neither permitted nor denied by best guess record for domain of linux-mips-bounce@linux-mips.org) smtp.mail=linux-mips-bounce@linux-mips.org +Received: from localhost (localhost [127.0.0.1]) + by arrakis.dune.hu (Postfix) with ESMTP id CA65423C0C11; + Sat, 30 Jan 2010 18:36:49 +0100 (CET) +X-Virus-Scanned: at arrakis.dune.hu +X-Spam-Flag: NO +X-Spam-Score: -0.529 +X-Spam-Level: +X-Spam-Status: No, score=-0.529 required=5 tests=[AWL=-1.118, BAYES_00=-2.599, + FH_DATE_PAST_20XX=3.188] autolearn=no +Received: from arrakis.dune.hu ([127.0.0.1]) + by localhost (arrakis.dune.hu [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id QzyrvmnW4GpM; Sat, 30 Jan 2010 18:36:47 +0100 (CET) +Received: from eddie.linux-mips.org (eddie.linux-mips.org [78.24.191.182]) + by arrakis.dune.hu (Postfix) with ESMTP id F1E8B23C0C0B; + Sat, 30 Jan 2010 18:36:46 +0100 (CET) +Received: from localhost.localdomain ([127.0.0.1]:37132 "EHLO + eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL) + by eddie.linux-mips.org with ESMTP id S1492196Ab0A3Rgq (ORCPT + + 2 others); + Sat, 30 Jan 2010 18:36:46 +0100 +Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 30 Jan 2010 18:36:27 +0100 (CET) +Received: from sakura.staff.proxad.net ([213.228.1.107]:53010 "EHLO + sakura.staff.proxad.net" rhost-flags-OK-OK-OK-OK) + by eddie.linux-mips.org with ESMTP id S1492994Ab0A3RfM (ORCPT + ); Sat, 30 Jan 2010 18:35:12 +0100 +Received: by sakura.staff.proxad.net (Postfix, from userid 1000) + id 30AA6551082; Sat, 30 Jan 2010 18:35:12 +0100 (CET) +From: Maxime Bizon +To: linux-mips@linux-mips.org, + ralf@linux-mips.org +Cc: Maxime Bizon +Subject: [PATCH 3/7] MIPS: bcm63xx: fix double gpio registration. +Date: Sat, 30 Jan 2010 18:34:54 +0100 +Message-Id: <1264872898-28149-4-git-send-email-mbizon@freebox.fr> +X-Mailer: git-send-email 1.6.3.3 +In-Reply-To: <1264872898-28149-1-git-send-email-mbizon@freebox.fr> +References: <1264872898-28149-1-git-send-email-mbizon@freebox.fr> +X-archive-position: 25760 +X-ecartis-version: Ecartis v1.0.0 +Sender: linux-mips-bounce@linux-mips.org +Errors-to: linux-mips-bounce@linux-mips.org +X-original-sender: mbizon@freebox.fr +Precedence: bulk +X-list: linux-mips +X-UID: 7928 +X-Length: 3635 +Status: R +X-Status: N +X-KMail-EncryptionState: +X-KMail-SignatureState: +X-KMail-MDN-Sent: + +bcm63xx_gpio_init is already called from prom_init to allow board to +use them early, so we can remove the unneeded arch_initcall. + +Signed-off-by: Maxime Bizon +--- + arch/mips/bcm63xx/gpio.c | 2 -- + 1 files changed, 0 insertions(+), 2 deletions(-) + +--- a/arch/mips/bcm63xx/gpio.c ++++ b/arch/mips/bcm63xx/gpio.c +@@ -130,5 +130,3 @@ int __init bcm63xx_gpio_init(void) + + return gpiochip_add(&bcm63xx_gpio_chip); + } +- +-arch_initcall(bcm63xx_gpio_init); diff --git a/target/linux/brcm63xx/patches-2.6.33/010-add_bcm63xx_ohci_controller.patch b/target/linux/brcm63xx/patches-2.6.33/010-add_bcm63xx_ohci_controller.patch new file mode 100644 index 0000000000..49e6ea140d --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/010-add_bcm63xx_ohci_controller.patch @@ -0,0 +1,202 @@ +Signed-off-by: Maxime Bizon +--- + drivers/usb/host/ohci-bcm63xx.c | 166 +++++++++++++++++++++++++++++++++++++++ + drivers/usb/host/ohci-hcd.c | 5 + + drivers/usb/host/ohci.h | 2 +- + 3 files changed, 172 insertions(+), 1 deletions(-) + create mode 100644 drivers/usb/host/ohci-bcm63xx.c + +--- /dev/null ++++ b/drivers/usb/host/ohci-bcm63xx.c +@@ -0,0 +1,166 @@ ++/* ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2010 Maxime Bizon ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct clk *usb_host_clock; ++ ++static int __devinit ohci_bcm63xx_start(struct usb_hcd *hcd) ++{ ++ struct ohci_hcd *ohci = hcd_to_ohci(hcd); ++ int ret; ++ ++ /* ++ * port 2 can be shared with USB slave, but all boards seem to ++ * have only one host port populated, so we can hardcode it ++ */ ++ ohci->num_ports = 1; ++ ++ ret = ohci_init(ohci); ++ if (ret < 0) ++ return ret; ++ ++ ret = ohci_run(ohci); ++ if (ret < 0) { ++ err("can't start %s", hcd->self.bus_name); ++ ohci_stop(hcd); ++ return ret; ++ } ++ return 0; ++} ++ ++static const struct hc_driver ohci_bcm63xx_hc_driver = { ++ .description = hcd_name, ++ .product_desc = "BCM63XX integrated OHCI controller", ++ .hcd_priv_size = sizeof(struct ohci_hcd), ++ ++ .irq = ohci_irq, ++ .flags = HCD_USB11 | HCD_MEMORY, ++ .start = ohci_bcm63xx_start, ++ .stop = ohci_stop, ++ .shutdown = ohci_shutdown, ++ .urb_enqueue = ohci_urb_enqueue, ++ .urb_dequeue = ohci_urb_dequeue, ++ .endpoint_disable = ohci_endpoint_disable, ++ .get_frame_number = ohci_get_frame, ++ .hub_status_data = ohci_hub_status_data, ++ .hub_control = ohci_hub_control, ++ .start_port_reset = ohci_start_port_reset, ++}; ++ ++static int __devinit ohci_hcd_bcm63xx_drv_probe(struct platform_device *pdev) ++{ ++ struct resource *res_mem; ++ struct usb_hcd *hcd; ++ struct ohci_hcd *ohci; ++ u32 reg; ++ int ret, irq; ++ ++ res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ irq = platform_get_irq(pdev, 0); ++ if (!res_mem || irq < 0) ++ return -ENODEV; ++ ++ if (BCMCPU_IS_6348()) { ++ struct clk *clk; ++ /* enable USB host clock */ ++ clk = clk_get(&pdev->dev, "usbh"); ++ if (IS_ERR(clk)) ++ return -ENODEV; ++ ++ clk_enable(clk); ++ usb_host_clock = clk; ++ bcm_rset_writel(RSET_OHCI_PRIV, 0, OHCI_PRIV_REG); ++ ++ } else if (BCMCPU_IS_6358()) { ++ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_REG); ++ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; ++ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; ++ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_REG); ++ /* ++ * The magic value comes for the original vendor BSP ++ * and is needed for USB to work. Datasheet does not ++ * help, so the magic value is used as-is. ++ */ ++ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020, USBH_PRIV_TEST_REG); ++ } else ++ return 0; ++ ++ hcd = usb_create_hcd(&ohci_bcm63xx_hc_driver, &pdev->dev, "bcm63xx"); ++ if (!hcd) ++ return -ENOMEM; ++ hcd->rsrc_start = res_mem->start; ++ hcd->rsrc_len = res_mem->end - res_mem->start + 1; ++ ++ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { ++ pr_debug("request_mem_region failed\n"); ++ ret = -EBUSY; ++ goto out; ++ } ++ ++ hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); ++ if (!hcd->regs) { ++ pr_debug("ioremap failed\n"); ++ ret = -EIO; ++ goto out1; ++ } ++ ++ ohci = hcd_to_ohci(hcd); ++ ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC | ++ OHCI_QUIRK_FRAME_NO; ++ ohci_hcd_init(ohci); ++ ++ ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); ++ if (ret) ++ goto out2; ++ ++ platform_set_drvdata(pdev, hcd); ++ return 0; ++ ++out2: ++ iounmap(hcd->regs); ++out1: ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); ++out: ++ usb_put_hcd(hcd); ++ return ret; ++} ++ ++static int __devexit ohci_hcd_bcm63xx_drv_remove(struct platform_device *pdev) ++{ ++ struct usb_hcd *hcd; ++ ++ hcd = platform_get_drvdata(pdev); ++ usb_remove_hcd(hcd); ++ iounmap(hcd->regs); ++ usb_put_hcd(hcd); ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); ++ if (usb_host_clock) { ++ clk_disable(usb_host_clock); ++ clk_put(usb_host_clock); ++ } ++ platform_set_drvdata(pdev, NULL); ++ return 0; ++} ++ ++static struct platform_driver ohci_hcd_bcm63xx_driver = { ++ .probe = ohci_hcd_bcm63xx_drv_probe, ++ .remove = __devexit_p(ohci_hcd_bcm63xx_drv_remove), ++ .shutdown = usb_hcd_platform_shutdown, ++ .driver = { ++ .name = "bcm63xx_ohci", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++MODULE_ALIAS("platform:bcm63xx_ohci"); +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -1051,6 +1051,11 @@ MODULE_LICENSE ("GPL"); + #define PLATFORM_DRIVER usb_hcd_pnx4008_driver + #endif + ++#ifdef CONFIG_BCM63XX ++#include "ohci-bcm63xx.c" ++#define PLATFORM_DRIVER ohci_hcd_bcm63xx_driver ++#endif ++ + #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \ + defined(CONFIG_CPU_SUBTYPE_SH7721) || \ + defined(CONFIG_CPU_SUBTYPE_SH7763) || \ +--- a/drivers/usb/host/ohci.h ++++ b/drivers/usb/host/ohci.h +@@ -655,7 +655,7 @@ static inline u32 hc32_to_cpup (const st + * some big-endian SOC implementations. Same thing happens with PSW access. + */ + +-#ifdef CONFIG_PPC_MPC52xx ++#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_BCM63XX) + #define big_endian_frame_no_quirk(ohci) (ohci->flags & OHCI_QUIRK_FRAME_NO) + #else + #define big_endian_frame_no_quirk(ohci) 0 diff --git a/target/linux/brcm63xx/patches-2.6.33/011-add_bcm63xx_ehci_controller.patch b/target/linux/brcm63xx/patches-2.6.33/011-add_bcm63xx_ehci_controller.patch new file mode 100644 index 0000000000..16ca692a2f --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/011-add_bcm63xx_ehci_controller.patch @@ -0,0 +1,178 @@ +Signed-off-by: Maxime Bizon +--- + drivers/usb/host/ehci-bcm63xx.c | 154 +++++++++++++++++++++++++++++++++++++++ + drivers/usb/host/ehci-hcd.c | 5 + + 2 files changed, 159 insertions(+), 0 deletions(-) + create mode 100644 drivers/usb/host/ehci-bcm63xx.c + +--- /dev/null ++++ b/drivers/usb/host/ehci-bcm63xx.c +@@ -0,0 +1,154 @@ ++/* ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2008 Maxime Bizon ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static int ehci_bcm63xx_setup(struct usb_hcd *hcd) ++{ ++ struct ehci_hcd *ehci = hcd_to_ehci(hcd); ++ int retval; ++ ++ retval = ehci_halt(ehci); ++ if (retval) ++ return retval; ++ ++ retval = ehci_init(hcd); ++ if (retval) ++ return retval; ++ ++ ehci_reset(ehci); ++ ehci_port_power(ehci, 0); ++ ++ return retval; ++} ++ ++ ++static const struct hc_driver ehci_bcm63xx_hc_driver = { ++ .description = hcd_name, ++ .product_desc = "BCM63XX integrated EHCI controller", ++ .hcd_priv_size = sizeof(struct ehci_hcd), ++ ++ .irq = ehci_irq, ++ .flags = HCD_MEMORY | HCD_USB2, ++ ++ .reset = ehci_bcm63xx_setup, ++ .start = ehci_run, ++ .stop = ehci_stop, ++ .shutdown = ehci_shutdown, ++ ++ .urb_enqueue = ehci_urb_enqueue, ++ .urb_dequeue = ehci_urb_dequeue, ++ .endpoint_disable = ehci_endpoint_disable, ++ ++ .get_frame_number = ehci_get_frame, ++ ++ .hub_status_data = ehci_hub_status_data, ++ .hub_control = ehci_hub_control, ++ .bus_suspend = ehci_bus_suspend, ++ .bus_resume = ehci_bus_resume, ++ .relinquish_port = ehci_relinquish_port, ++ .port_handed_over = ehci_port_handed_over, ++}; ++ ++static int __devinit ehci_hcd_bcm63xx_drv_probe(struct platform_device *pdev) ++{ ++ struct resource *res_mem; ++ struct usb_hcd *hcd; ++ struct ehci_hcd *ehci; ++ u32 reg; ++ int ret, irq; ++ ++ res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ irq = platform_get_irq(pdev, 0);; ++ if (!res_mem || irq < 0) ++ return -ENODEV; ++ ++ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_REG); ++ reg &= ~USBH_PRIV_SWAP_EHCI_DATA_MASK; ++ reg |= USBH_PRIV_SWAP_EHCI_ENDN_MASK; ++ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_REG); ++ ++ /* ++ * The magic value comes for the original vendor BSP and is ++ * needed for USB to work. Datasheet does not help, so the ++ * magic value is used as-is. ++ */ ++ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020, USBH_PRIV_TEST_REG); ++ ++ hcd = usb_create_hcd(&ehci_bcm63xx_hc_driver, &pdev->dev, "bcm63xx"); ++ if (!hcd) ++ return -ENOMEM; ++ hcd->rsrc_start = res_mem->start; ++ hcd->rsrc_len = res_mem->end - res_mem->start + 1; ++ ++ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { ++ pr_debug("request_mem_region failed\n"); ++ ret = -EBUSY; ++ goto out; ++ } ++ ++ hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); ++ if (!hcd->regs) { ++ pr_debug("ioremap failed\n"); ++ ret = -EIO; ++ goto out1; ++ } ++ ++ ehci = hcd_to_ehci(hcd); ++ ehci->big_endian_mmio = 1; ++ ehci->big_endian_desc = 0; ++ ehci->caps = hcd->regs; ++ ehci->regs = hcd->regs + ++ HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); ++ ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); ++ ehci->sbrn = 0x20; ++ ++ ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); ++ if (ret) ++ goto out2; ++ ++ platform_set_drvdata(pdev, hcd); ++ return 0; ++ ++out2: ++ iounmap(hcd->regs); ++out1: ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); ++out: ++ usb_put_hcd(hcd); ++ return ret; ++} ++ ++static int __devexit ehci_hcd_bcm63xx_drv_remove(struct platform_device *pdev) ++{ ++ struct usb_hcd *hcd; ++ ++ hcd = platform_get_drvdata(pdev); ++ usb_remove_hcd(hcd); ++ iounmap(hcd->regs); ++ usb_put_hcd(hcd); ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); ++ platform_set_drvdata(pdev, NULL); ++ return 0; ++} ++ ++static struct platform_driver ehci_hcd_bcm63xx_driver = { ++ .probe = ehci_hcd_bcm63xx_drv_probe, ++ .remove = __devexit_p(ehci_hcd_bcm63xx_drv_remove), ++ .shutdown = usb_hcd_platform_shutdown, ++ .driver = { ++ .name = "bcm63xx_ehci", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++MODULE_ALIAS("platform:bcm63xx_ehci"); +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -1158,6 +1158,11 @@ MODULE_LICENSE ("GPL"); + #define PLATFORM_DRIVER ehci_atmel_driver + #endif + ++#ifdef CONFIG_BCM63XX ++#include "ehci-bcm63xx.c" ++#define PLATFORM_DRIVER ehci_hcd_bcm63xx_driver ++#endif ++ + #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ + !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) + #error "missing bus glue for ehci-hcd" diff --git a/target/linux/brcm63xx/patches-2.6.33/012-mips_add_readl_writel_be_accessors.patch b/target/linux/brcm63xx/patches-2.6.33/012-mips_add_readl_writel_be_accessors.patch new file mode 100644 index 0000000000..71b715dcff --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/012-mips_add_readl_writel_be_accessors.patch @@ -0,0 +1,19 @@ +MIPS currently lacks the readl_be and writel_be accessors +which are required by BCM63xx for OHCI and EHCI support. +Let's define them globally for MIPS. This also fixes the +compilation of the bcm63xx defconfig against USB. + +Signed-off-by: Florian Fainelli +--- +--- a/arch/mips/include/asm/io.h ++++ b/arch/mips/include/asm/io.h +@@ -447,6 +447,9 @@ __BUILDIO(q, u64) + #define readl_relaxed readl + #define readq_relaxed readq + ++#define readl_be(addr) be32_to_cpu(__raw_readl((__force unsigned *)(addr))) ++#define writel_be(val, addr) __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) ++ + /* + * Some code tests for these symbols + */ diff --git a/target/linux/brcm63xx/patches-2.6.33/020-watchdog.patch b/target/linux/brcm63xx/patches-2.6.33/020-watchdog.patch new file mode 100644 index 0000000000..b4204d8f10 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/020-watchdog.patch @@ -0,0 +1,366 @@ +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -112,6 +112,7 @@ obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt + obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o + obj-$(CONFIG_AR7_WDT) += ar7_wdt.o + obj-$(CONFIG_TXX9_WDT) += txx9wdt.o ++obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o + + # PARISC Architecture + +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -840,6 +840,16 @@ config TXX9_WDT + help + Hardware driver for the built-in watchdog timer on TXx9 MIPS SoCs. + ++config BCM63XX_WDT ++ tristate "Broadcom BCM63xx hardware watchdog" ++ depends on BCM63XX ++ help ++ Watchdog driver for the built in watchdog hardware in Broadcom ++ BCM63xx SoC. ++ ++ To compile thi driver as a loadable module, choose M here. ++ The module will be called bcm63xx_wdt. ++ + # PARISC Architecture + + # POWERPC Architecture +--- /dev/null ++++ b/drivers/watchdog/bcm63xx_wdt.c +@@ -0,0 +1,334 @@ ++/* ++ * Broadcom BCM63xx SoC watchdog driver ++ * ++ * Copyright (C) 2007, Miguel Gaio ++ * Copyright (C) 2008, Florian Fainelli ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define PFX KBUILD_MODNAME ++ ++#define WDT_HZ 50000000 /* Fclk */ ++#define WDT_DEFAULT_TIME 30 /* seconds */ ++#define WDT_MAX_TIME 256 /* seconds */ ++ ++static struct { ++ void __iomem *regs; ++ struct timer_list timer; ++ int default_ticks; ++ unsigned long inuse; ++ atomic_t ticks; ++} bcm63xx_wdt_device; ++ ++static int expect_close; ++static int timeout; ++ ++static int wdt_time = WDT_DEFAULT_TIME; ++static int nowayout = WATCHDOG_NOWAYOUT; ++module_param(nowayout, int, 0); ++MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" ++ __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); ++ ++/* HW functions */ ++static void bcm63xx_wdt_hw_start(void) ++{ ++ bcm_writel(0xfffffffe, bcm63xx_wdt_device.regs + WDT_DEFVAL_REG); ++ bcm_writel(WDT_START_1, bcm63xx_wdt_device.regs + WDT_CTL_REG); ++ bcm_writel(WDT_START_2, bcm63xx_wdt_device.regs + WDT_CTL_REG); ++} ++ ++static void bcm63xx_wdt_hw_stop(void) ++{ ++ bcm_writel(WDT_STOP_1, bcm63xx_wdt_device.regs + WDT_CTL_REG); ++ bcm_writel(WDT_STOP_2, bcm63xx_wdt_device.regs + WDT_CTL_REG); ++} ++ ++static void bcm63xx_timer_tick(unsigned long unused) ++{ ++ if (!atomic_dec_and_test(&bcm63xx_wdt_device.ticks)) { ++ bcm63xx_wdt_hw_start(); ++ mod_timer(&bcm63xx_wdt_device.timer, jiffies + HZ); ++ } else ++ printk(KERN_CRIT PFX ": watchdog will restart system\n"); ++} ++ ++static void bcm63xx_wdt_pet(void) ++{ ++ atomic_set(&bcm63xx_wdt_device.ticks, wdt_time); ++} ++ ++static void bcm63xx_wdt_start(void) ++{ ++ bcm63xx_wdt_pet(); ++ bcm63xx_timer_tick(0); ++} ++ ++static void bcm63xx_wdt_pause(void) ++{ ++ del_timer_sync(&bcm63xx_wdt_device.timer); ++ bcm63xx_wdt_hw_stop(); ++} ++ ++static int bcm63xx_wdt_settimeout(int new_time) ++{ ++ if ((new_time <= 0) || (new_time > WDT_MAX_TIME)) ++ return -EINVAL; ++ ++ wdt_time = new_time; ++ ++ return 0; ++} ++ ++static int bcm63xx_wdt_open(struct inode *inode, struct file *file) ++{ ++ if (test_and_set_bit(0, &bcm63xx_wdt_device.inuse)) ++ return -EBUSY; ++ ++ bcm63xx_wdt_start(); ++ return nonseekable_open(inode, file); ++} ++ ++static int bcm63xx_wdt_release(struct inode *inode, struct file *file) ++{ ++ if (expect_close == 42) ++ bcm63xx_wdt_pause(); ++ else { ++ printk(KERN_CRIT PFX ++ ": Unexpected close, not stopping watchdog!\n"); ++ bcm63xx_wdt_start(); ++ } ++ clear_bit(0, &bcm63xx_wdt_device.inuse); ++ expect_close = 0; ++ return 0; ++} ++ ++static ssize_t bcm63xx_wdt_write(struct file *file, const char *data, ++ size_t len, loff_t *ppos) ++{ ++ if (len) { ++ if (!nowayout) { ++ size_t i; ++ ++ /* In case it was set long ago */ ++ expect_close = 0; ++ ++ for (i = 0; i != len; i++) { ++ char c; ++ if (get_user(c, data + i)) ++ return -EFAULT; ++ if (c == 'V') ++ expect_close = 42; ++ } ++ } ++ bcm63xx_wdt_pet(); ++ } ++ return len; ++} ++ ++static struct watchdog_info bcm63xx_wdt_info = { ++ .identity = PFX, ++ .options = WDIOF_SETTIMEOUT | ++ WDIOF_KEEPALIVEPING | ++ WDIOF_MAGICCLOSE, ++}; ++ ++ ++static long bcm63xx_wdt_ioctl(struct file *file, unsigned int cmd, ++ unsigned long arg) ++{ ++ void __user *argp = (void __user *)arg; ++ int __user *p = argp; ++ int new_value, retval = -EINVAL; ++ ++ switch (cmd) { ++ case WDIOC_GETSUPPORT: ++ return copy_to_user(argp, &bcm63xx_wdt_info, ++ sizeof(bcm63xx_wdt_info)) ? -EFAULT : 0; ++ ++ case WDIOC_GETSTATUS: ++ case WDIOC_GETBOOTSTATUS: ++ return put_user(0, p); ++ ++ case WDIOC_SETOPTIONS: ++ if (get_user(new_value, p)) ++ return -EFAULT; ++ ++ if (new_value & WDIOS_DISABLECARD) { ++ bcm63xx_wdt_pause(); ++ retval = 0; ++ } ++ if (new_value & WDIOS_ENABLECARD) { ++ bcm63xx_wdt_start(); ++ retval = 0; ++ } ++ ++ return retval; ++ ++ case WDIOC_KEEPALIVE: ++ bcm63xx_wdt_pet(); ++ return 0; ++ ++ case WDIOC_SETTIMEOUT: ++ if (get_user(new_value, p)) ++ return -EFAULT; ++ ++ if (bcm63xx_wdt_settimeout(new_value)) ++ return -EINVAL; ++ ++ bcm63xx_wdt_pet(); ++ ++ case WDIOC_GETTIMEOUT: ++ return put_user(wdt_time, p); ++ ++ default: ++ return -ENOTTY; ++ ++ } ++} ++ ++static int bcm63xx_wdt_notify_sys(struct notifier_block *this, ++ unsigned long code, void *unused) ++{ ++ if (code == SYS_DOWN || code == SYS_HALT) ++ bcm63xx_wdt_pause(); ++ return NOTIFY_DONE; ++} ++ ++static const struct file_operations bcm63xx_wdt_fops = { ++ .owner = THIS_MODULE, ++ .llseek = no_llseek, ++ .write = bcm63xx_wdt_write, ++ .unlocked_ioctl = bcm63xx_wdt_ioctl, ++ .open = bcm63xx_wdt_open, ++ .release = bcm63xx_wdt_release, ++}; ++ ++static struct miscdevice bcm63xx_wdt_miscdev = { ++ .minor = WATCHDOG_MINOR, ++ .name = "watchdog", ++ .fops = &bcm63xx_wdt_fops, ++}; ++ ++static struct notifier_block bcm63xx_wdt_notifier = { ++ .notifier_call = bcm63xx_wdt_notify_sys, ++}; ++ ++ ++static int bcm63xx_wdt_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct resource *r; ++ ++ setup_timer(&bcm63xx_wdt_device.timer, bcm63xx_timer_tick, 0L); ++ ++ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!r) { ++ printk(KERN_ERR PFX ++ "failed to retrieve resources\n"); ++ return -ENODEV; ++ } ++ ++ bcm63xx_wdt_device.regs = ioremap_nocache(r->start, r->end - r->start); ++ if (!bcm63xx_wdt_device.regs) { ++ printk(KERN_ERR PFX ++ "failed to remap I/O resources\n"); ++ return -ENXIO; ++ } ++ ++ if (bcm63xx_wdt_settimeout(wdt_time)) { ++ bcm63xx_wdt_settimeout(WDT_DEFAULT_TIME); ++ printk(KERN_INFO PFX ++ ": wdt_time value must be 1 <= wdt_time <= 256, using %d\n", ++ wdt_time); ++ } ++ ++ ret = register_reboot_notifier(&bcm63xx_wdt_notifier); ++ if (ret) { ++ printk(KERN_ERR PFX ++ "failed to register reboot_notifier\n"); ++ return ret; ++ } ++ ++ ret = misc_register(&bcm63xx_wdt_miscdev); ++ if (ret < 0) { ++ printk(KERN_ERR PFX ++ "failed to register watchdog device\n"); ++ goto unmap; ++ } ++ ++ printk(KERN_INFO PFX " started, timer margin: %d sec\n", WDT_DEFAULT_TIME); ++ ++ return 0; ++ ++unmap: ++ unregister_reboot_notifier(&bcm63xx_wdt_notifier); ++ iounmap(bcm63xx_wdt_device.regs); ++ return ret; ++} ++ ++static int bcm63xx_wdt_remove(struct platform_device *pdev) ++{ ++ if (!nowayout) ++ bcm63xx_wdt_pause(); ++ ++ misc_deregister(&bcm63xx_wdt_miscdev); ++ ++ iounmap(bcm63xx_wdt_device.regs); ++ ++ unregister_reboot_notifier(&bcm63xx_wdt_notifier); ++ ++ return 0; ++} ++ ++static struct platform_driver bcm63xx_wdt = { ++ .probe = bcm63xx_wdt_probe, ++ .remove = bcm63xx_wdt_remove, ++ .driver = { ++ .name = "bcm63xx-wdt", ++ } ++}; ++ ++static int __init bcm63xx_wdt_init(void) ++{ ++ return platform_driver_register(&bcm63xx_wdt); ++} ++ ++static void __exit bcm63xx_wdt_exit(void) ++{ ++ platform_driver_unregister(&bcm63xx_wdt); ++} ++ ++module_init(bcm63xx_wdt_init); ++module_exit(bcm63xx_wdt_exit); ++ ++MODULE_AUTHOR("Miguel Gaio "); ++MODULE_AUTHOR("Florian Fainelli "); ++MODULE_DESCRIPTION("Driver for the Broadcom BCM63xx SoC watchdog"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); ++MODULE_ALIAS("platform:bcm63xx-wdt"); diff --git a/target/linux/brcm63xx/patches-2.6.33/040-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-2.6.33/040-bcm963xx_flashmap.patch new file mode 100644 index 0000000000..c4631c868e --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/040-bcm963xx_flashmap.patch @@ -0,0 +1,693 @@ +From e734ace5baa04e0e8af1d4483475fbd6bd2b32a1 Mon Sep 17 00:00:00 2001 +From: Axel Gembe +Date: Mon, 12 May 2008 18:54:09 +0200 +Subject: [PATCH] bcm963xx: flashmap support + + +Signed-off-by: Axel Gembe +--- + drivers/mtd/maps/Kconfig | 7 +++++++ + drivers/mtd/maps/Makefile | 1 + + drivers/mtd/redboot.c | 13 ++++++++++--- + 3 files changed, 18 insertions(+), 3 deletions(-) + +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -257,6 +257,13 @@ config MTD_ALCHEMY + help + Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards + ++config MTD_BCM963XX ++ tristate "BCM963xx Flash device" ++ depends on MIPS && BCM63XX ++ help ++ Flash memory access on BCM963xx boards. Currently only works with ++ RedBoot and CFE. ++ + config MTD_DILNETPC + tristate "CFI Flash device mapped on DIL/Net PC" + depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -39,7 +39,7 @@ static inline int redboot_checksum(struc + return 1; + } + +-static int parse_redboot_partitions(struct mtd_info *master, ++int parse_redboot_partitions(struct mtd_info *master, + struct mtd_partition **pparts, + unsigned long fis_origin) + { +@@ -162,6 +162,14 @@ static int parse_redboot_partitions(stru + goto out; + } + ++ if (!fis_origin) { ++ for (i = 0; i < numslots; i++) { ++ if (!strncmp(buf[i].name, "RedBoot", 8)) { ++ fis_origin = (buf[i].flash_base & (master->size << 1) - 1); ++ } ++ } ++ } ++ + for (i = 0; i < numslots; i++) { + struct fis_list *new_fl, **prev; + +@@ -184,9 +192,8 @@ static int parse_redboot_partitions(stru + new_fl->img = &buf[i]; + if (fis_origin) { + buf[i].flash_base -= fis_origin; +- } else { +- buf[i].flash_base &= master->size-1; + } ++ buf[i].flash_base &= (master->size << 1) - 1; + + /* I'm sure the JFFS2 code has done me permanent damage. + * I now think the following is _normal_ +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -61,3 +61,4 @@ obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-asy + obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o + obj-$(CONFIG_MTD_VMU) += vmu-flash.o + obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o ++obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o +--- /dev/null ++++ b/drivers/mtd/maps/bcm963xx-flash.c +@@ -0,0 +1,399 @@ ++/* ++ * Copyright (C) 2006-2008 Florian Fainelli ++ * Mike Albon ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#define BUSWIDTH 2 /* Buswidth */ ++#define EXTENDED_SIZE 0xBFC00000 /* Extended flash address */ ++ ++#define PFX KBUILD_MODNAME ": " ++ ++extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long fis_origin); ++static struct mtd_partition *parsed_parts; ++ ++static struct mtd_info *bcm963xx_mtd_info; ++ ++static struct map_info bcm963xx_map = { ++ .name = "bcm963xx", ++ .bankwidth = BUSWIDTH, ++}; ++ ++static struct tagiddesc_t tagidtab[NUM_TAGID] = TAGID_DEFINITIONS; ++ ++static uint32_t tagcrc32tab[256] = { ++ 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, ++ 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, ++ 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, ++ 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, ++ 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, ++ 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, ++ 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, ++ 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, ++ 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, ++ 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, ++ 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, ++ 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, ++ 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, ++ 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, ++ 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, ++ 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, ++ 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, ++ 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, ++ 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, ++ 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, ++ 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, ++ 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, ++ 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, ++ 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, ++ 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, ++ 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, ++ 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, ++ 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, ++ 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, ++ 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, ++ 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, ++ 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D ++}; ++ ++static uint32_t tagcrc32(uint32_t crc, uint8_t *data, size_t len) ++{ ++ while (len--) ++ crc = (crc >> 8) ^ tagcrc32tab[(crc ^ *data++) & 0xFF]; ++ ++ return crc; ++} ++ ++static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition **pparts) ++{ ++ int nrparts = 3, curpart = 0; /* CFE,NVRAM and global LINUX are always present. */ ++ union bcm_tag *buf; ++ struct mtd_partition *parts; ++ int ret; ++ size_t retlen; ++ unsigned int rootfsaddr, kerneladdr, spareaddr; ++ unsigned int rootfslen, kernellen, sparelen, totallen; ++ unsigned char *tagid; ++ int namelen = 0; ++ int i; ++ uint32_t tagidcrc; ++ uint32_t calctagidcrc; ++ bool tagid_match = false; ++ char *boardid; ++ char *tagversion; ++ char *matchtagid; ++ ++ /* Allocate memory for buffer */ ++ buf = vmalloc(sizeof(union bcm_tag)); ++ if (!buf) ++ return -ENOMEM; ++ ++ /* Get the tag */ ++ ret = master->read(master,master->erasesize,sizeof(union bcm_tag), &retlen, (void *)buf); ++ if (retlen != sizeof(union bcm_tag)){ ++ vfree(buf); ++ return -EIO; ++ } ++ ++ /* tagId isn't in the same location, so we check each tagid against the ++ * tagid CRC. If the CRC is valid we have found the right tag and so ++ * use that tag ++ */ ++ ++ for (i = 0; i < NUM_TAGID; i++) { ++ switch(i) { ++ case 0: ++ matchtagid = "bccfe"; ++ tagid = &(buf->bccfe.tagId[0]); ++ sscanf(buf->bccfe.rootAddress,"%u", &rootfsaddr); ++ sscanf(buf->bccfe.rootLength, "%u", &rootfslen); ++ sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr); ++ sscanf(buf->bccfe.kernelLength, "%u", &kernellen); ++ sscanf(buf->bccfe.totalLength, "%u", &totallen); ++ tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]); ++ tagversion = &(buf->bccfe.tagVersion[0]); ++ boardid = &(buf->bccfe.boardid[0]); ++ break; ++ case 1: ++ matchtagid = "bc300"; ++ tagid = &(buf->bc300.tagId[0]); ++ sscanf(buf->bc300.rootAddress,"%u", &rootfsaddr); ++ sscanf(buf->bc300.rootLength, "%u", &rootfslen); ++ sscanf(buf->bc300.kernelAddress, "%u", &kerneladdr); ++ sscanf(buf->bc300.kernelLength, "%u", &kernellen); ++ sscanf(buf->bc300.totalLength, "%u", &totallen); ++ tagidcrc = *(uint32_t *)&(buf->bc300.tagIdCRC[0]); ++ tagversion = &(buf->bc300.tagVersion[0]); ++ boardid = &(buf->bc300.boardid[0]); ++ break; ++ case 2: ++ matchtagid = "ag306"; ++ tagid = &(buf->ag306.tagId[0]); ++ sscanf(buf->ag306.rootAddress,"%u", &rootfsaddr); ++ sscanf(buf->ag306.rootLength, "%u", &rootfslen); ++ sscanf(buf->ag306.kernelAddress, "%u", &kerneladdr); ++ sscanf(buf->ag306.kernelLength, "%u", &kernellen); ++ sscanf(buf->ag306.totalLength, "%u", &totallen); ++ tagidcrc = *(uint32_t *)&(buf->ag306.tagIdCRC[0]); ++ tagversion = &(buf->ag306.tagVersion[0]); ++ boardid = &(buf->ag306.boardid[0]); ++ break; ++ case 3: ++ matchtagid = "bc221"; ++ tagid = &(buf->bc221.tagId[0]); ++ sscanf(buf->bc221.rootAddress,"%u", &rootfsaddr); ++ sscanf(buf->bc221.rootLength, "%u", &rootfslen); ++ sscanf(buf->bc221.kernelAddress, "%u", &kerneladdr); ++ sscanf(buf->bc221.kernelLength, "%u", &kernellen); ++ sscanf(buf->bc221.totalLength, "%u", &totallen); ++ tagidcrc = *(uint32_t *)&(buf->bc221.tagIdCRC[0]); ++ tagversion = &(buf->bc221.tagVersion[0]); ++ boardid = &(buf->bc221.boardid[0]); ++ break; ++ case 4: ++ matchtagid = "bc310"; ++ tagid = &(buf->bc310.tagId[0]); ++ sscanf(buf->bc310.rootAddress,"%u", &rootfsaddr); ++ sscanf(buf->bc310.rootLength, "%u", &rootfslen); ++ sscanf(buf->bc310.kernelAddress, "%u", &kerneladdr); ++ sscanf(buf->bc310.kernelLength, "%u", &kernellen); ++ sscanf(buf->bc310.totalLength, "%u", &totallen); ++ tagidcrc = *(uint32_t *)&(buf->bc310.tagIdCRC[0]); ++ tagversion = &(buf->bc310.tagVersion[0]); ++ boardid = &(buf->bc310.boardid[0]); ++ break; ++ } ++ if (strncmp(tagid, matchtagid, TAGID_LEN) != 0) { ++ continue; ++ } ++ ++ calctagidcrc = htonl(tagcrc32(IMAGETAG_CRC_START, tagid, TAGID_LEN)); ++ if (tagidcrc == calctagidcrc) { ++ tagid_match = true; ++ break; ++ } ++ } ++ ++ if (!tagid_match) { ++ tagid = "bcram"; ++ sscanf(buf->bccfe.rootAddress,"%u", &rootfsaddr); ++ sscanf(buf->bccfe.rootLength, "%u", &rootfslen); ++ sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr); ++ sscanf(buf->bccfe.kernelLength, "%u", &kernellen); ++ sscanf(buf->bccfe.totalLength, "%u", &totallen); ++ tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]); ++ tagversion = &(buf->bccfe.tagVersion[0]); ++ boardid = &(buf->bccfe.boardid[0]); ++ } ++ ++ printk(KERN_INFO PFX "CFE boot tag found with version %s, board type %s, and tagid %s.\n",tagversion,boardid,tagid); ++ ++ rootfsaddr = rootfsaddr - EXTENDED_SIZE; ++ kerneladdr = kerneladdr - EXTENDED_SIZE; ++ spareaddr = roundup(totallen,master->erasesize) + master->erasesize; ++ sparelen = master->size - spareaddr - master->erasesize; ++ ++ /* Determine number of partitions */ ++ namelen = 8; ++ if (rootfslen > 0){ ++ nrparts++; ++ namelen =+ 6; ++ }; ++ if (kernellen > 0) { ++ nrparts++; ++ namelen =+ 6; ++ }; ++ ++ /* Ask kernel for more memory */ ++ parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL); ++ if (!parts) { ++ vfree(buf); ++ return -ENOMEM; ++ }; ++ ++ /* Start building partition list */ ++ parts[curpart].name = "CFE"; ++ parts[curpart].offset = 0; ++ parts[curpart].size = master->erasesize; ++ curpart++; ++ ++ if (kernellen > 0) { ++ parts[curpart].name = "kernel"; ++ parts[curpart].offset = kerneladdr; ++ parts[curpart].size = kernellen; ++ curpart++; ++ }; ++ ++ if (rootfslen > 0) { ++ parts[curpart].name = "rootfs"; ++ parts[curpart].offset = rootfsaddr; ++ parts[curpart].size = rootfslen; ++ if (sparelen > 0) ++ parts[curpart].size += sparelen; ++ curpart++; ++ }; ++ ++ parts[curpart].name = "nvram"; ++ parts[curpart].offset = master->size - master->erasesize; ++ parts[curpart].size = master->erasesize; ++ ++ /* Global partition "linux" to make easy firmware upgrade */ ++ curpart++; ++ parts[curpart].name = "linux"; ++ parts[curpart].offset = parts[0].size; ++ parts[curpart].size = master->size - parts[0].size - parts[3].size; ++ ++ for (i = 0; i < nrparts; i++) ++ printk(KERN_INFO PFX "Partition %d is %s offset %lx and length %lx\n", i, parts[i].name, parts[i].offset, parts[i].size); ++ ++ printk(KERN_INFO PFX "Spare partition is %x offset and length %x\n", spareaddr, sparelen); ++ *pparts = parts; ++ vfree(buf); ++ ++ return nrparts; ++}; ++ ++static int bcm963xx_detect_cfe(struct mtd_info *master) ++{ ++ int idoffset = 0x4e0; ++ static char idstring[8] = "CFE1CFE1"; ++ char buf[9]; ++ int ret; ++ size_t retlen; ++ ++ ret = master->read(master, idoffset, 8, &retlen, (void *)buf); ++ buf[retlen] = 0; ++ printk(KERN_INFO PFX "Read Signature value of %s\n", buf); ++ ++ return strncmp(idstring, buf, 8); ++} ++ ++static int bcm963xx_probe(struct platform_device *pdev) ++{ ++ int err = 0; ++ int parsed_nr_parts = 0; ++ char *part_type; ++ struct resource *r; ++ ++ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ bcm963xx_map.phys = r->start; ++ bcm963xx_map.size = (r->end - r->start) + 1; ++ bcm963xx_map.virt = ioremap(r->start, r->end - r->start + 1); ++ ++ if (!bcm963xx_map.virt) { ++ printk(KERN_ERR PFX "Failed to ioremap\n"); ++ return -EIO; ++ } ++ printk(KERN_INFO PFX "0x%08lx at 0x%08x\n", bcm963xx_map.size, bcm963xx_map.phys); ++ ++ simple_map_init(&bcm963xx_map); ++ ++ bcm963xx_mtd_info = do_map_probe("cfi_probe", &bcm963xx_map); ++ if (!bcm963xx_mtd_info) { ++ printk(KERN_ERR PFX "Failed to probe using CFI\n"); ++ err = -EIO; ++ goto err_probe; ++ } ++ ++ bcm963xx_mtd_info->owner = THIS_MODULE; ++ ++ /* This is mutually exclusive */ ++ if (bcm963xx_detect_cfe(bcm963xx_mtd_info) == 0) { ++ printk(KERN_INFO PFX "CFE bootloader detected\n"); ++ if (parsed_nr_parts == 0) { ++ int ret = parse_cfe_partitions(bcm963xx_mtd_info, &parsed_parts); ++ if (ret > 0) { ++ part_type = "CFE"; ++ parsed_nr_parts = ret; ++ } ++ } ++ } else { ++ printk(KERN_INFO PFX "assuming RedBoot bootloader\n"); ++ if (bcm963xx_mtd_info->size > 0x00400000) { ++ printk(KERN_INFO PFX "Support for extended flash memory size : 0x%lx ; ONLY 64MBIT SUPPORT\n", bcm963xx_mtd_info->size); ++ bcm963xx_map.virt = (u32)(EXTENDED_SIZE); ++ } ++ ++#ifdef CONFIG_MTD_REDBOOT_PARTS ++ if (parsed_nr_parts == 0) { ++ int ret = parse_redboot_partitions(bcm963xx_mtd_info, &parsed_parts, 0); ++ if (ret > 0) { ++ part_type = "RedBoot"; ++ parsed_nr_parts = ret; ++ } ++ } ++#endif ++ } ++ ++ return add_mtd_partitions(bcm963xx_mtd_info, parsed_parts, parsed_nr_parts); ++ ++err_probe: ++ iounmap(bcm963xx_map.virt); ++ return err; ++} ++ ++static int bcm963xx_remove(struct platform_device *pdev) ++{ ++ if (bcm963xx_mtd_info) { ++ del_mtd_partitions(bcm963xx_mtd_info); ++ map_destroy(bcm963xx_mtd_info); ++ } ++ ++ if (bcm963xx_map.virt) { ++ iounmap(bcm963xx_map.virt); ++ bcm963xx_map.virt = 0; ++ } ++ ++ return 0; ++} ++ ++static struct platform_driver bcm63xx_mtd_dev = { ++ .probe = bcm963xx_probe, ++ .remove = bcm963xx_remove, ++ .driver = { ++ .name = "bcm963xx-flash", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int __init bcm963xx_mtd_init(void) ++{ ++ return platform_driver_register(&bcm63xx_mtd_dev); ++} ++ ++static void __exit bcm963xx_mtd_exit(void) ++{ ++ platform_driver_unregister(&bcm63xx_mtd_dev); ++} ++ ++module_init(bcm963xx_mtd_init); ++module_exit(bcm963xx_mtd_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Broadcom BCM63xx MTD partition parser/mapping for CFE and RedBoot"); ++MODULE_AUTHOR("Florian Fainelli "); ++MODULE_AUTHOR("Mike Albon "); +--- /dev/null ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm_tag.h +@@ -0,0 +1,178 @@ ++#ifndef __BCM63XX_TAG_H ++#define __BCM63XX_TAG_H ++ ++#define IMAGE_LEN 10 /* Length of Length Field */ ++#define ADDRESS_LEN 12 /* Length of Address field */ ++#define TAGID_LEN 6 /* Length of tag ID */ ++#define TAGINFO_LEN 20 /* Length of vendor information field in tag */ ++#define TAGVER_LEN 4 /* Length of Tag Version */ ++#define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */ ++ ++#define NUM_TAGID 5 ++#define IMAGETAG_CRC_START 0xFFFFFFFF ++ ++struct tagiddesc_t { ++ char tagid[TAGID_LEN + 1]; ++ char tagiddesc[80]; ++}; ++ ++ // bc221 is used by BT Voyager and should be right ++ // bc310 should be right, and may apply to 3.08 code as well ++#define TAGID_DEFINITIONS { \ ++ { "bccfe", "Broadcom CFE flash image" }, \ ++ { "bc300", "Broadcom code version 3.00-3.06 and all ftp/tftp flash" }, \ ++ { "ag306", "Alice Gate (Pirelli, based on Broadcom 3.06)" }, \ ++ { "bc221", "Broadcom code version 2.21" }, \ ++ { "bc310", "Broadcom code version 3.10-3.12" }, \ ++} ++ ++struct bcm_tag_bccfe { ++ unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag ++ unsigned char sig_1[20]; // 4-23: Company Line 1 ++ unsigned char sig_2[14]; // 24-37: Company Line 2 ++ unsigned char chipid[6]; // 38-43: Chip this image is for ++ unsigned char boardid[16]; // 44-59: Board name ++ unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE ++ unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image ++ unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE ++ unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE ++ unsigned char rootAddress[ADDRESS_LEN]; // 94-105: Address in memory of rootfs ++ unsigned char rootLength[IMAGE_LEN]; // 106-115: Size of rootfs ++ unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel ++ unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel ++ unsigned char dualImage[2]; // 138-139: Unused at present ++ unsigned char inactiveFlag[2]; // 140-141: Unused at present ++ unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present ++ unsigned char tagId[TAGID_LEN]; // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced ++ unsigned char tagIdCRC[4]; // 168-171: CRC32 of tagId ++ unsigned char reserved1[44]; // 172-215: Reserved area not in use ++ unsigned char imageCRC[4]; // 216-219: CRC32 of images ++ unsigned char reserved2[16]; // 220-235: Unused at present ++ unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion ++ unsigned char reserved3[16]; // 240-255: Unused at present ++}; ++ ++struct bcm_tag_bc300 { ++ unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag ++ unsigned char sig_1[20]; // 4-23: Company Line 1 ++ unsigned char sig_2[14]; // 24-37: Company Line 2 ++ unsigned char chipid[6]; // 38-43: Chip this image is for ++ unsigned char boardid[16]; // 44-59: Board name ++ unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE ++ unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image ++ unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE ++ unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE ++ unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) ++ unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) ++ unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel ++ unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel ++ unsigned char dualImage[2]; // 138-139: Unused at present ++ unsigned char inactiveFlag[2]; // 140-141: Unused at present ++ unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present ++ unsigned char tagId[TAGID_LEN]; // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced ++ unsigned char tagIdCRC[4]; // 168-173: CRC32 to ensure validity of tagId ++ unsigned char rootAddress[ADDRESS_LEN]; // 174-183: Address in memory of rootfs partition ++ unsigned char rootLength[IMAGE_LEN]; // 184-193: Size of rootfs partition ++ unsigned char reserved1[22]; // 194-215: Reserved area not in use ++ unsigned char imageCRC[4]; // 216-219: CRC32 of images ++ unsigned char reserved2[16]; // 220-235: Unused at present ++ unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion ++ unsigned char reserved3[16]; // 240-255: Unused at present ++}; ++ ++struct bcm_tag_ag306 { ++ unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag ++ unsigned char sig_1[20]; // 4-23: Company Line 1 ++ unsigned char sig_2[14]; // 24-37: Company Line 2 ++ unsigned char chipid[6]; // 38-43: Chip this image is for ++ unsigned char boardid[16]; // 44-59: Board name ++ unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE ++ unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image ++ unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE ++ unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE ++ unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) ++ unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) ++ unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel ++ unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel ++ unsigned char dualImage[2]; // 138-139: Unused at present ++ unsigned char inactiveFlag[2]; // 140-141: Unused at present ++ unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present ++ unsigned char information2[54]; // 162-215: Compilation and related information (not generated/used by OpenWRT) ++ unsigned char kernelCRC[4] ; // 216-219: CRC32 of images ++ unsigned char rootAddress[ADDRESS_LEN]; // 220-231: Address in memory of rootfs partition ++ unsigned char tagIdCRC[4]; // 232-235: Checksum to ensure validity of tagId ++ unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion ++ unsigned char rootLength[IMAGE_LEN]; // 240-249: Size of rootfs ++ unsigned char tagId[TAGID_LEN]; // 250-255: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced ++}; ++ ++struct bcm_tag_bc221 { ++ unsigned char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag ++ unsigned char sig_1[20]; // 4-23: Company Line 1 ++ unsigned char sig_2[14]; // 24-37: Company Line 2 ++ unsigned char chipid[6]; // 38-43: Chip this image is for ++ unsigned char boardid[16]; // 44-59: Board name ++ unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE ++ unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image ++ unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE ++ unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE ++ unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) ++ unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) ++ unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel ++ unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel ++ unsigned char dualImage[2]; // 138-139: Unused at present ++ unsigned char inactiveFlag[2]; // 140-141: Unused at present ++ unsigned char rsa_signature[TAGINFO_LEN]; // 142-161: RSA Signature (unused at present; some vendors may use this) ++ unsigned char reserved5[2]; // 162-163: Unused at present ++ unsigned char tagId[TAGID_LEN]; // 164-169: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced ++ unsigned char rootAddress[ADDRESS_LEN]; // 170-181: Address in memory of rootfs partition ++ unsigned char rootLength[IMAGE_LEN]; // 182-191: Size of rootfs partition ++ unsigned char flashLayoutVer[4]; // 192-195: Version flash layout ++ unsigned char fskernelCRC[4]; // 196-199: Guessed to be kernel CRC ++ unsigned char reserved4[16]; // 200-215: Reserved area; unused at present ++ unsigned char imageCRC[4]; // 216-219: CRC32 of images ++ unsigned char reserved2[12]; // 220-231: Unused at present ++ unsigned char tagIdCRC[4]; // 232-235: CRC32 to ensure validity of tagId ++ unsigned char headerCRC[4]; // 236-239: CRC32 of header excluding tagVersion ++ unsigned char reserved3[16]; // 240-255: Unused at present ++}; ++ ++struct bcm_tag_bc310 { ++ unsigned char tagVersion[4]; // 0-3: Version of the image tag ++ unsigned char sig_1[20]; // 4-23: Company Line 1 ++ unsigned char sig_2[14]; // 24-37: Company Line 2 ++ unsigned char chipid[6]; // 38-43: Chip this image is for ++ unsigned char boardid[16]; // 44-59: Board name ++ unsigned char big_endian[2]; // 60-61: Map endianness -- 1 BE 0 LE ++ unsigned char totalLength[IMAGE_LEN]; // 62-71: Total length of image ++ unsigned char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE ++ unsigned char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE ++ unsigned char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of kernel (start of image) ++ unsigned char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) ++ unsigned char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel ++ unsigned char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel ++ unsigned char dualImage[2]; // 138-139: Unused at present ++ unsigned char inactiveFlag[2]; // 140-141: Unused at present ++ unsigned char information1[TAGINFO_LEN]; // 142-161: Unused at present; Some vendors use this for optional information ++ unsigned char tagId[6]; // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced ++ unsigned char tagIdCRC[4]; // 168-171: CRC32 to ensure validity of tagId ++ unsigned char rootAddress[ADDRESS_LEN]; // 172-183: Address in memory of rootfs partition ++ unsigned char rootLength[IMAGE_LEN]; // 184-193: Size of rootfs partition ++ unsigned char reserved1[22]; // 193-215: Reserved area not in use ++ unsigned char imageCRC[4]; // 216-219: CRC32 of images ++ unsigned char rootfsCRC[4]; // 220-227: CRC32 of rootfs partition ++ unsigned char kernelCRC[4]; // 224-227: CRC32 of kernel partition ++ unsigned char reserved2[8]; // 228-235: Unused at present ++ unsigned char headerCRC[4]; // 235-239: CRC32 of header excluding tagVersion ++ unsigned char reserved3[16]; // 240-255: Unused at present ++}; ++ ++union bcm_tag { ++ struct bcm_tag_bccfe bccfe; ++ struct bcm_tag_bc300 bc300; ++ struct bcm_tag_ag306 ag306; ++ struct bcm_tag_bc221 bc221; ++ struct bcm_tag_bc310 bc310; ++}; ++ ++#endif /* __BCM63XX_TAG_H */ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -721,20 +721,6 @@ static int board_get_mac_address(u8 *mac + return 0; + } + +-static struct mtd_partition mtd_partitions[] = { +- { +- .name = "cfe", +- .offset = 0x0, +- .size = 0x40000, +- } +-}; +- +-static struct physmap_flash_data flash_data = { +- .width = 2, +- .nr_parts = ARRAY_SIZE(mtd_partitions), +- .parts = mtd_partitions, +-}; +- + static struct resource mtd_resources[] = { + { + .start = 0, /* filled at runtime */ +@@ -744,12 +730,9 @@ static struct resource mtd_resources[] = + }; + + static struct platform_device mtd_dev = { +- .name = "physmap-flash", ++ .name = "bcm963xx-flash", + .resource = mtd_resources, + .num_resources = ARRAY_SIZE(mtd_resources), +- .dev = { +- .platform_data = &flash_data, +- }, + }; + + /* diff --git a/target/linux/brcm63xx/patches-2.6.33/070_bcm63xx_enet_vlan_incoming_fixed.patch b/target/linux/brcm63xx/patches-2.6.33/070_bcm63xx_enet_vlan_incoming_fixed.patch new file mode 100644 index 0000000000..dd0a72246a --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/070_bcm63xx_enet_vlan_incoming_fixed.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/bcm63xx_enet.c ++++ b/drivers/net/bcm63xx_enet.c +@@ -1523,7 +1523,7 @@ static int compute_hw_mtu(struct bcm_ene + actual_mtu = mtu; + + /* add ethernet header + vlan tag size */ +- actual_mtu += VLAN_ETH_HLEN; ++ actual_mtu += VLAN_ETH_HLEN + VLAN_HLEN; + + if (actual_mtu < 64 || actual_mtu > BCMENET_MAX_MTU) + return -EINVAL; diff --git a/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch b/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch new file mode 100644 index 0000000000..e1faeeedaf --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/100-reset_buttons.patch @@ -0,0 +1,88 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -15,6 +15,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -288,6 +290,16 @@ static struct board_info __initdata boar + .active_low = 1, + }, + }, ++ .reset_buttons = { ++ { ++ .desc = "reset", ++ .gpio = 32, ++ .active_low = 1, ++ .type = EV_KEY, ++ .code = BTN_0, ++ .threshold = 3, ++ }, ++ }, + }; + + static struct board_info __initdata board_96348gw = { +@@ -345,6 +357,16 @@ static struct board_info __initdata boar + .active_low = 1, + }, + }, ++ .reset_buttons = { ++ { ++ .desc = "reset", ++ .gpio = 36, ++ .active_low = 1, ++ .type = EV_KEY, ++ .code = BTN_0, ++ .threshold = 3, ++ }, ++ }, + }; + + static struct board_info __initdata board_FAST2404 = { +@@ -770,6 +792,16 @@ static struct platform_device bcm63xx_gp + .dev.platform_data = &bcm63xx_led_data, + }; + ++static struct gpio_buttons_platform_data bcm63xx_gpio_buttons_data = { ++ .poll_interval = 20, ++}; ++ ++static struct platform_device bcm63xx_gpio_buttons_device = { ++ .name = "gpio-buttons", ++ .id = 0, ++ .dev.platform_data = &bcm63xx_gpio_buttons_data, ++}; ++ + /* + * third stage init callback, register all board devices. + */ +@@ -825,6 +857,13 @@ int __init board_register_devices(void) + + platform_device_register(&bcm63xx_gpio_leds); + ++ if (board.reset_buttons) { ++ bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons); ++ bcm63xx_gpio_buttons_data.buttons = board.reset_buttons; ++ ++ platform_device_register(&bcm63xx_gpio_buttons_device); ++ } ++ + return 0; + } + +--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h ++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +@@ -55,6 +55,9 @@ struct board_info { + + /* GPIO LEDs */ + struct gpio_led leds[5]; ++ ++ /* Reset button */ ++ struct gpio_button reset_buttons[1]; + }; + + #endif /* ! BOARD_BCM963XX_H_ */ diff --git a/target/linux/brcm63xx/patches-2.6.33/110-gpiodev.patch b/target/linux/brcm63xx/patches-2.6.33/110-gpiodev.patch new file mode 100644 index 0000000000..8530c4e872 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/110-gpiodev.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -784,6 +784,10 @@ static struct ssb_sprom bcm63xx_sprom = + }; + #endif + ++static struct resource gpiodev_resource = { ++ .start = 0xFFFFFFFF, ++}; ++ + static struct gpio_led_platform_data bcm63xx_led_data; + + static struct platform_device bcm63xx_gpio_leds = { +@@ -852,6 +856,8 @@ int __init board_register_devices(void) + + platform_device_register(&mtd_dev); + ++ platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); ++ + bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); + bcm63xx_led_data.leds = board.leds; + diff --git a/target/linux/brcm63xx/patches-2.6.33/120-board_rta1025w_16.patch b/target/linux/brcm63xx/patches-2.6.33/120-board_rta1025w_16.patch new file mode 100644 index 0000000000..370c397062 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/120-board_rta1025w_16.patch @@ -0,0 +1,36 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -392,6 +392,25 @@ static struct board_info __initdata boar + .has_ehci0 = 1, + }; + ++static struct board_info __initdata board_rta1025w_16 = { ++ .name = "RTA1025W_16", ++ .expected_cpu_id = 0x6348, ++ ++ .has_enet0 = 1, ++ .has_enet1 = 1, ++ .has_pci = 1, ++ ++ .enet0 = { ++ .has_phy = 1, ++ .use_internal_phy = 1, ++ }, ++ .enet1 = { ++ .force_speed_100 = 1, ++ .force_duplex_full = 1, ++ }, ++}; ++ ++ + static struct board_info __initdata board_DV201AMR = { + .name = "DV201AMR", + .expected_cpu_id = 0x6348, +@@ -576,6 +595,7 @@ static const struct board_info __initdat + &board_FAST2404, + &board_DV201AMR, + &board_96348gw_a, ++ &board_rta1025w_16, + #endif + + #ifdef CONFIG_BCM63XX_CPU_6358 diff --git a/target/linux/brcm63xx/patches-2.6.33/130-board_DWVS0.patch b/target/linux/brcm63xx/patches-2.6.33/130-board_DWVS0.patch new file mode 100644 index 0000000000..440189cd55 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/130-board_DWVS0.patch @@ -0,0 +1,38 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -574,6 +574,27 @@ static struct board_info __initdata boar + .has_ohci0 = 1, + .has_ehci0 = 1, + }; ++ ++static struct board_info __initdata board_DWVS0 = { ++ .name = "DWV-S0", ++ .expected_cpu_id = 0x6358, ++ ++ .has_enet0 = 1, ++ .has_enet1 = 1, ++ .has_pci = 1, ++ ++ .enet0 = { ++ .has_phy = 1, ++ .use_internal_phy = 1, ++ }, ++ ++ .enet1 = { ++ .force_speed_100 = 1, ++ .force_duplex_full = 1, ++ }, ++ ++ .has_ohci0 = 1, ++}; + #endif + + /* +@@ -602,6 +623,7 @@ static const struct board_info __initdat + &board_96358vw, + &board_96358vw2, + &board_AGPFS0, ++ &board_DWVS0, + #endif + }; + diff --git a/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch b/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch new file mode 100644 index 0000000000..f1a66c9f91 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/140-new_bcm96348gw_leds.patch @@ -0,0 +1,82 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -336,24 +336,39 @@ static struct board_info __initdata boar + .active_low = 1, + }, + { +- .name = "ppp", +- .gpio = 3, ++ .name = "power", ++ .gpio = 0, + .active_low = 1, ++ .default_trigger = "default-on", + }, + { +- .name = "ppp-fail", ++ .name = "stop", ++ .gpio = 1, ++ .active_low = 1, ++ }, ++ { ++ .name = "line1", + .gpio = 4, + .active_low = 1, + }, + { +- .name = "power", +- .gpio = 0, ++ .name = "line2", ++ .gpio = 5, + .active_low = 1, +- .default_trigger = "default-on", + }, + { +- .name = "stop", +- .gpio = 1, ++ .name = "line3", ++ .gpio = 6, ++ .active_low = 1, ++ }, ++ { ++ .name = "tel", ++ .gpio = 7, ++ .active_low = 1, ++ }, ++ { ++ .name = "eth", ++ .gpio = 35, + .active_low = 1, + }, + }, +@@ -854,6 +869,7 @@ static struct platform_device bcm63xx_gp + int __init board_register_devices(void) + { + u32 val; ++ int led_count = 0; + + if (board.has_pccard) + bcm63xx_pcmcia_register(); +@@ -900,7 +916,11 @@ int __init board_register_devices(void) + + platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); + +- bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); ++ /* count number of LEDs defined by this device */ ++ while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name) ++ led_count++; ++ ++ bcm63xx_led_data.num_leds = led_count; + bcm63xx_led_data.leds = board.leds; + + platform_device_register(&bcm63xx_gpio_leds); +--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h ++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +@@ -54,7 +54,7 @@ struct board_info { + struct bcm63xx_dsp_platform_data dsp; + + /* GPIO LEDs */ +- struct gpio_led leds[5]; ++ struct gpio_led leds[8]; + + /* Reset button */ + struct gpio_button reset_buttons[1]; diff --git a/target/linux/brcm63xx/patches-2.6.33/150-alice_gate2_leds.patch b/target/linux/brcm63xx/patches-2.6.33/150-alice_gate2_leds.patch new file mode 100644 index 0000000000..7795f99efd --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/150-alice_gate2_leds.patch @@ -0,0 +1,66 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -588,6 +588,63 @@ static struct board_info __initdata boar + + .has_ohci0 = 1, + .has_ehci0 = 1, ++ ++ .leds = { ++ /*Each led on alice gate is bi-color */ ++ { ++ .name = "power:red", ++ .gpio = 5, ++ .active_low = 1, ++ }, ++ { ++ .name = "power:green", ++ .gpio = 4, ++ .active_low = 1, ++ .default_trigger = "default-on", ++ }, ++ { ++ .name = "wifi:red", ++ .gpio = 23, ++ .active_low = 1, ++ }, ++ { ++ .name = "wifi:green", ++ .gpio = 22, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr1:red", ++ .gpio = 27, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr1:green", ++ .gpio = 26, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr2:red", ++ .gpio = 30, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr2:green", ++ .gpio = 29, ++ .active_low = 1, ++ }, ++ }, ++ ++ .reset_buttons = { ++ { ++ .desc = "sw2", ++ .gpio = 37, ++ .active_low = 1, ++ .type = EV_KEY, ++ .code = BTN_0, ++ .threshold = 3, ++ }, ++ }, ++ /* sw1 is connected to gpio34*/ + }; + + static struct board_info __initdata board_DWVS0 = { diff --git a/target/linux/brcm63xx/patches-2.6.33/160-fix_gpio_count.patch b/target/linux/brcm63xx/patches-2.6.33/160-fix_gpio_count.patch new file mode 100644 index 0000000000..f99768536d --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/160-fix_gpio_count.patch @@ -0,0 +1,13 @@ +--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h +@@ -10,6 +10,10 @@ static inline unsigned long bcm63xx_gpio + switch (bcm63xx_get_cpu_id()) { + case BCM6358_CPU_ID: + return 40; ++ case BCM6338_CPU_ID: ++ return 8; ++ case BCM6345_CPU_ID: ++ return 16; + case BCM6348_CPU_ID: + default: + return 37; diff --git a/target/linux/brcm63xx/patches-2.6.33/170-board_livebox.patch b/target/linux/brcm63xx/patches-2.6.33/170-board_livebox.patch new file mode 100644 index 0000000000..38b0041850 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/170-board_livebox.patch @@ -0,0 +1,250 @@ +--- a/arch/mips/bcm63xx/boards/Kconfig ++++ b/arch/mips/bcm63xx/boards/Kconfig +@@ -8,4 +8,10 @@ config BOARD_BCM963XX + select SSB + help + ++config BOARD_LIVEBOX ++ bool "Inventel Livebox(es) boards" ++ select SSB ++ help ++ Inventel Livebox boards using the RedBoot bootloader. ++ + endchoice +--- a/arch/mips/bcm63xx/boards/Makefile ++++ b/arch/mips/bcm63xx/boards/Makefile +@@ -1,3 +1,4 @@ + obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o ++obj-$(CONFIG_BOARD_LIVEBOX) += board_livebox.o + + EXTRA_CFLAGS += -Werror +--- /dev/null ++++ b/arch/mips/bcm63xx/boards/board_livebox.c +@@ -0,0 +1,227 @@ ++/* ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ * ++ * Copyright (C) 2008 Florian Fainelli ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define PFX "board_livebox: " ++ ++static unsigned int mac_addr_used = 0; ++static struct board_info board; ++ ++/* ++ * known 6348 boards ++ */ ++#ifdef CONFIG_BCM63XX_CPU_6348 ++static struct board_info __initdata board_livebox = { ++ .name = "Livebox", ++ .expected_cpu_id = 0x6348, ++ ++ .has_enet0 = 1, ++ .has_enet1 = 1, ++ .has_pci = 1, ++ ++ .enet0 = { ++ .has_phy = 1, ++ .use_internal_phy = 1, ++ }, ++ ++ .enet1 = { ++ .force_speed_100 = 1, ++ .force_duplex_full = 1, ++ }, ++ ++ .has_ohci0 = 1, ++ .has_pccard = 1, ++ .has_ehci0 = 1, ++}; ++#endif ++ ++/* ++ * all boards ++ */ ++static const struct board_info __initdata *bcm963xx_boards[] = { ++#ifdef CONFIG_BCM63XX_CPU_6348 ++ &board_livebox ++#endif ++}; ++ ++/* ++ * early init callback ++ */ ++void __init board_prom_init(void) ++{ ++ u32 val; ++ ++ /* read base address of boot chip select (0) */ ++ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); ++ val &= MPI_CSBASE_BASE_MASK; ++ ++ /* assume board is a Livebox */ ++ memcpy(&board, bcm963xx_boards[0], sizeof(board)); ++ ++ /* setup pin multiplexing depending on board enabled device, ++ * this has to be done this early since PCI init is done ++ * inside arch_initcall */ ++ val = 0; ++ ++ if (board.has_pci) { ++ bcm63xx_pci_enabled = 1; ++ if (BCMCPU_IS_6348()) ++ val |= GPIO_MODE_6348_G2_PCI; ++ } ++ ++ if (board.has_pccard) { ++ if (BCMCPU_IS_6348()) ++ val |= GPIO_MODE_6348_G1_MII_PCCARD; ++ } ++ ++ if (board.has_enet0 && !board.enet0.use_internal_phy) { ++ if (BCMCPU_IS_6348()) ++ val |= GPIO_MODE_6348_G3_EXT_MII | ++ GPIO_MODE_6348_G0_EXT_MII; ++ } ++ ++ if (board.has_enet1 && !board.enet1.use_internal_phy) { ++ if (BCMCPU_IS_6348()) ++ val |= GPIO_MODE_6348_G3_EXT_MII | ++ GPIO_MODE_6348_G0_EXT_MII; ++ } ++ ++ bcm_gpio_writel(val, GPIO_MODE_REG); ++} ++ ++/* ++ * second stage init callback, good time to panic if we couldn't ++ * identify on which board we're running since early printk is working ++ */ ++void __init board_setup(void) ++{ ++ if (!board.name[0]) ++ panic("unable to detect bcm963xx board"); ++ printk(KERN_INFO PFX "board name: %s\n", board.name); ++ ++ /* make sure we're running on expected cpu */ ++ if (bcm63xx_get_cpu_id() != board.expected_cpu_id) ++ panic("unexpected CPU for bcm963xx board"); ++} ++ ++/* ++ * return board name for /proc/cpuinfo ++ */ ++const char *board_get_name(void) ++{ ++ return board.name; ++} ++ ++/* ++ * register & return a new board mac address ++ */ ++ ++static int board_get_mac_address(u8 *mac) ++{ ++ u8 default_mac[ETH_ALEN] = {0x00, 0x07, 0x3A, 0x00, 0x00, 0x00}; ++ u8 *p; ++ int count; ++ ++ memcpy(mac, default_mac, ETH_ALEN); ++ ++ p = mac + ETH_ALEN - 1; ++ count = mac_addr_used; ++ ++ while (count--) { ++ do { ++ (*p)++; ++ if (*p != 0) ++ break; ++ p--; ++ } while (p != mac); ++ } ++ ++ if (p == mac) { ++ printk(KERN_ERR PFX "unable to fetch mac address\n"); ++ return -ENODEV; ++ } ++ mac_addr_used++; ++ ++ return 0; ++} ++ ++static struct resource mtd_resources[] = { ++ { ++ .start = 0, /* filled at runtime */ ++ .end = 0, /* filled at runtime */ ++ .flags = IORESOURCE_MEM, ++ } ++}; ++ ++static struct platform_device mtd_dev = { ++ .name = "bcm963xx-flash", ++ .resource = mtd_resources, ++ .num_resources = ARRAY_SIZE(mtd_resources), ++}; ++ ++ ++/* ++ * third stage init callback, register all board devices. ++ */ ++int __init board_register_devices(void) ++{ ++ u32 val; ++ ++ bcm63xx_uart_register(); ++ bcm63xx_wdt_register(); ++ ++ if (board.has_pccard) ++ bcm63xx_pcmcia_register(); ++ ++ if (board.has_enet0 && ++ !board_get_mac_address(board.enet0.mac_addr)) ++ bcm63xx_enet_register(0, &board.enet0); ++ ++ if (board.has_enet1 && ++ !board_get_mac_address(board.enet1.mac_addr)) ++ bcm63xx_enet_register(1, &board.enet1); ++ ++ if (board.has_ohci0) ++ bcm63xx_ohci_register(); ++ ++ if (board.has_ehci0) ++ bcm63xx_ehci_register(); ++ ++ ++ /* read base address of boot chip select (0) */ ++ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); ++ val &= MPI_CSBASE_BASE_MASK; ++ mtd_resources[0].start = val; ++ mtd_resources[0].end = 0x1FFFFFFF; ++ ++ platform_device_register(&mtd_dev); ++ ++ return 0; ++} ++ diff --git a/target/linux/brcm63xx/patches-2.6.33/180-udc_preliminary_support.patch b/target/linux/brcm63xx/patches-2.6.33/180-udc_preliminary_support.patch new file mode 100644 index 0000000000..e0999da41c --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/180-udc_preliminary_support.patch @@ -0,0 +1,243 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + + #define PFX "board_bcm963xx: " +@@ -405,6 +406,8 @@ static struct board_info __initdata boar + .has_ohci0 = 1, + .has_pccard = 1, + .has_ehci0 = 1, ++ ++ .has_udc0 = 1, + }; + + static struct board_info __initdata board_rta1025w_16 = { +@@ -948,6 +951,9 @@ int __init board_register_devices(void) + if (board.has_dsp) + bcm63xx_dsp_register(&board.dsp); + ++ if (board.has_udc0) ++ bcm63xx_udc_register(); ++ + /* Generate MAC address for WLAN and + * register our SPROM */ + #ifdef CONFIG_SSB_PCIHOST +--- /dev/null ++++ b/arch/mips/bcm63xx/dev-usb-udc.c +@@ -0,0 +1,58 @@ ++/* ++ * Copyright (C) 2009 Henk Vergonet ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++#include ++#include ++#include ++#include ++ ++static struct resource udc_resources[] = { ++ { ++ .start = -1, /* filled at runtime */ ++ .end = -1, /* filled at runtime */ ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = -1, /* filled at runtime */ ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 udc_dmamask = ~(u32)0; ++ ++static struct platform_device bcm63xx_udc_device = { ++ .name = "bcm63xx-udc", ++ .id = 0, ++ .num_resources = ARRAY_SIZE(udc_resources), ++ .resource = udc_resources, ++ .dev = { ++ .dma_mask = &udc_dmamask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++}; ++ ++int __init bcm63xx_udc_register(void) ++{ ++ if (!BCMCPU_IS_6338() && !BCMCPU_IS_6345() && !BCMCPU_IS_6348()) ++ return 0; ++ ++ udc_resources[0].start = bcm63xx_regset_address(RSET_UDC0); ++ udc_resources[0].end = udc_resources[0].start; ++ udc_resources[0].end += RSET_UDC_SIZE - 1; ++ udc_resources[1].start = bcm63xx_get_irq_number(IRQ_UDC0); ++ return platform_device_register(&bcm63xx_udc_device); ++} +--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +@@ -125,7 +125,7 @@ enum bcm63xx_regs_set { + #define BCM_6338_UART0_BASE (0xfffe0300) + #define BCM_6338_GPIO_BASE (0xfffe0400) + #define BCM_6338_SPI_BASE (0xfffe0c00) +-#define BCM_6338_UDC0_BASE (0xdeadbeef) ++#define BCM_6338_UDC0_BASE (0xfffe3000) + #define BCM_6338_USBDMA_BASE (0xfffe2400) + #define BCM_6338_OHCI0_BASE (0xdeadbeef) + #define BCM_6338_OHCI_PRIV_BASE (0xfffe3000) +@@ -155,7 +155,7 @@ enum bcm63xx_regs_set { + #define BCM_6345_UART0_BASE (0xfffe0300) + #define BCM_6345_GPIO_BASE (0xfffe0400) + #define BCM_6345_SPI_BASE (0xdeadbeef) +-#define BCM_6345_UDC0_BASE (0xdeadbeef) ++#define BCM_6345_UDC0_BASE (0xfffe2100) + #define BCM_6345_USBDMA_BASE (0xfffe2800) + #define BCM_6345_ENET0_BASE (0xfffe1800) + #define BCM_6345_ENETDMA_BASE (0xfffe2800) +@@ -210,7 +210,7 @@ enum bcm63xx_regs_set { + #define BCM_6358_UART0_BASE (0xfffe0100) + #define BCM_6358_GPIO_BASE (0xfffe0080) + #define BCM_6358_SPI_BASE (0xdeadbeef) +-#define BCM_6358_UDC0_BASE (0xfffe0800) ++#define BCM_6358_UDC0_BASE (0xfffe0400) + #define BCM_6358_OHCI0_BASE (0xfffe1400) + #define BCM_6358_OHCI_PRIV_BASE (0xdeadbeef) + #define BCM_6358_USBH_PRIV_BASE (0xfffe1500) +@@ -430,6 +430,7 @@ enum bcm63xx_irq { + IRQ_TIMER = 0, + IRQ_UART0, + IRQ_DSL, ++ IRQ_UDC0, + IRQ_ENET0, + IRQ_ENET1, + IRQ_ENET_PHY, +@@ -472,7 +473,7 @@ enum bcm63xx_irq { + #define BCM_6345_UART0_IRQ (IRQ_INTERNAL_BASE + 2) + #define BCM_6345_DSL_IRQ (IRQ_INTERNAL_BASE + 3) + #define BCM_6345_ATM_IRQ (IRQ_INTERNAL_BASE + 4) +-#define BCM_6345_USB_IRQ (IRQ_INTERNAL_BASE + 5) ++#define BCM_6345_UDC0_IRQ (IRQ_INTERNAL_BASE + 5) + #define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8) + #define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) + #define BCM_6345_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 13 + 1) +@@ -494,10 +495,17 @@ enum bcm63xx_irq { + #define BCM_6348_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) + #define BCM_6348_UART0_IRQ (IRQ_INTERNAL_BASE + 2) + #define BCM_6348_DSL_IRQ (IRQ_INTERNAL_BASE + 4) ++#define BCM_6348_UDC0_IRQ (IRQ_INTERNAL_BASE + 6) + #define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7) + #define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8) + #define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) + #define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12) ++#define BCM_6348_USB_CNTL_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 14) ++#define BCM_6348_USB_CNTL_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 15) ++#define BCM_6348_USB_BULK_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 16) ++#define BCM_6348_USB_BULK_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 17) ++#define BCM_6348_USB_ISO_RX_DMA_IRQ (IRQ_INTERNAL_BASE + 18) ++#define BCM_6348_USB_ISO_TX_DMA_IRQ (IRQ_INTERNAL_BASE + 19) + #define BCM_6348_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 20) + #define BCM_6348_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 21) + #define BCM_6348_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 22) +--- /dev/null ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_udc.h +@@ -0,0 +1,6 @@ ++#ifndef BCM63XX_DEV_USB_UDC_H_ ++#define BCM63XX_DEV_USB_UDC_H_ ++ ++int bcm63xx_udc_register(void); ++ ++#endif /* BCM63XX_DEV_USB_UDC_H_ */ +--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h ++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +@@ -45,6 +45,7 @@ struct board_info { + unsigned int has_ohci0:1; + unsigned int has_ehci0:1; + unsigned int has_dsp:1; ++ unsigned int has_udc0:1; + + /* ethernet config */ + struct bcm63xx_enet_platform_data enet0; +--- a/arch/mips/bcm63xx/Makefile ++++ b/arch/mips/bcm63xx/Makefile +@@ -1,6 +1,6 @@ + obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ + dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \ +- dev-usb-ohci.o dev-usb-ehci.o ++ dev-usb-ohci.o dev-usb-ehci.o dev-usb-udc.o + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + + obj-y += boards/ +--- a/arch/mips/bcm63xx/clk.c ++++ b/arch/mips/bcm63xx/clk.c +@@ -141,6 +141,30 @@ static struct clk clk_usbh = { + }; + + /* ++ * USB slave clock ++ */ ++static void usbs_set(struct clk *clk, int enable) ++{ ++ u32 mask; ++ ++ switch(bcm63xx_get_cpu_id()) { ++ case BCM6338_CPU_ID: ++ mask = CKCTL_6338_USBS_EN; ++ break; ++ case BCM6348_CPU_ID: ++ mask = CKCTL_6348_USBS_EN; ++ break; ++ default: ++ return; ++ } ++ bcm_hwclock_set(mask, enable); ++} ++ ++static struct clk clk_usbs = { ++ .set = usbs_set, ++}; ++ ++/* + * SPI clock + */ + static void spi_set(struct clk *clk, int enable) +@@ -208,6 +232,8 @@ struct clk *clk_get(struct device *dev, + return &clk_ephy; + if (!strcmp(id, "usbh")) + return &clk_usbh; ++ if (!strcmp(id, "usbs")) ++ return &clk_usbs; + if (!strcmp(id, "spi")) + return &clk_spi; + if (!strcmp(id, "periph")) +--- a/arch/mips/bcm63xx/Kconfig ++++ b/arch/mips/bcm63xx/Kconfig +@@ -7,6 +7,7 @@ config BCM63XX_CPU_6338 + select USB_ARCH_HAS_OHCI + select USB_OHCI_BIG_ENDIAN_DESC + select USB_OHCI_BIG_ENDIAN_MMIO ++ select USB_ARCH_HAS_UDC + + config BCM63XX_CPU_6345 + bool "support 6345 CPU" +@@ -19,6 +20,7 @@ config BCM63XX_CPU_6348 + select USB_ARCH_HAS_OHCI + select USB_OHCI_BIG_ENDIAN_DESC + select USB_OHCI_BIG_ENDIAN_MMIO ++ select USB_ARCH_HAS_UDC + + config BCM63XX_CPU_6358 + bool "support 6358 CPU" diff --git a/target/linux/brcm63xx/patches-2.6.33/190-typo_cpu_features_override.patch b/target/linux/brcm63xx/patches-2.6.33/190-typo_cpu_features_override.patch new file mode 100644 index 0000000000..cf5e6111f4 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/190-typo_cpu_features_override.patch @@ -0,0 +1,19 @@ +Fix typo: CONFIG_BCMCPU_IS_63xx does not exists, +CONFIG_BCM63XX_CPU_63xx is the valid config option. + +Signed-off-by: Maxime Bizon +--- + .../asm/mach-bcm63xx/cpu-feature-overrides.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +--- a/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h ++++ b/arch/mips/include/asm/mach-bcm63xx/cpu-feature-overrides.h +@@ -24,7 +24,7 @@ + #define cpu_has_smartmips 0 + #define cpu_has_vtag_icache 0 + +-#if !defined(BCMCPU_RUNTIME_DETECT) && (defined(CONFIG_BCMCPU_IS_6348) || defined(CONFIG_CPU_IS_6338) || defined(CONFIG_CPU_IS_BCM6345)) ++#if !defined(BCMCPU_RUNTIME_DETECT) && (defined(CONFIG_BCM63XX_CPU_6348) || defined(CONFIG_BCM63XX_CPU_6345) || defined(CONFIG_BCM63XX_CPU_6338)) + #define cpu_has_dc_aliases 0 + #endif + diff --git a/target/linux/brcm63xx/patches-2.6.33/200-call_board_register_device_from_device_initcall.patch b/target/linux/brcm63xx/patches-2.6.33/200-call_board_register_device_from_device_initcall.patch new file mode 100644 index 0000000000..e7c71779c4 --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/200-call_board_register_device_from_device_initcall.patch @@ -0,0 +1,16 @@ +Some device registration (eg leds), expect subsystem initcall to be +run first, so move board device registration to device_initcall(). + +Signed-off-by: Maxime Bizon +--- + arch/mips/bcm63xx/setup.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +--- a/arch/mips/bcm63xx/setup.c ++++ b/arch/mips/bcm63xx/setup.c +@@ -124,4 +124,4 @@ int __init bcm63xx_register_devices(void + return board_register_devices(); + } + +-arch_initcall(bcm63xx_register_devices); ++device_initcall(bcm63xx_register_devices); diff --git a/target/linux/brcm63xx/patches-2.6.33/210-init_gpio_out_low_high_current_value_at_boot.patch b/target/linux/brcm63xx/patches-2.6.33/210-init_gpio_out_low_high_current_value_at_boot.patch new file mode 100644 index 0000000000..902840b39b --- /dev/null +++ b/target/linux/brcm63xx/patches-2.6.33/210-init_gpio_out_low_high_current_value_at_boot.patch @@ -0,0 +1,19 @@ +To avoid glitch during gpio initialisation, fetch gpio output +registers values left by bootloader. + +Signed-off-by: Maxime Bizon +--- + arch/mips/bcm63xx/gpio.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +--- a/arch/mips/bcm63xx/gpio.c ++++ b/arch/mips/bcm63xx/gpio.c +@@ -125,6 +125,8 @@ static struct gpio_chip bcm63xx_gpio_chi + + int __init bcm63xx_gpio_init(void) + { ++ gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_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); +