summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/arm/bcm28xx/patches/4.1.6/0001-raspberry-pi-github.patch (renamed from target/arm/bcm28xx/patches/4.1.6/0001-xbian.patch)35401
1 files changed, 20985 insertions, 14416 deletions
diff --git a/target/arm/bcm28xx/patches/4.1.6/0001-xbian.patch b/target/arm/bcm28xx/patches/4.1.6/0001-raspberry-pi-github.patch
index 318706994..ce089a8cd 100644
--- a/target/arm/bcm28xx/patches/4.1.6/0001-xbian.patch
+++ b/target/arm/bcm28xx/patches/4.1.6/0001-raspberry-pi-github.patch
@@ -1,328 +1,276 @@
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708_common.dtsi linux-xbian-rpi/arch/arm/boot/dts/bcm2708_common.dtsi
---- linux-4.1.3/arch/arm/boot/dts/bcm2708_common.dtsi 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2708_common.dtsi 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,287 @@
-+/include/ "skeleton.dtsi"
-+
-+/ {
-+ interrupt-parent = <&intc>;
-+
-+ aliases {
-+ audio = &audio;
-+ sound = &sound;
-+ soc = &soc;
-+ dma = &dma;
-+ intc = &intc;
-+ watchdog = &watchdog;
-+ random = &random;
-+ mailbox = &mailbox;
-+ gpio = &gpio;
-+ uart0 = &uart0;
-+ i2s = &i2s;
-+ spi0 = &spi0;
-+ i2c0 = &i2c0;
-+ uart1 = &uart1;
-+ mmc = &mmc;
-+ i2c1 = &i2c1;
-+ i2c2 = &i2c2;
-+ usb = &usb;
-+ leds = &leds;
-+ fb = &fb;
-+ vchiq = &vchiq;
-+ thermal = &thermal;
-+ clocks = &clocks;
-+ };
-+
-+ /* Onboard audio */
-+ audio: audio {
-+ compatible = "brcm,bcm2835-audio";
-+ brcm,pwm-channels = <8>;
-+ status = "disabled";
-+ };
-+
-+ /* External sound card */
-+ sound: sound {
-+ };
-+
-+ soc: soc {
-+ compatible = "simple-bus";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ dma: dma@7e007000 {
-+ compatible = "brcm,bcm2835-dma";
-+ reg = <0x7e007000 0xf00>;
-+ interrupts = <1 16>,
-+ <1 17>,
-+ <1 18>,
-+ <1 19>,
-+ <1 20>,
-+ <1 21>,
-+ <1 22>,
-+ <1 23>,
-+ <1 24>,
-+ <1 25>,
-+ <1 26>,
-+ <1 27>,
-+ <1 28>;
+diff -Nur linux-4.1.6/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 linux-rpi/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00
+--- linux-4.1.6/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 2015-08-26 10:26:04.449256090 +0200
+@@ -0,0 +1,6 @@
++What: /sys/bus/w1/devices/.../w1_seq
++Date: Apr 2015
++Contact: Matt Campbell <mattrcampbell@gmail.com>
++Description: Support for the DS28EA00 chain sequence function
++ see Documentation/w1/slaves/w1_therm for detailed information
++Users: any user space application which wants to communicate with DS28EA00
+diff -Nur linux-4.1.6/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt linux-rpi/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt
+--- linux-4.1.6/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt 2015-08-26 10:26:04.513256993 +0200
+@@ -48,8 +48,8 @@
+
+ bcm2835_i2s: i2s@7e203000 {
+ compatible = "brcm,bcm2835-i2s";
+- reg = < 0x7e203000 0x20>,
+- < 0x7e101098 0x02>;
++ reg = < 0x7e203000 0x24>,
++ < 0x7e101098 0x08>;
+
+ dmas = <&dma 2>,
+ <&dma 3>;
+diff -Nur linux-4.1.6/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt linux-rpi/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt
+--- linux-4.1.6/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt 2015-08-26 10:26:04.549257500 +0200
+@@ -16,8 +16,8 @@
+
+ bcm2835_i2s: i2s@7e203000 {
+ compatible = "brcm,bcm2835-i2s";
+- reg = <0x7e203000 0x20>,
+- <0x7e101098 0x02>;
++ reg = <0x7e203000 0x24>,
++ <0x7e101098 0x08>;
+
+ dmas = <&dma 2>,
+ <&dma 3>;
+diff -Nur linux-4.1.6/Documentation/video4linux/bcm2835-v4l2.txt linux-rpi/Documentation/video4linux/bcm2835-v4l2.txt
+--- linux-4.1.6/Documentation/video4linux/bcm2835-v4l2.txt 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/Documentation/video4linux/bcm2835-v4l2.txt 2015-08-26 10:26:04.645258854 +0200
+@@ -0,0 +1,60 @@
+
-+ #dma-cells = <1>;
-+ brcm,dma-channel-mask = <0x7f35>;
-+ };
++BCM2835 (aka Raspberry Pi) V4L2 driver
++======================================
+
-+ intc: interrupt-controller {
-+ compatible = "brcm,bcm2708-armctrl-ic";
-+ reg = <0x7e00b200 0x200>;
-+ interrupt-controller;
-+ #interrupt-cells = <2>;
-+ };
++1. Copyright
++============
+
-+ mailbox: mailbox@7e00b800 {
-+ compatible = "brcm,bcm2835-mbox";
-+ reg = <0x7e00b880 0x40>;
-+ interrupts = <0 1>;
-+ #mbox-cells = <0>;
-+ };
++Copyright © 2013 Raspberry Pi (Trading) Ltd.
+
-+ watchdog: watchdog@7e100000 {
-+ compatible = "brcm,bcm2835-pm-wdt";
-+ reg = <0x7e100000 0x28>;
-+ status = "disabled";
-+ };
++2. License
++==========
+
-+ random: rng@7e104000 {
-+ compatible = "brcm,bcm2835-rng";
-+ reg = <0x7e104000 0x10>;
-+ status = "disabled";
-+ };
++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.
+
-+ gpio: gpio@7e200000 {
-+ compatible = "brcm,bcm2835-gpio";
-+ reg = <0x7e200000 0xb4>;
-+ interrupts = <2 17>, <2 18>;
++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.
+
-+ gpio-controller;
-+ #gpio-cells = <2>;
++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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
-+ interrupt-controller;
-+ #interrupt-cells = <2>;
-+ };
++3. Quick Start
++==============
+
-+ uart0: uart@7e201000 {
-+ compatible = "arm,pl011", "arm,primecell";
-+ reg = <0x7e201000 0x1000>;
-+ interrupts = <2 25>;
-+ clocks = <&clk_uart0 &clk_apb_p>;
-+ clock-names = "uartclk","apb_pclk";
-+ arm,primecell-periphid = <0x00241011>; // For an explanation, see
-+ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038
-+ status = "disabled";
-+ };
++You need a version 1.0 or later of v4l2-ctl, available from:
++ git://git.linuxtv.org/v4l-utils.git
+
-+ i2s: i2s@7e203000 {
-+ compatible = "brcm,bcm2708-i2s";
-+ reg = <0x7e203000 0x24>,
-+ <0x7e101098 0x08>;
++$ sudo modprobe bcm2835-v4l2
+
-+ //dmas = <&dma 2>,
-+ // <&dma 3>;
-+ dma-names = "tx", "rx";
-+ status = "disabled";
-+ };
++Turn on the overlay:
+
-+ spi0: spi@7e204000 {
-+ compatible = "brcm,bcm2835-spi";
-+ reg = <0x7e204000 0x1000>;
-+ interrupts = <2 22>;
-+ clocks = <&clk_core>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ /* the dma channels */
-+ dmas = <&dma 6>, <&dma 7>;
-+ dma-names = "tx", "rx";
-+ /* the chipselects used - <0> means native GPIO
-+ * add more gpios if necessary as <&gpio 6 1>
-+ * (but do not forget to make them output!)
-+ */
-+ cs-gpios = <0>, <0>;
-+ };
++$ v4l2-ctl --overlay=1
+
-+ i2c0: i2c@7e205000 {
-+ compatible = "brcm,bcm2708-i2c";
-+ reg = <0x7e205000 0x1000>;
-+ interrupts = <2 21>;
-+ clocks = <&clk_i2c>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
++Turn off the overlay:
+
-+ uart1: uart@7e215040 {
-+ compatible = "brcm,bcm2835-aux-uart", "ns16550";
-+ reg = <0x7e215040 0x40>;
-+ interrupts = <1 29>;
-+ clock-frequency = <500000000>;
-+ reg-shift = <2>;
-+ no-loopback-test;
-+ status = "disabled";
-+ };
++$ v4l2-ctl --overlay=0
+
-+ mmc: mmc@7e300000 {
-+ compatible = "brcm,bcm2835-mmc";
-+ reg = <0x7e300000 0x100>;
-+ interrupts = <2 30>;
-+ clocks = <&clk_mmc>;
-+ dmas = <&dma 11>,
-+ <&dma 11>;
-+ dma-names = "tx", "rx";
-+ status = "disabled";
-+ };
++Set the capture format for video:
+
-+ i2c1: i2c@7e804000 {
-+ compatible = "brcm,bcm2708-i2c";
-+ reg = <0x7e804000 0x1000>;
-+ interrupts = <2 21>;
-+ clocks = <&clk_i2c>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
++$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4
+
-+ i2c2: i2c@7e805000 {
-+ // Beware - this is shared with the HDMI module.
-+ // Careless use may break (really) your display.
-+ // Caveat emptor.
-+ compatible = "brcm,bcm2708-i2c";
-+ reg = <0x7e805000 0x1000>;
-+ interrupts = <2 21>;
-+ clocks = <&clk_i2c>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
++(Note: 1088 not 1080).
+
-+ usb: usb@7e980000 {
-+ compatible = "brcm,bcm2708-usb";
-+ reg = <0x7e980000 0x10000>,
-+ <0x7e006000 0x1000>;
-+ interrupts = <2 0>,
-+ <1 9>;
-+ };
++Capture:
+
-+ firmware: firmware {
-+ compatible = "raspberrypi,bcm2835-firmware";
-+ mboxes = <&mailbox>;
-+ };
++$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264
+
-+ leds: leds {
-+ compatible = "gpio-leds";
-+ };
++Stills capture:
+
-+ fb: fb {
-+ compatible = "brcm,bcm2708-fb";
-+ firmware = <&firmware>;
-+ status = "disabled";
-+ };
++$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3
++$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg
+
-+ vchiq: vchiq {
-+ compatible = "brcm,bcm2835-vchiq";
-+ reg = <0x7e00b840 0xf>;
-+ interrupts = <0 2>;
-+ cache-line-size = <32>;
-+ firmware = <&firmware>;
-+ };
++List of available formats:
+
-+ thermal: thermal {
-+ compatible = "brcm,bcm2835-thermal";
-+ firmware = <&firmware>;
-+ };
-+ };
++$ v4l2-ctl --list-formats
+diff -Nur linux-4.1.6/Documentation/w1/slaves/w1_therm linux-rpi/Documentation/w1/slaves/w1_therm
+--- linux-4.1.6/Documentation/w1/slaves/w1_therm 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/Documentation/w1/slaves/w1_therm 2015-08-26 10:26:04.653258968 +0200
+@@ -11,12 +11,14 @@
+ Description
+ -----------
+
+-w1_therm provides basic temperature conversion for ds18*20 devices.
++w1_therm provides basic temperature conversion for ds18*20 devices, and the
++ds28ea00 device.
+ supported family codes:
+ W1_THERM_DS18S20 0x10
+ W1_THERM_DS1822 0x22
+ W1_THERM_DS18B20 0x28
+ W1_THERM_DS1825 0x3B
++W1_THERM_DS28EA00 0x42
+
+ Support is provided through the sysfs w1_slave file. Each open and
+ read sequence will initiate a temperature conversion then provide two
+@@ -48,3 +50,10 @@
+ maximum current draw of 1.5mA and that a 5k pullup resistor is not
+ sufficient. The strong pullup is designed to provide the additional
+ current required.
+
-+ clocks: clocks {
-+ compatible = "simple-bus";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
++The DS28EA00 provides an additional two pins for implementing a sequence
++detection algorithm. This feature allows you to determine the physical
++location of the chip in the 1-wire bus without needing pre-existing
++knowledge of the bus ordering. Support is provided through the sysfs
++w1_seq file. The file will contain a single line with an integer value
++representing the device index in the bus starting at 0.
+diff -Nur linux-4.1.6/arch/arm/Kconfig linux-rpi/arch/arm/Kconfig
+--- linux-4.1.6/arch/arm/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/Kconfig 2015-08-26 10:26:04.685259419 +0200
+@@ -314,6 +314,42 @@
+ default ARCH_VERSATILE if !MMU
+ default ARCH_MULTIPLATFORM if MMU
+
++config ARCH_BCM2708
++ bool "Broadcom BCM2708 family"
++ select CPU_V6
++ select ARM_AMBA
++ select HAVE_SCHED_CLOCK
++ select NEED_MACH_GPIO_H
++ select NEED_MACH_MEMORY_H
++ select COMMON_CLK
++ select ARCH_HAS_CPUFREQ
++ select GENERIC_CLOCKEVENTS
++ select ARM_ERRATA_411920
++ select MACH_BCM2708
++ select VC4
++ select FIQ
++ help
++ This enables support for Broadcom BCM2708 boards.
+
-+ clk_mmc: clock@0 {
-+ compatible = "fixed-clock";
-+ reg = <0>;
-+ #clock-cells = <0>;
-+ clock-output-names = "mmc";
-+ clock-frequency = <250000000>;
-+ };
++config ARCH_BCM2709
++ bool "Broadcom BCM2709 family"
++ select ARCH_HAS_BARRIERS if SMP
++ select CPU_V7
++ select HAVE_SMP
++ select ARM_AMBA
++ select MIGHT_HAVE_CACHE_L2X0
++ select HAVE_SCHED_CLOCK
++ select NEED_MACH_MEMORY_H
++ select NEED_MACH_IO_H
++ select COMMON_CLK
++ select ARCH_HAS_CPUFREQ
++ select GENERIC_CLOCKEVENTS
++ select MACH_BCM2709
++ select VC4
++ select FIQ
++ help
++ This enables support for Broadcom BCM2709 boards.
+
-+ clk_i2c: clock@1 {
-+ compatible = "fixed-clock";
-+ reg = <1>;
-+ #clock-cells = <0>;
-+ clock-output-names = "i2c";
-+ clock-frequency = <250000000>;
-+ };
+ config ARCH_MULTIPLATFORM
+ bool "Allow multiple platforms to be selected"
+ depends on MMU
+@@ -823,6 +859,9 @@
+ # Kconfigs may be included either alphabetically (according to the
+ # plat- suffix) or along side the corresponding mach-* source.
+ #
++source "arch/arm/mach-bcm2708/Kconfig"
++source "arch/arm/mach-bcm2709/Kconfig"
+
-+ clk_core: clock@2 {
-+ compatible = "fixed-clock";
-+ reg = <2>;
-+ #clock-cells = <0>;
-+ clock-output-names = "core";
-+ clock-frequency = <250000000>;
-+ };
+ source "arch/arm/mach-mvebu/Kconfig"
+
+ source "arch/arm/mach-alpine/Kconfig"
+diff -Nur linux-4.1.6/arch/arm/Kconfig.debug linux-rpi/arch/arm/Kconfig.debug
+--- linux-4.1.6/arch/arm/Kconfig.debug 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/Kconfig.debug 2015-08-26 10:26:04.685259419 +0200
+@@ -1197,6 +1197,14 @@
+ options; the platform specific options are deprecated
+ and will be soon removed.
+
++ config DEBUG_BCM2708_UART0
++ bool "Broadcom BCM2708 UART0 (PL011)"
++ depends on MACH_BCM2708
++ help
++ Say Y here if you want the debug print routines to direct
++ their output to UART 0. The port must have been initialised
++ by the boot-loader before use.
+
-+ clk_uart0: clock@3 {
-+ compatible = "fixed-clock";
-+ reg = <3>;
-+ #clock-cells = <0>;
-+ clock-output-names = "uart0_pclk";
-+ clock-frequency = <3000000>;
-+ };
+ endchoice
+
+ config DEBUG_AT91_UART
+diff -Nur linux-4.1.6/arch/arm/Makefile linux-rpi/arch/arm/Makefile
+--- linux-4.1.6/arch/arm/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/Makefile 2015-08-26 10:26:04.685259419 +0200
+@@ -142,6 +142,8 @@
+
+ # Machine directory name. This list is sorted alphanumerically
+ # by CONFIG_* macro name.
++machine-$(CONFIG_ARCH_BCM2708) += bcm2708
++machine-$(CONFIG_ARCH_BCM2709) += bcm2709
+ machine-$(CONFIG_ARCH_ALPINE) += alpine
+ machine-$(CONFIG_ARCH_AT91) += at91
+ machine-$(CONFIG_ARCH_AXXIA) += axxia
+diff -Nur linux-4.1.6/arch/arm/boot/dts/Makefile linux-rpi/arch/arm/boot/dts/Makefile
+--- linux-4.1.6/arch/arm/boot/dts/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/boot/dts/Makefile 2015-08-26 10:26:04.685259419 +0200
+@@ -1,5 +1,21 @@
+ ifeq ($(CONFIG_OF),y)
+
++dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb
++dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb
++dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-cm.dtb
++dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb
+
-+ clk_apb_p: clock@4 {
-+ compatible = "fixed-clock";
-+ reg = <4>;
-+ #clock-cells = <0>;
-+ clock-output-names = "apb_pclk";
-+ clock-frequency = <126000000>;
-+ };
-+ };
++# Raspberry Pi
++ifeq ($(CONFIG_BCM2708_DT),y)
++ RPI_DT_OVERLAYS=y
++endif
++ifeq ($(CONFIG_BCM2709_DT),y)
++ RPI_DT_OVERLAYS=y
++endif
++ifeq ($(CONFIG_ARCH_BCM2835),y)
++ RPI_DT_OVERLAYS=y
++endif
+
-+ __overrides__ {
-+ cache_line_size = <&vchiq>, "cache-line-size:0";
-+ };
-+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708.dtsi linux-xbian-rpi/arch/arm/boot/dts/bcm2708.dtsi
---- linux-4.1.3/arch/arm/boot/dts/bcm2708.dtsi 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2708.dtsi 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,19 @@
-+/include/ "bcm2708_common.dtsi"
+ dtb-$(CONFIG_ARCH_ALPINE) += \
+ alpine-db.dtb
+ dtb-$(CONFIG_MACH_ASM9260) += \
+@@ -660,7 +676,18 @@
+ mt6592-evb.dtb \
+ mt8127-moose.dtb \
+ mt8135-evbp1.dtb
+
-+/ {
-+ compatible = "brcm,bcm2708";
-+ model = "BCM2708";
++targets += dtbs dtbs_install
++targets += $(dtb-y)
+
-+ chosen {
-+ /* No padding required - the boot loader can do that. */
-+ bootargs = "";
-+ };
+ endif
+
+ always := $(dtb-y)
+ clean-files := *.dtb
+
-+ soc {
-+ ranges = <0x7e000000 0x20000000 0x01000000>;
++# Enable fixups to support overlays on BCM2708 platforms
++ifeq ($(RPI_DT_OVERLAYS),y)
++ DTC_FLAGS ?= -@
++endif
+
-+ arm-pmu {
-+ compatible = "arm,arm1176-pmu";
-+ };
-+ };
-+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b.dts linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-b.dts
---- linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-b.dts 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,119 @@
++subdir-y += overlays
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts linux-rpi/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
+--- linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts 2015-08-26 10:26:04.693259532 +0200
+@@ -0,0 +1,129 @@
+/dts-v1/;
+
+/include/ "bcm2708.dtsi"
+
+/ {
+ compatible = "brcm,bcm2708";
-+ model = "Raspberry Pi Model B";
++ model = "Raspberry Pi Model B+";
+};
+
+&gpio {
@@ -342,8 +290,8 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b.dts linux-xbian-rpi/arch/a
+ };
+
+ i2s_pins: i2s {
-+ brcm,pins = <28 29 30 31>;
-+ brcm,function = <6>; /* alt2 */
++ brcm,pins = <18 19 20 21>;
++ brcm,function = <4>; /* alt0 */
+ };
+};
+
@@ -407,7 +355,13 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b.dts linux-xbian-rpi/arch/a
+ act_led: act {
+ label = "led0";
+ linux,default-trigger = "mmc0";
-+ gpios = <&gpio 16 1>;
++ gpios = <&gpio 47 0>;
++ };
++
++ pwr_led: pwr {
++ label = "led1";
++ linux,default-trigger = "input";
++ gpios = <&gpio 35 0>;
+ };
+};
+
@@ -430,22 +384,26 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b.dts linux-xbian-rpi/arch/a
+ act_led_activelow = <&act_led>,"gpios:8";
+ act_led_trigger = <&act_led>,"linux,default-trigger";
+
++ pwr_led_gpio = <&pwr_led>,"gpios:4";
++ pwr_led_activelow = <&pwr_led>,"gpios:8";
++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
++
+ audio = <&audio>,"status";
+ watchdog = <&watchdog>,"status";
+ random = <&random>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
---- linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,129 @@
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-b.dts linux-rpi/arch/arm/boot/dts/bcm2708-rpi-b.dts
+--- linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-b.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2708-rpi-b.dts 2015-08-26 10:26:04.693259532 +0200
+@@ -0,0 +1,119 @@
+/dts-v1/;
+
+/include/ "bcm2708.dtsi"
+
+/ {
+ compatible = "brcm,bcm2708";
-+ model = "Raspberry Pi Model B+";
++ model = "Raspberry Pi Model B";
+};
+
+&gpio {
@@ -465,8 +423,8 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts linux-xbian-rpi/a
+ };
+
+ i2s_pins: i2s {
-+ brcm,pins = <18 19 20 21>;
-+ brcm,function = <4>; /* alt0 */
++ brcm,pins = <28 29 30 31>;
++ brcm,function = <6>; /* alt2 */
+ };
+};
+
@@ -530,13 +488,7 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts linux-xbian-rpi/a
+ act_led: act {
+ label = "led0";
+ linux,default-trigger = "mmc0";
-+ gpios = <&gpio 47 0>;
-+ };
-+
-+ pwr_led: pwr {
-+ label = "led1";
-+ linux,default-trigger = "input";
-+ gpios = <&gpio 35 0>;
++ gpios = <&gpio 16 1>;
+ };
+};
+
@@ -559,18 +511,14 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts linux-xbian-rpi/a
+ act_led_activelow = <&act_led>,"gpios:8";
+ act_led_trigger = <&act_led>,"linux,default-trigger";
+
-+ pwr_led_gpio = <&pwr_led>,"gpios:4";
-+ pwr_led_activelow = <&pwr_led>,"gpios:8";
-+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
-+
+ audio = <&audio>,"status";
+ watchdog = <&watchdog>,"status";
+ random = <&random>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-cm.dts linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dts
---- linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-cm.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-cm.dts linux-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dts
+--- linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-cm.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dts 2015-08-26 10:26:04.693259532 +0200
@@ -0,0 +1,93 @@
+/dts-v1/;
+
@@ -665,9 +613,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-cm.dts linux-xbian-rpi/arch/
+ core_freq = <&clk_core>,"clock-frequency:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
---- linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi linux-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
+--- linux-4.1.6/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi 2015-08-26 10:26:04.693259532 +0200
@@ -0,0 +1,30 @@
+/include/ "bcm2708.dtsi"
+
@@ -699,15 +647,15 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi linux-xbian-rpi/arch
+ random = <&random>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2709.dtsi linux-xbian-rpi/arch/arm/boot/dts/bcm2709.dtsi
---- linux-4.1.3/arch/arm/boot/dts/bcm2709.dtsi 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2709.dtsi 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,70 @@
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2708.dtsi linux-rpi/arch/arm/boot/dts/bcm2708.dtsi
+--- linux-4.1.6/arch/arm/boot/dts/bcm2708.dtsi 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2708.dtsi 2015-08-26 10:26:04.693259532 +0200
+@@ -0,0 +1,25 @@
+/include/ "bcm2708_common.dtsi"
+
+/ {
-+ compatible = "brcm,bcm2709";
-+ model = "BCM2709";
++ compatible = "brcm,bcm2708";
++ model = "BCM2708";
+
+ chosen {
+ /* No padding required - the boot loader can do that. */
@@ -715,67 +663,328 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2709.dtsi linux-xbian-rpi/arch/arm/bo
+ };
+
+ soc {
-+ ranges = <0x7e000000 0x3f000000 0x01000000>;
++ ranges = <0x7e000000 0x20000000 0x01000000>;
+
+ arm-pmu {
-+ compatible = "arm,cortex-a7-pmu";
-+ interrupts = <3 9>;
++ compatible = "arm,arm1176-pmu";
++ };
++
++ gpiomem {
++ compatible = "brcm,bcm2835-gpiomem";
++ reg = <0x7e200000 0x1000>;
++ status = "okay";
+ };
+ };
++};
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2708_common.dtsi linux-rpi/arch/arm/boot/dts/bcm2708_common.dtsi
+--- linux-4.1.6/arch/arm/boot/dts/bcm2708_common.dtsi 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2708_common.dtsi 2015-08-26 10:26:04.693259532 +0200
+@@ -0,0 +1,302 @@
++/include/ "skeleton.dtsi"
+
-+ timer {
-+ compatible = "arm,armv7-timer";
-+ clock-frequency = <19200000>;
-+ interrupts = <3 0>, // PHYS_SECURE_PPI
-+ <3 1>, // PHYS_NONSECURE_PPI
-+ <3 3>, // VIRT_PPI
-+ <3 2>; // HYP_PPI
-+ always-on;
++/ {
++ interrupt-parent = <&intc>;
++
++ aliases {
++ audio = &audio;
++ sound = &sound;
++ soc = &soc;
++ dma = &dma;
++ intc = &intc;
++ watchdog = &watchdog;
++ random = &random;
++ mailbox = &mailbox;
++ gpio = &gpio;
++ uart0 = &uart0;
++ i2s = &i2s;
++ spi0 = &spi0;
++ i2c0 = &i2c0;
++ uart1 = &uart1;
++ mmc = &mmc;
++ i2c1 = &i2c1;
++ i2c2 = &i2c2;
++ usb = &usb;
++ leds = &leds;
++ fb = &fb;
++ vchiq = &vchiq;
++ thermal = &thermal;
++ clocks = &clocks;
+ };
+
-+ cpus: cpus {
++ /* Onboard audio */
++ audio: audio {
++ compatible = "brcm,bcm2835-audio";
++ brcm,pwm-channels = <8>;
++ status = "disabled";
++ };
++
++ /* External sound card */
++ sound: sound {
++ };
++
++ soc: soc {
++ compatible = "simple-bus";
++ #address-cells = <1>;
++ #size-cells = <1>;
++
++ dma: dma@7e007000 {
++ compatible = "brcm,bcm2835-dma";
++ reg = <0x7e007000 0xf00>;
++ interrupts = <1 16>,
++ <1 17>,
++ <1 18>,
++ <1 19>,
++ <1 20>,
++ <1 21>,
++ <1 22>,
++ <1 23>,
++ <1 24>,
++ <1 25>,
++ <1 26>,
++ <1 27>;
++
++ #dma-cells = <1>;
++ brcm,dma-channel-mask = <0x0f35>;
++ };
++
++ intc: interrupt-controller {
++ compatible = "brcm,bcm2708-armctrl-ic";
++ reg = <0x7e00b200 0x200>;
++ interrupt-controller;
++ #interrupt-cells = <2>;
++ };
++
++ mailbox: mailbox@7e00b800 {
++ compatible = "brcm,bcm2835-mbox";
++ reg = <0x7e00b880 0x40>;
++ interrupts = <0 1>;
++ #mbox-cells = <0>;
++ };
++
++ watchdog: watchdog@7e100000 {
++ compatible = "brcm,bcm2835-pm-wdt";
++ reg = <0x7e100000 0x28>;
++ status = "disabled";
++ };
++
++ random: rng@7e104000 {
++ compatible = "brcm,bcm2835-rng";
++ reg = <0x7e104000 0x10>;
++ status = "disabled";
++ };
++
++ gpio: gpio@7e200000 {
++ compatible = "brcm,bcm2835-gpio";
++ reg = <0x7e200000 0xb4>;
++ interrupts = <2 17>, <2 18>;
++
++ gpio-controller;
++ #gpio-cells = <2>;
++
++ interrupt-controller;
++ #interrupt-cells = <2>;
++ };
++
++ uart0: uart@7e201000 {
++ compatible = "arm,pl011", "arm,primecell";
++ reg = <0x7e201000 0x1000>;
++ interrupts = <2 25>;
++ clocks = <&clk_uart0 &clk_apb_p>;
++ clock-names = "uartclk","apb_pclk";
++ arm,primecell-periphid = <0x00241011>; // For an explanation, see
++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038
++ status = "disabled";
++ };
++
++ i2s: i2s@7e203000 {
++ compatible = "brcm,bcm2708-i2s";
++ reg = <0x7e203000 0x24>,
++ <0x7e101098 0x08>;
++
++ //dmas = <&dma 2>,
++ // <&dma 3>;
++ dma-names = "tx", "rx";
++ status = "disabled";
++ };
++
++ spi0: spi@7e204000 {
++ compatible = "brcm,bcm2835-spi";
++ reg = <0x7e204000 0x1000>;
++ interrupts = <2 22>;
++ clocks = <&clk_core>;
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "disabled";
++ /* the dma channels */
++ dmas = <&dma 6>, <&dma 7>;
++ dma-names = "tx", "rx";
++ /* the chipselects used - <0> means native GPIO
++ * add more gpios if necessary as <&gpio 6 1>
++ * (but do not forget to make them output!)
++ */
++ cs-gpios = <0>, <0>;
++ };
++
++ i2c0: i2c@7e205000 {
++ compatible = "brcm,bcm2708-i2c";
++ reg = <0x7e205000 0x1000>;
++ interrupts = <2 21>;
++ clocks = <&clk_i2c>;
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "disabled";
++ };
++
++ pwm: pwm@7e20c000 {
++ compatible = "brcm,bcm2835-pwm";
++ reg = <0x7e20c000 0x28>;
++ clocks = <&clk_pwm>;
++ #pwm-cells = <2>;
++ status = "disabled";
++ };
++
++ uart1: uart@7e215040 {
++ compatible = "brcm,bcm2835-aux-uart", "ns16550";
++ reg = <0x7e215040 0x40>;
++ interrupts = <1 29>;
++ clock-frequency = <500000000>;
++ reg-shift = <2>;
++ no-loopback-test;
++ status = "disabled";
++ };
++
++ mmc: mmc@7e300000 {
++ compatible = "brcm,bcm2835-mmc";
++ reg = <0x7e300000 0x100>;
++ interrupts = <2 30>;
++ clocks = <&clk_mmc>;
++ dmas = <&dma 11>,
++ <&dma 11>;
++ dma-names = "tx", "rx";
++ status = "disabled";
++ };
++
++ i2c1: i2c@7e804000 {
++ compatible = "brcm,bcm2708-i2c";
++ reg = <0x7e804000 0x1000>;
++ interrupts = <2 21>;
++ clocks = <&clk_i2c>;
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "disabled";
++ };
++
++ i2c2: i2c@7e805000 {
++ // Beware - this is shared with the HDMI module.
++ // Careless use may break (really) your display.
++ // Caveat emptor.
++ compatible = "brcm,bcm2708-i2c";
++ reg = <0x7e805000 0x1000>;
++ interrupts = <2 21>;
++ clocks = <&clk_i2c>;
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "disabled";
++ };
++
++ usb: usb@7e980000 {
++ compatible = "brcm,bcm2708-usb";
++ reg = <0x7e980000 0x10000>,
++ <0x7e006000 0x1000>;
++ interrupts = <2 0>,
++ <1 9>;
++ };
++
++ firmware: firmware {
++ compatible = "raspberrypi,bcm2835-firmware";
++ mboxes = <&mailbox>;
++ };
++
++ leds: leds {
++ compatible = "gpio-leds";
++ };
++
++ fb: fb {
++ compatible = "brcm,bcm2708-fb";
++ firmware = <&firmware>;
++ status = "disabled";
++ };
++
++ vchiq: vchiq {
++ compatible = "brcm,bcm2835-vchiq";
++ reg = <0x7e00b840 0xf>;
++ interrupts = <0 2>;
++ cache-line-size = <32>;
++ firmware = <&firmware>;
++ };
++
++ thermal: thermal {
++ compatible = "brcm,bcm2835-thermal";
++ firmware = <&firmware>;
++ };
++ };
++
++ clocks: clocks {
++ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
-+ v7_cpu0: cpu@0 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf00>;
-+ clock-frequency = <800000000>;
++ clk_mmc: clock@0 {
++ compatible = "fixed-clock";
++ reg = <0>;
++ #clock-cells = <0>;
++ clock-output-names = "mmc";
++ clock-frequency = <250000000>;
+ };
+
-+ v7_cpu1: cpu@1 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf01>;
-+ clock-frequency = <800000000>;
++ clk_i2c: clock@1 {
++ compatible = "fixed-clock";
++ reg = <1>;
++ #clock-cells = <0>;
++ clock-output-names = "i2c";
++ clock-frequency = <250000000>;
+ };
+
-+ v7_cpu2: cpu@2 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf02>;
-+ clock-frequency = <800000000>;
++ clk_core: clock@2 {
++ compatible = "fixed-clock";
++ reg = <2>;
++ #clock-cells = <0>;
++ clock-output-names = "core";
++ clock-frequency = <250000000>;
+ };
+
-+ v7_cpu3: cpu@3 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a7";
-+ reg = <0xf03>;
-+ clock-frequency = <800000000>;
++ clk_uart0: clock@3 {
++ compatible = "fixed-clock";
++ reg = <3>;
++ #clock-cells = <0>;
++ clock-output-names = "uart0_pclk";
++ clock-frequency = <3000000>;
++ };
++
++ clk_apb_p: clock@4 {
++ compatible = "fixed-clock";
++ reg = <4>;
++ #clock-cells = <0>;
++ clock-output-names = "apb_pclk";
++ clock-frequency = <126000000>;
++ };
++
++ clk_pwm: clock@5 {
++ compatible = "fixed-clock";
++ reg = <3>;
++ #clock-cells = <0>;
++ clock-output-names = "pwm";
++ clock-frequency = <100000000>;
+ };
+ };
+
+ __overrides__ {
-+ arm_freq = <&v7_cpu0>, "clock-frequency:0",
-+ <&v7_cpu1>, "clock-frequency:0",
-+ <&v7_cpu2>, "clock-frequency:0",
-+ <&v7_cpu3>, "clock-frequency:0";
++ cache_line_size = <&vchiq>, "cache-line-size:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2709-rpi-2-b.dts linux-xbian-rpi/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
---- linux-4.1.3/arch/arm/boot/dts/bcm2709-rpi-2-b.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2709-rpi-2-b.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2709-rpi-2-b.dts linux-rpi/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
+--- linux-4.1.6/arch/arm/boot/dts/bcm2709-rpi-2-b.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2709-rpi-2-b.dts 2015-08-26 10:26:04.693259532 +0200
@@ -0,0 +1,129 @@
+/dts-v1/;
+
@@ -906,170 +1115,89 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2709-rpi-2-b.dts linux-xbian-rpi/arch
+ random = <&random>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2835.dtsi linux-xbian-rpi/arch/arm/boot/dts/bcm2835.dtsi
---- linux-4.1.3/arch/arm/boot/dts/bcm2835.dtsi 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2835.dtsi 2015-07-28 01:20:58.166151930 +0200
-@@ -6,14 +6,15 @@
- interrupt-parent = <&intc>;
-
- chosen {
-- bootargs = "earlyprintk console=ttyAMA0";
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2709.dtsi linux-rpi/arch/arm/boot/dts/bcm2709.dtsi
+--- linux-4.1.6/arch/arm/boot/dts/bcm2709.dtsi 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/bcm2709.dtsi 2015-08-26 10:26:04.693259532 +0200
+@@ -0,0 +1,76 @@
++/include/ "bcm2708_common.dtsi"
++
++/ {
++ compatible = "brcm,bcm2709";
++ model = "BCM2709";
++
++ chosen {
++ /* No padding required - the boot loader can do that. */
+ bootargs = "";
- };
-
-- soc {
-+ soc: soc {
- compatible = "simple-bus";
- #address-cells = <1>;
- #size-cells = <1>;
- ranges = <0x7e000000 0x20000000 0x02000000>;
-+ dma-ranges = <0x40000000 0x00000000 0x20000000>;
-
- timer@7e003000 {
- compatible = "brcm,bcm2835-system-timer";
-@@ -50,16 +51,23 @@
- #interrupt-cells = <2>;
- };
-
-- watchdog@7e100000 {
-+ watchdog: watchdog@7e100000 {
- compatible = "brcm,bcm2835-pm-wdt";
- reg = <0x7e100000 0x28>;
- };
-
-- rng@7e104000 {
-+ random: rng@7e104000 {
- compatible = "brcm,bcm2835-rng";
- reg = <0x7e104000 0x10>;
- };
-
-+ mailbox: mailbox@7e00b800 {
-+ compatible = "brcm,bcm2835-mbox";
-+ reg = <0x7e00b880 0x40>;
-+ interrupts = <0 1>;
-+ #mbox-cells = <0>;
++ };
++
++ soc {
++ ranges = <0x7e000000 0x3f000000 0x01000000>;
++
++ arm-pmu {
++ compatible = "arm,cortex-a7-pmu";
++ interrupts = <3 9>;
+ };
+
- gpio: gpio@7e200000 {
- compatible = "brcm,bcm2835-gpio";
- reg = <0x7e200000 0xb4>;
-@@ -83,7 +91,7 @@
- #interrupt-cells = <2>;
- };
-
-- uart@7e201000 {
-+ uart0: uart@7e201000 {
- compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
- reg = <0x7e201000 0x1000>;
- interrupts = <2 25>;
-@@ -93,8 +101,8 @@
-
- i2s: i2s@7e203000 {
- compatible = "brcm,bcm2835-i2s";
-- reg = <0x7e203000 0x20>,
-- <0x7e101098 0x02>;
-+ reg = <0x7e203000 0x24>,
-+ <0x7e101098 0x08>;
-
- dmas = <&dma 2>,
- <&dma 3>;
-@@ -102,7 +110,7 @@
- status = "disabled";
- };
-
-- spi: spi@7e204000 {
-+ spi0: spi@7e204000 {
- compatible = "brcm,bcm2835-spi";
- reg = <0x7e204000 0x1000>;
- interrupts = <2 22>;
-@@ -122,11 +130,14 @@
- status = "disabled";
- };
-
-- sdhci: sdhci@7e300000 {
-- compatible = "brcm,bcm2835-sdhci";
-+ mmc: mmc@7e300000 {
-+ compatible = "brcm,bcm2835-mmc";
- reg = <0x7e300000 0x100>;
- interrupts = <2 30>;
- clocks = <&clk_mmc>;
-+ dmas = <&dma 11>,
-+ <&dma 11>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -140,10 +151,12 @@
- status = "disabled";
- };
-
-- usb@7e980000 {
-- compatible = "brcm,bcm2835-usb";
-- reg = <0x7e980000 0x10000>;
-- interrupts = <1 9>;
-+ usb: usb@7e980000 {
-+ compatible = "brcm,bcm2708-usb";
-+ reg = <0x7e980000 0x10000>,
-+ <0x7e006000 0x1000>;
-+ interrupts = <2 0>,
-+ <1 9>;
- };
-
- arm-pmu {
-@@ -161,7 +174,7 @@
- reg = <0>;
- #clock-cells = <0>;
- clock-output-names = "mmc";
-- clock-frequency = <100000000>;
-+ clock-frequency = <250000000>;
- };
-
- clk_i2c: clock@1 {
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi-b.dts linux-xbian-rpi/arch/arm/boot/dts/bcm2835-rpi-b.dts
---- linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi-b.dts 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2835-rpi-b.dts 2015-07-28 01:20:58.166151930 +0200
-@@ -5,19 +5,28 @@
- compatible = "raspberrypi,model-b", "brcm,bcm2835";
- model = "Raspberry Pi Model B";
-
-- leds {
-- act {
-- gpios = <&gpio 16 1>;
-- };
-- };
- };
-
- &gpio {
-- pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>;
--
-- /* I2S interface */
-- i2s_alt2: i2s_alt2 {
-+ i2s_pins: i2s {
- brcm,pins = <28 29 30 31>;
-- brcm,function = <6>; /* alt2 */
-+ brcm,function = <4>; /* alt0 */
++ gpiomem {
++ compatible = "brcm,bcm2835-gpiomem";
++ reg = <0x7e200000 0x1000>;
++ status = "okay";
++ };
+ };
-+};
+
-+&i2s {
-+ #sound-dai-cells = <0>;
-+ pinctrl-names = "default";
-+ pinctrl-0 = <&i2s_pins>;
-+};
++ timer {
++ compatible = "arm,armv7-timer";
++ clock-frequency = <19200000>;
++ interrupts = <3 0>, // PHYS_SECURE_PPI
++ <3 1>, // PHYS_NONSECURE_PPI
++ <3 3>, // VIRT_PPI
++ <3 2>; // HYP_PPI
++ always-on;
++ };
+
-+&act_led {
-+ gpios = <&gpio 16 1>;
-+};
++ cpus: cpus {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ v7_cpu0: cpu@0 {
++ device_type = "cpu";
++ compatible = "arm,cortex-a7";
++ reg = <0xf00>;
++ clock-frequency = <800000000>;
++ };
++
++ v7_cpu1: cpu@1 {
++ device_type = "cpu";
++ compatible = "arm,cortex-a7";
++ reg = <0xf01>;
++ clock-frequency = <800000000>;
++ };
++
++ v7_cpu2: cpu@2 {
++ device_type = "cpu";
++ compatible = "arm,cortex-a7";
++ reg = <0xf02>;
++ clock-frequency = <800000000>;
++ };
++
++ v7_cpu3: cpu@3 {
++ device_type = "cpu";
++ compatible = "arm,cortex-a7";
++ reg = <0xf03>;
++ clock-frequency = <800000000>;
++ };
++ };
+
-+/ {
+ __overrides__ {
-+ act_led_gpio = <&act_led>,"gpios:4";
-+ act_led_activelow = <&act_led>,"gpios:8";
- };
- };
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts linux-xbian-rpi/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
---- linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts 2015-07-28 01:20:58.166151930 +0200
++ arm_freq = <&v7_cpu0>, "clock-frequency:0",
++ <&v7_cpu1>, "clock-frequency:0",
++ <&v7_cpu2>, "clock-frequency:0",
++ <&v7_cpu3>, "clock-frequency:0";
++ };
++};
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts linux-rpi/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+--- linux-4.1.6/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts 2015-08-26 10:26:04.693259532 +0200
@@ -4,27 +4,40 @@
/ {
compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
@@ -1128,9 +1256,51 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts linux-xbian-rpi/a
+ pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi.dtsi linux-xbian-rpi/arch/arm/boot/dts/bcm2835-rpi.dtsi
---- linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi.dtsi 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/boot/dts/bcm2835-rpi.dtsi 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2835-rpi-b.dts linux-rpi/arch/arm/boot/dts/bcm2835-rpi-b.dts
+--- linux-4.1.6/arch/arm/boot/dts/bcm2835-rpi-b.dts 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/boot/dts/bcm2835-rpi-b.dts 2015-08-26 10:26:04.693259532 +0200
+@@ -5,19 +5,28 @@
+ compatible = "raspberrypi,model-b", "brcm,bcm2835";
+ model = "Raspberry Pi Model B";
+
+- leds {
+- act {
+- gpios = <&gpio 16 1>;
+- };
+- };
+ };
+
+ &gpio {
+- pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>;
+-
+- /* I2S interface */
+- i2s_alt2: i2s_alt2 {
++ i2s_pins: i2s {
+ brcm,pins = <28 29 30 31>;
+- brcm,function = <6>; /* alt2 */
++ brcm,function = <4>; /* alt0 */
++ };
++};
++
++&i2s {
++ #sound-dai-cells = <0>;
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2s_pins>;
++};
++
++&act_led {
++ gpios = <&gpio 16 1>;
++};
++
++/ {
++ __overrides__ {
++ act_led_gpio = <&act_led>,"gpios:4";
++ act_led_activelow = <&act_led>,"gpios:8";
+ };
+ };
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2835-rpi.dtsi linux-rpi/arch/arm/boot/dts/bcm2835-rpi.dtsi
+--- linux-4.1.6/arch/arm/boot/dts/bcm2835-rpi.dtsi 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/boot/dts/bcm2835-rpi.dtsi 2015-08-26 10:26:04.693259532 +0200
@@ -1,51 +1,133 @@
/include/ "bcm2835.dtsi"
@@ -1283,18 +1453,133 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/bcm2835-rpi.dtsi linux-xbian-rpi/arch/ar
+ audio = <&audio>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/Makefile linux-xbian-rpi/arch/arm/boot/dts/Makefile
---- linux-4.1.3/arch/arm/boot/dts/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/boot/dts/Makefile 2015-07-28 01:20:58.162166151 +0200
-@@ -1,5 +1,21 @@
- ifeq ($(CONFIG_OF),y)
+diff -Nur linux-4.1.6/arch/arm/boot/dts/bcm2835.dtsi linux-rpi/arch/arm/boot/dts/bcm2835.dtsi
+--- linux-4.1.6/arch/arm/boot/dts/bcm2835.dtsi 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/boot/dts/bcm2835.dtsi 2015-08-26 10:26:04.693259532 +0200
+@@ -6,14 +6,15 @@
+ interrupt-parent = <&intc>;
-+dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb
-+dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb
-+dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-cm.dtb
-+dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb
+ chosen {
+- bootargs = "earlyprintk console=ttyAMA0";
++ bootargs = "";
+ };
+
+- soc {
++ soc: soc {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x7e000000 0x20000000 0x02000000>;
++ dma-ranges = <0x40000000 0x00000000 0x20000000>;
+
+ timer@7e003000 {
+ compatible = "brcm,bcm2835-system-timer";
+@@ -50,16 +51,23 @@
+ #interrupt-cells = <2>;
+ };
+
+- watchdog@7e100000 {
++ watchdog: watchdog@7e100000 {
+ compatible = "brcm,bcm2835-pm-wdt";
+ reg = <0x7e100000 0x28>;
+ };
+
+- rng@7e104000 {
++ random: rng@7e104000 {
+ compatible = "brcm,bcm2835-rng";
+ reg = <0x7e104000 0x10>;
+ };
+
++ mailbox: mailbox@7e00b800 {
++ compatible = "brcm,bcm2835-mbox";
++ reg = <0x7e00b880 0x40>;
++ interrupts = <0 1>;
++ #mbox-cells = <0>;
++ };
++
+ gpio: gpio@7e200000 {
+ compatible = "brcm,bcm2835-gpio";
+ reg = <0x7e200000 0xb4>;
+@@ -83,7 +91,7 @@
+ #interrupt-cells = <2>;
+ };
+
+- uart@7e201000 {
++ uart0: uart@7e201000 {
+ compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
+ reg = <0x7e201000 0x1000>;
+ interrupts = <2 25>;
+@@ -93,8 +101,8 @@
+
+ i2s: i2s@7e203000 {
+ compatible = "brcm,bcm2835-i2s";
+- reg = <0x7e203000 0x20>,
+- <0x7e101098 0x02>;
++ reg = <0x7e203000 0x24>,
++ <0x7e101098 0x08>;
+
+ dmas = <&dma 2>,
+ <&dma 3>;
+@@ -102,7 +110,7 @@
+ status = "disabled";
+ };
+
+- spi: spi@7e204000 {
++ spi0: spi@7e204000 {
+ compatible = "brcm,bcm2835-spi";
+ reg = <0x7e204000 0x1000>;
+ interrupts = <2 22>;
+@@ -122,11 +130,14 @@
+ status = "disabled";
+ };
+
+- sdhci: sdhci@7e300000 {
+- compatible = "brcm,bcm2835-sdhci";
++ mmc: mmc@7e300000 {
++ compatible = "brcm,bcm2835-mmc";
+ reg = <0x7e300000 0x100>;
+ interrupts = <2 30>;
+ clocks = <&clk_mmc>;
++ dmas = <&dma 11>,
++ <&dma 11>;
++ dma-names = "tx", "rx";
+ status = "disabled";
+ };
+
+@@ -140,10 +151,12 @@
+ status = "disabled";
+ };
+
+- usb@7e980000 {
+- compatible = "brcm,bcm2835-usb";
+- reg = <0x7e980000 0x10000>;
+- interrupts = <1 9>;
++ usb: usb@7e980000 {
++ compatible = "brcm,bcm2708-usb";
++ reg = <0x7e980000 0x10000>,
++ <0x7e006000 0x1000>;
++ interrupts = <2 0>,
++ <1 9>;
+ };
+
+ arm-pmu {
+@@ -161,7 +174,7 @@
+ reg = <0>;
+ #clock-cells = <0>;
+ clock-output-names = "mmc";
+- clock-frequency = <100000000>;
++ clock-frequency = <250000000>;
+ };
+
+ clk_i2c: clock@1 {
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/Makefile linux-rpi/arch/arm/boot/dts/overlays/Makefile
+--- linux-4.1.6/arch/arm/boot/dts/overlays/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/Makefile 2015-08-26 10:26:04.721259926 +0200
+@@ -0,0 +1,66 @@
++ifeq ($(CONFIG_OF),y)
++
++# Overlays for the Raspberry Pi platform
+
-+# Raspberry Pi
+ifeq ($(CONFIG_BCM2708_DT),y)
+ RPI_DT_OVERLAYS=y
+endif
@@ -1305,31 +1590,682 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/Makefile linux-xbian-rpi/arch/arm/boot/d
+ RPI_DT_OVERLAYS=y
+endif
+
- dtb-$(CONFIG_ARCH_ALPINE) += \
- alpine-db.dtb
- dtb-$(CONFIG_MACH_ASM9260) += \
-@@ -660,7 +676,18 @@
- mt6592-evb.dtb \
- mt8127-moose.dtb \
- mt8135-evbp1.dtb
++dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += gpio-poweroff-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += pwm-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += pwm-2chan-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += spi-dma-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb
++dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb
+
+targets += dtbs dtbs_install
+targets += $(dtb-y)
+
- endif
-
- always := $(dtb-y)
- clean-files := *.dtb
++endif
++
++always := $(dtb-y)
++clean-files := *.dtb
+
+# Enable fixups to support overlays on BCM2708 platforms
+ifeq ($(RPI_DT_OVERLAYS),y)
+ DTC_FLAGS ?= -@
+endif
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/README linux-rpi/arch/arm/boot/dts/overlays/README
+--- linux-4.1.6/arch/arm/boot/dts/overlays/README 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/README 2015-08-26 10:26:04.725259982 +0200
+@@ -0,0 +1,617 @@
++Introduction
++============
+
-+subdir-y += overlays
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/ads7846-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/ads7846-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/ads7846-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/ads7846-overlay.dts 2015-07-28 01:20:58.166151930 +0200
++This directory contains Device Tree overlays. Device Tree makes it possible
++to support many hardware configurations with a single kernel and without the
++need to explicitly load or blacklist kernel modules. Note that this isn't a
++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices
++are still configured by the board support code, but the intention is to
++eventually reach that goal.
++
++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By
++default, the Raspberry Pi kernel boots with device tree enabled. You can
++completely disable DT usage (for now) by adding:
++
++ device_tree=
++
++to your config.txt, which should cause your Pi to revert to the old way of
++doing things after a reboot.
++
++In /boot you will find a .dtb for each base platform. This describes the
++hardware that is part of the Raspberry Pi board. The loader (start.elf and its
++siblings) selects the .dtb file appropriate for the platform by name, and reads
++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi)
++are disabled, but they can be enabled using Device Tree parameters:
++
++ dtparam=i2c=on,i2s=on,spi=on
++
++However, this shouldn't be necessary in many use cases because loading an
++overlay that requires one of those interfaces will cause it to be enabled
++automatically, and it is advisable to only enable interfaces if they are
++needed.
++
++Configuring additional, optional hardware is done using Device Tree overlays
++(see below).
++
++raspi-config
++============
++
++The Advanced Options section of the raspi-config utility can enable and disable
++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it
++is possible to both enable an interface and blacklist the driver, if for some
++reason you should want to defer the loading.
++
++Modules
++=======
++
++As well as describing the hardware, Device Tree also gives enough information
++to allow suitable driver modules to be located and loaded, with the corollary
++that unneeded modules are not loaded. As a result it should be possible to
++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can
++have its contents deleted (or commented out).
++
++Using Overlays
++==============
++
++Overlays are loaded using the "dtoverlay" directive. As an example, consider the
++popular lirc-rpi module, the Linux Infrared Remote Control driver. In the
++pre-DT world this would be loaded from /etc/modules, with an explicit
++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled,
++this becomes a line in config.txt:
++
++ dtoverlay=lirc-rpi
++
++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By
++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using
++DT parameters:
++
++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13
++
++Parameters always have default values, although in some cases (e.g. "w1-gpio")
++it is necessary to provided multiple overlays in order to get the desired
++behaviour. See the list of overlays below for a description of the parameters and their defaults.
++
++The Overlay and Parameter Reference
++===================================
++
++N.B. When editing this file, please preserve the indentation levels to make it simple to parse
++programmatically. NO HARD TABS.
++
++
++Name: <The base DTB>
++Info: Configures the base Raspberry Pi hardware
++Load: <loaded automatically>
++Params:
++ audio Set to "on" to enable the onboard ALSA audio
++ interface (default "off")
++
++ i2c_arm Set to "on" to enable the ARM's i2c interface
++ (default "off")
++
++ i2c_vc Set to "on" to enable the i2c interface
++ usually reserved for the VideoCore processor
++ (default "off")
++
++ i2c An alias for i2c_arm
++
++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface
++ (default "100000")
++
++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface
++ (default "100000")
++
++ i2c_baudrate An alias for i2c_arm_baudrate
++
++ i2s Set to "on" to enable the i2s interface
++ (default "off")
++
++ spi Set to "on" to enable the spi interfaces
++ (default "off")
++
++ random Set to "on" to enable the hardware random
++ number generator (default "off")
++
++ uart0 Set to "off" to disable uart0 (default "on")
++
++ watchdog Set to "on" to enable the hardware watchdog
++ (default "off")
++
++ act_led_trigger Choose which activity the LED tracks.
++ Use "heartbeat" for a nice load indicator.
++ (default "mmc")
++
++ act_led_activelow Set to "on" to invert the sense of the LED
++ (default "off")
++
++ act_led_gpio Set which GPIO to use for the activity LED
++ (in case you want to connect it to an external
++ device)
++ (default "16" on a non-Plus board, "47" on a
++ Plus or Pi 2)
++
++ pwr_led_trigger
++ pwr_led_activelow
++ pwr_led_gpio
++ As for act_led_*, but using the PWR LED.
++ Not available on Model A/B boards.
++
++ N.B. It is recommended to only enable those interfaces that are needed.
++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc
++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.)
++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical
++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible
++ but deprecated because the ARM/VC assignments differ between board
++ revisions. The same board-specific mapping applies to i2c_baudrate,
++ and the other i2c baudrate parameters.
++
++
++Name: ads7846
++Info: ADS7846 Touch controller
++Load: dtoverlay=ads7846,<param>=<val>
++Params: cs SPI bus Chip Select (default 1)
++ speed SPI bus speed (default 2Mhz, max 3.25MHz)
++ penirq GPIO used for PENIRQ. REQUIRED
++ penirq_pull Set GPIO pull (default 0=none, 2=pullup)
++ swapxy Swap x and y axis
++ xmin Minimum value on the X axis (default 0)
++ ymin Minimum value on the Y axis (default 0)
++ xmax Maximum value on the X axis (default 4095)
++ ymax Maximum value on the Y axis (default 4095)
++ pmin Minimum reported pressure value (default 0)
++ pmax Maximum reported pressure value (default 65535)
++ xohms Touchpanel sensitivity (X-plate resistance)
++ (default 400)
++
++ penirq is required and usually xohms (60-100) has to be set as well.
++ Apart from that, pmax (255) and swapxy are also common.
++ The rest of the calibration can be done with xinput-calibrator.
++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian
++ Device Tree binding document:
++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt
++
++
++Name: bmp085_i2c-sensor
++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature
++ sensors from Bosch Sensortec
++Load: dtoverlay=bmp085_i2c-sensor
++Params: <None>
++
++
++Name: dht11
++Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors
++ Also sometimes found with the part number(s) AM230x.
++Load: dtoverlay=dht11,<param>=<val>
++Params: gpiopin GPIO connected to the sensor's DATA output.
++ (default 4)
++
++
++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ]
++
++
++Name: enc28j60
++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI)
++Load: dtoverlay=enc28j60,<param>=<val>
++Params: int_pin GPIO used for INT (default 25)
++
++ speed SPI bus speed (default 12000000)
++
++
++Name: gpio-poweroff
++Info: Drives a GPIO high or low on reboot
++Load: gpio-poweroff,<param>=<val>
++Params: gpiopin GPIO for signalling (default 26)
++
++ active_low Set if the power control device requires a
++ high->low transition to trigger a power-down.
++ Note that this will require the support of a
++ custom dt-blob.bin to prevent a power-down
++ during the boot process, and that a reboot
++ will also cause the pin to go low.
++
++
++Name: hifiberry-amp
++Info: Configures the HifiBerry Amp and Amp+ audio cards
++Load: dtoverlay=hifiberry-amp
++Params: <None>
++
++
++Name: hifiberry-dac
++Info: Configures the HifiBerry DAC audio card
++Load: dtoverlay=hifiberry-dac
++Params: <None>
++
++
++Name: hifiberry-dacplus
++Info: Configures the HifiBerry DAC+ audio card
++Load: dtoverlay=hifiberry-dacplus
++Params: <None>
++
++
++Name: hifiberry-digi
++Info: Configures the HifiBerry Digi audio card
++Load: dtoverlay=hifiberry-digi
++Params: <None>
++
++
++Name: hy28a
++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics
++ Default values match Texy's display shield
++Load: dtoverlay=hy28a,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++ xohms Touchpanel sensitivity (X-plate resistance)
++
++ resetgpio GPIO used to reset controller
++
++ ledgpio GPIO used to control backlight
++
++
++Name: hy28b
++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics
++ Default values match Texy's display shield
++Load: dtoverlay=hy28b,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++ xohms Touchpanel sensitivity (X-plate resistance)
++
++ resetgpio GPIO used to reset controller
++
++ ledgpio GPIO used to control backlight
++
++
++Name: i2c-rtc
++Info: Adds support for a number of I2C Real Time Clock devices
++Load: dtoverlay=i2c-rtc,<param>
++Params: ds1307 Select the DS1307 device
++
++ ds3231 Select the DS3231 device
++
++ mcp7941x Select the MCP7941x device
++
++ pcf2127 Select the PCF2127 device
++
++ pcf8523 Select the PCF8523 device
++
++ pcf8563 Select the PCF8563 device
++
++
++Name: i2s-mmap
++Info: Enables mmap support in the bcm2708-i2s driver
++Load: dtoverlay=i2s-mmap
++Params: <None>
++
++
++Name: iqaudio-dac
++Info: Configures the IQaudio DAC audio card
++Load: dtoverlay=iqaudio-dac
++Params: <None>
++
++
++Name: iqaudio-dacplus
++Info: Configures the IQaudio DAC+ audio card
++Load: dtoverlay=iqaudio-dacplus
++Params: <None>
++
++
++Name: lirc-rpi
++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi)
++ Consult the module documentation for more details.
++Load: dtoverlay=lirc-rpi,<param>=<val>,...
++Params: gpio_out_pin GPIO for output (default "17")
++
++ gpio_in_pin GPIO for input (default "18")
++
++ gpio_in_pull Pull up/down/off on the input pin
++ (default "down")
++
++ sense Override the IR receive auto-detection logic:
++ "0" = force active-high
++ "1" = force active-low
++ "-1" = use auto-detection
++ (default "-1")
++
++ softcarrier Turn the software carrier "on" or "off"
++ (default "on")
++
++ invert "on" = invert the output pin (default "off")
++
++ debug "on" = enable additional debug messages
++ (default "off")
++
++
++Name: mcp2515-can0
++Info: Configures the MCP2515 CAN controller on spi0.0
++Load: dtoverlay=mcp2515-can0,<param>=<val>
++Params: oscillator Clock frequency for the CAN controller (Hz)
++
++ spimaxfrequency Maximum SPI frequence (Hz)
++
++ interrupt GPIO for interrupt signal
++
++
++Name: mcp2515-can1
++Info: Configures the MCP2515 CAN controller on spi0.1
++Load: dtoverlay=mcp2515-can1,<param>=<val>
++Params: oscillator Clock frequency for the CAN controller (Hz)
++
++ spimaxfrequency Maximum SPI frequence (Hz)
++
++ interrupt GPIO for interrupt signal
++
++
++Name: mmc
++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock
++Load: dtoverlay=mmc,<param>=<val>
++Params: overclock_50 Clock (in MHz) to use when the MMC framework
++ requests 50MHz
++ force_pio Disable DMA support
++
++
++Name: mz61581
++Info: MZ61581 display by Tontec
++Load: dtoverlay=mz61581,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++ xohms Touchpanel sensitivity (X-plate resistance)
++
++
++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ]
++
++
++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ]
++
++
++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ]
++
++
++Name: piscreen
++Info: PiScreen display by OzzMaker.com
++Load: dtoverlay=piscreen,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++ xohms Touchpanel sensitivity (X-plate resistance)
++
++
++Name: pitft28-resistive
++Info: Adafruit PiTFT 2.8" resistive touch screen
++Load: dtoverlay=pitft28-resistive,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++
++Name: pps-gpio
++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO).
++Load: dtoverlay=pps-gpio,<param>=<val>
++Params: gpiopin Input GPIO (default "18")
++
++
++Name: pwm
++Info: Configures a single PWM channel
++ Legal pin,function combinations for each channel:
++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1)
++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1)
++ N.B.:
++ 1) Pin 18 is the only one available on all platforms, and
++ it is the one used by the I2S audio interface.
++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2.
++ 2) The onboard analogue audio output uses both PWM channels.
++ 3) So be careful mixing audio and PWM.
++ 4) Currently the clock must have been enabled and configured
++ by other means.
++Load: dtoverlay=pwm-2chan,<param>=<val>
++Load: dtoverlay=pwm,<param>=<val>
++Params: pin Output pin (default 18) - see table
++ func Pin function (default 2 = Alt5) - see above
++ clock PWM clock frequency (informational)
++
++
++Name: pwm-2chan
++Info: Configures both PWM channels
++ Legal pin,function combinations for each channel:
++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1)
++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1)
++ N.B.:
++ 1) Pin 18 is the only one available on all platforms, and
++ it is the one used by the I2S audio interface.
++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2.
++ 2) The onboard analogue audio output uses both PWM channels.
++ 3) So be careful mixing audio and PWM.
++ 4) Currently the clock must have been enabled and configured
++ by other means.
++Load: dtoverlay=pwm-2chan,<param>=<val>
++Params: pin Output pin (default 18) - see table
++ pin2 Output pin for other channel (default 19)
++ func Pin function (default 2 = Alt5) - see above
++ func2 Function for pin2 (default 2 = Alt5)
++ clock PWM clock frequency (informational)
++
++
++Name: rpi-dac
++Info: Configures the RPi DAC audio card
++Load: dtoverlay=rpi-dac
++Params: <None>
++
++
++Name: rpi-display
++Info: RPi-Display - 2.8" Touch Display by Watterott
++Load: dtoverlay=rpi-display,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++ xohms Touchpanel sensitivity (X-plate resistance)
++
++
++Name: rpi-ft5406
++Info: Official Raspberry Pi display touchscreen
++Load: dtoverlay=rpi-ft5406
++Params: <None>
++
++
++Name: rpi-proto
++Info: Configures the RPi Proto audio card
++Load: dtoverlay=rpi-proto
++Params: <None>
++
++
++Name: rpi-sense
++Info: Raspberry Pi Sense HAT
++Load: dtoverlay=rpi-sense
++Params: <None>
++
++
++Name: sdhost
++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock
++Load: dtoverlay=sdhost,<param>=<val>
++Params: overclock_50 Clock (in MHz) to use when the MMC framework
++ requests 50MHz
++
++ force_pio Disable DMA support (default off)
++
++ pio_limit Number of blocks above which to use DMA
++ (default 1)
++
++ debug Enable debug output (default off)
++
++
++Name: spi-bcm2708
++Info: Selects the bcm2708-spi SPI driver
++Load: dtoverlay=spi-bcm2708
++Params: <None>
++
++
++Name: spi-bcm2835
++Info: Selects the bcm2835-spi SPI driver
++Load: dtoverlay=spi-bcm2835
++Params: <None>
++
++
++Name: spi-dma
++Info: enables dma modes for spi-bcm2835
++Load: dtoverlay=spi-dma
++Params: <None>
++
++
++Name: tinylcd35
++Info: 3.5" Color TFT Display by www.tinylcd.com
++ Options: Touch, RTC, keypad
++Load: dtoverlay=tinylcd35,<param>=<val>
++Params: speed Display SPI bus speed
++
++ rotate Display rotation {0,90,180,270}
++
++ fps Delay between frame updates
++
++ debug Debug output level {0-7}
++
++ touch Enable touch panel
++
++ touchgpio Touch controller IRQ GPIO
++
++ xohms Touchpanel: Resistance of X-plate in ohms
++
++ rtc-pcf PCF8563 Real Time Clock
++
++ rtc-ds DS1307 Real Time Clock
++
++ keypad Enable keypad
++
++ Examples:
++ Display with touchpanel, PCF8563 RTC and keypad:
++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad
++ Old touch display:
++ dtoverlay=tinylcd35,touch,touchgpio=3
++
++
++Name: uart1
++Info: Enable uart1 in place of uart0
++Load: dtoverlay=uart1,<param>=<val>
++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14)
++
++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15)
++
++
++Name: vga666
++Info: Overlay for the Fen Logic VGA666 board
++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds
++ after the kernel has started.
++Load: dtoverlay=vga666
++Params: <None>
++
++
++Name: w1-gpio
++Info: Configures the w1-gpio Onewire interface module.
++ Use this overlay if you *don't* need a GPIO to drive an external pullup.
++Load: dtoverlay=w1-gpio,<param>=<val>
++Params: gpiopin GPIO for I/O (default "4")
++
++ pullup Non-zero, "on", or "y" to enable the parasitic
++ power (2-wire, power-on-data) feature
++
++
++Name: w1-gpio-pullup
++Info: Configures the w1-gpio Onewire interface module.
++ Use this overlay if you *do* need a GPIO to drive an external pullup.
++Load: dtoverlay=w1-gpio-pullup,<param>=<val>,...
++Params: gpiopin GPIO for I/O (default "4")
++
++ pullup Non-zero, "on", or "y" to enable the parasitic
++ power (2-wire, power-on-data) feature
++
++ extpullup GPIO for external pullup (default "5")
++
++
++Troubleshooting
++===============
++
++If you are experiencing problems that you think are DT-related, enable DT
++diagnostic output by adding this to /boot/config.txt:
++
++ dtdebug=on
++
++and rebooting. Then run:
++
++ sudo vcdbg log msg
++
++and look for relevant messages.
++
++Further reading
++===============
++
++This is only meant to be a quick introduction to the subject of Device Tree on
++Raspberry Pi. There is a more complete explanation here:
++
++http://www.raspberrypi.org/documentation/configuration/device-tree.md
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/ads7846-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/ads7846-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/ads7846-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/ads7846-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,83 @@
+/*
+ * Generic Device Tree overlay for the ADS7846 touch controller
@@ -1414,9 +2350,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/ads7846-overlay.dts linux-xbian
+ xohms = <&ads7846>,"ti,x-plate-ohms;0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,23 @@
+// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec
+/dts-v1/;
@@ -1441,9 +2377,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts l
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/dht11-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/dht11-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/dht11-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/dht11-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/dht11-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/dht11-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/dht11-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/dht11-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+/*
+ * Overlay for the DHT11/21/22 humidity/temperature sensor modules.
@@ -1484,9 +2420,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/dht11-overlay.dts linux-xbian-r
+ <&dht11>,"gpios:4";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/enc28j60-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/enc28j60-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/enc28j60-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/enc28j60-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/enc28j60-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/enc28j60-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/enc28j60-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/enc28j60-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,50 @@
+// Overlay for the Microchip ENC28J60 Ethernet Controller
+/dts-v1/;
@@ -1538,9 +2474,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/enc28j60-overlay.dts linux-xbia
+ speed = <&eth1>, "spi-max-frequency:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,34 @@
+// Definitions for gpio-poweroff module
+/dts-v1/;
@@ -1576,9 +2512,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts linux
+ active_low = <&power_ctrl>,"gpios:8";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for HiFiBerry Amp/Amp+
+/dts-v1/;
@@ -1619,9 +2555,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts linux
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,34 @@
+// Definitions for HiFiBerry DAC
+/dts-v1/;
@@ -1657,9 +2593,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts linux
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for HiFiBerry DAC+
+/dts-v1/;
@@ -1700,9 +2636,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts l
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for HiFiBerry Digi
+/dts-v1/;
@@ -1743,9 +2679,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts linu
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hy28a-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/hy28a-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/hy28a-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/hy28a-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/hy28a-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/hy28a-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/hy28a-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/hy28a-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,87 @@
+/*
+ * Device Tree overlay for HY28A display
@@ -1834,9 +2770,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hy28a-overlay.dts linux-xbian-r
+ <&hy28a_pins>, "brcm,pins:2";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hy28b-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/hy28b-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/hy28b-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/hy28b-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/hy28b-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/hy28b-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/hy28b-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/hy28b-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,142 @@
+/*
+ * Device Tree overlay for HY28b display shield by Texy
@@ -1980,9 +2916,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/hy28b-overlay.dts linux-xbian-r
+ <&hy28b_pins>, "brcm,pins:2";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,55 @@
+// Definitions for several I2C based Real Time Clocks
+/dts-v1/;
@@ -2039,9 +2975,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts linux-xbian
+ pcf8563 = <&pcf8563>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
@@ -2056,9 +2992,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts linux-xbia
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for IQaudIO DAC
+/dts-v1/;
@@ -2099,9 +3035,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts linux-x
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for IQaudIO DAC+
+/dts-v1/;
@@ -2142,9 +3078,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts lin
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,57 @@
+// Definitions for lirc-rpi module
+/dts-v1/;
@@ -2203,76 +3139,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts linux-xbia
+ debug = <&lirc_rpi>,"rpi,debug:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/Makefile linux-xbian-rpi/arch/arm/boot/dts/overlays/Makefile
---- linux-4.1.3/arch/arm/boot/dts/overlays/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/Makefile 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,63 @@
-+ifeq ($(CONFIG_OF),y)
-+
-+# Overlays for the Raspberry Pi platform
-+
-+ifeq ($(CONFIG_BCM2708_DT),y)
-+ RPI_DT_OVERLAYS=y
-+endif
-+ifeq ($(CONFIG_BCM2709_DT),y)
-+ RPI_DT_OVERLAYS=y
-+endif
-+ifeq ($(CONFIG_ARCH_BCM2835),y)
-+ RPI_DT_OVERLAYS=y
-+endif
-+
-+dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += gpio-poweroff-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb
-+dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb
-+
-+targets += dtbs dtbs_install
-+targets += $(dtb-y)
-+
-+endif
-+
-+always := $(dtb-y)
-+clean-files := *.dtb
-+
-+# Enable fixups to support overlays on BCM2708 platforms
-+ifeq ($(RPI_DT_OVERLAYS),y)
-+ DTC_FLAGS ?= -@
-+endif
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,69 @@
+/*
+ * Device tree overlay for mcp251x/can0 on spi0.0
@@ -2343,9 +3212,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts linux-
+ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,69 @@
+/*
+ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner
@@ -2416,9 +3285,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts linux-
+ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mmc-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/mmc-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/mmc-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/mmc-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/mmc-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/mmc-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/mmc-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/mmc-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,19 @@
+/dts-v1/;
+/plugin/;
@@ -2439,10 +3308,10 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mmc-overlay.dts linux-xbian-rpi
+ force_pio = <&mmc>,"brcm,force-pio?";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mz61581-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/mz61581-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/mz61581-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/mz61581-overlay.dts 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,109 @@
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/mz61581-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/mz61581-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/mz61581-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/mz61581-overlay.dts 2015-08-26 10:26:04.725259982 +0200
+@@ -0,0 +1,111 @@
+/*
+ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec
+ *
@@ -2457,6 +3326,8 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mz61581-overlay.dts linux-xbian
+ fragment@0 {
+ target = <&spi0>;
+ __overlay__ {
++ /* does not work with spi-bcm2835 using software chip selects */
++ compatible = "brcm,bcm2708-spi";
+ status = "okay";
+
+ spidev@0{
@@ -2552,9 +3423,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/mz61581-overlay.dts linux-xbian
+ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/piscreen-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/piscreen-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/piscreen-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/piscreen-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/piscreen-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/piscreen-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/piscreen-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/piscreen-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,96 @@
+/*
+ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker
@@ -2652,9 +3523,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/piscreen-overlay.dts linux-xbia
+ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,115 @@
+/*
+ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen
@@ -2771,9 +3642,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts l
+ debug = <&pitft>,"debug:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,34 @@
+/dts-v1/;
+/plugin/;
@@ -2809,579 +3680,105 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts linux-xbia
+ <&pps_pins>,"brcm,pins:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/README linux-xbian-rpi/arch/arm/boot/dts/overlays/README
---- linux-4.1.3/arch/arm/boot/dts/overlays/README 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/README 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,566 @@
-+Introduction
-+============
-+
-+This directory contains Device Tree overlays. Device Tree makes it possible
-+to support many hardware configurations with a single kernel and without the
-+need to explicitly load or blacklist kernel modules. Note that this isn't a
-+"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices
-+are still configured by the board support code, but the intention is to
-+eventually reach that goal.
-+
-+On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By
-+default, the Raspberry Pi kernel boots with device tree enabled. You can
-+completely disable DT usage (for now) by adding:
-+
-+ device_tree=
-+
-+to your config.txt, which should cause your Pi to revert to the old way of
-+doing things after a reboot.
-+
-+In /boot you will find a .dtb for each base platform. This describes the
-+hardware that is part of the Raspberry Pi board. The loader (start.elf and its
-+siblings) selects the .dtb file appropriate for the platform by name, and reads
-+it into memory. At this point, all of the optional interfaces (i2c, i2s, spi)
-+are disabled, but they can be enabled using Device Tree parameters:
-+
-+ dtparam=i2c=on,i2s=on,spi=on
-+
-+However, this shouldn't be necessary in many use cases because loading an
-+overlay that requires one of those interfaces will cause it to be enabled
-+automatically, and it is advisable to only enable interfaces if they are
-+needed.
-+
-+Configuring additional, optional hardware is done using Device Tree overlays
-+(see below).
-+
-+raspi-config
-+============
-+
-+The Advanced Options section of the raspi-config utility can enable and disable
-+Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it
-+is possible to both enable an interface and blacklist the driver, if for some
-+reason you should want to defer the loading.
-+
-+Modules
-+=======
-+
-+As well as describing the hardware, Device Tree also gives enough information
-+to allow suitable driver modules to be located and loaded, with the corollary
-+that unneeded modules are not loaded. As a result it should be possible to
-+remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can
-+have its contents deleted (or commented out).
-+
-+Using Overlays
-+==============
-+
-+Overlays are loaded using the "dtoverlay" directive. As an example, consider the
-+popular lirc-rpi module, the Linux Infrared Remote Control driver. In the
-+pre-DT world this would be loaded from /etc/modules, with an explicit
-+"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled,
-+this becomes a line in config.txt:
-+
-+ dtoverlay=lirc-rpi
-+
-+This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By
-+default it will use GPIOs 17 (out) and 18 (in), but this can be modified using
-+DT parameters:
-+
-+ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13
-+
-+Parameters always have default values, although in some cases (e.g. "w1-gpio")
-+it is necessary to provided multiple overlays in order to get the desired
-+behaviour. See the list of overlays below for a description of the parameters and their defaults.
-+
-+The Overlay and Parameter Reference
-+===================================
-+
-+Name: <The base DTB>
-+Info: Configures the base Raspberry Pi hardware
-+Load: <loaded automatically>
-+Params:
-+ audio Set to "on" to enable the onboard ALSA audio
-+ interface (default "off")
-+
-+ i2c_arm Set to "on" to enable the ARM's i2c interface
-+ (default "off")
-+
-+ i2c_vc Set to "on" to enable the i2c interface
-+ usually reserved for the VideoCore processor
-+ (default "off")
-+
-+ i2c An alias for i2c_arm
-+
-+ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface
-+ (default "100000")
-+
-+ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface
-+ (default "100000")
-+
-+ i2c_baudrate An alias for i2c_arm_baudrate
-+
-+ i2s Set to "on" to enable the i2s interface
-+ (default "off")
-+
-+ spi Set to "on" to enable the spi interfaces
-+ (default "off")
-+
-+ random Set to "on" to enable the hardware random
-+ number generator (default "off")
-+
-+ uart0 Set to "off" to disable uart0 (default "on")
-+
-+ watchdog Set to "on" to enable the hardware watchdog
-+ (default "off")
-+
-+ act_led_trigger Choose which activity the LED tracks.
-+ Use "heartbeat" for a nice load indicator.
-+ (default "mmc")
-+
-+ act_led_activelow Set to "on" to invert the sense of the LED
-+ (default "off")
-+
-+ act_led_gpio Set which GPIO to use for the activity LED
-+ (in case you want to connect it to an external
-+ device)
-+ (default "16" on a non-Plus board, "47" on a
-+ Plus or Pi 2)
-+
-+ pwr_led_trigger
-+ pwr_led_activelow
-+ pwr_led_gpio
-+ As for act_led_*, but using the PWR LED.
-+ Not available on Model A/B boards.
-+
-+ N.B. It is recommended to only enable those interfaces that are needed.
-+ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc
-+ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.)
-+ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical
-+ interfaces i2c0 and i2c1. Use of the numeric variants is still possible
-+ but deprecated because the ARM/VC assignments differ between board
-+ revisions. The same board-specific mapping applies to i2c_baudrate,
-+ and the other i2c baudrate parameters.
-+
-+
-+Name: ads7846
-+Info: ADS7846 Touch controller
-+Load: dtoverlay=ads7846,<param>=<val>
-+Params: cs SPI bus Chip Select (default 1)
-+ speed SPI bus speed (default 2Mhz, max 3.25MHz)
-+ penirq GPIO used for PENIRQ. REQUIRED
-+ penirq_pull Set GPIO pull (default 0=none, 2=pullup)
-+ swapxy Swap x and y axis
-+ xmin Minimum value on the X axis (default 0)
-+ ymin Minimum value on the Y axis (default 0)
-+ xmax Maximum value on the X axis (default 4095)
-+ ymax Maximum value on the Y axis (default 4095)
-+ pmin Minimum reported pressure value (default 0)
-+ pmax Maximum reported pressure value (default 65535)
-+ xohms Touchpanel sensitivity (X-plate resistance)
-+ (default 400)
-+
-+ penirq is required and usually xohms (60-100) has to be set as well.
-+ Apart from that, pmax (255) and swapxy are also common.
-+ The rest of the calibration can be done with xinput-calibrator.
-+ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian
-+ Device Tree binding document:
-+ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt
-+
-+
-+Name: bmp085_i2c-sensor
-+Info: Configures the BMP085/BMP180 digital barometric pressure and temperature
-+ sensors from Bosch Sensortec
-+Load: dtoverlay=bmp085_i2c-sensor
-+Params: <None>
-+
-+
-+Name: dht11
-+Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors
-+ Also sometimes found with the part number(s) AM230x.
-+Load: dtoverlay=dht11,<param>=<val>
-+Params: gpiopin GPIO connected to the sensor's DATA output.
-+ (default 4)
-+
-+
-+[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ]
-+
-+
-+Name: enc28j60
-+Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI)
-+Load: dtoverlay=enc28j60,<param>=<val>
-+Params: int_pin GPIO used for INT (default 25)
-+
-+ speed SPI bus speed (default 12000000)
-+
-+
-+Name: gpio-poweroff
-+Info: Drives a GPIO high or low on reboot
-+Load: gpio-poweroff,<param>=<val>
-+Params: gpiopin GPIO for signalling (default 26)
-+
-+ active_low Set if the power control device requires a
-+ high->low transition to trigger a power-down.
-+ Note that this will require the support of a
-+ custom dt-blob.bin to prevent a power-down
-+ during the boot process, and that a reboot
-+ will also cause the pin to go low.
-+
-+
-+Name: hifiberry-amp
-+Info: Configures the HifiBerry Amp and Amp+ audio cards
-+Load: dtoverlay=hifiberry-amp
-+Params: <None>
-+
-+
-+Name: hifiberry-dac
-+Info: Configures the HifiBerry DAC audio card
-+Load: dtoverlay=hifiberry-dac
-+Params: <None>
-+
-+
-+Name: hifiberry-dacplus
-+Info: Configures the HifiBerry DAC+ audio card
-+Load: dtoverlay=hifiberry-dacplus
-+Params: <None>
-+
-+
-+Name: hifiberry-digi
-+Info: Configures the HifiBerry Digi audio card
-+Load: dtoverlay=hifiberry-digi
-+Params: <None>
-+
-+
-+Name: hy28a
-+Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics
-+ Default values match Texy's display shield
-+Load: dtoverlay=hy28a,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+ xohms Touchpanel sensitivity (X-plate resistance)
-+
-+ resetgpio GPIO used to reset controller
-+
-+ ledgpio GPIO used to control backlight
-+
-+
-+Name: hy28b
-+Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics
-+ Default values match Texy's display shield
-+Load: dtoverlay=hy28b,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+ xohms Touchpanel sensitivity (X-plate resistance)
-+
-+ resetgpio GPIO used to reset controller
-+
-+ ledgpio GPIO used to control backlight
-+
-+
-+Name: i2c-rtc
-+Info: Adds support for a number of I2C Real Time Clock devices
-+Load: dtoverlay=i2c-rtc,<param>
-+Params: ds1307 Select the DS1307 device
-+
-+ ds3231 Select the DS3231 device
-+
-+ mcp7941x Select the MCP7941x device
-+
-+ pcf2127 Select the PCF2127 device
-+
-+ pcf8523 Select the PCF8523 device
-+
-+ pcf8563 Select the PCF8563 device
-+
-+
-+Name: i2s-mmap
-+Info: Enables mmap support in the bcm2708-i2s driver
-+Load: dtoverlay=i2s-mmap
-+Params: <None>
-+
-+
-+Name: iqaudio-dac
-+Info: Configures the IQaudio DAC audio card
-+Load: dtoverlay=iqaudio-dac
-+Params: <None>
-+
-+
-+Name: iqaudio-dacplus
-+Info: Configures the IQaudio DAC+ audio card
-+Load: dtoverlay=iqaudio-dacplus
-+Params: <None>
-+
-+
-+Name: lirc-rpi
-+Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi)
-+ Consult the module documentation for more details.
-+Load: dtoverlay=lirc-rpi,<param>=<val>,...
-+Params: gpio_out_pin GPIO for output (default "17")
-+
-+ gpio_in_pin GPIO for input (default "18")
-+
-+ gpio_in_pull Pull up/down/off on the input pin
-+ (default "down")
-+
-+ sense Override the IR receive auto-detection logic:
-+ "0" = force active-high
-+ "1" = force active-low
-+ "-1" = use auto-detection
-+ (default "-1")
-+
-+ softcarrier Turn the software carrier "on" or "off"
-+ (default "on")
-+
-+ invert "on" = invert the output pin (default "off")
-+
-+ debug "on" = enable additional debug messages
-+ (default "off")
-+
-+
-+Name: mcp2515-can0
-+Info: Configures the MCP2515 CAN controller on spi0.0
-+Load: dtoverlay=mcp2515-can0,<param>=<val>
-+Params: oscillator Clock frequency for the CAN controller (Hz)
-+
-+ spimaxfrequency Maximum SPI frequence (Hz)
-+
-+ interrupt GPIO for interrupt signal
-+
-+
-+Name: mcp2515-can1
-+Info: Configures the MCP2515 CAN controller on spi0.1
-+Load: dtoverlay=mcp2515-can1,<param>=<val>
-+Params: oscillator Clock frequency for the CAN controller (Hz)
-+
-+ spimaxfrequency Maximum SPI frequence (Hz)
-+
-+ interrupt GPIO for interrupt signal
-+
-+
-+Name: mmc
-+Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock
-+Load: dtoverlay=mmc,<param>=<val>
-+Params: overclock_50 Clock (in MHz) to use when the MMC framework
-+ requests 50MHz
-+ force_pio Disable DMA support
-+
-+
-+Name: mz61581
-+Info: MZ61581 display by Tontec
-+Load: dtoverlay=mz61581,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+ xohms Touchpanel sensitivity (X-plate resistance)
-+
-+
-+[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ]
-+
-+
-+[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ]
-+
-+
-+[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ]
-+
-+
-+Name: piscreen
-+Info: PiScreen display by OzzMaker.com
-+Load: dtoverlay=piscreen,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+ xohms Touchpanel sensitivity (X-plate resistance)
-+
-+
-+Name: pitft28-resistive
-+Info: Adafruit PiTFT 2.8" resistive touch screen
-+Load: dtoverlay=pitft28-resistive,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+
-+Name: pps-gpio
-+Info: Configures the pps-gpio (pulse-per-second time signal via GPIO).
-+Load: dtoverlay=pps-gpio,<param>=<val>
-+Params: gpiopin Input GPIO (default "18")
-+
-+
-+Name: rpi-dac
-+Info: Configures the RPi DAC audio card
-+Load: dtoverlay=rpi-dac
-+Params: <None>
-+
-+
-+Name: rpi-display
-+Info: RPi-Display - 2.8" Touch Display by Watterott
-+Load: dtoverlay=rpi-display,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+ xohms Touchpanel sensitivity (X-plate resistance)
-+
-+
-+Name: rpi-ft5406
-+Info: Official Raspberry Pi display touchscreen
-+Load: dtoverlay=rpi-ft5406
-+Params: <None>
-+
-+
-+Name: rpi-proto
-+Info: Configures the RPi Proto audio card
-+Load: dtoverlay=rpi-proto
-+Params: <None>
-+
-+
-+Name: rpi-sense
-+Info: Raspberry Pi Sense HAT
-+Load: dtoverlay=rpi-sense
-+Params: <None>
-+
-+
-+Name: sdhost
-+Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock
-+Load: dtoverlay=sdhost,<param>=<val>
-+Params: overclock_50 Clock (in MHz) to use when the MMC framework
-+ requests 50MHz
-+
-+ force_pio Disable DMA support (default off)
-+
-+ pio_limit Number of blocks above which to use DMA
-+ (default 1)
-+
-+ debug Enable debug output (default off)
-+
-+
-+Name: spi-bcm2708
-+Info: Selects the bcm2708-spi SPI driver
-+Load: dtoverlay=spi-bcm2708
-+Params: <None>
-+
-+
-+Name: spi-bcm2835
-+Info: Selects the bcm2835-spi SPI driver
-+Load: dtoverlay=spi-bcm2835
-+Params: <None>
-+
-+
-+Name: tinylcd35
-+Info: 3.5" Color TFT Display by www.tinylcd.com
-+ Options: Touch, RTC, keypad
-+Load: dtoverlay=tinylcd35,<param>=<val>
-+Params: speed Display SPI bus speed
-+
-+ rotate Display rotation {0,90,180,270}
-+
-+ fps Delay between frame updates
-+
-+ debug Debug output level {0-7}
-+
-+ touch Enable touch panel
-+
-+ touchgpio Touch controller IRQ GPIO
-+
-+ xohms Touchpanel: Resistance of X-plate in ohms
-+
-+ rtc-pcf PCF8563 Real Time Clock
-+
-+ rtc-ds DS1307 Real Time Clock
-+
-+ keypad Enable keypad
-+
-+ Examples:
-+ Display with touchpanel, PCF8563 RTC and keypad:
-+ dtoverlay=tinylcd35,touch,rtc-pcf,keypad
-+ Old touch display:
-+ dtoverlay=tinylcd35,touch,touchgpio=3
-+
-+
-+Name: uart1
-+Info: Enable uart1 in place of uart0
-+Load: dtoverlay=uart1,<param>=<val>
-+Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14)
-+
-+ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15)
-+
-+
-+Name: vga666
-+Info: Overlay for the Fen Logic VGA666 board
-+ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds
-+ after the kernel has started.
-+Load: dtoverlay=vga666
-+Params: <None>
-+
-+
-+Name: w1-gpio
-+Info: Configures the w1-gpio Onewire interface module.
-+ Use this overlay if you *don't* need a GPIO to drive an external pullup.
-+Load: dtoverlay=w1-gpio,<param>=<val>
-+Params: gpiopin GPIO for I/O (default "4")
-+
-+ pullup Non-zero, "on", or "y" to enable the parasitic
-+ power (2-wire, power-on-data) feature
-+
-+
-+Name: w1-gpio-pullup
-+Info: Configures the w1-gpio Onewire interface module.
-+ Use this overlay if you *do* need a GPIO to drive an external pullup.
-+Load: dtoverlay=w1-gpio-pullup,<param>=<val>,...
-+Params: gpiopin GPIO for I/O (default "4")
-+
-+ pullup Non-zero, "on", or "y" to enable the parasitic
-+ power (2-wire, power-on-data) feature
-+
-+ extpullup GPIO for external pullup (default "5")
-+
-+
-+Troubleshooting
-+===============
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/pwm-2chan-overlay.dts 2015-08-26 10:26:04.725259982 +0200
+@@ -0,0 +1,46 @@
++/dts-v1/;
++/plugin/;
+
-+If you are experiencing problems that you think are DT-related, enable DT
-+diagnostic output by adding this to /boot/config.txt:
++/*
++This is the 2-channel overlay - only use it if you need both channels.
++
++Legal pin,function combinations for each channel:
++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1)
++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1)
++
++N.B.:
++ 1) Pin 18 is the only one available on all platforms, and
++ it is the one used by the I2S audio interface.
++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2.
++ 2) The onboard analogue audio output uses both PWM channels.
++ 3) So be careful mixing audio and PWM.
++*/
+
-+ dtdebug=on
++/ {
++ fragment@0 {
++ target = <&gpio>;
++ __overlay__ {
++ pwm_pins: pwm_pins {
++ brcm,pins = <18 19>;
++ brcm,function = <2 2>; /* Alt5 */
++ };
++ };
++ };
+
-+and rebooting. Then run:
++ fragment@1 {
++ target = <&pwm>;
++ __overlay__ {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pwm_pins>;
++ status = "okay";
++ };
++ };
+
-+ sudo vcdbg log msg
++ __overrides__ {
++ pin = <&pwm_pins>,"brcm,pins:0";
++ pin2 = <&pwm_pins>,"brcm,pins:4";
++ func = <&pwm_pins>,"brcm,function:0";
++ func2 = <&pwm_pins>,"brcm,function:4";
++ clock = <&clk_pwm>,"clock-frequency:0";
++ };
++};
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/pwm-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/pwm-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/pwm-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/pwm-overlay.dts 2015-08-26 10:26:04.725259982 +0200
+@@ -0,0 +1,42 @@
++/dts-v1/;
++/plugin/;
+
-+and look for relevant messages.
++/*
++Legal pin,function combinations for each channel:
++ PWM0: 12,4(Alt0) 18,2(Alt5) 40,4(Alt0) 52,5(Alt1)
++ PWM1: 13,4(Alt0) 19,2(Alt5) 41,4(Alt0) 45,4(Alt0) 53,5(Alt1)
++
++N.B.:
++ 1) Pin 18 is the only one available on all platforms, and
++ it is the one used by the I2S audio interface.
++ Pins 12 and 13 might be better choices on an A+, B+ or Pi2.
++ 2) The onboard analogue audio output uses both PWM channels.
++ 3) So be careful mixing audio and PWM.
++*/
+
-+Further reading
-+===============
++/ {
++ fragment@0 {
++ target = <&gpio>;
++ __overlay__ {
++ pwm_pins: pwm_pins {
++ brcm,pins = <18>;
++ brcm,function = <2>; /* Alt5 */
++ };
++ };
++ };
+
-+This is only meant to be a quick introduction to the subject of Device Tree on
-+Raspberry Pi. There is a more complete explanation here:
++ fragment@1 {
++ target = <&pwm>;
++ __overlay__ {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pwm_pins>;
++ status = "okay";
++ };
++ };
+
-+http://www.raspberrypi.org/documentation/configuration/device-tree.md
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts 2015-07-28 01:20:58.166151930 +0200
++ __overrides__ {
++ pin = <&pwm_pins>,"brcm,pins:0";
++ func = <&pwm_pins>,"brcm,function:0";
++ clock = <&clk_pwm>,"clock-frequency:0";
++ };
++};
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,34 @@
+// Definitions for RPi DAC
+/dts-v1/;
@@ -3417,9 +3814,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts linux-xbian
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-display-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-display-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/rpi-display-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-display-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/rpi-display-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/rpi-display-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/rpi-display-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/rpi-display-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,82 @@
+/*
+ * Device Tree overlay for rpi-display by Watterott
@@ -3503,9 +3900,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-display-overlay.dts linux-x
+ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,17 @@
+/dts-v1/;
+/plugin/;
@@ -3524,9 +3921,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts linux-xb
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for Rpi-Proto
+/dts-v1/;
@@ -3567,9 +3964,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts linux-xbi
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,47 @@
+// rpi-sense HAT
+/dts-v1/;
@@ -3618,9 +4015,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts linux-xbi
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/sdhost-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/sdhost-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/sdhost-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/sdhost-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/sdhost-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/sdhost-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/sdhost-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/sdhost-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,56 @@
+/dts-v1/;
+/plugin/;
@@ -3678,9 +4075,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/sdhost-overlay.dts linux-xbian-
+ debug = <&sdhost>,"brcm,debug?";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,18 @@
+/*
+ * Device tree overlay for spi-bcm2835
@@ -3700,9 +4097,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts linux-x
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,18 @@
+/*
+ * Device tree overlay for spi-bcm2835
@@ -3722,9 +4119,33 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts linux-x
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/spi-dma-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/spi-dma-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/spi-dma-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/spi-dma-overlay.dts 2015-08-26 10:26:04.725259982 +0200
+@@ -0,0 +1,20 @@
++/*
++ * Device tree overlay for spi-bcm2835 to allow dma
++ */
++
++/dts-v1/;
++/plugin/;
++
++/ {
++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
++
++ fragment@0 {
++ target = <&spi0>;
++ __overlay__ {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ dmas = <&dma 6>, <&dma 7>;
++ dma-names = "tx", "rx";
++ };
++ };
++ };
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,216 @@
+/*
+ * tinylcd35-overlay.dts
@@ -3942,9 +4363,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts linux-xbi
+ keypad = <&keypad>,"status";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/uart1-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/uart1-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/uart1-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/uart1-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/uart1-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/uart1-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/uart1-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/uart1-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,38 @@
+/dts-v1/;
+/plugin/;
@@ -3984,9 +4405,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/uart1-overlay.dts linux-xbian-r
+ rxd1_pin = <&uart1_pins>,"brcm,pins:4";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/vga666-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/vga666-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/vga666-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/vga666-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/vga666-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/vga666-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/vga666-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/vga666-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,30 @@
+/dts-v1/;
+/plugin/;
@@ -4018,9 +4439,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/vga666-overlay.dts linux-xbian-
+ };
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,39 @@
+// Definitions for w1-gpio module (without external pullup)
+/dts-v1/;
@@ -4061,9 +4482,9 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts linux-xbian
+ pullup = <&w1>,"rpi,parasitic-power:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts linux-xbian-rpi/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts
---- linux-4.1.3/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts 2015-07-28 01:20:58.166151930 +0200
+diff -Nur linux-4.1.6/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts linux-rpi/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts
+--- linux-4.1.6/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts 2015-08-26 10:26:04.725259982 +0200
@@ -0,0 +1,41 @@
+// Definitions for w1-gpio module (with external pullup)
+/dts-v1/;
@@ -4106,10 +4527,10 @@ diff -Nur linux-4.1.3/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts linu
+ pullup = <&w1>,"rpi,parasitic-power:0";
+ };
+};
-diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/arm/configs/bcm2709_defconfig
---- linux-4.1.3/arch/arm/configs/bcm2709_defconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/configs/bcm2709_defconfig 2015-07-28 01:20:58.166151930 +0200
-@@ -0,0 +1,1228 @@
+diff -Nur linux-4.1.6/arch/arm/configs/bcm2709_defconfig linux-rpi/arch/arm/configs/bcm2709_defconfig
+--- linux-4.1.6/arch/arm/configs/bcm2709_defconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/configs/bcm2709_defconfig 2015-08-26 10:26:04.745260265 +0200
+@@ -0,0 +1,1233 @@
+# CONFIG_ARM_PATCH_PHYS_VIRT is not set
+CONFIG_PHYS_OFFSET=0
+CONFIG_LOCALVERSION="-v7"
@@ -4129,6 +4550,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_IKCONFIG_PROC=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_DEVICE=y
++CONFIG_CPUSETS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_MEMCG=y
+CONFIG_BLK_CGROUP=y
@@ -4530,6 +4952,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_BLK_DEV_DM=m
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
++CONFIG_DM_THIN_PROVISIONING=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_LOG_USERSPACE=m
+CONFIG_DM_RAID=m
@@ -4628,6 +5051,8 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_RT2800USB_RT53XX=y
+CONFIG_RT2800USB_RT55XX=y
+CONFIG_RT2800USB_UNKNOWN=y
++CONFIG_WL_MEDIATEK=y
++CONFIG_MT7601U=m
+CONFIG_RTL8192CU=m
+CONFIG_ZD1211RW=m
+CONFIG_MWIFIEX=m
@@ -5190,7 +5615,6 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_FB_FLEX=m
+CONFIG_FB_TFT_FBTFT_DEVICE=m
+CONFIG_MAILBOX=y
-+CONFIG_BCM2708_MBOX=y
+CONFIG_BCM2835_MBOX=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXTCON=m
@@ -5200,6 +5624,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_IIO_BUFFER_CB=y
+CONFIG_IIO_KFIFO_BUF=m
+CONFIG_DHT11=m
++CONFIG_PWM_BCM2835=m
+CONFIG_RASPBERRYPI_FIRMWARE=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
@@ -5228,6 +5653,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_AUTOFS4_FS=y
+CONFIG_FUSE_FS=m
+CONFIG_CUSE=m
++CONFIG_OVERLAY_FS=m
+CONFIG_FSCACHE=y
+CONFIG_FSCACHE_STATS=y
+CONFIG_FSCACHE_HISTOGRAM=y
@@ -5338,10 +5764,10 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2709_defconfig linux-xbian-rpi/arch/ar
+CONFIG_CRYPTO_AES_ARM_BS=m
+CONFIG_CRC_ITU_T=y
+CONFIG_LIBCRC32C=y
-diff -Nur linux-4.1.3/arch/arm/configs/bcm2835_defconfig linux-xbian-rpi/arch/arm/configs/bcm2835_defconfig
---- linux-4.1.3/arch/arm/configs/bcm2835_defconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/configs/bcm2835_defconfig 2015-07-28 01:20:58.166151930 +0200
-@@ -1,105 +1,1076 @@
+diff -Nur linux-4.1.6/arch/arm/configs/bcm2835_defconfig linux-rpi/arch/arm/configs/bcm2835_defconfig
+--- linux-4.1.6/arch/arm/configs/bcm2835_defconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/configs/bcm2835_defconfig 2015-08-26 10:26:04.745260265 +0200
+@@ -1,105 +1,1075 @@
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
@@ -6431,7 +6857,6 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2835_defconfig linux-xbian-rpi/arch/ar
+CONFIG_FB_FLEX=m
+CONFIG_FB_TFT_FBTFT_DEVICE=m
+CONFIG_MAILBOX=y
-+CONFIG_BCM2708_MBOX=y
+CONFIG_BCM2835_MBOX=y
# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXTCON=m
@@ -6440,7 +6865,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2835_defconfig linux-xbian-rpi/arch/ar
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
-@@ -107,18 +1078,110 @@
+@@ -107,18 +1077,110 @@
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
@@ -6554,7 +6979,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2835_defconfig linux-xbian-rpi/arch/ar
CONFIG_PRINTK_TIME=y
CONFIG_BOOT_PRINTK_DELAY=y
CONFIG_DYNAMIC_DEBUG=y
-@@ -128,14 +1191,39 @@
+@@ -128,14 +1190,39 @@
CONFIG_UNUSED_SYMBOLS=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_LOCKUP_DETECTOR=y
@@ -6594,10 +7019,10 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcm2835_defconfig linux-xbian-rpi/arch/ar
+CONFIG_LIBCRC32C=y
# CONFIG_XZ_DEC_ARM is not set
# CONFIG_XZ_DEC_ARMTHUMB is not set
-diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm/configs/bcmrpi_defconfig
---- linux-4.1.3/arch/arm/configs/bcmrpi_defconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/configs/bcmrpi_defconfig 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,1223 @@
+diff -Nur linux-4.1.6/arch/arm/configs/bcmrpi_defconfig linux-rpi/arch/arm/configs/bcmrpi_defconfig
+--- linux-4.1.6/arch/arm/configs/bcmrpi_defconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/configs/bcmrpi_defconfig 2015-08-26 10:26:04.745260265 +0200
+@@ -0,0 +1,1228 @@
+# CONFIG_ARM_PATCH_PHYS_VIRT is not set
+CONFIG_PHYS_OFFSET=0
+# CONFIG_LOCALVERSION_AUTO is not set
@@ -6616,6 +7041,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_IKCONFIG_PROC=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_DEVICE=y
++CONFIG_CPUSETS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_MEMCG=y
+CONFIG_BLK_CGROUP=y
@@ -7011,6 +7437,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_BLK_DEV_DM=m
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
++CONFIG_DM_THIN_PROVISIONING=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_LOG_USERSPACE=m
+CONFIG_DM_RAID=m
@@ -7109,6 +7536,8 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_RT2800USB_RT53XX=y
+CONFIG_RT2800USB_RT55XX=y
+CONFIG_RT2800USB_UNKNOWN=y
++CONFIG_WL_MEDIATEK=y
++CONFIG_MT7601U=m
+CONFIG_RTL8192CU=m
+CONFIG_ZD1211RW=m
+CONFIG_MWIFIEX=m
@@ -7671,7 +8100,6 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_FB_FLEX=m
+CONFIG_FB_TFT_FBTFT_DEVICE=m
+CONFIG_MAILBOX=y
-+CONFIG_BCM2708_MBOX=y
+CONFIG_BCM2835_MBOX=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXTCON=m
@@ -7681,6 +8109,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_IIO_BUFFER_CB=y
+CONFIG_IIO_KFIFO_BUF=m
+CONFIG_DHT11=m
++CONFIG_PWM_BCM2835=m
+CONFIG_RASPBERRYPI_FIRMWARE=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
@@ -7709,6 +8138,7 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_AUTOFS4_FS=y
+CONFIG_FUSE_FS=m
+CONFIG_CUSE=m
++CONFIG_OVERLAY_FS=m
+CONFIG_FSCACHE=y
+CONFIG_FSCACHE_STATS=y
+CONFIG_FSCACHE_HISTOGRAM=y
@@ -7821,9 +8251,9 @@ diff -Nur linux-4.1.3/arch/arm/configs/bcmrpi_defconfig linux-xbian-rpi/arch/arm
+CONFIG_CRYPTO_AES_ARM=m
+CONFIG_CRC_ITU_T=y
+CONFIG_LIBCRC32C=y
-diff -Nur linux-4.1.3/arch/arm/include/asm/entry-macro-multi.S linux-xbian-rpi/arch/arm/include/asm/entry-macro-multi.S
---- linux-4.1.3/arch/arm/include/asm/entry-macro-multi.S 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/include/asm/entry-macro-multi.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/include/asm/entry-macro-multi.S linux-rpi/arch/arm/include/asm/entry-macro-multi.S
+--- linux-4.1.6/arch/arm/include/asm/entry-macro-multi.S 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/include/asm/entry-macro-multi.S 2015-08-26 10:26:04.757260435 +0200
@@ -1,5 +1,6 @@
#include <asm/assembler.h>
@@ -7839,9 +8269,9 @@ diff -Nur linux-4.1.3/arch/arm/include/asm/entry-macro-multi.S linux-xbian-rpi/a
.macro arch_irq_handler, symbol_name
.align 5
-diff -Nur linux-4.1.3/arch/arm/include/asm/irqflags.h linux-xbian-rpi/arch/arm/include/asm/irqflags.h
---- linux-4.1.3/arch/arm/include/asm/irqflags.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/include/asm/irqflags.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/include/asm/irqflags.h linux-rpi/arch/arm/include/asm/irqflags.h
+--- linux-4.1.6/arch/arm/include/asm/irqflags.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/include/asm/irqflags.h 2015-08-26 10:26:04.761260491 +0200
@@ -145,12 +145,22 @@
}
@@ -7868,9 +8298,9 @@ diff -Nur linux-4.1.3/arch/arm/include/asm/irqflags.h linux-xbian-rpi/arch/arm/i
:
: "r" (flags)
: "memory", "cc");
-diff -Nur linux-4.1.3/arch/arm/include/asm/string.h linux-xbian-rpi/arch/arm/include/asm/string.h
---- linux-4.1.3/arch/arm/include/asm/string.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/include/asm/string.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/include/asm/string.h linux-rpi/arch/arm/include/asm/string.h
+--- linux-4.1.6/arch/arm/include/asm/string.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/include/asm/string.h 2015-08-26 10:26:04.765260547 +0200
@@ -24,6 +24,11 @@
#define __HAVE_ARCH_MEMSET
extern void * memset(void *, int, __kernel_size_t);
@@ -7883,9 +8313,9 @@ diff -Nur linux-4.1.3/arch/arm/include/asm/string.h linux-xbian-rpi/arch/arm/inc
extern void __memzero(void *ptr, __kernel_size_t n);
#define memset(p,v,n) \
-diff -Nur linux-4.1.3/arch/arm/include/asm/uaccess.h linux-xbian-rpi/arch/arm/include/asm/uaccess.h
---- linux-4.1.3/arch/arm/include/asm/uaccess.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/include/asm/uaccess.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/include/asm/uaccess.h linux-rpi/arch/arm/include/asm/uaccess.h
+--- linux-4.1.6/arch/arm/include/asm/uaccess.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/include/asm/uaccess.h 2015-08-26 10:26:04.765260547 +0200
@@ -475,6 +475,7 @@
#ifdef CONFIG_MMU
@@ -7894,83 +8324,9 @@ diff -Nur linux-4.1.3/arch/arm/include/asm/uaccess.h linux-xbian-rpi/arch/arm/in
extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n);
extern unsigned long __must_check __copy_to_user_std(void __user *to, const void *from, unsigned long n);
extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n);
-diff -Nur linux-4.1.3/arch/arm/Kconfig linux-xbian-rpi/arch/arm/Kconfig
---- linux-4.1.3/arch/arm/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/Kconfig 2015-07-28 01:20:58.162166151 +0200
-@@ -314,6 +314,42 @@
- default ARCH_VERSATILE if !MMU
- default ARCH_MULTIPLATFORM if MMU
-
-+config ARCH_BCM2708
-+ bool "Broadcom BCM2708 family"
-+ select CPU_V6
-+ select ARM_AMBA
-+ select HAVE_SCHED_CLOCK
-+ select NEED_MACH_GPIO_H
-+ select NEED_MACH_MEMORY_H
-+ select COMMON_CLK
-+ select ARCH_HAS_CPUFREQ
-+ select GENERIC_CLOCKEVENTS
-+ select ARM_ERRATA_411920
-+ select MACH_BCM2708
-+ select VC4
-+ select FIQ
-+ help
-+ This enables support for Broadcom BCM2708 boards.
-+
-+config ARCH_BCM2709
-+ bool "Broadcom BCM2709 family"
-+ select ARCH_HAS_BARRIERS if SMP
-+ select CPU_V7
-+ select HAVE_SMP
-+ select ARM_AMBA
-+ select MIGHT_HAVE_CACHE_L2X0
-+ select HAVE_SCHED_CLOCK
-+ select NEED_MACH_MEMORY_H
-+ select NEED_MACH_IO_H
-+ select COMMON_CLK
-+ select ARCH_HAS_CPUFREQ
-+ select GENERIC_CLOCKEVENTS
-+ select MACH_BCM2709
-+ select VC4
-+ select FIQ
-+ help
-+ This enables support for Broadcom BCM2709 boards.
-+
- config ARCH_MULTIPLATFORM
- bool "Allow multiple platforms to be selected"
- depends on MMU
-@@ -823,6 +859,9 @@
- # Kconfigs may be included either alphabetically (according to the
- # plat- suffix) or along side the corresponding mach-* source.
- #
-+source "arch/arm/mach-bcm2708/Kconfig"
-+source "arch/arm/mach-bcm2709/Kconfig"
-+
- source "arch/arm/mach-mvebu/Kconfig"
-
- source "arch/arm/mach-alpine/Kconfig"
-diff -Nur linux-4.1.3/arch/arm/Kconfig.debug linux-xbian-rpi/arch/arm/Kconfig.debug
---- linux-4.1.3/arch/arm/Kconfig.debug 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/Kconfig.debug 2015-07-28 01:20:58.162166151 +0200
-@@ -1197,6 +1197,14 @@
- options; the platform specific options are deprecated
- and will be soon removed.
-
-+ config DEBUG_BCM2708_UART0
-+ bool "Broadcom BCM2708 UART0 (PL011)"
-+ depends on MACH_BCM2708
-+ help
-+ Say Y here if you want the debug print routines to direct
-+ their output to UART 0. The port must have been initialised
-+ by the boot-loader before use.
-+
- endchoice
-
- config DEBUG_AT91_UART
-diff -Nur linux-4.1.3/arch/arm/kernel/fiqasm.S linux-xbian-rpi/arch/arm/kernel/fiqasm.S
---- linux-4.1.3/arch/arm/kernel/fiqasm.S 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/kernel/fiqasm.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/kernel/fiqasm.S linux-rpi/arch/arm/kernel/fiqasm.S
+--- linux-4.1.6/arch/arm/kernel/fiqasm.S 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/kernel/fiqasm.S 2015-08-26 10:26:04.769260604 +0200
@@ -47,3 +47,7 @@
mov r0, r0 @ avoid hazard prior to ARMv4
ret lr
@@ -7979,9 +8335,9 @@ diff -Nur linux-4.1.3/arch/arm/kernel/fiqasm.S linux-xbian-rpi/arch/arm/kernel/f
+ENTRY(__FIQ_Branch)
+ mov pc, r8
+ENDPROC(__FIQ_Branch)
-diff -Nur linux-4.1.3/arch/arm/kernel/head.S linux-xbian-rpi/arch/arm/kernel/head.S
---- linux-4.1.3/arch/arm/kernel/head.S 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/kernel/head.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/kernel/head.S linux-rpi/arch/arm/kernel/head.S
+--- linux-4.1.6/arch/arm/kernel/head.S 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/kernel/head.S 2015-08-26 10:26:04.769260604 +0200
@@ -680,6 +680,14 @@
ldrcc r7, [r4], #4 @ use branch for delay slot
bcc 1b
@@ -7997,18 +8353,10 @@ diff -Nur linux-4.1.3/arch/arm/kernel/head.S linux-xbian-rpi/arch/arm/kernel/hea
#endif
ENDPROC(__fixup_a_pv_table)
-diff -Nur linux-4.1.3/arch/arm/kernel/process.c linux-xbian-rpi/arch/arm/kernel/process.c
---- linux-4.1.3/arch/arm/kernel/process.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/kernel/process.c 2015-07-28 01:20:58.170137709 +0200
-@@ -28,6 +28,7 @@
- #include <linux/random.h>
- #include <linux/hw_breakpoint.h>
- #include <linux/leds.h>
-+#include <linux/delay.h>
-
- #include <asm/processor.h>
- #include <asm/thread_notify.h>
-@@ -98,6 +99,16 @@
+diff -Nur linux-4.1.6/arch/arm/kernel/process.c linux-rpi/arch/arm/kernel/process.c
+--- linux-4.1.6/arch/arm/kernel/process.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/kernel/process.c 2015-08-26 10:26:04.773260660 +0200
+@@ -98,6 +98,16 @@
}
#endif
@@ -8025,9 +8373,41 @@ diff -Nur linux-4.1.3/arch/arm/kernel/process.c linux-xbian-rpi/arch/arm/kernel/
void __show_regs(struct pt_regs *regs)
{
unsigned long flags;
-diff -Nur linux-4.1.3/arch/arm/lib/arm-mem.h linux-xbian-rpi/arch/arm/lib/arm-mem.h
---- linux-4.1.3/arch/arm/lib/arm-mem.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/arm-mem.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/Makefile linux-rpi/arch/arm/lib/Makefile
+--- linux-4.1.6/arch/arm/lib/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/lib/Makefile 2015-08-26 10:26:04.777260716 +0200
+@@ -6,9 +6,8 @@
+
+ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
+ csumpartialcopy.o csumpartialcopyuser.o clearbit.o \
+- delay.o delay-loop.o findbit.o memchr.o memcpy.o \
+- memmove.o memset.o memzero.o setbit.o \
+- strchr.o strrchr.o \
++ delay.o delay-loop.o findbit.o memchr.o memzero.o \
++ setbit.o strchr.o strrchr.o \
+ testchangebit.o testclearbit.o testsetbit.o \
+ ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
+ ucmpdi2.o lib1funcs.o div64.o \
+@@ -18,6 +17,16 @@
+ mmu-y := clear_user.o copy_page.o getuser.o putuser.o \
+ copy_from_user.o copy_to_user.o
+
++# Choose optimised implementations for Raspberry Pi
++ifeq ($(CONFIG_MACH_BCM2708),y)
++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600
++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672
++ obj-$(CONFIG_MODULES) += exports_rpi.o
++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o
++else
++ lib-y += memcpy.o memmove.o memset.o
++endif
++
+ # using lib_ here won't override already available weak symbols
+ obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o
+
+diff -Nur linux-4.1.6/arch/arm/lib/arm-mem.h linux-rpi/arch/arm/lib/arm-mem.h
+--- linux-4.1.6/arch/arm/lib/arm-mem.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/arm-mem.h 2015-08-26 10:26:04.777260716 +0200
@@ -0,0 +1,159 @@
+/*
+Copyright (c) 2013, Raspberry Pi Foundation
@@ -8188,9 +8568,9 @@ diff -Nur linux-4.1.3/arch/arm/lib/arm-mem.h linux-xbian-rpi/arch/arm/lib/arm-me
+ .endif
+92:
+.endm
-diff -Nur linux-4.1.3/arch/arm/lib/copy_from_user.S linux-xbian-rpi/arch/arm/lib/copy_from_user.S
---- linux-4.1.3/arch/arm/lib/copy_from_user.S 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/lib/copy_from_user.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/copy_from_user.S linux-rpi/arch/arm/lib/copy_from_user.S
+--- linux-4.1.6/arch/arm/lib/copy_from_user.S 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/lib/copy_from_user.S 2015-08-26 10:26:04.777260716 +0200
@@ -89,11 +89,13 @@
.text
@@ -8206,9 +8586,9 @@ diff -Nur linux-4.1.3/arch/arm/lib/copy_from_user.S linux-xbian-rpi/arch/arm/lib
.pushsection .fixup,"ax"
.align 0
-diff -Nur linux-4.1.3/arch/arm/lib/exports_rpi.c linux-xbian-rpi/arch/arm/lib/exports_rpi.c
---- linux-4.1.3/arch/arm/lib/exports_rpi.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/exports_rpi.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/exports_rpi.c linux-rpi/arch/arm/lib/exports_rpi.c
+--- linux-4.1.6/arch/arm/lib/exports_rpi.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/exports_rpi.c 2015-08-26 10:26:04.777260716 +0200
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd.
@@ -8247,41 +8627,9 @@ diff -Nur linux-4.1.3/arch/arm/lib/exports_rpi.c linux-xbian-rpi/arch/arm/lib/ex
+#include <linux/module.h>
+
+EXPORT_SYMBOL(memcmp);
-diff -Nur linux-4.1.3/arch/arm/lib/Makefile linux-xbian-rpi/arch/arm/lib/Makefile
---- linux-4.1.3/arch/arm/lib/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/lib/Makefile 2015-07-28 01:20:58.170137709 +0200
-@@ -6,9 +6,8 @@
-
- lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
- csumpartialcopy.o csumpartialcopyuser.o clearbit.o \
-- delay.o delay-loop.o findbit.o memchr.o memcpy.o \
-- memmove.o memset.o memzero.o setbit.o \
-- strchr.o strrchr.o \
-+ delay.o delay-loop.o findbit.o memchr.o memzero.o \
-+ setbit.o strchr.o strrchr.o \
- testchangebit.o testclearbit.o testsetbit.o \
- ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
- ucmpdi2.o lib1funcs.o div64.o \
-@@ -18,6 +17,16 @@
- mmu-y := clear_user.o copy_page.o getuser.o putuser.o \
- copy_from_user.o copy_to_user.o
-
-+# Choose optimised implementations for Raspberry Pi
-+ifeq ($(CONFIG_MACH_BCM2708),y)
-+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600
-+ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672
-+ obj-$(CONFIG_MODULES) += exports_rpi.o
-+ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o
-+else
-+ lib-y += memcpy.o memmove.o memset.o
-+endif
-+
- # using lib_ here won't override already available weak symbols
- obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o
-
-diff -Nur linux-4.1.3/arch/arm/lib/memcmp_rpi.S linux-xbian-rpi/arch/arm/lib/memcmp_rpi.S
---- linux-4.1.3/arch/arm/lib/memcmp_rpi.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/memcmp_rpi.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/memcmp_rpi.S linux-rpi/arch/arm/lib/memcmp_rpi.S
+--- linux-4.1.6/arch/arm/lib/memcmp_rpi.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/memcmp_rpi.S 2015-08-26 10:26:04.777260716 +0200
@@ -0,0 +1,285 @@
+/*
+Copyright (c) 2013, Raspberry Pi Foundation
@@ -8568,9 +8916,72 @@ diff -Nur linux-4.1.3/arch/arm/lib/memcmp_rpi.S linux-xbian-rpi/arch/arm/lib/mem
+ .unreq DAT7
+ .unreq OFF
+ENDPROC(memcmp)
-diff -Nur linux-4.1.3/arch/arm/lib/memcpymove.h linux-xbian-rpi/arch/arm/lib/memcpymove.h
---- linux-4.1.3/arch/arm/lib/memcpymove.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/memcpymove.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/memcpy_rpi.S linux-rpi/arch/arm/lib/memcpy_rpi.S
+--- linux-4.1.6/arch/arm/lib/memcpy_rpi.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/memcpy_rpi.S 2015-08-26 10:26:04.777260716 +0200
+@@ -0,0 +1,59 @@
++/*
++Copyright (c) 2013, Raspberry Pi Foundation
++Copyright (c) 2013, RISC OS Open Ltd
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are met:
++ * Redistributions of source code must retain the above copyright
++ notice, this list of conditions and the following disclaimer.
++ * Redistributions in binary form must reproduce the above copyright
++ notice, this list of conditions and the following disclaimer in the
++ documentation and/or other materials provided with the distribution.
++ * Neither the name of the copyright holder nor the
++ names of its contributors may be used to endorse or promote products
++ derived from this software without specific prior written permission.
++
++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
++*/
++
++#include <linux/linkage.h>
++#include "arm-mem.h"
++#include "memcpymove.h"
++
++/* Prevent the stack from becoming executable */
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
++
++ .text
++ .arch armv6
++ .object_arch armv4
++ .arm
++ .altmacro
++ .p2align 2
++
++/*
++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
++ * On entry:
++ * a1 = pointer to destination
++ * a2 = pointer to source
++ * a3 = number of bytes to copy
++ * On exit:
++ * a1 preserved
++ */
++
++.set prefetch_distance, 3
++
++ENTRY(memcpy)
++ memcpy 0
++ENDPROC(memcpy)
+diff -Nur linux-4.1.6/arch/arm/lib/memcpymove.h linux-rpi/arch/arm/lib/memcpymove.h
+--- linux-4.1.6/arch/arm/lib/memcpymove.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/memcpymove.h 2015-08-26 10:26:04.777260716 +0200
@@ -0,0 +1,506 @@
+/*
+Copyright (c) 2013, Raspberry Pi Foundation
@@ -9078,72 +9489,9 @@ diff -Nur linux-4.1.3/arch/arm/lib/memcpymove.h linux-xbian-rpi/arch/arm/lib/mem
+ .unreq LAST
+ .unreq OFF
+.endm
-diff -Nur linux-4.1.3/arch/arm/lib/memcpy_rpi.S linux-xbian-rpi/arch/arm/lib/memcpy_rpi.S
---- linux-4.1.3/arch/arm/lib/memcpy_rpi.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/memcpy_rpi.S 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,59 @@
-+/*
-+Copyright (c) 2013, Raspberry Pi Foundation
-+Copyright (c) 2013, RISC OS Open Ltd
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without
-+modification, are permitted provided that the following conditions are met:
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+ * Neither the name of the copyright holder nor the
-+ names of its contributors may be used to endorse or promote products
-+ derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
-+*/
-+
-+#include <linux/linkage.h>
-+#include "arm-mem.h"
-+#include "memcpymove.h"
-+
-+/* Prevent the stack from becoming executable */
-+#if defined(__linux__) && defined(__ELF__)
-+.section .note.GNU-stack,"",%progbits
-+#endif
-+
-+ .text
-+ .arch armv6
-+ .object_arch armv4
-+ .arm
-+ .altmacro
-+ .p2align 2
-+
-+/*
-+ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
-+ * On entry:
-+ * a1 = pointer to destination
-+ * a2 = pointer to source
-+ * a3 = number of bytes to copy
-+ * On exit:
-+ * a1 preserved
-+ */
-+
-+.set prefetch_distance, 3
-+
-+ENTRY(memcpy)
-+ memcpy 0
-+ENDPROC(memcpy)
-diff -Nur linux-4.1.3/arch/arm/lib/memmove_rpi.S linux-xbian-rpi/arch/arm/lib/memmove_rpi.S
---- linux-4.1.3/arch/arm/lib/memmove_rpi.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/memmove_rpi.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/memmove_rpi.S linux-rpi/arch/arm/lib/memmove_rpi.S
+--- linux-4.1.6/arch/arm/lib/memmove_rpi.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/memmove_rpi.S 2015-08-26 10:26:04.777260716 +0200
@@ -0,0 +1,61 @@
+/*
+Copyright (c) 2013, Raspberry Pi Foundation
@@ -9206,9 +9554,9 @@ diff -Nur linux-4.1.3/arch/arm/lib/memmove_rpi.S linux-xbian-rpi/arch/arm/lib/me
+ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */
+ memcpy 1
+ENDPROC(memmove)
-diff -Nur linux-4.1.3/arch/arm/lib/memset_rpi.S linux-xbian-rpi/arch/arm/lib/memset_rpi.S
---- linux-4.1.3/arch/arm/lib/memset_rpi.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/lib/memset_rpi.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/memset_rpi.S linux-rpi/arch/arm/lib/memset_rpi.S
+--- linux-4.1.6/arch/arm/lib/memset_rpi.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/lib/memset_rpi.S 2015-08-26 10:26:04.777260716 +0200
@@ -0,0 +1,121 @@
+/*
+Copyright (c) 2013, Raspberry Pi Foundation
@@ -9331,9 +9679,9 @@ diff -Nur linux-4.1.3/arch/arm/lib/memset_rpi.S linux-xbian-rpi/arch/arm/lib/mem
+ .unreq DAT2
+ .unreq DAT3
+ENDPROC(memset)
-diff -Nur linux-4.1.3/arch/arm/lib/uaccess_with_memcpy.c linux-xbian-rpi/arch/arm/lib/uaccess_with_memcpy.c
---- linux-4.1.3/arch/arm/lib/uaccess_with_memcpy.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/lib/uaccess_with_memcpy.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/lib/uaccess_with_memcpy.c linux-rpi/arch/arm/lib/uaccess_with_memcpy.c
+--- linux-4.1.6/arch/arm/lib/uaccess_with_memcpy.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/lib/uaccess_with_memcpy.c 2015-08-26 10:26:04.777260716 +0200
@@ -22,6 +22,14 @@
#include <asm/current.h>
#include <asm/page.h>
@@ -9477,9 +9825,20 @@ diff -Nur linux-4.1.3/arch/arm/lib/uaccess_with_memcpy.c linux-xbian-rpi/arch/ar
static unsigned long noinline
__clear_user_memset(void __user *addr, unsigned long n)
-diff -Nur linux-4.1.3/arch/arm/mach-bcm/board_bcm2835.c linux-xbian-rpi/arch/arm/mach-bcm/board_bcm2835.c
---- linux-4.1.3/arch/arm/mach-bcm/board_bcm2835.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/mach-bcm/board_bcm2835.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm/Kconfig linux-rpi/arch/arm/mach-bcm/Kconfig
+--- linux-4.1.6/arch/arm/mach-bcm/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/mach-bcm/Kconfig 2015-08-26 10:26:04.781260773 +0200
+@@ -114,6 +114,7 @@
+ select ARM_ERRATA_411920
+ select ARM_TIMER_SP804
+ select CLKSRC_OF
++ select FIQ
+ select PINCTRL
+ select PINCTRL_BCM2835
+ help
+diff -Nur linux-4.1.6/arch/arm/mach-bcm/board_bcm2835.c linux-rpi/arch/arm/mach-bcm/board_bcm2835.c
+--- linux-4.1.6/arch/arm/mach-bcm/board_bcm2835.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/mach-bcm/board_bcm2835.c 2015-08-26 10:26:04.781260773 +0200
@@ -18,6 +18,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
@@ -9510,20 +9869,75 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm/board_bcm2835.c linux-xbian-rpi/arch/arm
}
static const char * const bcm2835_compat[] = {
-diff -Nur linux-4.1.3/arch/arm/mach-bcm/Kconfig linux-xbian-rpi/arch/arm/mach-bcm/Kconfig
---- linux-4.1.3/arch/arm/mach-bcm/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/mach-bcm/Kconfig 2015-07-28 01:20:58.170137709 +0200
-@@ -114,6 +114,7 @@
- select ARM_ERRATA_411920
- select ARM_TIMER_SP804
- select CLKSRC_OF
-+ select FIQ
- select PINCTRL
- select PINCTRL_BCM2835
- help
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/armctrl.c linux-xbian-rpi/arch/arm/mach-bcm2708/armctrl.c
---- linux-4.1.3/arch/arm/mach-bcm2708/armctrl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/armctrl.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/Kconfig linux-rpi/arch/arm/mach-bcm2708/Kconfig
+--- linux-4.1.6/arch/arm/mach-bcm2708/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/Kconfig 2015-08-26 10:26:04.781260773 +0200
+@@ -0,0 +1,45 @@
++menu "Broadcom BCM2708 Implementations"
++ depends on ARCH_BCM2708
++
++config MACH_BCM2708
++ bool "Broadcom BCM2708 Development Platform"
++ select NEED_MACH_MEMORY_H
++ select NEED_MACH_IO_H
++ select CPU_V6
++ help
++ Include support for the Broadcom(R) BCM2708 platform.
++
++config BCM2708_DT
++ bool "BCM2708 Device Tree support"
++ depends on MACH_BCM2708
++ default n
++ select USE_OF
++ select ARCH_REQUIRE_GPIOLIB
++ select PINCTRL
++ select PINCTRL_BCM2835
++ help
++ Enable Device Tree support for BCM2708
++
++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_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.
++
++config BCM2708_SPIDEV
++ bool "Bind spidev to SPI0 master"
++ depends on MACH_BCM2708
++ depends on SPI
++ default y
++ help
++ Binds spidev driver to the SPI0 master
++endmenu
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/Makefile linux-rpi/arch/arm/mach-bcm2708/Makefile
+--- linux-4.1.6/arch/arm/mach-bcm2708/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/Makefile 2015-08-26 10:26:04.781260773 +0200
+@@ -0,0 +1,6 @@
++#
++# Makefile for the linux kernel.
++#
++
++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o
++obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/Makefile.boot linux-rpi/arch/arm/mach-bcm2708/Makefile.boot
+--- linux-4.1.6/arch/arm/mach-bcm2708/Makefile.boot 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/Makefile.boot 2015-08-26 10:26:04.781260773 +0200
+@@ -0,0 +1,3 @@
++ zreladdr-y := 0x00008000
++params_phys-y := 0x00000100
++initrd_phys-y := 0x00800000
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/armctrl.c linux-rpi/arch/arm/mach-bcm2708/armctrl.c
+--- linux-4.1.6/arch/arm/mach-bcm2708/armctrl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/armctrl.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,315 @@
+/*
+ * linux/arch/arm/mach-bcm2708/armctrl.c
@@ -9840,9 +10254,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/armctrl.c linux-xbian-rpi/arch/arm/m
+ armctrl_dt_init();
+ return 0;
+}
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/armctrl.h linux-xbian-rpi/arch/arm/mach-bcm2708/armctrl.h
---- linux-4.1.3/arch/arm/mach-bcm2708/armctrl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/armctrl.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/armctrl.h linux-rpi/arch/arm/mach-bcm2708/armctrl.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/armctrl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/armctrl.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,27 @@
+/*
+ * linux/arch/arm/mach-bcm2708/armctrl.h
@@ -9871,9 +10285,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/armctrl.h linux-xbian-rpi/arch/arm/m
+ u32 armctrl_sources, u32 resume_sources);
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/bcm2708.c linux-xbian-rpi/arch/arm/mach-bcm2708/bcm2708.c
---- linux-4.1.3/arch/arm/mach-bcm2708/bcm2708.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/bcm2708.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/bcm2708.c linux-rpi/arch/arm/mach-bcm2708/bcm2708.c
+--- linux-4.1.6/arch/arm/mach-bcm2708/bcm2708.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/bcm2708.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,1162 @@
+/*
+ * linux/arch/arm/mach-bcm2708/bcm2708.c
@@ -11037,9 +11451,62 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/bcm2708.c linux-xbian-rpi/arch/arm/m
+MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral.");
+module_param(pps_gpio_pin, int, 0644);
+MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS");
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/bcm2708_gpio.c linux-xbian-rpi/arch/arm/mach-bcm2708/bcm2708_gpio.c
---- linux-4.1.3/arch/arm/mach-bcm2708/bcm2708_gpio.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/bcm2708_gpio.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/bcm2708.h linux-rpi/arch/arm/mach-bcm2708/bcm2708.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/bcm2708.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/bcm2708.h 2015-08-26 10:26:04.781260773 +0200
+@@ -0,0 +1,49 @@
++/*
++ * 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 <linux/amba/bus.h>
++
++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, \
++ }, \
++ .irq = base##_IRQ, \
++}
++
++#endif
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/bcm2708_gpio.c linux-rpi/arch/arm/mach-bcm2708/bcm2708_gpio.c
+--- linux-4.1.6/arch/arm/mach-bcm2708/bcm2708_gpio.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/bcm2708_gpio.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,426 @@
+/*
+ * linux/arch/arm/mach-bcm2708/bcm2708_gpio.c
@@ -11467,62 +11934,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/bcm2708_gpio.c linux-xbian-rpi/arch/
+
+MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/bcm2708.h linux-xbian-rpi/arch/arm/mach-bcm2708/bcm2708.h
---- linux-4.1.3/arch/arm/mach-bcm2708/bcm2708.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/bcm2708.h 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,49 @@
-+/*
-+ * 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 <linux/amba/bus.h>
-+
-+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, \
-+ }, \
-+ .irq = base##_IRQ, \
-+}
-+
-+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/arm_control.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/arm_control.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/arm_control.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/arm_control.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/arm_control.h linux-rpi/arch/arm/mach-bcm2708/include/mach/arm_control.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/arm_control.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/arm_control.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,419 @@
+/*
+ * linux/arch/arm/mach-bcm2708/arm_control.h
@@ -11943,9 +12357,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/arm_control.h linux-xbi
+#define AJBTDO HW_REGISTER_RW(AJB_BASE+0x0c)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/clkdev.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/clkdev.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/clkdev.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/clkdev.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/clkdev.h linux-rpi/arch/arm/mach-bcm2708/include/mach/clkdev.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/clkdev.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/clkdev.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,7 @@
+#ifndef __ASM_MACH_CLKDEV_H
+#define __ASM_MACH_CLKDEV_H
@@ -11954,9 +12368,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/clkdev.h linux-xbian-rp
+#define __clk_put(clk) do { } while (0)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/debug-macro.S linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/debug-macro.S
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/debug-macro.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/debug-macro.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/debug-macro.S linux-rpi/arch/arm/mach-bcm2708/include/mach/debug-macro.S
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/debug-macro.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/debug-macro.S 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,22 @@
+/* arch/arm/mach-bcm2708/include/mach/debug-macro.S
+ *
@@ -11980,9 +12394,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/debug-macro.S linux-xbi
+ .endm
+
+#include <debug/pl01x.S>
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/entry-macro.S linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/entry-macro.S
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/entry-macro.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/entry-macro.S 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/entry-macro.S linux-rpi/arch/arm/mach-bcm2708/include/mach/entry-macro.S
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/entry-macro.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/entry-macro.S 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,69 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/entry-macro.S
@@ -12053,9 +12467,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/entry-macro.S linux-xbi
+1020: @ EQ will be set if no irqs pending
+
+ .endm
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/frc.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/frc.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/frc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/frc.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/frc.h linux-rpi/arch/arm/mach-bcm2708/include/mach/frc.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/frc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/frc.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,38 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/timex.h
@@ -12095,9 +12509,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/frc.h linux-xbian-rpi/a
+extern unsigned long long frc_clock_ticks63(void);
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/gpio.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/gpio.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/gpio.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/gpio.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/gpio.h linux-rpi/arch/arm/mach-bcm2708/include/mach/gpio.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/gpio.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/gpio.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,17 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/gpio.h
@@ -12116,9 +12530,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/gpio.h linux-xbian-rpi/
+#define irq_to_gpio(x) ((x) - GPIO_IRQ_START)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/hardware.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/hardware.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/hardware.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/hardware.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/hardware.h linux-rpi/arch/arm/mach-bcm2708/include/mach/hardware.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/hardware.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/hardware.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,28 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/hardware.h
@@ -12148,9 +12562,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/hardware.h linux-xbian-
+#include <mach/platform.h>
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/io.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/io.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/io.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/io.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/io.h linux-rpi/arch/arm/mach-bcm2708/include/mach/io.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/io.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/io.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,27 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/io.h
@@ -12179,9 +12593,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/io.h linux-xbian-rpi/ar
+#define __io(a) __typesafe_io(a)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/irqs.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/irqs.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/irqs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/irqs.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/irqs.h linux-rpi/arch/arm/mach-bcm2708/include/mach/irqs.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/irqs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/irqs.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,199 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/irqs.h
@@ -12382,9 +12796,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/irqs.h linux-xbian-rpi/
+#define NR_IRQS (BCM2708_ALLOC_IRQS+FREE_IRQS)
+
+#endif /* _BCM2708_IRQS_H_ */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/memory.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/memory.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/memory.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/memory.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/memory.h linux-rpi/arch/arm/mach-bcm2708/include/mach/memory.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/memory.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/memory.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,57 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/memory.h
@@ -12443,9 +12857,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/memory.h linux-xbian-rp
+#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET))
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/platform.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/platform.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/platform.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/platform.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/platform.h linux-rpi/arch/arm/mach-bcm2708/include/mach/platform.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/platform.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/platform.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,230 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/platform.h
@@ -12677,9 +13091,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/platform.h linux-xbian-
+#endif
+
+/* END */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/system.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/system.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/system.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/system.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/system.h linux-rpi/arch/arm/mach-bcm2708/include/mach/system.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/system.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/system.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,38 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/system.h
@@ -12719,9 +13133,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/system.h linux-xbian-rp
+}
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/timex.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/timex.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/timex.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/timex.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/timex.h linux-rpi/arch/arm/mach-bcm2708/include/mach/timex.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/timex.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/timex.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/timex.h
@@ -12746,9 +13160,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/timex.h linux-xbian-rpi
+ */
+
+#define CLOCK_TICK_RATE (1000000)
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/uncompress.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/uncompress.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/uncompress.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/uncompress.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/uncompress.h linux-rpi/arch/arm/mach-bcm2708/include/mach/uncompress.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/uncompress.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/uncompress.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,84 @@
+/*
+ * arch/arm/mach-bcn2708/include/mach/uncompress.h
@@ -12834,9 +13248,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/uncompress.h linux-xbia
+ * nothing to do
+ */
+#define arch_decomp_wdog()
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h linux-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,181 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -13019,9 +13433,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_sm_defs.h linux-xbia
+} VC_SM_MSG_UNION_T;
+
+#endif /* __VC_SM_DEFS_H__INCLUDED__ */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h linux-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,55 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -13078,9 +13492,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_sm_knl.h linux-xbian
+ long unsigned int *data);
+
+#endif /* __VC_SM_KNL_H__INCLUDED__ */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h linux-rpi/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,82 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -13164,9 +13578,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vc_vchi_sm.h linux-xbia
+ VC_SM_ACTION_CLEAN_T *action_clean);
+
+#endif /* __VC_VCHI_SM_H__INCLUDED__ */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vmalloc.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vmalloc.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vmalloc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vmalloc.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vmalloc.h linux-rpi/arch/arm/mach-bcm2708/include/mach/vmalloc.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vmalloc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/vmalloc.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,20 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/vmalloc.h
@@ -13188,9 +13602,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vmalloc.h linux-xbian-r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#define VMALLOC_END (0xe8000000)
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h
---- linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h linux-rpi/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h
+--- linux-4.1.6/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,248 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -13440,75 +13854,72 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h linux-x
+/* ---- Function Prototypes ---------------------------------------------- */
+
+#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/Kconfig linux-xbian-rpi/arch/arm/mach-bcm2708/Kconfig
---- linux-4.1.3/arch/arm/mach-bcm2708/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/Kconfig 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,45 @@
-+menu "Broadcom BCM2708 Implementations"
-+ depends on ARCH_BCM2708
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/Kconfig linux-rpi/arch/arm/mach-bcm2709/Kconfig
+--- linux-4.1.6/arch/arm/mach-bcm2709/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/Kconfig 2015-08-26 10:26:04.781260773 +0200
+@@ -0,0 +1,42 @@
++menu "Broadcom BCM2709 Implementations"
++ depends on ARCH_BCM2709
+
-+config MACH_BCM2708
-+ bool "Broadcom BCM2708 Development Platform"
-+ select NEED_MACH_MEMORY_H
-+ select NEED_MACH_IO_H
-+ select CPU_V6
++config MACH_BCM2709
++ bool "Broadcom BCM2709 Development Platform"
+ help
-+ Include support for the Broadcom(R) BCM2708 platform.
++ Include support for the Broadcom(R) BCM2709 platform.
+
-+config BCM2708_DT
-+ bool "BCM2708 Device Tree support"
-+ depends on MACH_BCM2708
++config BCM2709_DT
++ bool "BCM2709 Device Tree support"
++ depends on MACH_BCM2709
+ default n
+ select USE_OF
+ select ARCH_REQUIRE_GPIOLIB
+ select PINCTRL
+ select PINCTRL_BCM2835
+ help
-+ Enable Device Tree support for BCM2708
++ Enable Device Tree support for BCM2709
+
+config BCM2708_GPIO
-+ bool "BCM2708 gpio support"
-+ depends on MACH_BCM2708
++ bool "BCM2709 gpio support"
++ depends on MACH_BCM2709
+ select ARCH_REQUIRE_GPIOLIB
+ default y
+ help
-+ Include support for the Broadcom(R) BCM2708 gpio.
++ Include support for the Broadcom(R) BCM2709 gpio.
+
+config BCM2708_NOL2CACHE
+ bool "Videocore L2 cache disable"
-+ depends on MACH_BCM2708
-+ default n
++ depends on MACH_BCM2709
++ default y
+ help
+ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt.
+
+config BCM2708_SPIDEV
+ bool "Bind spidev to SPI0 master"
-+ depends on MACH_BCM2708
++ depends on MACH_BCM2709
+ depends on SPI
+ default y
+ help
+ Binds spidev driver to the SPI0 master
+endmenu
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/Makefile linux-xbian-rpi/arch/arm/mach-bcm2708/Makefile
---- linux-4.1.3/arch/arm/mach-bcm2708/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/Makefile 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/Makefile linux-rpi/arch/arm/mach-bcm2709/Makefile
+--- linux-4.1.6/arch/arm/mach-bcm2709/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/Makefile 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,6 @@
+#
+# Makefile for the linux kernel.
+#
+
-+obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o
++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o
+obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2708/Makefile.boot linux-xbian-rpi/arch/arm/mach-bcm2708/Makefile.boot
---- linux-4.1.3/arch/arm/mach-bcm2708/Makefile.boot 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2708/Makefile.boot 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/Makefile.boot linux-rpi/arch/arm/mach-bcm2709/Makefile.boot
+--- linux-4.1.6/arch/arm/mach-bcm2709/Makefile.boot 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/Makefile.boot 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,3 @@
+ zreladdr-y := 0x00008000
+params_phys-y := 0x00000100
+initrd_phys-y := 0x00800000
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/armctrl.c linux-xbian-rpi/arch/arm/mach-bcm2709/armctrl.c
---- linux-4.1.3/arch/arm/mach-bcm2709/armctrl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/armctrl.c 2015-07-28 01:20:58.170137709 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/armctrl.c linux-rpi/arch/arm/mach-bcm2709/armctrl.c
+--- linux-4.1.6/arch/arm/mach-bcm2709/armctrl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/armctrl.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,384 @@
+/*
+ * linux/arch/arm/mach-bcm2708/armctrl.c
@@ -13894,9 +14305,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/armctrl.c linux-xbian-rpi/arch/arm/m
+ armctrl_dt_init();
+ return 0;
+}
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/armctrl.h linux-xbian-rpi/arch/arm/mach-bcm2709/armctrl.h
---- linux-4.1.3/arch/arm/mach-bcm2709/armctrl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/armctrl.h 2015-07-28 01:20:58.174123488 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/armctrl.h linux-rpi/arch/arm/mach-bcm2709/armctrl.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/armctrl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/armctrl.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,27 @@
+/*
+ * linux/arch/arm/mach-bcm2708/armctrl.h
@@ -13925,9 +14336,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/armctrl.h linux-xbian-rpi/arch/arm/m
+ u32 armctrl_sources, u32 resume_sources);
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/bcm2708_gpio.c linux-xbian-rpi/arch/arm/mach-bcm2709/bcm2708_gpio.c
---- linux-4.1.3/arch/arm/mach-bcm2709/bcm2708_gpio.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/bcm2708_gpio.c 2015-07-28 01:20:58.174123488 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/bcm2708_gpio.c linux-rpi/arch/arm/mach-bcm2709/bcm2708_gpio.c
+--- linux-4.1.6/arch/arm/mach-bcm2709/bcm2708_gpio.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/bcm2708_gpio.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,426 @@
+/*
+ * linux/arch/arm/mach-bcm2708/bcm2708_gpio.c
@@ -14355,9 +14766,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/bcm2708_gpio.c linux-xbian-rpi/arch/
+
+MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/bcm2709.c linux-xbian-rpi/arch/arm/mach-bcm2709/bcm2709.c
---- linux-4.1.3/arch/arm/mach-bcm2709/bcm2709.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/bcm2709.c 2015-07-28 01:20:58.174123488 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/bcm2709.c linux-rpi/arch/arm/mach-bcm2709/bcm2709.c
+--- linux-4.1.6/arch/arm/mach-bcm2709/bcm2709.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/bcm2709.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,1332 @@
+/*
+ * linux/arch/arm/mach-bcm2709/bcm2709.c
@@ -15691,9 +16102,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/bcm2709.c linux-xbian-rpi/arch/arm/m
+MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral.");
+module_param(pps_gpio_pin, int, 0644);
+MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS");
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/bcm2709.h linux-xbian-rpi/arch/arm/mach-bcm2709/bcm2709.h
---- linux-4.1.3/arch/arm/mach-bcm2709/bcm2709.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/bcm2709.h 2015-07-28 01:20:58.174123488 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/bcm2709.h linux-rpi/arch/arm/mach-bcm2709/bcm2709.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/bcm2709.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/bcm2709.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,49 @@
+/*
+ * linux/arch/arm/mach-bcm2708/bcm2708.h
@@ -15744,9 +16155,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/bcm2709.h linux-xbian-rpi/arch/arm/m
+}
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/delay.S linux-xbian-rpi/arch/arm/mach-bcm2709/delay.S
---- linux-4.1.3/arch/arm/mach-bcm2709/delay.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/delay.S 2015-07-28 01:20:58.174123488 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/delay.S linux-rpi/arch/arm/mach-bcm2709/delay.S
+--- linux-4.1.6/arch/arm/mach-bcm2709/delay.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/delay.S 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,21 @@
+/*
+ * linux/arch/arm/lib/delay.S
@@ -15769,9 +16180,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/delay.S linux-xbian-rpi/arch/arm/mac
+ bhi bcm2708_delay
+ mov pc, lr
+ENDPROC(bcm2708_delay)
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/arm_control.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/arm_control.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/arm_control.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/arm_control.h 2015-07-28 01:20:58.174123488 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/arm_control.h linux-rpi/arch/arm/mach-bcm2709/include/mach/arm_control.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/arm_control.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/arm_control.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,493 @@
+/*
+ * linux/arch/arm/mach-bcm2708/arm_control.h
@@ -16266,16 +16677,16 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/arm_control.h linux-xbi
+#define ARM_LOCAL_MAILBOX3_CLR3 HW_REGISTER_RW(ARM_LOCAL_BASE+0x0FC)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/barriers.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/barriers.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/barriers.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/barriers.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/barriers.h linux-rpi/arch/arm/mach-bcm2709/include/mach/barriers.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/barriers.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/barriers.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,3 @@
+#define mb() dsb()
+#define rmb() dsb()
+#define wmb() mb()
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/clkdev.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/clkdev.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/clkdev.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/clkdev.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/clkdev.h linux-rpi/arch/arm/mach-bcm2709/include/mach/clkdev.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/clkdev.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/clkdev.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,7 @@
+#ifndef __ASM_MACH_CLKDEV_H
+#define __ASM_MACH_CLKDEV_H
@@ -16284,9 +16695,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/clkdev.h linux-xbian-rp
+#define __clk_put(clk) do { } while (0)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/debug-macro.S linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/debug-macro.S
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/debug-macro.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/debug-macro.S 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/debug-macro.S linux-rpi/arch/arm/mach-bcm2709/include/mach/debug-macro.S
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/debug-macro.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/debug-macro.S 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,22 @@
+/* arch/arm/mach-bcm2708/include/mach/debug-macro.S
+ *
@@ -16310,9 +16721,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/debug-macro.S linux-xbi
+ .endm
+
+#include <debug/pl01x.S>
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/entry-macro.S linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/entry-macro.S
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/entry-macro.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/entry-macro.S 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/entry-macro.S linux-rpi/arch/arm/mach-bcm2709/include/mach/entry-macro.S
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/entry-macro.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/entry-macro.S 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,120 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/entry-macro.S
@@ -16434,9 +16845,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/entry-macro.S linux-xbi
+ .macro arch_irq_handler_default
+1: get_irqnr_and_base r0, r2, r6, lr
+ .endm
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/frc.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/frc.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/frc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/frc.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/frc.h linux-rpi/arch/arm/mach-bcm2709/include/mach/frc.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/frc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/frc.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,38 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/timex.h
@@ -16476,9 +16887,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/frc.h linux-xbian-rpi/a
+extern unsigned long long frc_clock_ticks63(void);
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/gpio.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/gpio.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/gpio.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/gpio.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/gpio.h linux-rpi/arch/arm/mach-bcm2709/include/mach/gpio.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/gpio.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/gpio.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,17 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/gpio.h
@@ -16497,9 +16908,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/gpio.h linux-xbian-rpi/
+#define irq_to_gpio(x) ((x) - GPIO_IRQ_START)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/hardware.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/hardware.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/hardware.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/hardware.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/hardware.h linux-rpi/arch/arm/mach-bcm2709/include/mach/hardware.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/hardware.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/hardware.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,28 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/hardware.h
@@ -16529,9 +16940,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/hardware.h linux-xbian-
+#include <mach/platform.h>
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/io.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/io.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/io.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/io.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/io.h linux-rpi/arch/arm/mach-bcm2709/include/mach/io.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/io.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/io.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,27 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/io.h
@@ -16560,9 +16971,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/io.h linux-xbian-rpi/ar
+#define __io(a) __typesafe_io(a)
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/irqs.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/irqs.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/irqs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/irqs.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/irqs.h linux-rpi/arch/arm/mach-bcm2709/include/mach/irqs.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/irqs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/irqs.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,225 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/irqs.h
@@ -16789,9 +17200,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/irqs.h linux-xbian-rpi/
+#define NR_IRQS (BCM2708_ALLOC_IRQS+FREE_IRQS)
+
+#endif /* _BCM2708_IRQS_H_ */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/memory.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/memory.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/memory.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/memory.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/memory.h linux-rpi/arch/arm/mach-bcm2709/include/mach/memory.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/memory.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/memory.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,57 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/memory.h
@@ -16850,9 +17261,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/memory.h linux-xbian-rp
+#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - BCM_PLAT_PHYS_OFFSET))
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/platform.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/platform.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/platform.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/platform.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/platform.h linux-rpi/arch/arm/mach-bcm2709/include/mach/platform.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/platform.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/platform.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,227 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/platform.h
@@ -17081,9 +17492,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/platform.h linux-xbian-
+#endif
+
+/* END */
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/system.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/system.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/system.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/system.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/system.h linux-rpi/arch/arm/mach-bcm2709/include/mach/system.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/system.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/system.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,38 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/system.h
@@ -17123,9 +17534,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/system.h linux-xbian-rp
+}
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/timex.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/timex.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/timex.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/timex.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/timex.h linux-rpi/arch/arm/mach-bcm2709/include/mach/timex.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/timex.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/timex.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/timex.h
@@ -17150,9 +17561,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/timex.h linux-xbian-rpi
+ */
+
+#define CLOCK_TICK_RATE (1000000)
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/uncompress.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/uncompress.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/uncompress.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/uncompress.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/uncompress.h linux-rpi/arch/arm/mach-bcm2709/include/mach/uncompress.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/uncompress.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/uncompress.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,84 @@
+/*
+ * arch/arm/mach-bcn2708/include/mach/uncompress.h
@@ -17238,9 +17649,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/uncompress.h linux-xbia
+ * nothing to do
+ */
+#define arch_decomp_wdog()
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/vc_support.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/vc_support.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/vc_support.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/vc_support.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/vc_support.h linux-rpi/arch/arm/mach-bcm2709/include/mach/vc_support.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/vc_support.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/vc_support.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,69 @@
+#ifndef _VC_SUPPORT_H_
+#define _VC_SUPPORT_H_
@@ -17311,9 +17722,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/vc_support.h linux-xbia
+ unsigned int r0, unsigned int r1, unsigned int r2, unsigned int r3, unsigned int r4, unsigned int r5);
+
+#endif
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/vmalloc.h linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/vmalloc.h
---- linux-4.1.3/arch/arm/mach-bcm2709/include/mach/vmalloc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/include/mach/vmalloc.h 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/include/mach/vmalloc.h linux-rpi/arch/arm/mach-bcm2709/include/mach/vmalloc.h
+--- linux-4.1.6/arch/arm/mach-bcm2709/include/mach/vmalloc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/include/mach/vmalloc.h 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,20 @@
+/*
+ * arch/arm/mach-bcm2708/include/mach/vmalloc.h
@@ -17335,72 +17746,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/include/mach/vmalloc.h linux-xbian-r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#define VMALLOC_END (0xff000000)
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/Kconfig linux-xbian-rpi/arch/arm/mach-bcm2709/Kconfig
---- linux-4.1.3/arch/arm/mach-bcm2709/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/Kconfig 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,42 @@
-+menu "Broadcom BCM2709 Implementations"
-+ depends on ARCH_BCM2709
-+
-+config MACH_BCM2709
-+ bool "Broadcom BCM2709 Development Platform"
-+ help
-+ Include support for the Broadcom(R) BCM2709 platform.
-+
-+config BCM2709_DT
-+ bool "BCM2709 Device Tree support"
-+ depends on MACH_BCM2709
-+ default n
-+ select USE_OF
-+ select ARCH_REQUIRE_GPIOLIB
-+ select PINCTRL
-+ select PINCTRL_BCM2835
-+ help
-+ Enable Device Tree support for BCM2709
-+
-+config BCM2708_GPIO
-+ bool "BCM2709 gpio support"
-+ depends on MACH_BCM2709
-+ select ARCH_REQUIRE_GPIOLIB
-+ default y
-+ help
-+ Include support for the Broadcom(R) BCM2709 gpio.
-+
-+config BCM2708_NOL2CACHE
-+ bool "Videocore L2 cache disable"
-+ depends on MACH_BCM2709
-+ default y
-+ help
-+ Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt.
-+
-+config BCM2708_SPIDEV
-+ bool "Bind spidev to SPI0 master"
-+ depends on MACH_BCM2709
-+ depends on SPI
-+ default y
-+ help
-+ Binds spidev driver to the SPI0 master
-+endmenu
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/Makefile linux-xbian-rpi/arch/arm/mach-bcm2709/Makefile
---- linux-4.1.3/arch/arm/mach-bcm2709/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/Makefile 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,6 @@
-+#
-+# Makefile for the linux kernel.
-+#
-+
-+obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o
-+obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/Makefile.boot linux-xbian-rpi/arch/arm/mach-bcm2709/Makefile.boot
---- linux-4.1.3/arch/arm/mach-bcm2709/Makefile.boot 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/Makefile.boot 2015-07-28 01:20:58.170137709 +0200
-@@ -0,0 +1,3 @@
-+ zreladdr-y := 0x00008000
-+params_phys-y := 0x00000100
-+initrd_phys-y := 0x00800000
-diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/vc_support.c linux-xbian-rpi/arch/arm/mach-bcm2709/vc_support.c
---- linux-4.1.3/arch/arm/mach-bcm2709/vc_support.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/arch/arm/mach-bcm2709/vc_support.c 2015-07-28 01:20:58.182095047 +0200
+diff -Nur linux-4.1.6/arch/arm/mach-bcm2709/vc_support.c linux-rpi/arch/arm/mach-bcm2709/vc_support.c
+--- linux-4.1.6/arch/arm/mach-bcm2709/vc_support.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/arch/arm/mach-bcm2709/vc_support.c 2015-08-26 10:26:04.781260773 +0200
@@ -0,0 +1,318 @@
+/*
+ * vc_support.c
@@ -17720,21 +18068,9 @@ diff -Nur linux-4.1.3/arch/arm/mach-bcm2709/vc_support.c linux-xbian-rpi/arch/ar
+ return 1;
+ }
+}
-diff -Nur linux-4.1.3/arch/arm/Makefile linux-xbian-rpi/arch/arm/Makefile
---- linux-4.1.3/arch/arm/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/Makefile 2015-07-28 01:20:58.162166151 +0200
-@@ -142,6 +142,8 @@
-
- # Machine directory name. This list is sorted alphanumerically
- # by CONFIG_* macro name.
-+machine-$(CONFIG_ARCH_BCM2708) += bcm2708
-+machine-$(CONFIG_ARCH_BCM2709) += bcm2709
- machine-$(CONFIG_ARCH_ALPINE) += alpine
- machine-$(CONFIG_ARCH_AT91) += at91
- machine-$(CONFIG_ARCH_AXXIA) += axxia
-diff -Nur linux-4.1.3/arch/arm/mm/Kconfig linux-xbian-rpi/arch/arm/mm/Kconfig
---- linux-4.1.3/arch/arm/mm/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/mm/Kconfig 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/arch/arm/mm/Kconfig linux-rpi/arch/arm/mm/Kconfig
+--- linux-4.1.6/arch/arm/mm/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/mm/Kconfig 2015-08-26 10:26:04.889262296 +0200
@@ -358,7 +358,7 @@
# ARMv6
@@ -17744,9 +18080,9 @@ diff -Nur linux-4.1.3/arch/arm/mm/Kconfig linux-xbian-rpi/arch/arm/mm/Kconfig
select CPU_32v6
select CPU_ABRT_EV6
select CPU_CACHE_V6
-diff -Nur linux-4.1.3/arch/arm/mm/proc-v6.S linux-xbian-rpi/arch/arm/mm/proc-v6.S
---- linux-4.1.3/arch/arm/mm/proc-v6.S 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/mm/proc-v6.S 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/arch/arm/mm/proc-v6.S linux-rpi/arch/arm/mm/proc-v6.S
+--- linux-4.1.6/arch/arm/mm/proc-v6.S 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/mm/proc-v6.S 2015-08-26 10:26:04.893262353 +0200
@@ -73,10 +73,19 @@
*
* IRQs are already disabled.
@@ -17770,9 +18106,9 @@ diff -Nur linux-4.1.3/arch/arm/mm/proc-v6.S linux-xbian-rpi/arch/arm/mm/proc-v6.
ret lr
ENTRY(cpu_v6_dcache_clean_area)
-diff -Nur linux-4.1.3/arch/arm/mm/proc-v7.S linux-xbian-rpi/arch/arm/mm/proc-v7.S
---- linux-4.1.3/arch/arm/mm/proc-v7.S 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/mm/proc-v7.S 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/arch/arm/mm/proc-v7.S linux-rpi/arch/arm/mm/proc-v7.S
+--- linux-4.1.6/arch/arm/mm/proc-v7.S 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/mm/proc-v7.S 2015-08-26 10:26:04.893262353 +0200
@@ -456,6 +456,7 @@
orr r0, r0, r6 @ set them
THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions
@@ -17781,9 +18117,9 @@ diff -Nur linux-4.1.3/arch/arm/mm/proc-v7.S linux-xbian-rpi/arch/arm/mm/proc-v7.
ENDPROC(__v7_setup)
.align 2
-diff -Nur linux-4.1.3/arch/arm/tools/mach-types linux-xbian-rpi/arch/arm/tools/mach-types
---- linux-4.1.3/arch/arm/tools/mach-types 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/arch/arm/tools/mach-types 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/arch/arm/tools/mach-types linux-rpi/arch/arm/tools/mach-types
+--- linux-4.1.6/arch/arm/tools/mach-types 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/arch/arm/tools/mach-types 2015-08-26 10:26:04.905262521 +0200
@@ -522,6 +522,8 @@
prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103
paz00 MACH_PAZ00 PAZ00 3128
@@ -17793,142 +18129,30 @@ diff -Nur linux-4.1.3/arch/arm/tools/mach-types linux-xbian-rpi/arch/arm/tools/m
ag5evm MACH_AG5EVM AG5EVM 3189
ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206
wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207
-diff -Nur linux-4.1.3/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 linux-xbian-rpi/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00
---- linux-4.1.3/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 2015-07-28 01:20:58.162166151 +0200
-@@ -0,0 +1,6 @@
-+What: /sys/bus/w1/devices/.../w1_seq
-+Date: Apr 2015
-+Contact: Matt Campbell <mattrcampbell@gmail.com>
-+Description: Support for the DS28EA00 chain sequence function
-+ see Documentation/w1/slaves/w1_therm for detailed information
-+Users: any user space application which wants to communicate with DS28EA00
-diff -Nur linux-4.1.3/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt linux-xbian-rpi/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt
---- linux-4.1.3/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt 2015-07-28 01:20:58.162166151 +0200
-@@ -48,8 +48,8 @@
-
- bcm2835_i2s: i2s@7e203000 {
- compatible = "brcm,bcm2835-i2s";
-- reg = < 0x7e203000 0x20>,
-- < 0x7e101098 0x02>;
-+ reg = < 0x7e203000 0x24>,
-+ < 0x7e101098 0x08>;
-
- dmas = <&dma 2>,
- <&dma 3>;
-diff -Nur linux-4.1.3/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt linux-xbian-rpi/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt
---- linux-4.1.3/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt 2015-07-28 01:20:58.162166151 +0200
-@@ -16,8 +16,8 @@
+diff -Nur linux-4.1.6/drivers/char/Kconfig linux-rpi/drivers/char/Kconfig
+--- linux-4.1.6/drivers/char/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/char/Kconfig 2015-08-26 10:26:06.405283586 +0200
+@@ -590,6 +590,8 @@
- bcm2835_i2s: i2s@7e203000 {
- compatible = "brcm,bcm2835-i2s";
-- reg = <0x7e203000 0x20>,
-- <0x7e101098 0x02>;
-+ reg = <0x7e203000 0x24>,
-+ <0x7e101098 0x08>;
+ source "drivers/s390/char/Kconfig"
- dmas = <&dma 2>,
- <&dma 3>;
-diff -Nur linux-4.1.3/Documentation/video4linux/bcm2835-v4l2.txt linux-xbian-rpi/Documentation/video4linux/bcm2835-v4l2.txt
---- linux-4.1.3/Documentation/video4linux/bcm2835-v4l2.txt 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/Documentation/video4linux/bcm2835-v4l2.txt 2015-07-28 01:20:58.162166151 +0200
-@@ -0,0 +1,60 @@
-+
-+BCM2835 (aka Raspberry Pi) V4L2 driver
-+======================================
-+
-+1. Copyright
-+============
-+
-+Copyright © 2013 Raspberry Pi (Trading) Ltd.
-+
-+2. License
-+==========
-+
-+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., 675 Mass Ave, Cambridge, MA 02139, USA.
-+
-+3. Quick Start
-+==============
-+
-+You need a version 1.0 or later of v4l2-ctl, available from:
-+ git://git.linuxtv.org/v4l-utils.git
-+
-+$ sudo modprobe bcm2835-v4l2
-+
-+Turn on the overlay:
-+
-+$ v4l2-ctl --overlay=1
-+
-+Turn off the overlay:
-+
-+$ v4l2-ctl --overlay=0
-+
-+Set the capture format for video:
-+
-+$ v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4
-+
-+(Note: 1088 not 1080).
-+
-+Capture:
-+
-+$ v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.h264
-+
-+Stills capture:
-+
-+$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3
-+$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg
-+
-+List of available formats:
++source "drivers/char/broadcom/Kconfig"
+
-+$ v4l2-ctl --list-formats
-diff -Nur linux-4.1.3/Documentation/w1/slaves/w1_therm linux-xbian-rpi/Documentation/w1/slaves/w1_therm
---- linux-4.1.3/Documentation/w1/slaves/w1_therm 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/Documentation/w1/slaves/w1_therm 2015-07-28 01:20:58.162166151 +0200
-@@ -11,12 +11,14 @@
- Description
- -----------
-
--w1_therm provides basic temperature conversion for ds18*20 devices.
-+w1_therm provides basic temperature conversion for ds18*20 devices, and the
-+ds28ea00 device.
- supported family codes:
- W1_THERM_DS18S20 0x10
- W1_THERM_DS1822 0x22
- W1_THERM_DS18B20 0x28
- W1_THERM_DS1825 0x3B
-+W1_THERM_DS28EA00 0x42
+ config MSM_SMD_PKT
+ bool "Enable device interface for some SMD packet ports"
+ default n
+diff -Nur linux-4.1.6/drivers/char/Makefile linux-rpi/drivers/char/Makefile
+--- linux-4.1.6/drivers/char/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/char/Makefile 2015-08-26 10:26:06.405283586 +0200
+@@ -62,3 +62,4 @@
- Support is provided through the sysfs w1_slave file. Each open and
- read sequence will initiate a temperature conversion then provide two
-@@ -48,3 +50,10 @@
- maximum current draw of 1.5mA and that a 5k pullup resistor is not
- sufficient. The strong pullup is designed to provide the additional
- current required.
-+
-+The DS28EA00 provides an additional two pins for implementing a sequence
-+detection algorithm. This feature allows you to determine the physical
-+location of the chip in the 1-wire bus without needing pre-existing
-+knowledge of the bus ordering. Support is provided through the sysfs
-+w1_seq file. The file will contain a single line with an integer value
-+representing the device index in the bus starting at 0.
-diff -Nur linux-4.1.3/drivers/char/broadcom/Kconfig linux-xbian-rpi/drivers/char/broadcom/Kconfig
---- linux-4.1.3/drivers/char/broadcom/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/Kconfig 2015-07-28 01:20:58.186080826 +0200
-@@ -0,0 +1,40 @@
+ obj-$(CONFIG_TILE_SROM) += tile-srom.o
+ obj-$(CONFIG_XILLYBUS) += xillybus/
++obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/
+diff -Nur linux-4.1.6/drivers/char/broadcom/Kconfig linux-rpi/drivers/char/broadcom/Kconfig
+--- linux-4.1.6/drivers/char/broadcom/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/Kconfig 2015-08-26 10:26:06.405283586 +0200
+@@ -0,0 +1,49 @@
+#
+# Broadcom char driver config
+#
@@ -17969,17 +18193,298 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/Kconfig linux-xbian-rpi/drivers/char
+ help
+ Support for the VC shared memory on the Broadcom reference
+ design. Uses the VCHIQ stack.
-diff -Nur linux-4.1.3/drivers/char/broadcom/Makefile linux-xbian-rpi/drivers/char/broadcom/Makefile
---- linux-4.1.3/drivers/char/broadcom/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/Makefile 2015-07-28 01:20:58.186080826 +0200
-@@ -0,0 +1,4 @@
++
++config BCM2835_DEVGPIOMEM
++ tristate "/dev/gpiomem rootless GPIO access via mmap() on the BCM2835"
++ default m
++ help
++ Provides users with root-free access to the GPIO registers
++ on the 2835. Calling mmap(/dev/gpiomem) will map the GPIO
++ register page to the user's pointer.
++
+diff -Nur linux-4.1.6/drivers/char/broadcom/Makefile linux-rpi/drivers/char/broadcom/Makefile
+--- linux-4.1.6/drivers/char/broadcom/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/Makefile 2015-08-26 10:26:06.405283586 +0200
+@@ -0,0 +1,7 @@
+obj-$(CONFIG_BCM_VC_CMA) += vc_cma/
+obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o
+obj-$(CONFIG_BCM_VCIO) += vcio.o
+obj-$(CONFIG_BCM_VC_SM) += vc_sm/
-diff -Nur linux-4.1.3/drivers/char/broadcom/vc_cma/Makefile linux-xbian-rpi/drivers/char/broadcom/vc_cma/Makefile
---- linux-4.1.3/drivers/char/broadcom/vc_cma/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vc_cma/Makefile 2015-07-28 01:20:58.186080826 +0200
++
++obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o
++
+diff -Nur linux-4.1.6/drivers/char/broadcom/bcm2835-gpiomem.c linux-rpi/drivers/char/broadcom/bcm2835-gpiomem.c
+--- linux-4.1.6/drivers/char/broadcom/bcm2835-gpiomem.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/bcm2835-gpiomem.c 2015-08-26 10:26:06.405283586 +0200
+@@ -0,0 +1,265 @@
++/**
++ * GPIO memory device driver
++ *
++ * Creates a chardev /dev/gpiomem which will provide user access to
++ * the BCM2835's GPIO registers when it is mmap()'d.
++ * No longer need root for user GPIO access, but without relaxing permissions
++ * on /dev/mem.
++ *
++ * Written by Luke Wren <luke@raspberrypi.org>
++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions, and the following disclaimer,
++ * without modification.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The names of the above-listed copyright holders may not be used
++ * to endorse or promote products derived from this software without
++ * specific prior written permission.
++ *
++ * ALTERNATIVELY, this software may be distributed under the terms of the
++ * GNU General Public License ("GPL") version 2, as published by the Free
++ * Software Foundation.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
++ * CONTRIBUTORS 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.
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/platform_device.h>
++#include <linux/mm.h>
++#include <linux/slab.h>
++#include <linux/cdev.h>
++#include <linux/pagemap.h>
++#include <linux/io.h>
++
++#define DEVICE_NAME "bcm2835-gpiomem"
++#define DRIVER_NAME "gpiomem-bcm2835"
++#define DEVICE_MINOR 0
++
++struct bcm2835_gpiomem_instance {
++ unsigned long gpio_regs_phys;
++ struct device *dev;
++};
++
++static struct cdev bcm2835_gpiomem_cdev;
++static dev_t bcm2835_gpiomem_devid;
++static struct class *bcm2835_gpiomem_class;
++static struct device *bcm2835_gpiomem_dev;
++static struct bcm2835_gpiomem_instance *inst;
++
++
++/****************************************************************************
++*
++* GPIO mem chardev file ops
++*
++***************************************************************************/
++
++static int bcm2835_gpiomem_open(struct inode *inode, struct file *file)
++{
++ int dev = iminor(inode);
++ int ret = 0;
++
++ dev_info(inst->dev, "gpiomem device opened.");
++
++ if (dev != DEVICE_MINOR) {
++ dev_err(inst->dev, "Unknown minor device: %d", dev);
++ ret = -ENXIO;
++ }
++ return ret;
++}
++
++static int bcm2835_gpiomem_release(struct inode *inode, struct file *file)
++{
++ int dev = iminor(inode);
++ int ret = 0;
++
++ if (dev != DEVICE_MINOR) {
++ dev_err(inst->dev, "Unknown minor device %d", dev);
++ ret = -ENXIO;
++ }
++ return ret;
++}
++
++static const struct vm_operations_struct bcm2835_gpiomem_vm_ops = {
++#ifdef CONFIG_HAVE_IOREMAP_PROT
++ .access = generic_access_phys
++#endif
++};
++
++static int bcm2835_gpiomem_mmap(struct file *file, struct vm_area_struct *vma)
++{
++ /* Ignore what the user says - they're getting the GPIO regs
++ whether they like it or not! */
++ unsigned long gpio_page = inst->gpio_regs_phys >> PAGE_SHIFT;
++
++ vma->vm_page_prot = phys_mem_access_prot(file, gpio_page,
++ PAGE_SIZE,
++ vma->vm_page_prot);
++ vma->vm_ops = &bcm2835_gpiomem_vm_ops;
++ if (remap_pfn_range(vma, vma->vm_start,
++ gpio_page,
++ PAGE_SIZE,
++ vma->vm_page_prot)) {
++ return -EAGAIN;
++ }
++ return 0;
++}
++
++static const struct file_operations
++bcm2835_gpiomem_fops = {
++ .owner = THIS_MODULE,
++ .open = bcm2835_gpiomem_open,
++ .release = bcm2835_gpiomem_release,
++ .mmap = bcm2835_gpiomem_mmap,
++};
++
++
++ /****************************************************************************
++*
++* Probe and remove functions
++*
++***************************************************************************/
++
++
++static int bcm2835_gpiomem_probe(struct platform_device *pdev)
++{
++ int err;
++ void *ptr_err;
++ struct device *dev = &pdev->dev;
++ struct device_node *node = dev->of_node;
++ struct resource *ioresource;
++
++ /* Allocate buffers and instance data */
++
++ inst = kzalloc(sizeof(struct bcm2835_gpiomem_instance), GFP_KERNEL);
++
++ if (!inst) {
++ err = -ENOMEM;
++ goto failed_inst_alloc;
++ }
++
++ inst->dev = dev;
++
++ /* Create character device entries */
++
++ err = alloc_chrdev_region(&bcm2835_gpiomem_devid,
++ DEVICE_MINOR, 1, DEVICE_NAME);
++ if (err != 0) {
++ dev_err(inst->dev, "unable to allocate device number");
++ goto failed_alloc_chrdev;
++ }
++ cdev_init(&bcm2835_gpiomem_cdev, &bcm2835_gpiomem_fops);
++ bcm2835_gpiomem_cdev.owner = THIS_MODULE;
++ err = cdev_add(&bcm2835_gpiomem_cdev, bcm2835_gpiomem_devid, 1);
++ if (err != 0) {
++ dev_err(inst->dev, "unable to register device");
++ goto failed_cdev_add;
++ }
++
++ /* Create sysfs entries */
++
++ bcm2835_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME);
++ ptr_err = bcm2835_gpiomem_class;
++ if (IS_ERR(ptr_err))
++ goto failed_class_create;
++
++ bcm2835_gpiomem_dev = device_create(bcm2835_gpiomem_class, NULL,
++ bcm2835_gpiomem_devid, NULL,
++ "gpiomem");
++ ptr_err = bcm2835_gpiomem_dev;
++ if (IS_ERR(ptr_err))
++ goto failed_device_create;
++
++ /* Get address from device tree if available (*_resource() correctly
++ converts the bus address in device tree to a physical address),
++ or use hardcoded offset + BCM2708_PERI_BASE if not.
++ (In spite of its name 2708 actually seems to have the correct
++ mach-dependent value on 2709 etc, as it is defined in
++ mach-bcm270x/platform.h) */
++
++ if (node) {
++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ inst->gpio_regs_phys = ioresource->start;
++ } else {
++ inst->gpio_regs_phys = GPIO_BASE;
++ }
++
++ dev_info(inst->dev, "Initialised: Registers at 0x%08lx",
++ inst->gpio_regs_phys);
++
++ return 0;
++
++failed_device_create:
++ class_destroy(bcm2835_gpiomem_class);
++failed_class_create:
++ cdev_del(&bcm2835_gpiomem_cdev);
++ err = PTR_ERR(ptr_err);
++failed_cdev_add:
++ unregister_chrdev_region(bcm2835_gpiomem_devid, 1);
++failed_alloc_chrdev:
++ kfree(inst);
++failed_inst_alloc:
++ dev_err(inst->dev, "could not load bcm2835_gpiomem");
++ return err;
++}
++
++static int bcm2835_gpiomem_remove(struct platform_device *pdev)
++{
++ struct device *dev = inst->dev;
++
++ kfree(inst);
++ device_destroy(bcm2835_gpiomem_class, bcm2835_gpiomem_devid);
++ class_destroy(bcm2835_gpiomem_class);
++ cdev_del(&bcm2835_gpiomem_cdev);
++ unregister_chrdev_region(bcm2835_gpiomem_devid, 1);
++
++ dev_info(dev, "GPIO mem driver removed - OK");
++ return 0;
++}
++
++ /****************************************************************************
++*
++* Register the driver with device tree
++*
++***************************************************************************/
++
++static const struct of_device_id bcm2835_gpiomem_of_match[] = {
++ {.compatible = "brcm,bcm2835-gpiomem",},
++ { /* sentinel */ },
++};
++
++MODULE_DEVICE_TABLE(of, bcm2835_gpiomem_of_match);
++
++static struct platform_driver bcm2835_gpiomem_driver = {
++ .probe = bcm2835_gpiomem_probe,
++ .remove = bcm2835_gpiomem_remove,
++ .driver = {
++ .name = DRIVER_NAME,
++ .owner = THIS_MODULE,
++ .of_match_table = bcm2835_gpiomem_of_match,
++ },
++};
++
++module_platform_driver(bcm2835_gpiomem_driver);
++
++MODULE_ALIAS("platform:gpiomem-bcm2835");
++MODULE_LICENSE("GPL");
++MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace");
++MODULE_AUTHOR("Luke Wren <luke@raspberrypi.org>");
+diff -Nur linux-4.1.6/drivers/char/broadcom/vc_cma/Makefile linux-rpi/drivers/char/broadcom/vc_cma/Makefile
+--- linux-4.1.6/drivers/char/broadcom/vc_cma/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vc_cma/Makefile 2015-08-26 10:26:06.405283586 +0200
@@ -0,0 +1,14 @@
+ccflags-y += -Wall -Wstrict-prototypes -Wno-trigraphs
+ccflags-y += -Werror
@@ -17995,9 +18500,9 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_cma/Makefile linux-xbian-rpi/driv
+obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o
+
+vc-cma-objs := vc_cma.o
-diff -Nur linux-4.1.3/drivers/char/broadcom/vc_cma/vc_cma.c linux-xbian-rpi/drivers/char/broadcom/vc_cma/vc_cma.c
---- linux-4.1.3/drivers/char/broadcom/vc_cma/vc_cma.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vc_cma/vc_cma.c 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/drivers/char/broadcom/vc_cma/vc_cma.c linux-rpi/drivers/char/broadcom/vc_cma/vc_cma.c
+--- linux-4.1.6/drivers/char/broadcom/vc_cma/vc_cma.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vc_cma/vc_cma.c 2015-08-26 10:26:06.409283642 +0200
@@ -0,0 +1,1193 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -19192,189 +19697,10 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_cma/vc_cma.c linux-xbian-rpi/driv
+module_exit(vc_cma_exit);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Broadcom Corporation");
-diff -Nur linux-4.1.3/drivers/char/broadcom/vcio.c linux-xbian-rpi/drivers/char/broadcom/vcio.c
---- linux-4.1.3/drivers/char/broadcom/vcio.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vcio.c 2015-07-28 01:20:58.186080826 +0200
-@@ -0,0 +1,175 @@
-+/*
-+ * Copyright (C) 2010 Broadcom
-+ * Copyright (C) 2015 Noralf Trønnes
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+
-+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-+
-+#include <linux/cdev.h>
-+#include <linux/device.h>
-+#include <linux/fs.h>
-+#include <linux/init.h>
-+#include <linux/ioctl.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+#include <linux/uaccess.h>
-+#include <soc/bcm2835/raspberrypi-firmware.h>
-+
-+#define MBOX_CHAN_PROPERTY 8
-+
-+#define VCIO_IOC_MAGIC 100
-+#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *)
-+
-+static struct {
-+ dev_t devt;
-+ struct cdev cdev;
-+ struct class *class;
-+ struct rpi_firmware *fw;
-+} vcio;
-+
-+static int vcio_user_property_list(void *user)
-+{
-+ u32 *buf, size;
-+ int ret;
-+
-+ /* The first 32-bit is the size of the buffer */
-+ if (copy_from_user(&size, user, sizeof(size)))
-+ return -EFAULT;
-+
-+ buf = kmalloc(size, GFP_KERNEL);
-+ if (!buf)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(buf, user, size)) {
-+ kfree(buf);
-+ return -EFAULT;
-+ }
-+
-+ /* Strip off protocol encapsulation */
-+ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12);
-+ if (ret) {
-+ kfree(buf);
-+ return ret;
-+ }
-+
-+ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS;
-+ if (copy_to_user(user, buf, size))
-+ ret = -EFAULT;
-+
-+ kfree(buf);
-+
-+ return ret;
-+}
-+
-+static int vcio_device_open(struct inode *inode, struct file *file)
-+{
-+ try_module_get(THIS_MODULE);
-+
-+ return 0;
-+}
-+
-+static int vcio_device_release(struct inode *inode, struct file *file)
-+{
-+ module_put(THIS_MODULE);
-+
-+ return 0;
-+}
-+
-+static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num,
-+ unsigned long ioctl_param)
-+{
-+ switch (ioctl_num) {
-+ case IOCTL_MBOX_PROPERTY:
-+ return vcio_user_property_list((void *)ioctl_param);
-+ default:
-+ pr_err("unknown ioctl: %d\n", ioctl_num);
-+ return -EINVAL;
-+ }
-+}
-+
-+const struct file_operations vcio_fops = {
-+ .unlocked_ioctl = vcio_device_ioctl,
-+ .open = vcio_device_open,
-+ .release = vcio_device_release,
-+};
-+
-+static int __init vcio_init(void)
-+{
-+ struct device_node *np;
-+ static struct device *dev;
-+ int ret;
-+
-+ np = of_find_compatible_node(NULL, NULL,
-+ "raspberrypi,bcm2835-firmware");
-+/* Uncomment this when we only boot with Device Tree
-+ if (!of_device_is_available(np))
-+ return -ENODEV;
-+*/
-+ vcio.fw = rpi_firmware_get(np);
-+ if (!vcio.fw)
-+ return -ENODEV;
-+
-+ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio");
-+ if (ret) {
-+ pr_err("failed to allocate device number\n");
-+ return ret;
-+ }
-+
-+ cdev_init(&vcio.cdev, &vcio_fops);
-+ vcio.cdev.owner = THIS_MODULE;
-+ ret = cdev_add(&vcio.cdev, vcio.devt, 1);
-+ if (ret) {
-+ pr_err("failed to register device\n");
-+ goto err_unregister_chardev;
-+ }
-+
-+ /*
-+ * Create sysfs entries
-+ * 'bcm2708_vcio' is used for backwards compatibility so we don't break
-+ * userspace. Raspian has a udev rule that changes the permissions.
-+ */
-+ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio");
-+ if (IS_ERR(vcio.class)) {
-+ ret = PTR_ERR(vcio.class);
-+ pr_err("failed to create class\n");
-+ goto err_cdev_del;
-+ }
-+
-+ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio");
-+ if (IS_ERR(dev)) {
-+ ret = PTR_ERR(dev);
-+ pr_err("failed to create device\n");
-+ goto err_class_destroy;
-+ }
-+
-+ return 0;
-+
-+err_class_destroy:
-+ class_destroy(vcio.class);
-+err_cdev_del:
-+ cdev_del(&vcio.cdev);
-+err_unregister_chardev:
-+ unregister_chrdev_region(vcio.devt, 1);
-+
-+ return ret;
-+}
-+module_init(vcio_init);
-+
-+static void __exit vcio_exit(void)
-+{
-+ device_destroy(vcio.class, vcio.devt);
-+ class_destroy(vcio.class);
-+ cdev_del(&vcio.cdev);
-+ unregister_chrdev_region(vcio.devt, 1);
-+}
-+module_exit(vcio_exit);
-+
-+MODULE_AUTHOR("Gray Girling");
-+MODULE_AUTHOR("Noralf Trønnes");
-+MODULE_DESCRIPTION("Mailbox userspace access");
-+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/char/broadcom/vc_mem.c linux-xbian-rpi/drivers/char/broadcom/vc_mem.c
---- linux-4.1.3/drivers/char/broadcom/vc_mem.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vc_mem.c 2015-07-28 01:20:58.186080826 +0200
-@@ -0,0 +1,423 @@
+diff -Nur linux-4.1.6/drivers/char/broadcom/vc_mem.c linux-rpi/drivers/char/broadcom/vc_mem.c
+--- linux-4.1.6/drivers/char/broadcom/vc_mem.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vc_mem.c 2015-08-26 10:26:06.409283642 +0200
+@@ -0,0 +1,422 @@
+/*****************************************************************************
+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved.
+*
@@ -19399,7 +19725,6 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_mem.c linux-xbian-rpi/drivers/cha
+#include <linux/debugfs.h>
+#include <asm/uaccess.h>
+#include <linux/dma-mapping.h>
-+#include <linux/platform_data/mailbox-bcm2708.h>
+#include <linux/broadcom/vc_mem.h>
+
+#define DRIVER_NAME "vc-mem"
@@ -19798,9 +20123,9 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_mem.c linux-xbian-rpi/drivers/cha
+module_param(phys_addr, uint, 0644);
+module_param(mem_size, uint, 0644);
+module_param(mem_base, uint, 0644);
-diff -Nur linux-4.1.3/drivers/char/broadcom/vc_sm/Makefile linux-xbian-rpi/drivers/char/broadcom/vc_sm/Makefile
---- linux-4.1.3/drivers/char/broadcom/vc_sm/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vc_sm/Makefile 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/drivers/char/broadcom/vc_sm/Makefile linux-rpi/drivers/char/broadcom/vc_sm/Makefile
+--- linux-4.1.6/drivers/char/broadcom/vc_sm/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vc_sm/Makefile 2015-08-26 10:26:06.409283642 +0200
@@ -0,0 +1,21 @@
+EXTRA_CFLAGS += -Wall -Wstrict-prototypes -Wno-trigraphs -O2
+
@@ -19823,9 +20148,9 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_sm/Makefile linux-xbian-rpi/drive
+vc-sm-objs := \
+ vmcs_sm.o \
+ vc_vchi_sm.o
-diff -Nur linux-4.1.3/drivers/char/broadcom/vc_sm/vc_vchi_sm.c linux-xbian-rpi/drivers/char/broadcom/vc_sm/vc_vchi_sm.c
---- linux-4.1.3/drivers/char/broadcom/vc_sm/vc_vchi_sm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vc_sm/vc_vchi_sm.c 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/drivers/char/broadcom/vc_sm/vc_vchi_sm.c linux-rpi/drivers/char/broadcom/vc_sm/vc_vchi_sm.c
+--- linux-4.1.6/drivers/char/broadcom/vc_sm/vc_vchi_sm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vc_sm/vc_vchi_sm.c 2015-08-26 10:26:06.409283642 +0200
@@ -0,0 +1,492 @@
+/*****************************************************************************
+* Copyright 2011-2012 Broadcom Corporation. All rights reserved.
@@ -20319,9 +20644,9 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_sm/vc_vchi_sm.c linux-xbian-rpi/d
+ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN,
+ msg, sizeof(*msg), 0, 0, 0, 0);
+}
-diff -Nur linux-4.1.3/drivers/char/broadcom/vc_sm/vmcs_sm.c linux-xbian-rpi/drivers/char/broadcom/vc_sm/vmcs_sm.c
---- linux-4.1.3/drivers/char/broadcom/vc_sm/vmcs_sm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/broadcom/vc_sm/vmcs_sm.c 2015-07-28 01:20:58.186080826 +0200
+diff -Nur linux-4.1.6/drivers/char/broadcom/vc_sm/vmcs_sm.c linux-rpi/drivers/char/broadcom/vc_sm/vmcs_sm.c
+--- linux-4.1.6/drivers/char/broadcom/vc_sm/vmcs_sm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vc_sm/vmcs_sm.c 2015-08-26 10:26:06.409283642 +0200
@@ -0,0 +1,3211 @@
+/*****************************************************************************
+* Copyright 2011-2012 Broadcom Corporation. All rights reserved.
@@ -23534,428 +23859,229 @@ diff -Nur linux-4.1.3/drivers/char/broadcom/vc_sm/vmcs_sm.c linux-xbian-rpi/driv
+MODULE_AUTHOR("Broadcom");
+MODULE_DESCRIPTION("VideoCore SharedMemory Driver");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/drivers/char/frandom.c linux-xbian-rpi/drivers/char/frandom.c
---- linux-4.1.3/drivers/char/frandom.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/frandom.c 2015-07-27 23:13:03.986757999 +0200
-@@ -0,0 +1,415 @@
+diff -Nur linux-4.1.6/drivers/char/broadcom/vcio.c linux-rpi/drivers/char/broadcom/vcio.c
+--- linux-4.1.6/drivers/char/broadcom/vcio.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/broadcom/vcio.c 2015-08-26 10:26:06.409283642 +0200
+@@ -0,0 +1,175 @@
+/*
-+** frandom.c
-+** Fast pseudo-random generator
-+**
-+** (c) Copyright 2003-2011 Eli Billauer
-+** http://www.billauer.co.il
-+**
-+** This program is free software; you can redistribute it and/or modify
-+** it under the terms of the GNU General Public License as published by
-+** the Free Software Foundation; either version 2 of the License, or
-+** (at your option) any later version.
-+**
-+**
-+*/
-+
-+#include <linux/version.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
++ * Copyright (C) 2010 Broadcom
++ * Copyright (C) 2015 Noralf Trønnes
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ */
+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/fs.h>
-+#include <linux/errno.h>
-+#include <linux/types.h>
-+#include <linux/random.h>
++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
-+#include <asm/uaccess.h>
+#include <linux/cdev.h>
-+#include <linux/err.h>
+#include <linux/device.h>
++#include <linux/fs.h>
++#include <linux/init.h>
++#include <linux/ioctl.h>
++#include <linux/module.h>
++#include <linux/slab.h>
++#include <linux/uaccess.h>
++#include <soc/bcm2835/raspberrypi-firmware.h>
+
-+#define INTERNAL_SEED 0
-+#define EXTERNAL_SEED 1
-+
-+#define FRANDOM_MAJOR 235
-+#define FRANDOM_MINOR 11
-+#define ERANDOM_MINOR 12
-+
-+static struct file_operations frandom_fops; /* Values assigned below */
-+
-+static int erandom_seeded = 0; /* Internal flag */
-+
-+static int frandom_major = FRANDOM_MAJOR;
-+static int frandom_minor = FRANDOM_MINOR;
-+static int erandom_minor = ERANDOM_MINOR;
-+static int frandom_bufsize = 256;
-+static int frandom_chunklimit = 0; /* =0 means unlimited */
-+
-+static struct cdev frandom_cdev;
-+static struct cdev erandom_cdev;
-+static struct class *frandom_class;
-+struct device *frandom_device;
-+struct device *erandom_device;
-+
-+MODULE_DESCRIPTION("Fast pseudo-random number generator");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Eli Billauer");
-+module_param(frandom_major, int, 0);
-+module_param(frandom_minor, int, 0);
-+module_param(erandom_minor, int, 0);
-+module_param(frandom_bufsize, int, 0);
-+module_param(frandom_chunklimit, int, 0);
-+
-+MODULE_PARM_DESC(frandom_major,"Major number of /dev/frandom and /dev/erandom");
-+MODULE_PARM_DESC(frandom_minor,"Minor number of /dev/frandom");
-+MODULE_PARM_DESC(erandom_minor,"Minor number of /dev/erandom");
-+MODULE_PARM_DESC(frandom_bufsize,"Internal buffer size in bytes. Default is 256. Must be >= 256");
-+MODULE_PARM_DESC(frandom_chunklimit,"Limit for read() blocks size. 0 (default) is unlimited, otherwise must be >= 256");
-+
-+struct frandom_state
-+{
-+ struct semaphore sem; /* Semaphore on the state structure */
-+
-+ u8 S[256]; /* The state array */
-+ u8 i;
-+ u8 j;
-+
-+ char *buf;
-+};
-+
-+static struct frandom_state *erandom_state;
-+
-+static inline void swap_byte(u8 *a, u8 *b)
-+{
-+ u8 swapByte;
++#define MBOX_CHAN_PROPERTY 8
+
-+ swapByte = *a;
-+ *a = *b;
-+ *b = swapByte;
-+}
++#define VCIO_IOC_MAGIC 100
++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *)
+
-+static void init_rand_state(struct frandom_state *state, int seedflag);
++static struct {
++ dev_t devt;
++ struct cdev cdev;
++ struct class *class;
++ struct rpi_firmware *fw;
++} vcio;
+
-+void erandom_get_random_bytes(char *buf, size_t count)
++static int vcio_user_property_list(void *user)
+{
-+ struct frandom_state *state = erandom_state;
-+ int k;
-+
-+ unsigned int i;
-+ unsigned int j;
-+ u8 *S;
-+
-+ /* If we fail to get the semaphore, we revert to external random data.
-+ Since semaphore blocking is expected to be very rare, and interrupts
-+ during these rare and very short periods of time even less frequent,
-+ we take the better-safe-than-sorry approach, and fill the buffer
-+ some expensive random data, in case the caller wasn't aware of this
-+ possibility, and expects random data anyhow.
-+ */
-+
-+ if (down_interruptible(&state->sem)) {
-+ get_random_bytes(buf, count);
-+ return;
-+ }
-+
-+ /* We seed erandom as late as possible, hoping that the kernel's main
-+ RNG is already restored in the boot sequence (not critical, but
-+ better.
-+ */
++ u32 *buf, size;
++ int ret;
+
-+ if (!erandom_seeded) {
-+ erandom_seeded = 1;
-+ init_rand_state(state, EXTERNAL_SEED);
-+ printk(KERN_INFO "frandom: Seeded global generator now (used by erandom)\n");
-+ }
++ /* The first 32-bit is the size of the buffer */
++ if (copy_from_user(&size, user, sizeof(size)))
++ return -EFAULT;
+
-+ i = state->i;
-+ j = state->j;
-+ S = state->S;
++ buf = kmalloc(size, GFP_KERNEL);
++ if (!buf)
++ return -ENOMEM;
+
-+ for (k=0; k<count; k++) {
-+ i = (i + 1) & 0xff;
-+ j = (j + S[i]) & 0xff;
-+ swap_byte(&S[i], &S[j]);
-+ *buf++ = S[(S[i] + S[j]) & 0xff];
++ if (copy_from_user(buf, user, size)) {
++ kfree(buf);
++ return -EFAULT;
+ }
+
-+ state->i = i;
-+ state->j = j;
-+
-+ up(&state->sem);
-+}
-+
-+static void init_rand_state(struct frandom_state *state, int seedflag)
-+{
-+ unsigned int i, j, k;
-+ u8 *S;
-+ u8 *seed = state->buf;
-+
-+ if (seedflag == INTERNAL_SEED)
-+ erandom_get_random_bytes(seed, 256);
-+ else
-+ get_random_bytes(seed, 256);
-+
-+ S = state->S;
-+ for (i=0; i<256; i++)
-+ *S++=i;
-+
-+ j=0;
-+ S = state->S;
-+
-+ for (i=0; i<256; i++) {
-+ j = (j + S[i] + *seed++) & 0xff;
-+ swap_byte(&S[i], &S[j]);
++ /* Strip off protocol encapsulation */
++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12);
++ if (ret) {
++ kfree(buf);
++ return ret;
+ }
+
-+ /* It's considered good practice to discard the first 256 bytes
-+ generated. So we do it:
-+ */
++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS;
++ if (copy_to_user(user, buf, size))
++ ret = -EFAULT;
+
-+ i=0; j=0;
-+ for (k=0; k<256; k++) {
-+ i = (i + 1) & 0xff;
-+ j = (j + S[i]) & 0xff;
-+ swap_byte(&S[i], &S[j]);
-+ }
++ kfree(buf);
+
-+ state->i = i; /* Save state */
-+ state->j = j;
++ return ret;
+}
+
-+static int frandom_open(struct inode *inode, struct file *filp)
++static int vcio_device_open(struct inode *inode, struct file *file)
+{
++ try_module_get(THIS_MODULE);
+
-+ struct frandom_state *state;
-+
-+ int num = iminor(inode);
-+
-+ /* This should never happen, now when the minors are regsitered
-+ * explicitly
-+ */
-+ if ((num != frandom_minor) && (num != erandom_minor)) return -ENODEV;
-+
-+ state = kmalloc(sizeof(struct frandom_state), GFP_KERNEL);
-+ if (!state)
-+ return -ENOMEM;
-+
-+ state->buf = kmalloc(frandom_bufsize, GFP_KERNEL);
-+ if (!state->buf) {
-+ kfree(state);
-+ return -ENOMEM;
-+ }
-+
-+ sema_init(&state->sem, 1); /* Init semaphore as a mutex */
-+
-+ if (num == frandom_minor)
-+ init_rand_state(state, EXTERNAL_SEED);
-+ else
-+ init_rand_state(state, INTERNAL_SEED);
-+
-+ filp->private_data = state;
-+
-+ return 0; /* Success */
++ return 0;
+}
+
-+static int frandom_release(struct inode *inode, struct file *filp)
++static int vcio_device_release(struct inode *inode, struct file *file)
+{
-+
-+ struct frandom_state *state = filp->private_data;
-+
-+ kfree(state->buf);
-+ kfree(state);
++ module_put(THIS_MODULE);
+
+ return 0;
+}
+
-+static ssize_t frandom_read(struct file *filp, char *buf, size_t count,
-+ loff_t *f_pos)
++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num,
++ unsigned long ioctl_param)
+{
-+ struct frandom_state *state = filp->private_data;
-+ ssize_t ret;
-+ int dobytes, k;
-+ char *localbuf;
-+
-+ unsigned int i;
-+ unsigned int j;
-+ u8 *S;
-+
-+ if (down_interruptible(&state->sem))
-+ return -ERESTARTSYS;
-+
-+ if ((frandom_chunklimit > 0) && (count > frandom_chunklimit))
-+ count = frandom_chunklimit;
-+
-+ ret = count; /* It's either everything or an error... */
-+
-+ i = state->i;
-+ j = state->j;
-+ S = state->S;
-+
-+ while (count) {
-+ if (count > frandom_bufsize)
-+ dobytes = frandom_bufsize;
-+ else
-+ dobytes = count;
-+
-+ localbuf = state->buf;
-+
-+ for (k=0; k<dobytes; k++) {
-+ i = (i + 1) & 0xff;
-+ j = (j + S[i]) & 0xff;
-+ swap_byte(&S[i], &S[j]);
-+ *localbuf++ = S[(S[i] + S[j]) & 0xff];
-+ }
-+
-+ if (copy_to_user(buf, state->buf, dobytes)) {
-+ ret = -EFAULT;
-+ goto out;
-+ }
-+
-+ buf += dobytes;
-+ count -= dobytes;
++ switch (ioctl_num) {
++ case IOCTL_MBOX_PROPERTY:
++ return vcio_user_property_list((void *)ioctl_param);
++ default:
++ pr_err("unknown ioctl: %d\n", ioctl_num);
++ return -EINVAL;
+ }
-+
-+ out:
-+ state->i = i;
-+ state->j = j;
-+
-+ up(&state->sem);
-+ return ret;
+}
+
-+static struct file_operations frandom_fops = {
-+ read: frandom_read,
-+ open: frandom_open,
-+ release: frandom_release,
++const struct file_operations vcio_fops = {
++ .unlocked_ioctl = vcio_device_ioctl,
++ .open = vcio_device_open,
++ .release = vcio_device_release,
+};
+
-+static void frandom_cleanup_module(void) {
-+ unregister_chrdev_region(MKDEV(frandom_major, erandom_minor), 1);
-+ cdev_del(&erandom_cdev);
-+ device_destroy(frandom_class, MKDEV(frandom_major, erandom_minor));
-+
-+ unregister_chrdev_region(MKDEV(frandom_major, frandom_minor), 1);
-+ cdev_del(&frandom_cdev);
-+ device_destroy(frandom_class, MKDEV(frandom_major, frandom_minor));
-+ class_destroy(frandom_class);
-+
-+ kfree(erandom_state->buf);
-+ kfree(erandom_state);
-+}
-+
-+
-+static int frandom_init_module(void)
++static int __init vcio_init(void)
+{
-+ int result;
-+
-+ /* The buffer size MUST be at least 256 bytes, because we assume that
-+ minimal length in init_rand_state().
-+ */
-+ if (frandom_bufsize < 256) {
-+ printk(KERN_ERR "frandom: Refused to load because frandom_bufsize=%d < 256\n",frandom_bufsize);
-+ return -EINVAL;
-+ }
-+ if ((frandom_chunklimit != 0) && (frandom_chunklimit < 256)) {
-+ printk(KERN_ERR "frandom: Refused to load because frandom_chunklimit=%d < 256 and != 0\n",frandom_chunklimit);
-+ return -EINVAL;
-+ }
++ struct device_node *np;
++ static struct device *dev;
++ int ret;
+
-+ erandom_state = kmalloc(sizeof(struct frandom_state), GFP_KERNEL);
-+ if (!erandom_state)
-+ return -ENOMEM;
++ np = of_find_compatible_node(NULL, NULL,
++ "raspberrypi,bcm2835-firmware");
++/* Uncomment this when we only boot with Device Tree
++ if (!of_device_is_available(np))
++ return -ENODEV;
++*/
++ vcio.fw = rpi_firmware_get(np);
++ if (!vcio.fw)
++ return -ENODEV;
+
-+ /* This specific buffer is only used for seeding, so we need
-+ 256 bytes exactly */
-+ erandom_state->buf = kmalloc(256, GFP_KERNEL);
-+ if (!erandom_state->buf) {
-+ kfree(erandom_state);
-+ return -ENOMEM;
++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio");
++ if (ret) {
++ pr_err("failed to allocate device number\n");
++ return ret;
+ }
+
-+ sema_init(&erandom_state->sem, 1); /* Init semaphore as a mutex */
-+
-+ erandom_seeded = 0;
-+
-+ frandom_class = class_create(THIS_MODULE, "fastrng");
-+ if (IS_ERR(frandom_class)) {
-+ result = PTR_ERR(frandom_class);
-+ printk(KERN_WARNING "frandom: Failed to register class fastrng\n");
-+ goto error0;
++ cdev_init(&vcio.cdev, &vcio_fops);
++ vcio.cdev.owner = THIS_MODULE;
++ ret = cdev_add(&vcio.cdev, vcio.devt, 1);
++ if (ret) {
++ pr_err("failed to register device\n");
++ goto err_unregister_chardev;
+ }
+
+ /*
-+ * Register your major, and accept a dynamic number. This is the
-+ * first thing to do, in order to avoid releasing other module's
-+ * fops in frandom_cleanup_module()
++ * Create sysfs entries
++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break
++ * userspace. Raspian has a udev rule that changes the permissions.
+ */
-+
-+ cdev_init(&frandom_cdev, &frandom_fops);
-+ frandom_cdev.owner = THIS_MODULE;
-+ result = cdev_add(&frandom_cdev, MKDEV(frandom_major, frandom_minor), 1);
-+ if (result) {
-+ printk(KERN_WARNING "frandom: Failed to add cdev for /dev/frandom\n");
-+ goto error1;
-+ }
-+
-+ result = register_chrdev_region(MKDEV(frandom_major, frandom_minor), 1, "/dev/frandom");
-+ if (result < 0) {
-+ printk(KERN_WARNING "frandom: can't get major/minor %d/%d\n", frandom_major, frandom_minor);
-+ goto error2;
++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio");
++ if (IS_ERR(vcio.class)) {
++ ret = PTR_ERR(vcio.class);
++ pr_err("failed to create class\n");
++ goto err_cdev_del;
+ }
+
-+ frandom_device = device_create(frandom_class, NULL, MKDEV(frandom_major, frandom_minor), NULL, "frandom");
-+
-+ if (IS_ERR(frandom_device)) {
-+ printk(KERN_WARNING "frandom: Failed to create frandom device\n");
-+ goto error3;
++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio");
++ if (IS_ERR(dev)) {
++ ret = PTR_ERR(dev);
++ pr_err("failed to create device\n");
++ goto err_class_destroy;
+ }
+
-+ cdev_init(&erandom_cdev, &frandom_fops);
-+ erandom_cdev.owner = THIS_MODULE;
-+ result = cdev_add(&erandom_cdev, MKDEV(frandom_major, erandom_minor), 1);
-+ if (result) {
-+ printk(KERN_WARNING "frandom: Failed to add cdev for /dev/erandom\n");
-+ goto error4;
-+ }
++ return 0;
+
-+ result = register_chrdev_region(MKDEV(frandom_major, erandom_minor), 1, "/dev/erandom");
-+ if (result < 0) {
-+ printk(KERN_WARNING "frandom: can't get major/minor %d/%d\n", frandom_major, erandom_minor);
-+ goto error5;
-+ }
++err_class_destroy:
++ class_destroy(vcio.class);
++err_cdev_del:
++ cdev_del(&vcio.cdev);
++err_unregister_chardev:
++ unregister_chrdev_region(vcio.devt, 1);
+
-+ erandom_device = device_create(frandom_class, NULL, MKDEV(frandom_major, erandom_minor), NULL, "erandom");
++ return ret;
++}
++module_init(vcio_init);
+
-+ if (IS_ERR(erandom_device)) {
-+ printk(KERN_WARNING "frandom: Failed to create erandom device\n");
-+ goto error6;
-+ }
-+ return 0; /* succeed */
++static void __exit vcio_exit(void)
++{
++ device_destroy(vcio.class, vcio.devt);
++ class_destroy(vcio.class);
++ cdev_del(&vcio.cdev);
++ unregister_chrdev_region(vcio.devt, 1);
++}
++module_exit(vcio_exit);
+
-+ error6:
-+ unregister_chrdev_region(MKDEV(frandom_major, erandom_minor), 1);
-+ error5:
-+ cdev_del(&erandom_cdev);
-+ error4:
-+ device_destroy(frandom_class, MKDEV(frandom_major, frandom_minor));
-+ error3:
-+ unregister_chrdev_region(MKDEV(frandom_major, frandom_minor), 1);
-+ error2:
-+ cdev_del(&frandom_cdev);
-+ error1:
-+ class_destroy(frandom_class);
-+ error0:
-+ kfree(erandom_state->buf);
-+ kfree(erandom_state);
++MODULE_AUTHOR("Gray Girling");
++MODULE_AUTHOR("Noralf Trønnes");
++MODULE_DESCRIPTION("Mailbox userspace access");
++MODULE_LICENSE("GPL");
+diff -Nur linux-4.1.6/drivers/char/hw_random/Kconfig linux-rpi/drivers/char/hw_random/Kconfig
+--- linux-4.1.6/drivers/char/hw_random/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/char/hw_random/Kconfig 2015-08-26 10:26:06.409283642 +0200
+@@ -90,7 +90,7 @@
+
+ config HW_RANDOM_BCM2835
+ tristate "Broadcom BCM2835 Random Number Generator support"
+- depends on ARCH_BCM2835
++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
+ default HW_RANDOM
+ ---help---
+ This driver provides kernel-side support for the Random Number
+@@ -333,6 +333,17 @@
+
+ If unsure, say Y.
+
++config HW_RANDOM_BCM2708
++ tristate "BCM2708 generic true random number generator support"
++ depends on HW_RANDOM && (ARCH_BCM2708 || ARCH_BCM2709)
++ ---help---
++ This driver provides the kernel-side support for the BCM2708 hardware.
+
-+ return result;
-+}
++ To compile this driver as a module, choose M here: the
++ module will be called bcm2708-rng.
+
-+module_init(frandom_init_module);
-+module_exit(frandom_cleanup_module);
++ If unsure, say N.
+
-+EXPORT_SYMBOL(erandom_get_random_bytes);
-diff -Nur linux-4.1.3/drivers/char/hw_random/bcm2708-rng.c linux-xbian-rpi/drivers/char/hw_random/bcm2708-rng.c
---- linux-4.1.3/drivers/char/hw_random/bcm2708-rng.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/char/hw_random/bcm2708-rng.c 2015-07-28 01:20:58.186080826 +0200
+ config HW_RANDOM_MSM
+ tristate "Qualcomm SoCs Random Number Generator support"
+ depends on HW_RANDOM && ARCH_QCOM
+diff -Nur linux-4.1.6/drivers/char/hw_random/Makefile linux-rpi/drivers/char/hw_random/Makefile
+--- linux-4.1.6/drivers/char/hw_random/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/char/hw_random/Makefile 2015-08-26 10:26:06.409283642 +0200
+@@ -4,6 +4,7 @@
+
+ obj-$(CONFIG_HW_RANDOM) += rng-core.o
+ rng-core-y := core.o
++obj-$(CONFIG_HW_RANDOM_BCM2708) += bcm2708-rng.o
+ obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o
+ obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o
+ obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o
+diff -Nur linux-4.1.6/drivers/char/hw_random/bcm2708-rng.c linux-rpi/drivers/char/hw_random/bcm2708-rng.c
+--- linux-4.1.6/drivers/char/hw_random/bcm2708-rng.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/char/hw_random/bcm2708-rng.c 2015-08-26 10:26:06.409283642 +0200
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -24075,78 +24201,9 @@ diff -Nur linux-4.1.3/drivers/char/hw_random/bcm2708-rng.c linux-xbian-rpi/drive
+
+MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver");
+MODULE_LICENSE("GPL and additional rights");
-diff -Nur linux-4.1.3/drivers/char/hw_random/Kconfig linux-xbian-rpi/drivers/char/hw_random/Kconfig
---- linux-4.1.3/drivers/char/hw_random/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/char/hw_random/Kconfig 2015-07-28 01:20:58.186080826 +0200
-@@ -90,7 +90,7 @@
-
- config HW_RANDOM_BCM2835
- tristate "Broadcom BCM2835 Random Number Generator support"
-- depends on ARCH_BCM2835
-+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
- default HW_RANDOM
- ---help---
- This driver provides kernel-side support for the Random Number
-@@ -333,6 +333,17 @@
-
- If unsure, say Y.
-
-+config HW_RANDOM_BCM2708
-+ tristate "BCM2708 generic true random number generator support"
-+ depends on HW_RANDOM && (ARCH_BCM2708 || ARCH_BCM2709)
-+ ---help---
-+ This driver provides the kernel-side support for the BCM2708 hardware.
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called bcm2708-rng.
-+
-+ If unsure, say N.
-+
- config HW_RANDOM_MSM
- tristate "Qualcomm SoCs Random Number Generator support"
- depends on HW_RANDOM && ARCH_QCOM
-diff -Nur linux-4.1.3/drivers/char/hw_random/Makefile linux-xbian-rpi/drivers/char/hw_random/Makefile
---- linux-4.1.3/drivers/char/hw_random/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/char/hw_random/Makefile 2015-07-28 01:20:58.186080826 +0200
-@@ -4,6 +4,7 @@
-
- obj-$(CONFIG_HW_RANDOM) += rng-core.o
- rng-core-y := core.o
-+obj-$(CONFIG_HW_RANDOM_BCM2708) += bcm2708-rng.o
- obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o
- obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o
- obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o
-diff -Nur linux-4.1.3/drivers/char/Kconfig linux-xbian-rpi/drivers/char/Kconfig
---- linux-4.1.3/drivers/char/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/char/Kconfig 2015-07-28 01:20:58.186080826 +0200
-@@ -590,6 +590,8 @@
-
- source "drivers/s390/char/Kconfig"
-
-+source "drivers/char/broadcom/Kconfig"
-+
- config MSM_SMD_PKT
- bool "Enable device interface for some SMD packet ports"
- default n
-diff -Nur linux-4.1.3/drivers/char/Makefile linux-xbian-rpi/drivers/char/Makefile
---- linux-4.1.3/drivers/char/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/char/Makefile 2015-07-28 01:20:58.186080826 +0200
-@@ -2,6 +2,7 @@
- # Makefile for the kernel character device drivers.
- #
-
-+obj-m += frandom.o
- obj-y += mem.o random.o
- obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o
- obj-y += misc.o
-@@ -62,3 +63,4 @@
-
- obj-$(CONFIG_TILE_SROM) += tile-srom.o
- obj-$(CONFIG_XILLYBUS) += xillybus/
-+obj-$(CONFIG_BRCM_CHAR_DRIVERS) += broadcom/
-diff -Nur linux-4.1.3/drivers/clocksource/arm_arch_timer.c linux-xbian-rpi/drivers/clocksource/arm_arch_timer.c
---- linux-4.1.3/drivers/clocksource/arm_arch_timer.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/clocksource/arm_arch_timer.c 2015-07-28 01:20:58.190066605 +0200
+diff -Nur linux-4.1.6/drivers/clocksource/arm_arch_timer.c linux-rpi/drivers/clocksource/arm_arch_timer.c
+--- linux-4.1.6/drivers/clocksource/arm_arch_timer.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/clocksource/arm_arch_timer.c 2015-08-26 10:26:06.441284089 +0200
@@ -882,3 +882,39 @@
acpi_table_parse(ACPI_SIG_GTDT, arch_timer_acpi_init);
}
@@ -24187,9 +24244,39 @@ diff -Nur linux-4.1.3/drivers/clocksource/arm_arch_timer.c linux-xbian-rpi/drive
+ arch_timer_common_init();
+ return 0;
+}
-diff -Nur linux-4.1.3/drivers/cpufreq/bcm2835-cpufreq.c linux-xbian-rpi/drivers/cpufreq/bcm2835-cpufreq.c
---- linux-4.1.3/drivers/cpufreq/bcm2835-cpufreq.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/cpufreq/bcm2835-cpufreq.c 2015-07-28 01:20:58.190066605 +0200
+diff -Nur linux-4.1.6/drivers/cpufreq/Kconfig.arm linux-rpi/drivers/cpufreq/Kconfig.arm
+--- linux-4.1.6/drivers/cpufreq/Kconfig.arm 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/cpufreq/Kconfig.arm 2015-08-26 10:26:06.445284146 +0200
+@@ -258,6 +258,15 @@
+ help
+ This adds the CPUFreq driver support for SPEAr SOCs.
+
++config ARM_BCM2835_CPUFREQ
++ depends on RASPBERRYPI_FIRMWARE
++ bool "BCM2835 Driver"
++ default y
++ help
++ This adds the CPUFreq driver for BCM2835
++
++ If in doubt, say N.
++
+ config ARM_TEGRA_CPUFREQ
+ bool "TEGRA CPUFreq support"
+ depends on ARCH_TEGRA
+diff -Nur linux-4.1.6/drivers/cpufreq/Makefile linux-rpi/drivers/cpufreq/Makefile
+--- linux-4.1.6/drivers/cpufreq/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/cpufreq/Makefile 2015-08-26 10:26:06.445284146 +0200
+@@ -77,6 +77,7 @@
+ obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o
+ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o
+ obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o
++obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o
+ obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o
+ obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
+
+diff -Nur linux-4.1.6/drivers/cpufreq/bcm2835-cpufreq.c linux-rpi/drivers/cpufreq/bcm2835-cpufreq.c
+--- linux-4.1.6/drivers/cpufreq/bcm2835-cpufreq.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/cpufreq/bcm2835-cpufreq.c 2015-08-26 10:26:06.445284146 +0200
@@ -0,0 +1,213 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -24404,40 +24491,51 @@ diff -Nur linux-4.1.3/drivers/cpufreq/bcm2835-cpufreq.c linux-xbian-rpi/drivers/
+
+module_init(bcm2835_cpufreq_module_init);
+module_exit(bcm2835_cpufreq_module_exit);
-diff -Nur linux-4.1.3/drivers/cpufreq/Kconfig.arm linux-xbian-rpi/drivers/cpufreq/Kconfig.arm
---- linux-4.1.3/drivers/cpufreq/Kconfig.arm 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/cpufreq/Kconfig.arm 2015-07-28 01:20:58.190066605 +0200
-@@ -258,6 +258,15 @@
- help
- This adds the CPUFreq driver support for SPEAr SOCs.
+diff -Nur linux-4.1.6/drivers/dma/Kconfig linux-rpi/drivers/dma/Kconfig
+--- linux-4.1.6/drivers/dma/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/dma/Kconfig 2015-08-26 10:26:06.469284482 +0200
+@@ -337,6 +337,17 @@
+ select DMA_ENGINE
+ select DMA_VIRTUAL_CHANNELS
-+config ARM_BCM2835_CPUFREQ
-+ depends on BCM2708_MBOX
-+ bool "BCM2835 Driver"
++config DMA_BCM2708
++ tristate "BCM2708 DMA engine support"
++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
++ select DMA_ENGINE
++ select DMA_VIRTUAL_CHANNELS
++
++config DMA_BCM2708_LEGACY
++ bool "BCM2708 DMA legacy API support"
++ depends on DMA_BCM2708
+ default y
-+ help
-+ This adds the CPUFreq driver for BCM2835
+
-+ If in doubt, say N.
+ config TI_CPPI41
+ tristate "AM33xx CPPI41 DMA support"
+ depends on ARCH_OMAP
+@@ -385,7 +396,7 @@
+ select DMA_VIRTUAL_CHANNELS
+ help
+ Enable support for the MOXA ART SoC DMA controller.
+-
+
- config ARM_TEGRA_CPUFREQ
- bool "TEGRA CPUFreq support"
- depends on ARCH_TEGRA
-diff -Nur linux-4.1.3/drivers/cpufreq/Makefile linux-xbian-rpi/drivers/cpufreq/Makefile
---- linux-4.1.3/drivers/cpufreq/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/cpufreq/Makefile 2015-07-28 01:20:58.190066605 +0200
-@@ -77,6 +77,7 @@
- obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o
- obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o
- obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o
-+obj-$(CONFIG_ARM_BCM2835_CPUFREQ) += bcm2835-cpufreq.o
- obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o
- obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
-
-diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dma/bcm2708-dmaengine.c
---- linux-4.1.3/drivers/dma/bcm2708-dmaengine.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/dma/bcm2708-dmaengine.c 2015-07-28 01:20:58.194052384 +0200
-@@ -0,0 +1,1299 @@
+ config FSL_EDMA
+ tristate "Freescale eDMA engine support"
+ depends on OF
+diff -Nur linux-4.1.6/drivers/dma/Makefile linux-rpi/drivers/dma/Makefile
+--- linux-4.1.6/drivers/dma/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/dma/Makefile 2015-08-26 10:26:06.469284482 +0200
+@@ -39,6 +39,7 @@
+ obj-$(CONFIG_MMP_TDMA) += mmp_tdma.o
+ obj-$(CONFIG_DMA_OMAP) += omap-dma.o
+ obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o
++obj-$(CONFIG_DMA_BCM2708) += bcm2708-dmaengine.o
+ obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
+ obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
+ obj-$(CONFIG_DMA_JZ4780) += dma-jz4780.o
+diff -Nur linux-4.1.6/drivers/dma/bcm2708-dmaengine.c linux-rpi/drivers/dma/bcm2708-dmaengine.c
+--- linux-4.1.6/drivers/dma/bcm2708-dmaengine.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/dma/bcm2708-dmaengine.c 2015-08-26 10:26:06.473284538 +0200
+@@ -0,0 +1,1314 @@
+/*
+ * BCM2835 DMA engine support
+ *
@@ -24624,7 +24722,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+}
+
+static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman,
-+ unsigned preferred_feature_set)
++ unsigned required_feature_set)
+{
+ u32 chans;
+ int chan = 0;
@@ -24633,10 +24731,8 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ chans = dmaman->chan_available;
+ for (feature = 0; feature < BCM_DMA_FEATURE_COUNT; feature++)
+ /* select the subset of available channels with the desired
-+ feature so long as some of the candidate channels have that
-+ feature */
-+ if ((preferred_feature_set & (1 << feature)) &&
-+ (chans & dmaman->has_feature[feature]))
++ features */
++ if (required_feature_set & (1 << feature))
+ chans &= dmaman->has_feature[feature];
+
+ if (!chans)
@@ -24668,7 +24764,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+
+/* DMA Manager Monitor */
+
-+extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,
++extern int bcm_dma_chan_alloc(unsigned required_feature_set,
+ void __iomem **out_dma_base, int *out_dma_irq)
+{
+ struct vc_dmaman *dmaman = g_dmaman;
@@ -24680,7 +24776,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ return -ENODEV;
+
+ mutex_lock(&dmaman->lock);
-+ chan = vc_dmaman_chan_alloc(dmaman, preferred_feature_set);
++ chan = vc_dmaman_chan_alloc(dmaman, required_feature_set);
+ if (chan < 0)
+ goto out;
+
@@ -24882,6 +24978,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ return container_of(t, struct bcm2835_desc, vd.tx);
+}
+
++#if 0
+static void dma_dumpregs(struct bcm2835_chan *c)
+{
+ pr_debug("-------------DMA DUMPREGS-------------\n");
@@ -24897,6 +24994,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ readl(c->chan_base + BCM2835_DMA_NEXTCB));
+ pr_debug("--------------------------------------\n");
+}
++#endif
+
+static void bcm2835_dma_desc_free(struct virt_dma_desc *vd)
+{
@@ -25302,6 +25400,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ uint32_t len = sg_dma_len(sgent);
+
+ for (j = 0; j < len; j += max_size) {
++ u32 waits;
+ struct bcm2835_dma_cb *control_block =
+ &d->control_block_base[i+splitct];
+
@@ -25319,7 +25418,7 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ }
+
+ /* Common part */
-+ u32 waits = SDHCI_BCM_DMA_WAITS;
++ waits = SDHCI_BCM_DMA_WAITS;
+ if ((dma_debug >> 0) & 0x1f)
+ waits = (dma_debug >> 0) & 0x1f;
+ control_block->info |= BCM2835_DMA_WAITS(waits);
@@ -25514,6 +25613,14 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ int rc;
+ int i;
+ int irq;
++#ifdef CONFIG_DMA_BCM2708_LEGACY
++ static const u32 wanted_features[] = {
++ BCM_DMA_FEATURE_FAST,
++ BCM_DMA_FEATURE_NORMAL,
++ BCM_DMA_FEATURE_LITE
++ };
++ int j;
++#endif
+
+
+ if (!pdev->dev.dma_mask)
@@ -25560,20 +25667,24 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+
+ platform_set_drvdata(pdev, od);
+
-+ for (i = 0; i < 5; i++) {
++ for (i = 0, j = 0; j < ARRAY_SIZE(wanted_features);) {
++
+ void __iomem *chan_base;
+ int chan_id;
+
-+ chan_id = bcm_dma_chan_alloc(BCM_DMA_FEATURE_LITE,
-+ &chan_base,
-+ &irq);
++ chan_id = bcm_dma_chan_alloc(wanted_features[j],
++ &chan_base,
++ &irq);
+
-+ if (chan_id < 0)
-+ break;
++ if (chan_id < 0) {
++ j++;
++ continue;
++ }
+
+ rc = bcm2708_dma_chan_init(od, chan_base, chan_id, irq);
+ if (rc)
+ goto err_no_dma;
++ i++;
+ }
+
+ if (pdev->dev.of_node) {
@@ -25586,6 +25697,8 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+ }
+ }
+
++ dev_info(&pdev->dev, "Initialized %i DMA channels (+ 1 legacy)\n", i);
++
+#else
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+ if (rc)
@@ -25737,50 +25850,9 @@ diff -Nur linux-4.1.3/drivers/dma/bcm2708-dmaengine.c linux-xbian-rpi/drivers/dm
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_AUTHOR("Gellert Weisz <gellert@raspberrypi.org>");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/drivers/dma/Kconfig linux-xbian-rpi/drivers/dma/Kconfig
---- linux-4.1.3/drivers/dma/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/dma/Kconfig 2015-07-28 01:20:58.194052384 +0200
-@@ -337,6 +337,17 @@
- select DMA_ENGINE
- select DMA_VIRTUAL_CHANNELS
-
-+config DMA_BCM2708
-+ tristate "BCM2708 DMA engine support"
-+ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
-+ select DMA_ENGINE
-+ select DMA_VIRTUAL_CHANNELS
-+
-+config DMA_BCM2708_LEGACY
-+ bool "BCM2708 DMA legacy API support"
-+ depends on DMA_BCM2708
-+ default y
-+
- config TI_CPPI41
- tristate "AM33xx CPPI41 DMA support"
- depends on ARCH_OMAP
-@@ -385,7 +396,7 @@
- select DMA_VIRTUAL_CHANNELS
- help
- Enable support for the MOXA ART SoC DMA controller.
--
-+
- config FSL_EDMA
- tristate "Freescale eDMA engine support"
- depends on OF
-diff -Nur linux-4.1.3/drivers/dma/Makefile linux-xbian-rpi/drivers/dma/Makefile
---- linux-4.1.3/drivers/dma/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/dma/Makefile 2015-07-28 01:20:58.194052384 +0200
-@@ -39,6 +39,7 @@
- obj-$(CONFIG_MMP_TDMA) += mmp_tdma.o
- obj-$(CONFIG_DMA_OMAP) += omap-dma.o
- obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o
-+obj-$(CONFIG_DMA_BCM2708) += bcm2708-dmaengine.o
- obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
- obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
- obj-$(CONFIG_DMA_JZ4780) += dma-jz4780.o
-diff -Nur linux-4.1.3/drivers/firmware/Kconfig linux-xbian-rpi/drivers/firmware/Kconfig
---- linux-4.1.3/drivers/firmware/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/firmware/Kconfig 2015-07-28 01:20:58.194052384 +0200
+diff -Nur linux-4.1.6/drivers/firmware/Kconfig linux-rpi/drivers/firmware/Kconfig
+--- linux-4.1.6/drivers/firmware/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/firmware/Kconfig 2015-08-26 10:26:06.493284818 +0200
@@ -136,6 +136,13 @@
bool
depends on ARM || ARM64
@@ -25795,9 +25867,9 @@ diff -Nur linux-4.1.3/drivers/firmware/Kconfig linux-xbian-rpi/drivers/firmware/
source "drivers/firmware/google/Kconfig"
source "drivers/firmware/efi/Kconfig"
-diff -Nur linux-4.1.3/drivers/firmware/Makefile linux-xbian-rpi/drivers/firmware/Makefile
---- linux-4.1.3/drivers/firmware/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/firmware/Makefile 2015-07-28 01:20:58.194052384 +0200
+diff -Nur linux-4.1.6/drivers/firmware/Makefile linux-rpi/drivers/firmware/Makefile
+--- linux-4.1.6/drivers/firmware/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/firmware/Makefile 2015-08-26 10:26:06.493284818 +0200
@@ -13,6 +13,7 @@
obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
obj-$(CONFIG_QCOM_SCM) += qcom_scm.o
@@ -25806,10 +25878,10 @@ diff -Nur linux-4.1.3/drivers/firmware/Makefile linux-xbian-rpi/drivers/firmware
obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
obj-$(CONFIG_EFI) += efi/
-diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/firmware/raspberrypi.c
---- linux-4.1.3/drivers/firmware/raspberrypi.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/firmware/raspberrypi.c 2015-07-28 01:20:58.194052384 +0200
-@@ -0,0 +1,308 @@
+diff -Nur linux-4.1.6/drivers/firmware/raspberrypi.c linux-rpi/drivers/firmware/raspberrypi.c
+--- linux-4.1.6/drivers/firmware/raspberrypi.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/firmware/raspberrypi.c 2015-08-26 10:26:06.497284874 +0200
+@@ -0,0 +1,297 @@
+/*
+ * Defines interfaces for interacting wtih the Raspberry Pi firmware's
+ * property channel.
@@ -25831,7 +25903,6 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
+#define MBOX_CHAN(msg) ((msg) & 0xf)
+#define MBOX_DATA28(msg) ((msg) & ~0xf)
-+#define MBOX_CHAN_VCHIQ 3
+#define MBOX_CHAN_PROPERTY 8
+
+struct rpi_firmware {
@@ -25839,7 +25910,6 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+ struct mbox_chan *chan; /* The property channel. */
+ struct completion c;
+ u32 enabled;
-+ u32 received;
+};
+
+static struct platform_device *g_pdev;
@@ -25849,7 +25919,6 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+static void response_callback(struct mbox_client *cl, void *msg)
+{
+ struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl);
-+ fw->received = *(u32 *)msg;
+ complete(&fw->c);
+}
+
@@ -25857,7 +25926,7 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+ * Sends a request to the firmware through the BCM2835 mailbox driver,
+ * and synchronously waits for the reply.
+ */
-+int
++static int
+rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)
+{
+ u32 message = MBOX_MSG(chan, data);
@@ -25869,8 +25938,7 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+ reinit_completion(&fw->c);
+ ret = mbox_send_message(fw->chan, &message);
+ if (ret >= 0) {
-+ if (chan != MBOX_CHAN_VCHIQ)
-+ wait_for_completion(&fw->c);
++ wait_for_completion(&fw->c);
+ ret = 0;
+ } else {
+ dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret);
@@ -25879,13 +25947,6 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+
+ return ret;
+}
-+EXPORT_SYMBOL(rpi_firmware_transaction);
-+
-+u32 rpi_firmware_transaction_received(struct rpi_firmware *fw)
-+{
-+ return MBOX_DATA28(fw->received);
-+}
-+EXPORT_SYMBOL(rpi_firmware_transaction_received);
+
+/**
+ * rpi_firmware_property_list - Submit firmware property list
@@ -26118,9 +26179,9 @@ diff -Nur linux-4.1.3/drivers/firmware/raspberrypi.c linux-xbian-rpi/drivers/fir
+MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
+MODULE_DESCRIPTION("Raspberry Pi firmware driver");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/drivers/hid/usbhid/hid-core.c linux-xbian-rpi/drivers/hid/usbhid/hid-core.c
---- linux-4.1.3/drivers/hid/usbhid/hid-core.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/hid/usbhid/hid-core.c 2015-07-28 01:20:58.194052384 +0200
+diff -Nur linux-4.1.6/drivers/hid/usbhid/hid-core.c linux-rpi/drivers/hid/usbhid/hid-core.c
+--- linux-4.1.6/drivers/hid/usbhid/hid-core.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/hid/usbhid/hid-core.c 2015-08-26 10:26:06.661287169 +0200
@@ -49,7 +49,7 @@
* Module parameters.
*/
@@ -26145,9 +26206,59 @@ diff -Nur linux-4.1.3/drivers/hid/usbhid/hid-core.c linux-xbian-rpi/drivers/hid/
ret = -ENOMEM;
if (usb_endpoint_dir_in(endpoint)) {
-diff -Nur linux-4.1.3/drivers/i2c/busses/i2c-bcm2708.c linux-xbian-rpi/drivers/i2c/busses/i2c-bcm2708.c
---- linux-4.1.3/drivers/i2c/busses/i2c-bcm2708.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/i2c/busses/i2c-bcm2708.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/i2c/busses/Kconfig linux-rpi/drivers/i2c/busses/Kconfig
+--- linux-4.1.6/drivers/i2c/busses/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/i2c/busses/Kconfig 2015-08-26 10:26:06.689287562 +0200
+@@ -8,6 +8,25 @@
+ comment "PC SMBus host controller drivers"
+ depends on PCI
+
++config I2C_BCM2708
++ tristate "BCM2708 BSC"
++ depends on MACH_BCM2708 || MACH_BCM2709
++ help
++ Enabling this option will add BSC (Broadcom Serial Controller)
++ support for the BCM2708. BSC is a Broadcom proprietary bus compatible
++ with I2C/TWI/SMBus.
++
++config I2C_BCM2708_BAUDRATE
++ prompt "BCM2708 I2C baudrate"
++ depends on I2C_BCM2708
++ int
++ default 100000
++ help
++ Set the I2C baudrate. This will alter the default value. A
++ different baudrate can be set by using a module parameter as well. If
++ no parameter is provided when loading, this is the value that will be
++ used.
++
+ config I2C_ALI1535
+ tristate "ALI 1535"
+ depends on PCI
+@@ -362,7 +381,7 @@
+
+ config I2C_BCM2835
+ tristate "Broadcom BCM2835 I2C controller"
+- depends on ARCH_BCM2835
++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
+ help
+ If you say yes to this option, support will be included for the
+ BCM2835 I2C controller.
+diff -Nur linux-4.1.6/drivers/i2c/busses/Makefile linux-rpi/drivers/i2c/busses/Makefile
+--- linux-4.1.6/drivers/i2c/busses/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/i2c/busses/Makefile 2015-08-26 10:26:06.689287562 +0200
+@@ -2,6 +2,8 @@
+ # Makefile for the i2c bus drivers.
+ #
+
++obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o
++
+ # ACPI drivers
+ obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o
+
+diff -Nur linux-4.1.6/drivers/i2c/busses/i2c-bcm2708.c linux-rpi/drivers/i2c/busses/i2c-bcm2708.c
+--- linux-4.1.6/drivers/i2c/busses/i2c-bcm2708.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/i2c/busses/i2c-bcm2708.c 2015-08-26 10:26:06.689287562 +0200
@@ -0,0 +1,524 @@
+/*
+ * Driver for Broadcom BCM2708 BSC Controllers
@@ -26673,59 +26784,9 @@ diff -Nur linux-4.1.3/drivers/i2c/busses/i2c-bcm2708.c linux-xbian-rpi/drivers/i
+MODULE_AUTHOR("Chris Boot <bootc@bootc.net>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:" DRV_NAME);
-diff -Nur linux-4.1.3/drivers/i2c/busses/Kconfig linux-xbian-rpi/drivers/i2c/busses/Kconfig
---- linux-4.1.3/drivers/i2c/busses/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/i2c/busses/Kconfig 2015-07-28 01:20:58.198038163 +0200
-@@ -8,6 +8,25 @@
- comment "PC SMBus host controller drivers"
- depends on PCI
-
-+config I2C_BCM2708
-+ tristate "BCM2708 BSC"
-+ depends on MACH_BCM2708 || MACH_BCM2709
-+ help
-+ Enabling this option will add BSC (Broadcom Serial Controller)
-+ support for the BCM2708. BSC is a Broadcom proprietary bus compatible
-+ with I2C/TWI/SMBus.
-+
-+config I2C_BCM2708_BAUDRATE
-+ prompt "BCM2708 I2C baudrate"
-+ depends on I2C_BCM2708
-+ int
-+ default 100000
-+ help
-+ Set the I2C baudrate. This will alter the default value. A
-+ different baudrate can be set by using a module parameter as well. If
-+ no parameter is provided when loading, this is the value that will be
-+ used.
-+
- config I2C_ALI1535
- tristate "ALI 1535"
- depends on PCI
-@@ -362,7 +381,7 @@
-
- config I2C_BCM2835
- tristate "Broadcom BCM2835 I2C controller"
-- depends on ARCH_BCM2835
-+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
- help
- If you say yes to this option, support will be included for the
- BCM2835 I2C controller.
-diff -Nur linux-4.1.3/drivers/i2c/busses/Makefile linux-xbian-rpi/drivers/i2c/busses/Makefile
---- linux-4.1.3/drivers/i2c/busses/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/i2c/busses/Makefile 2015-07-28 01:20:58.198038163 +0200
-@@ -2,6 +2,8 @@
- # Makefile for the i2c bus drivers.
- #
-
-+obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o
-+
- # ACPI drivers
- obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o
-
-diff -Nur linux-4.1.3/drivers/input/joystick/Kconfig linux-xbian-rpi/drivers/input/joystick/Kconfig
---- linux-4.1.3/drivers/input/joystick/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/input/joystick/Kconfig 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/input/joystick/Kconfig linux-rpi/drivers/input/joystick/Kconfig
+--- linux-4.1.6/drivers/input/joystick/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/input/joystick/Kconfig 2015-08-26 10:26:07.769302643 +0200
@@ -329,4 +329,12 @@
To compile this as a module choose M here: the module will be called
maplecontrol.
@@ -26739,18 +26800,18 @@ diff -Nur linux-4.1.3/drivers/input/joystick/Kconfig linux-xbian-rpi/drivers/inp
+ This is the joystick driver for the Raspberry Pi Sense HAT
+
endif
-diff -Nur linux-4.1.3/drivers/input/joystick/Makefile linux-xbian-rpi/drivers/input/joystick/Makefile
---- linux-4.1.3/drivers/input/joystick/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/input/joystick/Makefile 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/input/joystick/Makefile linux-rpi/drivers/input/joystick/Makefile
+--- linux-4.1.6/drivers/input/joystick/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/input/joystick/Makefile 2015-08-26 10:26:07.769302643 +0200
@@ -32,4 +32,5 @@
obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o
obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o
obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o
+obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o
-diff -Nur linux-4.1.3/drivers/input/joystick/rpisense-js.c linux-xbian-rpi/drivers/input/joystick/rpisense-js.c
---- linux-4.1.3/drivers/input/joystick/rpisense-js.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/input/joystick/rpisense-js.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/input/joystick/rpisense-js.c linux-rpi/drivers/input/joystick/rpisense-js.c
+--- linux-4.1.6/drivers/input/joystick/rpisense-js.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/input/joystick/rpisense-js.c 2015-08-26 10:26:07.769302643 +0200
@@ -0,0 +1,153 @@
+/*
+ * Raspberry Pi Sense HAT joystick driver
@@ -26905,16 +26966,16 @@ diff -Nur linux-4.1.3/drivers/input/joystick/rpisense-js.c linux-xbian-rpi/drive
+MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver");
+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/input/touchscreen/Kconfig linux-xbian-rpi/drivers/input/touchscreen/Kconfig
---- linux-4.1.3/drivers/input/touchscreen/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/input/touchscreen/Kconfig 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/input/touchscreen/Kconfig linux-rpi/drivers/input/touchscreen/Kconfig
+--- linux-4.1.6/drivers/input/touchscreen/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/input/touchscreen/Kconfig 2015-08-26 10:26:07.789302922 +0200
@@ -583,6 +583,13 @@
To compile this driver as a module, choose M here: the
module will be called edt-ft5x06.
+config TOUCHSCREEN_RPI_FT5406
+ tristate "Raspberry Pi FT5406 driver"
-+ depends on ARCH_BCM2708 || ARCH_BCM2709
++ depends on RASPBERRYPI_FIRMWARE
+ help
+ Say Y here to enable the Raspberry Pi memory based FT5406 device
+
@@ -26922,9 +26983,9 @@ diff -Nur linux-4.1.3/drivers/input/touchscreen/Kconfig linux-xbian-rpi/drivers/
config TOUCHSCREEN_MIGOR
tristate "Renesas MIGO-R touchscreen"
depends on SH_MIGOR && I2C
-diff -Nur linux-4.1.3/drivers/input/touchscreen/Makefile linux-xbian-rpi/drivers/input/touchscreen/Makefile
---- linux-4.1.3/drivers/input/touchscreen/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/input/touchscreen/Makefile 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/input/touchscreen/Makefile linux-rpi/drivers/input/touchscreen/Makefile
+--- linux-4.1.6/drivers/input/touchscreen/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/input/touchscreen/Makefile 2015-08-26 10:26:07.789302922 +0200
@@ -29,6 +29,7 @@
obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o
obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
@@ -26933,9 +26994,9 @@ diff -Nur linux-4.1.3/drivers/input/touchscreen/Makefile linux-xbian-rpi/drivers
obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o
obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o
-diff -Nur linux-4.1.3/drivers/input/touchscreen/rpi-ft5406.c linux-xbian-rpi/drivers/input/touchscreen/rpi-ft5406.c
---- linux-4.1.3/drivers/input/touchscreen/rpi-ft5406.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/input/touchscreen/rpi-ft5406.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/input/touchscreen/rpi-ft5406.c linux-rpi/drivers/input/touchscreen/rpi-ft5406.c
+--- linux-4.1.6/drivers/input/touchscreen/rpi-ft5406.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/input/touchscreen/rpi-ft5406.c 2015-08-26 10:26:07.793302977 +0200
@@ -0,0 +1,246 @@
+/*
+ * Driver for memory based ft5406 touchscreen
@@ -27183,9 +27244,9 @@ diff -Nur linux-4.1.3/drivers/input/touchscreen/rpi-ft5406.c linux-xbian-rpi/dri
+MODULE_AUTHOR("Gordon Hollingworth");
+MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/irqchip/irq-bcm2835.c linux-xbian-rpi/drivers/irqchip/irq-bcm2835.c
---- linux-4.1.3/drivers/irqchip/irq-bcm2835.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/irqchip/irq-bcm2835.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/irqchip/irq-bcm2835.c linux-rpi/drivers/irqchip/irq-bcm2835.c
+--- linux-4.1.6/drivers/irqchip/irq-bcm2835.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/irqchip/irq-bcm2835.c 2015-08-26 10:26:07.805303145 +0200
@@ -56,7 +56,7 @@
#include "irqchip.h"
@@ -27284,9 +27345,9 @@ diff -Nur linux-4.1.3/drivers/irqchip/irq-bcm2835.c linux-xbian-rpi/drivers/irqc
return 0;
}
-diff -Nur linux-4.1.3/drivers/leds/leds-gpio.c linux-xbian-rpi/drivers/leds/leds-gpio.c
---- linux-4.1.3/drivers/leds/leds-gpio.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/leds/leds-gpio.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/leds/leds-gpio.c linux-rpi/drivers/leds/leds-gpio.c
+--- linux-4.1.6/drivers/leds/leds-gpio.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/leds/leds-gpio.c 2015-08-26 10:26:07.841303647 +0200
@@ -41,6 +41,13 @@
led_dat->platform_gpio_blink_set(led_dat->gpiod,
led_dat->new_level, NULL, NULL);
@@ -27333,9 +27394,9 @@ diff -Nur linux-4.1.3/drivers/leds/leds-gpio.c linux-xbian-rpi/drivers/leds/leds
if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP)
state = !!gpiod_get_value_cansleep(led_dat->gpiod);
else
-diff -Nur linux-4.1.3/drivers/leds/trigger/Kconfig linux-xbian-rpi/drivers/leds/trigger/Kconfig
---- linux-4.1.3/drivers/leds/trigger/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/leds/trigger/Kconfig 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/leds/trigger/Kconfig linux-rpi/drivers/leds/trigger/Kconfig
+--- linux-4.1.6/drivers/leds/trigger/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/leds/trigger/Kconfig 2015-08-26 10:26:07.845303703 +0200
@@ -108,4 +108,11 @@
This enables direct flash/torch on/off by the driver, kernel space.
If unsure, say Y.
@@ -27348,9 +27409,17 @@ diff -Nur linux-4.1.3/drivers/leds/trigger/Kconfig linux-xbian-rpi/drivers/leds/
+ If unsure, say Y.
+
endif # LEDS_TRIGGERS
-diff -Nur linux-4.1.3/drivers/leds/trigger/ledtrig-input.c linux-xbian-rpi/drivers/leds/trigger/ledtrig-input.c
---- linux-4.1.3/drivers/leds/trigger/ledtrig-input.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/leds/trigger/ledtrig-input.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/leds/trigger/Makefile linux-rpi/drivers/leds/trigger/Makefile
+--- linux-4.1.6/drivers/leds/trigger/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/leds/trigger/Makefile 2015-08-26 10:26:07.845303703 +0200
+@@ -8,3 +8,4 @@
+ obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
+ obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
+ obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o
++obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o
+diff -Nur linux-4.1.6/drivers/leds/trigger/ledtrig-input.c linux-rpi/drivers/leds/trigger/ledtrig-input.c
+--- linux-4.1.6/drivers/leds/trigger/ledtrig-input.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/leds/trigger/ledtrig-input.c 2015-08-26 10:26:07.845303703 +0200
@@ -0,0 +1,54 @@
+/*
+ * Set LED GPIO to Input "Trigger"
@@ -27406,107 +27475,35 @@ diff -Nur linux-4.1.3/drivers/leds/trigger/ledtrig-input.c linux-xbian-rpi/drive
+MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.org>");
+MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\"");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/leds/trigger/Makefile linux-xbian-rpi/drivers/leds/trigger/Makefile
---- linux-4.1.3/drivers/leds/trigger/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/leds/trigger/Makefile 2015-07-28 01:20:58.198038163 +0200
-@@ -8,3 +8,4 @@
- obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
- obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
- obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o
-+obj-$(CONFIG_LEDS_TRIGGER_INPUT) += ledtrig-input.o
-diff -Nur linux-4.1.3/drivers/mailbox/bcm2708-vcio.c linux-xbian-rpi/drivers/mailbox/bcm2708-vcio.c
---- linux-4.1.3/drivers/mailbox/bcm2708-vcio.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/mailbox/bcm2708-vcio.c 2015-07-28 01:20:58.198038163 +0200
-@@ -0,0 +1,86 @@
-+/*
-+ * Copyright (C) 2010 Broadcom
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ * This device provides a shared mechanism for writing to the mailboxes,
-+ * semaphores, doorbells etc. that are shared between the ARM and the
-+ * VideoCore processor
-+ */
-+
-+#include <linux/dma-mapping.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/platform_data/mailbox-bcm2708.h>
-+#include <linux/uaccess.h>
-+#include <soc/bcm2835/raspberrypi-firmware.h>
-+
-+#define DRIVER_NAME "bcm2708_vcio"
-+
-+extern int bcm_mailbox_write(unsigned chan, uint32_t data28)
-+{
-+ struct rpi_firmware *fw = rpi_firmware_get(NULL);
-+
-+ if (!fw)
-+ return -ENODEV;
-+
-+ return rpi_firmware_transaction(fw, chan, data28);
-+}
-+EXPORT_SYMBOL_GPL(bcm_mailbox_write);
-+
-+extern int bcm_mailbox_read(unsigned chan, uint32_t *data28)
-+{
-+ struct rpi_firmware *fw = rpi_firmware_get(NULL);
-+
-+ if (!fw)
-+ return -ENODEV;
-+
-+ *data28 = rpi_firmware_transaction_received(fw);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(bcm_mailbox_read);
-+
-+static DEFINE_MUTEX(mailbox_lock);
-+extern int bcm_mailbox_property(void *data, int size)
-+{
-+ uint32_t success;
-+ dma_addr_t mem_bus; /* the memory address accessed from videocore */
-+ void *mem_kern; /* the memory address accessed from driver */
-+ int s = 0;
-+
-+ mutex_lock(&mailbox_lock);
-+ /* allocate some memory for the messages communicating with GPU */
-+ mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus,
-+ GFP_KERNEL);
-+ if (mem_kern) {
-+ /* create the message */
-+ memcpy(mem_kern, data, size);
+diff -Nur linux-4.1.6/drivers/mailbox/Kconfig linux-rpi/drivers/mailbox/Kconfig
+--- linux-4.1.6/drivers/mailbox/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mailbox/Kconfig 2015-08-26 10:26:07.849303759 +0200
+@@ -60,4 +60,13 @@
+ An implementation of the Altera Mailbox soft core. It is used
+ to send message between processors. Say Y here if you want to use the
+ Altera mailbox support.
+
-+ /* send the message */
-+ wmb();
-+ s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus);
-+ if (s == 0)
-+ s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success);
-+ if (s == 0) {
-+ /* copy the response */
-+ rmb();
-+ memcpy(data, mem_kern, size);
-+ }
-+ dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus);
-+ } else {
-+ s = -ENOMEM;
-+ }
-+ if (s != 0)
-+ pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s);
++config BCM2835_MBOX
++ tristate "BCM2835 Mailbox"
++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
++ help
++ An implementation of the BCM2385 Mailbox. It is used to invoke
++ the services of the Videocore. Say Y here if you want to use the
++ BCM2835 Mailbox.
+
-+ mutex_unlock(&mailbox_lock);
-+ return s;
-+}
-+EXPORT_SYMBOL_GPL(bcm_mailbox_property);
+ endif
+diff -Nur linux-4.1.6/drivers/mailbox/Makefile linux-rpi/drivers/mailbox/Makefile
+--- linux-4.1.6/drivers/mailbox/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mailbox/Makefile 2015-08-26 10:26:07.849303759 +0200
+@@ -11,3 +11,5 @@
+ obj-$(CONFIG_PCC) += pcc.o
+
+ obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o
+
-+MODULE_AUTHOR("Gray Girling");
-+MODULE_DESCRIPTION("ARM I/O to VideoCore processor");
-+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/mailbox/bcm2835-mailbox.c linux-xbian-rpi/drivers/mailbox/bcm2835-mailbox.c
---- linux-4.1.3/drivers/mailbox/bcm2835-mailbox.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/mailbox/bcm2835-mailbox.c 2015-07-28 01:20:58.198038163 +0200
++obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o
+diff -Nur linux-4.1.6/drivers/mailbox/bcm2835-mailbox.c linux-rpi/drivers/mailbox/bcm2835-mailbox.c
+--- linux-4.1.6/drivers/mailbox/bcm2835-mailbox.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/mailbox/bcm2835-mailbox.c 2015-08-26 10:26:07.849303759 +0200
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2010,2015 Broadcom
@@ -27739,39 +27736,9 @@ diff -Nur linux-4.1.3/drivers/mailbox/bcm2835-mailbox.c linux-xbian-rpi/drivers/
+MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>");
+MODULE_DESCRIPTION("BCM2835 mailbox IPC driver");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/drivers/mailbox/Kconfig linux-xbian-rpi/drivers/mailbox/Kconfig
---- linux-4.1.3/drivers/mailbox/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mailbox/Kconfig 2015-07-28 01:20:58.198038163 +0200
-@@ -7,6 +7,12 @@
-
- if MAILBOX
-
-+config BCM2708_MBOX
-+ bool "Broadcom BCM2708 Mailbox (vcio)"
-+ depends on BCM2835_MBOX
-+ help
-+ Broadcom BCM2708 Mailbox (vcio)
-+
- config ARM_MHU
- tristate "ARM MHU Mailbox"
- depends on ARM_AMBA
-@@ -60,4 +66,13 @@
- An implementation of the Altera Mailbox soft core. It is used
- to send message between processors. Say Y here if you want to use the
- Altera mailbox support.
-+
-+config BCM2835_MBOX
-+ tristate "BCM2835 Mailbox"
-+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
-+ help
-+ An implementation of the BCM2385 Mailbox. It is used to invoke
-+ the services of the Videocore. Say Y here if you want to use the
-+ BCM2835 Mailbox.
-+
- endif
-diff -Nur linux-4.1.3/drivers/mailbox/mailbox.c linux-xbian-rpi/drivers/mailbox/mailbox.c
---- linux-4.1.3/drivers/mailbox/mailbox.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mailbox/mailbox.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/mailbox/mailbox.c linux-rpi/drivers/mailbox/mailbox.c
+--- linux-4.1.6/drivers/mailbox/mailbox.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mailbox/mailbox.c 2015-08-26 10:26:07.853303814 +0200
@@ -304,13 +304,23 @@
unsigned long flags;
int ret;
@@ -27805,28 +27772,72 @@ diff -Nur linux-4.1.3/drivers/mailbox/mailbox.c linux-xbian-rpi/drivers/mailbox/
if (!chan || chan->cl || !try_module_get(mbox->dev->driver->owner)) {
dev_dbg(dev, "%s: mailbox not free\n", __func__);
mutex_unlock(&con_mutex);
-diff -Nur linux-4.1.3/drivers/mailbox/Makefile linux-xbian-rpi/drivers/mailbox/Makefile
---- linux-4.1.3/drivers/mailbox/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mailbox/Makefile 2015-07-28 01:20:58.198038163 +0200
-@@ -2,6 +2,8 @@
+diff -Nur linux-4.1.6/drivers/media/platform/Kconfig linux-rpi/drivers/media/platform/Kconfig
+--- linux-4.1.6/drivers/media/platform/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/media/platform/Kconfig 2015-08-26 10:26:08.025306213 +0200
+@@ -11,6 +11,8 @@
- obj-$(CONFIG_MAILBOX) += mailbox.o
+ if V4L_PLATFORM_DRIVERS
-+obj-$(CONFIG_BCM2708_MBOX) += bcm2708-vcio.o
++source "drivers/media/platform/bcm2835/Kconfig"
+
- obj-$(CONFIG_ARM_MHU) += arm_mhu.o
+ source "drivers/media/platform/marvell-ccic/Kconfig"
- obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o
-@@ -11,3 +13,5 @@
- obj-$(CONFIG_PCC) += pcc.o
+ config VIDEO_VIA_CAMERA
+diff -Nur linux-4.1.6/drivers/media/platform/Makefile linux-rpi/drivers/media/platform/Makefile
+--- linux-4.1.6/drivers/media/platform/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/media/platform/Makefile 2015-08-26 10:26:08.025306213 +0200
+@@ -2,6 +2,8 @@
+ # Makefile for the video capture/playback device drivers.
+ #
- obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o
++obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/
+
-+obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbian-rpi/drivers/media/platform/bcm2835/bcm2835-camera.c
---- linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/bcm2835-camera.c 2015-07-28 01:20:58.198038163 +0200
-@@ -0,0 +1,1828 @@
+ obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o
+ obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o
+
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/Kconfig linux-rpi/drivers/media/platform/bcm2835/Kconfig
+--- linux-4.1.6/drivers/media/platform/bcm2835/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/Kconfig 2015-08-26 10:26:08.025306213 +0200
+@@ -0,0 +1,25 @@
++# Broadcom VideoCore IV v4l2 camera support
++
++config VIDEO_BCM2835
++ bool "Broadcom BCM2835 camera interface driver"
++ depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835)
++ ---help---
++ Say Y here to enable camera host interface devices for
++ Broadcom BCM2835 SoC. This operates over the VCHIQ interface
++ to a service running on VideoCore.
++
++
++if VIDEO_BCM2835
++
++config VIDEO_BCM2835_MMAL
++ tristate "Broadcom BM2835 MMAL camera interface driver"
++ depends on BCM2708_VCHIQ
++ select VIDEOBUF2_VMALLOC
++ ---help---
++ This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface
++
++ To compile this driver as a module, choose M here: the
++ module will be called bcm2835-v4l2.o
++
++
++endif # VIDEO_BM2835
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/Makefile linux-rpi/drivers/media/platform/bcm2835/Makefile
+--- linux-4.1.6/drivers/media/platform/bcm2835/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/Makefile 2015-08-26 10:26:08.025306213 +0200
+@@ -0,0 +1,5 @@
++bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o
++
++obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o
++
++ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/bcm2835-camera.c linux-rpi/drivers/media/platform/bcm2835/bcm2835-camera.c
+--- linux-4.1.6/drivers/media/platform/bcm2835/bcm2835-camera.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/bcm2835-camera.c 2015-08-26 10:26:08.025306213 +0200
+@@ -0,0 +1,1842 @@
+/*
+ * Broadcom BM2835 V4L2 driver
+ *
@@ -27917,12 +27928,13 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+/* video formats */
+static struct mmal_fmt formats[] = {
+ {
-+ .name = "4:2:0, packed YUV",
++ .name = "4:2:0, planar, YUV",
+ .fourcc = V4L2_PIX_FMT_YUV420,
+ .flags = 0,
+ .mmal = MMAL_ENCODING_I420,
+ .depth = 12,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 1,
+ },
+ {
+ .name = "4:2:2, packed, YUYV",
@@ -27931,6 +27943,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_YUYV,
+ .depth = 16,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 2,
+ },
+ {
+ .name = "RGB24 (LE)",
@@ -27939,6 +27952,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_BGR24,
+ .depth = 24,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 3,
+ },
+ {
+ .name = "JPEG",
@@ -27947,6 +27961,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_JPEG,
+ .depth = 8,
+ .mmal_component = MMAL_COMPONENT_IMAGE_ENCODE,
++ .ybbp = 0,
+ },
+ {
+ .name = "H264",
@@ -27955,6 +27970,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_H264,
+ .depth = 8,
+ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE,
++ .ybbp = 0,
+ },
+ {
+ .name = "MJPEG",
@@ -27963,6 +27979,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_MJPEG,
+ .depth = 8,
+ .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE,
++ .ybbp = 0,
+ },
+ {
+ .name = "4:2:2, packed, YVYU",
@@ -27971,6 +27988,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_YVYU,
+ .depth = 16,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 2,
+ },
+ {
+ .name = "4:2:2, packed, VYUY",
@@ -27979,6 +27997,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_VYUY,
+ .depth = 16,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 2,
+ },
+ {
+ .name = "4:2:2, packed, UYVY",
@@ -27987,14 +28006,16 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_UYVY,
+ .depth = 16,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 2,
+ },
+ {
-+ .name = "4:2:0, packed, NV12",
++ .name = "4:2:0, planar, NV12",
+ .fourcc = V4L2_PIX_FMT_NV12,
+ .flags = 0,
+ .mmal = MMAL_ENCODING_NV12,
+ .depth = 12,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 1,
+ },
+ {
+ .name = "RGB24 (BE)",
@@ -28003,22 +28024,25 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_RGB24,
+ .depth = 24,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 3,
+ },
+ {
-+ .name = "4:2:0, packed YVU",
++ .name = "4:2:0, planar, YVU",
+ .fourcc = V4L2_PIX_FMT_YVU420,
+ .flags = 0,
+ .mmal = MMAL_ENCODING_YV12,
+ .depth = 12,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 1,
+ },
+ {
-+ .name = "4:2:0, packed, NV21",
++ .name = "4:2:0, planar, NV21",
+ .fourcc = V4L2_PIX_FMT_NV21,
+ .flags = 0,
+ .mmal = MMAL_ENCODING_NV21,
+ .depth = 12,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 1,
+ },
+ {
+ .name = "RGB32 (BE)",
@@ -28027,6 +28051,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ .mmal = MMAL_ENCODING_BGRA,
+ .depth = 32,
+ .mmal_component = MMAL_COMPONENT_CAMERA,
++ .ybbp = 4,
+ },
+};
+
@@ -28600,7 +28625,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+ a->fmt.width = preview_port->es.video.width;
+ a->fmt.height = preview_port->es.video.height;
+ a->fmt.pixelformat = V4L2_PIX_FMT_YUV420;
-+ a->fmt.bytesperline = (preview_port->es.video.width * 3)>>1;
++ a->fmt.bytesperline = preview_port->es.video.width;
+ a->fmt.sizeimage = (preview_port->es.video.width *
+ preview_port->es.video.height * 3)>>1;
+ a->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M;
@@ -28723,7 +28748,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+
+ v4l_bound_align_image(&f->fmt.pix.width, MIN_WIDTH, MAX_WIDTH, 1,
+ &f->fmt.pix.height, MIN_HEIGHT, MAX_HEIGHT, 1, 0);
-+ f->fmt.pix.bytesperline = (f->fmt.pix.width * mfmt->depth)>>3;
++ f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp;
+
+ /* Image buffer has to be padded to allow for alignment, even though
+ * we then remove that padding before delivering the buffer.
@@ -29655,9 +29680,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.c linux-xbia
+
+module_init(bm2835_mmal_init);
+module_exit(bm2835_mmal_exit);
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.h linux-xbian-rpi/drivers/media/platform/bcm2835/bcm2835-camera.h
---- linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/bcm2835-camera.h 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/bcm2835-camera.h linux-rpi/drivers/media/platform/bcm2835/bcm2835-camera.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/bcm2835-camera.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/bcm2835-camera.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,126 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -29785,9 +29810,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/bcm2835-camera.h linux-xbia
+ (pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \
+ (pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \
+}
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/controls.c linux-xbian-rpi/drivers/media/platform/bcm2835/controls.c
---- linux-4.1.3/drivers/media/platform/bcm2835/controls.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/controls.c 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/controls.c linux-rpi/drivers/media/platform/bcm2835/controls.c
+--- linux-4.1.6/drivers/media/platform/bcm2835/controls.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/controls.c 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,1322 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -31111,48 +31136,10 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/controls.c linux-xbian-rpi/
+
+ return 0;
+}
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/Kconfig linux-xbian-rpi/drivers/media/platform/bcm2835/Kconfig
---- linux-4.1.3/drivers/media/platform/bcm2835/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/Kconfig 2015-07-28 01:20:58.198038163 +0200
-@@ -0,0 +1,25 @@
-+# Broadcom VideoCore IV v4l2 camera support
-+
-+config VIDEO_BCM2835
-+ bool "Broadcom BCM2835 camera interface driver"
-+ depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835)
-+ ---help---
-+ Say Y here to enable camera host interface devices for
-+ Broadcom BCM2835 SoC. This operates over the VCHIQ interface
-+ to a service running on VideoCore.
-+
-+
-+if VIDEO_BCM2835
-+
-+config VIDEO_BCM2835_MMAL
-+ tristate "Broadcom BM2835 MMAL camera interface driver"
-+ depends on BCM2708_VCHIQ
-+ select VIDEOBUF2_VMALLOC
-+ ---help---
-+ This is a V4L2 driver for the Broadcom BCM2835 MMAL camera host interface
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called bcm2835-v4l2.o
-+
-+
-+endif # VIDEO_BM2835
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/Makefile linux-xbian-rpi/drivers/media/platform/bcm2835/Makefile
---- linux-4.1.3/drivers/media/platform/bcm2835/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/Makefile 2015-07-28 01:20:58.198038163 +0200
-@@ -0,0 +1,5 @@
-+bcm2835-v4l2-objs := bcm2835-camera.o controls.o mmal-vchiq.o
-+
-+obj-$(CONFIG_VIDEO_BCM2835_MMAL) += bcm2835-v4l2.o
-+
-+ccflags-$(CONFIG_VIDEO_BCM2835) += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-common.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-common.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-common.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-common.h 2015-07-28 01:20:58.198038163 +0200
-@@ -0,0 +1,52 @@
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-common.h linux-rpi/drivers/media/platform/bcm2835/mmal-common.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-common.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-common.h 2015-08-26 10:26:08.025306213 +0200
+@@ -0,0 +1,53 @@
+/*
+ * Broadcom BM2835 V4L2 driver
+ *
@@ -31185,6 +31172,7 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-common.h linux-xbian-r
+ u32 mmal;
+ int depth;
+ u32 mmal_component; /* MMAL component index to be used to encode */
++ u32 ybbp; /* depth of first Y plane for planar formats */
+};
+
+/* buffer for one video frame */
@@ -31205,9 +31193,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-common.h linux-xbian-r
+ u32 u;
+ u32 v;
+};
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-encodings.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-encodings.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-encodings.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-encodings.h 2015-07-28 01:20:58.198038163 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-encodings.h linux-rpi/drivers/media/platform/bcm2835/mmal-encodings.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-encodings.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-encodings.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,127 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -31336,9 +31324,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-encodings.h linux-xbia
+/* @} MmalColorSpace List */
+
+#endif /* MMAL_ENCODINGS_H */
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-common.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg-common.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-common.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg-common.h 2015-07-28 01:20:58.202023943 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg-common.h linux-rpi/drivers/media/platform/bcm2835/mmal-msg-common.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg-common.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-msg-common.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,50 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -31390,9 +31378,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-common.h linux-xbi
+};
+
+#endif /* MMAL_MSG_COMMON_H */
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-format.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg-format.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-format.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg-format.h 2015-07-28 01:20:58.202023943 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg-format.h linux-rpi/drivers/media/platform/bcm2835/mmal-msg-format.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg-format.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-msg-format.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,81 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -31475,9 +31463,120 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-format.h linux-xbi
+};
+
+#endif /* MMAL_MSG_FORMAT_H */
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg.h 2015-07-28 01:20:58.202023943 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg-port.h linux-rpi/drivers/media/platform/bcm2835/mmal-msg-port.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg-port.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-msg-port.h 2015-08-26 10:26:08.025306213 +0200
+@@ -0,0 +1,107 @@
++/*
++ * Broadcom BM2835 V4L2 driver
++ *
++ * Copyright © 2013 Raspberry Pi (Trading) Ltd.
++ *
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License. See the file COPYING in the main directory of this archive
++ * for more details.
++ *
++ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk>
++ * Dave Stevenson <dsteve@broadcom.com>
++ * Simon Mellor <simellor@broadcom.com>
++ * Luke Diamand <luked@broadcom.com>
++ */
++
++/* MMAL_PORT_TYPE_T */
++enum mmal_port_type {
++ MMAL_PORT_TYPE_UNKNOWN = 0, /**< Unknown port type */
++ MMAL_PORT_TYPE_CONTROL, /**< Control port */
++ MMAL_PORT_TYPE_INPUT, /**< Input port */
++ MMAL_PORT_TYPE_OUTPUT, /**< Output port */
++ MMAL_PORT_TYPE_CLOCK, /**< Clock port */
++};
++
++/** The port is pass-through and doesn't need buffer headers allocated */
++#define MMAL_PORT_CAPABILITY_PASSTHROUGH 0x01
++/** The port wants to allocate the buffer payloads.
++ * This signals a preference that payload allocation should be done
++ * on this port for efficiency reasons. */
++#define MMAL_PORT_CAPABILITY_ALLOCATION 0x02
++/** The port supports format change events.
++ * This applies to input ports and is used to let the client know
++ * whether the port supports being reconfigured via a format
++ * change event (i.e. without having to disable the port). */
++#define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE 0x04
++
++/* mmal port structure (MMAL_PORT_T)
++ *
++ * most elements are informational only, the pointer values for
++ * interogation messages are generally provided as additional
++ * strucures within the message. When used to set values only teh
++ * buffer_num, buffer_size and userdata parameters are writable.
++ */
++struct mmal_port {
++ void *priv; /* Private member used by the framework */
++ const char *name; /* Port name. Used for debugging purposes (RO) */
++
++ u32 type; /* Type of the port (RO) enum mmal_port_type */
++ u16 index; /* Index of the port in its type list (RO) */
++ u16 index_all; /* Index of the port in the list of all ports (RO) */
++
++ u32 is_enabled; /* Indicates whether the port is enabled or not (RO) */
++ struct mmal_es_format *format; /* Format of the elementary stream */
++
++ u32 buffer_num_min; /* Minimum number of buffers the port
++ * requires (RO). This is set by the
++ * component.
++ */
++
++ u32 buffer_size_min; /* Minimum size of buffers the port
++ * requires (RO). This is set by the
++ * component.
++ */
++
++ u32 buffer_alignment_min; /* Minimum alignment requirement for
++ * the buffers (RO). A value of
++ * zero means no special alignment
++ * requirements. This is set by the
++ * component.
++ */
++
++ u32 buffer_num_recommended; /* Number of buffers the port
++ * recommends for optimal
++ * performance (RO). A value of
++ * zero means no special
++ * recommendation. This is set
++ * by the component.
++ */
++
++ u32 buffer_size_recommended; /* Size of buffers the port
++ * recommends for optimal
++ * performance (RO). A value of
++ * zero means no special
++ * recommendation. This is set
++ * by the component.
++ */
++
++ u32 buffer_num; /* Actual number of buffers the port will use.
++ * This is set by the client.
++ */
++
++ u32 buffer_size; /* Actual maximum size of the buffers that
++ * will be sent to the port. This is set by
++ * the client.
++ */
++
++ void *component; /* Component this port belongs to (Read Only) */
++
++ void *userdata; /* Field reserved for use by the client */
++
++ u32 capabilities; /* Flags describing the capabilities of a
++ * port (RO). Bitwise combination of \ref
++ * portcapabilities "Port capabilities"
++ * values.
++ */
++
++};
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg.h linux-rpi/drivers/media/platform/bcm2835/mmal-msg.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-msg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-msg.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,404 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -31883,120 +31982,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg.h linux-xbian-rpi/
+ u8 payload[MMAL_MSG_MAX_PAYLOAD];
+ } u;
+};
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-port.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg-port.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-msg-port.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-msg-port.h 2015-07-28 01:20:58.202023943 +0200
-@@ -0,0 +1,107 @@
-+/*
-+ * Broadcom BM2835 V4L2 driver
-+ *
-+ * Copyright © 2013 Raspberry Pi (Trading) Ltd.
-+ *
-+ * This file is subject to the terms and conditions of the GNU General Public
-+ * License. See the file COPYING in the main directory of this archive
-+ * for more details.
-+ *
-+ * Authors: Vincent Sanders <vincent.sanders@collabora.co.uk>
-+ * Dave Stevenson <dsteve@broadcom.com>
-+ * Simon Mellor <simellor@broadcom.com>
-+ * Luke Diamand <luked@broadcom.com>
-+ */
-+
-+/* MMAL_PORT_TYPE_T */
-+enum mmal_port_type {
-+ MMAL_PORT_TYPE_UNKNOWN = 0, /**< Unknown port type */
-+ MMAL_PORT_TYPE_CONTROL, /**< Control port */
-+ MMAL_PORT_TYPE_INPUT, /**< Input port */
-+ MMAL_PORT_TYPE_OUTPUT, /**< Output port */
-+ MMAL_PORT_TYPE_CLOCK, /**< Clock port */
-+};
-+
-+/** The port is pass-through and doesn't need buffer headers allocated */
-+#define MMAL_PORT_CAPABILITY_PASSTHROUGH 0x01
-+/** The port wants to allocate the buffer payloads.
-+ * This signals a preference that payload allocation should be done
-+ * on this port for efficiency reasons. */
-+#define MMAL_PORT_CAPABILITY_ALLOCATION 0x02
-+/** The port supports format change events.
-+ * This applies to input ports and is used to let the client know
-+ * whether the port supports being reconfigured via a format
-+ * change event (i.e. without having to disable the port). */
-+#define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE 0x04
-+
-+/* mmal port structure (MMAL_PORT_T)
-+ *
-+ * most elements are informational only, the pointer values for
-+ * interogation messages are generally provided as additional
-+ * strucures within the message. When used to set values only teh
-+ * buffer_num, buffer_size and userdata parameters are writable.
-+ */
-+struct mmal_port {
-+ void *priv; /* Private member used by the framework */
-+ const char *name; /* Port name. Used for debugging purposes (RO) */
-+
-+ u32 type; /* Type of the port (RO) enum mmal_port_type */
-+ u16 index; /* Index of the port in its type list (RO) */
-+ u16 index_all; /* Index of the port in the list of all ports (RO) */
-+
-+ u32 is_enabled; /* Indicates whether the port is enabled or not (RO) */
-+ struct mmal_es_format *format; /* Format of the elementary stream */
-+
-+ u32 buffer_num_min; /* Minimum number of buffers the port
-+ * requires (RO). This is set by the
-+ * component.
-+ */
-+
-+ u32 buffer_size_min; /* Minimum size of buffers the port
-+ * requires (RO). This is set by the
-+ * component.
-+ */
-+
-+ u32 buffer_alignment_min; /* Minimum alignment requirement for
-+ * the buffers (RO). A value of
-+ * zero means no special alignment
-+ * requirements. This is set by the
-+ * component.
-+ */
-+
-+ u32 buffer_num_recommended; /* Number of buffers the port
-+ * recommends for optimal
-+ * performance (RO). A value of
-+ * zero means no special
-+ * recommendation. This is set
-+ * by the component.
-+ */
-+
-+ u32 buffer_size_recommended; /* Size of buffers the port
-+ * recommends for optimal
-+ * performance (RO). A value of
-+ * zero means no special
-+ * recommendation. This is set
-+ * by the component.
-+ */
-+
-+ u32 buffer_num; /* Actual number of buffers the port will use.
-+ * This is set by the client.
-+ */
-+
-+ u32 buffer_size; /* Actual maximum size of the buffers that
-+ * will be sent to the port. This is set by
-+ * the client.
-+ */
-+
-+ void *component; /* Component this port belongs to (Read Only) */
-+
-+ void *userdata; /* Field reserved for use by the client */
-+
-+ u32 capabilities; /* Flags describing the capabilities of a
-+ * port (RO). Bitwise combination of \ref
-+ * portcapabilities "Port capabilities"
-+ * values.
-+ */
-+
-+};
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-parameters.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-parameters.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-parameters.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-parameters.h 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-parameters.h linux-rpi/drivers/media/platform/bcm2835/mmal-parameters.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-parameters.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-parameters.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,656 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -32654,9 +32642,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-parameters.h linux-xbi
+ u32 num_effect_params;
+ u32 effect_parameter[MMAL_MAX_IMAGEFX_PARAMETERS];
+};
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-vchiq.c linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-vchiq.c
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-vchiq.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-vchiq.c 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-vchiq.c linux-rpi/drivers/media/platform/bcm2835/mmal-vchiq.c
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-vchiq.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-vchiq.c 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,1916 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -34574,9 +34562,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-vchiq.c linux-xbian-rp
+ kfree(instance);
+ return -ENODEV;
+}
-diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-vchiq.h linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-vchiq.h
---- linux-4.1.3/drivers/media/platform/bcm2835/mmal-vchiq.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/media/platform/bcm2835/mmal-vchiq.h 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/media/platform/bcm2835/mmal-vchiq.h linux-rpi/drivers/media/platform/bcm2835/mmal-vchiq.h
+--- linux-4.1.6/drivers/media/platform/bcm2835/mmal-vchiq.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/media/platform/bcm2835/mmal-vchiq.h 2015-08-26 10:26:08.025306213 +0200
@@ -0,0 +1,178 @@
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -34756,33 +34744,9 @@ diff -Nur linux-4.1.3/drivers/media/platform/bcm2835/mmal-vchiq.h linux-xbian-rp
+ struct mmal_buffer *buf);
+
+#endif /* MMAL_VCHIQ_H */
-diff -Nur linux-4.1.3/drivers/media/platform/Kconfig linux-xbian-rpi/drivers/media/platform/Kconfig
---- linux-4.1.3/drivers/media/platform/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/media/platform/Kconfig 2015-07-28 01:20:58.198038163 +0200
-@@ -11,6 +11,8 @@
-
- if V4L_PLATFORM_DRIVERS
-
-+source "drivers/media/platform/bcm2835/Kconfig"
-+
- source "drivers/media/platform/marvell-ccic/Kconfig"
-
- config VIDEO_VIA_CAMERA
-diff -Nur linux-4.1.3/drivers/media/platform/Makefile linux-xbian-rpi/drivers/media/platform/Makefile
---- linux-4.1.3/drivers/media/platform/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/media/platform/Makefile 2015-07-28 01:20:58.198038163 +0200
-@@ -2,6 +2,8 @@
- # Makefile for the video capture/playback device drivers.
- #
-
-+obj-$(CONFIG_VIDEO_BCM2835) += bcm2835/
-+
- obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o
- obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o
-
-diff -Nur linux-4.1.3/drivers/media/usb/dvb-usb-v2/rtl28xxu.c linux-xbian-rpi/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
---- linux-4.1.3/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/media/usb/dvb-usb-v2/rtl28xxu.c linux-rpi/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+--- linux-4.1.6/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 2015-08-26 10:26:08.213308826 +0200
@@ -1744,6 +1744,10 @@
&rtl28xxu_props, "Compro VideoMate U620F", NULL) },
{ DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
@@ -34794,9 +34758,9 @@ diff -Nur linux-4.1.3/drivers/media/usb/dvb-usb-v2/rtl28xxu.c linux-xbian-rpi/dr
{ DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03,
&rtl28xxu_props, "Leadtek WinFast DTV Dongle mini", NULL) },
{ DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_CPYTO_REDI_PC50A,
-diff -Nur linux-4.1.3/drivers/mfd/Kconfig linux-xbian-rpi/drivers/mfd/Kconfig
---- linux-4.1.3/drivers/mfd/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mfd/Kconfig 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/mfd/Kconfig linux-rpi/drivers/mfd/Kconfig
+--- linux-4.1.6/drivers/mfd/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mfd/Kconfig 2015-08-26 10:26:08.269309603 +0200
@@ -10,6 +10,14 @@
select IRQ_DOMAIN
default n
@@ -34812,18 +34776,18 @@ diff -Nur linux-4.1.3/drivers/mfd/Kconfig linux-xbian-rpi/drivers/mfd/Kconfig
config MFD_CS5535
tristate "AMD CS5535 and CS5536 southbridge core functions"
select MFD_CORE
-diff -Nur linux-4.1.3/drivers/mfd/Makefile linux-xbian-rpi/drivers/mfd/Makefile
---- linux-4.1.3/drivers/mfd/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mfd/Makefile 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/mfd/Makefile linux-rpi/drivers/mfd/Makefile
+--- linux-4.1.6/drivers/mfd/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mfd/Makefile 2015-08-26 10:26:08.269309603 +0200
@@ -185,3 +185,5 @@
intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
+
+obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o
-diff -Nur linux-4.1.3/drivers/mfd/rpisense-core.c linux-xbian-rpi/drivers/mfd/rpisense-core.c
---- linux-4.1.3/drivers/mfd/rpisense-core.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/mfd/rpisense-core.c 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/mfd/rpisense-core.c linux-rpi/drivers/mfd/rpisense-core.c
+--- linux-4.1.6/drivers/mfd/rpisense-core.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/mfd/rpisense-core.c 2015-08-26 10:26:08.277309715 +0200
@@ -0,0 +1,157 @@
+/*
+ * Raspberry Pi Sense HAT core driver
@@ -34982,9 +34946,9 @@ diff -Nur linux-4.1.3/drivers/mfd/rpisense-core.c linux-xbian-rpi/drivers/mfd/rp
+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>");
+MODULE_LICENSE("GPL");
+
-diff -Nur linux-4.1.3/drivers/misc/Kconfig linux-xbian-rpi/drivers/misc/Kconfig
---- linux-4.1.3/drivers/misc/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/misc/Kconfig 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/misc/Kconfig linux-rpi/drivers/misc/Kconfig
+--- linux-4.1.6/drivers/misc/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/misc/Kconfig 2015-08-26 10:26:08.285309826 +0200
@@ -524,6 +524,7 @@
source "drivers/misc/altera-stapl/Kconfig"
source "drivers/misc/mei/Kconfig"
@@ -34993,9 +34957,9 @@ diff -Nur linux-4.1.3/drivers/misc/Kconfig linux-xbian-rpi/drivers/misc/Kconfig
source "drivers/misc/mic/Kconfig"
source "drivers/misc/genwqe/Kconfig"
source "drivers/misc/echo/Kconfig"
-diff -Nur linux-4.1.3/drivers/misc/Makefile linux-xbian-rpi/drivers/misc/Makefile
---- linux-4.1.3/drivers/misc/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/misc/Makefile 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/misc/Makefile linux-rpi/drivers/misc/Makefile
+--- linux-4.1.6/drivers/misc/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/misc/Makefile 2015-08-26 10:26:08.285309826 +0200
@@ -51,6 +51,7 @@
obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/
obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o
@@ -35004,9 +34968,40 @@ diff -Nur linux-4.1.3/drivers/misc/Makefile linux-xbian-rpi/drivers/misc/Makefil
obj-y += mic/
obj-$(CONFIG_GENWQE) += genwqe/
obj-$(CONFIG_ECHO) += echo/
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/connections/connection.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/connections/connection.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/connections/connection.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/connections/connection.h 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/Kconfig linux-rpi/drivers/misc/vc04_services/Kconfig
+--- linux-4.1.6/drivers/misc/vc04_services/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/Kconfig 2015-08-26 10:26:08.301310049 +0200
+@@ -0,0 +1,9 @@
++config BCM2708_VCHIQ
++ tristate "Videocore VCHIQ"
++ depends on RASPBERRYPI_FIRMWARE
++ default y
++ help
++ Kernel to VideoCore communication interface for the
++ BCM2708 family of products.
++ Defaults to Y when the Broadcom Videocore services
++ are included in the build, N otherwise.
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/Makefile linux-rpi/drivers/misc/vc04_services/Makefile
+--- linux-4.1.6/drivers/misc/vc04_services/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/Makefile 2015-08-26 10:26:08.301310049 +0200
+@@ -0,0 +1,14 @@
++obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o
++
++vchiq-objs := \
++ interface/vchiq_arm/vchiq_core.o \
++ interface/vchiq_arm/vchiq_arm.o \
++ interface/vchiq_arm/vchiq_kern_lib.o \
++ interface/vchiq_arm/vchiq_2835_arm.o \
++ interface/vchiq_arm/vchiq_debugfs.o \
++ interface/vchiq_arm/vchiq_shim.o \
++ interface/vchiq_arm/vchiq_util.o \
++ interface/vchiq_arm/vchiq_connected.o \
++
++ccflags-y += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000
++
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/connections/connection.h linux-rpi/drivers/misc/vc04_services/interface/vchi/connections/connection.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/connections/connection.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/connections/connection.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,328 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -35336,9 +35331,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/connections/conn
+#endif /* CONNECTION_H_ */
+
+/****************************** End of file **********************************/
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h linux-rpi/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,204 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -35544,9 +35539,391 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/message_drivers/
+#endif // _VCHI_MESSAGE_H_
+
+/****************************** End of file ***********************************/
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi.h linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi.h 2015-08-26 10:26:08.301310049 +0200
+@@ -0,0 +1,378 @@
++/**
++ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions, and the following disclaimer,
++ * without modification.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The names of the above-listed copyright holders may not be used
++ * to endorse or promote products derived from this software without
++ * specific prior written permission.
++ *
++ * ALTERNATIVELY, this software may be distributed under the terms of the
++ * GNU General Public License ("GPL") version 2, as published by the Free
++ * Software Foundation.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
++ * CONTRIBUTORS 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 VCHI_H_
++#define VCHI_H_
++
++#include "interface/vchi/vchi_cfg.h"
++#include "interface/vchi/vchi_common.h"
++#include "interface/vchi/connections/connection.h"
++#include "vchi_mh.h"
++
++
++/******************************************************************************
++ Global defs
++ *****************************************************************************/
++
++#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x))+VCHI_BULK_ALIGN-1) & ~(VCHI_BULK_ALIGN-1))
++#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN-1))
++#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN-1))))
++
++#ifdef USE_VCHIQ_ARM
++#define VCHI_BULK_ALIGNED(x) 1
++#else
++#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0)
++#endif
++
++struct vchi_version {
++ uint32_t version;
++ uint32_t version_min;
++};
++#define VCHI_VERSION(v_) { v_, v_ }
++#define VCHI_VERSION_EX(v_, m_) { v_, m_ }
++
++typedef enum
++{
++ VCHI_VEC_POINTER,
++ VCHI_VEC_HANDLE,
++ VCHI_VEC_LIST
++} VCHI_MSG_VECTOR_TYPE_T;
++
++typedef struct vchi_msg_vector_ex {
++
++ VCHI_MSG_VECTOR_TYPE_T type;
++ union
++ {
++ // a memory handle
++ struct
++ {
++ VCHI_MEM_HANDLE_T handle;
++ uint32_t offset;
++ int32_t vec_len;
++ } handle;
++
++ // an ordinary data pointer
++ struct
++ {
++ const void *vec_base;
++ int32_t vec_len;
++ } ptr;
++
++ // a nested vector list
++ struct
++ {
++ struct vchi_msg_vector_ex *vec;
++ uint32_t vec_len;
++ } list;
++ } u;
++} VCHI_MSG_VECTOR_EX_T;
++
++
++// Construct an entry in a msg vector for a pointer (p) of length (l)
++#define VCHI_VEC_POINTER(p,l) VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), (l) } }
++
++// Construct an entry in a msg vector for a message handle (h), starting at offset (o) of length (l)
++#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE, { { (h), (o), (l) } }
++
++// Macros to manipulate 'FOURCC' values
++#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] ))
++#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x & 0xFF
++
++
++// Opaque service information
++struct opaque_vchi_service_t;
++
++// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold,
++// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only.
++typedef struct
++{
++ struct opaque_vchi_service_t *service;
++ void *message;
++} VCHI_HELD_MSG_T;
++
++
++
++// structure used to provide the information needed to open a server or a client
++typedef struct {
++ struct vchi_version version;
++ int32_t service_id;
++ VCHI_CONNECTION_T *connection;
++ uint32_t rx_fifo_size;
++ uint32_t tx_fifo_size;
++ VCHI_CALLBACK_T callback;
++ void *callback_param;
++ /* client intends to receive bulk transfers of
++ odd lengths or into unaligned buffers */
++ int32_t want_unaligned_bulk_rx;
++ /* client intends to transmit bulk transfers of
++ odd lengths or out of unaligned buffers */
++ int32_t want_unaligned_bulk_tx;
++ /* client wants to check CRCs on (bulk) xfers.
++ Only needs to be set at 1 end - will do both directions. */
++ int32_t want_crc;
++} SERVICE_CREATION_T;
++
++// Opaque handle for a VCHI instance
++typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T;
++
++// Opaque handle for a server or client
++typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T;
++
++// Service registration & startup
++typedef void (*VCHI_SERVICE_INIT)(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections);
++
++typedef struct service_info_tag {
++ const char * const vll_filename; /* VLL to load to start this service. This is an empty string if VLL is "static" */
++ VCHI_SERVICE_INIT init; /* Service initialisation function */
++ void *vll_handle; /* VLL handle; NULL when unloaded or a "static VLL" in build */
++} SERVICE_INFO_T;
++
++/******************************************************************************
++ Global funcs - implementation is specific to which side you are on (local / remote)
++ *****************************************************************************/
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table,
++ const VCHI_MESSAGE_DRIVER_T * low_level);
++
++
++// Routine used to initialise the vchi on both local + remote connections
++extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle );
++
++extern int32_t vchi_exit( void );
++
++extern int32_t vchi_connect( VCHI_CONNECTION_T **connections,
++ const uint32_t num_connections,
++ VCHI_INSTANCE_T instance_handle );
++
++//When this is called, ensure that all services have no data pending.
++//Bulk transfers can remain 'queued'
++extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle );
++
++// Global control over bulk CRC checking
++extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection,
++ VCHI_CRC_CONTROL_T control );
++
++// helper functions
++extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t *length);
++extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address);
++extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle);
++
++
++/******************************************************************************
++ Global service API
++ *****************************************************************************/
++// Routine to create a named service
++extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle,
++ SERVICE_CREATION_T *setup,
++ VCHI_SERVICE_HANDLE_T *handle );
++
++// Routine to destory a service
++extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle );
++
++// Routine to open a named service
++extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle,
++ SERVICE_CREATION_T *setup,
++ VCHI_SERVICE_HANDLE_T *handle);
++
++extern int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle,
++ short *peer_version );
++
++// Routine to close a named service
++extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle );
++
++// Routine to increment ref count on a named service
++extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle );
++
++// Routine to decrement ref count on a named service
++extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle );
++
++// Routine to set a control option for a named service
++extern int32_t vchi_service_set_option( const VCHI_SERVICE_HANDLE_T handle,
++ VCHI_SERVICE_OPTION_T option,
++ int value);
++
++// Routine to send a message across a service
++extern int32_t vchi_msg_queue( VCHI_SERVICE_HANDLE_T handle,
++ const void *data,
++ uint32_t data_size,
++ VCHI_FLAGS_T flags,
++ void *msg_handle );
++
++// scatter-gather (vector) and send message
++int32_t vchi_msg_queuev_ex( VCHI_SERVICE_HANDLE_T handle,
++ VCHI_MSG_VECTOR_EX_T *vector,
++ uint32_t count,
++ VCHI_FLAGS_T flags,
++ void *msg_handle );
++
++// legacy scatter-gather (vector) and send message, only handles pointers
++int32_t vchi_msg_queuev( VCHI_SERVICE_HANDLE_T handle,
++ VCHI_MSG_VECTOR_T *vector,
++ uint32_t count,
++ VCHI_FLAGS_T flags,
++ void *msg_handle );
++
++// Routine to receive a msg from a service
++// Dequeue is equivalent to hold, copy into client buffer, release
++extern int32_t vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T handle,
++ void *data,
++ uint32_t max_data_size_to_read,
++ uint32_t *actual_msg_size,
++ VCHI_FLAGS_T flags );
++
++// Routine to look at a message in place.
++// The message is not dequeued, so a subsequent call to peek or dequeue
++// will return the same message.
++extern int32_t vchi_msg_peek( VCHI_SERVICE_HANDLE_T handle,
++ void **data,
++ uint32_t *msg_size,
++ VCHI_FLAGS_T flags );
++
++// Routine to remove a message after it has been read in place with peek
++// The first message on the queue is dequeued.
++extern int32_t vchi_msg_remove( VCHI_SERVICE_HANDLE_T handle );
++
++// Routine to look at a message in place.
++// The message is dequeued, so the caller is left holding it; the descriptor is
++// filled in and must be released when the user has finished with the message.
++extern int32_t vchi_msg_hold( VCHI_SERVICE_HANDLE_T handle,
++ void **data, // } may be NULL, as info can be
++ uint32_t *msg_size, // } obtained from HELD_MSG_T
++ VCHI_FLAGS_T flags,
++ VCHI_HELD_MSG_T *message_descriptor );
++
++// Initialise an iterator to look through messages in place
++extern int32_t vchi_msg_look_ahead( VCHI_SERVICE_HANDLE_T handle,
++ VCHI_MSG_ITER_T *iter,
++ VCHI_FLAGS_T flags );
++
++/******************************************************************************
++ Global service support API - operations on held messages and message iterators
++ *****************************************************************************/
++
++// Routine to get the address of a held message
++extern void *vchi_held_msg_ptr( const VCHI_HELD_MSG_T *message );
++
++// Routine to get the size of a held message
++extern int32_t vchi_held_msg_size( const VCHI_HELD_MSG_T *message );
++
++// Routine to get the transmit timestamp as written into the header by the peer
++extern uint32_t vchi_held_msg_tx_timestamp( const VCHI_HELD_MSG_T *message );
++
++// Routine to get the reception timestamp, written as we parsed the header
++extern uint32_t vchi_held_msg_rx_timestamp( const VCHI_HELD_MSG_T *message );
++
++// Routine to release a held message after it has been processed
++extern int32_t vchi_held_msg_release( VCHI_HELD_MSG_T *message );
++
++// Indicates whether the iterator has a next message.
++extern int32_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter );
++
++// Return the pointer and length for the next message and advance the iterator.
++extern int32_t vchi_msg_iter_next( VCHI_MSG_ITER_T *iter,
++ void **data,
++ uint32_t *msg_size );
++
++// Remove the last message returned by vchi_msg_iter_next.
++// Can only be called once after each call to vchi_msg_iter_next.
++extern int32_t vchi_msg_iter_remove( VCHI_MSG_ITER_T *iter );
++
++// Hold the last message returned by vchi_msg_iter_next.
++// Can only be called once after each call to vchi_msg_iter_next.
++extern int32_t vchi_msg_iter_hold( VCHI_MSG_ITER_T *iter,
++ VCHI_HELD_MSG_T *message );
++
++// Return information for the next message, and hold it, advancing the iterator.
++extern int32_t vchi_msg_iter_hold_next( VCHI_MSG_ITER_T *iter,
++ void **data, // } may be NULL
++ uint32_t *msg_size, // }
++ VCHI_HELD_MSG_T *message );
++
++
++/******************************************************************************
++ Global bulk API
++ *****************************************************************************/
++
++// Routine to prepare interface for a transfer from the other side
++extern int32_t vchi_bulk_queue_receive( VCHI_SERVICE_HANDLE_T handle,
++ void *data_dst,
++ uint32_t data_size,
++ VCHI_FLAGS_T flags,
++ void *transfer_handle );
++
++
++// Prepare interface for a transfer from the other side into relocatable memory.
++int32_t vchi_bulk_queue_receive_reloc( const VCHI_SERVICE_HANDLE_T handle,
++ VCHI_MEM_HANDLE_T h_dst,
++ uint32_t offset,
++ uint32_t data_size,
++ const VCHI_FLAGS_T flags,
++ void * const bulk_handle );
++
++// Routine to queue up data ready for transfer to the other (once they have signalled they are ready)
++extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle,
++ const void *data_src,
++ uint32_t data_size,
++ VCHI_FLAGS_T flags,
++ void *transfer_handle );
++
++
++/******************************************************************************
++ Configuration plumbing
++ *****************************************************************************/
++
++// function prototypes for the different mid layers (the state info gives the different physical connections)
++extern const VCHI_CONNECTION_API_T *single_get_func_table( void );
++//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void );
++//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void );
++
++// declare all message drivers here
++const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void );
++
++#ifdef __cplusplus
++}
++#endif
++
++extern int32_t vchi_bulk_queue_transmit_reloc( VCHI_SERVICE_HANDLE_T handle,
++ VCHI_MEM_HANDLE_T h_src,
++ uint32_t offset,
++ uint32_t data_size,
++ VCHI_FLAGS_T flags,
++ void *transfer_handle );
++#endif /* VCHI_H_ */
++
++/****************************** End of file **********************************/
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,224 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -35772,9 +36149,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h linux
+#endif /* VCHI_CFG_H_ */
+
+/****************************** End of file **********************************/
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 2015-07-28 01:20:58.281739526 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -35847,9 +36224,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_cfg_interna
+//#define VCHI_RX_NANOLOCKS
+
+#endif /*VCHI_CFG_INTERNAL_H_*/
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_common.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_common.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_common.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_common.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_common.h linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_common.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_common.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_common.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,175 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -36026,10 +36403,10 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_common.h li
+
+
+#endif // VCHI_COMMON_H_
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi.h 2015-07-28 01:20:58.281739526 +0200
-@@ -0,0 +1,378 @@
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_mh.h linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_mh.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 2015-08-26 10:26:08.301310049 +0200
+@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
+ *
@@ -36063,354 +36440,62 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi.h linux-xbi
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
-+#ifndef VCHI_H_
-+#define VCHI_H_
-+
-+#include "interface/vchi/vchi_cfg.h"
-+#include "interface/vchi/vchi_common.h"
-+#include "interface/vchi/connections/connection.h"
-+#include "vchi_mh.h"
-+
-+
-+/******************************************************************************
-+ Global defs
-+ *****************************************************************************/
-+
-+#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x))+VCHI_BULK_ALIGN-1) & ~(VCHI_BULK_ALIGN-1))
-+#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN-1))
-+#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN-1))))
-+
-+#ifdef USE_VCHIQ_ARM
-+#define VCHI_BULK_ALIGNED(x) 1
-+#else
-+#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0)
-+#endif
-+
-+struct vchi_version {
-+ uint32_t version;
-+ uint32_t version_min;
-+};
-+#define VCHI_VERSION(v_) { v_, v_ }
-+#define VCHI_VERSION_EX(v_, m_) { v_, m_ }
-+
-+typedef enum
-+{
-+ VCHI_VEC_POINTER,
-+ VCHI_VEC_HANDLE,
-+ VCHI_VEC_LIST
-+} VCHI_MSG_VECTOR_TYPE_T;
-+
-+typedef struct vchi_msg_vector_ex {
-+
-+ VCHI_MSG_VECTOR_TYPE_T type;
-+ union
-+ {
-+ // a memory handle
-+ struct
-+ {
-+ VCHI_MEM_HANDLE_T handle;
-+ uint32_t offset;
-+ int32_t vec_len;
-+ } handle;
-+
-+ // an ordinary data pointer
-+ struct
-+ {
-+ const void *vec_base;
-+ int32_t vec_len;
-+ } ptr;
-+
-+ // a nested vector list
-+ struct
-+ {
-+ struct vchi_msg_vector_ex *vec;
-+ uint32_t vec_len;
-+ } list;
-+ } u;
-+} VCHI_MSG_VECTOR_EX_T;
-+
-+
-+// Construct an entry in a msg vector for a pointer (p) of length (l)
-+#define VCHI_VEC_POINTER(p,l) VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), (l) } }
-+
-+// Construct an entry in a msg vector for a message handle (h), starting at offset (o) of length (l)
-+#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE, { { (h), (o), (l) } }
-+
-+// Macros to manipulate 'FOURCC' values
-+#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] ))
-+#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x & 0xFF
-+
-+
-+// Opaque service information
-+struct opaque_vchi_service_t;
-+
-+// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold,
-+// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only.
-+typedef struct
-+{
-+ struct opaque_vchi_service_t *service;
-+ void *message;
-+} VCHI_HELD_MSG_T;
-+
-+
-+
-+// structure used to provide the information needed to open a server or a client
-+typedef struct {
-+ struct vchi_version version;
-+ int32_t service_id;
-+ VCHI_CONNECTION_T *connection;
-+ uint32_t rx_fifo_size;
-+ uint32_t tx_fifo_size;
-+ VCHI_CALLBACK_T callback;
-+ void *callback_param;
-+ /* client intends to receive bulk transfers of
-+ odd lengths or into unaligned buffers */
-+ int32_t want_unaligned_bulk_rx;
-+ /* client intends to transmit bulk transfers of
-+ odd lengths or out of unaligned buffers */
-+ int32_t want_unaligned_bulk_tx;
-+ /* client wants to check CRCs on (bulk) xfers.
-+ Only needs to be set at 1 end - will do both directions. */
-+ int32_t want_crc;
-+} SERVICE_CREATION_T;
-+
-+// Opaque handle for a VCHI instance
-+typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T;
-+
-+// Opaque handle for a server or client
-+typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T;
-+
-+// Service registration & startup
-+typedef void (*VCHI_SERVICE_INIT)(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections);
++#ifndef VCHI_MH_H_
++#define VCHI_MH_H_
+
-+typedef struct service_info_tag {
-+ const char * const vll_filename; /* VLL to load to start this service. This is an empty string if VLL is "static" */
-+ VCHI_SERVICE_INIT init; /* Service initialisation function */
-+ void *vll_handle; /* VLL handle; NULL when unloaded or a "static VLL" in build */
-+} SERVICE_INFO_T;
++#include <linux/types.h>
+
-+/******************************************************************************
-+ Global funcs - implementation is specific to which side you are on (local / remote)
-+ *****************************************************************************/
++typedef int32_t VCHI_MEM_HANDLE_T;
++#define VCHI_MEM_HANDLE_INVALID 0
+
-+#ifdef __cplusplus
-+extern "C" {
+#endif
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 2015-08-26 10:26:08.301310049 +0200
+@@ -0,0 +1,40 @@
++/**
++ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions, and the following disclaimer,
++ * without modification.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The names of the above-listed copyright holders may not be used
++ * to endorse or promote products derived from this software without
++ * specific prior written permission.
++ *
++ * ALTERNATIVELY, this software may be distributed under the terms of the
++ * GNU General Public License ("GPL") version 2, as published by the Free
++ * Software Foundation.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
++ * CONTRIBUTORS 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.
++ */
+
-+extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table,
-+ const VCHI_MESSAGE_DRIVER_T * low_level);
-+
-+
-+// Routine used to initialise the vchi on both local + remote connections
-+extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle );
-+
-+extern int32_t vchi_exit( void );
-+
-+extern int32_t vchi_connect( VCHI_CONNECTION_T **connections,
-+ const uint32_t num_connections,
-+ VCHI_INSTANCE_T instance_handle );
-+
-+//When this is called, ensure that all services have no data pending.
-+//Bulk transfers can remain 'queued'
-+extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle );
-+
-+// Global control over bulk CRC checking
-+extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection,
-+ VCHI_CRC_CONTROL_T control );
-+
-+// helper functions
-+extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t *length);
-+extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address);
-+extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle);
-+
-+
-+/******************************************************************************
-+ Global service API
-+ *****************************************************************************/
-+// Routine to create a named service
-+extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle,
-+ SERVICE_CREATION_T *setup,
-+ VCHI_SERVICE_HANDLE_T *handle );
-+
-+// Routine to destory a service
-+extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle );
-+
-+// Routine to open a named service
-+extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle,
-+ SERVICE_CREATION_T *setup,
-+ VCHI_SERVICE_HANDLE_T *handle);
-+
-+extern int32_t vchi_get_peer_version( const VCHI_SERVICE_HANDLE_T handle,
-+ short *peer_version );
-+
-+// Routine to close a named service
-+extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle );
-+
-+// Routine to increment ref count on a named service
-+extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle );
-+
-+// Routine to decrement ref count on a named service
-+extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle );
-+
-+// Routine to set a control option for a named service
-+extern int32_t vchi_service_set_option( const VCHI_SERVICE_HANDLE_T handle,
-+ VCHI_SERVICE_OPTION_T option,
-+ int value);
-+
-+// Routine to send a message across a service
-+extern int32_t vchi_msg_queue( VCHI_SERVICE_HANDLE_T handle,
-+ const void *data,
-+ uint32_t data_size,
-+ VCHI_FLAGS_T flags,
-+ void *msg_handle );
-+
-+// scatter-gather (vector) and send message
-+int32_t vchi_msg_queuev_ex( VCHI_SERVICE_HANDLE_T handle,
-+ VCHI_MSG_VECTOR_EX_T *vector,
-+ uint32_t count,
-+ VCHI_FLAGS_T flags,
-+ void *msg_handle );
-+
-+// legacy scatter-gather (vector) and send message, only handles pointers
-+int32_t vchi_msg_queuev( VCHI_SERVICE_HANDLE_T handle,
-+ VCHI_MSG_VECTOR_T *vector,
-+ uint32_t count,
-+ VCHI_FLAGS_T flags,
-+ void *msg_handle );
-+
-+// Routine to receive a msg from a service
-+// Dequeue is equivalent to hold, copy into client buffer, release
-+extern int32_t vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T handle,
-+ void *data,
-+ uint32_t max_data_size_to_read,
-+ uint32_t *actual_msg_size,
-+ VCHI_FLAGS_T flags );
-+
-+// Routine to look at a message in place.
-+// The message is not dequeued, so a subsequent call to peek or dequeue
-+// will return the same message.
-+extern int32_t vchi_msg_peek( VCHI_SERVICE_HANDLE_T handle,
-+ void **data,
-+ uint32_t *msg_size,
-+ VCHI_FLAGS_T flags );
-+
-+// Routine to remove a message after it has been read in place with peek
-+// The first message on the queue is dequeued.
-+extern int32_t vchi_msg_remove( VCHI_SERVICE_HANDLE_T handle );
-+
-+// Routine to look at a message in place.
-+// The message is dequeued, so the caller is left holding it; the descriptor is
-+// filled in and must be released when the user has finished with the message.
-+extern int32_t vchi_msg_hold( VCHI_SERVICE_HANDLE_T handle,
-+ void **data, // } may be NULL, as info can be
-+ uint32_t *msg_size, // } obtained from HELD_MSG_T
-+ VCHI_FLAGS_T flags,
-+ VCHI_HELD_MSG_T *message_descriptor );
-+
-+// Initialise an iterator to look through messages in place
-+extern int32_t vchi_msg_look_ahead( VCHI_SERVICE_HANDLE_T handle,
-+ VCHI_MSG_ITER_T *iter,
-+ VCHI_FLAGS_T flags );
-+
-+/******************************************************************************
-+ Global service support API - operations on held messages and message iterators
-+ *****************************************************************************/
-+
-+// Routine to get the address of a held message
-+extern void *vchi_held_msg_ptr( const VCHI_HELD_MSG_T *message );
-+
-+// Routine to get the size of a held message
-+extern int32_t vchi_held_msg_size( const VCHI_HELD_MSG_T *message );
-+
-+// Routine to get the transmit timestamp as written into the header by the peer
-+extern uint32_t vchi_held_msg_tx_timestamp( const VCHI_HELD_MSG_T *message );
-+
-+// Routine to get the reception timestamp, written as we parsed the header
-+extern uint32_t vchi_held_msg_rx_timestamp( const VCHI_HELD_MSG_T *message );
-+
-+// Routine to release a held message after it has been processed
-+extern int32_t vchi_held_msg_release( VCHI_HELD_MSG_T *message );
-+
-+// Indicates whether the iterator has a next message.
-+extern int32_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter );
-+
-+// Return the pointer and length for the next message and advance the iterator.
-+extern int32_t vchi_msg_iter_next( VCHI_MSG_ITER_T *iter,
-+ void **data,
-+ uint32_t *msg_size );
-+
-+// Remove the last message returned by vchi_msg_iter_next.
-+// Can only be called once after each call to vchi_msg_iter_next.
-+extern int32_t vchi_msg_iter_remove( VCHI_MSG_ITER_T *iter );
-+
-+// Hold the last message returned by vchi_msg_iter_next.
-+// Can only be called once after each call to vchi_msg_iter_next.
-+extern int32_t vchi_msg_iter_hold( VCHI_MSG_ITER_T *iter,
-+ VCHI_HELD_MSG_T *message );
-+
-+// Return information for the next message, and hold it, advancing the iterator.
-+extern int32_t vchi_msg_iter_hold_next( VCHI_MSG_ITER_T *iter,
-+ void **data, // } may be NULL
-+ uint32_t *msg_size, // }
-+ VCHI_HELD_MSG_T *message );
-+
-+
-+/******************************************************************************
-+ Global bulk API
-+ *****************************************************************************/
-+
-+// Routine to prepare interface for a transfer from the other side
-+extern int32_t vchi_bulk_queue_receive( VCHI_SERVICE_HANDLE_T handle,
-+ void *data_dst,
-+ uint32_t data_size,
-+ VCHI_FLAGS_T flags,
-+ void *transfer_handle );
-+
-+
-+// Prepare interface for a transfer from the other side into relocatable memory.
-+int32_t vchi_bulk_queue_receive_reloc( const VCHI_SERVICE_HANDLE_T handle,
-+ VCHI_MEM_HANDLE_T h_dst,
-+ uint32_t offset,
-+ uint32_t data_size,
-+ const VCHI_FLAGS_T flags,
-+ void * const bulk_handle );
-+
-+// Routine to queue up data ready for transfer to the other (once they have signalled they are ready)
-+extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle,
-+ const void *data_src,
-+ uint32_t data_size,
-+ VCHI_FLAGS_T flags,
-+ void *transfer_handle );
-+
-+
-+/******************************************************************************
-+ Configuration plumbing
-+ *****************************************************************************/
-+
-+// function prototypes for the different mid layers (the state info gives the different physical connections)
-+extern const VCHI_CONNECTION_API_T *single_get_func_table( void );
-+//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void );
-+//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void );
++#ifndef VCHIQ_VCHIQ_H
++#define VCHIQ_VCHIQ_H
+
-+// declare all message drivers here
-+const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void );
++#include "vchiq_if.h"
++#include "vchiq_util.h"
+
-+#ifdef __cplusplus
-+}
+#endif
-+
-+extern int32_t vchi_bulk_queue_transmit_reloc( VCHI_SERVICE_HANDLE_T handle,
-+ VCHI_MEM_HANDLE_T h_src,
-+ uint32_t offset,
-+ uint32_t data_size,
-+ VCHI_FLAGS_T flags,
-+ void *transfer_handle );
-+#endif /* VCHI_H_ */
-+
-+/****************************** End of file **********************************/
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_mh.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_mh.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchi/vchi_mh.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -36445,18 +36530,18 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchi/vchi_mh.h linux-
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
-+#ifndef VCHI_MH_H_
-+#define VCHI_MH_H_
++#ifndef VCHIQ_2835_H
++#define VCHIQ_2835_H
+
-+#include <linux/types.h>
++#include "vchiq_pagelist.h"
+
-+typedef int32_t VCHI_MEM_HANDLE_T;
-+#define VCHI_MEM_HANDLE_INVALID 0
++#define VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX 0
++#define VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX 1
+
-+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 2015-07-28 01:20:58.285725306 +0200
++#endif /* VCHIQ_2835_H */
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,580 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -37038,55 +37123,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_
+
+ kfree(pagelist);
+}
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835.h 2015-07-28 01:20:58.285725306 +0200
-@@ -0,0 +1,42 @@
-+/**
-+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions, and the following disclaimer,
-+ * without modification.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ * 3. The names of the above-listed copyright holders may not be used
-+ * to endorse or promote products derived from this software without
-+ * specific prior written permission.
-+ *
-+ * ALTERNATIVELY, this software may be distributed under the terms of the
-+ * GNU General Public License ("GPL") version 2, as published by the Free
-+ * Software Foundation.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-+ * CONTRIBUTORS 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 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 -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,2903 @@
+/**
+ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved.
@@ -39991,9 +40030,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Broadcom Corporation");
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,220 @@
+/**
+ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved.
@@ -40215,9 +40254,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h
+
+
+#endif /* VCHIQ_ARM_H */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build_info.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -40256,9 +40295,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_build
+const char *vchiq_get_build_version(void);
+const char *vchiq_get_build_time(void);
+const char *vchiq_get_build_date(void);
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2010-2014 Broadcom. All rights reserved.
@@ -40329,9 +40368,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_cfg.h
+#endif
+
+#endif /* VCHIQ_CFG_H */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.c 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -40453,9 +40492,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_conne
+ mutex_unlock(&g_connected_mutex);
+}
+EXPORT_SYMBOL(vchiq_add_connected_callback);
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_connected.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -40507,9 +40546,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_conne
+void vchiq_call_connected_callbacks(void);
+
+#endif /* VCHIQ_CONNECTED_H */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,3934 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -44445,9 +44484,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.
+ numBytes = 0;
+ }
+}
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,712 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -45161,9 +45200,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.
+ size_t numBytes);
+
+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.c 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,383 @@
+/**
+ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved.
@@ -45548,9 +45587,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debug
+}
+
+#endif /* CONFIG_DEBUG_FS */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debugfs.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2014 Raspberry Pi (Trading) Ltd. All rights reserved.
@@ -45604,9 +45643,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_debug
+void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance);
+
+#endif /* VCHIQ_DEBUGFS_H */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+
@@ -45695,53 +45734,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genve
+ return vchiq_build_time;
+}
+EOF
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq.h 2015-07-28 01:20:58.285725306 +0200
-@@ -0,0 +1,40 @@
-+/**
-+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions, and the following disclaimer,
-+ * without modification.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ * 3. The names of the above-listed copyright holders may not be used
-+ * to endorse or promote products derived from this software without
-+ * specific prior written permission.
-+ *
-+ * ALTERNATIVELY, this software may be distributed under the terms of the
-+ * GNU General Public License ("GPL") version 2, as published by the Free
-+ * Software Foundation.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-+ * CONTRIBUTORS 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 VCHIQ_VCHIQ_H
-+#define VCHIQ_VCHIQ_H
-+
-+#include "vchiq_if.h"
-+#include "vchiq_util.h"
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,189 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -45932,9 +45927,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h
+ short *peer_version);
+
+#endif /* VCHIQ_IF_H */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,131 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -46067,9 +46062,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl
+#define VCHIQ_IOC_MAX 17
+
+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,458 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -46529,9 +46524,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_
+
+ return status;
+}
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killable.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -46602,9 +46597,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_killa
+#define mutex_lock_interruptible mutex_lock_interruptible_killable
+
+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdrv.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -46677,9 +46672,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_memdr
+ const VCHIQ_PLATFORM_DATA_T * platform_data);
+
+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 2015-08-26 10:26:08.301310049 +0200
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -46739,9 +46734,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_pagel
+} FRAGMENTS_T;
+
+#endif /* VCHIQ_PAGELIST_H */
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c 2015-08-26 10:26:08.305310104 +0200
@@ -0,0 +1,860 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -47603,9 +47598,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.
+ return ret;
+}
+EXPORT_SYMBOL(vchi_service_release);
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c 2015-08-26 10:26:08.305310104 +0200
@@ -0,0 +1,152 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -47759,9 +47754,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.
+
+ return header;
+}
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.h 2015-08-26 10:26:08.305310104 +0200
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -47844,9 +47839,9 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.
+extern VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue);
+
+#endif
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c
---- linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c 2015-07-28 01:20:58.285725306 +0200
+diff -Nur linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c
+--- linux-4.1.6/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_version.c 2015-08-26 10:26:08.305310104 +0200
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2010-2012 Broadcom. All rights reserved.
@@ -47907,41 +47902,10 @@ diff -Nur linux-4.1.3/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_versi
+{
+ return vchiq_build_time;
+}
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/Kconfig linux-xbian-rpi/drivers/misc/vc04_services/Kconfig
---- linux-4.1.3/drivers/misc/vc04_services/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/Kconfig 2015-07-28 01:20:58.281739526 +0200
-@@ -0,0 +1,9 @@
-+config BCM2708_VCHIQ
-+ tristate "Videocore VCHIQ"
-+ depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX
-+ default y
-+ help
-+ Kernel to VideoCore communication interface for the
-+ BCM2708 family of products.
-+ Defaults to Y when the Broadcom Videocore services
-+ are included in the build, N otherwise.
-diff -Nur linux-4.1.3/drivers/misc/vc04_services/Makefile linux-xbian-rpi/drivers/misc/vc04_services/Makefile
---- linux-4.1.3/drivers/misc/vc04_services/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/misc/vc04_services/Makefile 2015-07-28 01:20:58.281739526 +0200
-@@ -0,0 +1,14 @@
-+obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o
-+
-+vchiq-objs := \
-+ interface/vchiq_arm/vchiq_core.o \
-+ interface/vchiq_arm/vchiq_arm.o \
-+ interface/vchiq_arm/vchiq_kern_lib.o \
-+ interface/vchiq_arm/vchiq_2835_arm.o \
-+ interface/vchiq_arm/vchiq_debugfs.o \
-+ interface/vchiq_arm/vchiq_shim.o \
-+ interface/vchiq_arm/vchiq_util.o \
-+ interface/vchiq_arm/vchiq_connected.o \
-+
-+ccflags-y += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000
-+
-diff -Nur linux-4.1.3/drivers/mmc/card/block.c linux-xbian-rpi/drivers/mmc/card/block.c
---- linux-4.1.3/drivers/mmc/card/block.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/card/block.c 2015-07-28 01:20:58.285725306 +0200
-@@ -1413,6 +1413,7 @@
+diff -Nur linux-4.1.6/drivers/mmc/card/block.c linux-rpi/drivers/mmc/card/block.c
+--- linux-4.1.6/drivers/mmc/card/block.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/card/block.c 2015-08-26 10:26:08.305310104 +0200
+@@ -1415,6 +1415,7 @@
brq->data.blocks = card->host->ops->multi_io_quirk(card,
(rq_data_dir(req) == READ) ?
MMC_DATA_READ : MMC_DATA_WRITE,
@@ -47949,9 +47913,9 @@ diff -Nur linux-4.1.3/drivers/mmc/card/block.c linux-xbian-rpi/drivers/mmc/card/
brq->data.blocks);
}
-diff -Nur linux-4.1.3/drivers/mmc/core/quirks.c linux-xbian-rpi/drivers/mmc/core/quirks.c
---- linux-4.1.3/drivers/mmc/core/quirks.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/core/quirks.c 2015-07-28 01:20:58.289711085 +0200
+diff -Nur linux-4.1.6/drivers/mmc/core/quirks.c linux-rpi/drivers/mmc/core/quirks.c
+--- linux-4.1.6/drivers/mmc/core/quirks.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/core/quirks.c 2015-08-26 10:26:08.309310160 +0200
@@ -71,6 +71,7 @@
void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
@@ -47971,9 +47935,70 @@ diff -Nur linux-4.1.3/drivers/mmc/core/quirks.c linux-xbian-rpi/drivers/mmc/core
+ card->quirks |= MMC_QUIRK_BLK_NO_CMD23;
}
EXPORT_SYMBOL(mmc_fixup_device);
-diff -Nur linux-4.1.3/drivers/mmc/host/bcm2835-mmc.c linux-xbian-rpi/drivers/mmc/host/bcm2835-mmc.c
---- linux-4.1.3/drivers/mmc/host/bcm2835-mmc.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/mmc/host/bcm2835-mmc.c 2015-07-28 01:20:58.289711085 +0200
+diff -Nur linux-4.1.6/drivers/mmc/host/Kconfig linux-rpi/drivers/mmc/host/Kconfig
+--- linux-4.1.6/drivers/mmc/host/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/host/Kconfig 2015-08-26 10:26:08.309310160 +0200
+@@ -4,6 +4,45 @@
+
+ comment "MMC/SD/SDIO Host Controller Drivers"
+
++config MMC_BCM2835
++ tristate "MMC support on BCM2835"
++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
++ help
++ This selects the MMC Interface on BCM2835.
++
++ If you have a controller with this interface, say Y or M here.
++
++ If unsure, say N.
++
++config MMC_BCM2835_DMA
++ bool "DMA support on BCM2835 Arasan controller"
++ depends on MMC_BCM2835
++ help
++ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708
++ based chips.
++
++ If unsure, say N.
++
++config MMC_BCM2835_PIO_DMA_BARRIER
++ int "Block count limit for PIO transfers"
++ depends on MMC_BCM2835 && MMC_BCM2835_DMA
++ range 0 256
++ default 2
++ help
++ The inclusive limit in bytes under which PIO will be used instead of DMA
++
++ If unsure, say 2 here.
++
++config MMC_BCM2835_SDHOST
++ tristate "Support for the SDHost controller on BCM2708/9"
++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
++ help
++ This selects the SDHost controller on BCM2835/6.
++
++ If you have a controller with this interface, say Y or M here.
++
++ If unsure, say N.
++
+ config MMC_ARMMMCI
+ tristate "ARM AMBA Multimedia Card Interface support"
+ depends on ARM_AMBA
+diff -Nur linux-4.1.6/drivers/mmc/host/Makefile linux-rpi/drivers/mmc/host/Makefile
+--- linux-4.1.6/drivers/mmc/host/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/host/Makefile 2015-08-26 10:26:08.309310160 +0200
+@@ -18,6 +18,8 @@
+ obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o
+ obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o
+ obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o
++obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o
++obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o
+ obj-$(CONFIG_MMC_WBSD) += wbsd.o
+ obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
+ obj-$(CONFIG_MMC_OMAP) += omap.o
+diff -Nur linux-4.1.6/drivers/mmc/host/bcm2835-mmc.c linux-rpi/drivers/mmc/host/bcm2835-mmc.c
+--- linux-4.1.6/drivers/mmc/host/bcm2835-mmc.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/mmc/host/bcm2835-mmc.c 2015-08-26 10:26:08.309310160 +0200
@@ -0,0 +1,1558 @@
+/*
+ * BCM2835 MMC host driver.
@@ -49533,9 +49558,9 @@ diff -Nur linux-4.1.3/drivers/mmc/host/bcm2835-mmc.c linux-xbian-rpi/drivers/mmc
+MODULE_DESCRIPTION("BCM2835 SDHCI driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Gellert Weisz");
-diff -Nur linux-4.1.3/drivers/mmc/host/bcm2835-sdhost.c linux-xbian-rpi/drivers/mmc/host/bcm2835-sdhost.c
---- linux-4.1.3/drivers/mmc/host/bcm2835-sdhost.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/mmc/host/bcm2835-sdhost.c 2015-07-28 01:20:58.289711085 +0200
+diff -Nur linux-4.1.6/drivers/mmc/host/bcm2835-sdhost.c linux-rpi/drivers/mmc/host/bcm2835-sdhost.c
+--- linux-4.1.6/drivers/mmc/host/bcm2835-sdhost.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/mmc/host/bcm2835-sdhost.c 2015-08-26 10:26:08.309310160 +0200
@@ -0,0 +1,1930 @@
+/*
+ * BCM2835 SD host driver.
@@ -51467,70 +51492,9 @@ diff -Nur linux-4.1.3/drivers/mmc/host/bcm2835-sdhost.c linux-xbian-rpi/drivers/
+MODULE_DESCRIPTION("BCM2835 SDHost driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Phil Elwell");
-diff -Nur linux-4.1.3/drivers/mmc/host/Kconfig linux-xbian-rpi/drivers/mmc/host/Kconfig
---- linux-4.1.3/drivers/mmc/host/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/host/Kconfig 2015-07-28 01:20:58.289711085 +0200
-@@ -4,6 +4,45 @@
-
- comment "MMC/SD/SDIO Host Controller Drivers"
-
-+config MMC_BCM2835
-+ tristate "MMC support on BCM2835"
-+ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
-+ help
-+ This selects the MMC Interface on BCM2835.
-+
-+ If you have a controller with this interface, say Y or M here.
-+
-+ If unsure, say N.
-+
-+config MMC_BCM2835_DMA
-+ bool "DMA support on BCM2835 Arasan controller"
-+ depends on MMC_BCM2835
-+ help
-+ Enable DMA support on the Arasan SDHCI controller in Broadcom 2708
-+ based chips.
-+
-+ If unsure, say N.
-+
-+config MMC_BCM2835_PIO_DMA_BARRIER
-+ int "Block count limit for PIO transfers"
-+ depends on MMC_BCM2835 && MMC_BCM2835_DMA
-+ range 0 256
-+ default 2
-+ help
-+ The inclusive limit in bytes under which PIO will be used instead of DMA
-+
-+ If unsure, say 2 here.
-+
-+config MMC_BCM2835_SDHOST
-+ tristate "Support for the SDHost controller on BCM2708/9"
-+ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
-+ help
-+ This selects the SDHost controller on BCM2835/6.
-+
-+ If you have a controller with this interface, say Y or M here.
-+
-+ If unsure, say N.
-+
- config MMC_ARMMMCI
- tristate "ARM AMBA Multimedia Card Interface support"
- depends on ARM_AMBA
-diff -Nur linux-4.1.3/drivers/mmc/host/Makefile linux-xbian-rpi/drivers/mmc/host/Makefile
---- linux-4.1.3/drivers/mmc/host/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/host/Makefile 2015-07-28 01:20:58.289711085 +0200
-@@ -18,6 +18,8 @@
- obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o
- obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o
- obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o
-+obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o
-+obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o
- obj-$(CONFIG_MMC_WBSD) += wbsd.o
- obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
- obj-$(CONFIG_MMC_OMAP) += omap.o
-diff -Nur linux-4.1.3/drivers/mmc/host/omap_hsmmc.c linux-xbian-rpi/drivers/mmc/host/omap_hsmmc.c
---- linux-4.1.3/drivers/mmc/host/omap_hsmmc.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/host/omap_hsmmc.c 2015-07-28 01:20:58.289711085 +0200
+diff -Nur linux-4.1.6/drivers/mmc/host/omap_hsmmc.c linux-rpi/drivers/mmc/host/omap_hsmmc.c
+--- linux-4.1.6/drivers/mmc/host/omap_hsmmc.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/host/omap_hsmmc.c 2015-08-26 10:26:08.313310215 +0200
@@ -1749,7 +1749,9 @@
}
@@ -51542,9 +51506,9 @@ diff -Nur linux-4.1.3/drivers/mmc/host/omap_hsmmc.c linux-xbian-rpi/drivers/mmc/
{
/* This controller can't do multiblock reads due to hw bugs */
if (direction == MMC_DATA_READ)
-diff -Nur linux-4.1.3/drivers/mmc/host/sh_mobile_sdhi.c linux-xbian-rpi/drivers/mmc/host/sh_mobile_sdhi.c
---- linux-4.1.3/drivers/mmc/host/sh_mobile_sdhi.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/host/sh_mobile_sdhi.c 2015-07-28 01:20:58.289711085 +0200
+diff -Nur linux-4.1.6/drivers/mmc/host/sh_mobile_sdhi.c linux-rpi/drivers/mmc/host/sh_mobile_sdhi.c
+--- linux-4.1.6/drivers/mmc/host/sh_mobile_sdhi.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/host/sh_mobile_sdhi.c 2015-08-26 10:26:08.317310271 +0200
@@ -170,7 +170,9 @@
}
@@ -51556,9 +51520,9 @@ diff -Nur linux-4.1.3/drivers/mmc/host/sh_mobile_sdhi.c linux-xbian-rpi/drivers/
{
/*
* In Renesas controllers, when performing a
-diff -Nur linux-4.1.3/drivers/mmc/host/tmio_mmc_pio.c linux-xbian-rpi/drivers/mmc/host/tmio_mmc_pio.c
---- linux-4.1.3/drivers/mmc/host/tmio_mmc_pio.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/mmc/host/tmio_mmc_pio.c 2015-07-28 01:20:58.289711085 +0200
+diff -Nur linux-4.1.6/drivers/mmc/host/tmio_mmc_pio.c linux-rpi/drivers/mmc/host/tmio_mmc_pio.c
+--- linux-4.1.6/drivers/mmc/host/tmio_mmc_pio.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/mmc/host/tmio_mmc_pio.c 2015-08-26 10:26:08.317310271 +0200
@@ -1001,7 +1001,9 @@
}
@@ -51570,9 +51534,9 @@ diff -Nur linux-4.1.3/drivers/mmc/host/tmio_mmc_pio.c linux-xbian-rpi/drivers/mm
{
struct tmio_mmc_host *host = mmc_priv(card->host);
-diff -Nur linux-4.1.3/drivers/net/ethernet/microchip/enc28j60.c linux-xbian-rpi/drivers/net/ethernet/microchip/enc28j60.c
---- linux-4.1.3/drivers/net/ethernet/microchip/enc28j60.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/net/ethernet/microchip/enc28j60.c 2015-07-28 01:20:58.293696864 +0200
+diff -Nur linux-4.1.6/drivers/net/ethernet/microchip/enc28j60.c linux-rpi/drivers/net/ethernet/microchip/enc28j60.c
+--- linux-4.1.6/drivers/net/ethernet/microchip/enc28j60.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/net/ethernet/microchip/enc28j60.c 2015-08-26 10:26:08.525313161 +0200
@@ -1630,10 +1630,21 @@
return 0;
}
@@ -51595,9 +51559,9 @@ diff -Nur linux-4.1.3/drivers/net/ethernet/microchip/enc28j60.c linux-xbian-rpi/
},
.probe = enc28j60_probe,
.remove = enc28j60_remove,
-diff -Nur linux-4.1.3/drivers/net/usb/smsc95xx.c linux-xbian-rpi/drivers/net/usb/smsc95xx.c
---- linux-4.1.3/drivers/net/usb/smsc95xx.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/net/usb/smsc95xx.c 2015-07-28 01:20:58.293696864 +0200
+diff -Nur linux-4.1.6/drivers/net/usb/smsc95xx.c linux-rpi/drivers/net/usb/smsc95xx.c
+--- linux-4.1.6/drivers/net/usb/smsc95xx.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/net/usb/smsc95xx.c 2015-08-26 10:26:08.605314274 +0200
@@ -59,6 +59,7 @@
#define SUSPEND_SUSPEND3 (0x08)
#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \
@@ -51682,30 +51646,7 @@ diff -Nur linux-4.1.3/drivers/net/usb/smsc95xx.c linux-xbian-rpi/drivers/net/usb
/* try reading mac address from EEPROM */
if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
dev->net->dev_addr) == 0) {
-@@ -1086,6 +1142,12 @@
- return 0;
- }
-
-+#ifdef CONFIG_NET_POLL_CONTROLLER
-+static void smsc95xx_poll_dummy(struct net_device *netdev)
-+{
-+}
-+#endif
-+
- static const struct net_device_ops smsc95xx_netdev_ops = {
- .ndo_open = usbnet_open,
- .ndo_stop = usbnet_stop,
-@@ -1097,6 +1159,9 @@
- .ndo_do_ioctl = smsc95xx_ioctl,
- .ndo_set_rx_mode = smsc95xx_set_multicast,
- .ndo_set_features = smsc95xx_set_features,
-+#ifdef CONFIG_NET_POLL_CONTROLLER
-+ .ndo_poll_controller = smsc95xx_poll_dummy,
-+#endif
- };
-
- static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
-@@ -1785,7 +1850,6 @@
+@@ -1785,7 +1841,6 @@
if (dev->net->features & NETIF_F_RXCSUM)
smsc95xx_rx_csum_offload(skb);
skb_trim(skb, skb->len - 4); /* remove fcs */
@@ -51713,7 +51654,7 @@ diff -Nur linux-4.1.3/drivers/net/usb/smsc95xx.c linux-xbian-rpi/drivers/net/usb
return 1;
}
-@@ -1803,7 +1867,6 @@
+@@ -1803,7 +1858,6 @@
if (dev->net->features & NETIF_F_RXCSUM)
smsc95xx_rx_csum_offload(ax_skb);
skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */
@@ -51721,22 +51662,23 @@ diff -Nur linux-4.1.3/drivers/net/usb/smsc95xx.c linux-xbian-rpi/drivers/net/usb
usbnet_skb_return(dev, ax_skb);
}
-diff -Nur linux-4.1.3/drivers/net/wireless/Kconfig linux-xbian-rpi/drivers/net/wireless/Kconfig
---- linux-4.1.3/drivers/net/wireless/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/net/wireless/Kconfig 2015-07-28 01:20:58.293696864 +0200
-@@ -277,7 +277,8 @@
+diff -Nur linux-4.1.6/drivers/net/wireless/Kconfig linux-rpi/drivers/net/wireless/Kconfig
+--- linux-4.1.6/drivers/net/wireless/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/net/wireless/Kconfig 2015-08-26 10:26:08.617314440 +0200
+@@ -277,7 +277,9 @@
source "drivers/net/wireless/orinoco/Kconfig"
source "drivers/net/wireless/p54/Kconfig"
source "drivers/net/wireless/rt2x00/Kconfig"
-source "drivers/net/wireless/rtlwifi/Kconfig"
++source "drivers/net/wireless/mediatek/Kconfig"
+#source "drivers/net/wireless/rtlwifi/Kconfig"
+source "drivers/net/wireless/rtl8192cu/Kconfig"
source "drivers/net/wireless/ti/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig"
source "drivers/net/wireless/mwifiex/Kconfig"
-diff -Nur linux-4.1.3/drivers/net/wireless/Makefile linux-xbian-rpi/drivers/net/wireless/Makefile
---- linux-4.1.3/drivers/net/wireless/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/net/wireless/Makefile 2015-07-28 01:20:58.293696864 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/Makefile linux-rpi/drivers/net/wireless/Makefile
+--- linux-4.1.6/drivers/net/wireless/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/net/wireless/Makefile 2015-08-26 10:26:08.617314440 +0200
@@ -24,7 +24,8 @@
obj-$(CONFIG_ZD1211RW) += zd1211rw/
obj-$(CONFIG_RTL8180) += rtl818x/
@@ -51747,18 +51689,8703 @@ diff -Nur linux-4.1.3/drivers/net/wireless/Makefile linux-xbian-rpi/drivers/net/
# 16-bit wireless PCMCIA client drivers
obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/clean linux-xbian-rpi/drivers/net/wireless/rtl8192cu/clean
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/clean 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/clean 2015-07-28 01:20:58.297682643 +0200
+@@ -45,6 +46,8 @@
+ obj-$(CONFIG_IWLEGACY) += iwlegacy/
+ obj-$(CONFIG_RT2X00) += rt2x00/
+
++obj-$(CONFIG_WL_MEDIATEK) += mediatek/
++
+ obj-$(CONFIG_P54_COMMON) += p54/
+
+ obj-$(CONFIG_ATH_CARDS) += ath/
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/Kconfig linux-rpi/drivers/net/wireless/mediatek/Kconfig
+--- linux-4.1.6/drivers/net/wireless/mediatek/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/Kconfig 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,10 @@
++menuconfig WL_MEDIATEK
++ bool "Mediatek Wireless LAN support"
++ ---help---
++ Enable community drivers for MediaTek WiFi devices.
++ Those drivers make use of the Linux mac80211 stack.
++
++
++if WL_MEDIATEK
++source "drivers/net/wireless/mediatek/mt7601u/Kconfig"
++endif # WL_MEDIATEK
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/Makefile linux-rpi/drivers/net/wireless/mediatek/Makefile
+--- linux-4.1.6/drivers/net/wireless/mediatek/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/Makefile 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1 @@
++obj-$(CONFIG_MT7601U) += mt7601u/
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/Kconfig linux-rpi/drivers/net/wireless/mediatek/mt7601u/Kconfig
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/Kconfig 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,6 @@
++config MT7601U
++ tristate "MediaTek MT7601U (USB) support"
++ depends on MAC80211
++ depends on USB
++ ---help---
++ This adds support for MT7601U-based wireless USB dongles.
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/Makefile linux-rpi/drivers/net/wireless/mediatek/mt7601u/Makefile
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/Makefile 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,9 @@
++ccflags-y += -D__CHECK_ENDIAN__
++
++obj-$(CONFIG_MT7601U) += mt7601u.o
++
++mt7601u-objs = \
++ usb.o init.o main.o mcu.o trace.o dma.o core.o eeprom.o phy.o \
++ mac.o util.o debugfs.o tx.o
++
++CFLAGS_trace.o := -I$(src)
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/core.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/core.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/core.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/core.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,78 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++
++int mt7601u_wait_asic_ready(struct mt7601u_dev *dev)
++{
++ int i = 100;
++ u32 val;
++
++ do {
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return -EIO;
++
++ val = mt7601u_rr(dev, MT_MAC_CSR0);
++ if (val && ~val)
++ return 0;
++
++ udelay(10);
++ } while (i--);
++
++ return -EIO;
++}
++
++bool mt76_poll(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val,
++ int timeout)
++{
++ u32 cur;
++
++ timeout /= 10;
++ do {
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return false;
++
++ cur = mt7601u_rr(dev, offset) & mask;
++ if (cur == val)
++ return true;
++
++ udelay(10);
++ } while (timeout-- > 0);
++
++ dev_err(dev->dev, "Error: Time out with reg %08x\n", offset);
++
++ return false;
++}
++
++bool mt76_poll_msec(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val,
++ int timeout)
++{
++ u32 cur;
++
++ timeout /= 10;
++ do {
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return false;
++
++ cur = mt7601u_rr(dev, offset) & mask;
++ if (cur == val)
++ return true;
++
++ msleep(10);
++ } while (timeout-- > 0);
++
++ dev_err(dev->dev, "Error: Time out with reg %08x\n", offset);
++
++ return false;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/debugfs.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/debugfs.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/debugfs.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/debugfs.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,172 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include <linux/debugfs.h>
++
++#include "mt7601u.h"
++#include "eeprom.h"
++
++static int
++mt76_reg_set(void *data, u64 val)
++{
++ struct mt7601u_dev *dev = data;
++
++ mt76_wr(dev, dev->debugfs_reg, val);
++ return 0;
++}
++
++static int
++mt76_reg_get(void *data, u64 *val)
++{
++ struct mt7601u_dev *dev = data;
++
++ *val = mt76_rr(dev, dev->debugfs_reg);
++ return 0;
++}
++
++DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
++
++static int
++mt7601u_ampdu_stat_read(struct seq_file *file, void *data)
++{
++ struct mt7601u_dev *dev = file->private;
++ int i, j;
++
++#define stat_printf(grp, off, name) \
++ seq_printf(file, #name ":\t%llu\n", dev->stats.grp[off])
++
++ stat_printf(rx_stat, 0, rx_crc_err);
++ stat_printf(rx_stat, 1, rx_phy_err);
++ stat_printf(rx_stat, 2, rx_false_cca);
++ stat_printf(rx_stat, 3, rx_plcp_err);
++ stat_printf(rx_stat, 4, rx_fifo_overflow);
++ stat_printf(rx_stat, 5, rx_duplicate);
++
++ stat_printf(tx_stat, 0, tx_fail_cnt);
++ stat_printf(tx_stat, 1, tx_bcn_cnt);
++ stat_printf(tx_stat, 2, tx_success);
++ stat_printf(tx_stat, 3, tx_retransmit);
++ stat_printf(tx_stat, 4, tx_zero_len);
++ stat_printf(tx_stat, 5, tx_underflow);
++
++ stat_printf(aggr_stat, 0, non_aggr_tx);
++ stat_printf(aggr_stat, 1, aggr_tx);
++
++ stat_printf(zero_len_del, 0, tx_zero_len_del);
++ stat_printf(zero_len_del, 1, rx_zero_len_del);
++#undef stat_printf
++
++ seq_puts(file, "Aggregations stats:\n");
++ for (i = 0; i < 4; i++) {
++ for (j = 0; j < 8; j++)
++ seq_printf(file, "%08llx ",
++ dev->stats.aggr_n[i * 8 + j]);
++ seq_putc(file, '\n');
++ }
++
++ seq_printf(file, "recent average AMPDU len: %d\n",
++ atomic_read(&dev->avg_ampdu_len));
++
++ return 0;
++}
++
++static int
++mt7601u_ampdu_stat_open(struct inode *inode, struct file *f)
++{
++ return single_open(f, mt7601u_ampdu_stat_read, inode->i_private);
++}
++
++static const struct file_operations fops_ampdu_stat = {
++ .open = mt7601u_ampdu_stat_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int
++mt7601u_eeprom_param_read(struct seq_file *file, void *data)
++{
++ struct mt7601u_dev *dev = file->private;
++ struct mt7601u_rate_power *rp = &dev->ee->power_rate_table;
++ struct tssi_data *td = &dev->ee->tssi_data;
++ int i;
++
++ seq_printf(file, "RF freq offset: %hhx\n", dev->ee->rf_freq_off);
++ seq_printf(file, "RSSI offset: %hhx %hhx\n",
++ dev->ee->rssi_offset[0], dev->ee->rssi_offset[1]);
++ seq_printf(file, "Reference temp: %hhx\n", dev->ee->ref_temp);
++ seq_printf(file, "LNA gain: %hhx\n", dev->ee->lna_gain);
++ seq_printf(file, "Reg channels: %hhu-%hhu\n", dev->ee->reg.start,
++ dev->ee->reg.start + dev->ee->reg.num - 1);
++
++ seq_puts(file, "Per rate power:\n");
++ for (i = 0; i < 2; i++)
++ seq_printf(file, "\t raw:%02hhx bw20:%02hhx bw40:%02hhx\n",
++ rp->cck[i].raw, rp->cck[i].bw20, rp->cck[i].bw40);
++ for (i = 0; i < 4; i++)
++ seq_printf(file, "\t raw:%02hhx bw20:%02hhx bw40:%02hhx\n",
++ rp->ofdm[i].raw, rp->ofdm[i].bw20, rp->ofdm[i].bw40);
++ for (i = 0; i < 4; i++)
++ seq_printf(file, "\t raw:%02hhx bw20:%02hhx bw40:%02hhx\n",
++ rp->ht[i].raw, rp->ht[i].bw20, rp->ht[i].bw40);
++
++ seq_puts(file, "Per channel power:\n");
++ for (i = 0; i < 7; i++)
++ seq_printf(file, "\t tx_power ch%u:%02hhx ch%u:%02hhx\n",
++ i * 2 + 1, dev->ee->chan_pwr[i * 2],
++ i * 2 + 2, dev->ee->chan_pwr[i * 2 + 1]);
++
++ if (!dev->ee->tssi_enabled)
++ return 0;
++
++ seq_puts(file, "TSSI:\n");
++ seq_printf(file, "\t slope:%02hhx\n", td->slope);
++ seq_printf(file, "\t offset=%02hhx %02hhx %02hhx\n",
++ td->offset[0], td->offset[1], td->offset[2]);
++ seq_printf(file, "\t delta_off:%08x\n", td->tx0_delta_offset);
++
++ return 0;
++}
++
++static int
++mt7601u_eeprom_param_open(struct inode *inode, struct file *f)
++{
++ return single_open(f, mt7601u_eeprom_param_read, inode->i_private);
++}
++
++static const struct file_operations fops_eeprom_param = {
++ .open = mt7601u_eeprom_param_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++void mt7601u_init_debugfs(struct mt7601u_dev *dev)
++{
++ struct dentry *dir;
++
++ dir = debugfs_create_dir("mt7601u", dev->hw->wiphy->debugfsdir);
++ if (!dir)
++ return;
++
++ debugfs_create_u8("temperature", S_IRUSR, dir, &dev->raw_temp);
++ debugfs_create_u32("temp_mode", S_IRUSR, dir, &dev->temp_mode);
++
++ debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg);
++ debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev,
++ &fops_regval);
++ debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
++ debugfs_create_file("eeprom_param", S_IRUSR, dir, dev,
++ &fops_eeprom_param);
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/dma.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/dma.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/dma.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/dma.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,505 @@
++/*
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++#include "dma.h"
++#include "usb.h"
++#include "trace.h"
++
++static int mt7601u_submit_rx_buf(struct mt7601u_dev *dev,
++ struct mt7601u_dma_buf_rx *e, gfp_t gfp);
++
++static unsigned int ieee80211_get_hdrlen_from_buf(const u8 *data, unsigned len)
++{
++ const struct ieee80211_hdr *hdr = (const struct ieee80211_hdr *)data;
++ unsigned int hdrlen;
++
++ if (unlikely(len < 10))
++ return 0;
++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
++ if (unlikely(hdrlen > len))
++ return 0;
++ return hdrlen;
++}
++
++static struct sk_buff *
++mt7601u_rx_skb_from_seg(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi,
++ void *data, u32 seg_len, u32 truesize, struct page *p)
++{
++ struct sk_buff *skb;
++ u32 true_len, hdr_len = 0, copy, frag;
++
++ skb = alloc_skb(p ? 128 : seg_len, GFP_ATOMIC);
++ if (!skb)
++ return NULL;
++
++ true_len = mt76_mac_process_rx(dev, skb, data, rxwi);
++ if (!true_len || true_len > seg_len)
++ goto bad_frame;
++
++ hdr_len = ieee80211_get_hdrlen_from_buf(data, true_len);
++ if (!hdr_len)
++ goto bad_frame;
++
++ if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD)) {
++ memcpy(skb_put(skb, hdr_len), data, hdr_len);
++
++ data += hdr_len + 2;
++ true_len -= hdr_len;
++ hdr_len = 0;
++ }
++
++ /* If not doing paged RX allocated skb will always have enough space */
++ copy = (true_len <= skb_tailroom(skb)) ? true_len : hdr_len + 8;
++ frag = true_len - copy;
++
++ memcpy(skb_put(skb, copy), data, copy);
++ data += copy;
++
++ if (frag) {
++ skb_add_rx_frag(skb, 0, p, data - page_address(p),
++ frag, truesize);
++ get_page(p);
++ }
++
++ return skb;
++
++bad_frame:
++ dev_err_ratelimited(dev->dev, "Error: incorrect frame len:%u hdr:%u\n",
++ true_len, hdr_len);
++ dev_kfree_skb(skb);
++ return NULL;
++}
++
++static void mt7601u_rx_process_seg(struct mt7601u_dev *dev, u8 *data,
++ u32 seg_len, struct page *p)
++{
++ struct sk_buff *skb;
++ struct mt7601u_rxwi *rxwi;
++ u32 fce_info, truesize = seg_len;
++
++ /* DMA_INFO field at the beginning of the segment contains only some of
++ * the information, we need to read the FCE descriptor from the end.
++ */
++ fce_info = get_unaligned_le32(data + seg_len - MT_FCE_INFO_LEN);
++ seg_len -= MT_FCE_INFO_LEN;
++
++ data += MT_DMA_HDR_LEN;
++ seg_len -= MT_DMA_HDR_LEN;
++
++ rxwi = (struct mt7601u_rxwi *) data;
++ data += sizeof(struct mt7601u_rxwi);
++ seg_len -= sizeof(struct mt7601u_rxwi);
++
++ if (unlikely(rxwi->zero[0] || rxwi->zero[1] || rxwi->zero[2]))
++ dev_err_once(dev->dev, "Error: RXWI zero fields are set\n");
++ if (unlikely(MT76_GET(MT_RXD_INFO_TYPE, fce_info)))
++ dev_err_once(dev->dev, "Error: RX path seen a non-pkt urb\n");
++
++ trace_mt_rx(dev, rxwi, fce_info);
++
++ skb = mt7601u_rx_skb_from_seg(dev, rxwi, data, seg_len, truesize, p);
++ if (!skb)
++ return;
++
++ ieee80211_rx_ni(dev->hw, skb);
++}
++
++static u16 mt7601u_rx_next_seg_len(u8 *data, u32 data_len)
++{
++ u32 min_seg_len = MT_DMA_HDR_LEN + MT_RX_INFO_LEN +
++ sizeof(struct mt7601u_rxwi) + MT_FCE_INFO_LEN;
++ u16 dma_len = get_unaligned_le16(data);
++
++ if (data_len < min_seg_len ||
++ WARN_ON(!dma_len) ||
++ WARN_ON(dma_len + MT_DMA_HDRS > data_len) ||
++ WARN_ON(dma_len & 0x3))
++ return 0;
++
++ return MT_DMA_HDRS + dma_len;
++}
++
++static void
++mt7601u_rx_process_entry(struct mt7601u_dev *dev, struct mt7601u_dma_buf_rx *e)
++{
++ u32 seg_len, data_len = e->urb->actual_length;
++ u8 *data = page_address(e->p);
++ struct page *new_p = NULL;
++ int cnt = 0;
++
++ if (!test_bit(MT7601U_STATE_INITIALIZED, &dev->state))
++ return;
++
++ /* Copy if there is very little data in the buffer. */
++ if (data_len > 512)
++ new_p = dev_alloc_pages(MT_RX_ORDER);
++
++ while ((seg_len = mt7601u_rx_next_seg_len(data, data_len))) {
++ mt7601u_rx_process_seg(dev, data, seg_len, new_p ? e->p : NULL);
++
++ data_len -= seg_len;
++ data += seg_len;
++ cnt++;
++ }
++
++ if (cnt > 1)
++ trace_mt_rx_dma_aggr(dev, cnt, !!new_p);
++
++ if (new_p) {
++ /* we have one extra ref from the allocator */
++ __free_pages(e->p, MT_RX_ORDER);
++
++ e->p = new_p;
++ }
++}
++
++static struct mt7601u_dma_buf_rx *
++mt7601u_rx_get_pending_entry(struct mt7601u_dev *dev)
++{
++ struct mt7601u_rx_queue *q = &dev->rx_q;
++ struct mt7601u_dma_buf_rx *buf = NULL;
++ unsigned long flags;
++
++ spin_lock_irqsave(&dev->rx_lock, flags);
++
++ if (!q->pending)
++ goto out;
++
++ buf = &q->e[q->start];
++ q->pending--;
++ q->start = (q->start + 1) % q->entries;
++out:
++ spin_unlock_irqrestore(&dev->rx_lock, flags);
++
++ return buf;
++}
++
++static void mt7601u_complete_rx(struct urb *urb)
++{
++ struct mt7601u_dev *dev = urb->context;
++ struct mt7601u_rx_queue *q = &dev->rx_q;
++ unsigned long flags;
++
++ spin_lock_irqsave(&dev->rx_lock, flags);
++
++ if (mt7601u_urb_has_error(urb))
++ dev_err(dev->dev, "Error: RX urb failed:%d\n", urb->status);
++ if (WARN_ONCE(q->e[q->end].urb != urb, "RX urb mismatch"))
++ goto out;
++
++ q->end = (q->end + 1) % q->entries;
++ q->pending++;
++ tasklet_schedule(&dev->rx_tasklet);
++out:
++ spin_unlock_irqrestore(&dev->rx_lock, flags);
++}
++
++static void mt7601u_rx_tasklet(unsigned long data)
++{
++ struct mt7601u_dev *dev = (struct mt7601u_dev *) data;
++ struct mt7601u_dma_buf_rx *e;
++
++ while ((e = mt7601u_rx_get_pending_entry(dev))) {
++ if (e->urb->status)
++ continue;
++
++ mt7601u_rx_process_entry(dev, e);
++ mt7601u_submit_rx_buf(dev, e, GFP_ATOMIC);
++ }
++}
++
++static void mt7601u_complete_tx(struct urb *urb)
++{
++ struct mt7601u_tx_queue *q = urb->context;
++ struct mt7601u_dev *dev = q->dev;
++ struct sk_buff *skb;
++ unsigned long flags;
++
++ spin_lock_irqsave(&dev->tx_lock, flags);
++
++ if (mt7601u_urb_has_error(urb))
++ dev_err(dev->dev, "Error: TX urb failed:%d\n", urb->status);
++ if (WARN_ONCE(q->e[q->start].urb != urb, "TX urb mismatch"))
++ goto out;
++
++ skb = q->e[q->start].skb;
++ trace_mt_tx_dma_done(dev, skb);
++
++ mt7601u_tx_status(dev, skb);
++
++ if (q->used == q->entries - q->entries / 8)
++ ieee80211_wake_queue(dev->hw, skb_get_queue_mapping(skb));
++
++ q->start = (q->start + 1) % q->entries;
++ q->used--;
++
++ if (urb->status)
++ goto out;
++
++ set_bit(MT7601U_STATE_MORE_STATS, &dev->state);
++ if (!test_and_set_bit(MT7601U_STATE_READING_STATS, &dev->state))
++ queue_delayed_work(dev->stat_wq, &dev->stat_work,
++ msecs_to_jiffies(10));
++out:
++ spin_unlock_irqrestore(&dev->tx_lock, flags);
++}
++
++static int mt7601u_dma_submit_tx(struct mt7601u_dev *dev,
++ struct sk_buff *skb, u8 ep)
++{
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++ unsigned snd_pipe = usb_sndbulkpipe(usb_dev, dev->out_eps[ep]);
++ struct mt7601u_dma_buf_tx *e;
++ struct mt7601u_tx_queue *q = &dev->tx_q[ep];
++ unsigned long flags;
++ int ret;
++
++ spin_lock_irqsave(&dev->tx_lock, flags);
++
++ if (WARN_ON(q->entries <= q->used)) {
++ ret = -ENOSPC;
++ goto out;
++ }
++
++ e = &q->e[q->end];
++ e->skb = skb;
++ usb_fill_bulk_urb(e->urb, usb_dev, snd_pipe, skb->data, skb->len,
++ mt7601u_complete_tx, q);
++ ret = usb_submit_urb(e->urb, GFP_ATOMIC);
++ if (ret) {
++ /* Special-handle ENODEV from TX urb submission because it will
++ * often be the first ENODEV we see after device is removed.
++ */
++ if (ret == -ENODEV)
++ set_bit(MT7601U_STATE_REMOVED, &dev->state);
++ else
++ dev_err(dev->dev, "Error: TX urb submit failed:%d\n",
++ ret);
++ goto out;
++ }
++
++ q->end = (q->end + 1) % q->entries;
++ q->used++;
++
++ if (q->used >= q->entries)
++ ieee80211_stop_queue(dev->hw, skb_get_queue_mapping(skb));
++out:
++ spin_unlock_irqrestore(&dev->tx_lock, flags);
++
++ return ret;
++}
++
++/* Map hardware Q to USB endpoint number */
++static u8 q2ep(u8 qid)
++{
++ /* TODO: take management packets to queue 5 */
++ return qid + 1;
++}
++
++/* Map USB endpoint number to Q id in the DMA engine */
++static enum mt76_qsel ep2dmaq(u8 ep)
++{
++ if (ep == 5)
++ return MT_QSEL_MGMT;
++ return MT_QSEL_EDCA;
++}
++
++int mt7601u_dma_enqueue_tx(struct mt7601u_dev *dev, struct sk_buff *skb,
++ struct mt76_wcid *wcid, int hw_q)
++{
++ u8 ep = q2ep(hw_q);
++ u32 dma_flags;
++ int ret;
++
++ dma_flags = MT_TXD_PKT_INFO_80211;
++ if (wcid->hw_key_idx == 0xff)
++ dma_flags |= MT_TXD_PKT_INFO_WIV;
++
++ ret = mt7601u_dma_skb_wrap_pkt(skb, ep2dmaq(ep), dma_flags);
++ if (ret)
++ return ret;
++
++ ret = mt7601u_dma_submit_tx(dev, skb, ep);
++ if (ret) {
++ ieee80211_free_txskb(dev->hw, skb);
++ return ret;
++ }
++
++ return 0;
++}
++
++static void mt7601u_kill_rx(struct mt7601u_dev *dev)
++{
++ int i;
++ unsigned long flags;
++
++ spin_lock_irqsave(&dev->rx_lock, flags);
++
++ for (i = 0; i < dev->rx_q.entries; i++) {
++ int next = dev->rx_q.end;
++
++ spin_unlock_irqrestore(&dev->rx_lock, flags);
++ usb_poison_urb(dev->rx_q.e[next].urb);
++ spin_lock_irqsave(&dev->rx_lock, flags);
++ }
++
++ spin_unlock_irqrestore(&dev->rx_lock, flags);
++}
++
++static int mt7601u_submit_rx_buf(struct mt7601u_dev *dev,
++ struct mt7601u_dma_buf_rx *e, gfp_t gfp)
++{
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++ u8 *buf = page_address(e->p);
++ unsigned pipe;
++ int ret;
++
++ pipe = usb_rcvbulkpipe(usb_dev, dev->in_eps[MT_EP_IN_PKT_RX]);
++
++ usb_fill_bulk_urb(e->urb, usb_dev, pipe, buf, MT_RX_URB_SIZE,
++ mt7601u_complete_rx, dev);
++
++ trace_mt_submit_urb(dev, e->urb);
++ ret = usb_submit_urb(e->urb, gfp);
++ if (ret)
++ dev_err(dev->dev, "Error: submit RX URB failed:%d\n", ret);
++
++ return ret;
++}
++
++static int mt7601u_submit_rx(struct mt7601u_dev *dev)
++{
++ int i, ret;
++
++ for (i = 0; i < dev->rx_q.entries; i++) {
++ ret = mt7601u_submit_rx_buf(dev, &dev->rx_q.e[i], GFP_KERNEL);
++ if (ret)
++ return ret;
++ }
++
++ return 0;
++}
++
++static void mt7601u_free_rx(struct mt7601u_dev *dev)
++{
++ int i;
++
++ for (i = 0; i < dev->rx_q.entries; i++) {
++ __free_pages(dev->rx_q.e[i].p, MT_RX_ORDER);
++ usb_free_urb(dev->rx_q.e[i].urb);
++ }
++}
++
++static int mt7601u_alloc_rx(struct mt7601u_dev *dev)
++{
++ int i;
++
++ memset(&dev->rx_q, 0, sizeof(dev->rx_q));
++ dev->rx_q.dev = dev;
++ dev->rx_q.entries = N_RX_ENTRIES;
++
++ for (i = 0; i < N_RX_ENTRIES; i++) {
++ dev->rx_q.e[i].urb = usb_alloc_urb(0, GFP_KERNEL);
++ dev->rx_q.e[i].p = dev_alloc_pages(MT_RX_ORDER);
++
++ if (!dev->rx_q.e[i].urb || !dev->rx_q.e[i].p)
++ return -ENOMEM;
++ }
++
++ return 0;
++}
++
++static void mt7601u_free_tx_queue(struct mt7601u_tx_queue *q)
++{
++ int i;
++
++ WARN_ON(q->used);
++
++ for (i = 0; i < q->entries; i++) {
++ usb_poison_urb(q->e[i].urb);
++ usb_free_urb(q->e[i].urb);
++ }
++}
++
++static void mt7601u_free_tx(struct mt7601u_dev *dev)
++{
++ int i;
++
++ for (i = 0; i < __MT_EP_OUT_MAX; i++)
++ mt7601u_free_tx_queue(&dev->tx_q[i]);
++}
++
++static int mt7601u_alloc_tx_queue(struct mt7601u_dev *dev,
++ struct mt7601u_tx_queue *q)
++{
++ int i;
++
++ q->dev = dev;
++ q->entries = N_TX_ENTRIES;
++
++ for (i = 0; i < N_TX_ENTRIES; i++) {
++ q->e[i].urb = usb_alloc_urb(0, GFP_KERNEL);
++ if (!q->e[i].urb)
++ return -ENOMEM;
++ }
++
++ return 0;
++}
++
++static int mt7601u_alloc_tx(struct mt7601u_dev *dev)
++{
++ int i;
++
++ dev->tx_q = devm_kcalloc(dev->dev, __MT_EP_OUT_MAX,
++ sizeof(*dev->tx_q), GFP_KERNEL);
++
++ for (i = 0; i < __MT_EP_OUT_MAX; i++)
++ if (mt7601u_alloc_tx_queue(dev, &dev->tx_q[i]))
++ return -ENOMEM;
++
++ return 0;
++}
++
++int mt7601u_dma_init(struct mt7601u_dev *dev)
++{
++ int ret = -ENOMEM;
++
++ tasklet_init(&dev->rx_tasklet, mt7601u_rx_tasklet, (unsigned long) dev);
++
++ ret = mt7601u_alloc_tx(dev);
++ if (ret)
++ goto err;
++ ret = mt7601u_alloc_rx(dev);
++ if (ret)
++ goto err;
++
++ ret = mt7601u_submit_rx(dev);
++ if (ret)
++ goto err;
++
++ return 0;
++err:
++ mt7601u_dma_cleanup(dev);
++ return ret;
++}
++
++void mt7601u_dma_cleanup(struct mt7601u_dev *dev)
++{
++ mt7601u_kill_rx(dev);
++
++ tasklet_kill(&dev->rx_tasklet);
++
++ mt7601u_free_rx(dev);
++ mt7601u_free_tx(dev);
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/dma.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/dma.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/dma.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/dma.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,127 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT7601U_DMA_H
++#define __MT7601U_DMA_H
++
++#include <asm/unaligned.h>
++#include <linux/skbuff.h>
++
++#include "util.h"
++
++#define MT_DMA_HDR_LEN 4
++#define MT_RX_INFO_LEN 4
++#define MT_FCE_INFO_LEN 4
++#define MT_DMA_HDRS (MT_DMA_HDR_LEN + MT_RX_INFO_LEN)
++
++/* Common Tx DMA descriptor fields */
++#define MT_TXD_INFO_LEN GENMASK(15, 0)
++#define MT_TXD_INFO_D_PORT GENMASK(29, 27)
++#define MT_TXD_INFO_TYPE GENMASK(31, 30)
++
++enum mt76_msg_port {
++ WLAN_PORT,
++ CPU_RX_PORT,
++ CPU_TX_PORT,
++ HOST_PORT,
++ VIRTUAL_CPU_RX_PORT,
++ VIRTUAL_CPU_TX_PORT,
++ DISCARD,
++};
++
++enum mt76_info_type {
++ DMA_PACKET,
++ DMA_COMMAND,
++};
++
++/* Tx DMA packet specific flags */
++#define MT_TXD_PKT_INFO_NEXT_VLD BIT(16)
++#define MT_TXD_PKT_INFO_TX_BURST BIT(17)
++#define MT_TXD_PKT_INFO_80211 BIT(19)
++#define MT_TXD_PKT_INFO_TSO BIT(20)
++#define MT_TXD_PKT_INFO_CSO BIT(21)
++#define MT_TXD_PKT_INFO_WIV BIT(24)
++#define MT_TXD_PKT_INFO_QSEL GENMASK(26, 25)
++
++enum mt76_qsel {
++ MT_QSEL_MGMT,
++ MT_QSEL_HCCA,
++ MT_QSEL_EDCA,
++ MT_QSEL_EDCA_2,
++};
++
++/* Tx DMA MCU command specific flags */
++#define MT_TXD_CMD_INFO_SEQ GENMASK(19, 16)
++#define MT_TXD_CMD_INFO_TYPE GENMASK(26, 20)
++
++static inline int mt7601u_dma_skb_wrap(struct sk_buff *skb,
++ enum mt76_msg_port d_port,
++ enum mt76_info_type type, u32 flags)
++{
++ u32 info;
++
++ /* Buffer layout:
++ * | 4B | xfer len | pad | 4B |
++ * | TXINFO | pkt/cmd | zero pad to 4B | zero |
++ *
++ * length field of TXINFO should be set to 'xfer len'.
++ */
++
++ info = flags |
++ MT76_SET(MT_TXD_INFO_LEN, round_up(skb->len, 4)) |
++ MT76_SET(MT_TXD_INFO_D_PORT, d_port) |
++ MT76_SET(MT_TXD_INFO_TYPE, type);
++
++ put_unaligned_le32(info, skb_push(skb, sizeof(info)));
++ return skb_put_padto(skb, round_up(skb->len, 4) + 4);
++}
++
++static inline int
++mt7601u_dma_skb_wrap_pkt(struct sk_buff *skb, enum mt76_qsel qsel, u32 flags)
++{
++ flags |= MT76_SET(MT_TXD_PKT_INFO_QSEL, qsel);
++ return mt7601u_dma_skb_wrap(skb, WLAN_PORT, DMA_PACKET, flags);
++}
++
++/* Common Rx DMA descriptor fields */
++#define MT_RXD_INFO_LEN GENMASK(13, 0)
++#define MT_RXD_INFO_PCIE_INTR BIT(24)
++#define MT_RXD_INFO_QSEL GENMASK(26, 25)
++#define MT_RXD_INFO_PORT GENMASK(29, 27)
++#define MT_RXD_INFO_TYPE GENMASK(31, 30)
++
++/* Rx DMA packet specific flags */
++#define MT_RXD_PKT_INFO_UDP_ERR BIT(16)
++#define MT_RXD_PKT_INFO_TCP_ERR BIT(17)
++#define MT_RXD_PKT_INFO_IP_ERR BIT(18)
++#define MT_RXD_PKT_INFO_PKT_80211 BIT(19)
++#define MT_RXD_PKT_INFO_L3L4_DONE BIT(20)
++#define MT_RXD_PKT_INFO_MAC_LEN GENMASK(23, 21)
++
++/* Rx DMA MCU command specific flags */
++#define MT_RXD_CMD_INFO_SELF_GEN BIT(15)
++#define MT_RXD_CMD_INFO_CMD_SEQ GENMASK(19, 16)
++#define MT_RXD_CMD_INFO_EVT_TYPE GENMASK(23, 20)
++
++enum mt76_evt_type {
++ CMD_DONE,
++ CMD_ERROR,
++ CMD_RETRY,
++ EVENT_PWR_RSP,
++ EVENT_WOW_RSP,
++ EVENT_CARRIER_DETECT_RSP,
++ EVENT_DFS_DETECT_RSP,
++};
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/eeprom.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/eeprom.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/eeprom.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/eeprom.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,418 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include <linux/of.h>
++#include <linux/mtd/mtd.h>
++#include <linux/mtd/partitions.h>
++#include <linux/etherdevice.h>
++#include <asm/unaligned.h>
++#include "mt7601u.h"
++#include "eeprom.h"
++
++static bool
++field_valid(u8 val)
++{
++ return val != 0xff;
++}
++
++static s8
++field_validate(u8 val)
++{
++ if (!field_valid(val))
++ return 0;
++
++ return val;
++}
++
++static int
++mt7601u_efuse_read(struct mt7601u_dev *dev, u16 addr, u8 *data,
++ enum mt7601u_eeprom_access_modes mode)
++{
++ u32 val;
++ int i;
++
++ val = mt76_rr(dev, MT_EFUSE_CTRL);
++ val &= ~(MT_EFUSE_CTRL_AIN |
++ MT_EFUSE_CTRL_MODE);
++ val |= MT76_SET(MT_EFUSE_CTRL_AIN, addr & ~0xf) |
++ MT76_SET(MT_EFUSE_CTRL_MODE, mode) |
++ MT_EFUSE_CTRL_KICK;
++ mt76_wr(dev, MT_EFUSE_CTRL, val);
++
++ if (!mt76_poll(dev, MT_EFUSE_CTRL, MT_EFUSE_CTRL_KICK, 0, 1000))
++ return -ETIMEDOUT;
++
++ val = mt76_rr(dev, MT_EFUSE_CTRL);
++ if ((val & MT_EFUSE_CTRL_AOUT) == MT_EFUSE_CTRL_AOUT) {
++ /* Parts of eeprom not in the usage map (0x80-0xc0,0xf0)
++ * will not return valid data but it's ok.
++ */
++ memset(data, 0xff, 16);
++ return 0;
++ }
++
++ for (i = 0; i < 4; i++) {
++ val = mt76_rr(dev, MT_EFUSE_DATA(i));
++ put_unaligned_le32(val, data + 4 * i);
++ }
++
++ return 0;
++}
++
++static int
++mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
++{
++ const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
++ u8 data[map_reads * 16];
++ int ret, i;
++ u32 start = 0, end = 0, cnt_free;
++
++ for (i = 0; i < map_reads; i++) {
++ ret = mt7601u_efuse_read(dev, MT_EE_USAGE_MAP_START + i * 16,
++ data + i * 16, MT_EE_PHYSICAL_READ);
++ if (ret)
++ return ret;
++ }
++
++ for (i = 0; i < MT_EFUSE_USAGE_MAP_SIZE; i++)
++ if (!data[i]) {
++ if (!start)
++ start = MT_EE_USAGE_MAP_START + i;
++ end = MT_EE_USAGE_MAP_START + i;
++ }
++ cnt_free = end - start + 1;
++
++ if (MT_EFUSE_USAGE_MAP_SIZE - cnt_free < 5) {
++ dev_err(dev->dev, "Error: your device needs default EEPROM file and this driver doesn't support it!\n");
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
++static bool
++mt7601u_has_tssi(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ u16 nic_conf1 = get_unaligned_le16(eeprom + MT_EE_NIC_CONF_1);
++
++ return ~nic_conf1 && (nic_conf1 & MT_EE_NIC_CONF_1_TX_ALC_EN);
++}
++
++static void
++mt7601u_set_chip_cap(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ u16 nic_conf0 = get_unaligned_le16(eeprom + MT_EE_NIC_CONF_0);
++ u16 nic_conf1 = get_unaligned_le16(eeprom + MT_EE_NIC_CONF_1);
++
++ if (!field_valid(nic_conf1 & 0xff))
++ nic_conf1 &= 0xff00;
++
++ dev->ee->tssi_enabled = mt7601u_has_tssi(dev, eeprom) &&
++ !(nic_conf1 & MT_EE_NIC_CONF_1_TEMP_TX_ALC);
++
++ if (nic_conf1 & MT_EE_NIC_CONF_1_HW_RF_CTRL)
++ dev_err(dev->dev,
++ "Error: this driver does not support HW RF ctrl\n");
++
++ if (!field_valid(nic_conf0 >> 8))
++ return;
++
++ if (MT76_GET(MT_EE_NIC_CONF_0_RX_PATH, nic_conf0) > 1 ||
++ MT76_GET(MT_EE_NIC_CONF_0_TX_PATH, nic_conf0) > 1)
++ dev_err(dev->dev,
++ "Error: device has more than 1 RX/TX stream!\n");
++}
++
++static int
++mt7601u_set_macaddr(struct mt7601u_dev *dev, const u8 *eeprom)
++{
++ const void *src = eeprom + MT_EE_MAC_ADDR;
++
++ ether_addr_copy(dev->macaddr, src);
++
++ if (!is_valid_ether_addr(dev->macaddr)) {
++ eth_random_addr(dev->macaddr);
++ dev_info(dev->dev,
++ "Invalid MAC address, using random address %pM\n",
++ dev->macaddr);
++ }
++
++ mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(dev->macaddr));
++ mt76_wr(dev, MT_MAC_ADDR_DW1, get_unaligned_le16(dev->macaddr + 4) |
++ MT76_SET(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff));
++
++ return 0;
++}
++
++static void mt7601u_set_channel_target_power(struct mt7601u_dev *dev,
++ u8 *eeprom, u8 max_pwr)
++{
++ u8 trgt_pwr = eeprom[MT_EE_TX_TSSI_TARGET_POWER];
++
++ if (trgt_pwr > max_pwr || !trgt_pwr) {
++ dev_warn(dev->dev, "Error: EEPROM trgt power invalid %hhx!\n",
++ trgt_pwr);
++ trgt_pwr = 0x20;
++ }
++
++ memset(dev->ee->chan_pwr, trgt_pwr, sizeof(dev->ee->chan_pwr));
++}
++
++static void
++mt7601u_set_channel_power(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ u32 i, val;
++ u8 max_pwr;
++
++ val = mt7601u_rr(dev, MT_TX_ALC_CFG_0);
++ max_pwr = MT76_GET(MT_TX_ALC_CFG_0_LIMIT_0, val);
++
++ if (mt7601u_has_tssi(dev, eeprom)) {
++ mt7601u_set_channel_target_power(dev, eeprom, max_pwr);
++ return;
++ }
++
++ for (i = 0; i < 14; i++) {
++ s8 power = field_validate(eeprom[MT_EE_TX_POWER_OFFSET + i]);
++
++ if (power > max_pwr || power < 0)
++ power = MT7601U_DEFAULT_TX_POWER;
++
++ dev->ee->chan_pwr[i] = power;
++ }
++}
++
++static void
++mt7601u_set_country_reg(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ /* Note: - region 31 is not valid for mt7601u (see rtmp_init.c)
++ * - comments in rtmp_def.h are incorrect (see rt_channel.c)
++ */
++ static const struct reg_channel_bounds chan_bounds[] = {
++ /* EEPROM country regions 0 - 7 */
++ { 1, 11 }, { 1, 13 }, { 10, 2 }, { 10, 4 },
++ { 14, 1 }, { 1, 14 }, { 3, 7 }, { 5, 9 },
++ /* EEPROM country regions 32 - 33 */
++ { 1, 11 }, { 1, 14 }
++ };
++ u8 val = eeprom[MT_EE_COUNTRY_REGION];
++ int idx = -1;
++
++ if (val < 8)
++ idx = val;
++ if (val > 31 && val < 33)
++ idx = val - 32 + 8;
++
++ if (idx != -1)
++ dev_info(dev->dev,
++ "EEPROM country region %02hhx (channels %hhd-%hhd)\n",
++ val, chan_bounds[idx].start,
++ chan_bounds[idx].start + chan_bounds[idx].num - 1);
++ else
++ idx = 5; /* channels 1 - 14 */
++
++ dev->ee->reg = chan_bounds[idx];
++
++ /* TODO: country region 33 is special - phy should be set to B-mode
++ * before entering channel 14 (see sta/connect.c)
++ */
++}
++
++static void
++mt7601u_set_rf_freq_off(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ u8 comp;
++
++ dev->ee->rf_freq_off = field_validate(eeprom[MT_EE_FREQ_OFFSET]);
++ comp = field_validate(eeprom[MT_EE_FREQ_OFFSET_COMPENSATION]);
++
++ if (comp & BIT(7))
++ dev->ee->rf_freq_off -= comp & 0x7f;
++ else
++ dev->ee->rf_freq_off += comp;
++}
++
++static void
++mt7601u_set_rssi_offset(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ int i;
++ s8 *rssi_offset = dev->ee->rssi_offset;
++
++ for (i = 0; i < 2; i++) {
++ rssi_offset[i] = eeprom[MT_EE_RSSI_OFFSET + i];
++
++ if (rssi_offset[i] < -10 || rssi_offset[i] > 10) {
++ dev_warn(dev->dev,
++ "Warning: EEPROM RSSI is invalid %02hhx\n",
++ rssi_offset[i]);
++ rssi_offset[i] = 0;
++ }
++ }
++}
++
++static void
++mt7601u_extra_power_over_mac(struct mt7601u_dev *dev)
++{
++ u32 val;
++
++ val = ((mt7601u_rr(dev, MT_TX_PWR_CFG_1) & 0x0000ff00) >> 8);
++ val |= ((mt7601u_rr(dev, MT_TX_PWR_CFG_2) & 0x0000ff00) << 8);
++ mt7601u_wr(dev, MT_TX_PWR_CFG_7, val);
++
++ val = ((mt7601u_rr(dev, MT_TX_PWR_CFG_4) & 0x0000ff00) >> 8);
++ mt7601u_wr(dev, MT_TX_PWR_CFG_9, val);
++}
++
++static void
++mt7601u_set_power_rate(struct power_per_rate *rate, s8 delta, u8 value)
++{
++ /* Invalid? Note: vendor driver does not handle this */
++ if (value == 0xff)
++ return;
++
++ rate->raw = s6_validate(value);
++ rate->bw20 = s6_to_int(value);
++ /* Note: vendor driver does cap the value to s6 right away */
++ rate->bw40 = rate->bw20 + delta;
++}
++
++static void
++mt7601u_save_power_rate(struct mt7601u_dev *dev, s8 delta, u32 val, int i)
++{
++ struct mt7601u_rate_power *t = &dev->ee->power_rate_table;
++
++ switch (i) {
++ case 0:
++ mt7601u_set_power_rate(&t->cck[0], delta, (val >> 0) & 0xff);
++ mt7601u_set_power_rate(&t->cck[1], delta, (val >> 8) & 0xff);
++ /* Save cck bw20 for fixups of channel 14 */
++ dev->ee->real_cck_bw20[0] = t->cck[0].bw20;
++ dev->ee->real_cck_bw20[1] = t->cck[1].bw20;
++
++ mt7601u_set_power_rate(&t->ofdm[0], delta, (val >> 16) & 0xff);
++ mt7601u_set_power_rate(&t->ofdm[1], delta, (val >> 24) & 0xff);
++ break;
++ case 1:
++ mt7601u_set_power_rate(&t->ofdm[2], delta, (val >> 0) & 0xff);
++ mt7601u_set_power_rate(&t->ofdm[3], delta, (val >> 8) & 0xff);
++ mt7601u_set_power_rate(&t->ht[0], delta, (val >> 16) & 0xff);
++ mt7601u_set_power_rate(&t->ht[1], delta, (val >> 24) & 0xff);
++ break;
++ case 2:
++ mt7601u_set_power_rate(&t->ht[2], delta, (val >> 0) & 0xff);
++ mt7601u_set_power_rate(&t->ht[3], delta, (val >> 8) & 0xff);
++ break;
++ }
++}
++
++static s8
++get_delta(u8 val)
++{
++ s8 ret;
++
++ if (!field_valid(val) || !(val & BIT(7)))
++ return 0;
++
++ ret = val & 0x1f;
++ if (ret > 8)
++ ret = 8;
++ if (val & BIT(6))
++ ret = -ret;
++
++ return ret;
++}
++
++static void
++mt7601u_config_tx_power_per_rate(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ u32 val;
++ s8 bw40_delta;
++ int i;
++
++ bw40_delta = get_delta(eeprom[MT_EE_TX_POWER_DELTA_BW40]);
++
++ for (i = 0; i < 5; i++) {
++ val = get_unaligned_le32(eeprom + MT_EE_TX_POWER_BYRATE(i));
++
++ mt7601u_save_power_rate(dev, bw40_delta, val, i);
++
++ if (~val)
++ mt7601u_wr(dev, MT_TX_PWR_CFG_0 + i * 4, val);
++ }
++
++ mt7601u_extra_power_over_mac(dev);
++}
++
++static void
++mt7601u_init_tssi_params(struct mt7601u_dev *dev, u8 *eeprom)
++{
++ struct tssi_data *d = &dev->ee->tssi_data;
++
++ if (!dev->ee->tssi_enabled)
++ return;
++
++ d->slope = eeprom[MT_EE_TX_TSSI_SLOPE];
++ d->tx0_delta_offset = eeprom[MT_EE_TX_TSSI_OFFSET] * 1024;
++ d->offset[0] = eeprom[MT_EE_TX_TSSI_OFFSET_GROUP];
++ d->offset[1] = eeprom[MT_EE_TX_TSSI_OFFSET_GROUP + 1];
++ d->offset[2] = eeprom[MT_EE_TX_TSSI_OFFSET_GROUP + 2];
++}
++
++int
++mt7601u_eeprom_init(struct mt7601u_dev *dev)
++{
++ u8 *eeprom;
++ int i, ret;
++
++ ret = mt7601u_efuse_physical_size_check(dev);
++ if (ret)
++ return ret;
++
++ dev->ee = devm_kzalloc(dev->dev, sizeof(*dev->ee), GFP_KERNEL);
++ if (!dev->ee)
++ return -ENOMEM;
++
++ eeprom = kmalloc(MT7601U_EEPROM_SIZE, GFP_KERNEL);
++ if (!eeprom)
++ return -ENOMEM;
++
++ for (i = 0; i + 16 <= MT7601U_EEPROM_SIZE; i += 16) {
++ ret = mt7601u_efuse_read(dev, i, eeprom + i, MT_EE_READ);
++ if (ret)
++ goto out;
++ }
++
++ if (eeprom[MT_EE_VERSION_EE] > MT7601U_EE_MAX_VER)
++ dev_warn(dev->dev,
++ "Warning: unsupported EEPROM version %02hhx\n",
++ eeprom[MT_EE_VERSION_EE]);
++ dev_info(dev->dev, "EEPROM ver:%02hhx fae:%02hhx\n",
++ eeprom[MT_EE_VERSION_EE], eeprom[MT_EE_VERSION_FAE]);
++
++ mt7601u_set_macaddr(dev, eeprom);
++ mt7601u_set_chip_cap(dev, eeprom);
++ mt7601u_set_channel_power(dev, eeprom);
++ mt7601u_set_country_reg(dev, eeprom);
++ mt7601u_set_rf_freq_off(dev, eeprom);
++ mt7601u_set_rssi_offset(dev, eeprom);
++ dev->ee->ref_temp = eeprom[MT_EE_REF_TEMP];
++ dev->ee->lna_gain = eeprom[MT_EE_LNA_GAIN];
++
++ mt7601u_config_tx_power_per_rate(dev, eeprom);
++
++ mt7601u_init_tssi_params(dev, eeprom);
++out:
++ kfree(eeprom);
++ return ret;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/eeprom.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/eeprom.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/eeprom.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/eeprom.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,151 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT7601U_EEPROM_H
++#define __MT7601U_EEPROM_H
++
++struct mt7601u_dev;
++
++#define MT7601U_EE_MAX_VER 0x0c
++#define MT7601U_EEPROM_SIZE 256
++
++#define MT7601U_DEFAULT_TX_POWER 6
++
++enum mt76_eeprom_field {
++ MT_EE_CHIP_ID = 0x00,
++ MT_EE_VERSION_FAE = 0x02,
++ MT_EE_VERSION_EE = 0x03,
++ MT_EE_MAC_ADDR = 0x04,
++ MT_EE_NIC_CONF_0 = 0x34,
++ MT_EE_NIC_CONF_1 = 0x36,
++ MT_EE_COUNTRY_REGION = 0x39,
++ MT_EE_FREQ_OFFSET = 0x3a,
++ MT_EE_NIC_CONF_2 = 0x42,
++
++ MT_EE_LNA_GAIN = 0x44,
++ MT_EE_RSSI_OFFSET = 0x46,
++
++ MT_EE_TX_POWER_DELTA_BW40 = 0x50,
++ MT_EE_TX_POWER_OFFSET = 0x52,
++
++ MT_EE_TX_TSSI_SLOPE = 0x6e,
++ MT_EE_TX_TSSI_OFFSET_GROUP = 0x6f,
++ MT_EE_TX_TSSI_OFFSET = 0x76,
++
++ MT_EE_TX_TSSI_TARGET_POWER = 0xd0,
++ MT_EE_REF_TEMP = 0xd1,
++ MT_EE_FREQ_OFFSET_COMPENSATION = 0xdb,
++ MT_EE_TX_POWER_BYRATE_BASE = 0xde,
++
++ MT_EE_USAGE_MAP_START = 0x1e0,
++ MT_EE_USAGE_MAP_END = 0x1fc,
++};
++
++#define MT_EE_NIC_CONF_0_RX_PATH GENMASK(3, 0)
++#define MT_EE_NIC_CONF_0_TX_PATH GENMASK(7, 4)
++#define MT_EE_NIC_CONF_0_BOARD_TYPE GENMASK(13, 12)
++
++#define MT_EE_NIC_CONF_1_HW_RF_CTRL BIT(0)
++#define MT_EE_NIC_CONF_1_TEMP_TX_ALC BIT(1)
++#define MT_EE_NIC_CONF_1_LNA_EXT_2G BIT(2)
++#define MT_EE_NIC_CONF_1_LNA_EXT_5G BIT(3)
++#define MT_EE_NIC_CONF_1_TX_ALC_EN BIT(13)
++
++#define MT_EE_NIC_CONF_2_RX_STREAM GENMASK(3, 0)
++#define MT_EE_NIC_CONF_2_TX_STREAM GENMASK(7, 4)
++#define MT_EE_NIC_CONF_2_HW_ANTDIV BIT(8)
++#define MT_EE_NIC_CONF_2_XTAL_OPTION GENMASK(10, 9)
++#define MT_EE_NIC_CONF_2_TEMP_DISABLE BIT(11)
++#define MT_EE_NIC_CONF_2_COEX_METHOD GENMASK(15, 13)
++
++#define MT_EE_TX_POWER_BYRATE(i) (MT_EE_TX_POWER_BYRATE_BASE + \
++ (i) * 4)
++
++#define MT_EFUSE_USAGE_MAP_SIZE (MT_EE_USAGE_MAP_END - \
++ MT_EE_USAGE_MAP_START + 1)
++
++enum mt7601u_eeprom_access_modes {
++ MT_EE_READ = 0,
++ MT_EE_PHYSICAL_READ = 1,
++};
++
++struct power_per_rate {
++ u8 raw; /* validated s6 value */
++ s8 bw20; /* sign-extended int */
++ s8 bw40; /* sign-extended int */
++};
++
++/* Power per rate - one value per two rates */
++struct mt7601u_rate_power {
++ struct power_per_rate cck[2];
++ struct power_per_rate ofdm[4];
++ struct power_per_rate ht[4];
++};
++
++struct reg_channel_bounds {
++ u8 start;
++ u8 num;
++};
++
++struct mt7601u_eeprom_params {
++ bool tssi_enabled;
++ u8 rf_freq_off;
++ s8 rssi_offset[2];
++ s8 ref_temp;
++ s8 lna_gain;
++
++ u8 chan_pwr[14];
++ struct mt7601u_rate_power power_rate_table;
++ s8 real_cck_bw20[2];
++
++ /* TSSI stuff - only with internal TX ALC */
++ struct tssi_data {
++ int tx0_delta_offset;
++ u8 slope;
++ u8 offset[3];
++ } tssi_data;
++
++ struct reg_channel_bounds reg;
++};
++
++int mt7601u_eeprom_init(struct mt7601u_dev *dev);
++
++static inline u32 s6_validate(u32 reg)
++{
++ WARN_ON(reg & ~GENMASK(5, 0));
++ return reg & GENMASK(5, 0);
++}
++
++static inline int s6_to_int(u32 reg)
++{
++ int s6;
++
++ s6 = s6_validate(reg);
++ if (s6 & BIT(5))
++ s6 -= BIT(6);
++
++ return s6;
++}
++
++static inline u32 int_to_s6(int val)
++{
++ if (val < -0x20)
++ return 0x20;
++ if (val > 0x1f)
++ return 0x1f;
++
++ return val & 0x3f;
++}
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/init.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/init.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/init.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/init.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,628 @@
++/*
++ * (c) Copyright 2002-2010, Ralink Technology, Inc.
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++#include "eeprom.h"
++#include "trace.h"
++#include "mcu.h"
++
++#include "initvals.h"
++
++static void
++mt7601u_set_wlan_state(struct mt7601u_dev *dev, u32 val, bool enable)
++{
++ int i;
++
++ /* Note: we don't turn off WLAN_CLK because that makes the device
++ * not respond properly on the probe path.
++ * In case anyone (PSM?) wants to use this function we can
++ * bring the clock stuff back and fixup the probe path.
++ */
++
++ if (enable)
++ val |= (MT_WLAN_FUN_CTRL_WLAN_EN |
++ MT_WLAN_FUN_CTRL_WLAN_CLK_EN);
++ else
++ val &= ~(MT_WLAN_FUN_CTRL_WLAN_EN);
++
++ mt7601u_wr(dev, MT_WLAN_FUN_CTRL, val);
++ udelay(20);
++
++ if (enable) {
++ set_bit(MT7601U_STATE_WLAN_RUNNING, &dev->state);
++ } else {
++ clear_bit(MT7601U_STATE_WLAN_RUNNING, &dev->state);
++ return;
++ }
++
++ for (i = 200; i; i--) {
++ val = mt7601u_rr(dev, MT_CMB_CTRL);
++
++ if (val & MT_CMB_CTRL_XTAL_RDY && val & MT_CMB_CTRL_PLL_LD)
++ break;
++
++ udelay(20);
++ }
++
++ /* Note: vendor driver tries to disable/enable wlan here and retry
++ * but the code which does it is so buggy it must have never
++ * triggered, so don't bother.
++ */
++ if (!i)
++ dev_err(dev->dev, "Error: PLL and XTAL check failed!\n");
++}
++
++static void mt7601u_chip_onoff(struct mt7601u_dev *dev, bool enable, bool reset)
++{
++ u32 val;
++
++ mutex_lock(&dev->hw_atomic_mutex);
++
++ val = mt7601u_rr(dev, MT_WLAN_FUN_CTRL);
++
++ if (reset) {
++ val |= MT_WLAN_FUN_CTRL_GPIO_OUT_EN;
++ val &= ~MT_WLAN_FUN_CTRL_FRC_WL_ANT_SEL;
++
++ if (val & MT_WLAN_FUN_CTRL_WLAN_EN) {
++ val |= (MT_WLAN_FUN_CTRL_WLAN_RESET |
++ MT_WLAN_FUN_CTRL_WLAN_RESET_RF);
++ mt7601u_wr(dev, MT_WLAN_FUN_CTRL, val);
++ udelay(20);
++
++ val &= ~(MT_WLAN_FUN_CTRL_WLAN_RESET |
++ MT_WLAN_FUN_CTRL_WLAN_RESET_RF);
++ }
++ }
++
++ mt7601u_wr(dev, MT_WLAN_FUN_CTRL, val);
++ udelay(20);
++
++ mt7601u_set_wlan_state(dev, val, enable);
++
++ mutex_unlock(&dev->hw_atomic_mutex);
++}
++
++static void mt7601u_reset_csr_bbp(struct mt7601u_dev *dev)
++{
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, (MT_MAC_SYS_CTRL_RESET_CSR |
++ MT_MAC_SYS_CTRL_RESET_BBP));
++ mt7601u_wr(dev, MT_USB_DMA_CFG, 0);
++ msleep(1);
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, 0);
++}
++
++static void mt7601u_init_usb_dma(struct mt7601u_dev *dev)
++{
++ u32 val;
++
++ val = MT76_SET(MT_USB_DMA_CFG_RX_BULK_AGG_TOUT, MT_USB_AGGR_TIMEOUT) |
++ MT76_SET(MT_USB_DMA_CFG_RX_BULK_AGG_LMT, MT_USB_AGGR_SIZE_LIMIT) |
++ MT_USB_DMA_CFG_RX_BULK_EN |
++ MT_USB_DMA_CFG_TX_BULK_EN;
++ if (dev->in_max_packet == 512)
++ val |= MT_USB_DMA_CFG_RX_BULK_AGG_EN;
++ mt7601u_wr(dev, MT_USB_DMA_CFG, val);
++
++ val |= MT_USB_DMA_CFG_UDMA_RX_WL_DROP;
++ mt7601u_wr(dev, MT_USB_DMA_CFG, val);
++ val &= ~MT_USB_DMA_CFG_UDMA_RX_WL_DROP;
++ mt7601u_wr(dev, MT_USB_DMA_CFG, val);
++}
++
++static int mt7601u_init_bbp(struct mt7601u_dev *dev)
++{
++ int ret;
++
++ ret = mt7601u_wait_bbp_ready(dev);
++ if (ret)
++ return ret;
++
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP, bbp_common_vals,
++ ARRAY_SIZE(bbp_common_vals));
++ if (ret)
++ return ret;
++
++ return mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP, bbp_chip_vals,
++ ARRAY_SIZE(bbp_chip_vals));
++}
++
++static void
++mt76_init_beacon_offsets(struct mt7601u_dev *dev)
++{
++ u16 base = MT_BEACON_BASE;
++ u32 regs[4] = {};
++ int i;
++
++ for (i = 0; i < 16; i++) {
++ u16 addr = dev->beacon_offsets[i];
++
++ regs[i / 4] |= ((addr - base) / 64) << (8 * (i % 4));
++ }
++
++ for (i = 0; i < 4; i++)
++ mt7601u_wr(dev, MT_BCN_OFFSET(i), regs[i]);
++}
++
++static int mt7601u_write_mac_initvals(struct mt7601u_dev *dev)
++{
++ int ret;
++
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_WLAN, mac_common_vals,
++ ARRAY_SIZE(mac_common_vals));
++ if (ret)
++ return ret;
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_WLAN,
++ mac_chip_vals, ARRAY_SIZE(mac_chip_vals));
++ if (ret)
++ return ret;
++
++ mt76_init_beacon_offsets(dev);
++
++ mt7601u_wr(dev, MT_AUX_CLK_CFG, 0);
++
++ return 0;
++}
++
++static int mt7601u_init_wcid_mem(struct mt7601u_dev *dev)
++{
++ u32 *vals;
++ int i, ret;
++
++ vals = kmalloc(sizeof(*vals) * N_WCIDS * 2, GFP_KERNEL);
++ if (!vals)
++ return -ENOMEM;
++
++ for (i = 0; i < N_WCIDS; i++) {
++ vals[i * 2] = 0xffffffff;
++ vals[i * 2 + 1] = 0x00ffffff;
++ }
++
++ ret = mt7601u_burst_write_regs(dev, MT_WCID_ADDR_BASE,
++ vals, N_WCIDS * 2);
++ kfree(vals);
++
++ return ret;
++}
++
++static int mt7601u_init_key_mem(struct mt7601u_dev *dev)
++{
++ u32 vals[4] = {};
++
++ return mt7601u_burst_write_regs(dev, MT_SKEY_MODE_BASE_0,
++ vals, ARRAY_SIZE(vals));
++}
++
++static int mt7601u_init_wcid_attr_mem(struct mt7601u_dev *dev)
++{
++ u32 *vals;
++ int i, ret;
++
++ vals = kmalloc(sizeof(*vals) * N_WCIDS * 2, GFP_KERNEL);
++ if (!vals)
++ return -ENOMEM;
++
++ for (i = 0; i < N_WCIDS * 2; i++)
++ vals[i] = 1;
++
++ ret = mt7601u_burst_write_regs(dev, MT_WCID_ATTR_BASE,
++ vals, N_WCIDS * 2);
++ kfree(vals);
++
++ return ret;
++}
++
++static void mt7601u_reset_counters(struct mt7601u_dev *dev)
++{
++ mt7601u_rr(dev, MT_RX_STA_CNT0);
++ mt7601u_rr(dev, MT_RX_STA_CNT1);
++ mt7601u_rr(dev, MT_RX_STA_CNT2);
++ mt7601u_rr(dev, MT_TX_STA_CNT0);
++ mt7601u_rr(dev, MT_TX_STA_CNT1);
++ mt7601u_rr(dev, MT_TX_STA_CNT2);
++}
++
++int mt7601u_mac_start(struct mt7601u_dev *dev)
++{
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX);
++
++ if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY |
++ MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 200000))
++ return -ETIMEDOUT;
++
++ dev->rxfilter = MT_RX_FILTR_CFG_CRC_ERR |
++ MT_RX_FILTR_CFG_PHY_ERR | MT_RX_FILTR_CFG_PROMISC |
++ MT_RX_FILTR_CFG_VER_ERR | MT_RX_FILTR_CFG_DUP |
++ MT_RX_FILTR_CFG_CFACK | MT_RX_FILTR_CFG_CFEND |
++ MT_RX_FILTR_CFG_ACK | MT_RX_FILTR_CFG_CTS |
++ MT_RX_FILTR_CFG_RTS | MT_RX_FILTR_CFG_PSPOLL |
++ MT_RX_FILTR_CFG_BA | MT_RX_FILTR_CFG_CTRL_RSV;
++ mt7601u_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter);
++
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL,
++ MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX);
++
++ if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY |
++ MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 50))
++ return -ETIMEDOUT;
++
++ return 0;
++}
++
++static void mt7601u_mac_stop_hw(struct mt7601u_dev *dev)
++{
++ int i, ok;
++
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return;
++
++ mt76_clear(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_TIMER_EN |
++ MT_BEACON_TIME_CFG_SYNC_MODE | MT_BEACON_TIME_CFG_TBTT_EN |
++ MT_BEACON_TIME_CFG_BEACON_TX);
++
++ if (!mt76_poll(dev, MT_USB_DMA_CFG, MT_USB_DMA_CFG_TX_BUSY, 0, 1000))
++ dev_warn(dev->dev, "Warning: TX DMA did not stop!\n");
++
++ /* Page count on TxQ */
++ i = 200;
++ while (i-- && ((mt76_rr(dev, 0x0438) & 0xffffffff) ||
++ (mt76_rr(dev, 0x0a30) & 0x000000ff) ||
++ (mt76_rr(dev, 0x0a34) & 0x00ff00ff)))
++ msleep(10);
++
++ if (!mt76_poll(dev, MT_MAC_STATUS, MT_MAC_STATUS_TX, 0, 1000))
++ dev_warn(dev->dev, "Warning: MAC TX did not stop!\n");
++
++ mt76_clear(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_RX |
++ MT_MAC_SYS_CTRL_ENABLE_TX);
++
++ /* Page count on RxQ */
++ ok = 0;
++ i = 200;
++ while (i--) {
++ if ((mt76_rr(dev, 0x0430) & 0x00ff0000) ||
++ (mt76_rr(dev, 0x0a30) & 0xffffffff) ||
++ (mt76_rr(dev, 0x0a34) & 0xffffffff))
++ ok++;
++ if (ok > 6)
++ break;
++
++ msleep(1);
++ }
++
++ if (!mt76_poll(dev, MT_MAC_STATUS, MT_MAC_STATUS_RX, 0, 1000))
++ dev_warn(dev->dev, "Warning: MAC RX did not stop!\n");
++
++ if (!mt76_poll(dev, MT_USB_DMA_CFG, MT_USB_DMA_CFG_RX_BUSY, 0, 1000))
++ dev_warn(dev->dev, "Warning: RX DMA did not stop!\n");
++}
++
++void mt7601u_mac_stop(struct mt7601u_dev *dev)
++{
++ mt7601u_mac_stop_hw(dev);
++ flush_delayed_work(&dev->stat_work);
++ cancel_delayed_work_sync(&dev->stat_work);
++}
++
++static void mt7601u_stop_hardware(struct mt7601u_dev *dev)
++{
++ mt7601u_chip_onoff(dev, false, false);
++}
++
++int mt7601u_init_hardware(struct mt7601u_dev *dev)
++{
++ static const u16 beacon_offsets[16] = {
++ /* 512 byte per beacon */
++ 0xc000, 0xc200, 0xc400, 0xc600,
++ 0xc800, 0xca00, 0xcc00, 0xce00,
++ 0xd000, 0xd200, 0xd400, 0xd600,
++ 0xd800, 0xda00, 0xdc00, 0xde00
++ };
++ int ret;
++
++ dev->beacon_offsets = beacon_offsets;
++
++ mt7601u_chip_onoff(dev, true, false);
++
++ ret = mt7601u_wait_asic_ready(dev);
++ if (ret)
++ goto err;
++ ret = mt7601u_mcu_init(dev);
++ if (ret)
++ goto err;
++
++ if (!mt76_poll_msec(dev, MT_WPDMA_GLO_CFG,
++ MT_WPDMA_GLO_CFG_TX_DMA_BUSY |
++ MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 100)) {
++ ret = -EIO;
++ goto err;
++ }
++
++ /* Wait for ASIC ready after FW load. */
++ ret = mt7601u_wait_asic_ready(dev);
++ if (ret)
++ goto err;
++
++ mt7601u_reset_csr_bbp(dev);
++ mt7601u_init_usb_dma(dev);
++
++ ret = mt7601u_mcu_cmd_init(dev);
++ if (ret)
++ goto err;
++ ret = mt7601u_dma_init(dev);
++ if (ret)
++ goto err_mcu;
++ ret = mt7601u_write_mac_initvals(dev);
++ if (ret)
++ goto err_rx;
++
++ if (!mt76_poll_msec(dev, MT_MAC_STATUS,
++ MT_MAC_STATUS_TX | MT_MAC_STATUS_RX, 0, 100)) {
++ ret = -EIO;
++ goto err_rx;
++ }
++
++ ret = mt7601u_init_bbp(dev);
++ if (ret)
++ goto err_rx;
++ ret = mt7601u_init_wcid_mem(dev);
++ if (ret)
++ goto err_rx;
++ ret = mt7601u_init_key_mem(dev);
++ if (ret)
++ goto err_rx;
++ ret = mt7601u_init_wcid_attr_mem(dev);
++ if (ret)
++ goto err_rx;
++
++ mt76_clear(dev, MT_BEACON_TIME_CFG, (MT_BEACON_TIME_CFG_TIMER_EN |
++ MT_BEACON_TIME_CFG_SYNC_MODE |
++ MT_BEACON_TIME_CFG_TBTT_EN |
++ MT_BEACON_TIME_CFG_BEACON_TX));
++
++ mt7601u_reset_counters(dev);
++
++ mt7601u_rmw(dev, MT_US_CYC_CFG, MT_US_CYC_CNT, 0x1e);
++
++ mt7601u_wr(dev, MT_TXOP_CTRL_CFG, MT76_SET(MT_TXOP_TRUN_EN, 0x3f) |
++ MT76_SET(MT_TXOP_EXT_CCA_DLY, 0x58));
++
++ ret = mt7601u_eeprom_init(dev);
++ if (ret)
++ goto err_rx;
++
++ ret = mt7601u_phy_init(dev);
++ if (ret)
++ goto err_rx;
++
++ mt7601u_set_rx_path(dev, 0);
++ mt7601u_set_tx_dac(dev, 0);
++
++ mt7601u_mac_set_ctrlch(dev, false);
++ mt7601u_bbp_set_ctrlch(dev, false);
++ mt7601u_bbp_set_bw(dev, MT_BW_20);
++
++ return 0;
++
++err_rx:
++ mt7601u_dma_cleanup(dev);
++err_mcu:
++ mt7601u_mcu_cmd_deinit(dev);
++err:
++ mt7601u_chip_onoff(dev, false, false);
++ return ret;
++}
++
++void mt7601u_cleanup(struct mt7601u_dev *dev)
++{
++ if (!test_and_clear_bit(MT7601U_STATE_INITIALIZED, &dev->state))
++ return;
++
++ mt7601u_stop_hardware(dev);
++ mt7601u_dma_cleanup(dev);
++ mt7601u_mcu_cmd_deinit(dev);
++}
++
++struct mt7601u_dev *mt7601u_alloc_device(struct device *pdev)
++{
++ struct ieee80211_hw *hw;
++ struct mt7601u_dev *dev;
++
++ hw = ieee80211_alloc_hw(sizeof(*dev), &mt7601u_ops);
++ if (!hw)
++ return NULL;
++
++ dev = hw->priv;
++ dev->dev = pdev;
++ dev->hw = hw;
++ mutex_init(&dev->vendor_req_mutex);
++ mutex_init(&dev->reg_atomic_mutex);
++ mutex_init(&dev->hw_atomic_mutex);
++ mutex_init(&dev->mutex);
++ spin_lock_init(&dev->tx_lock);
++ spin_lock_init(&dev->rx_lock);
++ spin_lock_init(&dev->lock);
++ spin_lock_init(&dev->con_mon_lock);
++ atomic_set(&dev->avg_ampdu_len, 1);
++
++ dev->stat_wq = alloc_workqueue("mt7601u", WQ_UNBOUND, 0);
++ if (!dev->stat_wq) {
++ ieee80211_free_hw(hw);
++ return NULL;
++ }
++
++ return dev;
++}
++
++#define CHAN2G(_idx, _freq) { \
++ .band = IEEE80211_BAND_2GHZ, \
++ .center_freq = (_freq), \
++ .hw_value = (_idx), \
++ .max_power = 30, \
++}
++
++static const struct ieee80211_channel mt76_channels_2ghz[] = {
++ CHAN2G(1, 2412),
++ CHAN2G(2, 2417),
++ CHAN2G(3, 2422),
++ CHAN2G(4, 2427),
++ CHAN2G(5, 2432),
++ CHAN2G(6, 2437),
++ CHAN2G(7, 2442),
++ CHAN2G(8, 2447),
++ CHAN2G(9, 2452),
++ CHAN2G(10, 2457),
++ CHAN2G(11, 2462),
++ CHAN2G(12, 2467),
++ CHAN2G(13, 2472),
++ CHAN2G(14, 2484),
++};
++
++#define CCK_RATE(_idx, _rate) { \
++ .bitrate = _rate, \
++ .flags = IEEE80211_RATE_SHORT_PREAMBLE, \
++ .hw_value = (MT_PHY_TYPE_CCK << 8) | _idx, \
++ .hw_value_short = (MT_PHY_TYPE_CCK << 8) | (8 + _idx), \
++}
++
++#define OFDM_RATE(_idx, _rate) { \
++ .bitrate = _rate, \
++ .hw_value = (MT_PHY_TYPE_OFDM << 8) | _idx, \
++ .hw_value_short = (MT_PHY_TYPE_OFDM << 8) | _idx, \
++}
++
++static struct ieee80211_rate mt76_rates[] = {
++ CCK_RATE(0, 10),
++ CCK_RATE(1, 20),
++ CCK_RATE(2, 55),
++ CCK_RATE(3, 110),
++ OFDM_RATE(0, 60),
++ OFDM_RATE(1, 90),
++ OFDM_RATE(2, 120),
++ OFDM_RATE(3, 180),
++ OFDM_RATE(4, 240),
++ OFDM_RATE(5, 360),
++ OFDM_RATE(6, 480),
++ OFDM_RATE(7, 540),
++};
++
++static int
++mt76_init_sband(struct mt7601u_dev *dev, struct ieee80211_supported_band *sband,
++ const struct ieee80211_channel *chan, int n_chan,
++ struct ieee80211_rate *rates, int n_rates)
++{
++ struct ieee80211_sta_ht_cap *ht_cap;
++ void *chanlist;
++ int size;
++
++ size = n_chan * sizeof(*chan);
++ chanlist = devm_kmemdup(dev->dev, chan, size, GFP_KERNEL);
++ if (!chanlist)
++ return -ENOMEM;
++
++ sband->channels = chanlist;
++ sband->n_channels = n_chan;
++ sband->bitrates = rates;
++ sband->n_bitrates = n_rates;
++
++ ht_cap = &sband->ht_cap;
++ ht_cap->ht_supported = true;
++ ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
++ IEEE80211_HT_CAP_GRN_FLD |
++ IEEE80211_HT_CAP_SGI_20 |
++ IEEE80211_HT_CAP_SGI_40 |
++ (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
++
++ ht_cap->mcs.rx_mask[0] = 0xff;
++ ht_cap->mcs.rx_mask[4] = 0x1;
++ ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
++ ht_cap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
++ ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_2;
++
++ dev->chandef.chan = &sband->channels[0];
++
++ return 0;
++}
++
++static int
++mt76_init_sband_2g(struct mt7601u_dev *dev)
++{
++ dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g),
++ GFP_KERNEL);
++ dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = dev->sband_2g;
++
++ WARN_ON(dev->ee->reg.start - 1 + dev->ee->reg.num >
++ ARRAY_SIZE(mt76_channels_2ghz));
++
++ return mt76_init_sband(dev, dev->sband_2g,
++ &mt76_channels_2ghz[dev->ee->reg.start - 1],
++ dev->ee->reg.num,
++ mt76_rates, ARRAY_SIZE(mt76_rates));
++}
++
++int mt7601u_register_device(struct mt7601u_dev *dev)
++{
++ struct ieee80211_hw *hw = dev->hw;
++ struct wiphy *wiphy = hw->wiphy;
++ int ret;
++
++ /* Reserve WCID 0 for mcast - thanks to this APs WCID will go to
++ * entry no. 1 like it does in the vendor driver.
++ */
++ dev->wcid_mask[0] |= 1;
++
++ /* init fake wcid for monitor interfaces */
++ dev->mon_wcid = devm_kmalloc(dev->dev, sizeof(*dev->mon_wcid),
++ GFP_KERNEL);
++ if (!dev->mon_wcid)
++ return -ENOMEM;
++ dev->mon_wcid->idx = 0xff;
++ dev->mon_wcid->hw_key_idx = -1;
++
++ SET_IEEE80211_DEV(hw, dev->dev);
++
++ hw->queues = 4;
++ hw->flags = IEEE80211_HW_SIGNAL_DBM |
++ IEEE80211_HW_PS_NULLFUNC_STACK |
++ IEEE80211_HW_SUPPORTS_HT_CCK_RATES |
++ IEEE80211_HW_AMPDU_AGGREGATION |
++ IEEE80211_HW_SUPPORTS_RC_TABLE;
++ hw->max_rates = 1;
++ hw->max_report_rates = 7;
++ hw->max_rate_tries = 1;
++
++ hw->sta_data_size = sizeof(struct mt76_sta);
++ hw->vif_data_size = sizeof(struct mt76_vif);
++
++ SET_IEEE80211_PERM_ADDR(hw, dev->macaddr);
++
++ wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR;
++ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
++
++ ret = mt76_init_sband_2g(dev);
++ if (ret)
++ return ret;
++
++ INIT_DELAYED_WORK(&dev->mac_work, mt7601u_mac_work);
++ INIT_DELAYED_WORK(&dev->stat_work, mt7601u_tx_stat);
++
++ ret = ieee80211_register_hw(hw);
++ if (ret)
++ return ret;
++
++ mt7601u_init_debugfs(dev);
++
++ return 0;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/initvals.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/initvals.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/initvals.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/initvals.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,164 @@
++/*
++ * (c) Copyright 2002-2010, Ralink Technology, Inc.
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT7601U_INITVALS_H
++#define __MT7601U_INITVALS_H
++
++static const struct mt76_reg_pair bbp_common_vals[] = {
++ { 65, 0x2c },
++ { 66, 0x38 },
++ { 68, 0x0b },
++ { 69, 0x12 },
++ { 70, 0x0a },
++ { 73, 0x10 },
++ { 81, 0x37 },
++ { 82, 0x62 },
++ { 83, 0x6a },
++ { 84, 0x99 },
++ { 86, 0x00 },
++ { 91, 0x04 },
++ { 92, 0x00 },
++ { 103, 0x00 },
++ { 105, 0x05 },
++ { 106, 0x35 },
++};
++
++static const struct mt76_reg_pair bbp_chip_vals[] = {
++ { 1, 0x04 }, { 4, 0x40 }, { 20, 0x06 }, { 31, 0x08 },
++ /* CCK Tx Control */
++ { 178, 0xff },
++ /* AGC/Sync controls */
++ { 66, 0x14 }, { 68, 0x8b }, { 69, 0x12 }, { 70, 0x09 },
++ { 73, 0x11 }, { 75, 0x60 }, { 76, 0x44 }, { 84, 0x9a },
++ { 86, 0x38 }, { 91, 0x07 }, { 92, 0x02 },
++ /* Rx Path Controls */
++ { 99, 0x50 }, { 101, 0x00 }, { 103, 0xc0 }, { 104, 0x92 },
++ { 105, 0x3c }, { 106, 0x03 }, { 128, 0x12 },
++ /* Change RXWI content: Gain Report */
++ { 142, 0x04 }, { 143, 0x37 },
++ /* Change RXWI content: Antenna Report */
++ { 142, 0x03 }, { 143, 0x99 },
++ /* Calibration Index Register */
++ /* CCK Receiver Control */
++ { 160, 0xeb }, { 161, 0xc4 }, { 162, 0x77 }, { 163, 0xf9 },
++ { 164, 0x88 }, { 165, 0x80 }, { 166, 0xff }, { 167, 0xe4 },
++ /* Added AGC controls - these AGC/GLRT registers are accessed
++ * through R195 and R196.
++ */
++ { 195, 0x00 }, { 196, 0x00 },
++ { 195, 0x01 }, { 196, 0x04 },
++ { 195, 0x02 }, { 196, 0x20 },
++ { 195, 0x03 }, { 196, 0x0a },
++ { 195, 0x06 }, { 196, 0x16 },
++ { 195, 0x07 }, { 196, 0x05 },
++ { 195, 0x08 }, { 196, 0x37 },
++ { 195, 0x0a }, { 196, 0x15 },
++ { 195, 0x0b }, { 196, 0x17 },
++ { 195, 0x0c }, { 196, 0x06 },
++ { 195, 0x0d }, { 196, 0x09 },
++ { 195, 0x0e }, { 196, 0x05 },
++ { 195, 0x0f }, { 196, 0x09 },
++ { 195, 0x10 }, { 196, 0x20 },
++ { 195, 0x20 }, { 196, 0x17 },
++ { 195, 0x21 }, { 196, 0x06 },
++ { 195, 0x22 }, { 196, 0x09 },
++ { 195, 0x23 }, { 196, 0x17 },
++ { 195, 0x24 }, { 196, 0x06 },
++ { 195, 0x25 }, { 196, 0x09 },
++ { 195, 0x26 }, { 196, 0x17 },
++ { 195, 0x27 }, { 196, 0x06 },
++ { 195, 0x28 }, { 196, 0x09 },
++ { 195, 0x29 }, { 196, 0x05 },
++ { 195, 0x2a }, { 196, 0x09 },
++ { 195, 0x80 }, { 196, 0x8b },
++ { 195, 0x81 }, { 196, 0x12 },
++ { 195, 0x82 }, { 196, 0x09 },
++ { 195, 0x83 }, { 196, 0x17 },
++ { 195, 0x84 }, { 196, 0x11 },
++ { 195, 0x85 }, { 196, 0x00 },
++ { 195, 0x86 }, { 196, 0x00 },
++ { 195, 0x87 }, { 196, 0x18 },
++ { 195, 0x88 }, { 196, 0x60 },
++ { 195, 0x89 }, { 196, 0x44 },
++ { 195, 0x8a }, { 196, 0x8b },
++ { 195, 0x8b }, { 196, 0x8b },
++ { 195, 0x8c }, { 196, 0x8b },
++ { 195, 0x8d }, { 196, 0x8b },
++ { 195, 0x8e }, { 196, 0x09 },
++ { 195, 0x8f }, { 196, 0x09 },
++ { 195, 0x90 }, { 196, 0x09 },
++ { 195, 0x91 }, { 196, 0x09 },
++ { 195, 0x92 }, { 196, 0x11 },
++ { 195, 0x93 }, { 196, 0x11 },
++ { 195, 0x94 }, { 196, 0x11 },
++ { 195, 0x95 }, { 196, 0x11 },
++ /* PPAD */
++ { 47, 0x80 }, { 60, 0x80 }, { 150, 0xd2 }, { 151, 0x32 },
++ { 152, 0x23 }, { 153, 0x41 }, { 154, 0x00 }, { 155, 0x4f },
++ { 253, 0x7e }, { 195, 0x30 }, { 196, 0x32 }, { 195, 0x31 },
++ { 196, 0x23 }, { 195, 0x32 }, { 196, 0x45 }, { 195, 0x35 },
++ { 196, 0x4a }, { 195, 0x36 }, { 196, 0x5a }, { 195, 0x37 },
++ { 196, 0x5a },
++};
++
++static const struct mt76_reg_pair mac_common_vals[] = {
++ { MT_LEGACY_BASIC_RATE, 0x0000013f },
++ { MT_HT_BASIC_RATE, 0x00008003 },
++ { MT_MAC_SYS_CTRL, 0x00000000 },
++ { MT_RX_FILTR_CFG, 0x00017f97 },
++ { MT_BKOFF_SLOT_CFG, 0x00000209 },
++ { MT_TX_SW_CFG0, 0x00000000 },
++ { MT_TX_SW_CFG1, 0x00080606 },
++ { MT_TX_LINK_CFG, 0x00001020 },
++ { MT_TX_TIMEOUT_CFG, 0x000a2090 },
++ { MT_MAX_LEN_CFG, 0x00003fff },
++ { MT_PBF_TX_MAX_PCNT, 0x1fbf1f1f },
++ { MT_PBF_RX_MAX_PCNT, 0x0000009f },
++ { MT_TX_RETRY_CFG, 0x47d01f0f },
++ { MT_AUTO_RSP_CFG, 0x00000013 },
++ { MT_CCK_PROT_CFG, 0x05740003 },
++ { MT_OFDM_PROT_CFG, 0x05740003 },
++ { MT_MM40_PROT_CFG, 0x03f44084 },
++ { MT_GF20_PROT_CFG, 0x01744004 },
++ { MT_GF40_PROT_CFG, 0x03f44084 },
++ { MT_MM20_PROT_CFG, 0x01744004 },
++ { MT_TXOP_CTRL_CFG, 0x0000583f },
++ { MT_TX_RTS_CFG, 0x01092b20 },
++ { MT_EXP_ACK_TIME, 0x002400ca },
++ { MT_TXOP_HLDR_ET, 0x00000002 },
++ { MT_XIFS_TIME_CFG, 0x33a41010 },
++ { MT_PWR_PIN_CFG, 0x00000000 },
++};
++
++static const struct mt76_reg_pair mac_chip_vals[] = {
++ { MT_TSO_CTRL, 0x00006050 },
++ { MT_BCN_OFFSET(0), 0x18100800 },
++ { MT_BCN_OFFSET(1), 0x38302820 },
++ { MT_PBF_SYS_CTRL, 0x00080c00 },
++ { MT_PBF_CFG, 0x7f723c1f },
++ { MT_FCE_PSE_CTRL, 0x00000001 },
++ { MT_PAUSE_ENABLE_CONTROL1, 0x00000000 },
++ { MT_TX0_RF_GAIN_CORR, 0x003b0005 },
++ { MT_TX0_RF_GAIN_ATTEN, 0x00006900 },
++ { MT_TX0_BB_GAIN_ATTEN, 0x00000400 },
++ { MT_TX_ALC_VGA3, 0x00060006 },
++ { MT_TX_SW_CFG0, 0x00000402 },
++ { MT_TX_SW_CFG1, 0x00000000 },
++ { MT_TX_SW_CFG2, 0x00000000 },
++ { MT_HEADER_TRANS_CTRL_REG, 0x00000000 },
++ { MT_FCE_CSO, 0x0000030f },
++ { MT_FCE_PARAMETERS, 0x00256f0f },
++};
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/initvals_phy.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/initvals_phy.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/initvals_phy.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/initvals_phy.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,291 @@
++/*
++ * (c) Copyright 2002-2010, Ralink Technology, Inc.
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT7601U_PHY_INITVALS_H
++#define __MT7601U_PHY_INITVALS_H
++
++#define RF_REG_PAIR(bank, reg, value) \
++ { MT_MCU_MEMMAP_RF | (bank) << 16 | (reg), value }
++
++static const struct mt76_reg_pair rf_central[] = {
++ /* Bank 0 - for central blocks: BG, PLL, XTAL, LO, ADC/DAC */
++ RF_REG_PAIR(0, 0, 0x02),
++ RF_REG_PAIR(0, 1, 0x01),
++ RF_REG_PAIR(0, 2, 0x11),
++ RF_REG_PAIR(0, 3, 0xff),
++ RF_REG_PAIR(0, 4, 0x0a),
++ RF_REG_PAIR(0, 5, 0x20),
++ RF_REG_PAIR(0, 6, 0x00),
++ /* B/G */
++ RF_REG_PAIR(0, 7, 0x00),
++ RF_REG_PAIR(0, 8, 0x00),
++ RF_REG_PAIR(0, 9, 0x00),
++ RF_REG_PAIR(0, 10, 0x00),
++ RF_REG_PAIR(0, 11, 0x21),
++ /* XO */
++ RF_REG_PAIR(0, 13, 0x00), /* 40mhz xtal */
++ /* RF_REG_PAIR(0, 13, 0x13), */ /* 20mhz xtal */
++ RF_REG_PAIR(0, 14, 0x7c),
++ RF_REG_PAIR(0, 15, 0x22),
++ RF_REG_PAIR(0, 16, 0x80),
++ /* PLL */
++ RF_REG_PAIR(0, 17, 0x99),
++ RF_REG_PAIR(0, 18, 0x99),
++ RF_REG_PAIR(0, 19, 0x09),
++ RF_REG_PAIR(0, 20, 0x50),
++ RF_REG_PAIR(0, 21, 0xb0),
++ RF_REG_PAIR(0, 22, 0x00),
++ RF_REG_PAIR(0, 23, 0xc5),
++ RF_REG_PAIR(0, 24, 0xfc),
++ RF_REG_PAIR(0, 25, 0x40),
++ RF_REG_PAIR(0, 26, 0x4d),
++ RF_REG_PAIR(0, 27, 0x02),
++ RF_REG_PAIR(0, 28, 0x72),
++ RF_REG_PAIR(0, 29, 0x01),
++ RF_REG_PAIR(0, 30, 0x00),
++ RF_REG_PAIR(0, 31, 0x00),
++ /* test ports */
++ RF_REG_PAIR(0, 32, 0x00),
++ RF_REG_PAIR(0, 33, 0x00),
++ RF_REG_PAIR(0, 34, 0x23),
++ RF_REG_PAIR(0, 35, 0x01), /* change setting to reduce spurs */
++ RF_REG_PAIR(0, 36, 0x00),
++ RF_REG_PAIR(0, 37, 0x00),
++ /* ADC/DAC */
++ RF_REG_PAIR(0, 38, 0x00),
++ RF_REG_PAIR(0, 39, 0x20),
++ RF_REG_PAIR(0, 40, 0x00),
++ RF_REG_PAIR(0, 41, 0xd0),
++ RF_REG_PAIR(0, 42, 0x1b),
++ RF_REG_PAIR(0, 43, 0x02),
++ RF_REG_PAIR(0, 44, 0x00),
++};
++
++static const struct mt76_reg_pair rf_channel[] = {
++ RF_REG_PAIR(4, 0, 0x01),
++ RF_REG_PAIR(4, 1, 0x00),
++ RF_REG_PAIR(4, 2, 0x00),
++ RF_REG_PAIR(4, 3, 0x00),
++ /* LDO */
++ RF_REG_PAIR(4, 4, 0x00),
++ RF_REG_PAIR(4, 5, 0x08),
++ RF_REG_PAIR(4, 6, 0x00),
++ /* RX */
++ RF_REG_PAIR(4, 7, 0x5b),
++ RF_REG_PAIR(4, 8, 0x52),
++ RF_REG_PAIR(4, 9, 0xb6),
++ RF_REG_PAIR(4, 10, 0x57),
++ RF_REG_PAIR(4, 11, 0x33),
++ RF_REG_PAIR(4, 12, 0x22),
++ RF_REG_PAIR(4, 13, 0x3d),
++ RF_REG_PAIR(4, 14, 0x3e),
++ RF_REG_PAIR(4, 15, 0x13),
++ RF_REG_PAIR(4, 16, 0x22),
++ RF_REG_PAIR(4, 17, 0x23),
++ RF_REG_PAIR(4, 18, 0x02),
++ RF_REG_PAIR(4, 19, 0xa4),
++ RF_REG_PAIR(4, 20, 0x01),
++ RF_REG_PAIR(4, 21, 0x12),
++ RF_REG_PAIR(4, 22, 0x80),
++ RF_REG_PAIR(4, 23, 0xb3),
++ RF_REG_PAIR(4, 24, 0x00), /* reserved */
++ RF_REG_PAIR(4, 25, 0x00), /* reserved */
++ RF_REG_PAIR(4, 26, 0x00), /* reserved */
++ RF_REG_PAIR(4, 27, 0x00), /* reserved */
++ /* LOGEN */
++ RF_REG_PAIR(4, 28, 0x18),
++ RF_REG_PAIR(4, 29, 0xee),
++ RF_REG_PAIR(4, 30, 0x6b),
++ RF_REG_PAIR(4, 31, 0x31),
++ RF_REG_PAIR(4, 32, 0x5d),
++ RF_REG_PAIR(4, 33, 0x00), /* reserved */
++ /* TX */
++ RF_REG_PAIR(4, 34, 0x96),
++ RF_REG_PAIR(4, 35, 0x55),
++ RF_REG_PAIR(4, 36, 0x08),
++ RF_REG_PAIR(4, 37, 0xbb),
++ RF_REG_PAIR(4, 38, 0xb3),
++ RF_REG_PAIR(4, 39, 0xb3),
++ RF_REG_PAIR(4, 40, 0x03),
++ RF_REG_PAIR(4, 41, 0x00), /* reserved */
++ RF_REG_PAIR(4, 42, 0x00), /* reserved */
++ RF_REG_PAIR(4, 43, 0xc5),
++ RF_REG_PAIR(4, 44, 0xc5),
++ RF_REG_PAIR(4, 45, 0xc5),
++ RF_REG_PAIR(4, 46, 0x07),
++ RF_REG_PAIR(4, 47, 0xa8),
++ RF_REG_PAIR(4, 48, 0xef),
++ RF_REG_PAIR(4, 49, 0x1a),
++ /* PA */
++ RF_REG_PAIR(4, 54, 0x07),
++ RF_REG_PAIR(4, 55, 0xa7),
++ RF_REG_PAIR(4, 56, 0xcc),
++ RF_REG_PAIR(4, 57, 0x14),
++ RF_REG_PAIR(4, 58, 0x07),
++ RF_REG_PAIR(4, 59, 0xa8),
++ RF_REG_PAIR(4, 60, 0xd7),
++ RF_REG_PAIR(4, 61, 0x10),
++ RF_REG_PAIR(4, 62, 0x1c),
++ RF_REG_PAIR(4, 63, 0x00), /* reserved */
++};
++
++static const struct mt76_reg_pair rf_vga[] = {
++ RF_REG_PAIR(5, 0, 0x47),
++ RF_REG_PAIR(5, 1, 0x00),
++ RF_REG_PAIR(5, 2, 0x00),
++ RF_REG_PAIR(5, 3, 0x08),
++ RF_REG_PAIR(5, 4, 0x04),
++ RF_REG_PAIR(5, 5, 0x20),
++ RF_REG_PAIR(5, 6, 0x3a),
++ RF_REG_PAIR(5, 7, 0x3a),
++ RF_REG_PAIR(5, 8, 0x00),
++ RF_REG_PAIR(5, 9, 0x00),
++ RF_REG_PAIR(5, 10, 0x10),
++ RF_REG_PAIR(5, 11, 0x10),
++ RF_REG_PAIR(5, 12, 0x10),
++ RF_REG_PAIR(5, 13, 0x10),
++ RF_REG_PAIR(5, 14, 0x10),
++ RF_REG_PAIR(5, 15, 0x20),
++ RF_REG_PAIR(5, 16, 0x22),
++ RF_REG_PAIR(5, 17, 0x7c),
++ RF_REG_PAIR(5, 18, 0x00),
++ RF_REG_PAIR(5, 19, 0x00),
++ RF_REG_PAIR(5, 20, 0x00),
++ RF_REG_PAIR(5, 21, 0xf1),
++ RF_REG_PAIR(5, 22, 0x11),
++ RF_REG_PAIR(5, 23, 0x02),
++ RF_REG_PAIR(5, 24, 0x41),
++ RF_REG_PAIR(5, 25, 0x20),
++ RF_REG_PAIR(5, 26, 0x00),
++ RF_REG_PAIR(5, 27, 0xd7),
++ RF_REG_PAIR(5, 28, 0xa2),
++ RF_REG_PAIR(5, 29, 0x20),
++ RF_REG_PAIR(5, 30, 0x49),
++ RF_REG_PAIR(5, 31, 0x20),
++ RF_REG_PAIR(5, 32, 0x04),
++ RF_REG_PAIR(5, 33, 0xf1),
++ RF_REG_PAIR(5, 34, 0xa1),
++ RF_REG_PAIR(5, 35, 0x01),
++ RF_REG_PAIR(5, 41, 0x00),
++ RF_REG_PAIR(5, 42, 0x00),
++ RF_REG_PAIR(5, 43, 0x00),
++ RF_REG_PAIR(5, 44, 0x00),
++ RF_REG_PAIR(5, 45, 0x00),
++ RF_REG_PAIR(5, 46, 0x00),
++ RF_REG_PAIR(5, 47, 0x00),
++ RF_REG_PAIR(5, 48, 0x00),
++ RF_REG_PAIR(5, 49, 0x00),
++ RF_REG_PAIR(5, 50, 0x00),
++ RF_REG_PAIR(5, 51, 0x00),
++ RF_REG_PAIR(5, 52, 0x00),
++ RF_REG_PAIR(5, 53, 0x00),
++ RF_REG_PAIR(5, 54, 0x00),
++ RF_REG_PAIR(5, 55, 0x00),
++ RF_REG_PAIR(5, 56, 0x00),
++ RF_REG_PAIR(5, 57, 0x00),
++ RF_REG_PAIR(5, 58, 0x31),
++ RF_REG_PAIR(5, 59, 0x31),
++ RF_REG_PAIR(5, 60, 0x0a),
++ RF_REG_PAIR(5, 61, 0x02),
++ RF_REG_PAIR(5, 62, 0x00),
++ RF_REG_PAIR(5, 63, 0x00),
++};
++
++/* TODO: BBP178 is set to 0xff for "CCK CH14 OBW" which overrides the settings
++ * from channel switching. Seems stupid at best.
++ */
++static const struct mt76_reg_pair bbp_high_temp[] = {
++ { 75, 0x60 },
++ { 92, 0x02 },
++ { 178, 0xff }, /* For CCK CH14 OBW */
++ { 195, 0x88 }, { 196, 0x60 },
++}, bbp_high_temp_bw20[] = {
++ { 69, 0x12 },
++ { 91, 0x07 },
++ { 195, 0x23 }, { 196, 0x17 },
++ { 195, 0x24 }, { 196, 0x06 },
++ { 195, 0x81 }, { 196, 0x12 },
++ { 195, 0x83 }, { 196, 0x17 },
++}, bbp_high_temp_bw40[] = {
++ { 69, 0x15 },
++ { 91, 0x04 },
++ { 195, 0x23 }, { 196, 0x12 },
++ { 195, 0x24 }, { 196, 0x08 },
++ { 195, 0x81 }, { 196, 0x15 },
++ { 195, 0x83 }, { 196, 0x16 },
++}, bbp_low_temp[] = {
++ { 178, 0xff }, /* For CCK CH14 OBW */
++}, bbp_low_temp_bw20[] = {
++ { 69, 0x12 },
++ { 75, 0x5e },
++ { 91, 0x07 },
++ { 92, 0x02 },
++ { 195, 0x23 }, { 196, 0x17 },
++ { 195, 0x24 }, { 196, 0x06 },
++ { 195, 0x81 }, { 196, 0x12 },
++ { 195, 0x83 }, { 196, 0x17 },
++ { 195, 0x88 }, { 196, 0x5e },
++}, bbp_low_temp_bw40[] = {
++ { 69, 0x15 },
++ { 75, 0x5c },
++ { 91, 0x04 },
++ { 92, 0x03 },
++ { 195, 0x23 }, { 196, 0x10 },
++ { 195, 0x24 }, { 196, 0x08 },
++ { 195, 0x81 }, { 196, 0x15 },
++ { 195, 0x83 }, { 196, 0x16 },
++ { 195, 0x88 }, { 196, 0x5b },
++}, bbp_normal_temp[] = {
++ { 75, 0x60 },
++ { 92, 0x02 },
++ { 178, 0xff }, /* For CCK CH14 OBW */
++ { 195, 0x88 }, { 196, 0x60 },
++}, bbp_normal_temp_bw20[] = {
++ { 69, 0x12 },
++ { 91, 0x07 },
++ { 195, 0x23 }, { 196, 0x17 },
++ { 195, 0x24 }, { 196, 0x06 },
++ { 195, 0x81 }, { 196, 0x12 },
++ { 195, 0x83 }, { 196, 0x17 },
++}, bbp_normal_temp_bw40[] = {
++ { 69, 0x15 },
++ { 91, 0x04 },
++ { 195, 0x23 }, { 196, 0x12 },
++ { 195, 0x24 }, { 196, 0x08 },
++ { 195, 0x81 }, { 196, 0x15 },
++ { 195, 0x83 }, { 196, 0x16 },
++};
++
++#define BBP_TABLE(arr) { arr, ARRAY_SIZE(arr), }
++
++static const struct reg_table {
++ const struct mt76_reg_pair *regs;
++ size_t n;
++} bbp_mode_table[3][3] = {
++ {
++ BBP_TABLE(bbp_normal_temp_bw20),
++ BBP_TABLE(bbp_normal_temp_bw40),
++ BBP_TABLE(bbp_normal_temp),
++ }, {
++ BBP_TABLE(bbp_high_temp_bw20),
++ BBP_TABLE(bbp_high_temp_bw40),
++ BBP_TABLE(bbp_high_temp),
++ }, {
++ BBP_TABLE(bbp_low_temp_bw20),
++ BBP_TABLE(bbp_low_temp_bw40),
++ BBP_TABLE(bbp_low_temp),
++ }
++};
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mac.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/mac.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mac.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/mac.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,573 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++#include "trace.h"
++#include <linux/etherdevice.h>
++
++static void
++mt76_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate)
++{
++ u8 idx = MT76_GET(MT_TXWI_RATE_MCS, rate);
++
++ txrate->idx = 0;
++ txrate->flags = 0;
++ txrate->count = 1;
++
++ switch (MT76_GET(MT_TXWI_RATE_PHY_MODE, rate)) {
++ case MT_PHY_TYPE_OFDM:
++ txrate->idx = idx + 4;
++ return;
++ case MT_PHY_TYPE_CCK:
++ if (idx >= 8)
++ idx -= 8;
++
++ txrate->idx = idx;
++ return;
++ case MT_PHY_TYPE_HT_GF:
++ txrate->flags |= IEEE80211_TX_RC_GREEN_FIELD;
++ /* fall through */
++ case MT_PHY_TYPE_HT:
++ txrate->flags |= IEEE80211_TX_RC_MCS;
++ txrate->idx = idx;
++ break;
++ default:
++ WARN_ON(1);
++ return;
++ }
++
++ if (MT76_GET(MT_TXWI_RATE_BW, rate) == MT_PHY_BW_40)
++ txrate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
++
++ if (rate & MT_TXWI_RATE_SGI)
++ txrate->flags |= IEEE80211_TX_RC_SHORT_GI;
++}
++
++static void
++mt76_mac_fill_tx_status(struct mt7601u_dev *dev, struct ieee80211_tx_info *info,
++ struct mt76_tx_status *st)
++{
++ struct ieee80211_tx_rate *rate = info->status.rates;
++ int cur_idx, last_rate;
++ int i;
++
++ last_rate = min_t(int, st->retry, IEEE80211_TX_MAX_RATES - 1);
++ mt76_mac_process_tx_rate(&rate[last_rate], st->rate);
++ if (last_rate < IEEE80211_TX_MAX_RATES - 1)
++ rate[last_rate + 1].idx = -1;
++
++ cur_idx = rate[last_rate].idx + st->retry;
++ for (i = 0; i <= last_rate; i++) {
++ rate[i].flags = rate[last_rate].flags;
++ rate[i].idx = max_t(int, 0, cur_idx - i);
++ rate[i].count = 1;
++ }
++
++ if (last_rate > 0)
++ rate[last_rate - 1].count = st->retry + 1 - last_rate;
++
++ info->status.ampdu_len = 1;
++ info->status.ampdu_ack_len = st->success;
++
++ if (st->is_probe)
++ info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
++
++ if (st->aggr)
++ info->flags |= IEEE80211_TX_CTL_AMPDU |
++ IEEE80211_TX_STAT_AMPDU;
++
++ if (!st->ack_req)
++ info->flags |= IEEE80211_TX_CTL_NO_ACK;
++ else if (st->success)
++ info->flags |= IEEE80211_TX_STAT_ACK;
++}
++
++u16 mt76_mac_tx_rate_val(struct mt7601u_dev *dev,
++ const struct ieee80211_tx_rate *rate, u8 *nss_val)
++{
++ u16 rateval;
++ u8 phy, rate_idx;
++ u8 nss = 1;
++ u8 bw = 0;
++
++ if (rate->flags & IEEE80211_TX_RC_MCS) {
++ rate_idx = rate->idx;
++ nss = 1 + (rate->idx >> 3);
++ phy = MT_PHY_TYPE_HT;
++ if (rate->flags & IEEE80211_TX_RC_GREEN_FIELD)
++ phy = MT_PHY_TYPE_HT_GF;
++ if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
++ bw = 1;
++ } else {
++ const struct ieee80211_rate *r;
++ int band = dev->chandef.chan->band;
++ u16 val;
++
++ r = &dev->hw->wiphy->bands[band]->bitrates[rate->idx];
++ if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
++ val = r->hw_value_short;
++ else
++ val = r->hw_value;
++
++ phy = val >> 8;
++ rate_idx = val & 0xff;
++ bw = 0;
++ }
++
++ rateval = MT76_SET(MT_RXWI_RATE_MCS, rate_idx);
++ rateval |= MT76_SET(MT_RXWI_RATE_PHY, phy);
++ rateval |= MT76_SET(MT_RXWI_RATE_BW, bw);
++ if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
++ rateval |= MT_RXWI_RATE_SGI;
++
++ *nss_val = nss;
++ return rateval;
++}
++
++void mt76_mac_wcid_set_rate(struct mt7601u_dev *dev, struct mt76_wcid *wcid,
++ const struct ieee80211_tx_rate *rate)
++{
++ unsigned long flags;
++
++ spin_lock_irqsave(&dev->lock, flags);
++ wcid->tx_rate = mt76_mac_tx_rate_val(dev, rate, &wcid->tx_rate_nss);
++ wcid->tx_rate_set = true;
++ spin_unlock_irqrestore(&dev->lock, flags);
++}
++
++struct mt76_tx_status mt7601u_mac_fetch_tx_status(struct mt7601u_dev *dev)
++{
++ struct mt76_tx_status stat = {};
++ u32 val;
++
++ val = mt7601u_rr(dev, MT_TX_STAT_FIFO);
++ stat.valid = !!(val & MT_TX_STAT_FIFO_VALID);
++ stat.success = !!(val & MT_TX_STAT_FIFO_SUCCESS);
++ stat.aggr = !!(val & MT_TX_STAT_FIFO_AGGR);
++ stat.ack_req = !!(val & MT_TX_STAT_FIFO_ACKREQ);
++ stat.pktid = MT76_GET(MT_TX_STAT_FIFO_PID_TYPE, val);
++ stat.wcid = MT76_GET(MT_TX_STAT_FIFO_WCID, val);
++ stat.rate = MT76_GET(MT_TX_STAT_FIFO_RATE, val);
++
++ return stat;
++}
++
++void mt76_send_tx_status(struct mt7601u_dev *dev, struct mt76_tx_status *stat)
++{
++ struct ieee80211_tx_info info = {};
++ struct ieee80211_sta *sta = NULL;
++ struct mt76_wcid *wcid = NULL;
++ void *msta;
++
++ rcu_read_lock();
++ if (stat->wcid < ARRAY_SIZE(dev->wcid))
++ wcid = rcu_dereference(dev->wcid[stat->wcid]);
++
++ if (wcid) {
++ msta = container_of(wcid, struct mt76_sta, wcid);
++ sta = container_of(msta, struct ieee80211_sta,
++ drv_priv);
++ }
++
++ mt76_mac_fill_tx_status(dev, &info, stat);
++ ieee80211_tx_status_noskb(dev->hw, sta, &info);
++ rcu_read_unlock();
++}
++
++void mt7601u_mac_set_protection(struct mt7601u_dev *dev, bool legacy_prot,
++ int ht_mode)
++{
++ int mode = ht_mode & IEEE80211_HT_OP_MODE_PROTECTION;
++ bool non_gf = !!(ht_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
++ u32 prot[6];
++ bool ht_rts[4] = {};
++ int i;
++
++ prot[0] = MT_PROT_NAV_SHORT |
++ MT_PROT_TXOP_ALLOW_ALL |
++ MT_PROT_RTS_THR_EN;
++ prot[1] = prot[0];
++ if (legacy_prot)
++ prot[1] |= MT_PROT_CTRL_CTS2SELF;
++
++ prot[2] = prot[4] = MT_PROT_NAV_SHORT | MT_PROT_TXOP_ALLOW_BW20;
++ prot[3] = prot[5] = MT_PROT_NAV_SHORT | MT_PROT_TXOP_ALLOW_ALL;
++
++ if (legacy_prot) {
++ prot[2] |= MT_PROT_RATE_CCK_11;
++ prot[3] |= MT_PROT_RATE_CCK_11;
++ prot[4] |= MT_PROT_RATE_CCK_11;
++ prot[5] |= MT_PROT_RATE_CCK_11;
++ } else {
++ prot[2] |= MT_PROT_RATE_OFDM_24;
++ prot[3] |= MT_PROT_RATE_DUP_OFDM_24;
++ prot[4] |= MT_PROT_RATE_OFDM_24;
++ prot[5] |= MT_PROT_RATE_DUP_OFDM_24;
++ }
++
++ switch (mode) {
++ case IEEE80211_HT_OP_MODE_PROTECTION_NONE:
++ break;
++
++ case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER:
++ ht_rts[0] = ht_rts[1] = ht_rts[2] = ht_rts[3] = true;
++ break;
++
++ case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
++ ht_rts[1] = ht_rts[3] = true;
++ break;
++
++ case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED:
++ ht_rts[0] = ht_rts[1] = ht_rts[2] = ht_rts[3] = true;
++ break;
++ }
++
++ if (non_gf)
++ ht_rts[2] = ht_rts[3] = true;
++
++ for (i = 0; i < 4; i++)
++ if (ht_rts[i])
++ prot[i + 2] |= MT_PROT_CTRL_RTS_CTS;
++
++ for (i = 0; i < 6; i++)
++ mt7601u_wr(dev, MT_CCK_PROT_CFG + i * 4, prot[i]);
++}
++
++void mt7601u_mac_set_short_preamble(struct mt7601u_dev *dev, bool short_preamb)
++{
++ if (short_preamb)
++ mt76_set(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT);
++ else
++ mt76_clear(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT);
++}
++
++void mt7601u_mac_config_tsf(struct mt7601u_dev *dev, bool enable, int interval)
++{
++ u32 val = mt7601u_rr(dev, MT_BEACON_TIME_CFG);
++
++ val &= ~(MT_BEACON_TIME_CFG_TIMER_EN |
++ MT_BEACON_TIME_CFG_SYNC_MODE |
++ MT_BEACON_TIME_CFG_TBTT_EN);
++
++ if (!enable) {
++ mt7601u_wr(dev, MT_BEACON_TIME_CFG, val);
++ return;
++ }
++
++ val &= ~MT_BEACON_TIME_CFG_INTVAL;
++ val |= MT76_SET(MT_BEACON_TIME_CFG_INTVAL, interval << 4) |
++ MT_BEACON_TIME_CFG_TIMER_EN |
++ MT_BEACON_TIME_CFG_SYNC_MODE |
++ MT_BEACON_TIME_CFG_TBTT_EN;
++}
++
++static void mt7601u_check_mac_err(struct mt7601u_dev *dev)
++{
++ u32 val = mt7601u_rr(dev, 0x10f4);
++
++ if (!(val & BIT(29)) || !(val & (BIT(7) | BIT(5))))
++ return;
++
++ dev_err(dev->dev, "Error: MAC specific condition occurred\n");
++
++ mt76_set(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR);
++ udelay(10);
++ mt76_clear(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR);
++}
++
++void mt7601u_mac_work(struct work_struct *work)
++{
++ struct mt7601u_dev *dev = container_of(work, struct mt7601u_dev,
++ mac_work.work);
++ struct {
++ u32 addr_base;
++ u32 span;
++ u64 *stat_base;
++ } spans[] = {
++ { MT_RX_STA_CNT0, 3, dev->stats.rx_stat },
++ { MT_TX_STA_CNT0, 3, dev->stats.tx_stat },
++ { MT_TX_AGG_STAT, 1, dev->stats.aggr_stat },
++ { MT_MPDU_DENSITY_CNT, 1, dev->stats.zero_len_del },
++ { MT_TX_AGG_CNT_BASE0, 8, &dev->stats.aggr_n[0] },
++ { MT_TX_AGG_CNT_BASE1, 8, &dev->stats.aggr_n[16] },
++ };
++ u32 sum, n;
++ int i, j, k;
++
++ /* Note: using MCU_RANDOM_READ is actually slower then reading all the
++ * registers by hand. MCU takes ca. 20ms to complete read of 24
++ * registers while reading them one by one will takes roughly
++ * 24*200us =~ 5ms.
++ */
++
++ k = 0;
++ n = 0;
++ sum = 0;
++ for (i = 0; i < ARRAY_SIZE(spans); i++)
++ for (j = 0; j < spans[i].span; j++) {
++ u32 val = mt7601u_rr(dev, spans[i].addr_base + j * 4);
++
++ spans[i].stat_base[j * 2] += val & 0xffff;
++ spans[i].stat_base[j * 2 + 1] += val >> 16;
++
++ /* Calculate average AMPDU length */
++ if (spans[i].addr_base != MT_TX_AGG_CNT_BASE0 &&
++ spans[i].addr_base != MT_TX_AGG_CNT_BASE1)
++ continue;
++
++ n += (val >> 16) + (val & 0xffff);
++ sum += (val & 0xffff) * (1 + k * 2) +
++ (val >> 16) * (2 + k * 2);
++ k++;
++ }
++
++ atomic_set(&dev->avg_ampdu_len, n ? DIV_ROUND_CLOSEST(sum, n) : 1);
++
++ mt7601u_check_mac_err(dev);
++
++ ieee80211_queue_delayed_work(dev->hw, &dev->mac_work, 10 * HZ);
++}
++
++void
++mt7601u_mac_wcid_setup(struct mt7601u_dev *dev, u8 idx, u8 vif_idx, u8 *mac)
++{
++ u8 zmac[ETH_ALEN] = {};
++ u32 attr;
++
++ attr = MT76_SET(MT_WCID_ATTR_BSS_IDX, vif_idx & 7) |
++ MT76_SET(MT_WCID_ATTR_BSS_IDX_EXT, !!(vif_idx & 8));
++
++ mt76_wr(dev, MT_WCID_ATTR(idx), attr);
++
++ if (mac)
++ memcpy(zmac, mac, sizeof(zmac));
++
++ mt7601u_addr_wr(dev, MT_WCID_ADDR(idx), zmac);
++}
++
++void mt7601u_mac_set_ampdu_factor(struct mt7601u_dev *dev)
++{
++ struct ieee80211_sta *sta;
++ struct mt76_wcid *wcid;
++ void *msta;
++ u8 min_factor = 3;
++ int i;
++
++ rcu_read_lock();
++ for (i = 0; i < ARRAY_SIZE(dev->wcid); i++) {
++ wcid = rcu_dereference(dev->wcid[i]);
++ if (!wcid)
++ continue;
++
++ msta = container_of(wcid, struct mt76_sta, wcid);
++ sta = container_of(msta, struct ieee80211_sta, drv_priv);
++
++ min_factor = min(min_factor, sta->ht_cap.ampdu_factor);
++ }
++ rcu_read_unlock();
++
++ mt7601u_wr(dev, MT_MAX_LEN_CFG, 0xa0fff |
++ MT76_SET(MT_MAX_LEN_CFG_AMPDU, min_factor));
++}
++
++static void
++mt76_mac_process_rate(struct ieee80211_rx_status *status, u16 rate)
++{
++ u8 idx = MT76_GET(MT_RXWI_RATE_MCS, rate);
++
++ switch (MT76_GET(MT_RXWI_RATE_PHY, rate)) {
++ case MT_PHY_TYPE_OFDM:
++ if (WARN_ON(idx >= 8))
++ idx = 0;
++ idx += 4;
++
++ status->rate_idx = idx;
++ return;
++ case MT_PHY_TYPE_CCK:
++ if (idx >= 8) {
++ idx -= 8;
++ status->flag |= RX_FLAG_SHORTPRE;
++ }
++
++ if (WARN_ON(idx >= 4))
++ idx = 0;
++
++ status->rate_idx = idx;
++ return;
++ case MT_PHY_TYPE_HT_GF:
++ status->flag |= RX_FLAG_HT_GF;
++ /* fall through */
++ case MT_PHY_TYPE_HT:
++ status->flag |= RX_FLAG_HT;
++ status->rate_idx = idx;
++ break;
++ default:
++ WARN_ON(1);
++ return;
++ }
++
++ if (rate & MT_RXWI_RATE_SGI)
++ status->flag |= RX_FLAG_SHORT_GI;
++
++ if (rate & MT_RXWI_RATE_STBC)
++ status->flag |= 1 << RX_FLAG_STBC_SHIFT;
++
++ if (rate & MT_RXWI_RATE_BW)
++ status->flag |= RX_FLAG_40MHZ;
++}
++
++static void
++mt7601u_rx_monitor_beacon(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi,
++ u16 rate, int rssi)
++{
++ dev->bcn_freq_off = rxwi->freq_off;
++ dev->bcn_phy_mode = MT76_GET(MT_RXWI_RATE_PHY, rate);
++ dev->avg_rssi = (dev->avg_rssi * 15) / 16 + (rssi << 8);
++}
++
++static int
++mt7601u_rx_is_our_beacon(struct mt7601u_dev *dev, u8 *data)
++{
++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)data;
++
++ return ieee80211_is_beacon(hdr->frame_control) &&
++ ether_addr_equal(hdr->addr2, dev->ap_bssid);
++}
++
++u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,
++ u8 *data, void *rxi)
++{
++ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
++ struct mt7601u_rxwi *rxwi = rxi;
++ u32 len, ctl = le32_to_cpu(rxwi->ctl);
++ u16 rate = le16_to_cpu(rxwi->rate);
++ int rssi;
++
++ len = MT76_GET(MT_RXWI_CTL_MPDU_LEN, ctl);
++ if (len < 10)
++ return 0;
++
++ if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_DECRYPT)) {
++ status->flag |= RX_FLAG_DECRYPTED;
++ status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
++ }
++
++ status->chains = BIT(0);
++ rssi = mt7601u_phy_get_rssi(dev, rxwi, rate);
++ status->chain_signal[0] = status->signal = rssi;
++ status->freq = dev->chandef.chan->center_freq;
++ status->band = dev->chandef.chan->band;
++
++ mt76_mac_process_rate(status, rate);
++
++ spin_lock_bh(&dev->con_mon_lock);
++ if (mt7601u_rx_is_our_beacon(dev, data))
++ mt7601u_rx_monitor_beacon(dev, rxwi, rate, rssi);
++ else if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_U2M))
++ dev->avg_rssi = (dev->avg_rssi * 15) / 16 + (rssi << 8);
++ spin_unlock_bh(&dev->con_mon_lock);
++
++ return len;
++}
++
++static enum mt76_cipher_type
++mt76_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data)
++{
++ memset(key_data, 0, 32);
++ if (!key)
++ return MT_CIPHER_NONE;
++
++ if (key->keylen > 32)
++ return MT_CIPHER_NONE;
++
++ memcpy(key_data, key->key, key->keylen);
++
++ switch (key->cipher) {
++ case WLAN_CIPHER_SUITE_WEP40:
++ return MT_CIPHER_WEP40;
++ case WLAN_CIPHER_SUITE_WEP104:
++ return MT_CIPHER_WEP104;
++ case WLAN_CIPHER_SUITE_TKIP:
++ return MT_CIPHER_TKIP;
++ case WLAN_CIPHER_SUITE_CCMP:
++ return MT_CIPHER_AES_CCMP;
++ default:
++ return MT_CIPHER_NONE;
++ }
++}
++
++int mt76_mac_wcid_set_key(struct mt7601u_dev *dev, u8 idx,
++ struct ieee80211_key_conf *key)
++{
++ enum mt76_cipher_type cipher;
++ u8 key_data[32];
++ u8 iv_data[8];
++ u32 val;
++
++ cipher = mt76_mac_get_key_info(key, key_data);
++ if (cipher == MT_CIPHER_NONE && key)
++ return -EINVAL;
++
++ trace_set_key(dev, idx);
++
++ mt7601u_wr_copy(dev, MT_WCID_KEY(idx), key_data, sizeof(key_data));
++
++ memset(iv_data, 0, sizeof(iv_data));
++ if (key) {
++ iv_data[3] = key->keyidx << 6;
++ if (cipher >= MT_CIPHER_TKIP) {
++ /* Note: start with 1 to comply with spec,
++ * (see comment on common/cmm_wpa.c:4291).
++ */
++ iv_data[0] |= 1;
++ iv_data[3] |= 0x20;
++ }
++ }
++ mt7601u_wr_copy(dev, MT_WCID_IV(idx), iv_data, sizeof(iv_data));
++
++ val = mt7601u_rr(dev, MT_WCID_ATTR(idx));
++ val &= ~MT_WCID_ATTR_PKEY_MODE & ~MT_WCID_ATTR_PKEY_MODE_EXT;
++ val |= MT76_SET(MT_WCID_ATTR_PKEY_MODE, cipher & 7) |
++ MT76_SET(MT_WCID_ATTR_PKEY_MODE_EXT, cipher >> 3);
++ val &= ~MT_WCID_ATTR_PAIRWISE;
++ val |= MT_WCID_ATTR_PAIRWISE *
++ !!(key && key->flags & IEEE80211_KEY_FLAG_PAIRWISE);
++ mt7601u_wr(dev, MT_WCID_ATTR(idx), val);
++
++ return 0;
++}
++
++int mt76_mac_shared_key_setup(struct mt7601u_dev *dev, u8 vif_idx, u8 key_idx,
++ struct ieee80211_key_conf *key)
++{
++ enum mt76_cipher_type cipher;
++ u8 key_data[32];
++ u32 val;
++
++ cipher = mt76_mac_get_key_info(key, key_data);
++ if (cipher == MT_CIPHER_NONE && key)
++ return -EINVAL;
++
++ trace_set_shared_key(dev, vif_idx, key_idx);
++
++ mt7601u_wr_copy(dev, MT_SKEY(vif_idx, key_idx),
++ key_data, sizeof(key_data));
++
++ val = mt76_rr(dev, MT_SKEY_MODE(vif_idx));
++ val &= ~(MT_SKEY_MODE_MASK << MT_SKEY_MODE_SHIFT(vif_idx, key_idx));
++ val |= cipher << MT_SKEY_MODE_SHIFT(vif_idx, key_idx);
++ mt76_wr(dev, MT_SKEY_MODE(vif_idx), val);
++
++ return 0;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mac.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/mac.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mac.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/mac.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,178 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT76_MAC_H
++#define __MT76_MAC_H
++
++struct mt76_tx_status {
++ u8 valid:1;
++ u8 success:1;
++ u8 aggr:1;
++ u8 ack_req:1;
++ u8 is_probe:1;
++ u8 wcid;
++ u8 pktid;
++ u8 retry;
++ u16 rate;
++} __packed __aligned(2);
++
++/* Note: values in original "RSSI" and "SNR" fields are not actually what they
++ * are called for MT7601U, names used by this driver are educated guesses
++ * (see vendor mac/ral_omac.c).
++ */
++struct mt7601u_rxwi {
++ __le32 rxinfo;
++
++ __le32 ctl;
++
++ __le16 frag_sn;
++ __le16 rate;
++
++ u8 unknown;
++ u8 zero[3];
++
++ u8 snr;
++ u8 ant;
++ u8 gain;
++ u8 freq_off;
++
++ __le32 resv2;
++ __le32 expert_ant;
++} __packed __aligned(4);
++
++#define MT_RXINFO_BA BIT(0)
++#define MT_RXINFO_DATA BIT(1)
++#define MT_RXINFO_NULL BIT(2)
++#define MT_RXINFO_FRAG BIT(3)
++#define MT_RXINFO_U2M BIT(4)
++#define MT_RXINFO_MULTICAST BIT(5)
++#define MT_RXINFO_BROADCAST BIT(6)
++#define MT_RXINFO_MYBSS BIT(7)
++#define MT_RXINFO_CRCERR BIT(8)
++#define MT_RXINFO_ICVERR BIT(9)
++#define MT_RXINFO_MICERR BIT(10)
++#define MT_RXINFO_AMSDU BIT(11)
++#define MT_RXINFO_HTC BIT(12)
++#define MT_RXINFO_RSSI BIT(13)
++#define MT_RXINFO_L2PAD BIT(14)
++#define MT_RXINFO_AMPDU BIT(15)
++#define MT_RXINFO_DECRYPT BIT(16)
++#define MT_RXINFO_BSSIDX3 BIT(17)
++#define MT_RXINFO_WAPI_KEY BIT(18)
++#define MT_RXINFO_PN_LEN GENMASK(21, 19)
++#define MT_RXINFO_SW_PKT_80211 BIT(22)
++#define MT_RXINFO_TCP_SUM_BYPASS BIT(28)
++#define MT_RXINFO_IP_SUM_BYPASS BIT(29)
++#define MT_RXINFO_TCP_SUM_ERR BIT(30)
++#define MT_RXINFO_IP_SUM_ERR BIT(31)
++
++#define MT_RXWI_CTL_WCID GENMASK(7, 0)
++#define MT_RXWI_CTL_KEY_IDX GENMASK(9, 8)
++#define MT_RXWI_CTL_BSS_IDX GENMASK(12, 10)
++#define MT_RXWI_CTL_UDF GENMASK(15, 13)
++#define MT_RXWI_CTL_MPDU_LEN GENMASK(27, 16)
++#define MT_RXWI_CTL_TID GENMASK(31, 28)
++
++#define MT_RXWI_FRAG GENMASK(3, 0)
++#define MT_RXWI_SN GENMASK(15, 4)
++
++#define MT_RXWI_RATE_MCS GENMASK(6, 0)
++#define MT_RXWI_RATE_BW BIT(7)
++#define MT_RXWI_RATE_SGI BIT(8)
++#define MT_RXWI_RATE_STBC GENMASK(10, 9)
++#define MT_RXWI_RATE_ETXBF BIT(11)
++#define MT_RXWI_RATE_SND BIT(12)
++#define MT_RXWI_RATE_ITXBF BIT(13)
++#define MT_RXWI_RATE_PHY GENMASK(15, 14)
++
++#define MT_RXWI_GAIN_RSSI_VAL GENMASK(5, 0)
++#define MT_RXWI_GAIN_RSSI_LNA_ID GENMASK(7, 6)
++#define MT_RXWI_ANT_AUX_LNA BIT(7)
++
++#define MT_RXWI_EANT_ENC_ANT_ID GENMASK(7, 0)
++
++enum mt76_phy_type {
++ MT_PHY_TYPE_CCK,
++ MT_PHY_TYPE_OFDM,
++ MT_PHY_TYPE_HT,
++ MT_PHY_TYPE_HT_GF,
++};
++
++enum mt76_phy_bandwidth {
++ MT_PHY_BW_20,
++ MT_PHY_BW_40,
++};
++
++struct mt76_txwi {
++ __le16 flags;
++ __le16 rate_ctl;
++
++ u8 ack_ctl;
++ u8 wcid;
++ __le16 len_ctl;
++
++ __le32 iv;
++
++ __le32 eiv;
++
++ u8 aid;
++ u8 txstream;
++ __le16 ctl;
++} __packed __aligned(4);
++
++#define MT_TXWI_FLAGS_FRAG BIT(0)
++#define MT_TXWI_FLAGS_MMPS BIT(1)
++#define MT_TXWI_FLAGS_CFACK BIT(2)
++#define MT_TXWI_FLAGS_TS BIT(3)
++#define MT_TXWI_FLAGS_AMPDU BIT(4)
++#define MT_TXWI_FLAGS_MPDU_DENSITY GENMASK(7, 5)
++#define MT_TXWI_FLAGS_TXOP GENMASK(9, 8)
++#define MT_TXWI_FLAGS_CWMIN GENMASK(12, 10)
++#define MT_TXWI_FLAGS_NO_RATE_FALLBACK BIT(13)
++#define MT_TXWI_FLAGS_TX_RPT BIT(14)
++#define MT_TXWI_FLAGS_TX_RATE_LUT BIT(15)
++
++#define MT_TXWI_RATE_MCS GENMASK(6, 0)
++#define MT_TXWI_RATE_BW BIT(7)
++#define MT_TXWI_RATE_SGI BIT(8)
++#define MT_TXWI_RATE_STBC GENMASK(10, 9)
++#define MT_TXWI_RATE_PHY_MODE GENMASK(15, 14)
++
++#define MT_TXWI_ACK_CTL_REQ BIT(0)
++#define MT_TXWI_ACK_CTL_NSEQ BIT(1)
++#define MT_TXWI_ACK_CTL_BA_WINDOW GENMASK(7, 2)
++
++#define MT_TXWI_LEN_BYTE_CNT GENMASK(11, 0)
++#define MT_TXWI_LEN_PKTID GENMASK(15, 12)
++
++#define MT_TXWI_CTL_TX_POWER_ADJ GENMASK(3, 0)
++#define MT_TXWI_CTL_CHAN_CHECK_PKT BIT(4)
++#define MT_TXWI_CTL_PIFS_REV BIT(6)
++
++u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,
++ u8 *data, void *rxi);
++int mt76_mac_wcid_set_key(struct mt7601u_dev *dev, u8 idx,
++ struct ieee80211_key_conf *key);
++void mt76_mac_wcid_set_rate(struct mt7601u_dev *dev, struct mt76_wcid *wcid,
++ const struct ieee80211_tx_rate *rate);
++
++int mt76_mac_shared_key_setup(struct mt7601u_dev *dev, u8 vif_idx, u8 key_idx,
++ struct ieee80211_key_conf *key);
++u16 mt76_mac_tx_rate_val(struct mt7601u_dev *dev,
++ const struct ieee80211_tx_rate *rate, u8 *nss_val);
++struct mt76_tx_status
++mt7601u_mac_fetch_tx_status(struct mt7601u_dev *dev);
++void mt76_send_tx_status(struct mt7601u_dev *dev, struct mt76_tx_status *stat);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/main.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/main.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/main.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/main.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,413 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++#include "mac.h"
++#include <linux/etherdevice.h>
++#include <linux/version.h>
++
++static int mt7601u_start(struct ieee80211_hw *hw)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ int ret;
++
++ mutex_lock(&dev->mutex);
++
++ ret = mt7601u_mac_start(dev);
++ if (ret)
++ goto out;
++
++ ieee80211_queue_delayed_work(dev->hw, &dev->mac_work,
++ MT_CALIBRATE_INTERVAL);
++ ieee80211_queue_delayed_work(dev->hw, &dev->cal_work,
++ MT_CALIBRATE_INTERVAL);
++out:
++ mutex_unlock(&dev->mutex);
++ return ret;
++}
++
++static void mt7601u_stop(struct ieee80211_hw *hw)
++{
++ struct mt7601u_dev *dev = hw->priv;
++
++ mutex_lock(&dev->mutex);
++
++ cancel_delayed_work_sync(&dev->cal_work);
++ cancel_delayed_work_sync(&dev->mac_work);
++ mt7601u_mac_stop(dev);
++
++ mutex_unlock(&dev->mutex);
++}
++
++static int mt7601u_add_interface(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
++ unsigned int idx = 0;
++ unsigned int wcid = GROUP_WCID(idx);
++
++ /* Note: for AP do the AP-STA things mt76 does:
++ * - beacon offsets
++ * - do mac address tricks
++ * - shift vif idx
++ */
++ mvif->idx = idx;
++
++ if (dev->wcid_mask[wcid / BITS_PER_LONG] & BIT(wcid % BITS_PER_LONG))
++ return -ENOSPC;
++ dev->wcid_mask[wcid / BITS_PER_LONG] |= BIT(wcid % BITS_PER_LONG);
++ mvif->group_wcid.idx = wcid;
++ mvif->group_wcid.hw_key_idx = -1;
++
++ return 0;
++}
++
++static void mt7601u_remove_interface(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
++ unsigned int wcid = mvif->group_wcid.idx;
++
++ dev->wcid_mask[wcid / BITS_PER_LONG] &= ~BIT(wcid % BITS_PER_LONG);
++}
++
++static int mt7601u_config(struct ieee80211_hw *hw, u32 changed)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ int ret = 0;
++
++ mutex_lock(&dev->mutex);
++
++ if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
++ ieee80211_stop_queues(hw);
++ ret = mt7601u_phy_set_channel(dev, &hw->conf.chandef);
++ ieee80211_wake_queues(hw);
++ }
++
++ mutex_unlock(&dev->mutex);
++
++ return ret;
++}
++
++static void
++mt76_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
++ unsigned int *total_flags, u64 multicast)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ u32 flags = 0;
++
++#define MT76_FILTER(_flag, _hw) do { \
++ flags |= *total_flags & FIF_##_flag; \
++ dev->rxfilter &= ~(_hw); \
++ dev->rxfilter |= !(flags & FIF_##_flag) * (_hw); \
++ } while (0)
++
++ mutex_lock(&dev->mutex);
++
++ dev->rxfilter &= ~MT_RX_FILTR_CFG_OTHER_BSS;
++
++ MT76_FILTER(OTHER_BSS, MT_RX_FILTR_CFG_PROMISC);
++ MT76_FILTER(FCSFAIL, MT_RX_FILTR_CFG_CRC_ERR);
++ MT76_FILTER(PLCPFAIL, MT_RX_FILTR_CFG_PHY_ERR);
++ MT76_FILTER(CONTROL, MT_RX_FILTR_CFG_ACK |
++ MT_RX_FILTR_CFG_CTS |
++ MT_RX_FILTR_CFG_CFEND |
++ MT_RX_FILTR_CFG_CFACK |
++ MT_RX_FILTR_CFG_BA |
++ MT_RX_FILTR_CFG_CTRL_RSV);
++ MT76_FILTER(PSPOLL, MT_RX_FILTR_CFG_PSPOLL);
++
++ *total_flags = flags;
++ mt76_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter);
++
++ mutex_unlock(&dev->mutex);
++}
++
++static void
++mt7601u_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_bss_conf *info, u32 changed)
++{
++ struct mt7601u_dev *dev = hw->priv;
++
++ mutex_lock(&dev->mutex);
++
++ if (changed & BSS_CHANGED_ASSOC)
++ mt7601u_phy_con_cal_onoff(dev, info);
++
++ if (changed & BSS_CHANGED_BSSID) {
++ mt7601u_addr_wr(dev, MT_MAC_BSSID_DW0, info->bssid);
++
++ /* Note: this is a hack because beacon_int is not changed
++ * on leave nor is any more appropriate event generated.
++ * rt2x00 doesn't seem to be bothered though.
++ */
++ if (is_zero_ether_addr(info->bssid))
++ mt7601u_mac_config_tsf(dev, false, 0);
++ }
++
++ if (changed & BSS_CHANGED_BASIC_RATES) {
++ mt7601u_wr(dev, MT_LEGACY_BASIC_RATE, info->basic_rates);
++ mt7601u_wr(dev, MT_HT_FBK_CFG0, 0x65432100);
++ mt7601u_wr(dev, MT_HT_FBK_CFG1, 0xedcba980);
++ mt7601u_wr(dev, MT_LG_FBK_CFG0, 0xedcba988);
++ mt7601u_wr(dev, MT_LG_FBK_CFG1, 0x00002100);
++ }
++
++ if (changed & BSS_CHANGED_BEACON_INT)
++ mt7601u_mac_config_tsf(dev, true, info->beacon_int);
++
++ if (changed & BSS_CHANGED_HT || changed & BSS_CHANGED_ERP_CTS_PROT)
++ mt7601u_mac_set_protection(dev, info->use_cts_prot,
++ info->ht_operation_mode);
++
++ if (changed & BSS_CHANGED_ERP_PREAMBLE)
++ mt7601u_mac_set_short_preamble(dev, info->use_short_preamble);
++
++ if (changed & BSS_CHANGED_ERP_SLOT) {
++ int slottime = info->use_short_slot ? 9 : 20;
++
++ mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG,
++ MT_BKOFF_SLOT_CFG_SLOTTIME, slottime);
++ }
++
++ if (changed & BSS_CHANGED_ASSOC)
++ mt7601u_phy_recalibrate_after_assoc(dev);
++
++ mutex_unlock(&dev->mutex);
++}
++
++static int
++mt76_wcid_alloc(struct mt7601u_dev *dev)
++{
++ int i, idx = 0;
++
++ for (i = 0; i < ARRAY_SIZE(dev->wcid_mask); i++) {
++ idx = ffs(~dev->wcid_mask[i]);
++ if (!idx)
++ continue;
++
++ idx--;
++ dev->wcid_mask[i] |= BIT(idx);
++ break;
++ }
++
++ idx = i * BITS_PER_LONG + idx;
++ if (idx > 119)
++ return -1;
++
++ return idx;
++}
++
++static int
++mt7601u_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
++ struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
++ int ret = 0;
++ int idx = 0;
++
++ mutex_lock(&dev->mutex);
++
++ idx = mt76_wcid_alloc(dev);
++ if (idx < 0) {
++ ret = -ENOSPC;
++ goto out;
++ }
++
++ msta->wcid.idx = idx;
++ msta->wcid.hw_key_idx = -1;
++ mt7601u_mac_wcid_setup(dev, idx, mvif->idx, sta->addr);
++ mt76_clear(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
++ rcu_assign_pointer(dev->wcid[idx], &msta->wcid);
++ mt7601u_mac_set_ampdu_factor(dev);
++
++out:
++ mutex_unlock(&dev->mutex);
++
++ return ret;
++}
++
++static int
++mt7601u_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
++ int idx = msta->wcid.idx;
++
++ mutex_lock(&dev->mutex);
++ rcu_assign_pointer(dev->wcid[idx], NULL);
++ mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
++ dev->wcid_mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG);
++ mt7601u_mac_wcid_setup(dev, idx, 0, NULL);
++ mt7601u_mac_set_ampdu_factor(dev);
++ mutex_unlock(&dev->mutex);
++
++ return 0;
++}
++
++static void
++mt7601u_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ enum sta_notify_cmd cmd, struct ieee80211_sta *sta)
++{
++}
++
++static void
++mt7601u_sw_scan(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif,
++ const u8 *mac_addr)
++{
++ struct mt7601u_dev *dev = hw->priv;
++
++ mt7601u_agc_save(dev);
++ set_bit(MT7601U_STATE_SCANNING, &dev->state);
++}
++
++static void
++mt7601u_sw_scan_complete(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif)
++{
++ struct mt7601u_dev *dev = hw->priv;
++
++ mt7601u_agc_restore(dev);
++ clear_bit(MT7601U_STATE_SCANNING, &dev->state);
++}
++
++static int
++mt7601u_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
++ struct ieee80211_vif *vif, struct ieee80211_sta *sta,
++ struct ieee80211_key_conf *key)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
++ struct mt76_sta *msta = sta ? (struct mt76_sta *) sta->drv_priv : NULL;
++ struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid;
++ int idx = key->keyidx;
++ int ret;
++
++ if (cmd == SET_KEY) {
++ key->hw_key_idx = wcid->idx;
++ wcid->hw_key_idx = idx;
++ } else {
++ if (idx == wcid->hw_key_idx)
++ wcid->hw_key_idx = -1;
++
++ key = NULL;
++ }
++
++ if (!msta) {
++ if (key || wcid->hw_key_idx == idx) {
++ ret = mt76_mac_wcid_set_key(dev, wcid->idx, key);
++ if (ret)
++ return ret;
++ }
++
++ return mt76_mac_shared_key_setup(dev, mvif->idx, idx, key);
++ }
++
++ return mt76_mac_wcid_set_key(dev, msta->wcid.idx, key);
++}
++
++static int mt7601u_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
++{
++ struct mt7601u_dev *dev = hw->priv;
++
++ mt76_rmw_field(dev, MT_TX_RTS_CFG, MT_TX_RTS_CFG_THRESH, value);
++
++ return 0;
++}
++
++static int
++mt76_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ enum ieee80211_ampdu_mlme_action action,
++ struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
++
++ WARN_ON(msta->wcid.idx > GROUP_WCID(0));
++
++ switch (action) {
++ case IEEE80211_AMPDU_RX_START:
++ mt76_set(dev, MT_WCID_ADDR(msta->wcid.idx) + 4, BIT(16 + tid));
++ break;
++ case IEEE80211_AMPDU_RX_STOP:
++ mt76_clear(dev, MT_WCID_ADDR(msta->wcid.idx) + 4,
++ BIT(16 + tid));
++ break;
++ case IEEE80211_AMPDU_TX_OPERATIONAL:
++ ieee80211_send_bar(vif, sta->addr, tid, msta->agg_ssn[tid]);
++ break;
++ case IEEE80211_AMPDU_TX_STOP_FLUSH:
++ case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
++ break;
++ case IEEE80211_AMPDU_TX_START:
++ msta->agg_ssn[tid] = *ssn << 4;
++ ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
++ break;
++ case IEEE80211_AMPDU_TX_STOP_CONT:
++ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
++ break;
++ }
++
++ return 0;
++}
++
++static void
++mt76_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
++ struct ieee80211_sta_rates *rates;
++ struct ieee80211_tx_rate rate = {};
++
++ rcu_read_lock();
++ rates = rcu_dereference(sta->rates);
++
++ if (!rates)
++ goto out;
++
++ rate.idx = rates->rate[0].idx;
++ rate.flags = rates->rate[0].flags;
++ mt76_mac_wcid_set_rate(dev, &msta->wcid, &rate);
++
++out:
++ rcu_read_unlock();
++}
++
++const struct ieee80211_ops mt7601u_ops = {
++ .tx = mt7601u_tx,
++ .start = mt7601u_start,
++ .stop = mt7601u_stop,
++ .add_interface = mt7601u_add_interface,
++ .remove_interface = mt7601u_remove_interface,
++ .config = mt7601u_config,
++ .configure_filter = mt76_configure_filter,
++ .bss_info_changed = mt7601u_bss_info_changed,
++ .sta_add = mt7601u_sta_add,
++ .sta_remove = mt7601u_sta_remove,
++ .sta_notify = mt7601u_sta_notify,
++ .set_key = mt7601u_set_key,
++ .conf_tx = mt7601u_conf_tx,
++ .sw_scan_start = mt7601u_sw_scan,
++ .sw_scan_complete = mt7601u_sw_scan_complete,
++ .ampdu_action = mt76_ampdu_action,
++ .sta_rate_tbl_update = mt76_sta_rate_tbl_update,
++ .set_rts_threshold = mt7601u_set_rts_threshold,
++};
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mcu.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/mcu.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mcu.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/mcu.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,534 @@
++/*
++ * (c) Copyright 2002-2010, Ralink Technology, Inc.
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include <linux/kernel.h>
++#include <linux/firmware.h>
++#include <linux/delay.h>
++#include <linux/usb.h>
++#include <linux/skbuff.h>
++
++#include "mt7601u.h"
++#include "dma.h"
++#include "mcu.h"
++#include "usb.h"
++#include "trace.h"
++
++#define MCU_FW_URB_MAX_PAYLOAD 0x3800
++#define MCU_FW_URB_SIZE (MCU_FW_URB_MAX_PAYLOAD + 12)
++#define MCU_RESP_URB_SIZE 1024
++
++static inline int firmware_running(struct mt7601u_dev *dev)
++{
++ return mt7601u_rr(dev, MT_MCU_COM_REG0) == 1;
++}
++
++static inline void skb_put_le32(struct sk_buff *skb, u32 val)
++{
++ put_unaligned_le32(val, skb_put(skb, 4));
++}
++
++static inline void mt7601u_dma_skb_wrap_cmd(struct sk_buff *skb,
++ u8 seq, enum mcu_cmd cmd)
++{
++ WARN_ON(mt7601u_dma_skb_wrap(skb, CPU_TX_PORT, DMA_COMMAND,
++ MT76_SET(MT_TXD_CMD_INFO_SEQ, seq) |
++ MT76_SET(MT_TXD_CMD_INFO_TYPE, cmd)));
++}
++
++static inline void trace_mt_mcu_msg_send_cs(struct mt7601u_dev *dev,
++ struct sk_buff *skb, bool need_resp)
++{
++ u32 i, csum = 0;
++
++ for (i = 0; i < skb->len / 4; i++)
++ csum ^= get_unaligned_le32(skb->data + i * 4);
++
++ trace_mt_mcu_msg_send(dev, skb, csum, need_resp);
++}
++
++static struct sk_buff *
++mt7601u_mcu_msg_alloc(struct mt7601u_dev *dev, const void *data, int len)
++{
++ struct sk_buff *skb;
++
++ WARN_ON(len % 4); /* if length is not divisible by 4 we need to pad */
++
++ skb = alloc_skb(len + MT_DMA_HDR_LEN + 4, GFP_KERNEL);
++ skb_reserve(skb, MT_DMA_HDR_LEN);
++ memcpy(skb_put(skb, len), data, len);
++
++ return skb;
++}
++
++static int mt7601u_mcu_wait_resp(struct mt7601u_dev *dev, u8 seq)
++{
++ struct urb *urb = dev->mcu.resp.urb;
++ u32 rxfce;
++ int urb_status, ret, i = 5;
++
++ while (i--) {
++ if (!wait_for_completion_timeout(&dev->mcu.resp_cmpl,
++ msecs_to_jiffies(300))) {
++ dev_warn(dev->dev, "Warning: %s retrying\n", __func__);
++ continue;
++ }
++
++ /* Make copies of important data before reusing the urb */
++ rxfce = get_unaligned_le32(dev->mcu.resp.buf);
++ urb_status = urb->status * mt7601u_urb_has_error(urb);
++
++ ret = mt7601u_usb_submit_buf(dev, USB_DIR_IN, MT_EP_IN_CMD_RESP,
++ &dev->mcu.resp, GFP_KERNEL,
++ mt7601u_complete_urb,
++ &dev->mcu.resp_cmpl);
++ if (ret)
++ return ret;
++
++ if (urb_status)
++ dev_err(dev->dev, "Error: MCU resp urb failed:%d\n",
++ urb_status);
++
++ if (MT76_GET(MT_RXD_CMD_INFO_CMD_SEQ, rxfce) == seq &&
++ MT76_GET(MT_RXD_CMD_INFO_EVT_TYPE, rxfce) == CMD_DONE)
++ return 0;
++
++ dev_err(dev->dev, "Error: MCU resp evt:%hhx seq:%hhx-%hhx!\n",
++ MT76_GET(MT_RXD_CMD_INFO_EVT_TYPE, rxfce),
++ seq, MT76_GET(MT_RXD_CMD_INFO_CMD_SEQ, rxfce));
++ }
++
++ dev_err(dev->dev, "Error: %s timed out\n", __func__);
++ return -ETIMEDOUT;
++}
++
++static int
++mt7601u_mcu_msg_send(struct mt7601u_dev *dev, struct sk_buff *skb,
++ enum mcu_cmd cmd, bool wait_resp)
++{
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++ unsigned cmd_pipe = usb_sndbulkpipe(usb_dev,
++ dev->out_eps[MT_EP_OUT_INBAND_CMD]);
++ int sent, ret;
++ u8 seq = 0;
++
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return 0;
++
++ mutex_lock(&dev->mcu.mutex);
++
++ if (wait_resp)
++ while (!seq)
++ seq = ++dev->mcu.msg_seq & 0xf;
++
++ mt7601u_dma_skb_wrap_cmd(skb, seq, cmd);
++
++ if (dev->mcu.resp_cmpl.done)
++ dev_err(dev->dev, "Error: MCU response pre-completed!\n");
++
++ trace_mt_mcu_msg_send_cs(dev, skb, wait_resp);
++ trace_mt_submit_urb_sync(dev, cmd_pipe, skb->len);
++ ret = usb_bulk_msg(usb_dev, cmd_pipe, skb->data, skb->len, &sent, 500);
++ if (ret) {
++ dev_err(dev->dev, "Error: send MCU cmd failed:%d\n", ret);
++ goto out;
++ }
++ if (sent != skb->len)
++ dev_err(dev->dev, "Error: %s sent != skb->len\n", __func__);
++
++ if (wait_resp)
++ ret = mt7601u_mcu_wait_resp(dev, seq);
++out:
++ mutex_unlock(&dev->mcu.mutex);
++
++ consume_skb(skb);
++
++ return ret;
++}
++
++static int mt7601u_mcu_function_select(struct mt7601u_dev *dev,
++ enum mcu_function func, u32 val)
++{
++ struct sk_buff *skb;
++ struct {
++ __le32 id;
++ __le32 value;
++ } __packed __aligned(4) msg = {
++ .id = cpu_to_le32(func),
++ .value = cpu_to_le32(val),
++ };
++
++ skb = mt7601u_mcu_msg_alloc(dev, &msg, sizeof(msg));
++ return mt7601u_mcu_msg_send(dev, skb, CMD_FUN_SET_OP, func == 5);
++}
++
++int mt7601u_mcu_tssi_read_kick(struct mt7601u_dev *dev, int use_hvga)
++{
++ int ret;
++
++ if (!test_bit(MT7601U_STATE_MCU_RUNNING, &dev->state))
++ return 0;
++
++ ret = mt7601u_mcu_function_select(dev, ATOMIC_TSSI_SETTING,
++ use_hvga);
++ if (ret) {
++ dev_warn(dev->dev, "Warning: MCU TSSI read kick failed\n");
++ return ret;
++ }
++
++ dev->tssi_read_trig = true;
++
++ return 0;
++}
++
++int
++mt7601u_mcu_calibrate(struct mt7601u_dev *dev, enum mcu_calibrate cal, u32 val)
++{
++ struct sk_buff *skb;
++ struct {
++ __le32 id;
++ __le32 value;
++ } __packed __aligned(4) msg = {
++ .id = cpu_to_le32(cal),
++ .value = cpu_to_le32(val),
++ };
++
++ skb = mt7601u_mcu_msg_alloc(dev, &msg, sizeof(msg));
++ return mt7601u_mcu_msg_send(dev, skb, CMD_CALIBRATION_OP, true);
++}
++
++int mt7601u_write_reg_pairs(struct mt7601u_dev *dev, u32 base,
++ const struct mt76_reg_pair *data, int n)
++{
++ const int max_vals_per_cmd = INBAND_PACKET_MAX_LEN / 8;
++ struct sk_buff *skb;
++ int cnt, i, ret;
++
++ if (!n)
++ return 0;
++
++ cnt = min(max_vals_per_cmd, n);
++
++ skb = alloc_skb(cnt * 8 + MT_DMA_HDR_LEN + 4, GFP_KERNEL);
++ if (!skb)
++ return -ENOMEM;
++ skb_reserve(skb, MT_DMA_HDR_LEN);
++
++ for (i = 0; i < cnt; i++) {
++ skb_put_le32(skb, base + data[i].reg);
++ skb_put_le32(skb, data[i].value);
++ }
++
++ ret = mt7601u_mcu_msg_send(dev, skb, CMD_RANDOM_WRITE, cnt == n);
++ if (ret)
++ return ret;
++
++ return mt7601u_write_reg_pairs(dev, base, data + cnt, n - cnt);
++}
++
++int mt7601u_burst_write_regs(struct mt7601u_dev *dev, u32 offset,
++ const u32 *data, int n)
++{
++ const int max_regs_per_cmd = INBAND_PACKET_MAX_LEN / 4 - 1;
++ struct sk_buff *skb;
++ int cnt, i, ret;
++
++ if (!n)
++ return 0;
++
++ cnt = min(max_regs_per_cmd, n);
++
++ skb = alloc_skb(cnt * 4 + MT_DMA_HDR_LEN + 4, GFP_KERNEL);
++ if (!skb)
++ return -ENOMEM;
++ skb_reserve(skb, MT_DMA_HDR_LEN);
++
++ skb_put_le32(skb, MT_MCU_MEMMAP_WLAN + offset);
++ for (i = 0; i < cnt; i++)
++ skb_put_le32(skb, data[i]);
++
++ ret = mt7601u_mcu_msg_send(dev, skb, CMD_BURST_WRITE, cnt == n);
++ if (ret)
++ return ret;
++
++ return mt7601u_burst_write_regs(dev, offset + cnt * 4,
++ data + cnt, n - cnt);
++}
++
++struct mt76_fw_header {
++ __le32 ilm_len;
++ __le32 dlm_len;
++ __le16 build_ver;
++ __le16 fw_ver;
++ u8 pad[4];
++ char build_time[16];
++};
++
++struct mt76_fw {
++ struct mt76_fw_header hdr;
++ u8 ivb[MT_MCU_IVB_SIZE];
++ u8 ilm[];
++};
++
++static int __mt7601u_dma_fw(struct mt7601u_dev *dev,
++ const struct mt7601u_dma_buf *dma_buf,
++ const void *data, u32 len, u32 dst_addr)
++{
++ DECLARE_COMPLETION_ONSTACK(cmpl);
++ struct mt7601u_dma_buf buf = *dma_buf; /* we need to fake length */
++ __le32 reg;
++ u32 val;
++ int ret;
++
++ reg = cpu_to_le32(MT76_SET(MT_TXD_INFO_TYPE, DMA_PACKET) |
++ MT76_SET(MT_TXD_INFO_D_PORT, CPU_TX_PORT) |
++ MT76_SET(MT_TXD_INFO_LEN, len));
++ memcpy(buf.buf, &reg, sizeof(reg));
++ memcpy(buf.buf + sizeof(reg), data, len);
++ memset(buf.buf + sizeof(reg) + len, 0, 8);
++
++ ret = mt7601u_vendor_single_wr(dev, MT_VEND_WRITE_FCE,
++ MT_FCE_DMA_ADDR, dst_addr);
++ if (ret)
++ return ret;
++ len = roundup(len, 4);
++ ret = mt7601u_vendor_single_wr(dev, MT_VEND_WRITE_FCE,
++ MT_FCE_DMA_LEN, len << 16);
++ if (ret)
++ return ret;
++
++ buf.len = MT_DMA_HDR_LEN + len + 4;
++ ret = mt7601u_usb_submit_buf(dev, USB_DIR_OUT, MT_EP_OUT_INBAND_CMD,
++ &buf, GFP_KERNEL,
++ mt7601u_complete_urb, &cmpl);
++ if (ret)
++ return ret;
++
++ if (!wait_for_completion_timeout(&cmpl, msecs_to_jiffies(1000))) {
++ dev_err(dev->dev, "Error: firmware upload timed out\n");
++ usb_kill_urb(buf.urb);
++ return -ETIMEDOUT;
++ }
++ if (mt7601u_urb_has_error(buf.urb)) {
++ dev_err(dev->dev, "Error: firmware upload urb failed:%d\n",
++ buf.urb->status);
++ return buf.urb->status;
++ }
++
++ val = mt7601u_rr(dev, MT_TX_CPU_FROM_FCE_CPU_DESC_IDX);
++ val++;
++ mt7601u_wr(dev, MT_TX_CPU_FROM_FCE_CPU_DESC_IDX, val);
++
++ return 0;
++}
++
++static int
++mt7601u_dma_fw(struct mt7601u_dev *dev, struct mt7601u_dma_buf *dma_buf,
++ const void *data, int len, u32 dst_addr)
++{
++ int n, ret;
++
++ if (len == 0)
++ return 0;
++
++ n = min(MCU_FW_URB_MAX_PAYLOAD, len);
++ ret = __mt7601u_dma_fw(dev, dma_buf, data, n, dst_addr);
++ if (ret)
++ return ret;
++
++ if (!mt76_poll_msec(dev, MT_MCU_COM_REG1, BIT(31), BIT(31), 500))
++ return -ETIMEDOUT;
++
++ return mt7601u_dma_fw(dev, dma_buf, data + n, len - n, dst_addr + n);
++}
++
++static int
++mt7601u_upload_firmware(struct mt7601u_dev *dev, const struct mt76_fw *fw)
++{
++ struct mt7601u_dma_buf dma_buf;
++ void *ivb;
++ u32 ilm_len, dlm_len;
++ int i, ret;
++
++ ivb = kmemdup(fw->ivb, sizeof(fw->ivb), GFP_KERNEL);
++ if (!ivb || mt7601u_usb_alloc_buf(dev, MCU_FW_URB_SIZE, &dma_buf)) {
++ ret = -ENOMEM;
++ goto error;
++ }
++
++ ilm_len = le32_to_cpu(fw->hdr.ilm_len) - sizeof(fw->ivb);
++ dev_dbg(dev->dev, "loading FW - ILM %u + IVB %zu\n",
++ ilm_len, sizeof(fw->ivb));
++ ret = mt7601u_dma_fw(dev, &dma_buf, fw->ilm, ilm_len, sizeof(fw->ivb));
++ if (ret)
++ goto error;
++
++ dlm_len = le32_to_cpu(fw->hdr.dlm_len);
++ dev_dbg(dev->dev, "loading FW - DLM %u\n", dlm_len);
++ ret = mt7601u_dma_fw(dev, &dma_buf, fw->ilm + ilm_len,
++ dlm_len, MT_MCU_DLM_OFFSET);
++ if (ret)
++ goto error;
++
++ ret = mt7601u_vendor_request(dev, MT_VEND_DEV_MODE, USB_DIR_OUT,
++ 0x12, 0, ivb, sizeof(fw->ivb));
++ if (ret < 0)
++ goto error;
++ ret = 0;
++
++ for (i = 100; i && !firmware_running(dev); i--)
++ msleep(10);
++ if (!i) {
++ ret = -ETIMEDOUT;
++ goto error;
++ }
++
++ dev_dbg(dev->dev, "Firmware running!\n");
++error:
++ kfree(ivb);
++ mt7601u_usb_free_buf(dev, &dma_buf);
++
++ return ret;
++}
++
++static int mt7601u_load_firmware(struct mt7601u_dev *dev)
++{
++ const struct firmware *fw;
++ const struct mt76_fw_header *hdr;
++ int len, ret;
++ u32 val;
++
++ mt7601u_wr(dev, MT_USB_DMA_CFG, (MT_USB_DMA_CFG_RX_BULK_EN |
++ MT_USB_DMA_CFG_TX_BULK_EN));
++
++ if (firmware_running(dev))
++ return 0;
++
++ ret = request_firmware(&fw, MT7601U_FIRMWARE, dev->dev);
++ if (ret)
++ return ret;
++
++ if (!fw || !fw->data || fw->size < sizeof(*hdr))
++ goto err_inv_fw;
++
++ hdr = (const struct mt76_fw_header *) fw->data;
++
++ if (le32_to_cpu(hdr->ilm_len) <= MT_MCU_IVB_SIZE)
++ goto err_inv_fw;
++
++ len = sizeof(*hdr);
++ len += le32_to_cpu(hdr->ilm_len);
++ len += le32_to_cpu(hdr->dlm_len);
++
++ if (fw->size != len)
++ goto err_inv_fw;
++
++ val = le16_to_cpu(hdr->fw_ver);
++ dev_info(dev->dev,
++ "Firmware Version: %d.%d.%02d Build: %x Build time: %.16s\n",
++ (val >> 12) & 0xf, (val >> 8) & 0xf, val & 0xf,
++ le16_to_cpu(hdr->build_ver), hdr->build_time);
++
++ len = le32_to_cpu(hdr->ilm_len);
++
++ mt7601u_wr(dev, 0x94c, 0);
++ mt7601u_wr(dev, MT_FCE_PSE_CTRL, 0);
++
++ mt7601u_vendor_reset(dev);
++ msleep(5);
++
++ mt7601u_wr(dev, 0xa44, 0);
++ mt7601u_wr(dev, 0x230, 0x84210);
++ mt7601u_wr(dev, 0x400, 0x80c00);
++ mt7601u_wr(dev, 0x800, 1);
++
++ mt7601u_rmw(dev, MT_PBF_CFG, 0, (MT_PBF_CFG_TX0Q_EN |
++ MT_PBF_CFG_TX1Q_EN |
++ MT_PBF_CFG_TX2Q_EN |
++ MT_PBF_CFG_TX3Q_EN));
++
++ mt7601u_wr(dev, MT_FCE_PSE_CTRL, 1);
++
++ mt7601u_wr(dev, MT_USB_DMA_CFG, (MT_USB_DMA_CFG_RX_BULK_EN |
++ MT_USB_DMA_CFG_TX_BULK_EN));
++ val = mt76_set(dev, MT_USB_DMA_CFG, MT_USB_DMA_CFG_TX_CLR);
++ val &= ~MT_USB_DMA_CFG_TX_CLR;
++ mt7601u_wr(dev, MT_USB_DMA_CFG, val);
++
++ /* FCE tx_fs_base_ptr */
++ mt7601u_wr(dev, MT_TX_CPU_FROM_FCE_BASE_PTR, 0x400230);
++ /* FCE tx_fs_max_cnt */
++ mt7601u_wr(dev, MT_TX_CPU_FROM_FCE_MAX_COUNT, 1);
++ /* FCE pdma enable */
++ mt7601u_wr(dev, MT_FCE_PDMA_GLOBAL_CONF, 0x44);
++ /* FCE skip_fs_en */
++ mt7601u_wr(dev, MT_FCE_SKIP_FS, 3);
++
++ ret = mt7601u_upload_firmware(dev, (const struct mt76_fw *)fw->data);
++
++ release_firmware(fw);
++
++ return ret;
++
++err_inv_fw:
++ dev_err(dev->dev, "Invalid firmware image\n");
++ release_firmware(fw);
++ return -ENOENT;
++}
++
++int mt7601u_mcu_init(struct mt7601u_dev *dev)
++{
++ int ret;
++
++ mutex_init(&dev->mcu.mutex);
++
++ ret = mt7601u_load_firmware(dev);
++ if (ret)
++ return ret;
++
++ set_bit(MT7601U_STATE_MCU_RUNNING, &dev->state);
++
++ return 0;
++}
++
++int mt7601u_mcu_cmd_init(struct mt7601u_dev *dev)
++{
++ int ret;
++
++ ret = mt7601u_mcu_function_select(dev, Q_SELECT, 1);
++ if (ret)
++ return ret;
++
++ init_completion(&dev->mcu.resp_cmpl);
++ if (mt7601u_usb_alloc_buf(dev, MCU_RESP_URB_SIZE, &dev->mcu.resp)) {
++ mt7601u_usb_free_buf(dev, &dev->mcu.resp);
++ return -ENOMEM;
++ }
++
++ ret = mt7601u_usb_submit_buf(dev, USB_DIR_IN, MT_EP_IN_CMD_RESP,
++ &dev->mcu.resp, GFP_KERNEL,
++ mt7601u_complete_urb, &dev->mcu.resp_cmpl);
++ if (ret) {
++ mt7601u_usb_free_buf(dev, &dev->mcu.resp);
++ return ret;
++ }
++
++ return 0;
++}
++
++void mt7601u_mcu_cmd_deinit(struct mt7601u_dev *dev)
++{
++ usb_kill_urb(dev->mcu.resp.urb);
++ mt7601u_usb_free_buf(dev, &dev->mcu.resp);
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mcu.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/mcu.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mcu.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/mcu.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,94 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT7601U_MCU_H
++#define __MT7601U_MCU_H
++
++struct mt7601u_dev;
++
++/* Register definitions */
++#define MT_MCU_RESET_CTL 0x070C
++#define MT_MCU_INT_LEVEL 0x0718
++#define MT_MCU_COM_REG0 0x0730
++#define MT_MCU_COM_REG1 0x0734
++#define MT_MCU_COM_REG2 0x0738
++#define MT_MCU_COM_REG3 0x073C
++
++#define MT_MCU_IVB_SIZE 0x40
++#define MT_MCU_DLM_OFFSET 0x80000
++
++#define MT_MCU_MEMMAP_WLAN 0x00410000
++#define MT_MCU_MEMMAP_BBP 0x40000000
++#define MT_MCU_MEMMAP_RF 0x80000000
++
++#define INBAND_PACKET_MAX_LEN 192
++
++enum mcu_cmd {
++ CMD_FUN_SET_OP = 1,
++ CMD_LOAD_CR = 2,
++ CMD_INIT_GAIN_OP = 3,
++ CMD_DYNC_VGA_OP = 6,
++ CMD_TDLS_CH_SW = 7,
++ CMD_BURST_WRITE = 8,
++ CMD_READ_MODIFY_WRITE = 9,
++ CMD_RANDOM_READ = 10,
++ CMD_BURST_READ = 11,
++ CMD_RANDOM_WRITE = 12,
++ CMD_LED_MODE_OP = 16,
++ CMD_POWER_SAVING_OP = 20,
++ CMD_WOW_CONFIG = 21,
++ CMD_WOW_QUERY = 22,
++ CMD_WOW_FEATURE = 24,
++ CMD_CARRIER_DETECT_OP = 28,
++ CMD_RADOR_DETECT_OP = 29,
++ CMD_SWITCH_CHANNEL_OP = 30,
++ CMD_CALIBRATION_OP = 31,
++ CMD_BEACON_OP = 32,
++ CMD_ANTENNA_OP = 33,
++};
++
++enum mcu_function {
++ Q_SELECT = 1,
++ ATOMIC_TSSI_SETTING = 5,
++};
++
++enum mcu_power_mode {
++ RADIO_OFF = 0x30,
++ RADIO_ON = 0x31,
++ RADIO_OFF_AUTO_WAKEUP = 0x32,
++ RADIO_OFF_ADVANCE = 0x33,
++ RADIO_ON_ADVANCE = 0x34,
++};
++
++enum mcu_calibrate {
++ MCU_CAL_R = 1,
++ MCU_CAL_DCOC,
++ MCU_CAL_LC,
++ MCU_CAL_LOFT,
++ MCU_CAL_TXIQ,
++ MCU_CAL_BW,
++ MCU_CAL_DPD,
++ MCU_CAL_RXIQ,
++ MCU_CAL_TXDCOC,
++};
++
++int mt7601u_mcu_init(struct mt7601u_dev *dev);
++int mt7601u_mcu_cmd_init(struct mt7601u_dev *dev);
++void mt7601u_mcu_cmd_deinit(struct mt7601u_dev *dev);
++
++int
++mt7601u_mcu_calibrate(struct mt7601u_dev *dev, enum mcu_calibrate cal, u32 val);
++int mt7601u_mcu_tssi_read_kick(struct mt7601u_dev *dev, int use_hvga);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mt7601u.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/mt7601u.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/mt7601u.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,390 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef MT7601U_H
++#define MT7601U_H
++
++#include <linux/kernel.h>
++#include <linux/device.h>
++#include <linux/mutex.h>
++#include <linux/usb.h>
++#include <linux/completion.h>
++#include <net/mac80211.h>
++#include <linux/debugfs.h>
++
++#include "regs.h"
++#include "util.h"
++
++#define MT_CALIBRATE_INTERVAL (4 * HZ)
++
++#define MT_FREQ_CAL_INIT_DELAY (30 * HZ)
++#define MT_FREQ_CAL_CHECK_INTERVAL (10 * HZ)
++#define MT_FREQ_CAL_ADJ_INTERVAL (HZ / 2)
++
++#define MT_BBP_REG_VERSION 0x00
++
++#define MT_USB_AGGR_SIZE_LIMIT 28 /* * 1024B */
++#define MT_USB_AGGR_TIMEOUT 0x80 /* * 33ns */
++#define MT_RX_ORDER 3
++#define MT_RX_URB_SIZE (PAGE_SIZE << MT_RX_ORDER)
++
++struct mt7601u_dma_buf {
++ struct urb *urb;
++ void *buf;
++ dma_addr_t dma;
++ size_t len;
++};
++
++struct mt7601u_mcu {
++ struct mutex mutex;
++
++ u8 msg_seq;
++
++ struct mt7601u_dma_buf resp;
++ struct completion resp_cmpl;
++};
++
++struct mt7601u_freq_cal {
++ struct delayed_work work;
++ u8 freq;
++ bool enabled;
++ bool adjusting;
++};
++
++struct mac_stats {
++ u64 rx_stat[6];
++ u64 tx_stat[6];
++ u64 aggr_stat[2];
++ u64 aggr_n[32];
++ u64 zero_len_del[2];
++};
++
++#define N_RX_ENTRIES 16
++struct mt7601u_rx_queue {
++ struct mt7601u_dev *dev;
++
++ struct mt7601u_dma_buf_rx {
++ struct urb *urb;
++ struct page *p;
++ } e[N_RX_ENTRIES];
++
++ unsigned int start;
++ unsigned int end;
++ unsigned int entries;
++ unsigned int pending;
++};
++
++#define N_TX_ENTRIES 64
++
++struct mt7601u_tx_queue {
++ struct mt7601u_dev *dev;
++
++ struct mt7601u_dma_buf_tx {
++ struct urb *urb;
++ struct sk_buff *skb;
++ } e[N_TX_ENTRIES];
++
++ unsigned int start;
++ unsigned int end;
++ unsigned int entries;
++ unsigned int used;
++ unsigned int fifo_seq;
++};
++
++/* WCID allocation:
++ * 0: mcast wcid
++ * 1: bssid wcid
++ * 1...: STAs
++ * ...7e: group wcids
++ * 7f: reserved
++ */
++#define N_WCIDS 128
++#define GROUP_WCID(idx) (N_WCIDS - 2 - idx)
++
++struct mt7601u_eeprom_params;
++
++#define MT_EE_TEMPERATURE_SLOPE 39
++#define MT_FREQ_OFFSET_INVALID -128
++
++enum mt_temp_mode {
++ MT_TEMP_MODE_NORMAL,
++ MT_TEMP_MODE_HIGH,
++ MT_TEMP_MODE_LOW,
++};
++
++enum mt_bw {
++ MT_BW_20,
++ MT_BW_40,
++};
++
++enum {
++ MT7601U_STATE_INITIALIZED,
++ MT7601U_STATE_REMOVED,
++ MT7601U_STATE_WLAN_RUNNING,
++ MT7601U_STATE_MCU_RUNNING,
++ MT7601U_STATE_SCANNING,
++ MT7601U_STATE_READING_STATS,
++ MT7601U_STATE_MORE_STATS,
++};
++
++/**
++ * struct mt7601u_dev - adapter structure
++ * @lock: protects @wcid->tx_rate.
++ * @tx_lock: protects @tx_q and changes of MT7601U_STATE_*_STATS
++ flags in @state.
++ * @rx_lock: protects @rx_q.
++ * @con_mon_lock: protects @ap_bssid, @bcn_*, @avg_rssi.
++ * @mutex: ensures exclusive access from mac80211 callbacks.
++ * @vendor_req_mutex: ensures atomicity of vendor requests.
++ * @reg_atomic_mutex: ensures atomicity of indirect register accesses
++ * (accesses to RF and BBP).
++ * @hw_atomic_mutex: ensures exclusive access to HW during critical
++ * operations (power management, channel switch).
++ */
++struct mt7601u_dev {
++ struct ieee80211_hw *hw;
++ struct device *dev;
++
++ unsigned long state;
++
++ struct mutex mutex;
++
++ unsigned long wcid_mask[N_WCIDS / BITS_PER_LONG];
++
++ struct cfg80211_chan_def chandef;
++ struct ieee80211_supported_band *sband_2g;
++
++ struct mt7601u_mcu mcu;
++
++ struct delayed_work cal_work;
++ struct delayed_work mac_work;
++
++ struct workqueue_struct *stat_wq;
++ struct delayed_work stat_work;
++
++ struct mt76_wcid *mon_wcid;
++ struct mt76_wcid __rcu *wcid[N_WCIDS];
++
++ spinlock_t lock;
++
++ const u16 *beacon_offsets;
++
++ u8 macaddr[ETH_ALEN];
++ struct mt7601u_eeprom_params *ee;
++
++ struct mutex vendor_req_mutex;
++ struct mutex reg_atomic_mutex;
++ struct mutex hw_atomic_mutex;
++
++ u32 rxfilter;
++ u32 debugfs_reg;
++
++ u8 out_eps[8];
++ u8 in_eps[8];
++ u16 out_max_packet;
++ u16 in_max_packet;
++
++ /* TX */
++ spinlock_t tx_lock;
++ struct mt7601u_tx_queue *tx_q;
++
++ atomic_t avg_ampdu_len;
++
++ /* RX */
++ spinlock_t rx_lock;
++ struct tasklet_struct rx_tasklet;
++ struct mt7601u_rx_queue rx_q;
++
++ /* Connection monitoring things */
++ spinlock_t con_mon_lock;
++ u8 ap_bssid[ETH_ALEN];
++
++ s8 bcn_freq_off;
++ u8 bcn_phy_mode;
++
++ int avg_rssi; /* starts at 0 and converges */
++
++ u8 agc_save;
++
++ struct mt7601u_freq_cal freq_cal;
++
++ bool tssi_read_trig;
++
++ s8 tssi_init;
++ s8 tssi_init_hvga;
++ s16 tssi_init_hvga_offset_db;
++
++ int prev_pwr_diff;
++
++ enum mt_temp_mode temp_mode;
++ int curr_temp;
++ int dpd_temp;
++ s8 raw_temp;
++ bool pll_lock_protect;
++
++ u8 bw;
++ bool chan_ext_below;
++
++ /* PA mode */
++ u32 rf_pa_mode[2];
++
++ struct mac_stats stats;
++};
++
++struct mt7601u_tssi_params {
++ char tssi0;
++ int trgt_power;
++};
++
++struct mt76_wcid {
++ u8 idx;
++ u8 hw_key_idx;
++
++ u16 tx_rate;
++ bool tx_rate_set;
++ u8 tx_rate_nss;
++};
++
++struct mt76_vif {
++ u8 idx;
++
++ struct mt76_wcid group_wcid;
++};
++
++struct mt76_sta {
++ struct mt76_wcid wcid;
++ u16 agg_ssn[IEEE80211_NUM_TIDS];
++};
++
++struct mt76_reg_pair {
++ u32 reg;
++ u32 value;
++};
++
++struct mt7601u_rxwi;
++
++extern const struct ieee80211_ops mt7601u_ops;
++
++void mt7601u_init_debugfs(struct mt7601u_dev *dev);
++
++u32 mt7601u_rr(struct mt7601u_dev *dev, u32 offset);
++void mt7601u_wr(struct mt7601u_dev *dev, u32 offset, u32 val);
++u32 mt7601u_rmw(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val);
++u32 mt7601u_rmc(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val);
++void mt7601u_wr_copy(struct mt7601u_dev *dev, u32 offset,
++ const void *data, int len);
++
++int mt7601u_wait_asic_ready(struct mt7601u_dev *dev);
++bool mt76_poll(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val,
++ int timeout);
++bool mt76_poll_msec(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val,
++ int timeout);
++
++/* Compatibility with mt76 */
++#define mt76_rmw_field(_dev, _reg, _field, _val) \
++ mt76_rmw(_dev, _reg, _field, MT76_SET(_field, _val))
++
++static inline u32 mt76_rr(struct mt7601u_dev *dev, u32 offset)
++{
++ return mt7601u_rr(dev, offset);
++}
++
++static inline void mt76_wr(struct mt7601u_dev *dev, u32 offset, u32 val)
++{
++ return mt7601u_wr(dev, offset, val);
++}
++
++static inline u32
++mt76_rmw(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val)
++{
++ return mt7601u_rmw(dev, offset, mask, val);
++}
++
++static inline u32 mt76_set(struct mt7601u_dev *dev, u32 offset, u32 val)
++{
++ return mt76_rmw(dev, offset, 0, val);
++}
++
++static inline u32 mt76_clear(struct mt7601u_dev *dev, u32 offset, u32 val)
++{
++ return mt76_rmw(dev, offset, val, 0);
++}
++
++int mt7601u_write_reg_pairs(struct mt7601u_dev *dev, u32 base,
++ const struct mt76_reg_pair *data, int len);
++int mt7601u_burst_write_regs(struct mt7601u_dev *dev, u32 offset,
++ const u32 *data, int n);
++void mt7601u_addr_wr(struct mt7601u_dev *dev, const u32 offset, const u8 *addr);
++
++/* Init */
++struct mt7601u_dev *mt7601u_alloc_device(struct device *dev);
++int mt7601u_init_hardware(struct mt7601u_dev *dev);
++int mt7601u_register_device(struct mt7601u_dev *dev);
++void mt7601u_cleanup(struct mt7601u_dev *dev);
++
++int mt7601u_mac_start(struct mt7601u_dev *dev);
++void mt7601u_mac_stop(struct mt7601u_dev *dev);
++
++/* PHY */
++int mt7601u_phy_init(struct mt7601u_dev *dev);
++int mt7601u_wait_bbp_ready(struct mt7601u_dev *dev);
++void mt7601u_set_rx_path(struct mt7601u_dev *dev, u8 path);
++void mt7601u_set_tx_dac(struct mt7601u_dev *dev, u8 path);
++int mt7601u_bbp_set_bw(struct mt7601u_dev *dev, int bw);
++void mt7601u_agc_save(struct mt7601u_dev *dev);
++void mt7601u_agc_restore(struct mt7601u_dev *dev);
++int mt7601u_phy_set_channel(struct mt7601u_dev *dev,
++ struct cfg80211_chan_def *chandef);
++void mt7601u_phy_recalibrate_after_assoc(struct mt7601u_dev *dev);
++int mt7601u_phy_get_rssi(struct mt7601u_dev *dev,
++ struct mt7601u_rxwi *rxwi, u16 rate);
++void mt7601u_phy_con_cal_onoff(struct mt7601u_dev *dev,
++ struct ieee80211_bss_conf *info);
++
++/* MAC */
++void mt7601u_mac_work(struct work_struct *work);
++void mt7601u_mac_set_protection(struct mt7601u_dev *dev, bool legacy_prot,
++ int ht_mode);
++void mt7601u_mac_set_short_preamble(struct mt7601u_dev *dev, bool short_preamb);
++void mt7601u_mac_config_tsf(struct mt7601u_dev *dev, bool enable, int interval);
++void
++mt7601u_mac_wcid_setup(struct mt7601u_dev *dev, u8 idx, u8 vif_idx, u8 *mac);
++void mt7601u_mac_set_ampdu_factor(struct mt7601u_dev *dev);
++
++/* TX */
++void mt7601u_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
++ struct sk_buff *skb);
++int mt7601u_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ u16 queue, const struct ieee80211_tx_queue_params *params);
++void mt7601u_tx_status(struct mt7601u_dev *dev, struct sk_buff *skb);
++void mt7601u_tx_stat(struct work_struct *work);
++
++/* util */
++void mt76_remove_hdr_pad(struct sk_buff *skb);
++int mt76_insert_hdr_pad(struct sk_buff *skb);
++
++u32 mt7601u_bbp_set_ctrlch(struct mt7601u_dev *dev, bool below);
++
++static inline u32 mt7601u_mac_set_ctrlch(struct mt7601u_dev *dev, bool below)
++{
++ return mt7601u_rmc(dev, MT_TX_BAND_CFG, 1, below);
++}
++
++int mt7601u_dma_init(struct mt7601u_dev *dev);
++void mt7601u_dma_cleanup(struct mt7601u_dev *dev);
++
++int mt7601u_dma_enqueue_tx(struct mt7601u_dev *dev, struct sk_buff *skb,
++ struct mt76_wcid *wcid, int hw_q);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/phy.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/phy.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/phy.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/phy.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,1251 @@
++/*
++ * (c) Copyright 2002-2010, Ralink Technology, Inc.
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++#include "mcu.h"
++#include "eeprom.h"
++#include "trace.h"
++#include "initvals_phy.h"
++
++#include <linux/etherdevice.h>
++
++static void mt7601u_agc_reset(struct mt7601u_dev *dev);
++
++static int
++mt7601u_rf_wr(struct mt7601u_dev *dev, u8 bank, u8 offset, u8 value)
++{
++ int ret = 0;
++
++ if (WARN_ON(!test_bit(MT7601U_STATE_WLAN_RUNNING, &dev->state)) ||
++ WARN_ON(offset > 63))
++ return -EINVAL;
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return 0;
++
++ mutex_lock(&dev->reg_atomic_mutex);
++
++ if (!mt76_poll(dev, MT_RF_CSR_CFG, MT_RF_CSR_CFG_KICK, 0, 100)) {
++ ret = -ETIMEDOUT;
++ goto out;
++ }
++
++ mt7601u_wr(dev, MT_RF_CSR_CFG, MT76_SET(MT_RF_CSR_CFG_DATA, value) |
++ MT76_SET(MT_RF_CSR_CFG_REG_BANK, bank) |
++ MT76_SET(MT_RF_CSR_CFG_REG_ID, offset) |
++ MT_RF_CSR_CFG_WR |
++ MT_RF_CSR_CFG_KICK);
++ trace_rf_write(dev, bank, offset, value);
++out:
++ mutex_unlock(&dev->reg_atomic_mutex);
++
++ if (ret < 0)
++ dev_err(dev->dev, "Error: RF write %02hhx:%02hhx failed:%d!!\n",
++ bank, offset, ret);
++
++ return ret;
++}
++
++static int
++mt7601u_rf_rr(struct mt7601u_dev *dev, u8 bank, u8 offset)
++{
++ int ret = -ETIMEDOUT;
++ u32 val;
++
++ if (WARN_ON(!test_bit(MT7601U_STATE_WLAN_RUNNING, &dev->state)) ||
++ WARN_ON(offset > 63))
++ return -EINVAL;
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return 0xff;
++
++ mutex_lock(&dev->reg_atomic_mutex);
++
++ if (!mt76_poll(dev, MT_RF_CSR_CFG, MT_RF_CSR_CFG_KICK, 0, 100))
++ goto out;
++
++ mt7601u_wr(dev, MT_RF_CSR_CFG, MT76_SET(MT_RF_CSR_CFG_REG_BANK, bank) |
++ MT76_SET(MT_RF_CSR_CFG_REG_ID, offset) |
++ MT_RF_CSR_CFG_KICK);
++
++ if (!mt76_poll(dev, MT_RF_CSR_CFG, MT_RF_CSR_CFG_KICK, 0, 100))
++ goto out;
++
++ val = mt7601u_rr(dev, MT_RF_CSR_CFG);
++ if (MT76_GET(MT_RF_CSR_CFG_REG_ID, val) == offset &&
++ MT76_GET(MT_RF_CSR_CFG_REG_BANK, val) == bank) {
++ ret = MT76_GET(MT_RF_CSR_CFG_DATA, val);
++ trace_rf_read(dev, bank, offset, ret);
++ }
++out:
++ mutex_unlock(&dev->reg_atomic_mutex);
++
++ if (ret < 0)
++ dev_err(dev->dev, "Error: RF read %02hhx:%02hhx failed:%d!!\n",
++ bank, offset, ret);
++
++ return ret;
++}
++
++static int
++mt7601u_rf_rmw(struct mt7601u_dev *dev, u8 bank, u8 offset, u8 mask, u8 val)
++{
++ int ret;
++
++ ret = mt7601u_rf_rr(dev, bank, offset);
++ if (ret < 0)
++ return ret;
++ val |= ret & ~mask;
++ ret = mt7601u_rf_wr(dev, bank, offset, val);
++ if (ret)
++ return ret;
++
++ return val;
++}
++
++static int
++mt7601u_rf_set(struct mt7601u_dev *dev, u8 bank, u8 offset, u8 val)
++{
++ return mt7601u_rf_rmw(dev, bank, offset, 0, val);
++}
++
++static int
++mt7601u_rf_clear(struct mt7601u_dev *dev, u8 bank, u8 offset, u8 mask)
++{
++ return mt7601u_rf_rmw(dev, bank, offset, mask, 0);
++}
++
++static void mt7601u_bbp_wr(struct mt7601u_dev *dev, u8 offset, u8 val)
++{
++ if (WARN_ON(!test_bit(MT7601U_STATE_WLAN_RUNNING, &dev->state)) ||
++ test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return;
++
++ mutex_lock(&dev->reg_atomic_mutex);
++
++ if (!mt76_poll(dev, MT_BBP_CSR_CFG, MT_BBP_CSR_CFG_BUSY, 0, 1000)) {
++ dev_err(dev->dev, "Error: BBP write %02hhx failed!!\n", offset);
++ goto out;
++ }
++
++ mt7601u_wr(dev, MT_BBP_CSR_CFG,
++ MT76_SET(MT_BBP_CSR_CFG_VAL, val) |
++ MT76_SET(MT_BBP_CSR_CFG_REG_NUM, offset) |
++ MT_BBP_CSR_CFG_RW_MODE | MT_BBP_CSR_CFG_BUSY);
++ trace_bbp_write(dev, offset, val);
++out:
++ mutex_unlock(&dev->reg_atomic_mutex);
++}
++
++static int mt7601u_bbp_rr(struct mt7601u_dev *dev, u8 offset)
++{
++ u32 val;
++ int ret = -ETIMEDOUT;
++
++ if (WARN_ON(!test_bit(MT7601U_STATE_WLAN_RUNNING, &dev->state)))
++ return -EINVAL;
++ if (test_bit(MT7601U_STATE_REMOVED, &dev->state))
++ return 0xff;
++
++ mutex_lock(&dev->reg_atomic_mutex);
++
++ if (!mt76_poll(dev, MT_BBP_CSR_CFG, MT_BBP_CSR_CFG_BUSY, 0, 1000))
++ goto out;
++
++ mt7601u_wr(dev, MT_BBP_CSR_CFG,
++ MT76_SET(MT_BBP_CSR_CFG_REG_NUM, offset) |
++ MT_BBP_CSR_CFG_RW_MODE | MT_BBP_CSR_CFG_BUSY |
++ MT_BBP_CSR_CFG_READ);
++
++ if (!mt76_poll(dev, MT_BBP_CSR_CFG, MT_BBP_CSR_CFG_BUSY, 0, 1000))
++ goto out;
++
++ val = mt7601u_rr(dev, MT_BBP_CSR_CFG);
++ if (MT76_GET(MT_BBP_CSR_CFG_REG_NUM, val) == offset) {
++ ret = MT76_GET(MT_BBP_CSR_CFG_VAL, val);
++ trace_bbp_read(dev, offset, ret);
++ }
++out:
++ mutex_unlock(&dev->reg_atomic_mutex);
++
++ if (ret < 0)
++ dev_err(dev->dev, "Error: BBP read %02hhx failed:%d!!\n",
++ offset, ret);
++
++ return ret;
++}
++
++static int mt7601u_bbp_rmw(struct mt7601u_dev *dev, u8 offset, u8 mask, u8 val)
++{
++ int ret;
++
++ ret = mt7601u_bbp_rr(dev, offset);
++ if (ret < 0)
++ return ret;
++ val |= ret & ~mask;
++ mt7601u_bbp_wr(dev, offset, val);
++
++ return val;
++}
++
++static u8 mt7601u_bbp_rmc(struct mt7601u_dev *dev, u8 offset, u8 mask, u8 val)
++{
++ int ret;
++
++ ret = mt7601u_bbp_rr(dev, offset);
++ if (ret < 0)
++ return ret;
++ val |= ret & ~mask;
++ if (ret != val)
++ mt7601u_bbp_wr(dev, offset, val);
++
++ return val;
++}
++
++int mt7601u_wait_bbp_ready(struct mt7601u_dev *dev)
++{
++ int i = 20;
++ u8 val;
++
++ do {
++ val = mt7601u_bbp_rr(dev, MT_BBP_REG_VERSION);
++ if (val && ~val)
++ break;
++ } while (--i);
++
++ if (!i) {
++ dev_err(dev->dev, "Error: BBP is not ready\n");
++ return -EIO;
++ }
++
++ return 0;
++}
++
++u32 mt7601u_bbp_set_ctrlch(struct mt7601u_dev *dev, bool below)
++{
++ return mt7601u_bbp_rmc(dev, 3, 0x20, below ? 0x20 : 0);
++}
++
++int mt7601u_phy_get_rssi(struct mt7601u_dev *dev,
++ struct mt7601u_rxwi *rxwi, u16 rate)
++{
++ static const s8 lna[2][2][3] = {
++ /* main LNA */ {
++ /* bw20 */ { -2, 15, 33 },
++ /* bw40 */ { 0, 16, 34 }
++ },
++ /* aux LNA */ {
++ /* bw20 */ { -2, 15, 33 },
++ /* bw40 */ { -2, 16, 34 }
++ }
++ };
++ int bw = MT76_GET(MT_RXWI_RATE_BW, rate);
++ int aux_lna = MT76_GET(MT_RXWI_ANT_AUX_LNA, rxwi->ant);
++ int lna_id = MT76_GET(MT_RXWI_GAIN_RSSI_LNA_ID, rxwi->gain);
++ int val;
++
++ if (lna_id) /* LNA id can be 0, 2, 3. */
++ lna_id--;
++
++ val = 8;
++ val -= lna[aux_lna][bw][lna_id];
++ val -= MT76_GET(MT_RXWI_GAIN_RSSI_VAL, rxwi->gain);
++ val -= dev->ee->lna_gain;
++ val -= dev->ee->rssi_offset[0];
++
++ return val;
++}
++
++static void mt7601u_vco_cal(struct mt7601u_dev *dev)
++{
++ mt7601u_rf_wr(dev, 0, 4, 0x0a);
++ mt7601u_rf_wr(dev, 0, 5, 0x20);
++ mt7601u_rf_set(dev, 0, 4, BIT(7));
++ msleep(2);
++}
++
++static int mt7601u_set_bw_filter(struct mt7601u_dev *dev, bool cal)
++{
++ u32 filter = 0;
++ int ret;
++
++ if (!cal)
++ filter |= 0x10000;
++ if (dev->bw != MT_BW_20)
++ filter |= 0x00100;
++
++ /* TX */
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_BW, filter | 1);
++ if (ret)
++ return ret;
++ /* RX */
++ return mt7601u_mcu_calibrate(dev, MCU_CAL_BW, filter);
++}
++
++static int mt7601u_load_bbp_temp_table_bw(struct mt7601u_dev *dev)
++{
++ const struct reg_table *t;
++
++ if (WARN_ON(dev->temp_mode > MT_TEMP_MODE_LOW))
++ return -EINVAL;
++
++ t = &bbp_mode_table[dev->temp_mode][dev->bw];
++
++ return mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP, t->regs, t->n);
++}
++
++static int mt7601u_bbp_temp(struct mt7601u_dev *dev, int mode, const char *name)
++{
++ const struct reg_table *t;
++ int ret;
++
++ if (dev->temp_mode == mode)
++ return 0;
++
++ dev->temp_mode = mode;
++ trace_temp_mode(dev, mode);
++
++ t = bbp_mode_table[dev->temp_mode];
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP,
++ t[2].regs, t[2].n);
++ if (ret)
++ return ret;
++
++ return mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP,
++ t[dev->bw].regs, t[dev->bw].n);
++}
++
++static void mt7601u_apply_ch14_fixup(struct mt7601u_dev *dev, int hw_chan)
++{
++ struct mt7601u_rate_power *t = &dev->ee->power_rate_table;
++
++ if (hw_chan != 14 || dev->bw != MT_BW_20) {
++ mt7601u_bbp_rmw(dev, 4, 0x20, 0);
++ mt7601u_bbp_wr(dev, 178, 0xff);
++
++ t->cck[0].bw20 = dev->ee->real_cck_bw20[0];
++ t->cck[1].bw20 = dev->ee->real_cck_bw20[1];
++ } else { /* Apply CH14 OBW fixup */
++ mt7601u_bbp_wr(dev, 4, 0x60);
++ mt7601u_bbp_wr(dev, 178, 0);
++
++ /* Note: vendor code is buggy here for negative values */
++ t->cck[0].bw20 = dev->ee->real_cck_bw20[0] - 2;
++ t->cck[1].bw20 = dev->ee->real_cck_bw20[1] - 2;
++ }
++}
++
++static int __mt7601u_phy_set_channel(struct mt7601u_dev *dev,
++ struct cfg80211_chan_def *chandef)
++{
++#define FREQ_PLAN_REGS 4
++ static const u8 freq_plan[14][FREQ_PLAN_REGS] = {
++ { 0x99, 0x99, 0x09, 0x50 },
++ { 0x46, 0x44, 0x0a, 0x50 },
++ { 0xec, 0xee, 0x0a, 0x50 },
++ { 0x99, 0x99, 0x0b, 0x50 },
++ { 0x46, 0x44, 0x08, 0x51 },
++ { 0xec, 0xee, 0x08, 0x51 },
++ { 0x99, 0x99, 0x09, 0x51 },
++ { 0x46, 0x44, 0x0a, 0x51 },
++ { 0xec, 0xee, 0x0a, 0x51 },
++ { 0x99, 0x99, 0x0b, 0x51 },
++ { 0x46, 0x44, 0x08, 0x52 },
++ { 0xec, 0xee, 0x08, 0x52 },
++ { 0x99, 0x99, 0x09, 0x52 },
++ { 0x33, 0x33, 0x0b, 0x52 },
++ };
++ struct mt76_reg_pair channel_freq_plan[FREQ_PLAN_REGS] = {
++ { 17, 0 }, { 18, 0 }, { 19, 0 }, { 20, 0 },
++ };
++ struct mt76_reg_pair bbp_settings[3] = {
++ { 62, 0x37 - dev->ee->lna_gain },
++ { 63, 0x37 - dev->ee->lna_gain },
++ { 64, 0x37 - dev->ee->lna_gain },
++ };
++
++ struct ieee80211_channel *chan = chandef->chan;
++ enum nl80211_channel_type chan_type =
++ cfg80211_get_chandef_type(chandef);
++ struct mt7601u_rate_power *t = &dev->ee->power_rate_table;
++ int chan_idx;
++ bool chan_ext_below;
++ u8 bw;
++ int i, ret;
++
++ bw = MT_BW_20;
++ chan_ext_below = (chan_type == NL80211_CHAN_HT40MINUS);
++ chan_idx = chan->hw_value - 1;
++
++ if (chandef->width == NL80211_CHAN_WIDTH_40) {
++ bw = MT_BW_40;
++
++ if (chan_idx > 1 && chan_type == NL80211_CHAN_HT40MINUS)
++ chan_idx -= 2;
++ else if (chan_idx < 12 && chan_type == NL80211_CHAN_HT40PLUS)
++ chan_idx += 2;
++ else
++ dev_err(dev->dev, "Error: invalid 40MHz channel!!\n");
++ }
++
++ if (bw != dev->bw || chan_ext_below != dev->chan_ext_below) {
++ dev_dbg(dev->dev, "Info: switching HT mode bw:%d below:%d\n",
++ bw, chan_ext_below);
++
++ mt7601u_bbp_set_bw(dev, bw);
++
++ mt7601u_bbp_set_ctrlch(dev, chan_ext_below);
++ mt7601u_mac_set_ctrlch(dev, chan_ext_below);
++ dev->chan_ext_below = chan_ext_below;
++ }
++
++ for (i = 0; i < FREQ_PLAN_REGS; i++)
++ channel_freq_plan[i].value = freq_plan[chan_idx][i];
++
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_RF,
++ channel_freq_plan, FREQ_PLAN_REGS);
++ if (ret)
++ return ret;
++
++ mt7601u_rmw(dev, MT_TX_ALC_CFG_0, 0x3f3f,
++ dev->ee->chan_pwr[chan_idx] & 0x3f);
++
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP,
++ bbp_settings, ARRAY_SIZE(bbp_settings));
++ if (ret)
++ return ret;
++
++ mt7601u_vco_cal(dev);
++ mt7601u_bbp_set_bw(dev, bw);
++ ret = mt7601u_set_bw_filter(dev, false);
++ if (ret)
++ return ret;
++
++ mt7601u_apply_ch14_fixup(dev, chan->hw_value);
++ mt7601u_wr(dev, MT_TX_PWR_CFG_0, int_to_s6(t->ofdm[1].bw20) << 24 |
++ int_to_s6(t->ofdm[0].bw20) << 16 |
++ int_to_s6(t->cck[1].bw20) << 8 |
++ int_to_s6(t->cck[0].bw20));
++
++ if (test_bit(MT7601U_STATE_SCANNING, &dev->state))
++ mt7601u_agc_reset(dev);
++
++ dev->chandef = *chandef;
++
++ return 0;
++}
++
++int mt7601u_phy_set_channel(struct mt7601u_dev *dev,
++ struct cfg80211_chan_def *chandef)
++{
++ int ret;
++
++ cancel_delayed_work_sync(&dev->cal_work);
++ cancel_delayed_work_sync(&dev->freq_cal.work);
++
++ mutex_lock(&dev->hw_atomic_mutex);
++ ret = __mt7601u_phy_set_channel(dev, chandef);
++ mutex_unlock(&dev->hw_atomic_mutex);
++ if (ret)
++ return ret;
++
++ if (test_bit(MT7601U_STATE_SCANNING, &dev->state))
++ return 0;
++
++ ieee80211_queue_delayed_work(dev->hw, &dev->cal_work,
++ MT_CALIBRATE_INTERVAL);
++ if (dev->freq_cal.enabled)
++ ieee80211_queue_delayed_work(dev->hw, &dev->freq_cal.work,
++ MT_FREQ_CAL_INIT_DELAY);
++ return 0;
++}
++
++#define BBP_R47_FLAG GENMASK(2, 0)
++#define BBP_R47_F_TSSI 0
++#define BBP_R47_F_PKT_T 1
++#define BBP_R47_F_TX_RATE 2
++#define BBP_R47_F_TEMP 4
++/**
++ * mt7601u_bbp_r47_get - read value through BBP R47/R49 pair
++ * @dev: pointer to adapter structure
++ * @reg: value of BBP R47 before the operation
++ * @flag: one of the BBP_R47_F_* flags
++ *
++ * Convenience helper for reading values through BBP R47/R49 pair.
++ * Takes old value of BBP R47 as @reg, because callers usually have it
++ * cached already.
++ *
++ * Return: value of BBP R49.
++ */
++static u8 mt7601u_bbp_r47_get(struct mt7601u_dev *dev, u8 reg, u8 flag)
++{
++ flag |= reg & ~BBP_R47_FLAG;
++ mt7601u_bbp_wr(dev, 47, flag);
++ usleep_range(500, 700);
++ return mt7601u_bbp_rr(dev, 49);
++}
++
++static s8 mt7601u_read_bootup_temp(struct mt7601u_dev *dev)
++{
++ u8 bbp_val, temp;
++ u32 rf_bp, rf_set;
++ int i;
++
++ rf_set = mt7601u_rr(dev, MT_RF_SETTING_0);
++ rf_bp = mt7601u_rr(dev, MT_RF_BYPASS_0);
++
++ mt7601u_wr(dev, MT_RF_BYPASS_0, 0);
++ mt7601u_wr(dev, MT_RF_SETTING_0, 0x00000010);
++ mt7601u_wr(dev, MT_RF_BYPASS_0, 0x00000010);
++
++ bbp_val = mt7601u_bbp_rmw(dev, 47, 0, 0x10);
++
++ mt7601u_bbp_wr(dev, 22, 0x40);
++
++ for (i = 100; i && (bbp_val & 0x10); i--)
++ bbp_val = mt7601u_bbp_rr(dev, 47);
++
++ temp = mt7601u_bbp_r47_get(dev, bbp_val, BBP_R47_F_TEMP);
++
++ mt7601u_bbp_wr(dev, 22, 0);
++
++ bbp_val = mt7601u_bbp_rr(dev, 21);
++ bbp_val |= 0x02;
++ mt7601u_bbp_wr(dev, 21, bbp_val);
++ bbp_val &= ~0x02;
++ mt7601u_bbp_wr(dev, 21, bbp_val);
++
++ mt7601u_wr(dev, MT_RF_BYPASS_0, 0);
++ mt7601u_wr(dev, MT_RF_SETTING_0, rf_set);
++ mt7601u_wr(dev, MT_RF_BYPASS_0, rf_bp);
++
++ trace_read_temp(dev, temp);
++ return temp;
++}
++
++static s8 mt7601u_read_temp(struct mt7601u_dev *dev)
++{
++ int i;
++ u8 val;
++ s8 temp;
++
++ val = mt7601u_bbp_rmw(dev, 47, 0x7f, 0x10);
++
++ /* Note: this rarely succeeds, temp can change even if it fails. */
++ for (i = 100; i && (val & 0x10); i--)
++ val = mt7601u_bbp_rr(dev, 47);
++
++ temp = mt7601u_bbp_r47_get(dev, val, BBP_R47_F_TEMP);
++
++ trace_read_temp(dev, temp);
++ return temp;
++}
++
++static void mt7601u_rxdc_cal(struct mt7601u_dev *dev)
++{
++ static const struct mt76_reg_pair intro[] = {
++ { 158, 0x8d }, { 159, 0xfc },
++ { 158, 0x8c }, { 159, 0x4c },
++ }, outro[] = {
++ { 158, 0x8d }, { 159, 0xe0 },
++ };
++ u32 mac_ctrl;
++ int i, ret;
++
++ mac_ctrl = mt7601u_rr(dev, MT_MAC_SYS_CTRL);
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_RX);
++
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP,
++ intro, ARRAY_SIZE(intro));
++ if (ret)
++ dev_err(dev->dev, "%s intro failed:%d\n", __func__, ret);
++
++ for (i = 20; i; i--) {
++ usleep_range(300, 500);
++
++ mt7601u_bbp_wr(dev, 158, 0x8c);
++ if (mt7601u_bbp_rr(dev, 159) == 0x0c)
++ break;
++ }
++ if (!i)
++ dev_err(dev->dev, "%s timed out\n", __func__);
++
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, 0);
++
++ ret = mt7601u_write_reg_pairs(dev, MT_MCU_MEMMAP_BBP,
++ outro, ARRAY_SIZE(outro));
++ if (ret)
++ dev_err(dev->dev, "%s outro failed:%d\n", __func__, ret);
++
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, mac_ctrl);
++}
++
++void mt7601u_phy_recalibrate_after_assoc(struct mt7601u_dev *dev)
++{
++ mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->curr_temp);
++
++ mt7601u_rxdc_cal(dev);
++}
++
++/* Note: function copied from vendor driver */
++static s16 lin2dBd(u16 linear)
++{
++ short exp = 0;
++ unsigned int mantisa;
++ int app, dBd;
++
++ if (WARN_ON(!linear))
++ return -10000;
++
++ mantisa = linear;
++
++ exp = fls(mantisa) - 16;
++ if (exp > 0)
++ mantisa >>= exp;
++ else
++ mantisa <<= abs(exp);
++
++ if (mantisa <= 0xb800)
++ app = (mantisa + (mantisa >> 3) + (mantisa >> 4) - 0x9600);
++ else
++ app = (mantisa - (mantisa >> 3) - (mantisa >> 6) - 0x5a00);
++ if (app < 0)
++ app = 0;
++
++ dBd = ((15 + exp) << 15) + app;
++ dBd = (dBd << 2) + (dBd << 1) + (dBd >> 6) + (dBd >> 7);
++ dBd = (dBd >> 10);
++
++ return dBd;
++}
++
++static void
++mt7601u_set_initial_tssi(struct mt7601u_dev *dev, s16 tssi_db, s16 tssi_hvga_db)
++{
++ struct tssi_data *d = &dev->ee->tssi_data;
++ int init_offset;
++
++ init_offset = -((tssi_db * d->slope + d->offset[1]) / 4096) + 10;
++
++ mt76_rmw(dev, MT_TX_ALC_CFG_1, MT_TX_ALC_CFG_1_TEMP_COMP,
++ int_to_s6(init_offset) & MT_TX_ALC_CFG_1_TEMP_COMP);
++}
++
++static void mt7601u_tssi_dc_gain_cal(struct mt7601u_dev *dev)
++{
++ u8 rf_vga, rf_mixer, bbp_r47;
++ int i, j;
++ s8 res[4];
++ s16 tssi_init_db, tssi_init_hvga_db;
++
++ mt7601u_wr(dev, MT_RF_SETTING_0, 0x00000030);
++ mt7601u_wr(dev, MT_RF_BYPASS_0, 0x000c0030);
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, 0);
++
++ mt7601u_bbp_wr(dev, 58, 0);
++ mt7601u_bbp_wr(dev, 241, 0x2);
++ mt7601u_bbp_wr(dev, 23, 0x8);
++ bbp_r47 = mt7601u_bbp_rr(dev, 47);
++
++ /* Set VGA gain */
++ rf_vga = mt7601u_rf_rr(dev, 5, 3);
++ mt7601u_rf_wr(dev, 5, 3, 8);
++
++ /* Mixer disable */
++ rf_mixer = mt7601u_rf_rr(dev, 4, 39);
++ mt7601u_rf_wr(dev, 4, 39, 0);
++
++ for (i = 0; i < 4; i++) {
++ mt7601u_rf_wr(dev, 4, 39, (i & 1) ? rf_mixer : 0);
++
++ mt7601u_bbp_wr(dev, 23, (i < 2) ? 0x08 : 0x02);
++ mt7601u_rf_wr(dev, 5, 3, (i < 2) ? 0x08 : 0x11);
++
++ /* BBP TSSI initial and soft reset */
++ mt7601u_bbp_wr(dev, 22, 0);
++ mt7601u_bbp_wr(dev, 244, 0);
++
++ mt7601u_bbp_wr(dev, 21, 1);
++ udelay(1);
++ mt7601u_bbp_wr(dev, 21, 0);
++
++ /* TSSI measurement */
++ mt7601u_bbp_wr(dev, 47, 0x50);
++ mt7601u_bbp_wr(dev, (i & 1) ? 244 : 22, (i & 1) ? 0x31 : 0x40);
++
++ for (j = 20; j; j--)
++ if (!(mt7601u_bbp_rr(dev, 47) & 0x10))
++ break;
++ if (!j)
++ dev_err(dev->dev, "%s timed out\n", __func__);
++
++ /* TSSI read */
++ mt7601u_bbp_wr(dev, 47, 0x40);
++ res[i] = mt7601u_bbp_rr(dev, 49);
++ }
++
++ tssi_init_db = lin2dBd((short)res[1] - res[0]);
++ tssi_init_hvga_db = lin2dBd(((short)res[3] - res[2]) * 4);
++ dev->tssi_init = res[0];
++ dev->tssi_init_hvga = res[2];
++ dev->tssi_init_hvga_offset_db = tssi_init_hvga_db - tssi_init_db;
++
++ dev_dbg(dev->dev,
++ "TSSI_init:%hhx db:%hx hvga:%hhx hvga_db:%hx off_db:%hx\n",
++ dev->tssi_init, tssi_init_db, dev->tssi_init_hvga,
++ tssi_init_hvga_db, dev->tssi_init_hvga_offset_db);
++
++ mt7601u_bbp_wr(dev, 22, 0);
++ mt7601u_bbp_wr(dev, 244, 0);
++
++ mt7601u_bbp_wr(dev, 21, 1);
++ udelay(1);
++ mt7601u_bbp_wr(dev, 21, 0);
++
++ mt7601u_wr(dev, MT_RF_BYPASS_0, 0);
++ mt7601u_wr(dev, MT_RF_SETTING_0, 0);
++
++ mt7601u_rf_wr(dev, 5, 3, rf_vga);
++ mt7601u_rf_wr(dev, 4, 39, rf_mixer);
++ mt7601u_bbp_wr(dev, 47, bbp_r47);
++
++ mt7601u_set_initial_tssi(dev, tssi_init_db, tssi_init_hvga_db);
++}
++
++static int mt7601u_temp_comp(struct mt7601u_dev *dev, bool on)
++{
++ int ret, temp, hi_temp = 400, lo_temp = -200;
++
++ temp = (dev->raw_temp - dev->ee->ref_temp) * MT_EE_TEMPERATURE_SLOPE;
++ dev->curr_temp = temp;
++
++ /* DPD Calibration */
++ if (temp - dev->dpd_temp > 450 || temp - dev->dpd_temp < -450) {
++ dev->dpd_temp = temp;
++
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->dpd_temp);
++ if (ret)
++ return ret;
++
++ mt7601u_vco_cal(dev);
++
++ dev_dbg(dev->dev, "Recalibrate DPD\n");
++ }
++
++ /* PLL Lock Protect */
++ if (temp < -50 && !dev->pll_lock_protect) { /* < 20C */
++ dev->pll_lock_protect = true;
++
++ mt7601u_rf_wr(dev, 4, 4, 6);
++ mt7601u_rf_clear(dev, 4, 10, 0x30);
++
++ dev_dbg(dev->dev, "PLL lock protect on - too cold\n");
++ } else if (temp > 50 && dev->pll_lock_protect) { /* > 30C */
++ dev->pll_lock_protect = false;
++
++ mt7601u_rf_wr(dev, 4, 4, 0);
++ mt7601u_rf_rmw(dev, 4, 10, 0x30, 0x10);
++
++ dev_dbg(dev->dev, "PLL lock protect off\n");
++ }
++
++ if (on) {
++ hi_temp -= 50;
++ lo_temp -= 50;
++ }
++
++ /* BBP CR for H, L, N temperature */
++ if (temp > hi_temp)
++ return mt7601u_bbp_temp(dev, MT_TEMP_MODE_HIGH, "high");
++ else if (temp > lo_temp)
++ return mt7601u_bbp_temp(dev, MT_TEMP_MODE_NORMAL, "normal");
++ else
++ return mt7601u_bbp_temp(dev, MT_TEMP_MODE_LOW, "low");
++}
++
++/* Note: this is used only with TSSI, we can just use trgt_pwr from eeprom. */
++static int mt7601u_current_tx_power(struct mt7601u_dev *dev)
++{
++ return dev->ee->chan_pwr[dev->chandef.chan->hw_value - 1];
++}
++
++static bool mt7601u_use_hvga(struct mt7601u_dev *dev)
++{
++ return !(mt7601u_current_tx_power(dev) > 20);
++}
++
++static s16
++mt7601u_phy_rf_pa_mode_val(struct mt7601u_dev *dev, int phy_mode, int tx_rate)
++{
++ static const s16 decode_tb[] = { 0, 8847, -5734, -5734 };
++ u32 reg;
++
++ switch (phy_mode) {
++ case MT_PHY_TYPE_OFDM:
++ tx_rate += 4;
++ case MT_PHY_TYPE_CCK:
++ reg = dev->rf_pa_mode[0];
++ break;
++ default:
++ reg = dev->rf_pa_mode[1];
++ break;
++ }
++
++ return decode_tb[(reg >> (tx_rate * 2)) & 0x3];
++}
++
++static struct mt7601u_tssi_params
++mt7601u_tssi_params_get(struct mt7601u_dev *dev)
++{
++ static const u8 ofdm_pkt2rate[8] = { 6, 4, 2, 0, 7, 5, 3, 1 };
++ static const int static_power[4] = { 0, -49152, -98304, 49152 };
++ struct mt7601u_tssi_params p;
++ u8 bbp_r47, pkt_type, tx_rate;
++ struct power_per_rate *rate_table;
++
++ bbp_r47 = mt7601u_bbp_rr(dev, 47);
++
++ p.tssi0 = mt7601u_bbp_r47_get(dev, bbp_r47, BBP_R47_F_TSSI);
++ dev->raw_temp = mt7601u_bbp_r47_get(dev, bbp_r47, BBP_R47_F_TEMP);
++ pkt_type = mt7601u_bbp_r47_get(dev, bbp_r47, BBP_R47_F_PKT_T);
++
++ p.trgt_power = mt7601u_current_tx_power(dev);
++
++ switch (pkt_type & 0x03) {
++ case MT_PHY_TYPE_CCK:
++ tx_rate = (pkt_type >> 4) & 0x03;
++ rate_table = dev->ee->power_rate_table.cck;
++ break;
++
++ case MT_PHY_TYPE_OFDM:
++ tx_rate = ofdm_pkt2rate[(pkt_type >> 4) & 0x07];
++ rate_table = dev->ee->power_rate_table.ofdm;
++ break;
++
++ default:
++ tx_rate = mt7601u_bbp_r47_get(dev, bbp_r47, BBP_R47_F_TX_RATE);
++ tx_rate &= 0x7f;
++ rate_table = dev->ee->power_rate_table.ht;
++ break;
++ }
++
++ if (dev->bw == MT_BW_20)
++ p.trgt_power += rate_table[tx_rate / 2].bw20;
++ else
++ p.trgt_power += rate_table[tx_rate / 2].bw40;
++
++ p.trgt_power <<= 12;
++
++ dev_dbg(dev->dev, "tx_rate:%02hhx pwr:%08x\n", tx_rate, p.trgt_power);
++
++ p.trgt_power += mt7601u_phy_rf_pa_mode_val(dev, pkt_type & 0x03,
++ tx_rate);
++
++ /* Channel 14, cck, bw20 */
++ if ((pkt_type & 0x03) == MT_PHY_TYPE_CCK) {
++ if (mt7601u_bbp_rr(dev, 4) & 0x20)
++ p.trgt_power += mt7601u_bbp_rr(dev, 178) ? 18022 : 9830;
++ else
++ p.trgt_power += mt7601u_bbp_rr(dev, 178) ? 819 : 24576;
++ }
++
++ p.trgt_power += static_power[mt7601u_bbp_rr(dev, 1) & 0x03];
++
++ p.trgt_power += dev->ee->tssi_data.tx0_delta_offset;
++
++ dev_dbg(dev->dev,
++ "tssi:%02hhx t_power:%08x temp:%02hhx pkt_type:%02hhx\n",
++ p.tssi0, p.trgt_power, dev->raw_temp, pkt_type);
++
++ return p;
++}
++
++static bool mt7601u_tssi_read_ready(struct mt7601u_dev *dev)
++{
++ return !(mt7601u_bbp_rr(dev, 47) & 0x10);
++}
++
++static int mt7601u_tssi_cal(struct mt7601u_dev *dev)
++{
++ struct mt7601u_tssi_params params;
++ int curr_pwr, diff_pwr;
++ char tssi_offset;
++ s8 tssi_init;
++ s16 tssi_m_dc, tssi_db;
++ bool hvga;
++ u32 val;
++
++ if (!dev->ee->tssi_enabled)
++ return 0;
++
++ hvga = mt7601u_use_hvga(dev);
++ if (!dev->tssi_read_trig)
++ return mt7601u_mcu_tssi_read_kick(dev, hvga);
++
++ if (!mt7601u_tssi_read_ready(dev))
++ return 0;
++
++ params = mt7601u_tssi_params_get(dev);
++
++ tssi_init = (hvga ? dev->tssi_init_hvga : dev->tssi_init);
++ tssi_m_dc = params.tssi0 - tssi_init;
++ tssi_db = lin2dBd(tssi_m_dc);
++ dev_dbg(dev->dev, "tssi dc:%04hx db:%04hx hvga:%d\n",
++ tssi_m_dc, tssi_db, hvga);
++
++ if (dev->chandef.chan->hw_value < 5)
++ tssi_offset = dev->ee->tssi_data.offset[0];
++ else if (dev->chandef.chan->hw_value < 9)
++ tssi_offset = dev->ee->tssi_data.offset[1];
++ else
++ tssi_offset = dev->ee->tssi_data.offset[2];
++
++ if (hvga)
++ tssi_db -= dev->tssi_init_hvga_offset_db;
++
++ curr_pwr = tssi_db * dev->ee->tssi_data.slope + (tssi_offset << 9);
++ diff_pwr = params.trgt_power - curr_pwr;
++ dev_dbg(dev->dev, "Power curr:%08x diff:%08x\n", curr_pwr, diff_pwr);
++
++ if (params.tssi0 > 126 && diff_pwr > 0) {
++ dev_err(dev->dev, "Error: TSSI upper saturation\n");
++ diff_pwr = 0;
++ }
++ if (params.tssi0 - tssi_init < 1 && diff_pwr < 0) {
++ dev_err(dev->dev, "Error: TSSI lower saturation\n");
++ diff_pwr = 0;
++ }
++
++ if ((dev->prev_pwr_diff ^ diff_pwr) < 0 && abs(diff_pwr) < 4096 &&
++ (abs(diff_pwr) > abs(dev->prev_pwr_diff) ||
++ (diff_pwr > 0 && diff_pwr == -dev->prev_pwr_diff)))
++ diff_pwr = 0;
++ else
++ dev->prev_pwr_diff = diff_pwr;
++
++ diff_pwr += (diff_pwr > 0) ? 2048 : -2048;
++ diff_pwr /= 4096;
++
++ dev_dbg(dev->dev, "final diff: %08x\n", diff_pwr);
++
++ val = mt7601u_rr(dev, MT_TX_ALC_CFG_1);
++ curr_pwr = s6_to_int(MT76_GET(MT_TX_ALC_CFG_1_TEMP_COMP, val));
++ diff_pwr += curr_pwr;
++ val = (val & ~MT_TX_ALC_CFG_1_TEMP_COMP) | int_to_s6(diff_pwr);
++ mt7601u_wr(dev, MT_TX_ALC_CFG_1, val);
++
++ return mt7601u_mcu_tssi_read_kick(dev, hvga);
++}
++
++static u8 mt7601u_agc_default(struct mt7601u_dev *dev)
++{
++ return (dev->ee->lna_gain - 8) * 2 + 0x34;
++}
++
++static void mt7601u_agc_reset(struct mt7601u_dev *dev)
++{
++ u8 agc = mt7601u_agc_default(dev);
++
++ mt7601u_bbp_wr(dev, 66, agc);
++}
++
++void mt7601u_agc_save(struct mt7601u_dev *dev)
++{
++ dev->agc_save = mt7601u_bbp_rr(dev, 66);
++}
++
++void mt7601u_agc_restore(struct mt7601u_dev *dev)
++{
++ mt7601u_bbp_wr(dev, 66, dev->agc_save);
++}
++
++static void mt7601u_agc_tune(struct mt7601u_dev *dev)
++{
++ u8 val = mt7601u_agc_default(dev);
++
++ if (test_bit(MT7601U_STATE_SCANNING, &dev->state))
++ return;
++
++ /* Note: only in STA mode and not dozing; perhaps do this only if
++ * there is enough rssi updates since last run?
++ * Rssi updates are only on beacons and U2M so should work...
++ */
++ spin_lock_bh(&dev->con_mon_lock);
++ if (dev->avg_rssi <= -70)
++ val -= 0x20;
++ else if (dev->avg_rssi <= -60)
++ val -= 0x10;
++ spin_unlock_bh(&dev->con_mon_lock);
++
++ if (val != mt7601u_bbp_rr(dev, 66))
++ mt7601u_bbp_wr(dev, 66, val);
++
++ /* TODO: also if lost a lot of beacons try resetting
++ * (see RTMPSetAGCInitValue() call in mlme.c).
++ */
++}
++
++static void mt7601u_phy_calibrate(struct work_struct *work)
++{
++ struct mt7601u_dev *dev = container_of(work, struct mt7601u_dev,
++ cal_work.work);
++
++ mt7601u_agc_tune(dev);
++ mt7601u_tssi_cal(dev);
++ /* If TSSI calibration was run it already updated temperature. */
++ if (!dev->ee->tssi_enabled)
++ dev->raw_temp = mt7601u_read_temp(dev);
++ mt7601u_temp_comp(dev, true); /* TODO: find right value for @on */
++
++ ieee80211_queue_delayed_work(dev->hw, &dev->cal_work,
++ MT_CALIBRATE_INTERVAL);
++}
++
++static unsigned long
++__mt7601u_phy_freq_cal(struct mt7601u_dev *dev, s8 last_offset, u8 phy_mode)
++{
++ u8 activate_threshold, deactivate_threshold;
++
++ trace_freq_cal_offset(dev, phy_mode, last_offset);
++
++ /* No beacons received - reschedule soon */
++ if (last_offset == MT_FREQ_OFFSET_INVALID)
++ return MT_FREQ_CAL_ADJ_INTERVAL;
++
++ switch (phy_mode) {
++ case MT_PHY_TYPE_CCK:
++ activate_threshold = 19;
++ deactivate_threshold = 5;
++ break;
++ case MT_PHY_TYPE_OFDM:
++ activate_threshold = 102;
++ deactivate_threshold = 32;
++ break;
++ case MT_PHY_TYPE_HT:
++ case MT_PHY_TYPE_HT_GF:
++ activate_threshold = 82;
++ deactivate_threshold = 20;
++ break;
++ default:
++ WARN_ON(1);
++ return MT_FREQ_CAL_CHECK_INTERVAL;
++ }
++
++ if (abs(last_offset) >= activate_threshold)
++ dev->freq_cal.adjusting = true;
++ else if (abs(last_offset) <= deactivate_threshold)
++ dev->freq_cal.adjusting = false;
++
++ if (!dev->freq_cal.adjusting)
++ return MT_FREQ_CAL_CHECK_INTERVAL;
++
++ if (last_offset > deactivate_threshold) {
++ if (dev->freq_cal.freq > 0)
++ dev->freq_cal.freq--;
++ else
++ dev->freq_cal.adjusting = false;
++ } else if (last_offset < -deactivate_threshold) {
++ if (dev->freq_cal.freq < 0xbf)
++ dev->freq_cal.freq++;
++ else
++ dev->freq_cal.adjusting = false;
++ }
++
++ trace_freq_cal_adjust(dev, dev->freq_cal.freq);
++ mt7601u_rf_wr(dev, 0, 12, dev->freq_cal.freq);
++ mt7601u_vco_cal(dev);
++
++ return dev->freq_cal.adjusting ? MT_FREQ_CAL_ADJ_INTERVAL :
++ MT_FREQ_CAL_CHECK_INTERVAL;
++}
++
++static void mt7601u_phy_freq_cal(struct work_struct *work)
++{
++ struct mt7601u_dev *dev = container_of(work, struct mt7601u_dev,
++ freq_cal.work.work);
++ s8 last_offset;
++ u8 phy_mode;
++ unsigned long delay;
++
++ spin_lock_bh(&dev->con_mon_lock);
++ last_offset = dev->bcn_freq_off;
++ phy_mode = dev->bcn_phy_mode;
++ spin_unlock_bh(&dev->con_mon_lock);
++
++ delay = __mt7601u_phy_freq_cal(dev, last_offset, phy_mode);
++ ieee80211_queue_delayed_work(dev->hw, &dev->freq_cal.work, delay);
++
++ spin_lock_bh(&dev->con_mon_lock);
++ dev->bcn_freq_off = MT_FREQ_OFFSET_INVALID;
++ spin_unlock_bh(&dev->con_mon_lock);
++}
++
++void mt7601u_phy_con_cal_onoff(struct mt7601u_dev *dev,
++ struct ieee80211_bss_conf *info)
++{
++ if (!info->assoc)
++ cancel_delayed_work_sync(&dev->freq_cal.work);
++
++ /* Start/stop collecting beacon data */
++ spin_lock_bh(&dev->con_mon_lock);
++ ether_addr_copy(dev->ap_bssid, info->bssid);
++ dev->avg_rssi = 0;
++ dev->bcn_freq_off = MT_FREQ_OFFSET_INVALID;
++ spin_unlock_bh(&dev->con_mon_lock);
++
++ dev->freq_cal.freq = dev->ee->rf_freq_off;
++ dev->freq_cal.enabled = info->assoc;
++ dev->freq_cal.adjusting = false;
++
++ if (info->assoc)
++ ieee80211_queue_delayed_work(dev->hw, &dev->freq_cal.work,
++ MT_FREQ_CAL_INIT_DELAY);
++}
++
++static int mt7601u_init_cal(struct mt7601u_dev *dev)
++{
++ u32 mac_ctrl;
++ int ret;
++
++ dev->raw_temp = mt7601u_read_bootup_temp(dev);
++ dev->curr_temp = (dev->raw_temp - dev->ee->ref_temp) *
++ MT_EE_TEMPERATURE_SLOPE;
++ dev->dpd_temp = dev->curr_temp;
++
++ mac_ctrl = mt7601u_rr(dev, MT_MAC_SYS_CTRL);
++
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_R, 0);
++ if (ret)
++ return ret;
++
++ ret = mt7601u_rf_rr(dev, 0, 4);
++ if (ret < 0)
++ return ret;
++ ret |= 0x80;
++ ret = mt7601u_rf_wr(dev, 0, 4, ret);
++ if (ret)
++ return ret;
++ msleep(2);
++
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_TXDCOC, 0);
++ if (ret)
++ return ret;
++
++ mt7601u_rxdc_cal(dev);
++
++ ret = mt7601u_set_bw_filter(dev, true);
++ if (ret)
++ return ret;
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_LOFT, 0);
++ if (ret)
++ return ret;
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_TXIQ, 0);
++ if (ret)
++ return ret;
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_RXIQ, 0);
++ if (ret)
++ return ret;
++ ret = mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->dpd_temp);
++ if (ret)
++ return ret;
++
++ mt7601u_rxdc_cal(dev);
++
++ mt7601u_tssi_dc_gain_cal(dev);
++
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, mac_ctrl);
++
++ mt7601u_temp_comp(dev, true);
++
++ return 0;
++}
++
++int mt7601u_bbp_set_bw(struct mt7601u_dev *dev, int bw)
++{
++ u32 val, old;
++
++ if (bw == dev->bw) {
++ /* Vendor driver does the rmc even when no change is needed. */
++ mt7601u_bbp_rmc(dev, 4, 0x18, bw == MT_BW_20 ? 0 : 0x10);
++
++ return 0;
++ }
++ dev->bw = bw;
++
++ /* Stop MAC for the time of bw change */
++ old = mt7601u_rr(dev, MT_MAC_SYS_CTRL);
++ val = old & ~(MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX);
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, val);
++ mt76_poll(dev, MT_MAC_STATUS, MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
++ 0, 500000);
++
++ mt7601u_bbp_rmc(dev, 4, 0x18, bw == MT_BW_20 ? 0 : 0x10);
++
++ mt7601u_wr(dev, MT_MAC_SYS_CTRL, old);
++
++ return mt7601u_load_bbp_temp_table_bw(dev);
++}
++
++/**
++ * mt7601u_set_rx_path - set rx path in BBP
++ * @dev: pointer to adapter structure
++ * @path: rx path to set values are 0-based
++ */
++void mt7601u_set_rx_path(struct mt7601u_dev *dev, u8 path)
++{
++ mt7601u_bbp_rmw(dev, 3, 0x18, path << 3);
++}
++
++/**
++ * mt7601u_set_tx_dac - set which tx DAC to use
++ * @dev: pointer to adapter structure
++ * @path: DAC index, values are 0-based
++ */
++void mt7601u_set_tx_dac(struct mt7601u_dev *dev, u8 dac)
++{
++ mt7601u_bbp_rmc(dev, 1, 0x18, dac << 3);
++}
++
++int mt7601u_phy_init(struct mt7601u_dev *dev)
++{
++ int ret;
++
++ dev->rf_pa_mode[0] = mt7601u_rr(dev, MT_RF_PA_MODE_CFG0);
++ dev->rf_pa_mode[1] = mt7601u_rr(dev, MT_RF_PA_MODE_CFG1);
++
++ ret = mt7601u_rf_wr(dev, 0, 12, dev->ee->rf_freq_off);
++ if (ret)
++ return ret;
++ ret = mt7601u_write_reg_pairs(dev, 0, rf_central,
++ ARRAY_SIZE(rf_central));
++ if (ret)
++ return ret;
++ ret = mt7601u_write_reg_pairs(dev, 0, rf_channel,
++ ARRAY_SIZE(rf_channel));
++ if (ret)
++ return ret;
++ ret = mt7601u_write_reg_pairs(dev, 0, rf_vga, ARRAY_SIZE(rf_vga));
++ if (ret)
++ return ret;
++
++ ret = mt7601u_init_cal(dev);
++ if (ret)
++ return ret;
++
++ dev->prev_pwr_diff = 100;
++
++ INIT_DELAYED_WORK(&dev->cal_work, mt7601u_phy_calibrate);
++ INIT_DELAYED_WORK(&dev->freq_cal.work, mt7601u_phy_freq_cal);
++
++ return 0;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/regs.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/regs.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/regs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/regs.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,636 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT76_REGS_H
++#define __MT76_REGS_H
++
++#include <linux/bitops.h>
++
++#ifndef GENMASK
++#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
++#endif
++
++#define MT_ASIC_VERSION 0x0000
++
++#define MT76XX_REV_E3 0x22
++#define MT76XX_REV_E4 0x33
++
++#define MT_CMB_CTRL 0x0020
++#define MT_CMB_CTRL_XTAL_RDY BIT(22)
++#define MT_CMB_CTRL_PLL_LD BIT(23)
++
++#define MT_EFUSE_CTRL 0x0024
++#define MT_EFUSE_CTRL_AOUT GENMASK(5, 0)
++#define MT_EFUSE_CTRL_MODE GENMASK(7, 6)
++#define MT_EFUSE_CTRL_LDO_OFF_TIME GENMASK(13, 8)
++#define MT_EFUSE_CTRL_LDO_ON_TIME GENMASK(15, 14)
++#define MT_EFUSE_CTRL_AIN GENMASK(25, 16)
++#define MT_EFUSE_CTRL_KICK BIT(30)
++#define MT_EFUSE_CTRL_SEL BIT(31)
++
++#define MT_EFUSE_DATA_BASE 0x0028
++#define MT_EFUSE_DATA(_n) (MT_EFUSE_DATA_BASE + ((_n) << 2))
++
++#define MT_COEXCFG0 0x0040
++#define MT_COEXCFG0_COEX_EN BIT(0)
++
++#define MT_WLAN_FUN_CTRL 0x0080
++#define MT_WLAN_FUN_CTRL_WLAN_EN BIT(0)
++#define MT_WLAN_FUN_CTRL_WLAN_CLK_EN BIT(1)
++#define MT_WLAN_FUN_CTRL_WLAN_RESET_RF BIT(2)
++
++#define MT_WLAN_FUN_CTRL_WLAN_RESET BIT(3) /* MT76x0 */
++#define MT_WLAN_FUN_CTRL_CSR_F20M_CKEN BIT(3) /* MT76x2 */
++
++#define MT_WLAN_FUN_CTRL_PCIE_CLK_REQ BIT(4)
++#define MT_WLAN_FUN_CTRL_FRC_WL_ANT_SEL BIT(5)
++#define MT_WLAN_FUN_CTRL_INV_ANT_SEL BIT(6)
++#define MT_WLAN_FUN_CTRL_WAKE_HOST BIT(7)
++
++#define MT_WLAN_FUN_CTRL_THERM_RST BIT(8) /* MT76x2 */
++#define MT_WLAN_FUN_CTRL_THERM_CKEN BIT(9) /* MT76x2 */
++
++#define MT_WLAN_FUN_CTRL_GPIO_IN GENMASK(15, 8) /* MT76x0 */
++#define MT_WLAN_FUN_CTRL_GPIO_OUT GENMASK(23, 16) /* MT76x0 */
++#define MT_WLAN_FUN_CTRL_GPIO_OUT_EN GENMASK(31, 24) /* MT76x0 */
++
++#define MT_XO_CTRL0 0x0100
++#define MT_XO_CTRL1 0x0104
++#define MT_XO_CTRL2 0x0108
++#define MT_XO_CTRL3 0x010c
++#define MT_XO_CTRL4 0x0110
++
++#define MT_XO_CTRL5 0x0114
++#define MT_XO_CTRL5_C2_VAL GENMASK(14, 8)
++
++#define MT_XO_CTRL6 0x0118
++#define MT_XO_CTRL6_C2_CTRL GENMASK(14, 8)
++
++#define MT_XO_CTRL7 0x011c
++
++#define MT_WLAN_MTC_CTRL 0x10148
++#define MT_WLAN_MTC_CTRL_MTCMOS_PWR_UP BIT(0)
++#define MT_WLAN_MTC_CTRL_PWR_ACK BIT(12)
++#define MT_WLAN_MTC_CTRL_PWR_ACK_S BIT(13)
++#define MT_WLAN_MTC_CTRL_BBP_MEM_PD GENMASK(19, 16)
++#define MT_WLAN_MTC_CTRL_PBF_MEM_PD BIT(20)
++#define MT_WLAN_MTC_CTRL_FCE_MEM_PD BIT(21)
++#define MT_WLAN_MTC_CTRL_TSO_MEM_PD BIT(22)
++#define MT_WLAN_MTC_CTRL_BBP_MEM_RB BIT(24)
++#define MT_WLAN_MTC_CTRL_PBF_MEM_RB BIT(25)
++#define MT_WLAN_MTC_CTRL_FCE_MEM_RB BIT(26)
++#define MT_WLAN_MTC_CTRL_TSO_MEM_RB BIT(27)
++#define MT_WLAN_MTC_CTRL_STATE_UP BIT(28)
++
++#define MT_INT_SOURCE_CSR 0x0200
++#define MT_INT_MASK_CSR 0x0204
++
++#define MT_INT_RX_DONE(_n) BIT(_n)
++#define MT_INT_RX_DONE_ALL GENMASK(1, 0)
++#define MT_INT_TX_DONE_ALL GENMASK(13, 4)
++#define MT_INT_TX_DONE(_n) BIT(_n + 4)
++#define MT_INT_RX_COHERENT BIT(16)
++#define MT_INT_TX_COHERENT BIT(17)
++#define MT_INT_ANY_COHERENT BIT(18)
++#define MT_INT_MCU_CMD BIT(19)
++#define MT_INT_TBTT BIT(20)
++#define MT_INT_PRE_TBTT BIT(21)
++#define MT_INT_TX_STAT BIT(22)
++#define MT_INT_AUTO_WAKEUP BIT(23)
++#define MT_INT_GPTIMER BIT(24)
++#define MT_INT_RXDELAYINT BIT(26)
++#define MT_INT_TXDELAYINT BIT(27)
++
++#define MT_WPDMA_GLO_CFG 0x0208
++#define MT_WPDMA_GLO_CFG_TX_DMA_EN BIT(0)
++#define MT_WPDMA_GLO_CFG_TX_DMA_BUSY BIT(1)
++#define MT_WPDMA_GLO_CFG_RX_DMA_EN BIT(2)
++#define MT_WPDMA_GLO_CFG_RX_DMA_BUSY BIT(3)
++#define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE GENMASK(5, 4)
++#define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE BIT(6)
++#define MT_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7)
++#define MT_WPDMA_GLO_CFG_HDR_SEG_LEN GENMASK(15, 8)
++#define MT_WPDMA_GLO_CFG_CLK_GATE_DIS BIT(30)
++#define MT_WPDMA_GLO_CFG_RX_2B_OFFSET BIT(31)
++
++#define MT_WPDMA_RST_IDX 0x020c
++
++#define MT_WPDMA_DELAY_INT_CFG 0x0210
++
++#define MT_WMM_AIFSN 0x0214
++#define MT_WMM_AIFSN_MASK GENMASK(3, 0)
++#define MT_WMM_AIFSN_SHIFT(_n) ((_n) * 4)
++
++#define MT_WMM_CWMIN 0x0218
++#define MT_WMM_CWMIN_MASK GENMASK(3, 0)
++#define MT_WMM_CWMIN_SHIFT(_n) ((_n) * 4)
++
++#define MT_WMM_CWMAX 0x021c
++#define MT_WMM_CWMAX_MASK GENMASK(3, 0)
++#define MT_WMM_CWMAX_SHIFT(_n) ((_n) * 4)
++
++#define MT_WMM_TXOP_BASE 0x0220
++#define MT_WMM_TXOP(_n) (MT_WMM_TXOP_BASE + (((_n) / 2) << 2))
++#define MT_WMM_TXOP_SHIFT(_n) ((_n & 1) * 16)
++#define MT_WMM_TXOP_MASK GENMASK(15, 0)
++
++#define MT_FCE_DMA_ADDR 0x0230
++#define MT_FCE_DMA_LEN 0x0234
++
++#define MT_USB_DMA_CFG 0x238
++#define MT_USB_DMA_CFG_RX_BULK_AGG_TOUT GENMASK(7, 0)
++#define MT_USB_DMA_CFG_RX_BULK_AGG_LMT GENMASK(15, 8)
++#define MT_USB_DMA_CFG_PHY_CLR BIT(16)
++#define MT_USB_DMA_CFG_TX_CLR BIT(19)
++#define MT_USB_DMA_CFG_TXOP_HALT BIT(20)
++#define MT_USB_DMA_CFG_RX_BULK_AGG_EN BIT(21)
++#define MT_USB_DMA_CFG_RX_BULK_EN BIT(22)
++#define MT_USB_DMA_CFG_TX_BULK_EN BIT(23)
++#define MT_USB_DMA_CFG_UDMA_RX_WL_DROP BIT(25)
++#define MT_USB_DMA_CFG_EP_OUT_VALID GENMASK(29, 27)
++#define MT_USB_DMA_CFG_RX_BUSY BIT(30)
++#define MT_USB_DMA_CFG_TX_BUSY BIT(31)
++
++#define MT_TSO_CTRL 0x0250
++#define MT_HEADER_TRANS_CTRL_REG 0x0260
++
++#define MT_US_CYC_CFG 0x02a4
++#define MT_US_CYC_CNT GENMASK(7, 0)
++
++#define MT_TX_RING_BASE 0x0300
++#define MT_RX_RING_BASE 0x03c0
++#define MT_RING_SIZE 0x10
++
++#define MT_TX_HW_QUEUE_MCU 8
++#define MT_TX_HW_QUEUE_MGMT 9
++
++#define MT_PBF_SYS_CTRL 0x0400
++#define MT_PBF_SYS_CTRL_MCU_RESET BIT(0)
++#define MT_PBF_SYS_CTRL_DMA_RESET BIT(1)
++#define MT_PBF_SYS_CTRL_MAC_RESET BIT(2)
++#define MT_PBF_SYS_CTRL_PBF_RESET BIT(3)
++#define MT_PBF_SYS_CTRL_ASY_RESET BIT(4)
++
++#define MT_PBF_CFG 0x0404
++#define MT_PBF_CFG_TX0Q_EN BIT(0)
++#define MT_PBF_CFG_TX1Q_EN BIT(1)
++#define MT_PBF_CFG_TX2Q_EN BIT(2)
++#define MT_PBF_CFG_TX3Q_EN BIT(3)
++#define MT_PBF_CFG_RX0Q_EN BIT(4)
++#define MT_PBF_CFG_RX_DROP_EN BIT(8)
++
++#define MT_PBF_TX_MAX_PCNT 0x0408
++#define MT_PBF_RX_MAX_PCNT 0x040c
++
++#define MT_BCN_OFFSET_BASE 0x041c
++#define MT_BCN_OFFSET(_n) (MT_BCN_OFFSET_BASE + ((_n) << 2))
++
++#define MT_RF_CSR_CFG 0x0500
++#define MT_RF_CSR_CFG_DATA GENMASK(7, 0)
++#define MT_RF_CSR_CFG_REG_ID GENMASK(13, 8)
++#define MT_RF_CSR_CFG_REG_BANK GENMASK(17, 14)
++#define MT_RF_CSR_CFG_WR BIT(30)
++#define MT_RF_CSR_CFG_KICK BIT(31)
++
++#define MT_RF_BYPASS_0 0x0504
++#define MT_RF_BYPASS_1 0x0508
++#define MT_RF_SETTING_0 0x050c
++
++#define MT_RF_DATA_WRITE 0x0524
++
++#define MT_RF_CTRL 0x0528
++#define MT_RF_CTRL_ADDR GENMASK(11, 0)
++#define MT_RF_CTRL_WRITE BIT(12)
++#define MT_RF_CTRL_BUSY BIT(13)
++#define MT_RF_CTRL_IDX BIT(16)
++
++#define MT_RF_DATA_READ 0x052c
++
++#define MT_FCE_PSE_CTRL 0x0800
++#define MT_FCE_PARAMETERS 0x0804
++#define MT_FCE_CSO 0x0808
++
++#define MT_FCE_L2_STUFF 0x080c
++#define MT_FCE_L2_STUFF_HT_L2_EN BIT(0)
++#define MT_FCE_L2_STUFF_QOS_L2_EN BIT(1)
++#define MT_FCE_L2_STUFF_RX_STUFF_EN BIT(2)
++#define MT_FCE_L2_STUFF_TX_STUFF_EN BIT(3)
++#define MT_FCE_L2_STUFF_WR_MPDU_LEN_EN BIT(4)
++#define MT_FCE_L2_STUFF_MVINV_BSWAP BIT(5)
++#define MT_FCE_L2_STUFF_TS_CMD_QSEL_EN GENMASK(15, 8)
++#define MT_FCE_L2_STUFF_TS_LEN_EN GENMASK(23, 16)
++#define MT_FCE_L2_STUFF_OTHER_PORT GENMASK(25, 24)
++
++#define MT_FCE_WLAN_FLOW_CONTROL1 0x0824
++
++#define MT_TX_CPU_FROM_FCE_BASE_PTR 0x09a0
++#define MT_TX_CPU_FROM_FCE_MAX_COUNT 0x09a4
++#define MT_TX_CPU_FROM_FCE_CPU_DESC_IDX 0x09a8
++
++#define MT_FCE_PDMA_GLOBAL_CONF 0x09c4
++
++#define MT_PAUSE_ENABLE_CONTROL1 0x0a38
++
++#define MT_FCE_SKIP_FS 0x0a6c
++
++#define MT_MAC_CSR0 0x1000
++
++#define MT_MAC_SYS_CTRL 0x1004
++#define MT_MAC_SYS_CTRL_RESET_CSR BIT(0)
++#define MT_MAC_SYS_CTRL_RESET_BBP BIT(1)
++#define MT_MAC_SYS_CTRL_ENABLE_TX BIT(2)
++#define MT_MAC_SYS_CTRL_ENABLE_RX BIT(3)
++
++#define MT_MAC_ADDR_DW0 0x1008
++#define MT_MAC_ADDR_DW1 0x100c
++#define MT_MAC_ADDR_DW1_U2ME_MASK GENMASK(23, 16)
++
++#define MT_MAC_BSSID_DW0 0x1010
++#define MT_MAC_BSSID_DW1 0x1014
++#define MT_MAC_BSSID_DW1_ADDR GENMASK(15, 0)
++#define MT_MAC_BSSID_DW1_MBSS_MODE GENMASK(17, 16)
++#define MT_MAC_BSSID_DW1_MBEACON_N GENMASK(20, 18)
++#define MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT BIT(21)
++#define MT_MAC_BSSID_DW1_MBSS_MODE_B2 BIT(22)
++#define MT_MAC_BSSID_DW1_MBEACON_N_B3 BIT(23)
++#define MT_MAC_BSSID_DW1_MBSS_IDX_BYTE GENMASK(26, 24)
++
++#define MT_MAX_LEN_CFG 0x1018
++#define MT_MAX_LEN_CFG_AMPDU GENMASK(13, 12)
++
++#define MT_BBP_CSR_CFG 0x101c
++#define MT_BBP_CSR_CFG_VAL GENMASK(7, 0)
++#define MT_BBP_CSR_CFG_REG_NUM GENMASK(15, 8)
++#define MT_BBP_CSR_CFG_READ BIT(16)
++#define MT_BBP_CSR_CFG_BUSY BIT(17)
++#define MT_BBP_CSR_CFG_PAR_DUR BIT(18)
++#define MT_BBP_CSR_CFG_RW_MODE BIT(19)
++
++#define MT_AMPDU_MAX_LEN_20M1S 0x1030
++#define MT_AMPDU_MAX_LEN_20M2S 0x1034
++#define MT_AMPDU_MAX_LEN_40M1S 0x1038
++#define MT_AMPDU_MAX_LEN_40M2S 0x103c
++#define MT_AMPDU_MAX_LEN 0x1040
++
++#define MT_WCID_DROP_BASE 0x106c
++#define MT_WCID_DROP(_n) (MT_WCID_DROP_BASE + ((_n) >> 5) * 4)
++#define MT_WCID_DROP_MASK(_n) BIT((_n) % 32)
++
++#define MT_BCN_BYPASS_MASK 0x108c
++
++#define MT_MAC_APC_BSSID_BASE 0x1090
++#define MT_MAC_APC_BSSID_L(_n) (MT_MAC_APC_BSSID_BASE + ((_n) * 8))
++#define MT_MAC_APC_BSSID_H(_n) (MT_MAC_APC_BSSID_BASE + ((_n) * 8 + 4))
++#define MT_MAC_APC_BSSID_H_ADDR GENMASK(15, 0)
++#define MT_MAC_APC_BSSID0_H_EN BIT(16)
++
++#define MT_XIFS_TIME_CFG 0x1100
++#define MT_XIFS_TIME_CFG_CCK_SIFS GENMASK(7, 0)
++#define MT_XIFS_TIME_CFG_OFDM_SIFS GENMASK(15, 8)
++#define MT_XIFS_TIME_CFG_OFDM_XIFS GENMASK(19, 16)
++#define MT_XIFS_TIME_CFG_EIFS GENMASK(28, 20)
++#define MT_XIFS_TIME_CFG_BB_RXEND_EN BIT(29)
++
++#define MT_BKOFF_SLOT_CFG 0x1104
++#define MT_BKOFF_SLOT_CFG_SLOTTIME GENMASK(7, 0)
++#define MT_BKOFF_SLOT_CFG_CC_DELAY GENMASK(11, 8)
++
++#define MT_BEACON_TIME_CFG 0x1114
++#define MT_BEACON_TIME_CFG_INTVAL GENMASK(15, 0)
++#define MT_BEACON_TIME_CFG_TIMER_EN BIT(16)
++#define MT_BEACON_TIME_CFG_SYNC_MODE GENMASK(18, 17)
++#define MT_BEACON_TIME_CFG_TBTT_EN BIT(19)
++#define MT_BEACON_TIME_CFG_BEACON_TX BIT(20)
++#define MT_BEACON_TIME_CFG_TSF_COMP GENMASK(31, 24)
++
++#define MT_TBTT_SYNC_CFG 0x1118
++#define MT_TBTT_TIMER_CFG 0x1124
++
++#define MT_INT_TIMER_CFG 0x1128
++#define MT_INT_TIMER_CFG_PRE_TBTT GENMASK(15, 0)
++#define MT_INT_TIMER_CFG_GP_TIMER GENMASK(31, 16)
++
++#define MT_INT_TIMER_EN 0x112c
++#define MT_INT_TIMER_EN_PRE_TBTT_EN BIT(0)
++#define MT_INT_TIMER_EN_GP_TIMER_EN BIT(1)
++
++#define MT_MAC_STATUS 0x1200
++#define MT_MAC_STATUS_TX BIT(0)
++#define MT_MAC_STATUS_RX BIT(1)
++
++#define MT_PWR_PIN_CFG 0x1204
++#define MT_AUX_CLK_CFG 0x120c
++
++#define MT_BB_PA_MODE_CFG0 0x1214
++#define MT_BB_PA_MODE_CFG1 0x1218
++#define MT_RF_PA_MODE_CFG0 0x121c
++#define MT_RF_PA_MODE_CFG1 0x1220
++
++#define MT_RF_PA_MODE_ADJ0 0x1228
++#define MT_RF_PA_MODE_ADJ1 0x122c
++
++#define MT_DACCLK_EN_DLY_CFG 0x1264
++
++#define MT_EDCA_CFG_BASE 0x1300
++#define MT_EDCA_CFG_AC(_n) (MT_EDCA_CFG_BASE + ((_n) << 2))
++#define MT_EDCA_CFG_TXOP GENMASK(7, 0)
++#define MT_EDCA_CFG_AIFSN GENMASK(11, 8)
++#define MT_EDCA_CFG_CWMIN GENMASK(15, 12)
++#define MT_EDCA_CFG_CWMAX GENMASK(19, 16)
++
++#define MT_TX_PWR_CFG_0 0x1314
++#define MT_TX_PWR_CFG_1 0x1318
++#define MT_TX_PWR_CFG_2 0x131c
++#define MT_TX_PWR_CFG_3 0x1320
++#define MT_TX_PWR_CFG_4 0x1324
++
++#define MT_TX_BAND_CFG 0x132c
++#define MT_TX_BAND_CFG_UPPER_40M BIT(0)
++#define MT_TX_BAND_CFG_5G BIT(1)
++#define MT_TX_BAND_CFG_2G BIT(2)
++
++#define MT_HT_FBK_TO_LEGACY 0x1384
++#define MT_TX_MPDU_ADJ_INT 0x1388
++
++#define MT_TX_PWR_CFG_7 0x13d4
++#define MT_TX_PWR_CFG_8 0x13d8
++#define MT_TX_PWR_CFG_9 0x13dc
++
++#define MT_TX_SW_CFG0 0x1330
++#define MT_TX_SW_CFG1 0x1334
++#define MT_TX_SW_CFG2 0x1338
++
++#define MT_TXOP_CTRL_CFG 0x1340
++#define MT_TXOP_TRUN_EN GENMASK(5, 0)
++#define MT_TXOP_EXT_CCA_DLY GENMASK(15, 8)
++#define MT_TXOP_CTRL
++
++#define MT_TX_RTS_CFG 0x1344
++#define MT_TX_RTS_CFG_RETRY_LIMIT GENMASK(7, 0)
++#define MT_TX_RTS_CFG_THRESH GENMASK(23, 8)
++#define MT_TX_RTS_FALLBACK BIT(24)
++
++#define MT_TX_TIMEOUT_CFG 0x1348
++#define MT_TX_RETRY_CFG 0x134c
++#define MT_TX_LINK_CFG 0x1350
++#define MT_HT_FBK_CFG0 0x1354
++#define MT_HT_FBK_CFG1 0x1358
++#define MT_LG_FBK_CFG0 0x135c
++#define MT_LG_FBK_CFG1 0x1360
++
++#define MT_CCK_PROT_CFG 0x1364
++#define MT_OFDM_PROT_CFG 0x1368
++#define MT_MM20_PROT_CFG 0x136c
++#define MT_MM40_PROT_CFG 0x1370
++#define MT_GF20_PROT_CFG 0x1374
++#define MT_GF40_PROT_CFG 0x1378
++
++#define MT_PROT_RATE GENMASK(15, 0)
++#define MT_PROT_CTRL_RTS_CTS BIT(16)
++#define MT_PROT_CTRL_CTS2SELF BIT(17)
++#define MT_PROT_NAV_SHORT BIT(18)
++#define MT_PROT_NAV_LONG BIT(19)
++#define MT_PROT_TXOP_ALLOW_CCK BIT(20)
++#define MT_PROT_TXOP_ALLOW_OFDM BIT(21)
++#define MT_PROT_TXOP_ALLOW_MM20 BIT(22)
++#define MT_PROT_TXOP_ALLOW_MM40 BIT(23)
++#define MT_PROT_TXOP_ALLOW_GF20 BIT(24)
++#define MT_PROT_TXOP_ALLOW_GF40 BIT(25)
++#define MT_PROT_RTS_THR_EN BIT(26)
++#define MT_PROT_RATE_CCK_11 0x0003
++#define MT_PROT_RATE_OFDM_6 0x4000
++#define MT_PROT_RATE_OFDM_24 0x4004
++#define MT_PROT_RATE_DUP_OFDM_24 0x4084
++#define MT_PROT_TXOP_ALLOW_ALL GENMASK(25, 20)
++#define MT_PROT_TXOP_ALLOW_BW20 (MT_PROT_TXOP_ALLOW_ALL & \
++ ~MT_PROT_TXOP_ALLOW_MM40 & \
++ ~MT_PROT_TXOP_ALLOW_GF40)
++
++#define MT_EXP_ACK_TIME 0x1380
++
++#define MT_TX_PWR_CFG_0_EXT 0x1390
++#define MT_TX_PWR_CFG_1_EXT 0x1394
++
++#define MT_TX_FBK_LIMIT 0x1398
++#define MT_TX_FBK_LIMIT_MPDU_FBK GENMASK(7, 0)
++#define MT_TX_FBK_LIMIT_AMPDU_FBK GENMASK(15, 8)
++#define MT_TX_FBK_LIMIT_MPDU_UP_CLEAR BIT(16)
++#define MT_TX_FBK_LIMIT_AMPDU_UP_CLEAR BIT(17)
++#define MT_TX_FBK_LIMIT_RATE_LUT BIT(18)
++
++#define MT_TX0_RF_GAIN_CORR 0x13a0
++#define MT_TX1_RF_GAIN_CORR 0x13a4
++#define MT_TX0_RF_GAIN_ATTEN 0x13a8
++
++#define MT_TX_ALC_CFG_0 0x13b0
++#define MT_TX_ALC_CFG_0_CH_INIT_0 GENMASK(5, 0)
++#define MT_TX_ALC_CFG_0_CH_INIT_1 GENMASK(13, 8)
++#define MT_TX_ALC_CFG_0_LIMIT_0 GENMASK(21, 16)
++#define MT_TX_ALC_CFG_0_LIMIT_1 GENMASK(29, 24)
++
++#define MT_TX_ALC_CFG_1 0x13b4
++#define MT_TX_ALC_CFG_1_TEMP_COMP GENMASK(5, 0)
++
++#define MT_TX_ALC_CFG_2 0x13a8
++#define MT_TX_ALC_CFG_2_TEMP_COMP GENMASK(5, 0)
++
++#define MT_TX0_BB_GAIN_ATTEN 0x13c0
++
++#define MT_TX_ALC_VGA3 0x13c8
++
++#define MT_TX_PROT_CFG6 0x13e0
++#define MT_TX_PROT_CFG7 0x13e4
++#define MT_TX_PROT_CFG8 0x13e8
++
++#define MT_PIFS_TX_CFG 0x13ec
++
++#define MT_RX_FILTR_CFG 0x1400
++
++#define MT_RX_FILTR_CFG_CRC_ERR BIT(0)
++#define MT_RX_FILTR_CFG_PHY_ERR BIT(1)
++#define MT_RX_FILTR_CFG_PROMISC BIT(2)
++#define MT_RX_FILTR_CFG_OTHER_BSS BIT(3)
++#define MT_RX_FILTR_CFG_VER_ERR BIT(4)
++#define MT_RX_FILTR_CFG_MCAST BIT(5)
++#define MT_RX_FILTR_CFG_BCAST BIT(6)
++#define MT_RX_FILTR_CFG_DUP BIT(7)
++#define MT_RX_FILTR_CFG_CFACK BIT(8)
++#define MT_RX_FILTR_CFG_CFEND BIT(9)
++#define MT_RX_FILTR_CFG_ACK BIT(10)
++#define MT_RX_FILTR_CFG_CTS BIT(11)
++#define MT_RX_FILTR_CFG_RTS BIT(12)
++#define MT_RX_FILTR_CFG_PSPOLL BIT(13)
++#define MT_RX_FILTR_CFG_BA BIT(14)
++#define MT_RX_FILTR_CFG_BAR BIT(15)
++#define MT_RX_FILTR_CFG_CTRL_RSV BIT(16)
++
++#define MT_AUTO_RSP_CFG 0x1404
++
++#define MT_AUTO_RSP_PREAMB_SHORT BIT(4)
++
++#define MT_LEGACY_BASIC_RATE 0x1408
++#define MT_HT_BASIC_RATE 0x140c
++
++#define MT_RX_PARSER_CFG 0x1418
++#define MT_RX_PARSER_RX_SET_NAV_ALL BIT(0)
++
++#define MT_EXT_CCA_CFG 0x141c
++#define MT_EXT_CCA_CFG_CCA0 GENMASK(1, 0)
++#define MT_EXT_CCA_CFG_CCA1 GENMASK(3, 2)
++#define MT_EXT_CCA_CFG_CCA2 GENMASK(5, 4)
++#define MT_EXT_CCA_CFG_CCA3 GENMASK(7, 6)
++#define MT_EXT_CCA_CFG_CCA_MASK GENMASK(11, 8)
++#define MT_EXT_CCA_CFG_ED_CCA_MASK GENMASK(15, 12)
++
++#define MT_TX_SW_CFG3 0x1478
++
++#define MT_PN_PAD_MODE 0x150c
++
++#define MT_TXOP_HLDR_ET 0x1608
++
++#define MT_PROT_AUTO_TX_CFG 0x1648
++
++#define MT_RX_STA_CNT0 0x1700
++#define MT_RX_STA_CNT1 0x1704
++#define MT_RX_STA_CNT2 0x1708
++#define MT_TX_STA_CNT0 0x170c
++#define MT_TX_STA_CNT1 0x1710
++#define MT_TX_STA_CNT2 0x1714
++
++/* Vendor driver defines content of the second word of STAT_FIFO as follows:
++ * MT_TX_STAT_FIFO_RATE GENMASK(26, 16)
++ * MT_TX_STAT_FIFO_ETXBF BIT(27)
++ * MT_TX_STAT_FIFO_SND BIT(28)
++ * MT_TX_STAT_FIFO_ITXBF BIT(29)
++ * However, tests show that b16-31 have the same layout as TXWI rate_ctl
++ * with rate set to rate at which frame was acked.
++ */
++#define MT_TX_STAT_FIFO 0x1718
++#define MT_TX_STAT_FIFO_VALID BIT(0)
++#define MT_TX_STAT_FIFO_PID_TYPE GENMASK(4, 1)
++#define MT_TX_STAT_FIFO_SUCCESS BIT(5)
++#define MT_TX_STAT_FIFO_AGGR BIT(6)
++#define MT_TX_STAT_FIFO_ACKREQ BIT(7)
++#define MT_TX_STAT_FIFO_WCID GENMASK(15, 8)
++#define MT_TX_STAT_FIFO_RATE GENMASK(31, 16)
++
++#define MT_TX_AGG_STAT 0x171c
++
++#define MT_TX_AGG_CNT_BASE0 0x1720
++
++#define MT_MPDU_DENSITY_CNT 0x1740
++
++#define MT_TX_AGG_CNT_BASE1 0x174c
++
++#define MT_TX_AGG_CNT(_id) ((_id) < 8 ? \
++ MT_TX_AGG_CNT_BASE0 + ((_id) << 2) : \
++ MT_TX_AGG_CNT_BASE1 + ((_id - 8) << 2))
++
++#define MT_TX_STAT_FIFO_EXT 0x1798
++#define MT_TX_STAT_FIFO_EXT_RETRY GENMASK(7, 0)
++
++#define MT_BBP_CORE_BASE 0x2000
++#define MT_BBP_IBI_BASE 0x2100
++#define MT_BBP_AGC_BASE 0x2300
++#define MT_BBP_TXC_BASE 0x2400
++#define MT_BBP_RXC_BASE 0x2500
++#define MT_BBP_TXO_BASE 0x2600
++#define MT_BBP_TXBE_BASE 0x2700
++#define MT_BBP_RXFE_BASE 0x2800
++#define MT_BBP_RXO_BASE 0x2900
++#define MT_BBP_DFS_BASE 0x2a00
++#define MT_BBP_TR_BASE 0x2b00
++#define MT_BBP_CAL_BASE 0x2c00
++#define MT_BBP_DSC_BASE 0x2e00
++#define MT_BBP_PFMU_BASE 0x2f00
++
++#define MT_BBP(_type, _n) (MT_BBP_##_type##_BASE + ((_n) << 2))
++
++#define MT_BBP_CORE_R1_BW GENMASK(4, 3)
++
++#define MT_BBP_AGC_R0_CTRL_CHAN GENMASK(9, 8)
++#define MT_BBP_AGC_R0_BW GENMASK(14, 12)
++
++/* AGC, R4/R5 */
++#define MT_BBP_AGC_LNA_GAIN GENMASK(21, 16)
++
++/* AGC, R8/R9 */
++#define MT_BBP_AGC_GAIN GENMASK(14, 8)
++
++#define MT_BBP_AGC20_RSSI0 GENMASK(7, 0)
++#define MT_BBP_AGC20_RSSI1 GENMASK(15, 8)
++
++#define MT_BBP_TXBE_R0_CTRL_CHAN GENMASK(1, 0)
++
++#define MT_WCID_ADDR_BASE 0x1800
++#define MT_WCID_ADDR(_n) (MT_WCID_ADDR_BASE + (_n) * 8)
++
++#define MT_SRAM_BASE 0x4000
++
++#define MT_WCID_KEY_BASE 0x8000
++#define MT_WCID_KEY(_n) (MT_WCID_KEY_BASE + (_n) * 32)
++
++#define MT_WCID_IV_BASE 0xa000
++#define MT_WCID_IV(_n) (MT_WCID_IV_BASE + (_n) * 8)
++
++#define MT_WCID_ATTR_BASE 0xa800
++#define MT_WCID_ATTR(_n) (MT_WCID_ATTR_BASE + (_n) * 4)
++
++#define MT_WCID_ATTR_PAIRWISE BIT(0)
++#define MT_WCID_ATTR_PKEY_MODE GENMASK(3, 1)
++#define MT_WCID_ATTR_BSS_IDX GENMASK(6, 4)
++#define MT_WCID_ATTR_RXWI_UDF GENMASK(9, 7)
++#define MT_WCID_ATTR_PKEY_MODE_EXT BIT(10)
++#define MT_WCID_ATTR_BSS_IDX_EXT BIT(11)
++#define MT_WCID_ATTR_WAPI_MCBC BIT(15)
++#define MT_WCID_ATTR_WAPI_KEYID GENMASK(31, 24)
++
++#define MT_SKEY_BASE_0 0xac00
++#define MT_SKEY_BASE_1 0xb400
++#define MT_SKEY_0(_bss, _idx) \
++ (MT_SKEY_BASE_0 + (4 * (_bss) + _idx) * 32)
++#define MT_SKEY_1(_bss, _idx) \
++ (MT_SKEY_BASE_1 + (4 * ((_bss) & 7) + _idx) * 32)
++#define MT_SKEY(_bss, _idx) \
++ ((_bss & 8) ? MT_SKEY_1(_bss, _idx) : MT_SKEY_0(_bss, _idx))
++
++#define MT_SKEY_MODE_BASE_0 0xb000
++#define MT_SKEY_MODE_BASE_1 0xb3f0
++#define MT_SKEY_MODE_0(_bss) \
++ (MT_SKEY_MODE_BASE_0 + ((_bss / 2) << 2))
++#define MT_SKEY_MODE_1(_bss) \
++ (MT_SKEY_MODE_BASE_1 + ((((_bss) & 7) / 2) << 2))
++#define MT_SKEY_MODE(_bss) \
++ ((_bss & 8) ? MT_SKEY_MODE_1(_bss) : MT_SKEY_MODE_0(_bss))
++#define MT_SKEY_MODE_MASK GENMASK(3, 0)
++#define MT_SKEY_MODE_SHIFT(_bss, _idx) (4 * ((_idx) + 4 * (_bss & 1)))
++
++#define MT_BEACON_BASE 0xc000
++
++#define MT_TEMP_SENSOR 0x1d000
++#define MT_TEMP_SENSOR_VAL GENMASK(6, 0)
++
++enum mt76_cipher_type {
++ MT_CIPHER_NONE,
++ MT_CIPHER_WEP40,
++ MT_CIPHER_WEP104,
++ MT_CIPHER_TKIP,
++ MT_CIPHER_AES_CCMP,
++ MT_CIPHER_CKIP40,
++ MT_CIPHER_CKIP104,
++ MT_CIPHER_CKIP128,
++ MT_CIPHER_WAPI,
++};
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/trace.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/trace.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/trace.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/trace.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,21 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include <linux/module.h>
++
++#ifndef __CHECKER__
++#define CREATE_TRACE_POINTS
++#include "trace.h"
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/trace.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/trace.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/trace.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/trace.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,400 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#if !defined(__MT7601U_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
++#define __MT7601U_TRACE_H
++
++#include <linux/tracepoint.h>
++#include "mt7601u.h"
++#include "mac.h"
++
++#undef TRACE_SYSTEM
++#define TRACE_SYSTEM mt7601u
++
++#define MAXNAME 32
++#define DEV_ENTRY __array(char, wiphy_name, 32)
++#define DEV_ASSIGN strlcpy(__entry->wiphy_name, \
++ wiphy_name(dev->hw->wiphy), MAXNAME)
++#define DEV_PR_FMT "%s "
++#define DEV_PR_ARG __entry->wiphy_name
++
++#define REG_ENTRY __field(u32, reg) __field(u32, val)
++#define REG_ASSIGN __entry->reg = reg; __entry->val = val
++#define REG_PR_FMT "%04x=%08x"
++#define REG_PR_ARG __entry->reg, __entry->val
++
++DECLARE_EVENT_CLASS(dev_reg_evt,
++ TP_PROTO(struct mt7601u_dev *dev, u32 reg, u32 val),
++ TP_ARGS(dev, reg, val),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ REG_ENTRY
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ REG_ASSIGN;
++ ),
++ TP_printk(
++ DEV_PR_FMT REG_PR_FMT,
++ DEV_PR_ARG, REG_PR_ARG
++ )
++);
++
++DEFINE_EVENT(dev_reg_evt, reg_read,
++ TP_PROTO(struct mt7601u_dev *dev, u32 reg, u32 val),
++ TP_ARGS(dev, reg, val)
++);
++
++DEFINE_EVENT(dev_reg_evt, reg_write,
++ TP_PROTO(struct mt7601u_dev *dev, u32 reg, u32 val),
++ TP_ARGS(dev, reg, val)
++);
++
++TRACE_EVENT(mt_submit_urb,
++ TP_PROTO(struct mt7601u_dev *dev, struct urb *u),
++ TP_ARGS(dev, u),
++ TP_STRUCT__entry(
++ DEV_ENTRY __field(unsigned, pipe) __field(u32, len)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->pipe = u->pipe;
++ __entry->len = u->transfer_buffer_length;
++ ),
++ TP_printk(DEV_PR_FMT "p:%08x len:%u",
++ DEV_PR_ARG, __entry->pipe, __entry->len)
++);
++
++#define trace_mt_submit_urb_sync(__dev, __pipe, __len) ({ \
++ struct urb u; \
++ u.pipe = __pipe; \
++ u.transfer_buffer_length = __len; \
++ trace_mt_submit_urb(__dev, &u); \
++})
++
++TRACE_EVENT(mt_mcu_msg_send,
++ TP_PROTO(struct mt7601u_dev *dev,
++ struct sk_buff *skb, u32 csum, bool resp),
++ TP_ARGS(dev, skb, csum, resp),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u32, info)
++ __field(u32, csum)
++ __field(bool, resp)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->info = *(u32 *)skb->data;
++ __entry->csum = csum;
++ __entry->resp = resp;
++ ),
++ TP_printk(DEV_PR_FMT "i:%08x c:%08x r:%d",
++ DEV_PR_ARG, __entry->info, __entry->csum, __entry->resp)
++);
++
++TRACE_EVENT(mt_vend_req,
++ TP_PROTO(struct mt7601u_dev *dev, unsigned pipe, u8 req, u8 req_type,
++ u16 val, u16 offset, void *buf, size_t buflen, int ret),
++ TP_ARGS(dev, pipe, req, req_type, val, offset, buf, buflen, ret),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(unsigned, pipe) __field(u8, req) __field(u8, req_type)
++ __field(u16, val) __field(u16, offset) __field(void*, buf)
++ __field(int, buflen) __field(int, ret)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->pipe = pipe;
++ __entry->req = req;
++ __entry->req_type = req_type;
++ __entry->val = val;
++ __entry->offset = offset;
++ __entry->buf = buf;
++ __entry->buflen = buflen;
++ __entry->ret = ret;
++ ),
++ TP_printk(DEV_PR_FMT
++ "%d p:%08x req:%02hhx %02hhx val:%04hx %04hx buf:%d %d",
++ DEV_PR_ARG, __entry->ret, __entry->pipe, __entry->req,
++ __entry->req_type, __entry->val, __entry->offset,
++ !!__entry->buf, __entry->buflen)
++);
++
++TRACE_EVENT(ee_read,
++ TP_PROTO(struct mt7601u_dev *dev, int offset, u16 val),
++ TP_ARGS(dev, offset, val),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(int, o) __field(u16, v)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->o = offset;
++ __entry->v = val;
++ ),
++ TP_printk(DEV_PR_FMT "%04x=%04x", DEV_PR_ARG, __entry->o, __entry->v)
++);
++
++DECLARE_EVENT_CLASS(dev_rf_reg_evt,
++ TP_PROTO(struct mt7601u_dev *dev, u8 bank, u8 reg, u8 val),
++ TP_ARGS(dev, bank, reg, val),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u8, bank)
++ __field(u8, reg)
++ __field(u8, val)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ REG_ASSIGN;
++ __entry->bank = bank;
++ ),
++ TP_printk(
++ DEV_PR_FMT "%02hhx:%02hhx=%02hhx",
++ DEV_PR_ARG, __entry->bank, __entry->reg, __entry->val
++ )
++);
++
++DEFINE_EVENT(dev_rf_reg_evt, rf_read,
++ TP_PROTO(struct mt7601u_dev *dev, u8 bank, u8 reg, u8 val),
++ TP_ARGS(dev, bank, reg, val)
++);
++
++DEFINE_EVENT(dev_rf_reg_evt, rf_write,
++ TP_PROTO(struct mt7601u_dev *dev, u8 bank, u8 reg, u8 val),
++ TP_ARGS(dev, bank, reg, val)
++);
++
++DECLARE_EVENT_CLASS(dev_bbp_reg_evt,
++ TP_PROTO(struct mt7601u_dev *dev, u8 reg, u8 val),
++ TP_ARGS(dev, reg, val),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u8, reg)
++ __field(u8, val)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ REG_ASSIGN;
++ ),
++ TP_printk(
++ DEV_PR_FMT "%02hhx=%02hhx",
++ DEV_PR_ARG, __entry->reg, __entry->val
++ )
++);
++
++DEFINE_EVENT(dev_bbp_reg_evt, bbp_read,
++ TP_PROTO(struct mt7601u_dev *dev, u8 reg, u8 val),
++ TP_ARGS(dev, reg, val)
++);
++
++DEFINE_EVENT(dev_bbp_reg_evt, bbp_write,
++ TP_PROTO(struct mt7601u_dev *dev, u8 reg, u8 val),
++ TP_ARGS(dev, reg, val)
++);
++
++DECLARE_EVENT_CLASS(dev_simple_evt,
++ TP_PROTO(struct mt7601u_dev *dev, u8 val),
++ TP_ARGS(dev, val),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u8, val)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->val = val;
++ ),
++ TP_printk(
++ DEV_PR_FMT "%02hhx", DEV_PR_ARG, __entry->val
++ )
++);
++
++DEFINE_EVENT(dev_simple_evt, temp_mode,
++ TP_PROTO(struct mt7601u_dev *dev, u8 val),
++ TP_ARGS(dev, val)
++);
++
++DEFINE_EVENT(dev_simple_evt, read_temp,
++ TP_PROTO(struct mt7601u_dev *dev, u8 val),
++ TP_ARGS(dev, val)
++);
++
++DEFINE_EVENT(dev_simple_evt, freq_cal_adjust,
++ TP_PROTO(struct mt7601u_dev *dev, u8 val),
++ TP_ARGS(dev, val)
++);
++
++TRACE_EVENT(freq_cal_offset,
++ TP_PROTO(struct mt7601u_dev *dev, u8 phy_mode, s8 freq_off),
++ TP_ARGS(dev, phy_mode, freq_off),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u8, phy_mode)
++ __field(s8, freq_off)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->phy_mode = phy_mode;
++ __entry->freq_off = freq_off;
++ ),
++ TP_printk(DEV_PR_FMT "phy:%02hhx off:%02hhx",
++ DEV_PR_ARG, __entry->phy_mode, __entry->freq_off)
++);
++
++TRACE_EVENT(mt_rx,
++ TP_PROTO(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi, u32 f),
++ TP_ARGS(dev, rxwi, f),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field_struct(struct mt7601u_rxwi, rxwi)
++ __field(u32, fce_info)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->rxwi = *rxwi;
++ __entry->fce_info = f;
++ ),
++ TP_printk(DEV_PR_FMT "rxi:%08x ctl:%08x frag_sn:%04hx rate:%04hx "
++ "uknw:%02hhx z:%02hhx%02hhx%02hhx snr:%02hhx "
++ "ant:%02hhx gain:%02hhx freq_o:%02hhx "
++ "r:%08x ea:%08x fce:%08x", DEV_PR_ARG,
++ le32_to_cpu(__entry->rxwi.rxinfo),
++ le32_to_cpu(__entry->rxwi.ctl),
++ le16_to_cpu(__entry->rxwi.frag_sn),
++ le16_to_cpu(__entry->rxwi.rate),
++ __entry->rxwi.unknown,
++ __entry->rxwi.zero[0], __entry->rxwi.zero[1],
++ __entry->rxwi.zero[2],
++ __entry->rxwi.snr, __entry->rxwi.ant,
++ __entry->rxwi.gain, __entry->rxwi.freq_off,
++ __entry->rxwi.resv2, __entry->rxwi.expert_ant,
++ __entry->fce_info)
++);
++
++TRACE_EVENT(mt_tx,
++ TP_PROTO(struct mt7601u_dev *dev, struct sk_buff *skb,
++ struct mt76_sta *sta, struct mt76_txwi *h),
++ TP_ARGS(dev, skb, sta, h),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field_struct(struct mt76_txwi, h)
++ __field(struct sk_buff *, skb)
++ __field(struct mt76_sta *, sta)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->h = *h;
++ __entry->skb = skb;
++ __entry->sta = sta;
++ ),
++ TP_printk(DEV_PR_FMT "skb:%p sta:%p flg:%04hx rate_ctl:%04hx "
++ "ack:%02hhx wcid:%02hhx len_ctl:%05hx", DEV_PR_ARG,
++ __entry->skb, __entry->sta,
++ le16_to_cpu(__entry->h.flags),
++ le16_to_cpu(__entry->h.rate_ctl),
++ __entry->h.ack_ctl, __entry->h.wcid,
++ le16_to_cpu(__entry->h.len_ctl))
++);
++
++TRACE_EVENT(mt_tx_dma_done,
++ TP_PROTO(struct mt7601u_dev *dev, struct sk_buff *skb),
++ TP_ARGS(dev, skb),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(struct sk_buff *, skb)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->skb = skb;
++ ),
++ TP_printk(DEV_PR_FMT "%p", DEV_PR_ARG, __entry->skb)
++);
++
++TRACE_EVENT(mt_tx_status_cleaned,
++ TP_PROTO(struct mt7601u_dev *dev, int cleaned),
++ TP_ARGS(dev, cleaned),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(int, cleaned)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->cleaned = cleaned;
++ ),
++ TP_printk(DEV_PR_FMT "%d", DEV_PR_ARG, __entry->cleaned)
++);
++
++TRACE_EVENT(mt_tx_status,
++ TP_PROTO(struct mt7601u_dev *dev, u32 stat1, u32 stat2),
++ TP_ARGS(dev, stat1, stat2),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u32, stat1) __field(u32, stat2)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->stat1 = stat1;
++ __entry->stat2 = stat2;
++ ),
++ TP_printk(DEV_PR_FMT "%08x %08x",
++ DEV_PR_ARG, __entry->stat1, __entry->stat2)
++);
++
++TRACE_EVENT(mt_rx_dma_aggr,
++ TP_PROTO(struct mt7601u_dev *dev, int cnt, bool paged),
++ TP_ARGS(dev, cnt, paged),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u8, cnt)
++ __field(bool, paged)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->cnt = cnt;
++ __entry->paged = paged;
++ ),
++ TP_printk(DEV_PR_FMT "cnt:%d paged:%d",
++ DEV_PR_ARG, __entry->cnt, __entry->paged)
++);
++
++DEFINE_EVENT(dev_simple_evt, set_key,
++ TP_PROTO(struct mt7601u_dev *dev, u8 val),
++ TP_ARGS(dev, val)
++);
++
++TRACE_EVENT(set_shared_key,
++ TP_PROTO(struct mt7601u_dev *dev, u8 vid, u8 key),
++ TP_ARGS(dev, vid, key),
++ TP_STRUCT__entry(
++ DEV_ENTRY
++ __field(u8, vid)
++ __field(u8, key)
++ ),
++ TP_fast_assign(
++ DEV_ASSIGN;
++ __entry->vid = vid;
++ __entry->key = key;
++ ),
++ TP_printk(DEV_PR_FMT "phy:%02hhx off:%02hhx",
++ DEV_PR_ARG, __entry->vid, __entry->key)
++);
++
++#endif
++
++#undef TRACE_INCLUDE_PATH
++#define TRACE_INCLUDE_PATH .
++#undef TRACE_INCLUDE_FILE
++#define TRACE_INCLUDE_FILE trace
++
++#include <trace/define_trace.h>
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/tx.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/tx.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/tx.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/tx.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,319 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++#include "trace.h"
++
++enum mt76_txq_id {
++ MT_TXQ_VO = IEEE80211_AC_VO,
++ MT_TXQ_VI = IEEE80211_AC_VI,
++ MT_TXQ_BE = IEEE80211_AC_BE,
++ MT_TXQ_BK = IEEE80211_AC_BK,
++ MT_TXQ_PSD,
++ MT_TXQ_MCU,
++ __MT_TXQ_MAX
++};
++
++/* Hardware uses mirrored order of queues with Q0 having the highest priority */
++static u8 q2hwq(u8 q)
++{
++ return q ^ 0x3;
++}
++
++/* Take mac80211 Q id from the skb and translate it to hardware Q id */
++static u8 skb2q(struct sk_buff *skb)
++{
++ int qid = skb_get_queue_mapping(skb);
++
++ if (WARN_ON(qid >= MT_TXQ_PSD)) {
++ qid = MT_TXQ_BE;
++ skb_set_queue_mapping(skb, qid);
++ }
++
++ return q2hwq(qid);
++}
++
++/* Note: TX retry reporting is a bit broken.
++ * Retries are reported only once per AMPDU and often come a frame early
++ * i.e. they are reported in the last status preceding the AMPDU. Apart
++ * from the fact that it's hard to know the length of the AMPDU (which is
++ * required to know to how many consecutive frames retries should be
++ * applied), if status comes early on full FIFO it gets lost and retries
++ * of the whole AMPDU become invisible.
++ * As a work-around encode the desired rate in PKT_ID of TX descriptor
++ * and based on that guess the retries (every rate is tried once).
++ * Only downside here is that for MCS0 we have to rely solely on
++ * transmission failures as no retries can ever be reported.
++ * Not having to read EXT_FIFO has a nice effect of doubling the number
++ * of reports which can be fetched.
++ * Also the vendor driver never uses the EXT_FIFO register so it may be
++ * undertested.
++ */
++static u8 mt7601u_tx_pktid_enc(struct mt7601u_dev *dev, u8 rate, bool is_probe)
++{
++ u8 encoded = (rate + 1) + is_probe * 8;
++
++ /* Because PKT_ID 0 disables status reporting only 15 values are
++ * available but 16 are needed (8 MCS * 2 for encoding is_probe)
++ * - we need to cram together two rates. MCS0 and MCS7 with is_probe
++ * share PKT_ID 9.
++ */
++ if (is_probe && rate == 7)
++ return encoded - 7;
++
++ return encoded;
++}
++
++static void
++mt7601u_tx_pktid_dec(struct mt7601u_dev *dev, struct mt76_tx_status *stat)
++{
++ u8 req_rate = stat->pktid;
++ u8 eff_rate = stat->rate & 0x7;
++
++ req_rate -= 1;
++
++ if (req_rate > 7) {
++ stat->is_probe = true;
++ req_rate -= 8;
++
++ /* Decide between MCS0 and MCS7 which share pktid 9 */
++ if (!req_rate && eff_rate)
++ req_rate = 7;
++ }
++
++ stat->retry = req_rate - eff_rate;
++}
++
++static void mt7601u_tx_skb_remove_dma_overhead(struct sk_buff *skb,
++ struct ieee80211_tx_info *info)
++{
++ int pkt_len = (unsigned long)info->status.status_driver_data[0];
++
++ skb_pull(skb, sizeof(struct mt76_txwi) + 4);
++ if (ieee80211_get_hdrlen_from_skb(skb) % 4)
++ mt76_remove_hdr_pad(skb);
++
++ skb_trim(skb, pkt_len);
++}
++
++void mt7601u_tx_status(struct mt7601u_dev *dev, struct sk_buff *skb)
++{
++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++
++ mt7601u_tx_skb_remove_dma_overhead(skb, info);
++
++ ieee80211_tx_info_clear_status(info);
++ info->status.rates[0].idx = -1;
++ info->flags |= IEEE80211_TX_STAT_ACK;
++ ieee80211_tx_status(dev->hw, skb);
++}
++
++static int mt7601u_skb_rooms(struct mt7601u_dev *dev, struct sk_buff *skb)
++{
++ int hdr_len = ieee80211_get_hdrlen_from_skb(skb);
++ u32 need_head;
++
++ need_head = sizeof(struct mt76_txwi) + 4;
++ if (hdr_len % 4)
++ need_head += 2;
++
++ return skb_cow(skb, need_head);
++}
++
++static struct mt76_txwi *
++mt7601u_push_txwi(struct mt7601u_dev *dev, struct sk_buff *skb,
++ struct ieee80211_sta *sta, struct mt76_wcid *wcid,
++ int pkt_len)
++{
++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++ struct ieee80211_tx_rate *rate = &info->control.rates[0];
++ struct mt76_txwi *txwi;
++ unsigned long flags;
++ bool is_probe;
++ u32 pkt_id;
++ u16 rate_ctl;
++ u8 nss;
++
++ txwi = (struct mt76_txwi *)skb_push(skb, sizeof(struct mt76_txwi));
++ memset(txwi, 0, sizeof(*txwi));
++
++ if (!wcid->tx_rate_set)
++ ieee80211_get_tx_rates(info->control.vif, sta, skb,
++ info->control.rates, 1);
++
++ spin_lock_irqsave(&dev->lock, flags);
++ if (rate->idx < 0 || !rate->count)
++ rate_ctl = wcid->tx_rate;
++ else
++ rate_ctl = mt76_mac_tx_rate_val(dev, rate, &nss);
++ spin_unlock_irqrestore(&dev->lock, flags);
++ txwi->rate_ctl = cpu_to_le16(rate_ctl);
++
++ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
++ txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ;
++ if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
++ txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ;
++
++ if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) {
++ u8 ba_size = IEEE80211_MIN_AMPDU_BUF;
++
++ ba_size <<= sta->ht_cap.ampdu_factor;
++ ba_size = min_t(int, 63, ba_size);
++ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
++ ba_size = 0;
++ txwi->ack_ctl |= MT76_SET(MT_TXWI_ACK_CTL_BA_WINDOW, ba_size);
++
++ txwi->flags = cpu_to_le16(MT_TXWI_FLAGS_AMPDU |
++ MT76_SET(MT_TXWI_FLAGS_MPDU_DENSITY,
++ sta->ht_cap.ampdu_density));
++ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
++ txwi->flags = 0;
++ }
++
++ txwi->wcid = wcid->idx;
++
++ is_probe = !!(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
++ pkt_id = mt7601u_tx_pktid_enc(dev, rate_ctl & 0x7, is_probe);
++ pkt_len |= MT76_SET(MT_TXWI_LEN_PKTID, pkt_id);
++ txwi->len_ctl = cpu_to_le16(pkt_len);
++
++ return txwi;
++}
++
++void mt7601u_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
++ struct sk_buff *skb)
++{
++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++ struct mt7601u_dev *dev = hw->priv;
++ struct ieee80211_vif *vif = info->control.vif;
++ struct ieee80211_sta *sta = control->sta;
++ struct mt76_sta *msta = NULL;
++ struct mt76_wcid *wcid = dev->mon_wcid;
++ struct mt76_txwi *txwi;
++ int pkt_len = skb->len;
++ int hw_q = skb2q(skb);
++
++ BUILD_BUG_ON(ARRAY_SIZE(info->status.status_driver_data) < 1);
++ info->status.status_driver_data[0] = (void *)(unsigned long)pkt_len;
++
++ if (mt7601u_skb_rooms(dev, skb) || mt76_insert_hdr_pad(skb)) {
++ ieee80211_free_txskb(dev->hw, skb);
++ return;
++ }
++
++ if (sta) {
++ msta = (struct mt76_sta *) sta->drv_priv;
++ wcid = &msta->wcid;
++ } else if (vif) {
++ struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
++
++ wcid = &mvif->group_wcid;
++ }
++
++ txwi = mt7601u_push_txwi(dev, skb, sta, wcid, pkt_len);
++
++ if (mt7601u_dma_enqueue_tx(dev, skb, wcid, hw_q))
++ return;
++
++ trace_mt_tx(dev, skb, msta, txwi);
++}
++
++void mt7601u_tx_stat(struct work_struct *work)
++{
++ struct mt7601u_dev *dev = container_of(work, struct mt7601u_dev,
++ stat_work.work);
++ struct mt76_tx_status stat;
++ unsigned long flags;
++ int cleaned = 0;
++
++ while (!test_bit(MT7601U_STATE_REMOVED, &dev->state)) {
++ stat = mt7601u_mac_fetch_tx_status(dev);
++ if (!stat.valid)
++ break;
++
++ mt7601u_tx_pktid_dec(dev, &stat);
++ mt76_send_tx_status(dev, &stat);
++
++ cleaned++;
++ }
++ trace_mt_tx_status_cleaned(dev, cleaned);
++
++ spin_lock_irqsave(&dev->tx_lock, flags);
++ if (cleaned)
++ queue_delayed_work(dev->stat_wq, &dev->stat_work,
++ msecs_to_jiffies(10));
++ else if (test_and_clear_bit(MT7601U_STATE_MORE_STATS, &dev->state))
++ queue_delayed_work(dev->stat_wq, &dev->stat_work,
++ msecs_to_jiffies(20));
++ else
++ clear_bit(MT7601U_STATE_READING_STATS, &dev->state);
++ spin_unlock_irqrestore(&dev->tx_lock, flags);
++}
++
++int mt7601u_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ u16 queue, const struct ieee80211_tx_queue_params *params)
++{
++ struct mt7601u_dev *dev = hw->priv;
++ u8 cw_min = 5, cw_max = 10, hw_q = q2hwq(queue);
++ u32 val;
++
++ /* TODO: should we do funny things with the parameters?
++ * See what mt7601u_set_default_edca() used to do in init.c.
++ */
++
++ if (params->cw_min)
++ cw_min = fls(params->cw_min);
++ if (params->cw_max)
++ cw_max = fls(params->cw_max);
++
++ WARN_ON(params->txop > 0xff);
++ WARN_ON(params->aifs > 0xf);
++ WARN_ON(cw_min > 0xf);
++ WARN_ON(cw_max > 0xf);
++
++ val = MT76_SET(MT_EDCA_CFG_AIFSN, params->aifs) |
++ MT76_SET(MT_EDCA_CFG_CWMIN, cw_min) |
++ MT76_SET(MT_EDCA_CFG_CWMAX, cw_max);
++ /* TODO: based on user-controlled EnableTxBurst var vendor drv sets
++ * a really long txop on AC0 (see connect.c:2009) but only on
++ * connect? When not connected should be 0.
++ */
++ if (!hw_q)
++ val |= 0x60;
++ else
++ val |= MT76_SET(MT_EDCA_CFG_TXOP, params->txop);
++ mt76_wr(dev, MT_EDCA_CFG_AC(hw_q), val);
++
++ val = mt76_rr(dev, MT_WMM_TXOP(hw_q));
++ val &= ~(MT_WMM_TXOP_MASK << MT_WMM_TXOP_SHIFT(hw_q));
++ val |= params->txop << MT_WMM_TXOP_SHIFT(hw_q);
++ mt76_wr(dev, MT_WMM_TXOP(hw_q), val);
++
++ val = mt76_rr(dev, MT_WMM_AIFSN);
++ val &= ~(MT_WMM_AIFSN_MASK << MT_WMM_AIFSN_SHIFT(hw_q));
++ val |= params->aifs << MT_WMM_AIFSN_SHIFT(hw_q);
++ mt76_wr(dev, MT_WMM_AIFSN, val);
++
++ val = mt76_rr(dev, MT_WMM_CWMIN);
++ val &= ~(MT_WMM_CWMIN_MASK << MT_WMM_CWMIN_SHIFT(hw_q));
++ val |= cw_min << MT_WMM_CWMIN_SHIFT(hw_q);
++ mt76_wr(dev, MT_WMM_CWMIN, val);
++
++ val = mt76_rr(dev, MT_WMM_CWMAX);
++ val &= ~(MT_WMM_CWMAX_MASK << MT_WMM_CWMAX_SHIFT(hw_q));
++ val |= cw_max << MT_WMM_CWMAX_SHIFT(hw_q);
++ mt76_wr(dev, MT_WMM_CWMAX, val);
++
++ return 0;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/usb.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/usb.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/usb.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/usb.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,367 @@
++/*
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/usb.h>
++
++#include "mt7601u.h"
++#include "usb.h"
++#include "trace.h"
++
++static struct usb_device_id mt7601u_device_table[] = {
++ { USB_DEVICE(0x0b05, 0x17d3) },
++ { USB_DEVICE(0x0e8d, 0x760a) },
++ { USB_DEVICE(0x0e8d, 0x760b) },
++ { USB_DEVICE(0x13d3, 0x3431) },
++ { USB_DEVICE(0x13d3, 0x3434) },
++ { USB_DEVICE(0x148f, 0x7601) },
++ { USB_DEVICE(0x148f, 0x760a) },
++ { USB_DEVICE(0x148f, 0x760b) },
++ { USB_DEVICE(0x148f, 0x760c) },
++ { USB_DEVICE(0x148f, 0x760d) },
++ { USB_DEVICE(0x2001, 0x3d04) },
++ { USB_DEVICE(0x2717, 0x4106) },
++ { USB_DEVICE(0x2955, 0x0001) },
++ { USB_DEVICE(0x2955, 0x1001) },
++ { USB_DEVICE(0x2a5f, 0x1000) },
++ { USB_DEVICE(0x7392, 0x7710) },
++ { 0, }
++};
++
++bool mt7601u_usb_alloc_buf(struct mt7601u_dev *dev, size_t len,
++ struct mt7601u_dma_buf *buf)
++{
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++
++ buf->len = len;
++ buf->urb = usb_alloc_urb(0, GFP_KERNEL);
++ buf->buf = usb_alloc_coherent(usb_dev, buf->len, GFP_KERNEL, &buf->dma);
++
++ return !buf->urb || !buf->buf;
++}
++
++void mt7601u_usb_free_buf(struct mt7601u_dev *dev, struct mt7601u_dma_buf *buf)
++{
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++
++ usb_free_coherent(usb_dev, buf->len, buf->buf, buf->dma);
++ usb_free_urb(buf->urb);
++}
++
++int mt7601u_usb_submit_buf(struct mt7601u_dev *dev, int dir, int ep_idx,
++ struct mt7601u_dma_buf *buf, gfp_t gfp,
++ usb_complete_t complete_fn, void *context)
++{
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++ unsigned pipe;
++ int ret;
++
++ if (dir == USB_DIR_IN)
++ pipe = usb_rcvbulkpipe(usb_dev, dev->in_eps[ep_idx]);
++ else
++ pipe = usb_sndbulkpipe(usb_dev, dev->out_eps[ep_idx]);
++
++ usb_fill_bulk_urb(buf->urb, usb_dev, pipe, buf->buf, buf->len,
++ complete_fn, context);
++ buf->urb->transfer_dma = buf->dma;
++ buf->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
++
++ trace_mt_submit_urb(dev, buf->urb);
++ ret = usb_submit_urb(buf->urb, gfp);
++ if (ret)
++ dev_err(dev->dev, "Error: submit URB dir:%d ep:%d failed:%d\n",
++ dir, ep_idx, ret);
++ return ret;
++}
++
++void mt7601u_complete_urb(struct urb *urb)
++{
++ struct completion *cmpl = urb->context;
++
++ complete(cmpl);
++}
++
++static int
++__mt7601u_vendor_request(struct mt7601u_dev *dev, const u8 req,
++ const u8 direction, const u16 val, const u16 offset,
++ void *buf, const size_t buflen)
++{
++ int i, ret;
++ struct usb_device *usb_dev = mt7601u_to_usb_dev(dev);
++ const u8 req_type = direction | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
++ const unsigned int pipe = (direction == USB_DIR_IN) ?
++ usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0);
++
++ for (i = 0; i < MT_VEND_REQ_MAX_RETRY; i++) {
++ ret = usb_control_msg(usb_dev, pipe, req, req_type,
++ val, offset, buf, buflen,
++ MT_VEND_REQ_TOUT_MS);
++ trace_mt_vend_req(dev, pipe, req, req_type, val, offset,
++ buf, buflen, ret);
++
++ if (ret >= 0 || ret == -ENODEV)
++ return ret;
++
++ msleep(5);
++ }
++
++ dev_err(dev->dev, "Vendor request req:%02x off:%04x failed:%d\n",
++ req, offset, ret);
++
++ return ret;
++}
++
++int
++mt7601u_vendor_request(struct mt7601u_dev *dev, const u8 req,
++ const u8 direction, const u16 val, const u16 offset,
++ void *buf, const size_t buflen)
++{
++ int ret;
++
++ mutex_lock(&dev->vendor_req_mutex);
++
++ ret = __mt7601u_vendor_request(dev, req, direction, val, offset,
++ buf, buflen);
++ if (ret == -ENODEV)
++ set_bit(MT7601U_STATE_REMOVED, &dev->state);
++
++ mutex_unlock(&dev->vendor_req_mutex);
++
++ return ret;
++}
++
++void mt7601u_vendor_reset(struct mt7601u_dev *dev)
++{
++ mt7601u_vendor_request(dev, MT_VEND_DEV_MODE, USB_DIR_OUT,
++ MT_VEND_DEV_MODE_RESET, 0, NULL, 0);
++}
++
++u32 mt7601u_rr(struct mt7601u_dev *dev, u32 offset)
++{
++ int ret;
++ __le32 reg;
++ u32 val;
++
++ WARN_ONCE(offset > USHRT_MAX, "read high off:%08x", offset);
++
++ ret = mt7601u_vendor_request(dev, MT_VEND_MULTI_READ, USB_DIR_IN,
++ 0, offset, &reg, sizeof(reg));
++ val = le32_to_cpu(reg);
++ if (ret > 0 && ret != sizeof(reg)) {
++ dev_err(dev->dev, "Error: wrong size read:%d off:%08x\n",
++ ret, offset);
++ val = ~0;
++ }
++
++ trace_reg_read(dev, offset, val);
++ return val;
++}
++
++int mt7601u_vendor_single_wr(struct mt7601u_dev *dev, const u8 req,
++ const u16 offset, const u32 val)
++{
++ int ret;
++
++ ret = mt7601u_vendor_request(dev, req, USB_DIR_OUT,
++ val & 0xffff, offset, NULL, 0);
++ if (ret)
++ return ret;
++ return mt7601u_vendor_request(dev, req, USB_DIR_OUT,
++ val >> 16, offset + 2, NULL, 0);
++}
++
++void mt7601u_wr(struct mt7601u_dev *dev, u32 offset, u32 val)
++{
++ WARN_ONCE(offset > USHRT_MAX, "write high off:%08x", offset);
++
++ mt7601u_vendor_single_wr(dev, MT_VEND_WRITE, offset, val);
++ trace_reg_write(dev, offset, val);
++}
++
++u32 mt7601u_rmw(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val)
++{
++ val |= mt7601u_rr(dev, offset) & ~mask;
++ mt7601u_wr(dev, offset, val);
++ return val;
++}
++
++u32 mt7601u_rmc(struct mt7601u_dev *dev, u32 offset, u32 mask, u32 val)
++{
++ u32 reg = mt7601u_rr(dev, offset);
++
++ val |= reg & ~mask;
++ if (reg != val)
++ mt7601u_wr(dev, offset, val);
++ return val;
++}
++
++void mt7601u_wr_copy(struct mt7601u_dev *dev, u32 offset,
++ const void *data, int len)
++{
++ WARN_ONCE(offset & 3, "unaligned write copy off:%08x", offset);
++ WARN_ONCE(len & 3, "short write copy off:%08x", offset);
++
++ mt7601u_burst_write_regs(dev, offset, data, len / 4);
++}
++
++void mt7601u_addr_wr(struct mt7601u_dev *dev, const u32 offset, const u8 *addr)
++{
++ mt7601u_wr(dev, offset, get_unaligned_le32(addr));
++ mt7601u_wr(dev, offset + 4, addr[4] | addr[5] << 8);
++}
++
++static int mt7601u_assign_pipes(struct usb_interface *usb_intf,
++ struct mt7601u_dev *dev)
++{
++ struct usb_endpoint_descriptor *ep_desc;
++ struct usb_host_interface *intf_desc = usb_intf->cur_altsetting;
++ unsigned i, ep_i = 0, ep_o = 0;
++
++ BUILD_BUG_ON(sizeof(dev->in_eps) < __MT_EP_IN_MAX);
++ BUILD_BUG_ON(sizeof(dev->out_eps) < __MT_EP_OUT_MAX);
++
++ for (i = 0; i < intf_desc->desc.bNumEndpoints; i++) {
++ ep_desc = &intf_desc->endpoint[i].desc;
++
++ if (usb_endpoint_is_bulk_in(ep_desc) &&
++ ep_i++ < __MT_EP_IN_MAX) {
++ dev->in_eps[ep_i - 1] = usb_endpoint_num(ep_desc);
++ dev->in_max_packet = usb_endpoint_maxp(ep_desc);
++ /* Note: this is ignored by usb sub-system but vendor
++ * code does it. We can drop this at some point.
++ */
++ dev->in_eps[ep_i - 1] |= USB_DIR_IN;
++ } else if (usb_endpoint_is_bulk_out(ep_desc) &&
++ ep_o++ < __MT_EP_OUT_MAX) {
++ dev->out_eps[ep_o - 1] = usb_endpoint_num(ep_desc);
++ dev->out_max_packet = usb_endpoint_maxp(ep_desc);
++ }
++ }
++
++ if (ep_i != __MT_EP_IN_MAX || ep_o != __MT_EP_OUT_MAX) {
++ dev_err(dev->dev, "Error: wrong pipe number in:%d out:%d\n",
++ ep_i, ep_o);
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
++static int mt7601u_probe(struct usb_interface *usb_intf,
++ const struct usb_device_id *id)
++{
++ struct usb_device *usb_dev = interface_to_usbdev(usb_intf);
++ struct mt7601u_dev *dev;
++ u32 asic_rev, mac_rev;
++ int ret;
++
++ dev = mt7601u_alloc_device(&usb_intf->dev);
++ if (!dev)
++ return -ENOMEM;
++
++ usb_dev = usb_get_dev(usb_dev);
++ usb_reset_device(usb_dev);
++
++ usb_set_intfdata(usb_intf, dev);
++
++ ret = mt7601u_assign_pipes(usb_intf, dev);
++ if (ret)
++ goto err;
++ ret = mt7601u_wait_asic_ready(dev);
++ if (ret)
++ goto err;
++
++ asic_rev = mt7601u_rr(dev, MT_ASIC_VERSION);
++ mac_rev = mt7601u_rr(dev, MT_MAC_CSR0);
++ dev_info(dev->dev, "ASIC revision: %08x MAC revision: %08x\n",
++ asic_rev, mac_rev);
++
++ /* Note: vendor driver skips this check for MT7601U */
++ if (!(mt7601u_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL))
++ dev_warn(dev->dev, "Warning: eFUSE not present\n");
++
++ ret = mt7601u_init_hardware(dev);
++ if (ret)
++ goto err;
++ ret = mt7601u_register_device(dev);
++ if (ret)
++ goto err_hw;
++
++ set_bit(MT7601U_STATE_INITIALIZED, &dev->state);
++
++ return 0;
++err_hw:
++ mt7601u_cleanup(dev);
++err:
++ usb_set_intfdata(usb_intf, NULL);
++ usb_put_dev(interface_to_usbdev(usb_intf));
++
++ destroy_workqueue(dev->stat_wq);
++ ieee80211_free_hw(dev->hw);
++ return ret;
++}
++
++static void mt7601u_disconnect(struct usb_interface *usb_intf)
++{
++ struct mt7601u_dev *dev = usb_get_intfdata(usb_intf);
++
++ ieee80211_unregister_hw(dev->hw);
++ mt7601u_cleanup(dev);
++
++ usb_set_intfdata(usb_intf, NULL);
++ usb_put_dev(interface_to_usbdev(usb_intf));
++
++ destroy_workqueue(dev->stat_wq);
++ ieee80211_free_hw(dev->hw);
++}
++
++static int mt7601u_suspend(struct usb_interface *usb_intf, pm_message_t state)
++{
++ struct mt7601u_dev *dev = usb_get_intfdata(usb_intf);
++
++ mt7601u_cleanup(dev);
++
++ return 0;
++}
++
++static int mt7601u_resume(struct usb_interface *usb_intf)
++{
++ struct mt7601u_dev *dev = usb_get_intfdata(usb_intf);
++ int ret;
++
++ ret = mt7601u_init_hardware(dev);
++ if (ret)
++ return ret;
++
++ set_bit(MT7601U_STATE_INITIALIZED, &dev->state);
++
++ return 0;
++}
++
++MODULE_DEVICE_TABLE(usb, mt7601u_device_table);
++MODULE_FIRMWARE(MT7601U_FIRMWARE);
++MODULE_LICENSE("GPL");
++
++static struct usb_driver mt7601u_driver = {
++ .name = KBUILD_MODNAME,
++ .id_table = mt7601u_device_table,
++ .probe = mt7601u_probe,
++ .disconnect = mt7601u_disconnect,
++ .suspend = mt7601u_suspend,
++ .resume = mt7601u_resume,
++ .reset_resume = mt7601u_resume,
++ .soft_unbind = 1,
++ .disable_hub_initiated_lpm = 1,
++};
++module_usb_driver(mt7601u_driver);
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/usb.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/usb.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/usb.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/usb.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,77 @@
++/*
++ * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT7601U_USB_H
++#define __MT7601U_USB_H
++
++#include "mt7601u.h"
++
++#define MT7601U_FIRMWARE "mt7601u.bin"
++
++#define MT_VEND_REQ_MAX_RETRY 10
++#define MT_VEND_REQ_TOUT_MS 300
++
++#define MT_VEND_DEV_MODE_RESET 1
++
++enum mt_vendor_req {
++ MT_VEND_DEV_MODE = 1,
++ MT_VEND_WRITE = 2,
++ MT_VEND_MULTI_READ = 7,
++ MT_VEND_WRITE_FCE = 0x42,
++};
++
++enum mt_usb_ep_in {
++ MT_EP_IN_PKT_RX,
++ MT_EP_IN_CMD_RESP,
++ __MT_EP_IN_MAX,
++};
++
++enum mt_usb_ep_out {
++ MT_EP_OUT_INBAND_CMD,
++ MT_EP_OUT_AC_BK,
++ MT_EP_OUT_AC_BE,
++ MT_EP_OUT_AC_VI,
++ MT_EP_OUT_AC_VO,
++ MT_EP_OUT_HCCA,
++ __MT_EP_OUT_MAX,
++};
++
++static inline struct usb_device *mt7601u_to_usb_dev(struct mt7601u_dev *mt7601u)
++{
++ return interface_to_usbdev(to_usb_interface(mt7601u->dev));
++}
++
++static inline bool mt7601u_urb_has_error(struct urb *urb)
++{
++ return urb->status &&
++ urb->status != -ENOENT &&
++ urb->status != -ECONNRESET &&
++ urb->status != -ESHUTDOWN;
++}
++
++bool mt7601u_usb_alloc_buf(struct mt7601u_dev *dev, size_t len,
++ struct mt7601u_dma_buf *buf);
++void mt7601u_usb_free_buf(struct mt7601u_dev *dev, struct mt7601u_dma_buf *buf);
++int mt7601u_usb_submit_buf(struct mt7601u_dev *dev, int dir, int ep_idx,
++ struct mt7601u_dma_buf *buf, gfp_t gfp,
++ usb_complete_t complete_fn, void *context);
++void mt7601u_complete_urb(struct urb *urb);
++
++int mt7601u_vendor_request(struct mt7601u_dev *dev, const u8 req,
++ const u8 direction, const u16 val, const u16 offset,
++ void *buf, const size_t buflen);
++void mt7601u_vendor_reset(struct mt7601u_dev *dev);
++int mt7601u_vendor_single_wr(struct mt7601u_dev *dev, const u8 req,
++ const u16 offset, const u32 val);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/util.c linux-rpi/drivers/net/wireless/mediatek/mt7601u/util.c
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/util.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/util.c 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,42 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#include "mt7601u.h"
++
++void mt76_remove_hdr_pad(struct sk_buff *skb)
++{
++ int len = ieee80211_get_hdrlen_from_skb(skb);
++
++ memmove(skb->data + 2, skb->data, len);
++ skb_pull(skb, 2);
++}
++
++int mt76_insert_hdr_pad(struct sk_buff *skb)
++{
++ int len = ieee80211_get_hdrlen_from_skb(skb);
++ int ret;
++
++ if (len % 4 == 0)
++ return 0;
++
++ ret = skb_cow(skb, 2);
++ if (ret)
++ return ret;
++
++ skb_push(skb, 2);
++ memmove(skb->data, skb->data + 2, len);
++
++ skb->data[len] = 0;
++ skb->data[len + 1] = 0;
++ return 0;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/util.h linux-rpi/drivers/net/wireless/mediatek/mt7601u/util.h
+--- linux-4.1.6/drivers/net/wireless/mediatek/mt7601u/util.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/mediatek/mt7601u/util.h 2015-08-26 10:26:08.721315886 +0200
+@@ -0,0 +1,77 @@
++/*
++ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation
++ *
++ * This 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.
++ */
++
++#ifndef __MT76_UTIL_H
++#define __MT76_UTIL_H
++
++/*
++ * Power of two check, this will check
++ * if the mask that has been given contains and contiguous set of bits.
++ * Note that we cannot use the is_power_of_2() function since this
++ * check must be done at compile-time.
++ */
++#define is_power_of_two(x) ( !((x) & ((x)-1)) )
++#define low_bit_mask(x) ( ((x)-1) & ~(x) )
++#define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x))
++
++/*
++ * Macros to find first set bit in a variable.
++ * These macros behave the same as the __ffs() functions but
++ * the most important difference that this is done during
++ * compile-time rather then run-time.
++ */
++#define compile_ffs2(__x) \
++ __builtin_choose_expr(((__x) & 0x1), 0, 1)
++
++#define compile_ffs4(__x) \
++ __builtin_choose_expr(((__x) & 0x3), \
++ (compile_ffs2((__x))), \
++ (compile_ffs2((__x) >> 2) + 2))
++
++#define compile_ffs8(__x) \
++ __builtin_choose_expr(((__x) & 0xf), \
++ (compile_ffs4((__x))), \
++ (compile_ffs4((__x) >> 4) + 4))
++
++#define compile_ffs16(__x) \
++ __builtin_choose_expr(((__x) & 0xff), \
++ (compile_ffs8((__x))), \
++ (compile_ffs8((__x) >> 8) + 8))
++
++#define compile_ffs32(__x) \
++ __builtin_choose_expr(((__x) & 0xffff), \
++ (compile_ffs16((__x))), \
++ (compile_ffs16((__x) >> 16) + 16))
++
++/*
++ * This macro will check the requirements for the FIELD{8,16,32} macros
++ * The mask should be a constant non-zero contiguous set of bits which
++ * does not exceed the given typelimit.
++ */
++#define FIELD_CHECK(__mask) \
++ BUILD_BUG_ON(!(__mask) || !is_valid_mask(__mask))
++
++#define MT76_SET(_mask, _val) \
++ ({ \
++ FIELD_CHECK(_mask); \
++ (((u32) (_val)) << compile_ffs32(_mask)) & _mask; \
++ })
++
++#define MT76_GET(_mask, _val) \
++ ({ \
++ FIELD_CHECK(_mask); \
++ (u32) (((_val) & _mask) >> compile_ffs32(_mask)); \
++ })
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/Kconfig linux-rpi/drivers/net/wireless/rtl8192cu/Kconfig
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/Kconfig 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/Kconfig 2015-08-26 10:26:08.745316219 +0200
+@@ -0,0 +1,9 @@
++config RTL8192CU
++ tristate "Realtek 8192C USB WiFi"
++ depends on MAC80211 && USB
++ select CFG80211_WEXT
++ select WIRELESS_EXT
++ select WEXT_PRIV
++ ---help---
++ This option adds the Realtek RTL8192CU USB device such as Edimax EW-7811Un.
++
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/Makefile linux-rpi/drivers/net/wireless/rtl8192cu/Makefile
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/Makefile 2015-08-26 10:26:08.745316219 +0200
+@@ -0,0 +1,615 @@
++EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
++EXTRA_CFLAGS += -O1
++#EXTRA_CFLAGS += -O3
++#EXTRA_CFLAGS += -Wall
++#EXTRA_CFLAGS += -Wextra
++#EXTRA_CFLAGS += -Werror
++#EXTRA_CFLAGS += -pedantic
++#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
++
++EXTRA_CFLAGS += -Wno-unused-variable
++EXTRA_CFLAGS += -Wno-unused-value
++EXTRA_CFLAGS += -Wno-unused-label
++EXTRA_CFLAGS += -Wno-unused-parameter
++EXTRA_CFLAGS += -Wno-unused-function
++EXTRA_CFLAGS += -Wno-unused
++
++EXTRA_CFLAGS += -Wno-uninitialized
++
++EXTRA_CFLAGS += -I$(src)/include
++
++CONFIG_AUTOCFG_CP = n
++
++CONFIG_RTL8192C = y
++CONFIG_RTL8192D = n
++CONFIG_RTL8723A = n
++
++CONFIG_USB_HCI = y
++CONFIG_PCI_HCI = n
++CONFIG_SDIO_HCI = n
++
++CONFIG_MP_INCLUDED = n
++CONFIG_POWER_SAVING = y
++CONFIG_USB_AUTOSUSPEND = n
++CONFIG_HW_PWRP_DETECTION = n
++CONFIG_WIFI_TEST = n
++CONFIG_BT_COEXISTENCE = n
++CONFIG_RTL8192CU_REDEFINE_1X1 = n
++CONFIG_INTEL_WIDI = n
++CONFIG_WAKE_ON_WLAN = n
++
++CONFIG_PLATFORM_I386_PC = y
++CONFIG_PLATFORM_TI_AM3517 = n
++CONFIG_PLATFORM_ANDROID_X86 = n
++CONFIG_PLATFORM_JB_X86 = n
++CONFIG_PLATFORM_ARM_S3C2K4 = n
++CONFIG_PLATFORM_ARM_PXA2XX = n
++CONFIG_PLATFORM_ARM_S3C6K4 = n
++CONFIG_PLATFORM_MIPS_RMI = n
++CONFIG_PLATFORM_RTD2880B = n
++CONFIG_PLATFORM_MIPS_AR9132 = n
++CONFIG_PLATFORM_RTK_DMP = n
++CONFIG_PLATFORM_MIPS_PLM = n
++CONFIG_PLATFORM_MSTAR389 = n
++CONFIG_PLATFORM_MT53XX = n
++CONFIG_PLATFORM_ARM_MX51_241H = n
++CONFIG_PLATFORM_FS_MX61 = n
++CONFIG_PLATFORM_ACTIONS_ATJ227X = n
++CONFIG_PLATFORM_TEGRA3_CARDHU = n
++CONFIG_PLATFORM_TEGRA4_DALMORE = n
++CONFIG_PLATFORM_ARM_TCC8900 = n
++CONFIG_PLATFORM_ARM_TCC8920 = n
++CONFIG_PLATFORM_ARM_TCC8920_JB42 = n
++CONFIG_PLATFORM_ARM_RK2818 = n
++CONFIG_PLATFORM_ARM_TI_PANDA = n
++CONFIG_PLATFORM_MIPS_JZ4760 = n
++CONFIG_PLATFORM_DMP_PHILIPS = n
++CONFIG_PLATFORM_TI_DM365 = n
++CONFIG_PLATFORM_MN10300 = n
++CONFIG_PLATFORM_MSTAR_TITANIA12 = n
++CONFIG_PLATFORM_MSTAR_A3 = n
++CONFIG_PLATFORM_ARM_SUNxI = n
++CONFIG_PLATFORM_ARM_SUN6I = n
++
++CONFIG_DRVEXT_MODULE = n
++
++export TopDIR ?= $(shell pwd)
++
++
++ifeq ($(CONFIG_RTL8192C), y)
++
++RTL871X = rtl8192c
++
++ifeq ($(CONFIG_USB_HCI), y)
++MODULE_NAME = 8192cu
++FW_FILES := hal/$(RTL871X)/usb/Hal8192CUHWImg.o
++ifneq ($(CONFIG_WAKE_ON_WLAN), n)
++FW_FILES += hal/$(RTL871X)/usb/Hal8192CUHWImg_wowlan.o
++endif
++endif
++ifeq ($(CONFIG_PCI_HCI), y)
++MODULE_NAME = 8192ce
++FW_FILES := hal/$(RTL871X)/pci/Hal8192CEHWImg.o
++endif
++
++CHIP_FILES := \
++ hal/$(RTL871X)/$(RTL871X)_sreset.o \
++ hal/$(RTL871X)/$(RTL871X)_xmit.o
++CHIP_FILES += $(FW_FILES)
++endif
++
++ifeq ($(CONFIG_RTL8192D), y)
++
++RTL871X = rtl8192d
++
++ifeq ($(CONFIG_USB_HCI), y)
++MODULE_NAME = 8192du
++FW_FILES := hal/$(RTL871X)/usb/Hal8192DUHWImg.o
++ifneq ($(CONFIG_WAKE_ON_WLAN), n)
++FW_FILES += hal/$(RTL871X)/usb/Hal8192DUHWImg_wowlan.o
++endif
++endif
++ifeq ($(CONFIG_PCI_HCI), y)
++MODULE_NAME = 8192de
++FW_FILES := hal/$(RTL871X)/pci/Hal8192DEHWImg.o
++endif
++
++CHIP_FILES := \
++ hal/$(RTL871X)/$(RTL871X)_xmit.o
++CHIP_FILES += $(FW_FILES)
++endif
++
++ifeq ($(CONFIG_RTL8723A), y)
++
++RTL871X = rtl8723a
++
++ifeq ($(CONFIG_SDIO_HCI), y)
++MODULE_NAME = 8723as
++FW_FILES := hal/$(RTL871X)/sdio/Hal8723SHWImg.o
++endif
++
++ifeq ($(CONFIG_USB_HCI), y)
++MODULE_NAME = 8723au
++FW_FILES := hal/$(RTL871X)/usb/Hal8723UHWImg.o
++endif
++
++ifeq ($(CONFIG_PCI_HCI), y)
++MODULE_NAME = 8723ae
++FW_FILES := hal/$(RTL871X)/pci/Hal8723EHWImg.o
++endif
++
++PWRSEQ_FILES := hal/HalPwrSeqCmd.o \
++ hal/$(RTL871X)/Hal8723PwrSeq.o
++
++CHIP_FILES += $(FW_FILES) $(PWRSEQ_FILES)
++
++endif
++
++ifeq ($(CONFIG_SDIO_HCI), y)
++HCI_NAME = sdio
++endif
++
++ifeq ($(CONFIG_USB_HCI), y)
++HCI_NAME = usb
++endif
++
++ifeq ($(CONFIG_PCI_HCI), y)
++HCI_NAME = pci
++endif
++
++
++_OS_INTFS_FILES := os_dep/osdep_service.o \
++ os_dep/linux/os_intfs.o \
++ os_dep/linux/$(HCI_NAME)_intf.o \
++ os_dep/linux/$(HCI_NAME)_ops_linux.o \
++ os_dep/linux/ioctl_linux.o \
++ os_dep/linux/xmit_linux.o \
++ os_dep/linux/mlme_linux.o \
++ os_dep/linux/recv_linux.o \
++ os_dep/linux/ioctl_cfg80211.o \
++ os_dep/linux/rtw_android.o
++
++
++_HAL_INTFS_FILES := hal/hal_intf.o \
++ hal/hal_com.o \
++ hal/dm.o \
++ hal/$(RTL871X)/$(RTL871X)_hal_init.o \
++ hal/$(RTL871X)/$(RTL871X)_phycfg.o \
++ hal/$(RTL871X)/$(RTL871X)_rf6052.o \
++ hal/$(RTL871X)/$(RTL871X)_dm.o \
++ hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
++ hal/$(RTL871X)/$(RTL871X)_cmd.o \
++ hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
++ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
++ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
++ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
++
++ifeq ($(CONFIG_SDIO_HCI), y)
++_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
++else
++_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
++endif
++
++ifeq ($(CONFIG_MP_INCLUDED), y)
++_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
++endif
++
++_HAL_INTFS_FILES += $(CHIP_FILES)
++
++
++ifeq ($(CONFIG_AUTOCFG_CP), y)
++$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
++endif
++
++
++ifeq ($(CONFIG_USB_HCI), y)
++ifeq ($(CONFIG_USB_AUTOSUSPEND), y)
++EXTRA_CFLAGS += -DCONFIG_USB_AUTOSUSPEND
++endif
++endif
++
++ifeq ($(CONFIG_POWER_SAVING), y)
++EXTRA_CFLAGS += -DCONFIG_POWER_SAVING
++endif
++
++ifeq ($(CONFIG_HW_PWRP_DETECTION), y)
++EXTRA_CFLAGS += -DCONFIG_HW_PWRP_DETECTION
++endif
++
++ifeq ($(CONFIG_WIFI_TEST), y)
++EXTRA_CFLAGS += -DCONFIG_WIFI_TEST
++endif
++
++ifeq ($(CONFIG_BT_COEXISTENCE), y)
++EXTRA_CFLAGS += -DCONFIG_BT_COEXISTENCE
++endif
++
++ifeq ($(CONFIG_RTL8192CU_REDEFINE_1X1), y)
++EXTRA_CFLAGS += -DRTL8192C_RECONFIG_TO_1T1R
++endif
++
++ifeq ($(CONFIG_WAKE_ON_WLAN), y)
++EXTRA_CFLAGS += -DCONFIG_WAKE_ON_WLAN
++endif
++
++ifeq ($(CONFIG_INTEL_WIDI), y)
++EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI
++endif
++
++ifeq ($(CONFIG_PLATFORM_I386_PC), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
++ARCH ?= $(SUBARCH)
++CROSS_COMPILE ?=
++KVER := $(shell uname -r)
++KSRC := /lib/modules/$(KVER)/build
++MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
++INSTALL_PREFIX :=
++endif
++
++ifeq ($(CONFIG_PLATFORM_TI_AM3517), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_SHUTTLE
++CROSS_COMPILE := arm-eabi-
++KSRC := $(shell pwd)/../../../Android/kernel
++ARCH := arm
++endif
++
++ifeq ($(CONFIG_PLATFORM_MSTAR_TITANIA12), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_PLATFORM_MSTAR_TITANIA12
++ARCH:=mips
++CROSS_COMPILE:= /usr/src/Mstar_kernel/mips-4.3/bin/mips-linux-gnu-
++KVER:= 2.6.28.9
++KSRC:= /usr/src/Mstar_kernel/2.6.28.9/
++endif
++
++ifeq ($(CONFIG_PLATFORM_MSTAR_A3), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_PLATFORM_MSTAR_A3
++ARCH:=arm
++CROSS_COMPILE:= arm-none-linux-gnueabi-
++KVER:= 2.6.35.11
++KSRC:= /home/gary/PERFORCE/THEALE/RedLion/2.6.35.11/
++MODULE_NAME = wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
++ARCH := $(SUBARCH)
++CROSS_COMPILE := /media/DATA-2/android-x86/ics-x86_20120130/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-
++KSRC := /media/DATA-2/android-x86/ics-x86_20120130/out/target/product/generic_x86/obj/kernel
++MODULE_NAME :=wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_JB_X86), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
++EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
++EXTRA_CFLAGS += -DCONFIG_P2P_IPS
++SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
++ARCH := $(SUBARCH)
++CROSS_COMPILE := /home/android_sdk/android-x86_JB/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7/bin/i686-linux-android-
++KSRC := /home/android_sdk/android-x86_JB/out/target/product/x86/obj/kernel/
++MODULE_NAME :=wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_PXA2XX), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH := arm
++CROSS_COMPILE := arm-none-linux-gnueabi-
++KVER := 2.6.34.1
++KSRC ?= /usr/src/linux-2.6.34.1
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH := arm
++CROSS_COMPILE := arm-linux-
++KVER := 2.6.24.7_$(ARCH)
++KSRC := /usr/src/kernels/linux-$(KVER)
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_S3C6K4), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH := arm
++CROSS_COMPILE := arm-none-linux-gnueabi-
++KVER := 2.6.34.1
++KSRC ?= /usr/src/linux-2.6.34.1
++endif
++
++ifeq ($(CONFIG_PLATFORM_RTD2880B), y)
++EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B
++ARCH:=
++CROSS_COMPILE:=
++KVER:=
++KSRC:=
++endif
++
++ifeq ($(CONFIG_PLATFORM_MIPS_RMI), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH:=mips
++CROSS_COMPILE:=mipsisa32r2-uclibc-
++KVER:=
++KSRC:= /root/work/kernel_realtek
++endif
++
++ifeq ($(CONFIG_PLATFORM_MIPS_PLM), y)
++EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
++ARCH:=mips
++CROSS_COMPILE:=mipsisa32r2-uclibc-
++KVER:=
++KSRC:= /root/work/kernel_realtek
++endif
++
++ifeq ($(CONFIG_PLATFORM_MSTAR389), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR389
++ARCH:=mips
++CROSS_COMPILE:= mips-linux-gnu-
++KVER:= 2.6.28.10
++KSRC:= /home/mstar/mstar_linux/2.6.28.9/
++endif
++
++ifeq ($(CONFIG_PLATFORM_MIPS_AR9132), y)
++EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
++ARCH := mips
++CROSS_COMPILE := mips-openwrt-linux-
++KSRC := /home/alex/test_openwrt/tmp/linux-2.6.30.9
++endif
++
++ifeq ($(CONFIG_PLATFORM_DMP_PHILIPS), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM
++ARCH := mips
++#CROSS_COMPILE:=/usr/local/msdk-4.3.6-mips-EL-2.6.12.6-0.9.30.3/bin/mipsel-linux-
++CROSS_COMPILE:=/usr/local/toolchain_mipsel/bin/mipsel-linux-
++KSRC ?=/usr/local/Jupiter/linux-2.6.12
++endif
++
++ifeq ($(CONFIG_PLATFORM_RTK_DMP), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM
++ARCH:=mips
++CROSS_COMPILE:=mipsel-linux-
++KVER:=
++KSRC ?= /usr/src/DMP_Kernel/jupiter/linux-2.6.12
++endif
++
++ifeq ($(CONFIG_PLATFORM_MT53XX), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MT53XX
++ARCH:= arm
++CROSS_COMPILE:= arm11_mtk_le-
++KVER:= 2.6.27
++KSRC?= /proj/mtk00802/BD_Compare/BDP/Dev/BDP_V301/BDP_Linux/linux-2.6.27
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_MX51_241H), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WISTRON_PLATFORM
++ARCH := arm
++CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
++KVER := 2.6.31
++KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source
++endif
++
++ifeq ($(CONFIG_PLATFORM_FS_MX61), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH := arm
++CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi-
++KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env
++endif
++
++
++
++ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X
++ARCH := mips
++CROSS_COMPILE := /home/cnsd4/project/actions/tools-2.6.27/bin/mipsel-linux-gnu-
++KVER := 2.6.27
++KSRC := /home/cnsd4/project/actions/linux-2.6.27.28
++endif
++
++ifeq ($(CONFIG_PLATFORM_TI_DM365), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_TI_DM365
++ARCH := arm
++CROSS_COMPILE := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-
++KVER := 2.6.18
++KSRC := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-dm365
++endif
++
++ifeq ($(CONFIG_PLATFORM_TEGRA3_CARDHU), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++# default setting for Android 4.1, 4.2
++EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
++EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
++EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
++EXTRA_CFLAGS += -DCONFIG_P2P_IPS
++ARCH := arm
++CROSS_COMPILE := /home/android_sdk/nvidia/tegra-16r3-partner-android-4.1_20120723/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
++KSRC := /home/android_sdk/nvidia/tegra-16r3-partner-android-4.1_20120723/out/target/product/cardhu/obj/KERNEL
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_TEGRA4_DALMORE), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++# default setting for Android 4.1, 4.2
++EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
++EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
++EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
++EXTRA_CFLAGS += -DCONFIG_P2P_IPS
++ARCH := arm
++CROSS_COMPILE := /home/android_sdk/nvidia/tegra-17r9-partner-android-4.2-dalmore_20130131/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
++KSRC := /home/android_sdk/nvidia/tegra-17r9-partner-android-4.2-dalmore_20130131/out/target/product/dalmore/obj/KERNEL
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_TCC8900), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH := arm
++CROSS_COMPILE := /home/android_sdk/Telechips/SDK_2304_20110613/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
++KSRC := /home/android_sdk/Telechips/SDK_2304_20110613/kernel
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_TCC8920), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++ARCH := arm
++CROSS_COMPILE := /home/android_sdk/Telechips/v12.06_r1-tcc-android-4.0.4/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
++KSRC := /home/android_sdk/Telechips/v12.06_r1-tcc-android-4.0.4/kernel
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_TCC8920_JB42), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++# default setting for Android 4.1, 4.2
++EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
++EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
++EXTRA_CFLAGS += -DCONFIG_P2P_IPS
++ARCH := arm
++CROSS_COMPILE := /home/android_sdk/Telechips/v13.03_r1-tcc-android-4.2.2_ds_patched/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
++KSRC := /home/android_sdk/Telechips/v13.03_r1-tcc-android-4.2.2_ds_patched/kernel
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS -DCONFIG_MINIMAL_MEMORY_USAGE
++ARCH := arm
++CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
++KSRC := /usr/src/release_fae_version/kernel25_A7_281x
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_TI_PANDA), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE
++ARCH := arm
++#CROSS_COMPILE := /media/DATA-1/aosp/ics-aosp_20111227/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
++#KSRC := /media/DATA-1/aosp/android-omap-panda-3.0_20120104
++CROSS_COMPILE := /media/DATA-1/android-4.0/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
++KSRC := /media/DATA-1/android-4.0/panda_kernel/omap
++MODULE_NAME := wlan
++endif
++
++ifeq ($(CONFIG_PLATFORM_MIPS_JZ4760), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_MINIMAL_MEMORY_USAGE
++ARCH ?= mips
++CROSS_COMPILE ?= /mnt/sdb5/Ingenic/Umido/mips-4.3/bin/mips-linux-gnu-
++KSRC ?= /mnt/sdb5/Ingenic/Umido/kernel
++endif
++
++#Add setting for MN10300
++ifeq ($(CONFIG_PLATFORM_MN10300), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MN10300
++ARCH := mn10300
++CROSS_COMPILE := mn10300-linux-
++KVER := 2.6.32.2
++KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2
++INSTALL_PREFIX :=
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_SUNxI), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ARM_SUNxI
++ARCH := arm
++CROSS_COMPILE := arm-none-linux-gnueabi-
++KVER := 3.0.8
++#KSRC:= ../lichee/linux-3.0/
++endif
++
++ifeq ($(CONFIG_PLATFORM_ARM_SUN6I), y)
++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
++EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN6I
++EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
++EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
++# default setting for Android 4.1, 4.2
++EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
++EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
++EXTRA_CFLAGS += -DCONFIG_P2P_IPS
++ARCH := arm
++CROSS_COMPILE := arm-none-linux-gnueabi-
++KVER := 3.3.0
++#KSRC:= ../lichee/linux-3.3/
++endif
++
++ifneq ($(USER_MODULE_NAME),)
++MODULE_NAME := $(USER_MODULE_NAME)
++endif
++
++ifeq ($(CONFIG_MP_INCLUDED), y)
++MODULE_NAME := $(MODULE_NAME)_mp
++EXTRA_CFLAGS += -DCONFIG_MP_INCLUDED
++endif
++
++
++ifneq ($(KERNELRELEASE),)
++
++
++rtk_core := core/rtw_cmd.o \
++ core/rtw_security.o \
++ core/rtw_debug.o \
++ core/rtw_io.o \
++ core/rtw_ioctl_query.o \
++ core/rtw_ioctl_set.o \
++ core/rtw_ieee80211.o \
++ core/rtw_mlme.o \
++ core/rtw_mlme_ext.o \
++ core/rtw_wlan_util.o \
++ core/rtw_pwrctrl.o \
++ core/rtw_rf.o \
++ core/rtw_recv.o \
++ core/rtw_sta_mgt.o \
++ core/rtw_ap.o \
++ core/rtw_xmit.o \
++ core/rtw_p2p.o \
++ core/rtw_tdls.o \
++ core/rtw_br_ext.o \
++ core/rtw_iol.o \
++ core/rtw_sreset.o
++
++$(MODULE_NAME)-y += $(rtk_core)
++
++$(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o
++
++$(MODULE_NAME)-y += core/efuse/rtw_efuse.o
++
++$(MODULE_NAME)-y += $(_HAL_INTFS_FILES)
++
++$(MODULE_NAME)-y += $(_OS_INTFS_FILES)
++
++$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \
++ core/rtw_mp_ioctl.o
++
++obj-$(CONFIG_RTL8192CU) := $(MODULE_NAME).o
++
++else
++
++export CONFIG_RTL8192CU = m
++
++all: modules
++
++modules:
++ $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules
++
++strip:
++ $(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded
++
++install:
++ install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR)
++ /sbin/depmod -a ${KVER}
++
++uninstall:
++ rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
++ /sbin/depmod -a ${KVER}
++
++
++config_r:
++ @echo "make config"
++ /bin/bash script/Configure script/config.in
++
++.PHONY: modules clean
++
++clean:
++ rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
++ rm .tmp_versions -fr ; rm Module.symvers -fr
++ rm -fr Module.markers ; rm -fr modules.order
++ cd core/efuse ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++ cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++ cd hal/$(RTL871X)/$(HCI_NAME) ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++ cd hal/$(RTL871X) ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++ cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++ cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++ cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
++endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/clean linux-rpi/drivers/net/wireless/rtl8192cu/clean
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/clean 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/clean 2015-08-26 10:26:08.745316219 +0200
@@ -0,0 +1,5 @@
+#!/bin/bash
+rmmod 8192cu
+rmmod 8192ce
+rmmod 8192du
+rmmod 8192de
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c 2015-07-28 01:20:58.297682643 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c linux-rpi/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c 2015-08-26 10:26:08.745316219 +0200
@@ -0,0 +1,1145 @@
+/******************************************************************************
+ *
@@ -52905,9 +61532,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/efuse/rtw_efuse.c linu
+}
+#endif //CONFIG_ADAPTOR_INFO_CACHING_FILE
+#endif //PLATFORM_LINUX
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ap.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ap.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ap.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ap.c 2015-07-28 01:20:58.297682643 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ap.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ap.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ap.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ap.c 2015-08-26 10:26:08.745316219 +0200
@@ -0,0 +1,2939 @@
+/******************************************************************************
+ *
@@ -55848,9 +64475,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ap.c linux-xbian-r
+
+#endif //CONFIG_NATIVEAP_MLME
+#endif //CONFIG_AP_MODE
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c 2015-08-26 10:26:08.745316219 +0200
@@ -0,0 +1,1699 @@
+/******************************************************************************
+ *
@@ -57551,9 +66178,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_br_ext.c linux-xbi
+}
+
+#endif // CONFIG_BR_EXT
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,3034 @@
+/******************************************************************************
+ *
@@ -60589,9 +69216,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_cmd.c linux-xbian-
+_func_exit_;
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_debug.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_debug.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_debug.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_debug.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_debug.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_debug.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_debug.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_debug.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,1336 @@
+/******************************************************************************
+ *
@@ -61929,9 +70556,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_debug.c linux-xbia
+#endif /* CONFIG_DM_ADAPTIVITY */
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,422 @@
+/******************************************************************************
+ *
@@ -62355,9 +70982,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_eeprom.c linux-xbi
+
+_func_exit_;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,1914 @@
+/******************************************************************************
+ *
@@ -64273,9 +72900,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ieee80211.c linux-
+ action = (action >= ACT_PUBLIC_MAX) ? ACT_PUBLIC_MAX : action;
+ return _action_public_str[action];
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_io.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_io.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_io.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_io.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_io.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_io.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_io.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_io.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,462 @@
+/******************************************************************************
+ *
@@ -64739,9 +73366,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_io.c linux-xbian-r
+ return _rtw_writeN(adapter, addr, length, data);
+}
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,195 @@
+/******************************************************************************
+ *
@@ -64938,9 +73565,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_query.c linu
+ return _TRUE;
+}
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,1031 @@
+/******************************************************************************
+ *
@@ -65973,9 +74600,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_rtl.c linux-
+ return status;
+}
+//************** oid_rtl_seg_03_00 section end **************
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,1493 @@
+/******************************************************************************
+ *
@@ -67470,9 +76097,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_ioctl_set.c linux-
+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" band:%d fail\n", FUNC_ADPT_ARG(adapter), band);
+ return _FAIL;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_iol.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_iol.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_iol.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_iol.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_iol.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_iol.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_iol.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_iol.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,262 @@
+/******************************************************************************
+ *
@@ -67736,9 +76363,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_iol.c linux-xbian-
+}
+
+#endif //CONFIG_IOL
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c 2015-07-28 01:20:58.301668422 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,3966 @@
+/******************************************************************************
+ *
@@ -71706,9 +80333,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mlme.c linux-xbian
+ return _FALSE;
+}
+#endif //CONFIG_CONCURRENT_MODE
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,13599 @@
+/******************************************************************************
+ *
@@ -85309,9 +93936,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mlme_ext.c linux-x
+#endif //CONFIG_TDLS
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mp.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mp.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mp.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mp.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,1323 @@
+/******************************************************************************
+ *
@@ -86636,9 +95263,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mp.c linux-xbian-r
+}
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,2953 @@
+/******************************************************************************
+ *
@@ -89593,9 +98220,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_mp_ioctl.c linux-x
+ return 0;
+#endif
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,5293 @@
+/******************************************************************************
+ *
@@ -94890,9 +103517,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_p2p.c linux-xbian-
+}
+
+#endif //CONFIG_P2P
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,1538 @@
+/******************************************************************************
+ *
@@ -96432,9 +105059,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_pwrctrl.c linux-xb
+ }
+ return 0;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_recv.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_recv.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_recv.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_recv.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_recv.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_recv.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_recv.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_recv.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,4286 @@
+/******************************************************************************
+ *
@@ -100722,9 +109349,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_recv.c linux-xbian
+
+}
+#endif //CONFIG_NEW_SIGNAL_STAT_PROCESS
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_rf.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_rf.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_rf.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_rf.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_rf.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_rf.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_rf.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_rf.c 2015-08-26 10:26:08.749316275 +0200
@@ -0,0 +1,94 @@
+/******************************************************************************
+ *
@@ -100820,9 +109447,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_rf.c linux-xbian-r
+
+ return ch;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_security.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_security.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_security.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_security.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_security.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_security.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_security.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_security.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,3114 @@
+/******************************************************************************
+ *
@@ -103938,9 +112565,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_security.c linux-x
+
+ return status;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,351 @@
+/******************************************************************************
+ *
@@ -104293,9 +112920,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_sreset.c linux-xbi
+ DBG_871X("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
+#endif
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,847 @@
+/******************************************************************************
+ *
@@ -105144,9 +113771,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_sta_mgt.c linux-xb
+ return res;
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,2940 @@
+/******************************************************************************
+ *
@@ -108088,9 +116715,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_tdls.c linux-xbian
+}
+
+#endif //CONFIG_TDLS
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,2304 @@
+/******************************************************************************
+ *
@@ -110396,9 +119023,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_wlan_util.c linux-
+exit:
+ return status;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,4155 @@
+/******************************************************************************
+ *
@@ -114555,9 +123182,188 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/core/rtw_xmit.c linux-xbian
+ }
+}
+#endif //CONFIG_XMIT_ACK
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/dm.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/dm.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/dm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/dm.c 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c 2015-08-26 10:26:08.753316330 +0200
+@@ -0,0 +1,175 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++/*++
++Copyright (c) Realtek Semiconductor Corp. All rights reserved.
++
++Module Name:
++ HalPwrSeqCmd.c
++
++Abstract:
++ Implement HW Power sequence configuration CMD handling routine for Realtek devices.
++
++Major Change History:
++ When Who What
++ ---------- --------------- -------------------------------
++ 2011-10-26 Lucas Modify to be compatible with SD4-CE driver.
++ 2011-07-07 Roger Create.
++
++--*/
++#include <HalPwrSeqCmd.h>
++#include <sdio_ops.h>
++
++
++//
++// Description:
++// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
++//
++// Assumption:
++// We should follow specific format which was released from HW SD.
++//
++// 2011.07.07, added by Roger.
++//
++u8 HalPwrSeqCmdParsing(
++ PADAPTER padapter,
++ u8 CutVersion,
++ u8 FabVersion,
++ u8 InterfaceType,
++ WLAN_PWR_CFG PwrSeqCmd[])
++{
++ WLAN_PWR_CFG PwrCfgCmd = {0};
++ u8 bPollingBit = _FALSE;
++ u32 AryIdx = 0;
++ u8 value = 0;
++ u32 offset = 0;
++ u32 pollingCount = 0; // polling autoload done.
++ u32 maxPollingCnt = 5000;
++
++ do {
++ PwrCfgCmd = PwrSeqCmd[AryIdx];
++
++ RT_TRACE(_module_hal_init_c_ , _drv_info_,
++ ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
++ GET_PWR_CFG_OFFSET(PwrCfgCmd),
++ GET_PWR_CFG_CUT_MASK(PwrCfgCmd),
++ GET_PWR_CFG_FAB_MASK(PwrCfgCmd),
++ GET_PWR_CFG_INTF_MASK(PwrCfgCmd),
++ GET_PWR_CFG_BASE(PwrCfgCmd),
++ GET_PWR_CFG_CMD(PwrCfgCmd),
++ GET_PWR_CFG_MASK(PwrCfgCmd),
++ GET_PWR_CFG_VALUE(PwrCfgCmd)));
++
++ //2 Only Handle the command whose FAB, CUT, and Interface are matched
++ if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
++ (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
++ (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType))
++ {
++ switch (GET_PWR_CFG_CMD(PwrCfgCmd))
++ {
++ case PWR_CMD_READ:
++ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
++ break;
++
++ case PWR_CMD_WRITE:
++ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
++ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
++
++#ifdef CONFIG_SDIO_HCI
++ //
++ // <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface
++ // 2011.07.07.
++ //
++ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
++ {
++ // Read Back SDIO Local value
++ value = SdioLocalCmd52Read1Byte(padapter, offset);
++
++ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
++ value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
++
++ // Write Back SDIO Local value
++ SdioLocalCmd52Write1Byte(padapter, offset, value);
++ }
++ else
++#endif
++ {
++ // Read the value from system register
++ value = rtw_read8(padapter, offset);
++
++ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
++ value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
++
++ // Write the value back to sytem register
++ rtw_write8(padapter, offset, value);
++ }
++ break;
++
++ case PWR_CMD_POLLING:
++ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
++
++ bPollingBit = _FALSE;
++ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
++
++ do {
++#ifdef CONFIG_SDIO_HCI
++ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
++ value = SdioLocalCmd52Read1Byte(padapter, offset);
++ else
++#endif
++ value = rtw_read8(padapter, offset);
++
++ value &= GET_PWR_CFG_MASK(PwrCfgCmd);
++ if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
++ bPollingBit = _TRUE;
++ else
++ rtw_udelay_os(10);
++
++ if (pollingCount++ > maxPollingCnt) {
++ RT_TRACE(_module_hal_init_c_ , _drv_err_, ("Fail to polling Offset[%#x]\n", offset));
++ return _FALSE;
++ }
++ } while (!bPollingBit);
++
++ break;
++
++ case PWR_CMD_DELAY:
++ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
++ if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
++ rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
++ else
++ rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
++ break;
++
++ case PWR_CMD_END:
++ // When this command is parsed, end the process
++ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
++ return _TRUE;
++ break;
++
++ default:
++ RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
++ break;
++ }
++ }
++
++ AryIdx++;//Add Array Index
++ }while(1);
++
++ return _TRUE;
++}
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/dm.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/dm.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/dm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/dm.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,313 @@
+/******************************************************************************
+ *
@@ -114872,9 +123678,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/dm.c linux-xbian-rpi/dr
+ return;
+#endif /* CONFIG_DM_ADAPTIVITY */
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/dm.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/dm.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/dm.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/dm.h 2015-07-28 01:20:58.305654202 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/dm.h linux-rpi/drivers/net/wireless/rtl8192cu/hal/dm.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/dm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/dm.h 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,30 @@
+/******************************************************************************
+ *
@@ -114906,9 +123712,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/dm.h linux-xbian-rpi/dr
+void dm_adaptivity(_adapter *pAdapter);
+
+#endif /* __DM_H__ */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/hal_com.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/hal_com.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/hal_com.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/hal_com.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/hal_com.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/hal_com.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/hal_com.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/hal_com.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,370 @@
+/******************************************************************************
+ *
@@ -115280,9 +124086,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/hal_com.c linux-xbian-r
+exit:
+ return ret;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/hal_intf.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/hal_intf.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/hal_intf.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/hal_intf.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/hal_intf.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/hal_intf.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/hal_intf.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/hal_intf.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,545 @@
+/******************************************************************************
+ *
@@ -115829,188 +124635,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/hal_intf.c linux-xbian-
+{
+ return adapter->HalFunc.c2h_id_filter_ccx;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/HalPwrSeqCmd.c 2015-07-28 01:20:58.305654202 +0200
-@@ -0,0 +1,175 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+/*++
-+Copyright (c) Realtek Semiconductor Corp. All rights reserved.
-+
-+Module Name:
-+ HalPwrSeqCmd.c
-+
-+Abstract:
-+ Implement HW Power sequence configuration CMD handling routine for Realtek devices.
-+
-+Major Change History:
-+ When Who What
-+ ---------- --------------- -------------------------------
-+ 2011-10-26 Lucas Modify to be compatible with SD4-CE driver.
-+ 2011-07-07 Roger Create.
-+
-+--*/
-+#include <HalPwrSeqCmd.h>
-+#include <sdio_ops.h>
-+
-+
-+//
-+// Description:
-+// This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
-+//
-+// Assumption:
-+// We should follow specific format which was released from HW SD.
-+//
-+// 2011.07.07, added by Roger.
-+//
-+u8 HalPwrSeqCmdParsing(
-+ PADAPTER padapter,
-+ u8 CutVersion,
-+ u8 FabVersion,
-+ u8 InterfaceType,
-+ WLAN_PWR_CFG PwrSeqCmd[])
-+{
-+ WLAN_PWR_CFG PwrCfgCmd = {0};
-+ u8 bPollingBit = _FALSE;
-+ u32 AryIdx = 0;
-+ u8 value = 0;
-+ u32 offset = 0;
-+ u32 pollingCount = 0; // polling autoload done.
-+ u32 maxPollingCnt = 5000;
-+
-+ do {
-+ PwrCfgCmd = PwrSeqCmd[AryIdx];
-+
-+ RT_TRACE(_module_hal_init_c_ , _drv_info_,
-+ ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
-+ GET_PWR_CFG_OFFSET(PwrCfgCmd),
-+ GET_PWR_CFG_CUT_MASK(PwrCfgCmd),
-+ GET_PWR_CFG_FAB_MASK(PwrCfgCmd),
-+ GET_PWR_CFG_INTF_MASK(PwrCfgCmd),
-+ GET_PWR_CFG_BASE(PwrCfgCmd),
-+ GET_PWR_CFG_CMD(PwrCfgCmd),
-+ GET_PWR_CFG_MASK(PwrCfgCmd),
-+ GET_PWR_CFG_VALUE(PwrCfgCmd)));
-+
-+ //2 Only Handle the command whose FAB, CUT, and Interface are matched
-+ if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
-+ (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
-+ (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType))
-+ {
-+ switch (GET_PWR_CFG_CMD(PwrCfgCmd))
-+ {
-+ case PWR_CMD_READ:
-+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
-+ break;
-+
-+ case PWR_CMD_WRITE:
-+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
-+ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
-+
-+#ifdef CONFIG_SDIO_HCI
-+ //
-+ // <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface
-+ // 2011.07.07.
-+ //
-+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
-+ {
-+ // Read Back SDIO Local value
-+ value = SdioLocalCmd52Read1Byte(padapter, offset);
-+
-+ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
-+ value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
-+
-+ // Write Back SDIO Local value
-+ SdioLocalCmd52Write1Byte(padapter, offset, value);
-+ }
-+ else
-+#endif
-+ {
-+ // Read the value from system register
-+ value = rtw_read8(padapter, offset);
-+
-+ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
-+ value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
-+
-+ // Write the value back to sytem register
-+ rtw_write8(padapter, offset, value);
-+ }
-+ break;
-+
-+ case PWR_CMD_POLLING:
-+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
-+
-+ bPollingBit = _FALSE;
-+ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
-+
-+ do {
-+#ifdef CONFIG_SDIO_HCI
-+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
-+ value = SdioLocalCmd52Read1Byte(padapter, offset);
-+ else
-+#endif
-+ value = rtw_read8(padapter, offset);
-+
-+ value &= GET_PWR_CFG_MASK(PwrCfgCmd);
-+ if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
-+ bPollingBit = _TRUE;
-+ else
-+ rtw_udelay_os(10);
-+
-+ if (pollingCount++ > maxPollingCnt) {
-+ RT_TRACE(_module_hal_init_c_ , _drv_err_, ("Fail to polling Offset[%#x]\n", offset));
-+ return _FALSE;
-+ }
-+ } while (!bPollingBit);
-+
-+ break;
-+
-+ case PWR_CMD_DELAY:
-+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
-+ if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
-+ rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
-+ else
-+ rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000);
-+ break;
-+
-+ case PWR_CMD_END:
-+ // When this command is parsed, end the process
-+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
-+ return _TRUE;
-+ break;
-+
-+ default:
-+ RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
-+ break;
-+ }
-+ }
-+
-+ AryIdx++;//Add Array Index
-+ }while(1);
-+
-+ return _TRUE;
-+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,1154 @@
+/******************************************************************************
+ *
@@ -117166,9 +125793,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_cmd.c
+}
+
+#endif //CONFIG_WOWLAN
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,5055 @@
+/******************************************************************************
+ *
@@ -122225,9 +130852,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_dm.c
+ }
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,3627 @@
+/******************************************************************************
+ *
@@ -125856,9 +134483,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_i
+ pHalFunc->c2h_handler = c2h_handler_8192c;
+ pHalFunc->c2h_id_filter_ccx = c2h_id_filter_ccx_8192c;
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,1207 @@
+/******************************************************************************
+ *
@@ -127067,9 +135694,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_mp.c
+}
+
+#endif // CONFIG_MP_INCLUDE
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,4840 @@
+/******************************************************************************
+ *
@@ -131911,9 +140538,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_phycf
+ _PHY_SetRFPathSwitch(pAdapter, bMain, _FALSE);
+ }
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf6052.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,1030 @@
+/******************************************************************************
+ *
@@ -132945,9 +141572,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rf605
+} /* PHY_RFShadowRead */
+
+/* End of HalRf6052.c */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdesc.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,874 @@
+/******************************************************************************
+ *
@@ -133823,9 +142450,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_rxdes
+ //Offset 20
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_sreset.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,93 @@
+/******************************************************************************
+ *
@@ -133920,9 +142547,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_srese
+ }
+}
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c 2015-07-28 01:20:58.309639981 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.c 2015-08-26 10:26:08.753316330 +0200
@@ -0,0 +1,62 @@
+/******************************************************************************
+ *
@@ -133986,9 +142613,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_xmit.
+ }
+}
+#endif //CONFIG_XMIT_ACK
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,8757 @@
+/******************************************************************************
+ *
@@ -142747,9 +151374,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUH
+0xc78,0x621e001e,
+0xc78,0x621f001e,
+};
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUHWImg_wowlan.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,2557 @@
+/******************************************************************************
+ *
@@ -145308,9 +153935,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/Hal8192CUH
+0x94,0x01,0x40,0x1e,0x90,0xfd,0x11,0xe0,0xb5,0x05,0x14,0x90,0x01,0x17,0xe0,0xb5,
+0x05,0x07,0x90,0xfd,0x11,0xe4,0xf0,0x80,0x06,0xed,0x04,0x90,0xfd,0x11,0xf0,0xe4,
+0x2f,0xff,0x22,0x00,0x18,0x58,};
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_led.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,2674 @@
+/******************************************************************************
+ *
@@ -147986,9 +156613,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_
+ DeInitLed871x( &(ledpriv->SwLed0) );
+ DeInitLed871x( &(ledpriv->SwLed1) );
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_recv.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,227 @@
+/******************************************************************************
+ *
@@ -148217,9 +156844,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_
+#endif
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_xmit.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,1149 @@
+/******************************************************************************
+ *
@@ -149370,9 +157997,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/rtl8192cu_
+
+}
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,6260 @@
+/******************************************************************************
+ *
@@ -155634,9 +164261,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_halini
+_func_exit_;
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,1205 @@
+/******************************************************************************
+ *
@@ -156843,9 +165470,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_ce
+ return ret;
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_linux.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,1535 @@
+/******************************************************************************
+ *
@@ -158382,9 +167009,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_li
+ _func_exit_;
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp.c 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,1264 @@
+/******************************************************************************
+ *
@@ -159650,2581 +168277,18 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/hal/rtl8192c/usb/usb_ops_xp
+ return ret;
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 linux-xbian-rpi/drivers/net/wireless/rtl8192cu/ifcfg-wlan0
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 2015-07-28 01:20:58.313625760 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 linux-rpi/drivers/net/wireless/rtl8192cu/ifcfg-wlan0
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/ifcfg-wlan0 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,4 @@
+#DHCP client
+DEVICE=wlan0
+BOOTPROTO=dhcp
+ONBOOT=yes
\ No newline at end of file
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/autoconf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/autoconf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/autoconf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/autoconf.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,336 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+
-+/*
-+ * Public General Config
-+ */
-+#define AUTOCONF_INCLUDED
-+#define RTL871X_MODULE_NAME "92CU"
-+#define DRV_NAME "rtl8192cu"
-+
-+#define CONFIG_USB_HCI 1
-+
-+#define CONFIG_RTL8192C 1
-+
-+#define PLATFORM_LINUX 1
-+
-+//#define CONFIG_IOCTL_CFG80211 1
-+#ifdef CONFIG_IOCTL_CFG80211
-+ //#define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */
-+ #define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
-+ //#define CONFIG_DEBUG_CFG80211 1
-+ //#define CONFIG_DRV_ISSUE_PROV_REQ // IOT FOR S2
-+ #define CONFIG_SET_SCAN_DENY_TIMER
-+#endif
-+
-+/*
-+ * Internal General Config
-+ */
-+//#define CONFIG_PWRCTRL
-+//#define CONFIG_H2CLBK
-+
-+#define CONFIG_EMBEDDED_FWIMG 1
-+//#define CONFIG_FILE_FWIMG
-+
-+#ifdef CONFIG_WAKE_ON_WLAN
-+#define CONFIG_WOWLAN 1
-+#endif //CONFIG_WAKE_ON_WLAN
-+
-+#define CONFIG_R871X_TEST 1
-+
-+#define CONFIG_XMIT_ACK
-+#ifdef CONFIG_XMIT_ACK
-+ #define CONFIG_XMIT_ACK_POLLING
-+ #define CONFIG_ACTIVE_KEEP_ALIVE_CHECK
-+#endif
-+
-+#define CONFIG_80211N_HT 1
-+
-+#define CONFIG_RECV_REORDERING_CTRL 1
-+
-+//#define CONFIG_TCP_CSUM_OFFLOAD_RX 1
-+
-+//#define CONFIG_BEFORE_LINKED_DIG
-+//#define CONFIG_DRVEXT_MODULE 1
-+
-+#ifndef CONFIG_MP_INCLUDED
-+ #define CONFIG_IPS 1
-+ #ifdef CONFIG_IPS
-+ //#define CONFIG_IPS_LEVEL_2 1 //enable this to set default IPS mode to IPS_LEVEL_2
-+ #endif
-+
-+ #define SUPPORT_HW_RFOFF_DETECTED 1
-+
-+ #define CONFIG_LPS 1
-+ #define CONFIG_BT_COEXIST 1
-+
-+ //befor link
-+ #define CONFIG_ANTENNA_DIVERSITY
-+
-+ //after link
-+ #ifdef CONFIG_ANTENNA_DIVERSITY
-+ #define CONFIG_SW_ANTENNA_DIVERSITY
-+ //#define CONFIG_HW_ANTENNA_DIVERSITY
-+ #endif
-+
-+ #define CONFIG_IOL
-+#else //#ifndef CONFIG_MP_INCLUDED
-+ #define CONFIG_MP_IWPRIV_SUPPORT 1
-+#endif //#ifndef CONFIG_MP_INCLUDED
-+
-+#define CONFIG_AP_MODE 1
-+#ifdef CONFIG_AP_MODE
-+ #define CONFIG_NATIVEAP_MLME 1
-+ #ifndef CONFIG_NATIVEAP_MLME
-+ #define CONFIG_HOSTAPD_MLME 1
-+ #endif
-+ #define CONFIG_FIND_BEST_CHANNEL 1
-+ //#define CONFIG_NO_WIRELESS_HANDLERS 1
-+#endif
-+
-+// Added by Albert 20110314
-+#define CONFIG_P2P 1
-+#ifdef CONFIG_P2P
-+ //Added by Albert 20110812
-+ //The CONFIG_WFD is for supporting the Wi-Fi display
-+ #define CONFIG_WFD
-+
-+ #ifndef CONFIG_WIFI_TEST
-+ #define CONFIG_P2P_REMOVE_GROUP_INFO
-+ #endif
-+ //#define CONFIG_DBG_P2P
-+
-+ //#define CONFIG_P2P_PS
-+ //#define CONFIG_P2P_IPS
-+
-+ #define P2P_OP_CHECK_SOCIAL_CH
-+ // Added comment by Borg 2013/06/21
-+ // Issue: Nexus 4 is hard to do miracast.
-+ // Root Cause: After group formation,
-+ // Nexus 4 is possible to be not at OP channel of Invitation Resp/Nego Confirm but at social channel.
-+ // Patch: While scan OP channel,
-+ // not only scan OP channel of Invitation Resp/Nego Confirm,
-+ // but also scan social channel(1, 6, 11)
-+#endif
-+
-+// Added by Kurt 20110511
-+//#define CONFIG_TDLS 1
-+#ifdef CONFIG_TDLS
-+// #ifndef CONFIG_WFD
-+// #define CONFIG_WFD 1
-+// #endif
-+// #define CONFIG_TDLS_AUTOSETUP 1
-+// #define CONFIG_TDLS_AUTOCHECKALIVE 1
-+#endif
-+
-+#define CONFIG_SKB_COPY 1//for amsdu
-+
-+#define CONFIG_LED
-+#ifdef CONFIG_LED
-+ #define CONFIG_SW_LED
-+ #ifdef CONFIG_SW_LED
-+ //#define CONFIG_LED_HANDLED_BY_CMD_THREAD
-+ #endif
-+#endif // CONFIG_LED
-+
-+
-+
-+#define USB_INTERFERENCE_ISSUE // this should be checked in all usb interface
-+#define CONFIG_GLOBAL_UI_PID
-+
-+#define CONFIG_LAYER2_ROAMING
-+#define CONFIG_LAYER2_ROAMING_RESUME
-+//#define CONFIG_ADAPTOR_INFO_CACHING_FILE // now just applied on 8192cu only, should make it general...
-+//#define CONFIG_RESUME_IN_WORKQUEUE
-+//#define CONFIG_SET_SCAN_DENY_TIMER
-+#define CONFIG_LONG_DELAY_ISSUE
-+#define CONFIG_NEW_SIGNAL_STAT_PROCESS
-+//#define CONFIG_SIGNAL_DISPLAY_DBM //display RX signal with dbm
-+#define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable */
-+#define CONFIG_DEAUTH_BEFORE_CONNECT
-+
-+#ifdef CONFIG_IOL
-+ #define CONFIG_IOL_LLT
-+ #define CONFIG_IOL_MAC
-+ #define CONFIG_IOL_BB_PHY_REG
-+ #define CONFIG_IOL_BB_AGC_TAB
-+ #define CONFIG_IOL_RF_RF90_PATH_A
-+ #define CONFIG_IOL_RF_RF90_PATH_B
-+#endif
-+
-+#define CONFIG_BR_EXT 1 // Enable NAT2.5 support for STA mode interface with a L2 Bridge
-+#ifdef CONFIG_BR_EXT
-+#define CONFIG_BR_EXT_BRNAME "br0"
-+#endif // CONFIG_BR_EXT
-+
-+#define CONFIG_TX_MCAST2UNI 1 // Support IP multicast->unicast
-+//#define CONFIG_DM_ADAPTIVITY
-+//#define CONFIG_CHECK_AC_LIFETIME 1 // Check packet lifetime of 4 ACs.
-+
-+//#define CONFIG_CONCURRENT_MODE 1
-+#ifdef CONFIG_CONCURRENT_MODE
-+ #define CONFIG_TSF_RESET_OFFLOAD 1 // For 2 PORT TSF SYNC.
-+ //#define CONFIG_HWPORT_SWAP //Port0->Sec , Port1 -> Pri
-+ //#define CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
-+ //#define CONFIG_MULTI_VIR_IFACES //besides primary&secondary interfaces, extend to support more interfaces
-+#endif // CONFIG_CONCURRENT_MODE
-+
-+#define CONFIG_80211D
-+
-+/*
-+ * Interface Related Config
-+ */
-+
-+//#define CONFIG_USB_ONE_OUT_EP
-+//#define CONFIG_USB_INTERRUPT_IN_PIPE 1
-+
-+#ifndef CONFIG_MINIMAL_MEMORY_USAGE
-+ #define CONFIG_USB_TX_AGGREGATION 1
-+ #define CONFIG_USB_RX_AGGREGATION 1
-+#endif
-+
-+#define CONFIG_PREALLOC_RECV_SKB 1
-+//#define CONFIG_REDUCE_USB_TX_INT 1 // Trade-off: Improve performance, but may cause TX URBs blocked by USB Host/Bus driver on few platforms.
-+//#define CONFIG_EASY_REPLACEMENT 1
-+
-+/*
-+ * CONFIG_USE_USB_BUFFER_ALLOC_XX uses Linux USB Buffer alloc API and is for Linux platform only now!
-+ */
-+//#define CONFIG_USE_USB_BUFFER_ALLOC_TX 1 // Trade-off: For TX path, improve stability on some platforms, but may cause performance degrade on other platforms.
-+//#define CONFIG_USE_USB_BUFFER_ALLOC_RX 1 // For RX path
-+#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
-+#undef CONFIG_PREALLOC_RECV_SKB
-+#endif
-+
-+/*
-+ * USB VENDOR REQ BUFFER ALLOCATION METHOD
-+ * if not set we'll use function local variable (stack memory)
-+ */
-+//#define CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
-+#define CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
-+
-+#define CONFIG_USB_VENDOR_REQ_MUTEX
-+#define CONFIG_VENDOR_REQ_RETRY
-+
-+//#define CONFIG_USB_SUPPORT_ASYNC_VDN_REQ 1
-+
-+
-+/*
-+ * HAL Related Config
-+ */
-+
-+#define RTL8192C_RX_PACKET_NO_INCLUDE_CRC 1
-+
-+#define SUPPORTED_BLOCK_IO
-+
-+
-+
-+#define RTL8192CU_FW_DOWNLOAD_ENABLE 1
-+
-+#define CONFIG_ONLY_ONE_OUT_EP_TO_LOW 0
-+
-+#define CONFIG_OUT_EP_WIFI_MODE 0
-+
-+#define ENABLE_USB_DROP_INCORRECT_OUT 0
-+
-+#define RTL8192CU_ASIC_VERIFICATION 0 // For ASIC verification.
-+
-+#define RTL8192CU_ADHOC_WORKAROUND_SETTING 1
-+
-+#define DISABLE_BB_RF 0
-+
-+#define RTL8191C_FPGA_NETWORKTYPE_ADHOC 0
-+
-+#ifdef CONFIG_MP_INCLUDED
-+ #define MP_DRIVER 1
-+ #undef CONFIG_USB_TX_AGGREGATION
-+ #undef CONFIG_USB_RX_AGGREGATION
-+#else
-+ #define MP_DRIVER 0
-+#endif
-+
-+
-+/*
-+ * Platform Related Config
-+ */
-+#ifdef CONFIG_PLATFORM_MN10300
-+#define CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV
-+
-+#if defined (CONFIG_SW_ANTENNA_DIVERSITY)
-+ #undef CONFIG_SW_ANTENNA_DIVERSITY
-+ #define CONFIG_HW_ANTENNA_DIVERSITY
-+#endif
-+
-+#endif
-+
-+#ifdef CONFIG_WISTRON_PLATFORM
-+
-+#endif
-+
-+#ifdef CONFIG_PLATFORM_TI_DM365
-+#define CONFIG_USE_USB_BUFFER_ALLOC_RX 1
-+#endif
-+
-+#define CONFIG_ATTEMPT_TO_FIX_AP_BEACON_ERROR
-+
-+/*
-+ * Debug Related Config
-+ */
-+//#define CONFIG_DEBUG_RTL871X
-+
-+#define DBG 0
-+//#define CONFIG_DEBUG_RTL819X
-+
-+//#define CONFIG_PROC_DEBUG 1
-+
-+//#define DBG_IO
-+//#define DBG_DELAY_OS
-+//#define DBG_MEM_ALLOC
-+//#define DBG_IOCTL
-+
-+//#define DBG_TX
-+//#define DBG_XMIT_BUF
-+//#define DBG_TX_DROP_FRAME
-+
-+//#define DBG_RX_DROP_FRAME
-+//#define DBG_RX_SEQ
-+//#define DBG_RX_SIGNAL_DISPLAY_PROCESSING
-+//#define DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED "jeff-ap"
-+
-+//#define DBG_EXPIRATION_CHK
-+
-+
-+//#define DBG_SHOW_MCUFWDL_BEFORE_51_ENABLE
-+//#define DBG_ROAMING_TEST
-+
-+//#define DBG_HAL_INIT_PROFILING
-+
-+//#define DBG_MEMORY_LEAK 1
-+
-+#define DBG_CONFIG_ERROR_DETECT
-+//#define DBG_CONFIG_ERROR_RESET
-+
-+//TX use 1 urb
-+//#define CONFIG_SINGLE_XMIT_BUF
-+//RX use 1 urb
-+//#define CONFIG_SINGLE_RECV_BUF
-+
-+//turn off power tracking when traffic is busy
-+//#define CONFIG_BUSY_TRAFFIC_SKIP_PWR_TRACK
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/basic_types.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/basic_types.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/basic_types.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/basic_types.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,320 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __BASIC_TYPES_H__
-+#define __BASIC_TYPES_H__
-+
-+#include <drv_conf.h>
-+
-+
-+#define SUCCESS 0
-+#define FAIL (-1)
-+
-+#ifndef TRUE
-+ #define _TRUE 1
-+#else
-+ #define _TRUE TRUE
-+#endif
-+
-+#ifndef FALSE
-+ #define _FALSE 0
-+#else
-+ #define _FALSE FALSE
-+#endif
-+
-+#ifdef PLATFORM_WINDOWS
-+
-+ typedef signed char s8;
-+ typedef unsigned char u8;
-+
-+ typedef signed short s16;
-+ typedef unsigned short u16;
-+
-+ typedef signed long s32;
-+ typedef unsigned long u32;
-+
-+ typedef unsigned int uint;
-+ typedef signed int sint;
-+
-+
-+ typedef signed long long s64;
-+ typedef unsigned long long u64;
-+
-+ #ifdef NDIS50_MINIPORT
-+
-+ #define NDIS_MAJOR_VERSION 5
-+ #define NDIS_MINOR_VERSION 0
-+
-+ #endif
-+
-+ #ifdef NDIS51_MINIPORT
-+
-+ #define NDIS_MAJOR_VERSION 5
-+ #define NDIS_MINOR_VERSION 1
-+
-+ #endif
-+
-+ typedef NDIS_PROC proc_t;
-+
-+ typedef LONG atomic_t;
-+
-+#endif
-+
-+
-+#ifdef PLATFORM_LINUX
-+
-+ #include <linux/types.h>
-+ #define IN
-+ #define OUT
-+ #define VOID void
-+ #define NDIS_OID uint
-+ #define NDIS_STATUS uint
-+
-+ typedef signed int sint;
-+
-+ #ifndef PVOID
-+ typedef void * PVOID;
-+ //#define PVOID (void *)
-+ #endif
-+
-+ #define UCHAR u8
-+ #define USHORT u16
-+ #define UINT u32
-+ #define ULONG u32
-+
-+ typedef void (*proc_t)(void*);
-+
-+ typedef __kernel_size_t SIZE_T;
-+ typedef __kernel_ssize_t SSIZE_T;
-+ #define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
-+
-+#endif
-+
-+
-+#ifdef PLATFORM_FREEBSD
-+
-+ typedef signed char s8;
-+ typedef unsigned char u8;
-+
-+ typedef signed short s16;
-+ typedef unsigned short u16;
-+
-+ typedef signed int s32;
-+ typedef unsigned int u32;
-+
-+ typedef unsigned int uint;
-+ typedef signed int sint;
-+ typedef long atomic_t;
-+
-+ typedef signed long long s64;
-+ typedef unsigned long long u64;
-+ #define IN
-+ #define OUT
-+ #define VOID void
-+ #define NDIS_OID uint
-+ #define NDIS_STATUS uint
-+
-+ #ifndef PVOID
-+ typedef void * PVOID;
-+ //#define PVOID (void *)
-+ #endif
-+ typedef u32 dma_addr_t;
-+ #define UCHAR u8
-+ #define USHORT u16
-+ #define UINT u32
-+ #define ULONG u32
-+
-+ typedef void (*proc_t)(void*);
-+
-+ typedef unsigned int __kernel_size_t;
-+ typedef int __kernel_ssize_t;
-+
-+ typedef __kernel_size_t SIZE_T;
-+ typedef __kernel_ssize_t SSIZE_T;
-+ #define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
-+
-+#endif
-+
-+#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
-+#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
-+
-+#define SIZE_PTR SIZE_T
-+#define SSIZE_PTR SSIZE_T
-+
-+//port from fw by thomas
-+// TODO: Belows are Sync from SD7-Driver. It is necessary to check correctness
-+
-+/*
-+ * Call endian free function when
-+ * 1. Read/write packet content.
-+ * 2. Before write integer to IO.
-+ * 3. After read integer from IO.
-+*/
-+
-+//
-+// Byte Swapping routine.
-+//
-+#define EF1Byte
-+#define EF2Byte le16_to_cpu
-+#define EF4Byte le32_to_cpu
-+
-+//
-+// Read LE format data from memory
-+//
-+#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr)))
-+#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr)))
-+#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr)))
-+
-+//
-+// Write LE data to memory
-+//
-+#define WriteEF1Byte(_ptr, _val) (*((u8 *)(_ptr)))=EF1Byte(_val)
-+#define WriteEF2Byte(_ptr, _val) (*((u16 *)(_ptr)))=EF2Byte(_val)
-+#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val)
-+
-+//
-+// Example:
-+// BIT_LEN_MASK_32(0) => 0x00000000
-+// BIT_LEN_MASK_32(1) => 0x00000001
-+// BIT_LEN_MASK_32(2) => 0x00000003
-+// BIT_LEN_MASK_32(32) => 0xFFFFFFFF
-+//
-+#define BIT_LEN_MASK_32(__BitLen) \
-+ (0xFFFFFFFF >> (32 - (__BitLen)))
-+//
-+// Example:
-+// BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
-+// BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
-+//
-+#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \
-+ (BIT_LEN_MASK_32(__BitLen) << (__BitOffset))
-+
-+//
-+// Description:
-+// Return 4-byte value in host byte ordering from
-+// 4-byte pointer in litten-endian system.
-+//
-+#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
-+ (EF4Byte(*((u32 *)(__pStart))))
-+
-+//
-+// Description:
-+// Translate subfield (continuous bits in little-endian) of 4-byte value in litten byte to
-+// 4-byte value in host byte ordering.
-+//
-+#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
-+ ( \
-+ ( LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset) ) \
-+ & \
-+ BIT_LEN_MASK_32(__BitLen) \
-+ )
-+
-+//
-+// Description:
-+// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering
-+// and return the result in 4-byte value in host byte ordering.
-+//
-+#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
-+ ( \
-+ LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
-+ & \
-+ ( ~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ) \
-+ )
-+
-+//
-+// Description:
-+// Set subfield of little-endian 4-byte value to specified value.
-+//
-+#define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \
-+ *((u32 *)(__pStart)) = \
-+ EF4Byte( \
-+ LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
-+ | \
-+ ( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \
-+ );
-+
-+
-+#define BIT_LEN_MASK_16(__BitLen) \
-+ (0xFFFF >> (16 - (__BitLen)))
-+
-+#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \
-+ (BIT_LEN_MASK_16(__BitLen) << (__BitOffset))
-+
-+#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
-+ (EF2Byte(*((u16 *)(__pStart))))
-+
-+#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
-+ ( \
-+ ( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \
-+ & \
-+ BIT_LEN_MASK_16(__BitLen) \
-+ )
-+
-+#define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
-+ ( \
-+ LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
-+ & \
-+ ( ~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ) \
-+ )
-+
-+#define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \
-+ *((u16 *)(__pStart)) = \
-+ EF2Byte( \
-+ LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
-+ | \
-+ ( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \
-+ );
-+
-+#define BIT_LEN_MASK_8(__BitLen) \
-+ (0xFF >> (8 - (__BitLen)))
-+
-+#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \
-+ (BIT_LEN_MASK_8(__BitLen) << (__BitOffset))
-+
-+#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
-+ (EF1Byte(*((u8 *)(__pStart))))
-+
-+#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
-+ ( \
-+ ( LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset) ) \
-+ & \
-+ BIT_LEN_MASK_8(__BitLen) \
-+ )
-+
-+#define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
-+ ( \
-+ LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
-+ & \
-+ ( ~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ) \
-+ )
-+
-+#define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \
-+ *((u8 *)(__pStart)) = \
-+ EF1Byte( \
-+ LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
-+ | \
-+ ( (((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset) ) \
-+ );
-+
-+// Get the N-bytes aligment offset from the current length
-+#define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : (((__Value + __Aligment - 1) / __Aligment) * __Aligment))
-+
-+typedef unsigned char BOOLEAN,*PBOOLEAN;
-+
-+#endif //__BASIC_TYPES_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,87 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
-+#define _LINUX_BYTEORDER_BIG_ENDIAN_H
-+
-+#ifndef __BIG_ENDIAN
-+#define __BIG_ENDIAN 4321
-+#endif
-+#ifndef __BIG_ENDIAN_BITFIELD
-+#define __BIG_ENDIAN_BITFIELD
-+#endif
-+
-+#include <byteorder/swab.h>
-+
-+#define __constant_htonl(x) ((__u32)(x))
-+#define __constant_ntohl(x) ((__u32)(x))
-+#define __constant_htons(x) ((__u16)(x))
-+#define __constant_ntohs(x) ((__u16)(x))
-+#define __constant_cpu_to_le64(x) ___constant_swab64((x))
-+#define __constant_le64_to_cpu(x) ___constant_swab64((x))
-+#define __constant_cpu_to_le32(x) ___constant_swab32((x))
-+#define __constant_le32_to_cpu(x) ___constant_swab32((x))
-+#define __constant_cpu_to_le16(x) ___constant_swab16((x))
-+#define __constant_le16_to_cpu(x) ___constant_swab16((x))
-+#define __constant_cpu_to_be64(x) ((__u64)(x))
-+#define __constant_be64_to_cpu(x) ((__u64)(x))
-+#define __constant_cpu_to_be32(x) ((__u32)(x))
-+#define __constant_be32_to_cpu(x) ((__u32)(x))
-+#define __constant_cpu_to_be16(x) ((__u16)(x))
-+#define __constant_be16_to_cpu(x) ((__u16)(x))
-+#define __cpu_to_le64(x) __swab64((x))
-+#define __le64_to_cpu(x) __swab64((x))
-+#define __cpu_to_le32(x) __swab32((x))
-+#define __le32_to_cpu(x) __swab32((x))
-+#define __cpu_to_le16(x) __swab16((x))
-+#define __le16_to_cpu(x) __swab16((x))
-+#define __cpu_to_be64(x) ((__u64)(x))
-+#define __be64_to_cpu(x) ((__u64)(x))
-+#define __cpu_to_be32(x) ((__u32)(x))
-+#define __be32_to_cpu(x) ((__u32)(x))
-+#define __cpu_to_be16(x) ((__u16)(x))
-+#define __be16_to_cpu(x) ((__u16)(x))
-+#define __cpu_to_le64p(x) __swab64p((x))
-+#define __le64_to_cpup(x) __swab64p((x))
-+#define __cpu_to_le32p(x) __swab32p((x))
-+#define __le32_to_cpup(x) __swab32p((x))
-+#define __cpu_to_le16p(x) __swab16p((x))
-+#define __le16_to_cpup(x) __swab16p((x))
-+#define __cpu_to_be64p(x) (*(__u64*)(x))
-+#define __be64_to_cpup(x) (*(__u64*)(x))
-+#define __cpu_to_be32p(x) (*(__u32*)(x))
-+#define __be32_to_cpup(x) (*(__u32*)(x))
-+#define __cpu_to_be16p(x) (*(__u16*)(x))
-+#define __be16_to_cpup(x) (*(__u16*)(x))
-+#define __cpu_to_le64s(x) __swab64s((x))
-+#define __le64_to_cpus(x) __swab64s((x))
-+#define __cpu_to_le32s(x) __swab32s((x))
-+#define __le32_to_cpus(x) __swab32s((x))
-+#define __cpu_to_le16s(x) __swab16s((x))
-+#define __le16_to_cpus(x) __swab16s((x))
-+#define __cpu_to_be64s(x) do {} while (0)
-+#define __be64_to_cpus(x) do {} while (0)
-+#define __cpu_to_be32s(x) do {} while (0)
-+#define __be32_to_cpus(x) do {} while (0)
-+#define __cpu_to_be16s(x) do {} while (0)
-+#define __be16_to_cpus(x) do {} while (0)
-+
-+#include <byteorder/generic.h>
-+
-+#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,212 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _LINUX_BYTEORDER_GENERIC_H
-+#define _LINUX_BYTEORDER_GENERIC_H
-+
-+/*
-+ * linux/byteorder_generic.h
-+ * Generic Byte-reordering support
-+ *
-+ * Francois-Rene Rideau <fare@tunes.org> 19970707
-+ * gathered all the good ideas from all asm-foo/byteorder.h into one file,
-+ * cleaned them up.
-+ * I hope it is compliant with non-GCC compilers.
-+ * I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
-+ * because I wasn't sure it would be ok to put it in types.h
-+ * Upgraded it to 2.1.43
-+ * Francois-Rene Rideau <fare@tunes.org> 19971012
-+ * Upgraded it to 2.1.57
-+ * to please Linus T., replaced huge #ifdef's between little/big endian
-+ * by nestedly #include'd files.
-+ * Francois-Rene Rideau <fare@tunes.org> 19971205
-+ * Made it to 2.1.71; now a facelift:
-+ * Put files under include/linux/byteorder/
-+ * Split swab from generic support.
-+ *
-+ * TODO:
-+ * = Regular kernel maintainers could also replace all these manual
-+ * byteswap macros that remain, disseminated among drivers,
-+ * after some grep or the sources...
-+ * = Linus might want to rename all these macros and files to fit his taste,
-+ * to fit his personal naming scheme.
-+ * = it seems that a few drivers would also appreciate
-+ * nybble swapping support...
-+ * = every architecture could add their byteswap macro in asm/byteorder.h
-+ * see how some architectures already do (i386, alpha, ppc, etc)
-+ * = cpu_to_beXX and beXX_to_cpu might some day need to be well
-+ * distinguished throughout the kernel. This is not the case currently,
-+ * since little endian, big endian, and pdp endian machines needn't it.
-+ * But this might be the case for, say, a port of Linux to 20/21 bit
-+ * architectures (and F21 Linux addict around?).
-+ */
-+
-+/*
-+ * The following macros are to be defined by <asm/byteorder.h>:
-+ *
-+ * Conversion of long and short int between network and host format
-+ * ntohl(__u32 x)
-+ * ntohs(__u16 x)
-+ * htonl(__u32 x)
-+ * htons(__u16 x)
-+ * It seems that some programs (which? where? or perhaps a standard? POSIX?)
-+ * might like the above to be functions, not macros (why?).
-+ * if that's true, then detect them, and take measures.
-+ * Anyway, the measure is: define only ___ntohl as a macro instead,
-+ * and in a separate file, have
-+ * unsigned long inline ntohl(x){return ___ntohl(x);}
-+ *
-+ * The same for constant arguments
-+ * __constant_ntohl(__u32 x)
-+ * __constant_ntohs(__u16 x)
-+ * __constant_htonl(__u32 x)
-+ * __constant_htons(__u16 x)
-+ *
-+ * Conversion of XX-bit integers (16- 32- or 64-)
-+ * between native CPU format and little/big endian format
-+ * 64-bit stuff only defined for proper architectures
-+ * cpu_to_[bl]eXX(__uXX x)
-+ * [bl]eXX_to_cpu(__uXX x)
-+ *
-+ * The same, but takes a pointer to the value to convert
-+ * cpu_to_[bl]eXXp(__uXX x)
-+ * [bl]eXX_to_cpup(__uXX x)
-+ *
-+ * The same, but change in situ
-+ * cpu_to_[bl]eXXs(__uXX x)
-+ * [bl]eXX_to_cpus(__uXX x)
-+ *
-+ * See asm-foo/byteorder.h for examples of how to provide
-+ * architecture-optimized versions
-+ *
-+ */
-+
-+
-+#if defined(PLATFORM_LINUX) || defined(PLATFORM_WINDOWS) || defined(PLATFORM_MPIXEL) || defined(PLATFORM_FREEBSD)
-+/*
-+ * inside the kernel, we can use nicknames;
-+ * outside of it, we must avoid POSIX namespace pollution...
-+ */
-+#define cpu_to_le64 __cpu_to_le64
-+#define le64_to_cpu __le64_to_cpu
-+#define cpu_to_le32 __cpu_to_le32
-+#define le32_to_cpu __le32_to_cpu
-+#define cpu_to_le16 __cpu_to_le16
-+#define le16_to_cpu __le16_to_cpu
-+#define cpu_to_be64 __cpu_to_be64
-+#define be64_to_cpu __be64_to_cpu
-+#define cpu_to_be32 __cpu_to_be32
-+#define be32_to_cpu __be32_to_cpu
-+#define cpu_to_be16 __cpu_to_be16
-+#define be16_to_cpu __be16_to_cpu
-+#define cpu_to_le64p __cpu_to_le64p
-+#define le64_to_cpup __le64_to_cpup
-+#define cpu_to_le32p __cpu_to_le32p
-+#define le32_to_cpup __le32_to_cpup
-+#define cpu_to_le16p __cpu_to_le16p
-+#define le16_to_cpup __le16_to_cpup
-+#define cpu_to_be64p __cpu_to_be64p
-+#define be64_to_cpup __be64_to_cpup
-+#define cpu_to_be32p __cpu_to_be32p
-+#define be32_to_cpup __be32_to_cpup
-+#define cpu_to_be16p __cpu_to_be16p
-+#define be16_to_cpup __be16_to_cpup
-+#define cpu_to_le64s __cpu_to_le64s
-+#define le64_to_cpus __le64_to_cpus
-+#define cpu_to_le32s __cpu_to_le32s
-+#define le32_to_cpus __le32_to_cpus
-+#define cpu_to_le16s __cpu_to_le16s
-+#define le16_to_cpus __le16_to_cpus
-+#define cpu_to_be64s __cpu_to_be64s
-+#define be64_to_cpus __be64_to_cpus
-+#define cpu_to_be32s __cpu_to_be32s
-+#define be32_to_cpus __be32_to_cpus
-+#define cpu_to_be16s __cpu_to_be16s
-+#define be16_to_cpus __be16_to_cpus
-+#endif
-+
-+
-+/*
-+ * Handle ntohl and suches. These have various compatibility
-+ * issues - like we want to give the prototype even though we
-+ * also have a macro for them in case some strange program
-+ * wants to take the address of the thing or something..
-+ *
-+ * Note that these used to return a "long" in libc5, even though
-+ * long is often 64-bit these days.. Thus the casts.
-+ *
-+ * They have to be macros in order to do the constant folding
-+ * correctly - if the argument passed into a inline function
-+ * it is no longer constant according to gcc..
-+ */
-+
-+#undef ntohl
-+#undef ntohs
-+#undef htonl
-+#undef htons
-+
-+/*
-+ * Do the prototypes. Somebody might want to take the
-+ * address or some such sick thing..
-+ */
-+#if defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
-+extern __u32 ntohl(__u32);
-+extern __u32 htonl(__u32);
-+#else //defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
-+#ifndef PLATFORM_FREEBSD
-+extern unsigned long int ntohl(unsigned long int);
-+extern unsigned long int htonl(unsigned long int);
-+#endif
-+#endif
-+#ifndef PLATFORM_FREEBSD
-+extern unsigned short int ntohs(unsigned short int);
-+extern unsigned short int htons(unsigned short int);
-+#endif
-+
-+#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) || defined(PLATFORM_MPIXEL)
-+
-+#define ___htonl(x) __cpu_to_be32(x)
-+#define ___htons(x) __cpu_to_be16(x)
-+#define ___ntohl(x) __be32_to_cpu(x)
-+#define ___ntohs(x) __be16_to_cpu(x)
-+
-+#if defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
-+#define htonl(x) ___htonl(x)
-+#define ntohl(x) ___ntohl(x)
-+#else
-+#define htonl(x) ((unsigned long)___htonl(x))
-+#define ntohl(x) ((unsigned long)___ntohl(x))
-+#endif
-+#define htons(x) ___htons(x)
-+#define ntohs(x) ___ntohs(x)
-+
-+#endif /* OPTIMIZE */
-+
-+
-+#if defined (PLATFORM_WINDOWS)
-+
-+#define htonl(x) __cpu_to_be32(x)
-+#define ntohl(x) __be32_to_cpu(x)
-+#define htons(x) __cpu_to_be16(x)
-+#define ntohs(x) __be16_to_cpu(x)
-+
-+
-+#endif
-+
-+#endif /* _LINUX_BYTEORDER_GENERIC_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,89 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
-+#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
-+
-+#ifndef __LITTLE_ENDIAN
-+#define __LITTLE_ENDIAN 1234
-+#endif
-+#ifndef __LITTLE_ENDIAN_BITFIELD
-+#define __LITTLE_ENDIAN_BITFIELD
-+#endif
-+
-+#include <byteorder/swab.h>
-+
-+#ifndef __constant_htonl
-+#define __constant_htonl(x) ___constant_swab32((x))
-+#define __constant_ntohl(x) ___constant_swab32((x))
-+#define __constant_htons(x) ___constant_swab16((x))
-+#define __constant_ntohs(x) ___constant_swab16((x))
-+#define __constant_cpu_to_le64(x) ((__u64)(x))
-+#define __constant_le64_to_cpu(x) ((__u64)(x))
-+#define __constant_cpu_to_le32(x) ((__u32)(x))
-+#define __constant_le32_to_cpu(x) ((__u32)(x))
-+#define __constant_cpu_to_le16(x) ((__u16)(x))
-+#define __constant_le16_to_cpu(x) ((__u16)(x))
-+#define __constant_cpu_to_be64(x) ___constant_swab64((x))
-+#define __constant_be64_to_cpu(x) ___constant_swab64((x))
-+#define __constant_cpu_to_be32(x) ___constant_swab32((x))
-+#define __constant_be32_to_cpu(x) ___constant_swab32((x))
-+#define __constant_cpu_to_be16(x) ___constant_swab16((x))
-+#define __constant_be16_to_cpu(x) ___constant_swab16((x))
-+#define __cpu_to_le64(x) ((__u64)(x))
-+#define __le64_to_cpu(x) ((__u64)(x))
-+#define __cpu_to_le32(x) ((__u32)(x))
-+#define __le32_to_cpu(x) ((__u32)(x))
-+#define __cpu_to_le16(x) ((__u16)(x))
-+#define __le16_to_cpu(x) ((__u16)(x))
-+#define __cpu_to_be64(x) __swab64((x))
-+#define __be64_to_cpu(x) __swab64((x))
-+#define __cpu_to_be32(x) __swab32((x))
-+#define __be32_to_cpu(x) __swab32((x))
-+#define __cpu_to_be16(x) __swab16((x))
-+#define __be16_to_cpu(x) __swab16((x))
-+#define __cpu_to_le64p(x) (*(__u64*)(x))
-+#define __le64_to_cpup(x) (*(__u64*)(x))
-+#define __cpu_to_le32p(x) (*(__u32*)(x))
-+#define __le32_to_cpup(x) (*(__u32*)(x))
-+#define __cpu_to_le16p(x) (*(__u16*)(x))
-+#define __le16_to_cpup(x) (*(__u16*)(x))
-+#define __cpu_to_be64p(x) __swab64p((x))
-+#define __be64_to_cpup(x) __swab64p((x))
-+#define __cpu_to_be32p(x) __swab32p((x))
-+#define __be32_to_cpup(x) __swab32p((x))
-+#define __cpu_to_be16p(x) __swab16p((x))
-+#define __be16_to_cpup(x) __swab16p((x))
-+#define __cpu_to_le64s(x) do {} while (0)
-+#define __le64_to_cpus(x) do {} while (0)
-+#define __cpu_to_le32s(x) do {} while (0)
-+#define __le32_to_cpus(x) do {} while (0)
-+#define __cpu_to_le16s(x) do {} while (0)
-+#define __le16_to_cpus(x) do {} while (0)
-+#define __cpu_to_be64s(x) __swab64s((x))
-+#define __be64_to_cpus(x) __swab64s((x))
-+#define __cpu_to_be32s(x) __swab32s((x))
-+#define __be32_to_cpus(x) __swab32s((x))
-+#define __cpu_to_be16s(x) __swab16s((x))
-+#define __be16_to_cpus(x) __swab16s((x))
-+#endif // __constant_htonl
-+
-+#include <byteorder/generic.h>
-+
-+#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,156 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _LINUX_BYTEORDER_SWABB_H
-+#define _LINUX_BYTEORDER_SWABB_H
-+
-+/*
-+ * linux/byteorder/swabb.h
-+ * SWAp Bytes Bizarrely
-+ * swaHHXX[ps]?(foo)
-+ *
-+ * Support for obNUXIous pdp-endian and other bizarre architectures.
-+ * Will Linux ever run on such ancient beasts? if not, this file
-+ * will be but a programming pearl. Still, it's a reminder that we
-+ * shouldn't be making too many assumptions when trying to be portable.
-+ *
-+ */
-+
-+/*
-+ * Meaning of the names I chose (vaxlinux people feel free to correct them):
-+ * swahw32 swap 16-bit half-words in a 32-bit word
-+ * swahb32 swap 8-bit halves of each 16-bit half-word in a 32-bit word
-+ *
-+ * No 64-bit support yet. I don't know NUXI conventions for long longs.
-+ * I guarantee it will be a mess when it's there, though :->
-+ * It will be even worse if there are conflicting 64-bit conventions.
-+ * Hopefully, no one ever used 64-bit objects on NUXI machines.
-+ *
-+ */
-+
-+#define ___swahw32(x) \
-+({ \
-+ __u32 __x = (x); \
-+ ((__u32)( \
-+ (((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | \
-+ (((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); \
-+})
-+#define ___swahb32(x) \
-+({ \
-+ __u32 __x = (x); \
-+ ((__u32)( \
-+ (((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | \
-+ (((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); \
-+})
-+
-+#define ___constant_swahw32(x) \
-+ ((__u32)( \
-+ (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
-+ (((__u32)(x) & (__u32)0xffff0000UL) >> 16) ))
-+#define ___constant_swahb32(x) \
-+ ((__u32)( \
-+ (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
-+ (((__u32)(x) & (__u32)0xff00ff00UL) >> 8) ))
-+
-+/*
-+ * provide defaults when no architecture-specific optimization is detected
-+ */
-+#ifndef __arch__swahw32
-+# define __arch__swahw32(x) ___swahw32(x)
-+#endif
-+#ifndef __arch__swahb32
-+# define __arch__swahb32(x) ___swahb32(x)
-+#endif
-+
-+#ifndef __arch__swahw32p
-+# define __arch__swahw32p(x) __swahw32(*(x))
-+#endif
-+#ifndef __arch__swahb32p
-+# define __arch__swahb32p(x) __swahb32(*(x))
-+#endif
-+
-+#ifndef __arch__swahw32s
-+# define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0)
-+#endif
-+#ifndef __arch__swahb32s
-+# define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0)
-+#endif
-+
-+
-+/*
-+ * Allow constant folding
-+ */
-+#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
-+# define __swahw32(x) \
-+(__builtin_constant_p((__u32)(x)) ? \
-+ ___swahw32((x)) : \
-+ __fswahw32((x)))
-+# define __swahb32(x) \
-+(__builtin_constant_p((__u32)(x)) ? \
-+ ___swahb32((x)) : \
-+ __fswahb32((x)))
-+#else
-+# define __swahw32(x) __fswahw32(x)
-+# define __swahb32(x) __fswahb32(x)
-+#endif /* OPTIMIZE */
-+
-+
-+__inline static__ __const__ __u32 __fswahw32(__u32 x)
-+{
-+ return __arch__swahw32(x);
-+}
-+__inline static__ __u32 __swahw32p(__u32 *x)
-+{
-+ return __arch__swahw32p(x);
-+}
-+__inline static__ void __swahw32s(__u32 *addr)
-+{
-+ __arch__swahw32s(addr);
-+}
-+
-+
-+__inline static__ __const__ __u32 __fswahb32(__u32 x)
-+{
-+ return __arch__swahb32(x);
-+}
-+__inline static__ __u32 __swahb32p(__u32 *x)
-+{
-+ return __arch__swahb32p(x);
-+}
-+__inline static__ void __swahb32s(__u32 *addr)
-+{
-+ __arch__swahb32s(addr);
-+}
-+
-+#ifdef __BYTEORDER_HAS_U64__
-+/*
-+ * Not supported yet
-+ */
-+#endif /* __BYTEORDER_HAS_U64__ */
-+
-+#if defined(PLATFORM_LINUX)
-+#define swahw32 __swahw32
-+#define swahb32 __swahb32
-+#define swahw32p __swahw32p
-+#define swahb32p __swahb32p
-+#define swahw32s __swahw32s
-+#define swahb32s __swahb32s
-+#endif
-+
-+#endif /* _LINUX_BYTEORDER_SWABB_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,140 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _LINUX_BYTEORDER_SWAB_H
-+#define _LINUX_BYTEORDER_SWAB_H
-+
-+#if !defined(CONFIG_PLATFORM_MSTAR)
-+#ifndef __u16
-+typedef unsigned short __u16;
-+#endif
-+
-+#ifndef __u32
-+typedef unsigned int __u32;
-+#endif
-+
-+#ifndef __u8
-+typedef unsigned char __u8;
-+#endif
-+
-+#ifndef __u64
-+typedef unsigned long long __u64;
-+#endif
-+
-+
-+__inline static __u16 ___swab16(__u16 x)
-+{
-+ __u16 __x = x;
-+ return
-+ ((__u16)(
-+ (((__u16)(__x) & (__u16)0x00ffU) << 8) |
-+ (((__u16)(__x) & (__u16)0xff00U) >> 8) ));
-+
-+}
-+
-+__inline static __u32 ___swab32(__u32 x)
-+{
-+ __u32 __x = (x);
-+ return ((__u32)(
-+ (((__u32)(__x) & (__u32)0x000000ffUL) << 24) |
-+ (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) |
-+ (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) |
-+ (((__u32)(__x) & (__u32)0xff000000UL) >> 24) ));
-+}
-+
-+__inline static __u64 ___swab64(__u64 x)
-+{
-+ __u64 __x = (x);
-+
-+ return
-+ ((__u64)( \
-+ (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
-+ (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
-+ (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
-+ (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
-+ (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
-+ (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
-+ (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
-+ (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
-+}
-+#endif // CONFIG_PLATFORM_MSTAR
-+
-+#ifndef __arch__swab16
-+__inline static __u16 __arch__swab16(__u16 x)
-+{
-+ return ___swab16(x);
-+}
-+
-+#endif
-+
-+#ifndef __arch__swab32
-+__inline static __u32 __arch__swab32(__u32 x)
-+{
-+ __u32 __tmp = (x) ;
-+ return ___swab32(__tmp);
-+}
-+#endif
-+
-+#ifndef __arch__swab64
-+
-+__inline static __u64 __arch__swab64(__u64 x)
-+{
-+ __u64 __tmp = (x) ;
-+ return ___swab64(__tmp);
-+}
-+
-+
-+#endif
-+
-+#ifndef __swab16
-+#define __swab16(x) __fswab16(x)
-+#define __swab32(x) __fswab32(x)
-+#define __swab64(x) __fswab64(x)
-+#endif // __swab16
-+
-+#ifdef PLATFORM_FREEBSD
-+__inline static __u16 __fswab16(__u16 x)
-+#else
-+__inline static const __u16 __fswab16(__u16 x)
-+#endif //PLATFORM_FREEBSD
-+{
-+ return __arch__swab16(x);
-+}
-+#ifdef PLATFORM_FREEBSD
-+__inline static __u32 __fswab32(__u32 x)
-+#else
-+__inline static const __u32 __fswab32(__u32 x)
-+#endif //PLATFORM_FREEBSD
-+{
-+ return __arch__swab32(x);
-+}
-+
-+#if defined(PLATFORM_LINUX) || defined(PLATFORM_WINDOWS)
-+#define swab16 __swab16
-+#define swab32 __swab32
-+#define swab64 __swab64
-+#define swab16p __swab16p
-+#define swab32p __swab32p
-+#define swab64p __swab64p
-+#define swab16s __swab16s
-+#define swab32s __swab32s
-+#define swab64s __swab64s
-+#endif
-+
-+#endif /* _LINUX_BYTEORDER_SWAB_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/circ_buf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/circ_buf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/circ_buf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/circ_buf.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,27 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __CIRC_BUF_H_
-+#define __CIRC_BUF_H_ 1
-+
-+#define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1))
-+
-+#define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size))
-+
-+#endif //_CIRC_BUF_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,35 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __CMD_OSDEP_H_
-+#define __CMD_OSDEP_H_
-+
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+#include <drv_types.h>
-+
-+extern sint _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv);
-+extern sint _rtw_init_evt_priv(struct evt_priv *pevtpriv);
-+extern void _rtw_free_evt_priv (struct evt_priv *pevtpriv);
-+extern void _rtw_free_cmd_priv (struct cmd_priv *pcmdpriv);
-+extern sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj);
-+extern struct cmd_obj *_rtw_dequeue_cmd(_queue *queue);
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_conf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_conf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_conf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_conf.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,77 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __DRV_CONF_H__
-+#define __DRV_CONF_H__
-+#include "autoconf.h"
-+
-+#if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
-+
-+#error "Shall be Linux or Windows, but not both!\n"
-+
-+#endif
-+
-+//Older Android kernel doesn't has CONFIG_ANDROID defined,
-+//add this to force CONFIG_ANDROID defined
-+#ifdef CONFIG_PLATFORM_ANDROID
-+#define CONFIG_ANDROID
-+#endif
-+
-+#ifdef CONFIG_ANDROID
-+//Some Android build will restart the UI while non-printable ascii is passed
-+//between java and c/c++ layer (JNI). We force CONFIG_VALIDATE_SSID
-+//for Android here. If you are sure there is no risk on your system about this,
-+//mask this macro define to support non-printable ascii ssid.
-+//#define CONFIG_VALIDATE_SSID
-+
-+//Android expect dbm as the rx signal strength unit
-+#define CONFIG_SIGNAL_DISPLAY_DBM
-+#endif
-+
-+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined (CONFIG_RESUME_IN_WORKQUEUE)
-+ #warning "You have CONFIG_HAS_EARLYSUSPEND enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
-+ #undef CONFIG_RESUME_IN_WORKQUEUE
-+#endif
-+
-+#if defined(CONFIG_ANDROID_POWER) && defined (CONFIG_RESUME_IN_WORKQUEUE)
-+ #warning "You have CONFIG_ANDROID_POWER enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
-+ #undef CONFIG_RESUME_IN_WORKQUEUE
-+#endif
-+
-+#ifdef CONFIG_RESUME_IN_WORKQUEUE //this can be removed, because there is no case for this...
-+ #if !defined( CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
-+ #error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
-+ #error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
-+ #endif
-+#endif
-+
-+//About USB VENDOR REQ
-+#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
-+ #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically"
-+ #define CONFIG_USB_VENDOR_REQ_MUTEX
-+#endif
-+#if defined(CONFIG_VENDOR_REQ_RETRY) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
-+ #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_VENDOR_REQ_RETRY automatically"
-+ #define CONFIG_USB_VENDOR_REQ_MUTEX
-+#endif
-+
-+
-+//#include <rtl871x_byteorder.h>
-+
-+#endif // __DRV_CONF_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,92 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __DRV_TYPES_CE_H__
-+#define __DRV_TYPES_CE_H__
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+
-+#include <Sdcardddk.h>
-+
-+#define MAX_ACTIVE_REG_PATH 256
-+
-+#define MAX_MCAST_LIST_NUM 32
-+
-+
-+
-+//for ioctl
-+#define MAKE_DRIVER_VERSION(_MainVer,_MinorVer) ((((u32)(_MainVer))<<16)+_MinorVer)
-+
-+#define NIC_HEADER_SIZE 14 //!< can be moved to typedef.h
-+#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
-+#define NIC_MAX_SEND_PACKETS 10 // max number of send packets the MiniportSendPackets function can accept, can be moved to typedef.h
-+#define NIC_VENDOR_DRIVER_VERSION MAKE_DRIVER_VERSION(0,001) //!< can be moved to typedef.h
-+#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
-+
-+typedef struct _MP_REG_ENTRY
-+{
-+
-+ NDIS_STRING RegName; // variable name text
-+ BOOLEAN bRequired; // 1 -> required, 0 -> optional
-+
-+ u8 Type; // NdisParameterInteger/NdisParameterHexInteger/NdisParameterStringle/NdisParameterMultiString
-+ uint FieldOffset; // offset to MP_ADAPTER field
-+ uint FieldSize; // size (in bytes) of the field
-+
-+#ifdef UNDER_AMD64
-+ u64 Default;
-+#else
-+ u32 Default; // default value to use
-+#endif
-+
-+ u32 Min; // minimum value allowed
-+ u32 Max; // maximum value allowed
-+} MP_REG_ENTRY, *PMP_REG_ENTRY;
-+
-+#ifdef CONFIG_USB_HCI
-+typedef struct _USB_EXTENSION {
-+ LPCUSB_FUNCS _lpUsbFuncs;
-+ USB_HANDLE _hDevice;
-+ PVOID pAdapter;
-+
-+#if 0
-+ USB_ENDPOINT_DESCRIPTOR _endpACLIn;
-+ USB_ENDPOINT_DESCRIPTOR _endpACLOutHigh;
-+ USB_ENDPOINT_DESCRIPTOR _endpACLOutNormal;
-+
-+ USB_PIPE pPipeIn;
-+ USB_PIPE pPipeOutNormal;
-+ USB_PIPE pPipeOutHigh;
-+#endif
-+
-+} USB_EXTENSION, *PUSB_EXTENSION;
-+#endif
-+
-+
-+typedef struct _OCTET_STRING{
-+ u8 *Octet;
-+ u16 Length;
-+} OCTET_STRING, *POCTET_STRING;
-+
-+
-+
-+
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,661 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+/*-------------------------------------------------------------------------------
-+
-+ For type defines and data structure defines
-+
-+--------------------------------------------------------------------------------*/
-+
-+
-+#ifndef __DRV_TYPES_H__
-+#define __DRV_TYPES_H__
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+#include <wlan_bssdef.h>
-+
-+
-+#ifdef PLATFORM_OS_XP
-+#include <drv_types_xp.h>
-+#endif
-+
-+#ifdef PLATFORM_OS_CE
-+#include <drv_types_ce.h>
-+#endif
-+
-+#ifdef PLATFORM_LINUX
-+#include <drv_types_linux.h>
-+#endif
-+
-+enum _NIC_VERSION {
-+
-+ RTL8711_NIC,
-+ RTL8712_NIC,
-+ RTL8713_NIC,
-+ RTL8716_NIC
-+
-+};
-+
-+enum{
-+ UP_LINK,
-+ DOWN_LINK,
-+};
-+typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
-+
-+#ifdef CONFIG_80211N_HT
-+#include <rtw_ht.h>
-+#endif
-+
-+#include <rtw_cmd.h>
-+#include <wlan_bssdef.h>
-+#include <rtw_security.h>
-+#include <rtw_xmit.h>
-+#include <rtw_recv.h>
-+#include <hal_intf.h>
-+#include <hal_com.h>
-+#include <rtw_qos.h>
-+#include <rtw_pwrctrl.h>
-+#include <rtw_io.h>
-+#include <rtw_eeprom.h>
-+#include <sta_info.h>
-+#include <rtw_mlme.h>
-+#include <rtw_debug.h>
-+#include <rtw_rf.h>
-+#include <rtw_event.h>
-+#include <rtw_led.h>
-+#include <rtw_mlme_ext.h>
-+#include <rtw_p2p.h>
-+#include <rtw_tdls.h>
-+#include <rtw_ap.h>
-+
-+#ifdef CONFIG_DRVEXT_MODULE
-+#include <drvext_api.h>
-+#endif
-+
-+#ifdef CONFIG_MP_INCLUDED
-+#include <rtw_mp.h>
-+#endif
-+
-+#ifdef CONFIG_BR_EXT
-+#include <rtw_br_ext.h>
-+#endif // CONFIG_BR_EXT
-+
-+#ifdef CONFIG_IOCTL_CFG80211
-+ #include "ioctl_cfg80211.h"
-+#endif //CONFIG_IOCTL_CFG80211
-+
-+#define SPEC_DEV_ID_NONE BIT(0)
-+#define SPEC_DEV_ID_DISABLE_HT BIT(1)
-+#define SPEC_DEV_ID_ENABLE_PS BIT(2)
-+#define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
-+#define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
-+#define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
-+
-+struct specific_device_id{
-+
-+ u32 flags;
-+
-+ u16 idVendor;
-+ u16 idProduct;
-+
-+};
-+
-+struct registry_priv
-+{
-+ u8 chip_version;
-+ u8 rfintfs;
-+ u8 lbkmode;
-+ u8 hci;
-+ NDIS_802_11_SSID ssid;
-+ u8 network_mode; //infra, ad-hoc, auto
-+ u8 channel;//ad-hoc support requirement
-+ u8 wireless_mode;//A, B, G, auto
-+ u8 scan_mode;//active, passive
-+ u8 radio_enable;
-+ u8 preamble;//long, short, auto
-+ u8 vrtl_carrier_sense;//Enable, Disable, Auto
-+ u8 vcs_type;//RTS/CTS, CTS-to-self
-+ u16 rts_thresh;
-+ u16 frag_thresh;
-+ u8 adhoc_tx_pwr;
-+ u8 soft_ap;
-+ u8 power_mgnt;
-+ u8 ips_mode;
-+ u8 smart_ps;
-+ u8 long_retry_lmt;
-+ u8 short_retry_lmt;
-+ u16 busy_thresh;
-+ u8 ack_policy;
-+ u8 mp_mode;
-+ u8 software_encrypt;
-+ u8 software_decrypt;
-+
-+ u8 acm_method;
-+ //UAPSD
-+ u8 wmm_enable;
-+ u8 uapsd_enable;
-+ u8 uapsd_max_sp;
-+ u8 uapsd_acbk_en;
-+ u8 uapsd_acbe_en;
-+ u8 uapsd_acvi_en;
-+ u8 uapsd_acvo_en;
-+
-+ WLAN_BSSID_EX dev_network;
-+
-+#ifdef CONFIG_80211N_HT
-+ u8 ht_enable;
-+ u8 cbw40_enable;
-+ u8 ampdu_enable;//for tx
-+ u8 rx_stbc;
-+ u8 ampdu_amsdu;//A-MPDU Supports A-MSDU is permitted
-+#endif
-+ u8 lowrate_two_xmit;
-+
-+ u8 rf_config ;
-+ u8 low_power ;
-+
-+ u8 wifi_spec;// !turbo_mode
-+
-+ u8 channel_plan;
-+#ifdef CONFIG_BT_COEXIST
-+ u8 bt_iso;
-+ u8 bt_sco;
-+ u8 bt_ampdu;
-+#endif
-+ BOOLEAN bAcceptAddbaReq;
-+
-+ u8 antdiv_cfg;
-+
-+ u8 usbss_enable;//0:disable,1:enable
-+ u8 hwpdn_mode;//0:disable,1:enable,2:decide by EFUSE config
-+ u8 hwpwrp_detect;//0:disable,1:enable
-+
-+ u8 hw_wps_pbc;//0:disable,1:enable
-+
-+#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
-+ char adaptor_info_caching_file_path[PATH_LENGTH_MAX];
-+#endif
-+
-+#ifdef CONFIG_LAYER2_ROAMING
-+ u8 max_roaming_times; // the max number driver will try to roaming
-+#endif
-+
-+#ifdef CONFIG_IOL
-+ bool force_iol; //enable iol without other concern
-+#endif
-+ u8 special_rf_path; //0: 2T2R ,1: only turn on path A 1T1R, 2: only turn on path B 1T1R
-+ u8 mac_phy_mode; //0:by efuse, 1:smsp, 2:dmdp, 3:dmsp.
-+
-+#ifdef CONFIG_80211D
-+ u8 enable80211d;
-+#endif
-+
-+ u8 ifname[16];
-+ u8 if2name[16];
-+
-+ u8 notch_filter;
-+
-+#ifdef CONFIG_MULTI_VIR_IFACES
-+ u8 ext_iface_num;//primary/secondary iface is excluded
-+#endif
-+};
-+
-+
-+//For registry parameters
-+#define RGTRY_OFT(field) ((ULONG)FIELD_OFFSET(struct registry_priv,field))
-+#define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field)
-+#define BSSID_OFT(field) ((ULONG)FIELD_OFFSET(WLAN_BSSID_EX,field))
-+#define BSSID_SZ(field) sizeof(((PWLAN_BSSID_EX) 0)->field)
-+
-+#define MAX_CONTINUAL_URB_ERR 4
-+
-+#ifdef CONFIG_SDIO_HCI
-+#include <drv_types_sdio.h>
-+#define INTF_DATA SDIO_DATA
-+#endif
-+
-+#define GET_PRIMARY_ADAPTER(padapter) (((_adapter *)padapter)->dvobj->if1)
-+
-+#define GET_IFACE_NUMS(padapter) (((_adapter *)padapter)->dvobj->iface_nums)
-+#define GET_ADAPTER(padapter, iface_id) (((_adapter *)padapter)->dvobj->padapters[iface_id])
-+
-+enum _IFACE_ID {
-+ IFACE_ID0, //maping to PRIMARY_ADAPTER
-+ IFACE_ID1, //maping to SECONDARY_ADAPTER
-+ IFACE_ID2,
-+ IFACE_ID3,
-+ IFACE_ID_MAX,
-+};
-+
-+struct dvobj_priv
-+{
-+ _adapter *if1; //PRIMARY_ADAPTER
-+ _adapter *if2; //SECONDARY_ADAPTER
-+
-+ s32 processing_dev_remove;
-+
-+ //for local/global synchronization
-+ _mutex hw_init_mutex;
-+ _mutex h2c_fwcmd_mutex;
-+ _mutex setch_mutex;
-+ _mutex setbw_mutex;
-+
-+ unsigned char oper_channel; //saved channel info when call set_channel_bw
-+ unsigned char oper_bwmode;
-+ unsigned char oper_ch_offset;//PRIME_CHNL_OFFSET
-+ u32 on_oper_ch_time;
-+
-+ //extend to support mulitu interface
-+ //padapters[IFACE_ID0] == if1
-+ //padapters[IFACE_ID1] == if2
-+ _adapter *padapters[IFACE_ID_MAX];
-+ u8 iface_nums; // total number of ifaces used runtime
-+
-+ //For 92D, DMDP have 2 interface.
-+ u8 InterfaceNumber;
-+ u8 NumInterfaces;
-+ u8 DualMacMode;
-+ u8 irq_alloc;
-+
-+/*-------- below is for SDIO INTERFACE --------*/
-+
-+#ifdef INTF_DATA
-+ INTF_DATA intf_data;
-+#endif
-+
-+/*-------- below is for USB INTERFACE --------*/
-+
-+#ifdef CONFIG_USB_HCI
-+
-+ u8 nr_endpoint;
-+ u8 ishighspeed;
-+ u8 RtNumInPipes;
-+ u8 RtNumOutPipes;
-+ int ep_num[5]; //endpoint number
-+
-+ int RegUsbSS;
-+
-+ _sema usb_suspend_sema;
-+
-+#ifdef CONFIG_USB_VENDOR_REQ_MUTEX
-+ _mutex usb_vendor_req_mutex;
-+#endif
-+
-+#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
-+ u8 * usb_alloc_vendor_req_buf;
-+ u8 * usb_vendor_req_buf;
-+#endif
-+
-+#ifdef PLATFORM_WINDOWS
-+ //related device objects
-+ PDEVICE_OBJECT pphysdevobj;//pPhysDevObj;
-+ PDEVICE_OBJECT pfuncdevobj;//pFuncDevObj;
-+ PDEVICE_OBJECT pnextdevobj;//pNextDevObj;
-+
-+ u8 nextdevstacksz;//unsigned char NextDeviceStackSize; //= (CHAR)CEdevice->pUsbDevObj->StackSize + 1;
-+
-+ //urb for control diescriptor request
-+
-+#ifdef PLATFORM_OS_XP
-+ struct _URB_CONTROL_DESCRIPTOR_REQUEST descriptor_urb;
-+ PUSB_CONFIGURATION_DESCRIPTOR pconfig_descriptor;//UsbConfigurationDescriptor;
-+#endif
-+
-+#ifdef PLATFORM_OS_CE
-+ WCHAR active_path[MAX_ACTIVE_REG_PATH]; // adapter regpath
-+ USB_EXTENSION usb_extension;
-+
-+ _nic_hdl pipehdls_r8192c[0x10];
-+#endif
-+
-+ u32 config_descriptor_len;//ULONG UsbConfigurationDescriptorLength;
-+#endif//PLATFORM_WINDOWS
-+
-+#ifdef PLATFORM_LINUX
-+ struct usb_interface *pusbintf;
-+ struct usb_device *pusbdev;
-+#endif//PLATFORM_LINUX
-+
-+#ifdef PLATFORM_FREEBSD
-+ struct usb_interface *pusbintf;
-+ struct usb_device *pusbdev;
-+#endif//PLATFORM_FREEBSD
-+ ATOMIC_T continual_urb_error;
-+#endif//CONFIG_USB_HCI
-+
-+/*-------- below is for PCIE INTERFACE --------*/
-+
-+#ifdef CONFIG_PCI_HCI
-+
-+#ifdef PLATFORM_LINUX
-+ struct pci_dev *ppcidev;
-+
-+ //PCI MEM map
-+ unsigned long pci_mem_end; /* shared mem end */
-+ unsigned long pci_mem_start; /* shared mem start */
-+
-+ //PCI IO map
-+ unsigned long pci_base_addr; /* device I/O address */
-+
-+ //PciBridge
-+ struct pci_priv pcipriv;
-+
-+ u16 irqline;
-+ u8 irq_enabled;
-+ RT_ISR_CONTENT isr_content;
-+ _lock irq_th_lock;
-+
-+ //ASPM
-+ u8 const_pci_aspm;
-+ u8 const_amdpci_aspm;
-+ u8 const_hwsw_rfoff_d3;
-+ u8 const_support_pciaspm;
-+ // pci-e bridge */
-+ u8 const_hostpci_aspm_setting;
-+ // pci-e device */
-+ u8 const_devicepci_aspm_setting;
-+ u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00.
-+ u8 b_support_backdoor;
-+ u8 bdma64;
-+#endif//PLATFORM_LINUX
-+
-+#endif//CONFIG_PCI_HCI
-+};
-+
-+#ifdef PLATFORM_LINUX
-+static struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
-+{
-+ /* todo: get interface type from dvobj and the return the dev accordingly */
-+#ifdef RTW_DVOBJ_CHIP_HW_TYPE
-+#endif
-+
-+#ifdef CONFIG_USB_HCI
-+ return &dvobj->pusbintf->dev;
-+#endif
-+#ifdef CONFIG_SDIO_HCI
-+ return &dvobj->intf_data.func->dev;
-+#endif
-+#ifdef CONFIG_PCI_HCI
-+ return &dvobj->ppcidev->dev;
-+#endif
-+}
-+#endif
-+
-+
-+enum _IFACE_TYPE {
-+ IFACE_PORT0, //mapping to port0 for C/D series chips
-+ IFACE_PORT1, //mapping to port1 for C/D series chip
-+ MAX_IFACE_PORT,
-+};
-+
-+enum _ADAPTER_TYPE {
-+ PRIMARY_ADAPTER,
-+ SECONDARY_ADAPTER,
-+ MAX_ADAPTER = 0xFF,
-+};
-+
-+typedef enum _DRIVER_STATE{
-+ DRIVER_NORMAL = 0,
-+ DRIVER_DISAPPEAR = 1,
-+ DRIVER_REPLACE_DONGLE = 2,
-+}DRIVER_STATE;
-+
-+#ifdef CONFIG_INTEL_PROXIM
-+struct proxim {
-+ bool proxim_support;
-+ bool proxim_on;
-+
-+ void *proximity_priv;
-+ int (*proxim_rx)(_adapter *padapter,
-+ union recv_frame *precv_frame);
-+ u8 (*proxim_get_var)(_adapter* padapter, u8 type);
-+};
-+#endif //CONFIG_INTEL_PROXIM
-+
-+#ifdef RTL8723A_SDIO_LOOPBACK
-+typedef struct loopbackdata
-+{
-+ _sema sema;
-+ _thread_hdl_ lbkthread;
-+ u8 bstop;
-+ u32 cnt;
-+ u16 size;
-+ u16 txsize;
-+ u8 txbuf[0x8000];
-+ u16 rxsize;
-+ u8 rxbuf[0x8000];
-+ u8 msg[100];
-+
-+}LOOPBACKDATA, *PLOOPBACKDATA;
-+#endif
-+
-+struct _ADAPTER{
-+ int DriverState;// for disable driver using module, use dongle to replace module.
-+ int pid[3];//process id from UI, 0:wps, 1:hostapd, 2:dhcpcd
-+ int bDongle;//build-in module or external dongle
-+ u16 chip_type;
-+ u16 HardwareType;
-+ u16 interface_type;//USB,SDIO,PCI
-+
-+ struct dvobj_priv *dvobj;
-+ struct mlme_priv mlmepriv;
-+ struct mlme_ext_priv mlmeextpriv;
-+ struct cmd_priv cmdpriv;
-+ struct evt_priv evtpriv;
-+ //struct io_queue *pio_queue;
-+ struct io_priv iopriv;
-+ struct xmit_priv xmitpriv;
-+ struct recv_priv recvpriv;
-+ struct sta_priv stapriv;
-+ struct security_priv securitypriv;
-+ _lock security_key_mutex; // add for CONFIG_IEEE80211W, none 11w also can use
-+ struct registry_priv registrypriv;
-+ struct pwrctrl_priv pwrctrlpriv;
-+ struct eeprom_priv eeprompriv;
-+ struct led_priv ledpriv;
-+
-+#ifdef CONFIG_MP_INCLUDED
-+ struct mp_priv mppriv;
-+#endif
-+
-+#ifdef CONFIG_DRVEXT_MODULE
-+ struct drvext_priv drvextpriv;
-+#endif
-+
-+#ifdef CONFIG_AP_MODE
-+ struct hostapd_priv *phostapdpriv;
-+#endif
-+
-+#ifdef CONFIG_IOCTL_CFG80211
-+#ifdef CONFIG_P2P
-+ struct cfg80211_wifidirect_info cfg80211_wdinfo;
-+#endif //CONFIG_P2P
-+#endif //CONFIG_IOCTL_CFG80211
-+ u32 setband;
-+#ifdef CONFIG_P2P
-+ struct wifidirect_info wdinfo;
-+#endif //CONFIG_P2P
-+
-+#ifdef CONFIG_TDLS
-+ struct tdls_info tdlsinfo;
-+#endif //CONFIG_TDLS
-+
-+#ifdef CONFIG_WFD
-+ struct wifi_display_info wfd_info;
-+#endif //CONFIG_WFD
-+
-+ PVOID HalData;
-+ u32 hal_data_sz;
-+ struct hal_ops HalFunc;
-+
-+#ifdef CONFIG_BT_COEXIST
-+ //struct btcoexist_priv bt_coexist;
-+#endif
-+ s32 bDriverStopped;
-+ s32 bSurpriseRemoved;
-+ s32 bCardDisableWOHSM;
-+
-+ u32 IsrContent;
-+ u32 ImrContent;
-+
-+ u8 EepromAddressSize;
-+ u8 hw_init_completed;
-+ u8 bDriverIsGoingToUnload;
-+ u8 init_adpt_in_progress;
-+ u8 bHaltInProgress;
-+
-+ _thread_hdl_ cmdThread;
-+ _thread_hdl_ evtThread;
-+ _thread_hdl_ xmitThread;
-+ _thread_hdl_ recvThread;
-+
-+#ifndef PLATFORM_LINUX
-+ NDIS_STATUS (*dvobj_init)(struct dvobj_priv *dvobj);
-+ void (*dvobj_deinit)(struct dvobj_priv *dvobj);
-+#endif
-+
-+ void (*intf_start)(_adapter * adapter);
-+ void (*intf_stop)(_adapter * adapter);
-+
-+#ifdef PLATFORM_WINDOWS
-+ _nic_hdl hndis_adapter;//hNdisAdapter(NDISMiniportAdapterHandle);
-+ _nic_hdl hndis_config;//hNdisConfiguration;
-+ NDIS_STRING fw_img;
-+
-+ u32 NdisPacketFilter;
-+ u8 MCList[MAX_MCAST_LIST_NUM][6];
-+ u32 MCAddrCount;
-+#endif //end of PLATFORM_WINDOWS
-+
-+
-+#ifdef PLATFORM_LINUX
-+ _nic_hdl pnetdev;
-+
-+ // used by rtw_rereg_nd_name related function
-+ struct rereg_nd_name_data {
-+ _nic_hdl old_pnetdev;
-+ char old_ifname[IFNAMSIZ];
-+ u8 old_ips_mode;
-+ u8 old_bRegUseLed;
-+ } rereg_nd_name_priv;
-+
-+ int bup;
-+ struct net_device_stats stats;
-+ struct iw_statistics iwstats;
-+ struct proc_dir_entry *dir_dev;// for proc directory
-+
-+#ifdef CONFIG_IOCTL_CFG80211
-+ struct wireless_dev *rtw_wdev;
-+#endif //CONFIG_IOCTL_CFG80211
-+
-+#endif //end of PLATFORM_LINUX
-+
-+#ifdef PLATFORM_FREEBSD
-+ _nic_hdl pifp;
-+ int bup;
-+ _lock glock;
-+#endif //PLATFORM_FREEBSD
-+ int net_closed;
-+
-+ u8 bFWReady;
-+ u8 bReadPortCancel;
-+ u8 bWritePortCancel;
-+ u8 bRxRSSIDisplay;
-+ // Added by Albert 2012/07/26
-+ // The driver will write the initial gain everytime when running in the DM_Write_DIG function.
-+ u8 bForceWriteInitGain;
-+ // Added by Albert 2012/10/26
-+ // The driver will show up the desired channel number when this flag is 1.
-+ u8 bNotifyChannelChange;
-+#ifdef CONFIG_P2P
-+ // Added by Albert 2012/12/06
-+ // The driver will show the current P2P status when the upper application reads it.
-+ u8 bShowGetP2PState;
-+#endif
-+#ifdef CONFIG_AUTOSUSPEND
-+ u8 bDisableAutosuspend;
-+#endif
-+
-+ //pbuddy_adapter is used only in two inteface case, (iface_nums=2 in struct dvobj_priv)
-+ //PRIMARY_ADAPTER's buddy is SECONDARY_ADAPTER
-+ //SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER
-+ //for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to padapters[iface_id] in struct dvobj_priv
-+ //and their pbuddy_adapter is PRIMARY_ADAPTER.
-+ //for PRIMARY_ADAPTER(IFACE_ID0) can directly refer to if1 in struct dvobj_priv
-+ _adapter *pbuddy_adapter;
-+
-+#if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT)
-+ u8 isprimary; //is primary adapter or not
-+ //notes:
-+ // if isprimary is true, the adapter_type value is 0, iface_id is IFACE_ID0 for PRIMARY_ADAPTER
-+ // if isprimary is false, the adapter_type value is 1, iface_id is IFACE_ID1 for SECONDARY_ADAPTER
-+ // refer to iface_id if iface_nums>2 and isprimary is false and the adapter_type value is 0xff.
-+ u8 adapter_type;//used only in two inteface case(PRIMARY_ADAPTER and SECONDARY_ADAPTER) .
-+ u8 iface_type; //interface port type, it depends on HW port
-+#endif
-+
-+ //extend to support multi interface
-+ //IFACE_ID0 is equals to PRIMARY_ADAPTER
-+ //IFACE_ID1 is equals to SECONDARY_ADAPTER
-+ u8 iface_id;
-+
-+#ifdef CONFIG_DUALMAC_CONCURRENT
-+ u8 DualMacConcurrent; // 1: DMSP 0:DMDP
-+#endif
-+
-+#ifdef CONFIG_BR_EXT
-+ _lock br_ext_lock;
-+ //unsigned int macclone_completed;
-+ struct nat25_network_db_entry *nethash[NAT25_HASH_SIZE];
-+ int pppoe_connection_in_progress;
-+ unsigned char pppoe_addr[MACADDRLEN];
-+ unsigned char scdb_mac[MACADDRLEN];
-+ unsigned char scdb_ip[4];
-+ struct nat25_network_db_entry *scdb_entry;
-+ unsigned char br_mac[MACADDRLEN];
-+ unsigned char br_ip[4];
-+
-+ struct br_ext_info ethBrExtInfo;
-+#endif // CONFIG_BR_EXT
-+
-+#ifdef CONFIG_INTEL_PROXIM
-+ /* intel Proximity, should be alloc mem
-+ * in intel Proximity module and can only
-+ * be used in intel Proximity mode */
-+ struct proxim proximity;
-+#endif //CONFIG_INTEL_PROXIM
-+
-+#ifdef RTL8723A_SDIO_LOOPBACK
-+ PLOOPBACKDATA ploopback;
-+#endif
-+
-+};
-+
-+#define adapter_to_dvobj(adapter) (adapter->dvobj)
-+
-+int rtw_handle_dualmac(_adapter *adapter, bool init);
-+
-+__inline static u8 *myid(struct eeprom_priv *peepriv)
-+{
-+ return (peepriv->mac_addr);
-+}
-+
-+
-+#endif //__DRV_TYPES_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,24 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __DRV_TYPES_LINUX_H__
-+#define __DRV_TYPES_LINUX_H__
-+
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,69 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __DRV_TYPES_SDIO_H__
-+#define __DRV_TYPES_SDIO_H__
-+
-+#include <drv_conf.h>
-+#include <basic_types.h>
-+
-+// SDIO Header Files
-+#ifdef PLATFORM_LINUX
-+#include <linux/mmc/sdio_func.h>
-+#endif
-+#ifdef PLATFORM_OS_XP
-+#include <wdm.h>
-+#include <ntddsd.h>
-+#endif
-+#ifdef PLATFORM_OS_CE
-+#include <sdcardddk.h>
-+#endif
-+
-+
-+typedef struct sdio_data
-+{
-+ u8 func_number;
-+
-+ u8 tx_block_mode;
-+ u8 rx_block_mode;
-+ u32 block_transfer_len;
-+
-+#ifdef PLATFORM_LINUX
-+ struct sdio_func *func;
-+#endif
-+
-+#ifdef PLATFORM_OS_XP
-+ PDEVICE_OBJECT pphysdevobj;
-+ PDEVICE_OBJECT pfuncdevobj;
-+ PDEVICE_OBJECT pnextdevobj;
-+ SDBUS_INTERFACE_STANDARD sdbusinft;
-+ u8 nextdevstacksz;
-+#endif
-+
-+#ifdef PLATFORM_OS_CE
-+ SD_DEVICE_HANDLE hDevice;
-+ SD_CARD_RCA sd_rca;
-+ SD_CARD_INTERFACE card_intf;
-+ BOOLEAN enableIsarWithStatus;
-+ WCHAR active_path[MAX_ACTIVE_REG_PATH];
-+ SD_HOST_BLOCK_CAPABILITY sd_host_blk_cap;
-+#endif
-+} SDIO_DATA, *PSDIO_DATA;
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,94 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __DRV_TYPES_XP_H__
-+#define __DRV_TYPES_XP_H__
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+
-+
-+
-+#define MAX_MCAST_LIST_NUM 32
-+
-+
-+
-+//for ioctl
-+#define MAKE_DRIVER_VERSION(_MainVer,_MinorVer) ((((u32)(_MainVer))<<16)+_MinorVer)
-+
-+#define NIC_HEADER_SIZE 14 //!< can be moved to typedef.h
-+#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
-+#define NIC_MAX_SEND_PACKETS 10 // max number of send packets the MiniportSendPackets function can accept, can be moved to typedef.h
-+#define NIC_VENDOR_DRIVER_VERSION MAKE_DRIVER_VERSION(0,001) //!< can be moved to typedef.h
-+#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
-+
-+
-+#undef ON_VISTA
-+//added by Jackson
-+#ifndef ON_VISTA
-+//
-+// Bus driver versions
-+//
-+
-+#define SDBUS_DRIVER_VERSION_1 0x100
-+#define SDBUS_DRIVER_VERSION_2 0x200
-+
-+#define SDP_FUNCTION_TYPE 4
-+#define SDP_BUS_DRIVER_VERSION 5
-+#define SDP_BUS_WIDTH 6
-+#define SDP_BUS_CLOCK 7
-+#define SDP_BUS_INTERFACE_CONTROL 8
-+#define SDP_HOST_BLOCK_LENGTH 9
-+#define SDP_FUNCTION_BLOCK_LENGTH 10
-+#define SDP_FN0_BLOCK_LENGTH 11
-+#define SDP_FUNCTION_INT_ENABLE 12
-+#endif
-+
-+
-+typedef struct _MP_REG_ENTRY
-+{
-+
-+ NDIS_STRING RegName; // variable name text
-+ BOOLEAN bRequired; // 1 -> required, 0 -> optional
-+
-+ u8 Type; // NdisParameterInteger/NdisParameterHexInteger/NdisParameterStringle/NdisParameterMultiString
-+ uint FieldOffset; // offset to MP_ADAPTER field
-+ uint FieldSize; // size (in bytes) of the field
-+
-+#ifdef UNDER_AMD64
-+ u64 Default;
-+#else
-+ u32 Default; // default value to use
-+#endif
-+
-+ u32 Min; // minimum value allowed
-+ u32 Max; // maximum value allowed
-+} MP_REG_ENTRY, *PMP_REG_ENTRY;
-+
-+
-+typedef struct _OCTET_STRING{
-+ u8 *Octet;
-+ u16 Length;
-+} OCTET_STRING, *POCTET_STRING;
-+
-+
-+
-+
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ethernet.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ethernet.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ethernet.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ethernet.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,41 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+/*! \file */
-+#ifndef __INC_ETHERNET_H
-+#define __INC_ETHERNET_H
-+
-+#define ETHERNET_ADDRESS_LENGTH 6 //!< Ethernet Address Length
-+#define ETHERNET_HEADER_SIZE 14 //!< Ethernet Header Length
-+#define LLC_HEADER_SIZE 6 //!< LLC Header Length
-+#define TYPE_LENGTH_FIELD_SIZE 2 //!< Type/Length Size
-+#define MINIMUM_ETHERNET_PACKET_SIZE 60 //!< Minimum Ethernet Packet Size
-+#define MAXIMUM_ETHERNET_PACKET_SIZE 1514 //!< Maximum Ethernet Packet Size
-+
-+#define RT_ETH_IS_MULTICAST(_pAddr) ((((UCHAR *)(_pAddr))[0]&0x01)!=0) //!< Is Multicast Address?
-+#define RT_ETH_IS_BROADCAST(_pAddr) ( \
-+ ((UCHAR *)(_pAddr))[0]==0xff && \
-+ ((UCHAR *)(_pAddr))[1]==0xff && \
-+ ((UCHAR *)(_pAddr))[2]==0xff && \
-+ ((UCHAR *)(_pAddr))[3]==0xff && \
-+ ((UCHAR *)(_pAddr))[4]==0xff && \
-+ ((UCHAR *)(_pAddr))[5]==0xff ) //!< Is Broadcast Address?
-+
-+
-+#endif // #ifndef __INC_ETHERNET_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/h2clbk.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/h2clbk.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/h2clbk.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/h2clbk.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,35 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+
-+
-+#define _H2CLBK_H_
-+
-+
-+#include <rtl8711_spec.h>
-+#include <TypeDef.h>
-+
-+
-+void _lbk_cmd(PADAPTER Adapter);
-+
-+void _lbk_rsp(PADAPTER Adapter);
-+
-+void _lbk_evt(IN PADAPTER Adapter);
-+
-+void h2c_event_callback(unsigned char *dev, unsigned char *pbuf);
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,85 @@
+/******************************************************************************
+ *
@@ -162311,9 +168375,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CEHWImg.h li
+extern u32 Rtl8192CEAGCTAB_1TArray[AGCTAB_1TArrayLength];
+
+#endif //__INC_HAL8192CE_FW_IMG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,427 @@
+/******************************************************************************
+ *
@@ -162742,9 +168806,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyCfg.h li
+#define PHY_SetMacReg PHY_SetBBReg
+
+#endif // __INC_HAL8192CPHYCFG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,1122 @@
+/******************************************************************************
+ *
@@ -163868,9 +169932,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CPhyReg.h li
+
+
+#endif //__INC_HAL8192SPHYREG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,105 @@
+/******************************************************************************
+ *
@@ -163977,9 +170041,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg.h li
+extern u32 Rtl8192CUAGCTAB_1T_HPArray[AGCTAB_1T_HPArrayLength];
+
+#endif //__INC_HAL8192CU_FW_IMG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowlan.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,33 @@
+/******************************************************************************
+ *
@@ -164014,9 +170078,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192CUHWImg_wowl
+extern u8 Rtl8192CUFwUMCBCutWWImgArray[UMCBCutWWImgArrayLength];
+
+#endif //__INC_HAL8192CU_FW_IMG_WOWLAN_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,66 @@
+/******************************************************************************
+ *
@@ -164084,9 +170148,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DEHWImg.h li
+extern const u32 Rtl8192DEAGCTAB_1TArray[Rtl8192DEAGCTAB_1TArrayLength];
+
+#endif //__INC_HAL8192CU_FW_IMG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,527 @@
+/******************************************************************************
+ *
@@ -164615,9 +170679,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyCfg.h li
+#define PHY_SetMacReg PHY_SetBBReg
+
+#endif // __INC_HAL8192SPHYCFG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,1170 @@
+/******************************************************************************
+ *
@@ -165789,9 +171853,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DPhyReg.h li
+
+
+#endif //__INC_HAL8192SPHYREG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,66 @@
+/******************************************************************************
+ *
@@ -165859,9 +171923,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg.h li
+extern const u32 Rtl8192DUAGCTAB_1TArray[Rtl8192DUAGCTAB_1TArrayLength];
+
+#endif //__INC_HAL8192CU_FW_IMG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowlan.h 2015-08-26 10:26:08.757316386 +0200
@@ -0,0 +1,29 @@
+/******************************************************************************
+ *
@@ -165892,9 +171956,2713 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/Hal8192DUHWImg_wowl
+extern u8 Rtl8192DUFwWWImgArray[DUWWImgArrayLength];
+
+#endif //__INC_HAL8192DU_FW_IMG_WOWLAN_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/hal_com.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/hal_com.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/hal_com.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/hal_com.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h linux-rpi/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,137 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __HALPWRSEQCMD_H__
++#define __HALPWRSEQCMD_H__
++
++#include <drv_types.h>
++
++/*---------------------------------------------*/
++//3 The value of cmd: 4 bits
++/*---------------------------------------------*/
++#define PWR_CMD_READ 0x00
++ // offset: the read register offset
++ // msk: the mask of the read value
++ // value: N/A, left by 0
++ // note: dirver shall implement this function by read & msk
++
++#define PWR_CMD_WRITE 0x01
++ // offset: the read register offset
++ // msk: the mask of the write bits
++ // value: write value
++ // note: driver shall implement this cmd by read & msk after write
++
++#define PWR_CMD_POLLING 0x02
++ // offset: the read register offset
++ // msk: the mask of the polled value
++ // value: the value to be polled, masked by the msd field.
++ // note: driver shall implement this cmd by
++ // do{
++ // if( (Read(offset) & msk) == (value & msk) )
++ // break;
++ // } while(not timeout);
++
++#define PWR_CMD_DELAY 0x03
++ // offset: the value to delay
++ // msk: N/A
++ // value: the unit of delay, 0: us, 1: ms
++
++#define PWR_CMD_END 0x04
++ // offset: N/A
++ // msk: N/A
++ // value: N/A
++
++/*---------------------------------------------*/
++//3 The value of base: 4 bits
++/*---------------------------------------------*/
++ // define the base address of each block
++#define PWR_BASEADDR_MAC 0x00
++#define PWR_BASEADDR_USB 0x01
++#define PWR_BASEADDR_PCIE 0x02
++#define PWR_BASEADDR_SDIO 0x03
++
++/*---------------------------------------------*/
++//3 The value of interface_msk: 4 bits
++/*---------------------------------------------*/
++#define PWR_INTF_SDIO_MSK BIT(0)
++#define PWR_INTF_USB_MSK BIT(1)
++#define PWR_INTF_PCI_MSK BIT(2)
++#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
++
++/*---------------------------------------------*/
++//3 The value of fab_msk: 4 bits
++/*---------------------------------------------*/
++#define PWR_FAB_TSMC_MSK BIT(0)
++#define PWR_FAB_UMC_MSK BIT(1)
++#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
++
++/*---------------------------------------------*/
++//3 The value of cut_msk: 8 bits
++/*---------------------------------------------*/
++#define PWR_CUT_TESTCHIP_MSK BIT(0)
++#define PWR_CUT_A_MSK BIT(1)
++#define PWR_CUT_B_MSK BIT(2)
++#define PWR_CUT_C_MSK BIT(3)
++#define PWR_CUT_D_MSK BIT(4)
++#define PWR_CUT_E_MSK BIT(5)
++#define PWR_CUT_F_MSK BIT(6)
++#define PWR_CUT_G_MSK BIT(7)
++#define PWR_CUT_ALL_MSK 0xFF
++
++
++typedef enum _PWRSEQ_CMD_DELAY_UNIT_
++{
++ PWRSEQ_DELAY_US,
++ PWRSEQ_DELAY_MS,
++} PWRSEQ_DELAY_UNIT;
++
++typedef struct _WL_PWR_CFG_
++{
++ u16 offset;
++ u8 cut_msk;
++ u8 fab_msk:4;
++ u8 interface_msk:4;
++ u8 base:4;
++ u8 cmd:4;
++ u8 msk;
++ u8 value;
++} WLAN_PWR_CFG, *PWLAN_PWR_CFG;
++
++
++#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset
++#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk
++#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk
++#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk
++#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base
++#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd
++#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk
++#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value
++
++
++//================================================================================
++// Prototype of protected function.
++//================================================================================
++u8 HalPwrSeqCmdParsing(
++ PADAPTER padapter,
++ u8 CutVersion,
++ u8 FabVersion,
++ u8 InterfaceType,
++ WLAN_PWR_CFG PwrCfgCmd[]);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/autoconf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/autoconf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/autoconf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/autoconf.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,336 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++
++/*
++ * Public General Config
++ */
++#define AUTOCONF_INCLUDED
++#define RTL871X_MODULE_NAME "92CU"
++#define DRV_NAME "rtl8192cu"
++
++#define CONFIG_USB_HCI 1
++
++#define CONFIG_RTL8192C 1
++
++#define PLATFORM_LINUX 1
++
++//#define CONFIG_IOCTL_CFG80211 1
++#ifdef CONFIG_IOCTL_CFG80211
++ //#define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */
++ #define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
++ //#define CONFIG_DEBUG_CFG80211 1
++ //#define CONFIG_DRV_ISSUE_PROV_REQ // IOT FOR S2
++ #define CONFIG_SET_SCAN_DENY_TIMER
++#endif
++
++/*
++ * Internal General Config
++ */
++//#define CONFIG_PWRCTRL
++//#define CONFIG_H2CLBK
++
++#define CONFIG_EMBEDDED_FWIMG 1
++//#define CONFIG_FILE_FWIMG
++
++#ifdef CONFIG_WAKE_ON_WLAN
++#define CONFIG_WOWLAN 1
++#endif //CONFIG_WAKE_ON_WLAN
++
++#define CONFIG_R871X_TEST 1
++
++#define CONFIG_XMIT_ACK
++#ifdef CONFIG_XMIT_ACK
++ #define CONFIG_XMIT_ACK_POLLING
++ #define CONFIG_ACTIVE_KEEP_ALIVE_CHECK
++#endif
++
++#define CONFIG_80211N_HT 1
++
++#define CONFIG_RECV_REORDERING_CTRL 1
++
++//#define CONFIG_TCP_CSUM_OFFLOAD_RX 1
++
++//#define CONFIG_BEFORE_LINKED_DIG
++//#define CONFIG_DRVEXT_MODULE 1
++
++#ifndef CONFIG_MP_INCLUDED
++ #define CONFIG_IPS 1
++ #ifdef CONFIG_IPS
++ //#define CONFIG_IPS_LEVEL_2 1 //enable this to set default IPS mode to IPS_LEVEL_2
++ #endif
++
++ #define SUPPORT_HW_RFOFF_DETECTED 1
++
++ #define CONFIG_LPS 1
++ #define CONFIG_BT_COEXIST 1
++
++ //befor link
++ #define CONFIG_ANTENNA_DIVERSITY
++
++ //after link
++ #ifdef CONFIG_ANTENNA_DIVERSITY
++ #define CONFIG_SW_ANTENNA_DIVERSITY
++ //#define CONFIG_HW_ANTENNA_DIVERSITY
++ #endif
++
++ #define CONFIG_IOL
++#else //#ifndef CONFIG_MP_INCLUDED
++ #define CONFIG_MP_IWPRIV_SUPPORT 1
++#endif //#ifndef CONFIG_MP_INCLUDED
++
++#define CONFIG_AP_MODE 1
++#ifdef CONFIG_AP_MODE
++ #define CONFIG_NATIVEAP_MLME 1
++ #ifndef CONFIG_NATIVEAP_MLME
++ #define CONFIG_HOSTAPD_MLME 1
++ #endif
++ #define CONFIG_FIND_BEST_CHANNEL 1
++ //#define CONFIG_NO_WIRELESS_HANDLERS 1
++#endif
++
++// Added by Albert 20110314
++#define CONFIG_P2P 1
++#ifdef CONFIG_P2P
++ //Added by Albert 20110812
++ //The CONFIG_WFD is for supporting the Wi-Fi display
++ #define CONFIG_WFD
++
++ #ifndef CONFIG_WIFI_TEST
++ #define CONFIG_P2P_REMOVE_GROUP_INFO
++ #endif
++ //#define CONFIG_DBG_P2P
++
++ //#define CONFIG_P2P_PS
++ //#define CONFIG_P2P_IPS
++
++ #define P2P_OP_CHECK_SOCIAL_CH
++ // Added comment by Borg 2013/06/21
++ // Issue: Nexus 4 is hard to do miracast.
++ // Root Cause: After group formation,
++ // Nexus 4 is possible to be not at OP channel of Invitation Resp/Nego Confirm but at social channel.
++ // Patch: While scan OP channel,
++ // not only scan OP channel of Invitation Resp/Nego Confirm,
++ // but also scan social channel(1, 6, 11)
++#endif
++
++// Added by Kurt 20110511
++//#define CONFIG_TDLS 1
++#ifdef CONFIG_TDLS
++// #ifndef CONFIG_WFD
++// #define CONFIG_WFD 1
++// #endif
++// #define CONFIG_TDLS_AUTOSETUP 1
++// #define CONFIG_TDLS_AUTOCHECKALIVE 1
++#endif
++
++#define CONFIG_SKB_COPY 1//for amsdu
++
++#define CONFIG_LED
++#ifdef CONFIG_LED
++ #define CONFIG_SW_LED
++ #ifdef CONFIG_SW_LED
++ //#define CONFIG_LED_HANDLED_BY_CMD_THREAD
++ #endif
++#endif // CONFIG_LED
++
++
++
++#define USB_INTERFERENCE_ISSUE // this should be checked in all usb interface
++#define CONFIG_GLOBAL_UI_PID
++
++#define CONFIG_LAYER2_ROAMING
++#define CONFIG_LAYER2_ROAMING_RESUME
++//#define CONFIG_ADAPTOR_INFO_CACHING_FILE // now just applied on 8192cu only, should make it general...
++//#define CONFIG_RESUME_IN_WORKQUEUE
++//#define CONFIG_SET_SCAN_DENY_TIMER
++#define CONFIG_LONG_DELAY_ISSUE
++#define CONFIG_NEW_SIGNAL_STAT_PROCESS
++//#define CONFIG_SIGNAL_DISPLAY_DBM //display RX signal with dbm
++#define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable */
++#define CONFIG_DEAUTH_BEFORE_CONNECT
++
++#ifdef CONFIG_IOL
++ #define CONFIG_IOL_LLT
++ #define CONFIG_IOL_MAC
++ #define CONFIG_IOL_BB_PHY_REG
++ #define CONFIG_IOL_BB_AGC_TAB
++ #define CONFIG_IOL_RF_RF90_PATH_A
++ #define CONFIG_IOL_RF_RF90_PATH_B
++#endif
++
++#define CONFIG_BR_EXT 1 // Enable NAT2.5 support for STA mode interface with a L2 Bridge
++#ifdef CONFIG_BR_EXT
++#define CONFIG_BR_EXT_BRNAME "br0"
++#endif // CONFIG_BR_EXT
++
++#define CONFIG_TX_MCAST2UNI 1 // Support IP multicast->unicast
++//#define CONFIG_DM_ADAPTIVITY
++//#define CONFIG_CHECK_AC_LIFETIME 1 // Check packet lifetime of 4 ACs.
++
++//#define CONFIG_CONCURRENT_MODE 1
++#ifdef CONFIG_CONCURRENT_MODE
++ #define CONFIG_TSF_RESET_OFFLOAD 1 // For 2 PORT TSF SYNC.
++ //#define CONFIG_HWPORT_SWAP //Port0->Sec , Port1 -> Pri
++ //#define CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
++ //#define CONFIG_MULTI_VIR_IFACES //besides primary&secondary interfaces, extend to support more interfaces
++#endif // CONFIG_CONCURRENT_MODE
++
++#define CONFIG_80211D
++
++/*
++ * Interface Related Config
++ */
++
++//#define CONFIG_USB_ONE_OUT_EP
++//#define CONFIG_USB_INTERRUPT_IN_PIPE 1
++
++#ifndef CONFIG_MINIMAL_MEMORY_USAGE
++ #define CONFIG_USB_TX_AGGREGATION 1
++ #define CONFIG_USB_RX_AGGREGATION 1
++#endif
++
++#define CONFIG_PREALLOC_RECV_SKB 1
++//#define CONFIG_REDUCE_USB_TX_INT 1 // Trade-off: Improve performance, but may cause TX URBs blocked by USB Host/Bus driver on few platforms.
++//#define CONFIG_EASY_REPLACEMENT 1
++
++/*
++ * CONFIG_USE_USB_BUFFER_ALLOC_XX uses Linux USB Buffer alloc API and is for Linux platform only now!
++ */
++//#define CONFIG_USE_USB_BUFFER_ALLOC_TX 1 // Trade-off: For TX path, improve stability on some platforms, but may cause performance degrade on other platforms.
++//#define CONFIG_USE_USB_BUFFER_ALLOC_RX 1 // For RX path
++#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
++#undef CONFIG_PREALLOC_RECV_SKB
++#endif
++
++/*
++ * USB VENDOR REQ BUFFER ALLOCATION METHOD
++ * if not set we'll use function local variable (stack memory)
++ */
++//#define CONFIG_USB_VENDOR_REQ_BUFFER_DYNAMIC_ALLOCATE
++#define CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
++
++#define CONFIG_USB_VENDOR_REQ_MUTEX
++#define CONFIG_VENDOR_REQ_RETRY
++
++//#define CONFIG_USB_SUPPORT_ASYNC_VDN_REQ 1
++
++
++/*
++ * HAL Related Config
++ */
++
++#define RTL8192C_RX_PACKET_NO_INCLUDE_CRC 1
++
++#define SUPPORTED_BLOCK_IO
++
++
++
++#define RTL8192CU_FW_DOWNLOAD_ENABLE 1
++
++#define CONFIG_ONLY_ONE_OUT_EP_TO_LOW 0
++
++#define CONFIG_OUT_EP_WIFI_MODE 0
++
++#define ENABLE_USB_DROP_INCORRECT_OUT 0
++
++#define RTL8192CU_ASIC_VERIFICATION 0 // For ASIC verification.
++
++#define RTL8192CU_ADHOC_WORKAROUND_SETTING 1
++
++#define DISABLE_BB_RF 0
++
++#define RTL8191C_FPGA_NETWORKTYPE_ADHOC 0
++
++#ifdef CONFIG_MP_INCLUDED
++ #define MP_DRIVER 1
++ #undef CONFIG_USB_TX_AGGREGATION
++ #undef CONFIG_USB_RX_AGGREGATION
++#else
++ #define MP_DRIVER 0
++#endif
++
++
++/*
++ * Platform Related Config
++ */
++#ifdef CONFIG_PLATFORM_MN10300
++#define CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV
++
++#if defined (CONFIG_SW_ANTENNA_DIVERSITY)
++ #undef CONFIG_SW_ANTENNA_DIVERSITY
++ #define CONFIG_HW_ANTENNA_DIVERSITY
++#endif
++
++#endif
++
++#ifdef CONFIG_WISTRON_PLATFORM
++
++#endif
++
++#ifdef CONFIG_PLATFORM_TI_DM365
++#define CONFIG_USE_USB_BUFFER_ALLOC_RX 1
++#endif
++
++#define CONFIG_ATTEMPT_TO_FIX_AP_BEACON_ERROR
++
++/*
++ * Debug Related Config
++ */
++//#define CONFIG_DEBUG_RTL871X
++
++#define DBG 0
++//#define CONFIG_DEBUG_RTL819X
++
++//#define CONFIG_PROC_DEBUG 1
++
++//#define DBG_IO
++//#define DBG_DELAY_OS
++//#define DBG_MEM_ALLOC
++//#define DBG_IOCTL
++
++//#define DBG_TX
++//#define DBG_XMIT_BUF
++//#define DBG_TX_DROP_FRAME
++
++//#define DBG_RX_DROP_FRAME
++//#define DBG_RX_SEQ
++//#define DBG_RX_SIGNAL_DISPLAY_PROCESSING
++//#define DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED "jeff-ap"
++
++//#define DBG_EXPIRATION_CHK
++
++
++//#define DBG_SHOW_MCUFWDL_BEFORE_51_ENABLE
++//#define DBG_ROAMING_TEST
++
++//#define DBG_HAL_INIT_PROFILING
++
++//#define DBG_MEMORY_LEAK 1
++
++#define DBG_CONFIG_ERROR_DETECT
++//#define DBG_CONFIG_ERROR_RESET
++
++//TX use 1 urb
++//#define CONFIG_SINGLE_XMIT_BUF
++//RX use 1 urb
++//#define CONFIG_SINGLE_RECV_BUF
++
++//turn off power tracking when traffic is busy
++//#define CONFIG_BUSY_TRAFFIC_SKIP_PWR_TRACK
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/basic_types.h linux-rpi/drivers/net/wireless/rtl8192cu/include/basic_types.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/basic_types.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/basic_types.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,320 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __BASIC_TYPES_H__
++#define __BASIC_TYPES_H__
++
++#include <drv_conf.h>
++
++
++#define SUCCESS 0
++#define FAIL (-1)
++
++#ifndef TRUE
++ #define _TRUE 1
++#else
++ #define _TRUE TRUE
++#endif
++
++#ifndef FALSE
++ #define _FALSE 0
++#else
++ #define _FALSE FALSE
++#endif
++
++#ifdef PLATFORM_WINDOWS
++
++ typedef signed char s8;
++ typedef unsigned char u8;
++
++ typedef signed short s16;
++ typedef unsigned short u16;
++
++ typedef signed long s32;
++ typedef unsigned long u32;
++
++ typedef unsigned int uint;
++ typedef signed int sint;
++
++
++ typedef signed long long s64;
++ typedef unsigned long long u64;
++
++ #ifdef NDIS50_MINIPORT
++
++ #define NDIS_MAJOR_VERSION 5
++ #define NDIS_MINOR_VERSION 0
++
++ #endif
++
++ #ifdef NDIS51_MINIPORT
++
++ #define NDIS_MAJOR_VERSION 5
++ #define NDIS_MINOR_VERSION 1
++
++ #endif
++
++ typedef NDIS_PROC proc_t;
++
++ typedef LONG atomic_t;
++
++#endif
++
++
++#ifdef PLATFORM_LINUX
++
++ #include <linux/types.h>
++ #define IN
++ #define OUT
++ #define VOID void
++ #define NDIS_OID uint
++ #define NDIS_STATUS uint
++
++ typedef signed int sint;
++
++ #ifndef PVOID
++ typedef void * PVOID;
++ //#define PVOID (void *)
++ #endif
++
++ #define UCHAR u8
++ #define USHORT u16
++ #define UINT u32
++ #define ULONG u32
++
++ typedef void (*proc_t)(void*);
++
++ typedef __kernel_size_t SIZE_T;
++ typedef __kernel_ssize_t SSIZE_T;
++ #define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
++
++#endif
++
++
++#ifdef PLATFORM_FREEBSD
++
++ typedef signed char s8;
++ typedef unsigned char u8;
++
++ typedef signed short s16;
++ typedef unsigned short u16;
++
++ typedef signed int s32;
++ typedef unsigned int u32;
++
++ typedef unsigned int uint;
++ typedef signed int sint;
++ typedef long atomic_t;
++
++ typedef signed long long s64;
++ typedef unsigned long long u64;
++ #define IN
++ #define OUT
++ #define VOID void
++ #define NDIS_OID uint
++ #define NDIS_STATUS uint
++
++ #ifndef PVOID
++ typedef void * PVOID;
++ //#define PVOID (void *)
++ #endif
++ typedef u32 dma_addr_t;
++ #define UCHAR u8
++ #define USHORT u16
++ #define UINT u32
++ #define ULONG u32
++
++ typedef void (*proc_t)(void*);
++
++ typedef unsigned int __kernel_size_t;
++ typedef int __kernel_ssize_t;
++
++ typedef __kernel_size_t SIZE_T;
++ typedef __kernel_ssize_t SSIZE_T;
++ #define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
++
++#endif
++
++#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
++#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
++
++#define SIZE_PTR SIZE_T
++#define SSIZE_PTR SSIZE_T
++
++//port from fw by thomas
++// TODO: Belows are Sync from SD7-Driver. It is necessary to check correctness
++
++/*
++ * Call endian free function when
++ * 1. Read/write packet content.
++ * 2. Before write integer to IO.
++ * 3. After read integer from IO.
++*/
++
++//
++// Byte Swapping routine.
++//
++#define EF1Byte
++#define EF2Byte le16_to_cpu
++#define EF4Byte le32_to_cpu
++
++//
++// Read LE format data from memory
++//
++#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr)))
++#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr)))
++#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr)))
++
++//
++// Write LE data to memory
++//
++#define WriteEF1Byte(_ptr, _val) (*((u8 *)(_ptr)))=EF1Byte(_val)
++#define WriteEF2Byte(_ptr, _val) (*((u16 *)(_ptr)))=EF2Byte(_val)
++#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val)
++
++//
++// Example:
++// BIT_LEN_MASK_32(0) => 0x00000000
++// BIT_LEN_MASK_32(1) => 0x00000001
++// BIT_LEN_MASK_32(2) => 0x00000003
++// BIT_LEN_MASK_32(32) => 0xFFFFFFFF
++//
++#define BIT_LEN_MASK_32(__BitLen) \
++ (0xFFFFFFFF >> (32 - (__BitLen)))
++//
++// Example:
++// BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
++// BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
++//
++#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \
++ (BIT_LEN_MASK_32(__BitLen) << (__BitOffset))
++
++//
++// Description:
++// Return 4-byte value in host byte ordering from
++// 4-byte pointer in litten-endian system.
++//
++#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
++ (EF4Byte(*((u32 *)(__pStart))))
++
++//
++// Description:
++// Translate subfield (continuous bits in little-endian) of 4-byte value in litten byte to
++// 4-byte value in host byte ordering.
++//
++#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
++ ( \
++ ( LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset) ) \
++ & \
++ BIT_LEN_MASK_32(__BitLen) \
++ )
++
++//
++// Description:
++// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering
++// and return the result in 4-byte value in host byte ordering.
++//
++#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
++ ( \
++ LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
++ & \
++ ( ~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ) \
++ )
++
++//
++// Description:
++// Set subfield of little-endian 4-byte value to specified value.
++//
++#define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \
++ *((u32 *)(__pStart)) = \
++ EF4Byte( \
++ LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
++ | \
++ ( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \
++ );
++
++
++#define BIT_LEN_MASK_16(__BitLen) \
++ (0xFFFF >> (16 - (__BitLen)))
++
++#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \
++ (BIT_LEN_MASK_16(__BitLen) << (__BitOffset))
++
++#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
++ (EF2Byte(*((u16 *)(__pStart))))
++
++#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
++ ( \
++ ( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \
++ & \
++ BIT_LEN_MASK_16(__BitLen) \
++ )
++
++#define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
++ ( \
++ LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
++ & \
++ ( ~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ) \
++ )
++
++#define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \
++ *((u16 *)(__pStart)) = \
++ EF2Byte( \
++ LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
++ | \
++ ( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \
++ );
++
++#define BIT_LEN_MASK_8(__BitLen) \
++ (0xFF >> (8 - (__BitLen)))
++
++#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \
++ (BIT_LEN_MASK_8(__BitLen) << (__BitOffset))
++
++#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
++ (EF1Byte(*((u8 *)(__pStart))))
++
++#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
++ ( \
++ ( LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset) ) \
++ & \
++ BIT_LEN_MASK_8(__BitLen) \
++ )
++
++#define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
++ ( \
++ LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
++ & \
++ ( ~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ) \
++ )
++
++#define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \
++ *((u8 *)(__pStart)) = \
++ EF1Byte( \
++ LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
++ | \
++ ( (((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset) ) \
++ );
++
++// Get the N-bytes aligment offset from the current length
++#define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : (((__Value + __Aligment - 1) / __Aligment) * __Aligment))
++
++typedef unsigned char BOOLEAN,*PBOOLEAN;
++
++#endif //__BASIC_TYPES_H__
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/big_endian.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,87 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
++#define _LINUX_BYTEORDER_BIG_ENDIAN_H
++
++#ifndef __BIG_ENDIAN
++#define __BIG_ENDIAN 4321
++#endif
++#ifndef __BIG_ENDIAN_BITFIELD
++#define __BIG_ENDIAN_BITFIELD
++#endif
++
++#include <byteorder/swab.h>
++
++#define __constant_htonl(x) ((__u32)(x))
++#define __constant_ntohl(x) ((__u32)(x))
++#define __constant_htons(x) ((__u16)(x))
++#define __constant_ntohs(x) ((__u16)(x))
++#define __constant_cpu_to_le64(x) ___constant_swab64((x))
++#define __constant_le64_to_cpu(x) ___constant_swab64((x))
++#define __constant_cpu_to_le32(x) ___constant_swab32((x))
++#define __constant_le32_to_cpu(x) ___constant_swab32((x))
++#define __constant_cpu_to_le16(x) ___constant_swab16((x))
++#define __constant_le16_to_cpu(x) ___constant_swab16((x))
++#define __constant_cpu_to_be64(x) ((__u64)(x))
++#define __constant_be64_to_cpu(x) ((__u64)(x))
++#define __constant_cpu_to_be32(x) ((__u32)(x))
++#define __constant_be32_to_cpu(x) ((__u32)(x))
++#define __constant_cpu_to_be16(x) ((__u16)(x))
++#define __constant_be16_to_cpu(x) ((__u16)(x))
++#define __cpu_to_le64(x) __swab64((x))
++#define __le64_to_cpu(x) __swab64((x))
++#define __cpu_to_le32(x) __swab32((x))
++#define __le32_to_cpu(x) __swab32((x))
++#define __cpu_to_le16(x) __swab16((x))
++#define __le16_to_cpu(x) __swab16((x))
++#define __cpu_to_be64(x) ((__u64)(x))
++#define __be64_to_cpu(x) ((__u64)(x))
++#define __cpu_to_be32(x) ((__u32)(x))
++#define __be32_to_cpu(x) ((__u32)(x))
++#define __cpu_to_be16(x) ((__u16)(x))
++#define __be16_to_cpu(x) ((__u16)(x))
++#define __cpu_to_le64p(x) __swab64p((x))
++#define __le64_to_cpup(x) __swab64p((x))
++#define __cpu_to_le32p(x) __swab32p((x))
++#define __le32_to_cpup(x) __swab32p((x))
++#define __cpu_to_le16p(x) __swab16p((x))
++#define __le16_to_cpup(x) __swab16p((x))
++#define __cpu_to_be64p(x) (*(__u64*)(x))
++#define __be64_to_cpup(x) (*(__u64*)(x))
++#define __cpu_to_be32p(x) (*(__u32*)(x))
++#define __be32_to_cpup(x) (*(__u32*)(x))
++#define __cpu_to_be16p(x) (*(__u16*)(x))
++#define __be16_to_cpup(x) (*(__u16*)(x))
++#define __cpu_to_le64s(x) __swab64s((x))
++#define __le64_to_cpus(x) __swab64s((x))
++#define __cpu_to_le32s(x) __swab32s((x))
++#define __le32_to_cpus(x) __swab32s((x))
++#define __cpu_to_le16s(x) __swab16s((x))
++#define __le16_to_cpus(x) __swab16s((x))
++#define __cpu_to_be64s(x) do {} while (0)
++#define __be64_to_cpus(x) do {} while (0)
++#define __cpu_to_be32s(x) do {} while (0)
++#define __be32_to_cpus(x) do {} while (0)
++#define __cpu_to_be16s(x) do {} while (0)
++#define __be16_to_cpus(x) do {} while (0)
++
++#include <byteorder/generic.h>
++
++#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/generic.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,212 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _LINUX_BYTEORDER_GENERIC_H
++#define _LINUX_BYTEORDER_GENERIC_H
++
++/*
++ * linux/byteorder_generic.h
++ * Generic Byte-reordering support
++ *
++ * Francois-Rene Rideau <fare@tunes.org> 19970707
++ * gathered all the good ideas from all asm-foo/byteorder.h into one file,
++ * cleaned them up.
++ * I hope it is compliant with non-GCC compilers.
++ * I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
++ * because I wasn't sure it would be ok to put it in types.h
++ * Upgraded it to 2.1.43
++ * Francois-Rene Rideau <fare@tunes.org> 19971012
++ * Upgraded it to 2.1.57
++ * to please Linus T., replaced huge #ifdef's between little/big endian
++ * by nestedly #include'd files.
++ * Francois-Rene Rideau <fare@tunes.org> 19971205
++ * Made it to 2.1.71; now a facelift:
++ * Put files under include/linux/byteorder/
++ * Split swab from generic support.
++ *
++ * TODO:
++ * = Regular kernel maintainers could also replace all these manual
++ * byteswap macros that remain, disseminated among drivers,
++ * after some grep or the sources...
++ * = Linus might want to rename all these macros and files to fit his taste,
++ * to fit his personal naming scheme.
++ * = it seems that a few drivers would also appreciate
++ * nybble swapping support...
++ * = every architecture could add their byteswap macro in asm/byteorder.h
++ * see how some architectures already do (i386, alpha, ppc, etc)
++ * = cpu_to_beXX and beXX_to_cpu might some day need to be well
++ * distinguished throughout the kernel. This is not the case currently,
++ * since little endian, big endian, and pdp endian machines needn't it.
++ * But this might be the case for, say, a port of Linux to 20/21 bit
++ * architectures (and F21 Linux addict around?).
++ */
++
++/*
++ * The following macros are to be defined by <asm/byteorder.h>:
++ *
++ * Conversion of long and short int between network and host format
++ * ntohl(__u32 x)
++ * ntohs(__u16 x)
++ * htonl(__u32 x)
++ * htons(__u16 x)
++ * It seems that some programs (which? where? or perhaps a standard? POSIX?)
++ * might like the above to be functions, not macros (why?).
++ * if that's true, then detect them, and take measures.
++ * Anyway, the measure is: define only ___ntohl as a macro instead,
++ * and in a separate file, have
++ * unsigned long inline ntohl(x){return ___ntohl(x);}
++ *
++ * The same for constant arguments
++ * __constant_ntohl(__u32 x)
++ * __constant_ntohs(__u16 x)
++ * __constant_htonl(__u32 x)
++ * __constant_htons(__u16 x)
++ *
++ * Conversion of XX-bit integers (16- 32- or 64-)
++ * between native CPU format and little/big endian format
++ * 64-bit stuff only defined for proper architectures
++ * cpu_to_[bl]eXX(__uXX x)
++ * [bl]eXX_to_cpu(__uXX x)
++ *
++ * The same, but takes a pointer to the value to convert
++ * cpu_to_[bl]eXXp(__uXX x)
++ * [bl]eXX_to_cpup(__uXX x)
++ *
++ * The same, but change in situ
++ * cpu_to_[bl]eXXs(__uXX x)
++ * [bl]eXX_to_cpus(__uXX x)
++ *
++ * See asm-foo/byteorder.h for examples of how to provide
++ * architecture-optimized versions
++ *
++ */
++
++
++#if defined(PLATFORM_LINUX) || defined(PLATFORM_WINDOWS) || defined(PLATFORM_MPIXEL) || defined(PLATFORM_FREEBSD)
++/*
++ * inside the kernel, we can use nicknames;
++ * outside of it, we must avoid POSIX namespace pollution...
++ */
++#define cpu_to_le64 __cpu_to_le64
++#define le64_to_cpu __le64_to_cpu
++#define cpu_to_le32 __cpu_to_le32
++#define le32_to_cpu __le32_to_cpu
++#define cpu_to_le16 __cpu_to_le16
++#define le16_to_cpu __le16_to_cpu
++#define cpu_to_be64 __cpu_to_be64
++#define be64_to_cpu __be64_to_cpu
++#define cpu_to_be32 __cpu_to_be32
++#define be32_to_cpu __be32_to_cpu
++#define cpu_to_be16 __cpu_to_be16
++#define be16_to_cpu __be16_to_cpu
++#define cpu_to_le64p __cpu_to_le64p
++#define le64_to_cpup __le64_to_cpup
++#define cpu_to_le32p __cpu_to_le32p
++#define le32_to_cpup __le32_to_cpup
++#define cpu_to_le16p __cpu_to_le16p
++#define le16_to_cpup __le16_to_cpup
++#define cpu_to_be64p __cpu_to_be64p
++#define be64_to_cpup __be64_to_cpup
++#define cpu_to_be32p __cpu_to_be32p
++#define be32_to_cpup __be32_to_cpup
++#define cpu_to_be16p __cpu_to_be16p
++#define be16_to_cpup __be16_to_cpup
++#define cpu_to_le64s __cpu_to_le64s
++#define le64_to_cpus __le64_to_cpus
++#define cpu_to_le32s __cpu_to_le32s
++#define le32_to_cpus __le32_to_cpus
++#define cpu_to_le16s __cpu_to_le16s
++#define le16_to_cpus __le16_to_cpus
++#define cpu_to_be64s __cpu_to_be64s
++#define be64_to_cpus __be64_to_cpus
++#define cpu_to_be32s __cpu_to_be32s
++#define be32_to_cpus __be32_to_cpus
++#define cpu_to_be16s __cpu_to_be16s
++#define be16_to_cpus __be16_to_cpus
++#endif
++
++
++/*
++ * Handle ntohl and suches. These have various compatibility
++ * issues - like we want to give the prototype even though we
++ * also have a macro for them in case some strange program
++ * wants to take the address of the thing or something..
++ *
++ * Note that these used to return a "long" in libc5, even though
++ * long is often 64-bit these days.. Thus the casts.
++ *
++ * They have to be macros in order to do the constant folding
++ * correctly - if the argument passed into a inline function
++ * it is no longer constant according to gcc..
++ */
++
++#undef ntohl
++#undef ntohs
++#undef htonl
++#undef htons
++
++/*
++ * Do the prototypes. Somebody might want to take the
++ * address or some such sick thing..
++ */
++#if defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
++extern __u32 ntohl(__u32);
++extern __u32 htonl(__u32);
++#else //defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
++#ifndef PLATFORM_FREEBSD
++extern unsigned long int ntohl(unsigned long int);
++extern unsigned long int htonl(unsigned long int);
++#endif
++#endif
++#ifndef PLATFORM_FREEBSD
++extern unsigned short int ntohs(unsigned short int);
++extern unsigned short int htons(unsigned short int);
++#endif
++
++#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) || defined(PLATFORM_MPIXEL)
++
++#define ___htonl(x) __cpu_to_be32(x)
++#define ___htons(x) __cpu_to_be16(x)
++#define ___ntohl(x) __be32_to_cpu(x)
++#define ___ntohs(x) __be16_to_cpu(x)
++
++#if defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2)
++#define htonl(x) ___htonl(x)
++#define ntohl(x) ___ntohl(x)
++#else
++#define htonl(x) ((unsigned long)___htonl(x))
++#define ntohl(x) ((unsigned long)___ntohl(x))
++#endif
++#define htons(x) ___htons(x)
++#define ntohs(x) ___ntohs(x)
++
++#endif /* OPTIMIZE */
++
++
++#if defined (PLATFORM_WINDOWS)
++
++#define htonl(x) __cpu_to_be32(x)
++#define ntohl(x) __be32_to_cpu(x)
++#define htons(x) __cpu_to_be16(x)
++#define ntohs(x) __be16_to_cpu(x)
++
++
++#endif
++
++#endif /* _LINUX_BYTEORDER_GENERIC_H */
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/little_endian.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,89 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
++#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
++
++#ifndef __LITTLE_ENDIAN
++#define __LITTLE_ENDIAN 1234
++#endif
++#ifndef __LITTLE_ENDIAN_BITFIELD
++#define __LITTLE_ENDIAN_BITFIELD
++#endif
++
++#include <byteorder/swab.h>
++
++#ifndef __constant_htonl
++#define __constant_htonl(x) ___constant_swab32((x))
++#define __constant_ntohl(x) ___constant_swab32((x))
++#define __constant_htons(x) ___constant_swab16((x))
++#define __constant_ntohs(x) ___constant_swab16((x))
++#define __constant_cpu_to_le64(x) ((__u64)(x))
++#define __constant_le64_to_cpu(x) ((__u64)(x))
++#define __constant_cpu_to_le32(x) ((__u32)(x))
++#define __constant_le32_to_cpu(x) ((__u32)(x))
++#define __constant_cpu_to_le16(x) ((__u16)(x))
++#define __constant_le16_to_cpu(x) ((__u16)(x))
++#define __constant_cpu_to_be64(x) ___constant_swab64((x))
++#define __constant_be64_to_cpu(x) ___constant_swab64((x))
++#define __constant_cpu_to_be32(x) ___constant_swab32((x))
++#define __constant_be32_to_cpu(x) ___constant_swab32((x))
++#define __constant_cpu_to_be16(x) ___constant_swab16((x))
++#define __constant_be16_to_cpu(x) ___constant_swab16((x))
++#define __cpu_to_le64(x) ((__u64)(x))
++#define __le64_to_cpu(x) ((__u64)(x))
++#define __cpu_to_le32(x) ((__u32)(x))
++#define __le32_to_cpu(x) ((__u32)(x))
++#define __cpu_to_le16(x) ((__u16)(x))
++#define __le16_to_cpu(x) ((__u16)(x))
++#define __cpu_to_be64(x) __swab64((x))
++#define __be64_to_cpu(x) __swab64((x))
++#define __cpu_to_be32(x) __swab32((x))
++#define __be32_to_cpu(x) __swab32((x))
++#define __cpu_to_be16(x) __swab16((x))
++#define __be16_to_cpu(x) __swab16((x))
++#define __cpu_to_le64p(x) (*(__u64*)(x))
++#define __le64_to_cpup(x) (*(__u64*)(x))
++#define __cpu_to_le32p(x) (*(__u32*)(x))
++#define __le32_to_cpup(x) (*(__u32*)(x))
++#define __cpu_to_le16p(x) (*(__u16*)(x))
++#define __le16_to_cpup(x) (*(__u16*)(x))
++#define __cpu_to_be64p(x) __swab64p((x))
++#define __be64_to_cpup(x) __swab64p((x))
++#define __cpu_to_be32p(x) __swab32p((x))
++#define __be32_to_cpup(x) __swab32p((x))
++#define __cpu_to_be16p(x) __swab16p((x))
++#define __be16_to_cpup(x) __swab16p((x))
++#define __cpu_to_le64s(x) do {} while (0)
++#define __le64_to_cpus(x) do {} while (0)
++#define __cpu_to_le32s(x) do {} while (0)
++#define __le32_to_cpus(x) do {} while (0)
++#define __cpu_to_le16s(x) do {} while (0)
++#define __le16_to_cpus(x) do {} while (0)
++#define __cpu_to_be64s(x) __swab64s((x))
++#define __be64_to_cpus(x) __swab64s((x))
++#define __cpu_to_be32s(x) __swab32s((x))
++#define __be32_to_cpus(x) __swab32s((x))
++#define __cpu_to_be16s(x) __swab16s((x))
++#define __be16_to_cpus(x) __swab16s((x))
++#endif // __constant_htonl
++
++#include <byteorder/generic.h>
++
++#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swab.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,140 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _LINUX_BYTEORDER_SWAB_H
++#define _LINUX_BYTEORDER_SWAB_H
++
++#if !defined(CONFIG_PLATFORM_MSTAR)
++#ifndef __u16
++typedef unsigned short __u16;
++#endif
++
++#ifndef __u32
++typedef unsigned int __u32;
++#endif
++
++#ifndef __u8
++typedef unsigned char __u8;
++#endif
++
++#ifndef __u64
++typedef unsigned long long __u64;
++#endif
++
++
++__inline static __u16 ___swab16(__u16 x)
++{
++ __u16 __x = x;
++ return
++ ((__u16)(
++ (((__u16)(__x) & (__u16)0x00ffU) << 8) |
++ (((__u16)(__x) & (__u16)0xff00U) >> 8) ));
++
++}
++
++__inline static __u32 ___swab32(__u32 x)
++{
++ __u32 __x = (x);
++ return ((__u32)(
++ (((__u32)(__x) & (__u32)0x000000ffUL) << 24) |
++ (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) |
++ (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) |
++ (((__u32)(__x) & (__u32)0xff000000UL) >> 24) ));
++}
++
++__inline static __u64 ___swab64(__u64 x)
++{
++ __u64 __x = (x);
++
++ return
++ ((__u64)( \
++ (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
++ (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
++ (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
++ (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
++ (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
++ (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
++ (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
++ (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
++}
++#endif // CONFIG_PLATFORM_MSTAR
++
++#ifndef __arch__swab16
++__inline static __u16 __arch__swab16(__u16 x)
++{
++ return ___swab16(x);
++}
++
++#endif
++
++#ifndef __arch__swab32
++__inline static __u32 __arch__swab32(__u32 x)
++{
++ __u32 __tmp = (x) ;
++ return ___swab32(__tmp);
++}
++#endif
++
++#ifndef __arch__swab64
++
++__inline static __u64 __arch__swab64(__u64 x)
++{
++ __u64 __tmp = (x) ;
++ return ___swab64(__tmp);
++}
++
++
++#endif
++
++#ifndef __swab16
++#define __swab16(x) __fswab16(x)
++#define __swab32(x) __fswab32(x)
++#define __swab64(x) __fswab64(x)
++#endif // __swab16
++
++#ifdef PLATFORM_FREEBSD
++__inline static __u16 __fswab16(__u16 x)
++#else
++__inline static const __u16 __fswab16(__u16 x)
++#endif //PLATFORM_FREEBSD
++{
++ return __arch__swab16(x);
++}
++#ifdef PLATFORM_FREEBSD
++__inline static __u32 __fswab32(__u32 x)
++#else
++__inline static const __u32 __fswab32(__u32 x)
++#endif //PLATFORM_FREEBSD
++{
++ return __arch__swab32(x);
++}
++
++#if defined(PLATFORM_LINUX) || defined(PLATFORM_WINDOWS)
++#define swab16 __swab16
++#define swab32 __swab32
++#define swab64 __swab64
++#define swab16p __swab16p
++#define swab32p __swab32p
++#define swab64p __swab64p
++#define swab16s __swab16s
++#define swab32s __swab32s
++#define swab64s __swab64s
++#endif
++
++#endif /* _LINUX_BYTEORDER_SWAB_H */
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/byteorder/swabb.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,156 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _LINUX_BYTEORDER_SWABB_H
++#define _LINUX_BYTEORDER_SWABB_H
++
++/*
++ * linux/byteorder/swabb.h
++ * SWAp Bytes Bizarrely
++ * swaHHXX[ps]?(foo)
++ *
++ * Support for obNUXIous pdp-endian and other bizarre architectures.
++ * Will Linux ever run on such ancient beasts? if not, this file
++ * will be but a programming pearl. Still, it's a reminder that we
++ * shouldn't be making too many assumptions when trying to be portable.
++ *
++ */
++
++/*
++ * Meaning of the names I chose (vaxlinux people feel free to correct them):
++ * swahw32 swap 16-bit half-words in a 32-bit word
++ * swahb32 swap 8-bit halves of each 16-bit half-word in a 32-bit word
++ *
++ * No 64-bit support yet. I don't know NUXI conventions for long longs.
++ * I guarantee it will be a mess when it's there, though :->
++ * It will be even worse if there are conflicting 64-bit conventions.
++ * Hopefully, no one ever used 64-bit objects on NUXI machines.
++ *
++ */
++
++#define ___swahw32(x) \
++({ \
++ __u32 __x = (x); \
++ ((__u32)( \
++ (((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | \
++ (((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); \
++})
++#define ___swahb32(x) \
++({ \
++ __u32 __x = (x); \
++ ((__u32)( \
++ (((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | \
++ (((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); \
++})
++
++#define ___constant_swahw32(x) \
++ ((__u32)( \
++ (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
++ (((__u32)(x) & (__u32)0xffff0000UL) >> 16) ))
++#define ___constant_swahb32(x) \
++ ((__u32)( \
++ (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
++ (((__u32)(x) & (__u32)0xff00ff00UL) >> 8) ))
++
++/*
++ * provide defaults when no architecture-specific optimization is detected
++ */
++#ifndef __arch__swahw32
++# define __arch__swahw32(x) ___swahw32(x)
++#endif
++#ifndef __arch__swahb32
++# define __arch__swahb32(x) ___swahb32(x)
++#endif
++
++#ifndef __arch__swahw32p
++# define __arch__swahw32p(x) __swahw32(*(x))
++#endif
++#ifndef __arch__swahb32p
++# define __arch__swahb32p(x) __swahb32(*(x))
++#endif
++
++#ifndef __arch__swahw32s
++# define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0)
++#endif
++#ifndef __arch__swahb32s
++# define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0)
++#endif
++
++
++/*
++ * Allow constant folding
++ */
++#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
++# define __swahw32(x) \
++(__builtin_constant_p((__u32)(x)) ? \
++ ___swahw32((x)) : \
++ __fswahw32((x)))
++# define __swahb32(x) \
++(__builtin_constant_p((__u32)(x)) ? \
++ ___swahb32((x)) : \
++ __fswahb32((x)))
++#else
++# define __swahw32(x) __fswahw32(x)
++# define __swahb32(x) __fswahb32(x)
++#endif /* OPTIMIZE */
++
++
++__inline static__ __const__ __u32 __fswahw32(__u32 x)
++{
++ return __arch__swahw32(x);
++}
++__inline static__ __u32 __swahw32p(__u32 *x)
++{
++ return __arch__swahw32p(x);
++}
++__inline static__ void __swahw32s(__u32 *addr)
++{
++ __arch__swahw32s(addr);
++}
++
++
++__inline static__ __const__ __u32 __fswahb32(__u32 x)
++{
++ return __arch__swahb32(x);
++}
++__inline static__ __u32 __swahb32p(__u32 *x)
++{
++ return __arch__swahb32p(x);
++}
++__inline static__ void __swahb32s(__u32 *addr)
++{
++ __arch__swahb32s(addr);
++}
++
++#ifdef __BYTEORDER_HAS_U64__
++/*
++ * Not supported yet
++ */
++#endif /* __BYTEORDER_HAS_U64__ */
++
++#if defined(PLATFORM_LINUX)
++#define swahw32 __swahw32
++#define swahb32 __swahb32
++#define swahw32p __swahw32p
++#define swahb32p __swahb32p
++#define swahw32s __swahw32s
++#define swahb32s __swahb32s
++#endif
++
++#endif /* _LINUX_BYTEORDER_SWABB_H */
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/circ_buf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/circ_buf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/circ_buf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/circ_buf.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,27 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __CIRC_BUF_H_
++#define __CIRC_BUF_H_ 1
++
++#define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1))
++
++#define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size))
++
++#endif //_CIRC_BUF_H_
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h linux-rpi/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/cmd_osdep.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,35 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __CMD_OSDEP_H_
++#define __CMD_OSDEP_H_
++
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++#include <drv_types.h>
++
++extern sint _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv);
++extern sint _rtw_init_evt_priv(struct evt_priv *pevtpriv);
++extern void _rtw_free_evt_priv (struct evt_priv *pevtpriv);
++extern void _rtw_free_cmd_priv (struct cmd_priv *pcmdpriv);
++extern sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj);
++extern struct cmd_obj *_rtw_dequeue_cmd(_queue *queue);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_conf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_conf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_conf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_conf.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,77 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __DRV_CONF_H__
++#define __DRV_CONF_H__
++#include "autoconf.h"
++
++#if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
++
++#error "Shall be Linux or Windows, but not both!\n"
++
++#endif
++
++//Older Android kernel doesn't has CONFIG_ANDROID defined,
++//add this to force CONFIG_ANDROID defined
++#ifdef CONFIG_PLATFORM_ANDROID
++#define CONFIG_ANDROID
++#endif
++
++#ifdef CONFIG_ANDROID
++//Some Android build will restart the UI while non-printable ascii is passed
++//between java and c/c++ layer (JNI). We force CONFIG_VALIDATE_SSID
++//for Android here. If you are sure there is no risk on your system about this,
++//mask this macro define to support non-printable ascii ssid.
++//#define CONFIG_VALIDATE_SSID
++
++//Android expect dbm as the rx signal strength unit
++#define CONFIG_SIGNAL_DISPLAY_DBM
++#endif
++
++#if defined(CONFIG_HAS_EARLYSUSPEND) && defined (CONFIG_RESUME_IN_WORKQUEUE)
++ #warning "You have CONFIG_HAS_EARLYSUSPEND enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
++ #undef CONFIG_RESUME_IN_WORKQUEUE
++#endif
++
++#if defined(CONFIG_ANDROID_POWER) && defined (CONFIG_RESUME_IN_WORKQUEUE)
++ #warning "You have CONFIG_ANDROID_POWER enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
++ #undef CONFIG_RESUME_IN_WORKQUEUE
++#endif
++
++#ifdef CONFIG_RESUME_IN_WORKQUEUE //this can be removed, because there is no case for this...
++ #if !defined( CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
++ #error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
++ #error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
++ #endif
++#endif
++
++//About USB VENDOR REQ
++#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
++ #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically"
++ #define CONFIG_USB_VENDOR_REQ_MUTEX
++#endif
++#if defined(CONFIG_VENDOR_REQ_RETRY) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
++ #warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_VENDOR_REQ_RETRY automatically"
++ #define CONFIG_USB_VENDOR_REQ_MUTEX
++#endif
++
++
++//#include <rtl871x_byteorder.h>
++
++#endif // __DRV_CONF_H__
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types.h linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,661 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++/*-------------------------------------------------------------------------------
++
++ For type defines and data structure defines
++
++--------------------------------------------------------------------------------*/
++
++
++#ifndef __DRV_TYPES_H__
++#define __DRV_TYPES_H__
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++#include <wlan_bssdef.h>
++
++
++#ifdef PLATFORM_OS_XP
++#include <drv_types_xp.h>
++#endif
++
++#ifdef PLATFORM_OS_CE
++#include <drv_types_ce.h>
++#endif
++
++#ifdef PLATFORM_LINUX
++#include <drv_types_linux.h>
++#endif
++
++enum _NIC_VERSION {
++
++ RTL8711_NIC,
++ RTL8712_NIC,
++ RTL8713_NIC,
++ RTL8716_NIC
++
++};
++
++enum{
++ UP_LINK,
++ DOWN_LINK,
++};
++typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
++
++#ifdef CONFIG_80211N_HT
++#include <rtw_ht.h>
++#endif
++
++#include <rtw_cmd.h>
++#include <wlan_bssdef.h>
++#include <rtw_security.h>
++#include <rtw_xmit.h>
++#include <rtw_recv.h>
++#include <hal_intf.h>
++#include <hal_com.h>
++#include <rtw_qos.h>
++#include <rtw_pwrctrl.h>
++#include <rtw_io.h>
++#include <rtw_eeprom.h>
++#include <sta_info.h>
++#include <rtw_mlme.h>
++#include <rtw_debug.h>
++#include <rtw_rf.h>
++#include <rtw_event.h>
++#include <rtw_led.h>
++#include <rtw_mlme_ext.h>
++#include <rtw_p2p.h>
++#include <rtw_tdls.h>
++#include <rtw_ap.h>
++
++#ifdef CONFIG_DRVEXT_MODULE
++#include <drvext_api.h>
++#endif
++
++#ifdef CONFIG_MP_INCLUDED
++#include <rtw_mp.h>
++#endif
++
++#ifdef CONFIG_BR_EXT
++#include <rtw_br_ext.h>
++#endif // CONFIG_BR_EXT
++
++#ifdef CONFIG_IOCTL_CFG80211
++ #include "ioctl_cfg80211.h"
++#endif //CONFIG_IOCTL_CFG80211
++
++#define SPEC_DEV_ID_NONE BIT(0)
++#define SPEC_DEV_ID_DISABLE_HT BIT(1)
++#define SPEC_DEV_ID_ENABLE_PS BIT(2)
++#define SPEC_DEV_ID_RF_CONFIG_1T1R BIT(3)
++#define SPEC_DEV_ID_RF_CONFIG_2T2R BIT(4)
++#define SPEC_DEV_ID_ASSIGN_IFNAME BIT(5)
++
++struct specific_device_id{
++
++ u32 flags;
++
++ u16 idVendor;
++ u16 idProduct;
++
++};
++
++struct registry_priv
++{
++ u8 chip_version;
++ u8 rfintfs;
++ u8 lbkmode;
++ u8 hci;
++ NDIS_802_11_SSID ssid;
++ u8 network_mode; //infra, ad-hoc, auto
++ u8 channel;//ad-hoc support requirement
++ u8 wireless_mode;//A, B, G, auto
++ u8 scan_mode;//active, passive
++ u8 radio_enable;
++ u8 preamble;//long, short, auto
++ u8 vrtl_carrier_sense;//Enable, Disable, Auto
++ u8 vcs_type;//RTS/CTS, CTS-to-self
++ u16 rts_thresh;
++ u16 frag_thresh;
++ u8 adhoc_tx_pwr;
++ u8 soft_ap;
++ u8 power_mgnt;
++ u8 ips_mode;
++ u8 smart_ps;
++ u8 long_retry_lmt;
++ u8 short_retry_lmt;
++ u16 busy_thresh;
++ u8 ack_policy;
++ u8 mp_mode;
++ u8 software_encrypt;
++ u8 software_decrypt;
++
++ u8 acm_method;
++ //UAPSD
++ u8 wmm_enable;
++ u8 uapsd_enable;
++ u8 uapsd_max_sp;
++ u8 uapsd_acbk_en;
++ u8 uapsd_acbe_en;
++ u8 uapsd_acvi_en;
++ u8 uapsd_acvo_en;
++
++ WLAN_BSSID_EX dev_network;
++
++#ifdef CONFIG_80211N_HT
++ u8 ht_enable;
++ u8 cbw40_enable;
++ u8 ampdu_enable;//for tx
++ u8 rx_stbc;
++ u8 ampdu_amsdu;//A-MPDU Supports A-MSDU is permitted
++#endif
++ u8 lowrate_two_xmit;
++
++ u8 rf_config ;
++ u8 low_power ;
++
++ u8 wifi_spec;// !turbo_mode
++
++ u8 channel_plan;
++#ifdef CONFIG_BT_COEXIST
++ u8 bt_iso;
++ u8 bt_sco;
++ u8 bt_ampdu;
++#endif
++ BOOLEAN bAcceptAddbaReq;
++
++ u8 antdiv_cfg;
++
++ u8 usbss_enable;//0:disable,1:enable
++ u8 hwpdn_mode;//0:disable,1:enable,2:decide by EFUSE config
++ u8 hwpwrp_detect;//0:disable,1:enable
++
++ u8 hw_wps_pbc;//0:disable,1:enable
++
++#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
++ char adaptor_info_caching_file_path[PATH_LENGTH_MAX];
++#endif
++
++#ifdef CONFIG_LAYER2_ROAMING
++ u8 max_roaming_times; // the max number driver will try to roaming
++#endif
++
++#ifdef CONFIG_IOL
++ bool force_iol; //enable iol without other concern
++#endif
++ u8 special_rf_path; //0: 2T2R ,1: only turn on path A 1T1R, 2: only turn on path B 1T1R
++ u8 mac_phy_mode; //0:by efuse, 1:smsp, 2:dmdp, 3:dmsp.
++
++#ifdef CONFIG_80211D
++ u8 enable80211d;
++#endif
++
++ u8 ifname[16];
++ u8 if2name[16];
++
++ u8 notch_filter;
++
++#ifdef CONFIG_MULTI_VIR_IFACES
++ u8 ext_iface_num;//primary/secondary iface is excluded
++#endif
++};
++
++
++//For registry parameters
++#define RGTRY_OFT(field) ((ULONG)FIELD_OFFSET(struct registry_priv,field))
++#define RGTRY_SZ(field) sizeof(((struct registry_priv*) 0)->field)
++#define BSSID_OFT(field) ((ULONG)FIELD_OFFSET(WLAN_BSSID_EX,field))
++#define BSSID_SZ(field) sizeof(((PWLAN_BSSID_EX) 0)->field)
++
++#define MAX_CONTINUAL_URB_ERR 4
++
++#ifdef CONFIG_SDIO_HCI
++#include <drv_types_sdio.h>
++#define INTF_DATA SDIO_DATA
++#endif
++
++#define GET_PRIMARY_ADAPTER(padapter) (((_adapter *)padapter)->dvobj->if1)
++
++#define GET_IFACE_NUMS(padapter) (((_adapter *)padapter)->dvobj->iface_nums)
++#define GET_ADAPTER(padapter, iface_id) (((_adapter *)padapter)->dvobj->padapters[iface_id])
++
++enum _IFACE_ID {
++ IFACE_ID0, //maping to PRIMARY_ADAPTER
++ IFACE_ID1, //maping to SECONDARY_ADAPTER
++ IFACE_ID2,
++ IFACE_ID3,
++ IFACE_ID_MAX,
++};
++
++struct dvobj_priv
++{
++ _adapter *if1; //PRIMARY_ADAPTER
++ _adapter *if2; //SECONDARY_ADAPTER
++
++ s32 processing_dev_remove;
++
++ //for local/global synchronization
++ _mutex hw_init_mutex;
++ _mutex h2c_fwcmd_mutex;
++ _mutex setch_mutex;
++ _mutex setbw_mutex;
++
++ unsigned char oper_channel; //saved channel info when call set_channel_bw
++ unsigned char oper_bwmode;
++ unsigned char oper_ch_offset;//PRIME_CHNL_OFFSET
++ u32 on_oper_ch_time;
++
++ //extend to support mulitu interface
++ //padapters[IFACE_ID0] == if1
++ //padapters[IFACE_ID1] == if2
++ _adapter *padapters[IFACE_ID_MAX];
++ u8 iface_nums; // total number of ifaces used runtime
++
++ //For 92D, DMDP have 2 interface.
++ u8 InterfaceNumber;
++ u8 NumInterfaces;
++ u8 DualMacMode;
++ u8 irq_alloc;
++
++/*-------- below is for SDIO INTERFACE --------*/
++
++#ifdef INTF_DATA
++ INTF_DATA intf_data;
++#endif
++
++/*-------- below is for USB INTERFACE --------*/
++
++#ifdef CONFIG_USB_HCI
++
++ u8 nr_endpoint;
++ u8 ishighspeed;
++ u8 RtNumInPipes;
++ u8 RtNumOutPipes;
++ int ep_num[5]; //endpoint number
++
++ int RegUsbSS;
++
++ _sema usb_suspend_sema;
++
++#ifdef CONFIG_USB_VENDOR_REQ_MUTEX
++ _mutex usb_vendor_req_mutex;
++#endif
++
++#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
++ u8 * usb_alloc_vendor_req_buf;
++ u8 * usb_vendor_req_buf;
++#endif
++
++#ifdef PLATFORM_WINDOWS
++ //related device objects
++ PDEVICE_OBJECT pphysdevobj;//pPhysDevObj;
++ PDEVICE_OBJECT pfuncdevobj;//pFuncDevObj;
++ PDEVICE_OBJECT pnextdevobj;//pNextDevObj;
++
++ u8 nextdevstacksz;//unsigned char NextDeviceStackSize; //= (CHAR)CEdevice->pUsbDevObj->StackSize + 1;
++
++ //urb for control diescriptor request
++
++#ifdef PLATFORM_OS_XP
++ struct _URB_CONTROL_DESCRIPTOR_REQUEST descriptor_urb;
++ PUSB_CONFIGURATION_DESCRIPTOR pconfig_descriptor;//UsbConfigurationDescriptor;
++#endif
++
++#ifdef PLATFORM_OS_CE
++ WCHAR active_path[MAX_ACTIVE_REG_PATH]; // adapter regpath
++ USB_EXTENSION usb_extension;
++
++ _nic_hdl pipehdls_r8192c[0x10];
++#endif
++
++ u32 config_descriptor_len;//ULONG UsbConfigurationDescriptorLength;
++#endif//PLATFORM_WINDOWS
++
++#ifdef PLATFORM_LINUX
++ struct usb_interface *pusbintf;
++ struct usb_device *pusbdev;
++#endif//PLATFORM_LINUX
++
++#ifdef PLATFORM_FREEBSD
++ struct usb_interface *pusbintf;
++ struct usb_device *pusbdev;
++#endif//PLATFORM_FREEBSD
++ ATOMIC_T continual_urb_error;
++#endif//CONFIG_USB_HCI
++
++/*-------- below is for PCIE INTERFACE --------*/
++
++#ifdef CONFIG_PCI_HCI
++
++#ifdef PLATFORM_LINUX
++ struct pci_dev *ppcidev;
++
++ //PCI MEM map
++ unsigned long pci_mem_end; /* shared mem end */
++ unsigned long pci_mem_start; /* shared mem start */
++
++ //PCI IO map
++ unsigned long pci_base_addr; /* device I/O address */
++
++ //PciBridge
++ struct pci_priv pcipriv;
++
++ u16 irqline;
++ u8 irq_enabled;
++ RT_ISR_CONTENT isr_content;
++ _lock irq_th_lock;
++
++ //ASPM
++ u8 const_pci_aspm;
++ u8 const_amdpci_aspm;
++ u8 const_hwsw_rfoff_d3;
++ u8 const_support_pciaspm;
++ // pci-e bridge */
++ u8 const_hostpci_aspm_setting;
++ // pci-e device */
++ u8 const_devicepci_aspm_setting;
++ u8 b_support_aspm; // If it supports ASPM, Offset[560h] = 0x40, otherwise Offset[560h] = 0x00.
++ u8 b_support_backdoor;
++ u8 bdma64;
++#endif//PLATFORM_LINUX
++
++#endif//CONFIG_PCI_HCI
++};
++
++#ifdef PLATFORM_LINUX
++static struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
++{
++ /* todo: get interface type from dvobj and the return the dev accordingly */
++#ifdef RTW_DVOBJ_CHIP_HW_TYPE
++#endif
++
++#ifdef CONFIG_USB_HCI
++ return &dvobj->pusbintf->dev;
++#endif
++#ifdef CONFIG_SDIO_HCI
++ return &dvobj->intf_data.func->dev;
++#endif
++#ifdef CONFIG_PCI_HCI
++ return &dvobj->ppcidev->dev;
++#endif
++}
++#endif
++
++
++enum _IFACE_TYPE {
++ IFACE_PORT0, //mapping to port0 for C/D series chips
++ IFACE_PORT1, //mapping to port1 for C/D series chip
++ MAX_IFACE_PORT,
++};
++
++enum _ADAPTER_TYPE {
++ PRIMARY_ADAPTER,
++ SECONDARY_ADAPTER,
++ MAX_ADAPTER = 0xFF,
++};
++
++typedef enum _DRIVER_STATE{
++ DRIVER_NORMAL = 0,
++ DRIVER_DISAPPEAR = 1,
++ DRIVER_REPLACE_DONGLE = 2,
++}DRIVER_STATE;
++
++#ifdef CONFIG_INTEL_PROXIM
++struct proxim {
++ bool proxim_support;
++ bool proxim_on;
++
++ void *proximity_priv;
++ int (*proxim_rx)(_adapter *padapter,
++ union recv_frame *precv_frame);
++ u8 (*proxim_get_var)(_adapter* padapter, u8 type);
++};
++#endif //CONFIG_INTEL_PROXIM
++
++#ifdef RTL8723A_SDIO_LOOPBACK
++typedef struct loopbackdata
++{
++ _sema sema;
++ _thread_hdl_ lbkthread;
++ u8 bstop;
++ u32 cnt;
++ u16 size;
++ u16 txsize;
++ u8 txbuf[0x8000];
++ u16 rxsize;
++ u8 rxbuf[0x8000];
++ u8 msg[100];
++
++}LOOPBACKDATA, *PLOOPBACKDATA;
++#endif
++
++struct _ADAPTER{
++ int DriverState;// for disable driver using module, use dongle to replace module.
++ int pid[3];//process id from UI, 0:wps, 1:hostapd, 2:dhcpcd
++ int bDongle;//build-in module or external dongle
++ u16 chip_type;
++ u16 HardwareType;
++ u16 interface_type;//USB,SDIO,PCI
++
++ struct dvobj_priv *dvobj;
++ struct mlme_priv mlmepriv;
++ struct mlme_ext_priv mlmeextpriv;
++ struct cmd_priv cmdpriv;
++ struct evt_priv evtpriv;
++ //struct io_queue *pio_queue;
++ struct io_priv iopriv;
++ struct xmit_priv xmitpriv;
++ struct recv_priv recvpriv;
++ struct sta_priv stapriv;
++ struct security_priv securitypriv;
++ _lock security_key_mutex; // add for CONFIG_IEEE80211W, none 11w also can use
++ struct registry_priv registrypriv;
++ struct pwrctrl_priv pwrctrlpriv;
++ struct eeprom_priv eeprompriv;
++ struct led_priv ledpriv;
++
++#ifdef CONFIG_MP_INCLUDED
++ struct mp_priv mppriv;
++#endif
++
++#ifdef CONFIG_DRVEXT_MODULE
++ struct drvext_priv drvextpriv;
++#endif
++
++#ifdef CONFIG_AP_MODE
++ struct hostapd_priv *phostapdpriv;
++#endif
++
++#ifdef CONFIG_IOCTL_CFG80211
++#ifdef CONFIG_P2P
++ struct cfg80211_wifidirect_info cfg80211_wdinfo;
++#endif //CONFIG_P2P
++#endif //CONFIG_IOCTL_CFG80211
++ u32 setband;
++#ifdef CONFIG_P2P
++ struct wifidirect_info wdinfo;
++#endif //CONFIG_P2P
++
++#ifdef CONFIG_TDLS
++ struct tdls_info tdlsinfo;
++#endif //CONFIG_TDLS
++
++#ifdef CONFIG_WFD
++ struct wifi_display_info wfd_info;
++#endif //CONFIG_WFD
++
++ PVOID HalData;
++ u32 hal_data_sz;
++ struct hal_ops HalFunc;
++
++#ifdef CONFIG_BT_COEXIST
++ //struct btcoexist_priv bt_coexist;
++#endif
++ s32 bDriverStopped;
++ s32 bSurpriseRemoved;
++ s32 bCardDisableWOHSM;
++
++ u32 IsrContent;
++ u32 ImrContent;
++
++ u8 EepromAddressSize;
++ u8 hw_init_completed;
++ u8 bDriverIsGoingToUnload;
++ u8 init_adpt_in_progress;
++ u8 bHaltInProgress;
++
++ _thread_hdl_ cmdThread;
++ _thread_hdl_ evtThread;
++ _thread_hdl_ xmitThread;
++ _thread_hdl_ recvThread;
++
++#ifndef PLATFORM_LINUX
++ NDIS_STATUS (*dvobj_init)(struct dvobj_priv *dvobj);
++ void (*dvobj_deinit)(struct dvobj_priv *dvobj);
++#endif
++
++ void (*intf_start)(_adapter * adapter);
++ void (*intf_stop)(_adapter * adapter);
++
++#ifdef PLATFORM_WINDOWS
++ _nic_hdl hndis_adapter;//hNdisAdapter(NDISMiniportAdapterHandle);
++ _nic_hdl hndis_config;//hNdisConfiguration;
++ NDIS_STRING fw_img;
++
++ u32 NdisPacketFilter;
++ u8 MCList[MAX_MCAST_LIST_NUM][6];
++ u32 MCAddrCount;
++#endif //end of PLATFORM_WINDOWS
++
++
++#ifdef PLATFORM_LINUX
++ _nic_hdl pnetdev;
++
++ // used by rtw_rereg_nd_name related function
++ struct rereg_nd_name_data {
++ _nic_hdl old_pnetdev;
++ char old_ifname[IFNAMSIZ];
++ u8 old_ips_mode;
++ u8 old_bRegUseLed;
++ } rereg_nd_name_priv;
++
++ int bup;
++ struct net_device_stats stats;
++ struct iw_statistics iwstats;
++ struct proc_dir_entry *dir_dev;// for proc directory
++
++#ifdef CONFIG_IOCTL_CFG80211
++ struct wireless_dev *rtw_wdev;
++#endif //CONFIG_IOCTL_CFG80211
++
++#endif //end of PLATFORM_LINUX
++
++#ifdef PLATFORM_FREEBSD
++ _nic_hdl pifp;
++ int bup;
++ _lock glock;
++#endif //PLATFORM_FREEBSD
++ int net_closed;
++
++ u8 bFWReady;
++ u8 bReadPortCancel;
++ u8 bWritePortCancel;
++ u8 bRxRSSIDisplay;
++ // Added by Albert 2012/07/26
++ // The driver will write the initial gain everytime when running in the DM_Write_DIG function.
++ u8 bForceWriteInitGain;
++ // Added by Albert 2012/10/26
++ // The driver will show up the desired channel number when this flag is 1.
++ u8 bNotifyChannelChange;
++#ifdef CONFIG_P2P
++ // Added by Albert 2012/12/06
++ // The driver will show the current P2P status when the upper application reads it.
++ u8 bShowGetP2PState;
++#endif
++#ifdef CONFIG_AUTOSUSPEND
++ u8 bDisableAutosuspend;
++#endif
++
++ //pbuddy_adapter is used only in two inteface case, (iface_nums=2 in struct dvobj_priv)
++ //PRIMARY_ADAPTER's buddy is SECONDARY_ADAPTER
++ //SECONDARY_ADAPTER's buddy is PRIMARY_ADAPTER
++ //for iface_id > SECONDARY_ADAPTER(IFACE_ID1), refer to padapters[iface_id] in struct dvobj_priv
++ //and their pbuddy_adapter is PRIMARY_ADAPTER.
++ //for PRIMARY_ADAPTER(IFACE_ID0) can directly refer to if1 in struct dvobj_priv
++ _adapter *pbuddy_adapter;
++
++#if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_DUALMAC_CONCURRENT)
++ u8 isprimary; //is primary adapter or not
++ //notes:
++ // if isprimary is true, the adapter_type value is 0, iface_id is IFACE_ID0 for PRIMARY_ADAPTER
++ // if isprimary is false, the adapter_type value is 1, iface_id is IFACE_ID1 for SECONDARY_ADAPTER
++ // refer to iface_id if iface_nums>2 and isprimary is false and the adapter_type value is 0xff.
++ u8 adapter_type;//used only in two inteface case(PRIMARY_ADAPTER and SECONDARY_ADAPTER) .
++ u8 iface_type; //interface port type, it depends on HW port
++#endif
++
++ //extend to support multi interface
++ //IFACE_ID0 is equals to PRIMARY_ADAPTER
++ //IFACE_ID1 is equals to SECONDARY_ADAPTER
++ u8 iface_id;
++
++#ifdef CONFIG_DUALMAC_CONCURRENT
++ u8 DualMacConcurrent; // 1: DMSP 0:DMDP
++#endif
++
++#ifdef CONFIG_BR_EXT
++ _lock br_ext_lock;
++ //unsigned int macclone_completed;
++ struct nat25_network_db_entry *nethash[NAT25_HASH_SIZE];
++ int pppoe_connection_in_progress;
++ unsigned char pppoe_addr[MACADDRLEN];
++ unsigned char scdb_mac[MACADDRLEN];
++ unsigned char scdb_ip[4];
++ struct nat25_network_db_entry *scdb_entry;
++ unsigned char br_mac[MACADDRLEN];
++ unsigned char br_ip[4];
++
++ struct br_ext_info ethBrExtInfo;
++#endif // CONFIG_BR_EXT
++
++#ifdef CONFIG_INTEL_PROXIM
++ /* intel Proximity, should be alloc mem
++ * in intel Proximity module and can only
++ * be used in intel Proximity mode */
++ struct proxim proximity;
++#endif //CONFIG_INTEL_PROXIM
++
++#ifdef RTL8723A_SDIO_LOOPBACK
++ PLOOPBACKDATA ploopback;
++#endif
++
++};
++
++#define adapter_to_dvobj(adapter) (adapter->dvobj)
++
++int rtw_handle_dualmac(_adapter *adapter, bool init);
++
++__inline static u8 *myid(struct eeprom_priv *peepriv)
++{
++ return (peepriv->mac_addr);
++}
++
++
++#endif //__DRV_TYPES_H__
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_ce.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,92 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __DRV_TYPES_CE_H__
++#define __DRV_TYPES_CE_H__
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++
++#include <Sdcardddk.h>
++
++#define MAX_ACTIVE_REG_PATH 256
++
++#define MAX_MCAST_LIST_NUM 32
++
++
++
++//for ioctl
++#define MAKE_DRIVER_VERSION(_MainVer,_MinorVer) ((((u32)(_MainVer))<<16)+_MinorVer)
++
++#define NIC_HEADER_SIZE 14 //!< can be moved to typedef.h
++#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
++#define NIC_MAX_SEND_PACKETS 10 // max number of send packets the MiniportSendPackets function can accept, can be moved to typedef.h
++#define NIC_VENDOR_DRIVER_VERSION MAKE_DRIVER_VERSION(0,001) //!< can be moved to typedef.h
++#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
++
++typedef struct _MP_REG_ENTRY
++{
++
++ NDIS_STRING RegName; // variable name text
++ BOOLEAN bRequired; // 1 -> required, 0 -> optional
++
++ u8 Type; // NdisParameterInteger/NdisParameterHexInteger/NdisParameterStringle/NdisParameterMultiString
++ uint FieldOffset; // offset to MP_ADAPTER field
++ uint FieldSize; // size (in bytes) of the field
++
++#ifdef UNDER_AMD64
++ u64 Default;
++#else
++ u32 Default; // default value to use
++#endif
++
++ u32 Min; // minimum value allowed
++ u32 Max; // maximum value allowed
++} MP_REG_ENTRY, *PMP_REG_ENTRY;
++
++#ifdef CONFIG_USB_HCI
++typedef struct _USB_EXTENSION {
++ LPCUSB_FUNCS _lpUsbFuncs;
++ USB_HANDLE _hDevice;
++ PVOID pAdapter;
++
++#if 0
++ USB_ENDPOINT_DESCRIPTOR _endpACLIn;
++ USB_ENDPOINT_DESCRIPTOR _endpACLOutHigh;
++ USB_ENDPOINT_DESCRIPTOR _endpACLOutNormal;
++
++ USB_PIPE pPipeIn;
++ USB_PIPE pPipeOutNormal;
++ USB_PIPE pPipeOutHigh;
++#endif
++
++} USB_EXTENSION, *PUSB_EXTENSION;
++#endif
++
++
++typedef struct _OCTET_STRING{
++ u8 *Octet;
++ u16 Length;
++} OCTET_STRING, *POCTET_STRING;
++
++
++
++
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_linux.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,24 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __DRV_TYPES_LINUX_H__
++#define __DRV_TYPES_LINUX_H__
++
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_sdio.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,69 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __DRV_TYPES_SDIO_H__
++#define __DRV_TYPES_SDIO_H__
++
++#include <drv_conf.h>
++#include <basic_types.h>
++
++// SDIO Header Files
++#ifdef PLATFORM_LINUX
++#include <linux/mmc/sdio_func.h>
++#endif
++#ifdef PLATFORM_OS_XP
++#include <wdm.h>
++#include <ntddsd.h>
++#endif
++#ifdef PLATFORM_OS_CE
++#include <sdcardddk.h>
++#endif
++
++
++typedef struct sdio_data
++{
++ u8 func_number;
++
++ u8 tx_block_mode;
++ u8 rx_block_mode;
++ u32 block_transfer_len;
++
++#ifdef PLATFORM_LINUX
++ struct sdio_func *func;
++#endif
++
++#ifdef PLATFORM_OS_XP
++ PDEVICE_OBJECT pphysdevobj;
++ PDEVICE_OBJECT pfuncdevobj;
++ PDEVICE_OBJECT pnextdevobj;
++ SDBUS_INTERFACE_STANDARD sdbusinft;
++ u8 nextdevstacksz;
++#endif
++
++#ifdef PLATFORM_OS_CE
++ SD_DEVICE_HANDLE hDevice;
++ SD_CARD_RCA sd_rca;
++ SD_CARD_INTERFACE card_intf;
++ BOOLEAN enableIsarWithStatus;
++ WCHAR active_path[MAX_ACTIVE_REG_PATH];
++ SD_HOST_BLOCK_CAPABILITY sd_host_blk_cap;
++#endif
++} SDIO_DATA, *PSDIO_DATA;
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/drv_types_xp.h 2015-08-26 10:26:08.757316386 +0200
+@@ -0,0 +1,94 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __DRV_TYPES_XP_H__
++#define __DRV_TYPES_XP_H__
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++
++
++
++#define MAX_MCAST_LIST_NUM 32
++
++
++
++//for ioctl
++#define MAKE_DRIVER_VERSION(_MainVer,_MinorVer) ((((u32)(_MainVer))<<16)+_MinorVer)
++
++#define NIC_HEADER_SIZE 14 //!< can be moved to typedef.h
++#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
++#define NIC_MAX_SEND_PACKETS 10 // max number of send packets the MiniportSendPackets function can accept, can be moved to typedef.h
++#define NIC_VENDOR_DRIVER_VERSION MAKE_DRIVER_VERSION(0,001) //!< can be moved to typedef.h
++#define NIC_MAX_PACKET_SIZE 1514 //!< can be moved to typedef.h
++
++
++#undef ON_VISTA
++//added by Jackson
++#ifndef ON_VISTA
++//
++// Bus driver versions
++//
++
++#define SDBUS_DRIVER_VERSION_1 0x100
++#define SDBUS_DRIVER_VERSION_2 0x200
++
++#define SDP_FUNCTION_TYPE 4
++#define SDP_BUS_DRIVER_VERSION 5
++#define SDP_BUS_WIDTH 6
++#define SDP_BUS_CLOCK 7
++#define SDP_BUS_INTERFACE_CONTROL 8
++#define SDP_HOST_BLOCK_LENGTH 9
++#define SDP_FUNCTION_BLOCK_LENGTH 10
++#define SDP_FN0_BLOCK_LENGTH 11
++#define SDP_FUNCTION_INT_ENABLE 12
++#endif
++
++
++typedef struct _MP_REG_ENTRY
++{
++
++ NDIS_STRING RegName; // variable name text
++ BOOLEAN bRequired; // 1 -> required, 0 -> optional
++
++ u8 Type; // NdisParameterInteger/NdisParameterHexInteger/NdisParameterStringle/NdisParameterMultiString
++ uint FieldOffset; // offset to MP_ADAPTER field
++ uint FieldSize; // size (in bytes) of the field
++
++#ifdef UNDER_AMD64
++ u64 Default;
++#else
++ u32 Default; // default value to use
++#endif
++
++ u32 Min; // minimum value allowed
++ u32 Max; // maximum value allowed
++} MP_REG_ENTRY, *PMP_REG_ENTRY;
++
++
++typedef struct _OCTET_STRING{
++ u8 *Octet;
++ u16 Length;
++} OCTET_STRING, *POCTET_STRING;
++
++
++
++
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ethernet.h linux-rpi/drivers/net/wireless/rtl8192cu/include/ethernet.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ethernet.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/ethernet.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,41 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++/*! \file */
++#ifndef __INC_ETHERNET_H
++#define __INC_ETHERNET_H
++
++#define ETHERNET_ADDRESS_LENGTH 6 //!< Ethernet Address Length
++#define ETHERNET_HEADER_SIZE 14 //!< Ethernet Header Length
++#define LLC_HEADER_SIZE 6 //!< LLC Header Length
++#define TYPE_LENGTH_FIELD_SIZE 2 //!< Type/Length Size
++#define MINIMUM_ETHERNET_PACKET_SIZE 60 //!< Minimum Ethernet Packet Size
++#define MAXIMUM_ETHERNET_PACKET_SIZE 1514 //!< Maximum Ethernet Packet Size
++
++#define RT_ETH_IS_MULTICAST(_pAddr) ((((UCHAR *)(_pAddr))[0]&0x01)!=0) //!< Is Multicast Address?
++#define RT_ETH_IS_BROADCAST(_pAddr) ( \
++ ((UCHAR *)(_pAddr))[0]==0xff && \
++ ((UCHAR *)(_pAddr))[1]==0xff && \
++ ((UCHAR *)(_pAddr))[2]==0xff && \
++ ((UCHAR *)(_pAddr))[3]==0xff && \
++ ((UCHAR *)(_pAddr))[4]==0xff && \
++ ((UCHAR *)(_pAddr))[5]==0xff ) //!< Is Broadcast Address?
++
++
++#endif // #ifndef __INC_ETHERNET_H
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/h2clbk.h linux-rpi/drivers/net/wireless/rtl8192cu/include/h2clbk.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/h2clbk.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/h2clbk.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,35 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++
++
++#define _H2CLBK_H_
++
++
++#include <rtl8711_spec.h>
++#include <TypeDef.h>
++
++
++void _lbk_cmd(PADAPTER Adapter);
++
++void _lbk_rsp(PADAPTER Adapter);
++
++void _lbk_evt(IN PADAPTER Adapter);
++
++void h2c_event_callback(unsigned char *dev, unsigned char *pbuf);
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/hal_com.h linux-rpi/drivers/net/wireless/rtl8192cu/include/hal_com.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/hal_com.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/hal_com.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,145 @@
+/******************************************************************************
+ *
@@ -166041,9 +174809,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/hal_com.h linux-xbi
+s32 c2h_evt_read(_adapter *adapter, u8 *buf);
+
+#endif //__HAL_COMMON_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/hal_intf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/hal_intf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/hal_intf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/hal_intf.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/hal_intf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/hal_intf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/hal_intf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/hal_intf.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,431 @@
+/******************************************************************************
+ *
@@ -166476,630 +175244,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/hal_intf.h linux-xb
+c2h_id_filter rtw_hal_c2h_id_filter_ccx(_adapter *adapter);
+
+#endif //__HAL_INTF_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/HalPwrSeqCmd.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,137 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __HALPWRSEQCMD_H__
-+#define __HALPWRSEQCMD_H__
-+
-+#include <drv_types.h>
-+
-+/*---------------------------------------------*/
-+//3 The value of cmd: 4 bits
-+/*---------------------------------------------*/
-+#define PWR_CMD_READ 0x00
-+ // offset: the read register offset
-+ // msk: the mask of the read value
-+ // value: N/A, left by 0
-+ // note: dirver shall implement this function by read & msk
-+
-+#define PWR_CMD_WRITE 0x01
-+ // offset: the read register offset
-+ // msk: the mask of the write bits
-+ // value: write value
-+ // note: driver shall implement this cmd by read & msk after write
-+
-+#define PWR_CMD_POLLING 0x02
-+ // offset: the read register offset
-+ // msk: the mask of the polled value
-+ // value: the value to be polled, masked by the msd field.
-+ // note: driver shall implement this cmd by
-+ // do{
-+ // if( (Read(offset) & msk) == (value & msk) )
-+ // break;
-+ // } while(not timeout);
-+
-+#define PWR_CMD_DELAY 0x03
-+ // offset: the value to delay
-+ // msk: N/A
-+ // value: the unit of delay, 0: us, 1: ms
-+
-+#define PWR_CMD_END 0x04
-+ // offset: N/A
-+ // msk: N/A
-+ // value: N/A
-+
-+/*---------------------------------------------*/
-+//3 The value of base: 4 bits
-+/*---------------------------------------------*/
-+ // define the base address of each block
-+#define PWR_BASEADDR_MAC 0x00
-+#define PWR_BASEADDR_USB 0x01
-+#define PWR_BASEADDR_PCIE 0x02
-+#define PWR_BASEADDR_SDIO 0x03
-+
-+/*---------------------------------------------*/
-+//3 The value of interface_msk: 4 bits
-+/*---------------------------------------------*/
-+#define PWR_INTF_SDIO_MSK BIT(0)
-+#define PWR_INTF_USB_MSK BIT(1)
-+#define PWR_INTF_PCI_MSK BIT(2)
-+#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
-+
-+/*---------------------------------------------*/
-+//3 The value of fab_msk: 4 bits
-+/*---------------------------------------------*/
-+#define PWR_FAB_TSMC_MSK BIT(0)
-+#define PWR_FAB_UMC_MSK BIT(1)
-+#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
-+
-+/*---------------------------------------------*/
-+//3 The value of cut_msk: 8 bits
-+/*---------------------------------------------*/
-+#define PWR_CUT_TESTCHIP_MSK BIT(0)
-+#define PWR_CUT_A_MSK BIT(1)
-+#define PWR_CUT_B_MSK BIT(2)
-+#define PWR_CUT_C_MSK BIT(3)
-+#define PWR_CUT_D_MSK BIT(4)
-+#define PWR_CUT_E_MSK BIT(5)
-+#define PWR_CUT_F_MSK BIT(6)
-+#define PWR_CUT_G_MSK BIT(7)
-+#define PWR_CUT_ALL_MSK 0xFF
-+
-+
-+typedef enum _PWRSEQ_CMD_DELAY_UNIT_
-+{
-+ PWRSEQ_DELAY_US,
-+ PWRSEQ_DELAY_MS,
-+} PWRSEQ_DELAY_UNIT;
-+
-+typedef struct _WL_PWR_CFG_
-+{
-+ u16 offset;
-+ u8 cut_msk;
-+ u8 fab_msk:4;
-+ u8 interface_msk:4;
-+ u8 base:4;
-+ u8 cmd:4;
-+ u8 msk;
-+ u8 value;
-+} WLAN_PWR_CFG, *PWLAN_PWR_CFG;
-+
-+
-+#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset
-+#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk
-+#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk
-+#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk
-+#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base
-+#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd
-+#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk
-+#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value
-+
-+
-+//================================================================================
-+// Prototype of protected function.
-+//================================================================================
-+u8 HalPwrSeqCmdParsing(
-+ PADAPTER padapter,
-+ u8 CutVersion,
-+ u8 FabVersion,
-+ u8 InterfaceType,
-+ WLAN_PWR_CFG PwrCfgCmd[]);
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h 2015-07-28 01:20:58.317611539 +0200
-@@ -0,0 +1,476 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __IEEE80211_EXT_H
-+#define __IEEE80211_EXT_H
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+#include <drv_types.h>
-+
-+#define WMM_OUI_TYPE 2
-+#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
-+#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
-+#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
-+#define WMM_VERSION 1
-+
-+#define WPA_PROTO_WPA BIT(0)
-+#define WPA_PROTO_RSN BIT(1)
-+
-+#define WPA_KEY_MGMT_IEEE8021X BIT(0)
-+#define WPA_KEY_MGMT_PSK BIT(1)
-+#define WPA_KEY_MGMT_NONE BIT(2)
-+#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
-+#define WPA_KEY_MGMT_WPA_NONE BIT(4)
-+
-+
-+#define WPA_CAPABILITY_PREAUTH BIT(0)
-+#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)
-+#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
-+
-+
-+#define PMKID_LEN 16
-+
-+
-+#ifdef PLATFORM_LINUX
-+struct wpa_ie_hdr {
-+ u8 elem_id;
-+ u8 len;
-+ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
-+ u8 version[2]; /* little endian */
-+}__attribute__ ((packed));
-+
-+struct rsn_ie_hdr {
-+ u8 elem_id; /* WLAN_EID_RSN */
-+ u8 len;
-+ u8 version[2]; /* little endian */
-+}__attribute__ ((packed));
-+
-+struct wme_ac_parameter {
-+#if defined(CONFIG_LITTLE_ENDIAN)
-+ /* byte 1 */
-+ u8 aifsn:4,
-+ acm:1,
-+ aci:2,
-+ reserved:1;
-+
-+ /* byte 2 */
-+ u8 eCWmin:4,
-+ eCWmax:4;
-+#elif defined(CONFIG_BIG_ENDIAN)
-+ /* byte 1 */
-+ u8 reserved:1,
-+ aci:2,
-+ acm:1,
-+ aifsn:4;
-+
-+ /* byte 2 */
-+ u8 eCWmax:4,
-+ eCWmin:4;
-+#else
-+#error "Please fix <endian.h>"
-+#endif
-+
-+ /* bytes 3 & 4 */
-+ u16 txopLimit;
-+} __attribute__ ((packed));
-+
-+struct wme_parameter_element {
-+ /* required fields for WME version 1 */
-+ u8 oui[3];
-+ u8 oui_type;
-+ u8 oui_subtype;
-+ u8 version;
-+ u8 acInfo;
-+ u8 reserved;
-+ struct wme_ac_parameter ac[4];
-+
-+} __attribute__ ((packed));
-+
-+#endif
-+
-+#ifdef PLATFORM_WINDOWS
-+
-+#pragma pack(1)
-+
-+struct wpa_ie_hdr {
-+ u8 elem_id;
-+ u8 len;
-+ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
-+ u8 version[2]; /* little endian */
-+};
-+
-+struct rsn_ie_hdr {
-+ u8 elem_id; /* WLAN_EID_RSN */
-+ u8 len;
-+ u8 version[2]; /* little endian */
-+};
-+
-+#pragma pack()
-+
-+#endif
-+
-+#define WPA_PUT_LE16(a, val) \
-+ do { \
-+ (a)[1] = ((u16) (val)) >> 8; \
-+ (a)[0] = ((u16) (val)) & 0xff; \
-+ } while (0)
-+
-+#define WPA_PUT_BE32(a, val) \
-+ do { \
-+ (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
-+ (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
-+ (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
-+ (a)[3] = (u8) (((u32) (val)) & 0xff); \
-+ } while (0)
-+
-+#define WPA_PUT_LE32(a, val) \
-+ do { \
-+ (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
-+ (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
-+ (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
-+ (a)[0] = (u8) (((u32) (val)) & 0xff); \
-+ } while (0)
-+
-+#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
-+//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))
-+
-+
-+
-+/* Action category code */
-+enum ieee80211_category {
-+ WLAN_CATEGORY_SPECTRUM_MGMT = 0,
-+ WLAN_CATEGORY_QOS = 1,
-+ WLAN_CATEGORY_DLS = 2,
-+ WLAN_CATEGORY_BACK = 3,
-+ WLAN_CATEGORY_HT = 7,
-+ WLAN_CATEGORY_WMM = 17,
-+};
-+
-+/* SPECTRUM_MGMT action code */
-+enum ieee80211_spectrum_mgmt_actioncode {
-+ WLAN_ACTION_SPCT_MSR_REQ = 0,
-+ WLAN_ACTION_SPCT_MSR_RPRT = 1,
-+ WLAN_ACTION_SPCT_TPC_REQ = 2,
-+ WLAN_ACTION_SPCT_TPC_RPRT = 3,
-+ WLAN_ACTION_SPCT_CHL_SWITCH = 4,
-+ WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
-+};
-+
-+/* BACK action code */
-+enum ieee80211_back_actioncode {
-+ WLAN_ACTION_ADDBA_REQ = 0,
-+ WLAN_ACTION_ADDBA_RESP = 1,
-+ WLAN_ACTION_DELBA = 2,
-+};
-+
-+/* HT features action code */
-+enum ieee80211_ht_actioncode {
-+ WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
-+ WLAN_ACTION_SM_PS = 1,
-+ WLAN_ACTION_PSPM = 2,
-+ WLAN_ACTION_PCO_PHASE = 3,
-+ WLAN_ACTION_MIMO_CSI_MX = 4,
-+ WLAN_ACTION_MIMO_NONCP_BF = 5,
-+ WLAN_ACTION_MIMP_CP_BF = 6,
-+ WLAN_ACTION_ASEL_INDICATES_FB = 7,
-+ WLAN_ACTION_HI_INFO_EXCHG = 8,
-+};
-+
-+/* BACK (block-ack) parties */
-+enum ieee80211_back_parties {
-+ WLAN_BACK_RECIPIENT = 0,
-+ WLAN_BACK_INITIATOR = 1,
-+ WLAN_BACK_TIMER = 2,
-+};
-+
-+#ifdef PLATFORM_LINUX
-+
-+struct ieee80211_mgmt {
-+ u16 frame_control;
-+ u16 duration;
-+ u8 da[6];
-+ u8 sa[6];
-+ u8 bssid[6];
-+ u16 seq_ctrl;
-+ union {
-+ struct {
-+ u16 auth_alg;
-+ u16 auth_transaction;
-+ u16 status_code;
-+ /* possibly followed by Challenge text */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) auth;
-+ struct {
-+ u16 reason_code;
-+ } __attribute__ ((packed)) deauth;
-+ struct {
-+ u16 capab_info;
-+ u16 listen_interval;
-+ /* followed by SSID and Supported rates */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) assoc_req;
-+ struct {
-+ u16 capab_info;
-+ u16 status_code;
-+ u16 aid;
-+ /* followed by Supported rates */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) assoc_resp, reassoc_resp;
-+ struct {
-+ u16 capab_info;
-+ u16 listen_interval;
-+ u8 current_ap[6];
-+ /* followed by SSID and Supported rates */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) reassoc_req;
-+ struct {
-+ u16 reason_code;
-+ } __attribute__ ((packed)) disassoc;
-+ struct {
-+ __le64 timestamp;
-+ u16 beacon_int;
-+ u16 capab_info;
-+ /* followed by some of SSID, Supported rates,
-+ * FH Params, DS Params, CF Params, IBSS Params, TIM */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) beacon;
-+ struct {
-+ /* only variable items: SSID, Supported rates */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) probe_req;
-+ struct {
-+ __le64 timestamp;
-+ u16 beacon_int;
-+ u16 capab_info;
-+ /* followed by some of SSID, Supported rates,
-+ * FH Params, DS Params, CF Params, IBSS Params */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) probe_resp;
-+ struct {
-+ u8 category;
-+ union {
-+ struct {
-+ u8 action_code;
-+ u8 dialog_token;
-+ u8 status_code;
-+ u8 variable[0];
-+ } __attribute__ ((packed)) wme_action;
-+#if 0
-+ struct{
-+ u8 action_code;
-+ u8 element_id;
-+ u8 length;
-+ struct ieee80211_channel_sw_ie sw_elem;
-+ } __attribute__ ((packed)) chan_switch;
-+ struct{
-+ u8 action_code;
-+ u8 dialog_token;
-+ u8 element_id;
-+ u8 length;
-+ struct ieee80211_msrment_ie msr_elem;
-+ } __attribute__ ((packed)) measurement;
-+#endif
-+ struct{
-+ u8 action_code;
-+ u8 dialog_token;
-+ u16 capab;
-+ u16 timeout;
-+ u16 start_seq_num;
-+ } __attribute__ ((packed)) addba_req;
-+ struct{
-+ u8 action_code;
-+ u8 dialog_token;
-+ u16 status;
-+ u16 capab;
-+ u16 timeout;
-+ } __attribute__ ((packed)) addba_resp;
-+ struct{
-+ u8 action_code;
-+ u16 params;
-+ u16 reason_code;
-+ } __attribute__ ((packed)) delba;
-+ struct{
-+ u8 action_code;
-+ /* capab_info for open and confirm,
-+ * reason for close
-+ */
-+ u16 aux;
-+ /* Followed in plink_confirm by status
-+ * code, AID and supported rates,
-+ * and directly by supported rates in
-+ * plink_open and plink_close
-+ */
-+ u8 variable[0];
-+ } __attribute__ ((packed)) plink_action;
-+ struct{
-+ u8 action_code;
-+ u8 variable[0];
-+ } __attribute__ ((packed)) mesh_action;
-+ } __attribute__ ((packed)) u;
-+ } __attribute__ ((packed)) action;
-+ } __attribute__ ((packed)) u;
-+}__attribute__ ((packed));
-+
-+#endif
-+
-+
-+#ifdef PLATFORM_WINDOWS
-+
-+#pragma pack(1)
-+
-+struct ieee80211_mgmt {
-+ u16 frame_control;
-+ u16 duration;
-+ u8 da[6];
-+ u8 sa[6];
-+ u8 bssid[6];
-+ u16 seq_ctrl;
-+ union {
-+ struct {
-+ u16 auth_alg;
-+ u16 auth_transaction;
-+ u16 status_code;
-+ /* possibly followed by Challenge text */
-+ u8 variable[0];
-+ } auth;
-+ struct {
-+ u16 reason_code;
-+ } deauth;
-+ struct {
-+ u16 capab_info;
-+ u16 listen_interval;
-+ /* followed by SSID and Supported rates */
-+ u8 variable[0];
-+ } assoc_req;
-+ struct {
-+ u16 capab_info;
-+ u16 status_code;
-+ u16 aid;
-+ /* followed by Supported rates */
-+ u8 variable[0];
-+ } assoc_resp, reassoc_resp;
-+ struct {
-+ u16 capab_info;
-+ u16 listen_interval;
-+ u8 current_ap[6];
-+ /* followed by SSID and Supported rates */
-+ u8 variable[0];
-+ } reassoc_req;
-+ struct {
-+ u16 reason_code;
-+ } disassoc;
-+#if 0
-+ struct {
-+ __le64 timestamp;
-+ u16 beacon_int;
-+ u16 capab_info;
-+ /* followed by some of SSID, Supported rates,
-+ * FH Params, DS Params, CF Params, IBSS Params, TIM */
-+ u8 variable[0];
-+ } beacon;
-+ struct {
-+ /* only variable items: SSID, Supported rates */
-+ u8 variable[0];
-+ } probe_req;
-+
-+ struct {
-+ __le64 timestamp;
-+ u16 beacon_int;
-+ u16 capab_info;
-+ /* followed by some of SSID, Supported rates,
-+ * FH Params, DS Params, CF Params, IBSS Params */
-+ u8 variable[0];
-+ } probe_resp;
-+#endif
-+ struct {
-+ u8 category;
-+ union {
-+ struct {
-+ u8 action_code;
-+ u8 dialog_token;
-+ u8 status_code;
-+ u8 variable[0];
-+ } wme_action;
-+/*
-+ struct{
-+ u8 action_code;
-+ u8 element_id;
-+ u8 length;
-+ struct ieee80211_channel_sw_ie sw_elem;
-+ } chan_switch;
-+ struct{
-+ u8 action_code;
-+ u8 dialog_token;
-+ u8 element_id;
-+ u8 length;
-+ struct ieee80211_msrment_ie msr_elem;
-+ } measurement;
-+*/
-+ struct{
-+ u8 action_code;
-+ u8 dialog_token;
-+ u16 capab;
-+ u16 timeout;
-+ u16 start_seq_num;
-+ } addba_req;
-+ struct{
-+ u8 action_code;
-+ u8 dialog_token;
-+ u16 status;
-+ u16 capab;
-+ u16 timeout;
-+ } addba_resp;
-+ struct{
-+ u8 action_code;
-+ u16 params;
-+ u16 reason_code;
-+ } delba;
-+ struct{
-+ u8 action_code;
-+ /* capab_info for open and confirm,
-+ * reason for close
-+ */
-+ u16 aux;
-+ /* Followed in plink_confirm by status
-+ * code, AID and supported rates,
-+ * and directly by supported rates in
-+ * plink_open and plink_close
-+ */
-+ u8 variable[0];
-+ } plink_action;
-+ struct{
-+ u8 action_code;
-+ u8 variable[0];
-+ } mesh_action;
-+ } u;
-+ } action;
-+ } u;
-+} ;
-+
-+#pragma pack()
-+
-+#endif
-+
-+/* mgmt header + 1 byte category code */
-+#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)
-+
-+
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ieee80211.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ieee80211.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ieee80211.h linux-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ieee80211.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,1579 @@
+/******************************************************************************
+ *
@@ -168680,9 +176827,489 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ieee80211.h linux-x
+const char *action_public_str(u8 action);
+
+#endif /* IEEE80211_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/if_ether.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/if_ether.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/if_ether.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/if_ether.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h linux-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/ieee80211_ext.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,476 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __IEEE80211_EXT_H
++#define __IEEE80211_EXT_H
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++#include <drv_types.h>
++
++#define WMM_OUI_TYPE 2
++#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
++#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
++#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
++#define WMM_VERSION 1
++
++#define WPA_PROTO_WPA BIT(0)
++#define WPA_PROTO_RSN BIT(1)
++
++#define WPA_KEY_MGMT_IEEE8021X BIT(0)
++#define WPA_KEY_MGMT_PSK BIT(1)
++#define WPA_KEY_MGMT_NONE BIT(2)
++#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
++#define WPA_KEY_MGMT_WPA_NONE BIT(4)
++
++
++#define WPA_CAPABILITY_PREAUTH BIT(0)
++#define WPA_CAPABILITY_MGMT_FRAME_PROTECTION BIT(6)
++#define WPA_CAPABILITY_PEERKEY_ENABLED BIT(9)
++
++
++#define PMKID_LEN 16
++
++
++#ifdef PLATFORM_LINUX
++struct wpa_ie_hdr {
++ u8 elem_id;
++ u8 len;
++ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
++ u8 version[2]; /* little endian */
++}__attribute__ ((packed));
++
++struct rsn_ie_hdr {
++ u8 elem_id; /* WLAN_EID_RSN */
++ u8 len;
++ u8 version[2]; /* little endian */
++}__attribute__ ((packed));
++
++struct wme_ac_parameter {
++#if defined(CONFIG_LITTLE_ENDIAN)
++ /* byte 1 */
++ u8 aifsn:4,
++ acm:1,
++ aci:2,
++ reserved:1;
++
++ /* byte 2 */
++ u8 eCWmin:4,
++ eCWmax:4;
++#elif defined(CONFIG_BIG_ENDIAN)
++ /* byte 1 */
++ u8 reserved:1,
++ aci:2,
++ acm:1,
++ aifsn:4;
++
++ /* byte 2 */
++ u8 eCWmax:4,
++ eCWmin:4;
++#else
++#error "Please fix <endian.h>"
++#endif
++
++ /* bytes 3 & 4 */
++ u16 txopLimit;
++} __attribute__ ((packed));
++
++struct wme_parameter_element {
++ /* required fields for WME version 1 */
++ u8 oui[3];
++ u8 oui_type;
++ u8 oui_subtype;
++ u8 version;
++ u8 acInfo;
++ u8 reserved;
++ struct wme_ac_parameter ac[4];
++
++} __attribute__ ((packed));
++
++#endif
++
++#ifdef PLATFORM_WINDOWS
++
++#pragma pack(1)
++
++struct wpa_ie_hdr {
++ u8 elem_id;
++ u8 len;
++ u8 oui[4]; /* 24-bit OUI followed by 8-bit OUI type */
++ u8 version[2]; /* little endian */
++};
++
++struct rsn_ie_hdr {
++ u8 elem_id; /* WLAN_EID_RSN */
++ u8 len;
++ u8 version[2]; /* little endian */
++};
++
++#pragma pack()
++
++#endif
++
++#define WPA_PUT_LE16(a, val) \
++ do { \
++ (a)[1] = ((u16) (val)) >> 8; \
++ (a)[0] = ((u16) (val)) & 0xff; \
++ } while (0)
++
++#define WPA_PUT_BE32(a, val) \
++ do { \
++ (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
++ (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
++ (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
++ (a)[3] = (u8) (((u32) (val)) & 0xff); \
++ } while (0)
++
++#define WPA_PUT_LE32(a, val) \
++ do { \
++ (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
++ (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
++ (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
++ (a)[0] = (u8) (((u32) (val)) & 0xff); \
++ } while (0)
++
++#define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *) (a), (val))
++//#define RSN_SELECTOR_PUT(a, val) WPA_PUT_LE32((u8 *) (a), (val))
++
++
++
++/* Action category code */
++enum ieee80211_category {
++ WLAN_CATEGORY_SPECTRUM_MGMT = 0,
++ WLAN_CATEGORY_QOS = 1,
++ WLAN_CATEGORY_DLS = 2,
++ WLAN_CATEGORY_BACK = 3,
++ WLAN_CATEGORY_HT = 7,
++ WLAN_CATEGORY_WMM = 17,
++};
++
++/* SPECTRUM_MGMT action code */
++enum ieee80211_spectrum_mgmt_actioncode {
++ WLAN_ACTION_SPCT_MSR_REQ = 0,
++ WLAN_ACTION_SPCT_MSR_RPRT = 1,
++ WLAN_ACTION_SPCT_TPC_REQ = 2,
++ WLAN_ACTION_SPCT_TPC_RPRT = 3,
++ WLAN_ACTION_SPCT_CHL_SWITCH = 4,
++ WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
++};
++
++/* BACK action code */
++enum ieee80211_back_actioncode {
++ WLAN_ACTION_ADDBA_REQ = 0,
++ WLAN_ACTION_ADDBA_RESP = 1,
++ WLAN_ACTION_DELBA = 2,
++};
++
++/* HT features action code */
++enum ieee80211_ht_actioncode {
++ WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
++ WLAN_ACTION_SM_PS = 1,
++ WLAN_ACTION_PSPM = 2,
++ WLAN_ACTION_PCO_PHASE = 3,
++ WLAN_ACTION_MIMO_CSI_MX = 4,
++ WLAN_ACTION_MIMO_NONCP_BF = 5,
++ WLAN_ACTION_MIMP_CP_BF = 6,
++ WLAN_ACTION_ASEL_INDICATES_FB = 7,
++ WLAN_ACTION_HI_INFO_EXCHG = 8,
++};
++
++/* BACK (block-ack) parties */
++enum ieee80211_back_parties {
++ WLAN_BACK_RECIPIENT = 0,
++ WLAN_BACK_INITIATOR = 1,
++ WLAN_BACK_TIMER = 2,
++};
++
++#ifdef PLATFORM_LINUX
++
++struct ieee80211_mgmt {
++ u16 frame_control;
++ u16 duration;
++ u8 da[6];
++ u8 sa[6];
++ u8 bssid[6];
++ u16 seq_ctrl;
++ union {
++ struct {
++ u16 auth_alg;
++ u16 auth_transaction;
++ u16 status_code;
++ /* possibly followed by Challenge text */
++ u8 variable[0];
++ } __attribute__ ((packed)) auth;
++ struct {
++ u16 reason_code;
++ } __attribute__ ((packed)) deauth;
++ struct {
++ u16 capab_info;
++ u16 listen_interval;
++ /* followed by SSID and Supported rates */
++ u8 variable[0];
++ } __attribute__ ((packed)) assoc_req;
++ struct {
++ u16 capab_info;
++ u16 status_code;
++ u16 aid;
++ /* followed by Supported rates */
++ u8 variable[0];
++ } __attribute__ ((packed)) assoc_resp, reassoc_resp;
++ struct {
++ u16 capab_info;
++ u16 listen_interval;
++ u8 current_ap[6];
++ /* followed by SSID and Supported rates */
++ u8 variable[0];
++ } __attribute__ ((packed)) reassoc_req;
++ struct {
++ u16 reason_code;
++ } __attribute__ ((packed)) disassoc;
++ struct {
++ __le64 timestamp;
++ u16 beacon_int;
++ u16 capab_info;
++ /* followed by some of SSID, Supported rates,
++ * FH Params, DS Params, CF Params, IBSS Params, TIM */
++ u8 variable[0];
++ } __attribute__ ((packed)) beacon;
++ struct {
++ /* only variable items: SSID, Supported rates */
++ u8 variable[0];
++ } __attribute__ ((packed)) probe_req;
++ struct {
++ __le64 timestamp;
++ u16 beacon_int;
++ u16 capab_info;
++ /* followed by some of SSID, Supported rates,
++ * FH Params, DS Params, CF Params, IBSS Params */
++ u8 variable[0];
++ } __attribute__ ((packed)) probe_resp;
++ struct {
++ u8 category;
++ union {
++ struct {
++ u8 action_code;
++ u8 dialog_token;
++ u8 status_code;
++ u8 variable[0];
++ } __attribute__ ((packed)) wme_action;
++#if 0
++ struct{
++ u8 action_code;
++ u8 element_id;
++ u8 length;
++ struct ieee80211_channel_sw_ie sw_elem;
++ } __attribute__ ((packed)) chan_switch;
++ struct{
++ u8 action_code;
++ u8 dialog_token;
++ u8 element_id;
++ u8 length;
++ struct ieee80211_msrment_ie msr_elem;
++ } __attribute__ ((packed)) measurement;
++#endif
++ struct{
++ u8 action_code;
++ u8 dialog_token;
++ u16 capab;
++ u16 timeout;
++ u16 start_seq_num;
++ } __attribute__ ((packed)) addba_req;
++ struct{
++ u8 action_code;
++ u8 dialog_token;
++ u16 status;
++ u16 capab;
++ u16 timeout;
++ } __attribute__ ((packed)) addba_resp;
++ struct{
++ u8 action_code;
++ u16 params;
++ u16 reason_code;
++ } __attribute__ ((packed)) delba;
++ struct{
++ u8 action_code;
++ /* capab_info for open and confirm,
++ * reason for close
++ */
++ u16 aux;
++ /* Followed in plink_confirm by status
++ * code, AID and supported rates,
++ * and directly by supported rates in
++ * plink_open and plink_close
++ */
++ u8 variable[0];
++ } __attribute__ ((packed)) plink_action;
++ struct{
++ u8 action_code;
++ u8 variable[0];
++ } __attribute__ ((packed)) mesh_action;
++ } __attribute__ ((packed)) u;
++ } __attribute__ ((packed)) action;
++ } __attribute__ ((packed)) u;
++}__attribute__ ((packed));
++
++#endif
++
++
++#ifdef PLATFORM_WINDOWS
++
++#pragma pack(1)
++
++struct ieee80211_mgmt {
++ u16 frame_control;
++ u16 duration;
++ u8 da[6];
++ u8 sa[6];
++ u8 bssid[6];
++ u16 seq_ctrl;
++ union {
++ struct {
++ u16 auth_alg;
++ u16 auth_transaction;
++ u16 status_code;
++ /* possibly followed by Challenge text */
++ u8 variable[0];
++ } auth;
++ struct {
++ u16 reason_code;
++ } deauth;
++ struct {
++ u16 capab_info;
++ u16 listen_interval;
++ /* followed by SSID and Supported rates */
++ u8 variable[0];
++ } assoc_req;
++ struct {
++ u16 capab_info;
++ u16 status_code;
++ u16 aid;
++ /* followed by Supported rates */
++ u8 variable[0];
++ } assoc_resp, reassoc_resp;
++ struct {
++ u16 capab_info;
++ u16 listen_interval;
++ u8 current_ap[6];
++ /* followed by SSID and Supported rates */
++ u8 variable[0];
++ } reassoc_req;
++ struct {
++ u16 reason_code;
++ } disassoc;
++#if 0
++ struct {
++ __le64 timestamp;
++ u16 beacon_int;
++ u16 capab_info;
++ /* followed by some of SSID, Supported rates,
++ * FH Params, DS Params, CF Params, IBSS Params, TIM */
++ u8 variable[0];
++ } beacon;
++ struct {
++ /* only variable items: SSID, Supported rates */
++ u8 variable[0];
++ } probe_req;
++
++ struct {
++ __le64 timestamp;
++ u16 beacon_int;
++ u16 capab_info;
++ /* followed by some of SSID, Supported rates,
++ * FH Params, DS Params, CF Params, IBSS Params */
++ u8 variable[0];
++ } probe_resp;
++#endif
++ struct {
++ u8 category;
++ union {
++ struct {
++ u8 action_code;
++ u8 dialog_token;
++ u8 status_code;
++ u8 variable[0];
++ } wme_action;
++/*
++ struct{
++ u8 action_code;
++ u8 element_id;
++ u8 length;
++ struct ieee80211_channel_sw_ie sw_elem;
++ } chan_switch;
++ struct{
++ u8 action_code;
++ u8 dialog_token;
++ u8 element_id;
++ u8 length;
++ struct ieee80211_msrment_ie msr_elem;
++ } measurement;
++*/
++ struct{
++ u8 action_code;
++ u8 dialog_token;
++ u16 capab;
++ u16 timeout;
++ u16 start_seq_num;
++ } addba_req;
++ struct{
++ u8 action_code;
++ u8 dialog_token;
++ u16 status;
++ u16 capab;
++ u16 timeout;
++ } addba_resp;
++ struct{
++ u8 action_code;
++ u16 params;
++ u16 reason_code;
++ } delba;
++ struct{
++ u8 action_code;
++ /* capab_info for open and confirm,
++ * reason for close
++ */
++ u16 aux;
++ /* Followed in plink_confirm by status
++ * code, AID and supported rates,
++ * and directly by supported rates in
++ * plink_open and plink_close
++ */
++ u8 variable[0];
++ } plink_action;
++ struct{
++ u8 action_code;
++ u8 variable[0];
++ } mesh_action;
++ } u;
++ } action;
++ } u;
++} ;
++
++#pragma pack()
++
++#endif
++
++/* mgmt header + 1 byte category code */
++#define IEEE80211_MIN_ACTION_SIZE FIELD_OFFSET(struct ieee80211_mgmt, u.action.u)
++
++
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/if_ether.h linux-rpi/drivers/net/wireless/rtl8192cu/include/if_ether.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/if_ether.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/if_ether.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,112 @@
+/******************************************************************************
+ *
@@ -168796,9 +177423,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/if_ether.h linux-xb
+
+
+#endif /* _LINUX_IF_ETHER_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h linux-rpi/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,179 @@
+/******************************************************************************
+ *
@@ -168979,9 +177606,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ioctl_cfg80211.h li
+#endif
+
+#endif //__IOCTL_CFG80211_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ip.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ip.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ip.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/ip.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ip.h linux-rpi/drivers/net/wireless/rtl8192cu/include/ip.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/ip.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/ip.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,141 @@
+/******************************************************************************
+ *
@@ -169124,9 +177751,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/ip.h linux-xbian-rp
+};
+
+#endif /* _LINUX_IP_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/linux/wireless.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/linux/wireless.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/linux/wireless.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/linux/wireless.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/linux/wireless.h linux-rpi/drivers/net/wireless/rtl8192cu/include/linux/wireless.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/linux/wireless.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/linux/wireless.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,90 @@
+/******************************************************************************
+ *
@@ -169218,9 +177845,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/linux/wireless.h li
+};
+
+#endif /* _LINUX_WIRELESS_H */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h linux-rpi/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,39 @@
+/******************************************************************************
+ *
@@ -169261,9 +177888,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/mlme_osdep.h linux-
+void rtw_reset_securitypriv( _adapter *adapter );
+
+#endif //_MLME_OSDEP_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h linux-rpi/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,353 @@
+/******************************************************************************
+ *
@@ -169618,9 +178245,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/mp_custom_oid.h lin
+#define OID_RT_PRO_EFUSE_MAP 0xFF871217 //Q, S
+
+#endif //#ifndef __CUSTOM_OID_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/nic_spec.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/nic_spec.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/nic_spec.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/nic_spec.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/nic_spec.h linux-rpi/drivers/net/wireless/rtl8192cu/include/nic_spec.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/nic_spec.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/nic_spec.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,46 @@
+/******************************************************************************
+ *
@@ -169668,9 +178295,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/nic_spec.h linux-xb
+
+
+#endif // __RTL8711_SPEC_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h linux-rpi/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,170 @@
+/******************************************************************************
+ *
@@ -169842,9 +178469,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_ce_service.h
+ NdisInterlockedDecrement((PULONG)&(_MutexCounter)); \
+}
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_intf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/osdep_intf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_intf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/osdep_intf.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/osdep_intf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/osdep_intf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/osdep_intf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/osdep_intf.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,154 @@
+/******************************************************************************
+ *
@@ -170000,9 +178627,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_intf.h linux-
+void rtw_ndev_destructor(_nic_hdl ndev);
+
+#endif //_OSDEP_INTF_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_service.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/osdep_service.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_service.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/osdep_service.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/osdep_service.h linux-rpi/drivers/net/wireless/rtl8192cu/include/osdep_service.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/osdep_service.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/osdep_service.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,1813 @@
+/******************************************************************************
+ *
@@ -171817,9 +180444,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/osdep_service.h lin
+void rtw_cbuf_free(struct rtw_cbuf *cbuf);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_hal.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/pci_hal.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_hal.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/pci_hal.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/pci_hal.h linux-rpi/drivers/net/wireless/rtl8192cu/include/pci_hal.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/pci_hal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/pci_hal.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,167 @@
+/******************************************************************************
+ *
@@ -171988,9 +180615,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_hal.h linux-xbi
+#endif
+
+#endif //__PCIE_HAL_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_ops.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/pci_ops.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_ops.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/pci_ops.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/pci_ops.h linux-rpi/drivers/net/wireless/rtl8192cu/include/pci_ops.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/pci_ops.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/pci_ops.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,60 @@
+/******************************************************************************
+ *
@@ -172052,9 +180679,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_ops.h linux-xbi
+#endif
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_osintf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/pci_osintf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_osintf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/pci_osintf.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/pci_osintf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/pci_osintf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/pci_osintf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/pci_osintf.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,32 @@
+/******************************************************************************
+ *
@@ -172088,9 +180715,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/pci_osintf.h linux-
+
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/recv_osdep.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/recv_osdep.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/recv_osdep.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/recv_osdep.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/recv_osdep.h linux-rpi/drivers/net/wireless/rtl8192cu/include/recv_osdep.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/recv_osdep.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/recv_osdep.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,57 @@
+/******************************************************************************
+ *
@@ -172149,9 +180776,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/recv_osdep.h linux-
+
+
+#endif //
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,152 @@
+/******************************************************************************
+ *
@@ -172305,9 +180932,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_cmd.h linu
+#endif // CONFIG_WOWLAN
+
+#endif // __RTL8192C_CMD_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,515 @@
+/******************************************************************************
+ *
@@ -172824,9 +181451,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_dm.h linux
+#endif
+
+#endif //__HAL8190PCIDM_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h 2015-07-28 01:20:58.317611539 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,26 @@
+/******************************************************************************
+ *
@@ -172854,9 +181481,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_event.h li
+
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,934 @@
+/******************************************************************************
+ *
@@ -173792,9 +182419,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_hal.h linu
+extern void Hal_SetOFDMContinuousTx(PADAPTER pAdapter, u8 bStart);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
@@ -173837,9 +182464,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_led.h linu
+#endif
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,183 @@
+/******************************************************************************
+ *
@@ -174024,9 +182651,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_recv.h lin
+void rtl8192c_query_rx_desc_status(union recv_frame *precvframe, struct recv_stat *pdesc);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,91 @@
+/******************************************************************************
+ *
@@ -174119,9 +182746,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_rf.h linux
+
+
+#endif/* End of HalRf.h */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,1864 @@
+/******************************************************************************
+ *
@@ -175987,9 +184614,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_spec.h lin
+#include "basic_types.h"
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,32 @@
+/******************************************************************************
+ *
@@ -176023,9 +184650,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_sreset.h l
+extern void rtl8192c_sreset_linked_status_check(_adapter *padapter);
+#endif
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,128 @@
+/******************************************************************************
+ *
@@ -176155,9 +184782,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192c_xmit.h lin
+#endif
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,140 @@
+/******************************************************************************
+ *
@@ -176299,9 +184926,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_cmd.h linu
+#endif // CONFIG_WOWLAN
+
+#endif // __RTL8192D_CMD_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,420 @@
+/******************************************************************************
+ *
@@ -176723,9 +185350,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_dm.h linux
+VOID rtl8192d_dm_CheckTXPowerTracking(IN PADAPTER Adapter);
+
+#endif //__HAL8190PCIDM_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,1125 @@
+/******************************************************************************
+ *
@@ -177852,9 +186479,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_hal.h linu
+
+
+#endif //end CONFIG_MP_INCLUDED
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,42 @@
+/******************************************************************************
+ *
@@ -177898,9 +186525,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_led.h linu
+#endif
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,186 @@
+/******************************************************************************
+ *
@@ -178088,9 +186715,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_recv.h lin
+void rtl8192d_query_rx_desc_status(union recv_frame *precvframe, struct recv_stat *pdesc);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,96 @@
+/******************************************************************************
+ *
@@ -178188,9 +186815,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_rf.h linux
+
+
+#endif/* End of HalRf.h */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,1840 @@
+/******************************************************************************
+ *
@@ -180032,9 +188659,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_spec.h lin
+#include "basic_types.h"
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,144 @@
+/******************************************************************************
+ *
@@ -180180,9 +188807,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtl8192d_xmit.h lin
+
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_android.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_android.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_android.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_android.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_android.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_android.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_android.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_android.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,89 @@
+/******************************************************************************
+ *
@@ -180273,9 +188900,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_android.h linux
+#endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */
+
+#endif //__RTW_ANDROID_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ap.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ap.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ap.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ap.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ap.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ap.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ap.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ap.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
@@ -180340,9 +188967,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ap.h linux-xbia
+#endif //end of CONFIG_AP_MODE
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,75 @@
+/******************************************************************************
+ *
@@ -180419,9 +189046,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_br_ext.h linux-
+void nat25_db_cleanup(_adapter *priv);
+
+#endif // _RTW_BR_EXT_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,39 @@
+/******************************************************************************
+ *
@@ -180462,9 +189089,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_byteorder.h lin
+#endif
+
+#endif /* _RTL871X_BYTEORDER_H_ */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,1166 @@
+/******************************************************************************
+ *
@@ -181632,9 +190259,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_cmd.h linux-xbi
+#endif
+
+#endif // _CMD_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_debug.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_debug.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_debug.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_debug.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_debug.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_debug.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_debug.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_debug.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,537 @@
+/******************************************************************************
+ *
@@ -182173,9 +190800,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_debug.h linux-x
+#endif //CONFIG_PROC_DEBUG
+
+#endif //__RTW_DEBUG_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,152 @@
+/******************************************************************************
+ *
@@ -182329,9 +190956,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_eeprom.h linux-
+#endif //PLATFORM_LINUX
+
+#endif //__RTL871X_EEPROM_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,123 @@
+/******************************************************************************
+ *
@@ -182456,9 +191083,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_efuse.h linux-x
+void EFUSE_ShadowRead(PADAPTER pAdapter, u8 Type, u16 Offset, u32 *Value);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_event.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_event.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_event.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_event.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_event.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_event.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_event.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_event.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,153 @@
+/******************************************************************************
+ *
@@ -182613,9 +191240,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_event.h linux-x
+
+
+#endif // _WLANEVENT_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ht.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ht.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ht.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ht.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ht.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ht.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ht.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ht.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
@@ -182666,489 +191293,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ht.h linux-xbia
+};
+
+#endif //_RTL871X_HT_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h 2015-07-28 01:20:58.321597318 +0200
-@@ -0,0 +1,268 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _RTW_IOCTL_H_
-+#define _RTW_IOCTL_H_
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+#include <drv_types.h>
-+
-+#ifndef OID_802_11_CAPABILITY
-+ #define OID_802_11_CAPABILITY 0x0d010122
-+#endif
-+
-+#ifndef OID_802_11_PMKID
-+ #define OID_802_11_PMKID 0x0d010123
-+#endif
-+
-+
-+// For DDK-defined OIDs
-+#define OID_NDIS_SEG1 0x00010100
-+#define OID_NDIS_SEG2 0x00010200
-+#define OID_NDIS_SEG3 0x00020100
-+#define OID_NDIS_SEG4 0x01010100
-+#define OID_NDIS_SEG5 0x01020100
-+#define OID_NDIS_SEG6 0x01020200
-+#define OID_NDIS_SEG7 0xFD010100
-+#define OID_NDIS_SEG8 0x0D010100
-+#define OID_NDIS_SEG9 0x0D010200
-+#define OID_NDIS_SEG10 0x0D020200
-+
-+#define SZ_OID_NDIS_SEG1 23
-+#define SZ_OID_NDIS_SEG2 3
-+#define SZ_OID_NDIS_SEG3 6
-+#define SZ_OID_NDIS_SEG4 6
-+#define SZ_OID_NDIS_SEG5 4
-+#define SZ_OID_NDIS_SEG6 8
-+#define SZ_OID_NDIS_SEG7 7
-+#define SZ_OID_NDIS_SEG8 36
-+#define SZ_OID_NDIS_SEG9 24
-+#define SZ_OID_NDIS_SEG10 19
-+
-+// For Realtek-defined OIDs
-+#define OID_MP_SEG1 0xFF871100
-+#define OID_MP_SEG2 0xFF818000
-+
-+#define OID_MP_SEG3 0xFF818700
-+#define OID_MP_SEG4 0xFF011100
-+
-+#define DEBUG_OID(dbg, str) \
-+ if((!dbg)) \
-+ { \
-+ RT_TRACE(_module_rtl871x_ioctl_c_,_drv_info_,("%s(%d): %s", __FUNCTION__, __LINE__, str)); \
-+ }
-+
-+
-+enum oid_type
-+{
-+ QUERY_OID,
-+ SET_OID
-+};
-+
-+struct oid_funs_node {
-+ unsigned int oid_start; //the starting number for OID
-+ unsigned int oid_end; //the ending number for OID
-+ struct oid_obj_priv *node_array;
-+ unsigned int array_sz; //the size of node_array
-+ int query_counter; //count the number of query hits for this segment
-+ int set_counter; //count the number of set hits for this segment
-+};
-+
-+struct oid_par_priv
-+{
-+ void *adapter_context;
-+ NDIS_OID oid;
-+ void *information_buf;
-+ u32 information_buf_len;
-+ u32 *bytes_rw;
-+ u32 *bytes_needed;
-+ enum oid_type type_of_oid;
-+ u32 dbg;
-+};
-+
-+struct oid_obj_priv {
-+ unsigned char dbg; // 0: without OID debug message 1: with OID debug message
-+ NDIS_STATUS (*oidfuns)(struct oid_par_priv *poid_par_priv);
-+};
-+
-+#if (defined(CONFIG_MP_INCLUDED) && defined(_RTW_MP_IOCTL_C_)) || \
-+ (defined(PLATFORM_WINDOWS) && defined(_RTW_IOCTL_RTL_C_))
-+static NDIS_STATUS oid_null_function(struct oid_par_priv* poid_par_priv)
-+{
-+ _func_enter_;
-+ _func_exit_;
-+ return NDIS_STATUS_SUCCESS;
-+}
-+#endif
-+
-+#ifdef PLATFORM_WINDOWS
-+
-+int TranslateNdisPsToRtPs(IN NDIS_802_11_POWER_MODE ndisPsMode);
-+
-+//OID Handler for Segment 1
-+NDIS_STATUS oid_gen_supported_list_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_hardware_status_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_media_supported_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_media_in_use_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_maximum_lookahead_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_maximum_frame_size_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_link_speed_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_transmit_buffer_space_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_receive_buffer_space_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_transmit_block_size_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_receive_block_size_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_vendor_id_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_vendor_description_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_current_packet_filter_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_current_lookahead_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_driver_version_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_maximum_total_size_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_protocol_options_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_mac_options_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_media_connect_status_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_maximum_send_packets_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_vendor_driver_version_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+//OID Handler for Segment 2
-+NDIS_STATUS oid_gen_physical_medium_hdl(struct oid_par_priv* poid_par_priv);
-+
-+//OID Handler for Segment 3
-+NDIS_STATUS oid_gen_xmit_ok_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_rcv_ok_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_xmit_error_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_rcv_error_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_gen_rcv_no_buffer_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+//OID Handler for Segment 4
-+NDIS_STATUS oid_802_3_permanent_address_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_current_address_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_multicast_list_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_maximum_list_size_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_mac_options_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+
-+//OID Handler for Segment 5
-+NDIS_STATUS oid_802_3_rcv_error_alignment_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_one_collision_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_more_collisions_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+//OID Handler for Segment 6
-+NDIS_STATUS oid_802_3_xmit_deferred_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_max_collisions_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_rcv_overrun_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_underrun_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_heartbeat_failure_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_times_crs_lost_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_3_xmit_late_collisions_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+
-+//OID Handler for Segment 7
-+NDIS_STATUS oid_pnp_capabilities_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_pnp_set_power_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_pnp_query_power_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_pnp_add_wake_up_pattern_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_pnp_remove_wake_up_pattern_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_pnp_wake_up_pattern_list_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_pnp_enable_wake_up_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+
-+//OID Handler for Segment 8
-+NDIS_STATUS oid_802_11_bssid_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_ssid_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_infrastructure_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_add_wep_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_remove_wep_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_disassociate_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_authentication_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_privacy_filter_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_bssid_list_scan_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_encryption_status_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_reload_defaults_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_add_key_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_remove_key_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_association_information_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_test_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_media_stream_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_capability_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_pmkid_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+
-+
-+
-+//OID Handler for Segment 9
-+NDIS_STATUS oid_802_11_network_types_supported_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_network_type_in_use_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_tx_power_level_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_rssi_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_rssi_trigger_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_fragmentation_threshold_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_rts_threshold_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_number_of_antennas_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_rx_antenna_selected_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_tx_antenna_selected_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_supported_rates_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_desired_rates_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_configuration_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_power_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_802_11_bssid_list_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+//OID Handler for Segment 10
-+NDIS_STATUS oid_802_11_statistics_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+//OID Handler for Segment ED
-+NDIS_STATUS oid_rt_mh_vender_id_hdl(struct oid_par_priv* poid_par_priv);
-+
-+void Set_802_3_MULTICAST_LIST(ADAPTER *pAdapter, UCHAR *MCListbuf, ULONG MCListlen, BOOLEAN bAcceptAllMulticast);
-+
-+#endif// end of PLATFORM_WINDOWS
-+
-+
-+#if defined(PLATFORM_LINUX) && defined(CONFIG_WIRELESS_EXT)
-+extern struct iw_handler_def rtw_handlers_def;
-+#endif
-+
-+extern NDIS_STATUS drv_query_info(
-+ IN _nic_hdl MiniportAdapterContext,
-+ IN NDIS_OID Oid,
-+ IN void * InformationBuffer,
-+ IN u32 InformationBufferLength,
-+ OUT u32* BytesWritten,
-+ OUT u32* BytesNeeded
-+ );
-+
-+extern NDIS_STATUS drv_set_info(
-+ IN _nic_hdl MiniportAdapterContext,
-+ IN NDIS_OID Oid,
-+ IN void * InformationBuffer,
-+ IN u32 InformationBufferLength,
-+ OUT u32* BytesRead,
-+ OUT u32* BytesNeeded
-+ );
-+
-+#endif // #ifndef __INC_CEINFO_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h 2015-07-28 01:20:58.321597318 +0200
-@@ -0,0 +1,35 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _RTW_IOCTL_QUERY_H_
-+#define _RTW_IOCTL_QUERY_H_
-+
-+#include <drv_conf.h>
-+#include <drv_types.h>
-+
-+
-+#ifdef PLATFORM_WINDOWS
-+
-+u8 query_802_11_capability(_adapter* padapter,u8* pucBuf,u32 * pulOutLen);
-+u8 query_802_11_association_information (_adapter * padapter, PNDIS_802_11_ASSOCIATION_INFORMATION pAssocInfo);
-+
-+#endif
-+
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h 2015-07-28 01:20:58.321597318 +0200
-@@ -0,0 +1,83 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef _RTW_IOCTL_RTL_H_
-+#define _RTW_IOCTL_RTL_H_
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+#include <drv_types.h>
-+
-+//************** oid_rtl_seg_01_01 **************
-+NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv);//84
-+NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv* poid_par_priv);
-+
-+NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv* poid_par_priv); //8a
-+NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv* poid_par_priv); //8b
-+
-+NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv* poid_par_priv);//93
-+NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv* poid_par_priv);
-+
-+//************** oid_rtl_seg_01_03 section start **************
-+NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv* poid_par_priv);
-+
-+// oid_rtl_seg_01_11
-+NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv);
-+
-+//************** oid_rtl_seg_03_00 section start **************
-+NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv* poid_par_priv);
-+NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv);
-+
-+
-+
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h 2015-07-28 01:20:58.321597318 +0200
-@@ -0,0 +1,78 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __RTW_IOCTL_SET_H_
-+#define __RTW_IOCTL_SET_H_
-+
-+#include <drv_conf.h>
-+#include <drv_types.h>
-+
-+
-+typedef u8 NDIS_802_11_PMKID_VALUE[16];
-+
-+typedef struct _BSSIDInfo {
-+ NDIS_802_11_MAC_ADDRESS BSSID;
-+ NDIS_802_11_PMKID_VALUE PMKID;
-+} BSSIDInfo, *PBSSIDInfo;
-+
-+
-+#ifdef PLATFORM_OS_XP
-+typedef struct _NDIS_802_11_PMKID {
-+ u32 Length;
-+ u32 BSSIDInfoCount;
-+ BSSIDInfo BSSIDInfo[1];
-+} NDIS_802_11_PMKID, *PNDIS_802_11_PMKID;
-+#endif
-+
-+
-+#ifdef PLATFORM_WINDOWS
-+u8 rtw_set_802_11_reload_defaults(_adapter * padapter, NDIS_802_11_RELOAD_DEFAULTS reloadDefaults);
-+u8 rtw_set_802_11_test(_adapter * padapter, NDIS_802_11_TEST * test);
-+u8 rtw_set_802_11_pmkid(_adapter *pdapter, NDIS_802_11_PMKID *pmkid);
-+
-+u8 rtw_pnp_set_power_sleep(_adapter* padapter);
-+u8 rtw_pnp_set_power_wakeup(_adapter* padapter);
-+
-+void rtw_pnp_resume_wk(void *context);
-+void rtw_pnp_sleep_wk(void * context);
-+
-+#endif
-+
-+u8 rtw_set_802_11_add_key(_adapter * padapter, NDIS_802_11_KEY * key);
-+u8 rtw_set_802_11_authentication_mode(_adapter *pdapter, NDIS_802_11_AUTHENTICATION_MODE authmode);
-+u8 rtw_set_802_11_bssid(_adapter* padapter, u8 *bssid);
-+u8 rtw_set_802_11_add_wep(_adapter * padapter, NDIS_802_11_WEP * wep);
-+u8 rtw_set_802_11_disassociate(_adapter * padapter);
-+u8 rtw_set_802_11_bssid_list_scan(_adapter* padapter, NDIS_802_11_SSID *pssid, int ssid_max_num);
-+u8 rtw_set_802_11_infrastructure_mode(_adapter * padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
-+u8 rtw_set_802_11_remove_wep(_adapter * padapter, u32 keyindex);
-+u8 rtw_set_802_11_ssid(_adapter * padapter, NDIS_802_11_SSID * ssid);
-+u8 rtw_set_802_11_connect(_adapter* padapter, u8 *bssid, NDIS_802_11_SSID *ssid);
-+u8 rtw_set_802_11_remove_key(_adapter * padapter, NDIS_802_11_REMOVE_KEY * key);
-+
-+u8 rtw_validate_bssid(u8 *bssid);
-+u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid);
-+
-+u16 rtw_get_cur_max_rate(_adapter *adapter);
-+int rtw_set_scan_mode(_adapter *adapter, RT_SCAN_TYPE scan_mode);
-+int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan);
-+int rtw_set_country(_adapter *adapter, const char *country_code);
-+int rtw_set_band(_adapter *adapter, enum _BAND band);
-+
-+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_io.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_io.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_io.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_io.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_io.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_io.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_io.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_io.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,504 @@
+/******************************************************************************
+ *
@@ -183654,9 +191801,489 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_io.h linux-xbia
+*/
+
+#endif //_RTL8711_IO_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_iol.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_iol.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_iol.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_iol.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,268 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _RTW_IOCTL_H_
++#define _RTW_IOCTL_H_
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++#include <drv_types.h>
++
++#ifndef OID_802_11_CAPABILITY
++ #define OID_802_11_CAPABILITY 0x0d010122
++#endif
++
++#ifndef OID_802_11_PMKID
++ #define OID_802_11_PMKID 0x0d010123
++#endif
++
++
++// For DDK-defined OIDs
++#define OID_NDIS_SEG1 0x00010100
++#define OID_NDIS_SEG2 0x00010200
++#define OID_NDIS_SEG3 0x00020100
++#define OID_NDIS_SEG4 0x01010100
++#define OID_NDIS_SEG5 0x01020100
++#define OID_NDIS_SEG6 0x01020200
++#define OID_NDIS_SEG7 0xFD010100
++#define OID_NDIS_SEG8 0x0D010100
++#define OID_NDIS_SEG9 0x0D010200
++#define OID_NDIS_SEG10 0x0D020200
++
++#define SZ_OID_NDIS_SEG1 23
++#define SZ_OID_NDIS_SEG2 3
++#define SZ_OID_NDIS_SEG3 6
++#define SZ_OID_NDIS_SEG4 6
++#define SZ_OID_NDIS_SEG5 4
++#define SZ_OID_NDIS_SEG6 8
++#define SZ_OID_NDIS_SEG7 7
++#define SZ_OID_NDIS_SEG8 36
++#define SZ_OID_NDIS_SEG9 24
++#define SZ_OID_NDIS_SEG10 19
++
++// For Realtek-defined OIDs
++#define OID_MP_SEG1 0xFF871100
++#define OID_MP_SEG2 0xFF818000
++
++#define OID_MP_SEG3 0xFF818700
++#define OID_MP_SEG4 0xFF011100
++
++#define DEBUG_OID(dbg, str) \
++ if((!dbg)) \
++ { \
++ RT_TRACE(_module_rtl871x_ioctl_c_,_drv_info_,("%s(%d): %s", __FUNCTION__, __LINE__, str)); \
++ }
++
++
++enum oid_type
++{
++ QUERY_OID,
++ SET_OID
++};
++
++struct oid_funs_node {
++ unsigned int oid_start; //the starting number for OID
++ unsigned int oid_end; //the ending number for OID
++ struct oid_obj_priv *node_array;
++ unsigned int array_sz; //the size of node_array
++ int query_counter; //count the number of query hits for this segment
++ int set_counter; //count the number of set hits for this segment
++};
++
++struct oid_par_priv
++{
++ void *adapter_context;
++ NDIS_OID oid;
++ void *information_buf;
++ u32 information_buf_len;
++ u32 *bytes_rw;
++ u32 *bytes_needed;
++ enum oid_type type_of_oid;
++ u32 dbg;
++};
++
++struct oid_obj_priv {
++ unsigned char dbg; // 0: without OID debug message 1: with OID debug message
++ NDIS_STATUS (*oidfuns)(struct oid_par_priv *poid_par_priv);
++};
++
++#if (defined(CONFIG_MP_INCLUDED) && defined(_RTW_MP_IOCTL_C_)) || \
++ (defined(PLATFORM_WINDOWS) && defined(_RTW_IOCTL_RTL_C_))
++static NDIS_STATUS oid_null_function(struct oid_par_priv* poid_par_priv)
++{
++ _func_enter_;
++ _func_exit_;
++ return NDIS_STATUS_SUCCESS;
++}
++#endif
++
++#ifdef PLATFORM_WINDOWS
++
++int TranslateNdisPsToRtPs(IN NDIS_802_11_POWER_MODE ndisPsMode);
++
++//OID Handler for Segment 1
++NDIS_STATUS oid_gen_supported_list_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_hardware_status_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_media_supported_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_media_in_use_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_maximum_lookahead_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_maximum_frame_size_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_link_speed_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_transmit_buffer_space_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_receive_buffer_space_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_transmit_block_size_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_receive_block_size_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_vendor_id_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_vendor_description_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_current_packet_filter_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_current_lookahead_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_driver_version_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_maximum_total_size_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_protocol_options_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_mac_options_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_media_connect_status_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_maximum_send_packets_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_vendor_driver_version_hdl(struct oid_par_priv* poid_par_priv);
++
++
++//OID Handler for Segment 2
++NDIS_STATUS oid_gen_physical_medium_hdl(struct oid_par_priv* poid_par_priv);
++
++//OID Handler for Segment 3
++NDIS_STATUS oid_gen_xmit_ok_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_rcv_ok_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_xmit_error_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_rcv_error_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_gen_rcv_no_buffer_hdl(struct oid_par_priv* poid_par_priv);
++
++
++//OID Handler for Segment 4
++NDIS_STATUS oid_802_3_permanent_address_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_current_address_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_multicast_list_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_maximum_list_size_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_mac_options_hdl(struct oid_par_priv* poid_par_priv);
++
++
++
++//OID Handler for Segment 5
++NDIS_STATUS oid_802_3_rcv_error_alignment_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_one_collision_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_more_collisions_hdl(struct oid_par_priv* poid_par_priv);
++
++
++//OID Handler for Segment 6
++NDIS_STATUS oid_802_3_xmit_deferred_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_max_collisions_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_rcv_overrun_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_underrun_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_heartbeat_failure_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_times_crs_lost_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_3_xmit_late_collisions_hdl(struct oid_par_priv* poid_par_priv);
++
++
++
++//OID Handler for Segment 7
++NDIS_STATUS oid_pnp_capabilities_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_pnp_set_power_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_pnp_query_power_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_pnp_add_wake_up_pattern_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_pnp_remove_wake_up_pattern_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_pnp_wake_up_pattern_list_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_pnp_enable_wake_up_hdl(struct oid_par_priv* poid_par_priv);
++
++
++
++//OID Handler for Segment 8
++NDIS_STATUS oid_802_11_bssid_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_ssid_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_infrastructure_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_add_wep_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_remove_wep_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_disassociate_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_authentication_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_privacy_filter_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_bssid_list_scan_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_encryption_status_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_reload_defaults_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_add_key_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_remove_key_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_association_information_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_test_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_media_stream_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_capability_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_pmkid_hdl(struct oid_par_priv* poid_par_priv);
++
++
++
++
++
++//OID Handler for Segment 9
++NDIS_STATUS oid_802_11_network_types_supported_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_network_type_in_use_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_tx_power_level_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_rssi_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_rssi_trigger_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_fragmentation_threshold_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_rts_threshold_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_number_of_antennas_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_rx_antenna_selected_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_tx_antenna_selected_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_supported_rates_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_desired_rates_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_configuration_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_power_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_802_11_bssid_list_hdl(struct oid_par_priv* poid_par_priv);
++
++
++//OID Handler for Segment 10
++NDIS_STATUS oid_802_11_statistics_hdl(struct oid_par_priv* poid_par_priv);
++
++
++//OID Handler for Segment ED
++NDIS_STATUS oid_rt_mh_vender_id_hdl(struct oid_par_priv* poid_par_priv);
++
++void Set_802_3_MULTICAST_LIST(ADAPTER *pAdapter, UCHAR *MCListbuf, ULONG MCListlen, BOOLEAN bAcceptAllMulticast);
++
++#endif// end of PLATFORM_WINDOWS
++
++
++#if defined(PLATFORM_LINUX) && defined(CONFIG_WIRELESS_EXT)
++extern struct iw_handler_def rtw_handlers_def;
++#endif
++
++extern NDIS_STATUS drv_query_info(
++ IN _nic_hdl MiniportAdapterContext,
++ IN NDIS_OID Oid,
++ IN void * InformationBuffer,
++ IN u32 InformationBufferLength,
++ OUT u32* BytesWritten,
++ OUT u32* BytesNeeded
++ );
++
++extern NDIS_STATUS drv_set_info(
++ IN _nic_hdl MiniportAdapterContext,
++ IN NDIS_OID Oid,
++ IN void * InformationBuffer,
++ IN u32 InformationBufferLength,
++ OUT u32* BytesRead,
++ OUT u32* BytesNeeded
++ );
++
++#endif // #ifndef __INC_CEINFO_
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_query.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,35 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _RTW_IOCTL_QUERY_H_
++#define _RTW_IOCTL_QUERY_H_
++
++#include <drv_conf.h>
++#include <drv_types.h>
++
++
++#ifdef PLATFORM_WINDOWS
++
++u8 query_802_11_capability(_adapter* padapter,u8* pucBuf,u32 * pulOutLen);
++u8 query_802_11_association_information (_adapter * padapter, PNDIS_802_11_ASSOCIATION_INFORMATION pAssocInfo);
++
++#endif
++
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_rtl.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,83 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef _RTW_IOCTL_RTL_H_
++#define _RTW_IOCTL_RTL_H_
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++#include <drv_types.h>
++
++//************** oid_rtl_seg_01_01 **************
++NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv);//84
++NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv* poid_par_priv);
++
++NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv* poid_par_priv); //8a
++NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv* poid_par_priv); //8b
++
++NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv* poid_par_priv);//93
++NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv* poid_par_priv);
++
++//************** oid_rtl_seg_01_03 section start **************
++NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv* poid_par_priv);
++
++// oid_rtl_seg_01_11
++NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv);
++
++//************** oid_rtl_seg_03_00 section start **************
++NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv* poid_par_priv);
++NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv);
++
++
++
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_ioctl_set.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,78 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __RTW_IOCTL_SET_H_
++#define __RTW_IOCTL_SET_H_
++
++#include <drv_conf.h>
++#include <drv_types.h>
++
++
++typedef u8 NDIS_802_11_PMKID_VALUE[16];
++
++typedef struct _BSSIDInfo {
++ NDIS_802_11_MAC_ADDRESS BSSID;
++ NDIS_802_11_PMKID_VALUE PMKID;
++} BSSIDInfo, *PBSSIDInfo;
++
++
++#ifdef PLATFORM_OS_XP
++typedef struct _NDIS_802_11_PMKID {
++ u32 Length;
++ u32 BSSIDInfoCount;
++ BSSIDInfo BSSIDInfo[1];
++} NDIS_802_11_PMKID, *PNDIS_802_11_PMKID;
++#endif
++
++
++#ifdef PLATFORM_WINDOWS
++u8 rtw_set_802_11_reload_defaults(_adapter * padapter, NDIS_802_11_RELOAD_DEFAULTS reloadDefaults);
++u8 rtw_set_802_11_test(_adapter * padapter, NDIS_802_11_TEST * test);
++u8 rtw_set_802_11_pmkid(_adapter *pdapter, NDIS_802_11_PMKID *pmkid);
++
++u8 rtw_pnp_set_power_sleep(_adapter* padapter);
++u8 rtw_pnp_set_power_wakeup(_adapter* padapter);
++
++void rtw_pnp_resume_wk(void *context);
++void rtw_pnp_sleep_wk(void * context);
++
++#endif
++
++u8 rtw_set_802_11_add_key(_adapter * padapter, NDIS_802_11_KEY * key);
++u8 rtw_set_802_11_authentication_mode(_adapter *pdapter, NDIS_802_11_AUTHENTICATION_MODE authmode);
++u8 rtw_set_802_11_bssid(_adapter* padapter, u8 *bssid);
++u8 rtw_set_802_11_add_wep(_adapter * padapter, NDIS_802_11_WEP * wep);
++u8 rtw_set_802_11_disassociate(_adapter * padapter);
++u8 rtw_set_802_11_bssid_list_scan(_adapter* padapter, NDIS_802_11_SSID *pssid, int ssid_max_num);
++u8 rtw_set_802_11_infrastructure_mode(_adapter * padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
++u8 rtw_set_802_11_remove_wep(_adapter * padapter, u32 keyindex);
++u8 rtw_set_802_11_ssid(_adapter * padapter, NDIS_802_11_SSID * ssid);
++u8 rtw_set_802_11_connect(_adapter* padapter, u8 *bssid, NDIS_802_11_SSID *ssid);
++u8 rtw_set_802_11_remove_key(_adapter * padapter, NDIS_802_11_REMOVE_KEY * key);
++
++u8 rtw_validate_bssid(u8 *bssid);
++u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid);
++
++u16 rtw_get_cur_max_rate(_adapter *adapter);
++int rtw_set_scan_mode(_adapter *adapter, RT_SCAN_TYPE scan_mode);
++int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan);
++int rtw_set_country(_adapter *adapter, const char *country_code);
++int rtw_set_band(_adapter *adapter, enum _BAND band);
++
++#endif
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_iol.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_iol.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_iol.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_iol.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,89 @@
+/******************************************************************************
+ *
@@ -183747,9 +192374,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_iol.h linux-xbi
+bool rtw_IOL_applied(ADAPTER *adapter);
+
+#endif //__RTW_IOL_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_led.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_led.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_led.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_led.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_led.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_led.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_led.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_led.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,216 @@
+/******************************************************************************
+ *
@@ -183967,9 +192594,856 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_led.h linux-xbi
+extern void BlinkHandler(PLED_871x pLed);
+
+#endif //__RTW_LED_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h 2015-08-26 10:26:08.761316441 +0200
+@@ -0,0 +1,843 @@
++/******************************************************************************
++ *
++ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
++ * more details.
++ *
++ * You should have received a copy of the GNU General Public License along with
++ * this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
++ *
++ *
++ ******************************************************************************/
++#ifndef __RTW_MLME_H_
++#define __RTW_MLME_H_
++
++#include <drv_conf.h>
++#include <osdep_service.h>
++#include <mlme_osdep.h>
++#include <drv_types.h>
++#include <wlan_bssdef.h>
++
++#ifdef CONFIG_INTEL_WIDI
++#include <rtw_intel_widi.h>
++#endif
++
++#define MAX_BSS_CNT 128
++//#define MAX_JOIN_TIMEOUT 2000
++//#define MAX_JOIN_TIMEOUT 2500
++#define MAX_JOIN_TIMEOUT 6500
++
++// Commented by Albert 20101105
++// Increase the scanning timeout because of increasing the SURVEY_TO value.
++
++#define SCANNING_TIMEOUT 8000
++
++#define SCAN_INTERVAL (30) // unit:2sec, 30*2=60sec
++
++#ifdef PALTFORM_OS_WINCE
++#define SCANQUEUE_LIFETIME 12000000 // unit:us
++#else
++#define SCANQUEUE_LIFETIME 20 // unit:sec
++#endif
++
++#define WIFI_NULL_STATE 0x00000000
++
++#define WIFI_ASOC_STATE 0x00000001 // Under Linked state...
++#define WIFI_REASOC_STATE 0x00000002
++#define WIFI_SLEEP_STATE 0x00000004
++#define WIFI_STATION_STATE 0x00000008
++
++#define WIFI_AP_STATE 0x00000010
++#define WIFI_ADHOC_STATE 0x00000020
++#define WIFI_ADHOC_MASTER_STATE 0x00000040
++#define WIFI_UNDER_LINKING 0x00000080
++
++#define WIFI_UNDER_WPS 0x00000100
++//#define WIFI_UNDER_CMD 0x00000200
++//#define WIFI_UNDER_P2P 0x00000400
++#define WIFI_STA_ALIVE_CHK_STATE 0x00000400
++#define WIFI_SITE_MONITOR 0x00000800 //to indicate the station is under site surveying
++
++#ifdef WDS
++#define WIFI_WDS 0x00001000
++#define WIFI_WDS_RX_BEACON 0x00002000 // already rx WDS AP beacon
++#endif
++#ifdef AUTO_CONFIG
++#define WIFI_AUTOCONF 0x00004000
++#define WIFI_AUTOCONF_IND 0x00008000
++#endif
++
++/*
++// ========== P2P Section Start ===============
++#define WIFI_P2P_LISTEN_STATE 0x00010000
++#define WIFI_P2P_GROUP_FORMATION_STATE 0x00020000
++// ========== P2P Section End ===============
++*/
++
++//#ifdef UNDER_MPTEST
++#define WIFI_MP_STATE 0x00010000
++#define WIFI_MP_CTX_BACKGROUND 0x00020000 // in continous tx background
++#define WIFI_MP_CTX_ST 0x00040000 // in continous tx with single-tone
++#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 // pending in continous tx background due to out of skb
++#define WIFI_MP_CTX_CCK_HW 0x00100000 // in continous tx
++#define WIFI_MP_CTX_CCK_CS 0x00200000 // in continous tx with carrier suppression
++#define WIFI_MP_LPBK_STATE 0x00400000
++//#endif
++
++//#define _FW_UNDER_CMD WIFI_UNDER_CMD
++#define _FW_UNDER_LINKING WIFI_UNDER_LINKING
++#define _FW_LINKED WIFI_ASOC_STATE
++#define _FW_UNDER_SURVEY WIFI_SITE_MONITOR
++
++
++enum dot11AuthAlgrthmNum {
++ dot11AuthAlgrthm_Open = 0,
++ dot11AuthAlgrthm_Shared,
++ dot11AuthAlgrthm_8021X,
++ dot11AuthAlgrthm_Auto,
++ dot11AuthAlgrthm_MaxNum
++};
++
++// Scan type including active and passive scan.
++typedef enum _RT_SCAN_TYPE
++{
++ SCAN_PASSIVE,
++ SCAN_ACTIVE,
++ SCAN_MIX,
++}RT_SCAN_TYPE, *PRT_SCAN_TYPE;
++
++enum DriverInterface {
++ DRIVER_WEXT = 1,
++ DRIVER_CFG80211 = 2
++};
++
++enum _BAND
++{
++ GHZ24_50 = 0,
++ GHZ_50,
++ GHZ_24,
++ GHZ_MAX,
++};
++
++#define rtw_band_valid(band) ((band) >= GHZ24_50 && (band) < GHZ_MAX)
++
++enum SCAN_RESULT_TYPE
++{
++ SCAN_RESULT_P2P_ONLY = 0, // Will return all the P2P devices.
++ SCAN_RESULT_ALL = 1, // Will return all the scanned device, include AP.
++ SCAN_RESULT_WFD_TYPE = 2 // Will just return the correct WFD device.
++ // If this device is Miracast sink device, it will just return all the Miracast source devices.
++};
++
++/*
++
++there are several "locks" in mlme_priv,
++since mlme_priv is a shared resource between many threads,
++like ISR/Call-Back functions, the OID handlers, and even timer functions.
++
++
++Each _queue has its own locks, already.
++Other items are protected by mlme_priv.lock.
++
++To avoid possible dead lock, any thread trying to modifiying mlme_priv
++SHALL not lock up more than one locks at a time!
++
++*/
++
++
++#define traffic_threshold 10
++#define traffic_scan_period 500
++
++struct sitesurvey_ctrl {
++ u64 last_tx_pkts;
++ uint last_rx_pkts;
++ sint traffic_busy;
++ _timer sitesurvey_ctrl_timer;
++};
++
++typedef struct _RT_LINK_DETECT_T{
++ u32 NumTxOkInPeriod;
++ u32 NumRxOkInPeriod;
++ u32 NumRxUnicastOkInPeriod;
++ BOOLEAN bBusyTraffic;
++ BOOLEAN bTxBusyTraffic;
++ BOOLEAN bRxBusyTraffic;
++ BOOLEAN bHigherBusyTraffic; // For interrupt migration purpose.
++ BOOLEAN bHigherBusyRxTraffic; // We may disable Tx interrupt according as Rx traffic.
++ BOOLEAN bHigherBusyTxTraffic; // We may disable Tx interrupt according as Tx traffic.
++}RT_LINK_DETECT_T, *PRT_LINK_DETECT_T;
++
++struct profile_info {
++ u8 ssidlen;
++ u8 ssid[ WLAN_SSID_MAXLEN ];
++ u8 peermac[ ETH_ALEN ];
++};
++
++struct tx_invite_req_info{
++ u8 token;
++ u8 benable;
++ u8 go_ssid[ WLAN_SSID_MAXLEN ];
++ u8 ssidlen;
++ u8 go_bssid[ ETH_ALEN ];
++ u8 peer_macaddr[ ETH_ALEN ];
++ u8 operating_ch; // This information will be set by using the p2p_set op_ch=x
++ u8 peer_ch; // The listen channel for peer P2P device
++
++};
++
++struct tx_invite_resp_info{
++ u8 token; // Used to record the dialog token of p2p invitation request frame.
++};
++
++#ifdef CONFIG_WFD
++
++struct wifi_display_info{
++ u16 wfd_enable; // Eanble/Disable the WFD function.
++ u16 rtsp_ctrlport; // TCP port number at which the this WFD device listens for RTSP messages
++ u16 peer_rtsp_ctrlport; // TCP port number at which the peer WFD device listens for RTSP messages
++ // This filed should be filled when receiving the gropu negotiation request
++
++ u8 peer_session_avail; // WFD session is available or not for the peer wfd device.
++ // This variable will be set when sending the provisioning discovery request to peer WFD device.
++ // And this variable will be reset when it is read by using the iwpriv p2p_get wfd_sa command.
++
++ u8 ip_address[4];
++ u8 peer_ip_address[4];
++ u8 wfd_pc; // WFD preferred connection
++ // 0 -> Prefer to use the P2P for WFD connection on peer side.
++ // 1 -> Prefer to use the TDLS for WFD connection on peer side.
++
++ u8 wfd_device_type; // WFD Device Type
++ // 0 -> WFD Source Device
++ // 1 -> WFD Primary Sink Device
++ enum SCAN_RESULT_TYPE scan_result_type; // Used when P2P is enable. This parameter will impact the scan result.
++};
++#endif //CONFIG_WFD
++
++struct tx_provdisc_req_info{
++ u16 wps_config_method_request; // Used when sending the provisioning request frame
++ u16 peer_channel_num[2]; // The channel number which the receiver stands.
++ NDIS_802_11_SSID ssid;
++ u8 peerDevAddr[ ETH_ALEN ]; // Peer device address
++ u8 peerIFAddr[ ETH_ALEN ]; // Peer interface address
++ u8 benable; // This provision discovery request frame is trigger to send or not
++};
++
++struct rx_provdisc_req_info{ //When peer device issue prov_disc_req first, we should store the following informations
++ u8 peerDevAddr[ ETH_ALEN ]; // Peer device address
++ u8 strconfig_method_desc_of_prov_disc_req[4]; // description for the config method located in the provisioning discovery request frame.
++ // The UI must know this information to know which config method the remote p2p device is requiring.
++};
++
++struct tx_nego_req_info{
++ u16 peer_channel_num[2]; // The channel number which the receiver stands.
++ u8 peerDevAddr[ ETH_ALEN ]; // Peer device address
++ u8 benable; // This negoitation request frame is trigger to send or not
++};
++
++struct group_id_info{
++ u8 go_device_addr[ ETH_ALEN ]; // The GO's device address of this P2P group
++ u8 ssid[ WLAN_SSID_MAXLEN ]; // The SSID of this P2P group
++};
++
++struct scan_limit_info{
++ u8 scan_op_ch_only; // When this flag is set, the driver should just scan the operation channel
++#ifndef P2P_OP_CHECK_SOCIAL_CH
++ u8 operation_ch[2]; // Store the operation channel of invitation request frame
++#else
++ u8 operation_ch[5]; // Store additional channel 1,6,11 for Android 4.2 IOT & Nexus 4
++#endif //P2P_OP_CHECK_SOCIAL_CH
++};
++
++#ifdef CONFIG_IOCTL_CFG80211
++struct cfg80211_wifidirect_info{
++ _timer remain_on_ch_timer;
++ u8 restore_channel;
++ struct ieee80211_channel remain_on_ch_channel;
++ enum nl80211_channel_type remain_on_ch_type;
++ u64 remain_on_ch_cookie;
++ bool is_ro_ch;
++};
++#endif //CONFIG_IOCTL_CFG80211
++
++struct wifidirect_info{
++ _adapter* padapter;
++ _timer find_phase_timer;
++ _timer restore_p2p_state_timer;
++
++ // Used to do the scanning. After confirming the peer is availalble, the driver transmits the P2P frame to peer.
++ _timer pre_tx_scan_timer;
++ _timer reset_ch_sitesurvey;
++ _timer reset_ch_sitesurvey2; // Just for resetting the scan limit function by using p2p nego
++#ifdef CONFIG_CONCURRENT_MODE
++ // Used to switch the channel between legacy AP and listen state.
++ _timer ap_p2p_switch_timer;
++#endif
++ struct tx_provdisc_req_info tx_prov_disc_info;
++ struct rx_provdisc_req_info rx_prov_disc_info;
++ struct tx_invite_req_info invitereq_info;
++ struct profile_info profileinfo[ P2P_MAX_PERSISTENT_GROUP_NUM ]; // Store the profile information of persistent group
++ struct tx_invite_resp_info inviteresp_info;
++ struct tx_nego_req_info nego_req_info;
++ struct group_id_info groupid_info; // Store the group id information when doing the group negotiation handshake.
++ struct scan_limit_info rx_invitereq_info; // Used for get the limit scan channel from the Invitation procedure
++ struct scan_limit_info p2p_info; // Used for get the limit scan channel from the P2P negotiation handshake
++#ifdef CONFIG_WFD
++ struct wifi_display_info *wfd_info;
++#endif
++ enum P2P_ROLE role;
++ enum P2P_STATE pre_p2p_state;
++ enum P2P_STATE p2p_state;
++ u8 device_addr[ETH_ALEN]; // The device address should be the mac address of this device.
++ u8 interface_addr[ETH_ALEN];
++ u8 social_chan[4];
++ u8 listen_channel;
++ u8 operating_channel;
++ u8 listen_dwell; // This value should be between 1 and 3
++ u8 support_rate[8];
++ u8 p2p_wildcard_ssid[P2P_WILDCARD_SSID_LEN];
++ u8 intent; // should only include the intent value.
++ u8 p2p_peer_interface_addr[ ETH_ALEN ];
++ u8 p2p_peer_device_addr[ ETH_ALEN ];
++ u8 peer_intent; // Included the intent value and tie breaker value.
++ u8 device_name[ WPS_MAX_DEVICE_NAME_LEN ]; // Device name for displaying on searching device screen
++ u8 device_name_len;
++ u8 profileindex; // Used to point to the index of profileinfo array
++ u8 peer_operating_ch;
++ u8 find_phase_state_exchange_cnt;
++ u16 device_password_id_for_nego; // The device password ID for group negotation
++ u8 negotiation_dialog_token;
++ u8 nego_ssid[ WLAN_SSID_MAXLEN ]; // SSID information for group negotitation
++ u8 nego_ssidlen;
++ u8 p2p_group_ssid[WLAN_SSID_MAXLEN];
++ u8 p2p_group_ssid_len;
++ u8 persistent_supported; // Flag to know the persistent function should be supported or not.
++ // In the Sigma test, the Sigma will provide this enable from the sta_set_p2p CAPI.
++ // 0: disable
++ // 1: enable
++ u8 session_available; // Flag to set the WFD session available to enable or disable "by Sigma"
++ // In the Sigma test, the Sigma will disable the session available by using the sta_preset CAPI.
++ // 0: disable
++ // 1: enable
++ u8 wfd_tdls_enable; // Flag to enable or disable the TDLS by WFD Sigma
++ // 0: disable
++ // 1: enable
++ u8 wfd_tdls_weaksec; // Flag to enable or disable the weak security function for TDLS by WFD Sigma
++ // 0: disable
++ // In this case, the driver can't issue the tdsl setup request frame.
++ // 1: enable
++ // In this case, the driver can issue the tdls setup request frame
++ // even the current security is weak security.
++
++ enum P2P_WPSINFO ui_got_wps_info; // This field will store the WPS value (PIN value or PBC) that UI had got from the user.
++ u16 supported_wps_cm; // This field describes the WPS config method which this driver supported.
++ // The value should be the combination of config method defined in page104 of WPS v2.0 spec.
++ u8 external_uuid; // UUID flag
++ u8 uuid[16]; // UUID
++ uint channel_list_attr_len; // This field will contain the length of body of P2P Channel List attribute of group negotitation response frame.
++ u8 channel_list_attr[100]; // This field will contain the body of P2P Channel List attribute of group negotitation response frame.
++ // We will use the channel_cnt and channel_list fields when constructing the group negotitation confirm frame.
++ u8 driver_interface; // Indicate DRIVER_WEXT or DRIVER_CFG80211
++
++#ifdef CONFIG_CONCURRENT_MODE
++ u16 ext_listen_interval; // The interval to be available with legacy AP (ms)
++ u16 ext_listen_period; // The time period to be available for P2P listen state (ms)
++#endif
++#ifdef CONFIG_P2P_PS
++ enum P2P_PS_MODE p2p_ps_mode; // indicate p2p ps mode
++ enum P2P_PS_STATE p2p_ps_state; // indicate p2p ps state
++ u8 noa_index; // Identifies and instance of Notice of Absence timing.
++ u8 ctwindow; // Client traffic window. A period of time in TU after TBTT.
++ u8 opp_ps; // opportunistic power save.
++ u8 noa_num; // number of NoA descriptor in P2P IE.
++ u8 noa_count[P2P_MAX_NOA_NUM]; // Count for owner, Type of client.
++ u32 noa_duration[P2P_MAX_NOA_NUM]; // Max duration for owner, preferred or min acceptable duration for client.
++ u32 noa_interval[P2P_MAX_NOA_NUM]; // Length of interval for owner, preferred or max acceptable interval of client.
++ u32 noa_start_time[P2P_MAX_NOA_NUM]; // schedule expressed in terms of the lower 4 bytes of the TSF timer.
++#endif // CONFIG_P2P_PS
++};
++
++struct tdls_ss_record{ //signal strength record; recording the tdls sta with lowerest ss
++ u8 macaddr[ETH_ALEN];
++ u8 RxPWDBAll;
++ u8 is_tdls_sta; // _TRUE: direct link sta, _FALSE: else
++};
++
++struct tdls_info{
++ u8 ap_prohibited;
++ uint setup_state;
++ u8 sta_cnt;
++ u8 sta_maximum; // 1:tdls sta is equal (NUM_STA-1), reach max direct link number; 0: else;
++ struct tdls_ss_record ss_record;
++ u8 macid_index; //macid entry that is ready to write
++ u8 clear_cam; //cam entry that is trying to clear, using it in direct link teardown
++ u8 ch_sensing;
++ u8 cur_channel;
++ u8 candidate_ch;
++ u8 collect_pkt_num[MAX_CHANNEL_NUM];
++ _lock cmd_lock;
++ _lock hdl_lock;
++ u8 watchdog_count;
++ u8 dev_discovered; //WFD_TDLS: for sigma test
++ u8 enable;
++#ifdef CONFIG_WFD
++ struct wifi_display_info *wfd_info;
++#endif
++};
++
++struct mlme_priv {
++
++ _lock lock;
++ sint fw_state; //shall we protect this variable? maybe not necessarily...
++
++ u8 to_join; //flag
++ #ifdef CONFIG_LAYER2_ROAMING
++ u8 to_roaming; // roaming trying times
++ #endif
++
++ u8 *nic_hdl;
++
++ u8 not_indic_disco;
++ _list *pscanned;
++ _queue free_bss_pool;
++ _queue scanned_queue;
++ u8 *free_bss_buf;
++ u32 num_of_scanned;
++
++ NDIS_802_11_SSID assoc_ssid;
++ u8 assoc_bssid[6];
++
++ struct wlan_network cur_network;
++
++ //uint wireless_mode; no used, remove it
++
++ u32 scan_interval;
++
++ _timer assoc_timer;
++
++ uint assoc_by_bssid;
++ uint assoc_by_rssi;
++
++ _timer scan_to_timer; // driver itself handles scan_timeout status.
++ u32 scan_start_time; // used to evaluate the time spent in scanning
++
++ #ifdef CONFIG_SET_SCAN_DENY_TIMER
++ _timer set_scan_deny_timer;
++ ATOMIC_T set_scan_deny; //0: allowed, 1: deny
++ #endif
++
++ struct qos_priv qospriv;
++
++#ifdef CONFIG_80211N_HT
++
++ /* Number of non-HT AP/stations */
++ int num_sta_no_ht;
++
++ /* Number of HT AP/stations 20 MHz */
++ //int num_sta_ht_20mhz;
++
++
++ int num_FortyMHzIntolerant;
++
++ struct ht_priv htpriv;
++
++#endif
++
++ RT_LINK_DETECT_T LinkDetectInfo;
++ _timer dynamic_chk_timer; //dynamic/periodic check timer
++
++ u8 acm_mask; // for wmm acm mask
++ u8 ChannelPlan;
++ RT_SCAN_TYPE scan_mode; // active: 1, passive: 0
++
++ //u8 probereq_wpsie[MAX_WPS_IE_LEN];//added in probe req
++ //int probereq_wpsie_len;
++ u8 *wps_probe_req_ie;
++ u32 wps_probe_req_ie_len;
++
++#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++ /* Number of associated Non-ERP stations (i.e., stations using 802.11b
++ * in 802.11g BSS) */
++ int num_sta_non_erp;
++
++ /* Number of associated stations that do not support Short Slot Time */
++ int num_sta_no_short_slot_time;
++
++ /* Number of associated stations that do not support Short Preamble */
++ int num_sta_no_short_preamble;
++
++ int olbc; /* Overlapping Legacy BSS Condition */
++
++ /* Number of HT associated stations that do not support greenfield */
++ int num_sta_ht_no_gf;
++
++ /* Number of associated non-HT stations */
++ //int num_sta_no_ht;
++
++ /* Number of HT associated stations 20 MHz */
++ int num_sta_ht_20mhz;
++
++ /* Overlapping BSS information */
++ int olbc_ht;
++
++#ifdef CONFIG_80211N_HT
++ u16 ht_op_mode;
++#endif /* CONFIG_80211N_HT */
++
++ u8 *assoc_req;
++ u32 assoc_req_len;
++ u8 *assoc_rsp;
++ u32 assoc_rsp_len;
++
++ u8 *wps_beacon_ie;
++ //u8 *wps_probe_req_ie;
++ u8 *wps_probe_resp_ie;
++ u8 *wps_assoc_resp_ie; // for CONFIG_IOCTL_CFG80211, this IE could include p2p ie / wfd ie
++
++ u32 wps_beacon_ie_len;
++ //u32 wps_probe_req_ie_len;
++ u32 wps_probe_resp_ie_len;
++ u32 wps_assoc_resp_ie_len; // for CONFIG_IOCTL_CFG80211, this IE len could include p2p ie / wfd ie
++
++ u8 *p2p_beacon_ie;
++ u8 *p2p_probe_req_ie;
++ u8 *p2p_probe_resp_ie;
++ u8 *p2p_go_probe_resp_ie; //for GO
++ u8 *p2p_assoc_req_ie;
++
++ u32 p2p_beacon_ie_len;
++ u32 p2p_probe_req_ie_len;
++ u32 p2p_probe_resp_ie_len;
++ u32 p2p_go_probe_resp_ie_len; //for GO
++ u32 p2p_assoc_req_ie_len;
++/*
++#if defined(CONFIG_P2P) && defined(CONFIG_IOCTL_CFG80211)
++ //u8 *wps_p2p_beacon_ie;
++ u8 *p2p_beacon_ie;
++ u8 *wps_p2p_probe_resp_ie;
++ u8 *wps_p2p_assoc_resp_ie;
++ //u32 wps_p2p_beacon_ie_len;
++ u32 p2p_beacon_ie_len;
++ u32 wps_p2p_probe_resp_ie_len;
++ u32 wps_p2p_assoc_resp_ie_len;
++#endif
++*/
++
++ _lock bcn_update_lock;
++ u8 update_bcn;
++
++
++#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
++
++#if defined(CONFIG_WFD) && defined(CONFIG_IOCTL_CFG80211)
++
++ u8 *wfd_beacon_ie;
++ u8 *wfd_probe_req_ie;
++ u8 *wfd_probe_resp_ie;
++ u8 *wfd_go_probe_resp_ie; //for GO
++ u8 *wfd_assoc_req_ie;
++
++ u32 wfd_beacon_ie_len;
++ u32 wfd_probe_req_ie_len;
++ u32 wfd_probe_resp_ie_len;
++ u32 wfd_go_probe_resp_ie_len; //for GO
++ u32 wfd_assoc_req_ie_len;
++
++#endif
++
++#ifdef RTK_DMP_PLATFORM
++ // DMP kobject_hotplug function signal need in passive level
++ _workitem Linkup_workitem;
++ _workitem Linkdown_workitem;
++#endif
++
++#ifdef CONFIG_INTEL_WIDI
++ int widi_state;
++ int listen_state;
++ _timer listen_timer;
++ ATOMIC_T rx_probe_rsp; // 1:receive probe respone from RDS source.
++ u8 *l2sdTaBuffer;
++ u8 channel_idx;
++ s8 group_cnt; //For WiDi 3.5, they specified another scan algo. for WFD/RDS co-existed
++ u8 sa_ext[L2SDTA_SERVICE_VE_LEN];
++
++ u8 widi_enable;
++ /**
++ * For WiDi 4; upper layer would set
++ * p2p_primary_device_type_category_id
++ * p2p_primary_device_type_sub_category_id
++ * p2p_secondary_device_type_category_id
++ * p2p_secondary_device_type_sub_category_id
++ */
++ u16 p2p_pdt_cid;
++ u16 p2p_pdt_scid;
++ u8 num_p2p_sdt;
++ u16 p2p_sdt_cid[MAX_NUM_P2P_SDT];
++ u16 p2p_sdt_scid[MAX_NUM_P2P_SDT];
++ u8 p2p_reject_disable; //When starting NL80211 wpa_supplicant/hostapd, it will call netdev_close
++ //such that it will cause p2p disabled. Use this flag to reject.
++#endif // CONFIG_INTEL_WIDI
++
++#ifdef CONFIG_CONCURRENT_MODE
++ u8 scanning_via_buddy_intf;
++#endif
++};
++
++#ifdef CONFIG_AP_MODE
++
++struct hostapd_priv
++{
++ _adapter *padapter;
++
++#ifdef CONFIG_HOSTAPD_MLME
++ struct net_device *pmgnt_netdev;
++ struct usb_anchor anchored;
++#endif
++
++};
++
++extern int hostapd_mode_init(_adapter *padapter);
++extern void hostapd_mode_unload(_adapter *padapter);
++#endif
++
++
++extern void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf);
++extern void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf);
++extern void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf);
++extern void rtw_joinbss_event_callback(_adapter *adapter, u8 *pbuf);
++extern void rtw_stassoc_event_callback(_adapter *adapter, u8 *pbuf);
++extern void rtw_stadel_event_callback(_adapter *adapter, u8 *pbuf);
++extern void rtw_atimdone_event_callback(_adapter *adapter, u8 *pbuf);
++extern void rtw_cpwm_event_callback(_adapter *adapter, u8 *pbuf);
++
++#ifdef PLATFORM_WINDOWS
++extern thread_return event_thread(void *context);
++
++extern void rtw_join_timeout_handler (
++ IN PVOID SystemSpecific1,
++ IN PVOID FunctionContext,
++ IN PVOID SystemSpecific2,
++ IN PVOID SystemSpecific3
++ );
++
++extern void _rtw_scan_timeout_handler (
++ IN PVOID SystemSpecific1,
++ IN PVOID FunctionContext,
++ IN PVOID SystemSpecific2,
++ IN PVOID SystemSpecific3
++ );
++
++#endif
++
++#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
++extern int event_thread(void *context);
++extern void rtw_join_timeout_handler(void* FunctionContext);
++extern void _rtw_scan_timeout_handler(void* FunctionContext);
++#endif
++
++extern void rtw_free_network_queue(_adapter *adapter,u8 isfreeall);
++extern int rtw_init_mlme_priv(_adapter *adapter);// (struct mlme_priv *pmlmepriv);
++
++extern void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv);
++
++
++extern sint rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv);
++extern sint rtw_set_key(_adapter *adapter,struct security_priv *psecuritypriv,sint keyid, u8 set_tx);
++extern sint rtw_set_auth(_adapter *adapter,struct security_priv *psecuritypriv);
++
++__inline static u8 *get_bssid(struct mlme_priv *pmlmepriv)
++{ //if sta_mode:pmlmepriv->cur_network.network.MacAddress=> bssid
++ // if adhoc_mode:pmlmepriv->cur_network.network.MacAddress=> ibss mac address
++ return pmlmepriv->cur_network.network.MacAddress;
++}
++
++__inline static sint check_fwstate(struct mlme_priv *pmlmepriv, sint state)
++{
++ if (pmlmepriv->fw_state & state)
++ return _TRUE;
++
++ return _FALSE;
++}
++
++__inline static sint get_fwstate(struct mlme_priv *pmlmepriv)
++{
++ return pmlmepriv->fw_state;
++}
++
++/*
++ * No Limit on the calling context,
++ * therefore set it to be the critical section...
++ *
++ * ### NOTE:#### (!!!!)
++ * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
++ */
++__inline static void set_fwstate(struct mlme_priv *pmlmepriv, sint state)
++{
++ pmlmepriv->fw_state |= state;
++}
++
++__inline static void _clr_fwstate_(struct mlme_priv *pmlmepriv, sint state)
++{
++ pmlmepriv->fw_state &= ~state;
++}
++
++/*
++ * No Limit on the calling context,
++ * therefore set it to be the critical section...
++ */
++__inline static void clr_fwstate(struct mlme_priv *pmlmepriv, sint state)
++{
++ _irqL irqL;
++
++ _enter_critical_bh(&pmlmepriv->lock, &irqL);
++ if (check_fwstate(pmlmepriv, state) == _TRUE)
++ pmlmepriv->fw_state ^= state;
++ _exit_critical_bh(&pmlmepriv->lock, &irqL);
++}
++
++__inline static void clr_fwstate_ex(struct mlme_priv *pmlmepriv, sint state)
++{
++ _irqL irqL;
++
++ _enter_critical_bh(&pmlmepriv->lock, &irqL);
++ _clr_fwstate_(pmlmepriv, state);
++ _exit_critical_bh(&pmlmepriv->lock, &irqL);
++}
++
++__inline static void up_scanned_network(struct mlme_priv *pmlmepriv)
++{
++ _irqL irqL;
++
++ _enter_critical_bh(&pmlmepriv->lock, &irqL);
++ pmlmepriv->num_of_scanned++;
++ _exit_critical_bh(&pmlmepriv->lock, &irqL);
++}
++
++#ifdef CONFIG_CONCURRENT_MODE
++sint rtw_buddy_adapter_up(_adapter *padapter);
++sint check_buddy_fwstate(_adapter *padapter, sint state);
++#endif //CONFIG_CONCURRENT_MODE
++
++__inline static void down_scanned_network(struct mlme_priv *pmlmepriv)
++{
++ _irqL irqL;
++
++ _enter_critical_bh(&pmlmepriv->lock, &irqL);
++ pmlmepriv->num_of_scanned--;
++ _exit_critical_bh(&pmlmepriv->lock, &irqL);
++}
++
++__inline static void set_scanned_network_val(struct mlme_priv *pmlmepriv, sint val)
++{
++ _irqL irqL;
++
++ _enter_critical_bh(&pmlmepriv->lock, &irqL);
++ pmlmepriv->num_of_scanned = val;
++ _exit_critical_bh(&pmlmepriv->lock, &irqL);
++}
++
++extern u16 rtw_get_capability(WLAN_BSSID_EX *bss);
++extern void rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target);
++extern void rtw_disconnect_hdl_under_linked(_adapter* adapter, struct sta_info *psta, u8 free_assoc);
++extern void rtw_generate_random_ibss(u8 *pibss);
++extern struct wlan_network* rtw_find_network(_queue *scanned_queue, u8 *addr);
++extern struct wlan_network* rtw_get_oldest_wlan_network(_queue *scanned_queue);
++
++extern void rtw_free_assoc_resources(_adapter* adapter, int lock_scanned_queue);
++extern void rtw_indicate_disconnect(_adapter* adapter);
++extern void rtw_indicate_connect(_adapter* adapter);
++void rtw_indicate_scan_done( _adapter *padapter, bool aborted);
++void rtw_scan_abort(_adapter *adapter);
++
++extern int rtw_restruct_sec_ie(_adapter *adapter,u8 *in_ie,u8 *out_ie,uint in_len);
++extern int rtw_restruct_wmm_ie(_adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_len, uint initial_out_len);
++extern void rtw_init_registrypriv_dev_network(_adapter *adapter);
++
++extern void rtw_update_registrypriv_dev_network(_adapter *adapter);
++
++extern void rtw_get_encrypt_decrypt_from_registrypriv(_adapter *adapter);
++
++extern void _rtw_join_timeout_handler(_adapter *adapter);
++extern void rtw_scan_timeout_handler(_adapter *adapter);
++
++extern void rtw_dynamic_check_timer_handlder(_adapter *adapter);
++#ifdef CONFIG_SET_SCAN_DENY_TIMER
++bool rtw_is_scan_deny(_adapter *adapter);
++void rtw_clear_scan_deny(_adapter *adapter);
++void rtw_set_scan_deny_timer_hdl(_adapter *adapter);
++void rtw_set_scan_deny(_adapter *adapter, u32 ms);
++#else
++#define rtw_is_scan_deny(adapter) _FALSE
++#define rtw_clear_scan_deny(adapter) do {} while (0)
++#define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)
++#define rtw_set_scan_deny(adapter, ms) do {} while (0)
++#endif
++
++
++extern int _rtw_init_mlme_priv(_adapter *padapter);
++
++void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
++
++extern void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv);
++
++extern int _rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork);
++
++extern struct wlan_network* _rtw_dequeue_network(_queue *queue);
++
++extern struct wlan_network* _rtw_alloc_network(struct mlme_priv *pmlmepriv);
++
++
++extern void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 isfreeall);
++extern void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork);
++
++
++extern struct wlan_network* _rtw_find_network(_queue *scanned_queue, u8 *addr);
++
++extern void _rtw_free_network_queue(_adapter* padapter, u8 isfreeall);
++
++extern sint rtw_if_up(_adapter *padapter);
++
++
++u8 *rtw_get_capability_from_ie(u8 *ie);
++u8 *rtw_get_timestampe_from_ie(u8 *ie);
++u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
++
++
++void rtw_joinbss_reset(_adapter *padapter);
++
++#ifdef CONFIG_80211N_HT
++unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len, u8 channel);
++void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel);
++void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe);
++#endif
++
++int rtw_is_same_ibss(_adapter *adapter, struct wlan_network *pnetwork);
++int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst);
++
++#ifdef CONFIG_LAYER2_ROAMING
++void _rtw_roaming(_adapter *adapter, struct wlan_network *tgt_network);
++void rtw_roaming(_adapter *adapter, struct wlan_network *tgt_network);
++void rtw_set_roaming(_adapter *adapter, u8 to_roaming);
++u8 rtw_to_roaming(_adapter *adapter);
++#else
++#define _rtw_roaming(adapter, tgt_network) do {} while(0)
++#define rtw_roaming(adapter, tgt_network) do {} while(0)
++#define rtw_set_roaming(adapter, to_roaming) do {} while(0)
++#define rtw_to_roaming(adapter) 0
++#endif
++
++
++#ifdef CONFIG_INTEL_PROXIM
++void rtw_proxim_enable(_adapter *padapter);
++void rtw_proxim_disable(_adapter *padapter);
++void rtw_proxim_send_packet(_adapter *padapter,u8 *pbuf,u16 len,u8 hw_rate);
++#endif //CONFIG_INTEL_PROXIM
++#endif //__RTL871X_MLME_H_
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,962 @@
+/******************************************************************************
+ *
@@ -184933,856 +194407,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mlme_ext.h linu
+#endif//_RTL8192C_CMD_C_
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mlme.h 2015-07-28 01:20:58.321597318 +0200
-@@ -0,0 +1,843 @@
-+/******************************************************************************
-+ *
-+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of version 2 of the GNU General Public License as
-+ * published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope that it will be useful, but WITHOUT
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-+ * more details.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
-+ *
-+ *
-+ ******************************************************************************/
-+#ifndef __RTW_MLME_H_
-+#define __RTW_MLME_H_
-+
-+#include <drv_conf.h>
-+#include <osdep_service.h>
-+#include <mlme_osdep.h>
-+#include <drv_types.h>
-+#include <wlan_bssdef.h>
-+
-+#ifdef CONFIG_INTEL_WIDI
-+#include <rtw_intel_widi.h>
-+#endif
-+
-+#define MAX_BSS_CNT 128
-+//#define MAX_JOIN_TIMEOUT 2000
-+//#define MAX_JOIN_TIMEOUT 2500
-+#define MAX_JOIN_TIMEOUT 6500
-+
-+// Commented by Albert 20101105
-+// Increase the scanning timeout because of increasing the SURVEY_TO value.
-+
-+#define SCANNING_TIMEOUT 8000
-+
-+#define SCAN_INTERVAL (30) // unit:2sec, 30*2=60sec
-+
-+#ifdef PALTFORM_OS_WINCE
-+#define SCANQUEUE_LIFETIME 12000000 // unit:us
-+#else
-+#define SCANQUEUE_LIFETIME 20 // unit:sec
-+#endif
-+
-+#define WIFI_NULL_STATE 0x00000000
-+
-+#define WIFI_ASOC_STATE 0x00000001 // Under Linked state...
-+#define WIFI_REASOC_STATE 0x00000002
-+#define WIFI_SLEEP_STATE 0x00000004
-+#define WIFI_STATION_STATE 0x00000008
-+
-+#define WIFI_AP_STATE 0x00000010
-+#define WIFI_ADHOC_STATE 0x00000020
-+#define WIFI_ADHOC_MASTER_STATE 0x00000040
-+#define WIFI_UNDER_LINKING 0x00000080
-+
-+#define WIFI_UNDER_WPS 0x00000100
-+//#define WIFI_UNDER_CMD 0x00000200
-+//#define WIFI_UNDER_P2P 0x00000400
-+#define WIFI_STA_ALIVE_CHK_STATE 0x00000400
-+#define WIFI_SITE_MONITOR 0x00000800 //to indicate the station is under site surveying
-+
-+#ifdef WDS
-+#define WIFI_WDS 0x00001000
-+#define WIFI_WDS_RX_BEACON 0x00002000 // already rx WDS AP beacon
-+#endif
-+#ifdef AUTO_CONFIG
-+#define WIFI_AUTOCONF 0x00004000
-+#define WIFI_AUTOCONF_IND 0x00008000
-+#endif
-+
-+/*
-+// ========== P2P Section Start ===============
-+#define WIFI_P2P_LISTEN_STATE 0x00010000
-+#define WIFI_P2P_GROUP_FORMATION_STATE 0x00020000
-+// ========== P2P Section End ===============
-+*/
-+
-+//#ifdef UNDER_MPTEST
-+#define WIFI_MP_STATE 0x00010000
-+#define WIFI_MP_CTX_BACKGROUND 0x00020000 // in continous tx background
-+#define WIFI_MP_CTX_ST 0x00040000 // in continous tx with single-tone
-+#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 // pending in continous tx background due to out of skb
-+#define WIFI_MP_CTX_CCK_HW 0x00100000 // in continous tx
-+#define WIFI_MP_CTX_CCK_CS 0x00200000 // in continous tx with carrier suppression
-+#define WIFI_MP_LPBK_STATE 0x00400000
-+//#endif
-+
-+//#define _FW_UNDER_CMD WIFI_UNDER_CMD
-+#define _FW_UNDER_LINKING WIFI_UNDER_LINKING
-+#define _FW_LINKED WIFI_ASOC_STATE
-+#define _FW_UNDER_SURVEY WIFI_SITE_MONITOR
-+
-+
-+enum dot11AuthAlgrthmNum {
-+ dot11AuthAlgrthm_Open = 0,
-+ dot11AuthAlgrthm_Shared,
-+ dot11AuthAlgrthm_8021X,
-+ dot11AuthAlgrthm_Auto,
-+ dot11AuthAlgrthm_MaxNum
-+};
-+
-+// Scan type including active and passive scan.
-+typedef enum _RT_SCAN_TYPE
-+{
-+ SCAN_PASSIVE,
-+ SCAN_ACTIVE,
-+ SCAN_MIX,
-+}RT_SCAN_TYPE, *PRT_SCAN_TYPE;
-+
-+enum DriverInterface {
-+ DRIVER_WEXT = 1,
-+ DRIVER_CFG80211 = 2
-+};
-+
-+enum _BAND
-+{
-+ GHZ24_50 = 0,
-+ GHZ_50,
-+ GHZ_24,
-+ GHZ_MAX,
-+};
-+
-+#define rtw_band_valid(band) ((band) >= GHZ24_50 && (band) < GHZ_MAX)
-+
-+enum SCAN_RESULT_TYPE
-+{
-+ SCAN_RESULT_P2P_ONLY = 0, // Will return all the P2P devices.
-+ SCAN_RESULT_ALL = 1, // Will return all the scanned device, include AP.
-+ SCAN_RESULT_WFD_TYPE = 2 // Will just return the correct WFD device.
-+ // If this device is Miracast sink device, it will just return all the Miracast source devices.
-+};
-+
-+/*
-+
-+there are several "locks" in mlme_priv,
-+since mlme_priv is a shared resource between many threads,
-+like ISR/Call-Back functions, the OID handlers, and even timer functions.
-+
-+
-+Each _queue has its own locks, already.
-+Other items are protected by mlme_priv.lock.
-+
-+To avoid possible dead lock, any thread trying to modifiying mlme_priv
-+SHALL not lock up more than one locks at a time!
-+
-+*/
-+
-+
-+#define traffic_threshold 10
-+#define traffic_scan_period 500
-+
-+struct sitesurvey_ctrl {
-+ u64 last_tx_pkts;
-+ uint last_rx_pkts;
-+ sint traffic_busy;
-+ _timer sitesurvey_ctrl_timer;
-+};
-+
-+typedef struct _RT_LINK_DETECT_T{
-+ u32 NumTxOkInPeriod;
-+ u32 NumRxOkInPeriod;
-+ u32 NumRxUnicastOkInPeriod;
-+ BOOLEAN bBusyTraffic;
-+ BOOLEAN bTxBusyTraffic;
-+ BOOLEAN bRxBusyTraffic;
-+ BOOLEAN bHigherBusyTraffic; // For interrupt migration purpose.
-+ BOOLEAN bHigherBusyRxTraffic; // We may disable Tx interrupt according as Rx traffic.
-+ BOOLEAN bHigherBusyTxTraffic; // We may disable Tx interrupt according as Tx traffic.
-+}RT_LINK_DETECT_T, *PRT_LINK_DETECT_T;
-+
-+struct profile_info {
-+ u8 ssidlen;
-+ u8 ssid[ WLAN_SSID_MAXLEN ];
-+ u8 peermac[ ETH_ALEN ];
-+};
-+
-+struct tx_invite_req_info{
-+ u8 token;
-+ u8 benable;
-+ u8 go_ssid[ WLAN_SSID_MAXLEN ];
-+ u8 ssidlen;
-+ u8 go_bssid[ ETH_ALEN ];
-+ u8 peer_macaddr[ ETH_ALEN ];
-+ u8 operating_ch; // This information will be set by using the p2p_set op_ch=x
-+ u8 peer_ch; // The listen channel for peer P2P device
-+
-+};
-+
-+struct tx_invite_resp_info{
-+ u8 token; // Used to record the dialog token of p2p invitation request frame.
-+};
-+
-+#ifdef CONFIG_WFD
-+
-+struct wifi_display_info{
-+ u16 wfd_enable; // Eanble/Disable the WFD function.
-+ u16 rtsp_ctrlport; // TCP port number at which the this WFD device listens for RTSP messages
-+ u16 peer_rtsp_ctrlport; // TCP port number at which the peer WFD device listens for RTSP messages
-+ // This filed should be filled when receiving the gropu negotiation request
-+
-+ u8 peer_session_avail; // WFD session is available or not for the peer wfd device.
-+ // This variable will be set when sending the provisioning discovery request to peer WFD device.
-+ // And this variable will be reset when it is read by using the iwpriv p2p_get wfd_sa command.
-+
-+ u8 ip_address[4];
-+ u8 peer_ip_address[4];
-+ u8 wfd_pc; // WFD preferred connection
-+ // 0 -> Prefer to use the P2P for WFD connection on peer side.
-+ // 1 -> Prefer to use the TDLS for WFD connection on peer side.
-+
-+ u8 wfd_device_type; // WFD Device Type
-+ // 0 -> WFD Source Device
-+ // 1 -> WFD Primary Sink Device
-+ enum SCAN_RESULT_TYPE scan_result_type; // Used when P2P is enable. This parameter will impact the scan result.
-+};
-+#endif //CONFIG_WFD
-+
-+struct tx_provdisc_req_info{
-+ u16 wps_config_method_request; // Used when sending the provisioning request frame
-+ u16 peer_channel_num[2]; // The channel number which the receiver stands.
-+ NDIS_802_11_SSID ssid;
-+ u8 peerDevAddr[ ETH_ALEN ]; // Peer device address
-+ u8 peerIFAddr[ ETH_ALEN ]; // Peer interface address
-+ u8 benable; // This provision discovery request frame is trigger to send or not
-+};
-+
-+struct rx_provdisc_req_info{ //When peer device issue prov_disc_req first, we should store the following informations
-+ u8 peerDevAddr[ ETH_ALEN ]; // Peer device address
-+ u8 strconfig_method_desc_of_prov_disc_req[4]; // description for the config method located in the provisioning discovery request frame.
-+ // The UI must know this information to know which config method the remote p2p device is requiring.
-+};
-+
-+struct tx_nego_req_info{
-+ u16 peer_channel_num[2]; // The channel number which the receiver stands.
-+ u8 peerDevAddr[ ETH_ALEN ]; // Peer device address
-+ u8 benable; // This negoitation request frame is trigger to send or not
-+};
-+
-+struct group_id_info{
-+ u8 go_device_addr[ ETH_ALEN ]; // The GO's device address of this P2P group
-+ u8 ssid[ WLAN_SSID_MAXLEN ]; // The SSID of this P2P group
-+};
-+
-+struct scan_limit_info{
-+ u8 scan_op_ch_only; // When this flag is set, the driver should just scan the operation channel
-+#ifndef P2P_OP_CHECK_SOCIAL_CH
-+ u8 operation_ch[2]; // Store the operation channel of invitation request frame
-+#else
-+ u8 operation_ch[5]; // Store additional channel 1,6,11 for Android 4.2 IOT & Nexus 4
-+#endif //P2P_OP_CHECK_SOCIAL_CH
-+};
-+
-+#ifdef CONFIG_IOCTL_CFG80211
-+struct cfg80211_wifidirect_info{
-+ _timer remain_on_ch_timer;
-+ u8 restore_channel;
-+ struct ieee80211_channel remain_on_ch_channel;
-+ enum nl80211_channel_type remain_on_ch_type;
-+ u64 remain_on_ch_cookie;
-+ bool is_ro_ch;
-+};
-+#endif //CONFIG_IOCTL_CFG80211
-+
-+struct wifidirect_info{
-+ _adapter* padapter;
-+ _timer find_phase_timer;
-+ _timer restore_p2p_state_timer;
-+
-+ // Used to do the scanning. After confirming the peer is availalble, the driver transmits the P2P frame to peer.
-+ _timer pre_tx_scan_timer;
-+ _timer reset_ch_sitesurvey;
-+ _timer reset_ch_sitesurvey2; // Just for resetting the scan limit function by using p2p nego
-+#ifdef CONFIG_CONCURRENT_MODE
-+ // Used to switch the channel between legacy AP and listen state.
-+ _timer ap_p2p_switch_timer;
-+#endif
-+ struct tx_provdisc_req_info tx_prov_disc_info;
-+ struct rx_provdisc_req_info rx_prov_disc_info;
-+ struct tx_invite_req_info invitereq_info;
-+ struct profile_info profileinfo[ P2P_MAX_PERSISTENT_GROUP_NUM ]; // Store the profile information of persistent group
-+ struct tx_invite_resp_info inviteresp_info;
-+ struct tx_nego_req_info nego_req_info;
-+ struct group_id_info groupid_info; // Store the group id information when doing the group negotiation handshake.
-+ struct scan_limit_info rx_invitereq_info; // Used for get the limit scan channel from the Invitation procedure
-+ struct scan_limit_info p2p_info; // Used for get the limit scan channel from the P2P negotiation handshake
-+#ifdef CONFIG_WFD
-+ struct wifi_display_info *wfd_info;
-+#endif
-+ enum P2P_ROLE role;
-+ enum P2P_STATE pre_p2p_state;
-+ enum P2P_STATE p2p_state;
-+ u8 device_addr[ETH_ALEN]; // The device address should be the mac address of this device.
-+ u8 interface_addr[ETH_ALEN];
-+ u8 social_chan[4];
-+ u8 listen_channel;
-+ u8 operating_channel;
-+ u8 listen_dwell; // This value should be between 1 and 3
-+ u8 support_rate[8];
-+ u8 p2p_wildcard_ssid[P2P_WILDCARD_SSID_LEN];
-+ u8 intent; // should only include the intent value.
-+ u8 p2p_peer_interface_addr[ ETH_ALEN ];
-+ u8 p2p_peer_device_addr[ ETH_ALEN ];
-+ u8 peer_intent; // Included the intent value and tie breaker value.
-+ u8 device_name[ WPS_MAX_DEVICE_NAME_LEN ]; // Device name for displaying on searching device screen
-+ u8 device_name_len;
-+ u8 profileindex; // Used to point to the index of profileinfo array
-+ u8 peer_operating_ch;
-+ u8 find_phase_state_exchange_cnt;
-+ u16 device_password_id_for_nego; // The device password ID for group negotation
-+ u8 negotiation_dialog_token;
-+ u8 nego_ssid[ WLAN_SSID_MAXLEN ]; // SSID information for group negotitation
-+ u8 nego_ssidlen;
-+ u8 p2p_group_ssid[WLAN_SSID_MAXLEN];
-+ u8 p2p_group_ssid_len;
-+ u8 persistent_supported; // Flag to know the persistent function should be supported or not.
-+ // In the Sigma test, the Sigma will provide this enable from the sta_set_p2p CAPI.
-+ // 0: disable
-+ // 1: enable
-+ u8 session_available; // Flag to set the WFD session available to enable or disable "by Sigma"
-+ // In the Sigma test, the Sigma will disable the session available by using the sta_preset CAPI.
-+ // 0: disable
-+ // 1: enable
-+ u8 wfd_tdls_enable; // Flag to enable or disable the TDLS by WFD Sigma
-+ // 0: disable
-+ // 1: enable
-+ u8 wfd_tdls_weaksec; // Flag to enable or disable the weak security function for TDLS by WFD Sigma
-+ // 0: disable
-+ // In this case, the driver can't issue the tdsl setup request frame.
-+ // 1: enable
-+ // In this case, the driver can issue the tdls setup request frame
-+ // even the current security is weak security.
-+
-+ enum P2P_WPSINFO ui_got_wps_info; // This field will store the WPS value (PIN value or PBC) that UI had got from the user.
-+ u16 supported_wps_cm; // This field describes the WPS config method which this driver supported.
-+ // The value should be the combination of config method defined in page104 of WPS v2.0 spec.
-+ u8 external_uuid; // UUID flag
-+ u8 uuid[16]; // UUID
-+ uint channel_list_attr_len; // This field will contain the length of body of P2P Channel List attribute of group negotitation response frame.
-+ u8 channel_list_attr[100]; // This field will contain the body of P2P Channel List attribute of group negotitation response frame.
-+ // We will use the channel_cnt and channel_list fields when constructing the group negotitation confirm frame.
-+ u8 driver_interface; // Indicate DRIVER_WEXT or DRIVER_CFG80211
-+
-+#ifdef CONFIG_CONCURRENT_MODE
-+ u16 ext_listen_interval; // The interval to be available with legacy AP (ms)
-+ u16 ext_listen_period; // The time period to be available for P2P listen state (ms)
-+#endif
-+#ifdef CONFIG_P2P_PS
-+ enum P2P_PS_MODE p2p_ps_mode; // indicate p2p ps mode
-+ enum P2P_PS_STATE p2p_ps_state; // indicate p2p ps state
-+ u8 noa_index; // Identifies and instance of Notice of Absence timing.
-+ u8 ctwindow; // Client traffic window. A period of time in TU after TBTT.
-+ u8 opp_ps; // opportunistic power save.
-+ u8 noa_num; // number of NoA descriptor in P2P IE.
-+ u8 noa_count[P2P_MAX_NOA_NUM]; // Count for owner, Type of client.
-+ u32 noa_duration[P2P_MAX_NOA_NUM]; // Max duration for owner, preferred or min acceptable duration for client.
-+ u32 noa_interval[P2P_MAX_NOA_NUM]; // Length of interval for owner, preferred or max acceptable interval of client.
-+ u32 noa_start_time[P2P_MAX_NOA_NUM]; // schedule expressed in terms of the lower 4 bytes of the TSF timer.
-+#endif // CONFIG_P2P_PS
-+};
-+
-+struct tdls_ss_record{ //signal strength record; recording the tdls sta with lowerest ss
-+ u8 macaddr[ETH_ALEN];
-+ u8 RxPWDBAll;
-+ u8 is_tdls_sta; // _TRUE: direct link sta, _FALSE: else
-+};
-+
-+struct tdls_info{
-+ u8 ap_prohibited;
-+ uint setup_state;
-+ u8 sta_cnt;
-+ u8 sta_maximum; // 1:tdls sta is equal (NUM_STA-1), reach max direct link number; 0: else;
-+ struct tdls_ss_record ss_record;
-+ u8 macid_index; //macid entry that is ready to write
-+ u8 clear_cam; //cam entry that is trying to clear, using it in direct link teardown
-+ u8 ch_sensing;
-+ u8 cur_channel;
-+ u8 candidate_ch;
-+ u8 collect_pkt_num[MAX_CHANNEL_NUM];
-+ _lock cmd_lock;
-+ _lock hdl_lock;
-+ u8 watchdog_count;
-+ u8 dev_discovered; //WFD_TDLS: for sigma test
-+ u8 enable;
-+#ifdef CONFIG_WFD
-+ struct wifi_display_info *wfd_info;
-+#endif
-+};
-+
-+struct mlme_priv {
-+
-+ _lock lock;
-+ sint fw_state; //shall we protect this variable? maybe not necessarily...
-+
-+ u8 to_join; //flag
-+ #ifdef CONFIG_LAYER2_ROAMING
-+ u8 to_roaming; // roaming trying times
-+ #endif
-+
-+ u8 *nic_hdl;
-+
-+ u8 not_indic_disco;
-+ _list *pscanned;
-+ _queue free_bss_pool;
-+ _queue scanned_queue;
-+ u8 *free_bss_buf;
-+ u32 num_of_scanned;
-+
-+ NDIS_802_11_SSID assoc_ssid;
-+ u8 assoc_bssid[6];
-+
-+ struct wlan_network cur_network;
-+
-+ //uint wireless_mode; no used, remove it
-+
-+ u32 scan_interval;
-+
-+ _timer assoc_timer;
-+
-+ uint assoc_by_bssid;
-+ uint assoc_by_rssi;
-+
-+ _timer scan_to_timer; // driver itself handles scan_timeout status.
-+ u32 scan_start_time; // used to evaluate the time spent in scanning
-+
-+ #ifdef CONFIG_SET_SCAN_DENY_TIMER
-+ _timer set_scan_deny_timer;
-+ ATOMIC_T set_scan_deny; //0: allowed, 1: deny
-+ #endif
-+
-+ struct qos_priv qospriv;
-+
-+#ifdef CONFIG_80211N_HT
-+
-+ /* Number of non-HT AP/stations */
-+ int num_sta_no_ht;
-+
-+ /* Number of HT AP/stations 20 MHz */
-+ //int num_sta_ht_20mhz;
-+
-+
-+ int num_FortyMHzIntolerant;
-+
-+ struct ht_priv htpriv;
-+
-+#endif
-+
-+ RT_LINK_DETECT_T LinkDetectInfo;
-+ _timer dynamic_chk_timer; //dynamic/periodic check timer
-+
-+ u8 acm_mask; // for wmm acm mask
-+ u8 ChannelPlan;
-+ RT_SCAN_TYPE scan_mode; // active: 1, passive: 0
-+
-+ //u8 probereq_wpsie[MAX_WPS_IE_LEN];//added in probe req
-+ //int probereq_wpsie_len;
-+ u8 *wps_probe_req_ie;
-+ u32 wps_probe_req_ie_len;
-+
-+#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-+ /* Number of associated Non-ERP stations (i.e., stations using 802.11b
-+ * in 802.11g BSS) */
-+ int num_sta_non_erp;
-+
-+ /* Number of associated stations that do not support Short Slot Time */
-+ int num_sta_no_short_slot_time;
-+
-+ /* Number of associated stations that do not support Short Preamble */
-+ int num_sta_no_short_preamble;
-+
-+ int olbc; /* Overlapping Legacy BSS Condition */
-+
-+ /* Number of HT associated stations that do not support greenfield */
-+ int num_sta_ht_no_gf;
-+
-+ /* Number of associated non-HT stations */
-+ //int num_sta_no_ht;
-+
-+ /* Number of HT associated stations 20 MHz */
-+ int num_sta_ht_20mhz;
-+
-+ /* Overlapping BSS information */
-+ int olbc_ht;
-+
-+#ifdef CONFIG_80211N_HT
-+ u16 ht_op_mode;
-+#endif /* CONFIG_80211N_HT */
-+
-+ u8 *assoc_req;
-+ u32 assoc_req_len;
-+ u8 *assoc_rsp;
-+ u32 assoc_rsp_len;
-+
-+ u8 *wps_beacon_ie;
-+ //u8 *wps_probe_req_ie;
-+ u8 *wps_probe_resp_ie;
-+ u8 *wps_assoc_resp_ie; // for CONFIG_IOCTL_CFG80211, this IE could include p2p ie / wfd ie
-+
-+ u32 wps_beacon_ie_len;
-+ //u32 wps_probe_req_ie_len;
-+ u32 wps_probe_resp_ie_len;
-+ u32 wps_assoc_resp_ie_len; // for CONFIG_IOCTL_CFG80211, this IE len could include p2p ie / wfd ie
-+
-+ u8 *p2p_beacon_ie;
-+ u8 *p2p_probe_req_ie;
-+ u8 *p2p_probe_resp_ie;
-+ u8 *p2p_go_probe_resp_ie; //for GO
-+ u8 *p2p_assoc_req_ie;
-+
-+ u32 p2p_beacon_ie_len;
-+ u32 p2p_probe_req_ie_len;
-+ u32 p2p_probe_resp_ie_len;
-+ u32 p2p_go_probe_resp_ie_len; //for GO
-+ u32 p2p_assoc_req_ie_len;
-+/*
-+#if defined(CONFIG_P2P) && defined(CONFIG_IOCTL_CFG80211)
-+ //u8 *wps_p2p_beacon_ie;
-+ u8 *p2p_beacon_ie;
-+ u8 *wps_p2p_probe_resp_ie;
-+ u8 *wps_p2p_assoc_resp_ie;
-+ //u32 wps_p2p_beacon_ie_len;
-+ u32 p2p_beacon_ie_len;
-+ u32 wps_p2p_probe_resp_ie_len;
-+ u32 wps_p2p_assoc_resp_ie_len;
-+#endif
-+*/
-+
-+ _lock bcn_update_lock;
-+ u8 update_bcn;
-+
-+
-+#endif //#if defined (CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME)
-+
-+#if defined(CONFIG_WFD) && defined(CONFIG_IOCTL_CFG80211)
-+
-+ u8 *wfd_beacon_ie;
-+ u8 *wfd_probe_req_ie;
-+ u8 *wfd_probe_resp_ie;
-+ u8 *wfd_go_probe_resp_ie; //for GO
-+ u8 *wfd_assoc_req_ie;
-+
-+ u32 wfd_beacon_ie_len;
-+ u32 wfd_probe_req_ie_len;
-+ u32 wfd_probe_resp_ie_len;
-+ u32 wfd_go_probe_resp_ie_len; //for GO
-+ u32 wfd_assoc_req_ie_len;
-+
-+#endif
-+
-+#ifdef RTK_DMP_PLATFORM
-+ // DMP kobject_hotplug function signal need in passive level
-+ _workitem Linkup_workitem;
-+ _workitem Linkdown_workitem;
-+#endif
-+
-+#ifdef CONFIG_INTEL_WIDI
-+ int widi_state;
-+ int listen_state;
-+ _timer listen_timer;
-+ ATOMIC_T rx_probe_rsp; // 1:receive probe respone from RDS source.
-+ u8 *l2sdTaBuffer;
-+ u8 channel_idx;
-+ s8 group_cnt; //For WiDi 3.5, they specified another scan algo. for WFD/RDS co-existed
-+ u8 sa_ext[L2SDTA_SERVICE_VE_LEN];
-+
-+ u8 widi_enable;
-+ /**
-+ * For WiDi 4; upper layer would set
-+ * p2p_primary_device_type_category_id
-+ * p2p_primary_device_type_sub_category_id
-+ * p2p_secondary_device_type_category_id
-+ * p2p_secondary_device_type_sub_category_id
-+ */
-+ u16 p2p_pdt_cid;
-+ u16 p2p_pdt_scid;
-+ u8 num_p2p_sdt;
-+ u16 p2p_sdt_cid[MAX_NUM_P2P_SDT];
-+ u16 p2p_sdt_scid[MAX_NUM_P2P_SDT];
-+ u8 p2p_reject_disable; //When starting NL80211 wpa_supplicant/hostapd, it will call netdev_close
-+ //such that it will cause p2p disabled. Use this flag to reject.
-+#endif // CONFIG_INTEL_WIDI
-+
-+#ifdef CONFIG_CONCURRENT_MODE
-+ u8 scanning_via_buddy_intf;
-+#endif
-+};
-+
-+#ifdef CONFIG_AP_MODE
-+
-+struct hostapd_priv
-+{
-+ _adapter *padapter;
-+
-+#ifdef CONFIG_HOSTAPD_MLME
-+ struct net_device *pmgnt_netdev;
-+ struct usb_anchor anchored;
-+#endif
-+
-+};
-+
-+extern int hostapd_mode_init(_adapter *padapter);
-+extern void hostapd_mode_unload(_adapter *padapter);
-+#endif
-+
-+
-+extern void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf);
-+extern void rtw_survey_event_callback(_adapter *adapter, u8 *pbuf);
-+extern void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf);
-+extern void rtw_joinbss_event_callback(_adapter *adapter, u8 *pbuf);
-+extern void rtw_stassoc_event_callback(_adapter *adapter, u8 *pbuf);
-+extern void rtw_stadel_event_callback(_adapter *adapter, u8 *pbuf);
-+extern void rtw_atimdone_event_callback(_adapter *adapter, u8 *pbuf);
-+extern void rtw_cpwm_event_callback(_adapter *adapter, u8 *pbuf);
-+
-+#ifdef PLATFORM_WINDOWS
-+extern thread_return event_thread(void *context);
-+
-+extern void rtw_join_timeout_handler (
-+ IN PVOID SystemSpecific1,
-+ IN PVOID FunctionContext,
-+ IN PVOID SystemSpecific2,
-+ IN PVOID SystemSpecific3
-+ );
-+
-+extern void _rtw_scan_timeout_handler (
-+ IN PVOID SystemSpecific1,
-+ IN PVOID FunctionContext,
-+ IN PVOID SystemSpecific2,
-+ IN PVOID SystemSpecific3
-+ );
-+
-+#endif
-+
-+#if defined (PLATFORM_LINUX)|| defined (PLATFORM_FREEBSD)
-+extern int event_thread(void *context);
-+extern void rtw_join_timeout_handler(void* FunctionContext);
-+extern void _rtw_scan_timeout_handler(void* FunctionContext);
-+#endif
-+
-+extern void rtw_free_network_queue(_adapter *adapter,u8 isfreeall);
-+extern int rtw_init_mlme_priv(_adapter *adapter);// (struct mlme_priv *pmlmepriv);
-+
-+extern void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv);
-+
-+
-+extern sint rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv);
-+extern sint rtw_set_key(_adapter *adapter,struct security_priv *psecuritypriv,sint keyid, u8 set_tx);
-+extern sint rtw_set_auth(_adapter *adapter,struct security_priv *psecuritypriv);
-+
-+__inline static u8 *get_bssid(struct mlme_priv *pmlmepriv)
-+{ //if sta_mode:pmlmepriv->cur_network.network.MacAddress=> bssid
-+ // if adhoc_mode:pmlmepriv->cur_network.network.MacAddress=> ibss mac address
-+ return pmlmepriv->cur_network.network.MacAddress;
-+}
-+
-+__inline static sint check_fwstate(struct mlme_priv *pmlmepriv, sint state)
-+{
-+ if (pmlmepriv->fw_state & state)
-+ return _TRUE;
-+
-+ return _FALSE;
-+}
-+
-+__inline static sint get_fwstate(struct mlme_priv *pmlmepriv)
-+{
-+ return pmlmepriv->fw_state;
-+}
-+
-+/*
-+ * No Limit on the calling context,
-+ * therefore set it to be the critical section...
-+ *
-+ * ### NOTE:#### (!!!!)
-+ * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
-+ */
-+__inline static void set_fwstate(struct mlme_priv *pmlmepriv, sint state)
-+{
-+ pmlmepriv->fw_state |= state;
-+}
-+
-+__inline static void _clr_fwstate_(struct mlme_priv *pmlmepriv, sint state)
-+{
-+ pmlmepriv->fw_state &= ~state;
-+}
-+
-+/*
-+ * No Limit on the calling context,
-+ * therefore set it to be the critical section...
-+ */
-+__inline static void clr_fwstate(struct mlme_priv *pmlmepriv, sint state)
-+{
-+ _irqL irqL;
-+
-+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
-+ if (check_fwstate(pmlmepriv, state) == _TRUE)
-+ pmlmepriv->fw_state ^= state;
-+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
-+}
-+
-+__inline static void clr_fwstate_ex(struct mlme_priv *pmlmepriv, sint state)
-+{
-+ _irqL irqL;
-+
-+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
-+ _clr_fwstate_(pmlmepriv, state);
-+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
-+}
-+
-+__inline static void up_scanned_network(struct mlme_priv *pmlmepriv)
-+{
-+ _irqL irqL;
-+
-+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
-+ pmlmepriv->num_of_scanned++;
-+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
-+}
-+
-+#ifdef CONFIG_CONCURRENT_MODE
-+sint rtw_buddy_adapter_up(_adapter *padapter);
-+sint check_buddy_fwstate(_adapter *padapter, sint state);
-+#endif //CONFIG_CONCURRENT_MODE
-+
-+__inline static void down_scanned_network(struct mlme_priv *pmlmepriv)
-+{
-+ _irqL irqL;
-+
-+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
-+ pmlmepriv->num_of_scanned--;
-+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
-+}
-+
-+__inline static void set_scanned_network_val(struct mlme_priv *pmlmepriv, sint val)
-+{
-+ _irqL irqL;
-+
-+ _enter_critical_bh(&pmlmepriv->lock, &irqL);
-+ pmlmepriv->num_of_scanned = val;
-+ _exit_critical_bh(&pmlmepriv->lock, &irqL);
-+}
-+
-+extern u16 rtw_get_capability(WLAN_BSSID_EX *bss);
-+extern void rtw_update_scanned_network(_adapter *adapter, WLAN_BSSID_EX *target);
-+extern void rtw_disconnect_hdl_under_linked(_adapter* adapter, struct sta_info *psta, u8 free_assoc);
-+extern void rtw_generate_random_ibss(u8 *pibss);
-+extern struct wlan_network* rtw_find_network(_queue *scanned_queue, u8 *addr);
-+extern struct wlan_network* rtw_get_oldest_wlan_network(_queue *scanned_queue);
-+
-+extern void rtw_free_assoc_resources(_adapter* adapter, int lock_scanned_queue);
-+extern void rtw_indicate_disconnect(_adapter* adapter);
-+extern void rtw_indicate_connect(_adapter* adapter);
-+void rtw_indicate_scan_done( _adapter *padapter, bool aborted);
-+void rtw_scan_abort(_adapter *adapter);
-+
-+extern int rtw_restruct_sec_ie(_adapter *adapter,u8 *in_ie,u8 *out_ie,uint in_len);
-+extern int rtw_restruct_wmm_ie(_adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_len, uint initial_out_len);
-+extern void rtw_init_registrypriv_dev_network(_adapter *adapter);
-+
-+extern void rtw_update_registrypriv_dev_network(_adapter *adapter);
-+
-+extern void rtw_get_encrypt_decrypt_from_registrypriv(_adapter *adapter);
-+
-+extern void _rtw_join_timeout_handler(_adapter *adapter);
-+extern void rtw_scan_timeout_handler(_adapter *adapter);
-+
-+extern void rtw_dynamic_check_timer_handlder(_adapter *adapter);
-+#ifdef CONFIG_SET_SCAN_DENY_TIMER
-+bool rtw_is_scan_deny(_adapter *adapter);
-+void rtw_clear_scan_deny(_adapter *adapter);
-+void rtw_set_scan_deny_timer_hdl(_adapter *adapter);
-+void rtw_set_scan_deny(_adapter *adapter, u32 ms);
-+#else
-+#define rtw_is_scan_deny(adapter) _FALSE
-+#define rtw_clear_scan_deny(adapter) do {} while (0)
-+#define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)
-+#define rtw_set_scan_deny(adapter, ms) do {} while (0)
-+#endif
-+
-+
-+extern int _rtw_init_mlme_priv(_adapter *padapter);
-+
-+void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
-+
-+extern void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv);
-+
-+extern int _rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork);
-+
-+extern struct wlan_network* _rtw_dequeue_network(_queue *queue);
-+
-+extern struct wlan_network* _rtw_alloc_network(struct mlme_priv *pmlmepriv);
-+
-+
-+extern void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 isfreeall);
-+extern void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork);
-+
-+
-+extern struct wlan_network* _rtw_find_network(_queue *scanned_queue, u8 *addr);
-+
-+extern void _rtw_free_network_queue(_adapter* padapter, u8 isfreeall);
-+
-+extern sint rtw_if_up(_adapter *padapter);
-+
-+
-+u8 *rtw_get_capability_from_ie(u8 *ie);
-+u8 *rtw_get_timestampe_from_ie(u8 *ie);
-+u8 *rtw_get_beacon_interval_from_ie(u8 *ie);
-+
-+
-+void rtw_joinbss_reset(_adapter *padapter);
-+
-+#ifdef CONFIG_80211N_HT
-+unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, uint in_len, uint *pout_len, u8 channel);
-+void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel);
-+void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe);
-+#endif
-+
-+int rtw_is_same_ibss(_adapter *adapter, struct wlan_network *pnetwork);
-+int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst);
-+
-+#ifdef CONFIG_LAYER2_ROAMING
-+void _rtw_roaming(_adapter *adapter, struct wlan_network *tgt_network);
-+void rtw_roaming(_adapter *adapter, struct wlan_network *tgt_network);
-+void rtw_set_roaming(_adapter *adapter, u8 to_roaming);
-+u8 rtw_to_roaming(_adapter *adapter);
-+#else
-+#define _rtw_roaming(adapter, tgt_network) do {} while(0)
-+#define rtw_roaming(adapter, tgt_network) do {} while(0)
-+#define rtw_set_roaming(adapter, to_roaming) do {} while(0)
-+#define rtw_to_roaming(adapter) 0
-+#endif
-+
-+
-+#ifdef CONFIG_INTEL_PROXIM
-+void rtw_proxim_enable(_adapter *padapter);
-+void rtw_proxim_disable(_adapter *padapter);
-+void rtw_proxim_send_packet(_adapter *padapter,u8 *pbuf,u16 len,u8 hw_rate);
-+#endif //CONFIG_INTEL_PROXIM
-+#endif //__RTL871X_MLME_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mp.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mp.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,711 @@
+/******************************************************************************
+ *
@@ -186495,9 +195122,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp.h linux-xbia
+extern void Hal_ProSetCrystalCap (PADAPTER pAdapter , u32 CrystalCapVal);
+
+#endif //_RTW_MP_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h 2015-08-26 10:26:08.761316441 +0200
@@ -0,0 +1,595 @@
+/******************************************************************************
+ *
@@ -187094,9 +195721,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp_ioctl.h linu
+#endif /* _RTW_MP_IOCTL_C_ */
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,1096 @@
+/******************************************************************************
+ *
@@ -188194,9 +196821,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_mp_phy_regdef.h
+
+
+#endif //__INC_HAL8192SPHYREG_H
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,160 @@
+/******************************************************************************
+ *
@@ -188358,9 +196985,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_p2p.h linux-xbi
+ (wdinfo)->find_phase_state_exchange_cnt != P2P_FINDPHASE_EX_NONE)
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,362 @@
+/******************************************************************************
+ *
@@ -188724,9 +197351,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_pwrctrl.h linux
+int rtw_pm_set_lps(_adapter *padapter, u8 mode);
+
+#endif //__RTL871X_PWRCTRL_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_qos.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_qos.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_qos.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_qos.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_qos.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_qos.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_qos.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_qos.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,39 @@
+/******************************************************************************
+ *
@@ -188767,9 +197394,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_qos.h linux-xbi
+
+
+#endif //_RTL871X_QOS_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_recv.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_recv.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_recv.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_recv.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_recv.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_recv.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_recv.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_recv.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,730 @@
+/******************************************************************************
+ *
@@ -189501,9 +198128,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_recv.h linux-xb
+extern void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_rf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_rf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_rf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_rf.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_rf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_rf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_rf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_rf.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,151 @@
+/******************************************************************************
+ *
@@ -189656,9 +198283,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_rf.h linux-xbia
+
+
+#endif //_RTL8711_RF_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_security.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_security.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_security.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_security.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_security.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_security.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_security.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_security.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,446 @@
+/******************************************************************************
+ *
@@ -190106,9 +198733,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_security.h linu
+u8 rtw_handle_tkip_countermeasure(_adapter* adapter, const char *caller);
+
+#endif //__RTL871X_SECURITY_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,73 @@
+/******************************************************************************
+ *
@@ -190183,9 +198810,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_sreset.h linux-
+void sreset_reset(_adapter *padapter);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,142 @@
+/******************************************************************************
+ *
@@ -190329,14 +198956,14 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_tdls.h linux-xb
+#endif //CONFIG_TDLS
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_version.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_version.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_version.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_version.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_version.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_version.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_version.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_version.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1 @@
+#define DRIVERVERSION "v4.0.2_9000.20130911"
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,753 @@
+/******************************************************************************
+ *
@@ -191091,9 +199718,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/rtw_xmit.h linux-xb
+#include <xmit_osdep.h>
+
+#endif //_RTL871X_XMIT_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/sta_info.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/sta_info.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/sta_info.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/sta_info.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/sta_info.h linux-rpi/drivers/net/wireless/rtl8192cu/include/sta_info.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/sta_info.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/sta_info.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,431 @@
+/******************************************************************************
+ *
@@ -191526,9 +200153,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/sta_info.h linux-xb
+extern u8 rtw_access_ctrl(_adapter *padapter, u8 *mac_addr);
+
+#endif //_STA_INFO_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_hal.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_hal.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_hal.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_hal.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_hal.h linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_hal.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_hal.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_hal.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,36 @@
+/******************************************************************************
+ *
@@ -191566,9 +200193,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_hal.h linux-xbi
+#endif // CONFIG_WOWLAN_MANUAL
+#endif //CONFIG_WOWLAN
+#endif //__USB_HAL_H__
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_ops.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_ops.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_ops.h linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_ops.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,109 @@
+/******************************************************************************
+ *
@@ -191679,9 +200306,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_ops.h linux-xbi
+}
+
+#endif //__USB_OPS_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,62 @@
+/******************************************************************************
+ *
@@ -191745,9 +200372,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_ops_linux.h lin
+void usb_write_port_cancel(struct intf_hdl *pintfhdl);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_osintf.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_osintf.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_osintf.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_osintf.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_osintf.h linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_osintf.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_osintf.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_osintf.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
@@ -191786,9 +200413,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_osintf.h linux-
+
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h 2015-07-28 01:20:58.321597318 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,59 @@
+/******************************************************************************
+ *
@@ -191849,9 +200476,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/usb_vendor_req.h li
+//BOOLEAN CEusbGetDescriptorRequest(PCE_USB_DEVICE CEdevice, IN short urbLength, IN UCHAR DescriptorType, IN UCHAR Index, IN USHORT LanguageId, IN PVOID TransferBuffer, IN ULONG TransferBufferLength);
+
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/wifi.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/wifi.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/wifi.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/wifi.h 2015-07-28 01:20:58.325583098 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/wifi.h linux-rpi/drivers/net/wireless/rtl8192cu/include/wifi.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/wifi.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/wifi.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,1245 @@
+/******************************************************************************
+ *
@@ -193098,9 +201725,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/wifi.h linux-xbian-
+
+
+#endif // _WIFI_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h 2015-07-28 01:20:58.325583098 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h linux-rpi/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,702 @@
+/******************************************************************************
+ *
@@ -193804,9 +202431,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/wlan_bssdef.h linux
+
+
+#endif //#ifndef WLAN_BSSDEF_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h 2015-07-28 01:20:58.325583098 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h linux-rpi/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,94 @@
+/******************************************************************************
+ *
@@ -193902,641 +202529,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/include/xmit_osdep.h linux-
+extern void rtw_os_xmit_complete(_adapter *padapter, struct xmit_frame *pxframe);
+
+#endif //__XMIT_OSDEP_H_
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/Kconfig linux-xbian-rpi/drivers/net/wireless/rtl8192cu/Kconfig
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/Kconfig 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/Kconfig 2015-07-28 01:20:58.297682643 +0200
-@@ -0,0 +1,9 @@
-+config RTL8192CU
-+ tristate "Realtek 8192C USB WiFi"
-+ depends on MAC80211 && USB
-+ select CFG80211_WEXT
-+ select WIRELESS_EXT
-+ select WEXT_PRIV
-+ ---help---
-+ This option adds the Realtek RTL8192CU USB device such as Edimax EW-7811Un.
-+
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/Makefile linux-xbian-rpi/drivers/net/wireless/rtl8192cu/Makefile
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/Makefile 2015-07-28 01:20:58.297682643 +0200
-@@ -0,0 +1,615 @@
-+EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
-+EXTRA_CFLAGS += -O1
-+#EXTRA_CFLAGS += -O3
-+#EXTRA_CFLAGS += -Wall
-+#EXTRA_CFLAGS += -Wextra
-+#EXTRA_CFLAGS += -Werror
-+#EXTRA_CFLAGS += -pedantic
-+#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-+
-+EXTRA_CFLAGS += -Wno-unused-variable
-+EXTRA_CFLAGS += -Wno-unused-value
-+EXTRA_CFLAGS += -Wno-unused-label
-+EXTRA_CFLAGS += -Wno-unused-parameter
-+EXTRA_CFLAGS += -Wno-unused-function
-+EXTRA_CFLAGS += -Wno-unused
-+
-+EXTRA_CFLAGS += -Wno-uninitialized
-+
-+EXTRA_CFLAGS += -I$(src)/include
-+
-+CONFIG_AUTOCFG_CP = n
-+
-+CONFIG_RTL8192C = y
-+CONFIG_RTL8192D = n
-+CONFIG_RTL8723A = n
-+
-+CONFIG_USB_HCI = y
-+CONFIG_PCI_HCI = n
-+CONFIG_SDIO_HCI = n
-+
-+CONFIG_MP_INCLUDED = n
-+CONFIG_POWER_SAVING = y
-+CONFIG_USB_AUTOSUSPEND = n
-+CONFIG_HW_PWRP_DETECTION = n
-+CONFIG_WIFI_TEST = n
-+CONFIG_BT_COEXISTENCE = n
-+CONFIG_RTL8192CU_REDEFINE_1X1 = n
-+CONFIG_INTEL_WIDI = n
-+CONFIG_WAKE_ON_WLAN = n
-+
-+CONFIG_PLATFORM_I386_PC = y
-+CONFIG_PLATFORM_TI_AM3517 = n
-+CONFIG_PLATFORM_ANDROID_X86 = n
-+CONFIG_PLATFORM_JB_X86 = n
-+CONFIG_PLATFORM_ARM_S3C2K4 = n
-+CONFIG_PLATFORM_ARM_PXA2XX = n
-+CONFIG_PLATFORM_ARM_S3C6K4 = n
-+CONFIG_PLATFORM_MIPS_RMI = n
-+CONFIG_PLATFORM_RTD2880B = n
-+CONFIG_PLATFORM_MIPS_AR9132 = n
-+CONFIG_PLATFORM_RTK_DMP = n
-+CONFIG_PLATFORM_MIPS_PLM = n
-+CONFIG_PLATFORM_MSTAR389 = n
-+CONFIG_PLATFORM_MT53XX = n
-+CONFIG_PLATFORM_ARM_MX51_241H = n
-+CONFIG_PLATFORM_FS_MX61 = n
-+CONFIG_PLATFORM_ACTIONS_ATJ227X = n
-+CONFIG_PLATFORM_TEGRA3_CARDHU = n
-+CONFIG_PLATFORM_TEGRA4_DALMORE = n
-+CONFIG_PLATFORM_ARM_TCC8900 = n
-+CONFIG_PLATFORM_ARM_TCC8920 = n
-+CONFIG_PLATFORM_ARM_TCC8920_JB42 = n
-+CONFIG_PLATFORM_ARM_RK2818 = n
-+CONFIG_PLATFORM_ARM_TI_PANDA = n
-+CONFIG_PLATFORM_MIPS_JZ4760 = n
-+CONFIG_PLATFORM_DMP_PHILIPS = n
-+CONFIG_PLATFORM_TI_DM365 = n
-+CONFIG_PLATFORM_MN10300 = n
-+CONFIG_PLATFORM_MSTAR_TITANIA12 = n
-+CONFIG_PLATFORM_MSTAR_A3 = n
-+CONFIG_PLATFORM_ARM_SUNxI = n
-+CONFIG_PLATFORM_ARM_SUN6I = n
-+
-+CONFIG_DRVEXT_MODULE = n
-+
-+export TopDIR ?= $(shell pwd)
-+
-+
-+ifeq ($(CONFIG_RTL8192C), y)
-+
-+RTL871X = rtl8192c
-+
-+ifeq ($(CONFIG_USB_HCI), y)
-+MODULE_NAME = 8192cu
-+FW_FILES := hal/$(RTL871X)/usb/Hal8192CUHWImg.o
-+ifneq ($(CONFIG_WAKE_ON_WLAN), n)
-+FW_FILES += hal/$(RTL871X)/usb/Hal8192CUHWImg_wowlan.o
-+endif
-+endif
-+ifeq ($(CONFIG_PCI_HCI), y)
-+MODULE_NAME = 8192ce
-+FW_FILES := hal/$(RTL871X)/pci/Hal8192CEHWImg.o
-+endif
-+
-+CHIP_FILES := \
-+ hal/$(RTL871X)/$(RTL871X)_sreset.o \
-+ hal/$(RTL871X)/$(RTL871X)_xmit.o
-+CHIP_FILES += $(FW_FILES)
-+endif
-+
-+ifeq ($(CONFIG_RTL8192D), y)
-+
-+RTL871X = rtl8192d
-+
-+ifeq ($(CONFIG_USB_HCI), y)
-+MODULE_NAME = 8192du
-+FW_FILES := hal/$(RTL871X)/usb/Hal8192DUHWImg.o
-+ifneq ($(CONFIG_WAKE_ON_WLAN), n)
-+FW_FILES += hal/$(RTL871X)/usb/Hal8192DUHWImg_wowlan.o
-+endif
-+endif
-+ifeq ($(CONFIG_PCI_HCI), y)
-+MODULE_NAME = 8192de
-+FW_FILES := hal/$(RTL871X)/pci/Hal8192DEHWImg.o
-+endif
-+
-+CHIP_FILES := \
-+ hal/$(RTL871X)/$(RTL871X)_xmit.o
-+CHIP_FILES += $(FW_FILES)
-+endif
-+
-+ifeq ($(CONFIG_RTL8723A), y)
-+
-+RTL871X = rtl8723a
-+
-+ifeq ($(CONFIG_SDIO_HCI), y)
-+MODULE_NAME = 8723as
-+FW_FILES := hal/$(RTL871X)/sdio/Hal8723SHWImg.o
-+endif
-+
-+ifeq ($(CONFIG_USB_HCI), y)
-+MODULE_NAME = 8723au
-+FW_FILES := hal/$(RTL871X)/usb/Hal8723UHWImg.o
-+endif
-+
-+ifeq ($(CONFIG_PCI_HCI), y)
-+MODULE_NAME = 8723ae
-+FW_FILES := hal/$(RTL871X)/pci/Hal8723EHWImg.o
-+endif
-+
-+PWRSEQ_FILES := hal/HalPwrSeqCmd.o \
-+ hal/$(RTL871X)/Hal8723PwrSeq.o
-+
-+CHIP_FILES += $(FW_FILES) $(PWRSEQ_FILES)
-+
-+endif
-+
-+ifeq ($(CONFIG_SDIO_HCI), y)
-+HCI_NAME = sdio
-+endif
-+
-+ifeq ($(CONFIG_USB_HCI), y)
-+HCI_NAME = usb
-+endif
-+
-+ifeq ($(CONFIG_PCI_HCI), y)
-+HCI_NAME = pci
-+endif
-+
-+
-+_OS_INTFS_FILES := os_dep/osdep_service.o \
-+ os_dep/linux/os_intfs.o \
-+ os_dep/linux/$(HCI_NAME)_intf.o \
-+ os_dep/linux/$(HCI_NAME)_ops_linux.o \
-+ os_dep/linux/ioctl_linux.o \
-+ os_dep/linux/xmit_linux.o \
-+ os_dep/linux/mlme_linux.o \
-+ os_dep/linux/recv_linux.o \
-+ os_dep/linux/ioctl_cfg80211.o \
-+ os_dep/linux/rtw_android.o
-+
-+
-+_HAL_INTFS_FILES := hal/hal_intf.o \
-+ hal/hal_com.o \
-+ hal/dm.o \
-+ hal/$(RTL871X)/$(RTL871X)_hal_init.o \
-+ hal/$(RTL871X)/$(RTL871X)_phycfg.o \
-+ hal/$(RTL871X)/$(RTL871X)_rf6052.o \
-+ hal/$(RTL871X)/$(RTL871X)_dm.o \
-+ hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
-+ hal/$(RTL871X)/$(RTL871X)_cmd.o \
-+ hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
-+ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
-+ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
-+ hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
-+
-+ifeq ($(CONFIG_SDIO_HCI), y)
-+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
-+else
-+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
-+endif
-+
-+ifeq ($(CONFIG_MP_INCLUDED), y)
-+_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
-+endif
-+
-+_HAL_INTFS_FILES += $(CHIP_FILES)
-+
-+
-+ifeq ($(CONFIG_AUTOCFG_CP), y)
-+$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
-+endif
-+
-+
-+ifeq ($(CONFIG_USB_HCI), y)
-+ifeq ($(CONFIG_USB_AUTOSUSPEND), y)
-+EXTRA_CFLAGS += -DCONFIG_USB_AUTOSUSPEND
-+endif
-+endif
-+
-+ifeq ($(CONFIG_POWER_SAVING), y)
-+EXTRA_CFLAGS += -DCONFIG_POWER_SAVING
-+endif
-+
-+ifeq ($(CONFIG_HW_PWRP_DETECTION), y)
-+EXTRA_CFLAGS += -DCONFIG_HW_PWRP_DETECTION
-+endif
-+
-+ifeq ($(CONFIG_WIFI_TEST), y)
-+EXTRA_CFLAGS += -DCONFIG_WIFI_TEST
-+endif
-+
-+ifeq ($(CONFIG_BT_COEXISTENCE), y)
-+EXTRA_CFLAGS += -DCONFIG_BT_COEXISTENCE
-+endif
-+
-+ifeq ($(CONFIG_RTL8192CU_REDEFINE_1X1), y)
-+EXTRA_CFLAGS += -DRTL8192C_RECONFIG_TO_1T1R
-+endif
-+
-+ifeq ($(CONFIG_WAKE_ON_WLAN), y)
-+EXTRA_CFLAGS += -DCONFIG_WAKE_ON_WLAN
-+endif
-+
-+ifeq ($(CONFIG_INTEL_WIDI), y)
-+EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_I386_PC), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
-+ARCH ?= $(SUBARCH)
-+CROSS_COMPILE ?=
-+KVER := $(shell uname -r)
-+KSRC := /lib/modules/$(KVER)/build
-+MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
-+INSTALL_PREFIX :=
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_TI_AM3517), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_SHUTTLE
-+CROSS_COMPILE := arm-eabi-
-+KSRC := $(shell pwd)/../../../Android/kernel
-+ARCH := arm
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MSTAR_TITANIA12), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_PLATFORM_MSTAR_TITANIA12
-+ARCH:=mips
-+CROSS_COMPILE:= /usr/src/Mstar_kernel/mips-4.3/bin/mips-linux-gnu-
-+KVER:= 2.6.28.9
-+KSRC:= /usr/src/Mstar_kernel/2.6.28.9/
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MSTAR_A3), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_PLATFORM_MSTAR_A3
-+ARCH:=arm
-+CROSS_COMPILE:= arm-none-linux-gnueabi-
-+KVER:= 2.6.35.11
-+KSRC:= /home/gary/PERFORCE/THEALE/RedLion/2.6.35.11/
-+MODULE_NAME = wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
-+ARCH := $(SUBARCH)
-+CROSS_COMPILE := /media/DATA-2/android-x86/ics-x86_20120130/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-
-+KSRC := /media/DATA-2/android-x86/ics-x86_20120130/out/target/product/generic_x86/obj/kernel
-+MODULE_NAME :=wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_JB_X86), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
-+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
-+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
-+ARCH := $(SUBARCH)
-+CROSS_COMPILE := /home/android_sdk/android-x86_JB/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7/bin/i686-linux-android-
-+KSRC := /home/android_sdk/android-x86_JB/out/target/product/x86/obj/kernel/
-+MODULE_NAME :=wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_PXA2XX), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH := arm
-+CROSS_COMPILE := arm-none-linux-gnueabi-
-+KVER := 2.6.34.1
-+KSRC ?= /usr/src/linux-2.6.34.1
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH := arm
-+CROSS_COMPILE := arm-linux-
-+KVER := 2.6.24.7_$(ARCH)
-+KSRC := /usr/src/kernels/linux-$(KVER)
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_S3C6K4), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH := arm
-+CROSS_COMPILE := arm-none-linux-gnueabi-
-+KVER := 2.6.34.1
-+KSRC ?= /usr/src/linux-2.6.34.1
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_RTD2880B), y)
-+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B
-+ARCH:=
-+CROSS_COMPILE:=
-+KVER:=
-+KSRC:=
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MIPS_RMI), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH:=mips
-+CROSS_COMPILE:=mipsisa32r2-uclibc-
-+KVER:=
-+KSRC:= /root/work/kernel_realtek
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MIPS_PLM), y)
-+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
-+ARCH:=mips
-+CROSS_COMPILE:=mipsisa32r2-uclibc-
-+KVER:=
-+KSRC:= /root/work/kernel_realtek
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MSTAR389), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR389
-+ARCH:=mips
-+CROSS_COMPILE:= mips-linux-gnu-
-+KVER:= 2.6.28.10
-+KSRC:= /home/mstar/mstar_linux/2.6.28.9/
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MIPS_AR9132), y)
-+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
-+ARCH := mips
-+CROSS_COMPILE := mips-openwrt-linux-
-+KSRC := /home/alex/test_openwrt/tmp/linux-2.6.30.9
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_DMP_PHILIPS), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM
-+ARCH := mips
-+#CROSS_COMPILE:=/usr/local/msdk-4.3.6-mips-EL-2.6.12.6-0.9.30.3/bin/mipsel-linux-
-+CROSS_COMPILE:=/usr/local/toolchain_mipsel/bin/mipsel-linux-
-+KSRC ?=/usr/local/Jupiter/linux-2.6.12
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_RTK_DMP), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM
-+ARCH:=mips
-+CROSS_COMPILE:=mipsel-linux-
-+KVER:=
-+KSRC ?= /usr/src/DMP_Kernel/jupiter/linux-2.6.12
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MT53XX), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MT53XX
-+ARCH:= arm
-+CROSS_COMPILE:= arm11_mtk_le-
-+KVER:= 2.6.27
-+KSRC?= /proj/mtk00802/BD_Compare/BDP/Dev/BDP_V301/BDP_Linux/linux-2.6.27
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_MX51_241H), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WISTRON_PLATFORM
-+ARCH := arm
-+CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
-+KVER := 2.6.31
-+KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_FS_MX61), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH := arm
-+CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi-
-+KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env
-+endif
-+
-+
-+
-+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X
-+ARCH := mips
-+CROSS_COMPILE := /home/cnsd4/project/actions/tools-2.6.27/bin/mipsel-linux-gnu-
-+KVER := 2.6.27
-+KSRC := /home/cnsd4/project/actions/linux-2.6.27.28
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_TI_DM365), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_TI_DM365
-+ARCH := arm
-+CROSS_COMPILE := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-
-+KVER := 2.6.18
-+KSRC := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-dm365
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_TEGRA3_CARDHU), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+# default setting for Android 4.1, 4.2
-+EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
-+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
-+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
-+ARCH := arm
-+CROSS_COMPILE := /home/android_sdk/nvidia/tegra-16r3-partner-android-4.1_20120723/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
-+KSRC := /home/android_sdk/nvidia/tegra-16r3-partner-android-4.1_20120723/out/target/product/cardhu/obj/KERNEL
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_TEGRA4_DALMORE), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+# default setting for Android 4.1, 4.2
-+EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
-+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
-+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
-+ARCH := arm
-+CROSS_COMPILE := /home/android_sdk/nvidia/tegra-17r9-partner-android-4.2-dalmore_20130131/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
-+KSRC := /home/android_sdk/nvidia/tegra-17r9-partner-android-4.2-dalmore_20130131/out/target/product/dalmore/obj/KERNEL
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_TCC8900), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH := arm
-+CROSS_COMPILE := /home/android_sdk/Telechips/SDK_2304_20110613/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
-+KSRC := /home/android_sdk/Telechips/SDK_2304_20110613/kernel
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_TCC8920), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+ARCH := arm
-+CROSS_COMPILE := /home/android_sdk/Telechips/v12.06_r1-tcc-android-4.0.4/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
-+KSRC := /home/android_sdk/Telechips/v12.06_r1-tcc-android-4.0.4/kernel
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_TCC8920_JB42), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+# default setting for Android 4.1, 4.2
-+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
-+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
-+ARCH := arm
-+CROSS_COMPILE := /home/android_sdk/Telechips/v13.03_r1-tcc-android-4.2.2_ds_patched/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
-+KSRC := /home/android_sdk/Telechips/v13.03_r1-tcc-android-4.2.2_ds_patched/kernel
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS -DCONFIG_MINIMAL_MEMORY_USAGE
-+ARCH := arm
-+CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
-+KSRC := /usr/src/release_fae_version/kernel25_A7_281x
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_TI_PANDA), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE
-+ARCH := arm
-+#CROSS_COMPILE := /media/DATA-1/aosp/ics-aosp_20111227/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
-+#KSRC := /media/DATA-1/aosp/android-omap-panda-3.0_20120104
-+CROSS_COMPILE := /media/DATA-1/android-4.0/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
-+KSRC := /media/DATA-1/android-4.0/panda_kernel/omap
-+MODULE_NAME := wlan
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_MIPS_JZ4760), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_MINIMAL_MEMORY_USAGE
-+ARCH ?= mips
-+CROSS_COMPILE ?= /mnt/sdb5/Ingenic/Umido/mips-4.3/bin/mips-linux-gnu-
-+KSRC ?= /mnt/sdb5/Ingenic/Umido/kernel
-+endif
-+
-+#Add setting for MN10300
-+ifeq ($(CONFIG_PLATFORM_MN10300), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MN10300
-+ARCH := mn10300
-+CROSS_COMPILE := mn10300-linux-
-+KVER := 2.6.32.2
-+KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2
-+INSTALL_PREFIX :=
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_SUNxI), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ARM_SUNxI
-+ARCH := arm
-+CROSS_COMPILE := arm-none-linux-gnueabi-
-+KVER := 3.0.8
-+#KSRC:= ../lichee/linux-3.0/
-+endif
-+
-+ifeq ($(CONFIG_PLATFORM_ARM_SUN6I), y)
-+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN6I
-+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
-+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
-+# default setting for Android 4.1, 4.2
-+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
-+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
-+ARCH := arm
-+CROSS_COMPILE := arm-none-linux-gnueabi-
-+KVER := 3.3.0
-+#KSRC:= ../lichee/linux-3.3/
-+endif
-+
-+ifneq ($(USER_MODULE_NAME),)
-+MODULE_NAME := $(USER_MODULE_NAME)
-+endif
-+
-+ifeq ($(CONFIG_MP_INCLUDED), y)
-+MODULE_NAME := $(MODULE_NAME)_mp
-+EXTRA_CFLAGS += -DCONFIG_MP_INCLUDED
-+endif
-+
-+
-+ifneq ($(KERNELRELEASE),)
-+
-+
-+rtk_core := core/rtw_cmd.o \
-+ core/rtw_security.o \
-+ core/rtw_debug.o \
-+ core/rtw_io.o \
-+ core/rtw_ioctl_query.o \
-+ core/rtw_ioctl_set.o \
-+ core/rtw_ieee80211.o \
-+ core/rtw_mlme.o \
-+ core/rtw_mlme_ext.o \
-+ core/rtw_wlan_util.o \
-+ core/rtw_pwrctrl.o \
-+ core/rtw_rf.o \
-+ core/rtw_recv.o \
-+ core/rtw_sta_mgt.o \
-+ core/rtw_ap.o \
-+ core/rtw_xmit.o \
-+ core/rtw_p2p.o \
-+ core/rtw_tdls.o \
-+ core/rtw_br_ext.o \
-+ core/rtw_iol.o \
-+ core/rtw_sreset.o
-+
-+$(MODULE_NAME)-y += $(rtk_core)
-+
-+$(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o
-+
-+$(MODULE_NAME)-y += core/efuse/rtw_efuse.o
-+
-+$(MODULE_NAME)-y += $(_HAL_INTFS_FILES)
-+
-+$(MODULE_NAME)-y += $(_OS_INTFS_FILES)
-+
-+$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \
-+ core/rtw_mp_ioctl.o
-+
-+obj-$(CONFIG_RTL8192CU) := $(MODULE_NAME).o
-+
-+else
-+
-+export CONFIG_RTL8192CU = m
-+
-+all: modules
-+
-+modules:
-+ $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules
-+
-+strip:
-+ $(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded
-+
-+install:
-+ install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR)
-+ /sbin/depmod -a ${KVER}
-+
-+uninstall:
-+ rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
-+ /sbin/depmod -a ${KVER}
-+
-+
-+config_r:
-+ @echo "make config"
-+ /bin/bash script/Configure script/config.in
-+
-+.PHONY: modules clean
-+
-+clean:
-+ rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
-+ rm .tmp_versions -fr ; rm Module.symvers -fr
-+ rm -fr Module.markers ; rm -fr modules.order
-+ cd core/efuse ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+ cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+ cd hal/$(RTL871X)/$(HCI_NAME) ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+ cd hal/$(RTL871X) ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+ cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+ cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+ cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
-+endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c 2015-07-28 01:20:58.429213356 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,5488 @@
+/******************************************************************************
+ *
@@ -200026,9 +208021,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_cfg80211
+}
+
+#endif //CONFIG_IOCTL_CFG80211
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c 2015-07-28 01:20:58.429213356 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,11908 @@
+/******************************************************************************
+ *
@@ -211938,9 +219933,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/ioctl_linux.c
+#endif
+};
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c 2015-07-28 01:20:58.429213356 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,585 @@
+/******************************************************************************
+ *
@@ -212527,9 +220522,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/mlme_linux.c l
+
+#endif
+#endif
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c 2015-07-28 01:20:58.429213356 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,2748 @@
+/******************************************************************************
+ *
@@ -215279,9 +223274,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/os_intfs.c lin
+#endif
+ free_netdev(ndev);
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,1996 @@
+/******************************************************************************
+ *
@@ -217279,9 +225274,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_intf.c lin
+
+module_init(rtw_drv_entry);
+module_exit(rtw_drv_halt);
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,21 @@
+/******************************************************************************
+ *
@@ -217304,9 +225299,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/pci_ops_linux.
+#define _PCI_OPS_LINUX_C_
+
+#include <drv_types.h>
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,447 @@
+/******************************************************************************
+ *
@@ -217755,9 +225750,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/recv_linux.c l
+ _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
+
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,838 @@
+/******************************************************************************
+ *
@@ -218597,9 +226592,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/rtw_android.c
+ platform_driver_unregister(&wifi_device_legacy);
+}
+#endif /* defined(RTW_ENABLE_WIFI_CONTROL_FUNC) */
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,1655 @@
+/******************************************************************************
+ *
@@ -220256,9 +228251,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_intf.c lin
+}
+EXPORT_SYMBOL(rtw_usb_get_sw_pointer);
+#endif //CONFIG_INTEL_PROXIM
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,648 @@
+/******************************************************************************
+ *
@@ -220908,9 +228903,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/usb_ops_linux.
+ pxmitbuf++;
+ }
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,420 @@
+/******************************************************************************
+ *
@@ -221332,9 +229327,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/linux/xmit_linux.c l
+ rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, pkt->truesize);
+ return _rtw_xmit_entry(pkt, pnetdev);
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c 2015-08-26 10:26:08.765316497 +0200
@@ -0,0 +1,2299 @@
+/******************************************************************************
+ *
@@ -223635,9 +231630,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/os_dep/osdep_service.c linu
+{
+ rtw_mfree((u8*)cbuf, sizeof(*cbuf) + sizeof(void*)*cbuf->size);
+}
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/runwpa linux-xbian-rpi/drivers/net/wireless/rtl8192cu/runwpa
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/runwpa 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/runwpa 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/runwpa linux-rpi/drivers/net/wireless/rtl8192cu/runwpa
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/runwpa 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/runwpa 2015-08-26 10:26:08.769316552 +0200
@@ -0,0 +1,18 @@
+#!/bin/bash
+
@@ -223657,9 +231652,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/runwpa linux-xbian-rpi/driv
+
+ fi
+fi
-diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/wlan0dhcp linux-xbian-rpi/drivers/net/wireless/rtl8192cu/wlan0dhcp
---- linux-4.1.3/drivers/net/wireless/rtl8192cu/wlan0dhcp 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/net/wireless/rtl8192cu/wlan0dhcp 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/net/wireless/rtl8192cu/wlan0dhcp linux-rpi/drivers/net/wireless/rtl8192cu/wlan0dhcp
+--- linux-4.1.6/drivers/net/wireless/rtl8192cu/wlan0dhcp 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/net/wireless/rtl8192cu/wlan0dhcp 2015-08-26 10:26:08.769316552 +0200
@@ -0,0 +1,15 @@
+#!/bin/bash
+
@@ -223676,9 +231671,9 @@ diff -Nur linux-4.1.3/drivers/net/wireless/rtl8192cu/wlan0dhcp linux-xbian-rpi/d
+rm -f /etc/sysconfig/network-scripts/ifcfg-wlan0
+
+echo "get ip: $var1"
-diff -Nur linux-4.1.3/drivers/of/fdt.c linux-xbian-rpi/drivers/of/fdt.c
---- linux-4.1.3/drivers/of/fdt.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/of/fdt.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/of/fdt.c linux-rpi/drivers/of/fdt.c
+--- linux-4.1.6/drivers/of/fdt.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/of/fdt.c 2015-08-26 10:26:08.809317108 +0200
@@ -933,19 +933,38 @@
/* Retrieve command line */
@@ -223723,9 +231718,20 @@ diff -Nur linux-4.1.3/drivers/of/fdt.c linux-xbian-rpi/drivers/of/fdt.c
#endif /* CONFIG_CMDLINE */
pr_debug("Command line is: %s\n", (char*)data);
-diff -Nur linux-4.1.3/drivers/pinctrl/bcm/pinctrl-bcm2835.c linux-xbian-rpi/drivers/pinctrl/bcm/pinctrl-bcm2835.c
---- linux-4.1.3/drivers/pinctrl/bcm/pinctrl-bcm2835.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/pinctrl/bcm/pinctrl-bcm2835.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/pinctrl/Makefile linux-rpi/drivers/pinctrl/Makefile
+--- linux-4.1.6/drivers/pinctrl/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/pinctrl/Makefile 2015-08-26 10:26:08.837317497 +0200
+@@ -38,6 +38,7 @@
+ obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
+ obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o
+
++obj-$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += bcm/
+ obj-$(CONFIG_ARCH_BCM) += bcm/
+ obj-$(CONFIG_ARCH_BERLIN) += berlin/
+ obj-y += freescale/
+diff -Nur linux-4.1.6/drivers/pinctrl/bcm/pinctrl-bcm2835.c linux-rpi/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+--- linux-4.1.6/drivers/pinctrl/bcm/pinctrl-bcm2835.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/pinctrl/bcm/pinctrl-bcm2835.c 2015-08-26 10:26:08.837317497 +0200
@@ -47,6 +47,7 @@
#define MODULE_NAME "pinctrl-bcm2835"
#define BCM2835_NUM_GPIOS 54
@@ -223834,7 +231840,16 @@ diff -Nur linux-4.1.3/drivers/pinctrl/bcm/pinctrl-bcm2835.c linux-xbian-rpi/driv
}
static inline void __bcm2835_gpio_irq_config(struct bcm2835_pinctrl *pc,
-@@ -993,8 +1023,6 @@
+@@ -473,6 +503,8 @@
+
+ spin_lock_irqsave(&pc->irq_lock[bank], flags);
+ bcm2835_gpio_irq_config(pc, gpio, false);
++ /* Clear events that were latched prior to clearing event sources */
++ bcm2835_gpio_set_bit(pc, GPEDS0, gpio);
+ clear_bit(offset, &pc->enabled_irq_map[bank]);
+ spin_unlock_irqrestore(&pc->irq_lock[bank], flags);
+ }
+@@ -993,8 +1025,6 @@
for (i = 0; i < BCM2835_NUM_BANKS; i++) {
unsigned long events;
unsigned offset;
@@ -223843,7 +231858,7 @@ diff -Nur linux-4.1.3/drivers/pinctrl/bcm/pinctrl-bcm2835.c linux-xbian-rpi/driv
/* clear event detection flags */
bcm2835_gpio_wr(pc, GPREN0 + i * 4, 0);
-@@ -1009,10 +1037,17 @@
+@@ -1009,10 +1039,17 @@
for_each_set_bit(offset, &events, 32)
bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset));
@@ -223863,7 +231878,7 @@ diff -Nur linux-4.1.3/drivers/pinctrl/bcm/pinctrl-bcm2835.c linux-xbian-rpi/driv
len = strlen(dev_name(pc->dev)) + 16;
name = devm_kzalloc(pc->dev, len, GFP_KERNEL);
-@@ -1070,6 +1105,7 @@
+@@ -1070,6 +1107,7 @@
.remove = bcm2835_pinctrl_remove,
.driver = {
.name = MODULE_NAME,
@@ -223871,20 +231886,9 @@ diff -Nur linux-4.1.3/drivers/pinctrl/bcm/pinctrl-bcm2835.c linux-xbian-rpi/driv
.of_match_table = bcm2835_pinctrl_match,
},
};
-diff -Nur linux-4.1.3/drivers/pinctrl/Makefile linux-xbian-rpi/drivers/pinctrl/Makefile
---- linux-4.1.3/drivers/pinctrl/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/pinctrl/Makefile 2015-07-28 01:20:58.433199136 +0200
-@@ -38,6 +38,7 @@
- obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
- obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o
-
-+obj-$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += bcm/
- obj-$(CONFIG_ARCH_BCM) += bcm/
- obj-$(CONFIG_ARCH_BERLIN) += berlin/
- obj-y += freescale/
-diff -Nur linux-4.1.3/drivers/power/reset/gpio-poweroff.c linux-xbian-rpi/drivers/power/reset/gpio-poweroff.c
---- linux-4.1.3/drivers/power/reset/gpio-poweroff.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/power/reset/gpio-poweroff.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/power/reset/gpio-poweroff.c linux-rpi/drivers/power/reset/gpio-poweroff.c
+--- linux-4.1.6/drivers/power/reset/gpio-poweroff.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/power/reset/gpio-poweroff.c 2015-08-26 10:26:08.881318109 +0200
@@ -48,9 +48,11 @@
static int gpio_poweroff_probe(struct platform_device *pdev)
{
@@ -223898,9 +231902,21 @@ diff -Nur linux-4.1.3/drivers/power/reset/gpio-poweroff.c linux-xbian-rpi/driver
dev_err(&pdev->dev,
"%s: pm_power_off function already registered",
__func__);
-diff -Nur linux-4.1.3/drivers/rtc/rtc-ds1307.c linux-xbian-rpi/drivers/rtc/rtc-ds1307.c
---- linux-4.1.3/drivers/rtc/rtc-ds1307.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/rtc/rtc-ds1307.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/pwm/Kconfig linux-rpi/drivers/pwm/Kconfig
+--- linux-4.1.6/drivers/pwm/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/pwm/Kconfig 2015-08-26 10:26:08.885318164 +0200
+@@ -85,7 +85,7 @@
+
+ config PWM_BCM2835
+ tristate "BCM2835 PWM support"
+- depends on ARCH_BCM2835
++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
+ help
+ PWM framework driver for BCM2835 controller (Raspberry Pi)
+
+diff -Nur linux-4.1.6/drivers/rtc/rtc-ds1307.c linux-rpi/drivers/rtc/rtc-ds1307.c
+--- linux-4.1.6/drivers/rtc/rtc-ds1307.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/rtc/rtc-ds1307.c 2015-08-26 10:26:08.905318442 +0200
@@ -1242,6 +1242,14 @@
return 0;
}
@@ -223916,9 +231932,9 @@ diff -Nur linux-4.1.3/drivers/rtc/rtc-ds1307.c linux-xbian-rpi/drivers/rtc/rtc-d
static struct i2c_driver ds1307_driver = {
.driver = {
.name = "rtc-ds1307",
-diff -Nur linux-4.1.3/drivers/spi/Kconfig linux-xbian-rpi/drivers/spi/Kconfig
---- linux-4.1.3/drivers/spi/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/spi/Kconfig 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/spi/Kconfig linux-rpi/drivers/spi/Kconfig
+--- linux-4.1.6/drivers/spi/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/spi/Kconfig 2015-08-26 10:26:09.069320718 +0200
@@ -77,7 +77,7 @@
config SPI_BCM2835
@@ -223943,9 +231959,9 @@ diff -Nur linux-4.1.3/drivers/spi/Kconfig linux-xbian-rpi/drivers/spi/Kconfig
config SPI_BFIN5XX
tristate "SPI controller driver for ADI Blackfin5xx"
depends on BLACKFIN && !BF60x
-diff -Nur linux-4.1.3/drivers/spi/Makefile linux-xbian-rpi/drivers/spi/Makefile
---- linux-4.1.3/drivers/spi/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/spi/Makefile 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/spi/Makefile linux-rpi/drivers/spi/Makefile
+--- linux-4.1.6/drivers/spi/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/spi/Makefile 2015-08-26 10:26:09.069320718 +0200
@@ -20,6 +20,7 @@
obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o
obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o
@@ -223954,9 +231970,9 @@ diff -Nur linux-4.1.3/drivers/spi/Makefile linux-xbian-rpi/drivers/spi/Makefile
obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o
obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o
obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o
-diff -Nur linux-4.1.3/drivers/spi/spi-bcm2708.c linux-xbian-rpi/drivers/spi/spi-bcm2708.c
---- linux-4.1.3/drivers/spi/spi-bcm2708.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/spi/spi-bcm2708.c 2015-07-28 01:20:58.433199136 +0200
+diff -Nur linux-4.1.6/drivers/spi/spi-bcm2708.c linux-rpi/drivers/spi/spi-bcm2708.c
+--- linux-4.1.6/drivers/spi/spi-bcm2708.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/spi/spi-bcm2708.c 2015-08-26 10:26:09.069320718 +0200
@@ -0,0 +1,628 @@
+/*
+ * Driver for Broadcom BCM2708 SPI Controllers
@@ -224586,10 +232602,469 @@ diff -Nur linux-4.1.3/drivers/spi/spi-bcm2708.c linux-xbian-rpi/drivers/spi/spi-
+MODULE_AUTHOR("Chris Boot <bootc@bootc.net>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:" DRV_NAME);
-diff -Nur linux-4.1.3/drivers/spi/spi-bcm2835.c linux-xbian-rpi/drivers/spi/spi-bcm2835.c
---- linux-4.1.3/drivers/spi/spi-bcm2835.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/spi/spi-bcm2835.c 2015-07-28 01:20:58.433199136 +0200
-@@ -359,6 +359,8 @@
+diff -Nur linux-4.1.6/drivers/spi/spi-bcm2835.c linux-rpi/drivers/spi/spi-bcm2835.c
+--- linux-4.1.6/drivers/spi/spi-bcm2835.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/spi/spi-bcm2835.c 2015-08-26 10:26:09.069320718 +0200
+@@ -20,18 +20,22 @@
+ * GNU General Public License for more details.
+ */
+
++#include <asm/page.h>
+ #include <linux/clk.h>
+ #include <linux/completion.h>
+ #include <linux/delay.h>
++#include <linux/dma-mapping.h>
++#include <linux/dmaengine.h>
+ #include <linux/err.h>
+ #include <linux/interrupt.h>
+ #include <linux/io.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
+-#include <linux/of_irq.h>
+-#include <linux/of_gpio.h>
++#include <linux/of_address.h>
+ #include <linux/of_device.h>
++#include <linux/of_gpio.h>
++#include <linux/of_irq.h>
+ #include <linux/spi/spi.h>
+
+ /* SPI register offsets */
+@@ -69,7 +73,8 @@
+ #define BCM2835_SPI_CS_CS_01 0x00000001
+
+ #define BCM2835_SPI_POLLING_LIMIT_US 30
+-#define BCM2835_SPI_TIMEOUT_MS 30000
++#define BCM2835_SPI_POLLING_JIFFIES 2
++#define BCM2835_SPI_DMA_MIN_LENGTH 96
+ #define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
+ | SPI_NO_CS | SPI_3WIRE)
+
+@@ -83,6 +88,7 @@
+ u8 *rx_buf;
+ int tx_len;
+ int rx_len;
++ bool dma_pending;
+ };
+
+ static inline u32 bcm2835_rd(struct bcm2835_spi *bs, unsigned reg)
+@@ -128,12 +134,15 @@
+ /* Disable SPI interrupts and transfer */
+ cs &= ~(BCM2835_SPI_CS_INTR |
+ BCM2835_SPI_CS_INTD |
++ BCM2835_SPI_CS_DMAEN |
+ BCM2835_SPI_CS_TA);
+ /* and reset RX/TX FIFOS */
+ cs |= BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX;
+
+ /* and reset the SPI_HW */
+ bcm2835_wr(bs, BCM2835_SPI_CS, cs);
++ /* as well as DLEN */
++ bcm2835_wr(bs, BCM2835_SPI_DLEN, 0);
+ }
+
+ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
+@@ -157,42 +166,6 @@
+ return IRQ_HANDLED;
+ }
+
+-static int bcm2835_spi_transfer_one_poll(struct spi_master *master,
+- struct spi_device *spi,
+- struct spi_transfer *tfr,
+- u32 cs,
+- unsigned long xfer_time_us)
+-{
+- struct bcm2835_spi *bs = spi_master_get_devdata(master);
+- /* set timeout to 1 second of maximum polling */
+- unsigned long timeout = jiffies + HZ;
+-
+- /* enable HW block without interrupts */
+- bcm2835_wr(bs, BCM2835_SPI_CS, cs | BCM2835_SPI_CS_TA);
+-
+- /* loop until finished the transfer */
+- while (bs->rx_len) {
+- /* read from fifo as much as possible */
+- bcm2835_rd_fifo(bs);
+- /* fill in tx fifo as much as possible */
+- bcm2835_wr_fifo(bs);
+- /* if we still expect some data after the read,
+- * check for a possible timeout
+- */
+- if (bs->rx_len && time_after(jiffies, timeout)) {
+- /* Transfer complete - reset SPI HW */
+- bcm2835_spi_reset_hw(master);
+- /* and return timeout */
+- return -ETIMEDOUT;
+- }
+- }
+-
+- /* Transfer complete - reset SPI HW */
+- bcm2835_spi_reset_hw(master);
+- /* and return without waiting for completion */
+- return 0;
+-}
+-
+ static int bcm2835_spi_transfer_one_irq(struct spi_master *master,
+ struct spi_device *spi,
+ struct spi_transfer *tfr,
+@@ -229,6 +202,329 @@
+ return 1;
+ }
+
++/*
++ * DMA support
++ *
++ * this implementation has currently a few issues in so far as it does
++ * not work arrount limitations of the HW.
++ *
++ * the main one being that DMA transfers are limited to 16 bit
++ * (so 0 to 65535 bytes) by the SPI HW due to BCM2835_SPI_DLEN
++ *
++ * also we currently assume that the scatter-gather fragments are
++ * all multiple of 4 (except the last) - otherwise we would need
++ * to reset the FIFO before subsequent transfers...
++ * this also means that tx/rx transfers sg's need to be of equal size!
++ *
++ * there may be a few more border-cases we may need to address as well
++ * but unfortunately this would mean splitting up the scatter-gather
++ * list making it slightly unpractical...
++ */
++static void bcm2835_spi_dma_done(void *data)
++{
++ struct spi_master *master = data;
++ struct bcm2835_spi *bs = spi_master_get_devdata(master);
++
++ /* reset fifo and HW */
++ bcm2835_spi_reset_hw(master);
++
++ /* and terminate tx-dma as we do not have an irq for it
++ * because when the rx dma will terminate and this callback
++ * is called the tx-dma must have finished - can't get to this
++ * situation otherwise...
++ */
++ dmaengine_terminate_all(master->dma_tx);
++
++ /* mark as no longer pending */
++ bs->dma_pending = 0;
++
++ /* and mark as completed */;
++ complete(&master->xfer_completion);
++}
++
++static int bcm2835_spi_prepare_sg(struct spi_master *master,
++ struct spi_transfer *tfr,
++ bool is_tx)
++{
++ struct dma_chan *chan;
++ struct scatterlist *sgl;
++ unsigned int nents;
++ enum dma_transfer_direction dir;
++ unsigned long flags;
++
++ struct dma_async_tx_descriptor *desc;
++ dma_cookie_t cookie;
++
++ if (is_tx) {
++ dir = DMA_MEM_TO_DEV;
++ chan = master->dma_tx;
++ nents = tfr->tx_sg.nents;
++ sgl = tfr->tx_sg.sgl;
++ flags = 0 /* no tx interrupt */;
++
++ } else {
++ dir = DMA_DEV_TO_MEM;
++ chan = master->dma_rx;
++ nents = tfr->rx_sg.nents;
++ sgl = tfr->rx_sg.sgl;
++ flags = DMA_PREP_INTERRUPT;
++ }
++ /* prepare the channel */
++ desc = dmaengine_prep_slave_sg(chan, sgl, nents, dir, flags);
++ if (!desc)
++ return -EINVAL;
++
++ /* set callback for rx */
++ if (!is_tx) {
++ desc->callback = bcm2835_spi_dma_done;
++ desc->callback_param = master;
++ }
++
++ /* submit it to DMA-engine */
++ cookie = dmaengine_submit(desc);
++
++ return dma_submit_error(cookie);
++}
++
++static inline int bcm2835_check_sg_length(struct sg_table *sgt)
++{
++ int i;
++ struct scatterlist *sgl;
++
++ /* check that the sg entries are word-sized (except for last) */
++ for_each_sg(sgt->sgl, sgl, (int)sgt->nents - 1, i) {
++ if (sg_dma_len(sgl) % 4)
++ return -EFAULT;
++ }
++
++ return 0;
++}
++
++static int bcm2835_spi_transfer_one_dma(struct spi_master *master,
++ struct spi_device *spi,
++ struct spi_transfer *tfr,
++ u32 cs)
++{
++ struct bcm2835_spi *bs = spi_master_get_devdata(master);
++ int ret;
++
++ /* check that the scatter gather segments are all a multiple of 4 */
++ if (bcm2835_check_sg_length(&tfr->tx_sg) ||
++ bcm2835_check_sg_length(&tfr->rx_sg)) {
++ dev_warn_once(&spi->dev,
++ "scatter gather segment length is not a multiple of 4 - falling back to interrupt mode\n");
++ return bcm2835_spi_transfer_one_irq(master, spi, tfr, cs);
++ }
++
++ /* setup tx-DMA */
++ ret = bcm2835_spi_prepare_sg(master, tfr, true);
++ if (ret)
++ return ret;
++
++ /* start TX early */
++ dma_async_issue_pending(master->dma_tx);
++
++ /* mark as dma pending */
++ bs->dma_pending = 1;
++
++ /* set the DMA length */
++ bcm2835_wr(bs, BCM2835_SPI_DLEN, tfr->len);
++
++ /* start the HW */
++ bcm2835_wr(bs, BCM2835_SPI_CS,
++ cs | BCM2835_SPI_CS_TA | BCM2835_SPI_CS_DMAEN);
++
++ /* setup rx-DMA late - to run transfers while
++ * mapping of the rx buffers still takes place
++ * this saves 10us or more.
++ */
++ ret = bcm2835_spi_prepare_sg(master, tfr, false);
++ if (ret) {
++ /* need to reset on errors */
++ dmaengine_terminate_all(master->dma_tx);
++ bcm2835_spi_reset_hw(master);
++ return ret;
++ }
++
++ /* start rx dma late */
++ dma_async_issue_pending(master->dma_rx);
++
++ /* wait for wakeup in framework */
++ return 1;
++}
++
++static bool bcm2835_spi_can_dma(struct spi_master *master,
++ struct spi_device *spi,
++ struct spi_transfer *tfr)
++{
++ /* only run for gpio_cs */
++ if (!gpio_is_valid(spi->cs_gpio))
++ return false;
++
++ /* we start DMA efforts only on bigger transfers */
++ if (tfr->len < BCM2835_SPI_DMA_MIN_LENGTH)
++ return false;
++
++ /* BCM2835_SPI_DLEN has defined a max transfer size as
++ * 16 bit, so max is 65535
++ * we can revisit this by using an alternative transfer
++ * method - ideally this would get done without any more
++ * interaction...
++ */
++ if (tfr->len > 65535) {
++ dev_warn_once(&spi->dev,
++ "transfer size of %d too big for dma-transfer\n",
++ tfr->len);
++ return false;
++ }
++
++ /* if we run rx/tx_buf with word aligned addresses then we are OK */
++ if ((((size_t)tfr->rx_buf & 3) == 0) &&
++ (((size_t)tfr->tx_buf & 3) == 0))
++ return true;
++
++ /* otherwise we only allow transfers within the same page
++ * to avoid wasting time on dma_mapping when it is not practical
++ */
++ if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) {
++ dev_warn_once(&spi->dev,
++ "Unaligned spi tx-transfer bridging page\n");
++ return false;
++ }
++ if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) {
++ dev_warn_once(&spi->dev,
++ "Unaligned spi tx-transfer bridging page\n");
++ return false;
++ }
++
++ /* return OK */
++ return true;
++}
++
++static void bcm2835_dma_release(struct spi_master *master)
++{
++ if (master->dma_tx) {
++ dmaengine_terminate_all(master->dma_tx);
++ dma_release_channel(master->dma_tx);
++ master->dma_tx = NULL;
++ }
++ if (master->dma_rx) {
++ dmaengine_terminate_all(master->dma_rx);
++ dma_release_channel(master->dma_rx);
++ master->dma_rx = NULL;
++ }
++}
++
++static void bcm2835_dma_init(struct spi_master *master, struct device *dev)
++{
++ struct dma_slave_config slave_config;
++ const __be32 *addr;
++ dma_addr_t dma_reg_base;
++ int ret;
++
++ /* base address in dma-space */
++ addr = of_get_address(master->dev.of_node, 0, NULL, NULL);
++ if (!addr) {
++ dev_err(dev, "could not get DMA-register address - not using dma mode\n");
++ goto err;
++ }
++ dma_reg_base = be32_to_cpup(addr);
++
++ /* get tx/rx dma */
++ master->dma_tx = dma_request_slave_channel(dev, "tx");
++ if (!master->dma_tx) {
++ dev_err(dev, "no tx-dma configuration found - not using dma mode\n");
++ goto err;
++ }
++ master->dma_rx = dma_request_slave_channel(dev, "rx");
++ if (!master->dma_rx) {
++ dev_err(dev, "no rx-dma configuration found - not using dma mode\n");
++ goto err_release;
++ }
++
++ /* configure DMAs */
++ slave_config.direction = DMA_MEM_TO_DEV;
++ slave_config.dst_addr = (u32)(dma_reg_base + BCM2835_SPI_FIFO);
++ slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
++
++ ret = dmaengine_slave_config(master->dma_tx, &slave_config);
++ if (ret)
++ goto err_config;
++
++ slave_config.direction = DMA_DEV_TO_MEM;
++ slave_config.src_addr = (u32)(dma_reg_base + BCM2835_SPI_FIFO);
++ slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
++
++ ret = dmaengine_slave_config(master->dma_rx, &slave_config);
++ if (ret)
++ goto err_config;
++
++ /* all went well, so set can_dma */
++ master->can_dma = bcm2835_spi_can_dma;
++ master->max_dma_len = 65535; /* limitation by BCM2835_SPI_DLEN */
++ /* need to do TX AND RX DMA, so we need dummy buffers */
++ master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX;
++
++ return;
++
++err_config:
++ dev_err(dev, "issue configuring dma: %d - not using DMA mode\n",
++ ret);
++err_release:
++ bcm2835_dma_release(master);
++err:
++ return;
++}
++
++static int bcm2835_spi_transfer_one_poll(struct spi_master *master,
++ struct spi_device *spi,
++ struct spi_transfer *tfr,
++ u32 cs,
++ unsigned long xfer_time_us)
++{
++ struct bcm2835_spi *bs = spi_master_get_devdata(master);
++ unsigned long timeout;
++
++ /* enable HW block without interrupts */
++ bcm2835_wr(bs, BCM2835_SPI_CS, cs | BCM2835_SPI_CS_TA);
++
++ /* fill in the fifo before timeout calculations
++ * if we are interrupted here, then the data is
++ * getting transferred by the HW while we are interrupted
++ */
++ bcm2835_wr_fifo(bs);
++
++ /* set the timeout */
++ timeout = jiffies + BCM2835_SPI_POLLING_JIFFIES;
++
++ /* loop until finished the transfer */
++ while (bs->rx_len) {
++ /* fill in tx fifo with remaining data */
++ bcm2835_wr_fifo(bs);
++
++ /* read from fifo as much as possible */
++ bcm2835_rd_fifo(bs);
++
++ /* if there is still data pending to read
++ * then check the timeout
++ */
++ if (bs->rx_len && time_after(jiffies, timeout)) {
++ dev_dbg_ratelimited(&spi->dev,
++ "timeout period reached: jiffies: %lu remaining tx/rx: %d/%d - falling back to interrupt mode\n",
++ jiffies - timeout,
++ bs->tx_len, bs->rx_len);
++ /* fall back to interrupt mode */
++ return bcm2835_spi_transfer_one_irq(master, spi,
++ tfr, cs);
++ }
++ }
++
++ /* Transfer complete - reset SPI HW */
++ bcm2835_spi_reset_hw(master);
++ /* and return without waiting for completion */
++ return 0;
++}
++
+ static int bcm2835_spi_transfer_one(struct spi_master *master,
+ struct spi_device *spi,
+ struct spi_transfer *tfr)
+@@ -288,12 +584,26 @@
+ return bcm2835_spi_transfer_one_poll(master, spi, tfr,
+ cs, xfer_time_us);
+
++ /* run in dma mode if conditions are right */
++ if (master->can_dma && bcm2835_spi_can_dma(master, spi, tfr))
++ return bcm2835_spi_transfer_one_dma(master, spi, tfr, cs);
++
++ /* run in interrupt-mode */
+ return bcm2835_spi_transfer_one_irq(master, spi, tfr, cs);
+ }
+
+ static void bcm2835_spi_handle_err(struct spi_master *master,
+ struct spi_message *msg)
+ {
++ struct bcm2835_spi *bs = spi_master_get_devdata(master);
++
++ /* if an error occurred and we have an active dma, then terminate */
++ if (bs->dma_pending) {
++ dmaengine_terminate_all(master->dma_tx);
++ dmaengine_terminate_all(master->dma_rx);
++ bs->dma_pending = 0;
++ }
++ /* and reset */
+ bcm2835_spi_reset_hw(master);
+ }
+
+@@ -359,6 +669,8 @@
{
int err;
struct gpio_chip *chip;
@@ -224598,7 +233073,7 @@ diff -Nur linux-4.1.3/drivers/spi/spi-bcm2835.c linux-xbian-rpi/drivers/spi/spi-
/*
* sanity checking the native-chipselects
*/
-@@ -375,15 +377,42 @@
+@@ -375,15 +687,42 @@
"setup: only two native chip-selects are supported\n");
return -EINVAL;
}
@@ -224648,9 +233123,27 @@ diff -Nur linux-4.1.3/drivers/spi/spi-bcm2835.c linux-xbian-rpi/drivers/spi/spi-
/* and set up the "mode" and level */
dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n",
-diff -Nur linux-4.1.3/drivers/spi/spidev.c linux-xbian-rpi/drivers/spi/spidev.c
---- linux-4.1.3/drivers/spi/spidev.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/spi/spidev.c 2015-07-28 01:20:58.437184915 +0200
+@@ -463,6 +802,8 @@
+ goto out_clk_disable;
+ }
+
++ bcm2835_dma_init(master, &pdev->dev);
++
+ /* initialise the hardware with the default polarities */
+ bcm2835_wr(bs, BCM2835_SPI_CS,
+ BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
+@@ -493,6 +834,8 @@
+
+ clk_disable_unprepare(bs->clk);
+
++ bcm2835_dma_release(master);
++
+ return 0;
+ }
+
+diff -Nur linux-4.1.6/drivers/spi/spidev.c linux-rpi/drivers/spi/spidev.c
+--- linux-4.1.6/drivers/spi/spidev.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/spi/spidev.c 2015-08-26 10:26:09.077320829 +0200
@@ -706,6 +706,7 @@
#ifdef CONFIG_OF
static const struct of_device_id spidev_dt_ids[] = {
@@ -224659,153 +233152,25 @@ diff -Nur linux-4.1.3/drivers/spi/spidev.c linux-xbian-rpi/drivers/spi/spidev.c
{},
};
MODULE_DEVICE_TABLE(of, spidev_dt_ids);
-diff -Nur linux-4.1.3/drivers/staging/media/lirc/kcompat.h linux-xbian-rpi/drivers/staging/media/lirc/kcompat.h
---- linux-4.1.3/drivers/staging/media/lirc/kcompat.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/staging/media/lirc/kcompat.h 2015-07-28 01:20:58.437184915 +0200
-@@ -0,0 +1,139 @@
-+/*
-+ * Support header for building lirc drivers on kernels older than the
-+ * latest upstream kernel. As of this update, 2.6.18 is the oldest
-+ * kernel officially supported any longer. For older kernels, just
-+ * rewind the scm history a ways. We can't hope to significantly improve
-+ * things if we have to support crusty old kernels only a tiny minority
-+ * of people still run, some of these source files are/were really nasty
-+ * and hard to follow due to the proliferation of #if LINUX_VERSION_CODE
-+ * bits...
-+ */
-+
-+#ifndef _KCOMPAT_H
-+#define _KCOMPAT_H
-+
-+#include <linux/version.h>
-+
-+#ifndef __func__
-+#define __func__ __FUNCTION__
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
-+#define usb_alloc_coherent usb_buffer_alloc
-+#define usb_free_coherent usb_buffer_free
-+#endif
-+
-+#define LIRC_THIS_MODULE(x)
-+
-+#include <linux/device.h>
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
-+
-+#define lirc_device_create(cs, parent, dev, drvdata, fmt, args...) \
-+ class_device_create(cs, NULL, dev, parent, fmt, ## args)
-+
-+#else /* >= 2.6.26 */
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
-+
-+#define lirc_device_create(cs, parent, dev, drvdata, fmt, args...) \
-+ device_create(cs, parent, dev, fmt, ## args)
-+
-+#else /* >= 2.6.27 */
-+
-+#define lirc_device_create device_create
-+
-+#endif /* >= 2.6.27 */
-+
-+#endif /* >= 2.6.26 */
-+
-+#define LIRC_DEVFS_PREFIX
-+
-+typedef struct class lirc_class_t;
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
-+
-+#define lirc_device_destroy class_device_destroy
-+
-+#else
-+
-+#define lirc_device_destroy device_destroy
-+
-+#endif
-+
-+#ifndef LIRC_DEVFS_PREFIX
-+#define LIRC_DEVFS_PREFIX "usb/"
-+#endif
-+
-+#include <linux/moduleparam.h>
-+
-+#include <linux/interrupt.h>
-+#ifndef IRQ_RETVAL
-+typedef void irqreturn_t;
-+#define IRQ_NONE
-+#define IRQ_HANDLED
-+#define IRQ_RETVAL(x)
-+#endif
-+
-+#ifndef MOD_IN_USE
-+#ifdef CONFIG_MODULE_UNLOAD
-+#define MOD_IN_USE module_refcount(THIS_MODULE)
-+#else
-+#error "LIRC modules currently require"
-+#error " 'Loadable module support ---> Module unloading'"
-+#error "to be enabled in the kernel"
-+#endif
-+#endif
-+
-+/*************************** I2C specific *****************************/
-+#include <linux/i2c.h>
-+
-+/* removed in 2.6.14 */
-+#ifndef I2C_ALGO_BIT
-+# define I2C_ALGO_BIT 0
-+#endif
-+
-+/* removed in 2.6.16 */
-+#ifndef I2C_DRIVERID_EXP3
-+# define I2C_DRIVERID_EXP3 0xf003
-+#endif
-+
-+/*************************** USB specific *****************************/
-+#include <linux/usb.h>
-+
-+/* removed in 2.6.14 */
-+#ifndef URB_ASYNC_UNLINK
-+#define URB_ASYNC_UNLINK 0
-+#endif
-+
-+/*************************** pm_wakeup.h ******************************/
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
-+static inline void device_set_wakeup_capable(struct device *dev, int val) {}
-+#endif /* kernel < 2.6.27 */
-+
-+/*************************** interrupt.h ******************************/
-+/* added in 2.6.18, old defines removed in 2.6.24 */
-+#ifndef IRQF_DISABLED
-+#define IRQF_DISABLED SA_INTERRUPT
-+#endif
-+#ifndef IRQF_SHARED
-+#define IRQF_SHARED SA_SHIRQ
-+#endif
-+
-+/****************************** bitops.h **********************************/
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
-+#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
-+#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-+#endif
-+
-+/****************************** kernel.h **********************************/
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
-+#define DIV_ROUND_CLOSEST(x, divisor)( \
-+{ \
-+ typeof(divisor) __divisor = divisor; \
-+ (((x) + ((__divisor) / 2)) / (__divisor)); \
-+} \
-+)
-+#endif
+diff -Nur linux-4.1.6/drivers/staging/fbtft/fbtft-core.c linux-rpi/drivers/staging/fbtft/fbtft-core.c
+--- linux-4.1.6/drivers/staging/fbtft/fbtft-core.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/staging/fbtft/fbtft-core.c 2015-08-26 10:26:09.109321272 +0200
+@@ -1074,6 +1074,11 @@
+ p = of_prop_next_u32(prop, NULL, &val);
+ if (!p)
+ return -EINVAL;
+
-+#endif /* _KCOMPAT_H */
-diff -Nur linux-4.1.3/drivers/staging/media/lirc/Kconfig linux-xbian-rpi/drivers/staging/media/lirc/Kconfig
---- linux-4.1.3/drivers/staging/media/lirc/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/staging/media/lirc/Kconfig 2015-07-28 01:20:58.437184915 +0200
-@@ -32,6 +32,18 @@
++ par->fbtftops.reset(par);
++ if (par->gpio.cs != -1)
++ gpio_set_value(par->gpio.cs, 0); /* Activate chip */
++
+ while (p) {
+ if (val & FBTFT_OF_INIT_CMD) {
+ val &= 0xFFFF;
+diff -Nur linux-4.1.6/drivers/staging/media/lirc/Kconfig linux-rpi/drivers/staging/media/lirc/Kconfig
+--- linux-4.1.6/drivers/staging/media/lirc/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/staging/media/lirc/Kconfig 2015-08-26 10:26:09.169322103 +0200
+@@ -32,6 +32,12 @@
help
Driver for Homebrew Parallel Port Receivers
@@ -224815,18 +233180,23 @@ diff -Nur linux-4.1.3/drivers/staging/media/lirc/Kconfig linux-xbian-rpi/drivers
+ help
+ Driver for Homebrew GPIO Port Receiver/Transmitter for the RaspberryPi
+
-+config LIRC_XBOX
-+ tristate "Homebrew XBOX Receiver for the RaspberryPi"
-+ depends on LIRC
-+ help
-+ Homebrew XBOX Receiver for the RaspberryPi
-+
config LIRC_SASEM
tristate "Sasem USB IR Remote"
depends on LIRC && USB
-diff -Nur linux-4.1.3/drivers/staging/media/lirc/lirc_rpi.c linux-xbian-rpi/drivers/staging/media/lirc/lirc_rpi.c
---- linux-4.1.3/drivers/staging/media/lirc/lirc_rpi.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/staging/media/lirc/lirc_rpi.c 2015-07-28 01:20:58.437184915 +0200
+diff -Nur linux-4.1.6/drivers/staging/media/lirc/Makefile linux-rpi/drivers/staging/media/lirc/Makefile
+--- linux-4.1.6/drivers/staging/media/lirc/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/staging/media/lirc/Makefile 2015-08-26 10:26:09.169322103 +0200
+@@ -6,6 +6,7 @@
+ obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o
+ obj-$(CONFIG_LIRC_IMON) += lirc_imon.o
+ obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o
++obj-$(CONFIG_LIRC_RPI) += lirc_rpi.o
+ obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o
+ obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o
+ obj-$(CONFIG_LIRC_SIR) += lirc_sir.o
+diff -Nur linux-4.1.6/drivers/staging/media/lirc/lirc_rpi.c linux-rpi/drivers/staging/media/lirc/lirc_rpi.c
+--- linux-4.1.6/drivers/staging/media/lirc/lirc_rpi.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/staging/media/lirc/lirc_rpi.c 2015-08-26 10:26:09.169322103 +0200
@@ -0,0 +1,765 @@
+/*
+ * lirc_rpi.c
@@ -225593,1018 +233963,37 @@ diff -Nur linux-4.1.3/drivers/staging/media/lirc/lirc_rpi.c linux-xbian-rpi/driv
+
+module_param(debug, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(debug, "Enable debugging messages");
-diff -Nur linux-4.1.3/drivers/staging/media/lirc/lirc_xbox.c linux-xbian-rpi/drivers/staging/media/lirc/lirc_xbox.c
---- linux-4.1.3/drivers/staging/media/lirc/lirc_xbox.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/staging/media/lirc/lirc_xbox.c 2015-07-28 01:20:58.437184915 +0200
-@@ -0,0 +1,993 @@
-+/*
-+ * lirc_xbox - USB remote support for LIRC
-+ * (supports Microsoft XBOX DVD Dongle)
-+ *
-+ * Copyright (C) 2003-2004 Paul Miller <pmiller9@users.sourceforge.net>
-+ *
-+ * This driver was derived from:
-+ * Vladimir Dergachev <volodya@minspring.com>'s 2002
-+ * "USB ATI Remote support" (input device)
-+ * Adrian Dewhurst <sailor-lk@sailorfrag.net>'s 2002
-+ * "USB StreamZap remote driver" (LIRC)
-+ * Artur Lipowski <alipowski@kki.net.pl>'s 2002
-+ * "lirc_dev" and "lirc_gpio" LIRC modules
-+ * Michael Wojciechowski
-+ * initial xbox support
-+ * Vassilis Virvilis <vasvir@iit.demokritos.gr> 2006
-+ * reworked the patch for lirc submission
-+ * Paul Miller's <pmiller9@users.sourceforge.net> 2004
-+ * lirc_atiusb - removed all ati remote support
-+ * $Id: lirc_xbox.c,v 1.88 2011/06/03 11:11:11 jmartin Exp $
-+ */
-+
-+/*
-+ * 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
-+ */
-+
-+#include <linux/version.h>
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
-+#include <linux/autoconf.h>
-+#endif
-+
-+#include <linux/kernel.h>
-+#include <linux/errno.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include <linux/kmod.h>
-+//#include <linux/smp_lock.h>
-+#include <linux/completion.h>
-+#include <linux/uaccess.h>
-+#include <linux/usb.h>
-+#include <linux/poll.h>
-+#include <linux/wait.h>
-+#include <linux/list.h>
-+
-+#include "kcompat.h"
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
-+#include <media/lirc.h>
-+#include <media/lirc_dev.h>
-+#else
-+#include "drivers/lirc.h"
-+#include "drivers/lirc_dev/lirc_dev.h"
-+#endif
-+
-+#define DRIVER_VERSION "$Revision: 0.01 $"
-+#define DRIVER_AUTHOR "Jason Martin <austinspartan@users.sourceforge.net>"
-+#define DRIVER_DESC "XBOX DVD Dongle USB remote driver for LIRC"
-+#define DRIVER_NAME "lirc_xbox"
-+
-+#define CODE_LENGTH 6
-+#define CODE_MIN_LENGTH 6
-+#define DECODE_LENGTH 1
-+
-+/* module parameters */
-+#ifdef CONFIG_USB_DEBUG
-+static int debug = 1;
-+#else
-+static int debug;
-+#endif
-+
-+#define dprintk(fmt, args...) \
-+ do { \
-+ if (debug) \
-+ printk(KERN_DEBUG fmt, ## args); \
-+ } while (0)
-+
-+/*
-+ * USB_BUFF_LEN must be the maximum value of the code_length array.
-+ * It is used for static arrays.
-+ */
-+#define USB_BUFF_LEN 6
-+
-+static int mask = 0xFFFF; /* channel acceptance bit mask */
-+static int unique; /* enable channel-specific codes */
-+static int repeat = 10; /* repeat time in 1/100 sec */
-+static unsigned long repeat_jiffies; /* repeat timeout */
-+
-+/* get hi and low bytes of a 16-bits int */
-+#define HI(a) ((unsigned char)((a) >> 8))
-+#define LO(a) ((unsigned char)((a) & 0xff))
-+
-+/* general constants */
-+#define SEND_FLAG_IN_PROGRESS 1
-+#define SEND_FLAG_COMPLETE 2
-+#define FREE_ALL 0xFF
-+
-+/* endpoints */
-+#define EP_KEYS 0
-+#define EP_MOUSE 1
-+#define EP_MOUSE_ADDR 0x81
-+#define EP_KEYS_ADDR 0x82
-+
-+/* USB vendor ids for XBOX DVD Dongles */
-+#define VENDOR_MS1 0x040b
-+#define VENDOR_MS2 0x045e
-+#define VENDOR_MS3 0xFFFF
-+
-+static struct usb_device_id usb_remote_table[] = {
-+ /* Gamester Xbox DVD Movie Playback Kit IR */
-+ { USB_DEVICE(VENDOR_MS1, 0x6521) },
-+
-+ /* Microsoft Xbox DVD Movie Playback Kit IR */
-+ { USB_DEVICE(VENDOR_MS2, 0x0284) },
-+
-+ /*
-+ * Some Chinese manufacturer -- conflicts with the joystick from the
-+ * same manufacturer
-+ */
-+ { USB_DEVICE(VENDOR_MS3, 0xFFFF) },
-+
-+ /* Terminating entry */
-+ { }
-+};
-+
-+/* init strings */
-+#define USB_OUTLEN 7
-+
-+static char init1[] = {0x01, 0x00, 0x20, 0x14};
-+static char init2[] = {0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20};
-+
-+struct in_endpt {
-+ /* inner link in list of endpoints for the remote specified by ir */
-+ struct list_head iep_list_link;
-+ struct xbox_dev *ir;
-+ struct urb *urb;
-+ struct usb_endpoint_descriptor *ep;
-+
-+ /* buffers and dma */
-+ unsigned char *buf;
-+ unsigned int len;
-+ dma_addr_t dma;
-+
-+ /* handle repeats */
-+ unsigned char old[USB_BUFF_LEN];
-+ unsigned long old_jiffies;
-+};
-+
-+struct out_endpt {
-+ struct xbox_dev *ir;
-+ struct urb *urb;
-+ struct usb_endpoint_descriptor *ep;
-+
-+ /* buffers and dma */
-+ unsigned char *buf;
-+ dma_addr_t dma;
-+
-+ /* handle sending (init strings) */
-+ int send_flags;
-+ wait_queue_head_t wait;
-+};
-+
-+
-+/* data structure for each usb remote */
-+struct xbox_dev {
-+ /* inner link in list of all remotes managed by this module */
-+ struct list_head remote_list_link;
-+ /* Number of usb interfaces associated with this device */
-+ int dev_refcount;
-+
-+ /* usb */
-+ struct usb_device *usbdev;
-+ /* Head link to list of all inbound endpoints in this remote */
-+ struct list_head iep_listhead;
-+ struct out_endpt *out_init;
-+ int devnum;
-+
-+ /* lirc */
-+ struct lirc_driver *d;
-+ int connected;
-+
-+ /* locking */
-+ struct mutex lock;
-+};
-+
-+/* list of all registered devices via the remote_list_link in xbox_dev */
-+static struct list_head remote_list;
-+
-+/*
-+ * Convenience macros to retrieve a pointer to the surrounding struct from
-+ * the given list_head reference within, pointed at by link.
-+ */
-+#define get_iep_from_link(link) \
-+ list_entry((link), struct in_endpt, iep_list_link);
-+#define get_irctl_from_link(link) \
-+ list_entry((link), struct xbox_dev, remote_list_link);
-+
-+/* send packet - used to initialize remote */
-+static void send_packet(struct out_endpt *oep, u16 cmd, unsigned char *data)
-+{
-+ struct xbox_dev *ir = oep->ir;
-+ DECLARE_WAITQUEUE(wait, current);
-+ int timeout = HZ; /* 1 second */
-+ unsigned char buf[USB_OUTLEN];
-+
-+ dprintk(DRIVER_NAME "[%d]: send called (%#x)\n", ir->devnum, cmd);
-+
-+ mutex_lock(&ir->lock);
-+ oep->urb->transfer_buffer_length = LO(cmd) + 1;
-+ oep->urb->dev = oep->ir->usbdev;
-+ oep->send_flags = SEND_FLAG_IN_PROGRESS;
-+
-+ memcpy(buf+1, data, LO(cmd));
-+ buf[0] = HI(cmd);
-+ memcpy(oep->buf, buf, LO(cmd)+1);
-+
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ add_wait_queue(&oep->wait, &wait);
-+
-+ if (usb_submit_urb(oep->urb, GFP_ATOMIC)) {
-+ set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&oep->wait, &wait);
-+ mutex_unlock(&ir->lock);
-+ return;
-+ }
-+ mutex_unlock(&ir->lock);
-+
-+ while (timeout && (oep->urb->status == -EINPROGRESS)
-+ && !(oep->send_flags & SEND_FLAG_COMPLETE)) {
-+ timeout = schedule_timeout(timeout);
-+ rmb();
-+ }
-+
-+ dprintk(DRIVER_NAME "[%d]: send complete (%#x)\n", ir->devnum, cmd);
-+
-+ set_current_state(TASK_RUNNING);
-+ remove_wait_queue(&oep->wait, &wait);
-+ oep->urb->transfer_flags |= URB_ASYNC_UNLINK;
-+ usb_unlink_urb(oep->urb);
-+}
-+
-+static int unregister_from_lirc(struct xbox_dev *ir)
-+{
-+ struct lirc_driver *d = ir->d;
-+ int devnum;
-+
-+ devnum = ir->devnum;
-+ dprintk(DRIVER_NAME "[%d]: unregister from lirc called\n", devnum);
-+
-+ lirc_unregister_driver(d->minor);
-+
-+ printk(DRIVER_NAME "[%d]: usb remote disconnected\n", devnum);
-+ return 0;
-+}
-+
-+static int set_use_inc(void *data)
-+{
-+ struct xbox_dev *ir = data;
-+ struct list_head *pos, *n;
-+ struct in_endpt *iep;
-+ int rtn;
-+
-+ if (!ir) {
-+ printk(DRIVER_NAME "[?]: set_use_inc called with no context\n");
-+ return -EIO;
-+ }
-+ dprintk(DRIVER_NAME "[%d]: set use inc\n", ir->devnum);
-+
-+ mutex_lock(&ir->lock);
-+ if (!ir->connected) {
-+ if (!ir->usbdev) {
-+ mutex_unlock(&ir->lock);
-+ dprintk(DRIVER_NAME "[%d]: !ir->usbdev\n", ir->devnum);
-+ return -ENOENT;
-+ }
-+
-+ /* Iterate through the inbound endpoints */
-+ list_for_each_safe(pos, n, &ir->iep_listhead) {
-+ /* extract the current in_endpt */
-+ iep = get_iep_from_link(pos);
-+ iep->urb->dev = ir->usbdev;
-+ dprintk(DRIVER_NAME "[%d]: linking iep 0x%02x (%p)\n",
-+ ir->devnum, iep->ep->bEndpointAddress, iep);
-+ rtn = usb_submit_urb(iep->urb, GFP_ATOMIC);
-+ if (rtn) {
-+ printk(DRIVER_NAME "[%d]: open result = %d "
-+ "error submitting urb\n",
-+ ir->devnum, rtn);
-+ mutex_unlock(&ir->lock);
-+ return -EIO;
-+ }
-+ }
-+ ir->connected = 1;
-+ }
-+ mutex_unlock(&ir->lock);
-+
-+ return 0;
-+}
-+
-+static void set_use_dec(void *data)
-+{
-+ struct xbox_dev *ir = data;
-+ struct list_head *pos, *n;
-+ struct in_endpt *iep;
-+
-+ if (!ir) {
-+ printk(DRIVER_NAME "[?]: set_use_dec called with no context\n");
-+ return;
-+ }
-+ dprintk(DRIVER_NAME "[%d]: set use dec\n", ir->devnum);
-+
-+ mutex_lock(&ir->lock);
-+ if (ir->connected) {
-+ /* Free inbound usb urbs */
-+ list_for_each_safe(pos, n, &ir->iep_listhead) {
-+ iep = get_iep_from_link(pos);
-+ dprintk(DRIVER_NAME "[%d]: unlinking iep 0x%02x (%p)\n",
-+ ir->devnum, iep->ep->bEndpointAddress, iep);
-+ usb_kill_urb(iep->urb);
-+ }
-+ ir->connected = 0;
-+ }
-+ mutex_unlock(&ir->lock);
-+}
-+
-+static void print_data(struct in_endpt *iep, char *buf, int len)
-+{
-+ const int clen = CODE_LENGTH;
-+ char codes[clen * 3 + 1];
-+ int i;
-+
-+ if (len <= 0)
-+ return;
-+
-+ for (i = 0; i < len && i < clen; i++)
-+ snprintf(codes+i*3, 4, "%02x ", buf[i] & 0xFF);
-+ printk(DRIVER_NAME "[%d]: data received %s (ep=0x%x length=%d)\n",
-+ iep->ir->devnum, codes, iep->ep->bEndpointAddress, len);
-+}
-+
-+static int code_check_xbox(struct in_endpt *iep, int len)
-+{
-+ // struct xbox_dev *ir = iep->ir;
-+ const int clen = CODE_LENGTH;
-+
-+ if (len != clen) {
-+ dprintk(DRIVER_NAME ": We got %d instead of %d bytes from xbox "
-+ "ir.. ?\n", len, clen);
-+ return -1;
-+ }
-+
-+ /* check for repeats */
-+ if (memcmp(iep->old, iep->buf, len) == 0) {
-+ if (iep->old_jiffies + repeat_jiffies > jiffies)
-+ return -1;
-+ } else {
-+ /*
-+ * the third byte of xbox ir packet seems to contain key info
-+ * the last two bytes are.. some kind of clock?
-+ */
-+ iep->buf[0] = iep->buf[2];
-+ memset(iep->buf + 1, 0, len - 1);
-+ memcpy(iep->old, iep->buf, len);
-+ }
-+ iep->old_jiffies = jiffies;
-+
-+ return 0;
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
-+static void usb_remote_recv(struct urb *urb, struct pt_regs *regs)
-+#else
-+static void usb_remote_recv(struct urb *urb)
-+#endif
-+{
-+ struct in_endpt *iep;
-+ int len, result = -1;
-+
-+ if (!urb)
-+ return;
-+ iep = urb->context;
-+ if (!iep) {
-+ urb->transfer_flags |= URB_ASYNC_UNLINK;
-+ usb_unlink_urb(urb);
-+ return;
-+ }
-+ if (!iep->ir->usbdev)
-+ return;
-+
-+ len = urb->actual_length;
-+ if (debug)
-+ print_data(iep, urb->transfer_buffer, len);
-+
-+ switch (urb->status) {
-+
-+ case 0:
-+ result = code_check_xbox(iep, len);
-+
-+ if (result < 0)
-+ break;
-+
-+ lirc_buffer_write(iep->ir->d->rbuf, iep->buf);
-+ wake_up(&iep->ir->d->rbuf->wait_poll);
-+ break;
-+
-+ case -ECONNRESET:
-+ case -ENOENT:
-+ case -ESHUTDOWN:
-+ urb->transfer_flags |= URB_ASYNC_UNLINK;
-+ usb_unlink_urb(urb);
-+ return;
-+
-+ case -EPIPE:
-+ default:
-+ break;
-+ }
-+
-+ usb_submit_urb(urb, GFP_ATOMIC);
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
-+static void usb_remote_send(struct urb *urb, struct pt_regs *regs)
-+#else
-+static void usb_remote_send(struct urb *urb)
-+#endif
-+{
-+ struct out_endpt *oep;
-+
-+ if (!urb)
-+ return;
-+ oep = urb->context;
-+ if (!oep) {
-+ urb->transfer_flags |= URB_ASYNC_UNLINK;
-+ usb_unlink_urb(urb);
-+ return;
-+ }
-+ if (!oep->ir->usbdev)
-+ return;
-+
-+ dprintk(DRIVER_NAME "[%d]: usb out called\n", oep->ir->devnum);
-+
-+ if (urb->status)
-+ return;
-+
-+ oep->send_flags |= SEND_FLAG_COMPLETE;
-+ wmb();
-+ if (waitqueue_active(&oep->wait))
-+ wake_up(&oep->wait);
-+}
-+
-+
-+/*
-+ * Initialization and removal
-+ */
-+
-+/*
-+ * Free iep according to mem_failure which specifies a checkpoint into the
-+ * initialization sequence for rollback recovery.
-+ */
-+static void free_in_endpt(struct in_endpt *iep, int mem_failure)
-+{
-+ struct xbox_dev *ir;
-+ dprintk(DRIVER_NAME ": free_in_endpt(%p, %d)\n", iep, mem_failure);
-+ if (!iep)
-+ return;
-+
-+ ir = iep->ir;
-+ if (!ir) {
-+ dprintk(DRIVER_NAME ": free_in_endpt: WARNING! null ir\n");
-+ return;
-+ }
-+ mutex_lock(&ir->lock);
-+ switch (mem_failure) {
-+ case FREE_ALL:
-+ case 5:
-+ list_del(&iep->iep_list_link);
-+ dprintk(DRIVER_NAME "[%d]: free_in_endpt removing ep=0x%0x "
-+ "from list\n", ir->devnum, iep->ep->bEndpointAddress);
-+ case 4:
-+ if (iep->urb) {
-+ iep->urb->transfer_flags |= URB_ASYNC_UNLINK;
-+ usb_unlink_urb(iep->urb);
-+ usb_free_urb(iep->urb);
-+ iep->urb = 0;
-+ } else
-+ dprintk(DRIVER_NAME "[%d]: free_in_endpt null urb!\n",
-+ ir->devnum);
-+ case 3:
-+ usb_free_coherent(iep->ir->usbdev, iep->len, iep->buf, iep->dma);
-+ iep->buf = 0;
-+ case 2:
-+ kfree(iep);
-+ }
-+ mutex_unlock(&ir->lock);
-+}
-+
-+/*
-+ * Construct a new inbound endpoint for this remote, and add it to the list of
-+ * in_epts in ir.
-+ */
-+static struct in_endpt *new_in_endpt(struct xbox_dev *ir,
-+ struct usb_endpoint_descriptor *ep)
-+{
-+ struct usb_device *dev = ir->usbdev;
-+ struct in_endpt *iep;
-+ int pipe, maxp, len, addr;
-+ int mem_failure;
-+
-+ addr = ep->bEndpointAddress;
-+ pipe = usb_rcvintpipe(dev, addr);
-+ maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
-+
-+/* len = (maxp > USB_BUFLEN) ? USB_BUFLEN : maxp;
-+ * len -= (len % CODE_LENGTH); */
-+ len = CODE_LENGTH;
-+
-+ dprintk(DRIVER_NAME "[%d]: acceptable inbound endpoint (0x%x) found "
-+ "(maxp=%d len=%d)\n", ir->devnum, addr, maxp, len);
-+
-+ mem_failure = 0;
-+ iep = kzalloc(sizeof(*iep), GFP_KERNEL);
-+ if (!iep) {
-+ mem_failure = 1;
-+ goto new_in_endpt_failure_check;
-+ }
-+ iep->ir = ir;
-+ iep->ep = ep;
-+ iep->len = len;
-+
-+ iep->buf = usb_alloc_coherent(dev, len, GFP_ATOMIC, &iep->dma);
-+ if (!iep->buf) {
-+ mem_failure = 2;
-+ goto new_in_endpt_failure_check;
-+ }
-+
-+ iep->urb = usb_alloc_urb(0, GFP_KERNEL);
-+ if (!iep->urb)
-+ mem_failure = 3;
-+
-+new_in_endpt_failure_check:
-+
-+ if (mem_failure) {
-+ free_in_endpt(iep, mem_failure);
-+ printk(DRIVER_NAME "[%d]: ep=0x%x out of memory (code=%d)\n",
-+ ir->devnum, addr, mem_failure);
-+ return NULL;
-+ }
-+ list_add_tail(&iep->iep_list_link, &ir->iep_listhead);
-+ dprintk(DRIVER_NAME "[%d]: adding ep=0x%0x to list\n",
-+ ir->devnum, iep->ep->bEndpointAddress);
-+ return iep;
-+}
-+
-+static void free_out_endpt(struct out_endpt *oep, int mem_failure)
-+{
-+ struct xbox_dev *ir;
-+ dprintk(DRIVER_NAME ": free_out_endpt(%p, %d)\n", oep, mem_failure);
-+ if (!oep)
-+ return;
-+
-+ wake_up_all(&oep->wait);
-+
-+ ir = oep->ir;
-+ if (!ir) {
-+ dprintk(DRIVER_NAME ": free_out_endpt: WARNING! null ir\n");
-+ return;
-+ }
-+ mutex_lock(&ir->lock);
-+ switch (mem_failure) {
-+ case FREE_ALL:
-+ case 4:
-+ if (oep->urb) {
-+ oep->urb->transfer_flags |= URB_ASYNC_UNLINK;
-+ usb_unlink_urb(oep->urb);
-+ usb_free_urb(oep->urb);
-+ oep->urb = 0;
-+ } else {
-+ dprintk(DRIVER_NAME "[%d]: free_out_endpt: null urb!\n",
-+ ir->devnum);
-+ }
-+ case 3:
-+ usb_free_coherent(oep->ir->usbdev, USB_OUTLEN,
-+ oep->buf, oep->dma);
-+ oep->buf = 0;
-+ case 2:
-+ kfree(oep);
-+ }
-+ mutex_unlock(&ir->lock);
-+}
-+
-+static struct out_endpt *new_out_endpt(struct xbox_dev *ir,
-+ struct usb_endpoint_descriptor *ep)
-+{
-+ struct usb_device *dev = ir->usbdev;
-+ struct out_endpt *oep;
-+ int mem_failure;
-+
-+ dprintk(DRIVER_NAME "[%d]: acceptable outbound endpoint (0x%x) found\n",
-+ ir->devnum, ep->bEndpointAddress);
-+
-+ mem_failure = 0;
-+ oep = kzalloc(sizeof(*oep), GFP_KERNEL);
-+ if (!oep)
-+ mem_failure = 1;
-+ else {
-+ oep->ir = ir;
-+ oep->ep = ep;
-+ init_waitqueue_head(&oep->wait);
-+
-+ oep->buf = usb_alloc_coherent(dev, USB_OUTLEN,
-+ GFP_ATOMIC, &oep->dma);
-+ if (!oep->buf)
-+ mem_failure = 2;
-+ else {
-+ oep->urb = usb_alloc_urb(0, GFP_KERNEL);
-+ if (!oep->urb)
-+ mem_failure = 3;
-+ }
-+ }
-+ if (mem_failure) {
-+ free_out_endpt(oep, mem_failure);
-+ printk(DRIVER_NAME "[%d]: ep=0x%x out of memory (code=%d)\n",
-+ ir->devnum, ep->bEndpointAddress, mem_failure);
-+ return NULL;
-+ }
-+ return oep;
-+}
-+
-+static void free_irctl(struct xbox_dev *ir, int mem_failure)
-+{
-+ struct list_head *pos, *n;
-+ struct in_endpt *in;
-+ dprintk(DRIVER_NAME ": free_irctl(%p, %d)\n", ir, mem_failure);
-+
-+ if (!ir)
-+ return;
-+
-+ list_for_each_safe(pos, n, &ir->iep_listhead) {
-+ in = get_iep_from_link(pos);
-+ free_in_endpt(in, FREE_ALL);
-+ }
-+ if (ir->out_init) {
-+ free_out_endpt(ir->out_init, FREE_ALL);
-+ ir->out_init = NULL;
-+ }
-+
-+ mutex_lock(&ir->lock);
-+ switch (mem_failure) {
-+ case FREE_ALL:
-+ case 6:
-+ if (!--ir->dev_refcount) {
-+ list_del(&ir->remote_list_link);
-+ dprintk(DRIVER_NAME "[%d]: free_irctl: removing "
-+ "remote from list\n", ir->devnum);
-+ } else {
-+ dprintk(DRIVER_NAME "[%d]: free_irctl: refcount at %d,"
-+ "aborting free_irctl\n",
-+ ir->devnum, ir->dev_refcount);
-+ mutex_unlock(&ir->lock);
-+ return;
-+ }
-+ case 5:
-+ case 4:
-+ case 3:
-+ if (ir->d) {
-+ switch (mem_failure) {
-+ case 5:
-+ lirc_buffer_free(ir->d->rbuf);
-+ case 4:
-+ kfree(ir->d->rbuf);
-+ case 3:
-+ kfree(ir->d);
-+ }
-+ } else
-+ printk(DRIVER_NAME "[%d]: ir->d is a null pointer!\n",
-+ ir->devnum);
-+ case 2:
-+ mutex_unlock(&ir->lock);
-+ kfree(ir);
-+ return;
-+ }
-+ mutex_unlock(&ir->lock);
-+}
-+
-+static struct xbox_dev *new_irctl(struct usb_interface *intf)
-+{
-+ struct usb_device *dev = interface_to_usbdev(intf);
-+ struct xbox_dev *ir;
-+ struct lirc_driver *driver;
-+ int devnum, dclen;
-+ int mem_failure;
-+
-+ devnum = dev->devnum;
-+
-+ dprintk(DRIVER_NAME "[%d]: remote type = XBOX DVD Dongle\n", devnum);
-+
-+ mem_failure = 0;
-+ ir = kzalloc(sizeof(*ir), GFP_KERNEL);
-+ if (!ir) {
-+ mem_failure = 1;
-+ goto new_irctl_failure_check;
-+ }
-+
-+ dclen = DECODE_LENGTH;
-+
-+ /*
-+ * add this infrared remote struct to remote_list, keeping track
-+ * of the number of drivers registered.
-+ */
-+ dprintk(DRIVER_NAME "[%d]: adding remote to list\n", devnum);
-+ list_add_tail(&ir->remote_list_link, &remote_list);
-+ ir->dev_refcount = 1;
-+
-+ driver = kzalloc(sizeof(*driver), GFP_KERNEL);
-+ if (!driver) {
-+ mem_failure = 2;
-+ goto new_irctl_failure_check;
-+ }
-+
-+ ir->d = driver;
-+ driver->rbuf = kmalloc(sizeof(*(driver->rbuf)), GFP_KERNEL);
-+ if (!driver->rbuf) {
-+ mem_failure = 3;
-+ goto new_irctl_failure_check;
-+ }
-+
-+ if (lirc_buffer_init(driver->rbuf, dclen, 2)) {
-+ mem_failure = 4;
-+ goto new_irctl_failure_check;
-+ }
-+
-+ strcpy(driver->name, DRIVER_NAME " ");
-+ driver->minor = -1;
-+ driver->code_length = dclen * 8;
-+ driver->features = LIRC_CAN_REC_LIRCCODE;
-+ driver->data = ir;
-+ driver->set_use_inc = &set_use_inc;
-+ driver->set_use_dec = &set_use_dec;
-+ driver->dev = &intf->dev;
-+ driver->owner = THIS_MODULE;
-+ ir->usbdev = dev;
-+ ir->devnum = devnum;
-+
-+ mutex_init(&ir->lock);
-+ INIT_LIST_HEAD(&ir->iep_listhead);
-+
-+new_irctl_failure_check:
-+
-+ if (mem_failure) {
-+ free_irctl(ir, mem_failure);
-+ printk(DRIVER_NAME "[%d]: out of memory (code=%d)\n",
-+ devnum, mem_failure);
-+ return NULL;
-+ }
-+ return ir;
-+}
-+
-+/*
-+ * Scan the global list of remotes to see if the device listed is one of them.
-+ * If it is, the corresponding xbox_dev is returned, with its dev_refcount
-+ * incremented. Otherwise, returns null.
-+ */
-+static struct xbox_dev *get_prior_reg_ir(struct usb_device *dev)
-+{
-+ struct list_head *pos;
-+ struct xbox_dev *ir = NULL;
-+
-+ dprintk(DRIVER_NAME "[%d]: scanning remote_list...\n", dev->devnum);
-+ list_for_each(pos, &remote_list) {
-+ ir = get_irctl_from_link(pos);
-+ if (ir->usbdev != dev) {
-+ dprintk(DRIVER_NAME "[%d]: device %d isn't it...",
-+ dev->devnum, ir->devnum);
-+ ir = NULL;
-+ } else {
-+ dprintk(DRIVER_NAME "[%d]: prior instance found.\n",
-+ dev->devnum);
-+ ir->dev_refcount++;
-+ break;
-+ }
-+ }
-+ return ir;
-+}
-+
-+/*
-+ * If the USB interface has an out endpoint for control.
-+ */
-+static void send_outbound_init(struct xbox_dev *ir)
-+{
-+ if (ir->out_init) {
-+ struct out_endpt *oep = ir->out_init;
-+ dprintk(DRIVER_NAME "[%d]: usb_remote_probe: initializing "
-+ "outbound ep\n", ir->devnum);
-+ usb_fill_int_urb(oep->urb, ir->usbdev,
-+ usb_sndintpipe(ir->usbdev, oep->ep->bEndpointAddress),
-+ oep->buf, USB_OUTLEN, usb_remote_send,
-+ oep, oep->ep->bInterval);
-+ oep->urb->transfer_dma = oep->dma;
-+ oep->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-+
-+ send_packet(oep, 0x8004, init1);
-+ send_packet(oep, 0x8007, init2);
-+ }
-+}
-+
-+/* Log driver and usb info */
-+static void log_usb_dev_info(struct usb_device *dev)
-+{
-+ char buf[63], name[128] = "";
-+
-+ if (dev->descriptor.iManufacturer
-+ && usb_string(dev, dev->descriptor.iManufacturer,
-+ buf, sizeof(buf)) > 0)
-+ strlcpy(name, buf, sizeof(name));
-+ if (dev->descriptor.iProduct
-+ && usb_string(dev, dev->descriptor.iProduct, buf, sizeof(buf)) > 0)
-+ snprintf(name + strlen(name), sizeof(name) - strlen(name),
-+ " %s", buf);
-+ printk(DRIVER_NAME "[%d]: %s on usb%d:%d\n", dev->devnum, name,
-+ dev->bus->busnum, dev->devnum);
-+}
-+
-+
-+static int usb_remote_probe(struct usb_interface *intf,
-+ const struct usb_device_id *id)
-+{
-+ struct usb_device *dev = interface_to_usbdev(intf);
-+ struct usb_host_interface *idesc;
-+ struct usb_endpoint_descriptor *ep;
-+ struct in_endpt *iep;
-+ struct xbox_dev *ir;
-+ int i;
-+
-+ dprintk(DRIVER_NAME "[%d]: usb_remote_probe: dev:%p, intf:%p, id:%p)\n",
-+ dev->devnum, dev, intf, id);
-+
-+ idesc = intf->cur_altsetting;
-+
-+ /* Check if a usb remote has already been registered for this device */
-+ ir = get_prior_reg_ir(dev);
-+
-+ if (!ir) {
-+ ir = new_irctl(intf);
-+ if (!ir)
-+ return -ENOMEM;
-+ }
-+
-+ /*
-+ * step through the endpoints to find first in and first out endpoint
-+ * of type interrupt transfer
-+ */
-+ for (i = 0; i < idesc->desc.bNumEndpoints; ++i) {
-+ ep = &idesc->endpoint[i].desc;
-+ dprintk(DRIVER_NAME "[%d]: processing endpoint %d\n",
-+ dev->devnum, i);
-+ if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ==
-+ USB_DIR_IN) &&
-+ ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-+ USB_ENDPOINT_XFER_INT)) {
-+
-+ iep = new_in_endpt(ir, ep);
-+ if (iep)
-+ {
-+ usb_fill_int_urb(iep->urb, dev,
-+ usb_rcvintpipe(dev,
-+ iep->ep->bEndpointAddress),
-+ iep->buf, iep->len, usb_remote_recv,
-+ iep, iep->ep->bInterval);
-+ iep->urb->transfer_dma = iep->dma;
-+ iep->urb->transfer_flags |=
-+ URB_NO_TRANSFER_DMA_MAP;
-+ }
-+ }
-+
-+ if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) ==
-+ USB_DIR_OUT) &&
-+ ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-+ USB_ENDPOINT_XFER_INT) &&
-+ (ir->out_init == NULL))
-+ ir->out_init = new_out_endpt(ir, ep);
-+ }
-+ if (list_empty(&ir->iep_listhead)) {
-+ printk(DRIVER_NAME "[%d]: inbound endpoint not found\n",
-+ ir->devnum);
-+ free_irctl(ir, FREE_ALL);
-+ return -ENODEV;
-+ }
-+ if (ir->dev_refcount == 1) {
-+ ir->d->minor = lirc_register_driver(ir->d);
-+ if (ir->d->minor < 0) {
-+ free_irctl(ir, FREE_ALL);
-+ return -ENODEV;
-+ }
-+
-+ /* Note new driver registration in kernel logs */
-+ log_usb_dev_info(dev);
-+
-+ /* outbound data (initialization) */
-+ send_outbound_init(ir);
-+ }
-+
-+ usb_set_intfdata(intf, ir);
-+ return 0;
-+}
-+
-+static void usb_remote_disconnect(struct usb_interface *intf)
-+{
-+ /* struct usb_device *dev = interface_to_usbdev(intf); */
-+ struct xbox_dev *ir = usb_get_intfdata(intf);
-+ usb_set_intfdata(intf, NULL);
-+
-+ dprintk(DRIVER_NAME ": disconnecting remote %d:\n",
-+ (ir ? ir->devnum : -1));
-+ if (!ir || !ir->d)
-+ return;
-+
-+ if (ir->usbdev) {
-+ /* Only unregister once */
-+ ir->usbdev = NULL;
-+ unregister_from_lirc(ir);
-+ }
-+
-+ /* This also removes the current remote from remote_list */
-+ free_irctl(ir, FREE_ALL);
-+}
-+
-+static struct usb_driver usb_remote_driver = {
-+ LIRC_THIS_MODULE(.owner = THIS_MODULE)
-+ .name = DRIVER_NAME,
-+ .probe = usb_remote_probe,
-+ .disconnect = usb_remote_disconnect,
-+ .id_table = usb_remote_table
-+};
-+
-+static int __init usb_remote_init(void)
-+{
-+ int i;
-+
-+ INIT_LIST_HEAD(&remote_list);
-+
-+ printk(KERN_INFO "\n" DRIVER_NAME ": " DRIVER_DESC " "
-+ DRIVER_VERSION "\n");
-+ printk(DRIVER_NAME ": " DRIVER_AUTHOR "\n");
-+ dprintk(DRIVER_NAME ": debug mode enabled: "
-+ "$Id: lirc_xbox.c,v 1.88 2011/06/05 11:11:11 jmartin Exp $\n");
-+
-+ repeat_jiffies = repeat*HZ/100;
-+
-+ i = usb_register(&usb_remote_driver);
-+ if (i) {
-+ printk(DRIVER_NAME ": usb register failed, result = %d\n", i);
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
-+static void __exit usb_remote_exit(void)
-+{
-+ usb_deregister(&usb_remote_driver);
-+}
-+
-+module_init(usb_remote_init);
-+module_exit(usb_remote_exit);
-+
-+MODULE_DESCRIPTION(DRIVER_DESC);
-+MODULE_AUTHOR(DRIVER_AUTHOR);
-+MODULE_LICENSE("GPL");
-+MODULE_DEVICE_TABLE(usb, usb_remote_table);
-+
-+module_param(debug, bool, S_IRUGO | S_IWUSR);
-+MODULE_PARM_DESC(debug, "Debug enabled or not (default: 0)");
-+
-+module_param(mask, int, S_IRUGO | S_IWUSR);
-+MODULE_PARM_DESC(mask, "Set channel acceptance bit mask (default: 0xFFFF)");
-+
-+module_param(unique, bool, S_IRUGO | S_IWUSR);
-+MODULE_PARM_DESC(unique, "Enable channel-specific codes (default: 0)");
+diff -Nur linux-4.1.6/drivers/thermal/Kconfig linux-rpi/drivers/thermal/Kconfig
+--- linux-4.1.6/drivers/thermal/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/thermal/Kconfig 2015-08-26 10:26:11.733357477 +0200
+@@ -238,6 +238,13 @@
+ enforce idle time which results in more package C-state residency. The
+ user interface is exposed via generic thermal framework.
+
++config THERMAL_BCM2835
++ depends on RASPBERRYPI_FIRMWARE
++ tristate "BCM2835 Thermal Driver"
++ help
++ This will enable temperature monitoring for the Broadcom BCM2835
++ chip. If built as a module, it will be called 'bcm2835-thermal'.
+
-+module_param(repeat, int, S_IRUGO | S_IWUSR);
-+MODULE_PARM_DESC(repeat, "Repeat timeout (1/100 sec) (default: 10)");
-diff -Nur linux-4.1.3/drivers/staging/media/lirc/Makefile linux-xbian-rpi/drivers/staging/media/lirc/Makefile
---- linux-4.1.3/drivers/staging/media/lirc/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/staging/media/lirc/Makefile 2015-07-28 01:20:58.437184915 +0200
-@@ -6,6 +6,8 @@
- obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o
- obj-$(CONFIG_LIRC_IMON) += lirc_imon.o
- obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o
-+obj-$(CONFIG_LIRC_RPI) += lirc_rpi.o
-+obj-$(CONFIG_LIRC_XBOX) += lirc_xbox.o
- obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o
- obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o
- obj-$(CONFIG_LIRC_SIR) += lirc_sir.o
-diff -Nur linux-4.1.3/drivers/thermal/bcm2835-thermal.c linux-xbian-rpi/drivers/thermal/bcm2835-thermal.c
---- linux-4.1.3/drivers/thermal/bcm2835-thermal.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/thermal/bcm2835-thermal.c 2015-07-28 01:20:58.437184915 +0200
+ config X86_PKG_TEMP_THERMAL
+ tristate "X86 package temperature thermal driver"
+ depends on X86_THERMAL_VECTOR
+diff -Nur linux-4.1.6/drivers/thermal/Makefile linux-rpi/drivers/thermal/Makefile
+--- linux-4.1.6/drivers/thermal/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/thermal/Makefile 2015-08-26 10:26:11.733357477 +0200
+@@ -33,6 +33,7 @@
+ obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
+ obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o
+ obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
++obj-$(CONFIG_THERMAL_BCM2835) += bcm2835-thermal.o
+ obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
+ obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o
+ obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/
+diff -Nur linux-4.1.6/drivers/thermal/bcm2835-thermal.c linux-rpi/drivers/thermal/bcm2835-thermal.c
+--- linux-4.1.6/drivers/thermal/bcm2835-thermal.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/thermal/bcm2835-thermal.c 2015-08-26 10:26:11.733357477 +0200
@@ -0,0 +1,141 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -226747,37 +234136,9 @@ diff -Nur linux-4.1.3/drivers/thermal/bcm2835-thermal.c linux-xbian-rpi/drivers/
+MODULE_AUTHOR("Noralf Trønnes");
+MODULE_DESCRIPTION("Thermal driver for bcm2835 chip");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/thermal/Kconfig linux-xbian-rpi/drivers/thermal/Kconfig
---- linux-4.1.3/drivers/thermal/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/thermal/Kconfig 2015-07-28 01:20:58.437184915 +0200
-@@ -238,6 +238,13 @@
- enforce idle time which results in more package C-state residency. The
- user interface is exposed via generic thermal framework.
-
-+config THERMAL_BCM2835
-+ depends on BCM2708_MBOX
-+ tristate "BCM2835 Thermal Driver"
-+ help
-+ This will enable temperature monitoring for the Broadcom BCM2835
-+ chip. If built as a module, it will be called 'bcm2835-thermal'.
-+
- config X86_PKG_TEMP_THERMAL
- tristate "X86 package temperature thermal driver"
- depends on X86_THERMAL_VECTOR
-diff -Nur linux-4.1.3/drivers/thermal/Makefile linux-xbian-rpi/drivers/thermal/Makefile
---- linux-4.1.3/drivers/thermal/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/thermal/Makefile 2015-07-28 01:20:58.437184915 +0200
-@@ -33,6 +33,7 @@
- obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
- obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o
- obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
-+obj-$(CONFIG_THERMAL_BCM2835) += bcm2835-thermal.o
- obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
- obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o
- obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/
-diff -Nur linux-4.1.3/drivers/tty/serial/8250/8250_core.c linux-xbian-rpi/drivers/tty/serial/8250/8250_core.c
---- linux-4.1.3/drivers/tty/serial/8250/8250_core.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/tty/serial/8250/8250_core.c 2015-07-28 01:20:58.437184915 +0200
+diff -Nur linux-4.1.6/drivers/tty/serial/8250/8250_core.c linux-rpi/drivers/tty/serial/8250/8250_core.c
+--- linux-4.1.6/drivers/tty/serial/8250/8250_core.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/tty/serial/8250/8250_core.c 2015-08-26 10:26:11.745357642 +0200
@@ -3262,6 +3262,8 @@
if (nr_uarts > UART_NR)
@@ -226787,9 +234148,32 @@ diff -Nur linux-4.1.3/drivers/tty/serial/8250/8250_core.c linux-xbian-rpi/driver
for (i = 0; i < nr_uarts; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
-diff -Nur linux-4.1.3/drivers/usb/core/generic.c linux-xbian-rpi/drivers/usb/core/generic.c
---- linux-4.1.3/drivers/usb/core/generic.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/core/generic.c 2015-07-28 01:20:58.437184915 +0200
+diff -Nur linux-4.1.6/drivers/tty/serial/amba-pl011.c linux-rpi/drivers/tty/serial/amba-pl011.c
+--- linux-4.1.6/drivers/tty/serial/amba-pl011.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/tty/serial/amba-pl011.c 2015-08-26 10:26:11.745357642 +0200
+@@ -85,7 +85,7 @@
+
+ static unsigned int get_fifosize_arm(struct amba_device *dev)
+ {
+- return amba_rev(dev) < 3 ? 16 : 32;
++ return 16; //TODO: fix: amba_rev(dev) < 3 ? 16 : 32;
+ }
+
+ static struct vendor_data vendor_arm = {
+diff -Nur linux-4.1.6/drivers/usb/Makefile linux-rpi/drivers/usb/Makefile
+--- linux-4.1.6/drivers/usb/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/Makefile 2015-08-26 10:26:11.769357972 +0200
+@@ -7,6 +7,7 @@
+ obj-$(CONFIG_USB) += core/
+ obj-$(CONFIG_USB_SUPPORT) += phy/
+
++obj-$(CONFIG_USB_DWCOTG) += host/
+ obj-$(CONFIG_USB_DWC3) += dwc3/
+ obj-$(CONFIG_USB_DWC2) += dwc2/
+ obj-$(CONFIG_USB_ISP1760) += isp1760/
+diff -Nur linux-4.1.6/drivers/usb/core/generic.c linux-rpi/drivers/usb/core/generic.c
+--- linux-4.1.6/drivers/usb/core/generic.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/core/generic.c 2015-08-26 10:26:11.773358027 +0200
@@ -152,6 +152,7 @@
dev_warn(&udev->dev,
"no configuration chosen from %d choice%s\n",
@@ -226798,10 +234182,10 @@ diff -Nur linux-4.1.3/drivers/usb/core/generic.c linux-xbian-rpi/drivers/usb/cor
}
return i;
}
-diff -Nur linux-4.1.3/drivers/usb/core/hub.c linux-xbian-rpi/drivers/usb/core/hub.c
---- linux-4.1.3/drivers/usb/core/hub.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/core/hub.c 2015-07-28 01:20:58.441170694 +0200
-@@ -4922,7 +4922,7 @@
+diff -Nur linux-4.1.6/drivers/usb/core/hub.c linux-rpi/drivers/usb/core/hub.c
+--- linux-4.1.6/drivers/usb/core/hub.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/core/hub.c 2015-08-26 10:26:11.777358082 +0200
+@@ -4906,7 +4906,7 @@
if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
u16 status = 0, unused;
@@ -226810,9 +234194,9 @@ diff -Nur linux-4.1.3/drivers/usb/core/hub.c linux-xbian-rpi/drivers/usb/core/hu
usb_clear_port_feature(hdev, port1,
USB_PORT_FEAT_C_OVER_CURRENT);
msleep(100); /* Cool down */
-diff -Nur linux-4.1.3/drivers/usb/core/message.c linux-xbian-rpi/drivers/usb/core/message.c
---- linux-4.1.3/drivers/usb/core/message.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/core/message.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/core/message.c linux-rpi/drivers/usb/core/message.c
+--- linux-4.1.6/drivers/usb/core/message.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/core/message.c 2015-08-26 10:26:11.777358082 +0200
@@ -1872,6 +1872,85 @@
if (cp->string == NULL &&
!(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
@@ -226899,9 +234283,9 @@ diff -Nur linux-4.1.3/drivers/usb/core/message.c linux-xbian-rpi/drivers/usb/cor
/* Now that the interfaces are installed, re-enable LPM. */
usb_unlocked_enable_lpm(dev);
-diff -Nur linux-4.1.3/drivers/usb/core/otg_whitelist.h linux-xbian-rpi/drivers/usb/core/otg_whitelist.h
---- linux-4.1.3/drivers/usb/core/otg_whitelist.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/core/otg_whitelist.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/core/otg_whitelist.h linux-rpi/drivers/usb/core/otg_whitelist.h
+--- linux-4.1.6/drivers/usb/core/otg_whitelist.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/core/otg_whitelist.h 2015-08-26 10:26:11.777358082 +0200
@@ -19,33 +19,82 @@
static struct usb_device_id whitelist_table [] = {
@@ -227055,9 +234439,9 @@ diff -Nur linux-4.1.3/drivers/usb/core/otg_whitelist.h linux-xbian-rpi/drivers/u
return 0;
}
-diff -Nur linux-4.1.3/drivers/usb/gadget/file_storage.c linux-xbian-rpi/drivers/usb/gadget/file_storage.c
---- linux-4.1.3/drivers/usb/gadget/file_storage.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/gadget/file_storage.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/gadget/file_storage.c linux-rpi/drivers/usb/gadget/file_storage.c
+--- linux-4.1.6/drivers/usb/gadget/file_storage.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/gadget/file_storage.c 2015-08-26 10:26:11.785358192 +0200
@@ -0,0 +1,3676 @@
+/*
+ * file_storage.c -- File-backed USB Storage Gadget, for USB development
@@ -230735,9 +238119,180 @@ diff -Nur linux-4.1.3/drivers/usb/gadget/file_storage.c linux-xbian-rpi/drivers/
+ kref_put(&fsg->ref, fsg_release);
+}
+module_exit(fsg_cleanup);
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/changes.txt linux-xbian-rpi/drivers/usb/host/dwc_common_port/changes.txt
---- linux-4.1.3/drivers/usb/host/dwc_common_port/changes.txt 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/changes.txt 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/Kconfig linux-rpi/drivers/usb/host/Kconfig
+--- linux-4.1.6/drivers/usb/host/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/host/Kconfig 2015-08-26 10:26:11.801358412 +0200
+@@ -738,6 +738,19 @@
+ To compile this driver a module, choose M here: the module
+ will be called "hwa-hc".
+
++config USB_DWCOTG
++ tristate "Synopsis DWC host support"
++ depends on USB
++ help
++ The Synopsis DWC controller is a dual-role
++ host/peripheral/OTG ("On The Go") USB controllers.
++
++ Enable this option to support this IP in host controller mode.
++ If unsure, say N.
++
++ To compile this driver as a module, choose M here: the
++ modules built will be called dwc_otg and dwc_common_port.
++
+ config USB_IMX21_HCD
+ tristate "i.MX21 HCD support"
+ depends on ARM && ARCH_MXC
+diff -Nur linux-4.1.6/drivers/usb/host/Makefile linux-rpi/drivers/usb/host/Makefile
+--- linux-4.1.6/drivers/usb/host/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/usb/host/Makefile 2015-08-26 10:26:11.801358412 +0200
+@@ -68,6 +68,8 @@
+ obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
+ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.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_HCD_BCMA) += bcma-hcd.o
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/Makefile linux-rpi/drivers/usb/host/dwc_common_port/Makefile
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/Makefile 2015-08-26 10:26:11.801358412 +0200
+@@ -0,0 +1,58 @@
++#
++# Makefile for DWC_common library
++#
++
++ifneq ($(KERNELRELEASE),)
++
++ccflags-y += -DDWC_LINUX
++#ccflags-y += -DDEBUG
++#ccflags-y += -DDWC_DEBUG_REGS
++#ccflags-y += -DDWC_DEBUG_MEMORY
++
++ccflags-y += -DDWC_LIBMODULE
++ccflags-y += -DDWC_CCLIB
++#ccflags-y += -DDWC_CRYPTOLIB
++ccflags-y += -DDWC_NOTIFYLIB
++ccflags-y += -DDWC_UTFLIB
++
++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 ccflags-y in 2.6.31 actually
++ccflags-y += $(CPPFLAGS)
++endif
++
++else
++
++#ifeq ($(KDIR),)
++#$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment)
++#endif
++
++ifeq ($(ARCH),)
++$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \
++ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-")
++endif
++
++ifeq ($(DOXYGEN),)
++DOXYGEN := doxygen
++endif
++
++default:
++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 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 .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/Makefile.fbsd linux-rpi/drivers/usb/host/dwc_common_port/Makefile.fbsd
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/Makefile.fbsd 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/Makefile.fbsd 2015-08-26 10:26:11.801358412 +0200
+@@ -0,0 +1,17 @@
++CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include
++CFLAGS += -DDWC_FREEBSD
++CFLAGS += -DDEBUG
++#CFLAGS += -DDWC_DEBUG_REGS
++#CFLAGS += -DDWC_DEBUG_MEMORY
++
++#CFLAGS += -DDWC_LIBMODULE
++#CFLAGS += -DDWC_CCLIB
++#CFLAGS += -DDWC_CRYPTOLIB
++#CFLAGS += -DDWC_NOTIFYLIB
++#CFLAGS += -DDWC_UTFLIB
++
++KMOD = dwc_common_port_lib
++SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \
++ dwc_common_fbsd.c dwc_mem.c
++
++.include <bsd.kmod.mk>
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/Makefile.linux linux-rpi/drivers/usb/host/dwc_common_port/Makefile.linux
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/Makefile.linux 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/Makefile.linux 2015-08-26 10:26:11.801358412 +0200
+@@ -0,0 +1,49 @@
++#
++# Makefile for DWC_common library
++#
++ifneq ($(KERNELRELEASE),)
++
++ccflags-y += -DDWC_LINUX
++#ccflags-y += -DDEBUG
++#ccflags-y += -DDWC_DEBUG_REGS
++#ccflags-y += -DDWC_DEBUG_MEMORY
++
++ccflags-y += -DDWC_LIBMODULE
++ccflags-y += -DDWC_CCLIB
++ccflags-y += -DDWC_CRYPTOLIB
++ccflags-y += -DDWC_NOTIFYLIB
++ccflags-y += -DDWC_UTFLIB
++
++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 ($(KDIR),)
++$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment)
++endif
++
++ifeq ($(ARCH),)
++$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \
++ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-")
++endif
++
++ifeq ($(DOXYGEN),)
++DOXYGEN := doxygen
++endif
++
++default:
++ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 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 .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/changes.txt linux-rpi/drivers/usb/host/dwc_common_port/changes.txt
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/changes.txt 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/changes.txt 2015-08-26 10:26:11.801358412 +0200
@@ -0,0 +1,174 @@
+
+dwc_read_reg32() and friends now take an additional parameter, a pointer to an
@@ -230913,9 +238468,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/changes.txt linux-xbian-r
+A DWC_LIBMODULE #define has also been added. If this is not defined, then the
+module code in dwc_common_linux.c is not compiled in. This allows linking the
+library code directly into a driver module, instead of as a standalone module.
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/doc/doxygen.cfg linux-xbian-rpi/drivers/usb/host/dwc_common_port/doc/doxygen.cfg
---- linux-4.1.3/drivers/usb/host/dwc_common_port/doc/doxygen.cfg 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/doc/doxygen.cfg 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/doc/doxygen.cfg linux-rpi/drivers/usb/host/dwc_common_port/doc/doxygen.cfg
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/doc/doxygen.cfg 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/doc/doxygen.cfg 2015-08-26 10:26:11.801358412 +0200
@@ -0,0 +1,270 @@
+# Doxyfile 1.4.5
+
@@ -231187,9 +238742,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/doc/doxygen.cfg linux-xbi
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_cc.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_cc.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_cc.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_cc.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_cc.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_cc.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_cc.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_cc.c 2015-08-26 10:26:11.801358412 +0200
@@ -0,0 +1,532 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.c $
@@ -231723,9 +239278,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_cc.c linux-xbian-rpi/
+}
+
+#endif /* DWC_CCLIB */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_cc.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_cc.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_cc.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_cc.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_cc.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_cc.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_cc.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_cc.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,224 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_cc.h $
@@ -231951,9 +239506,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_cc.h linux-xbian-rpi/
+#endif
+
+#endif /* _DWC_CC_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1308 @@
+#include "dwc_os.h"
+#include "dwc_list.h"
@@ -233263,9 +240818,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_fbsd.c linux-x
+{
+ return wq->pending;
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_linux.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_common_linux.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_common_linux.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_common_linux.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_common_linux.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_common_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_common_linux.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1434 @@
+#include <linux/kernel.h>
+#include <linux/init.h>
@@ -234701,9 +242256,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_linux.c linux-
+MODULE_LICENSE ("GPL");
+
+#endif /* DWC_LIBMODULE */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1275 @@
+#include "dwc_os.h"
+#include "dwc_list.h"
@@ -235980,9 +243535,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c linux-x
+{
+ return wq->pending;
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_crypto.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_crypto.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_crypto.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_crypto.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,308 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.c $
@@ -236292,9 +243847,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_crypto.c linux-xbian-
+}
+
+#endif /* DWC_CRYPTOLIB */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_crypto.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_crypto.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_crypto.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_crypto.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_crypto.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,111 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_crypto.h $
@@ -236407,9 +243962,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_crypto.h linux-xbian-
+#endif
+
+#endif /* _DWC_CRYPTO_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_dh.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_dh.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_dh.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_dh.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_dh.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_dh.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_dh.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_dh.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,291 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.c $
@@ -236702,9 +244257,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_dh.c linux-xbian-rpi/
+#endif /* !CONFIG_MACH_IPMATE */
+
+#endif /* DWC_CRYPTOLIB */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_dh.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_dh.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_dh.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_dh.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_dh.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_dh.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_dh.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_dh.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,106 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_dh.h $
@@ -236812,9 +244367,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_dh.h linux-xbian-rpi/
+#endif
+
+#endif /* _DWC_DH_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_list.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_list.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_list.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_list.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_list.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_list.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_list.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_list.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,594 @@
+/* $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 $ */
@@ -237410,9 +244965,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_list.h linux-xbian-rp
+#endif
+
+#endif /* _DWC_LIST_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_mem.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_mem.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_mem.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_mem.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_mem.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_mem.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_mem.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_mem.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,245 @@
+/* Memory Debugging */
+#ifdef DWC_DEBUG_MEMORY
@@ -237659,9 +245214,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_mem.c linux-xbian-rpi
+}
+
+#endif /* DWC_DEBUG_MEMORY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_modpow.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_modpow.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_modpow.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_modpow.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,636 @@
+/* Bignum routines adapted from PUTTY sources. PuTTY copyright notice follows.
+ *
@@ -238299,9 +245854,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_modpow.c linux-xbian-
+#endif /* CONFIG_MACH_IPMATE */
+
+#endif /*DWC_CRYPTOLIB */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_modpow.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_modpow.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_modpow.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_modpow.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_modpow.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,34 @@
+/*
+ * dwc_modpow.h
@@ -238337,9 +245892,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_modpow.h linux-xbian-
+#endif
+
+#endif /* _LINUX_BIGNUM_H */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_notifier.c linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.c
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_notifier.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.c 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_notifier.c linux-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.c
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_notifier.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,319 @@
+#ifdef DWC_NOTIFYLIB
+
@@ -238660,9 +246215,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_notifier.c linux-xbia
+}
+
+#endif /* DWC_NOTIFYLIB */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_notifier.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_notifier.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_notifier.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_notifier.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_notifier.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,122 @@
+
+#ifndef __DWC_NOTIFIER_H__
@@ -238786,9 +246341,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_notifier.h linux-xbia
+#endif
+
+#endif /* __DWC_NOTIFIER_H__ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_os.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_os.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_os.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/dwc_os.h 2015-07-28 01:20:58.441170694 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_os.h linux-rpi/drivers/usb/host/dwc_common_port/dwc_os.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/dwc_os.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/dwc_os.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1276 @@
+/* =========================================================================
+ * $File: //dwh/usb_iip/dev/software/dwc_common_port_2/dwc_os.h $
@@ -240066,145 +247621,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/dwc_os.h linux-xbian-rpi/
+#endif
+
+#endif /* _DWC_OS_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/Makefile linux-xbian-rpi/drivers/usb/host/dwc_common_port/Makefile
---- linux-4.1.3/drivers/usb/host/dwc_common_port/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/Makefile 2015-07-28 01:20:58.441170694 +0200
-@@ -0,0 +1,58 @@
-+#
-+# Makefile for DWC_common library
-+#
-+
-+ifneq ($(KERNELRELEASE),)
-+
-+ccflags-y += -DDWC_LINUX
-+#ccflags-y += -DDEBUG
-+#ccflags-y += -DDWC_DEBUG_REGS
-+#ccflags-y += -DDWC_DEBUG_MEMORY
-+
-+ccflags-y += -DDWC_LIBMODULE
-+ccflags-y += -DDWC_CCLIB
-+#ccflags-y += -DDWC_CRYPTOLIB
-+ccflags-y += -DDWC_NOTIFYLIB
-+ccflags-y += -DDWC_UTFLIB
-+
-+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 ccflags-y in 2.6.31 actually
-+ccflags-y += $(CPPFLAGS)
-+endif
-+
-+else
-+
-+#ifeq ($(KDIR),)
-+#$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment)
-+#endif
-+
-+ifeq ($(ARCH),)
-+$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \
-+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-")
-+endif
-+
-+ifeq ($(DOXYGEN),)
-+DOXYGEN := doxygen
-+endif
-+
-+default:
-+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 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 .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/Makefile.fbsd linux-xbian-rpi/drivers/usb/host/dwc_common_port/Makefile.fbsd
---- linux-4.1.3/drivers/usb/host/dwc_common_port/Makefile.fbsd 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/Makefile.fbsd 2015-07-28 01:20:58.441170694 +0200
-@@ -0,0 +1,17 @@
-+CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include
-+CFLAGS += -DDWC_FREEBSD
-+CFLAGS += -DDEBUG
-+#CFLAGS += -DDWC_DEBUG_REGS
-+#CFLAGS += -DDWC_DEBUG_MEMORY
-+
-+#CFLAGS += -DDWC_LIBMODULE
-+#CFLAGS += -DDWC_CCLIB
-+#CFLAGS += -DDWC_CRYPTOLIB
-+#CFLAGS += -DDWC_NOTIFYLIB
-+#CFLAGS += -DDWC_UTFLIB
-+
-+KMOD = dwc_common_port_lib
-+SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \
-+ dwc_common_fbsd.c dwc_mem.c
-+
-+.include <bsd.kmod.mk>
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/Makefile.linux linux-xbian-rpi/drivers/usb/host/dwc_common_port/Makefile.linux
---- linux-4.1.3/drivers/usb/host/dwc_common_port/Makefile.linux 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/Makefile.linux 2015-07-28 01:20:58.441170694 +0200
-@@ -0,0 +1,49 @@
-+#
-+# Makefile for DWC_common library
-+#
-+ifneq ($(KERNELRELEASE),)
-+
-+ccflags-y += -DDWC_LINUX
-+#ccflags-y += -DDEBUG
-+#ccflags-y += -DDWC_DEBUG_REGS
-+#ccflags-y += -DDWC_DEBUG_MEMORY
-+
-+ccflags-y += -DDWC_LIBMODULE
-+ccflags-y += -DDWC_CCLIB
-+ccflags-y += -DDWC_CRYPTOLIB
-+ccflags-y += -DDWC_NOTIFYLIB
-+ccflags-y += -DDWC_UTFLIB
-+
-+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 ($(KDIR),)
-+$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment)
-+endif
-+
-+ifeq ($(ARCH),)
-+$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \
-+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-")
-+endif
-+
-+ifeq ($(DOXYGEN),)
-+DOXYGEN := doxygen
-+endif
-+
-+default:
-+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 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 .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/usb.h linux-xbian-rpi/drivers/usb/host/dwc_common_port/usb.h
---- linux-4.1.3/drivers/usb/host/dwc_common_port/usb.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_common_port/usb.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_common_port/usb.h linux-rpi/drivers/usb/host/dwc_common_port/usb.h
+--- linux-4.1.6/drivers/usb/host/dwc_common_port/usb.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_common_port/usb.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,946 @@
+/*
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -241152,9 +248571,95 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_common_port/usb.h linux-xbian-rpi/dri
+#endif
+
+#endif /* _USB_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/doc/doxygen.cfg linux-xbian-rpi/drivers/usb/host/dwc_otg/doc/doxygen.cfg
---- linux-4.1.3/drivers/usb/host/dwc_otg/doc/doxygen.cfg 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/doc/doxygen.cfg 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/Makefile linux-rpi/drivers/usb/host/dwc_otg/Makefile
+--- linux-4.1.6/drivers/usb/host/dwc_otg/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/Makefile 2015-08-26 10:26:11.805358467 +0200
+@@ -0,0 +1,82 @@
++#
++# Makefile for DWC_otg Highspeed USB controller driver
++#
++
++ifneq ($(KERNELRELEASE),)
++
++# Use the BUS_INTERFACE variable to compile the software for either
++# PCI(PCI_INTERFACE) or LM(LM_INTERFACE) bus.
++ifeq ($(BUS_INTERFACE),)
++# BUS_INTERFACE = -DPCI_INTERFACE
++# BUS_INTERFACE = -DLM_INTERFACE
++ BUS_INTERFACE = -DPLATFORM_INTERFACE
++endif
++
++#ccflags-y += -DDEBUG
++#ccflags-y += -DDWC_OTG_DEBUGLEV=1 # reduce common debug msgs
++
++# Use one of the following flags to compile the software in host-only or
++# device-only mode.
++#ccflags-y += -DDWC_HOST_ONLY
++#ccflags-y += -DDWC_DEVICE_ONLY
++
++ccflags-y += -Dlinux -DDWC_HS_ELECT_TST
++#ccflags-y += -DDWC_EN_ISOC
++ccflags-y += -I$(obj)/../dwc_common_port
++#ccflags-y += -I$(PORTLIB)
++ccflags-y += -DDWC_LINUX
++ccflags-y += $(CFI)
++ccflags-y += $(BUS_INTERFACE)
++#ccflags-y += -DDWC_DEV_SRPCAP
++
++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
++dwc_otg-objs += dwc_otg_adp.o
++dwc_otg-objs += dwc_otg_fiq_fsm.o
++dwc_otg-objs += dwc_otg_fiq_stub.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)
++ccflags-y += $(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
++ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install
++ $(MAKE) -C$(KDIR) M=$(PWD) modules_install
++
++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 Module.symvers
++
++endif
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/doc/doxygen.cfg linux-rpi/drivers/usb/host/dwc_otg/doc/doxygen.cfg
+--- linux-4.1.6/drivers/usb/host/dwc_otg/doc/doxygen.cfg 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/doc/doxygen.cfg 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,224 @@
+# Doxyfile 1.3.9.1
+
@@ -241380,9 +248885,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/doc/doxygen.cfg linux-xbian-rpi/d
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dummy_audio.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dummy_audio.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dummy_audio.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dummy_audio.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dummy_audio.c linux-rpi/drivers/usb/host/dwc_otg/dummy_audio.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dummy_audio.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dummy_audio.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1575 @@
+/*
+ * zero.c -- Gadget Zero, for USB development
@@ -242959,9 +250464,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dummy_audio.c linux-xbian-rpi/dri
+ remove_proc_entry("isoc_test", NULL);
+}
+module_exit (cleanup);
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_cfi_common.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_cfi_common.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_cfi_common.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_cfi_common.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_cfi_common.h linux-rpi/drivers/usb/host/dwc_otg/dwc_cfi_common.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_cfi_common.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_cfi_common.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,142 @@
+/* ==========================================================================
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
@@ -243105,9 +250610,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_cfi_common.h linux-xbian-rpi/
+typedef struct cfi_string cfi_string_t;
+
+#endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_adp.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_adp.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_adp.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_adp.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,854 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.c $
@@ -243963,9 +251468,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_adp.c linux-xbian-rpi/dri
+#endif
+ return 1;
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_adp.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_adp.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_adp.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_adp.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_adp.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,80 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_adp.h $
@@ -244047,9 +251552,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_adp.h linux-xbian-rpi/dri
+extern int32_t dwc_otg_adp_handle_srp_intr(dwc_otg_core_if_t * core_if);
+
+#endif //__DWC_OTG_ADP_H__
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_attr.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_attr.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_attr.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_attr.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1210 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $
@@ -245261,9 +252766,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_attr.c linux-xbian-rpi/dr
+ device_remove_file(&dev->dev, &dev_attr_sleep_status);
+#endif
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_attr.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_attr.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_attr.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_attr.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_attr.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,89 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $
@@ -245354,9 +252859,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_attr.h linux-xbian-rpi/dr
+#endif
+ );
+#endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cfi.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cfi.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1876 @@
+/* ==========================================================================
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
@@ -247234,9 +254739,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cfi.c linux-xbian-rpi/dri
+}
+
+#endif //DWC_UTE_CFI
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cfi.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cfi.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cfi.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,320 @@
+/* ==========================================================================
+ * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
@@ -247558,9 +255063,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cfi.h linux-xbian-rpi/dri
+int cfi_setup(struct dwc_otg_pcd *pcd, struct cfi_usb_ctrlrequest *ctrl);
+
+#endif /* (__DWC_OTG_CFI_H__) */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cil.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cil.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,7141 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $
@@ -254703,9 +262208,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil.c linux-xbian-rpi/dri
+ dwc_otg_pcd_start_srp_timer(core_if);
+ return;
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cil.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cil.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1464 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.h $
@@ -256171,9 +263676,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil.h linux-xbian-rpi/dri
+//////////////////////////////////////////////////////////////////////
+
+#endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1594 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil_intr.c $
@@ -257769,9 +265274,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c linux-xbian-rp
+ DWC_SPINUNLOCK(core_if->lock);
+ return retval;
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_core_if.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_core_if.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_core_if.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_core_if.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_core_if.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,705 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $
@@ -258478,9 +265983,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_core_if.h linux-xbian-rpi
+/** @} */
+
+#endif /* __DWC_CORE_IF_H__ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_dbg.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_dbg.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_dbg.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_dbg.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_dbg.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,117 @@
+/* ==========================================================================
+ *
@@ -258599,9 +266104,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_dbg.h linux-xbian-rpi/dri
+
+#endif /*DEBUG*/
+#endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_driver.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_driver.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.c 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_driver.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_driver.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.c 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,1757 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $
@@ -260360,9 +267865,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_driver.c linux-xbian-rpi/
+ </td></tr>
+
+*/
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_driver.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_driver.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.h 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_driver.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_driver.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_driver.h 2015-08-26 10:26:11.805358467 +0200
@@ -0,0 +1,86 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.h $
@@ -260450,10 +267955,10 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_driver.h linux-xbian-rpi/
+#endif
+
+#endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c 2015-07-28 01:20:58.445156473 +0200
-@@ -0,0 +1,1346 @@
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c 2015-08-26 10:26:11.805358467 +0200
+@@ -0,0 +1,1355 @@
+/*
+ * dwc_otg_fiq_fsm.c - The finite state machine FIQ
+ *
@@ -261071,8 +268576,11 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c linux-xbian-rpi
+ break;
+
+ case FIQ_HS_ISOC_SLEEPING:
-+ state->channel[n].fsm = FIQ_HS_ISOC_TURBO;
-+ fiq_fsm_restart_channel(state, n, 0);
++ /* Is it time to wake this channel yet? */
++ if (--state->channel[n].uframe_sleeps == 0) {
++ state->channel[n].fsm = FIQ_HS_ISOC_TURBO;
++ fiq_fsm_restart_channel(state, n, 0);
++ }
+ break;
+
+ case FIQ_PER_SSPLIT_QUEUED:
@@ -261080,7 +268588,7 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c linux-xbian-rpi
+ break;
+ if(!fiq_fsm_tt_in_use(state, num_channels, n)) {
+ if (!fiq_fsm_too_late(state, n)) {
-+ fiq_print(FIQDBG_INT, st, "SOF GO %01d", n);
++ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n);
+ fiq_fsm_restart_channel(state, n, 0);
+ state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED;
+ } else {
@@ -261525,8 +269033,14 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c linux-xbian-rpi
+ if (fiq_fsm_update_hs_isoc(state, n, hcint)) {
+ /* more transactions to come */
+ handled = 1;
-+ restart = 1;
+ fiq_print(FIQDBG_INT, state, "HSISO M ");
++ /* For strided transfers, put ourselves to sleep */
++ if (st->hs_isoc_info.stride > 1) {
++ st->uframe_sleeps = st->hs_isoc_info.stride - 1;
++ st->fsm = FIQ_HS_ISOC_SLEEPING;
++ } else {
++ restart = 1;
++ }
+ } else {
+ st->fsm = FIQ_HS_ISOC_DONE;
+ fiq_print(FIQDBG_INT, state, "HSISO F ");
@@ -261800,10 +269314,10 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c linux-xbian-rpi
+ mb();
+ fiq_fsm_spin_unlock(&state->lock);
+}
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h 2015-07-28 01:20:58.445156473 +0200
-@@ -0,0 +1,367 @@
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h 2015-08-26 10:26:11.805358467 +0200
+@@ -0,0 +1,370 @@
+/*
+ * dwc_otg_fiq_fsm.h - Finite state machine FIQ header definitions
+ *
@@ -262066,12 +269580,13 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h linux-xbian-rpi
+ * @iso_frame: Pointer to the array of OTG URB iso_frame_descs.
+ * @nrframes: Total length of iso_frame_desc array
+ * @index: Current index (FIQ-maintained)
-+ *
++ * @stride: Interval in uframes between HS isoc transactions
+ */
+struct fiq_hs_isoc_info {
+ struct dwc_otg_hcd_iso_packet_desc *iso_desc;
+ unsigned int nrframes;
+ unsigned int index;
++ unsigned int stride;
+};
+
+/**
@@ -262102,6 +269617,8 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h linux-xbian-rpi
+ /* Hardware bug workaround: sometimes channel halt interrupts are
+ * delayed until the next SOF. Keep track of when we expected to get interrupted. */
+ unsigned int expected_uframe;
++ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */
++ unsigned int uframe_sleeps;
+ /* in/out for communicating number of dma buffers used, or number of ISOC to do */
+ unsigned int nrpackets;
+ struct fiq_dma_info dma_info;
@@ -262171,9 +269688,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h linux-xbian-rpi
+extern void dwc_otg_fiq_nop(struct fiq_state *state);
+
+#endif /* DWC_OTG_FIQ_FSM_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S 2015-07-28 01:20:58.445156473 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,80 @@
+/*
+ * dwc_otg_fiq_fsm.S - assembly stub for the FSM FIQ
@@ -262255,10 +269772,10 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S linux-xbian-rp
+ subs pc, lr, #4;
+_dwc_otg_fiq_stub_end:
+END(_dwc_otg_fiq_stub)
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 2015-07-28 01:20:58.449142252 +0200
-@@ -0,0 +1,4252 @@
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.c 2015-08-26 10:26:11.809358522 +0200
+@@ -0,0 +1,4257 @@
+
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $
@@ -263939,6 +271456,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-xbian-rpi/dri
+ }
+ }
+
++ st->hs_isoc_info.stride = qh->interval;
++ st->uframe_sleeps = 0;
++
+ fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num);
+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32);
+ fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32);
@@ -263953,9 +271473,11 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-xbian-rpi/dri
+ DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32);
+ if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) {
+ /* Prevent queueing near EOF1. Bad things happen if a periodic
-+ * split transaction is queued very close to EOF.
++ * split transaction is queued very close to EOF. SOF interrupt handler
++ * will wake this channel at the next interrupt.
+ */
+ st->fsm = FIQ_HS_ISOC_SLEEPING;
++ st->uframe_sleeps = 1;
+ } else {
+ st->fsm = FIQ_HS_ISOC_TURBO;
+ st->hcchar_copy.b.chen = 1;
@@ -266511,9 +274033,875 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.c linux-xbian-rpi/dri
+}
+
+#endif /* DWC_DEVICE_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 2015-08-26 10:26:11.809358522 +0200
+@@ -0,0 +1,862 @@
++/* ==========================================================================
++ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $
++ * $Revision: #58 $
++ * $Date: 2011/09/15 $
++ * $Change: 1846647 $
++ *
++ * 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 "dwc_otg_os_dep.h"
++#include "usb.h"
++#include "dwc_otg_hcd_if.h"
++#include "dwc_otg_core_if.h"
++#include "dwc_list.h"
++#include "dwc_otg_cil.h"
++#include "dwc_otg_fiq_fsm.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 = 0,
++ DWC_OTG_TRANSACTION_PERIODIC = 1,
++ DWC_OTG_TRANSACTION_NON_PERIODIC = 2,
++ DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC
++} 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.<br>
++ * 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.<br>
++ * 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;
++
++ /*
++ ** Frame a NAK was received on this queue head, used to minimise NAK retransmission
++ */
++ uint16_t nak_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;
++
++ /** @} */
++
++
++ uint16_t speed;
++ uint16_t frame_usecs[8];
++
++ uint32_t skip_count;
++} dwc_otg_qh_t;
++
++DWC_CIRCLEQ_HEAD(hc_list, dwc_hc);
++
++typedef struct urb_tq_entry {
++ struct urb *urb;
++ DWC_TAILQ_ENTRY(urb_tq_entry) urb_tq_entries;
++} urb_tq_entry_t;
++
++DWC_TAILQ_HEAD(urb_list, urb_tq_entry);
++
++/**
++ * This structure holds the state of the HCD, including the non-periodic and
++ * periodic schedules.
++ */
++struct dwc_otg_hcd {
++ /** The DWC otg device pointer */
++ struct dwc_otg_device *otg_dev;
++ /** 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;
++
++ /**
++ * Total bandwidth claimed so far for all periodic transfers
++ * in a frame.
++ * This will include a mixture of HS and FS transfers.
++ * Units are microseconds per (micro)frame.
++ * We have a budget per frame and have to schedule
++ * transactions accordingly.
++ * Watch out for the fact that things are actually scheduled for the
++ * "next frame".
++ */
++ uint16_t frame_usecs[8];
++
++
++ /**
++ * Frame number read from the core at SOF. The value ranges from 0 to
++ * DWC_HFNUM_MAX_FRNUM.
++ */
++ uint16_t frame_number;
++
++ /**
++ * Count of periodic QHs, if using several eps. For SOF enable/disable.
++ */
++ uint16_t periodic_qh_count;
++
++ /**
++ * 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; /* microframe_schedule==0 */
++
++ /**
++ * Number of host channels assigned to non-periodic transfers.
++ */
++ int non_periodic_channels; /* microframe_schedule==0 */
++
++ /**
++ * Number of host channels assigned to non-periodic transfers.
++ */
++ int available_host_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_tasklet_t *completion_tasklet;
++ struct urb_list completed_urb_list;
++
++ /* */
++ dwc_spinlock_t *lock;
++ dwc_spinlock_t *channel_lock;
++ /**
++ * Private data that could be used by OS wrapper.
++ */
++ void *priv;
++
++ uint8_t otg_port;
++
++ /** Frame List */
++ uint32_t *frame_list;
++
++ /** Hub - Port assignment */
++ int hub_port[128];
++#ifdef FIQ_DEBUG
++ int hub_port_alloc[2048];
++#endif
++
++ /** Frame List DMA address */
++ dma_addr_t frame_list_dma;
++
++ struct fiq_stack *fiq_stack;
++ struct fiq_state *fiq_state;
++
++ /** Virtual address for split transaction DMA bounce buffers */
++ struct fiq_dma_blob *fiq_dmab;
++
++#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);
++
++int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh);
++void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh);
++
++extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh);
++extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh);
++extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num);
++
++/** @} */
++
++/** @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, int atomic_alloc);
++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_irqflags_t flags;
++ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);
++ dwc_otg_hcd_qh_remove(hcd, qh);
++ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags);
++ 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(int atomic_alloc)
++{
++ if (atomic_alloc)
++ return (dwc_otg_qh_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qh_t));
++ else
++ 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,
++ int atomic_alloc);
++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, int atomic_alloc);
++
++/** 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(int atomic_alloc)
++{
++ if (atomic_alloc)
++ return (dwc_otg_qtd_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qtd_t));
++ else
++ 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)
++{
++ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry);
++}
++
++/** Remove and free a QTD
++ * Need to disable IRQ and hold hcd lock while calling this function out of
++ * interrupt servicing chain */
++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 -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,1132 @@
+/*==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_ddma.c $
@@ -267647,875 +276035,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c linux-xbian-rp
+}
+
+#endif /* DWC_DEVICE_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd.h 2015-07-28 01:20:58.449142252 +0200
-@@ -0,0 +1,862 @@
-+/* ==========================================================================
-+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $
-+ * $Revision: #58 $
-+ * $Date: 2011/09/15 $
-+ * $Change: 1846647 $
-+ *
-+ * 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 "dwc_otg_os_dep.h"
-+#include "usb.h"
-+#include "dwc_otg_hcd_if.h"
-+#include "dwc_otg_core_if.h"
-+#include "dwc_list.h"
-+#include "dwc_otg_cil.h"
-+#include "dwc_otg_fiq_fsm.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 = 0,
-+ DWC_OTG_TRANSACTION_PERIODIC = 1,
-+ DWC_OTG_TRANSACTION_NON_PERIODIC = 2,
-+ DWC_OTG_TRANSACTION_ALL = DWC_OTG_TRANSACTION_PERIODIC + DWC_OTG_TRANSACTION_NON_PERIODIC
-+} 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.<br>
-+ * 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.<br>
-+ * 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;
-+
-+ /*
-+ ** Frame a NAK was received on this queue head, used to minimise NAK retransmission
-+ */
-+ uint16_t nak_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;
-+
-+ /** @} */
-+
-+
-+ uint16_t speed;
-+ uint16_t frame_usecs[8];
-+
-+ uint32_t skip_count;
-+} dwc_otg_qh_t;
-+
-+DWC_CIRCLEQ_HEAD(hc_list, dwc_hc);
-+
-+typedef struct urb_tq_entry {
-+ struct urb *urb;
-+ DWC_TAILQ_ENTRY(urb_tq_entry) urb_tq_entries;
-+} urb_tq_entry_t;
-+
-+DWC_TAILQ_HEAD(urb_list, urb_tq_entry);
-+
-+/**
-+ * This structure holds the state of the HCD, including the non-periodic and
-+ * periodic schedules.
-+ */
-+struct dwc_otg_hcd {
-+ /** The DWC otg device pointer */
-+ struct dwc_otg_device *otg_dev;
-+ /** 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;
-+
-+ /**
-+ * Total bandwidth claimed so far for all periodic transfers
-+ * in a frame.
-+ * This will include a mixture of HS and FS transfers.
-+ * Units are microseconds per (micro)frame.
-+ * We have a budget per frame and have to schedule
-+ * transactions accordingly.
-+ * Watch out for the fact that things are actually scheduled for the
-+ * "next frame".
-+ */
-+ uint16_t frame_usecs[8];
-+
-+
-+ /**
-+ * Frame number read from the core at SOF. The value ranges from 0 to
-+ * DWC_HFNUM_MAX_FRNUM.
-+ */
-+ uint16_t frame_number;
-+
-+ /**
-+ * Count of periodic QHs, if using several eps. For SOF enable/disable.
-+ */
-+ uint16_t periodic_qh_count;
-+
-+ /**
-+ * 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; /* microframe_schedule==0 */
-+
-+ /**
-+ * Number of host channels assigned to non-periodic transfers.
-+ */
-+ int non_periodic_channels; /* microframe_schedule==0 */
-+
-+ /**
-+ * Number of host channels assigned to non-periodic transfers.
-+ */
-+ int available_host_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_tasklet_t *completion_tasklet;
-+ struct urb_list completed_urb_list;
-+
-+ /* */
-+ dwc_spinlock_t *lock;
-+ dwc_spinlock_t *channel_lock;
-+ /**
-+ * Private data that could be used by OS wrapper.
-+ */
-+ void *priv;
-+
-+ uint8_t otg_port;
-+
-+ /** Frame List */
-+ uint32_t *frame_list;
-+
-+ /** Hub - Port assignment */
-+ int hub_port[128];
-+#ifdef FIQ_DEBUG
-+ int hub_port_alloc[2048];
-+#endif
-+
-+ /** Frame List DMA address */
-+ dma_addr_t frame_list_dma;
-+
-+ struct fiq_stack *fiq_stack;
-+ struct fiq_state *fiq_state;
-+
-+ /** Virtual address for split transaction DMA bounce buffers */
-+ struct fiq_dma_blob *fiq_dmab;
-+
-+#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);
-+
-+int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh);
-+void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh);
-+
-+extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh);
-+extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh);
-+extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num);
-+
-+/** @} */
-+
-+/** @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, int atomic_alloc);
-+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_irqflags_t flags;
-+ DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);
-+ dwc_otg_hcd_qh_remove(hcd, qh);
-+ DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags);
-+ 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(int atomic_alloc)
-+{
-+ if (atomic_alloc)
-+ return (dwc_otg_qh_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qh_t));
-+ else
-+ 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,
-+ int atomic_alloc);
-+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, int atomic_alloc);
-+
-+/** 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(int atomic_alloc)
-+{
-+ if (atomic_alloc)
-+ return (dwc_otg_qtd_t *) DWC_ALLOC_ATOMIC(sizeof(dwc_otg_qtd_t));
-+ else
-+ 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)
-+{
-+ DWC_CIRCLEQ_REMOVE(&qh->qtd_list, qtd, qtd_list_entry);
-+}
-+
-+/** Remove and free a QTD
-+ * Need to disable IRQ and hold hcd lock while calling this function out of
-+ * interrupt servicing chain */
-+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 -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,417 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_if.h $
@@ -268934,10 +276456,10 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h linux-xbian-rpi/
+
+#endif /* __DWC_HCD_IF_H__ */
+#endif /* DWC_DEVICE_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 2015-07-28 01:20:58.449142252 +0200
-@@ -0,0 +1,2712 @@
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c 2015-08-26 10:26:11.809358522 +0200
+@@ -0,0 +1,2714 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $
+ * $Revision: #89 $
@@ -271237,10 +278759,10 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-xbian-rp
+ dwc_urb->error_count++;
+ }
+ }
++ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1));
++
+ //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n",
+ // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count);
-+ hcd->fops->complete(hcd, dwc_urb->priv, dwc_urb, 0);
-+ release_channel(hcd, qh->channel, qtd, DWC_OTG_HC_XFER_URB_COMPLETE);
+}
+
+/**
@@ -271483,6 +279005,8 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-xbian-rp
+ * fail.
+ */
+ dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num);
++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0);
++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE);
+ break;
+
+ case FIQ_PER_SPLIT_LS_ABORTED:
@@ -271650,9 +279174,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c linux-xbian-rp
+ return retval;
+}
+#endif /* DWC_DEVICE_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,999 @@
+
+/* ==========================================================================
@@ -272653,9 +280177,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c linux-xbian-r
+}
+
+#endif /* DWC_DEVICE_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,957 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $
@@ -273614,9 +281138,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c linux-xbian-r
+}
+
+#endif /* DWC_DEVICE_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,188 @@
+#ifndef _DWC_OS_DEP_H_
+#define _DWC_OS_DEP_H_
@@ -273806,9 +281330,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h linux-xbian-rpi/
+
+
+#endif /* _DWC_OS_DEP_H_ */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.c 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,2712 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.c $
@@ -276522,9 +284046,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd.c linux-xbian-rpi/dri
+}
+
+#endif /* DWC_HOST_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd.h 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,266 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd.h $
@@ -276792,9 +284316,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd.h linux-xbian-rpi/dri
+extern void do_test_mode(void *data);
+#endif
+#endif /* DWC_HOST_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,360 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_if.h $
@@ -277156,9 +284680,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_if.h linux-xbian-rpi/
+#endif /* __DWC_PCD_IF_H__ */
+
+#endif /* DWC_HOST_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,5147 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_intr.c $
@@ -282307,9 +289831,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c linux-xbian-rp
+}
+
+#endif /* DWC_HOST_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,1360 @@
+ /* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $
@@ -283671,9 +291195,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c linux-xbian-r
+EXPORT_SYMBOL(usb_gadget_unregister_driver);
+
+#endif /* DWC_HOST_ONLY */
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_regs.h linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_regs.h
---- linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_regs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/dwc_otg_regs.h 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_regs.h linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_regs.h
+--- linux-4.1.6/drivers/usb/host/dwc_otg/dwc_otg_regs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/dwc_otg_regs.h 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,2550 @@
+/* ==========================================================================
+ * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_regs.h $
@@ -286225,95 +293749,29 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/dwc_otg_regs.h linux-xbian-rpi/dr
+} gpwrdn_data_t;
+
+#endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/Makefile linux-xbian-rpi/drivers/usb/host/dwc_otg/Makefile
---- linux-4.1.3/drivers/usb/host/dwc_otg/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/Makefile 2015-07-28 01:20:58.445156473 +0200
-@@ -0,0 +1,82 @@
-+#
-+# Makefile for DWC_otg Highspeed USB controller driver
-+#
-+
-+ifneq ($(KERNELRELEASE),)
-+
-+# Use the BUS_INTERFACE variable to compile the software for either
-+# PCI(PCI_INTERFACE) or LM(LM_INTERFACE) bus.
-+ifeq ($(BUS_INTERFACE),)
-+# BUS_INTERFACE = -DPCI_INTERFACE
-+# BUS_INTERFACE = -DLM_INTERFACE
-+ BUS_INTERFACE = -DPLATFORM_INTERFACE
-+endif
-+
-+#ccflags-y += -DDEBUG
-+#ccflags-y += -DDWC_OTG_DEBUGLEV=1 # reduce common debug msgs
-+
-+# Use one of the following flags to compile the software in host-only or
-+# device-only mode.
-+#ccflags-y += -DDWC_HOST_ONLY
-+#ccflags-y += -DDWC_DEVICE_ONLY
-+
-+ccflags-y += -Dlinux -DDWC_HS_ELECT_TST
-+#ccflags-y += -DDWC_EN_ISOC
-+ccflags-y += -I$(obj)/../dwc_common_port
-+#ccflags-y += -I$(PORTLIB)
-+ccflags-y += -DDWC_LINUX
-+ccflags-y += $(CFI)
-+ccflags-y += $(BUS_INTERFACE)
-+#ccflags-y += -DDWC_DEV_SRPCAP
-+
-+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
-+dwc_otg-objs += dwc_otg_adp.o
-+dwc_otg-objs += dwc_otg_fiq_fsm.o
-+dwc_otg-objs += dwc_otg_fiq_stub.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)
-+ccflags-y += $(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
-+ $(MAKE) -C$(KDIR) M=$(PORTLIB) modules_install
-+ $(MAKE) -C$(KDIR) M=$(PWD) modules_install
-+
-+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)
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/test/Makefile linux-rpi/drivers/usb/host/dwc_otg/test/Makefile
+--- linux-4.1.6/drivers/usb/host/dwc_otg/test/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/test/Makefile 2015-08-26 10:26:11.809358522 +0200
+@@ -0,0 +1,16 @@
+
++PERL=/usr/bin/perl
++PL_TESTS=test_sysfs.pl test_mod_param.pl
+
-+clean:
-+ rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers
++.PHONY : test
++test : perl_tests
+
-+endif
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm linux-xbian-rpi/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm
---- linux-4.1.3/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm 2015-07-28 01:20:58.449142252 +0200
++perl_tests :
++ @echo
++ @echo Running perl tests
++ @for test in $(PL_TESTS); do \
++ if $(PERL) ./$$test ; then \
++ echo "=======> $$test, PASSED" ; \
++ else echo "=======> $$test, FAILED" ; \
++ fi \
++ done
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm linux-rpi/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm
+--- linux-4.1.6/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,337 @@
+package dwc_otg_test;
+
@@ -286652,29 +294110,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/dwc_otg_test.pm linux-xbian-
+);
+
+1;
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/Makefile linux-xbian-rpi/drivers/usb/host/dwc_otg/test/Makefile
---- linux-4.1.3/drivers/usb/host/dwc_otg/test/Makefile 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/test/Makefile 2015-07-28 01:20:58.449142252 +0200
-@@ -0,0 +1,16 @@
-+
-+PERL=/usr/bin/perl
-+PL_TESTS=test_sysfs.pl test_mod_param.pl
-+
-+.PHONY : test
-+test : perl_tests
-+
-+perl_tests :
-+ @echo
-+ @echo Running perl tests
-+ @for test in $(PL_TESTS); do \
-+ if $(PERL) ./$$test ; then \
-+ echo "=======> $$test, PASSED" ; \
-+ else echo "=======> $$test, FAILED" ; \
-+ fi \
-+ done
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/test_mod_param.pl linux-xbian-rpi/drivers/usb/host/dwc_otg/test/test_mod_param.pl
---- linux-4.1.3/drivers/usb/host/dwc_otg/test/test_mod_param.pl 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/test/test_mod_param.pl 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/test/test_mod_param.pl linux-rpi/drivers/usb/host/dwc_otg/test/test_mod_param.pl
+--- linux-4.1.6/drivers/usb/host/dwc_otg/test/test_mod_param.pl 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/test/test_mod_param.pl 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,133 @@
+#!/usr/bin/perl -w
+#
@@ -286809,9 +294247,9 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/test_mod_param.pl linux-xbia
+
+test_main();
+0;
-diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/test_sysfs.pl linux-xbian-rpi/drivers/usb/host/dwc_otg/test/test_sysfs.pl
---- linux-4.1.3/drivers/usb/host/dwc_otg/test/test_sysfs.pl 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/usb/host/dwc_otg/test/test_sysfs.pl 2015-07-28 01:20:58.449142252 +0200
+diff -Nur linux-4.1.6/drivers/usb/host/dwc_otg/test/test_sysfs.pl linux-rpi/drivers/usb/host/dwc_otg/test/test_sysfs.pl
+--- linux-4.1.6/drivers/usb/host/dwc_otg/test/test_sysfs.pl 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/usb/host/dwc_otg/test/test_sysfs.pl 2015-08-26 10:26:11.809358522 +0200
@@ -0,0 +1,193 @@
+#!/usr/bin/perl -w
+#
@@ -287006,55 +294444,69 @@ diff -Nur linux-4.1.3/drivers/usb/host/dwc_otg/test/test_sysfs.pl linux-xbian-rp
+
+test_main();
+0;
-diff -Nur linux-4.1.3/drivers/usb/host/Kconfig linux-xbian-rpi/drivers/usb/host/Kconfig
---- linux-4.1.3/drivers/usb/host/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/host/Kconfig 2015-07-28 01:20:58.441170694 +0200
-@@ -738,6 +738,19 @@
- To compile this driver a module, choose M here: the module
- will be called "hwa-hc".
+diff -Nur linux-4.1.6/drivers/video/fbdev/Kconfig linux-rpi/drivers/video/fbdev/Kconfig
+--- linux-4.1.6/drivers/video/fbdev/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/video/fbdev/Kconfig 2015-08-26 10:26:11.873359401 +0200
+@@ -224,6 +224,20 @@
+ comment "Frame buffer hardware drivers"
+ depends on FB
-+config USB_DWCOTG
-+ tristate "Synopsis DWC host support"
-+ depends on USB
++config FB_BCM2708
++ tristate "BCM2708 framebuffer support"
++ depends on FB && RASPBERRYPI_FIRMWARE
++ 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 <file:Documentation/kbuild/modules.txt>. 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 FB_GRVGA
+ tristate "Aeroflex Gaisler framebuffer support"
+ depends on FB && SPARC
+@@ -2481,3 +2495,16 @@
+ help
+ This driver implements support for the Solomon SSD1307
+ OLED controller over I2C.
+
- config USB_IMX21_HCD
- tristate "i.MX21 HCD support"
- depends on ARM && ARCH_MXC
-diff -Nur linux-4.1.3/drivers/usb/host/Makefile linux-xbian-rpi/drivers/usb/host/Makefile
---- linux-4.1.3/drivers/usb/host/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/host/Makefile 2015-07-28 01:20:58.441170694 +0200
-@@ -68,6 +68,8 @@
- obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
- obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
- obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o
++config FB_RPISENSE
++ tristate "Raspberry Pi Sense HAT framebuffer"
++ depends on FB
++ select MFD_RPISENSE_CORE
++ select FB_SYS_FOPS
++ select FB_SYS_FILLRECT
++ select FB_SYS_COPYAREA
++ select FB_SYS_IMAGEBLIT
++ select FB_DEFERRED_IO
+
-+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_HCD_BCMA) += bcma-hcd.o
-diff -Nur linux-4.1.3/drivers/usb/Makefile linux-xbian-rpi/drivers/usb/Makefile
---- linux-4.1.3/drivers/usb/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/usb/Makefile 2015-07-28 01:20:58.437184915 +0200
-@@ -7,6 +7,7 @@
- obj-$(CONFIG_USB) += core/
- obj-$(CONFIG_USB_SUPPORT) += phy/
++ help
++ This is the framebuffer driver for the Raspberry Pi Sense HAT
+diff -Nur linux-4.1.6/drivers/video/fbdev/Makefile linux-rpi/drivers/video/fbdev/Makefile
+--- linux-4.1.6/drivers/video/fbdev/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/video/fbdev/Makefile 2015-08-26 10:26:11.873359401 +0200
+@@ -12,6 +12,7 @@
+ obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o
-+obj-$(CONFIG_USB_DWCOTG) += host/
- obj-$(CONFIG_USB_DWC3) += dwc3/
- obj-$(CONFIG_USB_DWC2) += dwc2/
- obj-$(CONFIG_USB_ISP1760) += isp1760/
-diff -Nur linux-4.1.3/drivers/video/fbdev/bcm2708_fb.c linux-xbian-rpi/drivers/video/fbdev/bcm2708_fb.c
---- linux-4.1.3/drivers/video/fbdev/bcm2708_fb.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/video/fbdev/bcm2708_fb.c 2015-07-28 01:20:58.453128032 +0200
+ # Hardware specific drivers go first
++obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o
+ obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o
+ obj-$(CONFIG_FB_ARC) += arcfb.o
+ obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o
+@@ -149,6 +150,7 @@
+ obj-$(CONFIG_FB_MXS) += mxsfb.o
+ obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o
+ obj-$(CONFIG_FB_SIMPLE) += simplefb.o
++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o
+
+ # the test framebuffer is last
+ obj-$(CONFIG_FB_VIRTUAL) += vfb.o
+diff -Nur linux-4.1.6/drivers/video/fbdev/bcm2708_fb.c linux-rpi/drivers/video/fbdev/bcm2708_fb.c
+--- linux-4.1.6/drivers/video/fbdev/bcm2708_fb.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/video/fbdev/bcm2708_fb.c 2015-08-26 10:26:11.877359456 +0200
@@ -0,0 +1,853 @@
+/*
+ * linux/drivers/video/bcm2708_fb.c
@@ -287909,9 +295361,9 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/bcm2708_fb.c linux-xbian-rpi/drivers/v
+MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer");
+MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer");
+MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes");
-diff -Nur linux-4.1.3/drivers/video/fbdev/core/cfbimgblt.c linux-xbian-rpi/drivers/video/fbdev/core/cfbimgblt.c
---- linux-4.1.3/drivers/video/fbdev/core/cfbimgblt.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/video/fbdev/core/cfbimgblt.c 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/video/fbdev/core/cfbimgblt.c linux-rpi/drivers/video/fbdev/core/cfbimgblt.c
+--- linux-4.1.6/drivers/video/fbdev/core/cfbimgblt.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/video/fbdev/core/cfbimgblt.c 2015-08-26 10:26:11.881359511 +0200
@@ -28,6 +28,11 @@
*
* Also need to add code to deal with cards endians that are different than
@@ -288085,9 +295537,9 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/core/cfbimgblt.c linux-xbian-rpi/drive
slow_imageblit(image, p, dst1, fgcolor, bgcolor,
start_index, pitch_index);
} else
-diff -Nur linux-4.1.3/drivers/video/fbdev/core/fbmem.c linux-xbian-rpi/drivers/video/fbdev/core/fbmem.c
---- linux-4.1.3/drivers/video/fbdev/core/fbmem.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/video/fbdev/core/fbmem.c 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/video/fbdev/core/fbmem.c linux-rpi/drivers/video/fbdev/core/fbmem.c
+--- linux-4.1.6/drivers/video/fbdev/core/fbmem.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/video/fbdev/core/fbmem.c 2015-08-26 10:26:11.881359511 +0200
@@ -1084,6 +1084,25 @@
}
EXPORT_SYMBOL(fb_blank);
@@ -288146,70 +295598,10 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/core/fbmem.c linux-xbian-rpi/drivers/v
arg = (unsigned long) compat_ptr(arg);
case FBIOBLANK:
ret = do_fb_ioctl(info, cmd, arg);
-diff -Nur linux-4.1.3/drivers/video/fbdev/Kconfig linux-xbian-rpi/drivers/video/fbdev/Kconfig
---- linux-4.1.3/drivers/video/fbdev/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/video/fbdev/Kconfig 2015-07-28 01:20:58.453128032 +0200
-@@ -224,6 +224,20 @@
- comment "Frame buffer hardware drivers"
- depends on FB
-
-+config FB_BCM2708
-+ tristate "BCM2708 framebuffer support"
-+ depends on FB && ARM && BCM2708_MBOX
-+ 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 <file:Documentation/kbuild/modules.txt>. The module
-+ will be called bcm2708_fb.
-+
- config FB_GRVGA
- tristate "Aeroflex Gaisler framebuffer support"
- depends on FB && SPARC
-@@ -2481,3 +2495,16 @@
- help
- This driver implements support for the Solomon SSD1307
- OLED controller over I2C.
-+
-+config FB_RPISENSE
-+ tristate "Raspberry Pi Sense HAT framebuffer"
-+ depends on FB
-+ select MFD_RPISENSE_CORE
-+ select FB_SYS_FOPS
-+ select FB_SYS_FILLRECT
-+ select FB_SYS_COPYAREA
-+ select FB_SYS_IMAGEBLIT
-+ select FB_DEFERRED_IO
-+
-+ help
-+ This is the framebuffer driver for the Raspberry Pi Sense HAT
-diff -Nur linux-4.1.3/drivers/video/fbdev/Makefile linux-xbian-rpi/drivers/video/fbdev/Makefile
---- linux-4.1.3/drivers/video/fbdev/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/video/fbdev/Makefile 2015-07-28 01:20:58.453128032 +0200
-@@ -12,6 +12,7 @@
- obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o
-
- # Hardware specific drivers go first
-+obj-$(CONFIG_FB_BCM2708) += bcm2708_fb.o
- obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o
- obj-$(CONFIG_FB_ARC) += arcfb.o
- obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o
-@@ -149,6 +150,7 @@
- obj-$(CONFIG_FB_MXS) += mxsfb.o
- obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o
- obj-$(CONFIG_FB_SIMPLE) += simplefb.o
-+obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o
-
- # the test framebuffer is last
- obj-$(CONFIG_FB_VIRTUAL) += vfb.o
-diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/video/fbdev/rpisense-fb.c
---- linux-4.1.3/drivers/video/fbdev/rpisense-fb.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/video/fbdev/rpisense-fb.c 2015-07-28 01:20:58.453128032 +0200
-@@ -0,0 +1,235 @@
+diff -Nur linux-4.1.6/drivers/video/fbdev/rpisense-fb.c linux-rpi/drivers/video/fbdev/rpisense-fb.c
+--- linux-4.1.6/drivers/video/fbdev/rpisense-fb.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/video/fbdev/rpisense-fb.c 2015-08-26 10:26:11.905359841 +0200
+@@ -0,0 +1,293 @@
+/*
+ * Raspberry Pi Sense HAT framebuffer driver
+ * http://raspberrypi.org
@@ -288231,6 +295623,7 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
++#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
@@ -288238,22 +295631,35 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/
+#include <linux/mfd/rpisense/framebuffer.h>
+#include <linux/mfd/rpisense/core.h>
+
++static bool lowlight;
++module_param(lowlight, bool, 0);
++MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third");
++
+struct rpisense *rpisense;
+
+struct rpisense_fb_param {
+ char __iomem *vmem;
+ u8 *vmem_work;
+ u32 vmemsize;
-+ u8 gamma[32];
++ u8 *gamma;
+};
+
++static u8 gamma_default[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07,
++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11,
++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,};
++
++static u8 gamma_low[32] = {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
++ 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06,
++ 0x06, 0x07, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0A,};
++
++static u8 gamma_user[32];
++
+static struct rpisense_fb_param rpisense_fb_param = {
+ .vmem = NULL,
+ .vmemsize = 128,
-+ .gamma = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-+ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07,
-+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11,
-+ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,},
++ .gamma = gamma_default,
+};
+
+static struct fb_deferred_io rpisense_fb_defio;
@@ -288339,6 +295745,46 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/
+ .deferred_io = rpisense_fb_deferred_io,
+};
+
++static int rpisense_fb_ioctl(struct fb_info *info, unsigned int cmd,
++ unsigned long arg)
++{
++ switch (cmd) {
++ case SENSEFB_FBIOGET_GAMMA:
++ if (copy_to_user((void __user *) arg, rpisense_fb_param.gamma,
++ sizeof(u8[32])))
++ return -EFAULT;
++ return 0;
++ case SENSEFB_FBIOSET_GAMMA:
++ if (copy_from_user(gamma_user, (void __user *)arg,
++ sizeof(u8[32])))
++ return -EFAULT;
++ rpisense_fb_param.gamma = gamma_user;
++ schedule_delayed_work(&info->deferred_work,
++ rpisense_fb_defio.delay);
++ return 0;
++ case SENSEFB_FBIORESET_GAMMA:
++ switch (arg) {
++ case 0:
++ rpisense_fb_param.gamma = gamma_default;
++ break;
++ case 1:
++ rpisense_fb_param.gamma = gamma_low;
++ break;
++ case 2:
++ rpisense_fb_param.gamma = gamma_user;
++ break;
++ default:
++ return -EINVAL;
++ }
++ schedule_delayed_work(&info->deferred_work,
++ rpisense_fb_defio.delay);
++ break;
++ default:
++ return -EINVAL;
++ }
++ return 0;
++}
++
+static struct fb_ops rpisense_fb_ops = {
+ .owner = THIS_MODULE,
+ .fb_read = fb_sys_read,
@@ -288346,6 +295792,7 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/
+ .fb_fillrect = rpisense_fb_fillrect,
+ .fb_copyarea = rpisense_fb_copyarea,
+ .fb_imageblit = rpisense_fb_imageblit,
++ .fb_ioctl = rpisense_fb_ioctl,
+};
+
+static int rpisense_fb_probe(struct platform_device *pdev)
@@ -288383,6 +295830,9 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/
+ info->screen_base = rpisense_fb_param.vmem;
+ info->screen_size = rpisense_fb_param.vmemsize;
+
++ if (lowlight)
++ rpisense_fb_param.gamma = gamma_low;
++
+ fb_deferred_io_init(info);
+
+ ret = register_framebuffer(info);
@@ -288445,9 +295895,9 @@ diff -Nur linux-4.1.3/drivers/video/fbdev/rpisense-fb.c linux-xbian-rpi/drivers/
+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>");
+MODULE_LICENSE("GPL");
+
-diff -Nur linux-4.1.3/drivers/video/logo/logo_linux_clut224.ppm linux-xbian-rpi/drivers/video/logo/logo_linux_clut224.ppm
---- linux-4.1.3/drivers/video/logo/logo_linux_clut224.ppm 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/video/logo/logo_linux_clut224.ppm 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/video/logo/logo_linux_clut224.ppm linux-rpi/drivers/video/logo/logo_linux_clut224.ppm
+--- linux-4.1.6/drivers/video/logo/logo_linux_clut224.ppm 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/video/logo/logo_linux_clut224.ppm 2015-08-26 10:26:11.921360061 +0200
@@ -1,1604 +1,883 @@
P3
-# Standard 224-color Linux logo
@@ -290934,9 +298384,9 @@ diff -Nur linux-4.1.3/drivers/video/logo/logo_linux_clut224.ppm linux-xbian-rpi/
+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 -Nur linux-4.1.3/drivers/w1/masters/w1-gpio.c linux-xbian-rpi/drivers/w1/masters/w1-gpio.c
---- linux-4.1.3/drivers/w1/masters/w1-gpio.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/w1/masters/w1-gpio.c 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/w1/masters/w1-gpio.c linux-rpi/drivers/w1/masters/w1-gpio.c
+--- linux-4.1.6/drivers/w1/masters/w1-gpio.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/w1/masters/w1-gpio.c 2015-08-26 10:26:11.929360171 +0200
@@ -23,6 +23,19 @@
#include "../w1.h"
#include "../w1_int.h"
@@ -291071,44 +298521,10 @@ diff -Nur linux-4.1.3/drivers/w1/masters/w1-gpio.c linux-xbian-rpi/drivers/w1/ma
return 0;
}
-diff -Nur linux-4.1.3/drivers/w1/slaves/w1_therm.c linux-xbian-rpi/drivers/w1/slaves/w1_therm.c
---- linux-4.1.3/drivers/w1/slaves/w1_therm.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/w1/slaves/w1_therm.c 2015-07-28 01:20:58.453128032 +0200
-@@ -59,16 +59,32 @@
- static int w1_strong_pullup = 1;
- module_param_named(strong_pullup, w1_strong_pullup, int, 0);
-
-+struct w1_therm_family_data {
-+ uint8_t rom[9];
-+ atomic_t refcnt;
-+};
-+
-+/* return the address of the refcnt in the family data */
-+#define THERM_REFCNT(family_data) \
-+ (&((struct w1_therm_family_data*)family_data)->refcnt)
-+
- static int w1_therm_add_slave(struct w1_slave *sl)
- {
-- sl->family_data = kzalloc(9, GFP_KERNEL);
-+ sl->family_data = kzalloc(sizeof(struct w1_therm_family_data),
-+ GFP_KERNEL);
- if (!sl->family_data)
- return -ENOMEM;
-+ atomic_set(THERM_REFCNT(sl->family_data), 1);
- return 0;
- }
-
- static void w1_therm_remove_slave(struct w1_slave *sl)
- {
-+ int refcnt = atomic_sub_return(1, THERM_REFCNT(sl->family_data));
-+ while(refcnt) {
-+ msleep(1000);
-+ refcnt = atomic_read(THERM_REFCNT(sl->family_data));
-+ }
- kfree(sl->family_data);
- sl->family_data = NULL;
- }
-@@ -76,13 +92,24 @@
+diff -Nur linux-4.1.6/drivers/w1/slaves/w1_therm.c linux-rpi/drivers/w1/slaves/w1_therm.c
+--- linux-4.1.6/drivers/w1/slaves/w1_therm.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/w1/slaves/w1_therm.c 2015-08-26 10:26:11.929360171 +0200
+@@ -92,13 +92,24 @@
static ssize_t w1_slave_show(struct device *device,
struct device_attribute *attr, char *buf);
@@ -291133,7 +298549,7 @@ diff -Nur linux-4.1.3/drivers/w1/slaves/w1_therm.c linux-xbian-rpi/drivers/w1/sl
static struct w1_family_ops w1_therm_fops = {
.add_slave = w1_therm_add_slave,
-@@ -90,6 +117,12 @@
+@@ -106,6 +117,12 @@
.groups = w1_therm_groups,
};
@@ -291146,7 +298562,7 @@ diff -Nur linux-4.1.3/drivers/w1/slaves/w1_therm.c linux-xbian-rpi/drivers/w1/sl
static struct w1_family w1_therm_family_DS18S20 = {
.fid = W1_THERM_DS18S20,
.fops = &w1_therm_fops,
-@@ -107,7 +140,7 @@
+@@ -123,7 +140,7 @@
static struct w1_family w1_therm_family_DS28EA00 = {
.fid = W1_THERM_DS28EA00,
@@ -291155,86 +298571,10 @@ diff -Nur linux-4.1.3/drivers/w1/slaves/w1_therm.c linux-xbian-rpi/drivers/w1/sl
};
static struct w1_family w1_therm_family_DS1825 = {
-@@ -194,13 +227,22 @@
- struct w1_slave *sl = dev_to_w1_slave(device);
- struct w1_master *dev = sl->master;
- u8 rom[9], crc, verdict, external_power;
-- int i, max_trying = 10;
-+ int i, ret, max_trying = 10;
- ssize_t c = PAGE_SIZE;
-+ u8 *family_data = sl->family_data;
-
-- i = mutex_lock_interruptible(&dev->bus_mutex);
-- if (i != 0)
-- return i;
-+ ret = mutex_lock_interruptible(&dev->bus_mutex);
-+ if (ret != 0)
-+ goto post_unlock;
-+
-+ if(!sl->family_data)
-+ {
-+ ret = -ENODEV;
-+ goto pre_unlock;
-+ }
-
-+ /* prevent the slave from going away in sleep */
-+ atomic_inc(THERM_REFCNT(family_data));
- memset(rom, 0, sizeof(rom));
-
- while (max_trying--) {
-@@ -230,17 +272,19 @@
- mutex_unlock(&dev->bus_mutex);
-
- sleep_rem = msleep_interruptible(tm);
-- if (sleep_rem != 0)
-- return -EINTR;
-+ if (sleep_rem != 0) {
-+ ret = -EINTR;
-+ goto post_unlock;
-+ }
-
-- i = mutex_lock_interruptible(&dev->bus_mutex);
-- if (i != 0)
-- return i;
-+ ret = mutex_lock_interruptible(&dev->bus_mutex);
-+ if (ret != 0)
-+ goto post_unlock;
- } else if (!w1_strong_pullup) {
- sleep_rem = msleep_interruptible(tm);
- if (sleep_rem != 0) {
-- mutex_unlock(&dev->bus_mutex);
-- return -EINTR;
-+ ret = -EINTR;
-+ goto pre_unlock;
- }
- }
-
-@@ -269,19 +313,107 @@
- c -= snprintf(buf + PAGE_SIZE - c, c, ": crc=%02x %s\n",
- crc, (verdict) ? "YES" : "NO");
- if (verdict)
-- memcpy(sl->family_data, rom, sizeof(rom));
-+ memcpy(family_data, rom, sizeof(rom));
- else
- dev_warn(device, "Read failed CRC check\n");
-
- for (i = 0; i < 9; ++i)
- c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ",
-- ((u8 *)sl->family_data)[i]);
-+ ((u8 *)family_data)[i]);
-
- c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n",
- w1_convert_temp(rom, sl->family->fid));
-+ ret = PAGE_SIZE - c;
-+
-+pre_unlock:
- mutex_unlock(&dev->bus_mutex);
+@@ -316,6 +333,89 @@
+ return ret;
+ }
-+post_unlock:
-+ atomic_dec(THERM_REFCNT(family_data));
-+ return ret;
-+}
-+
+#define W1_42_CHAIN 0x99
+#define W1_42_CHAIN_OFF 0x3C
+#define W1_42_CHAIN_OFF_INV 0xC3
@@ -291312,16 +298652,18 @@ diff -Nur linux-4.1.3/drivers/w1/slaves/w1_therm.c linux-xbian-rpi/drivers/w1/sl
+ mutex_unlock(&sl->master->bus_mutex);
+
+ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq);
- return PAGE_SIZE - c;
++ return PAGE_SIZE - c;
+error:
+ mutex_unlock(&sl->master->bus_mutex);
+ return -EIO;
- }
-
++}
++
static int __init w1_therm_init(void)
-diff -Nur linux-4.1.3/drivers/w1/w1.h linux-xbian-rpi/drivers/w1/w1.h
---- linux-4.1.3/drivers/w1/w1.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/w1/w1.h 2015-07-28 01:20:58.453128032 +0200
+ {
+ int err, i;
+diff -Nur linux-4.1.6/drivers/w1/w1.h linux-rpi/drivers/w1/w1.h
+--- linux-4.1.6/drivers/w1/w1.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/w1/w1.h 2015-08-26 10:26:11.929360171 +0200
@@ -171,6 +171,12 @@
u8 (*set_pullup)(void *, int);
@@ -291335,9 +298677,9 @@ diff -Nur linux-4.1.3/drivers/w1/w1.h linux-xbian-rpi/drivers/w1/w1.h
void (*search)(void *, struct w1_master *,
u8, w1_slave_found_callback);
};
-diff -Nur linux-4.1.3/drivers/w1/w1_int.c linux-xbian-rpi/drivers/w1/w1_int.c
---- linux-4.1.3/drivers/w1/w1_int.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/w1/w1_int.c 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/w1/w1_int.c linux-rpi/drivers/w1/w1_int.c
+--- linux-4.1.6/drivers/w1/w1_int.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/w1/w1_int.c 2015-08-26 10:26:11.929360171 +0200
@@ -123,6 +123,20 @@
return(-EINVAL);
}
@@ -291359,9 +298701,9 @@ diff -Nur linux-4.1.3/drivers/w1/w1_int.c linux-xbian-rpi/drivers/w1/w1_int.c
/* Lock until the device is added (or not) to w1_masters. */
mutex_lock(&w1_mlock);
/* Search for the first available id (starting at 1). */
-diff -Nur linux-4.1.3/drivers/w1/w1_io.c linux-xbian-rpi/drivers/w1/w1_io.c
---- linux-4.1.3/drivers/w1/w1_io.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/w1/w1_io.c 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/w1/w1_io.c linux-rpi/drivers/w1/w1_io.c
+--- linux-4.1.6/drivers/w1/w1_io.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/w1/w1_io.c 2015-08-26 10:26:11.929360171 +0200
@@ -134,10 +134,22 @@
static void w1_post_write(struct w1_master *dev)
{
@@ -291388,9 +298730,45 @@ diff -Nur linux-4.1.3/drivers/w1/w1_io.c linux-xbian-rpi/drivers/w1/w1_io.c
dev->pullup_duration = 0;
}
}
-diff -Nur linux-4.1.3/drivers/watchdog/bcm2708_wdog.c linux-xbian-rpi/drivers/watchdog/bcm2708_wdog.c
---- linux-4.1.3/drivers/watchdog/bcm2708_wdog.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/drivers/watchdog/bcm2708_wdog.c 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/drivers/watchdog/Kconfig linux-rpi/drivers/watchdog/Kconfig
+--- linux-4.1.6/drivers/watchdog/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/watchdog/Kconfig 2015-08-26 10:26:11.929360171 +0200
+@@ -451,6 +451,12 @@
+ To compile this driver as a module, choose M here: the
+ module will be called retu_wdt.
+
++config BCM2708_WDT
++ tristate "BCM2708 Watchdog"
++ depends on ARCH_BCM2708 || ARCH_BCM2709
++ help
++ Enables BCM2708 watchdog support.
++
+ config MOXART_WDT
+ tristate "MOXART watchdog"
+ depends on ARCH_MOXART
+@@ -1216,7 +1222,7 @@
+
+ config BCM2835_WDT
+ tristate "Broadcom BCM2835 hardware watchdog"
+- depends on ARCH_BCM2835
++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
+ select WATCHDOG_CORE
+ help
+ Watchdog driver for the built in watchdog hardware in Broadcom
+diff -Nur linux-4.1.6/drivers/watchdog/Makefile linux-rpi/drivers/watchdog/Makefile
+--- linux-4.1.6/drivers/watchdog/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/drivers/watchdog/Makefile 2015-08-26 10:26:11.929360171 +0200
+@@ -56,6 +56,7 @@
+ obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
+ obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
+ obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
++obj-$(CONFIG_BCM2708_WDT) += bcm2708_wdog.o
+ obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
+ obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o
+ obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o
+diff -Nur linux-4.1.6/drivers/watchdog/bcm2708_wdog.c linux-rpi/drivers/watchdog/bcm2708_wdog.c
+--- linux-4.1.6/drivers/watchdog/bcm2708_wdog.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/drivers/watchdog/bcm2708_wdog.c 2015-08-26 10:26:11.929360171 +0200
@@ -0,0 +1,382 @@
+/*
+ * Broadcom BCM2708 watchdog driver.
@@ -291774,689 +299152,9 @@ diff -Nur linux-4.1.3/drivers/watchdog/bcm2708_wdog.c linux-xbian-rpi/drivers/wa
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
+MODULE_ALIAS_MISCDEV(TEMP_MINOR);
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/drivers/watchdog/Kconfig linux-xbian-rpi/drivers/watchdog/Kconfig
---- linux-4.1.3/drivers/watchdog/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/watchdog/Kconfig 2015-07-28 01:20:58.453128032 +0200
-@@ -451,6 +451,12 @@
- To compile this driver as a module, choose M here: the
- module will be called retu_wdt.
-
-+config BCM2708_WDT
-+ tristate "BCM2708 Watchdog"
-+ depends on ARCH_BCM2708 || ARCH_BCM2709
-+ help
-+ Enables BCM2708 watchdog support.
-+
- config MOXART_WDT
- tristate "MOXART watchdog"
- depends on ARCH_MOXART
-@@ -1216,7 +1222,7 @@
-
- config BCM2835_WDT
- tristate "Broadcom BCM2835 hardware watchdog"
-- depends on ARCH_BCM2835
-+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
- select WATCHDOG_CORE
- help
- Watchdog driver for the built in watchdog hardware in Broadcom
-diff -Nur linux-4.1.3/drivers/watchdog/Makefile linux-xbian-rpi/drivers/watchdog/Makefile
---- linux-4.1.3/drivers/watchdog/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/drivers/watchdog/Makefile 2015-07-28 01:20:58.453128032 +0200
-@@ -56,6 +56,7 @@
- obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
- obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
- obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
-+obj-$(CONFIG_BCM2708_WDT) += bcm2708_wdog.o
- obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
- obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o
- obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o
-diff -Nur linux-4.1.3/fs/btrfs/compression.c linux-xbian-rpi/fs/btrfs/compression.c
---- linux-4.1.3/fs/btrfs/compression.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/compression.c 2015-07-27 23:13:08.905209516 +0200
-@@ -753,6 +753,8 @@
- static const struct btrfs_compress_op * const btrfs_compress_op[] = {
- &btrfs_zlib_compress,
- &btrfs_lzo_compress,
-+ &btrfs_lz4_compress,
-+ &btrfs_lz4hc_compress,
- };
-
- void __init btrfs_init_compress(void)
-diff -Nur linux-4.1.3/fs/btrfs/compression.h linux-xbian-rpi/fs/btrfs/compression.h
---- linux-4.1.3/fs/btrfs/compression.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/compression.h 2015-07-27 23:13:08.905209516 +0200
-@@ -79,5 +79,7 @@
-
- extern const struct btrfs_compress_op btrfs_zlib_compress;
- extern const struct btrfs_compress_op btrfs_lzo_compress;
-+extern const struct btrfs_compress_op btrfs_lz4_compress;
-+extern const struct btrfs_compress_op btrfs_lz4hc_compress;
-
- #endif
-diff -Nur linux-4.1.3/fs/btrfs/ctree.h linux-xbian-rpi/fs/btrfs/ctree.h
---- linux-4.1.3/fs/btrfs/ctree.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/ctree.h 2015-07-27 23:13:08.909195295 +0200
-@@ -504,13 +504,7 @@
- #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
- #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
- #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
--/*
-- * some patches floated around with a second compression method
-- * lets save that incompat here for when they do get in
-- * Note we don't actually support it, we're just reserving the
-- * number
-- */
--#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2 (1ULL << 4)
-+#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZ4 (1ULL << 4)
-
- /*
- * older kernels tried to do bigger metadata blocks, but the
-@@ -539,6 +533,7 @@
- BTRFS_FEATURE_INCOMPAT_RAID56 | \
- BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF | \
- BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA | \
-+ BTRFS_FEATURE_INCOMPAT_COMPRESS_LZ4 | \
- BTRFS_FEATURE_INCOMPAT_NO_HOLES)
-
- #define BTRFS_FEATURE_INCOMPAT_SAFE_SET \
-@@ -709,8 +704,10 @@
- BTRFS_COMPRESS_NONE = 0,
- BTRFS_COMPRESS_ZLIB = 1,
- BTRFS_COMPRESS_LZO = 2,
-- BTRFS_COMPRESS_TYPES = 2,
-- BTRFS_COMPRESS_LAST = 3,
-+ BTRFS_COMPRESS_LZ4 = 3,
-+ BTRFS_COMPRESS_LZ4HC = 4,
-+ BTRFS_COMPRESS_TYPES = 4,
-+ BTRFS_COMPRESS_LAST = 5,
- };
-
- struct btrfs_inode_item {
-diff -Nur linux-4.1.3/fs/btrfs/disk-io.c linux-xbian-rpi/fs/btrfs/disk-io.c
---- linux-4.1.3/fs/btrfs/disk-io.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/disk-io.c 2015-07-27 23:13:08.909195295 +0200
-@@ -2703,6 +2703,10 @@
- if (tree_root->fs_info->compress_type == BTRFS_COMPRESS_LZO)
- features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
-
-+ if (tree_root->fs_info->compress_type == BTRFS_COMPRESS_LZ4 ||
-+ tree_root->fs_info->compress_type == BTRFS_COMPRESS_LZ4HC)
-+ features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZ4;
-+
- if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
- printk(KERN_INFO "BTRFS: has skinny extents\n");
-
-diff -Nur linux-4.1.3/fs/btrfs/ioctl.c linux-xbian-rpi/fs/btrfs/ioctl.c
---- linux-4.1.3/fs/btrfs/ioctl.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/ioctl.c 2015-07-27 23:13:08.921152633 +0200
-@@ -1439,6 +1439,10 @@
- if (range->compress_type == BTRFS_COMPRESS_LZO) {
- btrfs_set_fs_incompat(root->fs_info, COMPRESS_LZO);
- }
-+ if (range->compress_type == BTRFS_COMPRESS_LZ4 ||
-+ range->compress_type == BTRFS_COMPRESS_LZ4HC) {
-+ btrfs_set_fs_incompat(root->fs_info, COMPRESS_LZ4);
-+ }
-
- ret = defrag_count;
-
-diff -Nur linux-4.1.3/fs/btrfs/lz4_wrapper.c linux-xbian-rpi/fs/btrfs/lz4_wrapper.c
---- linux-4.1.3/fs/btrfs/lz4_wrapper.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/fs/btrfs/lz4_wrapper.c 2015-07-27 23:13:08.921152633 +0200
-@@ -0,0 +1,487 @@
-+/*
-+ * Copyright (C) 2008 Oracle. All rights reserved.
-+ * Copyright (C) 2013 SUSE. 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 v2 as published by the Free Software Foundation.
-+ *
-+ * 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 021110-1307, USA.
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/slab.h>
-+#include <linux/vmalloc.h>
-+#include <linux/init.h>
-+#include <linux/err.h>
-+#include <linux/sched.h>
-+#include <linux/pagemap.h>
-+#include <linux/bio.h>
-+#include <linux/lz4.h>
-+#include "compression.h"
-+
-+#define LZ4_LEN 4
-+#define LZ4_CHUNK_SIZE (4096)
-+#define LZ4_MAX_WORKBUF 2*LZ4_CHUNK_SIZE
-+
-+struct workspace {
-+ void *mem; /* work memory for compression */
-+ void *buf; /* where compressed data goes */
-+ void *cbuf; /* where decompressed data goes */
-+ struct list_head list;
-+};
-+
-+static void lz4_free_workspace(struct list_head *ws)
-+{
-+ struct workspace *workspace = list_entry(ws, struct workspace, list);
-+
-+ vfree(workspace->buf);
-+ vfree(workspace->cbuf);
-+ vfree(workspace->mem);
-+ kfree(workspace);
-+}
-+
-+static struct list_head *lz4_alloc_workspace_generic(int hi)
-+{
-+ struct workspace *workspace;
-+
-+ workspace = kzalloc(sizeof(*workspace), GFP_NOFS);
-+ if (!workspace)
-+ return ERR_PTR(-ENOMEM);
-+
-+ if (hi)
-+ workspace->mem = vmalloc(LZ4HC_MEM_COMPRESS);
-+ else
-+ workspace->mem = vmalloc(LZ4_MEM_COMPRESS);
-+ workspace->buf = vmalloc(LZ4_MAX_WORKBUF);
-+ workspace->cbuf = vmalloc(LZ4_MAX_WORKBUF);
-+ if (!workspace->mem || !workspace->buf || !workspace->cbuf)
-+ goto fail;
-+
-+ INIT_LIST_HEAD(&workspace->list);
-+
-+ return &workspace->list;
-+fail:
-+ lz4_free_workspace(&workspace->list);
-+ return ERR_PTR(-ENOMEM);
-+}
-+
-+static struct list_head *lz4_alloc_workspace(void)
-+{
-+ return lz4_alloc_workspace_generic(0);
-+}
-+
-+static struct list_head *lz4hc_alloc_workspace(void)
-+{
-+ return lz4_alloc_workspace_generic(1);
-+}
-+
-+static inline void write_compress_length(char *buf, size_t len)
-+{
-+ __le32 dlen;
-+
-+ dlen = cpu_to_le32(len);
-+ memcpy(buf, &dlen, LZ4_LEN);
-+}
-+
-+static inline size_t read_compress_length(char *buf)
-+{
-+ __le32 dlen;
-+
-+ memcpy(&dlen, buf, LZ4_LEN);
-+ return le32_to_cpu(dlen);
-+}
-+
-+static int lz4_compress_pages_generic(struct list_head *ws,
-+ struct address_space *mapping,
-+ u64 start, unsigned long len,
-+ struct page **pages,
-+ unsigned long nr_dest_pages,
-+ unsigned long *out_pages,
-+ unsigned long *total_in,
-+ unsigned long *total_out,
-+ unsigned long max_out, int hi)
-+{
-+ struct workspace *workspace = list_entry(ws, struct workspace, list);
-+ int ret = 0;
-+ char *data_in;
-+ char *cpage_out;
-+ int nr_pages = 0;
-+ struct page *in_page = NULL;
-+ struct page *out_page = NULL;
-+ unsigned long bytes_left;
-+
-+ size_t in_len;
-+ size_t out_len;
-+ char *buf;
-+ unsigned long tot_in = 0;
-+ unsigned long tot_out = 0;
-+ unsigned long pg_bytes_left;
-+ unsigned long out_offset;
-+ unsigned long bytes;
-+
-+ *out_pages = 0;
-+ *total_out = 0;
-+ *total_in = 0;
-+
-+ in_page = find_get_page(mapping, start >> PAGE_CACHE_SHIFT);
-+ data_in = kmap(in_page);
-+
-+ /*
-+ * store the size of all chunks of compressed data in
-+ * the first 4 bytes
-+ */
-+ out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
-+ if (out_page == NULL) {
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+ cpage_out = kmap(out_page);
-+ out_offset = LZ4_LEN;
-+ tot_out = LZ4_LEN;
-+ pages[0] = out_page;
-+ nr_pages = 1;
-+ pg_bytes_left = PAGE_CACHE_SIZE - LZ4_LEN;
-+
-+ /* compress at most one page of data each time */
-+ in_len = min(len, PAGE_CACHE_SIZE);
-+ while (tot_in < len) {
-+ if (hi)
-+ ret = lz4hc_compress(data_in, in_len, workspace->cbuf,
-+ &out_len, workspace->mem);
-+ else
-+ ret = lz4_compress(data_in, in_len, workspace->cbuf, &out_len,
-+ workspace->mem);
-+ if (ret < 0) {
-+ printk(KERN_DEBUG
-+ "btrfs: lz4 compress in loop returned %d\n",
-+ ret);
-+ ret = -1;
-+ goto out;
-+ }
-+
-+ /* store the size of this chunk of compressed data */
-+ write_compress_length(cpage_out + out_offset, out_len);
-+ tot_out += LZ4_LEN;
-+ out_offset += LZ4_LEN;
-+ pg_bytes_left -= LZ4_LEN;
-+
-+ tot_in += in_len;
-+ tot_out += out_len;
-+
-+ /* copy bytes from the working buffer into the pages */
-+ buf = workspace->cbuf;
-+ while (out_len) {
-+ bytes = min_t(unsigned long, pg_bytes_left, out_len);
-+
-+ memcpy(cpage_out + out_offset, buf, bytes);
-+
-+ out_len -= bytes;
-+ pg_bytes_left -= bytes;
-+ buf += bytes;
-+ out_offset += bytes;
-+
-+ /*
-+ * we need another page for writing out.
-+ *
-+ * Note if there's less than 4 bytes left, we just
-+ * skip to a new page.
-+ */
-+ if ((out_len == 0 && pg_bytes_left < LZ4_LEN) ||
-+ pg_bytes_left == 0) {
-+ if (pg_bytes_left) {
-+ memset(cpage_out + out_offset, 0,
-+ pg_bytes_left);
-+ tot_out += pg_bytes_left;
-+ }
-+
-+ /* we're done, don't allocate new page */
-+ if (out_len == 0 && tot_in >= len)
-+ break;
-+
-+ kunmap(out_page);
-+ if (nr_pages == nr_dest_pages) {
-+ out_page = NULL;
-+ ret = -1;
-+ goto out;
-+ }
-+
-+ out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
-+ if (out_page == NULL) {
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+ cpage_out = kmap(out_page);
-+ pages[nr_pages++] = out_page;
-+
-+ pg_bytes_left = PAGE_CACHE_SIZE;
-+ out_offset = 0;
-+ }
-+ }
-+
-+ /* we're making it bigger, give up */
-+ if (tot_in > 8192 && tot_in < tot_out)
-+ goto out;
-+
-+ /* we're all done */
-+ if (tot_in >= len)
-+ break;
-+
-+ if (tot_out > max_out)
-+ break;
-+
-+ bytes_left = len - tot_in;
-+ kunmap(in_page);
-+ page_cache_release(in_page);
-+
-+ start += PAGE_CACHE_SIZE;
-+ in_page = find_get_page(mapping, start >> PAGE_CACHE_SHIFT);
-+ data_in = kmap(in_page);
-+ in_len = min(bytes_left, PAGE_CACHE_SIZE);
-+ }
-+
-+ if (tot_out > tot_in)
-+ goto out;
-+
-+ /* store the size of all chunks of compressed data */
-+ cpage_out = kmap(pages[0]);
-+ write_compress_length(cpage_out, tot_out);
-+
-+ kunmap(pages[0]);
-+
-+ ret = 0;
-+ *total_out = tot_out;
-+ *total_in = tot_in;
-+out:
-+ *out_pages = nr_pages;
-+ if (out_page)
-+ kunmap(out_page);
-+
-+ if (in_page) {
-+ kunmap(in_page);
-+ page_cache_release(in_page);
-+ }
-+
-+ return ret;
-+}
-+
-+static int lz4_compress_pages(struct list_head *ws,
-+ struct address_space *mapping,
-+ u64 start, unsigned long len,
-+ struct page **pages,
-+ unsigned long nr_dest_pages,
-+ unsigned long *out_pages,
-+ unsigned long *total_in,
-+ unsigned long *total_out,
-+ unsigned long max_out)
-+{
-+ return lz4_compress_pages_generic(ws, mapping, start, len, pages,
-+ nr_dest_pages, out_pages, total_in, total_out,
-+ max_out, 0);
-+}
-+
-+static int lz4hc_compress_pages(struct list_head *ws,
-+ struct address_space *mapping,
-+ u64 start, unsigned long len,
-+ struct page **pages,
-+ unsigned long nr_dest_pages,
-+ unsigned long *out_pages,
-+ unsigned long *total_in,
-+ unsigned long *total_out,
-+ unsigned long max_out)
-+{
-+ return lz4_compress_pages_generic(ws, mapping, start, len, pages,
-+ nr_dest_pages, out_pages, total_in, total_out,
-+ max_out, 1);
-+}
-+
-+static int lz4_decompress_biovec(struct list_head *ws,
-+ struct page **pages_in,
-+ u64 disk_start,
-+ struct bio_vec *bvec,
-+ int vcnt,
-+ size_t srclen)
-+{
-+ struct workspace *workspace = list_entry(ws, struct workspace, list);
-+ int ret = 0, ret2;
-+ char *data_in;
-+ unsigned long page_in_index = 0;
-+ unsigned long page_out_index = 0;
-+ unsigned long total_pages_in = (srclen + PAGE_CACHE_SIZE - 1) /
-+ PAGE_CACHE_SIZE;
-+ unsigned long buf_start;
-+ unsigned long buf_offset = 0;
-+ unsigned long bytes;
-+ unsigned long working_bytes;
-+ unsigned long pg_offset;
-+
-+ size_t in_len;
-+ size_t out_len;
-+ unsigned long in_offset;
-+ unsigned long in_page_bytes_left;
-+ unsigned long tot_in;
-+ unsigned long tot_out;
-+ unsigned long tot_len;
-+ char *buf;
-+ bool may_late_unmap, need_unmap;
-+
-+ data_in = kmap(pages_in[0]);
-+ tot_len = read_compress_length(data_in);
-+
-+ tot_in = LZ4_LEN;
-+ in_offset = LZ4_LEN;
-+ tot_len = min_t(size_t, srclen, tot_len);
-+ in_page_bytes_left = PAGE_CACHE_SIZE - LZ4_LEN;
-+
-+ tot_out = 0;
-+ pg_offset = 0;
-+
-+ while (tot_in < tot_len) {
-+ in_len = read_compress_length(data_in + in_offset);
-+ in_page_bytes_left -= LZ4_LEN;
-+ in_offset += LZ4_LEN;
-+ tot_in += LZ4_LEN;
-+
-+ tot_in += in_len;
-+ working_bytes = in_len;
-+ may_late_unmap = need_unmap = false;
-+
-+ /* fast path: avoid using the working buffer */
-+ if (in_page_bytes_left >= in_len) {
-+ buf = data_in + in_offset;
-+ bytes = in_len;
-+ may_late_unmap = true;
-+ goto cont;
-+ }
-+
-+ /* copy bytes from the pages into the working buffer */
-+ buf = workspace->cbuf;
-+ buf_offset = 0;
-+ while (working_bytes) {
-+ bytes = min(working_bytes, in_page_bytes_left);
-+
-+ memcpy(buf + buf_offset, data_in + in_offset, bytes);
-+ buf_offset += bytes;
-+cont:
-+ working_bytes -= bytes;
-+ in_page_bytes_left -= bytes;
-+ in_offset += bytes;
-+
-+ /* check if we need to pick another page */
-+ if ((working_bytes == 0 && in_page_bytes_left < LZ4_LEN)
-+ || in_page_bytes_left == 0) {
-+ tot_in += in_page_bytes_left;
-+
-+ if (working_bytes == 0 && tot_in >= tot_len)
-+ break;
-+
-+ if (page_in_index + 1 >= total_pages_in) {
-+ ret = -1;
-+ goto done;
-+ }
-+
-+ if (may_late_unmap)
-+ need_unmap = true;
-+ else
-+ kunmap(pages_in[page_in_index]);
-+
-+ data_in = kmap(pages_in[++page_in_index]);
-+
-+ in_page_bytes_left = PAGE_CACHE_SIZE;
-+ in_offset = 0;
-+ }
-+ }
-+
-+ out_len = LZ4_CHUNK_SIZE;
-+ ret = lz4_decompress_unknownoutputsize(buf, in_len, workspace->buf,
-+ &out_len);
-+ if (need_unmap)
-+ kunmap(pages_in[page_in_index - 1]);
-+ if (ret < 0) {
-+ printk(KERN_WARNING "btrfs: lz4 decompress failed\n");
-+ ret = -1;
-+ break;
-+ }
-+
-+ buf_start = tot_out;
-+ tot_out += out_len;
-+
-+ ret2 = btrfs_decompress_buf2page(workspace->buf, buf_start,
-+ tot_out, disk_start,
-+ bvec, vcnt,
-+ &page_out_index, &pg_offset);
-+ if (ret2 == 0)
-+ break;
-+ }
-+done:
-+ kunmap(pages_in[page_in_index]);
-+ return ret;
-+}
-+
-+static int lz4_decompress_wrapper(struct list_head *ws, unsigned char *data_in,
-+ struct page *dest_page,
-+ unsigned long start_byte,
-+ size_t srclen, size_t destlen)
-+{
-+ struct workspace *workspace = list_entry(ws, struct workspace, list);
-+ size_t in_len;
-+ size_t out_len;
-+ size_t tot_len;
-+ int ret = 0;
-+ char *kaddr;
-+ unsigned long bytes;
-+
-+ BUG_ON(srclen < LZ4_LEN);
-+
-+ tot_len = read_compress_length(data_in);
-+ data_in += LZ4_LEN;
-+
-+ in_len = read_compress_length(data_in);
-+ data_in += LZ4_LEN;
-+
-+ out_len = LZ4_CHUNK_SIZE;
-+ ret = lz4_decompress_unknownoutputsize(data_in, in_len, workspace->buf,
-+ &out_len);
-+ if (ret < 0) {
-+ printk(KERN_WARNING "btrfs: lz4 decompress failed\n");
-+ ret = -1;
-+ goto out;
-+ }
-+
-+ if (out_len < start_byte) {
-+ ret = -1;
-+ goto out;
-+ }
-+
-+ bytes = min_t(unsigned long, destlen, out_len - start_byte);
-+
-+ kaddr = kmap_atomic(dest_page);
-+ memcpy(kaddr, workspace->buf + start_byte, bytes);
-+ kunmap_atomic(kaddr);
-+out:
-+ return ret;
-+}
-+
-+const struct btrfs_compress_op btrfs_lz4_compress = {
-+ .alloc_workspace = lz4_alloc_workspace,
-+ .free_workspace = lz4_free_workspace,
-+ .compress_pages = lz4_compress_pages,
-+ .decompress_biovec = lz4_decompress_biovec,
-+ .decompress = lz4_decompress_wrapper,
-+};
-+
-+const struct btrfs_compress_op btrfs_lz4hc_compress = {
-+ .alloc_workspace = lz4hc_alloc_workspace,
-+ .free_workspace = lz4_free_workspace,
-+ .compress_pages = lz4hc_compress_pages,
-+ .decompress_biovec = lz4_decompress_biovec,
-+ .decompress = lz4_decompress_wrapper,
-+};
-diff -Nur linux-4.1.3/fs/btrfs/Makefile linux-xbian-rpi/fs/btrfs/Makefile
---- linux-4.1.3/fs/btrfs/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/Makefile 2015-07-27 23:13:08.901223737 +0200
-@@ -9,7 +9,7 @@
- export.o tree-log.o free-space-cache.o zlib.o lzo.o \
- compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
- reada.o backref.o ulist.o qgroup.o send.o dev-replace.o raid56.o \
-- uuid-tree.o props.o hash.o
-+ uuid-tree.o props.o hash.o lz4_wrapper.o
-
- btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
- btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
-diff -Nur linux-4.1.3/fs/btrfs/super.c linux-xbian-rpi/fs/btrfs/super.c
---- linux-4.1.3/fs/btrfs/super.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/super.c 2015-07-27 23:13:08.961010425 +0200
-@@ -492,6 +492,20 @@
- btrfs_clear_opt(info->mount_opt, COMPRESS);
- btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
- compress_force = false;
-+ } else if (strcmp(args[0].from, "lz4") == 0) {
-+ compress_type = "lz4";
-+ info->compress_type = BTRFS_COMPRESS_LZ4;
-+ btrfs_set_opt(info->mount_opt, COMPRESS);
-+ btrfs_clear_opt(info->mount_opt, NODATACOW);
-+ btrfs_clear_opt(info->mount_opt, NODATASUM);
-+ btrfs_set_fs_incompat(info, COMPRESS_LZ4);
-+ } else if (strcmp(args[0].from, "lz4hc") == 0) {
-+ compress_type = "lz4hc";
-+ info->compress_type = BTRFS_COMPRESS_LZ4HC;
-+ btrfs_set_opt(info->mount_opt, COMPRESS);
-+ btrfs_clear_opt(info->mount_opt, NODATACOW);
-+ btrfs_clear_opt(info->mount_opt, NODATASUM);
-+ btrfs_set_fs_incompat(info, COMPRESS_LZ4);
- } else {
- ret = -EINVAL;
- goto out;
-@@ -1051,8 +1065,14 @@
- if (btrfs_test_opt(root, COMPRESS)) {
- if (info->compress_type == BTRFS_COMPRESS_ZLIB)
- compress_type = "zlib";
-+ else if (info->compress_type == BTRFS_COMPRESS_LZ4)
-+ compress_type = "lz4";
-+ else if (info->compress_type == BTRFS_COMPRESS_LZ4HC)
-+ compress_type = "lz4hc";
-+ else if (info->compress_type == BTRFS_COMPRESS_LZO)
-+ compress_type = "lzo";
- else
-- compress_type = "lzo";
-+ compress_type = "none";
- if (btrfs_test_opt(root, FORCE_COMPRESS))
- seq_printf(seq, ",compress-force=%s", compress_type);
- else
-diff -Nur linux-4.1.3/fs/btrfs/xattr.c linux-xbian-rpi/fs/btrfs/xattr.c
---- linux-4.1.3/fs/btrfs/xattr.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/fs/btrfs/xattr.c 2015-07-28 01:20:58.453128032 +0200
-@@ -411,6 +411,7 @@
- ret = btrfs_is_valid_xattr(name);
- if (ret)
- return ret;
-+
- return __btrfs_getxattr(d_inode(dentry), name, buffer, size);
- }
-
-diff -Nur linux-4.1.3/include/linux/broadcom/vc_cma.h linux-xbian-rpi/include/linux/broadcom/vc_cma.h
---- linux-4.1.3/include/linux/broadcom/vc_cma.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/broadcom/vc_cma.h 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/include/linux/broadcom/vc_cma.h linux-rpi/include/linux/broadcom/vc_cma.h
+--- linux-4.1.6/include/linux/broadcom/vc_cma.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/broadcom/vc_cma.h 2015-08-26 10:26:12.201363899 +0200
@@ -0,0 +1,29 @@
+/*****************************************************************************
+* Copyright 2012 Broadcom Corporation. All rights reserved.
@@ -292487,9 +299185,9 @@ diff -Nur linux-4.1.3/include/linux/broadcom/vc_cma.h linux-xbian-rpi/include/li
+#endif
+
+#endif /* VC_CMA_H */
-diff -Nur linux-4.1.3/include/linux/broadcom/vc_mem.h linux-xbian-rpi/include/linux/broadcom/vc_mem.h
---- linux-4.1.3/include/linux/broadcom/vc_mem.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/broadcom/vc_mem.h 2015-07-28 01:20:58.453128032 +0200
+diff -Nur linux-4.1.6/include/linux/broadcom/vc_mem.h linux-rpi/include/linux/broadcom/vc_mem.h
+--- linux-4.1.6/include/linux/broadcom/vc_mem.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/broadcom/vc_mem.h 2015-08-26 10:26:12.201363899 +0200
@@ -0,0 +1,35 @@
+/*****************************************************************************
+* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved.
@@ -292526,9 +299224,9 @@ diff -Nur linux-4.1.3/include/linux/broadcom/vc_mem.h linux-xbian-rpi/include/li
+#endif
+
+#endif /* _VC_MEM_H */
-diff -Nur linux-4.1.3/include/linux/leds.h linux-xbian-rpi/include/linux/leds.h
---- linux-4.1.3/include/linux/leds.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/include/linux/leds.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/leds.h linux-rpi/include/linux/leds.h
+--- linux-4.1.6/include/linux/leds.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/include/linux/leds.h 2015-08-26 10:26:12.233364337 +0200
@@ -47,6 +47,9 @@
#define SET_BRIGHTNESS_ASYNC (1 << 21)
#define SET_BRIGHTNESS_SYNC (1 << 22)
@@ -292539,9 +299237,9 @@ diff -Nur linux-4.1.3/include/linux/leds.h linux-xbian-rpi/include/linux/leds.h
/* Set LED brightness level */
/* Must not sleep, use a workqueue if needed */
-diff -Nur linux-4.1.3/include/linux/mfd/rpisense/core.h linux-xbian-rpi/include/linux/mfd/rpisense/core.h
---- linux-4.1.3/include/linux/mfd/rpisense/core.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/mfd/rpisense/core.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/mfd/rpisense/core.h linux-rpi/include/linux/mfd/rpisense/core.h
+--- linux-4.1.6/include/linux/mfd/rpisense/core.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/mfd/rpisense/core.h 2015-08-26 10:26:12.241364447 +0200
@@ -0,0 +1,47 @@
+/*
+ * Raspberry Pi Sense HAT core driver
@@ -292590,10 +299288,10 @@ diff -Nur linux-4.1.3/include/linux/mfd/rpisense/core.h linux-xbian-rpi/include/
+int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count);
+
+#endif
-diff -Nur linux-4.1.3/include/linux/mfd/rpisense/framebuffer.h linux-xbian-rpi/include/linux/mfd/rpisense/framebuffer.h
---- linux-4.1.3/include/linux/mfd/rpisense/framebuffer.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/mfd/rpisense/framebuffer.h 2015-07-28 01:20:58.457113811 +0200
-@@ -0,0 +1,28 @@
+diff -Nur linux-4.1.6/include/linux/mfd/rpisense/framebuffer.h linux-rpi/include/linux/mfd/rpisense/framebuffer.h
+--- linux-4.1.6/include/linux/mfd/rpisense/framebuffer.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/mfd/rpisense/framebuffer.h 2015-08-26 10:26:12.241364447 +0200
+@@ -0,0 +1,32 @@
+/*
+ * Raspberry Pi Sense HAT framebuffer driver
+ * http://raspberrypi.org
@@ -292612,7 +299310,11 @@ diff -Nur linux-4.1.3/include/linux/mfd/rpisense/framebuffer.h linux-xbian-rpi/i
+#ifndef __LINUX_RPISENSE_FB_H_
+#define __LINUX_RPISENSE_FB_H_
+
-+#include <linux/platform_device.h>
++#define SENSEFB_FBIO_IOC_MAGIC 0xF1
++
++#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0)
++#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1)
++#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2)
+
+struct rpisense;
+
@@ -292622,9 +299324,9 @@ diff -Nur linux-4.1.3/include/linux/mfd/rpisense/framebuffer.h linux-xbian-rpi/i
+};
+
+#endif
-diff -Nur linux-4.1.3/include/linux/mfd/rpisense/joystick.h linux-xbian-rpi/include/linux/mfd/rpisense/joystick.h
---- linux-4.1.3/include/linux/mfd/rpisense/joystick.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/mfd/rpisense/joystick.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/mfd/rpisense/joystick.h linux-rpi/include/linux/mfd/rpisense/joystick.h
+--- linux-4.1.6/include/linux/mfd/rpisense/joystick.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/mfd/rpisense/joystick.h 2015-08-26 10:26:12.241364447 +0200
@@ -0,0 +1,35 @@
+/*
+ * Raspberry Pi Sense HAT joystick driver
@@ -292661,9 +299363,9 @@ diff -Nur linux-4.1.3/include/linux/mfd/rpisense/joystick.h linux-xbian-rpi/incl
+
+
+#endif
-diff -Nur linux-4.1.3/include/linux/mmc/host.h linux-xbian-rpi/include/linux/mmc/host.h
---- linux-4.1.3/include/linux/mmc/host.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/include/linux/mmc/host.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/mmc/host.h linux-rpi/include/linux/mmc/host.h
+--- linux-4.1.6/include/linux/mmc/host.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/include/linux/mmc/host.h 2015-08-26 10:26:12.249364556 +0200
@@ -140,7 +140,9 @@
* I/O. Returns the number of supported blocks for the request.
*/
@@ -292683,9 +299385,9 @@ diff -Nur linux-4.1.3/include/linux/mmc/host.h linux-xbian-rpi/include/linux/mmc
mmc_pm_flag_t pm_caps; /* supported pm features */
-diff -Nur linux-4.1.3/include/linux/platform_data/bcm2708.h linux-xbian-rpi/include/linux/platform_data/bcm2708.h
---- linux-4.1.3/include/linux/platform_data/bcm2708.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/platform_data/bcm2708.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/platform_data/bcm2708.h linux-rpi/include/linux/platform_data/bcm2708.h
+--- linux-4.1.6/include/linux/platform_data/bcm2708.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/platform_data/bcm2708.h 2015-08-26 10:26:12.265364775 +0200
@@ -0,0 +1,23 @@
+/*
+ * include/linux/platform_data/bcm2708.h
@@ -292710,9 +299412,9 @@ diff -Nur linux-4.1.3/include/linux/platform_data/bcm2708.h linux-xbian-rpi/incl
+ bcm2708_gpio_pull_t value);
+
+#endif
-diff -Nur linux-4.1.3/include/linux/platform_data/dma-bcm2708.h linux-xbian-rpi/include/linux/platform_data/dma-bcm2708.h
---- linux-4.1.3/include/linux/platform_data/dma-bcm2708.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/platform_data/dma-bcm2708.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/platform_data/dma-bcm2708.h linux-rpi/include/linux/platform_data/dma-bcm2708.h
+--- linux-4.1.6/include/linux/platform_data/dma-bcm2708.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/linux/platform_data/dma-bcm2708.h 2015-08-26 10:26:12.265364775 +0200
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2010 Broadcom
@@ -292841,140 +299543,9 @@ diff -Nur linux-4.1.3/include/linux/platform_data/dma-bcm2708.h linux-xbian-rpi/
+#endif /* CONFIG_DMA_BCM2708_LEGACY */
+
+#endif /* _PLAT_BCM2708_DMA_H */
-diff -Nur linux-4.1.3/include/linux/platform_data/mailbox-bcm2708.h linux-xbian-rpi/include/linux/platform_data/mailbox-bcm2708.h
---- linux-4.1.3/include/linux/platform_data/mailbox-bcm2708.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/linux/platform_data/mailbox-bcm2708.h 2015-07-28 01:20:58.457113811 +0200
-@@ -0,0 +1,127 @@
-+/*
-+ * 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.
-+ */
-+#ifndef _PLAT_MAILBOX_BCM2708_H
-+#define _PLAT_MAILBOX_BCM2708_H
-+
-+/* Routines to handle I/O via the VideoCore "ARM control" registers
-+ * (semaphores, doorbells, mailboxes)
-+ */
-+
-+/* Constants shared with the ARM identifying separate mailbox channels */
-+#define MBOX_CHAN_POWER 0 /* for use by the power management interface */
-+#define MBOX_CHAN_FB 1 /* for use by the frame buffer */
-+#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */
-+#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */
-+#define MBOX_CHAN_COUNT 9
-+
-+enum {
-+ VCMSG_PROCESS_REQUEST = 0x00000000
-+};
-+
-+enum {
-+ VCMSG_REQUEST_SUCCESSFUL = 0x80000000,
-+ VCMSG_REQUEST_FAILED = 0x80000001
-+};
-+
-+/* Mailbox property tags */
-+enum {
-+ VCMSG_PROPERTY_END = 0x00000000,
-+ VCMSG_GET_FIRMWARE_REVISION = 0x00000001,
-+ VCMSG_GET_BOARD_MODEL = 0x00010001,
-+ VCMSG_GET_BOARD_REVISION = 0x00010002,
-+ VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003,
-+ VCMSG_GET_BOARD_SERIAL = 0x00010004,
-+ VCMSG_GET_ARM_MEMORY = 0x00010005,
-+ VCMSG_GET_VC_MEMORY = 0x00010006,
-+ VCMSG_GET_CLOCKS = 0x00010007,
-+ VCMSG_GET_COMMAND_LINE = 0x00050001,
-+ VCMSG_GET_DMA_CHANNELS = 0x00060001,
-+ VCMSG_GET_POWER_STATE = 0x00020001,
-+ VCMSG_GET_TIMING = 0x00020002,
-+ VCMSG_SET_POWER_STATE = 0x00028001,
-+ VCMSG_GET_CLOCK_STATE = 0x00030001,
-+ VCMSG_SET_CLOCK_STATE = 0x00038001,
-+ VCMSG_GET_CLOCK_RATE = 0x00030002,
-+ VCMSG_SET_CLOCK_RATE = 0x00038002,
-+ VCMSG_GET_VOLTAGE = 0x00030003,
-+ VCMSG_SET_VOLTAGE = 0x00038003,
-+ VCMSG_GET_MAX_CLOCK = 0x00030004,
-+ VCMSG_GET_MAX_VOLTAGE = 0x00030005,
-+ VCMSG_GET_TEMPERATURE = 0x00030006,
-+ VCMSG_GET_MIN_CLOCK = 0x00030007,
-+ VCMSG_GET_MIN_VOLTAGE = 0x00030008,
-+ VCMSG_GET_TURBO = 0x00030009,
-+ VCMSG_GET_MAX_TEMPERATURE = 0x0003000a,
-+ VCMSG_GET_STC = 0x0003000b,
-+ VCMSG_SET_TURBO = 0x00038009,
-+ VCMSG_SET_ALLOCATE_MEM = 0x0003000c,
-+ VCMSG_SET_LOCK_MEM = 0x0003000d,
-+ VCMSG_SET_UNLOCK_MEM = 0x0003000e,
-+ VCMSG_SET_RELEASE_MEM = 0x0003000f,
-+ VCMSG_SET_EXECUTE_CODE = 0x00030010,
-+ VCMSG_SET_EXECUTE_QPU = 0x00030011,
-+ VCMSG_SET_ENABLE_QPU = 0x00030012,
-+ VCMSG_GET_RESOURCE_HANDLE = 0x00030014,
-+ VCMSG_GET_EDID_BLOCK = 0x00030020,
-+ VCMSG_GET_CUSTOMER_OTP = 0x00030021,
-+ VCMSG_SET_CUSTOMER_OTP = 0x00038021,
-+ VCMSG_SET_ALLOCATE_BUFFER = 0x00040001,
-+ VCMSG_SET_RELEASE_BUFFER = 0x00048001,
-+ VCMSG_SET_BLANK_SCREEN = 0x00040002,
-+ VCMSG_TST_BLANK_SCREEN = 0x00044002,
-+ VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003,
-+ VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003,
-+ VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003,
-+ VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004,
-+ VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004,
-+ VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004,
-+ VCMSG_GET_DEPTH = 0x00040005,
-+ VCMSG_TST_DEPTH = 0x00044005,
-+ VCMSG_SET_DEPTH = 0x00048005,
-+ VCMSG_GET_PIXEL_ORDER = 0x00040006,
-+ VCMSG_TST_PIXEL_ORDER = 0x00044006,
-+ VCMSG_SET_PIXEL_ORDER = 0x00048006,
-+ VCMSG_GET_ALPHA_MODE = 0x00040007,
-+ VCMSG_TST_ALPHA_MODE = 0x00044007,
-+ VCMSG_SET_ALPHA_MODE = 0x00048007,
-+ VCMSG_GET_PITCH = 0x00040008,
-+ VCMSG_TST_PITCH = 0x00044008,
-+ VCMSG_SET_PITCH = 0x00048008,
-+ VCMSG_GET_VIRTUAL_OFFSET = 0x00040009,
-+ VCMSG_TST_VIRTUAL_OFFSET = 0x00044009,
-+ VCMSG_SET_VIRTUAL_OFFSET = 0x00048009,
-+ VCMSG_GET_OVERSCAN = 0x0004000a,
-+ VCMSG_TST_OVERSCAN = 0x0004400a,
-+ VCMSG_SET_OVERSCAN = 0x0004800a,
-+ VCMSG_GET_PALETTE = 0x0004000b,
-+ VCMSG_TST_PALETTE = 0x0004400b,
-+ VCMSG_SET_PALETTE = 0x0004800b,
-+ VCMSG_GET_LAYER = 0x0004000c,
-+ VCMSG_TST_LAYER = 0x0004400c,
-+ VCMSG_SET_LAYER = 0x0004800c,
-+ VCMSG_GET_TRANSFORM = 0x0004000d,
-+ VCMSG_TST_TRANSFORM = 0x0004400d,
-+ VCMSG_SET_TRANSFORM = 0x0004800d,
-+ VCMSG_TST_VSYNC = 0x0004400e,
-+ VCMSG_SET_VSYNC = 0x0004800e,
-+ VCMSG_GET_TOUCHBUF = 0x0004000f,
-+ VCMSG_SET_CURSOR_INFO = 0x00008010,
-+ VCMSG_SET_CURSOR_STATE = 0x00008011,
-+};
-+
-+int bcm_mailbox_read(unsigned chan, uint32_t *data28);
-+int bcm_mailbox_write(unsigned chan, uint32_t data28);
-+int bcm_mailbox_property(void *data, int size);
-+
-+#endif
-diff -Nur linux-4.1.3/include/linux/vmstat.h linux-xbian-rpi/include/linux/vmstat.h
---- linux-4.1.3/include/linux/vmstat.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/include/linux/vmstat.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/vmstat.h linux-rpi/include/linux/vmstat.h
+--- linux-4.1.6/include/linux/vmstat.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/include/linux/vmstat.h 2015-08-26 10:26:12.301365268 +0200
@@ -241,7 +241,11 @@
static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
{
@@ -292987,9 +299558,9 @@ diff -Nur linux-4.1.3/include/linux/vmstat.h linux-xbian-rpi/include/linux/vmsta
}
static inline void __inc_zone_page_state(struct page *page,
-diff -Nur linux-4.1.3/include/linux/w1-gpio.h linux-xbian-rpi/include/linux/w1-gpio.h
---- linux-4.1.3/include/linux/w1-gpio.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/include/linux/w1-gpio.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/linux/w1-gpio.h linux-rpi/include/linux/w1-gpio.h
+--- linux-4.1.6/include/linux/w1-gpio.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/include/linux/w1-gpio.h 2015-08-26 10:26:12.301365268 +0200
@@ -18,6 +18,7 @@
struct w1_gpio_platform_data {
unsigned int pin;
@@ -292998,10 +299569,10 @@ diff -Nur linux-4.1.3/include/linux/w1-gpio.h linux-xbian-rpi/include/linux/w1-g
void (*enable_external_pullup)(int enable);
unsigned int ext_pullup_enable_pin;
unsigned int pullup_duration;
-diff -Nur linux-4.1.3/include/soc/bcm2835/raspberrypi-firmware.h linux-xbian-rpi/include/soc/bcm2835/raspberrypi-firmware.h
---- linux-4.1.3/include/soc/bcm2835/raspberrypi-firmware.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/include/soc/bcm2835/raspberrypi-firmware.h 2015-07-28 01:20:58.457113811 +0200
-@@ -0,0 +1,125 @@
+diff -Nur linux-4.1.6/include/soc/bcm2835/raspberrypi-firmware.h linux-rpi/include/soc/bcm2835/raspberrypi-firmware.h
+--- linux-4.1.6/include/soc/bcm2835/raspberrypi-firmware.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/include/soc/bcm2835/raspberrypi-firmware.h 2015-08-26 10:26:12.333365706 +0200
+@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2015 Broadcom
+ *
@@ -293120,16 +299691,14 @@ diff -Nur linux-4.1.3/include/soc/bcm2835/raspberrypi-firmware.h linux-xbian-rpi
+ RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,
+};
+
-+int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data);
-+u32 rpi_firmware_transaction_received(struct rpi_firmware *fw);
+int rpi_firmware_property(struct rpi_firmware *fw,
+ u32 tag, void *data, size_t len);
+int rpi_firmware_property_list(struct rpi_firmware *fw,
+ void *data, size_t tag_size);
+struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node);
-diff -Nur linux-4.1.3/include/uapi/linux/fb.h linux-xbian-rpi/include/uapi/linux/fb.h
---- linux-4.1.3/include/uapi/linux/fb.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/include/uapi/linux/fb.h 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/include/uapi/linux/fb.h linux-rpi/include/uapi/linux/fb.h
+--- linux-4.1.6/include/uapi/linux/fb.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/include/uapi/linux/fb.h 2015-08-26 10:26:12.985374634 +0200
@@ -34,6 +34,11 @@
#define FBIOPUT_MODEINFO 0x4617
#define FBIOGET_DISPINFO 0x4618
@@ -293142,9 +299711,9 @@ diff -Nur linux-4.1.3/include/uapi/linux/fb.h linux-xbian-rpi/include/uapi/linux
#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
#define FB_TYPE_PLANES 1 /* Non interleaved planes */
-diff -Nur linux-4.1.3/kernel/cgroup.c linux-xbian-rpi/kernel/cgroup.c
---- linux-4.1.3/kernel/cgroup.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/kernel/cgroup.c 2015-07-28 01:20:58.457113811 +0200
+diff -Nur linux-4.1.6/kernel/cgroup.c linux-rpi/kernel/cgroup.c
+--- linux-4.1.6/kernel/cgroup.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/kernel/cgroup.c 2015-08-26 10:26:13.025375180 +0200
@@ -5393,6 +5393,29 @@
}
__setup("cgroup_disable=", cgroup_disable);
@@ -293175,9 +299744,9 @@ diff -Nur linux-4.1.3/kernel/cgroup.c linux-xbian-rpi/kernel/cgroup.c
static int __init cgroup_set_legacy_files_on_dfl(char *str)
{
printk("cgroup: using legacy files on the default hierarchy\n");
-diff -Nur linux-4.1.3/mm/memcontrol.c linux-xbian-rpi/mm/memcontrol.c
---- linux-4.1.3/mm/memcontrol.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/mm/memcontrol.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/mm/memcontrol.c linux-rpi/mm/memcontrol.c
+--- linux-4.1.6/mm/memcontrol.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/mm/memcontrol.c 2015-08-26 10:26:13.085375999 +0200
@@ -5388,6 +5388,7 @@
.dfl_cftypes = memory_files,
.legacy_cftypes = mem_cgroup_legacy_files,
@@ -293186,9 +299755,9 @@ diff -Nur linux-4.1.3/mm/memcontrol.c linux-xbian-rpi/mm/memcontrol.c
};
/**
-diff -Nur linux-4.1.3/scripts/dtc/checks.c linux-xbian-rpi/scripts/dtc/checks.c
---- linux-4.1.3/scripts/dtc/checks.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/checks.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/checks.c linux-rpi/scripts/dtc/checks.c
+--- linux-4.1.6/scripts/dtc/checks.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/checks.c 2015-08-26 10:26:13.257378345 +0200
@@ -53,7 +53,7 @@
void *data;
bool warn, error;
@@ -293441,9 +300010,9 @@ diff -Nur linux-4.1.3/scripts/dtc/checks.c linux-xbian-rpi/scripts/dtc/checks.c
{
struct node *dt = bi->dt;
int i;
-diff -Nur linux-4.1.3/scripts/dtc/data.c linux-xbian-rpi/scripts/dtc/data.c
---- linux-4.1.3/scripts/dtc/data.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/data.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/data.c linux-rpi/scripts/dtc/data.c
+--- linux-4.1.6/scripts/dtc/data.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/data.c 2015-08-26 10:26:13.257378345 +0200
@@ -74,7 +74,7 @@
struct data d;
char *q;
@@ -293479,235 +300048,9 @@ diff -Nur linux-4.1.3/scripts/dtc/data.c linux-xbian-rpi/scripts/dtc/data.c
- return 1;
+ return true;
}
-diff -Nur linux-4.1.3/scripts/dtc/dtc.c linux-xbian-rpi/scripts/dtc/dtc.c
---- linux-4.1.3/scripts/dtc/dtc.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc.c 2015-07-28 01:20:58.461099590 +0200
-@@ -29,6 +29,7 @@
- int minsize; /* Minimum blob size */
- int padsize; /* Additional padding to blob */
- int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
-+int symbol_fixup_support = 0;
-
- static void fill_fullpaths(struct node *tree, const char *prefix)
- {
-@@ -48,8 +49,10 @@
- }
-
- /* Usage related data. */
-+#define FDT_VERSION(version) _FDT_VERSION(version)
-+#define _FDT_VERSION(version) #version
- static const char usage_synopsis[] = "dtc [options] <input file>";
--static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
-+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
- static struct option const usage_long_opts[] = {
- {"quiet", no_argument, NULL, 'q'},
- {"in-format", a_argument, NULL, 'I'},
-@@ -67,6 +70,7 @@
- {"phandle", a_argument, NULL, 'H'},
- {"warning", a_argument, NULL, 'W'},
- {"error", a_argument, NULL, 'E'},
-+ {"symbols", a_argument, NULL, '@'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
- {NULL, no_argument, NULL, 0x0},
-@@ -82,9 +86,9 @@
- "\t\tdts - device tree source text\n"
- "\t\tdtb - device tree blob\n"
- "\t\tasm - assembler source",
-- "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
-+ "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
- "\n\tOutput dependency file",
-- "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
-+ "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
- "\n\tMake the blob at least <bytes> long (extra space)",
- "\n\tAdd padding to the blob of <bytes> long (extra space)",
- "\n\tSet the physical boot cpu",
-@@ -97,6 +101,7 @@
- "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
- "\n\tEnable/disable warnings (prefix with \"no-\")",
- "\n\tEnable/disable errors (prefix with \"no-\")",
-+ "\n\tSymbols and Fixups support",
- "\n\tPrint this help and exit",
- "\n\tPrint version and exit",
- NULL,
-@@ -109,7 +114,7 @@
- const char *outform = "dts";
- const char *outname = "-";
- const char *depname = NULL;
-- int force = 0, sort = 0;
-+ bool force = false, sort = false;
- const char *arg;
- int opt;
- FILE *outf = NULL;
-@@ -148,7 +153,7 @@
- padsize = strtol(optarg, NULL, 0);
- break;
- case 'f':
-- force = 1;
-+ force = true;
- break;
- case 'q':
- quiet++;
-@@ -174,7 +179,7 @@
- break;
-
- case 's':
-- sort = 1;
-+ sort = true;
- break;
-
- case 'W':
-@@ -184,7 +189,9 @@
- case 'E':
- parse_checks_option(false, true, optarg);
- break;
--
-+ case '@':
-+ symbol_fixup_support = 1;
-+ break;
- case 'h':
- usage(NULL);
- default:
-@@ -237,7 +244,7 @@
- if (streq(outname, "-")) {
- outf = stdout;
- } else {
-- outf = fopen(outname, "w");
-+ outf = fopen(outname, "wb");
- if (! outf)
- die("Couldn't open output file %s: %s\n",
- outname, strerror(errno));
-diff -Nur linux-4.1.3/scripts/dtc/dtc.h linux-xbian-rpi/scripts/dtc/dtc.h
---- linux-4.1.3/scripts/dtc/dtc.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc.h 2015-07-28 01:20:58.461099590 +0200
-@@ -38,9 +38,9 @@
- #include "util.h"
-
- #ifdef DEBUG
--#define debug(fmt,args...) printf(fmt, ##args)
-+#define debug(...) printf(__VA_ARGS__)
- #else
--#define debug(fmt,args...)
-+#define debug(...)
- #endif
-
-
-@@ -54,6 +54,7 @@
- extern int minsize; /* Minimum blob size */
- extern int padsize; /* Additional padding to blob */
- extern int phandle_format; /* Use linux,phandle or phandle properties */
-+extern int symbol_fixup_support;/* enable symbols & fixup support */
-
- #define PHANDLE_LEGACY 0x1
- #define PHANDLE_EPAPR 0x2
-@@ -88,7 +89,7 @@
- };
-
-
--#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
-+#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
-
- #define for_each_marker(m) \
- for (; (m); (m) = (m)->next)
-@@ -118,7 +119,7 @@
-
- struct data data_add_marker(struct data d, enum markertype type, char *ref);
-
--int data_is_one_string(struct data d);
-+bool data_is_one_string(struct data d);
-
- /* DT constraints */
-
-@@ -127,13 +128,32 @@
-
- /* Live trees */
- struct label {
-- int deleted;
-+ bool deleted;
- char *label;
- struct label *next;
- };
-
-+struct fixup_entry {
-+ int offset;
-+ struct node *node;
-+ struct property *prop;
-+ struct fixup_entry *next;
-+};
-+
-+struct fixup {
-+ char *ref;
-+ struct fixup_entry *entries;
-+ struct fixup *next;
-+};
-+
-+struct symbol {
-+ struct label *label;
-+ struct node *node;
-+ struct symbol *next;
-+};
-+
- struct property {
-- int deleted;
-+ bool deleted;
- char *name;
- struct data val;
-
-@@ -143,7 +163,7 @@
- };
-
- struct node {
-- int deleted;
-+ bool deleted;
- char *name;
- struct property *proplist;
- struct node *children;
-@@ -158,6 +178,12 @@
- int addr_cells, size_cells;
-
- struct label *labels;
-+
-+ int is_root;
-+ int is_plugin;
-+ struct fixup *fixups;
-+ struct symbol *symbols;
-+ struct fixup_entry *local_fixups;
- };
-
- #define for_each_label_withdel(l0, l) \
-@@ -181,6 +207,18 @@
- for_each_child_withdel(n, c) \
- if (!(c)->deleted)
-
-+#define for_each_fixup(n, f) \
-+ for ((f) = (n)->fixups; (f); (f) = (f)->next)
-+
-+#define for_each_fixup_entry(f, fe) \
-+ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
-+
-+#define for_each_symbol(n, s) \
-+ for ((s) = (n)->symbols; (s); (s) = (s)->next)
-+
-+#define for_each_local_fixup_entry(n, fe) \
-+ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
-+
- void add_label(struct label **labels, char *label);
- void delete_labels(struct label **labels);
-
-@@ -247,8 +285,8 @@
-
- /* Checks */
-
--void parse_checks_option(bool warn, bool error, const char *optarg);
--void process_checks(int force, struct boot_info *bi);
-+void parse_checks_option(bool warn, bool error, const char *arg);
-+void process_checks(bool force, struct boot_info *bi);
-
- /* Flattened trees */
-
-diff -Nur linux-4.1.3/scripts/dtc/dtc-lexer.l linux-xbian-rpi/scripts/dtc/dtc-lexer.l
---- linux-4.1.3/scripts/dtc/dtc-lexer.l 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc-lexer.l 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/dtc-lexer.l linux-rpi/scripts/dtc/dtc-lexer.l
+--- linux-4.1.6/scripts/dtc/dtc-lexer.l 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc-lexer.l 2015-08-26 10:26:13.257378345 +0200
@@ -20,7 +20,6 @@
%option noyywrap nounput noinput never-interactive
@@ -293845,9 +300188,9 @@ diff -Nur linux-4.1.3/scripts/dtc/dtc-lexer.l linux-xbian-rpi/scripts/dtc/dtc-le
+
+ treesource_error = true;
}
-diff -Nur linux-4.1.3/scripts/dtc/dtc-lexer.lex.c_shipped linux-xbian-rpi/scripts/dtc/dtc-lexer.lex.c_shipped
---- linux-4.1.3/scripts/dtc/dtc-lexer.lex.c_shipped 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc-lexer.lex.c_shipped 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/dtc-lexer.lex.c_shipped linux-rpi/scripts/dtc/dtc-lexer.lex.c_shipped
+--- linux-4.1.6/scripts/dtc/dtc-lexer.lex.c_shipped 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc-lexer.lex.c_shipped 2015-08-26 10:26:13.257378345 +0200
@@ -372,8 +372,8 @@
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
@@ -294702,9 +301045,9 @@ diff -Nur linux-4.1.3/scripts/dtc/dtc-lexer.lex.c_shipped linux-xbian-rpi/script
+ treesource_error = true;
}
-diff -Nur linux-4.1.3/scripts/dtc/dtc-parser.tab.c_shipped linux-xbian-rpi/scripts/dtc/dtc-parser.tab.c_shipped
---- linux-4.1.3/scripts/dtc/dtc-parser.tab.c_shipped 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc-parser.tab.c_shipped 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/dtc-parser.tab.c_shipped linux-rpi/scripts/dtc/dtc-parser.tab.c_shipped
+--- linux-4.1.6/scripts/dtc/dtc-parser.tab.c_shipped 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc-parser.tab.c_shipped 2015-08-26 10:26:13.257378345 +0200
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
@@ -297374,9 +303717,9 @@ diff -Nur linux-4.1.3/scripts/dtc/dtc-parser.tab.c_shipped linux-xbian-rpi/scrip
- return c;
+ ERROR(&yylloc, "%s", s);
}
-diff -Nur linux-4.1.3/scripts/dtc/dtc-parser.tab.h_shipped linux-xbian-rpi/scripts/dtc/dtc-parser.tab.h_shipped
---- linux-4.1.3/scripts/dtc/dtc-parser.tab.h_shipped 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc-parser.tab.h_shipped 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/dtc-parser.tab.h_shipped linux-rpi/scripts/dtc/dtc-parser.tab.h_shipped
+--- linux-4.1.6/scripts/dtc/dtc-parser.tab.h_shipped 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc-parser.tab.h_shipped 2015-08-26 10:26:13.257378345 +0200
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
@@ -297548,9 +303891,9 @@ diff -Nur linux-4.1.3/scripts/dtc/dtc-parser.tab.h_shipped linux-xbian-rpi/scrip
-#endif /* ! YYPARSE_PARAM */
#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
-diff -Nur linux-4.1.3/scripts/dtc/dtc-parser.y linux-xbian-rpi/scripts/dtc/dtc-parser.y
---- linux-4.1.3/scripts/dtc/dtc-parser.y 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/dtc-parser.y 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/dtc-parser.y linux-rpi/scripts/dtc/dtc-parser.y
+--- linux-4.1.6/scripts/dtc/dtc-parser.y 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc-parser.y 2015-08-26 10:26:13.257378345 +0200
@@ -17,31 +17,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
@@ -297825,9 +304168,235 @@ diff -Nur linux-4.1.3/scripts/dtc/dtc-parser.y linux-xbian-rpi/scripts/dtc/dtc-p
- return c;
+ ERROR(&yylloc, "%s", s);
}
-diff -Nur linux-4.1.3/scripts/dtc/flattree.c linux-xbian-rpi/scripts/dtc/flattree.c
---- linux-4.1.3/scripts/dtc/flattree.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/flattree.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/dtc.c linux-rpi/scripts/dtc/dtc.c
+--- linux-4.1.6/scripts/dtc/dtc.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc.c 2015-08-26 10:26:13.257378345 +0200
+@@ -29,6 +29,7 @@
+ int minsize; /* Minimum blob size */
+ int padsize; /* Additional padding to blob */
+ int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
++int symbol_fixup_support = 0;
+
+ static void fill_fullpaths(struct node *tree, const char *prefix)
+ {
+@@ -48,8 +49,10 @@
+ }
+
+ /* Usage related data. */
++#define FDT_VERSION(version) _FDT_VERSION(version)
++#define _FDT_VERSION(version) #version
+ static const char usage_synopsis[] = "dtc [options] <input file>";
+-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
++static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
+ static struct option const usage_long_opts[] = {
+ {"quiet", no_argument, NULL, 'q'},
+ {"in-format", a_argument, NULL, 'I'},
+@@ -67,6 +70,7 @@
+ {"phandle", a_argument, NULL, 'H'},
+ {"warning", a_argument, NULL, 'W'},
+ {"error", a_argument, NULL, 'E'},
++ {"symbols", a_argument, NULL, '@'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'v'},
+ {NULL, no_argument, NULL, 0x0},
+@@ -82,9 +86,9 @@
+ "\t\tdts - device tree source text\n"
+ "\t\tdtb - device tree blob\n"
+ "\t\tasm - assembler source",
+- "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
++ "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
+ "\n\tOutput dependency file",
+- "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
++ "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
+ "\n\tMake the blob at least <bytes> long (extra space)",
+ "\n\tAdd padding to the blob of <bytes> long (extra space)",
+ "\n\tSet the physical boot cpu",
+@@ -97,6 +101,7 @@
+ "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
+ "\n\tEnable/disable warnings (prefix with \"no-\")",
+ "\n\tEnable/disable errors (prefix with \"no-\")",
++ "\n\tSymbols and Fixups support",
+ "\n\tPrint this help and exit",
+ "\n\tPrint version and exit",
+ NULL,
+@@ -109,7 +114,7 @@
+ const char *outform = "dts";
+ const char *outname = "-";
+ const char *depname = NULL;
+- int force = 0, sort = 0;
++ bool force = false, sort = false;
+ const char *arg;
+ int opt;
+ FILE *outf = NULL;
+@@ -148,7 +153,7 @@
+ padsize = strtol(optarg, NULL, 0);
+ break;
+ case 'f':
+- force = 1;
++ force = true;
+ break;
+ case 'q':
+ quiet++;
+@@ -174,7 +179,7 @@
+ break;
+
+ case 's':
+- sort = 1;
++ sort = true;
+ break;
+
+ case 'W':
+@@ -184,7 +189,9 @@
+ case 'E':
+ parse_checks_option(false, true, optarg);
+ break;
+-
++ case '@':
++ symbol_fixup_support = 1;
++ break;
+ case 'h':
+ usage(NULL);
+ default:
+@@ -237,7 +244,7 @@
+ if (streq(outname, "-")) {
+ outf = stdout;
+ } else {
+- outf = fopen(outname, "w");
++ outf = fopen(outname, "wb");
+ if (! outf)
+ die("Couldn't open output file %s: %s\n",
+ outname, strerror(errno));
+diff -Nur linux-4.1.6/scripts/dtc/dtc.h linux-rpi/scripts/dtc/dtc.h
+--- linux-4.1.6/scripts/dtc/dtc.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/dtc.h 2015-08-26 10:26:13.257378345 +0200
+@@ -38,9 +38,9 @@
+ #include "util.h"
+
+ #ifdef DEBUG
+-#define debug(fmt,args...) printf(fmt, ##args)
++#define debug(...) printf(__VA_ARGS__)
+ #else
+-#define debug(fmt,args...)
++#define debug(...)
+ #endif
+
+
+@@ -54,6 +54,7 @@
+ extern int minsize; /* Minimum blob size */
+ extern int padsize; /* Additional padding to blob */
+ extern int phandle_format; /* Use linux,phandle or phandle properties */
++extern int symbol_fixup_support;/* enable symbols & fixup support */
+
+ #define PHANDLE_LEGACY 0x1
+ #define PHANDLE_EPAPR 0x2
+@@ -88,7 +89,7 @@
+ };
+
+
+-#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
++#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
+
+ #define for_each_marker(m) \
+ for (; (m); (m) = (m)->next)
+@@ -118,7 +119,7 @@
+
+ struct data data_add_marker(struct data d, enum markertype type, char *ref);
+
+-int data_is_one_string(struct data d);
++bool data_is_one_string(struct data d);
+
+ /* DT constraints */
+
+@@ -127,13 +128,32 @@
+
+ /* Live trees */
+ struct label {
+- int deleted;
++ bool deleted;
+ char *label;
+ struct label *next;
+ };
+
++struct fixup_entry {
++ int offset;
++ struct node *node;
++ struct property *prop;
++ struct fixup_entry *next;
++};
++
++struct fixup {
++ char *ref;
++ struct fixup_entry *entries;
++ struct fixup *next;
++};
++
++struct symbol {
++ struct label *label;
++ struct node *node;
++ struct symbol *next;
++};
++
+ struct property {
+- int deleted;
++ bool deleted;
+ char *name;
+ struct data val;
+
+@@ -143,7 +163,7 @@
+ };
+
+ struct node {
+- int deleted;
++ bool deleted;
+ char *name;
+ struct property *proplist;
+ struct node *children;
+@@ -158,6 +178,12 @@
+ int addr_cells, size_cells;
+
+ struct label *labels;
++
++ int is_root;
++ int is_plugin;
++ struct fixup *fixups;
++ struct symbol *symbols;
++ struct fixup_entry *local_fixups;
+ };
+
+ #define for_each_label_withdel(l0, l) \
+@@ -181,6 +207,18 @@
+ for_each_child_withdel(n, c) \
+ if (!(c)->deleted)
+
++#define for_each_fixup(n, f) \
++ for ((f) = (n)->fixups; (f); (f) = (f)->next)
++
++#define for_each_fixup_entry(f, fe) \
++ for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
++
++#define for_each_symbol(n, s) \
++ for ((s) = (n)->symbols; (s); (s) = (s)->next)
++
++#define for_each_local_fixup_entry(n, fe) \
++ for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
++
+ void add_label(struct label **labels, char *label);
+ void delete_labels(struct label **labels);
+
+@@ -247,8 +285,8 @@
+
+ /* Checks */
+
+-void parse_checks_option(bool warn, bool error, const char *optarg);
+-void process_checks(int force, struct boot_info *bi);
++void parse_checks_option(bool warn, bool error, const char *arg);
++void process_checks(bool force, struct boot_info *bi);
+
+ /* Flattened trees */
+
+diff -Nur linux-4.1.6/scripts/dtc/flattree.c linux-rpi/scripts/dtc/flattree.c
+--- linux-4.1.6/scripts/dtc/flattree.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/flattree.c 2015-08-26 10:26:13.257378345 +0200
@@ -261,7 +261,13 @@
{
struct property *prop;
@@ -297995,9 +304564,9 @@ diff -Nur linux-4.1.3/scripts/dtc/flattree.c linux-xbian-rpi/scripts/dtc/flattre
emit->endnode(etarget, tree->labels);
}
-diff -Nur linux-4.1.3/scripts/dtc/fstree.c linux-xbian-rpi/scripts/dtc/fstree.c
---- linux-4.1.3/scripts/dtc/fstree.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/fstree.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/fstree.c linux-rpi/scripts/dtc/fstree.c
+--- linux-4.1.6/scripts/dtc/fstree.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/fstree.c 2015-08-26 10:26:13.257378345 +0200
@@ -37,26 +37,26 @@
tree = build_node(NULL, NULL);
@@ -298046,9 +304615,9 @@ diff -Nur linux-4.1.3/scripts/dtc/fstree.c linux-xbian-rpi/scripts/dtc/fstree.c
}
closedir(d);
-diff -Nur linux-4.1.3/scripts/dtc/livetree.c linux-xbian-rpi/scripts/dtc/livetree.c
---- linux-4.1.3/scripts/dtc/livetree.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/livetree.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/livetree.c linux-rpi/scripts/dtc/livetree.c
+--- linux-4.1.6/scripts/dtc/livetree.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/livetree.c 2015-08-26 10:26:13.257378345 +0200
@@ -511,7 +511,9 @@
struct node *get_node_by_ref(struct node *tree, const char *ref)
@@ -298060,9 +304629,9 @@ diff -Nur linux-4.1.3/scripts/dtc/livetree.c linux-xbian-rpi/scripts/dtc/livetre
return get_node_by_path(tree, ref);
else
return get_node_by_label(tree, ref);
-diff -Nur linux-4.1.3/scripts/dtc/srcpos.c linux-xbian-rpi/scripts/dtc/srcpos.c
---- linux-4.1.3/scripts/dtc/srcpos.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/srcpos.c 2015-07-28 01:20:58.461099590 +0200
+diff -Nur linux-4.1.6/scripts/dtc/srcpos.c linux-rpi/scripts/dtc/srcpos.c
+--- linux-4.1.6/scripts/dtc/srcpos.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/srcpos.c 2015-08-26 10:26:13.257378345 +0200
@@ -34,7 +34,7 @@
static struct search_path *search_path_head, **search_path_tail;
@@ -298163,9 +304732,9 @@ diff -Nur linux-4.1.3/scripts/dtc/srcpos.c linux-xbian-rpi/scripts/dtc/srcpos.c
va_end(va);
}
-diff -Nur linux-4.1.3/scripts/dtc/srcpos.h linux-xbian-rpi/scripts/dtc/srcpos.h
---- linux-4.1.3/scripts/dtc/srcpos.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/srcpos.h 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/dtc/srcpos.h linux-rpi/scripts/dtc/srcpos.h
+--- linux-4.1.6/scripts/dtc/srcpos.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/srcpos.h 2015-08-26 10:26:13.257378345 +0200
@@ -21,6 +21,7 @@
#define _SRCPOS_H_
@@ -298202,9 +304771,9 @@ diff -Nur linux-4.1.3/scripts/dtc/srcpos.h linux-xbian-rpi/scripts/dtc/srcpos.h
extern void srcpos_set_line(char *f, int l);
-diff -Nur linux-4.1.3/scripts/dtc/treesource.c linux-xbian-rpi/scripts/dtc/treesource.c
---- linux-4.1.3/scripts/dtc/treesource.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/treesource.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/dtc/treesource.c linux-rpi/scripts/dtc/treesource.c
+--- linux-4.1.6/scripts/dtc/treesource.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/treesource.c 2015-08-26 10:26:13.257378345 +0200
@@ -26,12 +26,12 @@
extern YYLTYPE yylloc;
@@ -298259,9 +304828,9 @@ diff -Nur linux-4.1.3/scripts/dtc/treesource.c linux-xbian-rpi/scripts/dtc/trees
if ((const void *)bp >= propend)
break;
fprintf(f, " ");
-diff -Nur linux-4.1.3/scripts/dtc/util.c linux-xbian-rpi/scripts/dtc/util.c
---- linux-4.1.3/scripts/dtc/util.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/util.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/dtc/util.c linux-rpi/scripts/dtc/util.c
+--- linux-4.1.6/scripts/dtc/util.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/util.c 2015-08-26 10:26:13.261378400 +0200
@@ -39,11 +39,11 @@
char *xstrdup(const char *s)
{
@@ -298318,9 +304887,9 @@ diff -Nur linux-4.1.3/scripts/dtc/util.c linux-xbian-rpi/scripts/dtc/util.c
printf(">");
} else {
printf(" = [");
-diff -Nur linux-4.1.3/scripts/dtc/util.h linux-xbian-rpi/scripts/dtc/util.h
---- linux-4.1.3/scripts/dtc/util.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/util.h 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/dtc/util.h linux-rpi/scripts/dtc/util.h
+--- linux-4.1.6/scripts/dtc/util.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/util.h 2015-08-26 10:26:13.261378400 +0200
@@ -2,6 +2,7 @@
#define _UTIL_H
@@ -298346,15 +304915,15 @@ diff -Nur linux-4.1.3/scripts/dtc/util.h linux-xbian-rpi/scripts/dtc/util.h
/*
* Parse an escaped character starting at index i in string s. The resulting
-diff -Nur linux-4.1.3/scripts/dtc/version_gen.h linux-xbian-rpi/scripts/dtc/version_gen.h
---- linux-4.1.3/scripts/dtc/version_gen.h 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/scripts/dtc/version_gen.h 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/dtc/version_gen.h linux-rpi/scripts/dtc/version_gen.h
+--- linux-4.1.6/scripts/dtc/version_gen.h 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/scripts/dtc/version_gen.h 2015-08-26 10:26:13.261378400 +0200
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.4.0-dirty"
+#define DTC_VERSION "DTC 1.4.1-g36c70742"
-diff -Nur linux-4.1.3/scripts/knlinfo linux-xbian-rpi/scripts/knlinfo
---- linux-4.1.3/scripts/knlinfo 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/scripts/knlinfo 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/knlinfo linux-rpi/scripts/knlinfo
+--- linux-4.1.6/scripts/knlinfo 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/scripts/knlinfo 2015-08-26 10:26:13.265378454 +0200
@@ -0,0 +1,168 @@
+#!/usr/bin/env perl
+# ----------------------------------------------------------------------
@@ -298524,9 +305093,9 @@ diff -Nur linux-4.1.3/scripts/knlinfo linux-xbian-rpi/scripts/knlinfo
+ my ($data) = @_;
+ return unpack('H*', $data);
+}
-diff -Nur linux-4.1.3/scripts/mkknlimg linux-xbian-rpi/scripts/mkknlimg
---- linux-4.1.3/scripts/mkknlimg 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/scripts/mkknlimg 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/scripts/mkknlimg linux-rpi/scripts/mkknlimg
+--- linux-4.1.6/scripts/mkknlimg 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/scripts/mkknlimg 2015-08-26 10:26:13.265378454 +0200
@@ -0,0 +1,275 @@
+#!/usr/bin/env perl
+# ----------------------------------------------------------------------
@@ -298803,524 +305372,38 @@ diff -Nur linux-4.1.3/scripts/mkknlimg linux-xbian-rpi/scripts/mkknlimg
+ my $val = $configs->{$wanted} || 'n';
+ return (($val eq 'y') || ($val eq '1'));
+}
-diff -Nur linux-4.1.3/sound/arm/bcm2835.c linux-xbian-rpi/sound/arm/bcm2835.c
---- linux-4.1.3/sound/arm/bcm2835.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/arm/bcm2835.c 2015-07-28 01:20:58.465085369 +0200
-@@ -0,0 +1,511 @@
-+/*****************************************************************************
-+* Copyright 2011 Broadcom Corporation. All rights reserved.
-+*
-+* Unless you and Broadcom execute a separate written software license
-+* agreement governing use of this software, this software is licensed to you
-+* under the terms of the GNU General Public License version 2, available at
-+* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
-+*
-+* Notwithstanding the above, under no circumstances may you combine this
-+* software in any way with any other Broadcom software provided under a
-+* license other than the GPL, without Broadcom's express prior written
-+* consent.
-+*****************************************************************************/
-+
-+#include <linux/platform_device.h>
-+
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include <linux/of.h>
-+
-+#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 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 snd_bcm2835_alsa_probe_dt(struct platform_device *pdev)
-+{
-+ struct device *dev = &pdev->dev;
-+ bcm2835_chip_t *chip;
-+ struct snd_card *card;
-+ u32 numchans;
-+ int err, i;
-+
-+ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels",
-+ &numchans);
-+ if (err) {
-+ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'");
-+ return err;
-+ }
-+
-+ if (numchans == 0 || numchans > MAX_SUBSTREAMS) {
-+ numchans = MAX_SUBSTREAMS;
-+ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n",
-+ numchans);
-+ }
-+
-+ err = snd_card_new(NULL, -1, NULL, THIS_MODULE, 0, &card);
-+ if (err) {
-+ dev_err(dev, "Failed to create soundcard structure\n");
-+ return err;
-+ }
-+
-+ snd_card_set_dev(card, dev);
-+ strcpy(card->driver, "bcm2835");
-+ strcpy(card->shortname, "bcm2835 ALSA");
-+ sprintf(card->longname, "%s", card->shortname);
-+
-+ err = snd_bcm2835_create(card, pdev, &chip);
-+ if (err < 0) {
-+ dev_err(dev, "Failed to create bcm2835 chip\n");
-+ goto err_free;
-+ }
-+
-+ err = snd_bcm2835_new_pcm(chip);
-+ if (err < 0) {
-+ dev_err(dev, "Failed to create new bcm2835 pcm device\n");
-+ goto err_free;
-+ }
-+
-+ err = snd_bcm2835_new_spdif_pcm(chip);
-+ if (err < 0) {
-+ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n");
-+ goto err_free;
-+ }
-+
-+ err = snd_bcm2835_new_ctl(chip);
-+ if (err < 0) {
-+ dev_err(dev, "Failed to create new bcm2835 ctl\n");
-+ goto err_free;
-+ }
-+
-+ for (i = 0; i < numchans; i++) {
-+ chip->avail_substreams |= (1 << i);
-+ chip->pdev[i] = pdev;
-+ }
-+
-+ err = snd_card_register(card);
-+ if (err) {
-+ dev_err(dev, "Failed to register bcm2835 ALSA card \n");
-+ goto err_free;
-+ }
-+
-+ g_card = card;
-+ g_chip = chip;
-+ platform_set_drvdata(pdev, card);
-+ audio_info("bcm2835 ALSA card created with %u channels\n", numchans);
-+
-+ return 0;
-+
-+err_free:
-+ snd_card_free(card);
-+
-+ return err;
-+}
-+
-+static int snd_bcm2835_alsa_probe(struct platform_device *pdev)
-+{
-+ static int dev;
-+ bcm2835_chip_t *chip;
-+ struct snd_card *card;
-+ int err;
-+
-+ if (pdev->dev.of_node)
-+ return snd_bcm2835_alsa_probe_dt(pdev);
-+
-+ if (dev >= MAX_SUBSTREAMS)
-+ return -ENODEV;
-+
-+ if (!enable[dev]) {
-+ dev++;
-+ return -ENOENT;
-+ }
-+
-+ if (dev > 0)
-+ goto add_register_map;
-+
-+ err = snd_card_new(NULL, 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, "bcm2835");
-+ strcpy(g_card->shortname, "bcm2835 ALSA");
-+ sprintf(g_card->longname, "%s", g_card->shortname);
-+
-+ err = snd_bcm2835_create(g_card, pdev, &chip);
-+ if (err < 0) {
-+ dev_err(&pdev->dev, "Failed to create bcm2835 chip\n");
-+ goto out_bcm2835_create;
-+ }
-+
-+ g_chip = chip;
-+ err = snd_bcm2835_new_pcm(chip);
-+ if (err < 0) {
-+ dev_err(&pdev->dev, "Failed to create new BCM2835 pcm device\n");
-+ goto out_bcm2835_new_pcm;
-+ }
-+
-+ err = snd_bcm2835_new_spdif_pcm(chip);
-+ if (err < 0) {
-+ dev_err(&pdev->dev, "Failed to create new BCM2835 spdif pcm device\n");
-+ goto out_bcm2835_new_spdif;
-+ }
-+
-+ err = snd_bcm2835_new_ctl(chip);
-+ if (err < 0) {
-+ dev_err(&pdev->dev, "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) {
-+ err = snd_card_register(card);
-+ if (err < 0) {
-+ dev_err(&pdev->dev,
-+ "Failed to register bcm2835 ALSA card \n");
-+ goto out_card_register;
-+ }
-+ platform_set_drvdata(pdev, card);
-+ audio_info("bcm2835 ALSA card created!\n");
-+ } else {
-+ audio_info("bcm2835 ALSA chip created!\n");
-+ platform_set_drvdata(pdev, (void *)dev);
-+ }
-+
-+ dev++;
-+
-+ return 0;
-+
-+out_card_register:
-+out_bcm2835_new_ctl:
-+out_bcm2835_new_spdif:
-+out_bcm2835_new_pcm:
-+out_bcm2835_create:
-+ BUG_ON(!g_card);
-+ if (snd_card_free(g_card))
-+ dev_err(&pdev->dev, "Failed to free Registered alsa card\n");
-+ g_card = NULL;
-+out:
-+ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */
-+ dev_err(&pdev->dev, "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 const struct of_device_id snd_bcm2835_of_match_table[] = {
-+ { .compatible = "brcm,bcm2835-audio", },
-+ {},
-+};
-+MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table);
-+
-+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,
-+ .of_match_table = snd_bcm2835_of_match_table,
-+ },
-+};
-+
-+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 bcm2835_alsa_device_init(void)
-+{
-+ int err;
-+ err = platform_driver_register(&bcm2835_alsa0_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto out;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa1_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_0;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa2_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_1;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa3_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_2;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa4_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_3;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa5_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_4;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa6_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_5;
-+ }
-+
-+ err = platform_driver_register(&bcm2835_alsa7_driver);
-+ if (err) {
-+ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-+ goto unregister_6;
-+ }
-+
-+ 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;
-+}
+diff -Nur linux-4.1.6/sound/arm/Kconfig linux-rpi/sound/arm/Kconfig
+--- linux-4.1.6/sound/arm/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/arm/Kconfig 2015-08-26 10:26:13.285378727 +0200
+@@ -39,5 +39,13 @@
+ 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 || ARCH_BCM2709 || ARCH_BCM2835) \
++ && BCM2708_VCHIQ && SND
++ select SND_PCM
++ help
++ Say Y or M if you want to support BCM2835 Alsa pcm card driver
+
-+static void 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);
-+}
+ endif # SND_ARM
+
+diff -Nur linux-4.1.6/sound/arm/Makefile linux-rpi/sound/arm/Makefile
+--- linux-4.1.6/sound/arm/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/arm/Makefile 2015-08-26 10:26:13.285378727 +0200
+@@ -14,3 +14,8 @@
+
+ obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o
+ snd-pxa2xx-ac97-objs := pxa2xx-ac97.o
+
-+late_initcall(bcm2835_alsa_device_init);
-+module_exit(bcm2835_alsa_device_exit);
++obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o
++snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o
+
-+MODULE_AUTHOR("Dom Cobley");
-+MODULE_DESCRIPTION("Alsa driver for BCM2835 chip");
-+MODULE_LICENSE("GPL");
-+MODULE_ALIAS("platform:bcm2835_alsa");
-diff -Nur linux-4.1.3/sound/arm/bcm2835-ctl.c linux-xbian-rpi/sound/arm/bcm2835-ctl.c
---- linux-4.1.3/sound/arm/bcm2835-ctl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/arm/bcm2835-ctl.c 2015-07-28 01:20:58.465085369 +0200
++ccflags-y += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000
+diff -Nur linux-4.1.6/sound/arm/bcm2835-ctl.c linux-rpi/sound/arm/bcm2835-ctl.c
+--- linux-4.1.6/sound/arm/bcm2835-ctl.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/arm/bcm2835-ctl.c 2015-08-26 10:26:13.285378727 +0200
@@ -0,0 +1,323 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -299645,180 +305728,9 @@ diff -Nur linux-4.1.3/sound/arm/bcm2835-ctl.c linux-xbian-rpi/sound/arm/bcm2835-
+ }
+ return 0;
+}
-diff -Nur linux-4.1.3/sound/arm/bcm2835.h linux-xbian-rpi/sound/arm/bcm2835.h
---- linux-4.1.3/sound/arm/bcm2835.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/arm/bcm2835.h 2015-07-28 01:20:58.465085369 +0200
-@@ -0,0 +1,167 @@
-+/*****************************************************************************
-+* 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
-+
-+#include <linux/device.h>
-+#include <linux/list.h>
-+#include <linux/interrupt.h>
-+#include <linux/wait.h>
-+#include <sound/core.h>
-+#include <sound/initval.h>
-+#include <sound/pcm.h>
-+#include <sound/pcm_params.h>
-+#include <sound/pcm-indirect.h>
-+#include <linux/workqueue.h>
-+
-+/*
-+#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...)
-+
-+#define audio_info(fmt, arg...)
-+
-+#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */
-+
-+#else
-+
-+#define audio_debug(fmt, arg...)
-+
-+#define audio_info(fmt, arg...)
-+
-+#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)
-+enum {
-+ CTRL_VOL_MUTE,
-+ CTRL_VOL_UNMUTE
-+};
-+
-+/* macros for alsa2chip and chip2alsa, instead of functions */
-+
-+#define alsa2chip(vol) (uint)(-((vol << 8) / 100)) /* convert alsa to chip volume (defined as macro rather than function call) */
-+#define chip2alsa(vol) -((vol * 100) >> 8) /* convert chip to alsa volume */
-+
-+/* 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;
-+
-+/* definition of the chip-specific record */
-+typedef struct bcm2835_chip {
-+ struct snd_card *card;
-+ struct snd_pcm *pcm;
-+ struct snd_pcm *pcm_spdif;
-+ /* 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 old_volume; /* stores the volume value whist muted */
-+ int dest;
-+ int mute;
-+
-+ unsigned int opened;
-+ unsigned int spdif_status;
-+ struct mutex audio_mutex;
-+} bcm2835_chip_t;
-+
-+typedef struct bcm2835_alsa_stream {
-+ bcm2835_chip_t *chip;
-+ struct snd_pcm_substream *substream;
-+ struct snd_pcm_indirect pcm_indirect;
-+
-+ 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;
-+
-+ int channels;
-+ int params_rate;
-+ int pcm_format_width;
-+
-+ 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);
-+int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip);
-+
-+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_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 -Nur linux-4.1.3/sound/arm/bcm2835-pcm.c linux-xbian-rpi/sound/arm/bcm2835-pcm.c
---- linux-4.1.3/sound/arm/bcm2835-pcm.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/arm/bcm2835-pcm.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/arm/bcm2835-pcm.c linux-rpi/sound/arm/bcm2835-pcm.c
+--- linux-4.1.6/sound/arm/bcm2835-pcm.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/arm/bcm2835-pcm.c 2015-08-26 10:26:13.285378727 +0200
@@ -0,0 +1,557 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -300377,9 +306289,9 @@ diff -Nur linux-4.1.3/sound/arm/bcm2835-pcm.c linux-xbian-rpi/sound/arm/bcm2835-
+
+ return 0;
+}
-diff -Nur linux-4.1.3/sound/arm/bcm2835-vchiq.c linux-xbian-rpi/sound/arm/bcm2835-vchiq.c
---- linux-4.1.3/sound/arm/bcm2835-vchiq.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/arm/bcm2835-vchiq.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/arm/bcm2835-vchiq.c linux-rpi/sound/arm/bcm2835-vchiq.c
+--- linux-4.1.6/sound/arm/bcm2835-vchiq.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/arm/bcm2835-vchiq.c 2015-08-26 10:26:13.285378727 +0200
@@ -0,0 +1,902 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -301283,38 +307195,695 @@ diff -Nur linux-4.1.3/sound/arm/bcm2835-vchiq.c linux-xbian-rpi/sound/arm/bcm283
+
+module_param(force_bulk, bool, 0444);
+MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio");
-diff -Nur linux-4.1.3/sound/arm/Kconfig linux-xbian-rpi/sound/arm/Kconfig
---- linux-4.1.3/sound/arm/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/arm/Kconfig 2015-07-28 01:20:58.465085369 +0200
-@@ -39,5 +39,13 @@
- 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 || ARCH_BCM2709 || ARCH_BCM2835) \
-+ && BCM2708_VCHIQ && SND
-+ select SND_PCM
-+ help
-+ Say Y or M if you want to support BCM2835 Alsa pcm card driver
+diff -Nur linux-4.1.6/sound/arm/bcm2835.c linux-rpi/sound/arm/bcm2835.c
+--- linux-4.1.6/sound/arm/bcm2835.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/arm/bcm2835.c 2015-08-26 10:26:13.285378727 +0200
+@@ -0,0 +1,511 @@
++/*****************************************************************************
++* 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 -Nur linux-4.1.3/sound/arm/Makefile linux-xbian-rpi/sound/arm/Makefile
---- linux-4.1.3/sound/arm/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/arm/Makefile 2015-07-28 01:20:58.465085369 +0200
-@@ -14,3 +14,8 @@
-
- obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o
- snd-pxa2xx-ac97-objs := pxa2xx-ac97.o
++#include <linux/platform_device.h>
+
-+obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o
-+snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/module.h>
++#include <linux/of.h>
+
-+ccflags-y += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000
-diff -Nur linux-4.1.3/sound/arm/vc_vchi_audioserv_defs.h linux-xbian-rpi/sound/arm/vc_vchi_audioserv_defs.h
---- linux-4.1.3/sound/arm/vc_vchi_audioserv_defs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/arm/vc_vchi_audioserv_defs.h 2015-07-28 01:20:58.465085369 +0200
++#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 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 snd_bcm2835_alsa_probe_dt(struct platform_device *pdev)
++{
++ struct device *dev = &pdev->dev;
++ bcm2835_chip_t *chip;
++ struct snd_card *card;
++ u32 numchans;
++ int err, i;
++
++ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels",
++ &numchans);
++ if (err) {
++ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'");
++ return err;
++ }
++
++ if (numchans == 0 || numchans > MAX_SUBSTREAMS) {
++ numchans = MAX_SUBSTREAMS;
++ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n",
++ numchans);
++ }
++
++ err = snd_card_new(NULL, -1, NULL, THIS_MODULE, 0, &card);
++ if (err) {
++ dev_err(dev, "Failed to create soundcard structure\n");
++ return err;
++ }
++
++ snd_card_set_dev(card, dev);
++ strcpy(card->driver, "bcm2835");
++ strcpy(card->shortname, "bcm2835 ALSA");
++ sprintf(card->longname, "%s", card->shortname);
++
++ err = snd_bcm2835_create(card, pdev, &chip);
++ if (err < 0) {
++ dev_err(dev, "Failed to create bcm2835 chip\n");
++ goto err_free;
++ }
++
++ err = snd_bcm2835_new_pcm(chip);
++ if (err < 0) {
++ dev_err(dev, "Failed to create new bcm2835 pcm device\n");
++ goto err_free;
++ }
++
++ err = snd_bcm2835_new_spdif_pcm(chip);
++ if (err < 0) {
++ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n");
++ goto err_free;
++ }
++
++ err = snd_bcm2835_new_ctl(chip);
++ if (err < 0) {
++ dev_err(dev, "Failed to create new bcm2835 ctl\n");
++ goto err_free;
++ }
++
++ for (i = 0; i < numchans; i++) {
++ chip->avail_substreams |= (1 << i);
++ chip->pdev[i] = pdev;
++ }
++
++ err = snd_card_register(card);
++ if (err) {
++ dev_err(dev, "Failed to register bcm2835 ALSA card \n");
++ goto err_free;
++ }
++
++ g_card = card;
++ g_chip = chip;
++ platform_set_drvdata(pdev, card);
++ audio_info("bcm2835 ALSA card created with %u channels\n", numchans);
++
++ return 0;
++
++err_free:
++ snd_card_free(card);
++
++ return err;
++}
++
++static int snd_bcm2835_alsa_probe(struct platform_device *pdev)
++{
++ static int dev;
++ bcm2835_chip_t *chip;
++ struct snd_card *card;
++ int err;
++
++ if (pdev->dev.of_node)
++ return snd_bcm2835_alsa_probe_dt(pdev);
++
++ if (dev >= MAX_SUBSTREAMS)
++ return -ENODEV;
++
++ if (!enable[dev]) {
++ dev++;
++ return -ENOENT;
++ }
++
++ if (dev > 0)
++ goto add_register_map;
++
++ err = snd_card_new(NULL, 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, "bcm2835");
++ strcpy(g_card->shortname, "bcm2835 ALSA");
++ sprintf(g_card->longname, "%s", g_card->shortname);
++
++ err = snd_bcm2835_create(g_card, pdev, &chip);
++ if (err < 0) {
++ dev_err(&pdev->dev, "Failed to create bcm2835 chip\n");
++ goto out_bcm2835_create;
++ }
++
++ g_chip = chip;
++ err = snd_bcm2835_new_pcm(chip);
++ if (err < 0) {
++ dev_err(&pdev->dev, "Failed to create new BCM2835 pcm device\n");
++ goto out_bcm2835_new_pcm;
++ }
++
++ err = snd_bcm2835_new_spdif_pcm(chip);
++ if (err < 0) {
++ dev_err(&pdev->dev, "Failed to create new BCM2835 spdif pcm device\n");
++ goto out_bcm2835_new_spdif;
++ }
++
++ err = snd_bcm2835_new_ctl(chip);
++ if (err < 0) {
++ dev_err(&pdev->dev, "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) {
++ err = snd_card_register(card);
++ if (err < 0) {
++ dev_err(&pdev->dev,
++ "Failed to register bcm2835 ALSA card \n");
++ goto out_card_register;
++ }
++ platform_set_drvdata(pdev, card);
++ audio_info("bcm2835 ALSA card created!\n");
++ } else {
++ audio_info("bcm2835 ALSA chip created!\n");
++ platform_set_drvdata(pdev, (void *)dev);
++ }
++
++ dev++;
++
++ return 0;
++
++out_card_register:
++out_bcm2835_new_ctl:
++out_bcm2835_new_spdif:
++out_bcm2835_new_pcm:
++out_bcm2835_create:
++ BUG_ON(!g_card);
++ if (snd_card_free(g_card))
++ dev_err(&pdev->dev, "Failed to free Registered alsa card\n");
++ g_card = NULL;
++out:
++ dev = SNDRV_CARDS; /* stop more avail_substreams from being probed */
++ dev_err(&pdev->dev, "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 const struct of_device_id snd_bcm2835_of_match_table[] = {
++ { .compatible = "brcm,bcm2835-audio", },
++ {},
++};
++MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table);
++
++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,
++ .of_match_table = snd_bcm2835_of_match_table,
++ },
++};
++
++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 bcm2835_alsa_device_init(void)
++{
++ int err;
++ err = platform_driver_register(&bcm2835_alsa0_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto out;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa1_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_0;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa2_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_1;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa3_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_2;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa4_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_3;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa5_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_4;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa6_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_5;
++ }
++
++ err = platform_driver_register(&bcm2835_alsa7_driver);
++ if (err) {
++ pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
++ goto unregister_6;
++ }
++
++ 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 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 -Nur linux-4.1.6/sound/arm/bcm2835.h linux-rpi/sound/arm/bcm2835.h
+--- linux-4.1.6/sound/arm/bcm2835.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/arm/bcm2835.h 2015-08-26 10:26:13.285378727 +0200
+@@ -0,0 +1,167 @@
++/*****************************************************************************
++* 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
++
++#include <linux/device.h>
++#include <linux/list.h>
++#include <linux/interrupt.h>
++#include <linux/wait.h>
++#include <sound/core.h>
++#include <sound/initval.h>
++#include <sound/pcm.h>
++#include <sound/pcm_params.h>
++#include <sound/pcm-indirect.h>
++#include <linux/workqueue.h>
++
++/*
++#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...)
++
++#define audio_info(fmt, arg...)
++
++#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */
++
++#else
++
++#define audio_debug(fmt, arg...)
++
++#define audio_info(fmt, arg...)
++
++#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)
++enum {
++ CTRL_VOL_MUTE,
++ CTRL_VOL_UNMUTE
++};
++
++/* macros for alsa2chip and chip2alsa, instead of functions */
++
++#define alsa2chip(vol) (uint)(-((vol << 8) / 100)) /* convert alsa to chip volume (defined as macro rather than function call) */
++#define chip2alsa(vol) -((vol * 100) >> 8) /* convert chip to alsa volume */
++
++/* 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;
++
++/* definition of the chip-specific record */
++typedef struct bcm2835_chip {
++ struct snd_card *card;
++ struct snd_pcm *pcm;
++ struct snd_pcm *pcm_spdif;
++ /* 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 old_volume; /* stores the volume value whist muted */
++ int dest;
++ int mute;
++
++ unsigned int opened;
++ unsigned int spdif_status;
++ struct mutex audio_mutex;
++} bcm2835_chip_t;
++
++typedef struct bcm2835_alsa_stream {
++ bcm2835_chip_t *chip;
++ struct snd_pcm_substream *substream;
++ struct snd_pcm_indirect pcm_indirect;
++
++ 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;
++
++ int channels;
++ int params_rate;
++ int pcm_format_width;
++
++ 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);
++int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip);
++
++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_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 -Nur linux-4.1.6/sound/arm/vc_vchi_audioserv_defs.h linux-rpi/sound/arm/vc_vchi_audioserv_defs.h
+--- linux-4.1.6/sound/arm/vc_vchi_audioserv_defs.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/arm/vc_vchi_audioserv_defs.h 2015-08-26 10:26:13.285378727 +0200
@@ -0,0 +1,116 @@
+/*****************************************************************************
+* Copyright 2011 Broadcom Corporation. All rights reserved.
@@ -301432,9 +308001,104 @@ diff -Nur linux-4.1.3/sound/arm/vc_vchi_audioserv_defs.h linux-xbian-rpi/sound/a
+} VC_AUDIO_MSG_T;
+
+#endif // _VC_AUDIO_DEFS_H_
-diff -Nur linux-4.1.3/sound/soc/bcm/bcm2708-i2s.c linux-xbian-rpi/sound/soc/bcm/bcm2708-i2s.c
---- linux-4.1.3/sound/soc/bcm/bcm2708-i2s.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/bcm2708-i2s.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/Kconfig linux-rpi/sound/soc/bcm/Kconfig
+--- linux-4.1.6/sound/soc/bcm/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/soc/bcm/Kconfig 2015-08-26 10:26:13.365379818 +0200
+@@ -7,3 +7,63 @@
+ Say Y or M if you want to add support for codecs attached to
+ the BCM2835 I2S interface. You will also need
+ to select the audio interfaces to support below.
++
++config SND_BCM2708_SOC_I2S
++ tristate "SoC Audio support for the Broadcom BCM2708 I2S module"
++ depends on MACH_BCM2708 || MACH_BCM2709
++ select REGMAP_MMIO
++ select SND_SOC_DMAENGINE_PCM
++ select SND_SOC_GENERIC_DMAENGINE_PCM
++ help
++ Say Y or M if you want to add support for codecs attached to
++ the BCM2708 I2S interface. You will also need
++ to select the audio interfaces to support below.
++
++config SND_BCM2708_SOC_HIFIBERRY_DAC
++ tristate "Support for HifiBerry DAC"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_PCM5102A
++ help
++ Say Y or M if you want to add support for HifiBerry DAC.
++
++config SND_BCM2708_SOC_HIFIBERRY_DACPLUS
++ tristate "Support for HifiBerry DAC+"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_PCM512x
++ help
++ Say Y or M if you want to add support for HifiBerry DAC+.
++
++config SND_BCM2708_SOC_HIFIBERRY_DIGI
++ tristate "Support for HifiBerry Digi"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_WM8804
++ help
++ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board.
++
++config SND_BCM2708_SOC_HIFIBERRY_AMP
++ tristate "Support for the HifiBerry Amp"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_TAS5713
++ help
++ Say Y or M if you want to add support for the HifiBerry Amp amplifier board.
++
++config SND_BCM2708_SOC_RPI_DAC
++ tristate "Support for RPi-DAC"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_PCM1794A
++ help
++ Say Y or M if you want to add support for RPi-DAC.
++
++config SND_BCM2708_SOC_RPI_PROTO
++ tristate "Support for Rpi-PROTO"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_WM8731
++ help
++ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731).
++
++config SND_BCM2708_SOC_IQAUDIO_DAC
++ tristate "Support for IQaudIO-DAC"
++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
++ select SND_SOC_PCM512x_I2C
++ help
++ Say Y or M if you want to add support for IQaudIO-DAC.
+diff -Nur linux-4.1.6/sound/soc/bcm/Makefile linux-rpi/sound/soc/bcm/Makefile
+--- linux-4.1.6/sound/soc/bcm/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/soc/bcm/Makefile 2015-08-26 10:26:13.365379818 +0200
+@@ -3,3 +3,24 @@
+
+ obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o
+
++# BCM2708 Platform Support
++snd-soc-bcm2708-i2s-objs := bcm2708-i2s.o
++
++obj-$(CONFIG_SND_BCM2708_SOC_I2S) += snd-soc-bcm2708-i2s.o
++
++# BCM2708 Machine Support
++snd-soc-hifiberry-dac-objs := hifiberry_dac.o
++snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o
++snd-soc-hifiberry-digi-objs := hifiberry_digi.o
++snd-soc-hifiberry-amp-objs := hifiberry_amp.o
++snd-soc-rpi-dac-objs := rpi-dac.o
++snd-soc-rpi-proto-objs := rpi-proto.o
++snd-soc-iqaudio-dac-objs := iqaudio-dac.o
++
++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o
++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o
++obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o
++obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o
++obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o
++obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o
+diff -Nur linux-4.1.6/sound/soc/bcm/bcm2708-i2s.c linux-rpi/sound/soc/bcm/bcm2708-i2s.c
+--- linux-4.1.6/sound/soc/bcm/bcm2708-i2s.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/bcm2708-i2s.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,1014 @@
+/*
+ * ALSA SoC I2S Audio Layer for Broadcom BCM2708 SoC
@@ -302450,9 +309114,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/bcm2708-i2s.c linux-xbian-rpi/sound/soc/bcm/
+MODULE_DESCRIPTION("BCM2708 I2S interface");
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/bcm2708-i2s.h linux-xbian-rpi/sound/soc/bcm/bcm2708-i2s.h
---- linux-4.1.3/sound/soc/bcm/bcm2708-i2s.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/bcm2708-i2s.h 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/bcm2708-i2s.h linux-rpi/sound/soc/bcm/bcm2708-i2s.h
+--- linux-4.1.6/sound/soc/bcm/bcm2708-i2s.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/bcm2708-i2s.h 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,35 @@
+/*
+ * I2S configuration for sound cards.
@@ -302489,9 +309153,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/bcm2708-i2s.h linux-xbian-rpi/sound/soc/bcm/
+extern void bcm2708_i2s_set_gpio(int gpio);
+
+#endif
-diff -Nur linux-4.1.3/sound/soc/bcm/bcm2835-i2s.c linux-xbian-rpi/sound/soc/bcm/bcm2835-i2s.c
---- linux-4.1.3/sound/soc/bcm/bcm2835-i2s.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/soc/bcm/bcm2835-i2s.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/bcm2835-i2s.c linux-rpi/sound/soc/bcm/bcm2835-i2s.c
+--- linux-4.1.6/sound/soc/bcm/bcm2835-i2s.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/soc/bcm/bcm2835-i2s.c 2015-08-26 10:26:13.365379818 +0200
@@ -861,6 +861,7 @@
{ .compatible = "brcm,bcm2835-i2s", },
{},
@@ -302500,9 +309164,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/bcm2835-i2s.c linux-xbian-rpi/sound/soc/bcm/
static struct platform_driver bcm2835_i2s_driver = {
.probe = bcm2835_i2s_probe,
-diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_amp.c linux-xbian-rpi/sound/soc/bcm/hifiberry_amp.c
---- linux-4.1.3/sound/soc/bcm/hifiberry_amp.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/hifiberry_amp.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/hifiberry_amp.c linux-rpi/sound/soc/bcm/hifiberry_amp.c
+--- linux-4.1.6/sound/soc/bcm/hifiberry_amp.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/hifiberry_amp.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,127 @@
+/*
+ * ASoC Driver for HifiBerry AMP
@@ -302631,9 +309295,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_amp.c linux-xbian-rpi/sound/soc/bc
+MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>");
+MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_dac.c linux-xbian-rpi/sound/soc/bcm/hifiberry_dac.c
---- linux-4.1.3/sound/soc/bcm/hifiberry_dac.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/hifiberry_dac.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/hifiberry_dac.c linux-rpi/sound/soc/bcm/hifiberry_dac.c
+--- linux-4.1.6/sound/soc/bcm/hifiberry_dac.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/hifiberry_dac.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,122 @@
+/*
+ * ASoC Driver for HifiBerry DAC
@@ -302757,9 +309421,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_dac.c linux-xbian-rpi/sound/soc/bc
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_dacplus.c linux-xbian-rpi/sound/soc/bcm/hifiberry_dacplus.c
---- linux-4.1.3/sound/soc/bcm/hifiberry_dacplus.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/hifiberry_dacplus.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/hifiberry_dacplus.c linux-rpi/sound/soc/bcm/hifiberry_dacplus.c
+--- linux-4.1.6/sound/soc/bcm/hifiberry_dacplus.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/hifiberry_dacplus.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,141 @@
+/*
+ * ASoC Driver for HiFiBerry DAC+
@@ -302902,9 +309566,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_dacplus.c linux-xbian-rpi/sound/so
+MODULE_AUTHOR("Daniel Matuschek <daniel@hifiberry.com>");
+MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_digi.c linux-xbian-rpi/sound/soc/bcm/hifiberry_digi.c
---- linux-4.1.3/sound/soc/bcm/hifiberry_digi.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/hifiberry_digi.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/hifiberry_digi.c linux-rpi/sound/soc/bcm/hifiberry_digi.c
+--- linux-4.1.6/sound/soc/bcm/hifiberry_digi.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/hifiberry_digi.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,223 @@
+/*
+ * ASoC Driver for HifiBerry Digi
@@ -303129,9 +309793,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/hifiberry_digi.c linux-xbian-rpi/sound/soc/b
+MODULE_AUTHOR("Daniel Matuschek <info@crazy-audio.com>");
+MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/iqaudio-dac.c linux-xbian-rpi/sound/soc/bcm/iqaudio-dac.c
---- linux-4.1.3/sound/soc/bcm/iqaudio-dac.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/iqaudio-dac.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/iqaudio-dac.c linux-rpi/sound/soc/bcm/iqaudio-dac.c
+--- linux-4.1.6/sound/soc/bcm/iqaudio-dac.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/iqaudio-dac.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,133 @@
+/*
+ * ASoC Driver for IQaudIO DAC
@@ -303266,104 +309930,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/iqaudio-dac.c linux-xbian-rpi/sound/soc/bcm/
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/Kconfig linux-xbian-rpi/sound/soc/bcm/Kconfig
---- linux-4.1.3/sound/soc/bcm/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/soc/bcm/Kconfig 2015-07-28 01:20:58.465085369 +0200
-@@ -7,3 +7,63 @@
- Say Y or M if you want to add support for codecs attached to
- the BCM2835 I2S interface. You will also need
- to select the audio interfaces to support below.
-+
-+config SND_BCM2708_SOC_I2S
-+ tristate "SoC Audio support for the Broadcom BCM2708 I2S module"
-+ depends on MACH_BCM2708 || MACH_BCM2709
-+ select REGMAP_MMIO
-+ select SND_SOC_DMAENGINE_PCM
-+ select SND_SOC_GENERIC_DMAENGINE_PCM
-+ help
-+ Say Y or M if you want to add support for codecs attached to
-+ the BCM2708 I2S interface. You will also need
-+ to select the audio interfaces to support below.
-+
-+config SND_BCM2708_SOC_HIFIBERRY_DAC
-+ tristate "Support for HifiBerry DAC"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_PCM5102A
-+ help
-+ Say Y or M if you want to add support for HifiBerry DAC.
-+
-+config SND_BCM2708_SOC_HIFIBERRY_DACPLUS
-+ tristate "Support for HifiBerry DAC+"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_PCM512x
-+ help
-+ Say Y or M if you want to add support for HifiBerry DAC+.
-+
-+config SND_BCM2708_SOC_HIFIBERRY_DIGI
-+ tristate "Support for HifiBerry Digi"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_WM8804
-+ help
-+ Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board.
-+
-+config SND_BCM2708_SOC_HIFIBERRY_AMP
-+ tristate "Support for the HifiBerry Amp"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_TAS5713
-+ help
-+ Say Y or M if you want to add support for the HifiBerry Amp amplifier board.
-+
-+config SND_BCM2708_SOC_RPI_DAC
-+ tristate "Support for RPi-DAC"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_PCM1794A
-+ help
-+ Say Y or M if you want to add support for RPi-DAC.
-+
-+config SND_BCM2708_SOC_RPI_PROTO
-+ tristate "Support for Rpi-PROTO"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_WM8731
-+ help
-+ Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731).
-+
-+config SND_BCM2708_SOC_IQAUDIO_DAC
-+ tristate "Support for IQaudIO-DAC"
-+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
-+ select SND_SOC_PCM512x_I2C
-+ help
-+ Say Y or M if you want to add support for IQaudIO-DAC.
-diff -Nur linux-4.1.3/sound/soc/bcm/Makefile linux-xbian-rpi/sound/soc/bcm/Makefile
---- linux-4.1.3/sound/soc/bcm/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/soc/bcm/Makefile 2015-07-28 01:20:58.465085369 +0200
-@@ -3,3 +3,24 @@
-
- obj-$(CONFIG_SND_BCM2835_SOC_I2S) += snd-soc-bcm2835-i2s.o
-
-+# BCM2708 Platform Support
-+snd-soc-bcm2708-i2s-objs := bcm2708-i2s.o
-+
-+obj-$(CONFIG_SND_BCM2708_SOC_I2S) += snd-soc-bcm2708-i2s.o
-+
-+# BCM2708 Machine Support
-+snd-soc-hifiberry-dac-objs := hifiberry_dac.o
-+snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o
-+snd-soc-hifiberry-digi-objs := hifiberry_digi.o
-+snd-soc-hifiberry-amp-objs := hifiberry_amp.o
-+snd-soc-rpi-dac-objs := rpi-dac.o
-+snd-soc-rpi-proto-objs := rpi-proto.o
-+snd-soc-iqaudio-dac-objs := iqaudio-dac.o
-+
-+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o
-+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
-+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o
-+obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o
-+obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o
-+obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o
-+obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o
-diff -Nur linux-4.1.3/sound/soc/bcm/rpi-dac.c linux-xbian-rpi/sound/soc/bcm/rpi-dac.c
---- linux-4.1.3/sound/soc/bcm/rpi-dac.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/rpi-dac.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/rpi-dac.c linux-rpi/sound/soc/bcm/rpi-dac.c
+--- linux-4.1.6/sound/soc/bcm/rpi-dac.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/rpi-dac.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,118 @@
+/*
+ * ASoC Driver for RPi-DAC.
@@ -303483,9 +310052,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/rpi-dac.c linux-xbian-rpi/sound/soc/bcm/rpi-
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_DESCRIPTION("ASoC Driver for RPi-DAC");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/bcm/rpi-proto.c linux-xbian-rpi/sound/soc/bcm/rpi-proto.c
---- linux-4.1.3/sound/soc/bcm/rpi-proto.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/bcm/rpi-proto.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/bcm/rpi-proto.c linux-rpi/sound/soc/bcm/rpi-proto.c
+--- linux-4.1.6/sound/soc/bcm/rpi-proto.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/bcm/rpi-proto.c 2015-08-26 10:26:13.365379818 +0200
@@ -0,0 +1,153 @@
+/*
+ * ASoC driver for PROTO AudioCODEC (with a WM8731)
@@ -303640,9 +310209,9 @@ diff -Nur linux-4.1.3/sound/soc/bcm/rpi-proto.c linux-xbian-rpi/sound/soc/bcm/rp
+MODULE_AUTHOR("Florian Meier");
+MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)");
+MODULE_LICENSE("GPL");
-diff -Nur linux-4.1.3/sound/soc/codecs/Kconfig linux-xbian-rpi/sound/soc/codecs/Kconfig
---- linux-4.1.3/sound/soc/codecs/Kconfig 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/soc/codecs/Kconfig 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/Kconfig linux-rpi/sound/soc/codecs/Kconfig
+--- linux-4.1.6/sound/soc/codecs/Kconfig 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/soc/codecs/Kconfig 2015-08-26 10:26:13.365379818 +0200
@@ -83,6 +83,8 @@
select SND_SOC_PCM512x_I2C if I2C
select SND_SOC_PCM512x_SPI if SPI_MASTER
@@ -303683,9 +310252,9 @@ diff -Nur linux-4.1.3/sound/soc/codecs/Kconfig linux-xbian-rpi/sound/soc/codecs/
config SND_SOC_TLV320AIC23
tristate
-diff -Nur linux-4.1.3/sound/soc/codecs/Makefile linux-xbian-rpi/sound/soc/codecs/Makefile
---- linux-4.1.3/sound/soc/codecs/Makefile 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/soc/codecs/Makefile 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/Makefile linux-rpi/sound/soc/codecs/Makefile
+--- linux-4.1.6/sound/soc/codecs/Makefile 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/soc/codecs/Makefile 2015-08-26 10:26:13.365379818 +0200
@@ -78,6 +78,8 @@
snd-soc-pcm512x-spi-objs := pcm512x-spi.o
snd-soc-rl6231-objs := rl6231.o
@@ -303720,9 +310289,9 @@ diff -Nur linux-4.1.3/sound/soc/codecs/Makefile linux-xbian-rpi/sound/soc/codecs
obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o
obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o
obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
-diff -Nur linux-4.1.3/sound/soc/codecs/pcm1794a.c linux-xbian-rpi/sound/soc/codecs/pcm1794a.c
---- linux-4.1.3/sound/soc/codecs/pcm1794a.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/codecs/pcm1794a.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/pcm1794a.c linux-rpi/sound/soc/codecs/pcm1794a.c
+--- linux-4.1.6/sound/soc/codecs/pcm1794a.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/codecs/pcm1794a.c 2015-08-26 10:26:13.377379983 +0200
@@ -0,0 +1,69 @@
+/*
+ * Driver for the PCM1794A codec
@@ -303793,9 +310362,9 @@ diff -Nur linux-4.1.3/sound/soc/codecs/pcm1794a.c linux-xbian-rpi/sound/soc/code
+MODULE_DESCRIPTION("ASoC PCM1794A codec driver");
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/codecs/pcm5102a.c linux-xbian-rpi/sound/soc/codecs/pcm5102a.c
---- linux-4.1.3/sound/soc/codecs/pcm5102a.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/codecs/pcm5102a.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/pcm5102a.c linux-rpi/sound/soc/codecs/pcm5102a.c
+--- linux-4.1.6/sound/soc/codecs/pcm5102a.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/codecs/pcm5102a.c 2015-08-26 10:26:13.377379983 +0200
@@ -0,0 +1,70 @@
+/*
+ * Driver for the PCM5102A codec
@@ -303867,9 +310436,9 @@ diff -Nur linux-4.1.3/sound/soc/codecs/pcm5102a.c linux-xbian-rpi/sound/soc/code
+MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
+MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/codecs/tas5713.c linux-xbian-rpi/sound/soc/codecs/tas5713.c
---- linux-4.1.3/sound/soc/codecs/tas5713.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/codecs/tas5713.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/tas5713.c linux-rpi/sound/soc/codecs/tas5713.c
+--- linux-4.1.6/sound/soc/codecs/tas5713.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/codecs/tas5713.c 2015-08-26 10:26:13.385380091 +0200
@@ -0,0 +1,369 @@
+/*
+ * ASoC Driver for TAS5713
@@ -304240,9 +310809,9 @@ diff -Nur linux-4.1.3/sound/soc/codecs/tas5713.c linux-xbian-rpi/sound/soc/codec
+MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>");
+MODULE_DESCRIPTION("ASoC driver for TAS5713");
+MODULE_LICENSE("GPL v2");
-diff -Nur linux-4.1.3/sound/soc/codecs/tas5713.h linux-xbian-rpi/sound/soc/codecs/tas5713.h
---- linux-4.1.3/sound/soc/codecs/tas5713.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-xbian-rpi/sound/soc/codecs/tas5713.h 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/tas5713.h linux-rpi/sound/soc/codecs/tas5713.h
+--- linux-4.1.6/sound/soc/codecs/tas5713.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-rpi/sound/soc/codecs/tas5713.h 2015-08-26 10:26:13.385380091 +0200
@@ -0,0 +1,210 @@
+/*
+ * ASoC Driver for TAS5713
@@ -304454,9 +311023,9 @@ diff -Nur linux-4.1.3/sound/soc/codecs/tas5713.h linux-xbian-rpi/sound/soc/codec
+
+
+#endif /* _TAS5713_H */
-diff -Nur linux-4.1.3/sound/soc/codecs/wm8804.c linux-xbian-rpi/sound/soc/codecs/wm8804.c
---- linux-4.1.3/sound/soc/codecs/wm8804.c 2015-07-21 19:10:33.000000000 +0200
-+++ linux-xbian-rpi/sound/soc/codecs/wm8804.c 2015-07-28 01:20:58.465085369 +0200
+diff -Nur linux-4.1.6/sound/soc/codecs/wm8804.c linux-rpi/sound/soc/codecs/wm8804.c
+--- linux-4.1.6/sound/soc/codecs/wm8804.c 2015-08-17 05:52:51.000000000 +0200
++++ linux-rpi/sound/soc/codecs/wm8804.c 2015-08-26 10:26:13.393380200 +0200
@@ -304,6 +304,7 @@
blen = 0x1;
break;