diff --git a/packages/linux/patches/linux-3.1.10-601-RPi_support-0.1.patch b/packages/linux/patches/linux-3.1.10-601-RPi_support-0.1.patch index bb8def0570..9d4107db07 100644 --- a/packages/linux/patches/linux-3.1.10-601-RPi_support-0.1.patch +++ b/packages/linux/patches/linux-3.1.10-601-RPi_support-0.1.patch @@ -1,6 +1,70 @@ +diff -Naur linux-3.1.10/arch/arm/Kconfig linux-3.1.10.patch/arch/arm/Kconfig +--- linux-3.1.10/arch/arm/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/Kconfig 2012-04-28 22:26:48.527710568 +0200 +@@ -896,6 +896,19 @@ + 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 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 +@@ -1042,6 +1055,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.1.10/arch/arm/Makefile linux-3.1.10.patch/arch/arm/Makefile +--- linux-3.1.10/arch/arm/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/Makefile 2012-04-28 22:26:48.527710568 +0200 +@@ -196,6 +196,7 @@ + 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 -Naur linux-3.1.10/arch/arm/boot/compressed/Makefile linux-3.1.10.patch/arch/arm/boot/compressed/Makefile +--- linux-3.1.10/arch/arm/boot/compressed/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/boot/compressed/Makefile 2012-04-28 22:26:48.528710588 +0200 +@@ -121,11 +121,17 @@ + LDFLAGS_vmlinux += -T + + # For __aeabi_uidivmod +-lib1funcs = $(obj)/lib1funcs.o ++lib1funcs = $(obj)/lib1funcs.o $(obj)/divdi3.o + + $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE + $(call cmd,shipped) + ++$(obj)/longlong.h: $(srctree)/arch/$(SRCARCH)/lib/longlong.h FORCE ++ $(call cmd,shipped) ++ ++$(obj)/divdi3.c: $(srctree)/arch/$(SRCARCH)/lib/divdi3.c $(obj)/longlong.h FORCE ++ $(call cmd,shipped) ++ + # We need to prevent any GOTOFF relocs being used with references + # to symbols in the .bss section since we cannot relocate them + # independently from the rest at run time. This can be achieved by diff -Naur linux-3.1.10/arch/arm/boot/compressed/divdi3.c linux-3.1.10.patch/arch/arm/boot/compressed/divdi3.c --- linux-3.1.10/arch/arm/boot/compressed/divdi3.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/boot/compressed/divdi3.c 2012-04-15 16:07:15.106922186 +0200 ++++ linux-3.1.10.patch/arch/arm/boot/compressed/divdi3.c 2012-04-28 22:26:48.529710608 +0200 @@ -0,0 +1,338 @@ +/* 64-bit multiplication and division + Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003 @@ -342,7 +406,7 @@ diff -Naur linux-3.1.10/arch/arm/boot/compressed/divdi3.c linux-3.1.10.patch/arc +} diff -Naur linux-3.1.10/arch/arm/boot/compressed/longlong.h linux-3.1.10.patch/arch/arm/boot/compressed/longlong.h --- linux-3.1.10/arch/arm/boot/compressed/longlong.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/boot/compressed/longlong.h 2012-04-15 16:07:15.106922186 +0200 ++++ linux-3.1.10.patch/arch/arm/boot/compressed/longlong.h 2012-04-28 22:26:48.530710628 +0200 @@ -0,0 +1,151 @@ +/* longlong.h -- based on code from gcc-2.95.3 + @@ -495,31 +559,9 @@ diff -Naur linux-3.1.10/arch/arm/boot/compressed/longlong.h linux-3.1.10.patch/a + +#define UDIV_NEEDS_NORMALIZATION 1 +#define udiv_qrnnd __udiv_qrnnd_c -diff -Naur linux-3.1.10/arch/arm/boot/compressed/Makefile linux-3.1.10.patch/arch/arm/boot/compressed/Makefile ---- linux-3.1.10/arch/arm/boot/compressed/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/boot/compressed/Makefile 2012-04-15 16:07:15.105922166 +0200 -@@ -121,11 +121,17 @@ - LDFLAGS_vmlinux += -T - - # For __aeabi_uidivmod --lib1funcs = $(obj)/lib1funcs.o -+lib1funcs = $(obj)/lib1funcs.o $(obj)/divdi3.o - - $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE - $(call cmd,shipped) - -+$(obj)/longlong.h: $(srctree)/arch/$(SRCARCH)/lib/longlong.h FORCE -+ $(call cmd,shipped) -+ -+$(obj)/divdi3.c: $(srctree)/arch/$(SRCARCH)/lib/divdi3.c $(obj)/longlong.h FORCE -+ $(call cmd,shipped) -+ - # We need to prevent any GOTOFF relocs being used with references - # to symbols in the .bss section since we cannot relocate them - # independently from the rest at run time. This can be achieved by diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_cutdown_defconfig linux-3.1.10.patch/arch/arm/configs/bcmrpi_cutdown_defconfig --- linux-3.1.10/arch/arm/configs/bcmrpi_cutdown_defconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/configs/bcmrpi_cutdown_defconfig 2012-04-15 16:07:15.300925993 +0200 ++++ linux-3.1.10.patch/arch/arm/configs/bcmrpi_cutdown_defconfig 2012-04-28 22:26:48.891717987 +0200 @@ -0,0 +1,494 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set @@ -613,7 +655,7 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_cutdown_defconfig linux-3.1.10.p +CONFIG_MISC_DEVICES=y +CONFIG_SCSI=y +# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=m ++CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=m +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_LOWLEVEL is not set @@ -815,7 +857,7 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_cutdown_defconfig linux-3.1.10.p +CONFIG_USB_STORAGE_KARMA=m +CONFIG_USB_STORAGE_CYPRESS_ATACB=m +CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_UAS=m ++CONFIG_USB_UAS=y +CONFIG_USB_LIBUSUAL=y +CONFIG_USB_MDC800=m +CONFIG_USB_MICROTEK=m @@ -1017,7 +1059,7 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_cutdown_defconfig linux-3.1.10.p +CONFIG_LIBCRC32C=y diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_defconfig linux-3.1.10.patch/arch/arm/configs/bcmrpi_defconfig --- linux-3.1.10/arch/arm/configs/bcmrpi_defconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/configs/bcmrpi_defconfig 2012-04-15 16:07:15.300925993 +0200 ++++ linux-3.1.10.patch/arch/arm/configs/bcmrpi_defconfig 2012-04-28 22:26:48.892718008 +0200 @@ -0,0 +1,530 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set @@ -1127,7 +1169,7 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_defconfig linux-3.1.10.patch/arc +CONFIG_MISC_DEVICES=y +CONFIG_SCSI=y +# CONFIG_SCSI_PROC_FS is not set -+CONFIG_BLK_DEV_SD=m ++CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=m +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_LOWLEVEL is not set @@ -1330,7 +1372,7 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_defconfig linux-3.1.10.patch/arc +CONFIG_USB_STORAGE_KARMA=m +CONFIG_USB_STORAGE_CYPRESS_ATACB=m +CONFIG_USB_STORAGE_ENE_UB6250=m -+CONFIG_USB_UAS=m ++CONFIG_USB_UAS=y +CONFIG_USB_LIBUSUAL=y +CONFIG_USB_MDC800=m +CONFIG_USB_MICROTEK=m @@ -1551,7 +1593,7 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_defconfig linux-3.1.10.patch/arc +CONFIG_LIBCRC32C=y diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_emergency_defconfig linux-3.1.10.patch/arch/arm/configs/bcmrpi_emergency_defconfig --- linux-3.1.10/arch/arm/configs/bcmrpi_emergency_defconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/configs/bcmrpi_emergency_defconfig 2012-04-15 16:07:15.267925345 +0200 ++++ linux-3.1.10.patch/arch/arm/configs/bcmrpi_emergency_defconfig 2012-04-28 22:26:48.809716315 +0200 @@ -0,0 +1,475 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set @@ -2028,40 +2070,9 @@ diff -Naur linux-3.1.10/arch/arm/configs/bcmrpi_emergency_defconfig linux-3.1.10 +# CONFIG_CRYPTO_HW is not set +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -diff -Naur linux-3.1.10/arch/arm/Kconfig linux-3.1.10.patch/arch/arm/Kconfig ---- linux-3.1.10/arch/arm/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/Kconfig 2012-04-15 16:07:15.104922146 +0200 -@@ -896,6 +896,19 @@ - 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 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 -@@ -1042,6 +1055,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.1.10/arch/arm/kernel/armksyms.c linux-3.1.10.patch/arch/arm/kernel/armksyms.c --- linux-3.1.10/arch/arm/kernel/armksyms.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/kernel/armksyms.c 2012-04-15 16:07:15.109922246 +0200 ++++ linux-3.1.10.patch/arch/arm/kernel/armksyms.c 2012-04-28 22:26:48.533710691 +0200 @@ -46,6 +46,8 @@ extern void __aeabi_uidiv(void); extern void __aeabi_uidivmod(void); @@ -2080,9 +2091,22 @@ diff -Naur linux-3.1.10/arch/arm/kernel/armksyms.c linux-3.1.10.patch/arch/arm/k #endif /* bitops */ +diff -Naur linux-3.1.10/arch/arm/lib/Makefile linux-3.1.10.patch/arch/arm/lib/Makefile +--- linux-3.1.10/arch/arm/lib/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/lib/Makefile 2012-04-28 22:26:48.598712009 +0200 +@@ -13,7 +13,8 @@ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +- io-readsb.o io-writesb.o io-readsl.o io-writesl.o ++ io-readsb.o io-writesb.o io-readsl.o io-writesl.o \ ++ divdi3.o + + mmu-y := clear_user.o copy_page.o getuser.o putuser.o + diff -Naur linux-3.1.10/arch/arm/lib/divdi3.c linux-3.1.10.patch/arch/arm/lib/divdi3.c --- linux-3.1.10/arch/arm/lib/divdi3.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/lib/divdi3.c 2012-04-15 16:07:15.110922265 +0200 ++++ linux-3.1.10.patch/arch/arm/lib/divdi3.c 2012-04-28 22:26:48.599712034 +0200 @@ -0,0 +1,338 @@ +/* 64-bit multiplication and division + Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003 @@ -2424,7 +2448,7 @@ diff -Naur linux-3.1.10/arch/arm/lib/divdi3.c linux-3.1.10.patch/arch/arm/lib/di +} diff -Naur linux-3.1.10/arch/arm/lib/lib1funcs.S linux-3.1.10.patch/arch/arm/lib/lib1funcs.S --- linux-3.1.10/arch/arm/lib/lib1funcs.S 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/lib/lib1funcs.S 2012-04-15 16:07:15.110922265 +0200 ++++ linux-3.1.10.patch/arch/arm/lib/lib1funcs.S 2012-04-28 22:26:48.600712056 +0200 @@ -349,6 +349,33 @@ UNWIND(.fnend) ENDPROC(__aeabi_idivmod) @@ -2461,7 +2485,7 @@ diff -Naur linux-3.1.10/arch/arm/lib/lib1funcs.S linux-3.1.10.patch/arch/arm/lib Ldiv0: diff -Naur linux-3.1.10/arch/arm/lib/longlong.h linux-3.1.10.patch/arch/arm/lib/longlong.h --- linux-3.1.10/arch/arm/lib/longlong.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/lib/longlong.h 2012-04-15 16:07:15.111922284 +0200 ++++ linux-3.1.10.patch/arch/arm/lib/longlong.h 2012-04-28 22:26:48.601712077 +0200 @@ -0,0 +1,151 @@ +/* longlong.h -- based on code from gcc-2.95.3 + @@ -2614,22 +2638,64 @@ diff -Naur linux-3.1.10/arch/arm/lib/longlong.h linux-3.1.10.patch/arch/arm/lib/ + +#define UDIV_NEEDS_NORMALIZATION 1 +#define udiv_qrnnd __udiv_qrnnd_c -diff -Naur linux-3.1.10/arch/arm/lib/Makefile linux-3.1.10.patch/arch/arm/lib/Makefile ---- linux-3.1.10/arch/arm/lib/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/lib/Makefile 2012-04-15 16:07:15.109922246 +0200 -@@ -13,7 +13,8 @@ - testchangebit.o testclearbit.o testsetbit.o \ - ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ - ucmpdi2.o lib1funcs.o div64.o \ -- io-readsb.o io-writesb.o io-readsl.o io-writesl.o -+ io-readsb.o io-writesb.o io-readsl.o io-writesl.o \ -+ divdi3.o - - mmu-y := clear_user.o copy_page.o getuser.o putuser.o - +diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/Kconfig linux-3.1.10.patch/arch/arm/mach-bcm2708/Kconfig +--- linux-3.1.10/arch/arm/mach-bcm2708/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/Kconfig 2012-04-28 22:26:48.811716356 +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.1.10/arch/arm/mach-bcm2708/Makefile linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile +--- linux-3.1.10/arch/arm/mach-bcm2708/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile 2012-04-28 22:26:48.602712097 +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.1.10/arch/arm/mach-bcm2708/Makefile.boot linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile.boot +--- linux-3.1.10/arch/arm/mach-bcm2708/Makefile.boot 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile.boot 2012-04-28 22:26:48.602712097 +0200 +@@ -0,0 +1,3 @@ ++ zreladdr-y := 0x00008000 ++params_phys-y := 0x00000100 ++initrd_phys-y := 0x00800000 diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/armctrl.c linux-3.1.10.patch/arch/arm/mach-bcm2708/armctrl.c --- linux-3.1.10/arch/arm/mach-bcm2708/armctrl.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/armctrl.c 2012-04-15 16:07:15.113922323 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/armctrl.c 2012-04-28 22:26:48.603712117 +0200 @@ -0,0 +1,399 @@ +/* + * linux/arch/arm/mach-bcm2708/armctrl.c @@ -3032,7 +3098,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/armctrl.c linux-3.1.10.patch/arch/ +} diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/armctrl.h linux-3.1.10.patch/arch/arm/mach-bcm2708/armctrl.h --- linux-3.1.10/arch/arm/mach-bcm2708/armctrl.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/armctrl.h 2012-04-15 16:07:15.113922323 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/armctrl.h 2012-04-28 22:26:48.604712137 +0200 @@ -0,0 +1,27 @@ +/* + * linux/arch/arm/mach-bcm2708/armctrl.h @@ -3063,8 +3129,8 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/armctrl.h linux-3.1.10.patch/arch/ +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.c --- linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.c 2012-04-15 16:07:15.293925856 +0200 -@@ -0,0 +1,666 @@ ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.c 2012-04-28 22:26:48.893718028 +0200 +@@ -0,0 +1,649 @@ +/* + * linux/arch/arm/mach-bcm2708/bcm2708.c + * @@ -3152,69 +3218,54 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ + .virtual = IO_ADDRESS(ARMCTRL_BASE), + .pfn = __phys_to_pfn(ARMCTRL_BASE), + .length = SZ_4K, -+ .type = MT_DEVICE}, { -+ .virtual = IO_ADDRESS(UART0_BASE), -+ .pfn = __phys_to_pfn(UART0_BASE), -+ .length = SZ_4K, -+ .type = MT_DEVICE}, { -+ .virtual = -+ IO_ADDRESS(UART1_BASE), -+ .pfn = -+ __phys_to_pfn(UART1_BASE), -+ .length = SZ_4K, -+ .type = MT_DEVICE}, { -+#ifdef CONFIG_MMC_BCM2708 /* broadcom legacy SD */ -+ . -+ virtual -+ = -+ IO_ADDRESS -+ (MMCI0_BASE), -+ .pfn = -+ __phys_to_pfn -+ (MMCI0_BASE), -+ . -+ length = -+ SZ_4K, -+ .type = -+ MT_DEVICE}, ++ .type = MT_DEVICE}, + { ++ .virtual = IO_ADDRESS(UART0_BASE), ++ .pfn = __phys_to_pfn(UART0_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(UART1_BASE), ++ .pfn = __phys_to_pfn(UART1_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++#ifdef CONFIG_MMC_BCM2708 /* broadcom legacy SD */ ++ { ++ .virtual = IO_ADDRESS(MMCI0_BASE), ++ .pfn = __phys_to_pfn(MMCI0_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, +#endif ++ { + .virtual = IO_ADDRESS(DMA_BASE), + .pfn = __phys_to_pfn(DMA_BASE), + .length = SZ_4K, -+ .type = MT_DEVICE}, { -+ .virtual = IO_ADDRESS(MCORE_BASE), -+ .pfn = __phys_to_pfn(MCORE_BASE), -+ .length = SZ_4K, -+ .type = MT_DEVICE}, { -+ .virtual = -+ IO_ADDRESS(ST_BASE), -+ .pfn = -+ __phys_to_pfn(ST_BASE), -+ .length = SZ_4K, -+ .type = MT_DEVICE}, { -+ . -+ virtual -+ = -+ IO_ADDRESS -+ (USB_BASE), -+ .pfn = -+ __phys_to_pfn -+ (USB_BASE), -+ . -+ length = -+ SZ_128K, -+ .type = -+ MT_DEVICE}, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(MCORE_BASE), ++ .pfn = __phys_to_pfn(MCORE_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(ST_BASE), ++ .pfn = __phys_to_pfn(ST_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(USB_BASE), ++ .pfn = __phys_to_pfn(USB_BASE), ++ .length = SZ_128K, ++ .type = MT_DEVICE}, + { + .virtual = IO_ADDRESS(PM_BASE), + .pfn = __phys_to_pfn(PM_BASE), + .length = SZ_4K, -+ .type = MT_DEVICE}, { -+ .virtual = IO_ADDRESS(GPIO_BASE), -+ .pfn = __phys_to_pfn(GPIO_BASE), -+ .length = SZ_4K, -+ .type = MT_DEVICE} ++ .type = MT_DEVICE}, ++ { ++ .virtual = IO_ADDRESS(GPIO_BASE), ++ .pfn = __phys_to_pfn(GPIO_BASE), ++ .length = SZ_4K, ++ .type = MT_DEVICE} +}; + +void __init bcm2708_map_io(void) @@ -3228,15 +3279,15 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ +static cycle_t stc_read_cycles(struct clocksource *cs) +{ + /* STC: a free running counter that increments at the rate of 1MHz */ -+ return (cycle_t)readl(__io_address(ST_BASE+0x04)); ++ return (cycle_t) readl(__io_address(ST_BASE + 0x04)); +} + +static struct clocksource clocksource_stc = { -+ .name = "stc", -+ .rating = 300, -+ .read = stc_read_cycles, -+ .mask = CLOCKSOURCE_MASK(32), -+ .flags = CLOCK_SOURCE_IS_CONTINUOUS, ++ .name = "stc", ++ .rating = 300, ++ .read = stc_read_cycles, ++ .mask = CLOCKSOURCE_MASK(32), ++ .flags = CLOCK_SOURCE_IS_CONTINUOUS, +}; + +unsigned long frc_clock_ticks32(void) @@ -3247,19 +3298,16 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ +static void __init bcm2708_clocksource_init(void) +{ + // calculate .shift and .mult values and register clocksource -+ if (clocksource_register_hz(&clocksource_stc, STC_FREQ_HZ)) -+ { ++ if (clocksource_register_hz(&clocksource_stc, STC_FREQ_HZ)) { + printk(KERN_ERR "timer: failed to initialize clock " -+ "source %s\n", clocksource_stc.name); ++ "source %s\n", clocksource_stc.name); + } +} + +unsigned long long sched_clock(void) +{ -+ return clocksource_cyc2ns(clocksource_stc.read( -+ &clocksource_stc), -+ clocksource_stc.mult, -+ clocksource_stc.shift); ++ return clocksource_cyc2ns(clocksource_stc.read(&clocksource_stc), ++ clocksource_stc.mult, clocksource_stc.shift); +} + +/* @@ -3336,11 +3384,12 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ + .start = MMCI0_BASE, + .end = MMCI0_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, -+ }, { -+ .start = IRQ_SDIO, -+ .end = IRQ_SDIO, -+ .flags = IORESOURCE_IRQ, -+ } ++ }, ++ { ++ .start = IRQ_SDIO, ++ .end = IRQ_SDIO, ++ .flags = IORESOURCE_IRQ, ++ } +}; + +static struct platform_device bcm2708_mci_device = { @@ -3465,11 +3514,12 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ + .start = ST_BASE, + .end = ST_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, -+ }, { -+ .start = IRQ_TIMER3, -+ .end = IRQ_TIMER3, -+ .flags = IORESOURCE_IRQ, -+ } ++ }, ++ { ++ .start = IRQ_TIMER3, ++ .end = IRQ_TIMER3, ++ .flags = IORESOURCE_IRQ, ++ } + +}; + @@ -3534,14 +3584,13 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ + .coherent_dma_mask = 0xffffffffUL}, +}; + -+ +static struct platform_device bcm2708_alsa_devices[] = { -+ [0] = { -+ .name = "bcm2835_AUD0", -+ .id = 0, /* first audio device */ -+ .resource = 0, -+ .num_resources = 0, -+ }, ++ [0] = { ++ .name = "bcm2835_AUD0", ++ .id = 0, /* first audio device */ ++ .resource = 0, ++ .num_resources = 0, ++ }, +}; + +int __init bcm_register_device(struct platform_device *pdev) @@ -3727,13 +3776,68 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.c linux-3.1.10.patch/arch/ + +MACHINE_START(BCM2708, "BCM2708") + /* Maintainer: Broadcom Europe Ltd. */ -+.map_io = bcm2708_map_io,.init_irq = bcm2708_init_irq,.timer = ++ .map_io = bcm2708_map_io,.init_irq = bcm2708_init_irq,.timer = + &bcm2708_timer,.init_machine = + bcm2708_init, MACHINE_END module_param(boardrev, uint, 0644); +module_param(serial, uint, 0644); +diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.h linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.h +--- linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.h 2012-04-28 22:26:48.606712178 +0200 +@@ -0,0 +1,51 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/bcm2708.h ++ * ++ * BCM2708 machine support header ++ * ++ * 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 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 __BCM2708_BCM2708_H ++#define __BCM2708_BCM2708_H ++ ++#include ++ ++extern void __init bcm2708_init(void); ++extern void __init bcm2708_init_irq(void); ++extern void __init bcm2708_map_io(void); ++extern struct sys_timer bcm2708_timer; ++extern unsigned int mmc_status(struct device *dev); ++ ++#define AMBA_DEVICE(name, busid, base, plat) \ ++static struct amba_device name##_device = { \ ++ .dev = { \ ++ .coherent_dma_mask = ~0, \ ++ .init_name = busid, \ ++ .platform_data = plat, \ ++ }, \ ++ .res = { \ ++ .start = base##_BASE, \ ++ .end = (base##_BASE) + SZ_4K - 1,\ ++ .flags = IORESOURCE_MEM, \ ++ }, \ ++ .dma_mask = ~0, \ ++ .irq = base##_IRQ, \ ++ /* .dma = base##_DMA,*/ \ ++} ++ ++#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708_gpio.c linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708_gpio.c --- linux-3.1.10/arch/arm/mach-bcm2708/bcm2708_gpio.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708_gpio.c 2012-04-15 16:07:15.116922383 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708_gpio.c 2012-04-28 22:26:48.607712199 +0200 @@ -0,0 +1,323 @@ +/* + * linux/arch/arm/mach-bcm2708/bcm2708_gpio.c @@ -4058,64 +4162,9 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708_gpio.c linux-3.1.10.patch/ +MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver"); +MODULE_LICENSE("GPL"); + -diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.h linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.h ---- linux-3.1.10/arch/arm/mach-bcm2708/bcm2708.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/bcm2708.h 2012-04-15 16:07:15.115922363 +0200 -@@ -0,0 +1,51 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/bcm2708.h -+ * -+ * BCM2708 machine support header -+ * -+ * 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 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 __BCM2708_BCM2708_H -+#define __BCM2708_BCM2708_H -+ -+#include -+ -+extern void __init bcm2708_init(void); -+extern void __init bcm2708_init_irq(void); -+extern void __init bcm2708_map_io(void); -+extern struct sys_timer bcm2708_timer; -+extern unsigned int mmc_status(struct device *dev); -+ -+#define AMBA_DEVICE(name, busid, base, plat) \ -+static struct amba_device name##_device = { \ -+ .dev = { \ -+ .coherent_dma_mask = ~0, \ -+ .init_name = busid, \ -+ .platform_data = plat, \ -+ }, \ -+ .res = { \ -+ .start = base##_BASE, \ -+ .end = (base##_BASE) + SZ_4K - 1,\ -+ .flags = IORESOURCE_MEM, \ -+ }, \ -+ .dma_mask = ~0, \ -+ .irq = base##_IRQ, \ -+ /* .dma = base##_DMA,*/ \ -+} -+ -+#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/clock.c linux-3.1.10.patch/arch/arm/mach-bcm2708/clock.c --- linux-3.1.10/arch/arm/mach-bcm2708/clock.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/clock.c 2012-04-15 16:07:15.116922383 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/clock.c 2012-04-28 22:26:48.631712687 +0200 @@ -0,0 +1,61 @@ +/* + * linux/arch/arm/mach-bcm2708/clock.c @@ -4180,7 +4229,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/clock.c linux-3.1.10.patch/arch/ar +EXPORT_SYMBOL(clk_set_rate); diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/clock.h linux-3.1.10.patch/arch/arm/mach-bcm2708/clock.h --- linux-3.1.10/arch/arm/mach-bcm2708/clock.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/clock.h 2012-04-15 16:07:15.116922383 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/clock.h 2012-04-28 22:26:48.631712687 +0200 @@ -0,0 +1,24 @@ +/* + * linux/arch/arm/mach-bcm2708/clock.h @@ -4208,7 +4257,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/clock.h linux-3.1.10.patch/arch/ar +}; diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/dma.c linux-3.1.10.patch/arch/arm/mach-bcm2708/dma.c --- linux-3.1.10/arch/arm/mach-bcm2708/dma.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/dma.c 2012-04-15 16:07:15.117922403 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/dma.c 2012-04-28 22:26:48.632712707 +0200 @@ -0,0 +1,397 @@ +/* + * linux/arch/arm/mach-bcm2708/dma.c @@ -4609,7 +4658,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/dma.c linux-3.1.10.patch/arch/arm/ +MODULE_PARM_DESC(dmachans, "Bitmap of DMA channels available to the ARM"); diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/arm_control.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/arm_control.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/arm_control.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/arm_control.h 2012-04-15 16:07:15.119922441 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/arm_control.h 2012-04-28 22:26:48.634712748 +0200 @@ -0,0 +1,419 @@ +/* + * linux/arch/arm/mach-bcm2708/arm_control.h @@ -5032,7 +5081,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/arm_control.h linux-3 +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/arm_power.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/arm_power.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/arm_power.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/arm_power.h 2012-04-15 16:07:15.119922441 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/arm_power.h 2012-04-28 22:26:48.635712769 +0200 @@ -0,0 +1,60 @@ +/* + * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h @@ -5096,7 +5145,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/arm_power.h linux-3.1 +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/clkdev.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/clkdev.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/clkdev.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/clkdev.h 2012-04-15 16:07:15.119922441 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/clkdev.h 2012-04-28 22:26:48.635712769 +0200 @@ -0,0 +1,7 @@ +#ifndef __ASM_MACH_CLKDEV_H +#define __ASM_MACH_CLKDEV_H @@ -5107,7 +5156,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/clkdev.h linux-3.1.10 +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/debug-macro.S linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/debug-macro.S --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/debug-macro.S 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/debug-macro.S 2012-04-15 16:07:15.120922460 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/debug-macro.S 2012-04-28 22:26:48.635712769 +0200 @@ -0,0 +1,24 @@ +/* arch/arm/mach-bcm2708/include/mach/debug-macro.S + * @@ -5135,7 +5184,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/debug-macro.S linux-3 +#include diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/dma.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/dma.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/dma.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/dma.h 2012-04-15 16:07:15.120922460 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/dma.h 2012-04-28 22:26:48.636712790 +0200 @@ -0,0 +1,84 @@ +/* + * linux/arch/arm/mach-bcm2708/include/mach/dma.h @@ -5223,7 +5272,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/dma.h linux-3.1.10.pa +#endif /* _MACH_BCM2708_DMA_H */ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/entry-macro.S linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/entry-macro.S --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/entry-macro.S 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/entry-macro.S 2012-04-15 16:07:15.121922480 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/entry-macro.S 2012-04-28 22:26:48.637712811 +0200 @@ -0,0 +1,69 @@ +/* + * arch/arm/mach-bcm2708/include/mach/entry-macro.S @@ -5296,7 +5345,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/entry-macro.S linux-3 + .endm diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/frc.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/frc.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/frc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/frc.h 2012-04-15 16:07:15.121922480 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/frc.h 2012-04-28 22:26:48.637712811 +0200 @@ -0,0 +1,38 @@ +/* + * arch/arm/mach-bcm2708/include/mach/timex.h @@ -5338,7 +5387,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/frc.h linux-3.1.10.pa +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/gpio.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/gpio.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/gpio.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/gpio.h 2012-04-15 16:07:15.122922500 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/gpio.h 2012-04-28 22:26:48.638712831 +0200 @@ -0,0 +1,48 @@ +/* + * arch/arm/mach-bcm2708/include/mach/gpio.h @@ -5390,7 +5439,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/gpio.h linux-3.1.10.p +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/hardware.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/hardware.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/hardware.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/hardware.h 2012-04-15 16:07:15.122922500 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/hardware.h 2012-04-28 22:26:48.638712831 +0200 @@ -0,0 +1,28 @@ +/* + * arch/arm/mach-bcm2708/include/mach/hardware.h @@ -5422,7 +5471,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/hardware.h linux-3.1. +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/io.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/io.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/io.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/io.h 2012-04-15 16:07:15.122922500 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/io.h 2012-04-28 22:26:48.639712851 +0200 @@ -0,0 +1,28 @@ +/* + * arch/arm/mach-bcm2708/include/mach/io.h @@ -5454,7 +5503,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/io.h linux-3.1.10.pat +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/irqs.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/irqs.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/irqs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/irqs.h 2012-04-15 16:07:15.123922520 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/irqs.h 2012-04-28 22:26:48.640712871 +0200 @@ -0,0 +1,190 @@ +/* + * arch/arm/mach-bcm2708/include/mach/irqs.h @@ -5648,7 +5697,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/irqs.h linux-3.1.10.p +#endif /* _BCM2708_IRQS_H_ */ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/irqs.h.orig linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/irqs.h.orig --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/irqs.h.orig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/irqs.h.orig 2012-04-15 16:07:15.124922540 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/irqs.h.orig 2012-04-28 22:26:48.641712891 +0200 @@ -0,0 +1,185 @@ +/* + * arch/arm/mach-bcm2708/include/mach/irqs.h @@ -5837,7 +5886,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/irqs.h.orig linux-3.1 +#define NR_IRQS (64 + 21) diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/memory.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/memory.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/memory.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/memory.h 2012-04-15 16:07:15.269925385 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/memory.h 2012-04-28 22:26:48.811716356 +0200 @@ -0,0 +1,64 @@ +/* + * arch/arm/mach-bcm2708/include/mach/memory.h @@ -5905,7 +5954,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/memory.h linux-3.1.10 +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/platform.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/platform.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/platform.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/platform.h 2012-04-15 16:07:15.125922560 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/platform.h 2012-04-28 22:26:48.642712911 +0200 @@ -0,0 +1,210 @@ +/* + * arch/arm/mach-bcm2708/include/mach/platform.h @@ -6119,7 +6168,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/platform.h linux-3.1. +/* END */ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/platform.h.orig linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/platform.h.orig --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/platform.h.orig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/platform.h.orig 2012-04-15 16:07:15.126922579 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/platform.h.orig 2012-04-28 22:26:48.643712931 +0200 @@ -0,0 +1,210 @@ +/* + * arch/arm/mach-bcm2708/include/mach/platform.h @@ -6333,7 +6382,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/platform.h.orig linux +/* END */ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/power.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/power.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/power.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/power.h 2012-04-15 16:07:15.126922579 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/power.h 2012-04-28 22:26:48.643712931 +0200 @@ -0,0 +1,26 @@ +/* + * linux/arch/arm/mach-bcm2708/power.h @@ -6363,7 +6412,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/power.h linux-3.1.10. +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/system.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/system.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/system.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/system.h 2012-04-15 16:07:15.126922579 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/system.h 2012-04-28 22:26:48.644712952 +0200 @@ -0,0 +1,53 @@ +/* + * arch/arm/mach-bcm2708/include/mach/system.h @@ -6420,7 +6469,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/system.h linux-3.1.10 +#endif diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/timex.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/timex.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/timex.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/timex.h 2012-04-15 16:07:15.127922598 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/timex.h 2012-04-28 22:26:48.644712952 +0200 @@ -0,0 +1,23 @@ +/* + * arch/arm/mach-bcm2708/include/mach/timex.h @@ -6447,7 +6496,7 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/timex.h linux-3.1.10. +#define CLOCK_TICK_RATE (1000000) diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/uncompress.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/uncompress.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/uncompress.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/uncompress.h 2012-04-15 16:07:15.127922598 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/uncompress.h 2012-04-28 22:26:48.645712973 +0200 @@ -0,0 +1,49 @@ +/* + * arch/arm/mach-bcn2708/include/mach/uncompress.h @@ -6498,9 +6547,48 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/uncompress.h linux-3. + */ +#define arch_decomp_setup() +#define arch_decomp_wdog() +diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vc_mem.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vc_mem.h +--- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vc_mem.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vc_mem.h 2012-04-28 22:26:48.883717824 +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.1.10/arch/arm/mach-bcm2708/include/mach/vcio.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vcio.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vcio.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vcio.h 2012-04-15 16:07:15.128922617 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vcio.h 2012-04-28 22:26:48.646712994 +0200 @@ -0,0 +1,42 @@ +/* + * arch/arm/mach-bcm2708/include/mach/vcio.h @@ -6544,48 +6632,9 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vcio.h linux-3.1.10.p +extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); + +#endif -diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vc_mem.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vc_mem.h ---- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vc_mem.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vc_mem.h 2012-04-15 16:07:15.307926130 +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.1.10/arch/arm/mach-bcm2708/include/mach/vmalloc.h linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vmalloc.h --- linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vmalloc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vmalloc.h 2012-04-15 16:07:15.128922617 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/include/mach/vmalloc.h 2012-04-28 22:26:48.646712994 +0200 @@ -0,0 +1,20 @@ +/* + * arch/arm/mach-bcm2708/include/mach/vmalloc.h @@ -6607,64 +6656,9 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/include/mach/vmalloc.h linux-3.1.1 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define VMALLOC_END (0xd8000000) -diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/Kconfig linux-3.1.10.patch/arch/arm/mach-bcm2708/Kconfig ---- linux-3.1.10/arch/arm/mach-bcm2708/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/Kconfig 2012-04-15 16:07:15.268925365 +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.1.10/arch/arm/mach-bcm2708/Makefile linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile ---- linux-3.1.10/arch/arm/mach-bcm2708/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile 2012-04-15 16:07:15.112922303 +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.1.10/arch/arm/mach-bcm2708/Makefile.boot linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile.boot ---- linux-3.1.10/arch/arm/mach-bcm2708/Makefile.boot 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/Makefile.boot 2012-04-15 16:07:15.112922303 +0200 -@@ -0,0 +1,3 @@ -+ zreladdr-y := 0x00008000 -+params_phys-y := 0x00000100 -+initrd_phys-y := 0x00800000 diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/power.c linux-3.1.10.patch/arch/arm/mach-bcm2708/power.c --- linux-3.1.10/arch/arm/mach-bcm2708/power.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/power.c 2012-04-15 16:07:15.273925463 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/power.c 2012-04-28 22:26:48.817716479 +0200 @@ -0,0 +1,195 @@ +/* + * linux/arch/arm/mach-bcm2708/power.c @@ -6861,9 +6855,479 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/power.c linux-3.1.10.patch/arch/ar +MODULE_AUTHOR("Phil Elwell"); +MODULE_DESCRIPTION("Interface to BCM2708 power management"); +MODULE_LICENSE("GPL"); +diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/vc_mem.c linux-3.1.10.patch/arch/arm/mach-bcm2708/vc_mem.c +--- linux-3.1.10/arch/arm/mach-bcm2708/vc_mem.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/vc_mem.c 2012-04-28 22:26:48.886717884 +0200 +@@ -0,0 +1,466 @@ ++/***************************************************************************** ++* 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. ++*****************************************************************************/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef CONFIG_ARCH_KONA ++#include ++#elif CONFIG_ARCH_BCM2708 ++#else ++#include ++#endif ++ ++#include "mach/vc_mem.h" ++//#include "interface/vchiq_arm/vchiq_connected.h" ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Uncomment to enable debug logging ++//#define ENABLE_DBG ++ ++#if defined(ENABLE_DBG) ++#define LOG_DBG( fmt, ... ) printk( KERN_INFO fmt "\n", ##__VA_ARGS__ ) ++#else ++#define LOG_DBG( fmt, ... ) ++#endif ++#define LOG_ERR( fmt, ... ) printk( KERN_ERR fmt "\n", ##__VA_ARGS__ ) ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++// Proc entry ++static struct proc_dir_entry *vc_mem_proc_entry; ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++#ifdef CONFIG_ARCH_KONA ++ ++#include ++unsigned long mm_vc_mem_phys_addr = VC_EMI; ++ ++#elif CONFIG_ARCH_BCM2708 ++ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++ ++#else ++ ++#include ++unsigned long mm_vc_mem_phys_addr = MM_ADDR_IO_VC_EMI; ++ ++#endif ++ ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ LOG_DBG("%s: called file = 0x%p", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ LOG_DBG("%s: called file = 0x%p", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++ mm_vc_mem_size = 256 * 1024 * 1024; // Static for now ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++ mm_vc_mem_base = 128 * 1024 * 1024; // Static for now ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ vc_mem_get_size(); ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ LOG_DBG("%s: called file = 0x%p", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ LOG_DBG("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ LOG_DBG("%s: VC_MEM_IOC_MEM_SIZE=%u", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ LOG_DBG("%s: VC_MEM_IOC_MEM_BASE=%u", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ LOG_DBG("%s: file = 0x%p returning %d", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ LOG_DBG("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ LOG_ERR("%s: length %ld is too big", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ LOG_ERR("%s: remap_pfn_range failed (rc=%d)", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++/**************************************************************************** ++* ++* vc_mem_proc_read ++* ++***************************************************************************/ ++ ++static int ++vc_mem_proc_read(char *buf, char **start, off_t offset, int count, int *eof, ++ void *data) ++{ ++ char *p = buf; ++ ++ (void) start; ++ (void) count; ++ (void) data; ++ ++ if (offset > 0) { ++ *eof = 1; ++ return 0; ++ } ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ p += sprintf(p, "Videocore memory:\n"); ++ if (mm_vc_mem_phys_addr != 0) ++ p += sprintf(p, " Physical address: 0x%p\n", ++ (void *) mm_vc_mem_phys_addr); ++ else ++ p += sprintf(p, " Physical address: 0x00000000\n"); ++ p += sprintf(p, " Length (bytes): %u\n", mm_vc_mem_size); ++ ++ *eof = 1; ++ return p - buf; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_proc_write ++* ++***************************************************************************/ ++ ++static int ++vc_mem_proc_write(struct file *file, const char __user * buffer, ++ unsigned long count, void *data) ++{ ++ int rc = -EFAULT; ++ char input_str[10]; ++ ++ memset(input_str, 0, sizeof (input_str)); ++ ++ if (count > sizeof (input_str)) { ++ LOG_ERR("%s: input string length too long", __func__); ++ goto out; ++ } ++ ++ if (copy_from_user(input_str, buffer, count - 1)) { ++ LOG_ERR("%s: failed to get input string", __func__); ++ goto out; ++ } ++ ++ if (strncmp(input_str, "connect", strlen("connect")) == 0) { ++ // Get the videocore memory size from the videocore ++ vc_mem_get_size(); ++ } ++ ++ out: ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_connected_init ++* ++* This function is called once the videocore has been connected. ++* ++***************************************************************************/ ++ ++void ++vc_mem_connected_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ LOG_DBG("%s: called", __func__); ++ ++ vc_mem_get_size(); ++ ++ printk("vc-mem: mm_vc_mem_phys_addr = 0x%08lx\n", mm_vc_mem_phys_addr); ++ printk("vc-mem: mm_vc_mem_size = 0x%08x (%u MiB)\n", ++ mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++ vc_mem_proc_entry = create_proc_entry(DRIVER_NAME, 0444, NULL); ++ if (vc_mem_proc_entry == NULL) { ++ rc = -EFAULT; ++ LOG_ERR("%s: create_proc_entry failed", __func__); ++ goto out_device_destroy; ++ } ++ vc_mem_proc_entry->read_proc = vc_mem_proc_read; ++ vc_mem_proc_entry->write_proc = vc_mem_proc_write; ++ ++ vc_mem_inited = 1; ++ return; ++ ++ out_device_destroy: ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ printk(KERN_INFO "vc-mem: Videocore memory driver\n"); ++ ++ //vchiq_add_connected_callback(vc_mem_connected_init); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ LOG_DBG("%s: called", __func__); ++ ++ if (vc_mem_inited) { ++ remove_proc_entry(vc_mem_proc_entry->name, NULL); ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/vcio.c linux-3.1.10.patch/arch/arm/mach-bcm2708/vcio.c --- linux-3.1.10/arch/arm/mach-bcm2708/vcio.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/vcio.c 2012-04-15 16:07:15.130922657 +0200 ++++ linux-3.1.10.patch/arch/arm/mach-bcm2708/vcio.c 2012-04-28 22:26:48.649713054 +0200 @@ -0,0 +1,309 @@ +/* + * linux/arch/arm/mach-bcm2708/vcio.c @@ -7174,490 +7638,21 @@ diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/vcio.c linux-3.1.10.patch/arch/arm +MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:bcm-mbox"); -diff -Naur linux-3.1.10/arch/arm/mach-bcm2708/vc_mem.c linux-3.1.10.patch/arch/arm/mach-bcm2708/vc_mem.c ---- linux-3.1.10/arch/arm/mach-bcm2708/vc_mem.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mach-bcm2708/vc_mem.c 2012-04-15 16:07:15.299925973 +0200 -@@ -0,0 +1,466 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_ARCH_KONA -+#include -+#elif CONFIG_ARCH_BCM2708 -+#else -+#include -+#endif -+ -+#include "mach/vc_mem.h" -+//#include "interface/vchiq_arm/vchiq_connected.h" -+ -+#define DRIVER_NAME "vc-mem" -+ -+// Uncomment to enable debug logging -+//#define ENABLE_DBG -+ -+#if defined(ENABLE_DBG) -+#define LOG_DBG( fmt, ... ) printk( KERN_INFO fmt "\n", ##__VA_ARGS__ ) -+#else -+#define LOG_DBG( fmt, ... ) -+#endif -+#define LOG_ERR( fmt, ... ) printk( KERN_ERR fmt "\n", ##__VA_ARGS__ ) -+ -+// Device (/dev) related variables -+static dev_t vc_mem_devnum = 0; -+static struct class *vc_mem_class = NULL; -+static struct cdev vc_mem_cdev; -+static int vc_mem_inited = 0; -+ -+// Proc entry -+static struct proc_dir_entry *vc_mem_proc_entry; -+ -+/* -+ * Videocore memory addresses and size -+ * -+ * Drivers that wish to know the videocore memory addresses and sizes should -+ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in -+ * headers. This allows the other drivers to not be tied down to a a certain -+ * address/size at compile time. -+ * -+ * In the future, the goal is to have the videocore memory virtual address and -+ * size be calculated at boot time rather than at compile time. The decision of -+ * where the videocore memory resides and its size would be in the hands of the -+ * bootloader (and/or kernel). When that happens, the values of these variables -+ * would be calculated and assigned in the init function. -+ */ -+#ifdef CONFIG_ARCH_KONA -+ -+#include -+unsigned long mm_vc_mem_phys_addr = VC_EMI; -+ -+#elif CONFIG_ARCH_BCM2708 -+ -+// in the 2835 VC in mapped above ARM, but ARM has full access to VC space -+unsigned long mm_vc_mem_phys_addr = 0x00000000; -+ -+#else -+ -+#include -+unsigned long mm_vc_mem_phys_addr = MM_ADDR_IO_VC_EMI; -+ -+#endif -+ -+unsigned int mm_vc_mem_size = 0; -+unsigned int mm_vc_mem_base = 0; -+ -+EXPORT_SYMBOL(mm_vc_mem_phys_addr); -+EXPORT_SYMBOL(mm_vc_mem_size); -+EXPORT_SYMBOL(mm_vc_mem_base); -+ -+/**************************************************************************** -+* -+* vc_mem_open -+* -+***************************************************************************/ -+ -+static int -+vc_mem_open(struct inode *inode, struct file *file) -+{ -+ (void) inode; -+ (void) file; -+ -+ LOG_DBG("%s: called file = 0x%p", __func__, file); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_release -+* -+***************************************************************************/ -+ -+static int -+vc_mem_release(struct inode *inode, struct file *file) -+{ -+ (void) inode; -+ (void) file; -+ -+ LOG_DBG("%s: called file = 0x%p", __func__, file); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_size -+* -+***************************************************************************/ -+ -+static void -+vc_mem_get_size(void) -+{ -+ mm_vc_mem_size = 256 * 1024 * 1024; // Static for now -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_base -+* -+***************************************************************************/ -+ -+static void -+vc_mem_get_base(void) -+{ -+ mm_vc_mem_base = 128 * 1024 * 1024; // Static for now -+} -+ -+/**************************************************************************** -+* -+* vc_mem_get_current_size -+* -+***************************************************************************/ -+ -+int -+vc_mem_get_current_size(void) -+{ -+ vc_mem_get_size(); -+ return mm_vc_mem_size; -+} -+ -+EXPORT_SYMBOL_GPL(vc_mem_get_current_size); -+ -+/**************************************************************************** -+* -+* vc_mem_ioctl -+* -+***************************************************************************/ -+ -+static long -+vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int rc = 0; -+ -+ (void) cmd; -+ (void) arg; -+ -+ LOG_DBG("%s: called file = 0x%p", __func__, file); -+ -+ switch (cmd) { -+ case VC_MEM_IOC_MEM_PHYS_ADDR: -+ { -+ LOG_DBG("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p", -+ __func__, (void *) mm_vc_mem_phys_addr); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, -+ sizeof (mm_vc_mem_phys_addr)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_SIZE: -+ { -+ // Get the videocore memory size first -+ vc_mem_get_size(); -+ -+ LOG_DBG("%s: VC_MEM_IOC_MEM_SIZE=%u", __func__, -+ mm_vc_mem_size); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_size, -+ sizeof (mm_vc_mem_size)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ case VC_MEM_IOC_MEM_BASE: -+ { -+ // Get the videocore memory size first -+ vc_mem_get_base(); -+ -+ LOG_DBG("%s: VC_MEM_IOC_MEM_BASE=%u", __func__, -+ mm_vc_mem_size); -+ -+ if (copy_to_user((void *) arg, &mm_vc_mem_size, -+ sizeof (mm_vc_mem_size)) != 0) { -+ rc = -EFAULT; -+ } -+ break; -+ } -+ default: -+ { -+ return -ENOTTY; -+ } -+ } -+ LOG_DBG("%s: file = 0x%p returning %d", __func__, file, rc); -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_mmap -+* -+***************************************************************************/ -+ -+static int -+vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) -+{ -+ int rc = 0; -+ unsigned long length = vma->vm_end - vma->vm_start; -+ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; -+ -+ LOG_DBG("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx", -+ __func__, (long) vma->vm_start, (long) vma->vm_end, -+ (long) vma->vm_pgoff); -+ -+ if (offset + length > mm_vc_mem_size) { -+ LOG_ERR("%s: length %ld is too big", __func__, length); -+ return -EINVAL; -+ } -+ // Do not cache the memory map -+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -+ -+ rc = remap_pfn_range(vma, vma->vm_start, -+ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + -+ vma->vm_pgoff, length, vma->vm_page_prot); -+ if (rc != 0) { -+ LOG_ERR("%s: remap_pfn_range failed (rc=%d)", __func__, rc); -+ } -+ -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* File Operations for the driver. -+* -+***************************************************************************/ -+ -+static const struct file_operations vc_mem_fops = { -+ .owner = THIS_MODULE, -+ .open = vc_mem_open, -+ .release = vc_mem_release, -+ .unlocked_ioctl = vc_mem_ioctl, -+ .mmap = vc_mem_mmap, -+}; -+ -+/**************************************************************************** -+* -+* vc_mem_proc_read -+* -+***************************************************************************/ -+ -+static int -+vc_mem_proc_read(char *buf, char **start, off_t offset, int count, int *eof, -+ void *data) -+{ -+ char *p = buf; -+ -+ (void) start; -+ (void) count; -+ (void) data; -+ -+ if (offset > 0) { -+ *eof = 1; -+ return 0; -+ } -+ // Get the videocore memory size first -+ vc_mem_get_size(); -+ -+ p += sprintf(p, "Videocore memory:\n"); -+ if (mm_vc_mem_phys_addr != 0) -+ p += sprintf(p, " Physical address: 0x%p\n", -+ (void *) mm_vc_mem_phys_addr); -+ else -+ p += sprintf(p, " Physical address: 0x00000000\n"); -+ p += sprintf(p, " Length (bytes): %u\n", mm_vc_mem_size); -+ -+ *eof = 1; -+ return p - buf; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_proc_write -+* -+***************************************************************************/ -+ -+static int -+vc_mem_proc_write(struct file *file, const char __user * buffer, -+ unsigned long count, void *data) -+{ -+ int rc = -EFAULT; -+ char input_str[10]; -+ -+ memset(input_str, 0, sizeof (input_str)); -+ -+ if (count > sizeof (input_str)) { -+ LOG_ERR("%s: input string length too long", __func__); -+ goto out; -+ } -+ -+ if (copy_from_user(input_str, buffer, count - 1)) { -+ LOG_ERR("%s: failed to get input string", __func__); -+ goto out; -+ } -+ -+ if (strncmp(input_str, "connect", strlen("connect")) == 0) { -+ // Get the videocore memory size from the videocore -+ vc_mem_get_size(); -+ } -+ -+ out: -+ return rc; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_connected_init -+* -+* This function is called once the videocore has been connected. -+* -+***************************************************************************/ -+ -+void -+vc_mem_connected_init(void) -+{ -+ int rc = -EFAULT; -+ struct device *dev; -+ -+ LOG_DBG("%s: called", __func__); -+ -+ vc_mem_get_size(); -+ -+ printk("vc-mem: mm_vc_mem_phys_addr = 0x%08lx\n", mm_vc_mem_phys_addr); -+ printk("vc-mem: mm_vc_mem_size = 0x%08x (%u MiB)\n", -+ mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); -+ -+ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { -+ LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); -+ goto out_err; -+ } -+ -+ cdev_init(&vc_mem_cdev, &vc_mem_fops); -+ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { -+ LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); -+ goto out_unregister; -+ } -+ -+ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); -+ if (IS_ERR(vc_mem_class)) { -+ rc = PTR_ERR(vc_mem_class); -+ LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); -+ goto out_cdev_del; -+ } -+ -+ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, -+ DRIVER_NAME); -+ if (IS_ERR(dev)) { -+ rc = PTR_ERR(dev); -+ LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); -+ goto out_class_destroy; -+ } -+ -+ vc_mem_proc_entry = create_proc_entry(DRIVER_NAME, 0444, NULL); -+ if (vc_mem_proc_entry == NULL) { -+ rc = -EFAULT; -+ LOG_ERR("%s: create_proc_entry failed", __func__); -+ goto out_device_destroy; -+ } -+ vc_mem_proc_entry->read_proc = vc_mem_proc_read; -+ vc_mem_proc_entry->write_proc = vc_mem_proc_write; -+ -+ vc_mem_inited = 1; -+ return; -+ -+ out_device_destroy: -+ device_destroy(vc_mem_class, vc_mem_devnum); -+ -+ out_class_destroy: -+ class_destroy(vc_mem_class); -+ vc_mem_class = NULL; -+ -+ out_cdev_del: -+ cdev_del(&vc_mem_cdev); -+ -+ out_unregister: -+ unregister_chrdev_region(vc_mem_devnum, 1); -+ -+ out_err: -+ return; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_init -+* -+***************************************************************************/ -+ -+static int __init -+vc_mem_init(void) -+{ -+ printk(KERN_INFO "vc-mem: Videocore memory driver\n"); -+ -+ //vchiq_add_connected_callback(vc_mem_connected_init); -+ -+ return 0; -+} -+ -+/**************************************************************************** -+* -+* vc_mem_exit -+* -+***************************************************************************/ -+ -+static void __exit -+vc_mem_exit(void) -+{ -+ LOG_DBG("%s: called", __func__); -+ -+ if (vc_mem_inited) { -+ remove_proc_entry(vc_mem_proc_entry->name, NULL); -+ device_destroy(vc_mem_class, vc_mem_devnum); -+ class_destroy(vc_mem_class); -+ cdev_del(&vc_mem_cdev); -+ unregister_chrdev_region(vc_mem_devnum, 1); -+ } -+} -+ -+module_init(vc_mem_init); -+module_exit(vc_mem_exit); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Broadcom Corporation"); -diff -Naur linux-3.1.10/arch/arm/Makefile linux-3.1.10.patch/arch/arm/Makefile ---- linux-3.1.10/arch/arm/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/Makefile 2012-04-15 16:07:15.104922146 +0200 -@@ -196,6 +196,7 @@ - machine-$(CONFIG_MACH_SPEAR320) := spear3xx - machine-$(CONFIG_MACH_SPEAR600) := spear6xx - machine-$(CONFIG_ARCH_ZYNQ) := zynq -+machine-$(CONFIG_ARCH_BCM2708) := bcm2708 +diff -Naur linux-3.1.10/arch/arm/mm/Kconfig linux-3.1.10.patch/arch/arm/mm/Kconfig +--- linux-3.1.10/arch/arm/mm/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/arch/arm/mm/Kconfig 2012-04-28 22:26:48.650713074 +0200 +@@ -390,7 +390,7 @@ - # Platform directory name. This list is sorted alphanumerically - # by CONFIG_* macro name. + # 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.1.10/arch/arm/mm/alignment.c linux-3.1.10.patch/arch/arm/mm/alignment.c --- linux-3.1.10/arch/arm/mm/alignment.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mm/alignment.c 2012-04-15 16:07:15.132922697 +0200 ++++ linux-3.1.10.patch/arch/arm/mm/alignment.c 2012-04-28 22:26:48.651713094 +0200 @@ -855,9 +855,11 @@ case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */ if (thumb2_32b) @@ -7672,21 +7667,9 @@ diff -Naur linux-3.1.10/arch/arm/mm/alignment.c linux-3.1.10.patch/arch/arm/mm/a default: goto bad; -diff -Naur linux-3.1.10/arch/arm/mm/Kconfig linux-3.1.10.patch/arch/arm/mm/Kconfig ---- linux-3.1.10/arch/arm/mm/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mm/Kconfig 2012-04-15 16:07:15.131922677 +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.1.10/arch/arm/mm/proc-v6.S linux-3.1.10.patch/arch/arm/mm/proc-v6.S --- linux-3.1.10/arch/arm/mm/proc-v6.S 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/arch/arm/mm/proc-v6.S 2012-04-15 16:07:15.132922697 +0200 ++++ linux-3.1.10.patch/arch/arm/mm/proc-v6.S 2012-04-28 22:26:48.652713115 +0200 @@ -70,10 +70,19 @@ * * IRQs are already disabled. @@ -7710,15 +7693,9 @@ diff -Naur linux-3.1.10/arch/arm/mm/proc-v6.S linux-3.1.10.patch/arch/arm/mm/pro mov pc, lr ENTRY(cpu_v6_dcache_clean_area) -diff -Naur linux-3.1.10/Documentation/repack.nfo linux-3.1.10.patch/Documentation/repack.nfo ---- linux-3.1.10/Documentation/repack.nfo 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/Documentation/repack.nfo 2012-04-15 16:08:46.775721007 +0200 -@@ -0,0 +1,2 @@ -+this patch is part of and was repacked for OpenELEC project -+http://www.openelec.tv diff -Naur linux-3.1.10/drivers/misc/Kconfig linux-3.1.10.patch/drivers/misc/Kconfig --- linux-3.1.10/drivers/misc/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/Kconfig 2012-04-15 16:07:15.154923128 +0200 ++++ linux-3.1.10.patch/drivers/misc/Kconfig 2012-04-28 22:26:48.677713625 +0200 @@ -507,5 +507,6 @@ source "drivers/misc/ti-st/Kconfig" source "drivers/misc/lis3lv02d/Kconfig" @@ -7728,15 +7705,51 @@ diff -Naur linux-3.1.10/drivers/misc/Kconfig linux-3.1.10.patch/drivers/misc/Kco endif # MISC_DEVICES diff -Naur linux-3.1.10/drivers/misc/Makefile linux-3.1.10.patch/drivers/misc/Makefile --- linux-3.1.10/drivers/misc/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/Makefile 2012-04-15 16:07:15.155923148 +0200 ++++ linux-3.1.10.patch/drivers/misc/Makefile 2012-04-28 22:26:48.678713645 +0200 @@ -47,3 +47,4 @@ obj-y += lis3lv02d/ obj-y += carma/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o +obj-y += vc04_services/ +diff -Naur linux-3.1.10/drivers/misc/vc04_services/Kconfig linux-3.1.10.patch/drivers/misc/vc04_services/Kconfig +--- linux-3.1.10/drivers/misc/vc04_services/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/Kconfig 2012-04-28 22:26:48.678713645 +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.1.10/drivers/misc/vc04_services/Makefile linux-3.1.10.patch/drivers/misc/vc04_services/Makefile +--- linux-3.1.10/drivers/misc/vc04_services/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/Makefile 2012-04-28 22:26:48.822716579 +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.1.10/drivers/misc/vc04_services/interface/vchi/connections/connection.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/connections/connection.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/connections/connection.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/connections/connection.h 2012-04-15 16:07:15.279925582 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/connections/connection.h 2012-04-28 22:26:48.823716600 +0200 @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -8049,7 +8062,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/connections/co +/****************************** End of file **********************************/ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 2012-04-15 16:07:15.280925601 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 2012-04-28 22:26:48.824716621 +0200 @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -8237,443 +8250,9 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/message_driver +#endif // _VCHI_MESSAGE_H_ + +/****************************** End of file ***********************************/ -diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 2012-04-15 16:07:15.282925639 +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.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 2012-04-15 16:07:15.282925639 +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.1.10/drivers/misc/vc04_services/interface/vchi/vchi_common.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_common.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_common.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_common.h 2012-04-15 16:07:15.283925659 +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.1.10/drivers/misc/vc04_services/interface/vchi/vchi.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi.h 2012-04-15 16:07:15.281925620 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi.h 2012-04-28 22:26:48.825716642 +0200 @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -9022,9 +8601,443 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi.h linux-3 +#endif /* VCHI_H_ */ + +/****************************** End of file **********************************/ +diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 2012-04-28 22:26:48.826716662 +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.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 2012-04-28 22:26:48.826716662 +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.1.10/drivers/misc/vc04_services/interface/vchi/vchi_common.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_common.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_common.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_common.h 2012-04-28 22:26:48.827716682 +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.1.10/drivers/misc/vc04_services/interface/vchi/vchi_mh.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_mh.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 2012-04-15 16:07:15.235924717 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 2012-04-28 22:26:48.733714766 +0200 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -9053,9 +9066,71 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchi/vchi_mh.h linu +#define VCHI_MEM_HANDLE_INVALID 0 + +#endif +diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 2012-04-28 22:26:48.680713685 +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.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 2012-04-28 22:26:48.680713685 +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.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 2012-04-15 16:07:15.283925659 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 2012-04-28 22:26:48.827716682 +0200 @@ -0,0 +1,512 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -9569,41 +9644,10 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_283 + kfree(pagelist); +} + -diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 2012-04-15 16:07:15.157923187 +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.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 2012-04-15 16:07:15.285925699 +0200 -@@ -0,0 +1,1905 @@ ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 2012-04-28 22:26:48.894718048 +0200 +@@ -0,0 +1,1912 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. + * @@ -9743,7 +9787,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm +***************************************************************************/ + +static inline USER_SERVICE_T *find_service_by_handle( -+ VCHIQ_INSTANCE_T instance, int handle ) ++ VCHIQ_INSTANCE_T instance, int handle ) +{ + USER_SERVICE_T *user_service; + @@ -10700,7 +10744,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm + char cr = '\n'; + if (copy_to_user(context->buf + context->actual - 1, &cr, 1)) + { -+ context->actual = -EFAULT; ++ context->actual = -EFAULT; + } + } + } @@ -10989,11 +11033,11 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm + } + if(arm_state->use_notify_pending) + { -+ send_pending = 1; -+ arm_state->use_notify_pending = 0; ++ send_pending = arm_state->use_notify_pending; ++ arm_state->use_notify_pending=0; + } + vcos_mutex_unlock(&arm_state->use_count_mutex); -+ if(send_pending) ++ while(send_pending--) + { + vcos_log_info( "%s sending VCHIQ_MSG_REMOTE_USE_ACTIVE", __func__); + if ( vchiq_send_remote_use_active(state) != VCHIQ_SUCCESS) @@ -11193,7 +11237,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm + } + if(!block_while_resume) + { -+ arm_state->use_notify_pending = 1; ++ arm_state->use_notify_pending++; + vcos_event_signal(&arm_state->hp_evt); /* hp task will check if we need to resume and also send use notify */ + } + @@ -11417,6 +11461,13 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm + vcos_unused(state); +} + ++void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate) ++{ ++ vcos_unused(state); ++ vcos_unused(oldstate); ++ vcos_unused(oldstate); ++} ++ + +/**************************************************************************** +* @@ -11511,7 +11562,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm +MODULE_AUTHOR("Broadcom Corporation"); diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 2012-04-15 16:07:15.286925719 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 2012-04-28 22:26:48.830716742 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -11633,7 +11684,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm +#endif /* VCHIQ_ARM_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 2012-04-15 16:07:15.170923442 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 2012-04-28 22:26:48.684713768 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -11680,7 +11731,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg +#endif /* VCHIQ_CFG_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 2012-04-15 16:07:15.170923442 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 2012-04-28 22:26:48.684713768 +0200 @@ -0,0 +1,101 @@ +/***************************************************************************** +* Copyright 2001 - 2010 Broadcom Corporation. All rights reserved. @@ -11785,7 +11836,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_con +EXPORT_SYMBOL( vchiq_add_connected_callback ); diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 2012-04-15 16:07:15.191923855 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 2012-04-28 22:26:48.685713788 +0200 @@ -0,0 +1,32 @@ +/***************************************************************************** +* Copyright 2001 - 2010 Broadcom Corporation. All rights reserved. @@ -11821,8 +11872,8 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_con + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 2012-04-15 16:07:15.289925777 +0200 -@@ -0,0 +1,2700 @@ ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 2012-04-28 22:26:48.896718088 +0200 +@@ -0,0 +1,2717 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. + * @@ -11964,10 +12015,12 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cor +static inline void +vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate) +{ ++ VCHIQ_CONNSTATE_T oldstate = state->conn_state; + vcos_log_info("%d: %s->%s", state->id, -+ conn_state_names[state->conn_state], ++ conn_state_names[oldstate], + conn_state_names[newstate]); + state->conn_state = newstate; ++ vchiq_platform_conn_state_changed(state, oldstate, newstate); +} + +static inline void @@ -14511,22 +14564,37 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cor + +VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T * state) +{ -+ return queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), NULL, 0, 0, 0); ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ { ++ status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), NULL, 0, 0, 0); ++ } ++ return status; +} + +VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T * state) +{ -+ return queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), NULL, 0, 0, 0); ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ { ++ status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), NULL, 0, 0, 0); ++ } ++ return status; +} + +VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T * state) +{ -+ return queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), NULL, 0, 0, 0); ++ VCHIQ_STATUS_T status = VCHIQ_RETRY; ++ if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED) ++ { ++ status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), NULL, 0, 0, 0); ++ } ++ return status; +} diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 2012-04-15 16:07:15.290925796 +0200 -@@ -0,0 +1,505 @@ ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 2012-04-28 22:26:48.896718088 +0200 +@@ -0,0 +1,506 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. + * @@ -15029,43 +15097,13 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cor +extern VCHIQ_STATUS_T +vchiq_send_remote_use_active(VCHIQ_STATE_T * state); + -+ ++extern void ++vchiq_platform_conn_state_changed(VCHIQ_STATE_T* state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate); + +#endif -diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 2012-04-15 16:07:15.157923187 +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.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 2012-04-15 16:07:15.290925796 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 2012-04-28 22:26:48.834716825 +0200 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -15224,7 +15262,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if. +#endif /* VCHIQ_IF_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 2012-04-15 16:07:15.198923992 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 2012-04-28 22:26:48.897718108 +0200 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -15319,21 +15357,21 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioc +#define VCHIQ_IOC_QUEUE_MESSAGE _IOW(VCHIQ_IOC_MAGIC, 4, VCHIQ_QUEUE_MESSAGE_T) +#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT _IOW(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T) +#define VCHIQ_IOC_QUEUE_BULK_RECEIVE _IOW(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T) -+#define VCHIQ_IOC_AWAIT_COMPLETION _IOW(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T) -+#define VCHIQ_IOC_DEQUEUE_MESSAGE _IOW(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T) ++#define VCHIQ_IOC_AWAIT_COMPLETION _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T) ++#define VCHIQ_IOC_DEQUEUE_MESSAGE _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T) +#define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9) -+#define VCHIQ_IOC_GET_CONFIG _IOW(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T) -+#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11) -+#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12) -+#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13) -+#define VCHIQ_IOC_SET_SERVICE_OPTION _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T) -+#define VCHIQ_IOC_DUMP_PHYS_MEM _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T) ++#define VCHIQ_IOC_GET_CONFIG _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T) ++#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11) ++#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12) ++#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13) ++#define VCHIQ_IOC_SET_SERVICE_OPTION _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T) ++#define VCHIQ_IOC_DUMP_PHYS_MEM _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T) +#define VCHIQ_IOC_MAX 15 + +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 2012-04-15 16:07:15.198923992 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 2012-04-28 22:26:48.691713910 +0200 @@ -0,0 +1,297 @@ +/***************************************************************************** +* Copyright 2001 - 2011 Broadcom Corporation. All rights reserved. @@ -15634,7 +15672,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ker +EXPORT_SYMBOL(vchiq_open_service_params); diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c 2012-04-15 16:07:15.291925816 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c 2012-04-28 22:26:48.835716846 +0200 @@ -0,0 +1,1628 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -17266,7 +17304,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib +} diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 2012-04-15 16:07:15.201924050 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 2012-04-28 22:26:48.695713992 +0200 @@ -0,0 +1,45 @@ +/***************************************************************************** +* Copyright 2001 - 2010 Broadcom Corporation. All rights reserved. @@ -17315,7 +17353,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_mem +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 2012-04-15 16:07:15.202924069 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 2012-04-28 22:26:48.695713992 +0200 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -17362,7 +17400,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pag +#endif /* VCHIQ_PAGELIST_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 2012-04-15 16:07:15.292925836 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 2012-04-28 22:26:48.836716866 +0200 @@ -0,0 +1,1001 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -18367,7 +18405,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shi +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 2012-04-15 16:07:15.204924109 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 2012-04-28 22:26:48.698714053 +0200 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -18468,7 +18506,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_uti +} diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 2012-04-15 16:07:15.205924129 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 2012-04-28 22:26:48.699714073 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved. @@ -18519,7 +18557,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_uti + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c 2012-04-15 16:07:15.206924149 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_cmd.c 2012-04-28 22:26:48.701714113 +0200 @@ -0,0 +1,681 @@ +/***************************************************************************** +* Copyright 2009 - 2011 Broadcom Corporation. All rights reserved. @@ -19204,7 +19242,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_c + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h 2012-04-15 16:07:15.236924737 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_common.h 2012-04-28 22:26:48.734714787 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19295,7 +19333,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_c + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h 2012-04-15 16:07:15.236924737 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_blockpool.h 2012-04-28 22:26:48.734714787 +0200 @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19570,7 +19608,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c 2012-04-15 16:07:15.237924757 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.c 2012-04-28 22:26:48.735714808 +0200 @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -19885,7 +19923,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h 2012-04-15 16:07:15.237924757 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_event_flags.h 2012-04-28 22:26:48.735714808 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20007,7 +20045,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h 2012-04-15 16:07:15.238924777 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_named_sem.h 2012-04-28 22:26:48.736714828 +0200 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20103,7 +20141,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h 2012-04-15 16:07:15.238924777 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_quickslow_mutex.h 2012-04-28 22:26:48.736714828 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20193,7 +20231,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h 2012-04-15 16:07:15.239924797 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_reentrant_mtx.h 2012-04-28 22:26:48.737714848 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20283,7 +20321,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h 2012-04-15 16:07:15.239924797 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_generic_tls.h 2012-04-28 22:26:48.737714848 +0200 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20442,7 +20480,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_g + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h 2012-04-15 16:07:15.240924816 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_joinable_thread_from_plain.h 2012-04-28 22:26:48.738714868 +0200 @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20660,7 +20698,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_j +#endif /* VCOS_JOINABLE_THREAD_FROM_PLAIN_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h 2012-04-15 16:07:15.240924816 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_latch_from_sem.h 2012-04-28 22:26:48.738714868 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -20723,7 +20761,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_l + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c 2012-04-15 16:07:15.241924835 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_logcat.c 2012-04-28 22:26:48.739714889 +0200 @@ -0,0 +1,560 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21287,7 +21325,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_l + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c 2012-04-15 16:07:15.241924835 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.c 2012-04-28 22:26:48.739714889 +0200 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21375,7 +21413,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_m + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h 2012-04-15 16:07:15.242924854 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mem_from_malloc.h 2012-04-28 22:26:48.740714909 +0200 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21444,7 +21482,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_m + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h 2012-04-15 16:07:15.242924854 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_mutexes_are_reentrant.h 2012-04-28 22:26:48.740714909 +0200 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21527,7 +21565,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_m + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h 2012-04-15 16:07:15.243924874 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/generic/vcos_thread_reaper.h 2012-04-28 22:26:48.741714929 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21577,7 +21615,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/generic/vcos_t + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h 2012-04-15 16:07:15.243924874 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/stdint.h 2012-04-28 22:26:48.741714929 +0200 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -21612,7 +21650,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/st +#endif /* _VCOS_PLATFORM_LINUX_STDINT_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c 2012-04-15 16:07:15.244924894 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel.c 2012-04-28 22:26:48.742714949 +0200 @@ -0,0 +1,627 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -22243,7 +22281,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc +EXPORT_SYMBOL( vcos_strdup ); diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c 2012-04-15 16:07:15.217924364 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_cfg.c 2012-04-28 22:26:48.711714317 +0200 @@ -0,0 +1,332 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -22579,7 +22617,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c 2012-04-15 16:07:15.244924894 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_linuxkernel_misc.c 2012-04-28 22:26:48.742714949 +0200 @@ -0,0 +1,111 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -22694,7 +22732,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc +// ############################################################################# diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c 2012-04-15 16:07:15.219924403 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_mod_init.c 2012-04-28 22:26:48.713714359 +0200 @@ -0,0 +1,64 @@ +/***************************************************************************** +* Copyright 2006 - 2008 Broadcom Corporation. All rights reserved. @@ -22762,7 +22800,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h 2012-04-15 16:07:15.245924914 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform.h 2012-04-28 22:26:48.743714969 +0200 @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23273,7 +23311,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h 2012-04-15 16:07:15.246924934 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_platform_types.h 2012-04-28 22:26:48.744714990 +0200 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23335,7 +23373,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c 2012-04-15 16:07:15.221924443 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.c 2012-04-28 22:26:48.715714400 +0200 @@ -0,0 +1,129 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -23468,7 +23506,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc +} diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h 2012-04-15 16:07:15.222924463 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/linuxkernel/vcos_thread_map.h 2012-04-28 22:26:48.716714420 +0200 @@ -0,0 +1,39 @@ +/***************************************************************************** +* Copyright 2009 - 2010 Broadcom Corporation. All rights reserved. @@ -23509,9 +23547,225 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/linuxkernel/vc +VCOS_THREAD_T *vcos_kthread_current(void); + +#endif /*VCOS_THREAD_MAP_H */ +diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos.h 2012-04-28 22:26:48.744714990 +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.1.10/drivers/misc/vc04_services/interface/vcos/vcos_assert.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_assert.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_assert.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_assert.h 2012-04-15 16:07:15.247924954 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_assert.h 2012-04-28 22:26:48.745715011 +0200 @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23795,7 +24049,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_assert.h +#endif /* VCOS_ASSERT_H */ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h 2012-04-15 16:07:15.247924954 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_atomic_flags.h 2012-04-28 22:26:48.746715032 +0200 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23882,7 +24136,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_atomic_fl +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h 2012-04-15 16:07:15.248924973 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_build_info.h 2012-04-28 22:26:48.746715032 +0200 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -23909,7 +24163,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_build_inf + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h 2012-04-15 16:07:15.224924502 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h 2012-04-28 22:26:48.719714481 +0200 @@ -0,0 +1,113 @@ +/***************************************************************************** +* Copyright 2009 - 2011 Broadcom Corporation. All rights reserved. @@ -24026,7 +24280,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_cfg.h lin + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h 2012-04-15 16:07:15.224924502 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h 2012-04-28 22:26:48.720714501 +0200 @@ -0,0 +1,98 @@ +/***************************************************************************** +* Copyright 2009 - 2011 Broadcom Corporation. All rights reserved. @@ -24128,7 +24382,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_cmd.h lin + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h 2012-04-15 16:07:15.248924973 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h 2012-04-28 22:26:48.747715052 +0200 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24172,7 +24426,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_ctype.h l + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h 2012-04-15 16:07:15.248924973 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h 2012-04-28 22:26:48.747715052 +0200 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24254,9 +24508,121 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_dlfcn.h l +#endif + + +diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event.h 2012-04-28 22:26:48.747715052 +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.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h 2012-04-15 16:07:15.249924992 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event_flags.h 2012-04-28 22:26:48.748715072 +0200 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24367,337 +24733,9 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event_fla + +#endif + -diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_event.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_event.h 2012-04-15 16:07:15.249924992 +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.1.10/drivers/misc/vc04_services/interface/vcos/vcos.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos.h 2012-04-15 16:07:15.246924934 +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.1.10/drivers/misc/vc04_services/interface/vcos/vcos_init.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_init.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_init.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_init.h 2012-04-15 16:07:15.250925011 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_init.h 2012-04-28 22:26:48.748715072 +0200 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -24755,7 +24793,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_init.h li + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_logging.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_logging.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_logging.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_logging.h 2012-04-15 16:07:15.250925011 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_logging.h 2012-04-28 22:26:48.749715092 +0200 @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25049,7 +25087,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_logging.h + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h 2012-04-15 16:07:15.251925031 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_thread.h 2012-04-28 22:26:48.749715092 +0200 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25171,7 +25209,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_lowlevel_ + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_mem.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_mem.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_mem.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_mem.h 2012-04-15 16:07:15.251925031 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_mem.h 2012-04-28 22:26:48.750715112 +0200 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25267,7 +25305,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_mem.h lin + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h 2012-04-15 16:07:15.252925051 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue.h 2012-04-28 22:26:48.750715112 +0200 @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25439,7 +25477,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_msgqueue. + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h 2012-04-15 16:07:15.252925051 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h 2012-04-28 22:26:48.751715132 +0200 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25546,7 +25584,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_mutex.h l +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_once.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_once.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_once.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_once.h 2012-04-15 16:07:15.253925071 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_once.h 2012-04-28 22:26:48.751715132 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25603,7 +25641,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_once.h li + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h 2012-04-15 16:07:15.253925071 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_semaphore.h 2012-04-28 22:26:48.752715153 +0200 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25733,7 +25771,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_semaphore + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h 2012-04-15 16:07:15.254925091 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h 2012-04-28 22:26:48.752715153 +0200 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25771,7 +25809,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_stdbool.h +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h 2012-04-15 16:07:15.254925091 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h 2012-04-28 22:26:48.753715174 +0200 @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -25978,7 +26016,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_stdint.h + diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_string.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_string.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_string.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_string.h 2012-04-15 16:07:15.254925091 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_string.h 2012-04-28 22:26:48.753715174 +0200 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -26064,100 +26102,9 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_string.h +} +#endif +#endif -diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h ---- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h 2012-04-15 16:07:15.255925111 +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.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread.h 2012-04-15 16:07:15.255925111 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread.h 2012-04-28 22:26:48.754715195 +0200 @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -26429,9 +26376,100 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread.h +} +#endif +#endif +diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h +--- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_thread_attr.h 2012-04-28 22:26:48.754715195 +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.1.10/drivers/misc/vc04_services/interface/vcos/vcos_timer.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_timer.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_timer.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_timer.h 2012-04-15 16:07:15.256925130 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_timer.h 2012-04-28 22:26:48.755715215 +0200 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -26541,7 +26579,7 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_timer.h l +#endif diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_types.h linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_types.h --- linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_types.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_types.h 2012-04-15 16:07:15.256925130 +0200 ++++ linux-3.1.10.patch/drivers/misc/vc04_services/interface/vcos/vcos_types.h 2012-04-28 22:26:48.781715745 +0200 @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2010-2011 Broadcom. All rights reserved. @@ -26754,45 +26792,74 @@ diff -Naur linux-3.1.10/drivers/misc/vc04_services/interface/vcos/vcos_types.h l +typedef vcos_fourcc_t FOURCC_T; + +#endif -diff -Naur linux-3.1.10/drivers/misc/vc04_services/Kconfig linux-3.1.10.patch/drivers/misc/vc04_services/Kconfig ---- linux-3.1.10/drivers/misc/vc04_services/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/Kconfig 2012-04-15 16:07:15.155923148 +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.1.10/drivers/mmc/host/Kconfig linux-3.1.10.patch/drivers/mmc/host/Kconfig +--- linux-3.1.10/drivers/mmc/host/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/mmc/host/Kconfig 2012-04-28 22:26:48.653713136 +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. + -diff -Naur linux-3.1.10/drivers/misc/vc04_services/Makefile linux-3.1.10.patch/drivers/misc/vc04_services/Makefile ---- linux-3.1.10/drivers/misc/vc04_services/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/misc/vc04_services/Makefile 2012-04-15 16:07:15.278925562 +0200 -@@ -0,0 +1,21 @@ -+obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o ++ If you have a controller with this interface, say Y or M here. + -+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 ++ If unsure, say N. + -+EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel ++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.1.10/drivers/mmc/host/Makefile linux-3.1.10.patch/drivers/mmc/host/Makefile +--- linux-3.1.10/drivers/mmc/host/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/mmc/host/Makefile 2012-04-28 22:26:48.653713136 +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.1.10/drivers/mmc/host/bcm2708_mci.c linux-3.1.10.patch/drivers/mmc/host/bcm2708_mci.c --- linux-3.1.10/drivers/mmc/host/bcm2708_mci.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/bcm2708_mci.c 2012-04-15 16:07:15.135922755 +0200 ++++ linux-3.1.10.patch/drivers/mmc/host/bcm2708_mci.c 2012-04-28 22:26:48.654713157 +0200 @@ -0,0 +1,889 @@ +/* + * linux/drivers/mmc/host/bcm2708_mci.c - Broadcom BCM2708 MCI driver @@ -27685,7 +27752,7 @@ diff -Naur linux-3.1.10/drivers/mmc/host/bcm2708_mci.c linux-3.1.10.patch/driver +MODULE_ALIAS("platform:bcm2708_mci"); diff -Naur linux-3.1.10/drivers/mmc/host/bcm2708_mci.h linux-3.1.10.patch/drivers/mmc/host/bcm2708_mci.h --- linux-3.1.10/drivers/mmc/host/bcm2708_mci.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/bcm2708_mci.h 2012-04-15 16:07:15.136922774 +0200 ++++ linux-3.1.10.patch/drivers/mmc/host/bcm2708_mci.h 2012-04-28 22:26:48.655713177 +0200 @@ -0,0 +1,101 @@ +/* + * linux/drivers/mmc/host/bcm2708_mci.c - Broadcom BCM2708 MCI driver @@ -27788,75 +27855,10 @@ diff -Naur linux-3.1.10/drivers/mmc/host/bcm2708_mci.h linux-3.1.10.patch/driver + kunmap_atomic(buffer, KM_BIO_SRC_IRQ); +// local_irq_restore(*flags); +} -diff -Naur linux-3.1.10/drivers/mmc/host/Kconfig linux-3.1.10.patch/drivers/mmc/host/Kconfig ---- linux-3.1.10/drivers/mmc/host/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/Kconfig 2012-04-15 16:07:15.133922717 +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.1.10/drivers/mmc/host/Makefile linux-3.1.10.patch/drivers/mmc/host/Makefile ---- linux-3.1.10/drivers/mmc/host/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/Makefile 2012-04-15 16:07:15.134922736 +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.1.10/drivers/mmc/host/sdhci-bcm2708.c linux-3.1.10.patch/drivers/mmc/host/sdhci-bcm2708.c --- linux-3.1.10/drivers/mmc/host/sdhci-bcm2708.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/sdhci-bcm2708.c 2012-04-15 16:07:15.277925542 +0200 -@@ -0,0 +1,1548 @@ ++++ linux-3.1.10.patch/drivers/mmc/host/sdhci-bcm2708.c 2012-04-28 22:26:48.888717924 +0200 +@@ -0,0 +1,1555 @@ +/* + * sdhci-bcm2708.c Support for SDHCI device on BCM2708 + * Copyright (c) 2010 Broadcom @@ -27918,6 +27920,9 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci-bcm2708.c linux-3.1.10.patch/driv +//#define LOG_REGISTERS + +#define USE_SCHED_TIME ++#define USE_SPACED_WRITES_2CLK 1 /* space consecutive register writes */ ++#define USE_SOFTWARE_TIMEOUTS 1 /* not hardware timeouts */ ++#define SOFTWARE_ERASE_TIMEOUT_SEC 30 + +#define SDHCI_BCM_DMA_CHAN 4 /* this default is normally overriden */ +#define SDHCI_BCM_DMA_WAITS 0 /* delays slowing DMA transfers: 0-31 */ @@ -28087,9 +28092,11 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci-bcm2708.c linux-3.1.10.patch/driv +static void sdhci_bcm2708_raw_writel(struct sdhci_host *host, u32 val, int reg) +{ + u32 ier; ++ ++#if USE_SPACED_WRITES_2CLK + static bool timeout_disabled = false; + unsigned int ns_2clk = 0; -+ ++ + /* The Arasan has a bugette whereby it may lose the content of + * successive writes to registers that are within two SD-card clock + * cycles of each other (a clock domain crossing problem). @@ -28097,7 +28104,6 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci-bcm2708.c linux-3.1.10.patch/driv + * (Which is just as well - otherwise we'd have to nobble the DMA engine + * too) + */ -+#if 1 + if (reg != SDHCI_BUFFER && host->clock != 0) { + /* host->clock is the clock freq in Hz */ + static hptime_t last_write_hpt; @@ -28118,11 +28124,14 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci-bcm2708.c linux-3.1.10.patch/driv + } + last_write_hpt = now; + } -+#if 1 -+ /* The Arasan is clocked for timeouts using the SD clock which is too fast -+ * for ERASE commands and causes issues. So we disable timeouts for ERASE */ -+ if (host->cmd != NULL && host->cmd->opcode == MMC_ERASE && reg == (SDHCI_COMMAND & ~3)) { -+ mod_timer(&host->timer, jiffies + 30 * HZ); ++#if USE_SOFTWARE_TIMEOUTS ++ /* The Arasan is clocked for timeouts using the SD clock which is too ++ * fast for ERASE commands and causes issues. So we disable timeouts ++ * for ERASE */ ++ if (host->cmd != NULL && host->cmd->opcode == MMC_ERASE && ++ reg == (SDHCI_COMMAND & ~3)) { ++ mod_timer(&host->timer, ++ jiffies + SOFTWARE_ERASE_TIMEOUT_SEC * HZ); + ier = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE); + ier &= ~SDHCI_INT_DATA_TIMEOUT; + writel(ier, host->ioaddr + SDHCI_SIGNAL_ENABLE); @@ -29407,7 +29416,7 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci-bcm2708.c linux-3.1.10.patch/driv + diff -Naur linux-3.1.10/drivers/mmc/host/sdhci.c linux-3.1.10.patch/drivers/mmc/host/sdhci.c --- linux-3.1.10/drivers/mmc/host/sdhci.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/sdhci.c 2012-04-15 16:07:15.276925522 +0200 ++++ linux-3.1.10.patch/drivers/mmc/host/sdhci.c 2012-04-28 22:26:48.820716539 +0200 @@ -16,15 +16,18 @@ #include #include @@ -30687,7 +30696,7 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci.c linux-3.1.10.patch/drivers/mmc/ +MODULE_PARM_DESC(debug_quirks2, "Force certain other quirks."); diff -Naur linux-3.1.10/drivers/mmc/host/sdhci.h linux-3.1.10.patch/drivers/mmc/host/sdhci.h --- linux-3.1.10/drivers/mmc/host/sdhci.h 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/mmc/host/sdhci.h 2012-04-15 16:07:15.142922893 +0200 ++++ linux-3.1.10.patch/drivers/mmc/host/sdhci.h 2012-04-28 22:26:48.662713319 +0200 @@ -274,6 +274,24 @@ void (*platform_reset_exit)(struct sdhci_host *host, u8 mask); int (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); @@ -30748,7 +30757,7 @@ diff -Naur linux-3.1.10/drivers/mmc/host/sdhci.h linux-3.1.10.patch/drivers/mmc/ #endif /* __SDHCI_HW_H */ diff -Naur linux-3.1.10/drivers/net/usb/smsc95xx.c linux-3.1.10.patch/drivers/net/usb/smsc95xx.c --- linux-3.1.10/drivers/net/usb/smsc95xx.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/net/usb/smsc95xx.c 2012-04-15 16:07:15.235924717 +0200 ++++ linux-3.1.10.patch/drivers/net/usb/smsc95xx.c 2012-04-28 22:26:48.733714766 +0200 @@ -46,6 +46,7 @@ #define SMSC95XX_INTERNAL_PHY_ID (1) #define SMSC95XX_TX_OVERHEAD (8) @@ -30828,9 +30837,20 @@ diff -Naur linux-3.1.10/drivers/net/usb/smsc95xx.c linux-3.1.10.patch/drivers/ne /* try reading mac address from EEPROM */ if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { +diff -Naur linux-3.1.10/drivers/usb/Makefile linux-3.1.10.patch/drivers/usb/Makefile +--- linux-3.1.10/drivers/usb/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/Makefile 2012-04-28 22:26:47.696693632 +0200 +@@ -21,6 +21,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.1.10/drivers/usb/core/generic.c linux-3.1.10.patch/drivers/usb/core/generic.c --- linux-3.1.10/drivers/usb/core/generic.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/core/generic.c 2012-04-15 16:07:15.014920382 +0200 ++++ linux-3.1.10.patch/drivers/usb/core/generic.c 2012-04-28 22:26:47.696693632 +0200 @@ -149,6 +149,7 @@ dev_warn(&udev->dev, "no configuration chosen from %d choice%s\n", @@ -30841,7 +30861,7 @@ diff -Naur linux-3.1.10/drivers/usb/core/generic.c linux-3.1.10.patch/drivers/us } diff -Naur linux-3.1.10/drivers/usb/core/hub.c linux-3.1.10.patch/drivers/usb/core/hub.c --- linux-3.1.10/drivers/usb/core/hub.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/core/hub.c 2012-04-15 16:07:15.021920519 +0200 ++++ linux-3.1.10.patch/drivers/usb/core/hub.c 2012-04-28 22:26:48.180703496 +0200 @@ -1071,6 +1071,8 @@ INIT_WORK(&hub->tt.clear_work, hub_tt_work); switch (hdev->descriptor.bDeviceProtocol) { @@ -30957,7 +30977,7 @@ diff -Naur linux-3.1.10/drivers/usb/core/hub.c linux-3.1.10.patch/drivers/usb/co !hcd->driver->port_handed_over || diff -Naur linux-3.1.10/drivers/usb/core/message.c linux-3.1.10.patch/drivers/usb/core/message.c --- linux-3.1.10/drivers/usb/core/message.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/core/message.c 2012-04-15 16:07:15.022920538 +0200 ++++ linux-3.1.10.patch/drivers/usb/core/message.c 2012-04-28 22:26:48.323706410 +0200 @@ -1836,6 +1836,85 @@ if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) @@ -31046,7 +31066,7 @@ diff -Naur linux-3.1.10/drivers/usb/core/message.c linux-3.1.10.patch/drivers/us * to trigger binding of drivers to interfaces. probe() diff -Naur linux-3.1.10/drivers/usb/core/otg_whitelist.h linux-3.1.10.patch/drivers/usb/core/otg_whitelist.h --- linux-3.1.10/drivers/usb/core/otg_whitelist.h 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/core/otg_whitelist.h 2012-04-15 16:07:15.023920557 +0200 ++++ linux-3.1.10.patch/drivers/usb/core/otg_whitelist.h 2012-04-28 22:26:48.438708753 +0200 @@ -19,33 +19,82 @@ static struct usb_device_id whitelist_table [] = { @@ -31262,9 +31282,33 @@ diff -Naur linux-3.1.10/drivers/usb/core/otg_whitelist.h linux-3.1.10.patch/driv #endif } +diff -Naur linux-3.1.10/drivers/usb/gadget/Kconfig linux-3.1.10.patch/drivers/usb/gadget/Kconfig +--- linux-3.1.10/drivers/usb/gadget/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/gadget/Kconfig 2012-04-28 22:26:48.784715805 +0200 +@@ -525,6 +525,20 @@ + depends on USB_GADGET + depends on USB_GADGET_DUALSPEED + ++config USB_GADGET_SNPS_DWC_OTG ++ boolean "Synopsys Driver for DWC_otg Controller" ++ depends on USB && EXPERIMENTAL ++ select USB_OTG ++ select USB_GADGET_DUALSPEED ++ help ++ Selects the Synopsys Driver for the DWC_otg Controller. ++ ++config USB_DWC_OTG_LPM ++ boolean "Enable LPM support" ++ depends on USB && EXPERIMENTAL ++ help ++ Enables LPM support. ++ + # + # USB Gadget Drivers + # diff -Naur linux-3.1.10/drivers/usb/gadget/file_storage.c linux-3.1.10.patch/drivers/usb/gadget/file_storage.c --- linux-3.1.10/drivers/usb/gadget/file_storage.c 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/gadget/file_storage.c 2012-04-15 16:07:15.026920616 +0200 ++++ linux-3.1.10.patch/drivers/usb/gadget/file_storage.c 2012-04-28 22:26:48.442708836 +0200 @@ -572,8 +572,37 @@ .iConfiguration = FSG_STRING_CONFIG, .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, @@ -31386,33 +31430,134 @@ diff -Naur linux-3.1.10/drivers/usb/gadget/file_storage.c linux-3.1.10.patch/dri /* Allocate the request and buffer for endpoint 0 */ fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); if (!req) -diff -Naur linux-3.1.10/drivers/usb/gadget/Kconfig linux-3.1.10.patch/drivers/usb/gadget/Kconfig ---- linux-3.1.10/drivers/usb/gadget/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/gadget/Kconfig 2012-04-15 16:07:15.259925188 +0200 -@@ -525,6 +525,20 @@ - depends on USB_GADGET - depends on USB_GADGET_DUALSPEED +diff -Naur linux-3.1.10/drivers/usb/host/Kconfig linux-3.1.10.patch/drivers/usb/host/Kconfig +--- linux-3.1.10/drivers/usb/host/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/host/Kconfig 2012-04-28 22:26:48.443708856 +0200 +@@ -543,6 +543,19 @@ + To compile this driver a module, choose M here: the module + will be called "hwa-hc". -+config USB_GADGET_SNPS_DWC_OTG -+ boolean "Synopsys Driver for DWC_otg Controller" -+ depends on USB && EXPERIMENTAL -+ select USB_OTG -+ select USB_GADGET_DUALSPEED ++config USB_DWCOTG ++ tristate "Synopsis DWC host support" ++ depends on USB + help -+ Selects the Synopsys Driver for the DWC_otg Controller. ++ The Synopsis DWC controller is a dual-role ++ host/peripheral/OTG ("On The Go") USB controllers. + -+config USB_DWC_OTG_LPM -+ boolean "Enable LPM support" -+ depends on USB && EXPERIMENTAL -+ help -+ 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 "iMX21 HCD support" + depends on USB && ARM && MACH_MX21 +diff -Naur linux-3.1.10/drivers/usb/host/Makefile linux-3.1.10.patch/drivers/usb/host/Makefile +--- linux-3.1.10/drivers/usb/host/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/host/Makefile 2012-04-28 22:26:48.443708856 +0200 +@@ -32,6 +32,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.1.10/drivers/usb/host/dwc_common_port/Makefile linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile +--- linux-3.1.10/drivers/usb/host/dwc_common_port/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile 2012-04-28 22:26:48.813716396 +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_modpow.o dwc_dh.o \ ++ dwc_crypto.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.1.10/drivers/usb/host/dwc_common_port/Makefile.linux linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile.linux +--- linux-3.1.10/drivers/usb/host/dwc_common_port/Makefile.linux 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile.linux 2012-04-28 22:26:48.444708876 +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 + - # - # USB Gadget Drivers - # diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_cc.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_cc.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_cc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_cc.c 2012-04-15 16:07:15.029920676 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_cc.c 2012-04-28 22:26:48.445708896 +0200 @@ -0,0 +1,506 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_cc.c $ @@ -31922,7 +32067,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_cc.c linux-3.1.10.p +} diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_cc.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_cc.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_cc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_cc.h 2012-04-15 16:07:15.030920695 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_cc.h 2012-04-28 22:26:48.446708916 +0200 @@ -0,0 +1,209 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_cc.h $ @@ -32135,7 +32280,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_cc.h linux-3.1.10.p + diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_common_linux.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_common_linux.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_common_linux.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_common_linux.c 2012-04-15 16:07:15.031920714 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_common_linux.c 2012-04-28 22:26:48.448708957 +0200 @@ -0,0 +1,1247 @@ +#include "dwc_cc.h" +#include "dwc_modpow.h" @@ -33386,7 +33531,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_common_linux.c linu +EXPORT_SYMBOL(DWC_WAITQ_ABORT); diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_crypto.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_crypto.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_crypto.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_crypto.c 2012-04-15 16:07:15.032920733 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_crypto.c 2012-04-28 22:26:48.449708978 +0200 @@ -0,0 +1,306 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_crypto.c $ @@ -33696,7 +33841,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_crypto.c linux-3.1. + diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_crypto.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_crypto.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_crypto.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_crypto.h 2012-04-15 16:07:15.033920753 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_crypto.h 2012-04-28 22:26:48.449708978 +0200 @@ -0,0 +1,103 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_crypto.h $ @@ -33803,7 +33948,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_crypto.h linux-3.1. +#endif /* _DWC_CRYPTO_H_ */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_dh.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_dh.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_dh.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_dh.c 2012-04-15 16:07:15.033920753 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_dh.c 2012-04-28 22:26:48.450708999 +0200 @@ -0,0 +1,286 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_dh.c $ @@ -34093,7 +34238,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_dh.c linux-3.1.10.p +#endif /* CONFIG_IPMATE_MACH */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_dh.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_dh.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_dh.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_dh.h 2012-04-15 16:07:15.034920773 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_dh.h 2012-04-28 22:26:48.450708999 +0200 @@ -0,0 +1,98 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_dh.h $ @@ -34195,7 +34340,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_dh.h linux-3.1.10.p +#endif /* _DWC_DH_H_ */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_list.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_list.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_list.h 2012-04-15 16:07:15.035920793 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_list.h 2012-04-28 22:26:48.452709040 +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 $ */ @@ -34815,7 +34960,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_list.h linux-3.1.10 +#endif /* !_SYS_QUEUE_H_ */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_mem.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_mem.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_mem.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_mem.c 2012-04-15 16:07:15.036920813 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_mem.c 2012-04-28 22:26:48.453709060 +0200 @@ -0,0 +1,172 @@ +#include "dwc_os.h" +#include "dwc_list.h" @@ -34991,7 +35136,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_mem.c linux-3.1.10. +#endif /* DEBUG_MEMORY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_modpow.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_modpow.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_modpow.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_modpow.c 2012-04-15 16:07:15.037920833 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_modpow.c 2012-04-28 22:26:48.454709080 +0200 @@ -0,0 +1,622 @@ +/* Bignum routines adapted from PUTTY sources. PuTTY copyright notice follows. + * @@ -35617,7 +35762,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_modpow.c linux-3.1. +#endif /* CONFIG_MACH_IPMATE */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_modpow.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_modpow.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_modpow.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_modpow.h 2012-04-15 16:07:15.037920833 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_modpow.h 2012-04-28 22:26:48.455709101 +0200 @@ -0,0 +1,26 @@ +/* + * dwc_modpow.h @@ -35647,7 +35792,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_modpow.h linux-3.1. +#endif /* _LINUX_BIGNUM_H */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_notifier.c linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_notifier.c --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_notifier.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_notifier.c 2012-04-15 16:07:15.038920852 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_notifier.c 2012-04-28 22:26:48.455709101 +0200 @@ -0,0 +1,256 @@ +#include "dwc_notifier.h" +#include "dwc_list.h" @@ -35907,7 +36052,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_notifier.c linux-3. + diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_notifier.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_notifier.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_notifier.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_notifier.h 2012-04-15 16:07:15.038920852 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_notifier.h 2012-04-28 22:26:48.456709121 +0200 @@ -0,0 +1,112 @@ + +#ifndef __DWC_NOTIFIER_H__ @@ -36023,7 +36168,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_notifier.h linux-3. +#endif /* __DWC_NOTIFIER_H__ */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_os.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_os.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_os.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_os.h 2012-04-15 16:07:15.270925405 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/dwc_os.h 2012-04-28 22:26:48.814716416 +0200 @@ -0,0 +1,925 @@ +/* ========================================================================= + * $File: //dwh/usb_iip/dev/software/dwc_common_port/dwc_os.h $ @@ -36950,99 +37095,9 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/dwc_os.h linux-3.1.10.p + * threading should be able to be implemented with the defined behavior. + * + */ -diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/Makefile linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile ---- linux-3.1.10/drivers/usb/host/dwc_common_port/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile 2012-04-15 16:07:15.270925405 +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_modpow.o dwc_dh.o \ -+ dwc_crypto.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.1.10/drivers/usb/host/dwc_common_port/Makefile.linux linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile.linux ---- linux-3.1.10/drivers/usb/host/dwc_common_port/Makefile.linux 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/Makefile.linux 2012-04-15 16:07:15.028920656 +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.1.10/drivers/usb/host/dwc_common_port/usb.h linux-3.1.10.patch/drivers/usb/host/dwc_common_port/usb.h --- linux-3.1.10/drivers/usb/host/dwc_common_port/usb.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/usb.h 2012-04-15 16:07:15.042920930 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_common_port/usb.h 2012-04-28 22:26:48.459709181 +0200 @@ -0,0 +1,850 @@ +/* + * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37894,9 +37949,93 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_common_port/usb.h linux-3.1.10.patc + + +#endif /* _USB_H_ */ +diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/Makefile linux-3.1.10.patch/drivers/usb/host/dwc_otg/Makefile +--- linux-3.1.10/drivers/usb/host/dwc_otg/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/Makefile 2012-04-28 22:26:48.815716437 +0200 +@@ -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 -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dummy_audio.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dummy_audio.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dummy_audio.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dummy_audio.c 2012-04-15 16:07:15.046921009 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dummy_audio.c 2012-04-28 22:26:48.464709284 +0200 @@ -0,0 +1,1575 @@ +/* + * zero.c -- Gadget Zero, for USB development @@ -39475,7 +39614,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dummy_audio.c linux-3.1.10.patc +module_exit (cleanup); diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_cfi_common.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_cfi_common.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_cfi_common.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_cfi_common.h 2012-04-15 16:07:15.047921028 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_cfi_common.h 2012-04-28 22:26:48.465709304 +0200 @@ -0,0 +1,142 @@ +/* ========================================================================== + * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, @@ -39621,7 +39760,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_cfi_common.h linux-3.1.10.p +#endif diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_attr.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_attr.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_attr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_attr.c 2012-04-15 16:07:15.049921067 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_attr.c 2012-04-28 22:26:48.467709344 +0200 @@ -0,0 +1,1316 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ @@ -40941,7 +41080,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_attr.c linux-3.1.10.pat +} diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_attr.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_attr.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_attr.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_attr.h 2012-04-15 16:07:15.050921087 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_attr.h 2012-04-28 22:26:48.467709344 +0200 @@ -0,0 +1,88 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ @@ -41033,7 +41172,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_attr.h linux-3.1.10.pat +#endif diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cfi.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cfi.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 2012-04-15 16:07:15.053921147 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 2012-04-28 22:26:48.470709406 +0200 @@ -0,0 +1,1876 @@ +/* ========================================================================== + * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, @@ -42913,7 +43052,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cfi.c linux-3.1.10.patc +#endif //DWC_UTE_CFI diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cfi.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cfi.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 2012-04-15 16:07:15.053921147 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 2012-04-28 22:26:48.472709448 +0200 @@ -0,0 +1,319 @@ +/* ========================================================================== + * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, @@ -43236,7 +43375,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cfi.h linux-3.1.10.patc +#endif /* (__DWC_OTG_CFI_H__) */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil.c 2012-04-15 16:07:15.062921323 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil.c 2012-04-28 22:26:48.481709630 +0200 @@ -0,0 +1,5410 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ @@ -48650,7 +48789,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil.c linux-3.1.10.patc +} diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil.h 2012-04-15 16:07:15.064921361 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil.h 2012-04-28 22:26:48.484709691 +0200 @@ -0,0 +1,1143 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $ @@ -49797,7 +49936,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil.h linux-3.1.10.patc +#endif diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 2012-04-15 16:07:15.065921381 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 2012-04-28 22:26:48.485709712 +0200 @@ -0,0 +1,846 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $ @@ -50647,7 +50786,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c linux-3.1.10 +} diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_core_if.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_core_if.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 2012-04-15 16:07:15.067921421 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 2012-04-28 22:26:48.487709754 +0200 @@ -0,0 +1,641 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $ @@ -51292,7 +51431,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_core_if.h linux-3.1.10. +#endif /* __DWC_CORE_IF_H__ */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_dbg.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_dbg.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 2012-04-15 16:07:15.067921421 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 2012-04-28 22:26:48.488709774 +0200 @@ -0,0 +1,113 @@ +/* ========================================================================== + * @@ -51409,7 +51548,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_dbg.h linux-3.1.10.patc +#endif diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_driver.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_driver.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_driver.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_driver.c 2012-04-15 16:07:15.070921480 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_driver.c 2012-04-28 22:26:48.491709834 +0200 @@ -0,0 +1,1577 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ @@ -52990,7 +53129,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_driver.c linux-3.1.10.p +*/ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_driver.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_driver.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_driver.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_driver.h 2012-04-15 16:07:15.070921480 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_driver.h 2012-04-28 22:26:48.491709834 +0200 @@ -0,0 +1,101 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $ @@ -53095,8 +53234,8 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_driver.h linux-3.1.10.p +#endif diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 2012-04-15 16:07:15.075921578 +0200 -@@ -0,0 +1,3330 @@ ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 2012-04-28 22:26:48.890717966 +0200 +@@ -0,0 +1,3334 @@ + +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ @@ -54008,6 +54147,10 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-3.1.10.patc + return 0; +#endif + ++ if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info)) ++ urb->actual_length = urb->length; ++ ++ + hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list); + + /* Remove the host channel from the free list. */ @@ -56427,9 +56570,817 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-3.1.10.patc +} + +#endif /* DWC_DEVICE_ONLY */ +diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +--- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 2012-04-28 22:26:48.497709957 +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(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(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.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 2012-04-15 16:07:15.078921637 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 2012-04-28 22:26:48.499709997 +0200 @@ -0,0 +1,1106 @@ +/*========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $ @@ -57537,817 +58488,9 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c linux-3.1.10 +} + +#endif /* DWC_DEVICE_ONLY */ -diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.h ---- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 2012-04-15 16:07:15.076921598 +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(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(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.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 2012-04-15 16:07:15.079921656 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 2012-04-28 22:26:48.500710017 +0200 @@ -0,0 +1,393 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $ @@ -58744,7 +58887,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h linux-3.1.10.p +#endif /* DWC_DEVICE_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 2012-04-15 16:07:15.082921715 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 2012-04-28 22:26:48.503710079 +0200 @@ -0,0 +1,2065 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ @@ -60813,8 +60956,8 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-3.1.10 +#endif /* DWC_DEVICE_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 2012-04-15 16:07:15.084921755 +0200 -@@ -0,0 +1,840 @@ ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 2012-04-28 22:26:48.891717987 +0200 +@@ -0,0 +1,843 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ + * $Revision: #11 $ @@ -61485,6 +61628,9 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-3.1.1 + urb->number_of_packets, + mem_flags == GFP_ATOMIC ? 1 : 0); + ++ if(dwc_otg_urb == NULL) ++ return -ENOMEM; ++ + urb->hcpriv = dwc_otg_urb; + + dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe), @@ -61657,7 +61803,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-3.1.1 +#endif /* DWC_DEVICE_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 2012-04-15 16:07:15.085921775 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 2012-04-28 22:26:48.507710160 +0200 @@ -0,0 +1,732 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ @@ -62393,7 +62539,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c linux-3.1.1 +#endif /* DWC_DEVICE_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 2012-04-15 16:07:15.088921832 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 2012-04-28 22:26:48.511710242 +0200 @@ -0,0 +1,2067 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $ @@ -64464,7 +64610,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd.c linux-3.1.10.patc +#endif /* DWC_HOST_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 2012-04-15 16:07:15.088921832 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 2012-04-28 22:26:48.511710242 +0200 @@ -0,0 +1,216 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $ @@ -64684,7 +64830,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd.h linux-3.1.10.patc +#endif /* DWC_HOST_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 2012-04-15 16:07:15.089921852 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 2012-04-28 22:26:48.512710263 +0200 @@ -0,0 +1,333 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $ @@ -65021,7 +65167,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h linux-3.1.10.p +#endif /* DWC_HOST_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 2012-04-15 16:07:15.095921970 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 2012-04-28 22:26:48.518710383 +0200 @@ -0,0 +1,4077 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $ @@ -69102,7 +69248,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c linux-3.1.10 +#endif /* DWC_HOST_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 2012-04-15 16:07:15.097922009 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 2012-04-28 22:26:48.521710446 +0200 @@ -0,0 +1,1288 @@ + /* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ @@ -70394,7 +70540,7 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c linux-3.1.1 +#endif /* DWC_HOST_ONLY */ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_regs.h linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_regs.h --- linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_regs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_regs.h 2012-04-15 16:07:15.101922089 +0200 ++++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/dwc_otg_regs.h 2012-04-28 22:26:48.524710507 +0200 @@ -0,0 +1,2237 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $ @@ -72633,139 +72779,44 @@ diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/dwc_otg_regs.h linux-3.1.10.pat +} pcgcctl_data_t; + +#endif -diff -Naur linux-3.1.10/drivers/usb/host/dwc_otg/Makefile linux-3.1.10.patch/drivers/usb/host/dwc_otg/Makefile ---- linux-3.1.10/drivers/usb/host/dwc_otg/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/dwc_otg/Makefile 2012-04-15 16:07:15.271925425 +0200 -@@ -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 -Naur linux-3.1.10/drivers/usb/host/Kconfig linux-3.1.10.patch/drivers/usb/host/Kconfig ---- linux-3.1.10/drivers/usb/host/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/Kconfig 2012-04-15 16:07:15.027920636 +0200 -@@ -543,6 +543,19 @@ - To compile this driver a module, choose M here: the module - will be called "hwa-hc". +diff -Naur linux-3.1.10/drivers/video/Kconfig linux-3.1.10.patch/drivers/video/Kconfig +--- linux-3.1.10/drivers/video/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/video/Kconfig 2012-04-28 22:26:48.667713421 +0200 +@@ -303,6 +303,20 @@ + help + Support the Permedia2 FIFO disconnect feature. -+config USB_DWCOTG -+ tristate "Synopsis DWC host support" -+ depends on USB ++config FB_BCM2708 ++ tristate "BCM2708 framebuffer support" ++ depends on FB && ARM ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT + help -+ The Synopsis DWC controller is a dual-role -+ host/peripheral/OTG ("On The Go") USB controllers. ++ This framebuffer device driver is for the BCM2708 framebuffer. + -+ Enable this option to support this IP in host controller mode. -+ If unsure, say N. ++ 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. + -+ 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 "iMX21 HCD support" - depends on USB && ARM && MACH_MX21 -diff -Naur linux-3.1.10/drivers/usb/host/Makefile linux-3.1.10.patch/drivers/usb/host/Makefile ---- linux-3.1.10/drivers/usb/host/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/host/Makefile 2012-04-15 16:07:15.027920636 +0200 -@@ -32,6 +32,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.1.10/drivers/usb/Makefile linux-3.1.10.patch/drivers/usb/Makefile ---- linux-3.1.10/drivers/usb/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/usb/Makefile 2012-04-15 16:07:15.014920382 +0200 -@@ -21,6 +21,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/ - + config FB_ARMCLCD + tristate "ARM PrimeCell PL110 support" + depends on FB && ARM && ARM_AMBA +diff -Naur linux-3.1.10/drivers/video/Makefile linux-3.1.10.patch/drivers/video/Makefile +--- linux-3.1.10/drivers/video/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/video/Makefile 2012-04-28 22:26:48.669713462 +0200 +@@ -95,6 +95,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.1.10/drivers/video/bcm2708_fb.c linux-3.1.10.patch/drivers/video/bcm2708_fb.c --- linux-3.1.10/drivers/video/bcm2708_fb.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/video/bcm2708_fb.c 2012-04-15 16:07:15.309926170 +0200 ++++ linux-3.1.10.patch/drivers/video/bcm2708_fb.c 2012-04-28 22:26:48.886717884 +0200 @@ -0,0 +1,461 @@ +/* + * linux/drivers/video/bcm2708_fb.c @@ -73228,33 +73279,9 @@ diff -Naur linux-3.1.10/drivers/video/bcm2708_fb.c linux-3.1.10.patch/drivers/vi + +MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer"); +MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer"); -diff -Naur linux-3.1.10/drivers/video/Kconfig linux-3.1.10.patch/drivers/video/Kconfig ---- linux-3.1.10/drivers/video/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/video/Kconfig 2012-04-15 16:07:15.147922991 +0200 -@@ -303,6 +303,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.1.10/drivers/video/logo/logo_linux_clut224.ppm linux-3.1.10.patch/drivers/video/logo/logo_linux_clut224.ppm --- linux-3.1.10/drivers/video/logo/logo_linux_clut224.ppm 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/video/logo/logo_linux_clut224.ppm 2012-04-15 16:07:15.153923108 +0200 ++++ linux-3.1.10.patch/drivers/video/logo/logo_linux_clut224.ppm 2012-04-28 22:26:48.676713605 +0200 @@ -1,1604 +1,883 @@ P3 -# Standard 224-color Linux logo @@ -75741,20 +75768,36 @@ diff -Naur linux-3.1.10/drivers/video/logo/logo_linux_clut224.ppm linux-3.1.10.p +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 -Naur linux-3.1.10/drivers/video/Makefile linux-3.1.10.patch/drivers/video/Makefile ---- linux-3.1.10/drivers/video/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/video/Makefile 2012-04-15 16:07:15.147922991 +0200 -@@ -95,6 +95,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.1.10/drivers/watchdog/Kconfig linux-3.1.10.patch/drivers/watchdog/Kconfig +--- linux-3.1.10/drivers/watchdog/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/watchdog/Kconfig 2012-04-28 22:26:48.664713361 +0200 +@@ -348,6 +348,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.1.10/drivers/watchdog/Makefile linux-3.1.10.patch/drivers/watchdog/Makefile +--- linux-3.1.10/drivers/watchdog/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/drivers/watchdog/Makefile 2012-04-28 22:26:48.665713381 +0200 +@@ -54,6 +54,7 @@ + obj-$(CONFIG_ADX_WATCHDOG) += adx_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.1.10/drivers/watchdog/bcm2708_wdog.c linux-3.1.10.patch/drivers/watchdog/bcm2708_wdog.c --- linux-3.1.10/drivers/watchdog/bcm2708_wdog.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/drivers/watchdog/bcm2708_wdog.c 2012-04-15 16:07:15.145922951 +0200 ++++ linux-3.1.10.patch/drivers/watchdog/bcm2708_wdog.c 2012-04-28 22:26:48.665713381 +0200 @@ -0,0 +1,385 @@ +/* + * Broadcom BCM2708 watchdog driver. @@ -76141,36 +76184,9 @@ diff -Naur linux-3.1.10/drivers/watchdog/bcm2708_wdog.c linux-3.1.10.patch/drive +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); + -diff -Naur linux-3.1.10/drivers/watchdog/Kconfig linux-3.1.10.patch/drivers/watchdog/Kconfig ---- linux-3.1.10/drivers/watchdog/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/watchdog/Kconfig 2012-04-15 16:07:15.144922931 +0200 -@@ -348,6 +348,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.1.10/drivers/watchdog/Makefile linux-3.1.10.patch/drivers/watchdog/Makefile ---- linux-3.1.10/drivers/watchdog/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/drivers/watchdog/Makefile 2012-04-15 16:07:15.144922931 +0200 -@@ -54,6 +54,7 @@ - obj-$(CONFIG_ADX_WATCHDOG) += adx_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.1.10/include/linux/mmc/host.h linux-3.1.10.patch/include/linux/mmc/host.h --- linux-3.1.10/include/linux/mmc/host.h 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/include/linux/mmc/host.h 2012-04-15 16:07:15.143922912 +0200 ++++ linux-3.1.10.patch/include/linux/mmc/host.h 2012-04-28 22:26:48.663713340 +0200 @@ -12,6 +12,7 @@ #include @@ -76251,7 +76267,7 @@ diff -Naur linux-3.1.10/include/linux/mmc/host.h linux-3.1.10.patch/include/linu #endif /* LINUX_MMC_HOST_H */ diff -Naur linux-3.1.10/include/linux/mmc/sdhci.h linux-3.1.10.patch/include/linux/mmc/sdhci.h --- linux-3.1.10/include/linux/mmc/sdhci.h 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/include/linux/mmc/sdhci.h 2012-04-15 16:07:15.143922912 +0200 ++++ linux-3.1.10.patch/include/linux/mmc/sdhci.h 2012-04-28 22:26:48.663713340 +0200 @@ -88,6 +88,10 @@ /* The read-only detection via SDHCI_PRESENT_STATE register is unstable */ #define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1<<31) @@ -76285,436 +76301,38 @@ diff -Naur linux-3.1.10/include/linux/mmc/sdhci.h linux-3.1.10.patch/include/lin struct mmc_data *data; /* Current data request */ unsigned int data_early:1; /* Data finished before cmd */ -diff -Naur linux-3.1.10/sound/arm/bcm2835.c linux-3.1.10.patch/sound/arm/bcm2835.c ---- linux-3.1.10/sound/arm/bcm2835.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/bcm2835.c 2012-04-15 16:07:15.305926091 +0200 -@@ -0,0 +1,423 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ +diff -Naur linux-3.1.10/sound/arm/Kconfig linux-3.1.10.patch/sound/arm/Kconfig +--- linux-3.1.10/sound/arm/Kconfig 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/sound/arm/Kconfig 2012-04-28 22:26:48.837716886 +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 + -+#include + endif # SND_ARM + +diff -Naur linux-3.1.10/sound/arm/Makefile linux-3.1.10.patch/sound/arm/Makefile +--- linux-3.1.10/sound/arm/Makefile 2012-01-18 16:33:18.000000000 +0100 ++++ linux-3.1.10.patch/sound/arm/Makefile 2012-04-28 22:26:48.838716906 +0200 +@@ -14,3 +14,9 @@ + + obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o + snd-pxa2xx-ac97-objs := pxa2xx-ac97.o + -+#include -+#include ++obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o ++snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o + -+#include "bcm2835.h" ++EXTRA_CFLAGS += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel + -+/* 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.1.10/sound/arm/bcm2835-ctl.c linux-3.1.10.patch/sound/arm/bcm2835-ctl.c --- linux-3.1.10/sound/arm/bcm2835-ctl.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/bcm2835-ctl.c 2012-04-15 16:07:15.301926013 +0200 ++++ linux-3.1.10.patch/sound/arm/bcm2835-ctl.c 2012-04-28 22:26:48.875717660 +0200 @@ -0,0 +1,172 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. @@ -76888,255 +76506,9 @@ diff -Naur linux-3.1.10/sound/arm/bcm2835-ctl.c linux-3.1.10.patch/sound/arm/bcm + } + return 0; +} -diff -Naur linux-3.1.10/sound/arm/bcm2835.h linux-3.1.10.patch/sound/arm/bcm2835.h ---- linux-3.1.10/sound/arm/bcm2835.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/bcm2835.h 2012-04-15 16:07:15.309926170 +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.1.10/sound/arm/bcm2835-pcm.c linux-3.1.10.patch/sound/arm/bcm2835-pcm.c --- linux-3.1.10/sound/arm/bcm2835-pcm.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/bcm2835-pcm.c 2012-04-15 16:07:15.308926150 +0200 ++++ linux-3.1.10.patch/sound/arm/bcm2835-pcm.c 2012-04-28 22:26:48.884717844 +0200 @@ -0,0 +1,424 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. @@ -77564,8 +76936,8 @@ diff -Naur linux-3.1.10/sound/arm/bcm2835-pcm.c linux-3.1.10.patch/sound/arm/bcm +} diff -Naur linux-3.1.10/sound/arm/bcm2835-vchiq.c linux-3.1.10.patch/sound/arm/bcm2835-vchiq.c --- linux-3.1.10/sound/arm/bcm2835-vchiq.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/bcm2835-vchiq.c 2012-04-15 16:07:15.308926150 +0200 -@@ -0,0 +1,813 @@ ++++ linux-3.1.10.patch/sound/arm/bcm2835-vchiq.c 2012-04-28 22:26:48.888717924 +0200 +@@ -0,0 +1,818 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -78329,20 +77701,25 @@ diff -Naur linux-3.1.10/sound/arm/bcm2835-vchiq.c linux-3.1.10.patch/sound/arm/b + ret = -1; + goto unlock; + } -+ LOG_DBG(" ... send header\n"); ++ LOG_DBG(" ... sent header\n"); ++ if (!m.u.write.silence) { ++ /* Send the message to the videocore */ ++ success = vchi_bulk_queue_transmit(instance->vchi_handle[0], ++ src, count, ++ 0 * ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED ++ + ++ 1 * ++ VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, ++ NULL); ++ if (success != 0) { ++ LOG_ERR ++ ("%s: failed on vchi_bulk_queue_transmit (status=%d)", ++ __func__, success); + -+ /* Send the message to the videocore */ -+ success = vchi_bulk_queue_transmit(instance->vchi_handle[0], -+ src, count, -+ 0 * VCHI_FLAGS_BLOCK_UNTIL_QUEUED + -+ 1 * VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, -+ NULL); -+ if (success != 0) { -+ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)", -+ __func__, success); -+ -+ ret = -1; -+ goto unlock; ++ ret = -1; ++ goto unlock; ++ } + } + ret = 0; + @@ -78379,38 +77756,682 @@ diff -Naur linux-3.1.10/sound/arm/bcm2835-vchiq.c linux-3.1.10.patch/sound/arm/b + atomic_sub(count, &alsa_stream->retrieved); + return count; +} -diff -Naur linux-3.1.10/sound/arm/Kconfig linux-3.1.10.patch/sound/arm/Kconfig ---- linux-3.1.10/sound/arm/Kconfig 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/Kconfig 2012-04-15 16:07:15.293925856 +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 +diff -Naur linux-3.1.10/sound/arm/bcm2835.c linux-3.1.10.patch/sound/arm/bcm2835.c +--- linux-3.1.10/sound/arm/bcm2835.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/sound/arm/bcm2835.c 2012-04-28 22:26:48.880717762 +0200 +@@ -0,0 +1,423 @@ ++/***************************************************************************** ++* 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 -Naur linux-3.1.10/sound/arm/Makefile linux-3.1.10.patch/sound/arm/Makefile ---- linux-3.1.10/sound/arm/Makefile 2012-01-18 16:33:18.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/Makefile 2012-04-15 16:07:15.294925876 +0200 -@@ -14,3 +14,9 @@ - - 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 + -+EXTRA_CFLAGS += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel ++#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 -Naur linux-3.1.10/sound/arm/bcm2835.h linux-3.1.10.patch/sound/arm/bcm2835.h +--- linux-3.1.10/sound/arm/bcm2835.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.1.10.patch/sound/arm/bcm2835.h 2012-04-28 22:26:48.885717864 +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.1.10/sound/arm/vc_vchi_audioserv_defs.h linux-3.1.10.patch/sound/arm/vc_vchi_audioserv_defs.h --- linux-3.1.10/sound/arm/vc_vchi_audioserv_defs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-3.1.10.patch/sound/arm/vc_vchi_audioserv_defs.h 2012-04-15 16:07:15.306926110 +0200 ++++ linux-3.1.10.patch/sound/arm/vc_vchi_audioserv_defs.h 2012-04-28 22:26:48.883717824 +0200 @@ -0,0 +1,112 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved.