diff --git a/packages/linux/patches/linux-3.2.21-601-RPi_support-0.1.patch b/packages/linux/patches/linux-3.2.21-601-RPi_support-5b0ccb0.patch similarity index 96% rename from packages/linux/patches/linux-3.2.21-601-RPi_support-0.1.patch rename to packages/linux/patches/linux-3.2.21-601-RPi_support-5b0ccb0.patch index 7a9bcf8769..7aa56f487a 100644 --- a/packages/linux/patches/linux-3.2.21-601-RPi_support-0.1.patch +++ b/packages/linux/patches/linux-3.2.21-601-RPi_support-5b0ccb0.patch @@ -1,75 +1,6 @@ -diff --git a/Makefile b/Makefile -index c7e9cc4..7eb465e 100644 -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 987c72d..98ea27e 100644 ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -955,6 +955,21 @@ config PLAT_SPEAR - help - Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). - -+config ARCH_BCM2708 -+ bool "Broadcom BCM2708 family" -+ select CPU_V6 -+ select ARM_AMBA -+ select HAVE_CLK -+ select HAVE_SCHED_CLOCK -+ select NEED_MACH_MEMORY_H -+ select CLKDEV_LOOKUP -+ select GENERIC_CLOCKEVENTS -+ select ARM_ERRATA_411920 -+ select MACH_BCM2708 -+ select VC4 -+ help -+ This enables support for Broadcom BCM2708 boards. -+ - config ARCH_VT8500 - bool "VIA/WonderMedia 85xx" - select CPU_ARM926T -@@ -1098,6 +1113,7 @@ source "arch/arm/plat-versatile/Kconfig" - source "arch/arm/mach-vt8500/Kconfig" - - source "arch/arm/mach-w90x900/Kconfig" -+source "arch/arm/mach-bcm2708/Kconfig" - - # Definitions to make life easier - config ARCH_ACORN -diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug -index c5213e7..5e58b8f 100644 ---- a/arch/arm/Kconfig.debug -+++ b/arch/arm/Kconfig.debug -@@ -247,6 +247,14 @@ choice - their output to the standard serial port on the RealView - PB1176 platform. - -+ config DEBUG_BCM2708_UART0 -+ bool "Broadcom BCM2708 UART0 (PL011)" -+ depends on MACH_BCM2708 -+ help -+ Say Y here if you want the debug print routines to direct -+ their output to UART 0. The port must have been initialised -+ by the boot-loader before use. -+ - endchoice - - config EARLY_PRINTK -diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index dfcf3b0..1b18ede 100644 ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -198,6 +198,7 @@ machine-$(CONFIG_MACH_SPEAR310) := spear3xx - machine-$(CONFIG_MACH_SPEAR320) := spear3xx - machine-$(CONFIG_MACH_SPEAR600) := spear6xx - machine-$(CONFIG_ARCH_ZYNQ) := zynq -+machine-$(CONFIG_ARCH_BCM2708) := bcm2708 - - # Platform directory name. This list is sorted alphanumerically - # by CONFIG_* macro name. -diff --git a/arch/arm/configs/bcmrpi_cutdown_defconfig b/arch/arm/configs/bcmrpi_cutdown_defconfig -new file mode 100644 -index 0000000..6732014 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_cutdown_defconfig +diff -Naur linux-3.2.21/arch/arm/configs/bcmrpi_cutdown_defconfig linux-3.2.21-bootc-5b0ccb0/arch/arm/configs/bcmrpi_cutdown_defconfig +--- linux-3.2.21/arch/arm/configs/bcmrpi_cutdown_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/configs/bcmrpi_cutdown_defconfig 2012-07-02 13:42:13.347277970 +0200 @@ -0,0 +1,494 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set @@ -565,11 +496,9 @@ index 0000000..6732014 +# CONFIG_CRYPTO_HW is not set +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -new file mode 100644 -index 0000000..fcbf8a5 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_defconfig +diff -Naur linux-3.2.21/arch/arm/configs/bcmrpi_defconfig linux-3.2.21-bootc-5b0ccb0/arch/arm/configs/bcmrpi_defconfig +--- linux-3.2.21/arch/arm/configs/bcmrpi_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/configs/bcmrpi_defconfig 2012-07-02 13:42:13.340277828 +0200 @@ -0,0 +1,530 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set @@ -1101,11 +1030,9 @@ index 0000000..fcbf8a5 +# CONFIG_CRYPTO_HW is not set +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -diff --git a/arch/arm/configs/bcmrpi_emergency_defconfig b/arch/arm/configs/bcmrpi_emergency_defconfig -new file mode 100644 -index 0000000..3b40c49 ---- /dev/null -+++ b/arch/arm/configs/bcmrpi_emergency_defconfig +diff -Naur linux-3.2.21/arch/arm/configs/bcmrpi_emergency_defconfig linux-3.2.21-bootc-5b0ccb0/arch/arm/configs/bcmrpi_emergency_defconfig +--- linux-3.2.21/arch/arm/configs/bcmrpi_emergency_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/configs/bcmrpi_emergency_defconfig 2012-07-02 13:42:13.348277990 +0200 @@ -0,0 +1,532 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set @@ -1639,72 +1566,60 @@ index 0000000..3b40c49 +# CONFIG_CRYPTO_HW is not set +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig -new file mode 100644 -index 0000000..5593167 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/Kconfig -@@ -0,0 +1,32 @@ -+menu "Broadcom BCM2708 Implementations" -+ depends on ARCH_BCM2708 -+ -+config MACH_BCM2708 -+ bool "Broadcom BCM2708 Development Platform" +diff -Naur linux-3.2.21/arch/arm/Kconfig linux-3.2.21-bootc-5b0ccb0/arch/arm/Kconfig +--- linux-3.2.21/arch/arm/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/Kconfig 2012-07-02 13:42:13.242275826 +0200 +@@ -955,6 +955,21 @@ + help + Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). + ++config ARCH_BCM2708 ++ bool "Broadcom BCM2708 family" + select CPU_V6 ++ select ARM_AMBA ++ select HAVE_CLK ++ select HAVE_SCHED_CLOCK ++ select NEED_MACH_MEMORY_H ++ select CLKDEV_LOOKUP ++ select GENERIC_CLOCKEVENTS ++ select ARM_ERRATA_411920 ++ select MACH_BCM2708 ++ select VC4 + help -+ Include support for the Broadcom(R) BCM2708 platform. ++ This enables support for Broadcom BCM2708 boards. + -+config BCM2708_GPIO -+ bool "BCM2708 gpio support" -+ depends on MACH_BCM2708 -+ select ARCH_REQUIRE_GPIOLIB -+ default y -+ help -+ Include support for the Broadcom(R) BCM2708 gpio. + config ARCH_VT8500 + bool "VIA/WonderMedia 85xx" + select CPU_ARM926T +@@ -1098,6 +1113,7 @@ + source "arch/arm/mach-vt8500/Kconfig" + + source "arch/arm/mach-w90x900/Kconfig" ++source "arch/arm/mach-bcm2708/Kconfig" + + # Definitions to make life easier + config ARCH_ACORN +diff -Naur linux-3.2.21/arch/arm/Kconfig.debug linux-3.2.21-bootc-5b0ccb0/arch/arm/Kconfig.debug +--- linux-3.2.21/arch/arm/Kconfig.debug 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/Kconfig.debug 2012-07-02 13:42:13.063272167 +0200 +@@ -247,6 +247,14 @@ + their output to the standard serial port on the RealView + PB1176 platform. + ++ config DEBUG_BCM2708_UART0 ++ bool "Broadcom BCM2708 UART0 (PL011)" ++ depends on MACH_BCM2708 ++ help ++ Say Y here if you want the debug print routines to direct ++ their output to UART 0. The port must have been initialised ++ by the boot-loader before use. + -+config BCM2708_VCMEM -+ bool "Videocore Memory" -+ depends on MACH_BCM2708 -+ default y -+ help -+ Helper for videocore memory access and total size allocation. -+ -+config BCM2708_NOL2CACHE -+ bool "Videocore L2 cache disable" -+ depends on MACH_BCM2708 -+ default n -+ help -+ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt. -+ -+endmenu -diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile -new file mode 100644 -index 0000000..164ecb2 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/Makefile -@@ -0,0 +1,8 @@ -+# -+# Makefile for the linux kernel. -+# -+ -+obj-$(CONFIG_MACH_BCM2708) += clock.o bcm2708.o armctrl.o vcio.o power.o dma.o -+obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o -+obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o -+ -diff --git a/arch/arm/mach-bcm2708/Makefile.boot b/arch/arm/mach-bcm2708/Makefile.boot -new file mode 100644 -index 0000000..67039c3 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/Makefile.boot -@@ -0,0 +1,3 @@ -+ zreladdr-y := 0x00008000 -+params_phys-y := 0x00000100 -+initrd_phys-y := 0x00800000 -diff --git a/arch/arm/mach-bcm2708/armctrl.c b/arch/arm/mach-bcm2708/armctrl.c -new file mode 100644 -index 0000000..6b97124 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/armctrl.c + endchoice + + config EARLY_PRINTK +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/armctrl.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/armctrl.c +--- linux-3.2.21/arch/arm/mach-bcm2708/armctrl.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/armctrl.c 2012-07-02 13:42:13.235275683 +0200 @@ -0,0 +1,399 @@ +/* + * linux/arch/arm/mach-bcm2708/armctrl.c @@ -2105,11 +2020,9 @@ index 0000000..6b97124 + armctrl_pm_register(base, irq_start, resume_sources); + return 0; +} -diff --git a/arch/arm/mach-bcm2708/armctrl.h b/arch/arm/mach-bcm2708/armctrl.h -new file mode 100644 -index 0000000..0aa916e ---- /dev/null -+++ b/arch/arm/mach-bcm2708/armctrl.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/armctrl.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/armctrl.h +--- linux-3.2.21/arch/arm/mach-bcm2708/armctrl.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/armctrl.h 2012-07-02 13:42:13.232275620 +0200 @@ -0,0 +1,27 @@ +/* + * linux/arch/arm/mach-bcm2708/armctrl.h @@ -2138,12 +2051,10 @@ index 0000000..0aa916e + u32 armctrl_sources, u32 resume_sources); + +#endif -diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c -new file mode 100644 -index 0000000..0207807 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/bcm2708.c -@@ -0,0 +1,749 @@ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/bcm2708.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/bcm2708.c +--- linux-3.2.21/arch/arm/mach-bcm2708/bcm2708.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/bcm2708.c 2012-07-02 13:42:13.232275620 +0200 +@@ -0,0 +1,763 @@ +/* + * linux/arch/arm/mach-bcm2708/bcm2708.c + * @@ -2197,6 +2108,7 @@ index 0000000..0207807 +#include +#include +#include ++#include + +#include "bcm2708.h" +#include "armctrl.h" @@ -2706,10 +2618,23 @@ index 0000000..0207807 + return ret; +} + ++/* We can't really power off, but if we do the normal reset scheme, and indicate to bootcode.bin not to reboot, then most of the chip will be powered off */ ++static void bcm2708_power_off(void) ++{ ++ /* we set the watchdog hard reset bit here to distinguish this reset from the normal (full) reset. bootcode.bin will not reboot after a hard reset */ ++ uint32_t pm_rsts = readl(IO_ADDRESS(PM_RSTS)); ++ pm_rsts = PM_PASSWORD | (pm_rsts & PM_RSTC_WRCFG_CLR) | PM_RSTS_HADWRH_SET; ++ writel(pm_rsts, IO_ADDRESS(PM_RSTS)); ++ /* continue with normal reset mechanism */ ++ arch_reset(0, ""); ++} ++ +void __init bcm2708_init(void) +{ + int i; + ++ pm_power_off = bcm2708_power_off; ++ + for (i = 0; i < ARRAY_SIZE(lookups); i++) + clkdev_add(&lookups[i]); + @@ -2893,11 +2818,349 @@ index 0000000..0207807 + &bcm2708_timer,.init_machine = + bcm2708_init, MACHINE_END module_param(boardrev, uint, 0644); +module_param(serial, uint, 0644); -diff --git a/arch/arm/mach-bcm2708/bcm2708.h b/arch/arm/mach-bcm2708/bcm2708.h -new file mode 100644 -index 0000000..dfe8700 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/bcm2708.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/bcm2708_gpio.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/bcm2708_gpio.c +--- linux-3.2.21/arch/arm/mach-bcm2708/bcm2708_gpio.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/bcm2708_gpio.c 2012-07-02 13:42:13.232275620 +0200 +@@ -0,0 +1,336 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/bcm2708_gpio.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BCM_GPIO_DRIVER_NAME "bcm2708_gpio" ++#define DRIVER_NAME BCM_GPIO_DRIVER_NAME ++#define BCM_GPIO_USE_IRQ 1 ++ ++#define GPIOFSEL(x) (0x00+(x)*4) ++#define GPIOSET(x) (0x1c+(x)*4) ++#define GPIOCLR(x) (0x28+(x)*4) ++#define GPIOLEV(x) (0x34+(x)*4) ++#define GPIOEDS(x) (0x40+(x)*4) ++#define GPIOREN(x) (0x4c+(x)*4) ++#define GPIOFEN(x) (0x58+(x)*4) ++#define GPIOHEN(x) (0x64+(x)*4) ++#define GPIOLEN(x) (0x70+(x)*4) ++#define GPIOAREN(x) (0x7c+(x)*4) ++#define GPIOAFEN(x) (0x88+(x)*4) ++#define GPIOUD(x) (0x94+(x)*4) ++#define GPIOUDCLK(x) (0x98+(x)*4) ++ ++enum { GPIO_FSEL_INPUT, GPIO_FSEL_OUTPUT, ++ GPIO_FSEL_ALT5, GPIO_FSEL_ALT_4, ++ GPIO_FSEL_ALT0, GPIO_FSEL_ALT1, ++ GPIO_FSEL_ALT2, GPIO_FSEL_ALT3, }; ++ ++ /* Each of the two spinlocks protects a different set of hardware ++ * regiters and data structurs. This decouples the code of the IRQ from ++ * the GPIO code. This also makes the case of a GPIO routine call from ++ * the IRQ code simpler. ++ */ ++static DEFINE_SPINLOCK(lock); /* GPIO registers */ ++ ++ ++struct bcm2708_gpio { ++ struct list_head list; ++ void __iomem *base; ++ struct gpio_chip gc; ++ unsigned long rising; ++ unsigned long falling; ++}; ++ ++static int bcm2708_set_function(struct gpio_chip *gc, unsigned offset, int function) ++{ ++ struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc); ++ unsigned long flags; ++ unsigned gpiodir; ++ unsigned gpio_bank = offset/10; ++ unsigned gpio_field_offset = (offset - 10*gpio_bank) * 3; ++ ++//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set_function %p (%d,%d)\n", gc, offset, function); ++ if (offset >= BCM_NR_GPIOS) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&lock, flags); ++ ++ gpiodir = readl(gpio->base + GPIOFSEL(gpio_bank)); ++ gpiodir &= ~(7 << gpio_field_offset); ++ gpiodir |= function << gpio_field_offset; ++ writel(gpiodir, gpio->base + GPIOFSEL(gpio_bank)); ++ spin_unlock_irqrestore(&lock, flags); ++ gpiodir = readl(gpio->base + GPIOFSEL(gpio_bank)); ++ ++ return 0; ++} ++ ++ ++static int bcm2708_gpio_dir_in(struct gpio_chip *gc, unsigned offset) ++{ ++ return bcm2708_set_function(gc, offset, GPIO_FSEL_INPUT); ++} ++ ++static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value); ++static int bcm2708_gpio_dir_out(struct gpio_chip *gc, unsigned offset, int value) ++{ ++ int ret; ++ ret = bcm2708_set_function(gc, offset, GPIO_FSEL_OUTPUT); ++ if (ret >= 0) ++ bcm2708_gpio_set(gc, offset, value); ++ return ret; ++} ++ ++static int bcm2708_gpio_get(struct gpio_chip *gc, unsigned offset) ++{ ++ struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc); ++ unsigned gpio_bank = offset/32; ++ unsigned gpio_field_offset = (offset - 32*gpio_bank); ++ unsigned lev; ++ ++ if (offset >= BCM_NR_GPIOS) ++ return 0; ++ lev = readl(gpio->base + GPIOLEV(gpio_bank)); ++//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_get %p (%d)=%d\n", gc, offset, 0x1 & (lev>>gpio_field_offset)); ++ return 0x1 & (lev>>gpio_field_offset); ++} ++ ++static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value) ++{ ++ struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc); ++ unsigned gpio_bank = offset/32; ++ unsigned gpio_field_offset = (offset - 32*gpio_bank); ++//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set %p (%d=%d)\n", gc, offset, value); ++ if (offset >= BCM_NR_GPIOS) ++ return; ++ if (value) ++ writel(1<base + GPIOSET(gpio_bank)); ++ else ++ writel(1<base + GPIOCLR(gpio_bank)); ++} ++ ++/************************************************************************************************************************* ++ * bcm2708 GPIO IRQ ++ */ ++ ++ ++#if BCM_GPIO_USE_IRQ ++ ++#define IRQ_TO_GPIO(x) irq_to_gpio(x) ++ ++static int bcm2708_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) { ++ return gpio_to_irq(gpio); ++} ++ ++ ++static int bcm2708_gpio_irq_set_type(struct irq_data *d, unsigned type) { ++ unsigned irq = d->irq; ++ struct bcm2708_gpio *gpio=irq_get_chip_data(irq); ++ ++ if (type & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) ++ return -EINVAL; ++ ++ if (type & IRQ_TYPE_EDGE_RISING) { ++ gpio->rising |= (1 << IRQ_TO_GPIO(irq)); ++ } else { ++ gpio->rising &= ~(1 << IRQ_TO_GPIO(irq)); ++ } ++ ++ if (type & IRQ_TYPE_EDGE_FALLING) { ++ gpio->falling |= (1 << IRQ_TO_GPIO(irq)); ++ } else { ++ gpio->falling &= ~(1 << IRQ_TO_GPIO(irq)); ++ } ++ return 0; ++} ++ ++static void bcm2708_gpio_irq_mask(struct irq_data *d) { ++ unsigned irq = d->irq; ++ struct bcm2708_gpio *gpio=irq_get_chip_data(irq); ++ unsigned gn = IRQ_TO_GPIO(irq); ++ unsigned gb = gn/32; ++ unsigned long rising=readl(gpio->base + GPIOREN(gb)); ++ unsigned long falling=readl(gpio->base + GPIOFEN(gb)); ++ ++ writel(rising & ~(1 << gn), gpio->base + GPIOREN(gb)); ++ writel(falling & ~(1 << gn), gpio->base + GPIOFEN(gb)); ++} ++ ++static void bcm2708_gpio_irq_unmask(struct irq_data *d) { ++ unsigned irq = d->irq; ++ struct bcm2708_gpio *gpio=irq_get_chip_data(irq); ++ unsigned gn = IRQ_TO_GPIO(irq); ++ unsigned gb = gn/32; ++ unsigned long rising=readl(gpio->base + GPIOREN(gb)); ++ unsigned long falling=readl(gpio->base + GPIOFEN(gb)); ++ ++ gn=gn%32; ++ ++ writel(1 << gn, gpio->base + GPIOEDS(gb)); ++ ++ if(gpio->rising & (1 << gn)) { ++ writel(rising | (1 << gn), gpio->base + GPIOREN(gb)); ++ } else { ++ writel(rising & ~(1 << gn), gpio->base + GPIOREN(gb)); ++ } ++ ++ if(gpio->falling & (1 << gn)) { ++ writel(falling | (1 << gn), gpio->base + GPIOFEN(gb)); ++ } else { ++ writel(falling & ~(1 << gn), gpio->base + GPIOFEN(gb)); ++ } ++} ++ ++static struct irq_chip bcm2708_irqchip = { ++ .name = "GPIO", ++ .irq_enable = bcm2708_gpio_irq_unmask, ++ .irq_disable = bcm2708_gpio_irq_mask, ++ .irq_unmask = bcm2708_gpio_irq_unmask, ++ .irq_mask = bcm2708_gpio_irq_mask, ++ .irq_set_type = bcm2708_gpio_irq_set_type, ++}; ++ ++static irqreturn_t bcm2708_gpio_interrupt(int irq, void *dev_id) { ++ unsigned long edsr; ++ unsigned bank; ++ int i; ++ unsigned gpio; ++ for(bank=0; bank<=1; bank++) { ++ edsr=readl(__io_address(GPIO_BASE)+GPIOEDS(bank)); ++ for_each_set_bit(i, &edsr, 32) { ++ gpio=i+bank*32; ++ generic_handle_irq(gpio_to_irq(gpio)); ++ } ++ writel(0xffffffff, __io_address(GPIO_BASE)+GPIOEDS(bank)); ++ } ++ return IRQ_HANDLED; ++} ++ ++static struct irqaction bcm2708_gpio_irq = { ++ .name = "BCM2708 GPIO catchall handler", ++ .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, ++ .handler = bcm2708_gpio_interrupt, ++}; ++ ++ ++static void bcm2708_gpio_irq_init(struct bcm2708_gpio *ucb) { ++ unsigned irq; ++ ++ ucb->gc.to_irq=bcm2708_gpio_to_irq; ++ ++ for (irq=GPIO_IRQ_START; irq<(GPIO_IRQ_START+GPIO_IRQS); irq++) { ++ irq_set_chip_data(irq, ucb); ++ irq_set_chip(irq, &bcm2708_irqchip); ++ set_irq_flags(irq, IRQF_VALID); ++ } ++ setup_irq(IRQ_GPIO3, &bcm2708_gpio_irq); ++} ++ ++#else ++ ++static void bcm2708_gpio_irq_init(struct bcm2708_gpio *ucb) { ++} ++ ++#endif /* #if BCM_GPIO_USE_IRQ ******************************************************************************************************************/ ++ ++static int bcm2708_gpio_probe(struct platform_device *dev) ++{ ++ struct bcm2708_gpio *ucb; ++ struct resource *res; ++ int err = 0; ++ ++ printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_probe %p\n", dev); ++ ++ ucb = kzalloc(sizeof(*ucb), GFP_KERNEL); ++ if (NULL == ucb) { ++ printk(KERN_ERR DRIVER_NAME ": failed to allocate " ++ "mailbox memory\n"); ++ err = -ENOMEM; ++ goto err; ++ } ++ ++ res = platform_get_resource(dev, IORESOURCE_MEM, 0); ++ ++ platform_set_drvdata(dev, ucb); ++ ucb->base = __io_address(GPIO_BASE); ++ ++ ucb->gc.label = "bcm2708_gpio"; ++ ucb->gc.base = 0; ++ ucb->gc.ngpio = BCM_NR_GPIOS; ++ ucb->gc.owner = THIS_MODULE; ++ ++ ucb->gc.direction_input = bcm2708_gpio_dir_in; ++ ucb->gc.direction_output = bcm2708_gpio_dir_out; ++ ucb->gc.get = bcm2708_gpio_get; ++ ucb->gc.set = bcm2708_gpio_set; ++ ucb->gc.can_sleep = 0; ++ ++ bcm2708_gpio_irq_init(ucb); ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++err: ++ return err; ++ ++} ++ ++static int bcm2708_gpio_remove(struct platform_device *dev) ++{ ++ int err = 0; ++ struct bcm2708_gpio *ucb = platform_get_drvdata(dev); ++ ++ printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_remove %p\n", dev); ++ ++ err = gpiochip_remove(&ucb->gc); ++ ++ platform_set_drvdata(dev, NULL); ++ kfree(ucb); ++ ++ return err; ++} ++ ++static struct platform_driver bcm2708_gpio_driver = { ++ .probe = bcm2708_gpio_probe, ++ .remove = bcm2708_gpio_remove, ++ .driver = { ++ .name = "bcm2708_gpio" ++ }, ++}; ++ ++static int __init bcm2708_gpio_init(void) ++{ ++ return platform_driver_register(&bcm2708_gpio_driver); ++} ++ ++static void __exit bcm2708_gpio_exit(void) ++{ ++ platform_driver_unregister(&bcm2708_gpio_driver); ++} ++ ++module_init(bcm2708_gpio_init); ++module_exit(bcm2708_gpio_exit); ++ ++MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver"); ++MODULE_LICENSE("GPL"); ++ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/bcm2708.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/bcm2708.h +--- linux-3.2.21/arch/arm/mach-bcm2708/bcm2708.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/bcm2708.h 2012-07-02 13:42:13.235275683 +0200 @@ -0,0 +1,51 @@ +/* + * linux/arch/arm/mach-bcm2708/bcm2708.h @@ -2950,340 +3213,9 @@ index 0000000..dfe8700 +} + +#endif -diff --git a/arch/arm/mach-bcm2708/bcm2708_gpio.c b/arch/arm/mach-bcm2708/bcm2708_gpio.c -new file mode 100644 -index 0000000..59df912 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/bcm2708_gpio.c -@@ -0,0 +1,323 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/bcm2708_gpio.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BCM_GPIO_DRIVER_NAME "bcm2708_gpio" -+#define DRIVER_NAME BCM_GPIO_DRIVER_NAME -+#define BCM_GPIO_USE_IRQ 0 -+ -+#define GPIOFSEL(x) (0x00+(x)*4) -+#define GPIOSET(x) (0x1c+(x)*4) -+#define GPIOCLR(x) (0x28+(x)*4) -+#define GPIOLEV(x) (0x34+(x)*4) -+#define GPIOEDS(x) (0x40+(x)*4) -+#define GPIOREN(x) (0x4c+(x)*4) -+#define GPIOFEN(x) (0x58+(x)*4) -+#define GPIOHEN(x) (0x64+(x)*4) -+#define GPIOLEN(x) (0x70+(x)*4) -+#define GPIOAREN(x) (0x7c+(x)*4) -+#define GPIOAFEN(x) (0x88+(x)*4) -+#define GPIOUD(x) (0x94+(x)*4) -+#define GPIOUDCLK(x) (0x98+(x)*4) -+ -+enum { GPIO_FSEL_INPUT, GPIO_FSEL_OUTPUT, -+ GPIO_FSEL_ALT5, GPIO_FSEL_ALT_4, -+ GPIO_FSEL_ALT0, GPIO_FSEL_ALT1, -+ GPIO_FSEL_ALT2, GPIO_FSEL_ALT3, }; -+ -+ /* Each of the two spinlocks protects a different set of hardware -+ * regiters and data structurs. This decouples the code of the IRQ from -+ * the GPIO code. This also makes the case of a GPIO routine call from -+ * the IRQ code simpler. -+ */ -+static DEFINE_SPINLOCK(lock); /* GPIO registers */ -+static DEFINE_SPINLOCK(irq_lock); /* IRQ registers */ -+ -+ -+struct bcm2708_gpio { -+ /* We use a list of bcm2708_gpio structs for each trigger IRQ in the main -+ * interrupts controller of the system. We need this to support systems -+ * in which more that one bcm2708s are connected to the same IRQ. The ISR -+ * interates through this list to find the source of the interrupt. -+ */ -+ struct list_head list; -+ -+ void __iomem *base; -+ unsigned irq_base; -+ struct gpio_chip gc; -+}; -+ -+static int bcm2708_set_function(struct gpio_chip *gc, unsigned offset, int function) -+{ -+ struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc); -+ unsigned long flags; -+ unsigned gpiodir; -+ unsigned gpio_bank = offset/10; -+ unsigned gpio_field_offset = (offset - 10*gpio_bank) * 3; -+ -+//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set_function %p (%d,%d)\n", gc, offset, function); -+ if (offset >= ARCH_NR_GPIOS) -+ return -EINVAL; -+ -+ spin_lock_irqsave(&lock, flags); -+ -+ gpiodir = readl(gpio->base + GPIOFSEL(gpio_bank)); -+ gpiodir &= ~(7 << gpio_field_offset); -+ gpiodir |= function << gpio_field_offset; -+ writel(gpiodir, gpio->base + GPIOFSEL(gpio_bank)); -+ spin_unlock_irqrestore(&lock, flags); -+ gpiodir = readl(gpio->base + GPIOFSEL(gpio_bank)); -+ -+ return 0; -+} -+ -+ -+static int bcm2708_gpio_dir_in(struct gpio_chip *gc, unsigned offset) -+{ -+ return bcm2708_set_function(gc, offset, GPIO_FSEL_INPUT); -+} -+ -+static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value); -+static int bcm2708_gpio_dir_out(struct gpio_chip *gc, unsigned offset, int value) -+{ -+ int ret; -+ ret = bcm2708_set_function(gc, offset, GPIO_FSEL_OUTPUT); -+ if (ret >= 0) -+ bcm2708_gpio_set(gc, offset, value); -+ return ret; -+} -+ -+static int bcm2708_gpio_get(struct gpio_chip *gc, unsigned offset) -+{ -+ struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc); -+ unsigned gpio_bank = offset/32; -+ unsigned gpio_field_offset = (offset - 32*gpio_bank); -+ unsigned lev; -+ -+ if (offset >= ARCH_NR_GPIOS) -+ return 0; -+ lev = readl(gpio->base + GPIOLEV(gpio_bank)); -+//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_get %p (%d)=%d\n", gc, offset, 0x1 & (lev>>gpio_field_offset)); -+ return 0x1 & (lev>>gpio_field_offset); -+} -+ -+static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value) -+{ -+ struct bcm2708_gpio *gpio = container_of(gc, struct bcm2708_gpio, gc); -+ unsigned gpio_bank = offset/32; -+ unsigned gpio_field_offset = (offset - 32*gpio_bank); -+//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set %p (%d=%d)\n", gc, offset, value); -+ if (offset >= ARCH_NR_GPIOS) -+ return; -+ if (value) -+ writel(1<base + GPIOSET(gpio_bank)); -+ else -+ writel(1<base + GPIOCLR(gpio_bank)); -+} -+ -+/* -+ * bcm2708 GPIO IRQ -+ */ -+ -+#if BCM_GPIO_USE_IRQ -+static void bcm2708_irq_disable(unsigned irq) -+{ -+ struct bcm2708_gpio *chip = get_irq_chip_data(irq); -+ //int offset = irq - gpio->irq_base; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&chip->irq_lock, flags); -+ // disable gpio interrupts here -+ spin_unlock_irqrestore(&chip->irq_lock, flags); -+} -+ -+static void bcm2708_irq_enable(unsigned irq) -+{ -+ struct bcm2708_gpio *chip = get_irq_chip_data(irq); -+ //int offset = irq - chip->irq_base; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&chip->irq_lock, flags); -+ // enable gpio interrupts here -+ spin_unlock_irqrestore(&chip->irq_lock, flags); -+} -+ -+static int bcm2708_irq_type(unsigned irq, unsigned trigger) -+{ -+ struct bcm2708_gpio *chip = get_irq_chip_data(irq); -+ int offset = irq - chip->irq_base; -+ unsigned long flags; -+ unsigned gpio_bank = offset/32; -+ unsigned gpio_field_offset = (offset - 32*gpio_bank); -+ unsigned gpioren, gpiofen, gpiohen, gpiolen; -+ -+ if (offset < 0 || offset >= ARCH_NR_GPIOS) -+ return -EINVAL; -+ -+ spin_lock_irqsave(&chip->irq_lock, flags); -+ -+ gpioren = readl(chip->base + GPIOREN(gpio_bank)); -+ gpiofen = readl(chip->base + GPIOFEN(gpio_bank)); -+ gpiohen = readl(chip->base + GPIOHEN(gpio_bank)); -+ gpiolen = readl(chip->base + GPIOLEN(gpio_bank)); -+ -+ if (trigger & (IRQ_TYPE_EDGE_RISING)) -+ gpioren |= (1<base + GPIOREN(gpio_bank)); -+ writel(gpiofen, chip->base + GPIOFEN(gpio_bank)); -+ writel(gpiohen, chip->base + GPIOHEN(gpio_bank)); -+ writel(gpiolen, chip->base + GPIOLEN(gpio_bank)); -+ -+ spin_unlock_irqrestore(&chip->irq_lock, flags); -+ -+ return 0; -+} -+ -+static struct irq_chip bcm2708_irqchip = { -+ .name = "GPIO", -+ .enable = bcm2708_irq_enable, -+ .disable = bcm2708_irq_disable, -+ .set_type = bcm2708_irq_type, -+}; -+ -+static void bcm2708_irq_handler(unsigned irq, struct irq_desc *desc) -+{ -+ struct list_head *chip_list = get_irq_data(irq); -+ struct list_head *ptr; -+ struct bcm2708_gpio *chip; -+ unsigned gpio_bank; -+ -+ desc->chip->ack(irq); -+ list_for_each(ptr, chip_list) { -+ unsigned long pending; -+ int offset; -+ -+ chip = list_entry(ptr, struct bcm2708_gpio, list); -+ for (gpio_bank = 0; gpio_bank < ARCH_NR_GPIOS/32; gpio_bank++) { -+ pending = readl(chip->base + GPIOEDS(gpio_bank)); -+ writel(pending, chip->base + GPIOEDS(gpio_bank)); -+ -+ if (pending == 0) -+ continue; -+ -+ for_each_set_bit(offset, &pending, ARCH_NR_GPIOS) -+ generic_handle_irq(gpio_to_irq(offset+32*gpio_bank)); -+ } -+ } -+ desc->chip->unmask(irq); -+} -+#endif /* #if BCM_GPIO_USE_IRQ */ -+ -+static int bcm2708_gpio_probe(struct platform_device *dev) -+{ -+ struct bcm2708_gpio *ucb; -+ struct resource *res; -+ int err = 0; -+ -+ printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_probe %p\n", dev); -+ -+ ucb = kzalloc(sizeof(*ucb), GFP_KERNEL); -+ if (NULL == ucb) { -+ printk(KERN_ERR DRIVER_NAME ": failed to allocate " -+ "mailbox memory\n"); -+ err = -ENOMEM; -+ goto err; -+ } -+ -+ res = platform_get_resource(dev, IORESOURCE_MEM, 0); -+ -+ platform_set_drvdata(dev, ucb); -+ ucb->base = __io_address(GPIO_BASE); -+ -+ ucb->gc.label = "bcm2708_gpio"; -+ ucb->gc.base = 0; -+ ucb->gc.ngpio = ARCH_NR_GPIOS; -+ ucb->gc.owner = THIS_MODULE; -+ -+ ucb->gc.direction_input = bcm2708_gpio_dir_in; -+ ucb->gc.direction_output = bcm2708_gpio_dir_out; -+ ucb->gc.get = bcm2708_gpio_get; -+ ucb->gc.set = bcm2708_gpio_set; -+ ucb->gc.can_sleep = 0; -+ -+ err = gpiochip_add(&ucb->gc); -+ if (err) -+ goto err; -+ -+err: -+ return err; -+ -+} -+ -+static int bcm2708_gpio_remove(struct platform_device *dev) -+{ -+ int err = 0; -+ struct bcm2708_gpio *ucb = platform_get_drvdata(dev); -+ -+ printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_remove %p\n", dev); -+ -+ err = gpiochip_remove(&ucb->gc); -+ -+ platform_set_drvdata(dev, NULL); -+ kfree(ucb); -+ -+ return err; -+} -+ -+static struct platform_driver bcm2708_gpio_driver = { -+ .probe = bcm2708_gpio_probe, -+ .remove = bcm2708_gpio_remove, -+ .driver = { -+ .name = "bcm2708_gpio" -+ }, -+}; -+ -+static int __init bcm2708_gpio_init(void) -+{ -+ return platform_driver_register(&bcm2708_gpio_driver); -+} -+ -+static void __exit bcm2708_gpio_exit(void) -+{ -+ platform_driver_unregister(&bcm2708_gpio_driver); -+} -+ -+module_init(bcm2708_gpio_init); -+module_exit(bcm2708_gpio_exit); -+ -+MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver"); -+MODULE_LICENSE("GPL"); -+ -diff --git a/arch/arm/mach-bcm2708/clock.c b/arch/arm/mach-bcm2708/clock.c -new file mode 100644 -index 0000000..4fc556e ---- /dev/null -+++ b/arch/arm/mach-bcm2708/clock.c +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/clock.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/clock.c +--- linux-3.2.21/arch/arm/mach-bcm2708/clock.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/clock.c 2012-07-02 13:42:13.232275620 +0200 @@ -0,0 +1,61 @@ +/* + * linux/arch/arm/mach-bcm2708/clock.c @@ -3346,11 +3278,9 @@ index 0000000..4fc556e + return -EIO; +} +EXPORT_SYMBOL(clk_set_rate); -diff --git a/arch/arm/mach-bcm2708/clock.h b/arch/arm/mach-bcm2708/clock.h -new file mode 100644 -index 0000000..5f9d725 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/clock.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/clock.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/clock.h +--- linux-3.2.21/arch/arm/mach-bcm2708/clock.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/clock.h 2012-07-02 13:42:13.233275641 +0200 @@ -0,0 +1,24 @@ +/* + * linux/arch/arm/mach-bcm2708/clock.h @@ -3376,11 +3306,9 @@ index 0000000..5f9d725 +struct clk { + unsigned long rate; +}; -diff --git a/arch/arm/mach-bcm2708/dma.c b/arch/arm/mach-bcm2708/dma.c -new file mode 100644 -index 0000000..0b7a4f6 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/dma.c +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/dma.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/dma.c +--- linux-3.2.21/arch/arm/mach-bcm2708/dma.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/dma.c 2012-07-02 13:42:13.235275683 +0200 @@ -0,0 +1,397 @@ +/* + * linux/arch/arm/mach-bcm2708/dma.c @@ -3779,11 +3707,9 @@ index 0000000..0b7a4f6 +MODULE_LICENSE("GPL"); + +MODULE_PARM_DESC(dmachans, "Bitmap of DMA channels available to the ARM"); -diff --git a/arch/arm/mach-bcm2708/include/mach/arm_control.h b/arch/arm/mach-bcm2708/include/mach/arm_control.h -new file mode 100644 -index 0000000..a82bb92 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/arm_control.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/arm_control.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/arm_control.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/arm_control.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/arm_control.h 2012-07-02 13:42:13.233275641 +0200 @@ -0,0 +1,419 @@ +/* + * linux/arch/arm/mach-bcm2708/arm_control.h @@ -4204,11 +4130,9 @@ index 0000000..a82bb92 +#define AJBTDO HW_REGISTER_RW(AJB_BASE+0x0c) + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/arm_power.h b/arch/arm/mach-bcm2708/include/mach/arm_power.h -new file mode 100644 -index 0000000..aae9136 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/arm_power.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/arm_power.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/arm_power.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/arm_power.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/arm_power.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,60 @@ +/* + * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h @@ -4270,11 +4194,9 @@ index 0000000..aae9136 +}; + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/clkdev.h b/arch/arm/mach-bcm2708/include/mach/clkdev.h -new file mode 100644 -index 0000000..04b37a8 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/clkdev.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/clkdev.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/clkdev.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/clkdev.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/clkdev.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,7 @@ +#ifndef __ASM_MACH_CLKDEV_H +#define __ASM_MACH_CLKDEV_H @@ -4283,11 +4205,9 @@ index 0000000..04b37a8 +#define __clk_put(clk) do { } while (0) + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/debug-macro.S b/arch/arm/mach-bcm2708/include/mach/debug-macro.S -new file mode 100644 -index 0000000..2d0dc1c ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/debug-macro.S +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/debug-macro.S linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/debug-macro.S +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/debug-macro.S 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/debug-macro.S 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,22 @@ +/* arch/arm/mach-bcm2708/include/mach/debug-macro.S + * @@ -4311,11 +4231,9 @@ index 0000000..2d0dc1c + .endm + +#include -diff --git a/arch/arm/mach-bcm2708/include/mach/dma.h b/arch/arm/mach-bcm2708/include/mach/dma.h -new file mode 100644 -index 0000000..25e06d7 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/dma.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/dma.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/dma.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/dma.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/dma.h 2012-07-02 13:42:13.233275641 +0200 @@ -0,0 +1,84 @@ +/* + * linux/arch/arm/mach-bcm2708/include/mach/dma.h @@ -4401,11 +4319,9 @@ index 0000000..25e06d7 + + +#endif /* _MACH_BCM2708_DMA_H */ -diff --git a/arch/arm/mach-bcm2708/include/mach/entry-macro.S b/arch/arm/mach-bcm2708/include/mach/entry-macro.S -new file mode 100644 -index 0000000..79b62d9 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/entry-macro.S +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/entry-macro.S linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/entry-macro.S +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/entry-macro.S 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/entry-macro.S 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,69 @@ +/* + * arch/arm/mach-bcm2708/include/mach/entry-macro.S @@ -4476,11 +4392,9 @@ index 0000000..79b62d9 +1020: @ EQ will be set if no irqs pending + + .endm -diff --git a/arch/arm/mach-bcm2708/include/mach/frc.h b/arch/arm/mach-bcm2708/include/mach/frc.h -new file mode 100644 -index 0000000..dd51e07 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/frc.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/frc.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/frc.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/frc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/frc.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,38 @@ +/* + * arch/arm/mach-bcm2708/include/mach/timex.h @@ -4520,12 +4434,10 @@ index 0000000..dd51e07 +extern unsigned long long frc_clock_ticks63(void); + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/gpio.h b/arch/arm/mach-bcm2708/include/mach/gpio.h -new file mode 100644 -index 0000000..526004f ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/gpio.h -@@ -0,0 +1,48 @@ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/gpio.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/gpio.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/gpio.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/gpio.h 2012-07-02 13:42:13.235275683 +0200 +@@ -0,0 +1,47 @@ +/* + * arch/arm/mach-bcm2708/include/mach/gpio.h + * @@ -4537,10 +4449,11 @@ index 0000000..526004f +#ifndef __ASM_ARCH_GPIO_H +#define __ASM_ARCH_GPIO_H + -+#define ARCH_NR_GPIOS 54 // number of gpio lines ++#define BCM_NR_GPIOS 54 // number of gpio lines + +#include -+ ++#include ++#include + +#ifdef CONFIG_GPIOLIB + @@ -4559,26 +4472,22 @@ index 0000000..526004f + return __gpio_cansleep(gpio); +} + -+static inline int gpio_to_irq(unsigned gpio) -+{ -+ WARN_ON(1); -+ return -ENOSYS; ++ ++static inline unsigned irq_to_gpio(unsigned irq) { ++ return (irq-GPIO_IRQ_START); +} + -+static inline int irq_to_gpio(unsigned int irq) -+{ -+ WARN_ON(1); -+ return -EINVAL; ++static inline unsigned gpio_to_irq(unsigned gpio) { ++ return GPIO_IRQ_START+gpio; +} ++#define gpio_to_irq gpio_to_irq + +#endif /* CONFIG_GPIOLIB */ + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/hardware.h b/arch/arm/mach-bcm2708/include/mach/hardware.h -new file mode 100644 -index 0000000..c2954e8 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/hardware.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/hardware.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/hardware.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/hardware.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/hardware.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,28 @@ +/* + * arch/arm/mach-bcm2708/include/mach/hardware.h @@ -4608,11 +4517,9 @@ index 0000000..c2954e8 +#include + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/io.h b/arch/arm/mach-bcm2708/include/mach/io.h -new file mode 100644 -index 0000000..e8c7fca ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/io.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/io.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/io.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/io.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/io.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,28 @@ +/* + * arch/arm/mach-bcm2708/include/mach/io.h @@ -4642,12 +4549,10 @@ index 0000000..e8c7fca +#define __mem_pci(a) (a) + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/irqs.h b/arch/arm/mach-bcm2708/include/mach/irqs.h -new file mode 100644 -index 0000000..f59d474 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/irqs.h -@@ -0,0 +1,190 @@ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/irqs.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/irqs.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/irqs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/irqs.h 2012-07-02 13:42:13.233275641 +0200 +@@ -0,0 +1,196 @@ +/* + * arch/arm/mach-bcm2708/include/mach/irqs.h + * @@ -4835,14 +4740,18 @@ index 0000000..f59d474 +#define FIQ_PENDING1 INT_PENDING1 +#define FIQ_PENDING2 INT_PENDING2 + -+#define NR_IRQS (64 + 21) ++#define HARD_IRQS (64 + 21) ++#define GPIO_IRQ_START HARD_IRQS ++ ++#define GPIO_IRQS 32*5 ++ ++#define NR_IRQS HARD_IRQS+GPIO_IRQS ++ + +#endif /* _BCM2708_IRQS_H_ */ -diff --git a/arch/arm/mach-bcm2708/include/mach/memory.h b/arch/arm/mach-bcm2708/include/mach/memory.h -new file mode 100644 -index 0000000..5d47513 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/memory.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/memory.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/memory.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/memory.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/memory.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,64 @@ +/* + * arch/arm/mach-bcm2708/include/mach/memory.h @@ -4908,12 +4817,10 @@ index 0000000..5d47513 +#define CONSISTENT_DMA_SIZE 0x00200000 + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h -new file mode 100644 -index 0000000..d038597 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/platform.h -@@ -0,0 +1,213 @@ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/platform.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/platform.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/platform.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/platform.h 2012-07-02 13:42:13.234275662 +0200 +@@ -0,0 +1,224 @@ +/* + * arch/arm/mach-bcm2708/include/mach/platform.h + * @@ -5110,6 +5017,7 @@ index 0000000..d038597 + * Watchdog + */ +#define PM_RSTC (PM_BASE+0x1c) ++#define PM_RSTS (PM_BASE+0x20) +#define PM_WDOG (PM_BASE+0x24) + +#define PM_WDOG_RESET 0000000000 @@ -5123,15 +5031,23 @@ index 0000000..d038597 +/* AMBA UART clock */ +#define UART0_CLOCK 3000000 + ++#define PM_RSTS_HADPOR_SET 0x00001000 ++#define PM_RSTS_HADSRH_SET 0x00000400 ++#define PM_RSTS_HADSRF_SET 0x00000200 ++#define PM_RSTS_HADSRQ_SET 0x00000100 ++#define PM_RSTS_HADWRH_SET 0x00000040 ++#define PM_RSTS_HADWRF_SET 0x00000020 ++#define PM_RSTS_HADWRQ_SET 0x00000010 ++#define PM_RSTS_HADDRH_SET 0x00000004 ++#define PM_RSTS_HADDRF_SET 0x00000002 ++#define PM_RSTS_HADDRQ_SET 0x00000001 + +#endif + +/* END */ -diff --git a/arch/arm/mach-bcm2708/include/mach/power.h b/arch/arm/mach-bcm2708/include/mach/power.h -new file mode 100644 -index 0000000..52b3b02 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/power.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/power.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/power.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/power.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/power.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,26 @@ +/* + * linux/arch/arm/mach-bcm2708/power.h @@ -5159,11 +5075,9 @@ index 0000000..52b3b02 +extern int bcm_power_close(BCM_POWER_HANDLE_T handle); + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/system.h b/arch/arm/mach-bcm2708/include/mach/system.h -new file mode 100644 -index 0000000..bc9d458 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/system.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/system.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/system.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/system.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/system.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,53 @@ +/* + * arch/arm/mach-bcm2708/include/mach/system.h @@ -5218,11 +5132,9 @@ index 0000000..bc9d458 +} + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/timex.h b/arch/arm/mach-bcm2708/include/mach/timex.h -new file mode 100644 -index 0000000..64a660c ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/timex.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/timex.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/timex.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/timex.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/timex.h 2012-07-02 13:42:13.234275662 +0200 @@ -0,0 +1,23 @@ +/* + * arch/arm/mach-bcm2708/include/mach/timex.h @@ -5247,11 +5159,9 @@ index 0000000..64a660c + */ + +#define CLOCK_TICK_RATE (1000000) -diff --git a/arch/arm/mach-bcm2708/include/mach/uncompress.h b/arch/arm/mach-bcm2708/include/mach/uncompress.h -new file mode 100644 -index 0000000..dca1247 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/uncompress.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/uncompress.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/uncompress.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/uncompress.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/uncompress.h 2012-07-02 13:42:13.233275641 +0200 @@ -0,0 +1,84 @@ +/* + * arch/arm/mach-bcn2708/include/mach/uncompress.h @@ -5337,52 +5247,9 @@ index 0000000..dca1247 + * nothing to do + */ +#define arch_decomp_wdog() -diff --git a/arch/arm/mach-bcm2708/include/mach/vc_mem.h b/arch/arm/mach-bcm2708/include/mach/vc_mem.h -new file mode 100644 -index 0000000..9d41c3a ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/vc_mem.h -@@ -0,0 +1,35 @@ -+/***************************************************************************** -+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#if !defined( VC_MEM_H ) -+#define VC_MEM_H -+ -+#include -+ -+#define VC_MEM_IOC_MAGIC 'v' -+ -+#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) -+#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) -+#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) -+ -+#if defined( __KERNEL__ ) -+#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF -+ -+extern unsigned long mm_vc_mem_phys_addr; -+extern unsigned int mm_vc_mem_size; -+extern int vc_mem_get_current_size( void ); -+#endif -+ -+#endif /* VC_MEM_H */ -+ -diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h -new file mode 100644 -index 0000000..0d7f9a5 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/vcio.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/vcio.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/vcio.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/vcio.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/vcio.h 2012-07-02 13:42:13.233275641 +0200 @@ -0,0 +1,42 @@ +/* + * arch/arm/mach-bcm2708/include/mach/vcio.h @@ -5426,11 +5293,48 @@ index 0000000..0d7f9a5 +extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); + +#endif -diff --git a/arch/arm/mach-bcm2708/include/mach/vmalloc.h b/arch/arm/mach-bcm2708/include/mach/vmalloc.h -new file mode 100644 -index 0000000..28ecc15 ---- /dev/null -+++ b/arch/arm/mach-bcm2708/include/mach/vmalloc.h +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/vc_mem.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/vc_mem.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/vc_mem.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/vc_mem.h 2012-07-02 13:42:13.233275641 +0200 +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#if !defined( VC_MEM_H ) ++#define VC_MEM_H ++ ++#include ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* VC_MEM_H */ ++ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/include/mach/vmalloc.h linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/vmalloc.h +--- linux-3.2.21/arch/arm/mach-bcm2708/include/mach/vmalloc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/include/mach/vmalloc.h 2012-07-02 13:42:13.233275641 +0200 @@ -0,0 +1,20 @@ +/* + * arch/arm/mach-bcm2708/include/mach/vmalloc.h @@ -5452,11 +5356,64 @@ index 0000000..28ecc15 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define VMALLOC_END (0xd8000000) -diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c -new file mode 100644 -index 0000000..256bf1a ---- /dev/null -+++ b/arch/arm/mach-bcm2708/power.c +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/Kconfig linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/Kconfig +--- linux-3.2.21/arch/arm/mach-bcm2708/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/Kconfig 2012-07-02 13:42:13.232275620 +0200 +@@ -0,0 +1,32 @@ ++menu "Broadcom BCM2708 Implementations" ++ depends on ARCH_BCM2708 ++ ++config MACH_BCM2708 ++ bool "Broadcom BCM2708 Development Platform" ++ select CPU_V6 ++ help ++ Include support for the Broadcom(R) BCM2708 platform. ++ ++config BCM2708_GPIO ++ bool "BCM2708 gpio support" ++ depends on MACH_BCM2708 ++ select ARCH_REQUIRE_GPIOLIB ++ default y ++ help ++ Include support for the Broadcom(R) BCM2708 gpio. ++ ++config BCM2708_VCMEM ++ bool "Videocore Memory" ++ depends on MACH_BCM2708 ++ default y ++ help ++ Helper for videocore memory access and total size allocation. ++ ++config BCM2708_NOL2CACHE ++ bool "Videocore L2 cache disable" ++ depends on MACH_BCM2708 ++ default n ++ help ++ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt. ++ ++endmenu +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/Makefile linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/Makefile +--- linux-3.2.21/arch/arm/mach-bcm2708/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/Makefile 2012-07-02 13:42:13.232275620 +0200 +@@ -0,0 +1,8 @@ ++# ++# Makefile for the linux kernel. ++# ++ ++obj-$(CONFIG_MACH_BCM2708) += clock.o bcm2708.o armctrl.o vcio.o power.o dma.o ++obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o ++obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++ +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/Makefile.boot linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/Makefile.boot +--- linux-3.2.21/arch/arm/mach-bcm2708/Makefile.boot 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/Makefile.boot 2012-07-02 13:42:13.232275620 +0200 +@@ -0,0 +1,3 @@ ++ zreladdr-y := 0x00008000 ++params_phys-y := 0x00000100 ++initrd_phys-y := 0x00800000 +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/power.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/power.c +--- linux-3.2.21/arch/arm/mach-bcm2708/power.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/power.c 2012-07-02 13:42:13.235275683 +0200 @@ -0,0 +1,194 @@ +/* + * linux/arch/arm/mach-bcm2708/power.c @@ -5652,11 +5609,321 @@ index 0000000..256bf1a +MODULE_AUTHOR("Phil Elwell"); +MODULE_DESCRIPTION("Interface to BCM2708 power management"); +MODULE_LICENSE("GPL"); -diff --git a/arch/arm/mach-bcm2708/vc_mem.c b/arch/arm/mach-bcm2708/vc_mem.c -new file mode 100644 -index 0000000..67c10ee ---- /dev/null -+++ b/arch/arm/mach-bcm2708/vc_mem.c +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/vcio.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/vcio.c +--- linux-3.2.21/arch/arm/mach-bcm2708/vcio.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/vcio.c 2012-07-02 13:42:13.232275620 +0200 +@@ -0,0 +1,308 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/vcio.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This device provides a shared mechanism for writing to the mailboxes, ++ * semaphores, doorbells etc. that are shared between the ARM and the ++ * VideoCore processor ++ */ ++ ++#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ++#define SUPPORT_SYSRQ ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++ ++#define DRIVER_NAME BCM_VCIO_DRIVER_NAME ++ ++/* ---------------------------------------------------------------------- ++ * Mailbox ++ * -------------------------------------------------------------------- */ ++ ++/* offsets from a mail box base address */ ++#define MAIL_WRT 0x00 /* write - and next 4 words */ ++#define MAIL_RD 0x00 /* read - and next 4 words */ ++#define MAIL_POL 0x10 /* read without popping the fifo */ ++#define MAIL_SND 0x14 /* sender ID (bottom two bits) */ ++#define MAIL_STA 0x18 /* status */ ++#define MAIL_CNF 0x1C /* configuration */ ++ ++#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) ++#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) ++#define MBOX_CHAN(msg) ((msg) & 0xf) ++#define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) ++ ++#define MBOX_MAGIC 0xd0d0c0de ++ ++struct vc_mailbox { ++ struct device *dev; /* parent device */ ++ void __iomem *status; ++ void __iomem *config; ++ void __iomem *read; ++ void __iomem *write; ++ uint32_t msg[MBOX_CHAN_COUNT]; ++ struct semaphore sema[MBOX_CHAN_COUNT]; ++ uint32_t magic; ++}; ++ ++static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, ++ uint32_t addr_mbox) ++{ ++ int i; ++ ++ mbox_out->dev = dev; ++ mbox_out->status = __io_address(addr_mbox + MAIL_STA); ++ mbox_out->config = __io_address(addr_mbox + MAIL_CNF); ++ mbox_out->read = __io_address(addr_mbox + MAIL_RD); ++ /* Write to the other mailbox */ ++ mbox_out->write = ++ __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) + ++ MAIL_WRT); ++ ++ for (i = 0; i < MBOX_CHAN_COUNT; i++) { ++ mbox_out->msg[i] = 0; ++ sema_init(&mbox_out->sema[i], 0); ++ } ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config); ++ ++ mbox_out->magic = MBOX_MAGIC; ++} ++ ++static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) ++{ ++ int rc; ++ ++ if (mbox->magic != MBOX_MAGIC) ++ rc = -EINVAL; ++ else { ++ /* wait for the mailbox FIFO to have some space in it */ ++ while (0 != (readl(mbox->status) & ARM_MS_FULL)) ++ cpu_relax(); ++ ++ writel(MBOX_MSG(chan, data28), mbox->write); ++ rc = 0; ++ } ++ return rc; ++} ++ ++static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) ++{ ++ int rc; ++ ++ if (mbox->magic != MBOX_MAGIC) ++ rc = -EINVAL; ++ else { ++ if (down_interruptible(&mbox->sema[chan]) == 0) { ++ *data28 = MBOX_DATA28(mbox->msg[chan]); ++ mbox->msg[chan] = 0; ++ rc = 0; ++ } else { ++ /* The wait was interrupted */ ++ rc = -EINTR; ++ } ++ } ++ return rc; ++} ++ ++static irqreturn_t mbox_irq(int irq, void *dev_id) ++{ ++ /* wait for the mailbox FIFO to have some data in it */ ++ struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id; ++ int status = readl(mbox->status); ++ int ret = IRQ_NONE; ++ ++ while (!(status & ARM_MS_EMPTY)) { ++ uint32_t msg = readl(mbox->read); ++ int chan = MBOX_CHAN(msg); ++ if (chan < MBOX_CHAN_COUNT) { ++ if (mbox->msg[chan]) { ++ /* Overflow */ ++ printk(KERN_ERR DRIVER_NAME ++ ": mbox chan %d overflow - drop %08x\n", ++ chan, msg); ++ } else { ++ mbox->msg[chan] = (msg | 0xf); ++ up(&mbox->sema[chan]); ++ } ++ } else { ++ printk(KERN_ERR DRIVER_NAME ++ ": invalid channel selector (msg %08x)\n", msg); ++ } ++ ret = IRQ_HANDLED; ++ status = readl(mbox->status); ++ } ++ return ret; ++} ++ ++static struct irqaction mbox_irqaction = { ++ .name = "ARM Mailbox IRQ", ++ .flags = IRQF_DISABLED | IRQF_IRQPOLL, ++ .handler = mbox_irq, ++}; ++ ++/* ---------------------------------------------------------------------- ++ * Mailbox Methods ++ * -------------------------------------------------------------------- */ ++ ++static struct device *mbox_dev; /* we assume there's only one! */ ++ ++static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) ++{ ++ int rc; ++ ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); ++ device_lock(dev); ++ rc = mbox_write(mailbox, chan, data28); ++ device_unlock(dev); ++ ++ return rc; ++} ++ ++static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) ++{ ++ int rc; ++ ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); ++ device_lock(dev); ++ rc = mbox_read(mailbox, chan, data28); ++ device_unlock(dev); ++ ++ return rc; ++} ++ ++extern int bcm_mailbox_write(unsigned chan, uint32_t data28) ++{ ++ if (mbox_dev) ++ return dev_mbox_write(mbox_dev, chan, data28); ++ else ++ return -ENODEV; ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_write); ++ ++extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) ++{ ++ if (mbox_dev) ++ return dev_mbox_read(mbox_dev, chan, data28); ++ else ++ return -ENODEV; ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ ++static void dev_mbox_register(const char *dev_name, struct device *dev) ++{ ++ mbox_dev = dev; ++} ++ ++/* ---------------------------------------------------------------------- ++ * Platform Device for Mailbox ++ * -------------------------------------------------------------------- */ ++ ++static int bcm_vcio_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ struct vc_mailbox *mailbox; ++ ++ mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); ++ if (NULL == mailbox) { ++ printk(KERN_ERR DRIVER_NAME ": failed to allocate " ++ "mailbox memory\n"); ++ ret = -ENOMEM; ++ } else { ++ struct resource *res; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (res == NULL) { ++ printk(KERN_ERR DRIVER_NAME ": failed to obtain memory " ++ "resource\n"); ++ ret = -ENODEV; ++ kfree(mailbox); ++ } else { ++ /* should be based on the registers from res really */ ++ mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD); ++ ++ platform_set_drvdata(pdev, mailbox); ++ dev_mbox_register(DRIVER_NAME, &pdev->dev); ++ ++ mbox_irqaction.dev_id = mailbox; ++ setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); ++ printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n", ++ __io_address(ARM_0_MAIL0_RD)); ++ } ++ } ++ return ret; ++} ++ ++static int bcm_vcio_remove(struct platform_device *pdev) ++{ ++ struct vc_mailbox *mailbox = platform_get_drvdata(pdev); ++ ++ platform_set_drvdata(pdev, NULL); ++ kfree(mailbox); ++ ++ return 0; ++} ++ ++static struct platform_driver bcm_mbox_driver = { ++ .probe = bcm_vcio_probe, ++ .remove = bcm_vcio_remove, ++ ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int __init bcm_mbox_init(void) ++{ ++ int ret; ++ ++ printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n"); ++ ++ ret = platform_driver_register(&bcm_mbox_driver); ++ if (ret != 0) { ++ printk(KERN_ERR DRIVER_NAME ": failed to register " ++ "on platform\n"); ++ } ++ ++ return ret; ++} ++ ++static void __exit bcm_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm_mbox_driver); ++} ++ ++arch_initcall(bcm_mbox_init); /* Initialize early */ ++module_exit(bcm_mbox_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bcm-mbox"); +diff -Naur linux-3.2.21/arch/arm/mach-bcm2708/vc_mem.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/vc_mem.c +--- linux-3.2.21/arch/arm/mach-bcm2708/vc_mem.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mach-bcm2708/vc_mem.c 2012-07-02 13:42:13.235275683 +0200 @@ -0,0 +1,466 @@ +/***************************************************************************** +* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. @@ -6124,338 +6391,21 @@ index 0000000..67c10ee +module_exit(vc_mem_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Broadcom Corporation"); -diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c -new file mode 100644 -index 0000000..799a0ac ---- /dev/null -+++ b/arch/arm/mach-bcm2708/vcio.c -@@ -0,0 +1,308 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/vcio.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for writing to the mailboxes, -+ * semaphores, doorbells etc. that are shared between the ARM and the -+ * VideoCore processor -+ */ -+ -+#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -+#define SUPPORT_SYSRQ -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#define DRIVER_NAME BCM_VCIO_DRIVER_NAME -+ -+/* ---------------------------------------------------------------------- -+ * Mailbox -+ * -------------------------------------------------------------------- */ -+ -+/* offsets from a mail box base address */ -+#define MAIL_WRT 0x00 /* write - and next 4 words */ -+#define MAIL_RD 0x00 /* read - and next 4 words */ -+#define MAIL_POL 0x10 /* read without popping the fifo */ -+#define MAIL_SND 0x14 /* sender ID (bottom two bits) */ -+#define MAIL_STA 0x18 /* status */ -+#define MAIL_CNF 0x1C /* configuration */ -+ -+#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) -+#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) -+#define MBOX_CHAN(msg) ((msg) & 0xf) -+#define MBOX_DATA28(msg) ((msg) & ~0xf) -+#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) -+ -+#define MBOX_MAGIC 0xd0d0c0de -+ -+struct vc_mailbox { -+ struct device *dev; /* parent device */ -+ void __iomem *status; -+ void __iomem *config; -+ void __iomem *read; -+ void __iomem *write; -+ uint32_t msg[MBOX_CHAN_COUNT]; -+ struct semaphore sema[MBOX_CHAN_COUNT]; -+ uint32_t magic; -+}; -+ -+static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, -+ uint32_t addr_mbox) -+{ -+ int i; -+ -+ mbox_out->dev = dev; -+ mbox_out->status = __io_address(addr_mbox + MAIL_STA); -+ mbox_out->config = __io_address(addr_mbox + MAIL_CNF); -+ mbox_out->read = __io_address(addr_mbox + MAIL_RD); -+ /* Write to the other mailbox */ -+ mbox_out->write = -+ __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) + -+ MAIL_WRT); -+ -+ for (i = 0; i < MBOX_CHAN_COUNT; i++) { -+ mbox_out->msg[i] = 0; -+ sema_init(&mbox_out->sema[i], 0); -+ } -+ -+ /* Enable the interrupt on data reception */ -+ writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config); -+ -+ mbox_out->magic = MBOX_MAGIC; -+} -+ -+static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) -+{ -+ int rc; -+ -+ if (mbox->magic != MBOX_MAGIC) -+ rc = -EINVAL; -+ else { -+ /* wait for the mailbox FIFO to have some space in it */ -+ while (0 != (readl(mbox->status) & ARM_MS_FULL)) -+ cpu_relax(); -+ -+ writel(MBOX_MSG(chan, data28), mbox->write); -+ rc = 0; -+ } -+ return rc; -+} -+ -+static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) -+{ -+ int rc; -+ -+ if (mbox->magic != MBOX_MAGIC) -+ rc = -EINVAL; -+ else { -+ if (down_interruptible(&mbox->sema[chan]) == 0) { -+ *data28 = MBOX_DATA28(mbox->msg[chan]); -+ mbox->msg[chan] = 0; -+ rc = 0; -+ } else { -+ /* The wait was interrupted */ -+ rc = -EINTR; -+ } -+ } -+ return rc; -+} -+ -+static irqreturn_t mbox_irq(int irq, void *dev_id) -+{ -+ /* wait for the mailbox FIFO to have some data in it */ -+ struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id; -+ int status = readl(mbox->status); -+ int ret = IRQ_NONE; -+ -+ while (!(status & ARM_MS_EMPTY)) { -+ uint32_t msg = readl(mbox->read); -+ int chan = MBOX_CHAN(msg); -+ if (chan < MBOX_CHAN_COUNT) { -+ if (mbox->msg[chan]) { -+ /* Overflow */ -+ printk(KERN_ERR DRIVER_NAME -+ ": mbox chan %d overflow - drop %08x\n", -+ chan, msg); -+ } else { -+ mbox->msg[chan] = (msg | 0xf); -+ up(&mbox->sema[chan]); -+ } -+ } else { -+ printk(KERN_ERR DRIVER_NAME -+ ": invalid channel selector (msg %08x)\n", msg); -+ } -+ ret = IRQ_HANDLED; -+ status = readl(mbox->status); -+ } -+ return ret; -+} -+ -+static struct irqaction mbox_irqaction = { -+ .name = "ARM Mailbox IRQ", -+ .flags = IRQF_DISABLED | IRQF_IRQPOLL, -+ .handler = mbox_irq, -+}; -+ -+/* ---------------------------------------------------------------------- -+ * Mailbox Methods -+ * -------------------------------------------------------------------- */ -+ -+static struct device *mbox_dev; /* we assume there's only one! */ -+ -+static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) -+{ -+ int rc; -+ -+ struct vc_mailbox *mailbox = dev_get_drvdata(dev); -+ device_lock(dev); -+ rc = mbox_write(mailbox, chan, data28); -+ device_unlock(dev); -+ -+ return rc; -+} -+ -+static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) -+{ -+ int rc; -+ -+ struct vc_mailbox *mailbox = dev_get_drvdata(dev); -+ device_lock(dev); -+ rc = mbox_read(mailbox, chan, data28); -+ device_unlock(dev); -+ -+ return rc; -+} -+ -+extern int bcm_mailbox_write(unsigned chan, uint32_t data28) -+{ -+ if (mbox_dev) -+ return dev_mbox_write(mbox_dev, chan, data28); -+ else -+ return -ENODEV; -+} -+EXPORT_SYMBOL_GPL(bcm_mailbox_write); -+ -+extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) -+{ -+ if (mbox_dev) -+ return dev_mbox_read(mbox_dev, chan, data28); -+ else -+ return -ENODEV; -+} -+EXPORT_SYMBOL_GPL(bcm_mailbox_read); -+ -+static void dev_mbox_register(const char *dev_name, struct device *dev) -+{ -+ mbox_dev = dev; -+} -+ -+/* ---------------------------------------------------------------------- -+ * Platform Device for Mailbox -+ * -------------------------------------------------------------------- */ -+ -+static int bcm_vcio_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ struct vc_mailbox *mailbox; -+ -+ mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); -+ if (NULL == mailbox) { -+ printk(KERN_ERR DRIVER_NAME ": failed to allocate " -+ "mailbox memory\n"); -+ ret = -ENOMEM; -+ } else { -+ struct resource *res; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (res == NULL) { -+ printk(KERN_ERR DRIVER_NAME ": failed to obtain memory " -+ "resource\n"); -+ ret = -ENODEV; -+ kfree(mailbox); -+ } else { -+ /* should be based on the registers from res really */ -+ mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD); -+ -+ platform_set_drvdata(pdev, mailbox); -+ dev_mbox_register(DRIVER_NAME, &pdev->dev); -+ -+ mbox_irqaction.dev_id = mailbox; -+ setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); -+ printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n", -+ __io_address(ARM_0_MAIL0_RD)); -+ } -+ } -+ return ret; -+} -+ -+static int bcm_vcio_remove(struct platform_device *pdev) -+{ -+ struct vc_mailbox *mailbox = platform_get_drvdata(pdev); -+ -+ platform_set_drvdata(pdev, NULL); -+ kfree(mailbox); -+ -+ return 0; -+} -+ -+static struct platform_driver bcm_mbox_driver = { -+ .probe = bcm_vcio_probe, -+ .remove = bcm_vcio_remove, -+ -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int __init bcm_mbox_init(void) -+{ -+ int ret; -+ -+ printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n"); -+ -+ ret = platform_driver_register(&bcm_mbox_driver); -+ if (ret != 0) { -+ printk(KERN_ERR DRIVER_NAME ": failed to register " -+ "on platform\n"); -+ } -+ -+ return ret; -+} -+ -+static void __exit bcm_mbox_exit(void) -+{ -+ platform_driver_unregister(&bcm_mbox_driver); -+} -+ -+arch_initcall(bcm_mbox_init); /* Initialize early */ -+module_exit(bcm_mbox_exit); -+ -+MODULE_AUTHOR("Gray Girling"); -+MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:bcm-mbox"); -diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig -index 67f75a0..2c9ec3c 100644 ---- a/arch/arm/mm/Kconfig -+++ b/arch/arm/mm/Kconfig -@@ -390,7 +390,7 @@ config CPU_PJ4 +diff -Naur linux-3.2.21/arch/arm/Makefile linux-3.2.21-bootc-5b0ccb0/arch/arm/Makefile +--- linux-3.2.21/arch/arm/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/Makefile 2012-07-02 13:42:13.008271044 +0200 +@@ -198,6 +198,7 @@ + machine-$(CONFIG_MACH_SPEAR320) := spear3xx + machine-$(CONFIG_MACH_SPEAR600) := spear6xx + machine-$(CONFIG_ARCH_ZYNQ) := zynq ++machine-$(CONFIG_ARCH_BCM2708) := bcm2708 - # ARMv6 - config CPU_V6 -- bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX -+ bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || MACH_BCM2708 - select CPU_32v6 - select CPU_ABRT_EV6 - select CPU_PABRT_V6 -diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c -index c335c76..118b667 100644 ---- a/arch/arm/mm/alignment.c -+++ b/arch/arm/mm/alignment.c -@@ -855,9 +855,11 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) + # Platform directory name. This list is sorted alphanumerically + # by CONFIG_* macro name. +diff -Naur linux-3.2.21/arch/arm/mm/alignment.c linux-3.2.21-bootc-5b0ccb0/arch/arm/mm/alignment.c +--- linux-3.2.21/arch/arm/mm/alignment.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mm/alignment.c 2012-07-02 13:42:13.231275600 +0200 +@@ -855,9 +855,11 @@ case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */ if (thumb2_32b) handler = do_alignment_t32_to_handler(&instr, regs, &offset); @@ -6469,11 +6419,22 @@ index c335c76..118b667 100644 default: goto bad; -diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S -index d061d2f..436dc2c 100644 ---- a/arch/arm/mm/proc-v6.S -+++ b/arch/arm/mm/proc-v6.S -@@ -70,10 +70,19 @@ ENTRY(cpu_v6_reset) +diff -Naur linux-3.2.21/arch/arm/mm/Kconfig linux-3.2.21-bootc-5b0ccb0/arch/arm/mm/Kconfig +--- linux-3.2.21/arch/arm/mm/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mm/Kconfig 2012-07-02 13:42:13.227275520 +0200 +@@ -390,7 +390,7 @@ + + # ARMv6 + config CPU_V6 +- bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX ++ bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || MACH_BCM2708 + select CPU_32v6 + select CPU_ABRT_EV6 + select CPU_PABRT_V6 +diff -Naur linux-3.2.21/arch/arm/mm/proc-v6.S linux-3.2.21-bootc-5b0ccb0/arch/arm/mm/proc-v6.S +--- linux-3.2.21/arch/arm/mm/proc-v6.S 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/arch/arm/mm/proc-v6.S 2012-07-02 13:42:13.230275580 +0200 +@@ -70,10 +70,19 @@ * * IRQs are already disabled. */ @@ -6496,42 +6457,9 @@ index d061d2f..436dc2c 100644 mov pc, lr ENTRY(cpu_v6_dcache_clean_area) -diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index a3afac4..cbc62ff 100644 ---- a/drivers/i2c/busses/Kconfig -+++ b/drivers/i2c/busses/Kconfig -@@ -308,6 +308,14 @@ config I2C_AU1550 - This driver can also be built as a module. If so, the module - will be called i2c-au1550. - -+config I2C_BCM2708 -+ tristate "BCM2708 BSC" -+ depends on MACH_BCM2708 -+ help -+ Enabling this option will add BSC (Broadcom Serial Controller) -+ support for the BCM2708. BSC is a Broadcom proprietary bus compatible -+ with I2C/TWI/SMBus. -+ - config I2C_BLACKFIN_TWI - tristate "Blackfin TWI I2C support" - depends on BLACKFIN -diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile -index fba6da6..4022671 100644 ---- a/drivers/i2c/busses/Makefile -+++ b/drivers/i2c/busses/Makefile -@@ -30,6 +30,7 @@ obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o - # Embedded system I2C/SMBus host controller drivers - obj-$(CONFIG_I2C_AT91) += i2c-at91.o - obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o -+obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o - obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o - obj-$(CONFIG_I2C_CPM) += i2c-cpm.o - obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o -diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c -new file mode 100644 -index 0000000..5ec460f ---- /dev/null -+++ b/drivers/i2c/busses/i2c-bcm2708.c +diff -Naur linux-3.2.21/drivers/i2c/busses/i2c-bcm2708.c linux-3.2.21-bootc-5b0ccb0/drivers/i2c/busses/i2c-bcm2708.c +--- linux-3.2.21/drivers/i2c/busses/i2c-bcm2708.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/i2c/busses/i2c-bcm2708.c 2012-07-02 13:42:15.960331367 +0200 @@ -0,0 +1,379 @@ +/* + * Driver for Broadcom BCM2708 BSC Controllers @@ -6912,71 +6840,56 @@ index 0000000..5ec460f +MODULE_AUTHOR("Chris Boot "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index 5664696..b4679ec 100644 ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -508,5 +508,6 @@ source "drivers/misc/ti-st/Kconfig" +diff -Naur linux-3.2.21/drivers/i2c/busses/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/i2c/busses/Kconfig +--- linux-3.2.21/drivers/i2c/busses/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/i2c/busses/Kconfig 2012-07-02 13:42:15.960331367 +0200 +@@ -308,6 +308,14 @@ + This driver can also be built as a module. If so, the module + will be called i2c-au1550. + ++config I2C_BCM2708 ++ tristate "BCM2708 BSC" ++ depends on MACH_BCM2708 ++ help ++ Enabling this option will add BSC (Broadcom Serial Controller) ++ support for the BCM2708. BSC is a Broadcom proprietary bus compatible ++ with I2C/TWI/SMBus. ++ + config I2C_BLACKFIN_TWI + tristate "Blackfin TWI I2C support" + depends on BLACKFIN +diff -Naur linux-3.2.21/drivers/i2c/busses/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/i2c/busses/Makefile +--- linux-3.2.21/drivers/i2c/busses/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/i2c/busses/Makefile 2012-07-02 13:42:15.958331325 +0200 +@@ -30,6 +30,7 @@ + # Embedded system I2C/SMBus host controller drivers + obj-$(CONFIG_I2C_AT91) += i2c-at91.o + obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o ++obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o + obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o + obj-$(CONFIG_I2C_CPM) += i2c-cpm.o + obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o +diff -Naur linux-3.2.21/drivers/misc/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/misc/Kconfig +--- linux-3.2.21/drivers/misc/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/Kconfig 2012-07-02 13:42:15.982331817 +0200 +@@ -508,5 +508,6 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" +source "drivers/misc/vc04_services/Kconfig" endif # MISC_DEVICES -diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile -index b26495a..a06b534 100644 ---- a/drivers/misc/Makefile -+++ b/drivers/misc/Makefile -@@ -48,3 +48,4 @@ obj-y += lis3lv02d/ +diff -Naur linux-3.2.21/drivers/misc/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/misc/Makefile +--- linux-3.2.21/drivers/misc/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/Makefile 2012-07-02 13:42:15.976331692 +0200 +@@ -48,3 +48,4 @@ obj-y += carma/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ +obj-y += vc04_services/ -diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig -new file mode 100644 -index 0000000..d97a1e2 ---- /dev/null -+++ b/drivers/misc/vc04_services/Kconfig -@@ -0,0 +1,7 @@ -+config BCM2708_VCHIQ -+ tristate "Videocore VCHIQ" -+ depends on MACH_BCM2708 -+ default y -+ help -+ Helper for communication for VideoCore. -+ -diff --git a/drivers/misc/vc04_services/Makefile b/drivers/misc/vc04_services/Makefile -new file mode 100644 -index 0000000..ee53af7 ---- /dev/null -+++ b/drivers/misc/vc04_services/Makefile -@@ -0,0 +1,21 @@ -+obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o -+ -+vchiq-objs := \ -+ interface/vchiq_arm/vchiq_core.o \ -+ interface/vchiq_arm/vchiq_shim.o \ -+ interface/vchiq_arm/vchiq_util.o \ -+ interface/vchiq_arm/vchiq_arm.o \ -+ interface/vchiq_arm/vchiq_kern_lib.o \ -+ interface/vchiq_arm/vchiq_2835_arm.o \ -+ interface/vcos/linuxkernel/vcos_linuxkernel.o \ -+ interface/vcos/linuxkernel/vcos_thread_map.o \ -+ interface/vcos/linuxkernel/vcos_linuxkernel_cfg.o \ -+ interface/vcos/generic/vcos_generic_event_flags.o \ -+ interface/vcos/generic/vcos_logcat.o \ -+ interface/vcos/generic/vcos_mem_from_malloc.o \ -+ interface/vcos/generic/vcos_cmd.o -+ -+EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -+ -+ -+ -diff --git a/drivers/misc/vc04_services/interface/vchi/connections/connection.h b/drivers/misc/vc04_services/interface/vchi/connections/connection.h -new file mode 100644 -index 0000000..2fe5742 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/connections/connection.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/connections/connection.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/connections/connection.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/connections/connection.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/connections/connection.h 2012-07-02 13:42:15.996332103 +0200 @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -7287,11 +7200,9 @@ index 0000000..2fe5742 +#endif /* CONNECTION_H_ */ + +/****************************** End of file **********************************/ -diff --git a/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h -new file mode 100644 -index 0000000..7701b15 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 2012-07-02 13:42:15.996332103 +0200 @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -7479,11 +7390,443 @@ index 0000000..7701b15 +#endif // _VCHI_MESSAGE_H_ + +/****************************** End of file ***********************************/ -diff --git a/drivers/misc/vc04_services/interface/vchi/vchi.h b/drivers/misc/vc04_services/interface/vchi/vchi.h -new file mode 100644 -index 0000000..e441d8c ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/vchi.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 2012-07-02 13:42:15.996332103 +0200 +@@ -0,0 +1,214 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*============================================================================= ++Contains the #defines for the number of servers / clients etc, these can be ++over-ridden from the platform makefile if needed ++=============================================================================*/ ++ ++#ifndef VCHI_CFG_H_ ++#define VCHI_CFG_H_ ++ ++/**************************************************************************************** ++ * Defines in this first section are part of the VCHI API and may be examined by VCHI ++ * services. ++ ***************************************************************************************/ ++ ++/* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */ ++/* Really determined by the message driver, and should be available from a run-time call. */ ++#ifndef VCHI_BULK_ALIGN ++# if __VCCOREVER__ >= 0x04000000 ++# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans ++# else ++# define VCHI_BULK_ALIGN 16 ++# endif ++#endif ++ ++/* Required length multiple for bulk transfers, if unaligned transfers are not enabled */ ++/* May be less than or greater than VCHI_BULK_ALIGN */ ++/* Really determined by the message driver, and should be available from a run-time call. */ ++#ifndef VCHI_BULK_GRANULARITY ++# if __VCCOREVER__ >= 0x04000000 ++# define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans ++# else ++# define VCHI_BULK_GRANULARITY 16 ++# endif ++#endif ++ ++/* The largest possible message to be queued with vchi_msg_queue. */ ++#ifndef VCHI_MAX_MSG_SIZE ++# if defined VCHI_LOCAL_HOST_PORT ++# define VCHI_MAX_MSG_SIZE 16384 // makes file transfers fast, but should they be using bulk? ++# else ++# define VCHI_MAX_MSG_SIZE 4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!! ++# endif ++#endif ++ ++/****************************************************************************************** ++ * Defines below are system configuration options, and should not be used by VCHI services. ++ *****************************************************************************************/ ++ ++/* How many connections can we support? A localhost implementation uses 2 connections, ++ * 1 for host-app, 1 for VMCS, and these are hooked together by a loopback MPHI VCFW ++ * driver. */ ++#ifndef VCHI_MAX_NUM_CONNECTIONS ++# define VCHI_MAX_NUM_CONNECTIONS 3 ++#endif ++ ++/* How many services can we open per connection? Extending this doesn't cost processing time, just a small ++ * amount of static memory. */ ++#ifndef VCHI_MAX_SERVICES_PER_CONNECTION ++# define VCHI_MAX_SERVICES_PER_CONNECTION 36 ++#endif ++ ++/* Adjust if using a message driver that supports more logical TX channels */ ++#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION ++# define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels ++#endif ++ ++/* Adjust if using a message driver that supports more logical RX channels */ ++#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION ++# define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI ++#endif ++ ++/* How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the effective ++ * receive queue space, less message headers. */ ++#ifndef VCHI_NUM_READ_SLOTS ++# if defined(VCHI_LOCAL_HOST_PORT) ++# define VCHI_NUM_READ_SLOTS 4 ++# else ++# define VCHI_NUM_READ_SLOTS 48 ++# endif ++#endif ++ ++/* Do we utilise overrun facility for receive message slots? Can aid peer transmit ++ * performance. Only define on VideoCore end, talking to host. ++ */ ++//#define VCHI_MSG_RX_OVERRUN ++ ++/* How many transmit slots do we use. Generally don't need many, as the hardware driver ++ * underneath VCHI will usually have its own buffering. */ ++#ifndef VCHI_NUM_WRITE_SLOTS ++# define VCHI_NUM_WRITE_SLOTS 4 ++#endif ++ ++/* If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or more slots, ++ * then it's taking up too much buffer space, and the peer service will be told to stop ++ * transmitting with an XOFF message. For this to be effective, the VCHI_NUM_READ_SLOTS ++ * needs to be considerably bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency ++ * is too high. */ ++#ifndef VCHI_XOFF_THRESHOLD ++# define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2) ++#endif ++ ++/* After we've sent an XOFF, the peer will be told to resume transmission once the local ++ * service has dequeued/released enough messages that it's now occupying ++ * VCHI_XON_THRESHOLD slots or fewer. */ ++#ifndef VCHI_XON_THRESHOLD ++# define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4) ++#endif ++ ++/* A size below which a bulk transfer omits the handshake completely and always goes ++ * via the message channel, if bulk auxiliary is being sent on that service. (The user ++ * can guarantee this by enabling unaligned transmits). ++ * Not API. */ ++#ifndef VCHI_MIN_BULK_SIZE ++# define VCHI_MIN_BULK_SIZE ( VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096 ) ++#endif ++ ++/* Maximum size of bulk transmission chunks, for each interface type. A trade-off between ++ * speed and latency; the smaller the chunk size the better change of messages and other ++ * bulk transmissions getting in when big bulk transfers are happening. Set to 0 to not ++ * break transmissions into chunks. ++ */ ++#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI ++# define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024) ++#endif ++ ++/* NB Chunked CCP2 transmissions violate the letter of the CCP2 spec by using "JPEG8" mode ++ * with multiple-line frames. Only use if the receiver can cope. */ ++#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2 ++# define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0 ++#endif ++ ++/* How many TX messages can we have pending in our transmit slots. Once exhausted, ++ * vchi_msg_queue will be blocked. */ ++#ifndef VCHI_TX_MSG_QUEUE_SIZE ++# define VCHI_TX_MSG_QUEUE_SIZE 256 ++#endif ++ ++/* How many RX messages can we have parsed in the receive slots. Once exhausted, parsing ++ * will be suspended until older messages are dequeued/released. */ ++#ifndef VCHI_RX_MSG_QUEUE_SIZE ++# define VCHI_RX_MSG_QUEUE_SIZE 256 ++#endif ++ ++/* Really should be able to cope if we run out of received message descriptors, by ++ * suspending parsing as the comment above says, but we don't. This sweeps the issue ++ * under the carpet. */ ++#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS ++# undef VCHI_RX_MSG_QUEUE_SIZE ++# define VCHI_RX_MSG_QUEUE_SIZE (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS ++#endif ++ ++/* How many bulk transmits can we have pending. Once exhausted, vchi_bulk_queue_transmit ++ * will be blocked. */ ++#ifndef VCHI_TX_BULK_QUEUE_SIZE ++# define VCHI_TX_BULK_QUEUE_SIZE 64 ++#endif ++ ++/* How many bulk receives can we have pending. Once exhausted, vchi_bulk_queue_receive ++ * will be blocked. */ ++#ifndef VCHI_RX_BULK_QUEUE_SIZE ++# define VCHI_RX_BULK_QUEUE_SIZE 64 ++#endif ++ ++/* A limit on how many outstanding bulk requests we expect the peer to give us. If ++ * the peer asks for more than this, VCHI will fail and assert. The number is determined ++ * by the peer's hardware - it's the number of outstanding requests that can be queued ++ * on all bulk channels. VC3's MPHI peripheral allows 16. */ ++#ifndef VCHI_MAX_PEER_BULK_REQUESTS ++# define VCHI_MAX_PEER_BULK_REQUESTS 32 ++#endif ++ ++/* Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2 ++ * transmitter on and off. ++ */ ++/*#define VCHI_CCP2TX_MANUAL_POWER*/ ++ ++#ifndef VCHI_CCP2TX_MANUAL_POWER ++ ++/* Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. Set ++ * negative for no IDLE. ++ */ ++# ifndef VCHI_CCP2TX_IDLE_TIMEOUT ++# define VCHI_CCP2TX_IDLE_TIMEOUT 5 ++# endif ++ ++/* Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. Set ++ * negative for no OFF. ++ */ ++# ifndef VCHI_CCP2TX_OFF_TIMEOUT ++# define VCHI_CCP2TX_OFF_TIMEOUT 1000 ++# endif ++ ++#endif /* VCHI_CCP2TX_MANUAL_POWER */ ++ ++#endif /* VCHI_CFG_H_ */ ++ ++/****************************** End of file **********************************/ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 2012-07-02 13:42:15.995332082 +0200 +@@ -0,0 +1,56 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef VCHI_CFG_INTERNAL_H_ ++#define VCHI_CFG_INTERNAL_H_ ++ ++/**************************************************************************************** ++ * Control optimisation attempts. ++ ***************************************************************************************/ ++ ++// Don't use lots of short-term locks - use great long ones, reducing the overall locks-per-second ++#define VCHI_COARSE_LOCKING ++ ++// Avoid lock then unlock on exit from blocking queue operations (msg tx, bulk rx/tx) ++// (only relevant if VCHI_COARSE_LOCKING) ++#define VCHI_ELIDE_BLOCK_EXIT_LOCK ++ ++// Avoid lock on non-blocking peek ++// (only relevant if VCHI_COARSE_LOCKING) ++#define VCHI_AVOID_PEEK_LOCK ++ ++// Use one slot-handler thread per connection, rather than 1 thread dealing with all connections in rotation. ++#define VCHI_MULTIPLE_HANDLER_THREADS ++ ++// Put free descriptors onto the head of the free queue, rather than the tail, so that we don't thrash ++// our way through the pool of descriptors. ++#define VCHI_PUSH_FREE_DESCRIPTORS_ONTO_HEAD ++ ++// Don't issue a MSG_AVAILABLE callback for every single message. Possibly only safe if VCHI_COARSE_LOCKING. ++#define VCHI_FEWER_MSG_AVAILABLE_CALLBACKS ++ ++// Don't use message descriptors for TX messages that don't need them ++#define VCHI_MINIMISE_TX_MSG_DESCRIPTORS ++ ++// Nano-locks for multiqueue ++//#define VCHI_MQUEUE_NANOLOCKS ++ ++// Lock-free(er) dequeuing ++//#define VCHI_RX_NANOLOCKS ++ ++#endif /*VCHI_CFG_INTERNAL_H_*/ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_common.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_common.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_common.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_common.h 2012-07-02 13:42:15.995332082 +0200 +@@ -0,0 +1,152 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*============================================================================= ++Contains global defs used by submodules within vchi. ++=============================================================================*/ ++ ++#ifndef VCHI_COMMON_H_ ++#define VCHI_COMMON_H_ ++ ++ ++//flags used when sending messages (must be bitmapped) ++typedef enum ++{ ++ VCHI_FLAGS_NONE = 0x0, ++ VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go ++ VCHI_FLAGS_ALLOW_PARTIAL = 0x8, ++ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, ++ VCHI_FLAGS_CALLBACK_WHEN_DATA_READ = 0x20, ++ ++ VCHI_FLAGS_ALIGN_SLOT = 0x000080, // internal use only ++ VCHI_FLAGS_BULK_AUX_QUEUED = 0x010000, // internal use only ++ VCHI_FLAGS_BULK_AUX_COMPLETE = 0x020000, // internal use only ++ VCHI_FLAGS_BULK_DATA_QUEUED = 0x040000, // internal use only ++ VCHI_FLAGS_BULK_DATA_COMPLETE = 0x080000, // internal use only ++ VCHI_FLAGS_INTERNAL = 0xFF0000 ++} VCHI_FLAGS_T; ++ ++// constants for vchi_crc_control() ++typedef enum { ++ VCHI_CRC_NOTHING = -1, ++ VCHI_CRC_PER_SERVICE = 0, ++ VCHI_CRC_EVERYTHING = 1, ++} VCHI_CRC_CONTROL_T; ++ ++//callback reasons when an event occurs on a service ++typedef enum ++{ ++ VCHI_CALLBACK_REASON_MIN, ++ ++ //This indicates that there is data available ++ //handle is the msg id that was transmitted with the data ++ // When a message is received and there was no FULL message available previously, send callback ++ // Tasks get kicked by the callback, reset their event and try and read from the fifo until it fails ++ VCHI_CALLBACK_MSG_AVAILABLE, ++ VCHI_CALLBACK_MSG_SENT, ++ VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented ++ ++ // This indicates that a transfer from the other side has completed ++ VCHI_CALLBACK_BULK_RECEIVED, ++ //This indicates that data queued up to be sent has now gone ++ //handle is the msg id that was used when sending the data ++ VCHI_CALLBACK_BULK_SENT, ++ VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented ++ VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented ++ ++ VCHI_CALLBACK_SERVICE_CLOSED, ++ ++ // this side has sent XOFF to peer due to lack of data consumption by service ++ // (suggests the service may need to take some recovery action if it has ++ // been deliberately holding off consuming data) ++ VCHI_CALLBACK_SENT_XOFF, ++ VCHI_CALLBACK_SENT_XON, ++ ++ // indicates that a bulk transfer has finished reading the source buffer ++ VCHI_CALLBACK_BULK_DATA_READ, ++ ++ // power notification events (currently host side only) ++ VCHI_CALLBACK_PEER_OFF, ++ VCHI_CALLBACK_PEER_SUSPENDED, ++ VCHI_CALLBACK_PEER_ON, ++ VCHI_CALLBACK_PEER_RESUMED, ++ VCHI_CALLBACK_FORCED_POWER_OFF, ++ ++#ifdef USE_VCHIQ_ARM ++ // some extra notifications provided by vchiq_arm ++ VCHI_CALLBACK_SERVICE_OPENED, ++ VCHI_CALLBACK_BULK_RECEIVE_ABORTED, ++ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, ++#endif ++ ++ VCHI_CALLBACK_REASON_MAX ++} VCHI_CALLBACK_REASON_T; ++ ++//Calback used by all services / bulk transfers ++typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param ++ VCHI_CALLBACK_REASON_T reason, ++ void *handle ); //for transmitting msg's only ++ ++ ++ ++/* ++ * Define vector struct for scatter-gather (vector) operations ++ * Vectors can be nested - if a vector element has negative length, then ++ * the data pointer is treated as pointing to another vector array, with ++ * '-vec_len' elements. Thus to append a header onto an existing vector, ++ * you can do this: ++ * ++ * void foo(const VCHI_MSG_VECTOR_T *v, int n) ++ * { ++ * VCHI_MSG_VECTOR_T nv[2]; ++ * nv[0].vec_base = my_header; ++ * nv[0].vec_len = sizeof my_header; ++ * nv[1].vec_base = v; ++ * nv[1].vec_len = -n; ++ * ... ++ * ++ */ ++typedef struct vchi_msg_vector { ++ const void *vec_base; ++ int32_t vec_len; ++} VCHI_MSG_VECTOR_T; ++ ++// Opaque type for a connection API ++typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T; ++ ++// Opaque type for a message driver ++typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T; ++ ++ ++// Iterator structure for reading ahead through received message queue. Allocated by client, ++// initialised by vchi_msg_look_ahead. Fields are for internal VCHI use only. ++// Iterates over messages in queue at the instant of the call to vchi_msg_lookahead - ++// will not proceed to messages received since. Behaviour is undefined if an iterator ++// is used again after messages for that service are removed/dequeued by any ++// means other than vchi_msg_iter_... calls on the iterator itself. ++typedef struct { ++ struct opaque_vchi_service_t *service; ++ void *last; ++ void *next; ++ void *remove; ++} VCHI_MSG_ITER_T; ++ ++ ++#endif // VCHI_COMMON_H_ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi.h 2012-07-02 13:42:15.995332082 +0200 @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -7832,451 +8175,9 @@ index 0000000..e441d8c +#endif /* VCHI_H_ */ + +/****************************** End of file **********************************/ -diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h -new file mode 100644 -index 0000000..a66e489 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h -@@ -0,0 +1,214 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*============================================================================= -+Contains the #defines for the number of servers / clients etc, these can be -+over-ridden from the platform makefile if needed -+=============================================================================*/ -+ -+#ifndef VCHI_CFG_H_ -+#define VCHI_CFG_H_ -+ -+/**************************************************************************************** -+ * Defines in this first section are part of the VCHI API and may be examined by VCHI -+ * services. -+ ***************************************************************************************/ -+ -+/* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */ -+/* Really determined by the message driver, and should be available from a run-time call. */ -+#ifndef VCHI_BULK_ALIGN -+# if __VCCOREVER__ >= 0x04000000 -+# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans -+# else -+# define VCHI_BULK_ALIGN 16 -+# endif -+#endif -+ -+/* Required length multiple for bulk transfers, if unaligned transfers are not enabled */ -+/* May be less than or greater than VCHI_BULK_ALIGN */ -+/* Really determined by the message driver, and should be available from a run-time call. */ -+#ifndef VCHI_BULK_GRANULARITY -+# if __VCCOREVER__ >= 0x04000000 -+# define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans -+# else -+# define VCHI_BULK_GRANULARITY 16 -+# endif -+#endif -+ -+/* The largest possible message to be queued with vchi_msg_queue. */ -+#ifndef VCHI_MAX_MSG_SIZE -+# if defined VCHI_LOCAL_HOST_PORT -+# define VCHI_MAX_MSG_SIZE 16384 // makes file transfers fast, but should they be using bulk? -+# else -+# define VCHI_MAX_MSG_SIZE 4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!! -+# endif -+#endif -+ -+/****************************************************************************************** -+ * Defines below are system configuration options, and should not be used by VCHI services. -+ *****************************************************************************************/ -+ -+/* How many connections can we support? A localhost implementation uses 2 connections, -+ * 1 for host-app, 1 for VMCS, and these are hooked together by a loopback MPHI VCFW -+ * driver. */ -+#ifndef VCHI_MAX_NUM_CONNECTIONS -+# define VCHI_MAX_NUM_CONNECTIONS 3 -+#endif -+ -+/* How many services can we open per connection? Extending this doesn't cost processing time, just a small -+ * amount of static memory. */ -+#ifndef VCHI_MAX_SERVICES_PER_CONNECTION -+# define VCHI_MAX_SERVICES_PER_CONNECTION 36 -+#endif -+ -+/* Adjust if using a message driver that supports more logical TX channels */ -+#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION -+# define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels -+#endif -+ -+/* Adjust if using a message driver that supports more logical RX channels */ -+#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION -+# define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI -+#endif -+ -+/* How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the effective -+ * receive queue space, less message headers. */ -+#ifndef VCHI_NUM_READ_SLOTS -+# if defined(VCHI_LOCAL_HOST_PORT) -+# define VCHI_NUM_READ_SLOTS 4 -+# else -+# define VCHI_NUM_READ_SLOTS 48 -+# endif -+#endif -+ -+/* Do we utilise overrun facility for receive message slots? Can aid peer transmit -+ * performance. Only define on VideoCore end, talking to host. -+ */ -+//#define VCHI_MSG_RX_OVERRUN -+ -+/* How many transmit slots do we use. Generally don't need many, as the hardware driver -+ * underneath VCHI will usually have its own buffering. */ -+#ifndef VCHI_NUM_WRITE_SLOTS -+# define VCHI_NUM_WRITE_SLOTS 4 -+#endif -+ -+/* If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or more slots, -+ * then it's taking up too much buffer space, and the peer service will be told to stop -+ * transmitting with an XOFF message. For this to be effective, the VCHI_NUM_READ_SLOTS -+ * needs to be considerably bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency -+ * is too high. */ -+#ifndef VCHI_XOFF_THRESHOLD -+# define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2) -+#endif -+ -+/* After we've sent an XOFF, the peer will be told to resume transmission once the local -+ * service has dequeued/released enough messages that it's now occupying -+ * VCHI_XON_THRESHOLD slots or fewer. */ -+#ifndef VCHI_XON_THRESHOLD -+# define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4) -+#endif -+ -+/* A size below which a bulk transfer omits the handshake completely and always goes -+ * via the message channel, if bulk auxiliary is being sent on that service. (The user -+ * can guarantee this by enabling unaligned transmits). -+ * Not API. */ -+#ifndef VCHI_MIN_BULK_SIZE -+# define VCHI_MIN_BULK_SIZE ( VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096 ) -+#endif -+ -+/* Maximum size of bulk transmission chunks, for each interface type. A trade-off between -+ * speed and latency; the smaller the chunk size the better change of messages and other -+ * bulk transmissions getting in when big bulk transfers are happening. Set to 0 to not -+ * break transmissions into chunks. -+ */ -+#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI -+# define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024) -+#endif -+ -+/* NB Chunked CCP2 transmissions violate the letter of the CCP2 spec by using "JPEG8" mode -+ * with multiple-line frames. Only use if the receiver can cope. */ -+#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2 -+# define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0 -+#endif -+ -+/* How many TX messages can we have pending in our transmit slots. Once exhausted, -+ * vchi_msg_queue will be blocked. */ -+#ifndef VCHI_TX_MSG_QUEUE_SIZE -+# define VCHI_TX_MSG_QUEUE_SIZE 256 -+#endif -+ -+/* How many RX messages can we have parsed in the receive slots. Once exhausted, parsing -+ * will be suspended until older messages are dequeued/released. */ -+#ifndef VCHI_RX_MSG_QUEUE_SIZE -+# define VCHI_RX_MSG_QUEUE_SIZE 256 -+#endif -+ -+/* Really should be able to cope if we run out of received message descriptors, by -+ * suspending parsing as the comment above says, but we don't. This sweeps the issue -+ * under the carpet. */ -+#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS -+# undef VCHI_RX_MSG_QUEUE_SIZE -+# define VCHI_RX_MSG_QUEUE_SIZE (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS -+#endif -+ -+/* How many bulk transmits can we have pending. Once exhausted, vchi_bulk_queue_transmit -+ * will be blocked. */ -+#ifndef VCHI_TX_BULK_QUEUE_SIZE -+# define VCHI_TX_BULK_QUEUE_SIZE 64 -+#endif -+ -+/* How many bulk receives can we have pending. Once exhausted, vchi_bulk_queue_receive -+ * will be blocked. */ -+#ifndef VCHI_RX_BULK_QUEUE_SIZE -+# define VCHI_RX_BULK_QUEUE_SIZE 64 -+#endif -+ -+/* A limit on how many outstanding bulk requests we expect the peer to give us. If -+ * the peer asks for more than this, VCHI will fail and assert. The number is determined -+ * by the peer's hardware - it's the number of outstanding requests that can be queued -+ * on all bulk channels. VC3's MPHI peripheral allows 16. */ -+#ifndef VCHI_MAX_PEER_BULK_REQUESTS -+# define VCHI_MAX_PEER_BULK_REQUESTS 32 -+#endif -+ -+/* Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2 -+ * transmitter on and off. -+ */ -+/*#define VCHI_CCP2TX_MANUAL_POWER*/ -+ -+#ifndef VCHI_CCP2TX_MANUAL_POWER -+ -+/* Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. Set -+ * negative for no IDLE. -+ */ -+# ifndef VCHI_CCP2TX_IDLE_TIMEOUT -+# define VCHI_CCP2TX_IDLE_TIMEOUT 5 -+# endif -+ -+/* Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. Set -+ * negative for no OFF. -+ */ -+# ifndef VCHI_CCP2TX_OFF_TIMEOUT -+# define VCHI_CCP2TX_OFF_TIMEOUT 1000 -+# endif -+ -+#endif /* VCHI_CCP2TX_MANUAL_POWER */ -+ -+#endif /* VCHI_CFG_H_ */ -+ -+/****************************** End of file **********************************/ -diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h -new file mode 100644 -index 0000000..958cc55 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h -@@ -0,0 +1,56 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef VCHI_CFG_INTERNAL_H_ -+#define VCHI_CFG_INTERNAL_H_ -+ -+/**************************************************************************************** -+ * Control optimisation attempts. -+ ***************************************************************************************/ -+ -+// Don't use lots of short-term locks - use great long ones, reducing the overall locks-per-second -+#define VCHI_COARSE_LOCKING -+ -+// Avoid lock then unlock on exit from blocking queue operations (msg tx, bulk rx/tx) -+// (only relevant if VCHI_COARSE_LOCKING) -+#define VCHI_ELIDE_BLOCK_EXIT_LOCK -+ -+// Avoid lock on non-blocking peek -+// (only relevant if VCHI_COARSE_LOCKING) -+#define VCHI_AVOID_PEEK_LOCK -+ -+// Use one slot-handler thread per connection, rather than 1 thread dealing with all connections in rotation. -+#define VCHI_MULTIPLE_HANDLER_THREADS -+ -+// Put free descriptors onto the head of the free queue, rather than the tail, so that we don't thrash -+// our way through the pool of descriptors. -+#define VCHI_PUSH_FREE_DESCRIPTORS_ONTO_HEAD -+ -+// Don't issue a MSG_AVAILABLE callback for every single message. Possibly only safe if VCHI_COARSE_LOCKING. -+#define VCHI_FEWER_MSG_AVAILABLE_CALLBACKS -+ -+// Don't use message descriptors for TX messages that don't need them -+#define VCHI_MINIMISE_TX_MSG_DESCRIPTORS -+ -+// Nano-locks for multiqueue -+//#define VCHI_MQUEUE_NANOLOCKS -+ -+// Lock-free(er) dequeuing -+//#define VCHI_RX_NANOLOCKS -+ -+#endif /*VCHI_CFG_INTERNAL_H_*/ -diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_common.h b/drivers/misc/vc04_services/interface/vchi/vchi_common.h -new file mode 100644 -index 0000000..4057878 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/vchi_common.h -@@ -0,0 +1,152 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*============================================================================= -+Contains global defs used by submodules within vchi. -+=============================================================================*/ -+ -+#ifndef VCHI_COMMON_H_ -+#define VCHI_COMMON_H_ -+ -+ -+//flags used when sending messages (must be bitmapped) -+typedef enum -+{ -+ VCHI_FLAGS_NONE = 0x0, -+ VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) -+ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent -+ VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go -+ VCHI_FLAGS_ALLOW_PARTIAL = 0x8, -+ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, -+ VCHI_FLAGS_CALLBACK_WHEN_DATA_READ = 0x20, -+ -+ VCHI_FLAGS_ALIGN_SLOT = 0x000080, // internal use only -+ VCHI_FLAGS_BULK_AUX_QUEUED = 0x010000, // internal use only -+ VCHI_FLAGS_BULK_AUX_COMPLETE = 0x020000, // internal use only -+ VCHI_FLAGS_BULK_DATA_QUEUED = 0x040000, // internal use only -+ VCHI_FLAGS_BULK_DATA_COMPLETE = 0x080000, // internal use only -+ VCHI_FLAGS_INTERNAL = 0xFF0000 -+} VCHI_FLAGS_T; -+ -+// constants for vchi_crc_control() -+typedef enum { -+ VCHI_CRC_NOTHING = -1, -+ VCHI_CRC_PER_SERVICE = 0, -+ VCHI_CRC_EVERYTHING = 1, -+} VCHI_CRC_CONTROL_T; -+ -+//callback reasons when an event occurs on a service -+typedef enum -+{ -+ VCHI_CALLBACK_REASON_MIN, -+ -+ //This indicates that there is data available -+ //handle is the msg id that was transmitted with the data -+ // When a message is received and there was no FULL message available previously, send callback -+ // Tasks get kicked by the callback, reset their event and try and read from the fifo until it fails -+ VCHI_CALLBACK_MSG_AVAILABLE, -+ VCHI_CALLBACK_MSG_SENT, -+ VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented -+ -+ // This indicates that a transfer from the other side has completed -+ VCHI_CALLBACK_BULK_RECEIVED, -+ //This indicates that data queued up to be sent has now gone -+ //handle is the msg id that was used when sending the data -+ VCHI_CALLBACK_BULK_SENT, -+ VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented -+ VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented -+ -+ VCHI_CALLBACK_SERVICE_CLOSED, -+ -+ // this side has sent XOFF to peer due to lack of data consumption by service -+ // (suggests the service may need to take some recovery action if it has -+ // been deliberately holding off consuming data) -+ VCHI_CALLBACK_SENT_XOFF, -+ VCHI_CALLBACK_SENT_XON, -+ -+ // indicates that a bulk transfer has finished reading the source buffer -+ VCHI_CALLBACK_BULK_DATA_READ, -+ -+ // power notification events (currently host side only) -+ VCHI_CALLBACK_PEER_OFF, -+ VCHI_CALLBACK_PEER_SUSPENDED, -+ VCHI_CALLBACK_PEER_ON, -+ VCHI_CALLBACK_PEER_RESUMED, -+ VCHI_CALLBACK_FORCED_POWER_OFF, -+ -+#ifdef USE_VCHIQ_ARM -+ // some extra notifications provided by vchiq_arm -+ VCHI_CALLBACK_SERVICE_OPENED, -+ VCHI_CALLBACK_BULK_RECEIVE_ABORTED, -+ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, -+#endif -+ -+ VCHI_CALLBACK_REASON_MAX -+} VCHI_CALLBACK_REASON_T; -+ -+//Calback used by all services / bulk transfers -+typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param -+ VCHI_CALLBACK_REASON_T reason, -+ void *handle ); //for transmitting msg's only -+ -+ -+ -+/* -+ * Define vector struct for scatter-gather (vector) operations -+ * Vectors can be nested - if a vector element has negative length, then -+ * the data pointer is treated as pointing to another vector array, with -+ * '-vec_len' elements. Thus to append a header onto an existing vector, -+ * you can do this: -+ * -+ * void foo(const VCHI_MSG_VECTOR_T *v, int n) -+ * { -+ * VCHI_MSG_VECTOR_T nv[2]; -+ * nv[0].vec_base = my_header; -+ * nv[0].vec_len = sizeof my_header; -+ * nv[1].vec_base = v; -+ * nv[1].vec_len = -n; -+ * ... -+ * -+ */ -+typedef struct vchi_msg_vector { -+ const void *vec_base; -+ int32_t vec_len; -+} VCHI_MSG_VECTOR_T; -+ -+// Opaque type for a connection API -+typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T; -+ -+// Opaque type for a message driver -+typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T; -+ -+ -+// Iterator structure for reading ahead through received message queue. Allocated by client, -+// initialised by vchi_msg_look_ahead. Fields are for internal VCHI use only. -+// Iterates over messages in queue at the instant of the call to vchi_msg_lookahead - -+// will not proceed to messages received since. Behaviour is undefined if an iterator -+// is used again after messages for that service are removed/dequeued by any -+// means other than vchi_msg_iter_... calls on the iterator itself. -+typedef struct { -+ struct opaque_vchi_service_t *service; -+ void *last; -+ void *next; -+ void *remove; -+} VCHI_MSG_ITER_T; -+ -+ -+#endif // VCHI_COMMON_H_ -diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_mh.h b/drivers/misc/vc04_services/interface/vchi/vchi_mh.h -new file mode 100644 -index 0000000..9bcf12e ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchi/vchi_mh.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_mh.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_mh.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 2012-07-02 13:42:15.995332082 +0200 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -8305,77 +8206,9 @@ index 0000000..9bcf12e +#define VCHI_MEM_HANDLE_INVALID 0 + +#endif -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h -new file mode 100644 -index 0000000..49d3087 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h -@@ -0,0 +1,27 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef VCHIQ_VCHIQ_H -+#define VCHIQ_VCHIQ_H -+ -+#include "vchiq_if.h" -+#include "vchiq_util.h" -+#include "interface/vcos/vcos.h" -+ -+#endif -+ -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h -new file mode 100644 -index 0000000..959405e ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h -@@ -0,0 +1,27 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef VCHIQ_2835_H -+#define VCHIQ_2835_H -+ -+#include "vchiq_pagelist.h" -+ -+#define VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX 0 -+#define VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX 1 -+ -+#endif /* VCHIQ_2835_H */ -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -new file mode 100644 -index 0000000..35f6afe ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,512 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -8889,11 +8722,40 @@ index 0000000..35f6afe + kfree(pagelist); +} + -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c -new file mode 100644 -index 0000000..49a53ce ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 2012-07-02 13:42:15.994332061 +0200 +@@ -0,0 +1,27 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef VCHIQ_2835_H ++#define VCHIQ_2835_H ++ ++#include "vchiq_pagelist.h" ++ ++#define VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX 0 ++#define VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX 1 ++ ++#endif /* VCHIQ_2835_H */ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,1912 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -10807,11 +10669,9 @@ index 0000000..49a53ce +module_exit(vchiq_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Broadcom Corporation"); -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h -new file mode 100644 -index 0000000..24b42ff ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -10931,11 +10791,9 @@ index 0000000..24b42ff + + +#endif /* VCHIQ_ARM_H */ -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h -new file mode 100644 -index 0000000..cd51d99 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -10980,11 +10838,9 @@ index 0000000..cd51d99 +#endif + +#endif /* VCHIQ_CFG_H */ -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c -new file mode 100644 -index 0000000..62e3006 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 2012-07-02 13:42:15.995332082 +0200 @@ -0,0 +1,101 @@ +/***************************************************************************** +* Copyright 2001 - 2010 Broadcom Corporation. All rights reserved. @@ -11087,11 +10943,9 @@ index 0000000..62e3006 +} + +EXPORT_SYMBOL( vchiq_add_connected_callback ); -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h -new file mode 100644 -index 0000000..88cfa58 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,32 @@ +/***************************************************************************** +* Copyright 2001 - 2010 Broadcom Corporation. All rights reserved. @@ -11125,11 +10979,9 @@ index 0000000..88cfa58 + +#endif /* VCHIQ_CONNECTED_H */ + -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c -new file mode 100644 -index 0000000..749e7d4 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 2012-07-02 13:42:15.995332082 +0200 @@ -0,0 +1,2717 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -13848,11 +13700,9 @@ index 0000000..749e7d4 + } + return status; +} -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h -new file mode 100644 -index 0000000..37884bd ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -14360,11 +14210,40 @@ index 0000000..37884bd +vchiq_platform_conn_state_changed(VCHIQ_STATE_T* state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate); + +#endif -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h -new file mode 100644 -index 0000000..42d471b ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 2012-07-02 13:42:15.994332061 +0200 +@@ -0,0 +1,27 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef VCHIQ_VCHIQ_H ++#define VCHIQ_VCHIQ_H ++ ++#include "vchiq_if.h" ++#include "vchiq_util.h" ++#include "interface/vcos/vcos.h" ++ ++#endif ++ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -14521,11 +14400,9 @@ index 0000000..42d471b +extern VCHIQ_STATUS_T vchiq_dump_phys_mem( VCHIQ_SERVICE_HANDLE_T service, void *ptr, size_t num_bytes ); + +#endif /* VCHIQ_IF_H */ -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h -new file mode 100644 -index 0000000..06298bf ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 2012-07-02 13:42:15.995332082 +0200 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -14632,11 +14509,9 @@ index 0000000..06298bf +#define VCHIQ_IOC_MAX 15 + +#endif -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c -new file mode 100644 -index 0000000..e1768e4 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,297 @@ +/***************************************************************************** +* Copyright 2001 - 2011 Broadcom Corporation. All rights reserved. @@ -14935,11 +14810,9 @@ index 0000000..e1768e4 +EXPORT_SYMBOL(vchiq_open_service); +EXPORT_SYMBOL(vchiq_add_service_params); +EXPORT_SYMBOL(vchiq_open_service_params); -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c -new file mode 100644 -index 0000000..f1a8f42 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,1628 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -16569,11 +16442,9 @@ index 0000000..f1a8f42 + free_msgbufs = buf; + vcos_mutex_unlock(&vchiq_lib_mutex); +} -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h -new file mode 100644 -index 0000000..a465b91 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 2012-07-02 13:42:15.994332061 +0200 @@ -0,0 +1,45 @@ +/***************************************************************************** +* Copyright 2001 - 2010 Broadcom Corporation. All rights reserved. @@ -16620,11 +16491,9 @@ index 0000000..a465b91 +VCHIQ_STATUS_T vchiq_memdrv_initialise(void); + +#endif -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h -new file mode 100644 -index 0000000..e8d4e30 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -16669,11 +16538,9 @@ index 0000000..e8d4e30 +} FRAGMENTS_T; + +#endif /* VCHIQ_PAGELIST_H */ -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c -new file mode 100644 -index 0000000..88cd86f ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,1001 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -17676,11 +17543,9 @@ index 0000000..88cd86f +EXPORT_SYMBOL(vchi_service_use); +EXPORT_SYMBOL(vchi_service_release); +#endif -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c -new file mode 100644 -index 0000000..20b67c3 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 2012-07-02 13:42:15.995332082 +0200 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -17779,11 +17644,9 @@ index 0000000..20b67c3 + + return header; +} -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h -new file mode 100644 -index 0000000..6e0c84b ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -17832,11 +17695,9 @@ index 0000000..6e0c84b + +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c b/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c -new file mode 100644 -index 0000000..447d577 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,681 @@ +/***************************************************************************** +* Copyright 2009 - 2011 Broadcom Corporation. All rights reserved. @@ -18519,11 +18380,9 @@ index 0000000..447d577 + return VCOS_SUCCESS; +} + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h -new file mode 100644 -index 0000000..ce7816957 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -18612,11 +18471,9 @@ index 0000000..ce7816957 +VCOSPRE_ void VCOSPOST_ vcos_timer_init(void); +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h -new file mode 100644 -index 0000000..154b200 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -18889,11 +18746,9 @@ index 0000000..154b200 +#endif +#endif /* VCOS_GENERIC_BLOCKPOOL_H */ + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c -new file mode 100644 -index 0000000..3948a57 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19206,11 +19061,9 @@ index 0000000..3948a57 +} + +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h -new file mode 100644 -index 0000000..8776ebe ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19330,11 +19183,9 @@ index 0000000..8776ebe +#endif +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h -new file mode 100644 -index 0000000..370562d ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19428,11 +19279,9 @@ index 0000000..370562d +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h -new file mode 100644 -index 0000000..bf7945c ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19520,11 +19369,9 @@ index 0000000..bf7945c +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h -new file mode 100644 -index 0000000..27563ea ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19612,11 +19459,9 @@ index 0000000..27563ea +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h -new file mode 100644 -index 0000000..22c059a ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19773,11 +19618,9 @@ index 0000000..22c059a +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h -new file mode 100644 -index 0000000..fd0e198 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19993,11 +19836,9 @@ index 0000000..fd0e198 +} +#endif +#endif /* VCOS_JOINABLE_THREAD_FROM_PLAIN_H */ -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h -new file mode 100644 -index 0000000..ec9e07b ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20058,11 +19899,9 @@ index 0000000..ec9e07b + +#endif /* VCOS_INLINE_BODIES */ + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c b/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c -new file mode 100644 -index 0000000..8b05179 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,560 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20624,11 +20463,9 @@ index 0000000..8b05179 + } +} + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c b/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c -new file mode 100644 -index 0000000..dd0574a ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20714,11 +20551,9 @@ index 0000000..dd0574a + _vcos_platform_free(h->ptr); +} + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h -new file mode 100644 -index 0000000..8e2a18e ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20785,11 +20620,9 @@ index 0000000..8e2a18e +#endif /* VCOS_INLINE_BODIES */ + + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h -new file mode 100644 -index 0000000..a6a52b4 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20870,11 +20703,9 @@ index 0000000..a6a52b4 + + + -diff --git a/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h b/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h -new file mode 100644 -index 0000000..655dc25 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h 2012-07-02 13:42:15.990331980 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20922,11 +20753,9 @@ index 0000000..655dc25 +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h b/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h -new file mode 100644 -index 0000000..1db1ecb ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20959,11 +20788,9 @@ index 0000000..1db1ecb +#include /* includes integer types */ + +#endif /* _VCOS_PLATFORM_LINUX_STDINT_H */ -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c -new file mode 100644 -index 0000000..0385540 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,627 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21592,11 +21419,9 @@ index 0000000..0385540 +EXPORT_SYMBOL( vcos_verify_bkpts_enabled ); + +EXPORT_SYMBOL( vcos_strdup ); -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c -new file mode 100644 -index 0000000..e3f0840 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,332 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -21930,11 +21755,9 @@ index 0000000..e3f0840 + +EXPORT_SYMBOL_GPL( vcos_cfg_get_proc_entry ); + -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c -new file mode 100644 -index 0000000..4a9cedf ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,111 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -22047,11 +21870,9 @@ index 0000000..4a9cedf + +// END ######################################################################### +// ############################################################################# -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c -new file mode 100644 -index 0000000..6ffd755 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,64 @@ +/***************************************************************************** +* Copyright 2006 - 2008 Broadcom Corporation. All rights reserved. @@ -22117,11 +21938,9 @@ index 0000000..6ffd755 +MODULE_LICENSE( "GPL" ); +MODULE_VERSION( "1.0" ); + -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h -new file mode 100644 -index 0000000..381688e ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -22630,11 +22449,9 @@ index 0000000..381688e + +#endif /* VCOS_PLATFORM_H */ + -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h -new file mode 100644 -index 0000000..5f82aaf ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -22695,11 +22512,9 @@ index 0000000..5f82aaf +#define PRIx64 "llx" + +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c -new file mode 100644 -index 0000000..2d62589 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,129 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -22830,11 +22645,9 @@ index 0000000..2d62589 + + return *vcos_thread_storage; +} -diff --git a/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h -new file mode 100644 -index 0000000..62963c1 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,39 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -22875,229 +22688,9 @@ index 0000000..62963c1 +VCOS_THREAD_T *vcos_kthread_current(void); + +#endif /*VCOS_THREAD_MAP_H */ -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos.h b/drivers/misc/vc04_services/interface/vcos/vcos.h -new file mode 100644 -index 0000000..e37d795 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos.h -@@ -0,0 +1,212 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*============================================================================= -+VideoCore OS Abstraction Layer - public header file -+=============================================================================*/ -+ -+/** -+ * \mainpage OS Abstraction Layer -+ * -+ * \section intro Introduction -+ * -+ * This abstraction layer is here to allow the underlying OS to be easily changed (e.g. from -+ * Nucleus to ThreadX) and to aid in porting host applications to new targets. -+ * -+ * \subsection error Error handling -+ * -+ * Wherever possible, VCOS functions assert internally and return void. The only exceptions -+ * are creation functions (which might fail due to lack of resources) and functions that -+ * might timeout or fail due to lack of space. Errors that might be reported by the underlying -+ * OS API (e.g. invalid mutex) are treated as a programming error, and are merely asserted on. -+ * -+ * \section thread_synch Threads and synchronisation -+ * -+ * \subsection thread Threads -+ * -+ * The thread API is somewhat different to that found in Nucleus. In particular, threads -+ * cannot just be destroyed at arbitrary times and nor can they merely exit. This is so -+ * that the same API can be implemented across all interesting platforms without too much -+ * difficulty. See vcos_thread.h for details. Thread attributes are configured via -+ * the VCOS_THREAD_ATTR_T structure, found in vcos_thread_attr.h. -+ * -+ * \subsection sema Semaphores -+ * -+ * Counted semaphores (c.f. Nucleus NU_SEMAPHORE) are created with VCOS_SEMAPHORE_T. -+ * Under ThreadX on VideoCore, semaphores are implemented using VideoCore spinlocks, and -+ * so are quite a lot faster than ordinary ThreadX semaphores. See vcos_semaphore.h. -+ * -+ * \subsection mtx Mutexes -+ * -+ * Mutexes are used for locking. Attempts to take a mutex twice, or to unlock it -+ * in a different thread to the one in which it was locked should be expected to fail. -+ * Mutexes are not re-entrant (see vcos_reentrant_mutex.h for a slightly slower -+ * re-entrant mutex). -+ * -+ * \subsection evflags Event flags -+ * -+ * Event flags (the ThreadX name - also known as event groups under Nucleus) provide -+ * 32 flags which can be waited on by multiple clients, and signalled by multiple clients. -+ * A timeout can be specified. See vcos_event_flags.h. An alternative to this is the -+ * VCOS_EVENT_T (see vcos_event.h) which is akin to the Win32 auto-reset event, or a -+ * saturating counted semaphore. -+ * -+ * \subsection event Events -+ * -+ * A VCOS_EVENT_T is a bit like a saturating semaphore. No matter how many times it -+ * is signalled, the waiter will only wake up once. See vcos_event.h. You might think this -+ * is useful if you suspect that the cost of reading the semaphore count (perhaps via a -+ * system call) is expensive on your platform. -+ * -+ * \subsection tls Thread local storage -+ * -+ * Thread local storage is supported using vcos_tls.h. This is emulated on Nucleus -+ * and ThreadX. -+ * -+ * \section int Interrupts -+ * -+ * The legacy LISR/HISR scheme found in Nucleus is supported via the legacy ISR API, -+ * which is also supported on ThreadX. New code should avoid this, and old code should -+ * be migrated away from it, since it is slow. See vcos_legacy_isr.h. -+ * -+ * Registering an interrupt handler, and disabling/restoring interrupts, is handled -+ * using the functions in vcos_isr.h. -+ * -+ */ -+ -+/** -+ * \file vcos.h -+ * -+ * This is the top level header file. Clients include this. It pulls in the platform-specific -+ * header file (vcos_platform.h) together with header files defining the expected APIs, such -+ * as vcos_mutex.h, vcos_semaphore.h, etc. It is also possible to include these header files -+ * directly. -+ * -+ */ -+ -+#ifndef VCOS_H -+#define VCOS_H -+ -+#include "interface/vcos/vcos_assert.h" -+#include "vcos_types.h" -+#include "vcos_platform.h" -+ -+#ifndef VCOS_INIT_H -+#include "interface/vcos/vcos_init.h" -+#endif -+ -+#ifndef VCOS_SEMAPHORE_H -+#include "interface/vcos/vcos_semaphore.h" -+#endif -+ -+#ifndef VCOS_THREAD_H -+#include "interface/vcos/vcos_thread.h" -+#endif -+ -+#ifndef VCOS_MUTEX_H -+#include "interface/vcos/vcos_mutex.h" -+#endif -+ -+#ifndef VCOS_MEM_H -+#include "interface/vcos/vcos_mem.h" -+#endif -+ -+#ifndef VCOS_LOGGING_H -+#include "interface/vcos/vcos_logging.h" -+#endif -+ -+#ifndef VCOS_STRING_H -+#include "interface/vcos/vcos_string.h" -+#endif -+ -+#ifndef VCOS_EVENT_H -+#include "interface/vcos/vcos_event.h" -+#endif -+ -+#ifndef VCOS_THREAD_ATTR_H -+#include "interface/vcos/vcos_thread_attr.h" -+#endif -+ -+#ifndef VCOS_TLS_H -+#include "interface/vcos/vcos_tls.h" -+#endif -+ -+#ifndef VCOS_REENTRANT_MUTEX_H -+#include "interface/vcos/vcos_reentrant_mutex.h" -+#endif -+ -+#ifndef VCOS_NAMED_SEMAPHORE_H -+#include "interface/vcos/vcos_named_semaphore.h" -+#endif -+ -+#ifndef VCOS_QUICKSLOW_MUTEX_H -+#include "interface/vcos/vcos_quickslow_mutex.h" -+#endif -+ -+/* Headers with predicates */ -+ -+#if VCOS_HAVE_EVENT_FLAGS -+#include "interface/vcos/vcos_event_flags.h" -+#endif -+ -+#if VCOS_HAVE_QUEUE -+#include "interface/vcos/vcos_queue.h" -+#endif -+ -+#if VCOS_HAVE_LEGACY_ISR -+#include "interface/vcos/vcos_legacy_isr.h" -+#endif -+ -+#if VCOS_HAVE_TIMER -+#include "interface/vcos/vcos_timer.h" -+#endif -+ -+#if VCOS_HAVE_MEMPOOL -+#include "interface/vcos/vcos_mempool.h" -+#endif -+ -+#if VCOS_HAVE_ISR -+#include "interface/vcos/vcos_isr.h" -+#endif -+ -+#if VCOS_HAVE_ATOMIC_FLAGS -+#include "interface/vcos/vcos_atomic_flags.h" -+#endif -+ -+#if VCOS_HAVE_ONCE -+#include "interface/vcos/vcos_once.h" -+#endif -+ -+#if VCOS_HAVE_BLOCK_POOL -+#include "interface/vcos/vcos_blockpool.h" -+#endif -+ -+#if VCOS_HAVE_FILE -+#include "interface/vcos/vcos_file.h" -+#endif -+ -+#if VCOS_HAVE_CFG -+#include "interface/vcos/vcos_cfg.h" -+#endif -+ -+#if VCOS_HAVE_CMD -+#include "interface/vcos/vcos_cmd.h" -+#endif -+ -+#endif /* VCOS_H */ -+ -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_assert.h b/drivers/misc/vc04_services/interface/vcos/vcos_assert.h -new file mode 100644 -index 0000000..1e72dff ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_assert.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_assert.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_assert.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_assert.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_assert.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23379,11 +22972,9 @@ index 0000000..1e72dff +#endif + +#endif /* VCOS_ASSERT_H */ -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h b/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h -new file mode 100644 -index 0000000..317abf3 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23468,11 +23059,9 @@ index 0000000..317abf3 +#endif + +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h b/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h -new file mode 100644 -index 0000000..f3817f6 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23497,11 +23086,9 @@ index 0000000..f3817f6 +const char *vcos_get_build_time( void ); +const char *vcos_get_build_date( void ); + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h b/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h -new file mode 100644 -index 0000000..4423051 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h 2012-07-02 13:42:15.988331939 +0200 @@ -0,0 +1,113 @@ +/***************************************************************************** +* Copyright 2009 - 2011 Broadcom Corporation. All rights reserved. @@ -23616,11 +23203,9 @@ index 0000000..4423051 +#endif +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h b/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h -new file mode 100644 -index 0000000..29d5315 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,98 @@ +/***************************************************************************** +* Copyright 2009 - 2011 Broadcom Corporation. All rights reserved. @@ -23720,11 +23305,9 @@ index 0000000..29d5315 + +#endif /* VCOS_CMD_H */ + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h b/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h -new file mode 100644 -index 0000000..a270de8 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23766,11 +23349,9 @@ index 0000000..a270de8 + +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h b/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h -new file mode 100644 -index 0000000..0a683c0b ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23852,125 +23433,9 @@ index 0000000..0a683c0b +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_event.h b/drivers/misc/vc04_services/interface/vcos/vcos_event.h -new file mode 100644 -index 0000000..38612f9 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_event.h -@@ -0,0 +1,108 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*============================================================================= -+VideoCore OS Abstraction Layer - public header file for events -+=============================================================================*/ -+ -+#ifndef VCOS_EVENT_H -+#define VCOS_EVENT_H -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#include "interface/vcos/vcos_types.h" -+#include "vcos_platform.h" -+ -+/** -+ * \file -+ * -+ * An event is akin to the Win32 auto-reset event. -+ * -+ * -+ * Signalling an event will wake up one waiting thread only. Once one -+ * thread has been woken the event atomically returns to the unsignalled -+ * state. -+ * -+ * If no threads are waiting on the event when it is signalled it remains -+ * signalled. -+ * -+ * This is almost, but not quite, completely unlike the "event flags" -+ * object based on Nucleus event groups and ThreadX event flags. -+ * -+ * In particular, it should be similar in speed to a semaphore, unlike -+ * the event flags. -+ */ -+ -+/** -+ * Create an event instance. -+ * -+ * @param event Filled in with constructed event. -+ * @param name Name of the event (for debugging) -+ * -+ * @return VCOS_SUCCESS on success, or error code. -+ */ -+VCOS_INLINE_DECL -+VCOS_STATUS_T vcos_event_create(VCOS_EVENT_T *event, const char *name); -+ -+#ifndef vcos_event_signal -+ -+/** -+ * Signal the event. The event will return to being unsignalled -+ * after exactly one waiting thread has been woken up. If no -+ * threads are waiting it remains signalled. -+ * -+ * @param event The event to signal -+ */ -+VCOS_INLINE_DECL -+void vcos_event_signal(VCOS_EVENT_T *event); -+ -+/** -+ * Wait for the event. -+ * -+ * @param event The event to wait for -+ * @return VCOS_SUCCESS on success, VCOS_EAGAIN if the wait was interrupted. -+ */ -+VCOS_INLINE_DECL -+VCOS_STATUS_T vcos_event_wait(VCOS_EVENT_T *event); -+ -+/** -+ * Try event, but don't block. -+ * -+ * @param event The event to try -+ * @return VCOS_SUCCESS on success, VCOS_EAGAIN if the event is not currently signalled -+ */ -+VCOS_INLINE_DECL -+VCOS_STATUS_T vcos_event_try(VCOS_EVENT_T *event); -+ -+#endif -+ -+/* -+ * Destroy an event. -+ */ -+VCOS_INLINE_DECL -+void vcos_event_delete(VCOS_EVENT_T *event); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif -+ -+ -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h b/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h -new file mode 100644 -index 0000000..9eee410 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24081,11 +23546,337 @@ index 0000000..9eee410 + +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_init.h b/drivers/misc/vc04_services/interface/vcos/vcos_init.h -new file mode 100644 -index 0000000..9fc5eca ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_init.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_event.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_event.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_event.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_event.h 2012-07-02 13:42:15.989331960 +0200 +@@ -0,0 +1,108 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*============================================================================= ++VideoCore OS Abstraction Layer - public header file for events ++=============================================================================*/ ++ ++#ifndef VCOS_EVENT_H ++#define VCOS_EVENT_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include "interface/vcos/vcos_types.h" ++#include "vcos_platform.h" ++ ++/** ++ * \file ++ * ++ * An event is akin to the Win32 auto-reset event. ++ * ++ * ++ * Signalling an event will wake up one waiting thread only. Once one ++ * thread has been woken the event atomically returns to the unsignalled ++ * state. ++ * ++ * If no threads are waiting on the event when it is signalled it remains ++ * signalled. ++ * ++ * This is almost, but not quite, completely unlike the "event flags" ++ * object based on Nucleus event groups and ThreadX event flags. ++ * ++ * In particular, it should be similar in speed to a semaphore, unlike ++ * the event flags. ++ */ ++ ++/** ++ * Create an event instance. ++ * ++ * @param event Filled in with constructed event. ++ * @param name Name of the event (for debugging) ++ * ++ * @return VCOS_SUCCESS on success, or error code. ++ */ ++VCOS_INLINE_DECL ++VCOS_STATUS_T vcos_event_create(VCOS_EVENT_T *event, const char *name); ++ ++#ifndef vcos_event_signal ++ ++/** ++ * Signal the event. The event will return to being unsignalled ++ * after exactly one waiting thread has been woken up. If no ++ * threads are waiting it remains signalled. ++ * ++ * @param event The event to signal ++ */ ++VCOS_INLINE_DECL ++void vcos_event_signal(VCOS_EVENT_T *event); ++ ++/** ++ * Wait for the event. ++ * ++ * @param event The event to wait for ++ * @return VCOS_SUCCESS on success, VCOS_EAGAIN if the wait was interrupted. ++ */ ++VCOS_INLINE_DECL ++VCOS_STATUS_T vcos_event_wait(VCOS_EVENT_T *event); ++ ++/** ++ * Try event, but don't block. ++ * ++ * @param event The event to try ++ * @return VCOS_SUCCESS on success, VCOS_EAGAIN if the event is not currently signalled ++ */ ++VCOS_INLINE_DECL ++VCOS_STATUS_T vcos_event_try(VCOS_EVENT_T *event); ++ ++#endif ++ ++/* ++ * Destroy an event. ++ */ ++VCOS_INLINE_DECL ++void vcos_event_delete(VCOS_EVENT_T *event); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif ++ ++ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos.h 2012-07-02 13:42:15.990331980 +0200 +@@ -0,0 +1,212 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*============================================================================= ++VideoCore OS Abstraction Layer - public header file ++=============================================================================*/ ++ ++/** ++ * \mainpage OS Abstraction Layer ++ * ++ * \section intro Introduction ++ * ++ * This abstraction layer is here to allow the underlying OS to be easily changed (e.g. from ++ * Nucleus to ThreadX) and to aid in porting host applications to new targets. ++ * ++ * \subsection error Error handling ++ * ++ * Wherever possible, VCOS functions assert internally and return void. The only exceptions ++ * are creation functions (which might fail due to lack of resources) and functions that ++ * might timeout or fail due to lack of space. Errors that might be reported by the underlying ++ * OS API (e.g. invalid mutex) are treated as a programming error, and are merely asserted on. ++ * ++ * \section thread_synch Threads and synchronisation ++ * ++ * \subsection thread Threads ++ * ++ * The thread API is somewhat different to that found in Nucleus. In particular, threads ++ * cannot just be destroyed at arbitrary times and nor can they merely exit. This is so ++ * that the same API can be implemented across all interesting platforms without too much ++ * difficulty. See vcos_thread.h for details. Thread attributes are configured via ++ * the VCOS_THREAD_ATTR_T structure, found in vcos_thread_attr.h. ++ * ++ * \subsection sema Semaphores ++ * ++ * Counted semaphores (c.f. Nucleus NU_SEMAPHORE) are created with VCOS_SEMAPHORE_T. ++ * Under ThreadX on VideoCore, semaphores are implemented using VideoCore spinlocks, and ++ * so are quite a lot faster than ordinary ThreadX semaphores. See vcos_semaphore.h. ++ * ++ * \subsection mtx Mutexes ++ * ++ * Mutexes are used for locking. Attempts to take a mutex twice, or to unlock it ++ * in a different thread to the one in which it was locked should be expected to fail. ++ * Mutexes are not re-entrant (see vcos_reentrant_mutex.h for a slightly slower ++ * re-entrant mutex). ++ * ++ * \subsection evflags Event flags ++ * ++ * Event flags (the ThreadX name - also known as event groups under Nucleus) provide ++ * 32 flags which can be waited on by multiple clients, and signalled by multiple clients. ++ * A timeout can be specified. See vcos_event_flags.h. An alternative to this is the ++ * VCOS_EVENT_T (see vcos_event.h) which is akin to the Win32 auto-reset event, or a ++ * saturating counted semaphore. ++ * ++ * \subsection event Events ++ * ++ * A VCOS_EVENT_T is a bit like a saturating semaphore. No matter how many times it ++ * is signalled, the waiter will only wake up once. See vcos_event.h. You might think this ++ * is useful if you suspect that the cost of reading the semaphore count (perhaps via a ++ * system call) is expensive on your platform. ++ * ++ * \subsection tls Thread local storage ++ * ++ * Thread local storage is supported using vcos_tls.h. This is emulated on Nucleus ++ * and ThreadX. ++ * ++ * \section int Interrupts ++ * ++ * The legacy LISR/HISR scheme found in Nucleus is supported via the legacy ISR API, ++ * which is also supported on ThreadX. New code should avoid this, and old code should ++ * be migrated away from it, since it is slow. See vcos_legacy_isr.h. ++ * ++ * Registering an interrupt handler, and disabling/restoring interrupts, is handled ++ * using the functions in vcos_isr.h. ++ * ++ */ ++ ++/** ++ * \file vcos.h ++ * ++ * This is the top level header file. Clients include this. It pulls in the platform-specific ++ * header file (vcos_platform.h) together with header files defining the expected APIs, such ++ * as vcos_mutex.h, vcos_semaphore.h, etc. It is also possible to include these header files ++ * directly. ++ * ++ */ ++ ++#ifndef VCOS_H ++#define VCOS_H ++ ++#include "interface/vcos/vcos_assert.h" ++#include "vcos_types.h" ++#include "vcos_platform.h" ++ ++#ifndef VCOS_INIT_H ++#include "interface/vcos/vcos_init.h" ++#endif ++ ++#ifndef VCOS_SEMAPHORE_H ++#include "interface/vcos/vcos_semaphore.h" ++#endif ++ ++#ifndef VCOS_THREAD_H ++#include "interface/vcos/vcos_thread.h" ++#endif ++ ++#ifndef VCOS_MUTEX_H ++#include "interface/vcos/vcos_mutex.h" ++#endif ++ ++#ifndef VCOS_MEM_H ++#include "interface/vcos/vcos_mem.h" ++#endif ++ ++#ifndef VCOS_LOGGING_H ++#include "interface/vcos/vcos_logging.h" ++#endif ++ ++#ifndef VCOS_STRING_H ++#include "interface/vcos/vcos_string.h" ++#endif ++ ++#ifndef VCOS_EVENT_H ++#include "interface/vcos/vcos_event.h" ++#endif ++ ++#ifndef VCOS_THREAD_ATTR_H ++#include "interface/vcos/vcos_thread_attr.h" ++#endif ++ ++#ifndef VCOS_TLS_H ++#include "interface/vcos/vcos_tls.h" ++#endif ++ ++#ifndef VCOS_REENTRANT_MUTEX_H ++#include "interface/vcos/vcos_reentrant_mutex.h" ++#endif ++ ++#ifndef VCOS_NAMED_SEMAPHORE_H ++#include "interface/vcos/vcos_named_semaphore.h" ++#endif ++ ++#ifndef VCOS_QUICKSLOW_MUTEX_H ++#include "interface/vcos/vcos_quickslow_mutex.h" ++#endif ++ ++/* Headers with predicates */ ++ ++#if VCOS_HAVE_EVENT_FLAGS ++#include "interface/vcos/vcos_event_flags.h" ++#endif ++ ++#if VCOS_HAVE_QUEUE ++#include "interface/vcos/vcos_queue.h" ++#endif ++ ++#if VCOS_HAVE_LEGACY_ISR ++#include "interface/vcos/vcos_legacy_isr.h" ++#endif ++ ++#if VCOS_HAVE_TIMER ++#include "interface/vcos/vcos_timer.h" ++#endif ++ ++#if VCOS_HAVE_MEMPOOL ++#include "interface/vcos/vcos_mempool.h" ++#endif ++ ++#if VCOS_HAVE_ISR ++#include "interface/vcos/vcos_isr.h" ++#endif ++ ++#if VCOS_HAVE_ATOMIC_FLAGS ++#include "interface/vcos/vcos_atomic_flags.h" ++#endif ++ ++#if VCOS_HAVE_ONCE ++#include "interface/vcos/vcos_once.h" ++#endif ++ ++#if VCOS_HAVE_BLOCK_POOL ++#include "interface/vcos/vcos_blockpool.h" ++#endif ++ ++#if VCOS_HAVE_FILE ++#include "interface/vcos/vcos_file.h" ++#endif ++ ++#if VCOS_HAVE_CFG ++#include "interface/vcos/vcos_cfg.h" ++#endif ++ ++#if VCOS_HAVE_CMD ++#include "interface/vcos/vcos_cmd.h" ++#endif ++ ++#endif /* VCOS_H */ ++ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_init.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_init.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_init.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_init.h 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24141,11 +23932,9 @@ index 0000000..9fc5eca +} +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_logging.h b/drivers/misc/vc04_services/interface/vcos/vcos_logging.h -new file mode 100644 -index 0000000..9702822 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_logging.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_logging.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_logging.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_logging.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_logging.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24437,11 +24226,9 @@ index 0000000..9702822 +#endif /* VCOS_LOGGING_H */ + + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h b/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h -new file mode 100644 -index 0000000..9473cec ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24561,11 +24348,9 @@ index 0000000..9473cec +#endif +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_mem.h b/drivers/misc/vc04_services/interface/vcos/vcos_mem.h -new file mode 100644 -index 0000000..af16208 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_mem.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_mem.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_mem.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_mem.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_mem.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24659,11 +24444,9 @@ index 0000000..af16208 +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h b/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h -new file mode 100644 -index 0000000..f0ef70b ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24833,11 +24616,9 @@ index 0000000..f0ef70b +#endif + + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h b/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h -new file mode 100644 -index 0000000..14387a8 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24942,11 +24723,9 @@ index 0000000..14387a8 +} +#endif +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_once.h b/drivers/misc/vc04_services/interface/vcos/vcos_once.h -new file mode 100644 -index 0000000..0533c10 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_once.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_once.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_once.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_once.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_once.h 2012-07-02 13:42:15.991332000 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25001,11 +24780,9 @@ index 0000000..0533c10 +#endif +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h b/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h -new file mode 100644 -index 0000000..2760dd7 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25133,11 +24910,9 @@ index 0000000..2760dd7 +#endif +#endif + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h b/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h -new file mode 100644 -index 0000000..3c7669d ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h 2012-07-02 13:42:15.993332040 +0200 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25173,11 +24948,9 @@ index 0000000..3c7669d +#endif /* __cplusplus */ + +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h b/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h -new file mode 100644 -index 0000000..c9a3e02 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25382,11 +25155,9 @@ index 0000000..c9a3e02 +#endif /* VCOS_STDINT_H */ + + -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_string.h b/drivers/misc/vc04_services/interface/vcos/vcos_string.h -new file mode 100644 -index 0000000..c3d875f ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_string.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_string.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_string.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_string.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_string.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25472,11 +25243,100 @@ index 0000000..c3d875f +} +#endif +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_thread.h b/drivers/misc/vc04_services/interface/vcos/vcos_thread.h -new file mode 100644 -index 0000000..ee34648 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_thread.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h 2012-07-02 13:42:15.989331960 +0200 +@@ -0,0 +1,87 @@ ++/* ++ * Copyright (c) 2010-2011 Broadcom. All rights reserved. ++ * ++ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*============================================================================= ++VideoCore OS Abstraction Layer - thread attributes ++=============================================================================*/ ++ ++#ifndef VCOS_THREAD_ATTR_H ++#define VCOS_THREAD_ATTR_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** ++ * \file ++ * ++ * Attributes for thread creation. ++ * ++ */ ++ ++/** Initialize thread attribute struct. This call does not allocate memory, ++ * and so cannot fail. ++ * ++ */ ++VCOSPRE_ void VCOSPOST_ vcos_thread_attr_init(VCOS_THREAD_ATTR_T *attrs); ++ ++/** Set the stack address and size. If not set, a stack will be allocated automatically. ++ * ++ * This can only be set on some platforms. It will always be possible to set the stack ++ * address on VideoCore, but on host platforms, support may well not be available. ++ */ ++#if VCOS_CAN_SET_STACK_ADDR ++VCOS_INLINE_DECL ++void vcos_thread_attr_setstack(VCOS_THREAD_ATTR_T *attrs, void *addr, VCOS_UNSIGNED sz); ++#endif ++ ++/** Set the stack size. If not set, a default size will be used. Attempting to call this after having ++ * set the stack location with vcos_thread_attr_setstack() will result in undefined behaviour. ++ */ ++VCOS_INLINE_DECL ++void vcos_thread_attr_setstacksize(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED sz); ++ ++/** Set the task priority. If not set, a default value will be used. ++ */ ++VCOS_INLINE_DECL ++void vcos_thread_attr_setpriority(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED pri); ++ ++/** Set the task cpu affinity. If not set, the default will be used. ++ */ ++VCOS_INLINE_DECL ++void vcos_thread_attr_setaffinity(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED aff); ++ ++/** Set the timeslice. If not set the default will be used. ++ */ ++VCOS_INLINE_DECL ++void vcos_thread_attr_settimeslice(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED ts); ++ ++/** The thread entry function takes (argc,argv), as per Nucleus, with ++ * argc being 0. This may be withdrawn in a future release and should not ++ * be used in new code. ++ */ ++VCOS_INLINE_DECL ++void _vcos_thread_attr_setlegacyapi(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED legacy); ++ ++VCOS_INLINE_DECL ++void vcos_thread_attr_setautostart(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED autostart); ++ ++#ifdef __cplusplus ++} ++#endif ++#endif +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_thread.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_thread.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_thread.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_thread.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25748,104 +25608,9 @@ index 0000000..ee34648 +} +#endif +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h b/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h -new file mode 100644 -index 0000000..375dd01 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h -@@ -0,0 +1,87 @@ -+/* -+ * Copyright (c) 2010-2011 Broadcom. All rights reserved. -+ * -+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*============================================================================= -+VideoCore OS Abstraction Layer - thread attributes -+=============================================================================*/ -+ -+#ifndef VCOS_THREAD_ATTR_H -+#define VCOS_THREAD_ATTR_H -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** -+ * \file -+ * -+ * Attributes for thread creation. -+ * -+ */ -+ -+/** Initialize thread attribute struct. This call does not allocate memory, -+ * and so cannot fail. -+ * -+ */ -+VCOSPRE_ void VCOSPOST_ vcos_thread_attr_init(VCOS_THREAD_ATTR_T *attrs); -+ -+/** Set the stack address and size. If not set, a stack will be allocated automatically. -+ * -+ * This can only be set on some platforms. It will always be possible to set the stack -+ * address on VideoCore, but on host platforms, support may well not be available. -+ */ -+#if VCOS_CAN_SET_STACK_ADDR -+VCOS_INLINE_DECL -+void vcos_thread_attr_setstack(VCOS_THREAD_ATTR_T *attrs, void *addr, VCOS_UNSIGNED sz); -+#endif -+ -+/** Set the stack size. If not set, a default size will be used. Attempting to call this after having -+ * set the stack location with vcos_thread_attr_setstack() will result in undefined behaviour. -+ */ -+VCOS_INLINE_DECL -+void vcos_thread_attr_setstacksize(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED sz); -+ -+/** Set the task priority. If not set, a default value will be used. -+ */ -+VCOS_INLINE_DECL -+void vcos_thread_attr_setpriority(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED pri); -+ -+/** Set the task cpu affinity. If not set, the default will be used. -+ */ -+VCOS_INLINE_DECL -+void vcos_thread_attr_setaffinity(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED aff); -+ -+/** Set the timeslice. If not set the default will be used. -+ */ -+VCOS_INLINE_DECL -+void vcos_thread_attr_settimeslice(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED ts); -+ -+/** The thread entry function takes (argc,argv), as per Nucleus, with -+ * argc being 0. This may be withdrawn in a future release and should not -+ * be used in new code. -+ */ -+VCOS_INLINE_DECL -+void _vcos_thread_attr_setlegacyapi(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED legacy); -+ -+VCOS_INLINE_DECL -+void vcos_thread_attr_setautostart(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED autostart); -+ -+#ifdef __cplusplus -+} -+#endif -+#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_timer.h b/drivers/misc/vc04_services/interface/vcos/vcos_timer.h -new file mode 100644 -index 0000000..1612334 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_timer.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_timer.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_timer.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_timer.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_timer.h 2012-07-02 13:42:15.992332020 +0200 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25953,11 +25718,9 @@ index 0000000..1612334 +} +#endif +#endif -diff --git a/drivers/misc/vc04_services/interface/vcos/vcos_types.h b/drivers/misc/vc04_services/interface/vcos/vcos_types.h -new file mode 100644 -index 0000000..25de671 ---- /dev/null -+++ b/drivers/misc/vc04_services/interface/vcos/vcos_types.h +diff -Naur linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_types.h linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_types.h +--- linux-3.2.21/drivers/misc/vc04_services/interface/vcos/vcos_types.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/interface/vcos/vcos_types.h 2012-07-02 13:42:15.989331960 +0200 @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -26170,11 +25933,46 @@ index 0000000..25de671 +typedef vcos_fourcc_t FOURCC_T; + +#endif -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index 411a994..ad08933 100644 ---- a/drivers/mmc/core/core.c -+++ b/drivers/mmc/core/core.c -@@ -514,10 +514,14 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) +diff -Naur linux-3.2.21/drivers/misc/vc04_services/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/Kconfig +--- linux-3.2.21/drivers/misc/vc04_services/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/Kconfig 2012-07-02 13:42:15.996332103 +0200 +@@ -0,0 +1,7 @@ ++config BCM2708_VCHIQ ++ tristate "Videocore VCHIQ" ++ depends on MACH_BCM2708 ++ default y ++ help ++ Helper for communication for VideoCore. ++ +diff -Naur linux-3.2.21/drivers/misc/vc04_services/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/Makefile +--- linux-3.2.21/drivers/misc/vc04_services/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/misc/vc04_services/Makefile 2012-07-02 13:42:15.996332103 +0200 +@@ -0,0 +1,21 @@ ++obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o ++ ++vchiq-objs := \ ++ interface/vchiq_arm/vchiq_core.o \ ++ interface/vchiq_arm/vchiq_shim.o \ ++ interface/vchiq_arm/vchiq_util.o \ ++ interface/vchiq_arm/vchiq_arm.o \ ++ interface/vchiq_arm/vchiq_kern_lib.o \ ++ interface/vchiq_arm/vchiq_2835_arm.o \ ++ interface/vcos/linuxkernel/vcos_linuxkernel.o \ ++ interface/vcos/linuxkernel/vcos_thread_map.o \ ++ interface/vcos/linuxkernel/vcos_linuxkernel_cfg.o \ ++ interface/vcos/generic/vcos_generic_event_flags.o \ ++ interface/vcos/generic/vcos_logcat.o \ ++ interface/vcos/generic/vcos_mem_from_malloc.o \ ++ interface/vcos/generic/vcos_cmd.o ++ ++EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel ++ ++ ++ +diff -Naur linux-3.2.21/drivers/mmc/core/core.c linux-3.2.21-bootc-5b0ccb0/drivers/mmc/core/core.c +--- linux-3.2.21/drivers/mmc/core/core.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/core/core.c 2012-07-02 13:42:16.308338477 +0200 +@@ -514,10 +514,14 @@ if (data->flags & MMC_DATA_WRITE) /* @@ -26192,78 +25990,9 @@ index 411a994..ad08933 100644 else limit_us = 100000; -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index cf444b0..f8feea6 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -229,6 +229,27 @@ config MMC_SDHCI_S3C_DMA - - YMMV. - -+config MMC_SDHCI_BCM2708 -+ tristate "SDHCI support on BCM2708" -+ depends on MMC_SDHCI && MACH_BCM2708 -+ select MMC_SDHCI_IO_ACCESSORS -+ help -+ This selects the Secure Digital Host Controller Interface (SDHCI) -+ often referrered to as the eMMC block. -+ -+ If you have a controller with this interface, say Y or M here. -+ -+ If unsure, say N. -+ -+config MMC_SDHCI_BCM2708_DMA -+ bool "DMA support on BCM2708 Arasan controller" -+ depends on MMC_SDHCI_BCM2708 && EXPERIMENTAL -+ help -+ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 -+ based chips. -+ -+ If unsure, say N. -+ - config MMC_OMAP - tristate "TI OMAP Multimedia Card Interface support" - depends on ARCH_OMAP -@@ -296,6 +317,14 @@ config MMC_ATMELMCI - If unsure, say N. - - endchoice -+config MMC_BCM2708 -+ tristate "BCM2708 Multimedia Card Interface support" -+ help -+ This selects the BCM2708 Multimedia Card Interface driver. If -+ you have a BCM2708 platform with a Multimedia Card -+ slot, say Y or M here. -+ -+ If unsure, say N. - - config MMC_ATMELMCI_DMA - bool "Atmel MCI DMA support" -diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index b4b83f3..eeb683c 100644 ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o - obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.o - obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o - obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o -+obj-$(CONFIG_MMC_SDHCI_BCM2708) += sdhci-bcm2708.o - obj-$(CONFIG_MMC_WBSD) += wbsd.o - obj-$(CONFIG_MMC_AU1X) += au1xmmc.o - obj-$(CONFIG_MMC_OMAP) += omap.o -@@ -36,6 +37,7 @@ tmio_mmc_core-$(subst m,y,$(CONFIG_MMC_SDHI)) += tmio_mmc_dma.o - obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o - obj-$(CONFIG_MMC_CB710) += cb710-mmc.o - obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o -+obj-$(CONFIG_MMC_BCM2708) += bcm2708_mci.o - obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o - obj-$(CONFIG_MMC_DW) += dw_mmc.o - obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o -diff --git a/drivers/mmc/host/bcm2708_mci.c b/drivers/mmc/host/bcm2708_mci.c -new file mode 100644 -index 0000000..3c7de96 ---- /dev/null -+++ b/drivers/mmc/host/bcm2708_mci.c +diff -Naur linux-3.2.21/drivers/mmc/host/bcm2708_mci.c linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/bcm2708_mci.c +--- linux-3.2.21/drivers/mmc/host/bcm2708_mci.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/bcm2708_mci.c 2012-07-02 13:42:16.304338397 +0200 @@ -0,0 +1,889 @@ +/* + * linux/drivers/mmc/host/bcm2708_mci.c - Broadcom BCM2708 MCI driver @@ -27154,11 +26883,9 @@ index 0000000..3c7de96 +MODULE_DESCRIPTION("BCM2708 Multimedia Card Interface driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:bcm2708_mci"); -diff --git a/drivers/mmc/host/bcm2708_mci.h b/drivers/mmc/host/bcm2708_mci.h -new file mode 100644 -index 0000000..b2851d9 ---- /dev/null -+++ b/drivers/mmc/host/bcm2708_mci.h +diff -Naur linux-3.2.21/drivers/mmc/host/bcm2708_mci.h linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/bcm2708_mci.h +--- linux-3.2.21/drivers/mmc/host/bcm2708_mci.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/bcm2708_mci.h 2012-07-02 13:42:16.300338314 +0200 @@ -0,0 +1,101 @@ +/* + * linux/drivers/mmc/host/bcm2708_mci.c - Broadcom BCM2708 MCI driver @@ -27261,11 +26988,74 @@ index 0000000..b2851d9 + kunmap_atomic(buffer, KM_BIO_SRC_IRQ); +// local_irq_restore(*flags); +} -diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c -new file mode 100644 -index 0000000..e383cc8 ---- /dev/null -+++ b/drivers/mmc/host/sdhci-bcm2708.c +diff -Naur linux-3.2.21/drivers/mmc/host/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/Kconfig +--- linux-3.2.21/drivers/mmc/host/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/Kconfig 2012-07-02 13:42:16.302338356 +0200 +@@ -229,6 +229,27 @@ + + YMMV. + ++config MMC_SDHCI_BCM2708 ++ tristate "SDHCI support on BCM2708" ++ depends on MMC_SDHCI && MACH_BCM2708 ++ select MMC_SDHCI_IO_ACCESSORS ++ help ++ This selects the Secure Digital Host Controller Interface (SDHCI) ++ often referrered to as the eMMC block. ++ ++ If you have a controller with this interface, say Y or M here. ++ ++ If unsure, say N. ++ ++config MMC_SDHCI_BCM2708_DMA ++ bool "DMA support on BCM2708 Arasan controller" ++ depends on MMC_SDHCI_BCM2708 && EXPERIMENTAL ++ help ++ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 ++ based chips. ++ ++ If unsure, say N. ++ + config MMC_OMAP + tristate "TI OMAP Multimedia Card Interface support" + depends on ARCH_OMAP +@@ -296,6 +317,14 @@ + If unsure, say N. + + endchoice ++config MMC_BCM2708 ++ tristate "BCM2708 Multimedia Card Interface support" ++ help ++ This selects the BCM2708 Multimedia Card Interface driver. If ++ you have a BCM2708 platform with a Multimedia Card ++ slot, say Y or M here. ++ ++ If unsure, say N. + + config MMC_ATMELMCI_DMA + bool "Atmel MCI DMA support" +diff -Naur linux-3.2.21/drivers/mmc/host/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/Makefile +--- linux-3.2.21/drivers/mmc/host/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/Makefile 2012-07-02 13:42:16.299338293 +0200 +@@ -13,6 +13,7 @@ + obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.o + obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o + obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o ++obj-$(CONFIG_MMC_SDHCI_BCM2708) += sdhci-bcm2708.o + obj-$(CONFIG_MMC_WBSD) += wbsd.o + obj-$(CONFIG_MMC_AU1X) += au1xmmc.o + obj-$(CONFIG_MMC_OMAP) += omap.o +@@ -36,6 +37,7 @@ + obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o + obj-$(CONFIG_MMC_CB710) += cb710-mmc.o + obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o ++obj-$(CONFIG_MMC_BCM2708) += bcm2708_mci.o + obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o + obj-$(CONFIG_MMC_DW) += dw_mmc.o + obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o +diff -Naur linux-3.2.21/drivers/mmc/host/sdhci-bcm2708.c linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/sdhci-bcm2708.c +--- linux-3.2.21/drivers/mmc/host/sdhci-bcm2708.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/sdhci-bcm2708.c 2012-07-02 13:42:16.304338397 +0200 @@ -0,0 +1,1477 @@ +/* + * sdhci-bcm2708.c Support for SDHCI device on BCM2708 @@ -28744,10 +28534,9 @@ index 0000000..e383cc8 +MODULE_PARM_DESC(emmc_clock_freq, "Specify the speed of emmc clock"); + + -diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c -index 6ce32a7..4cfad2e 100644 ---- a/drivers/mmc/host/sdhci.c -+++ b/drivers/mmc/host/sdhci.c +diff -Naur linux-3.2.21/drivers/mmc/host/sdhci.c linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/sdhci.c +--- linux-3.2.21/drivers/mmc/host/sdhci.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/sdhci.c 2012-07-02 13:42:16.301338335 +0200 @@ -27,6 +27,7 @@ #include @@ -28756,7 +28545,7 @@ index 6ce32a7..4cfad2e 100644 #include "sdhci.h" -@@ -296,7 +297,7 @@ static void sdhci_read_block_pio(struct sdhci_host *host) +@@ -296,7 +297,7 @@ u32 uninitialized_var(scratch); u8 *buf; @@ -28765,7 +28554,7 @@ index 6ce32a7..4cfad2e 100644 blksize = host->data->blksz; chunk = 0; -@@ -341,7 +342,7 @@ static void sdhci_write_block_pio(struct sdhci_host *host) +@@ -341,7 +342,7 @@ u32 scratch; u8 *buf; @@ -28774,7 +28563,7 @@ index 6ce32a7..4cfad2e 100644 blksize = host->data->blksz; chunk = 0; -@@ -380,19 +381,28 @@ static void sdhci_write_block_pio(struct sdhci_host *host) +@@ -380,19 +381,28 @@ local_irq_restore(flags); } @@ -28806,7 +28595,7 @@ index 6ce32a7..4cfad2e 100644 /* * Some controllers (JMicron JMB38x) mess up the buffer bits -@@ -403,7 +413,7 @@ static void sdhci_transfer_pio(struct sdhci_host *host) +@@ -403,7 +413,7 @@ (host->data->blocks == 1)) mask = ~0; @@ -28815,7 +28604,7 @@ index 6ce32a7..4cfad2e 100644 if (host->quirks & SDHCI_QUIRK_PIO_NEEDS_DELAY) udelay(100); -@@ -415,9 +425,11 @@ static void sdhci_transfer_pio(struct sdhci_host *host) +@@ -415,9 +425,11 @@ host->blocks--; if (host->blocks == 0) break; @@ -28828,7 +28617,7 @@ index 6ce32a7..4cfad2e 100644 } static char *sdhci_kmap_atomic(struct scatterlist *sg, unsigned long *flags) -@@ -690,7 +702,9 @@ static void sdhci_set_transfer_irqs(struct sdhci_host *host) +@@ -690,7 +702,9 @@ u32 pio_irqs = SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; u32 dma_irqs = SDHCI_INT_DMA_END | SDHCI_INT_ADMA_ERROR; @@ -28839,7 +28628,7 @@ index 6ce32a7..4cfad2e 100644 sdhci_clear_set_irqs(host, pio_irqs, dma_irqs); else sdhci_clear_set_irqs(host, dma_irqs, pio_irqs); -@@ -722,44 +736,25 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) +@@ -722,44 +736,25 @@ host->data_early = 0; host->data->bytes_xfered = 0; @@ -28892,7 +28681,7 @@ index 6ce32a7..4cfad2e 100644 int broken, i; struct scatterlist *sg; -@@ -818,7 +813,8 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) +@@ -818,7 +813,8 @@ */ WARN_ON(1); host->flags &= ~SDHCI_REQ_USE_DMA; @@ -28902,7 +28691,7 @@ index 6ce32a7..4cfad2e 100644 WARN_ON(sg_cnt != 1); sdhci_writel(host, sg_dma_address(data->sg), SDHCI_DMA_ADDRESS); -@@ -834,11 +830,13 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) +@@ -834,11 +830,13 @@ if (host->version >= SDHCI_SPEC_200) { ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); ctrl &= ~SDHCI_CTRL_DMA_MASK; @@ -28921,7 +28710,7 @@ index 6ce32a7..4cfad2e 100644 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); } -@@ -890,7 +888,8 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, +@@ -890,7 +888,8 @@ if (data->flags & MMC_DATA_READ) mode |= SDHCI_TRNS_READ; @@ -28931,7 +28720,7 @@ index 6ce32a7..4cfad2e 100644 mode |= SDHCI_TRNS_DMA; sdhci_writew(host, mode, SDHCI_TRANSFER_MODE); -@@ -906,13 +905,16 @@ static void sdhci_finish_data(struct sdhci_host *host) +@@ -906,13 +905,16 @@ host->data = NULL; if (host->flags & SDHCI_REQ_USE_DMA) { @@ -28952,7 +28741,7 @@ index 6ce32a7..4cfad2e 100644 } /* -@@ -965,6 +967,12 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) +@@ -965,6 +967,12 @@ if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) mask |= SDHCI_DATA_INHIBIT; @@ -28965,7 +28754,7 @@ index 6ce32a7..4cfad2e 100644 /* We shouldn't wait for data inihibit for stop commands, even though they might use busy signaling */ if (host->mrq->data && (cmd == host->mrq->data->stop)) -@@ -982,10 +990,16 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) +@@ -982,10 +990,16 @@ timeout--; mdelay(1); } @@ -28982,7 +28771,7 @@ index 6ce32a7..4cfad2e 100644 sdhci_prepare_data(host, cmd); -@@ -1218,6 +1232,35 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned short power) +@@ -1218,6 +1232,35 @@ mdelay(10); } @@ -29018,7 +28807,7 @@ index 6ce32a7..4cfad2e 100644 /*****************************************************************************\ * * * MMC callbacks * -@@ -1298,6 +1341,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) +@@ -1298,6 +1341,7 @@ { unsigned long flags; u8 ctrl; @@ -29026,7 +28815,7 @@ index 6ce32a7..4cfad2e 100644 spin_lock_irqsave(&host->lock, flags); -@@ -1356,7 +1400,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) +@@ -1356,7 +1400,7 @@ else ctrl &= ~SDHCI_CTRL_HISPD; @@ -29035,7 +28824,7 @@ index 6ce32a7..4cfad2e 100644 u16 clk, ctrl_2; unsigned int clock; -@@ -1445,6 +1489,12 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) +@@ -1445,6 +1489,12 @@ out: mmiowb(); spin_unlock_irqrestore(&host->lock, flags); @@ -29048,7 +28837,7 @@ index 6ce32a7..4cfad2e 100644 } static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) -@@ -1888,6 +1938,8 @@ static const struct mmc_host_ops sdhci_ops = { +@@ -1888,6 +1938,8 @@ .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, .execute_tuning = sdhci_execute_tuning, .enable_preset_value = sdhci_enable_preset_value, @@ -29057,7 +28846,7 @@ index 6ce32a7..4cfad2e 100644 }; /*****************************************************************************\ -@@ -2000,7 +2052,7 @@ static void sdhci_timeout_timer(unsigned long data) +@@ -2000,7 +2052,7 @@ if (host->mrq) { pr_err("%s: Timeout waiting for hardware " @@ -29066,7 +28855,7 @@ index 6ce32a7..4cfad2e 100644 sdhci_dumpregs(host); if (host->data) { -@@ -2045,10 +2097,13 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask) +@@ -2045,10 +2097,13 @@ BUG_ON(intmask == 0); if (!host->cmd) { @@ -29084,7 +28873,7 @@ index 6ce32a7..4cfad2e 100644 return; } -@@ -2118,6 +2173,19 @@ static void sdhci_show_adma_error(struct sdhci_host *host) +@@ -2118,6 +2173,19 @@ static void sdhci_show_adma_error(struct sdhci_host *host) { } #endif @@ -29104,7 +28893,7 @@ index 6ce32a7..4cfad2e 100644 static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) { BUG_ON(intmask == 0); -@@ -2144,34 +2212,57 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) +@@ -2144,34 +2212,57 @@ return; } } @@ -29177,7 +28966,7 @@ index 6ce32a7..4cfad2e 100644 /* * We currently don't do anything fancy with DMA -@@ -2200,18 +2291,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) +@@ -2200,18 +2291,8 @@ sdhci_writel(host, dmanow, SDHCI_DMA_ADDRESS); } @@ -29198,7 +28987,7 @@ index 6ce32a7..4cfad2e 100644 } } -@@ -2266,6 +2347,22 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) +@@ -2266,6 +2347,22 @@ tasklet_schedule(&host->card_tasklet); } @@ -29221,7 +29010,7 @@ index 6ce32a7..4cfad2e 100644 if (intmask & SDHCI_INT_CMD_MASK) { sdhci_writel(host, intmask & SDHCI_INT_CMD_MASK, SDHCI_INT_STATUS); -@@ -2280,7 +2377,13 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) +@@ -2280,7 +2377,13 @@ intmask &= ~(SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK); @@ -29236,7 +29025,7 @@ index 6ce32a7..4cfad2e 100644 if (intmask & SDHCI_INT_BUS_POWER) { pr_err("%s: Card is consuming too much power!\n", -@@ -2363,7 +2466,8 @@ int sdhci_resume_host(struct sdhci_host *host) +@@ -2363,7 +2466,8 @@ return ret; } @@ -29246,7 +29035,7 @@ index 6ce32a7..4cfad2e 100644 if (host->ops->enable_dma) host->ops->enable_dma(host); } -@@ -2570,14 +2674,16 @@ int sdhci_add_host(struct sdhci_host *host) +@@ -2570,14 +2674,16 @@ host->flags &= ~SDHCI_USE_ADMA; } @@ -29265,7 +29054,7 @@ index 6ce32a7..4cfad2e 100644 } } } -@@ -2688,7 +2794,7 @@ int sdhci_add_host(struct sdhci_host *host) +@@ -2688,7 +2794,7 @@ /* Auto-CMD23 stuff only works in ADMA or PIO. */ if ((host->version >= SDHCI_SPEC_300) && ((host->flags & SDHCI_USE_ADMA) || @@ -29274,7 +29063,7 @@ index 6ce32a7..4cfad2e 100644 host->flags |= SDHCI_AUTO_CMD23; DBG("%s: Auto-CMD23 available\n", mmc_hostname(mmc)); } else { -@@ -2821,6 +2927,12 @@ int sdhci_add_host(struct sdhci_host *host) +@@ -2821,6 +2927,12 @@ mmc->caps |= MMC_CAP_MAX_CURRENT_200; } @@ -29287,7 +29076,7 @@ index 6ce32a7..4cfad2e 100644 mmc->ocr_avail = ocr_avail; mmc->ocr_avail_sdio = ocr_avail; if (host->ocr_avail_sdio) -@@ -2953,6 +3065,7 @@ int sdhci_add_host(struct sdhci_host *host) +@@ -2953,6 +3065,7 @@ pr_info("%s: SDHCI controller on %s [%s] using %s\n", mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)), @@ -29295,11 +29084,10 @@ index 6ce32a7..4cfad2e 100644 (host->flags & SDHCI_USE_ADMA) ? "ADMA" : (host->flags & SDHCI_USE_SDMA) ? "DMA" : "PIO"); -diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h -index a04d4d0..4cc7b4b 100644 ---- a/drivers/mmc/host/sdhci.h -+++ b/drivers/mmc/host/sdhci.h -@@ -273,6 +273,25 @@ struct sdhci_ops { +diff -Naur linux-3.2.21/drivers/mmc/host/sdhci.h linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/sdhci.h +--- linux-3.2.21/drivers/mmc/host/sdhci.h 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/mmc/host/sdhci.h 2012-07-02 13:42:16.301338335 +0200 +@@ -273,6 +273,25 @@ void (*platform_reset_enter)(struct sdhci_host *host, u8 mask); void (*platform_reset_exit)(struct sdhci_host *host, u8 mask); int (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); @@ -29325,7 +29113,7 @@ index a04d4d0..4cc7b4b 100644 void (*hw_reset)(struct sdhci_host *host); }; -@@ -379,6 +398,29 @@ extern int sdhci_resume_host(struct sdhci_host *host); +@@ -379,6 +398,29 @@ extern void sdhci_enable_irq_wakeups(struct sdhci_host *host); #endif @@ -29355,10 +29143,9 @@ index a04d4d0..4cc7b4b 100644 #ifdef CONFIG_PM_RUNTIME extern int sdhci_runtime_suspend_host(struct sdhci_host *host); extern int sdhci_runtime_resume_host(struct sdhci_host *host); -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 55b3218..5d2fec2 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c +diff -Naur linux-3.2.21/drivers/net/usb/smsc95xx.c linux-3.2.21-bootc-5b0ccb0/drivers/net/usb/smsc95xx.c +--- linux-3.2.21/drivers/net/usb/smsc95xx.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/net/usb/smsc95xx.c 2012-07-02 13:42:16.808348695 +0200 @@ -46,6 +46,7 @@ #define SMSC95XX_INTERNAL_PHY_ID (1) #define SMSC95XX_TX_OVERHEAD (8) @@ -29367,7 +29154,7 @@ index 55b3218..5d2fec2 100644 struct smsc95xx_priv { u32 mac_cr; -@@ -63,6 +64,10 @@ static int turbo_mode = true; +@@ -63,6 +64,10 @@ module_param(turbo_mode, bool, 0644); MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); @@ -29378,7 +29165,7 @@ index 55b3218..5d2fec2 100644 static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data) { u32 *buf = kmalloc(4, GFP_KERNEL); -@@ -600,8 +605,59 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) +@@ -600,8 +605,59 @@ return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); } @@ -29438,7 +29225,7 @@ index 55b3218..5d2fec2 100644 /* try reading mac address from EEPROM */ if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -@@ -1016,6 +1072,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) +@@ -1016,6 +1072,7 @@ dev->net->ethtool_ops = &smsc95xx_ethtool_ops; dev->net->flags |= IFF_MULTICAST; dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; @@ -29446,11 +29233,10 @@ index 55b3218..5d2fec2 100644 return 0; } -diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig -index 7587796..4153631 100644 ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -74,6 +74,14 @@ config SPI_ATMEL +diff -Naur linux-3.2.21/drivers/spi/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/spi/Kconfig +--- linux-3.2.21/drivers/spi/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/spi/Kconfig 2012-07-02 13:42:17.511363062 +0200 +@@ -74,6 +74,14 @@ This selects a driver for the Atmel SPI Controller, present on many AT32 (AVR32) and AT91 (ARM) chips. @@ -29465,11 +29251,10 @@ index 7587796..4153631 100644 config SPI_BFIN tristate "SPI controller driver for ADI Blackfin5xx" depends on BLACKFIN -diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile -index 61c3261..2ff2985 100644 ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_SPI_ALTERA) += spi-altera.o +diff -Naur linux-3.2.21/drivers/spi/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/spi/Makefile +--- linux-3.2.21/drivers/spi/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/spi/Makefile 2012-07-02 13:42:17.503362897 +0200 +@@ -14,6 +14,7 @@ obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o obj-$(CONFIG_SPI_ATH79) += spi-ath79.o obj-$(CONFIG_SPI_AU1550) += spi-au1550.o @@ -29477,11 +29262,9 @@ index 61c3261..2ff2985 100644 obj-$(CONFIG_SPI_BFIN) += spi-bfin5xx.o obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o -diff --git a/drivers/spi/spi-bcm2708.c b/drivers/spi/spi-bcm2708.c -new file mode 100644 -index 0000000..b32dda5 ---- /dev/null -+++ b/drivers/spi/spi-bcm2708.c +diff -Naur linux-3.2.21/drivers/spi/spi-bcm2708.c linux-3.2.21-bootc-5b0ccb0/drivers/spi/spi-bcm2708.c +--- linux-3.2.21/drivers/spi/spi-bcm2708.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/spi/spi-bcm2708.c 2012-07-02 13:42:17.533363509 +0200 @@ -0,0 +1,579 @@ +/* + * Driver for Broadcom BCM2708 SPI Controllers @@ -30062,23 +29845,10 @@ index 0000000..b32dda5 +MODULE_AUTHOR("Chris Boot "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index 75eca76..a6b7e41 100644 ---- a/drivers/usb/Makefile -+++ b/drivers/usb/Makefile -@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_U132_HCD) += host/ - obj-$(CONFIG_USB_R8A66597_HCD) += host/ - obj-$(CONFIG_USB_HWA_HCD) += host/ - obj-$(CONFIG_USB_ISP1760_HCD) += host/ -+obj-$(CONFIG_USB_DWCOTG) += host/ - obj-$(CONFIG_USB_IMX21_HCD) += host/ - obj-$(CONFIG_USB_FSL_MPH_DR_OF) += host/ - -diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c -index 69ecd3c..0431b4e 100644 ---- a/drivers/usb/core/generic.c -+++ b/drivers/usb/core/generic.c -@@ -149,6 +149,7 @@ int usb_choose_configuration(struct usb_device *udev) +diff -Naur linux-3.2.21/drivers/usb/core/generic.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/generic.c +--- linux-3.2.21/drivers/usb/core/generic.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/generic.c 2012-07-02 13:42:16.283337966 +0200 +@@ -149,6 +149,7 @@ dev_warn(&udev->dev, "no configuration chosen from %d choice%s\n", num_configs, plural(num_configs)); @@ -30086,11 +29856,10 @@ index 69ecd3c..0431b4e 100644 } return i; } -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 52d27ed..34eb283 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -1075,6 +1075,8 @@ static int hub_configure(struct usb_hub *hub, +diff -Naur linux-3.2.21/drivers/usb/core/hub.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/hub.c +--- linux-3.2.21/drivers/usb/core/hub.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/hub.c 2012-07-02 13:42:16.284337987 +0200 +@@ -1075,6 +1075,8 @@ INIT_WORK(&hub->tt.clear_work, hub_tt_work); switch (hdev->descriptor.bDeviceProtocol) { case 0: @@ -30099,7 +29868,7 @@ index 52d27ed..34eb283 100644 break; case 1: dev_dbg(hub_dev, "Single TT\n"); -@@ -1091,6 +1093,7 @@ static int hub_configure(struct usb_hub *hub, +@@ -1091,6 +1093,7 @@ hub->tt.hub = hdev; break; case 3: @@ -30107,7 +29876,7 @@ index 52d27ed..34eb283 100644 /* USB 3.0 hubs don't have a TT */ break; default: -@@ -1720,6 +1723,12 @@ static inline void announce_device(struct usb_device *udev) { } +@@ -1720,6 +1723,12 @@ #endif #ifdef CONFIG_USB_OTG @@ -30120,7 +29889,7 @@ index 52d27ed..34eb283 100644 #include "otg_whitelist.h" #endif -@@ -1774,9 +1783,15 @@ static int usb_enumerate_device_otg(struct usb_device *udev) +@@ -1774,9 +1783,15 @@ dev_info(&udev->dev, "can't set HNP mode: %d\n", err); @@ -30137,7 +29906,7 @@ index 52d27ed..34eb283 100644 } } -@@ -1785,12 +1800,27 @@ static int usb_enumerate_device_otg(struct usb_device *udev) +@@ -1785,12 +1800,27 @@ /* Maybe it can talk to us, though we can't talk to it. * (Includes HNP test device.) */ @@ -30168,7 +29937,7 @@ index 52d27ed..34eb283 100644 goto fail; } fail: -@@ -2981,7 +3011,9 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, +@@ -2981,7 +3011,9 @@ buf->bMaxPacketSize0 = 0; r = usb_control_msg(udev, usb_rcvaddr0pipe(), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, @@ -30179,7 +29948,7 @@ index 52d27ed..34eb283 100644 buf, GET_DESCRIPTOR_BUFSIZE, initial_descriptor_timeout); switch (buf->bMaxPacketSize0) { -@@ -3427,8 +3459,10 @@ loop: +@@ -3427,8 +3459,10 @@ release_devnum(udev); hub_free_dev(udev); usb_put_dev(udev); @@ -30192,11 +29961,10 @@ index 52d27ed..34eb283 100644 } if (hub->hdev->parent || !hcd->driver->port_handed_over || -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index ef116a5..113b44e 100644 ---- a/drivers/usb/core/message.c -+++ b/drivers/usb/core/message.c -@@ -1838,6 +1838,85 @@ free_interfaces: +diff -Naur linux-3.2.21/drivers/usb/core/message.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/message.c +--- linux-3.2.21/drivers/usb/core/message.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/message.c 2012-07-02 13:42:16.283337966 +0200 +@@ -1838,6 +1838,85 @@ if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) cp->string = usb_cache_string(dev, cp->desc.iConfiguration); @@ -30282,10 +30050,9 @@ index ef116a5..113b44e 100644 /* Now that all the interfaces are set up, register them * to trigger binding of drivers to interfaces. probe() -diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h -index e8cdce5..3a0da17 100644 ---- a/drivers/usb/core/otg_whitelist.h -+++ b/drivers/usb/core/otg_whitelist.h +diff -Naur linux-3.2.21/drivers/usb/core/otg_whitelist.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/otg_whitelist.h +--- linux-3.2.21/drivers/usb/core/otg_whitelist.h 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/core/otg_whitelist.h 2012-07-02 13:42:16.283337966 +0200 @@ -19,33 +19,82 @@ static struct usb_device_id whitelist_table [] = { @@ -30375,14 +30142,20 @@ index e8cdce5..3a0da17 100644 static int is_targeted(struct usb_device *dev) { struct usb_device_id *id = whitelist_table; -@@ -55,58 +104,83 @@ static int is_targeted(struct usb_device *dev) +@@ -55,58 +104,83 @@ return 1; /* HNP test device is _never_ targeted (see OTG spec 6.6.6) */ - if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a && - le16_to_cpu(dev->descriptor.idProduct) == 0xbadd)) - return 0; -- ++ if (dev->descriptor.idVendor == 0x1a0a && ++ dev->descriptor.idProduct == 0xbadd) { ++ return 0; ++ } else if (!enable_whitelist) { ++ return 1; ++ } else { + - /* NOTE: can't use usb_match_id() since interface caches - * aren't set up yet. this is cut/paste from that code. - */ @@ -30416,13 +30189,6 @@ index e8cdce5..3a0da17 100644 - if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && - (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) - continue; -+ if (dev->descriptor.idVendor == 0x1a0a && -+ dev->descriptor.idProduct == 0xbadd) { -+ return 0; -+ } else if (!enable_whitelist) { -+ return 1; -+ } else { -+ +#ifdef DEBUG + dev_dbg(&dev->dev, "device V:%04x P:%04x DC:%04x SC:%04x PR:%04x \n", + dev->descriptor.idVendor, @@ -30502,28 +30268,10 @@ index e8cdce5..3a0da17 100644 #endif } -diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig -index 23a4473..12d27d2 100644 ---- a/drivers/usb/gadget/Kconfig -+++ b/drivers/usb/gadget/Kconfig -@@ -552,6 +552,12 @@ config USB_GADGET_SUPERSPEED - depends on USB_GADGET - depends on USB_GADGET_DUALSPEED - -+config USB_DWC_OTG_LPM -+ boolean "Enable LPM support" -+ depends on USB && EXPERIMENTAL -+ help -+ Enables LPM support. -+ - # - # USB Gadget Drivers - # -diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c -index db2d607..5090ae6 100644 ---- a/drivers/usb/gadget/file_storage.c -+++ b/drivers/usb/gadget/file_storage.c -@@ -573,8 +573,37 @@ config_desc = { +diff -Naur linux-3.2.21/drivers/usb/gadget/file_storage.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/gadget/file_storage.c +--- linux-3.2.21/drivers/usb/gadget/file_storage.c 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/gadget/file_storage.c 2012-07-02 13:42:16.269337681 +0200 +@@ -573,8 +573,37 @@ .iConfiguration = FSG_STRING_CONFIG, .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, .bMaxPower = CONFIG_USB_GADGET_VBUS_DRAW / 2, @@ -30561,7 +30309,7 @@ index db2d607..5090ae6 100644 static struct usb_qualifier_descriptor dev_qualifier = { -@@ -984,13 +1013,29 @@ get_config: +@@ -984,13 +1013,29 @@ break; case USB_DT_BOS: @@ -30592,7 +30340,7 @@ index db2d607..5090ae6 100644 break; /* One config, two speeds */ -@@ -2640,6 +2685,9 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) +@@ -2640,6 +2685,9 @@ fsg_set_halt(fsg, fsg->bulk_out); halt_bulk_in_endpoint(fsg); } @@ -30602,7 +30350,7 @@ index db2d607..5090ae6 100644 return -EINVAL; } -@@ -2991,7 +3039,8 @@ static void handle_exception(struct fsg_dev *fsg) +@@ -2991,7 +3039,8 @@ * bulk endpoint, clear the halt now. (The SuperH UDC * requires this.) */ if (test_and_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags)) @@ -30612,7 +30360,7 @@ index db2d607..5090ae6 100644 if (transport_is_bbb()) { if (fsg->ep0_req_tag == exception_req_tag) -@@ -3065,6 +3114,9 @@ static int fsg_main_thread(void *fsg_) +@@ -3065,6 +3114,9 @@ * that expects a __user pointer and it will work okay. */ set_fs(get_ds()); @@ -30622,7 +30370,7 @@ index db2d607..5090ae6 100644 /* The main loop */ while (fsg->state != FSG_STATE_TERMINATED) { if (exception_in_progress(fsg) || signal_pending(current)) { -@@ -3212,6 +3264,13 @@ static int __init check_parameters(struct fsg_dev *fsg) +@@ -3212,6 +3264,13 @@ gcnum = usb_gadget_controller_number(fsg->gadget); if (gcnum >= 0) mod_data.release = 0x0300 + gcnum; @@ -30636,7 +30384,7 @@ index db2d607..5090ae6 100644 else { WARNING(fsg, "controller '%s' not recognized\n", fsg->gadget->name); -@@ -3473,6 +3532,13 @@ static int __init fsg_bind(struct usb_gadget *gadget) +@@ -3473,6 +3532,13 @@ rc = -ENOMEM; @@ -30650,142 +30398,25 @@ index db2d607..5090ae6 100644 /* Allocate the request and buffer for endpoint 0 */ fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); if (!req) -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 060e0e2..c03ee48 100644 ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -556,6 +556,19 @@ config USB_HWA_HCD - To compile this driver a module, choose M here: the module - will be called "hwa-hc". +diff -Naur linux-3.2.21/drivers/usb/gadget/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/usb/gadget/Kconfig +--- linux-3.2.21/drivers/usb/gadget/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/gadget/Kconfig 2012-07-02 13:42:16.275337804 +0200 +@@ -552,6 +552,12 @@ + depends on USB_GADGET + depends on USB_GADGET_DUALSPEED -+config USB_DWCOTG -+ tristate "Synopsis DWC host support" -+ depends on USB ++config USB_DWC_OTG_LPM ++ boolean "Enable LPM support" ++ depends on USB && EXPERIMENTAL + help -+ The Synopsis DWC controller is a dual-role -+ host/peripheral/OTG ("On The Go") USB controllers. ++ Enables LPM support. + -+ Enable this option to support this IP in host controller mode. -+ If unsure, say N. -+ -+ To compile this driver as a module, choose M here: the -+ modules built will be called dwc_otg and dwc_common_port. -+ - config USB_IMX21_HCD - tristate "i.MX21 HCD support" - depends on USB && ARM && ARCH_MXC -diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile -index 7ca290f..802dda6 100644 ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -33,6 +33,8 @@ obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o - obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o - obj-$(CONFIG_USB_ISP1760_HCD) += isp1760.o - obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ - obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o - obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o - obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o -diff --git a/drivers/usb/host/dwc_common_port/Makefile b/drivers/usb/host/dwc_common_port/Makefile -new file mode 100644 -index 0000000..b593b08 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile -@@ -0,0 +1,46 @@ -+# -+# Makefile for DWC_common library -+# -+ -+ifneq ($(KERNELRELEASE),) -+ -+#CPPFLAGS += -DDEBUG_MEMORY -+ -+ifeq ($(CONFIG_USB_DEBUG),y) -+CPPFLAGS += -DDEBUG -+endif -+CPPFLAGS += -DDWC_LINUX -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o -+dwc_common_port_lib-objs := dwc_cc.o \ -+ dwc_notifier.o \ -+ dwc_common_linux.o dwc_mem.o -+ -+kernrelwd := $(subst ., ,$(KERNELRELEASE)) -+kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) -+ -+ifneq ($(kernrel3),2.6.20) -+# grayg - I only know that we use EXTRA_CFLAGS in 2.6.31 actually -+EXTRA_CFLAGS += $(CPPFLAGS) -+endif -+ -+else -+ -+ifeq ($(DOXYGEN),) -+DOXYGEN := $(DOXYGEN) -+endif -+ -+default: -+ $(MAKE) -C$(KDIR) M=$(PWD) modules -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+endif -+ -+clean: -+ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers -+ -diff --git a/drivers/usb/host/dwc_common_port/Makefile.linux b/drivers/usb/host/dwc_common_port/Makefile.linux -new file mode 100644 -index 0000000..a553a9d ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/Makefile.linux -@@ -0,0 +1,36 @@ -+# -+# Makefile for DWC_common library -+# -+ifneq ($(KERNELRELEASE),) -+ -+#CPPFLAGS += -DDEBUG_MEMORY -+ -+#CPPFLAGS += -DDEBUG -+CPPFLAGS += -DDWC_LINUX -+ -+obj-m := dwc_common_port_lib.o -+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ -+ dwc_crypto.o dwc_notifier.o \ -+ dwc_common_linux.o dwc_mem.o -+ -+else -+ -+ -+ifeq ($(DOXYGEN),) -+DOXYGEN := $(DOXYGEN) -+endif -+ -+default: -+ $(MAKE) -C$(KDIR) M=$(PWD) modules -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+endif -+ -+clean: -+ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers -+ -diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.c b/drivers/usb/host/dwc_common_port/dwc_cc.c -new file mode 100644 -index 0000000..3a7dd71 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_cc.c + # + # USB Gadget Drivers + # +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_cc.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_cc.c +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_cc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_cc.c 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,506 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_cc.c $ @@ -31293,11 +30924,9 @@ index 0000000..3a7dd71 + + return retval; +} -diff --git a/drivers/usb/host/dwc_common_port/dwc_cc.h b/drivers/usb/host/dwc_common_port/dwc_cc.h -new file mode 100644 -index 0000000..6b46419 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_cc.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_cc.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_cc.h +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_cc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_cc.h 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,209 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_cc.h $ @@ -31508,11 +31137,9 @@ index 0000000..6b46419 + +#endif /* _DWC_CC_H_ */ + -diff --git a/drivers/usb/host/dwc_common_port/dwc_common_linux.c b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -new file mode 100644 -index 0000000..fbf9dfb ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_common_linux.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_common_linux.c +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_common_linux.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_common_linux.c 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,1138 @@ +#include "dwc_cc.h" +#include "dwc_notifier.h" @@ -32652,11 +32279,9 @@ index 0000000..fbf9dfb + DWC_WAITQ_TRIGGER(wq); +} +EXPORT_SYMBOL(DWC_WAITQ_ABORT); -diff --git a/drivers/usb/host/dwc_common_port/dwc_list.h b/drivers/usb/host/dwc_common_port/dwc_list.h -new file mode 100644 -index 0000000..b29afe0 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_list.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_list.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_list.h +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_list.h 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,616 @@ +/* $OpenBSD: queue.h,v 1.26 2004/05/04 16:59:32 grange Exp $ */ +/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ @@ -33274,11 +32899,9 @@ index 0000000..b29afe0 +} while (0) + +#endif /* !_SYS_QUEUE_H_ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_mem.c b/drivers/usb/host/dwc_common_port/dwc_mem.c -new file mode 100644 -index 0000000..f2f9bc6 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_mem.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_mem.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_mem.c +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_mem.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_mem.c 2012-07-02 13:42:16.231336905 +0200 @@ -0,0 +1,172 @@ +#include "dwc_os.h" +#include "dwc_list.h" @@ -33452,11 +33075,9 @@ index 0000000..f2f9bc6 +} + +#endif /* DEBUG_MEMORY */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.c b/drivers/usb/host/dwc_common_port/dwc_notifier.c -new file mode 100644 -index 0000000..e44bb81 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_notifier.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_notifier.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_notifier.c +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_notifier.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_notifier.c 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,256 @@ +#include "dwc_notifier.h" +#include "dwc_list.h" @@ -33714,11 +33335,9 @@ index 0000000..e44bb81 + } +} + -diff --git a/drivers/usb/host/dwc_common_port/dwc_notifier.h b/drivers/usb/host/dwc_common_port/dwc_notifier.h -new file mode 100644 -index 0000000..a1388d1 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_notifier.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_notifier.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_notifier.h +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_notifier.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_notifier.h 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,112 @@ + +#ifndef __DWC_NOTIFIER_H__ @@ -33832,11 +33451,9 @@ index 0000000..a1388d1 +void dwc_notify(dwc_notifier_t *notifier, char *notification, void *notification_data); + +#endif /* __DWC_NOTIFIER_H__ */ -diff --git a/drivers/usb/host/dwc_common_port/dwc_os.h b/drivers/usb/host/dwc_common_port/dwc_os.h -new file mode 100644 -index 0000000..453966a ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/dwc_os.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_os.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_os.h +--- linux-3.2.21/drivers/usb/host/dwc_common_port/dwc_os.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/dwc_os.h 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,925 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_os.h $ @@ -34763,11 +34380,99 @@ index 0000000..453966a + * threading should be able to be implemented with the defined behavior. + * + */ -diff --git a/drivers/usb/host/dwc_common_port/usb.h b/drivers/usb/host/dwc_common_port/usb.h -new file mode 100644 -index 0000000..2ee4252 ---- /dev/null -+++ b/drivers/usb/host/dwc_common_port/usb.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/Makefile +--- linux-3.2.21/drivers/usb/host/dwc_common_port/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/Makefile 2012-07-02 13:42:16.231336905 +0200 +@@ -0,0 +1,46 @@ ++# ++# Makefile for DWC_common library ++# ++ ++ifneq ($(KERNELRELEASE),) ++ ++#CPPFLAGS += -DDEBUG_MEMORY ++ ++ifeq ($(CONFIG_USB_DEBUG),y) ++CPPFLAGS += -DDEBUG ++endif ++CPPFLAGS += -DDWC_LINUX ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o ++dwc_common_port_lib-objs := dwc_cc.o \ ++ dwc_notifier.o \ ++ dwc_common_linux.o dwc_mem.o ++ ++kernrelwd := $(subst ., ,$(KERNELRELEASE)) ++kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) ++ ++ifneq ($(kernrel3),2.6.20) ++# grayg - I only know that we use EXTRA_CFLAGS in 2.6.31 actually ++EXTRA_CFLAGS += $(CPPFLAGS) ++endif ++ ++else ++ ++ifeq ($(DOXYGEN),) ++DOXYGEN := $(DOXYGEN) ++endif ++ ++default: ++ $(MAKE) -C$(KDIR) M=$(PWD) modules ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++endif ++ ++clean: ++ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers ++ +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/Makefile.linux linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/Makefile.linux +--- linux-3.2.21/drivers/usb/host/dwc_common_port/Makefile.linux 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/Makefile.linux 2012-07-02 13:42:16.232336925 +0200 +@@ -0,0 +1,36 @@ ++# ++# Makefile for DWC_common library ++# ++ifneq ($(KERNELRELEASE),) ++ ++#CPPFLAGS += -DDEBUG_MEMORY ++ ++#CPPFLAGS += -DDEBUG ++CPPFLAGS += -DDWC_LINUX ++ ++obj-m := dwc_common_port_lib.o ++dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \ ++ dwc_crypto.o dwc_notifier.o \ ++ dwc_common_linux.o dwc_mem.o ++ ++else ++ ++ ++ifeq ($(DOXYGEN),) ++DOXYGEN := $(DOXYGEN) ++endif ++ ++default: ++ $(MAKE) -C$(KDIR) M=$(PWD) modules ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++endif ++ ++clean: ++ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers ++ +diff -Naur linux-3.2.21/drivers/usb/host/dwc_common_port/usb.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/usb.h +--- linux-3.2.21/drivers/usb/host/dwc_common_port/usb.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_common_port/usb.h 2012-07-02 13:42:16.232336925 +0200 @@ -0,0 +1,850 @@ +/* + * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35619,97 +35324,9 @@ index 0000000..2ee4252 + + +#endif /* _USB_H_ */ -diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile -new file mode 100644 -index 0000000..fed13f4 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/Makefile -@@ -0,0 +1,80 @@ -+# -+# Makefile for DWC_otg Highspeed USB controller driver -+# -+ -+ifneq ($(KERNELRELEASE),) -+ -+ifeq ($(BUS_INTERFACE),) -+ # BUS_INTERFACE = -DLM_INTERFACE -+ BUS_INTERFACE = -DPLATFORM_INTERFACE=1 -+endif -+ -+ifeq ($(CONFIG_USB_DEBUG),y) -+CPPFLAGS += -DDEBUG -+endif -+ -+# Use one of the following flags to compile the software in host-only or -+# device-only mode. -+#CPPFLAGS += -DDWC_HOST_ONLY -+#CPPFLAGS += -DDWC_DEVICE_ONLY -+ -+CPPFLAGS += -Dlinux -DDWC_HS_ELECT_TST -+#CGG: CPPFLAGS += -DDWC_EN_ISOC -+CPPFLAGS += -I$(obj)/../dwc_common_port -+#CPPFLAGS += -I$(PORTLIB) -+CPPFLAGS += -DDWC_LINUX -+CPPFLAGS += $(CFI) -+CPPFLAGS += $(BUS_INTERFACE) -+ -+obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o -+ -+dwc_otg-objs := dwc_otg_driver.o dwc_otg_attr.o -+dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o -+dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o -+dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o -+ifneq ($(CFI),) -+dwc_otg-objs += dwc_otg_cfi.o -+endif -+ -+kernrelwd := $(subst ., ,$(KERNELRELEASE)) -+kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) -+ -+ifneq ($(kernrel3),2.6.20) -+EXTRA_CFLAGS += $(CPPFLAGS) -+endif -+ -+else -+ -+PWD := $(shell pwd) -+PORTLIB := $(PWD)/../dwc_common_port -+ -+# Command paths -+CTAGS := $(CTAGS) -+DOXYGEN := $(DOXYGEN) -+ -+default: portlib -+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ -+install: default -+ifneq ($(INSTALL_MOD_PATH),) -+ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install -+ $(MAKE) -C$(KDIR) M=$(PWD) modules_install -+else -+ @echo "No install path defined" -+endif -+ -+portlib: -+ $(MAKE) -C$(KDIR) M=$(PORTLIB) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules -+ cp $(PORTLIB)/Module.symvers $(PWD)/ -+ -+docs: $(wildcard *.[hc]) doc/doxygen.cfg -+ $(DOXYGEN) doc/doxygen.cfg -+ -+tags: $(wildcard *.[hc]) -+ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) -+ -+ -+clean: -+ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions -+ -+endif -diff --git a/drivers/usb/host/dwc_otg/dummy_audio.c b/drivers/usb/host/dwc_otg/dummy_audio.c -new file mode 100644 -index 0000000..530ac8b ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dummy_audio.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dummy_audio.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dummy_audio.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dummy_audio.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dummy_audio.c 2012-07-02 13:42:16.242337130 +0200 @@ -0,0 +1,1575 @@ +/* + * zero.c -- Gadget Zero, for USB development @@ -37286,11 +36903,9 @@ index 0000000..530ac8b + remove_proc_entry("isoc_test", NULL); +} +module_exit (cleanup); -diff --git a/drivers/usb/host/dwc_otg/dwc_cfi_common.h b/drivers/usb/host/dwc_otg/dwc_cfi_common.h -new file mode 100644 -index 0000000..be56af4 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_cfi_common.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_cfi_common.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_cfi_common.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_cfi_common.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_cfi_common.h 2012-07-02 13:42:16.242337130 +0200 @@ -0,0 +1,142 @@ +/* ========================================================================== + * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, @@ -37434,11 +37049,9 @@ index 0000000..be56af4 +typedef struct cfi_string cfi_string_t; + +#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.c b/drivers/usb/host/dwc_otg/dwc_otg_attr.c -new file mode 100644 -index 0000000..26ff76f ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_attr.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_attr.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_attr.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_attr.c 2012-07-02 13:42:16.244337170 +0200 @@ -0,0 +1,1316 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ @@ -38756,11 +38369,9 @@ index 0000000..26ff76f + device_remove_file(&dev->dev, &dev_attr_sleep_status); +#endif +} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_attr.h b/drivers/usb/host/dwc_otg/dwc_otg_attr.h -new file mode 100644 -index 0000000..b59651d ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_attr.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_attr.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_attr.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_attr.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_attr.h 2012-07-02 13:42:16.241337110 +0200 @@ -0,0 +1,88 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ @@ -38850,11 +38461,9 @@ index 0000000..b59651d +#endif + ); +#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.c b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c -new file mode 100644 -index 0000000..7fe7255 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cfi.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cfi.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 2012-07-02 13:42:16.244337170 +0200 @@ -0,0 +1,1876 @@ +/* ========================================================================== + * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, @@ -40732,11 +40341,9 @@ index 0000000..7fe7255 +} + +#endif //DWC_UTE_CFI -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h -new file mode 100644 -index 0000000..0215224 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cfi.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cfi.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,319 @@ +/* ========================================================================== + * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, @@ -41057,11 +40664,9 @@ index 0000000..0215224 +int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl); + +#endif /* (__DWC_OTG_CFI_H__) */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c -new file mode 100644 -index 0000000..ccfe6b5 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cil.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cil.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cil.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cil.c 2012-07-02 13:42:16.241337110 +0200 @@ -0,0 +1,5410 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ @@ -46473,11 +46078,9 @@ index 0000000..ccfe6b5 +{ + return dwc_read_reg32(&core_if->core_global_regs->hptxfsiz); +} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.h b/drivers/usb/host/dwc_otg/dwc_otg_cil.h -new file mode 100644 -index 0000000..1176166 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cil.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cil.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cil.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cil.h 2012-07-02 13:42:16.241337110 +0200 @@ -0,0 +1,1143 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $ @@ -47622,11 +47225,9 @@ index 0000000..1176166 + void *_p); + +#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c -new file mode 100644 -index 0000000..b8b2740 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,846 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $ @@ -48474,11 +48075,9 @@ index 0000000..b8b2740 + } + return retval; +} -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_core_if.h b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h -new file mode 100644 -index 0000000..25aae5e ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_core_if.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_core_if.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_core_if.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,642 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $ @@ -49122,11 +48721,9 @@ index 0000000..25aae5e +/** @} */ + +#endif /* __DWC_CORE_IF_H__ */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_dbg.h b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h -new file mode 100644 -index 0000000..e81d093 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_dbg.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_dbg.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_dbg.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 2012-07-02 13:42:16.244337170 +0200 @@ -0,0 +1,113 @@ +/* ========================================================================== + * @@ -49241,11 +48838,9 @@ index 0000000..e81d093 + +#endif /*DEBUG*/ +#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -new file mode 100644 -index 0000000..0e22013 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_driver.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_driver.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_driver.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_driver.c 2012-07-02 13:42:16.240337089 +0200 @@ -0,0 +1,1577 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ @@ -50824,11 +50419,9 @@ index 0000000..0e22013 + + +*/ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.h b/drivers/usb/host/dwc_otg/dwc_otg_driver.h -new file mode 100644 -index 0000000..f37d3ac ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_driver.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_driver.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_driver.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_driver.h 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,101 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $ @@ -50931,11 +50524,9 @@ index 0000000..f37d3ac +#endif + +#endif -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -new file mode 100644 -index 0000000..f07bb72 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,3334 @@ + +/* ========================================================================== @@ -54271,821 +53862,9 @@ index 0000000..f07bb72 +} + +#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -new file mode 100644 -index 0000000..f6e7870 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -@@ -0,0 +1,804 @@ -+/* ========================================================================== -+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ -+ * $Revision: #52 $ -+ * $Date: 2009/04/21 $ -+ * $Change: 1237472 $ -+ * -+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, -+ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless -+ * otherwise expressly agreed to in writing between Synopsys and you. -+ * -+ * The Software IS NOT an item of Licensed Software or Licensed Product under -+ * any End User Software License Agreement or Agreement for Licensed Product -+ * with Synopsys or any supplement thereto. You are permitted to use and -+ * redistribute this Software in source and binary forms, with or without -+ * modification, provided that redistributions of source code must retain this -+ * notice. You may not view, use, disclose, copy or distribute this file or -+ * any information contained herein except pursuant to this license grant from -+ * Synopsys. If you do not agree with this notice, including the disclaimer -+ * below, then you are not authorized to use the Software. -+ * -+ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, -+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -+ * DAMAGE. -+ * ========================================================================== */ -+#ifndef DWC_DEVICE_ONLY -+#ifndef __DWC_HCD_H__ -+#define __DWC_HCD_H__ -+ -+#include -+#include "dwc_otg_hcd_if.h" -+#include "dwc_otg_core_if.h" -+#include "dwc_list.h" -+#include "dwc_otg_cil.h" -+ -+/** -+ * @file -+ * -+ * This file contains the structures, constants, and interfaces for -+ * the Host Contoller Driver (HCD). -+ * -+ * The Host Controller Driver (HCD) is responsible for translating requests -+ * from the USB Driver into the appropriate actions on the DWC_otg controller. -+ * It isolates the USBD from the specifics of the controller by providing an -+ * API to the USBD. -+ */ -+ -+struct dwc_otg_hcd_pipe_info { -+ uint8_t dev_addr; -+ uint8_t ep_num; -+ uint8_t pipe_type; -+ uint8_t pipe_dir; -+ uint16_t mps; -+}; -+ -+struct dwc_otg_hcd_iso_packet_desc { -+ uint32_t offset; -+ uint32_t length; -+ uint32_t actual_length; -+ uint32_t status; -+}; -+ -+struct dwc_otg_qtd; -+ -+struct dwc_otg_hcd_urb { -+ void *priv; -+ struct dwc_otg_qtd *qtd; -+ void *buf; -+ dwc_dma_t dma; -+ void *setup_packet; -+ dwc_dma_t setup_dma; -+ uint32_t length; -+ uint32_t actual_length; -+ uint32_t status; -+ uint32_t error_count; -+ uint32_t packet_count; -+ uint32_t flags; -+ uint16_t interval; -+ struct dwc_otg_hcd_pipe_info pipe_info; -+ struct dwc_otg_hcd_iso_packet_desc iso_descs[0]; -+}; -+ -+static inline uint8_t dwc_otg_hcd_get_ep_num(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return pipe->ep_num; -+} -+ -+static inline uint8_t dwc_otg_hcd_get_pipe_type(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return pipe->pipe_type; -+} -+ -+static inline uint16_t dwc_otg_hcd_get_mps(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return pipe->mps; -+} -+ -+static inline uint8_t dwc_otg_hcd_get_dev_addr(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return pipe->dev_addr; -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_isoc(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_ISOCHRONOUS); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_int(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_INTERRUPT); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_bulk(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_BULK); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_control(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (pipe->pipe_type == UE_CONTROL); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_in(struct dwc_otg_hcd_pipe_info *pipe) -+{ -+ return (pipe->pipe_dir == UE_DIR_IN); -+} -+ -+static inline uint8_t dwc_otg_hcd_is_pipe_out(struct dwc_otg_hcd_pipe_info -+ *pipe) -+{ -+ return (!dwc_otg_hcd_is_pipe_in(pipe)); -+} -+ -+static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, -+ uint8_t devaddr, uint8_t ep_num, -+ uint8_t pipe_type, uint8_t pipe_dir, -+ uint16_t mps) -+{ -+ pipe->dev_addr = devaddr; -+ pipe->ep_num = ep_num; -+ pipe->pipe_type = pipe_type; -+ pipe->pipe_dir = pipe_dir; -+ pipe->mps = mps; -+} -+ -+/** -+ * Phases for control transfers. -+ */ -+typedef enum dwc_otg_control_phase { -+ DWC_OTG_CONTROL_SETUP, -+ DWC_OTG_CONTROL_DATA, -+ DWC_OTG_CONTROL_STATUS -+} dwc_otg_control_phase_e; -+ -+/** Transaction types. */ -+typedef enum dwc_otg_transaction_type { -+ DWC_OTG_TRANSACTION_NONE, -+ DWC_OTG_TRANSACTION_PERIODIC, -+ DWC_OTG_TRANSACTION_NON_PERIODIC, -+ DWC_OTG_TRANSACTION_ALL -+} dwc_otg_transaction_type_e; -+ -+struct dwc_otg_qh; -+ -+/** -+ * A Queue Transfer Descriptor (QTD) holds the state of a bulk, control, -+ * interrupt, or isochronous transfer. A single QTD is created for each URB -+ * (of one of these types) submitted to the HCD. The transfer associated with -+ * a QTD may require one or multiple transactions. -+ * -+ * A QTD is linked to a Queue Head, which is entered in either the -+ * non-periodic or periodic schedule for execution. When a QTD is chosen for -+ * execution, some or all of its transactions may be executed. After -+ * execution, the state of the QTD is updated. The QTD may be retired if all -+ * its transactions are complete or if an error occurred. Otherwise, it -+ * remains in the schedule so more transactions can be executed later. -+ */ -+typedef struct dwc_otg_qtd { -+ /** -+ * Determines the PID of the next data packet for the data phase of -+ * control transfers. Ignored for other transfer types.
-+ * One of the following values: -+ * - DWC_OTG_HC_PID_DATA0 -+ * - DWC_OTG_HC_PID_DATA1 -+ */ -+ uint8_t data_toggle; -+ -+ /** Current phase for control transfers (Setup, Data, or Status). */ -+ dwc_otg_control_phase_e control_phase; -+ -+ /** Keep track of the current split type -+ * for FS/LS endpoints on a HS Hub */ -+ uint8_t complete_split; -+ -+ /** How many bytes transferred during SSPLIT OUT */ -+ uint32_t ssplit_out_xfer_count; -+ -+ /** -+ * Holds the number of bus errors that have occurred for a transaction -+ * within this transfer. -+ */ -+ uint8_t error_count; -+ -+ /** -+ * Index of the next frame descriptor for an isochronous transfer. A -+ * frame descriptor describes the buffer position and length of the -+ * data to be transferred in the next scheduled (micro)frame of an -+ * isochronous transfer. It also holds status for that transaction. -+ * The frame index starts at 0. -+ */ -+ uint16_t isoc_frame_index; -+ -+ /** Position of the ISOC split on full/low speed */ -+ uint8_t isoc_split_pos; -+ -+ /** Position of the ISOC split in the buffer for the current frame */ -+ uint16_t isoc_split_offset; -+ -+ /** URB for this transfer */ -+ struct dwc_otg_hcd_urb *urb; -+ -+ struct dwc_otg_qh *qh; -+ -+ /** This list of QTDs */ -+ DWC_CIRCLEQ_ENTRY(dwc_otg_qtd) qtd_list_entry; -+ -+ /** Indicates if this QTD is currently processed by HW. */ -+ uint8_t in_process; -+ -+ /** Number of DMA descriptors for this QTD */ -+ uint8_t n_desc; -+ -+ /** -+ * Last activated frame(packet) index. -+ * Used in Descriptor DMA mode only. -+ */ -+ uint16_t isoc_frame_index_last; -+ -+} dwc_otg_qtd_t; -+ -+DWC_CIRCLEQ_HEAD(dwc_otg_qtd_list, dwc_otg_qtd); -+ -+/** -+ * A Queue Head (QH) holds the static characteristics of an endpoint and -+ * maintains a list of transfers (QTDs) for that endpoint. A QH structure may -+ * be entered in either the non-periodic or periodic schedule. -+ */ -+typedef struct dwc_otg_qh { -+ /** -+ * Endpoint type. -+ * One of the following values: -+ * - UE_CONTROL -+ * - UE_BULK -+ * - UE_INTERRUPT -+ * - UE_ISOCHRONOUS -+ */ -+ uint8_t ep_type; -+ uint8_t ep_is_in; -+ -+ /** wMaxPacketSize Field of Endpoint Descriptor. */ -+ uint16_t maxp; -+ -+ /** -+ * Device speed. -+ * One of the following values: -+ * - DWC_OTG_EP_SPEED_LOW -+ * - DWC_OTG_EP_SPEED_FULL -+ * - DWC_OTG_EP_SPEED_HIGH -+ */ -+ uint8_t dev_speed; -+ -+ /** -+ * Determines the PID of the next data packet for non-control -+ * transfers. Ignored for control transfers.
-+ * One of the following values: -+ * - DWC_OTG_HC_PID_DATA0 -+ * - DWC_OTG_HC_PID_DATA1 -+ */ -+ uint8_t data_toggle; -+ -+ /** Ping state if 1. */ -+ uint8_t ping_state; -+ -+ /** -+ * List of QTDs for this QH. -+ */ -+ struct dwc_otg_qtd_list qtd_list; -+ -+ /** Host channel currently processing transfers for this QH. */ -+ struct dwc_hc *channel; -+ -+ /** Full/low speed endpoint on high-speed hub requires split. */ -+ uint8_t do_split; -+ -+ /** @name Periodic schedule information */ -+ /** @{ */ -+ -+ /** Bandwidth in microseconds per (micro)frame. */ -+ uint16_t usecs; -+ -+ /** Interval between transfers in (micro)frames. */ -+ uint16_t interval; -+ -+ /** -+ * (micro)frame to initialize a periodic transfer. The transfer -+ * executes in the following (micro)frame. -+ */ -+ uint16_t sched_frame; -+ -+ /** (micro)frame at which last start split was initialized. */ -+ uint16_t start_split_frame; -+ -+ /** @} */ -+ -+ /** -+ * Used instead of original buffer if -+ * it(physical address) is not dword-aligned. -+ */ -+ uint8_t *dw_align_buf; -+ dwc_dma_t dw_align_buf_dma; -+ -+ /** Entry for QH in either the periodic or non-periodic schedule. */ -+ dwc_list_link_t qh_list_entry; -+ -+ /** @name Descriptor DMA support */ -+ /** @{ */ -+ -+ /** Descriptor List. */ -+ dwc_otg_host_dma_desc_t *desc_list; -+ -+ /** Descriptor List physical address. */ -+ dwc_dma_t desc_list_dma; -+ -+ /** -+ * Xfer Bytes array. -+ * Each element corresponds to a descriptor and indicates -+ * original XferSize size value for the descriptor. -+ */ -+ uint32_t *n_bytes; -+ -+ /** Actual number of transfer descriptors in a list. */ -+ uint16_t ntd; -+ -+ /** First activated isochronous transfer descriptor index. */ -+ uint8_t td_first; -+ /** Last activated isochronous transfer descriptor index. */ -+ uint8_t td_last; -+ -+ /** @} */ -+ -+} dwc_otg_qh_t; -+ -+DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); -+ -+#ifdef HW2937_WORKAROUND -+ -+typedef enum { -+ HW2937_XFER_MODE_IDLE, -+ HW2937_XFER_MODE_IN, -+ HW2937_XFER_MODE_OUT, -+ HW2937_XFER_MODE_PAUSEIN /* Transitioning from IN to IDLE */ -+} hw2937_xfer_mode_t; -+#endif -+ -+/** -+ * This structure holds the state of the HCD, including the non-periodic and -+ * periodic schedules. -+ */ -+struct dwc_otg_hcd { -+ /** DWC OTG Core Interface Layer */ -+ dwc_otg_core_if_t *core_if; -+ -+ /** Function HCD driver callbacks */ -+ struct dwc_otg_hcd_function_ops *fops; -+ -+ /** Internal DWC HCD Flags */ -+ volatile union dwc_otg_hcd_internal_flags { -+ uint32_t d32; -+ struct { -+ unsigned port_connect_status_change:1; -+ unsigned port_connect_status:1; -+ unsigned port_reset_change:1; -+ unsigned port_enable_change:1; -+ unsigned port_suspend_change:1; -+ unsigned port_over_current_change:1; -+ unsigned port_l1_change:1; -+ unsigned reserved:26; -+ } b; -+ } flags; -+ -+ /** -+ * Inactive items in the non-periodic schedule. This is a list of -+ * Queue Heads. Transfers associated with these Queue Heads are not -+ * currently assigned to a host channel. -+ */ -+ dwc_list_link_t non_periodic_sched_inactive; -+ -+ /** -+ * Active items in the non-periodic schedule. This is a list of -+ * Queue Heads. Transfers associated with these Queue Heads are -+ * currently assigned to a host channel. -+ */ -+ dwc_list_link_t non_periodic_sched_active; -+ -+ /** -+ * Pointer to the next Queue Head to process in the active -+ * non-periodic schedule. -+ */ -+ dwc_list_link_t *non_periodic_qh_ptr; -+ -+ /** -+ * Inactive items in the periodic schedule. This is a list of QHs for -+ * periodic transfers that are _not_ scheduled for the next frame. -+ * Each QH in the list has an interval counter that determines when it -+ * needs to be scheduled for execution. This scheduling mechanism -+ * allows only a simple calculation for periodic bandwidth used (i.e. -+ * must assume that all periodic transfers may need to execute in the -+ * same frame). However, it greatly simplifies scheduling and should -+ * be sufficient for the vast majority of OTG hosts, which need to -+ * connect to a small number of peripherals at one time. -+ * -+ * Items move from this list to periodic_sched_ready when the QH -+ * interval counter is 0 at SOF. -+ */ -+ dwc_list_link_t periodic_sched_inactive; -+ -+ /** -+ * List of periodic QHs that are ready for execution in the next -+ * frame, but have not yet been assigned to host channels. -+ * -+ * Items move from this list to periodic_sched_assigned as host -+ * channels become available during the current frame. -+ */ -+ dwc_list_link_t periodic_sched_ready; -+ -+ /** -+ * List of periodic QHs to be executed in the next frame that are -+ * assigned to host channels. -+ * -+ * Items move from this list to periodic_sched_queued as the -+ * transactions for the QH are queued to the DWC_otg controller. -+ */ -+ dwc_list_link_t periodic_sched_assigned; -+ -+ /** -+ * List of periodic QHs that have been queued for execution. -+ * -+ * Items move from this list to either periodic_sched_inactive or -+ * periodic_sched_ready when the channel associated with the transfer -+ * is released. If the interval for the QH is 1, the item moves to -+ * periodic_sched_ready because it must be rescheduled for the next -+ * frame. Otherwise, the item moves to periodic_sched_inactive. -+ */ -+ dwc_list_link_t periodic_sched_queued; -+ -+ /** -+ * Total bandwidth claimed so far for periodic transfers. This value -+ * is in microseconds per (micro)frame. The assumption is that all -+ * periodic transfers may occur in the same (micro)frame. -+ */ -+ uint16_t periodic_usecs; -+ -+ /** -+ * Frame number read from the core at SOF. The value ranges from 0 to -+ * DWC_HFNUM_MAX_FRNUM. -+ */ -+ uint16_t frame_number; -+ -+ /** -+ * Free host channels in the controller. This is a list of -+ * dwc_hc_t items. -+ */ -+ struct hc_list free_hc_list; -+ /** -+ * Number of host channels assigned to periodic transfers. Currently -+ * assuming that there is a dedicated host channel for each periodic -+ * transaction and at least one host channel available for -+ * non-periodic transactions. -+ */ -+ int periodic_channels; -+ -+ /** -+ * Number of host channels assigned to non-periodic transfers. -+ */ -+ int non_periodic_channels; -+ -+ /** -+ * Array of pointers to the host channel descriptors. Allows accessing -+ * a host channel descriptor given the host channel number. This is -+ * useful in interrupt handlers. -+ */ -+ struct dwc_hc *hc_ptr_array[MAX_EPS_CHANNELS]; -+ -+ /** -+ * Buffer to use for any data received during the status phase of a -+ * control transfer. Normally no data is transferred during the status -+ * phase. This buffer is used as a bit bucket. -+ */ -+ uint8_t *status_buf; -+ -+ /** -+ * DMA address for status_buf. -+ */ -+ dma_addr_t status_buf_dma; -+#define DWC_OTG_HCD_STATUS_BUF_SIZE 64 -+ -+ /** -+ * Connection timer. An OTG host must display a message if the device -+ * does not connect. Started when the VBus power is turned on via -+ * sysfs attribute "buspower". -+ */ -+ dwc_timer_t *conn_timer; -+ -+ /* Tasket to do a reset */ -+ dwc_tasklet_t *reset_tasklet; -+ -+ /* */ -+ dwc_spinlock_t *lock; -+ -+ /** -+ * Private data that could be used by OS wrapper. -+ */ -+ void *priv; -+ -+ uint8_t otg_port; -+ -+ /** Frame List */ -+ uint32_t *frame_list; -+ -+ /** Frame List DMA address */ -+ dma_addr_t frame_list_dma; -+ -+#ifdef HW2937_WORKAROUND -+ /** Current transfer mode (IN, OUT, or IDLE) */ -+ hw2937_xfer_mode_t hw2937_xfer_mode; -+ -+ /** Mask of channels assigned to the current mode */ -+ uint32_t hw2937_assigned_channels; -+#endif -+ -+#ifdef DEBUG -+ uint32_t frrem_samples; -+ uint64_t frrem_accum; -+ -+ uint32_t hfnum_7_samples_a; -+ uint64_t hfnum_7_frrem_accum_a; -+ uint32_t hfnum_0_samples_a; -+ uint64_t hfnum_0_frrem_accum_a; -+ uint32_t hfnum_other_samples_a; -+ uint64_t hfnum_other_frrem_accum_a; -+ -+ uint32_t hfnum_7_samples_b; -+ uint64_t hfnum_7_frrem_accum_b; -+ uint32_t hfnum_0_samples_b; -+ uint64_t hfnum_0_frrem_accum_b; -+ uint32_t hfnum_other_samples_b; -+ uint64_t hfnum_other_frrem_accum_b; -+#endif -+}; -+ -+/** @name Transaction Execution Functions */ -+/** @{ */ -+extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t -+ * hcd); -+extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, -+ dwc_otg_transaction_type_e tr_type); -+ -+/** @} */ -+ -+/** @name Interrupt Handler Functions */ -+/** @{ */ -+extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_incomplete_periodic_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_conn_id_status_change_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_disconnect_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, -+ uint32_t num); -+extern int32_t dwc_otg_hcd_handle_session_req_intr(dwc_otg_hcd_t * dwc_otg_hcd); -+extern int32_t dwc_otg_hcd_handle_wakeup_detected_intr(dwc_otg_hcd_t * -+ dwc_otg_hcd); -+/** @} */ -+ -+/** @name Schedule Queue Functions */ -+/** @{ */ -+ -+/* Implemented in dwc_otg_hcd_queue.c */ -+extern dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, -+ dwc_otg_hcd_urb_t * urb); -+extern void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, -+ int sched_csplit); -+ -+/** Remove and free a QH */ -+static inline void dwc_otg_hcd_qh_remove_and_free(dwc_otg_hcd_t * hcd, -+ dwc_otg_qh_t * qh) -+{ -+ dwc_otg_hcd_qh_remove(hcd, qh); -+ dwc_otg_hcd_qh_free(hcd, qh); -+} -+ -+/** Allocates memory for a QH structure. -+ * @return Returns the memory allocate or NULL on error. */ -+static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(void) -+{ -+ return (dwc_otg_qh_t *) dwc_alloc_atomic(sizeof(dwc_otg_qh_t)); -+} -+ -+extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb); -+extern void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb); -+extern int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, dwc_otg_hcd_t * dwc_otg_hcd, -+ dwc_otg_qh_t ** qh); -+ -+/** Allocates memory for a QTD structure. -+ * @return Returns the memory allocate or NULL on error. */ -+static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(void) -+{ -+ return (dwc_otg_qtd_t *) dwc_alloc_atomic(sizeof(dwc_otg_qtd_t)); -+} -+ -+/** Frees the memory for a QTD structure. QTD should already be removed from -+ * list. -+ * @param qtd QTD to free.*/ -+static inline void dwc_otg_hcd_qtd_free(dwc_otg_qtd_t * qtd) -+{ -+ dwc_free(qtd); -+} -+ -+/** Removes a QTD from list. -+ * @param hcd HCD instance. -+ * @param qtd QTD to remove from list. -+ * @param qh QTD belongs to. -+ */ -+static inline void dwc_otg_hcd_qtd_remove(dwc_otg_hcd_t * hcd, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_qh_t * qh) -+{ -+ uint64_t flags; -+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); -+ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); -+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); -+} -+ -+/** Remove and free a QTD */ -+static inline void dwc_otg_hcd_qtd_remove_and_free(dwc_otg_hcd_t * hcd, -+ dwc_otg_qtd_t * qtd, -+ dwc_otg_qh_t * qh) -+{ -+ dwc_otg_hcd_qtd_remove(hcd, qtd, qh); -+ dwc_otg_hcd_qtd_free(qtd); -+} -+ -+/** @} */ -+ -+/** @name Descriptor DMA Supporting Functions */ -+/** @{ */ -+ -+extern void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, -+ dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_halt_status_e halt_status); -+ -+extern int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+extern void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); -+ -+/** @} */ -+ -+/** @name Internal Functions */ -+/** @{ */ -+dwc_otg_qh_t *dwc_urb_to_qh(dwc_otg_hcd_urb_t * urb); -+/** @} */ -+ -+#ifdef CONFIG_USB_DWC_OTG_LPM -+extern int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, -+ uint8_t devaddr); -+extern void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd); -+#endif -+ -+/** Gets the QH that contains the list_head */ -+#define dwc_list_to_qh(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qh_t, qh_list_entry) -+ -+/** Gets the QTD that contains the list_head */ -+#define dwc_list_to_qtd(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qtd_t, qtd_list_entry) -+ -+/** Check if QH is non-periodic */ -+#define dwc_qh_is_non_per(_qh_ptr_) ((_qh_ptr_->ep_type == UE_BULK) || \ -+ (_qh_ptr_->ep_type == UE_CONTROL)) -+ -+/** High bandwidth multiplier as encoded in highspeed endpoint descriptors */ -+#define dwc_hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) -+ -+/** Packet size for any kind of endpoint descriptor */ -+#define dwc_max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) -+ -+/** -+ * Returns true if _frame1 is less than or equal to _frame2. The comparison is -+ * done modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the -+ * frame number when the max frame number is reached. -+ */ -+static inline int dwc_frame_num_le(uint16_t frame1, uint16_t frame2) -+{ -+ return ((frame2 - frame1) & DWC_HFNUM_MAX_FRNUM) <= -+ (DWC_HFNUM_MAX_FRNUM >> 1); -+} -+ -+/** -+ * Returns true if _frame1 is greater than _frame2. The comparison is done -+ * modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the frame -+ * number when the max frame number is reached. -+ */ -+static inline int dwc_frame_num_gt(uint16_t frame1, uint16_t frame2) -+{ -+ return (frame1 != frame2) && -+ (((frame1 - frame2) & DWC_HFNUM_MAX_FRNUM) < -+ (DWC_HFNUM_MAX_FRNUM >> 1)); -+} -+ -+/** -+ * Increments _frame by the amount specified by _inc. The addition is done -+ * modulo DWC_HFNUM_MAX_FRNUM. Returns the incremented value. -+ */ -+static inline uint16_t dwc_frame_num_inc(uint16_t frame, uint16_t inc) -+{ -+ return (frame + inc) & DWC_HFNUM_MAX_FRNUM; -+} -+ -+static inline uint16_t dwc_full_frame_num(uint16_t frame) -+{ -+ return (frame & DWC_HFNUM_MAX_FRNUM) >> 3; -+} -+ -+static inline uint16_t dwc_micro_frame_num(uint16_t frame) -+{ -+ return frame & 0x7; -+} -+ -+void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, -+ dwc_otg_hc_regs_t * hc_regs, -+ dwc_otg_qtd_t * qtd); -+ -+#ifdef DEBUG -+/** -+ * Macro to sample the remaining PHY clocks left in the current frame. This -+ * may be used during debugging to determine the average time it takes to -+ * execute sections of code. There are two possible sample points, "a" and -+ * "b", so the _letter argument must be one of these values. -+ * -+ * To dump the average sample times, read the "hcd_frrem" sysfs attribute. For -+ * example, "cat /sys/devices/lm0/hcd_frrem". -+ */ -+#define dwc_sample_frrem(_hcd, _qh, _letter) \ -+{ \ -+ hfnum_data_t hfnum; \ -+ dwc_otg_qtd_t *qtd; \ -+ qtd = list_entry(_qh->qtd_list.next, dwc_otg_qtd_t, qtd_list_entry); \ -+ if (usb_pipeint(qtd->urb->pipe) && _qh->start_split_frame != 0 && !qtd->complete_split) { \ -+ hfnum.d32 = dwc_read_reg32(&_hcd->core_if->host_if->host_global_regs->hfnum); \ -+ switch (hfnum.b.frnum & 0x7) { \ -+ case 7: \ -+ _hcd->hfnum_7_samples_##_letter++; \ -+ _hcd->hfnum_7_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ case 0: \ -+ _hcd->hfnum_0_samples_##_letter++; \ -+ _hcd->hfnum_0_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ default: \ -+ _hcd->hfnum_other_samples_##_letter++; \ -+ _hcd->hfnum_other_frrem_accum_##_letter += hfnum.b.frrem; \ -+ break; \ -+ } \ -+ } \ -+} -+#else -+#define dwc_sample_frrem(_hcd, _qh, _letter) -+#endif -+#endif -+#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c -new file mode 100644 -index 0000000..21d1ab1 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 2012-07-02 13:42:16.244337170 +0200 @@ -0,0 +1,1106 @@ +/*========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $ @@ -55975,7 +54754,7 @@ index 0000000..21d1ab1 + if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL) { + if (qtd->control_phase == DWC_OTG_CONTROL_DATA) { + urb->actual_length += n_bytes - remain; -+ if (remain || urb->actual_length == urb->length) { ++ if (remain || urb->actual_length >= urb->length) { + /* + * For Control Data stage do not set urb->status=0 to prevent + * URB callback. Set it when Status phase done. See below. @@ -55994,7 +54773,7 @@ index 0000000..21d1ab1 + else { + /* BULK and INTR */ + urb->actual_length += n_bytes - remain; -+ if (remain || urb->actual_length == urb->length) { ++ if (remain || urb->actual_length >= urb->length) { + urb->status = 0; + *xfer_done = 1; + } @@ -56193,11 +54972,817 @@ index 0000000..21d1ab1 +} + +#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h -new file mode 100644 -index 0000000..d5a903b ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 2012-07-02 13:42:16.244337170 +0200 +@@ -0,0 +1,804 @@ ++/* ========================================================================== ++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ ++ * $Revision: #52 $ ++ * $Date: 2009/04/21 $ ++ * $Change: 1237472 $ ++ * ++ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, ++ * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless ++ * otherwise expressly agreed to in writing between Synopsys and you. ++ * ++ * The Software IS NOT an item of Licensed Software or Licensed Product under ++ * any End User Software License Agreement or Agreement for Licensed Product ++ * with Synopsys or any supplement thereto. You are permitted to use and ++ * redistribute this Software in source and binary forms, with or without ++ * modification, provided that redistributions of source code must retain this ++ * notice. You may not view, use, disclose, copy or distribute this file or ++ * any information contained herein except pursuant to this license grant from ++ * Synopsys. If you do not agree with this notice, including the disclaimer ++ * below, then you are not authorized to use the Software. ++ * ++ * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, ++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++ * DAMAGE. ++ * ========================================================================== */ ++#ifndef DWC_DEVICE_ONLY ++#ifndef __DWC_HCD_H__ ++#define __DWC_HCD_H__ ++ ++#include ++#include "dwc_otg_hcd_if.h" ++#include "dwc_otg_core_if.h" ++#include "dwc_list.h" ++#include "dwc_otg_cil.h" ++ ++/** ++ * @file ++ * ++ * This file contains the structures, constants, and interfaces for ++ * the Host Contoller Driver (HCD). ++ * ++ * The Host Controller Driver (HCD) is responsible for translating requests ++ * from the USB Driver into the appropriate actions on the DWC_otg controller. ++ * It isolates the USBD from the specifics of the controller by providing an ++ * API to the USBD. ++ */ ++ ++struct dwc_otg_hcd_pipe_info { ++ uint8_t dev_addr; ++ uint8_t ep_num; ++ uint8_t pipe_type; ++ uint8_t pipe_dir; ++ uint16_t mps; ++}; ++ ++struct dwc_otg_hcd_iso_packet_desc { ++ uint32_t offset; ++ uint32_t length; ++ uint32_t actual_length; ++ uint32_t status; ++}; ++ ++struct dwc_otg_qtd; ++ ++struct dwc_otg_hcd_urb { ++ void *priv; ++ struct dwc_otg_qtd *qtd; ++ void *buf; ++ dwc_dma_t dma; ++ void *setup_packet; ++ dwc_dma_t setup_dma; ++ uint32_t length; ++ uint32_t actual_length; ++ uint32_t status; ++ uint32_t error_count; ++ uint32_t packet_count; ++ uint32_t flags; ++ uint16_t interval; ++ struct dwc_otg_hcd_pipe_info pipe_info; ++ struct dwc_otg_hcd_iso_packet_desc iso_descs[0]; ++}; ++ ++static inline uint8_t dwc_otg_hcd_get_ep_num(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return pipe->ep_num; ++} ++ ++static inline uint8_t dwc_otg_hcd_get_pipe_type(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return pipe->pipe_type; ++} ++ ++static inline uint16_t dwc_otg_hcd_get_mps(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return pipe->mps; ++} ++ ++static inline uint8_t dwc_otg_hcd_get_dev_addr(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return pipe->dev_addr; ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_isoc(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_ISOCHRONOUS); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_int(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_INTERRUPT); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_bulk(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_BULK); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_control(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (pipe->pipe_type == UE_CONTROL); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_in(struct dwc_otg_hcd_pipe_info *pipe) ++{ ++ return (pipe->pipe_dir == UE_DIR_IN); ++} ++ ++static inline uint8_t dwc_otg_hcd_is_pipe_out(struct dwc_otg_hcd_pipe_info ++ *pipe) ++{ ++ return (!dwc_otg_hcd_is_pipe_in(pipe)); ++} ++ ++static inline void dwc_otg_hcd_fill_pipe(struct dwc_otg_hcd_pipe_info *pipe, ++ uint8_t devaddr, uint8_t ep_num, ++ uint8_t pipe_type, uint8_t pipe_dir, ++ uint16_t mps) ++{ ++ pipe->dev_addr = devaddr; ++ pipe->ep_num = ep_num; ++ pipe->pipe_type = pipe_type; ++ pipe->pipe_dir = pipe_dir; ++ pipe->mps = mps; ++} ++ ++/** ++ * Phases for control transfers. ++ */ ++typedef enum dwc_otg_control_phase { ++ DWC_OTG_CONTROL_SETUP, ++ DWC_OTG_CONTROL_DATA, ++ DWC_OTG_CONTROL_STATUS ++} dwc_otg_control_phase_e; ++ ++/** Transaction types. */ ++typedef enum dwc_otg_transaction_type { ++ DWC_OTG_TRANSACTION_NONE, ++ DWC_OTG_TRANSACTION_PERIODIC, ++ DWC_OTG_TRANSACTION_NON_PERIODIC, ++ DWC_OTG_TRANSACTION_ALL ++} dwc_otg_transaction_type_e; ++ ++struct dwc_otg_qh; ++ ++/** ++ * A Queue Transfer Descriptor (QTD) holds the state of a bulk, control, ++ * interrupt, or isochronous transfer. A single QTD is created for each URB ++ * (of one of these types) submitted to the HCD. The transfer associated with ++ * a QTD may require one or multiple transactions. ++ * ++ * A QTD is linked to a Queue Head, which is entered in either the ++ * non-periodic or periodic schedule for execution. When a QTD is chosen for ++ * execution, some or all of its transactions may be executed. After ++ * execution, the state of the QTD is updated. The QTD may be retired if all ++ * its transactions are complete or if an error occurred. Otherwise, it ++ * remains in the schedule so more transactions can be executed later. ++ */ ++typedef struct dwc_otg_qtd { ++ /** ++ * Determines the PID of the next data packet for the data phase of ++ * control transfers. Ignored for other transfer types.
++ * One of the following values: ++ * - DWC_OTG_HC_PID_DATA0 ++ * - DWC_OTG_HC_PID_DATA1 ++ */ ++ uint8_t data_toggle; ++ ++ /** Current phase for control transfers (Setup, Data, or Status). */ ++ dwc_otg_control_phase_e control_phase; ++ ++ /** Keep track of the current split type ++ * for FS/LS endpoints on a HS Hub */ ++ uint8_t complete_split; ++ ++ /** How many bytes transferred during SSPLIT OUT */ ++ uint32_t ssplit_out_xfer_count; ++ ++ /** ++ * Holds the number of bus errors that have occurred for a transaction ++ * within this transfer. ++ */ ++ uint8_t error_count; ++ ++ /** ++ * Index of the next frame descriptor for an isochronous transfer. A ++ * frame descriptor describes the buffer position and length of the ++ * data to be transferred in the next scheduled (micro)frame of an ++ * isochronous transfer. It also holds status for that transaction. ++ * The frame index starts at 0. ++ */ ++ uint16_t isoc_frame_index; ++ ++ /** Position of the ISOC split on full/low speed */ ++ uint8_t isoc_split_pos; ++ ++ /** Position of the ISOC split in the buffer for the current frame */ ++ uint16_t isoc_split_offset; ++ ++ /** URB for this transfer */ ++ struct dwc_otg_hcd_urb *urb; ++ ++ struct dwc_otg_qh *qh; ++ ++ /** This list of QTDs */ ++ DWC_CIRCLEQ_ENTRY(dwc_otg_qtd) qtd_list_entry; ++ ++ /** Indicates if this QTD is currently processed by HW. */ ++ uint8_t in_process; ++ ++ /** Number of DMA descriptors for this QTD */ ++ uint8_t n_desc; ++ ++ /** ++ * Last activated frame(packet) index. ++ * Used in Descriptor DMA mode only. ++ */ ++ uint16_t isoc_frame_index_last; ++ ++} dwc_otg_qtd_t; ++ ++DWC_CIRCLEQ_HEAD(dwc_otg_qtd_list, dwc_otg_qtd); ++ ++/** ++ * A Queue Head (QH) holds the static characteristics of an endpoint and ++ * maintains a list of transfers (QTDs) for that endpoint. A QH structure may ++ * be entered in either the non-periodic or periodic schedule. ++ */ ++typedef struct dwc_otg_qh { ++ /** ++ * Endpoint type. ++ * One of the following values: ++ * - UE_CONTROL ++ * - UE_BULK ++ * - UE_INTERRUPT ++ * - UE_ISOCHRONOUS ++ */ ++ uint8_t ep_type; ++ uint8_t ep_is_in; ++ ++ /** wMaxPacketSize Field of Endpoint Descriptor. */ ++ uint16_t maxp; ++ ++ /** ++ * Device speed. ++ * One of the following values: ++ * - DWC_OTG_EP_SPEED_LOW ++ * - DWC_OTG_EP_SPEED_FULL ++ * - DWC_OTG_EP_SPEED_HIGH ++ */ ++ uint8_t dev_speed; ++ ++ /** ++ * Determines the PID of the next data packet for non-control ++ * transfers. Ignored for control transfers.
++ * One of the following values: ++ * - DWC_OTG_HC_PID_DATA0 ++ * - DWC_OTG_HC_PID_DATA1 ++ */ ++ uint8_t data_toggle; ++ ++ /** Ping state if 1. */ ++ uint8_t ping_state; ++ ++ /** ++ * List of QTDs for this QH. ++ */ ++ struct dwc_otg_qtd_list qtd_list; ++ ++ /** Host channel currently processing transfers for this QH. */ ++ struct dwc_hc *channel; ++ ++ /** Full/low speed endpoint on high-speed hub requires split. */ ++ uint8_t do_split; ++ ++ /** @name Periodic schedule information */ ++ /** @{ */ ++ ++ /** Bandwidth in microseconds per (micro)frame. */ ++ uint16_t usecs; ++ ++ /** Interval between transfers in (micro)frames. */ ++ uint16_t interval; ++ ++ /** ++ * (micro)frame to initialize a periodic transfer. The transfer ++ * executes in the following (micro)frame. ++ */ ++ uint16_t sched_frame; ++ ++ /** (micro)frame at which last start split was initialized. */ ++ uint16_t start_split_frame; ++ ++ /** @} */ ++ ++ /** ++ * Used instead of original buffer if ++ * it(physical address) is not dword-aligned. ++ */ ++ uint8_t *dw_align_buf; ++ dwc_dma_t dw_align_buf_dma; ++ ++ /** Entry for QH in either the periodic or non-periodic schedule. */ ++ dwc_list_link_t qh_list_entry; ++ ++ /** @name Descriptor DMA support */ ++ /** @{ */ ++ ++ /** Descriptor List. */ ++ dwc_otg_host_dma_desc_t *desc_list; ++ ++ /** Descriptor List physical address. */ ++ dwc_dma_t desc_list_dma; ++ ++ /** ++ * Xfer Bytes array. ++ * Each element corresponds to a descriptor and indicates ++ * original XferSize size value for the descriptor. ++ */ ++ uint32_t *n_bytes; ++ ++ /** Actual number of transfer descriptors in a list. */ ++ uint16_t ntd; ++ ++ /** First activated isochronous transfer descriptor index. */ ++ uint8_t td_first; ++ /** Last activated isochronous transfer descriptor index. */ ++ uint8_t td_last; ++ ++ /** @} */ ++ ++} dwc_otg_qh_t; ++ ++DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); ++ ++#ifdef HW2937_WORKAROUND ++ ++typedef enum { ++ HW2937_XFER_MODE_IDLE, ++ HW2937_XFER_MODE_IN, ++ HW2937_XFER_MODE_OUT, ++ HW2937_XFER_MODE_PAUSEIN /* Transitioning from IN to IDLE */ ++} hw2937_xfer_mode_t; ++#endif ++ ++/** ++ * This structure holds the state of the HCD, including the non-periodic and ++ * periodic schedules. ++ */ ++struct dwc_otg_hcd { ++ /** DWC OTG Core Interface Layer */ ++ dwc_otg_core_if_t *core_if; ++ ++ /** Function HCD driver callbacks */ ++ struct dwc_otg_hcd_function_ops *fops; ++ ++ /** Internal DWC HCD Flags */ ++ volatile union dwc_otg_hcd_internal_flags { ++ uint32_t d32; ++ struct { ++ unsigned port_connect_status_change:1; ++ unsigned port_connect_status:1; ++ unsigned port_reset_change:1; ++ unsigned port_enable_change:1; ++ unsigned port_suspend_change:1; ++ unsigned port_over_current_change:1; ++ unsigned port_l1_change:1; ++ unsigned reserved:26; ++ } b; ++ } flags; ++ ++ /** ++ * Inactive items in the non-periodic schedule. This is a list of ++ * Queue Heads. Transfers associated with these Queue Heads are not ++ * currently assigned to a host channel. ++ */ ++ dwc_list_link_t non_periodic_sched_inactive; ++ ++ /** ++ * Active items in the non-periodic schedule. This is a list of ++ * Queue Heads. Transfers associated with these Queue Heads are ++ * currently assigned to a host channel. ++ */ ++ dwc_list_link_t non_periodic_sched_active; ++ ++ /** ++ * Pointer to the next Queue Head to process in the active ++ * non-periodic schedule. ++ */ ++ dwc_list_link_t *non_periodic_qh_ptr; ++ ++ /** ++ * Inactive items in the periodic schedule. This is a list of QHs for ++ * periodic transfers that are _not_ scheduled for the next frame. ++ * Each QH in the list has an interval counter that determines when it ++ * needs to be scheduled for execution. This scheduling mechanism ++ * allows only a simple calculation for periodic bandwidth used (i.e. ++ * must assume that all periodic transfers may need to execute in the ++ * same frame). However, it greatly simplifies scheduling and should ++ * be sufficient for the vast majority of OTG hosts, which need to ++ * connect to a small number of peripherals at one time. ++ * ++ * Items move from this list to periodic_sched_ready when the QH ++ * interval counter is 0 at SOF. ++ */ ++ dwc_list_link_t periodic_sched_inactive; ++ ++ /** ++ * List of periodic QHs that are ready for execution in the next ++ * frame, but have not yet been assigned to host channels. ++ * ++ * Items move from this list to periodic_sched_assigned as host ++ * channels become available during the current frame. ++ */ ++ dwc_list_link_t periodic_sched_ready; ++ ++ /** ++ * List of periodic QHs to be executed in the next frame that are ++ * assigned to host channels. ++ * ++ * Items move from this list to periodic_sched_queued as the ++ * transactions for the QH are queued to the DWC_otg controller. ++ */ ++ dwc_list_link_t periodic_sched_assigned; ++ ++ /** ++ * List of periodic QHs that have been queued for execution. ++ * ++ * Items move from this list to either periodic_sched_inactive or ++ * periodic_sched_ready when the channel associated with the transfer ++ * is released. If the interval for the QH is 1, the item moves to ++ * periodic_sched_ready because it must be rescheduled for the next ++ * frame. Otherwise, the item moves to periodic_sched_inactive. ++ */ ++ dwc_list_link_t periodic_sched_queued; ++ ++ /** ++ * Total bandwidth claimed so far for periodic transfers. This value ++ * is in microseconds per (micro)frame. The assumption is that all ++ * periodic transfers may occur in the same (micro)frame. ++ */ ++ uint16_t periodic_usecs; ++ ++ /** ++ * Frame number read from the core at SOF. The value ranges from 0 to ++ * DWC_HFNUM_MAX_FRNUM. ++ */ ++ uint16_t frame_number; ++ ++ /** ++ * Free host channels in the controller. This is a list of ++ * dwc_hc_t items. ++ */ ++ struct hc_list free_hc_list; ++ /** ++ * Number of host channels assigned to periodic transfers. Currently ++ * assuming that there is a dedicated host channel for each periodic ++ * transaction and at least one host channel available for ++ * non-periodic transactions. ++ */ ++ int periodic_channels; ++ ++ /** ++ * Number of host channels assigned to non-periodic transfers. ++ */ ++ int non_periodic_channels; ++ ++ /** ++ * Array of pointers to the host channel descriptors. Allows accessing ++ * a host channel descriptor given the host channel number. This is ++ * useful in interrupt handlers. ++ */ ++ struct dwc_hc *hc_ptr_array[MAX_EPS_CHANNELS]; ++ ++ /** ++ * Buffer to use for any data received during the status phase of a ++ * control transfer. Normally no data is transferred during the status ++ * phase. This buffer is used as a bit bucket. ++ */ ++ uint8_t *status_buf; ++ ++ /** ++ * DMA address for status_buf. ++ */ ++ dma_addr_t status_buf_dma; ++#define DWC_OTG_HCD_STATUS_BUF_SIZE 64 ++ ++ /** ++ * Connection timer. An OTG host must display a message if the device ++ * does not connect. Started when the VBus power is turned on via ++ * sysfs attribute "buspower". ++ */ ++ dwc_timer_t *conn_timer; ++ ++ /* Tasket to do a reset */ ++ dwc_tasklet_t *reset_tasklet; ++ ++ /* */ ++ dwc_spinlock_t *lock; ++ ++ /** ++ * Private data that could be used by OS wrapper. ++ */ ++ void *priv; ++ ++ uint8_t otg_port; ++ ++ /** Frame List */ ++ uint32_t *frame_list; ++ ++ /** Frame List DMA address */ ++ dma_addr_t frame_list_dma; ++ ++#ifdef HW2937_WORKAROUND ++ /** Current transfer mode (IN, OUT, or IDLE) */ ++ hw2937_xfer_mode_t hw2937_xfer_mode; ++ ++ /** Mask of channels assigned to the current mode */ ++ uint32_t hw2937_assigned_channels; ++#endif ++ ++#ifdef DEBUG ++ uint32_t frrem_samples; ++ uint64_t frrem_accum; ++ ++ uint32_t hfnum_7_samples_a; ++ uint64_t hfnum_7_frrem_accum_a; ++ uint32_t hfnum_0_samples_a; ++ uint64_t hfnum_0_frrem_accum_a; ++ uint32_t hfnum_other_samples_a; ++ uint64_t hfnum_other_frrem_accum_a; ++ ++ uint32_t hfnum_7_samples_b; ++ uint64_t hfnum_7_frrem_accum_b; ++ uint32_t hfnum_0_samples_b; ++ uint64_t hfnum_0_frrem_accum_b; ++ uint32_t hfnum_other_samples_b; ++ uint64_t hfnum_other_frrem_accum_b; ++#endif ++}; ++ ++/** @name Transaction Execution Functions */ ++/** @{ */ ++extern dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t ++ * hcd); ++extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd, ++ dwc_otg_transaction_type_e tr_type); ++ ++/** @} */ ++ ++/** @name Interrupt Handler Functions */ ++/** @{ */ ++extern int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_rx_status_q_level_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_np_tx_fifo_empty_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_perio_tx_fifo_empty_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_incomplete_periodic_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_conn_id_status_change_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_disconnect_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, ++ uint32_t num); ++extern int32_t dwc_otg_hcd_handle_session_req_intr(dwc_otg_hcd_t * dwc_otg_hcd); ++extern int32_t dwc_otg_hcd_handle_wakeup_detected_intr(dwc_otg_hcd_t * ++ dwc_otg_hcd); ++/** @} */ ++ ++/** @name Schedule Queue Functions */ ++/** @{ */ ++ ++/* Implemented in dwc_otg_hcd_queue.c */ ++extern dwc_otg_qh_t *dwc_otg_hcd_qh_create(dwc_otg_hcd_t * hcd, ++ dwc_otg_hcd_urb_t * urb); ++extern void dwc_otg_hcd_qh_free(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, ++ int sched_csplit); ++ ++/** Remove and free a QH */ ++static inline void dwc_otg_hcd_qh_remove_and_free(dwc_otg_hcd_t * hcd, ++ dwc_otg_qh_t * qh) ++{ ++ dwc_otg_hcd_qh_remove(hcd, qh); ++ dwc_otg_hcd_qh_free(hcd, qh); ++} ++ ++/** Allocates memory for a QH structure. ++ * @return Returns the memory allocate or NULL on error. */ ++static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(void) ++{ ++ return (dwc_otg_qh_t *) dwc_alloc_atomic(sizeof(dwc_otg_qh_t)); ++} ++ ++extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb); ++extern void dwc_otg_hcd_qtd_init(dwc_otg_qtd_t * qtd, dwc_otg_hcd_urb_t * urb); ++extern int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd, dwc_otg_hcd_t * dwc_otg_hcd, ++ dwc_otg_qh_t ** qh); ++ ++/** Allocates memory for a QTD structure. ++ * @return Returns the memory allocate or NULL on error. */ ++static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(void) ++{ ++ return (dwc_otg_qtd_t *) dwc_alloc_atomic(sizeof(dwc_otg_qtd_t)); ++} ++ ++/** Frees the memory for a QTD structure. QTD should already be removed from ++ * list. ++ * @param qtd QTD to free.*/ ++static inline void dwc_otg_hcd_qtd_free(dwc_otg_qtd_t * qtd) ++{ ++ dwc_free(qtd); ++} ++ ++/** Removes a QTD from list. ++ * @param hcd HCD instance. ++ * @param qtd QTD to remove from list. ++ * @param qh QTD belongs to. ++ */ ++static inline void dwc_otg_hcd_qtd_remove(dwc_otg_hcd_t * hcd, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_qh_t * qh) ++{ ++ uint64_t flags; ++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); ++ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry); ++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); ++} ++ ++/** Remove and free a QTD */ ++static inline void dwc_otg_hcd_qtd_remove_and_free(dwc_otg_hcd_t * hcd, ++ dwc_otg_qtd_t * qtd, ++ dwc_otg_qh_t * qh) ++{ ++ dwc_otg_hcd_qtd_remove(hcd, qtd, qh); ++ dwc_otg_hcd_qtd_free(qtd); ++} ++ ++/** @} */ ++ ++/** @name Descriptor DMA Supporting Functions */ ++/** @{ */ ++ ++extern void dwc_otg_hcd_start_xfer_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_complete_xfer_ddma(dwc_otg_hcd_t * hcd, ++ dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_halt_status_e halt_status); ++ ++extern int dwc_otg_hcd_qh_init_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++extern void dwc_otg_hcd_qh_free_ddma(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh); ++ ++/** @} */ ++ ++/** @name Internal Functions */ ++/** @{ */ ++dwc_otg_qh_t *dwc_urb_to_qh(dwc_otg_hcd_urb_t * urb); ++/** @} */ ++ ++#ifdef CONFIG_USB_DWC_OTG_LPM ++extern int dwc_otg_hcd_get_hc_for_lpm_tran(dwc_otg_hcd_t * hcd, ++ uint8_t devaddr); ++extern void dwc_otg_hcd_free_hc_from_lpm(dwc_otg_hcd_t * hcd); ++#endif ++ ++/** Gets the QH that contains the list_head */ ++#define dwc_list_to_qh(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qh_t, qh_list_entry) ++ ++/** Gets the QTD that contains the list_head */ ++#define dwc_list_to_qtd(_list_head_ptr_) container_of(_list_head_ptr_, dwc_otg_qtd_t, qtd_list_entry) ++ ++/** Check if QH is non-periodic */ ++#define dwc_qh_is_non_per(_qh_ptr_) ((_qh_ptr_->ep_type == UE_BULK) || \ ++ (_qh_ptr_->ep_type == UE_CONTROL)) ++ ++/** High bandwidth multiplier as encoded in highspeed endpoint descriptors */ ++#define dwc_hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) ++ ++/** Packet size for any kind of endpoint descriptor */ ++#define dwc_max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) ++ ++/** ++ * Returns true if _frame1 is less than or equal to _frame2. The comparison is ++ * done modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the ++ * frame number when the max frame number is reached. ++ */ ++static inline int dwc_frame_num_le(uint16_t frame1, uint16_t frame2) ++{ ++ return ((frame2 - frame1) & DWC_HFNUM_MAX_FRNUM) <= ++ (DWC_HFNUM_MAX_FRNUM >> 1); ++} ++ ++/** ++ * Returns true if _frame1 is greater than _frame2. The comparison is done ++ * modulo DWC_HFNUM_MAX_FRNUM. This accounts for the rollover of the frame ++ * number when the max frame number is reached. ++ */ ++static inline int dwc_frame_num_gt(uint16_t frame1, uint16_t frame2) ++{ ++ return (frame1 != frame2) && ++ (((frame1 - frame2) & DWC_HFNUM_MAX_FRNUM) < ++ (DWC_HFNUM_MAX_FRNUM >> 1)); ++} ++ ++/** ++ * Increments _frame by the amount specified by _inc. The addition is done ++ * modulo DWC_HFNUM_MAX_FRNUM. Returns the incremented value. ++ */ ++static inline uint16_t dwc_frame_num_inc(uint16_t frame, uint16_t inc) ++{ ++ return (frame + inc) & DWC_HFNUM_MAX_FRNUM; ++} ++ ++static inline uint16_t dwc_full_frame_num(uint16_t frame) ++{ ++ return (frame & DWC_HFNUM_MAX_FRNUM) >> 3; ++} ++ ++static inline uint16_t dwc_micro_frame_num(uint16_t frame) ++{ ++ return frame & 0x7; ++} ++ ++void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, ++ dwc_otg_hc_regs_t * hc_regs, ++ dwc_otg_qtd_t * qtd); ++ ++#ifdef DEBUG ++/** ++ * Macro to sample the remaining PHY clocks left in the current frame. This ++ * may be used during debugging to determine the average time it takes to ++ * execute sections of code. There are two possible sample points, "a" and ++ * "b", so the _letter argument must be one of these values. ++ * ++ * To dump the average sample times, read the "hcd_frrem" sysfs attribute. For ++ * example, "cat /sys/devices/lm0/hcd_frrem". ++ */ ++#define dwc_sample_frrem(_hcd, _qh, _letter) \ ++{ \ ++ hfnum_data_t hfnum; \ ++ dwc_otg_qtd_t *qtd; \ ++ qtd = list_entry(_qh->qtd_list.next, dwc_otg_qtd_t, qtd_list_entry); \ ++ if (usb_pipeint(qtd->urb->pipe) && _qh->start_split_frame != 0 && !qtd->complete_split) { \ ++ hfnum.d32 = dwc_read_reg32(&_hcd->core_if->host_if->host_global_regs->hfnum); \ ++ switch (hfnum.b.frnum & 0x7) { \ ++ case 7: \ ++ _hcd->hfnum_7_samples_##_letter++; \ ++ _hcd->hfnum_7_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ case 0: \ ++ _hcd->hfnum_0_samples_##_letter++; \ ++ _hcd->hfnum_0_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ default: \ ++ _hcd->hfnum_other_samples_##_letter++; \ ++ _hcd->hfnum_other_frrem_accum_##_letter += hfnum.b.frrem; \ ++ break; \ ++ } \ ++ } \ ++} ++#else ++#define dwc_sample_frrem(_hcd, _qh, _letter) ++#endif ++#endif ++#endif /* DWC_DEVICE_ONLY */ +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 2012-07-02 13:42:16.245337190 +0200 @@ -0,0 +1,393 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $ @@ -56592,11 +56177,9 @@ index 0000000..d5a903b + +#endif /* __DWC_HCD_IF_H__ */ +#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -new file mode 100644 -index 0000000..6e4bc60 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,2065 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ @@ -57167,7 +56750,7 @@ index 0000000..6e4bc60 + (urb->flags & URB_SEND_ZERO_PACKET) && (urb->actual_length == urb->length) && + !(urb->length % hc->max_packet)) { + xfer_done = 0; -+ } else if (short_read || urb->actual_length == urb->length) { ++ } else if (short_read || urb->actual_length >= urb->length) { + xfer_done = 1; + urb->status = 0; + } @@ -58476,10 +58059,10 @@ index 0000000..6e4bc60 + } else if (hcint.b.xacterr && !hcd->core_if->dma_desc_enable) { + if (out_nak_enh) { + if (hcint.b.nyet || hcint.b.nak || hcint.b.ack) { -+ DWC_DEBUG("XactErr with NYET/NAK/ACK\n"); ++ DWC_DEBUGPL(DBG_HCD, "XactErr with NYET/NAK/ACK\n"); + qtd->error_count = 0; + } else { -+ DWC_DEBUG("XactErr without NYET/NAK/ACK\n"); ++ DWC_DEBUGPL(DBG_HCD, "XactErr without NYET/NAK/ACK\n"); + } + } + @@ -58663,12 +58246,10 @@ index 0000000..6e4bc60 +} + +#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -new file mode 100644 -index 0000000..970b065 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -0,0 +1,848 @@ +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 2012-07-02 13:42:16.244337170 +0200 +@@ -0,0 +1,855 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ + * $Revision: #11 $ @@ -58861,6 +58442,7 @@ index 0000000..970b065 + uint32_t * port_addr) +{ + struct urb *urb = (struct urb *)urb_handle; ++ struct usb_bus *bus; +#if 1 //GRAYG - temporary + if (NULL == urb_handle) + DWC_ERROR("**** %s - NULL URB handle\n", __func__);//GRAYG @@ -58877,12 +58459,18 @@ index 0000000..970b065 + *hub_addr = 0; //GRAYG + // we probably shouldn't have a transaction translator if + // there's no associated hub? -+ } else -+ *hub_addr = urb->dev->tt->hub->devnum; ++ } else { ++ bus = hcd_to_bus(dwc_otg_hcd_to_hcd(hcd)); ++ if (urb->dev->tt->hub == bus->root_hub) ++ *hub_addr = 0; ++ else ++ *hub_addr = urb->dev->tt->hub->devnum; ++ } ++ *port_addr = urb->dev->tt->multi ? urb->dev->ttport : 1; + } else { + *hub_addr = 0; ++ *port_addr = urb->dev->ttport; + } -+ *port_addr = urb->dev->ttport; + return 0; +} + @@ -59517,11 +59105,9 @@ index 0000000..970b065 +} + +#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -new file mode 100644 -index 0000000..cfed807 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 2012-07-02 13:42:16.244337170 +0200 @@ -0,0 +1,732 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ @@ -60255,11 +59841,9 @@ index 0000000..cfed807 +} + +#endif /* DWC_DEVICE_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c -new file mode 100644 -index 0000000..6043b99 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 2012-07-02 13:42:16.241337110 +0200 @@ -0,0 +1,2067 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $ @@ -62328,11 +61912,9 @@ index 0000000..6043b99 +} + +#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h -new file mode 100644 -index 0000000..d38e169 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 2012-07-02 13:42:16.240337089 +0200 @@ -0,0 +1,216 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $ @@ -62550,11 +62132,9 @@ index 0000000..d38e169 +extern void do_test_mode(void *data); +#endif +#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h -new file mode 100644 -index 0000000..66e9db7 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 2012-07-02 13:42:16.244337170 +0200 @@ -0,0 +1,333 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $ @@ -62889,11 +62469,9 @@ index 0000000..66e9db7 +#endif /* __DWC_PCD_IF_H__ */ + +#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c -new file mode 100644 -index 0000000..f89e878 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 2012-07-02 13:42:16.242337130 +0200 @@ -0,0 +1,4077 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $ @@ -66972,11 +66550,9 @@ index 0000000..f89e878 +} + +#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c -new file mode 100644 -index 0000000..aae78a7 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 2012-07-02 13:42:16.243337150 +0200 @@ -0,0 +1,1288 @@ + /* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ @@ -68266,11 +67842,9 @@ index 0000000..aae78a7 +EXPORT_SYMBOL(usb_gadget_unregister_driver); + +#endif /* DWC_HOST_ONLY */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_regs.h b/drivers/usb/host/dwc_otg/dwc_otg_regs.h -new file mode 100644 -index 0000000..e8220ad ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/dwc_otg_regs.h +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_regs.h linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_regs.h +--- linux-3.2.21/drivers/usb/host/dwc_otg/dwc_otg_regs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/dwc_otg_regs.h 2012-07-02 13:42:16.241337110 +0200 @@ -0,0 +1,2237 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $ @@ -70509,33 +70083,93 @@ index 0000000..e8220ad +} pcgcctl_data_t; + +#endif -diff --git a/drivers/usb/host/dwc_otg/test/Makefile b/drivers/usb/host/dwc_otg/test/Makefile -new file mode 100644 -index 0000000..fc45375 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/Makefile -@@ -0,0 +1,16 @@ +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/Makefile +--- linux-3.2.21/drivers/usb/host/dwc_otg/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/Makefile 2012-07-02 13:42:16.240337089 +0200 +@@ -0,0 +1,80 @@ ++# ++# Makefile for DWC_otg Highspeed USB controller driver ++# + -+PERL=/usr/bin/perl -+PL_TESTS=test_sysfs.pl test_mod_param.pl ++ifneq ($(KERNELRELEASE),) + -+.PHONY : test -+test : perl_tests ++ifeq ($(BUS_INTERFACE),) ++ # BUS_INTERFACE = -DLM_INTERFACE ++ BUS_INTERFACE = -DPLATFORM_INTERFACE=1 ++endif + -+perl_tests : -+ @echo -+ @echo Running perl tests -+ @for test in $(PL_TESTS); do \ -+ if $(PERL) ./$$test ; then \ -+ echo "=======> $$test, PASSED" ; \ -+ else echo "=======> $$test, FAILED" ; \ -+ fi \ -+ done -diff --git a/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm -new file mode 100644 -index 0000000..233b04a ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm ++ifeq ($(CONFIG_USB_DEBUG),y) ++CPPFLAGS += -DDEBUG ++endif ++ ++# Use one of the following flags to compile the software in host-only or ++# device-only mode. ++#CPPFLAGS += -DDWC_HOST_ONLY ++#CPPFLAGS += -DDWC_DEVICE_ONLY ++ ++CPPFLAGS += -Dlinux -DDWC_HS_ELECT_TST ++#CGG: CPPFLAGS += -DDWC_EN_ISOC ++CPPFLAGS += -I$(obj)/../dwc_common_port ++#CPPFLAGS += -I$(PORTLIB) ++CPPFLAGS += -DDWC_LINUX ++CPPFLAGS += $(CFI) ++CPPFLAGS += $(BUS_INTERFACE) ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o ++ ++dwc_otg-objs := dwc_otg_driver.o dwc_otg_attr.o ++dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o ++dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o ++dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o ++ifneq ($(CFI),) ++dwc_otg-objs += dwc_otg_cfi.o ++endif ++ ++kernrelwd := $(subst ., ,$(KERNELRELEASE)) ++kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd)) ++ ++ifneq ($(kernrel3),2.6.20) ++EXTRA_CFLAGS += $(CPPFLAGS) ++endif ++ ++else ++ ++PWD := $(shell pwd) ++PORTLIB := $(PWD)/../dwc_common_port ++ ++# Command paths ++CTAGS := $(CTAGS) ++DOXYGEN := $(DOXYGEN) ++ ++default: portlib ++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ ++install: default ++ifneq ($(INSTALL_MOD_PATH),) ++ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install ++ $(MAKE) -C$(KDIR) M=$(PWD) modules_install ++else ++ @echo "No install path defined" ++endif ++ ++portlib: ++ $(MAKE) -C$(KDIR) M=$(PORTLIB) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules ++ cp $(PORTLIB)/Module.symvers $(PWD)/ ++ ++docs: $(wildcard *.[hc]) doc/doxygen.cfg ++ $(DOXYGEN) doc/doxygen.cfg ++ ++tags: $(wildcard *.[hc]) ++ $(CTAGS) -e $(wildcard *.[hc]) $(wildcard linux/*.[hc]) $(wildcard $(KDIR)/include/linux/usb*.h) ++ ++ ++clean: ++ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions ++ ++endif +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm +--- linux-3.2.21/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm 2012-07-02 13:42:16.242337130 +0200 @@ -0,0 +1,337 @@ +package dwc_otg_test; + @@ -70874,11 +70508,29 @@ index 0000000..233b04a +); + +1; -diff --git a/drivers/usb/host/dwc_otg/test/test_mod_param.pl b/drivers/usb/host/dwc_otg/test/test_mod_param.pl -new file mode 100644 -index 0000000..e887dce ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/test_mod_param.pl +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/test/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/Makefile +--- linux-3.2.21/drivers/usb/host/dwc_otg/test/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/Makefile 2012-07-02 13:42:16.242337130 +0200 +@@ -0,0 +1,16 @@ ++ ++PERL=/usr/bin/perl ++PL_TESTS=test_sysfs.pl test_mod_param.pl ++ ++.PHONY : test ++test : perl_tests ++ ++perl_tests : ++ @echo ++ @echo Running perl tests ++ @for test in $(PL_TESTS); do \ ++ if $(PERL) ./$$test ; then \ ++ echo "=======> $$test, PASSED" ; \ ++ else echo "=======> $$test, FAILED" ; \ ++ fi \ ++ done +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/test/test_mod_param.pl linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/test_mod_param.pl +--- linux-3.2.21/drivers/usb/host/dwc_otg/test/test_mod_param.pl 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/test_mod_param.pl 2012-07-02 13:42:16.242337130 +0200 @@ -0,0 +1,133 @@ +#!/usr/bin/perl -w +# @@ -71013,11 +70665,9 @@ index 0000000..e887dce + +test_main(); +0; -diff --git a/drivers/usb/host/dwc_otg/test/test_sysfs.pl b/drivers/usb/host/dwc_otg/test/test_sysfs.pl -new file mode 100644 -index 0000000..abcf284 ---- /dev/null -+++ b/drivers/usb/host/dwc_otg/test/test_sysfs.pl +diff -Naur linux-3.2.21/drivers/usb/host/dwc_otg/test/test_sysfs.pl linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/test_sysfs.pl +--- linux-3.2.21/drivers/usb/host/dwc_otg/test/test_sysfs.pl 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/dwc_otg/test/test_sysfs.pl 2012-07-02 13:42:16.242337130 +0200 @@ -0,0 +1,193 @@ +#!/usr/bin/perl -w +# @@ -71212,49 +70862,56 @@ index 0000000..abcf284 + +test_main(); +0; -diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index d83e967..a488cd7 100644 ---- a/drivers/video/Kconfig -+++ b/drivers/video/Kconfig -@@ -312,6 +312,20 @@ config FB_PM2_FIFO_DISCONNECT - help - Support the Permedia2 FIFO disconnect feature. +diff -Naur linux-3.2.21/drivers/usb/host/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/Kconfig +--- linux-3.2.21/drivers/usb/host/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/Kconfig 2012-07-02 13:42:16.238337047 +0200 +@@ -556,6 +556,19 @@ + To compile this driver a module, choose M here: the module + will be called "hwa-hc". -+config FB_BCM2708 -+ tristate "BCM2708 framebuffer support" -+ depends on FB && ARM -+ select FB_CFB_FILLRECT -+ select FB_CFB_COPYAREA -+ select FB_CFB_IMAGEBLIT ++config USB_DWCOTG ++ tristate "Synopsis DWC host support" ++ depends on USB + help -+ This framebuffer device driver is for the BCM2708 framebuffer. ++ The Synopsis DWC controller is a dual-role ++ host/peripheral/OTG ("On The Go") USB controllers. + -+ If you want to compile this as a module (=code which can be -+ inserted into and removed from the running kernel), say M -+ here and read . The module -+ will be called bcm2708_fb. ++ Enable this option to support this IP in host controller mode. ++ If unsure, say N. + - config FB_ARMCLCD - tristate "ARM PrimeCell PL110 support" - depends on FB && ARM && ARM_AMBA -diff --git a/drivers/video/Makefile b/drivers/video/Makefile -index 9b9d8ff..6e9e8e9 100644 ---- a/drivers/video/Makefile -+++ b/drivers/video/Makefile -@@ -96,6 +96,7 @@ obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o - obj-$(CONFIG_FB_PVR2) += pvr2fb.o - obj-$(CONFIG_FB_VOODOO1) += sstfb.o - obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o -+obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o - obj-$(CONFIG_FB_68328) += 68328fb.o - obj-$(CONFIG_FB_GBE) += gbefb.o - obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o -diff --git a/drivers/video/bcm2708_fb.c b/drivers/video/bcm2708_fb.c -new file mode 100644 -index 0000000..8d67e86 ---- /dev/null -+++ b/drivers/video/bcm2708_fb.c -@@ -0,0 +1,473 @@ ++ To compile this driver as a module, choose M here: the ++ modules built will be called dwc_otg and dwc_common_port. ++ + config USB_IMX21_HCD + tristate "i.MX21 HCD support" + depends on USB && ARM && ARCH_MXC +diff -Naur linux-3.2.21/drivers/usb/host/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/Makefile +--- linux-3.2.21/drivers/usb/host/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/host/Makefile 2012-07-02 13:42:16.231336905 +0200 +@@ -33,6 +33,8 @@ + obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o + obj-$(CONFIG_USB_ISP1760_HCD) += isp1760.o + obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o ++ ++obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/ + obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o + obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o + obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o +diff -Naur linux-3.2.21/drivers/usb/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/usb/Makefile +--- linux-3.2.21/drivers/usb/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/usb/Makefile 2012-07-02 13:42:16.218336638 +0200 +@@ -23,6 +23,7 @@ + obj-$(CONFIG_USB_R8A66597_HCD) += host/ + obj-$(CONFIG_USB_HWA_HCD) += host/ + obj-$(CONFIG_USB_ISP1760_HCD) += host/ ++obj-$(CONFIG_USB_DWCOTG) += host/ + obj-$(CONFIG_USB_IMX21_HCD) += host/ + obj-$(CONFIG_USB_FSL_MPH_DR_OF) += host/ + +diff -Naur linux-3.2.21/drivers/video/bcm2708_fb.c linux-3.2.21-bootc-5b0ccb0/drivers/video/bcm2708_fb.c +--- linux-3.2.21/drivers/video/bcm2708_fb.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/video/bcm2708_fb.c 2012-07-02 13:42:15.878329692 +0200 +@@ -0,0 +1,487 @@ +/* + * linux/drivers/video/bcm2708_fb.c + * @@ -71305,6 +70962,7 @@ index 0000000..8d67e86 + u32 xoffset, yoffset; + u32 base; + u32 screen_size; ++ u16 cmap[256]; +}; + +struct bcm2708_fb { @@ -71523,18 +71181,31 @@ index 0000000..8d67e86 + return (val >> (16 - bf->length) & mask) << bf->offset; +} + ++ +static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, + unsigned int green, unsigned int blue, + unsigned int transp, struct fb_info *info) +{ + struct bcm2708_fb *fb = to_bcm2708(info); + ++ /*pr_info("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ + if (regno < 16) + fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | + convert_bitfield(blue, &fb->fb.var.blue) | + convert_bitfield(green, &fb->fb.var.green) | + convert_bitfield(red, &fb->fb.var.red); + ++ if (regno < 256) { ++ /* blue [0:4], green [5:10], red [11:15] */ ++ fb->info->cmap[regno] = ((red >> (16-5)) & 0x1f) << 11 | ++ ((green >> (16-6)) & 0x3f) << 5 | ++ ((blue >> (16-5)) & 0x1f) << 0; ++ } ++ /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ ++ /* So just call it for what looks like the last colour in a list for now. */ ++ if (regno == 15 || regno == 255) ++ bcm2708_fb_set_par(info); ++ + return regno > 255; +} + @@ -71728,10 +71399,33 @@ index 0000000..8d67e86 +MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer"); +MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer"); +MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); -diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43..7626beb 100644 ---- a/drivers/video/logo/logo_linux_clut224.ppm -+++ b/drivers/video/logo/logo_linux_clut224.ppm +diff -Naur linux-3.2.21/drivers/video/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/video/Kconfig +--- linux-3.2.21/drivers/video/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/video/Kconfig 2012-07-02 13:42:15.876329650 +0200 +@@ -312,6 +312,20 @@ + help + Support the Permedia2 FIFO disconnect feature. + ++config FB_BCM2708 ++ tristate "BCM2708 framebuffer support" ++ depends on FB && ARM ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT ++ help ++ This framebuffer device driver is for the BCM2708 framebuffer. ++ ++ If you want to compile this as a module (=code which can be ++ inserted into and removed from the running kernel), say M ++ here and read . The module ++ will be called bcm2708_fb. ++ + config FB_ARMCLCD + tristate "ARM PrimeCell PL110 support" + depends on FB && ARM && ARM_AMBA +diff -Naur linux-3.2.21/drivers/video/logo/logo_linux_clut224.ppm linux-3.2.21-bootc-5b0ccb0/drivers/video/logo/logo_linux_clut224.ppm +--- linux-3.2.21/drivers/video/logo/logo_linux_clut224.ppm 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/video/logo/logo_linux_clut224.ppm 2012-07-02 13:42:15.869329508 +0200 @@ -1,1604 +1,883 @@ P3 -# Standard 224-color Linux logo @@ -74218,40 +73912,20 @@ index 3c14e43..7626beb 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig -index 79fd606..bd76a65 100644 ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -343,6 +343,12 @@ config IMX2_WDT - To compile this driver as a module, choose M here: the - module will be called imx2_wdt. - -+config BCM2708_WDT -+ tristate "BCM2708 Watchdog" -+ depends on ARCH_BCM2708 -+ help -+ Enables BCM2708 watchdog support. -+ - # AVR32 Architecture - - config AT32AP700X_WDT -diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile -index fe893e9..897ab01 100644 ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -53,6 +53,7 @@ obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o - obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o - obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o - obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o -+obj-$(CONFIG_BCM2708_WDT) += bcm2708_wdog.o - - # AVR32 Architecture - obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o -diff --git a/drivers/watchdog/bcm2708_wdog.c b/drivers/watchdog/bcm2708_wdog.c -new file mode 100644 -index 0000000..dd33c35 ---- /dev/null -+++ b/drivers/watchdog/bcm2708_wdog.c +diff -Naur linux-3.2.21/drivers/video/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/video/Makefile +--- linux-3.2.21/drivers/video/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/video/Makefile 2012-07-02 13:42:15.845329017 +0200 +@@ -96,6 +96,7 @@ + obj-$(CONFIG_FB_PVR2) += pvr2fb.o + obj-$(CONFIG_FB_VOODOO1) += sstfb.o + obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o ++obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o + obj-$(CONFIG_FB_68328) += 68328fb.o + obj-$(CONFIG_FB_GBE) += gbefb.o + obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o +diff -Naur linux-3.2.21/drivers/watchdog/bcm2708_wdog.c linux-3.2.21-bootc-5b0ccb0/drivers/watchdog/bcm2708_wdog.c +--- linux-3.2.21/drivers/watchdog/bcm2708_wdog.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/watchdog/bcm2708_wdog.c 2012-07-02 13:42:17.501362857 +0200 @@ -0,0 +1,385 @@ +/* + * Broadcom BCM2708 watchdog driver. @@ -74638,11 +74312,37 @@ index 0000000..dd33c35 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); + -diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h -index e4b6935..99b7eef 100644 ---- a/include/linux/mmc/sdhci.h -+++ b/include/linux/mmc/sdhci.h -@@ -121,6 +121,7 @@ struct sdhci_host { +diff -Naur linux-3.2.21/drivers/watchdog/Kconfig linux-3.2.21-bootc-5b0ccb0/drivers/watchdog/Kconfig +--- linux-3.2.21/drivers/watchdog/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/watchdog/Kconfig 2012-07-02 13:42:17.496362753 +0200 +@@ -343,6 +343,12 @@ + To compile this driver as a module, choose M here: the + module will be called imx2_wdt. + ++config BCM2708_WDT ++ tristate "BCM2708 Watchdog" ++ depends on ARCH_BCM2708 ++ help ++ Enables BCM2708 watchdog support. ++ + # AVR32 Architecture + + config AT32AP700X_WDT +diff -Naur linux-3.2.21/drivers/watchdog/Makefile linux-3.2.21-bootc-5b0ccb0/drivers/watchdog/Makefile +--- linux-3.2.21/drivers/watchdog/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/drivers/watchdog/Makefile 2012-07-02 13:42:17.492362673 +0200 +@@ -53,6 +53,7 @@ + obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o + obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o + obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o ++obj-$(CONFIG_BCM2708_WDT) += bcm2708_wdog.o + + # AVR32 Architecture + obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o +diff -Naur linux-3.2.21/include/linux/mmc/sdhci.h linux-3.2.21-bootc-5b0ccb0/include/linux/mmc/sdhci.h +--- linux-3.2.21/include/linux/mmc/sdhci.h 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/include/linux/mmc/sdhci.h 2012-07-02 13:42:15.364319187 +0200 +@@ -121,6 +121,7 @@ #define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ #define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ #define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ @@ -74650,7 +74350,7 @@ index e4b6935..99b7eef 100644 unsigned int version; /* SDHCI spec. version */ -@@ -135,6 +136,7 @@ struct sdhci_host { +@@ -135,6 +136,7 @@ struct mmc_request *mrq; /* Current request */ struct mmc_command *cmd; /* Current command */ @@ -74658,42 +74358,437 @@ index e4b6935..99b7eef 100644 struct mmc_data *data; /* Current data request */ unsigned int data_early:1; /* Data finished before cmd */ -diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig -index 885683a..3577572 100644 ---- a/sound/arm/Kconfig -+++ b/sound/arm/Kconfig -@@ -39,5 +39,12 @@ config SND_PXA2XX_AC97 - Say Y or M if you want to support any AC97 codec attached to - the PXA2xx AC97 interface. - -+config SND_BCM2835 -+ tristate "BCM2835 ALSA driver" -+ depends on ARCH_BCM2708 && SND -+ select SND_PCM -+ help -+ Say Y or M if you want to support BCM2835 Alsa pcm card driver +diff -Naur linux-3.2.21/sound/arm/bcm2835.c linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835.c +--- linux-3.2.21/sound/arm/bcm2835.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835.c 2012-07-02 13:42:12.543261541 +0200 +@@ -0,0 +1,424 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ + - endif # SND_ARM - -diff --git a/sound/arm/Makefile b/sound/arm/Makefile -index 8c0c851..181cb57 100644 ---- a/sound/arm/Makefile -+++ b/sound/arm/Makefile -@@ -14,3 +14,9 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o - - obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o - snd-pxa2xx-ac97-objs := pxa2xx-ac97.o ++#include + -+obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o -+snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o ++#include ++#include ++#include + -+EXTRA_CFLAGS += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 ++#include "bcm2835.h" + -diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c -new file mode 100755 -index 0000000..c0546e35 ---- /dev/null -+++ b/sound/arm/bcm2835-ctl.c ++/* module parameters (see "Module Parameters") */ ++/* SNDRV_CARDS: maximum number of cards supported by this module */ ++static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 }; ++static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL }; ++static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 }; ++ ++/* HACKY global pointers needed for successive probes to work : ssp ++ * But compared against the changes we will have to do in VC audio_ipc code ++ * to export 8 audio_ipc devices as a single IPC device and then monitor all ++ * four devices in a thread, this gets things done quickly and should be easier ++ * to debug if we run into issues ++ */ ++ ++static struct snd_card *g_card = NULL; ++static bcm2835_chip_t *g_chip = NULL; ++ ++static int snd_bcm2835_free(bcm2835_chip_t * chip) ++{ ++ kfree(chip); ++ return 0; ++} ++ ++/* component-destructor ++ * (see "Management of Cards and Components") ++ */ ++static int snd_bcm2835_dev_free(struct snd_device *device) ++{ ++ return snd_bcm2835_free(device->device_data); ++} ++ ++/* chip-specific constructor ++ * (see "Management of Cards and Components") ++ */ ++static int __devinit snd_bcm2835_create(struct snd_card *card, ++ struct platform_device *pdev, ++ bcm2835_chip_t ** rchip) ++{ ++ bcm2835_chip_t *chip; ++ int err; ++ static struct snd_device_ops ops = { ++ .dev_free = snd_bcm2835_dev_free, ++ }; ++ ++ *rchip = NULL; ++ ++ chip = kzalloc(sizeof(*chip), GFP_KERNEL); ++ if (chip == NULL) ++ return -ENOMEM; ++ ++ chip->card = card; ++ ++ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); ++ if (err < 0) { ++ snd_bcm2835_free(chip); ++ return err; ++ } ++ ++ *rchip = chip; ++ return 0; ++} ++ ++static int __devinit snd_bcm2835_alsa_probe(struct platform_device *pdev) ++{ ++ static int dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ int err; ++ printk(KERN_INFO "### snd_bcm2835_alsa_probe %p ###", pdev); ++ ++ printk ++ ("############ PROBING FOR bcm2835 ALSA device (%d):(%d) ###############\n", ++ dev, enable[dev]); ++ ++ if (dev >= MAX_SUBSTREAMS) ++ return -ENODEV; ++ ++ if (!enable[dev]) { ++ dev++; ++ return -ENOENT; ++ } ++ ++ if (dev > 0) ++ goto add_register_map; ++ ++ printk("Creating card...\n"); ++ err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &g_card); ++ if (err < 0) ++ goto out; ++ ++ snd_card_set_dev(g_card, &pdev->dev); ++ strcpy(g_card->driver, "BRCM bcm2835 ALSA Driver"); ++ strcpy(g_card->shortname, "bcm2835 ALSA"); ++ sprintf(g_card->longname, "%s", g_card->shortname); ++ ++ printk("Creating device/chip ..\n"); ++ err = snd_bcm2835_create(g_card, pdev, &chip); ++ if (err < 0) { ++ printk(KERN_ERR "Failed to create bcm2835 chip\n"); ++ goto out_bcm2835_create; ++ } ++ ++ g_chip = chip; ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ printk(KERN_ERR "Failed to create new BCM2835 pcm device\n"); ++ goto out_bcm2835_new_pcm; ++ } ++ ++ printk("Adding controls ..\n"); ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ printk(KERN_ERR "Failed to create new BCM2835 ctl\n"); ++ goto out_bcm2835_new_ctl; ++ } ++ ++add_register_map: ++ card = g_card; ++ chip = g_chip; ++ ++ BUG_ON(!(card && chip)); ++ ++ chip->avail_substreams |= (1 << dev); ++ chip->pdev[dev] = pdev; ++ ++ if (dev == 0) { ++ printk("Registering card ....\n"); ++ err = snd_card_register(card); ++ if (err < 0) { ++ printk(KERN_ERR ++ "Failed to register bcm2835 ALSA card \n"); ++ goto out_card_register; ++ } ++ platform_set_drvdata(pdev, card); ++ printk("bcm2835 ALSA CARD CREATED!\n"); ++ } else { ++ printk("bcm2835 ALSA CHIP CREATED!\n"); ++ platform_set_drvdata(pdev, (void *)dev); ++ } ++ ++ dev++; ++ ++ return 0; ++ ++out_card_register: ++out_bcm2835_new_ctl: ++out_bcm2835_new_pcm: ++out_bcm2835_create: ++ BUG_ON(!g_card); ++ if (snd_card_free(g_card)) ++ printk(KERN_ERR "Failed to free Registered alsa card\n"); ++ g_card = NULL; ++out: ++ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */ ++ printk(KERN_ERR "BCM2835 ALSA Probe failed !!\n"); ++ return err; ++} ++ ++static int snd_bcm2835_alsa_remove(struct platform_device *pdev) ++{ ++ uint32_t idx; ++ void *drv_data; ++ ++ drv_data = platform_get_drvdata(pdev); ++ ++ if (drv_data == (void *)g_card) { ++ /* This is the card device */ ++ snd_card_free((struct snd_card *)drv_data); ++ g_card = NULL; ++ g_chip = NULL; ++ } else { ++ idx = (uint32_t) drv_data; ++ if (g_card != NULL) { ++ BUG_ON(!g_chip); ++ /* We pass chip device numbers in audio ipc devices ++ * other than the one we registered our card with ++ */ ++ idx = (uint32_t) drv_data; ++ BUG_ON(!idx || idx > MAX_SUBSTREAMS); ++ g_chip->avail_substreams &= ~(1 << idx); ++ /* There should be atleast one substream registered ++ * after we are done here, as it wil be removed when ++ * the *remove* is called for the card device ++ */ ++ BUG_ON(!g_chip->avail_substreams); ++ } ++ } ++ ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, ++ pm_message_t state) ++{ ++ return 0; ++} ++ ++static int snd_bcm2835_alsa_resume(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++#endif ++ ++static struct platform_driver bcm2835_alsa0_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD0", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa1_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD1", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa2_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD2", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa3_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD3", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa4_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD4", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa5_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD5", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa6_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD6", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static struct platform_driver bcm2835_alsa7_driver = { ++ .probe = snd_bcm2835_alsa_probe, ++ .remove = snd_bcm2835_alsa_remove, ++#ifdef CONFIG_PM ++ .suspend = snd_bcm2835_alsa_suspend, ++ .resume = snd_bcm2835_alsa_resume, ++#endif ++ .driver = { ++ .name = "bcm2835_AUD7", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int __devinit bcm2835_alsa_device_init(void) ++{ ++ int err; ++ err = platform_driver_register(&bcm2835_alsa0_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa0_driver %d .\n", err); ++ goto out; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa1_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa1_driver %d .\n", err); ++ goto unregister_0; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa2_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa2_driver %d .\n", err); ++ goto unregister_1; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa3_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa3_driver %d .\n", err); ++ goto unregister_2; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa4_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa4_driver %d .\n", err); ++ goto unregister_3; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa5_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa5_driver %d .\n", err); ++ goto unregister_4; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa6_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa6_driver %d .\n", err); ++ goto unregister_5; ++ } ++ ++ err = platform_driver_register(&bcm2835_alsa7_driver); ++ if (err) { ++ printk("Error registering bcm2835_alsa7_driver %d .\n", err); ++ goto unregister_6; ++ } ++ printk(KERN_INFO "### BCM2835 ALSA driver init %s ### \n", ++ err ? "FAILED" : "OK"); ++ ++ return 0; ++ ++unregister_6: ++ platform_driver_unregister(&bcm2835_alsa6_driver); ++unregister_5: ++ platform_driver_unregister(&bcm2835_alsa5_driver); ++unregister_4: ++ platform_driver_unregister(&bcm2835_alsa4_driver); ++unregister_3: ++ platform_driver_unregister(&bcm2835_alsa3_driver); ++unregister_2: ++ platform_driver_unregister(&bcm2835_alsa2_driver); ++unregister_1: ++ platform_driver_unregister(&bcm2835_alsa1_driver); ++unregister_0: ++ platform_driver_unregister(&bcm2835_alsa0_driver); ++out: ++ return err; ++} ++ ++static void __devexit bcm2835_alsa_device_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_alsa0_driver); ++ platform_driver_unregister(&bcm2835_alsa1_driver); ++ platform_driver_unregister(&bcm2835_alsa2_driver); ++ platform_driver_unregister(&bcm2835_alsa3_driver); ++ platform_driver_unregister(&bcm2835_alsa4_driver); ++ platform_driver_unregister(&bcm2835_alsa5_driver); ++ platform_driver_unregister(&bcm2835_alsa6_driver); ++ platform_driver_unregister(&bcm2835_alsa7_driver); ++} ++ ++late_initcall(bcm2835_alsa_device_init); ++module_exit(bcm2835_alsa_device_exit); ++ ++MODULE_AUTHOR("Dom Cobley"); ++MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bcm2835_alsa"); +diff -Naur linux-3.2.21/sound/arm/bcm2835-ctl.c linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835-ctl.c +--- linux-3.2.21/sound/arm/bcm2835-ctl.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835-ctl.c 2012-07-02 13:42:12.543261541 +0200 @@ -0,0 +1,172 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. @@ -74867,11 +74962,255 @@ index 0000000..c0546e35 + } + return 0; +} -diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c -new file mode 100755 -index 0000000..ff3eb4e ---- /dev/null -+++ b/sound/arm/bcm2835-pcm.c +diff -Naur linux-3.2.21/sound/arm/bcm2835.h linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835.h +--- linux-3.2.21/sound/arm/bcm2835.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835.h 2012-07-02 13:42:12.544261562 +0200 +@@ -0,0 +1,242 @@ ++/***************************************************************************** ++* Copyright 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef __SOUND_ARM_BCM2835_H ++#define __SOUND_ARM_BCM2835_H ++ ++#define SUBSTREAM_NUM 1 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* #define DUMP_RAW_DATA */ ++//#define AUDIO_DEBUG_ENABLE ++//#define AUDIO_VERBOSE_DEBUG_ENABLE ++ ++/* Debug macros */ ++#ifdef AUDIO_DEBUG_ENABLE ++ ++#ifdef AUDIO_VERBOSE_DEBUG_ENABLE ++ ++#define audio_debug(fmt, arg...) \ ++ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_info(fmt, arg...) \ ++ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#else ++ ++#define audio_debug(fmt, arg...) do {} while (0) ++ ++#define audio_info(fmt, arg...) do {} while (0) ++ ++#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */ ++ ++#else ++ ++#define audio_debug(fmt, arg...) do {} while (0) ++ ++#define audio_info(fmt, arg...) do {} while (0) ++ ++#endif /* AUDIO_DEBUG_ENABLE */ ++ ++#define audio_error(fmt, arg...) \ ++ printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_warning(fmt, arg...) \ ++ printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define audio_alert(fmt, arg...) \ ++ printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) ++ ++#define MAX_SUBSTREAMS (8) ++#define AVAIL_SUBSTREAMS_MASK (0xff) ++ ++#define AUDIO_IPC_BLOCK_NUM_BUFFERS (8) ++#define AUDIO_IPC_BLOCK_BUFFER_SIZE (1024*8) ++ ++#define AUDIO_CONTROL_OFFSET (0x00) ++#define CTRL_EN_SHIFT (0) ++#define CTRL_EN_MASK (0x00000001) ++#define CTRL_PLAY_SHIFT (1) ++#define CTRL_PLAY_MASK (0x00000002) ++#define CTRL_MUTE_SHIFT (2) ++#define CTRL_MUTE_MASK (0x00000004) ++#define CTRL_SETUP_SHIFT (3) ++#define CTRL_SETUP_MASK (0x00000008) ++#define CTRL_FLUSH_SHIFT (4) ++#define CTRL_FLUSH_MASK (0x00000010) ++#define CTRL_STOPMODE_SHIFT (5) ++#define CTRL_STOPMODE_MASK (0x00000020) ++ ++#define AUDIO_STATUS_OFFSET (0x04) ++#define STAT_EN_SHIFT (0) ++#define STAT_EN_MASK (0x00000001) ++#define STAT_PLAY_SHIFT (1) ++#define STAT_PLAY_MASK (0x00000002) ++#define STAT_MUTE_SHIFT (2) ++#define STAT_MUTE_MASK (0x00000004) ++#define STAT_SETUP_SHIFT (3) ++#define STAT_SETUP_MASK (0x00000008) ++#define STAT_FLUSH_SHIFT (4) ++#define STAT_FLUSH_MASK (0x00000010) ++#define STAT_STOPMODE_SHIFT (5) ++#define STAT_STOPMODE_MASK (0x00000020) ++ ++/* Interrupt status */ ++#define AUDIO_INTSTAT_OFFSET (0x08) ++#define INTSTAT_CONTROL_SHIFT (0) ++#define INTSTAT_CONTROL_MASK (0x0000000f) ++#define INTSTAT_FIFO_SHIFT (4) ++#define INTSTAT_FIFO_MASK (0x000000f0) ++ ++/* Configuration */ ++#define AUDIO_DESTINATION_OFFSET (0x0C) ++#define AUDIO_SAMPLE_RATE_OFFSET (0x10) ++#define AUDIO_BIT_RATE_OFFSET (0x14) ++#define AUDIO_VOLUME_OFFSET (0x18) ++#define AUDIO_CHANNELS_OFFSET (0x1C) ++ ++/* Implemention of peterson's algorithm for shared memory semaphores */ ++#define AUDIO_FLAG0_OFFSET (0x20) ++#define AUDIO_FLAG1_OFFSET (0x24) ++#define AUDIO_TURN_OFFSET (0x28) ++ ++/* Fifo registers */ ++#define AUDIO_IN_WRITE_PTR_OFFSET (0x30) ++#define AUDIO_IN_READ_PTR_OFFSET (0x34) ++#define AUDIO_IN_FIFO_SIZE_OFFSET (0x38) ++#define AUDIO_IN_FIFO_ENTRY_OFFSET (0x3C) ++#define AUDIO_IN_FIFO_START_OFFSET (0x40) ++ ++/* 8 entries here of 4 words each = 0x80 gap from 0x50 */ ++#define AUDIO_IN_FIFO_OFFSET (0x50) ++ ++#define AUDIO_OUT_WRITE_PTR_OFFSET (0xD0) ++#define AUDIO_OUT_READ_PTR_OFFSET (0xD4) ++#define AUDIO_OUT_FIFO_SIZE_OFFSET (0xD8) ++#define AUDIO_OUT_FIFO_ENTRY_OFFSET (0xDC) ++#define AUDIO_OUT_FIFO_START_OFFSET (0xE0) ++ ++/* 8 entries here of 4 words each = 0x80 gap from 0xF0 */ ++#define AUDIO_OUT_FIFO_OFFSET (0xF0) ++ ++/* Some constants for values .. */ ++typedef enum { ++ AUDIO_DEST_AUTO = 0, ++ AUDIO_DEST_HEADPHONES = 1, ++ AUDIO_DEST_HDMI = 2, ++ AUDIO_DEST_MAX, ++} SND_BCM2835_ROUTE_T; ++ ++typedef enum { ++ PCM_PLAYBACK_VOLUME, ++ PCM_PLAYBACK_MUTE, ++ PCM_PLAYBACK_DEVICE, ++} SND_BCM2835_CTRL_T; ++ ++/* this struct is tightly packed - its size is 16bytes */ ++typedef struct { ++ uint32_t buffer_id; ++ uint32_t buffer_size; ++ uint32_t buffer_ptr; ++ uint32_t spare; ++ ++} AUDIO_FIFO_ENTRY_T; ++ ++/* definition of the chip-specific record */ ++typedef struct bcm2835_chip { ++ struct snd_card *card; ++ struct snd_pcm *pcm; ++ /* Bitmat for valid reg_base and irq numbers */ ++ uint32_t avail_substreams; ++ struct platform_device *pdev[MAX_SUBSTREAMS]; ++ struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS]; ++ ++ int volume; ++ int dest; ++ int mute; ++} bcm2835_chip_t; ++ ++typedef struct bcm2835_audio_buffer { ++ uint32_t buffer_id; ++ phys_addr_t bus_addr; ++ uint8_t __iomem *start; ++ uint32_t size; ++ uint32_t data_left; ++ struct list_head link; ++ ++} bcm2835_audio_buffer_t; ++ ++typedef struct bcm2835_alsa_stream { ++ bcm2835_chip_t *chip; ++ struct snd_pcm_substream *substream; ++ ++ struct semaphore buffers_update_sem; ++ struct semaphore control_sem; ++ spinlock_t lock; ++ volatile uint32_t control; ++ volatile uint32_t status; ++ ++ int open; ++ int running; ++ int draining; ++ ++#ifdef DUMP_RAW_DATA ++ /* for debug */ ++ int file; ++#endif ++ unsigned int pos; ++ unsigned int buffer_size; ++ unsigned int period_size; ++ ++ uint32_t enable_fifo_irq; ++ irq_handler_t fifo_irq_handler; ++ ++ atomic_t retrieved; ++ struct opaque_AUDIO_INSTANCE_T *instance; ++ struct workqueue_struct *my_wq; ++ int idx; ++} bcm2835_alsa_stream_t; ++ ++int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); ++int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); ++ ++void bcm2835_audio_fifo_get_lock(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_fifo_put_lock(bcm2835_alsa_stream_t * alsa_stream); ++ ++int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, ++ uint32_t channels, uint32_t samplerate, ++ uint32_t bps); ++int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream); ++int bcm2835_audio_set_ctls(bcm2835_chip_t * chip); ++int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count, ++ void *src); ++//uint32_t bcm2835_audio_buffers_consumed_bytes(bcm2835_alsa_stream_t *alsa_stream); ++uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream); ++void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream); ++ ++#endif /* __SOUND_ARM_BCM2835_H */ +diff -Naur linux-3.2.21/sound/arm/bcm2835-pcm.c linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835-pcm.c +--- linux-3.2.21/sound/arm/bcm2835-pcm.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835-pcm.c 2012-07-02 13:42:12.543261541 +0200 @@ -0,0 +1,400 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. @@ -75273,11 +75612,9 @@ index 0000000..ff3eb4e + + return 0; +} -diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c -new file mode 100755 -index 0000000..23c0aa3 ---- /dev/null -+++ b/sound/arm/bcm2835-vchiq.c +diff -Naur linux-3.2.21/sound/arm/bcm2835-vchiq.c linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835-vchiq.c +--- linux-3.2.21/sound/arm/bcm2835-vchiq.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/bcm2835-vchiq.c 2012-07-02 13:42:12.544261562 +0200 @@ -0,0 +1,818 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. @@ -76097,689 +76434,38 @@ index 0000000..23c0aa3 + atomic_sub(count, &alsa_stream->retrieved); + return count; +} -diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c -new file mode 100755 -index 0000000..3f6b0ea ---- /dev/null -+++ b/sound/arm/bcm2835.c -@@ -0,0 +1,424 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#include -+ -+#include -+#include -+#include -+ -+#include "bcm2835.h" -+ -+/* module parameters (see "Module Parameters") */ -+/* SNDRV_CARDS: maximum number of cards supported by this module */ -+static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 }; -+static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL }; -+static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 }; -+ -+/* HACKY global pointers needed for successive probes to work : ssp -+ * But compared against the changes we will have to do in VC audio_ipc code -+ * to export 8 audio_ipc devices as a single IPC device and then monitor all -+ * four devices in a thread, this gets things done quickly and should be easier -+ * to debug if we run into issues -+ */ -+ -+static struct snd_card *g_card = NULL; -+static bcm2835_chip_t *g_chip = NULL; -+ -+static int snd_bcm2835_free(bcm2835_chip_t * chip) -+{ -+ kfree(chip); -+ return 0; -+} -+ -+/* component-destructor -+ * (see "Management of Cards and Components") -+ */ -+static int snd_bcm2835_dev_free(struct snd_device *device) -+{ -+ return snd_bcm2835_free(device->device_data); -+} -+ -+/* chip-specific constructor -+ * (see "Management of Cards and Components") -+ */ -+static int __devinit snd_bcm2835_create(struct snd_card *card, -+ struct platform_device *pdev, -+ bcm2835_chip_t ** rchip) -+{ -+ bcm2835_chip_t *chip; -+ int err; -+ static struct snd_device_ops ops = { -+ .dev_free = snd_bcm2835_dev_free, -+ }; -+ -+ *rchip = NULL; -+ -+ chip = kzalloc(sizeof(*chip), GFP_KERNEL); -+ if (chip == NULL) -+ return -ENOMEM; -+ -+ chip->card = card; -+ -+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); -+ if (err < 0) { -+ snd_bcm2835_free(chip); -+ return err; -+ } -+ -+ *rchip = chip; -+ return 0; -+} -+ -+static int __devinit snd_bcm2835_alsa_probe(struct platform_device *pdev) -+{ -+ static int dev; -+ bcm2835_chip_t *chip; -+ struct snd_card *card; -+ int err; -+ printk(KERN_INFO "### snd_bcm2835_alsa_probe %p ###", pdev); -+ -+ printk -+ ("############ PROBING FOR bcm2835 ALSA device (%d):(%d) ###############\n", -+ dev, enable[dev]); -+ -+ if (dev >= MAX_SUBSTREAMS) -+ return -ENODEV; -+ -+ if (!enable[dev]) { -+ dev++; -+ return -ENOENT; -+ } -+ -+ if (dev > 0) -+ goto add_register_map; -+ -+ printk("Creating card...\n"); -+ err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &g_card); -+ if (err < 0) -+ goto out; -+ -+ snd_card_set_dev(g_card, &pdev->dev); -+ strcpy(g_card->driver, "BRCM bcm2835 ALSA Driver"); -+ strcpy(g_card->shortname, "bcm2835 ALSA"); -+ sprintf(g_card->longname, "%s", g_card->shortname); -+ -+ printk("Creating device/chip ..\n"); -+ err = snd_bcm2835_create(g_card, pdev, &chip); -+ if (err < 0) { -+ printk(KERN_ERR "Failed to create bcm2835 chip\n"); -+ goto out_bcm2835_create; -+ } -+ -+ g_chip = chip; -+ err = snd_bcm2835_new_pcm(chip); -+ if (err < 0) { -+ printk(KERN_ERR "Failed to create new BCM2835 pcm device\n"); -+ goto out_bcm2835_new_pcm; -+ } -+ -+ printk("Adding controls ..\n"); -+ err = snd_bcm2835_new_ctl(chip); -+ if (err < 0) { -+ printk(KERN_ERR "Failed to create new BCM2835 ctl\n"); -+ goto out_bcm2835_new_ctl; -+ } -+ -+add_register_map: -+ card = g_card; -+ chip = g_chip; -+ -+ BUG_ON(!(card && chip)); -+ -+ chip->avail_substreams |= (1 << dev); -+ chip->pdev[dev] = pdev; -+ -+ if (dev == 0) { -+ printk("Registering card ....\n"); -+ err = snd_card_register(card); -+ if (err < 0) { -+ printk(KERN_ERR -+ "Failed to register bcm2835 ALSA card \n"); -+ goto out_card_register; -+ } -+ platform_set_drvdata(pdev, card); -+ printk("bcm2835 ALSA CARD CREATED!\n"); -+ } else { -+ printk("bcm2835 ALSA CHIP CREATED!\n"); -+ platform_set_drvdata(pdev, (void *)dev); -+ } -+ -+ dev++; -+ -+ return 0; -+ -+out_card_register: -+out_bcm2835_new_ctl: -+out_bcm2835_new_pcm: -+out_bcm2835_create: -+ BUG_ON(!g_card); -+ if (snd_card_free(g_card)) -+ printk(KERN_ERR "Failed to free Registered alsa card\n"); -+ g_card = NULL; -+out: -+ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */ -+ printk(KERN_ERR "BCM2835 ALSA Probe failed !!\n"); -+ return err; -+} -+ -+static int snd_bcm2835_alsa_remove(struct platform_device *pdev) -+{ -+ uint32_t idx; -+ void *drv_data; -+ -+ drv_data = platform_get_drvdata(pdev); -+ -+ if (drv_data == (void *)g_card) { -+ /* This is the card device */ -+ snd_card_free((struct snd_card *)drv_data); -+ g_card = NULL; -+ g_chip = NULL; -+ } else { -+ idx = (uint32_t) drv_data; -+ if (g_card != NULL) { -+ BUG_ON(!g_chip); -+ /* We pass chip device numbers in audio ipc devices -+ * other than the one we registered our card with -+ */ -+ idx = (uint32_t) drv_data; -+ BUG_ON(!idx || idx > MAX_SUBSTREAMS); -+ g_chip->avail_substreams &= ~(1 << idx); -+ /* There should be atleast one substream registered -+ * after we are done here, as it wil be removed when -+ * the *remove* is called for the card device -+ */ -+ BUG_ON(!g_chip->avail_substreams); -+ } -+ } -+ -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_PM -+static int snd_bcm2835_alsa_suspend(struct platform_device *pdev, -+ pm_message_t state) -+{ -+ return 0; -+} -+ -+static int snd_bcm2835_alsa_resume(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+#endif -+ -+static struct platform_driver bcm2835_alsa0_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD0", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa1_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD1", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa2_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD2", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa3_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD3", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa4_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD4", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa5_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD5", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa6_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD6", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static struct platform_driver bcm2835_alsa7_driver = { -+ .probe = snd_bcm2835_alsa_probe, -+ .remove = snd_bcm2835_alsa_remove, -+#ifdef CONFIG_PM -+ .suspend = snd_bcm2835_alsa_suspend, -+ .resume = snd_bcm2835_alsa_resume, -+#endif -+ .driver = { -+ .name = "bcm2835_AUD7", -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int __devinit bcm2835_alsa_device_init(void) -+{ -+ int err; -+ err = platform_driver_register(&bcm2835_alsa0_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa0_driver %d .\n", err); -+ goto out; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa1_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa1_driver %d .\n", err); -+ goto unregister_0; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa2_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa2_driver %d .\n", err); -+ goto unregister_1; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa3_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa3_driver %d .\n", err); -+ goto unregister_2; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa4_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa4_driver %d .\n", err); -+ goto unregister_3; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa5_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa5_driver %d .\n", err); -+ goto unregister_4; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa6_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa6_driver %d .\n", err); -+ goto unregister_5; -+ } -+ -+ err = platform_driver_register(&bcm2835_alsa7_driver); -+ if (err) { -+ printk("Error registering bcm2835_alsa7_driver %d .\n", err); -+ goto unregister_6; -+ } -+ printk(KERN_INFO "### BCM2835 ALSA driver init %s ### \n", -+ err ? "FAILED" : "OK"); -+ -+ return 0; -+ -+unregister_6: -+ platform_driver_unregister(&bcm2835_alsa6_driver); -+unregister_5: -+ platform_driver_unregister(&bcm2835_alsa5_driver); -+unregister_4: -+ platform_driver_unregister(&bcm2835_alsa4_driver); -+unregister_3: -+ platform_driver_unregister(&bcm2835_alsa3_driver); -+unregister_2: -+ platform_driver_unregister(&bcm2835_alsa2_driver); -+unregister_1: -+ platform_driver_unregister(&bcm2835_alsa1_driver); -+unregister_0: -+ platform_driver_unregister(&bcm2835_alsa0_driver); -+out: -+ return err; -+} -+ -+static void __devexit bcm2835_alsa_device_exit(void) -+{ -+ platform_driver_unregister(&bcm2835_alsa0_driver); -+ platform_driver_unregister(&bcm2835_alsa1_driver); -+ platform_driver_unregister(&bcm2835_alsa2_driver); -+ platform_driver_unregister(&bcm2835_alsa3_driver); -+ platform_driver_unregister(&bcm2835_alsa4_driver); -+ platform_driver_unregister(&bcm2835_alsa5_driver); -+ platform_driver_unregister(&bcm2835_alsa6_driver); -+ platform_driver_unregister(&bcm2835_alsa7_driver); -+} -+ -+late_initcall(bcm2835_alsa_device_init); -+module_exit(bcm2835_alsa_device_exit); -+ -+MODULE_AUTHOR("Dom Cobley"); -+MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:bcm2835_alsa"); -diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h -new file mode 100755 -index 0000000..134a483 ---- /dev/null -+++ b/sound/arm/bcm2835.h -@@ -0,0 +1,242 @@ -+/***************************************************************************** -+* Copyright 2011 Broadcom Corporation. All rights reserved. -+* -+* Unless you and Broadcom execute a separate written software license -+* agreement governing use of this software, this software is licensed to you -+* under the terms of the GNU General Public License version 2, available at -+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). -+* -+* Notwithstanding the above, under no circumstances may you combine this -+* software in any way with any other Broadcom software provided under a -+* license other than the GPL, without Broadcom's express prior written -+* consent. -+*****************************************************************************/ -+ -+#ifndef __SOUND_ARM_BCM2835_H -+#define __SOUND_ARM_BCM2835_H -+ -+#define SUBSTREAM_NUM 1 -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* #define DUMP_RAW_DATA */ -+//#define AUDIO_DEBUG_ENABLE -+//#define AUDIO_VERBOSE_DEBUG_ENABLE -+ -+/* Debug macros */ -+#ifdef AUDIO_DEBUG_ENABLE -+ -+#ifdef AUDIO_VERBOSE_DEBUG_ENABLE -+ -+#define audio_debug(fmt, arg...) \ -+ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_info(fmt, arg...) \ -+ printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#else -+ -+#define audio_debug(fmt, arg...) do {} while (0) -+ -+#define audio_info(fmt, arg...) do {} while (0) -+ -+#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */ -+ -+#else -+ -+#define audio_debug(fmt, arg...) do {} while (0) -+ -+#define audio_info(fmt, arg...) do {} while (0) -+ -+#endif /* AUDIO_DEBUG_ENABLE */ -+ -+#define audio_error(fmt, arg...) \ -+ printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_warning(fmt, arg...) \ -+ printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define audio_alert(fmt, arg...) \ -+ printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) -+ -+#define MAX_SUBSTREAMS (8) -+#define AVAIL_SUBSTREAMS_MASK (0xff) -+ -+#define AUDIO_IPC_BLOCK_NUM_BUFFERS (8) -+#define AUDIO_IPC_BLOCK_BUFFER_SIZE (1024*8) -+ -+#define AUDIO_CONTROL_OFFSET (0x00) -+#define CTRL_EN_SHIFT (0) -+#define CTRL_EN_MASK (0x00000001) -+#define CTRL_PLAY_SHIFT (1) -+#define CTRL_PLAY_MASK (0x00000002) -+#define CTRL_MUTE_SHIFT (2) -+#define CTRL_MUTE_MASK (0x00000004) -+#define CTRL_SETUP_SHIFT (3) -+#define CTRL_SETUP_MASK (0x00000008) -+#define CTRL_FLUSH_SHIFT (4) -+#define CTRL_FLUSH_MASK (0x00000010) -+#define CTRL_STOPMODE_SHIFT (5) -+#define CTRL_STOPMODE_MASK (0x00000020) -+ -+#define AUDIO_STATUS_OFFSET (0x04) -+#define STAT_EN_SHIFT (0) -+#define STAT_EN_MASK (0x00000001) -+#define STAT_PLAY_SHIFT (1) -+#define STAT_PLAY_MASK (0x00000002) -+#define STAT_MUTE_SHIFT (2) -+#define STAT_MUTE_MASK (0x00000004) -+#define STAT_SETUP_SHIFT (3) -+#define STAT_SETUP_MASK (0x00000008) -+#define STAT_FLUSH_SHIFT (4) -+#define STAT_FLUSH_MASK (0x00000010) -+#define STAT_STOPMODE_SHIFT (5) -+#define STAT_STOPMODE_MASK (0x00000020) -+ -+/* Interrupt status */ -+#define AUDIO_INTSTAT_OFFSET (0x08) -+#define INTSTAT_CONTROL_SHIFT (0) -+#define INTSTAT_CONTROL_MASK (0x0000000f) -+#define INTSTAT_FIFO_SHIFT (4) -+#define INTSTAT_FIFO_MASK (0x000000f0) -+ -+/* Configuration */ -+#define AUDIO_DESTINATION_OFFSET (0x0C) -+#define AUDIO_SAMPLE_RATE_OFFSET (0x10) -+#define AUDIO_BIT_RATE_OFFSET (0x14) -+#define AUDIO_VOLUME_OFFSET (0x18) -+#define AUDIO_CHANNELS_OFFSET (0x1C) -+ -+/* Implemention of peterson's algorithm for shared memory semaphores */ -+#define AUDIO_FLAG0_OFFSET (0x20) -+#define AUDIO_FLAG1_OFFSET (0x24) -+#define AUDIO_TURN_OFFSET (0x28) -+ -+/* Fifo registers */ -+#define AUDIO_IN_WRITE_PTR_OFFSET (0x30) -+#define AUDIO_IN_READ_PTR_OFFSET (0x34) -+#define AUDIO_IN_FIFO_SIZE_OFFSET (0x38) -+#define AUDIO_IN_FIFO_ENTRY_OFFSET (0x3C) -+#define AUDIO_IN_FIFO_START_OFFSET (0x40) -+ -+/* 8 entries here of 4 words each = 0x80 gap from 0x50 */ -+#define AUDIO_IN_FIFO_OFFSET (0x50) -+ -+#define AUDIO_OUT_WRITE_PTR_OFFSET (0xD0) -+#define AUDIO_OUT_READ_PTR_OFFSET (0xD4) -+#define AUDIO_OUT_FIFO_SIZE_OFFSET (0xD8) -+#define AUDIO_OUT_FIFO_ENTRY_OFFSET (0xDC) -+#define AUDIO_OUT_FIFO_START_OFFSET (0xE0) -+ -+/* 8 entries here of 4 words each = 0x80 gap from 0xF0 */ -+#define AUDIO_OUT_FIFO_OFFSET (0xF0) -+ -+/* Some constants for values .. */ -+typedef enum { -+ AUDIO_DEST_AUTO = 0, -+ AUDIO_DEST_HEADPHONES = 1, -+ AUDIO_DEST_HDMI = 2, -+ AUDIO_DEST_MAX, -+} SND_BCM2835_ROUTE_T; -+ -+typedef enum { -+ PCM_PLAYBACK_VOLUME, -+ PCM_PLAYBACK_MUTE, -+ PCM_PLAYBACK_DEVICE, -+} SND_BCM2835_CTRL_T; -+ -+/* this struct is tightly packed - its size is 16bytes */ -+typedef struct { -+ uint32_t buffer_id; -+ uint32_t buffer_size; -+ uint32_t buffer_ptr; -+ uint32_t spare; -+ -+} AUDIO_FIFO_ENTRY_T; -+ -+/* definition of the chip-specific record */ -+typedef struct bcm2835_chip { -+ struct snd_card *card; -+ struct snd_pcm *pcm; -+ /* Bitmat for valid reg_base and irq numbers */ -+ uint32_t avail_substreams; -+ struct platform_device *pdev[MAX_SUBSTREAMS]; -+ struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS]; -+ -+ int volume; -+ int dest; -+ int mute; -+} bcm2835_chip_t; -+ -+typedef struct bcm2835_audio_buffer { -+ uint32_t buffer_id; -+ phys_addr_t bus_addr; -+ uint8_t __iomem *start; -+ uint32_t size; -+ uint32_t data_left; -+ struct list_head link; -+ -+} bcm2835_audio_buffer_t; -+ -+typedef struct bcm2835_alsa_stream { -+ bcm2835_chip_t *chip; -+ struct snd_pcm_substream *substream; -+ -+ struct semaphore buffers_update_sem; -+ struct semaphore control_sem; -+ spinlock_t lock; -+ volatile uint32_t control; -+ volatile uint32_t status; -+ -+ int open; -+ int running; -+ int draining; -+ -+#ifdef DUMP_RAW_DATA -+ /* for debug */ -+ int file; -+#endif -+ unsigned int pos; -+ unsigned int buffer_size; -+ unsigned int period_size; -+ -+ uint32_t enable_fifo_irq; -+ irq_handler_t fifo_irq_handler; -+ -+ atomic_t retrieved; -+ struct opaque_AUDIO_INSTANCE_T *instance; -+ struct workqueue_struct *my_wq; -+ int idx; -+} bcm2835_alsa_stream_t; -+ -+int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); -+int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); -+ -+void bcm2835_audio_fifo_get_lock(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_fifo_put_lock(bcm2835_alsa_stream_t * alsa_stream); -+ -+int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, -+ uint32_t channels, uint32_t samplerate, -+ uint32_t bps); -+int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream); -+int bcm2835_audio_set_ctls(bcm2835_chip_t * chip); -+int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count, -+ void *src); -+//uint32_t bcm2835_audio_buffers_consumed_bytes(bcm2835_alsa_stream_t *alsa_stream); -+uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream); -+void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream); -+ -+#endif /* __SOUND_ARM_BCM2835_H */ -diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h -new file mode 100644 -index 0000000..d610734 ---- /dev/null -+++ b/sound/arm/vc_vchi_audioserv_defs.h +diff -Naur linux-3.2.21/sound/arm/Kconfig linux-3.2.21-bootc-5b0ccb0/sound/arm/Kconfig +--- linux-3.2.21/sound/arm/Kconfig 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/Kconfig 2012-07-02 13:42:12.544261562 +0200 +@@ -39,5 +39,12 @@ + Say Y or M if you want to support any AC97 codec attached to + the PXA2xx AC97 interface. + ++config SND_BCM2835 ++ tristate "BCM2835 ALSA driver" ++ depends on ARCH_BCM2708 && SND ++ select SND_PCM ++ help ++ Say Y or M if you want to support BCM2835 Alsa pcm card driver ++ + endif # SND_ARM + +diff -Naur linux-3.2.21/sound/arm/Makefile linux-3.2.21-bootc-5b0ccb0/sound/arm/Makefile +--- linux-3.2.21/sound/arm/Makefile 2012-06-20 00:18:30.000000000 +0200 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/Makefile 2012-07-02 13:42:12.543261541 +0200 +@@ -14,3 +14,9 @@ + + obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o + snd-pxa2xx-ac97-objs := pxa2xx-ac97.o ++ ++obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o ++snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o ++ ++EXTRA_CFLAGS += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000 ++ +diff -Naur linux-3.2.21/sound/arm/vc_vchi_audioserv_defs.h linux-3.2.21-bootc-5b0ccb0/sound/arm/vc_vchi_audioserv_defs.h +--- linux-3.2.21/sound/arm/vc_vchi_audioserv_defs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.2.21-bootc-5b0ccb0/sound/arm/vc_vchi_audioserv_defs.h 2012-07-02 13:42:12.544261562 +0200 @@ -0,0 +1,112 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved.